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;
/* 0x40 */ u8 curPosX;
/* 0x41 */ char unk_41;
/* 0x42 */ u16 nextPos[2];
/* 0x42 */ s16 nextPos[2];
/* 0x46 */ s16 textStartPos[2]; // relative to textbox
/* 0x4A */ s16 textColor;
/* 0x4C */ u8* printBuffer;

View File

@ -142,7 +142,7 @@ def main(args):
sizes, vrams = get_func_info()
total_size = sum(sizes.values())
# 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
all_funcs = set(sizes.keys())

View File

@ -226,7 +226,7 @@ void draw_message_window(MessagePrintState* printer) {
#define MSG_EPILOGUE_TEXT_Y -2
#endif
#if VERSION_IQUE || VERSION_PAL
#if VERSION_PAL
INCLUDE_ASM(s32, "msg_draw", appendGfx_message);
#else
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;
u16 spB6;
u8 spB8;
#if VERSION_IQUE
u16 byte = 0;
#endif
f32 windowScaleX;
MessageCharset* msgCharset;
f32 temp_f10;
@ -368,7 +371,18 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
msg_drawState->drawBufferPos = 0;
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:
msg_drawState->nextPos[0] = 0;
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:
switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) {
case MSG_STYLE_RIGHT:
#if VERSION_IQUE
msg_drawState->nextPos[1] += 5;
#endif
case MSG_STYLE_LEFT:
case MSG_STYLE_CENTER:
case MSG_STYLE_TATTLE:
@ -691,6 +708,9 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
printer->windowBasePos.y = 28;
printer->windowSize.x = MSG_SIGN_WIDTH;
msg_drawState->framePalette = 15;
#if VERSION_IQUE
msg_drawState->nextPos[1] -= 2;
#endif
temp_s1_5 = 0xFF;
if (printer->style == MSG_STYLE_SIGN) {
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;
} else {
signRaster = ui_msg_lamppost_corner_bottomright_png;
msg_drawState->textColor = MSG_PAL_1C;
signPalette = ui_msg_lamppost_pal;
msg_drawState->textColor = MSG_PAL_1C;
}
msg_drawState->clipX[0] = 20 + MSG_SIGN_OFFSET_X + 14;
msg_drawState->clipY[0] = 40;
@ -731,7 +751,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
28, 10, 10, 310, 230, temp_s1_5);
draw_ci_image_with_clipping(ui_msg_sign_corner_topright_png, 16, 16, G_IM_FMT_CI, G_IM_SIZ_4b, signPalette, 284 - MSG_SIGN_OFFSET_X,
28, 10, 10, 310, 230, temp_s1_5);
draw_ci_image_with_clipping(ui_msg_sign_corner_bottomleft_png, 16, 16, G_IM_FMT_CI, G_IM_SIZ_4b, signPalette, 20 + MSG_SIGN_OFFSET_X,
draw_ci_image_with_clipping(ui_msg_sign_corner_bottomleft_png, 16, 16, G_IM_FMT_CI, G_IM_SIZ_4b, signPalette, 20 + MSG_SIGN_OFFSET_X,
printer->windowSize.y + 12, 10, 10, 310, 230, temp_s1_5);
draw_ci_image_with_clipping(signRaster, 16, 16, G_IM_FMT_CI, G_IM_SIZ_4b, signPalette, 284 - MSG_SIGN_OFFSET_X, printer->windowSize.y + 12,
10, 10, 310, 230, temp_s1_5);
@ -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->drawBufferPos += 2;
break;
#if !VERSION_IQUE
case MSG_PRINT_FUNC_SIZE:
packedScaleX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
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++;
gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
break;
#endif
case MSG_PRINT_FUNC_SET_X:
msg_drawState->nextPos[0] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] * 256 +
(msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2]);
@ -1245,6 +1267,13 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
}
break;
default:
#if VERSION_IQUE
if (lastbyte >= 0x5f && lastbyte <= 0x8f) {
msg_drawState->drawBufferPos++;
break;
}
#endif
if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) {
sp96 = 0xFF;
gDPPipeSync(gMainGfxPos++);
@ -1453,9 +1482,11 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
case MSG_PAL_13:
case MSG_PAL_14:
break;
#if !VERSION_IQUE
case MSG_PAL_STANDARD:
palette = MSG_PAL_40;
break;
#endif
case MSG_PAL_20:
palette = MSG_PAL_41;
break;
@ -1482,12 +1513,29 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMainGfxPos++, PM_CC_07, PM_CC_07);
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_drawState->printBuffer[msg_drawState->drawBufferPos],
palette, charPosX + 2, charPosY + 2);
#endif
gDPPipeSync(gMainGfxPos++);
gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
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);
gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
}
}
if (msg_drawState->effectFlags & MSG_FX_FLAG_BLUR) {
@ -1500,14 +1548,38 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
if (spB8 != 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_drawState->printBuffer[msg_drawState->drawBufferPos], palette,
phi_s0_7, phi_s1_8);
#endif
}
} 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_drawState->printBuffer[msg_drawState->drawBufferPos], palette, charPosX,
charPosY);
#endif
}
}
}
@ -1516,9 +1588,13 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit
}
msg_drawState->visiblePrintedCount += 1;
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_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x,
msg_drawState->curPosX, msg_drawState->printModeFlags);
#endif
msg_drawState->drawBufferPos++;
break;
}

File diff suppressed because it is too large Load Diff