iQue appendGfx_message (#1167)

* iQue appendGfx_message

* i forgot constant name

* update progress.py

this should 100% by now :)
This commit is contained in:
AltoXorg 2024-02-06 20:32:33 +08:00 committed by GitHub
parent 1ad6a2145e
commit 6a2ad7e1b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 84 additions and 4942 deletions

View File

@ -1292,7 +1292,7 @@ typedef struct MessageDrawState {
/* 0x3E */ u16 fontVariant; /* 0x3E */ u16 fontVariant;
/* 0x40 */ u8 curPosX; /* 0x40 */ u8 curPosX;
/* 0x41 */ char unk_41; /* 0x41 */ char unk_41;
/* 0x42 */ u16 nextPos[2]; /* 0x42 */ s16 nextPos[2];
/* 0x46 */ s16 textStartPos[2]; // relative to textbox /* 0x46 */ s16 textStartPos[2]; // relative to textbox
/* 0x4A */ s16 textColor; /* 0x4A */ s16 textColor;
/* 0x4C */ u8* printBuffer; /* 0x4C */ u8* printBuffer;

View File

@ -142,7 +142,7 @@ def main(args):
sizes, vrams = get_func_info() sizes, vrams = get_func_info()
total_size = sum(sizes.values()) total_size = sum(sizes.values())
# TODO hack for now since non-us roms aren't mapped out # TODO hack for now since non-us roms aren't mapped out
if args.version != "us": if args.version not in ("us", "ique"):
total_size = 3718612 total_size = 3718612
all_funcs = set(sizes.keys()) all_funcs = set(sizes.keys())

View File

@ -226,7 +226,7 @@ void draw_message_window(MessagePrintState* printer) {
#define MSG_EPILOGUE_TEXT_Y -2 #define MSG_EPILOGUE_TEXT_Y -2
#endif #endif
#if VERSION_IQUE || VERSION_PAL #if VERSION_PAL
INCLUDE_ASM(s32, "msg_draw", appendGfx_message); INCLUDE_ASM(s32, "msg_draw", appendGfx_message);
#else #else
void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 additionalOffsetX, u16 additionalOffsetY, void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 additionalOffsetX, u16 additionalOffsetY,
@ -240,6 +240,9 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
s16 spAE; s16 spAE;
u16 spB6; u16 spB6;
u8 spB8; u8 spB8;
#if VERSION_IQUE
u16 byte = 0;
#endif
f32 windowScaleX; f32 windowScaleX;
MessageCharset* msgCharset; MessageCharset* msgCharset;
f32 temp_f10; f32 temp_f10;
@ -368,7 +371,18 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
msg_drawState->drawBufferPos = 0; msg_drawState->drawBufferPos = 0;
while (!sp80bool) { while (!sp80bool) {
switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos]) { #if VERSION_IQUE
u16 lastbyte, glyph_index, byte2;
lastbyte = byte;
byte = msg_drawState->printBuffer[msg_drawState->drawBufferPos];
byte2 = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
switch (byte)
#else
switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos])
#endif
{
case MSG_CHAR_PRINT_ENDL: case MSG_CHAR_PRINT_ENDL:
msg_drawState->nextPos[0] = 0; msg_drawState->nextPos[0] = 0;
msg_drawState->nextPos[1] += (s32)((msg_drawState->msgScale.y * MsgCharsets[msg_drawState->font]->newLineY) msg_drawState->nextPos[1] += (s32)((msg_drawState->msgScale.y * MsgCharsets[msg_drawState->font]->newLineY)
@ -402,6 +416,9 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
case MSG_CHAR_PRINT_STYLE: case MSG_CHAR_PRINT_STYLE:
switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) { switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) {
case MSG_STYLE_RIGHT: case MSG_STYLE_RIGHT:
#if VERSION_IQUE
msg_drawState->nextPos[1] += 5;
#endif
case MSG_STYLE_LEFT: case MSG_STYLE_LEFT:
case MSG_STYLE_CENTER: case MSG_STYLE_CENTER:
case MSG_STYLE_TATTLE: case MSG_STYLE_TATTLE:
@ -691,6 +708,9 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
printer->windowBasePos.y = 28; printer->windowBasePos.y = 28;
printer->windowSize.x = MSG_SIGN_WIDTH; printer->windowSize.x = MSG_SIGN_WIDTH;
msg_drawState->framePalette = 15; msg_drawState->framePalette = 15;
#if VERSION_IQUE
msg_drawState->nextPos[1] -= 2;
#endif
temp_s1_5 = 0xFF; temp_s1_5 = 0xFF;
if (printer->style == MSG_STYLE_SIGN) { if (printer->style == MSG_STYLE_SIGN) {
signRaster = ui_msg_sign_corner_bottomright_png; signRaster = ui_msg_sign_corner_bottomright_png;
@ -699,8 +719,8 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
signPalette = ui_msg_sign_pal; signPalette = ui_msg_sign_pal;
} else { } else {
signRaster = ui_msg_lamppost_corner_bottomright_png; signRaster = ui_msg_lamppost_corner_bottomright_png;
msg_drawState->textColor = MSG_PAL_1C;
signPalette = ui_msg_lamppost_pal; signPalette = ui_msg_lamppost_pal;
msg_drawState->textColor = MSG_PAL_1C;
} }
msg_drawState->clipX[0] = 20 + MSG_SIGN_OFFSET_X + 14; msg_drawState->clipX[0] = 20 + MSG_SIGN_OFFSET_X + 14;
msg_drawState->clipY[0] = 40; msg_drawState->clipY[0] = 40;
@ -902,6 +922,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
msg_drawState->curPosX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]; msg_drawState->curPosX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
msg_drawState->drawBufferPos += 2; msg_drawState->drawBufferPos += 2;
break; break;
#if !VERSION_IQUE
case MSG_PRINT_FUNC_SIZE: case MSG_PRINT_FUNC_SIZE:
packedScaleX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]; packedScaleX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
msg_drawState->msgScale.x = (f32)(packedScaleX >> 4) + ((packedScaleX & 0xF) * 0.0625f); msg_drawState->msgScale.x = (f32)(packedScaleX >> 4) + ((packedScaleX & 0xF) * 0.0625f);
@ -920,6 +941,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
msg_drawState->drawBufferPos++; msg_drawState->drawBufferPos++;
gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE); gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
break; break;
#endif
case MSG_PRINT_FUNC_SET_X: case MSG_PRINT_FUNC_SET_X:
msg_drawState->nextPos[0] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] * 256 + msg_drawState->nextPos[0] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] * 256 +
(msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2]); (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2]);
@ -1245,6 +1267,13 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
} }
break; break;
default: default:
#if VERSION_IQUE
if (lastbyte >= 0x5f && lastbyte <= 0x8f) {
msg_drawState->drawBufferPos++;
break;
}
#endif
if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) { if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) {
sp96 = 0xFF; sp96 = 0xFF;
gDPPipeSync(gMainGfxPos++); gDPPipeSync(gMainGfxPos++);
@ -1453,9 +1482,11 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
case MSG_PAL_13: case MSG_PAL_13:
case MSG_PAL_14: case MSG_PAL_14:
break; break;
#if !VERSION_IQUE
case MSG_PAL_STANDARD: case MSG_PAL_STANDARD:
palette = MSG_PAL_40; palette = MSG_PAL_40;
break; break;
#endif
case MSG_PAL_20: case MSG_PAL_20:
palette = MSG_PAL_41; palette = MSG_PAL_41;
break; break;
@ -1482,13 +1513,30 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMainGfxPos++, PM_CC_07, PM_CC_07); gDPSetCombineMode(gMainGfxPos++, PM_CC_07, PM_CC_07);
gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, 72); gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, 72);
#if VERSION_IQUE
if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
glyph_index = (MSG_CHAR_ZH_START - MSG_CHAR_MULTIBYTE_FIRST) + byte + (byte2 - 1)
* (MSG_CHAR_MULTIBYTE_LAST - MSG_CHAR_MULTIBYTE_FIRST + 1);
msg_draw_char(printer, msg_drawState, glyph_index,
palette, charPosX + 2, charPosY + 2);
} else {
msg_draw_char(printer, msg_drawState, byte,
palette, charPosX + 2, charPosY + 2);
}
#else
msg_draw_char(printer, msg_drawState, msg_draw_char(printer, msg_drawState,
msg_drawState->printBuffer[msg_drawState->drawBufferPos], msg_drawState->printBuffer[msg_drawState->drawBufferPos],
palette, charPosX + 2, charPosY + 2); palette, charPosX + 2, charPosY + 2);
#endif
gDPPipeSync(gMainGfxPos++); gDPPipeSync(gMainGfxPos++);
if (phi_s2_5 < 0xFF) {
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMainGfxPos++, PM_CC_02, PM_CC_02);
} else {
gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2); gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA); gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
} }
}
if (msg_drawState->effectFlags & MSG_FX_FLAG_BLUR) { if (msg_drawState->effectFlags & MSG_FX_FLAG_BLUR) {
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
@ -1500,14 +1548,38 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
if (spB8 != 1) { if (spB8 != 1) {
phi_s1_8 += (rand_int(10000) % 3) - 1; phi_s1_8 += (rand_int(10000) % 3) - 1;
} }
#if VERSION_IQUE
if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
glyph_index = (MSG_CHAR_ZH_START - MSG_CHAR_MULTIBYTE_FIRST) + byte + (byte2 - 1)
* (MSG_CHAR_MULTIBYTE_LAST - MSG_CHAR_MULTIBYTE_FIRST + 1);
msg_draw_char(printer, msg_drawState, glyph_index,
palette, charPosX + 2, charPosY + 2);
} else {
msg_draw_char(printer, msg_drawState, byte,
palette, charPosX + 2, charPosY + 2);
}
#else
msg_draw_char(printer, msg_drawState, msg_draw_char(printer, msg_drawState,
msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette, msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette,
phi_s0_7, phi_s1_8); phi_s0_7, phi_s1_8);
#endif
} }
} else { } else {
#if VERSION_IQUE
if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
glyph_index = (MSG_CHAR_ZH_START - MSG_CHAR_MULTIBYTE_FIRST) + byte + (byte2 - 1)
* (MSG_CHAR_MULTIBYTE_LAST - MSG_CHAR_MULTIBYTE_FIRST + 1);
msg_draw_char(printer, msg_drawState, glyph_index,
palette, charPosX + 2, charPosY + 2);
} else {
msg_draw_char(printer, msg_drawState, byte,
palette, charPosX + 2, charPosY + 2);
}
#else
msg_draw_char(printer, msg_drawState, msg_draw_char(printer, msg_drawState,
msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette, charPosX, msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette, charPosX,
charPosY); charPosY);
#endif
} }
} }
} }
@ -1516,9 +1588,13 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
} }
msg_drawState->visiblePrintedCount += 1; msg_drawState->visiblePrintedCount += 1;
msg_drawState->nextPos[0] += msg_drawState->nextPos[0] +=
#if VERSION_IQUE
msg_drawState->msgScale.x * 14.0f;
#else
msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos], msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos],
msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x, msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x,
msg_drawState->curPosX, msg_drawState->printModeFlags); msg_drawState->curPosX, msg_drawState->printModeFlags);
#endif
msg_drawState->drawBufferPos++; msg_drawState->drawBufferPos++;
break; break;
} }

File diff suppressed because it is too large Load Diff