From 24d5f9cfaff220d9d1b292e386a18f883474b1e3 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Fri, 22 Dec 2023 14:18:26 -0600 Subject: [PATCH] Do initial cleanup of window code --- config/GMPE01_00/symbols.txt | 12 +- include/game/window.h | 136 +++--- src/game/window.c | 923 ++++++++++++++++++----------------- 3 files changed, 535 insertions(+), 536 deletions(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 8162dbd0..338fb54d 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -6187,13 +6187,13 @@ winTabSize = .sbss:0x801D3DC9; // type:object size:0x1 scope:local data:byte mesWInsert = .sbss:0x801D3DCA; // type:object size:0x8 scope:local winMaxHeight = .sbss:0x801D3DD2; // type:object size:0x2 scope:local data:2byte winMaxWidth = .sbss:0x801D3DD4; // type:object size:0x2 scope:local data:2byte -messDataNo = .sbss:0x801D3DD8; // type:object size:0x4 data:4byte +messDataNo = .sbss:0x801D3DD8; // type:object size:0x4 scope:local data:4byte messDataPtr = .sbss:0x801D3DDC; // type:object size:0x4 data:4byte -winProc = .sbss:0x801D3DE0; // type:object size:0x4 data:4byte -cardAnimB = .sbss:0x801D3DE4; // type:object size:0x4 data:4byte -cardAnimA = .sbss:0x801D3DE8; // type:object size:0x4 data:4byte -cursorAnim = .sbss:0x801D3DEC; // type:object size:0x4 data:4byte -iconAnim = .sbss:0x801D3DF0; // type:object size:0x8 data:4byte +winProc = .sbss:0x801D3DE0; // type:object size:0x4 scope:local data:4byte +cardAnimB = .sbss:0x801D3DE4; // type:object size:0x4 scope:local data:4byte +cardAnimA = .sbss:0x801D3DE8; // type:object size:0x4 scope:local data:4byte +cursorAnim = .sbss:0x801D3DEC; // type:object size:0x4 scope:local data:4byte +iconAnim = .sbss:0x801D3DF0; // type:object size:0x4 scope:local data:4byte UnMountCnt = .sbss:0x801D3DF8; // type:object size:0x1 data:byte cardWork = .sbss:0x801D3DFC; // type:object size:0x4 scope:local data:4byte arqIdx = .sbss:0x801D3E00; // type:object size:0x2 scope:local data:2byte diff --git a/include/game/window.h b/include/game/window.h index 3c1988af..d4009df6 100644 --- a/include/game/window.h +++ b/include/game/window.h @@ -2,87 +2,77 @@ #define _GAME_WINDOW_H #include "game/sprite.h" +#include "dolphin.h" + typedef struct { - /* 0x00 */ u8 unk00; - /* 0x01 */ u8 unk01; - /* 0x02 */ s16 unk02; - /* 0x04 */ s16 unk04; - /* 0x06 */ s16 unk06; -} UnknownWindowStruct1; // Size 8 + /* 0x00 */ u8 color; + /* 0x01 */ u8 fade; + /* 0x02 */ s16 x; + /* 0x04 */ s16 y; + /* 0x06 */ s16 character; +} WinChar; // Size 8 typedef struct { - /* 0x00 */ u8 unk00; - /* 0x01 */ char unk01[1]; - /* 0x02 */ s16 unk02; - /* 0x04 */ s16 unk04; -} UnknownWindowStruct2; // Size 6 + /* 0x00 */ u8 stat; + /* 0x02 */ s16 x; + /* 0x04 */ s16 y; +} WinChoice; // Size 6 typedef struct { - /* 0x000 */ u8 unk00; - /* 0x001 */ u8 unk01; - /* 0x002 */ u8 unk02; - /* 0x003 */ u8 unk03; - /* 0x004 */ s16 unk04; - /* 0x006 */ s16 unk06[30]; - /* 0x042 */ s16 unk42; - /* 0x044 */ s16 unk44; - /* 0x046 */ s16 unk46; - /* 0x048 */ s16 unk48; - /* 0x04A */ char unk4A[2]; - /* 0x04C */ u32 unk4C; - /* 0x050 */ AnimData* unk50; - /* 0x054 */ s16 unk54; - /* 0x056 */ s16 unk56; - /* 0x058 */ s16 unk58; - /* 0x05A */ s16 unk5A; - /* 0x05C */ s16 unk5C; - /* 0x05E */ s16 unk5E; - /* 0x060 */ s16 unk60; - /* 0x062 */ s16 unk62; - /* 0x064 */ s16 unk64; - /* 0x066 */ s16 unk66; - /* 0x068 */ s16 unk68; - /* 0x06A */ s16 unk6A; - /* 0x06C */ f32 unk6C; - /* 0x070 */ f32 unk70; - /* 0x074 */ f32 unk74; - /* 0x078 */ f32 unk78; - /* 0x07C */ f32 unk7C; - /* 0x080 */ s16 unk80; - /* 0x082 */ s16 unk82; - /* 0x084 */ UnknownWindowStruct1* unk84; - /* 0x088 */ s16 unk88; - /* 0x08A */ char unk8A[2]; + /* 0x000 */ u8 stat; + /* 0x001 */ u8 active_pad; + /* 0x002 */ u8 player_disable; + /* 0x003 */ u8 color_key; + /* 0x004 */ s16 group; + /* 0x006 */ s16 sprite_id[30]; + /* 0x042 */ s16 speed; + /* 0x044 */ s16 mess_time; + /* 0x046 */ s16 advance_sprite; + /* 0x048 */ s16 prio; + /* 0x04C */ u32 attr; + /* 0x050 */ AnimData *frame; + /* 0x054 */ s16 mess_rect_x; + /* 0x056 */ s16 mess_rect_w; + /* 0x058 */ s16 mess_rect_y; + /* 0x05A */ s16 mess_rect_h; + /* 0x05C */ s16 mess_x; + /* 0x05E */ s16 mess_y; + /* 0x060 */ s16 mess_color; + /* 0x062 */ s16 mess_shadow_color; + /* 0x064 */ s16 spacing_x; + /* 0x066 */ s16 spacing_y; + /* 0x068 */ s16 w; + /* 0x06A */ s16 h; + /* 0x06C */ f32 pos_x; + /* 0x070 */ f32 pos_y; + /* 0x074 */ f32 scale_x; + /* 0x078 */ f32 scale_y; + /* 0x07C */ f32 rot; + /* 0x080 */ s16 num_chars; + /* 0x082 */ s16 max_chars; + /* 0x084 */ WinChar *char_data; + /* 0x088 */ s16 mess_stackptr; /* 0x08C */ s32 unk8C; - /* 0x090 */ u8* unk90; - /* 0x094 */ u8* unk94[1]; // unknown size - /* 0x098 */ char unk98[0x1C]; - /* 0x0B4 */ void* unkB4[8]; - /* 0x0D4 */ s16 unkD4; - /* 0x0D6 */ s16 unkD6; - /* 0x0D8 */ s16 unkD8; - /* 0x0DA */ u8 unkDA[16]; - /* 0x0EA */ UnknownWindowStruct2 unkEA[16]; - /* 0x14A */ s16 unk14A; - /* 0x14C */ s16 unk14C; - /* 0x14E */ s16 unk14E; - /* 0x150 */ s16 unk150; - /* 0x152 */ s16 unk152; - /* 0x154 */ s16 unk154; - /* 0x156 */ s16 unk156; - /* 0x158 */ s16 unk158; - /* 0x15A */ char unk15A[6]; - /* 0x160 */ u8 unk160[10][3]; - /* 0x17E */ char unk17E[2]; + /* 0x090 */ u8 *mess; + /* 0x094 */ u8 *mess_stack[8]; + /* 0x0B4 */ u8 *insert_mess[8]; + /* 0x0D4 */ s16 num_choices; + /* 0x0D6 */ s16 choice; + /* 0x0D8 */ s16 cursor_sprite; + /* 0x0DA */ u8 choice_disable[16]; + /* 0x0EA */ WinChoice choice_data[16]; + /* 0x14A */ s16 scissor_x; + /* 0x14C */ s16 scissor_y; + /* 0x14E */ s16 scissor_w; + /* 0x150 */ s16 scissor_h; + /* 0x152 */ s16 char_w; + /* 0x154 */ s16 push_key; + /* 0x156 */ s16 key_down; + /* 0x158 */ s16 key_auto; + /* 0x160 */ u8 ATTRIBUTE_ALIGN(32) mess_pal[10][3]; } SomeWindowStruct; // Size 0x180 -typedef struct { - /* 0x00 */ u8 r; - /* 0x01 */ u8 g; - /* 0x02 */ u8 b; -} ColorRGB; // Size 3 - void HuWindowInit(void); void HuWinInit(s32 arg0); s16 HuWinCreate(f32 x, f32 y, s16 w, s16 h, s16 frame); @@ -105,7 +95,7 @@ u8 HuWinStatGet(s16 arg0); void HuWinMesColSet(s16 arg0, u8 arg1); void HuWinMesPalSet(s16 arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4); void HuWinBGTPLvlSet(s16 arg0, f32 arg1); -void HuWinBGColSet(s16 arg0, ColorRGB* arg1); +void HuWinBGColSet(s16 arg0, GXColor *arg1); void HuWinMesSpeedSet(s16 arg0, s16 arg1); void HuWinMesRead(s32 arg0); void HuWinMesSet(s16 arg0, u32 arg1); diff --git a/src/game/window.c b/src/game/window.c index 86f51aeb..c5e6335a 100644 --- a/src/game/window.c +++ b/src/game/window.c @@ -1,27 +1,31 @@ #include "common.h" + #include "game/window.h" +#include "game/sprite.h" +#include "game/data.h" +#include "game/dvd.h" #include "game/memory.h" #include "game/process.h" +#include "math.h" #include "stdarg.h" #include "string.h" #define M_PI 3.141592653589793 typedef struct { - /* 0x00 */ AnimData** unk00; - /* 0x04 */ s16 unk04; - /* 0x06 */ s16 unk06; - /* 0x08 */ s16 unk08; - /* 0x0A */ s16 unk0A; - /* 0x0C */ s16 unk0C; -} SomeFontTblStruct; // Size 0x10 + /* 0x00 */ AnimData **anim; + /* 0x04 */ s16 bank; + /* 0x06 */ s16 w; + /* 0x08 */ s16 h; + /* 0x0A */ s16 center_x; + /* 0x0C */ s16 center_y; +} spcFontTblData; typedef struct { - /* 0x00 */ s16 unk00; - /* 0x02 */ char unk02[2]; - /* 0x04 */ s32 unk04[4]; -} SomeKeyBufStruct; // Size 0x14 + /* 0x00 */ s16 time; + /* 0x04 */ u32 player[4]; +} keyBufData; // Size 0x14 static void MesDispFunc(SpriteData*); static u8 winBGMake(AnimData*, AnimData*); @@ -42,10 +46,8 @@ s32 HuAudFXPlay(s32); void HuAR_ARAMtoMRAM(void*); void HuDataDirClose(s32); void* HuDataReadNum(s32, s32); -f64 cos(f64); -f64 sin(f64); + void mtxTransCat(Mtx, f32, f32, f32); -void* HuDvdDataRead(char*); void* MessData_MesPtrGet(void*, u32); extern u16 HuPadBtn[4]; @@ -53,30 +55,30 @@ extern u8 HuPadDStkRep[4]; SomeWindowStruct ATTRIBUTE_ALIGN(32) winData[32]; u32 winKey[4]; -SomeKeyBufStruct winComKeyBuf[256]; +keyBufData winComKeyBuf[256]; -AnimData* iconAnim; -AnimData* cursorAnim; -AnimData* cardAnimA; -AnimData* cardAnimB; -Process* winProc; +static AnimData *iconAnim; +static AnimData *cursorAnim; +static AnimData *cardAnimA; +static AnimData *cardAnimB; +static Process *winProc; void* messDataPtr; -s32 messDataNo; +static s32 messDataNo; static s16 winMaxWidth; static s16 winMaxHeight; static u8 mesWInsert[8]; static u8 winTabSize; static u8 winInsertF; -static void* winAMemP; -static u8* fontWidthP; +static void *winAMemP; +static u8 *fontWidthP; static s32 cancelCRF; static s16 mesCharCnt; static s16 comKeyIdxNow; static s16 comKeyIdx; static u8 LanguageNo; -AnimData* fontAnim; +AnimData *fontAnim; -static SomeFontTblStruct spcFontTbl[] = { +static spcFontTblData spcFontTbl[] = { { &iconAnim, 0, 20, 24, 10, 12 }, { &iconAnim, 1, 20, 24, 10, 12 }, { &iconAnim, 2, 20, 24, 10, 12 }, @@ -101,6 +103,7 @@ static SomeFontTblStruct spcFontTbl[] = { { &cardAnimA, 0, 32, 32, 16, 16 }, { &cardAnimB, 0, 32, 32, 16, 16 } }; + u8 charWETbl[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -122,6 +125,7 @@ u8 charWETbl[] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; + u8 charWJTbl[] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, @@ -144,7 +148,8 @@ u8 charWJTbl[] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; -static u8 ATTRIBUTE_ALIGN(32) charColPal[] = { + +static u8 ATTRIBUTE_ALIGN(32) charColPal[2*3*10] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, @@ -166,18 +171,21 @@ static u8 ATTRIBUTE_ALIGN(32) charColPal[] = { 0x60, 0x60, 0x60, 0x90, 0x90, 0x90 }; + static s32 frameFileTbl[] = { - 0x00860006, - 0x00860007, - 0x00860008, - 0x00860006 + MAKE_DATA_NUM(DATADIR_WIN, 6), + MAKE_DATA_NUM(DATADIR_WIN, 7), + MAKE_DATA_NUM(DATADIR_WIN, 8), + MAKE_DATA_NUM(DATADIR_WIN, 6) }; + static char* mesDataTbl[] = { "mess/mini.dat", "mess/board.dat", "mess/mini_e.dat", "mess/board_e.dat" }; + static s32 winVoiceTbl[] = { 0x37, 0x36, 0x38, 0x44, 0x43, 0x45, 0x41, 0x40, @@ -190,11 +198,11 @@ static s32 winVoiceTbl[] = { s16 winPrio = 1000; void HuWindowInit(void) { - s16 var_r31; + s16 i; - winAMemP = HuAR_DVDtoARAM(0x860000); - for (var_r31 = 0; var_r31 < 32; var_r31++) { - winData[var_r31].unk04 = -1; + winAMemP = HuAR_DVDtoARAM(MAKE_DIR_NUM(DATADIR_WIN)); + for (i = 0; i < 32; i++) { + winData[i].group = -1; } winProc = 0; winPrio = 1000; @@ -215,37 +223,37 @@ void HuWinInit(s32 arg0) { fontWidthP = (LanguageNo == 0) ? charWJTbl : charWETbl; HuWinMesRead(arg0); for (var_r30 = 0; var_r30 < 32; var_r30++) { - winData[var_r30].unk04 = -1; + winData[var_r30].group = -1; } - if (fontAnim == 0) { + if (!fontAnim) { if (LanguageNo == 0) { - var_r31 = HuDataReadNum(0x860000, 0x10000000); + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 0), MEMORY_DEFAULT_NUM); } else { - var_r31 = HuDataReadNum(0x860001, 0x10000000); + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 1), MEMORY_DEFAULT_NUM); } fontAnim = HuSprAnimRead(var_r31); } - if (iconAnim == 0) { - var_r31 = HuDataReadNum(0x860003, 0x10000000); + if (!iconAnim) { + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 3), MEMORY_DEFAULT_NUM); iconAnim = HuSprAnimRead(var_r31); HuSprAnimLock(iconAnim); } - if (cursorAnim == 0) { - var_r31 = HuDataReadNum(0x860002, 0x10000000); + if (!cursorAnim) { + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 2), MEMORY_DEFAULT_NUM); cursorAnim = HuSprAnimRead(var_r31); HuSprAnimLock(cursorAnim); } - if (cardAnimA == 0) { - var_r31 = HuDataReadNum(0x860004, 0x10000000); + if (!cardAnimA) { + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 4), MEMORY_DEFAULT_NUM); cardAnimA = HuSprAnimRead(var_r31); HuSprAnimLock(cardAnimA); } - if (cardAnimB == 0) { - var_r31 = HuDataReadNum(0x860005, 0x10000000); + if (!cardAnimB) { + var_r31 = HuDataReadNum(MAKE_DATA_NUM(DATADIR_WIN, 5), MEMORY_DEFAULT_NUM); cardAnimB = HuSprAnimRead(var_r31); HuSprAnimLock(cardAnimB); } - HuDataDirClose(0x860000); + HuDataDirClose(MAKE_DIR_NUM(DATADIR_WIN)); HuWinComKeyReset(); winPrio = 1000; } @@ -262,7 +270,7 @@ s16 HuWinCreate(f32 x, f32 y, s16 w, s16 h, s16 frame) { void* temp_r21; for (var_r29 = 0; var_r29 < 32; var_r29++) { - if (winData[var_r29].unk04 == -1) { + if (winData[var_r29].group == -1) { break; } } @@ -270,86 +278,86 @@ s16 HuWinCreate(f32 x, f32 y, s16 w, s16 h, s16 frame) { return -1; } temp_r31 = &winData[var_r29]; - temp_r31->unk04 = temp_r3 = HuSprGrpCreate(0x1E); + temp_r31->group = temp_r3 = HuSprGrpCreate(0x1E); if (frame < 0 || frame >= 4) { frame = 0; } w = (w + 0xF) & 0xFFF0; h = (h + 0xF) & 0xFFF0; if (x == -10000.0f) { - temp_r31->unk6C = (576.0f - w) / 2; + temp_r31->pos_x = (576.0f - w) / 2; } else { - temp_r31->unk6C = x; + temp_r31->pos_x = x; } if (y == -10000.0f) { - temp_r31->unk70 = (480.0f - h) / 2; + temp_r31->pos_y = (480.0f - h) / 2; } else { - temp_r31->unk70 = y; + temp_r31->pos_y = y; } HuSprGrpCenterSet(temp_r3, w / 2, h / 2); - HuSprGrpPosSet(temp_r3, temp_r31->unk6C, temp_r31->unk70); - temp_r21 = HuAR_ARAMtoMRAMFileRead(frameFileTbl[frame], 0x10000000, 2); - temp_r31->unk50 = HuSprAnimRead(temp_r21); - temp_r3_2 = temp_r31->unk06[0] = HuSprCreate(temp_r31->unk50, winPrio, 0); + HuSprGrpPosSet(temp_r3, temp_r31->pos_x, temp_r31->pos_y); + temp_r21 = HuAR_ARAMtoMRAMFileRead(frameFileTbl[frame], MEMORY_DEFAULT_NUM, 2); + temp_r31->frame = HuSprAnimRead(temp_r21); + temp_r3_2 = temp_r31->sprite_id[0] = HuSprCreate(temp_r31->frame, winPrio, 0); HuSprGrpMemberSet(temp_r3, 0, temp_r3_2); HuSprTPLvlSet(temp_r3, 0, 0.9f); temp_r3_3 = HuSprAnimMake(w / 16, h / 16, 6); HuSprBGSet(temp_r3, 0, temp_r3_3, 0); - temp_r31->unk03 = winBGMake(temp_r3_3, temp_r31->unk50); - temp_r3_2 = temp_r31->unk06[1] = HuSprFuncCreate(MesDispFunc, winPrio); + temp_r31->color_key = winBGMake(temp_r3_3, temp_r31->frame); + temp_r3_2 = temp_r31->sprite_id[1] = HuSprFuncCreate(MesDispFunc, winPrio); temp_r22 = &HuSprData[temp_r3_2]; temp_r22->work[0] = var_r29; HuSprGrpMemberSet(temp_r3, 1, temp_r3_2); - temp_r31->unk80 = 0; - temp_r31->unk82 = (w / 8) * (h / 24) * 4; - temp_r31->unk84 = HuMemDirectMalloc(HEAP_SYSTEM, temp_r31->unk82 * sizeof(UnknownWindowStruct1)); - temp_r31->unk4C = 0; - temp_r31->unk00 = 0; + temp_r31->num_chars = 0; + temp_r31->max_chars = (w / 8) * (h / 24) * 4; + temp_r31->char_data = HuMemDirectMalloc(HEAP_SYSTEM, temp_r31->max_chars * sizeof(WinChar)); + temp_r31->attr = 0; + temp_r31->stat = 0; temp_r31->unk8C = 0; - temp_r31->unk44 = 0; - temp_r31->unk5C = temp_r31->unk5E = 0; - temp_r31->unk54 = 8; - temp_r31->unk58 = 8; - temp_r31->unk56 = w - 8; - temp_r31->unk5A = h - 8; - temp_r31->unk42 = 1; - temp_r31->unk60 = 7; - temp_r31->unk62 = 0; - temp_r31->unk01 = 0xF; - temp_r31->unk02 = 0; - temp_r31->unk88 = 0; - temp_r31->unk90 = 0; - temp_r31->unkD4 = 0; - temp_r31->unk48 = winPrio; - temp_r31->unk64 = 1; - temp_r31->unk66 = 2; - temp_r31->unk68 = w; - temp_r31->unk6A = h; - temp_r31->unk14A = temp_r31->unk14C = 0; - temp_r31->unk14E = 0x280; - temp_r31->unk150 = 0x1E0; - temp_r31->unk152 = 0x18; - temp_r31->unk154 = 0x300; - temp_r31->unk158 = 0; + temp_r31->mess_time = 0; + temp_r31->mess_x = temp_r31->mess_y = 0; + temp_r31->mess_rect_x = 8; + temp_r31->mess_rect_y = 8; + temp_r31->mess_rect_w = w - 8; + temp_r31->mess_rect_h = h - 8; + temp_r31->speed = 1; + temp_r31->mess_color = 7; + temp_r31->mess_shadow_color = 0; + temp_r31->active_pad = 0xF; + temp_r31->player_disable = 0; + temp_r31->mess_stackptr = 0; + temp_r31->mess = 0; + temp_r31->num_choices = 0; + temp_r31->prio = winPrio; + temp_r31->spacing_x = 1; + temp_r31->spacing_y = 2; + temp_r31->w = w; + temp_r31->h = h; + temp_r31->scissor_x = temp_r31->scissor_y = 0; + temp_r31->scissor_w = 0x280; + temp_r31->scissor_h = 0x1E0; + temp_r31->char_w = 0x18; + temp_r31->push_key = 0x300; + temp_r31->key_auto = 0; if (frame == 0 || frame == 2) { - memcpy(&temp_r31->unk160, charColPal + 30, 30); + memcpy(&temp_r31->mess_pal, &charColPal[30], 30); } else { - memcpy(&temp_r31->unk160, charColPal, 30); - temp_r31->unk62 = 9; + memcpy(&temp_r31->mess_pal, charColPal, 30); + temp_r31->mess_shadow_color = 9; } for (var_r30 = 0; var_r30 < 8; var_r30++) { - temp_r31->unkB4[var_r30] = 0; + temp_r31->insert_mess[var_r30] = 0; } for (var_r30 = 2; var_r30 < 30; var_r30++) { - temp_r31->unk06[var_r30] = -1; + temp_r31->sprite_id[var_r30] = -1; } winPrio -= 3; if (winPrio < 500) { winPrio = 1000; } for (var_r30 = 0; var_r30 < 16; var_r30++) { - temp_r31->unkDA[var_r30] = 0; - temp_r31->unkEA[var_r30].unk00 = 0; + temp_r31->choice_disable[var_r30] = 0; + temp_r31->choice_data[var_r30].stat = 0; } return var_r29; } @@ -358,15 +366,15 @@ void HuWinKill(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; s16 var_r30; - if (temp_r31->unk04 != -1) { - HuMemDirectFree(temp_r31->unk84); + if (temp_r31->group != -1) { + HuMemDirectFree(temp_r31->char_data); for (var_r30 = 2; var_r30 < 30; var_r30++) { - if (temp_r31->unk06[var_r30] != -1) { - HuSprGrpMemberKill(temp_r31->unk04, var_r30); + if (temp_r31->sprite_id[var_r30] != -1) { + HuSprGrpMemberKill(temp_r31->group, var_r30); } } - HuSprGrpKill(temp_r31->unk04); - temp_r31->unk04 = -1; + HuSprGrpKill(temp_r31->group); + temp_r31->group = -1; } } @@ -374,7 +382,7 @@ void HuWinAllKill(void) { s16 var_r30; for (var_r30 = 0; var_r30 < 32; var_r30++) { - if (winData[var_r30].unk04 != -1) { + if (winData[var_r30].group != -1) { HuWinKill(var_r30); } } @@ -427,8 +435,8 @@ static void MesDispFunc(SpriteData* arg0) { Mtx sp50; Mtx44 sp10; - if (temp_r31->unk80 != 0) { - spC = &HuSprGrpData[temp_r31->unk04]; + if (temp_r31->num_chars != 0) { + spC = &HuSprGrpData[temp_r31->group]; GXInvalidateTexAll(); C_MTXOrtho(sp10, 0.0f, 480.0f, 0.0f, 576.0f, 0.0f, 10.0f); GXSetProjection(sp10, GX_ORTHOGRAPHIC); @@ -460,37 +468,37 @@ static void MesDispFunc(SpriteData* arg0) { GXLoadPosMtxImm(sp50, 0); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); HuSprTexLoad(fontAnim, 0, 0, GX_CLAMP, GX_CLAMP, GX_LINEAR); - GXBegin(GX_QUADS, GX_VTXFMT0, temp_r31->unk80 * 4); + GXBegin(GX_QUADS, GX_VTXFMT0, temp_r31->num_chars * 4); var_f23 = (LanguageNo == 0) ? 0.05882353f : 0.07692308f; - for (var_r29 = 0; var_r29 < temp_r31->unk80; var_r29++) { - temp_f27 = fontWidthP[temp_r31->unk84[var_r29].unk06 + 0x30]; - temp_f29 = 0.0625f * (temp_r31->unk84[var_r29].unk06 % 16); - temp_f28 = var_f23 * (temp_r31->unk84[var_r29].unk06 / 16); + for (var_r29 = 0; var_r29 < temp_r31->num_chars; var_r29++) { + temp_f27 = fontWidthP[temp_r31->char_data[var_r29].character + 0x30]; + temp_f29 = 0.0625f * (temp_r31->char_data[var_r29].character % 16); + temp_f28 = var_f23 * (temp_r31->char_data[var_r29].character / 16); temp_f26 = temp_f29 + (temp_f27 / 320.0); temp_f25 = temp_f28 + var_f23; - temp_f31 = temp_r31->unk84[var_r29].unk02; - temp_f30 = temp_r31->unk84[var_r29].unk04; - temp_r28 = temp_r31->unk84[var_r29].unk00; - if (temp_r31->unk42 != 0) { - temp_r27 = temp_r31->unk84[var_r29].unk01 * 8; + temp_f31 = temp_r31->char_data[var_r29].x; + temp_f30 = temp_r31->char_data[var_r29].y; + temp_r28 = temp_r31->char_data[var_r29].color; + if (temp_r31->speed != 0) { + temp_r27 = temp_r31->char_data[var_r29].fade * 8; } else { temp_r27 = 0xFF; } temp_r27 = 0xFF; - if (temp_r31->unk84[var_r29].unk01 < 0x1F) { - temp_r31->unk84[var_r29].unk01++; + if (temp_r31->char_data[var_r29].fade < 0x1F) { + temp_r31->char_data[var_r29].fade++; } GXPosition3f32(temp_f31 + 1.0f, temp_f30, 0.0f); - GXColor4u8(temp_r31->unk160[temp_r28][0], temp_r31->unk160[temp_r28][1], temp_r31->unk160[temp_r28][2], temp_r27); + GXColor4u8(temp_r31->mess_pal[temp_r28][0], temp_r31->mess_pal[temp_r28][1], temp_r31->mess_pal[temp_r28][2], temp_r27); GXTexCoord2f32(temp_f29, temp_f28); GXPosition3f32(temp_f31 + temp_f27, temp_f30, 0.0f); - GXColor4u8(temp_r31->unk160[temp_r28][0], temp_r31->unk160[temp_r28][1], temp_r31->unk160[temp_r28][2], temp_r27); + GXColor4u8(temp_r31->mess_pal[temp_r28][0], temp_r31->mess_pal[temp_r28][1], temp_r31->mess_pal[temp_r28][2], temp_r27); GXTexCoord2f32(temp_f26, temp_f28); GXPosition3f32(temp_f31 + temp_f27, temp_f30 + 24.0f, 0.0f); - GXColor4u8(temp_r31->unk160[temp_r28][0], temp_r31->unk160[temp_r28][1], temp_r31->unk160[temp_r28][2], temp_r27); + GXColor4u8(temp_r31->mess_pal[temp_r28][0], temp_r31->mess_pal[temp_r28][1], temp_r31->mess_pal[temp_r28][2], temp_r27); GXTexCoord2f32(temp_f26, temp_f25); GXPosition3f32(temp_f31 + 1.0f, temp_f30 + 24.0f, 0.0f); - GXColor4u8(temp_r31->unk160[temp_r28][0], temp_r31->unk160[temp_r28][1], temp_r31->unk160[temp_r28][2], temp_r27); + GXColor4u8(temp_r31->mess_pal[temp_r28][0], temp_r31->mess_pal[temp_r28][1], temp_r31->mess_pal[temp_r28][2], temp_r27); GXTexCoord2f32(temp_f29, temp_f25); } GXEnd(); @@ -513,7 +521,7 @@ static u8 winBGMake(AnimData* arg0, AnimData* arg1) { temp_r23 = arg0->bmp->sizeY; temp_r27 = (temp_r28 + 7) & 0xF8; temp_r22 = (temp_r23 + 3) & 0xFC; - temp_r3 = arg0->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, temp_r27 * temp_r22, 0x10000000); + temp_r3 = arg0->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, temp_r27 * temp_r22, MEMORY_DEFAULT_NUM); for (var_r30 = 0; var_r30 < temp_r23; var_r30++) { if (var_r30 == 0) { for (var_r31 = 0; var_r31 < temp_r28; var_r31++) { @@ -568,8 +576,8 @@ static void HuWinProc(void) { HuPrcVSleep(); var_r31 = winData; for (var_r30 = 0; var_r30 < 32; var_r30++, var_r31++) { - if (var_r31->unk04 != -1 && !(var_r31->unk4C & 8)) { - switch (var_r31->unk00) { + if (var_r31->group != -1 && !(var_r31->attr & 8)) { + switch (var_r31->stat) { case 0: break; case 1: @@ -580,8 +588,8 @@ static void HuWinProc(void) { HuWinKeyWait(var_r30); break; case 3: - if (!(var_r31->unk4C & 0x40) || HuWinActiveKeyGetX(var_r31) == 0) { - var_r31->unk4C &= ~0x40; + if (!(var_r31->attr & 0x40) || HuWinActiveKeyGetX(var_r31) == 0) { + var_r31->attr &= ~0x40; HuWinComKeyGet(var_r30, winKey); HuWinChoice(var_r31); } @@ -592,25 +600,25 @@ static void HuWinProc(void) { } } -static inline void HuWinDrawMesInlineFunc(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { +static inline void charEntry(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { SomeWindowStruct* temp_r28 = &winData[arg0]; - UnknownWindowStruct1* temp_r20 = temp_r28->unk84; + WinChar *temp_r20 = temp_r28->char_data; - temp_r20 = &temp_r28->unk84[temp_r28->unk80]; - temp_r20->unk02 = arg1 - temp_r28->unk68 / 2; - temp_r20->unk04 = arg2 - temp_r28->unk6A / 2; - temp_r20->unk06 = arg3 - 0x30; - temp_r20->unk00 = arg4; - temp_r20->unk01 = 0; - temp_r28->unk80++; - if (temp_r28->unk80 >= temp_r28->unk82) { - temp_r28->unk80 = temp_r28->unk82 - 1; + temp_r20 = &temp_r28->char_data[temp_r28->num_chars]; + temp_r20->x = arg1 - temp_r28->w / 2; + temp_r20->y = arg2 - temp_r28->h / 2; + temp_r20->character = arg3 - 0x30; + temp_r20->color = arg4; + temp_r20->fade = 0; + temp_r28->num_chars++; + if (temp_r28->num_chars >= temp_r28->max_chars) { + temp_r28->num_chars = temp_r28->max_chars - 1; } } static void HuWinDrawMes(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - SpriteGroupData* sp44 = &HuSprGrpData[temp_r31->unk04]; + SpriteGroupData* sp44 = &HuSprGrpData[temp_r31->group]; s16 var_r30; s16 sp34; s16 sp32; @@ -621,168 +629,168 @@ static void HuWinDrawMes(s16 arg0) { s16 sp28; s16 sp26; - temp_r31->unk44 += 3; - while (temp_r31->unk44 >= temp_r31->unk42 || (temp_r31->unk4C & 0x2000)) { - temp_r31->unk44 -= temp_r31->unk42; - if (temp_r31->unk44 < 0) { - temp_r31->unk44 = 0; + temp_r31->mess_time += 3; + while (temp_r31->mess_time >= temp_r31->speed || (temp_r31->attr & 0x2000)) { + temp_r31->mess_time -= temp_r31->speed; + if (temp_r31->mess_time < 0) { + temp_r31->mess_time = 0; } - sp32 = temp_r31->unk64 + fontWidthP[temp_r31->unk90[0]]; + sp32 = temp_r31->spacing_x + fontWidthP[temp_r31->mess[0]]; sp2C = 0; - if (temp_r31->unk90[0] != 0 && (temp_r31->unk4C & 4)) { - temp_r31->unk4C &= ~4; + if (temp_r31->mess[0] != 0 && (temp_r31->attr & 4)) { + temp_r31->attr &= ~4; _HuWinHomeClear(temp_r31); } - while (temp_r31->unk90[0] < 0x30 || temp_r31->unk90[0] == 0xFF) { - switch (temp_r31->unk90[0]) { + while (temp_r31->mess[0] < 0x30 || temp_r31->mess[0] == 0xFF) { + switch (temp_r31->mess[0]) { case 0x0: - if (temp_r31->unk88 == 0) { + if (temp_r31->mess_stackptr == 0) { for (sp34 = 0; sp34 < 16; sp34++) { - temp_r31->unkDA[sp34] = 0; + temp_r31->choice_disable[sp34] = 0; } - temp_r31->unk00 = 0; - temp_r31->unk4C &= ~0x80; + temp_r31->stat = 0; + temp_r31->attr &= ~0x80; return; } - temp_r31->unk88--; - temp_r31->unk90 = temp_r31->unk94[temp_r31->unk88]; - temp_r31->unk44 = 0; + temp_r31->mess_stackptr--; + temp_r31->mess = temp_r31->mess_stack[temp_r31->mess_stackptr]; + temp_r31->mess_time = 0; break; case 0x1F: - temp_r31->unk90++; - sp2E = temp_r31->unk90[0] - 1; - if (temp_r31->unkB4[sp2E] != 0) { - temp_r31->unk94[temp_r31->unk88] = temp_r31->unk90; - temp_r31->unk90 = temp_r31->unkB4[sp2E]; - temp_r31->unk88++; - if (temp_r31->unk90[0] != 0xB) { - temp_r31->unk90--; + temp_r31->mess++; + sp2E = temp_r31->mess[0] - 1; + if (temp_r31->insert_mess[sp2E] != 0) { + temp_r31->mess_stack[temp_r31->mess_stackptr] = temp_r31->mess; + temp_r31->mess = temp_r31->insert_mess[sp2E]; + temp_r31->mess_stackptr++; + if (temp_r31->mess[0] != 0xB) { + temp_r31->mess--; } } break; case 0xB: - temp_r31->unk4C &= ~0x2200; + temp_r31->attr &= ~0x2200; _HuWinHomeClear(temp_r31); - if (temp_r31->unk4C & 0x800) { - sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->unk90 + 1); - temp_r31->unk5C = (temp_r31->unk56 - sp26) / 2; - } else if (temp_r31->unk4C & 0x1000) { - sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->unk90 + 1); - temp_r31->unk5C = temp_r31->unk56 - sp26; + if (temp_r31->attr & 0x800) { + sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->mess + 1); + temp_r31->mess_x = (temp_r31->mess_rect_w - sp26) / 2; + } else if (temp_r31->attr & 0x1000) { + sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->mess + 1); + temp_r31->mess_x = temp_r31->mess_rect_w - sp26; } break; case 0x1E: - temp_r31->unk90++; - if (!(temp_r31->unk4C & 0x80)) { - temp_r31->unk60 = temp_r31->unk90[0] - 1; + temp_r31->mess++; + if (!(temp_r31->attr & 0x80)) { + temp_r31->mess_color = temp_r31->mess[0] - 1; } break; case 0x1D: - temp_r31->unk4C ^= 1; + temp_r31->attr ^= 1; break; case 0xA: - temp_r31->unk4C &= ~0x2020; - if (temp_r31->unk4C & 0x200) { - if (!(temp_r31->unk4C & 0x100)) { + temp_r31->attr &= ~0x2020; + if (temp_r31->attr & 0x200) { + if (!(temp_r31->attr & 0x100)) { if (HuWinCR(temp_r31) != 0) { - temp_r31->unk90++; + temp_r31->mess++; HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 2; + temp_r31->attr |= 2; return; } - if (temp_r31->unk4C & 0x800) { - sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->unk90 + 1); - temp_r31->unk5C = (temp_r31->unk56 - sp26) / 2; - } else if (temp_r31->unk4C & 0x1000) { - sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->unk90 + 1); - temp_r31->unk5C = temp_r31->unk56 - sp26; + if (temp_r31->attr & 0x800) { + sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->mess + 1); + temp_r31->mess_x = (temp_r31->mess_rect_w - sp26) / 2; + } else if (temp_r31->attr & 0x1000) { + sp26 = GetMesMaxSizeSub2(temp_r31, temp_r31->mess + 1); + temp_r31->mess_x = temp_r31->mess_rect_w - sp26; } break; } - sp32 = fontWidthP[16] + temp_r31->unk64; + sp32 = fontWidthP[16] + temp_r31->spacing_x; /* fallthrough */ case 0x10: case 0x20: - temp_r31->unk4C |= 0x200; - if (temp_r31->unk5C + sp32 > temp_r31->unk56) { + temp_r31->attr |= 0x200; + if (temp_r31->mess_x + sp32 > temp_r31->mess_rect_w) { if (HuWinCR(temp_r31) != 0) { - temp_r31->unk90++; + temp_r31->mess++; HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 2; + temp_r31->attr |= 2; return; } break; } - temp_r31->unk5C += sp32; + temp_r31->mess_x += sp32; } break; case 0xE: - temp_r31->unk4C |= 0x200; - temp_r31->unk90++; - sp30 = temp_r31->unk64 + spcFontTbl[temp_r31->unk90[0] - 1].unk06; - if (temp_r31->unk5C + sp30 > temp_r31->unk56 && HuWinCR(temp_r31) != 0) { - temp_r31->unk90--; + temp_r31->attr |= 0x200; + temp_r31->mess++; + sp30 = temp_r31->spacing_x + spcFontTbl[temp_r31->mess[0] - 1].w; + if (temp_r31->mess_x + sp30 > temp_r31->mess_rect_w && HuWinCR(temp_r31) != 0) { + temp_r31->mess--; HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 2; + temp_r31->attr |= 2; return; } - HuWinSpcFontEntry(temp_r31, temp_r31->unk90[0] - 1, temp_r31->unk54 + temp_r31->unk5C, temp_r31->unk58 + temp_r31->unk5E); - temp_r31->unk5C += sp30; + HuWinSpcFontEntry(temp_r31, temp_r31->mess[0] - 1, temp_r31->mess_rect_x + temp_r31->mess_x, temp_r31->mess_rect_y + temp_r31->mess_y); + temp_r31->mess_x += sp30; sp2C = 1; break; case 0x1C: - temp_r31->unk90++; - HuAudFXPlay(winVoiceTbl[temp_r31->unk90[0] - 1]); + temp_r31->mess++; + HuAudFXPlay(winVoiceTbl[temp_r31->mess[0] - 1]); break; case 0xFF: - temp_r31->unk90++; + temp_r31->mess++; HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 4; - temp_r31->unk4C &= ~0x200; + temp_r31->attr |= 4; + temp_r31->attr &= ~0x200; return; case 0xF: - temp_r31->unk4C |= 0x2000; - if (temp_r31->unkDA[temp_r31->unkD4] != 0) { - temp_r31->unk4C |= 0x20; - temp_r31->unkEA[temp_r31->unkD4].unk00 |= 1; + temp_r31->attr |= 0x2000; + if (temp_r31->choice_disable[temp_r31->num_choices] != 0) { + temp_r31->attr |= 0x20; + temp_r31->choice_data[temp_r31->num_choices].stat |= 1; } else { - temp_r31->unkEA[temp_r31->unkD4].unk00 &= ~1; + temp_r31->choice_data[temp_r31->num_choices].stat &= ~1; } - temp_r31->unkEA[temp_r31->unkD4].unk02 = temp_r31->unk5C + temp_r31->unk58; - temp_r31->unkEA[temp_r31->unkD4].unk04 = temp_r31->unk5E + temp_r31->unk54; - temp_r31->unkD4++; + temp_r31->choice_data[temp_r31->num_choices].x = temp_r31->mess_x + temp_r31->mess_rect_y; + temp_r31->choice_data[temp_r31->num_choices].y = temp_r31->mess_y + temp_r31->mess_rect_x; + temp_r31->num_choices++; break; case 0xC: - temp_r31->unk4C |= 0x200; - sp30 = temp_r31->unk152 * ((temp_r31->unk5C + temp_r31->unk152) / temp_r31->unk152) - temp_r31->unk5C; - if (temp_r31->unk5C + sp30 > temp_r31->unk56) { + temp_r31->attr |= 0x200; + sp30 = temp_r31->char_w * ((temp_r31->mess_x + temp_r31->char_w) / temp_r31->char_w) - temp_r31->mess_x; + if (temp_r31->mess_x + sp30 > temp_r31->mess_rect_w) { if (HuWinCR(temp_r31) != 0) { - temp_r31->unk90++; + temp_r31->mess++; HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 2; + temp_r31->attr |= 2; return; } } else { - temp_r31->unk5C += sp30; + temp_r31->mess_x += sp30; } break; } - temp_r31->unk90++; - sp32 = temp_r31->unk64 + fontWidthP[temp_r31->unk90[0]]; + temp_r31->mess++; + sp32 = temp_r31->spacing_x + fontWidthP[temp_r31->mess[0]]; if (sp2C != 0) { break; } } if (sp2C == 0) { - if (temp_r31->unk5C + sp32 > temp_r31->unk56 && HuWinCR(temp_r31) != 0) { + if (temp_r31->mess_x + sp32 > temp_r31->mess_rect_w && HuWinCR(temp_r31) != 0) { HuWinKeyWaitEntry(arg0); - temp_r31->unk4C |= 2; + temp_r31->attr |= 2; return; } - var_r30 = temp_r31->unk90[0]; - temp_r31->unk4C |= 0x200; - if (temp_r31->unk90[1] == 0x80) { + var_r30 = temp_r31->mess[0]; + temp_r31->attr |= 0x200; + if (temp_r31->mess[1] == 0x80) { if (var_r30 >= 0x96 && var_r30 <= 0xA4) { var_r30 = var_r30 + 0x6A; } else if (var_r30 >= 0xAA && var_r30 <= 0xAE) { @@ -792,44 +800,44 @@ static void HuWinDrawMes(s16 arg0) { } else if (var_r30 >= 0xEA && var_r30 <= 0xEE) { var_r30 = var_r30 + 0x3E; } - temp_r31->unk90++; - } else if (temp_r31->unk90[1] == 0x81) { + temp_r31->mess++; + } else if (temp_r31->mess[1] == 0x81) { if (var_r30 >= 0xAA && var_r30 <= 0xAE) { var_r30 = (var_r30 + 0x6A); } else if (var_r30 >= 0xEA && var_r30 <= 0xEE) { var_r30 = (var_r30 + 0x43); } - temp_r31->unk90++; + temp_r31->mess++; } - sp28 = (temp_r31->unk4C & 0x20) ? 8 : temp_r31->unk60; - if (temp_r31->unk4C & 1) { + sp28 = (temp_r31->attr & 0x20) ? 8 : temp_r31->mess_color; + if (temp_r31->attr & 1) { sp2A = 0; - if (temp_r31->unk60 == 0 || temp_r31->unk60 == 1) { + if (temp_r31->mess_color == 0 || temp_r31->mess_color == 1) { sp2A = 8; } - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C + 2, temp_r31->unk58 + temp_r31->unk5E , var_r30, sp2A); - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C - 2, temp_r31->unk58 + temp_r31->unk5E , var_r30, sp2A); - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C , temp_r31->unk58 + temp_r31->unk5E + 2, var_r30, sp2A); - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C , temp_r31->unk58 + temp_r31->unk5E - 2, var_r30, sp2A); - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C , temp_r31->unk58 + temp_r31->unk5E , var_r30, sp28); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x + 2, temp_r31->mess_rect_y + temp_r31->mess_y , var_r30, sp2A); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x - 2, temp_r31->mess_rect_y + temp_r31->mess_y , var_r30, sp2A); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x , temp_r31->mess_rect_y + temp_r31->mess_y + 2, var_r30, sp2A); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x , temp_r31->mess_rect_y + temp_r31->mess_y - 2, var_r30, sp2A); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x , temp_r31->mess_rect_y + temp_r31->mess_y , var_r30, sp28); } else { - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C + 2, temp_r31->unk58 + temp_r31->unk5E + 2, var_r30, temp_r31->unk62); - HuWinDrawMesInlineFunc(arg0, temp_r31->unk54 + temp_r31->unk5C , temp_r31->unk58 + temp_r31->unk5E , var_r30, sp28); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x + 2, temp_r31->mess_rect_y + temp_r31->mess_y + 2, var_r30, temp_r31->mess_shadow_color); + charEntry(arg0, temp_r31->mess_rect_x + temp_r31->mess_x , temp_r31->mess_rect_y + temp_r31->mess_y , var_r30, sp28); } - temp_r31->unk5C += sp32; - temp_r31->unk90++; + temp_r31->mess_x += sp32; + temp_r31->mess++; } } } static s32 HuWinCR(SomeWindowStruct* arg0) { - if (arg0->unk5E + 0x30 > arg0->unk5A) { - arg0->unk5E = 0; - arg0->unk5C = 0; + if (arg0->mess_y + 0x30 > arg0->mess_rect_h) { + arg0->mess_y = 0; + arg0->mess_x = 0; return 1; } else { - arg0->unk5E += arg0->unk66 + 0x18; - arg0->unk5C = 0; + arg0->mess_y += arg0->spacing_y + 0x18; + arg0->mess_x = 0; return 0; } } @@ -837,13 +845,13 @@ static s32 HuWinCR(SomeWindowStruct* arg0) { static void _HuWinHomeClear(SomeWindowStruct* arg0) { s16 var_r30; - arg0->unk80 = 0; - arg0->unk5E = arg0->unk5C = 0; - arg0->unkD4 = 0; + arg0->num_chars = 0; + arg0->mess_y = arg0->mess_x = 0; + arg0->num_choices = 0; HuWinSpcFontClear(arg0); - arg0->unk4C &= ~0x2020; + arg0->attr &= ~0x2020; for (var_r30 = 0; var_r30 < 16; var_r30++) { - arg0->unkEA[var_r30].unk00 = 0; + arg0->choice_data[var_r30].stat = 0; } } @@ -856,66 +864,67 @@ void HuWinHomeClear(s16 arg0) { void HuWinKeyWaitEntry(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - if (temp_r31->unk4C & 0x400) { - temp_r31->unk00 = 0; + if (temp_r31->attr & 0x400) { + temp_r31->stat = 0; } else { - temp_r31->unk00 = 2; - temp_r31->unk46 = HuWinSpcFontEntry(temp_r31, 0x13, temp_r31->unk56 - 0x14, temp_r31->unk5A - 0x18); + temp_r31->stat = 2; + temp_r31->advance_sprite = HuWinSpcFontEntry(temp_r31, 19, temp_r31->mess_rect_w - 20, temp_r31->mess_rect_h - 24); } } static void HuWinKeyWait(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - if (temp_r31->unk154 & HuWinActivePadGet(temp_r31)) { - temp_r31->unk156 = HuWinActivePadGet(temp_r31); - temp_r31->unk00 = 1; - HuAudFXPlay(0x1C); - HuWinSprKill(arg0, temp_r31->unk46); - if (temp_r31->unk4C & 2) { + if (temp_r31->push_key & HuWinActivePadGet(temp_r31)) { + temp_r31->key_down = HuWinActivePadGet(temp_r31); + temp_r31->stat = 1; + HuAudFXPlay(28); + HuWinSprKill(arg0, temp_r31->advance_sprite); + if (temp_r31->attr & 2) { _HuWinHomeClear(temp_r31); } - temp_r31->unk4C &= ~2; + temp_r31->attr &= ~2; } } static s16 HuWinSpcFontEntry(SomeWindowStruct* arg0, s16 arg1, s16 arg2, s16 arg3) { - SpriteGroupData* spC = &HuSprGrpData[arg0->unk04]; + SpriteGroupData* spC = &HuSprGrpData[arg0->group]; s16 temp_r3; s16 var_r30; - AnimData* temp_r27; + AnimData *anim; for (var_r30 = 10; var_r30 < 30; var_r30++) { - if (arg0->unk06[var_r30] == -1) { - temp_r27 = *spcFontTbl[arg1].unk00; - arg0->unk06[var_r30] = temp_r3 = HuSprCreate(temp_r27, arg0->unk48 - 1, spcFontTbl[arg1].unk04); - HuSprGrpMemberSet(arg0->unk04, var_r30, temp_r3); - HuSprPosSet(arg0->unk04, var_r30, arg2 + spcFontTbl[arg1].unk0A - arg0->unk68 / 2, arg3 + spcFontTbl[arg1].unk0C - arg0->unk6A / 2); + if (arg0->sprite_id[var_r30] == -1) { + anim = *spcFontTbl[arg1].anim; + arg0->sprite_id[var_r30] = temp_r3 = HuSprCreate(anim, arg0->prio - 1, spcFontTbl[arg1].bank); + HuSprGrpMemberSet(arg0->group, var_r30, temp_r3); + HuSprPosSet(arg0->group, var_r30, arg2 + spcFontTbl[arg1].center_x - arg0->w / 2, arg3 + spcFontTbl[arg1].center_y - arg0->h / 2); break; } } return var_r30; } +static void HuWinSpcFontPosSet(SomeWindowStruct* arg0, s16 arg1, s16 arg2, s16 arg3) { + SpriteGroupData* temp_var = &HuSprGrpData[arg0->group]; + + HuSprPosSet(arg0->group, arg1, arg2 - arg0->w / 2, arg3 - arg0->h / 2); +} + static void HuWinSpcFontClear(SomeWindowStruct* arg0) { s16 var_r31; for (var_r31 = 10; var_r31 < 30; var_r31++) { - if (arg0->unk06[var_r31] != -1) { - HuSprGrpMemberKill(arg0->unk04, var_r31); - arg0->unk06[var_r31] = -1; + if (arg0->sprite_id[var_r31] != -1) { + HuSprGrpMemberKill(arg0->group, var_r31); + arg0->sprite_id[var_r31] = -1; } } } -static inline void HuWinChoiceInlineFunction(SomeWindowStruct* arg0, s16 arg1, s16 arg2, s16 arg3) { - SpriteGroupData* temp_var = &HuSprGrpData[arg0->unk04]; - - HuSprPosSet(arg0->unk04, arg1, arg2 - arg0->unk68 / 2, arg3 - arg0->unk6A / 2); -} void HuWinChoice(SomeWindowStruct* arg0) { - UnknownWindowStruct2* var_r31; + WinChoice *var_r31; f32 var_f30; f32 var_f31; s16 temp_r20; @@ -930,7 +939,7 @@ void HuWinChoice(SomeWindowStruct* arg0) { s16 var_r23; s16 var_r30; - temp_r26 = arg0->unkD6; + temp_r26 = arg0->choice; var_r23 = temp_r26; var_r19 = -1; temp_r21 = HuWinActivePadGet(arg0); @@ -946,42 +955,42 @@ void HuWinChoice(SomeWindowStruct* arg0) { if (temp_r21 & 4) { var_r19 = 3; } - temp_r25 = arg0->unkEA[temp_r26].unk02; - temp_r24 = arg0->unkEA[temp_r26].unk04; + temp_r25 = arg0->choice_data[temp_r26].x; + temp_r24 = arg0->choice_data[temp_r26].y; var_f31 = 100000.0f; var_f30 = var_f31; - temp_r27 = arg0->unkD4; + temp_r27 = arg0->num_choices; switch (var_r19) { case 0: - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == temp_r24 && var_r31->unk02 < temp_r25) { + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == temp_r24 && var_r31->x < temp_r25) { break; } } if (var_r30 != temp_r27) { - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == temp_r24 && var_r31->unk02 < temp_r25 && var_f30 > temp_r25 - var_r31->unk02) { - var_f30 = temp_r25 - var_r31->unk02; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == temp_r24 && var_r31->x < temp_r25 && var_f30 > temp_r25 - var_r31->x) { + var_f30 = temp_r25 - var_r31->x; var_r23 = var_r30; } } } break; case 1: - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 < temp_r24) { + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y < temp_r24) { break; } } if (var_r30 != temp_r27) { - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 < temp_r24) { - temp_r20 = temp_r24 - var_r31->unk04; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y < temp_r24) { + temp_r20 = temp_r24 - var_r31->y; if (temp_r20 <= var_f30) { if (temp_r20 < var_f30) { var_f31 = 100000.0f; } - temp_r28 = temp_r25 - var_r31->unk02; + temp_r28 = temp_r25 - var_r31->x; temp_r28 = temp_r28 * temp_r28; if (temp_r28 < var_f31) { var_f30 = temp_r20; @@ -993,16 +1002,16 @@ void HuWinChoice(SomeWindowStruct* arg0) { } } else { var_r22 = -1000; - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 > var_r22) { - var_r22 = var_r31->unk04; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y > var_r22) { + var_r22 = var_r31->y; } } if (var_r22 != temp_r24) { var_f31 = 100000.0f; - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == var_r22) { - temp_r28 = temp_r25 - var_r31->unk02; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == var_r22) { + temp_r28 = temp_r25 - var_r31->x; temp_r28 = temp_r28 * temp_r28; if (temp_r28 < var_f31) { var_f31 = temp_r28; @@ -1014,35 +1023,35 @@ void HuWinChoice(SomeWindowStruct* arg0) { } break; case 2: - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == temp_r24 && var_r31->unk02 > temp_r25) { + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == temp_r24 && var_r31->x > temp_r25) { break; } } if (var_r30 != temp_r27) { - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == temp_r24 && var_r31->unk02 > temp_r25 && var_f30 > var_r31->unk02 - temp_r25) { - var_f30 = var_r31->unk02 - temp_r25; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == temp_r24 && var_r31->x > temp_r25 && var_f30 > var_r31->x - temp_r25) { + var_f30 = var_r31->x - temp_r25; var_r23 = var_r30; } } } break; case 3: - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 > temp_r24) { + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y > temp_r24) { break; } } if (var_r30 != temp_r27) { - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 > temp_r24) { - temp_r20 = var_r31->unk04 - temp_r24; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y > temp_r24) { + temp_r20 = var_r31->y - temp_r24; if (temp_r20 <= var_f30) { if (temp_r20 < var_f30) { var_f31 = 100000.0f; } - temp_r28 = temp_r25 - var_r31->unk02; + temp_r28 = temp_r25 - var_r31->x; temp_r28 = temp_r28 * temp_r28; if (temp_r28 < var_f31) { var_f30 = temp_r20; @@ -1054,16 +1063,16 @@ void HuWinChoice(SomeWindowStruct* arg0) { } } else { var_r22 = 1000; - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 < var_r22) { - var_r22 = var_r31->unk04; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y < var_r22) { + var_r22 = var_r31->y; } } if (var_r22 != temp_r24) { var_f31 = 100000.0f; - for (var_r30 = 0, var_r31 = arg0->unkEA; var_r30 < temp_r27; var_r30++, var_r31++) { - if (var_r30 != temp_r26 && !(var_r31->unk00 & 1) && var_r31->unk04 == var_r22) { - temp_r28 = temp_r25 - var_r31->unk02; + for (var_r30 = 0, var_r31 = arg0->choice_data; var_r30 < temp_r27; var_r30++, var_r31++) { + if (var_r30 != temp_r26 && !(var_r31->stat & 1) && var_r31->y == var_r22) { + temp_r28 = temp_r25 - var_r31->x; temp_r28 = temp_r28 * temp_r28; if (temp_r28 < var_f31) { var_f31 = temp_r28; @@ -1075,20 +1084,20 @@ void HuWinChoice(SomeWindowStruct* arg0) { } break; } - if (arg0->unkD6 != var_r23) { - arg0->unkD6 = var_r23; + if (arg0->choice != var_r23) { + arg0->choice = var_r23; HuAudFXPlay(0); - } else if (temp_r21 & (arg0->unk158 | 0x100)) { + } else if (temp_r21 & (arg0->key_auto | 0x100)) { HuAudFXPlay(2); - arg0->unk156 = temp_r21; - arg0->unk00 = 0; - } else if ((temp_r21 & 0x200) && !(arg0->unk4C & 0x10)) { + arg0->key_down = temp_r21; + arg0->stat = 0; + } else if ((temp_r21 & 0x200) && !(arg0->attr & 0x10)) { HuAudFXPlay(3); - arg0->unk156 = temp_r21; - arg0->unkD6 = -1; - arg0->unk00 = 0; + arg0->key_down = temp_r21; + arg0->choice = -1; + arg0->stat = 0; } - HuWinChoiceInlineFunction(arg0, arg0->unkD8, arg0->unkEA[var_r23].unk02 + spcFontTbl[0x14].unk0A, arg0->unkEA[var_r23].unk04 + spcFontTbl[0x14].unk0C); + HuWinSpcFontPosSet(arg0, arg0->cursor_sprite, arg0->choice_data[var_r23].x + spcFontTbl[20].center_x, arg0->choice_data[var_r23].y + spcFontTbl[20].center_y); } u32 HuWinActivePadGet(SomeWindowStruct* arg0) { @@ -1097,7 +1106,7 @@ u32 HuWinActivePadGet(SomeWindowStruct* arg0) { var_r30 = 0; for (var_r31 = 0; var_r31 < 4; var_r31++) { - if (arg0->unk01 & (1 << var_r31)) { + if (arg0->active_pad & (1 << var_r31)) { var_r30 |= winKey[var_r31]; } } @@ -1111,7 +1120,7 @@ u32 HuWinActiveKeyGetX(SomeWindowStruct* arg0) { u8 temp_r28; var_r29 = 0; - temp_r28 = (arg0->unk01 & ~arg0->unk02); + temp_r28 = (arg0->active_pad & ~arg0->player_disable); for (var_r30 = 0; var_r30 < 4; var_r30++) { if (temp_r28 & (1 << var_r30)) { for (var_r31 = 0; var_r31 < 4; var_r31++) { @@ -1130,107 +1139,107 @@ u32 HuWinActiveKeyGetX(SomeWindowStruct* arg0) { void HuWinPosSet(s16 arg0, f32 arg1, f32 arg2) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk6C = arg1; - temp_r31->unk70 = arg2; - HuSprGrpPosSet(temp_r31->unk04, arg1, arg2); + temp_r31->pos_x = arg1; + temp_r31->pos_y = arg2; + HuSprGrpPosSet(temp_r31->group, arg1, arg2); } void HuWinScaleSet(s16 arg0, f32 arg1, f32 arg2) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk74 = arg1; - temp_r31->unk78 = arg2; - HuSprGrpScaleSet(temp_r31->unk04, arg1, arg2); + temp_r31->scale_x = arg1; + temp_r31->scale_y = arg2; + HuSprGrpScaleSet(temp_r31->group, arg1, arg2); } void HuWinZRotSet(s16 arg0, f32 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk7C = arg1; - HuSprGrpZRotSet(temp_r31->unk04, arg1); + temp_r31->rot = arg1; + HuSprGrpZRotSet(temp_r31->group, arg1); } void HuWinCenterPosSet(s16 arg0, f32 arg1, f32 arg2) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprGrpCenterSet(temp_r31->unk04, temp_r31->unk68 / 2.0f - arg1, temp_r31->unk6A / 2.0f - arg2); + HuSprGrpCenterSet(temp_r31->group, temp_r31->w / 2.0f - arg1, temp_r31->h / 2.0f - arg2); } void HuWinDrawNoSet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprGrpDrawNoSet(temp_r31->unk04, arg1); + HuSprGrpDrawNoSet(temp_r31->group, arg1); } void HuWinScissorSet(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprGrpScissorSet(temp_r31->unk04, arg1, arg2, arg3, arg4); + HuSprGrpScissorSet(temp_r31->group, arg1, arg2, arg3, arg4); } void HuWinPriSet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; s16 var_r30; - HuSprPriSet(temp_r31->unk04, 0, arg1); - HuSprPriSet(temp_r31->unk04, 1, arg1); + HuSprPriSet(temp_r31->group, 0, arg1); + HuSprPriSet(temp_r31->group, 1, arg1); for (var_r30 = 2; var_r30 < 30; var_r30++) { - if (temp_r31->unk06[var_r30] != -1) { - HuSprPriSet(temp_r31->unk04, var_r30, arg1 - 1); + if (temp_r31->sprite_id[var_r30] != -1) { + HuSprPriSet(temp_r31->group, var_r30, arg1 - 1); } } - temp_r31->unk48 = arg1; + temp_r31->prio = arg1; } void HuWinAttrSet(s16 arg0, s32 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk4C |= arg1; + temp_r31->attr |= arg1; } void HuWinAttrReset(s16 arg0, u32 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk4C &= ~arg1; + temp_r31->attr &= ~arg1; } u8 HuWinStatGet(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - return temp_r31->unk00; + return temp_r31->stat; } void HuWinMesColSet(s16 arg0, u8 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk60 = arg1; - temp_r31->unk4C |= 0x80; + temp_r31->mess_color = arg1; + temp_r31->attr |= 0x80; } void HuWinMesPalSet(s16 arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk160[arg1][0] = arg2; - temp_r31->unk160[arg1][1] = arg3; - temp_r31->unk160[arg1][2] = arg4; + temp_r31->mess_pal[arg1][0] = arg2; + temp_r31->mess_pal[arg1][1] = arg3; + temp_r31->mess_pal[arg1][2] = arg4; } void HuWinBGTPLvlSet(s16 arg0, f32 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprTPLvlSet(temp_r31->unk04, 0, arg1); + HuSprTPLvlSet(temp_r31->group, 0, arg1); } -void HuWinBGColSet(s16 arg0, ColorRGB* arg1) { +void HuWinBGColSet(s16 arg0, GXColor *arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprColorSet(temp_r31->unk04, 0, arg1->r, arg1->g, arg1->b); + HuSprColorSet(temp_r31->group, 0, arg1->r, arg1->g, arg1->b); } void HuWinMesSpeedSet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk42 = arg1; + temp_r31->speed = arg1; } void HuWinMesRead(s32 arg0) { @@ -1255,24 +1264,24 @@ void HuWinMesRead(s32 arg0) { void HuWinMesSet(s16 arg0, u32 arg1) { SomeWindowStruct* win = &winData[arg0]; - win->unk00 = 1; + win->stat = 1; if ((arg1 & 0x80000000) == 0) { if (messDataPtr == 0) { OSReport("Error: No Message\n"); return; } - win->unk90 = MessData_MesPtrGet(messDataPtr, arg1); - if (win->unk90 == 0) { + win->mess = MessData_MesPtrGet(messDataPtr, arg1); + if (win->mess == 0) { OSReport("Error: No Message data\n"); HuWinMesSet(arg0, 0); return; } } else { - win->unk90 = (u8*) arg1; + win->mess = (u8*) arg1; } - if (!(win->unk4C & 0x80)) { - win->unk60 = 7; - win->unk44 = 0; + if (!(win->attr & 0x80)) { + win->mess_color = 7; + win->mess_time = 0; } } @@ -1284,63 +1293,63 @@ void HuWinInsertMesSet(s16 arg0, u32 arg1, s16 arg2) { OSReport("Error: No Message\n"); return; } - temp_r31->unkB4[arg2] = MessData_MesPtrGet(messDataPtr, arg1); - if (temp_r31->unkB4[arg2] == 0) { + temp_r31->insert_mess[arg2] = MessData_MesPtrGet(messDataPtr, arg1); + if (temp_r31->insert_mess[arg2] == 0) { OSReport("Error: No Message data\n"); } } else { - temp_r31->unkB4[arg2] = (void*) arg1; + temp_r31->insert_mess[arg2] = (void*) arg1; } } s16 HuWinChoiceGet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk4C |= 0x40; - while (temp_r31->unk00 != 0) { + temp_r31->attr |= 0x40; + while (temp_r31->stat != 0) { HuPrcVSleep(); } - for (; arg1 < temp_r31->unkD4; arg1++) { - if (!(temp_r31->unkEA[arg1].unk00 & 1)) { + for (; arg1 < temp_r31->num_choices; arg1++) { + if (!(temp_r31->choice_data[arg1].stat & 1)) { break; } } - if (arg1 == temp_r31->unkD4) { - for (arg1 = 0; arg1 < temp_r31->unkD4; arg1++) { - if (!(temp_r31->unkEA[arg1].unk00 & 1)) { + if (arg1 == temp_r31->num_choices) { + for (arg1 = 0; arg1 < temp_r31->num_choices; arg1++) { + if (!(temp_r31->choice_data[arg1].stat & 1)) { break; } } - if (arg1 == temp_r31->unkD4) { + if (arg1 == temp_r31->num_choices) { return -1; } } - temp_r31->unkD8 = HuWinSpcFontEntry(temp_r31, 0x14, temp_r31->unkEA[arg1].unk02, temp_r31->unkEA[arg1].unk04); - temp_r31->unk00 = 3; - temp_r31->unkD6 = arg1; - while (temp_r31->unk00 != 0) { + temp_r31->cursor_sprite = HuWinSpcFontEntry(temp_r31, 0x14, temp_r31->choice_data[arg1].x, temp_r31->choice_data[arg1].y); + temp_r31->stat = 3; + temp_r31->choice = arg1; + while (temp_r31->stat != 0) { HuPrcVSleep(); } - return temp_r31->unkD6; + return temp_r31->choice; } s16 HuWinChoiceNumGet(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - return temp_r31->unkD4; + return temp_r31->num_choices; } void HuWinChoiceDisable(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unkDA[arg1] = 1; + temp_r31->choice_disable[arg1] = 1; } s16 HuWinChoiceNowGet(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - if (temp_r31->unk00 == 3) { - return temp_r31->unkD6; + if (temp_r31->stat == 3) { + return temp_r31->choice; } else { return -1; } @@ -1349,7 +1358,7 @@ s16 HuWinChoiceNowGet(s16 arg0) { void HuWinMesWait(s16 arg0) { SomeWindowStruct* temp_r31 = &winData[arg0]; - while (temp_r31->unk00 != 0) { + while (temp_r31->stat != 0) { HuPrcVSleep(); } } @@ -1358,20 +1367,20 @@ void HuWinAnimSet(s16 arg0, AnimData* arg1, s16 arg2, f32 arg3, f32 arg4) { SomeWindowStruct* temp_r31 = &winData[arg0]; s16 temp_r30; - temp_r30 = HuSprCreate(arg1, temp_r31->unk48 - 1, arg2); + temp_r30 = HuSprCreate(arg1, temp_r31->prio - 1, arg2); HuWinSprSet(arg0, temp_r30, arg3, arg4); } s16 HuWinSprSet(s16 arg0, s16 arg1, f32 arg2, f32 arg3) { SomeWindowStruct* temp_r31 = &winData[arg0]; - SpriteGroupData* temp_r29 = &HuSprGrpData[temp_r31->unk04]; + SpriteGroupData* temp_r29 = &HuSprGrpData[temp_r31->group]; s16 var_r30; for (var_r30 = 2; var_r30 <= 9; var_r30++) { - if (temp_r31->unk06[var_r30] == -1) { - temp_r31->unk06[var_r30] = arg1; - HuSprGrpMemberSet(temp_r31->unk04, var_r30, arg1); - HuSprPosSet(temp_r31->unk04, var_r30, arg2 - temp_r29->center_x, arg3 - temp_r29->center_y); + if (temp_r31->sprite_id[var_r30] == -1) { + temp_r31->sprite_id[var_r30] = arg1; + HuSprGrpMemberSet(temp_r31->group, var_r30, arg1); + HuSprPosSet(temp_r31->group, var_r30, arg2 - temp_r29->center_x, arg3 - temp_r29->center_y); break; } } @@ -1380,29 +1389,29 @@ s16 HuWinSprSet(s16 arg0, s16 arg1, f32 arg2, f32 arg3) { void HuWinSprPosSet(s16 arg0, s16 arg1, f32 arg2, f32 arg3) { SomeWindowStruct* temp_r31 = &winData[arg0]; - SpriteGroupData* temp_r30 = &HuSprGrpData[temp_r31->unk04]; + SpriteGroupData* temp_r30 = &HuSprGrpData[temp_r31->group]; - HuSprPosSet(temp_r31->unk04, arg1, arg2 - temp_r30->center_x, arg3 - temp_r30->center_y); + HuSprPosSet(temp_r31->group, arg1, arg2 - temp_r30->center_x, arg3 - temp_r30->center_y); } void HuWinSprPriSet(s16 arg0, s16 arg1, s16 arg2) { SomeWindowStruct* temp_r31 = &winData[arg0]; - SpriteGroupData* sp10 = &HuSprGrpData[temp_r31->unk04]; + SpriteGroupData* sp10 = &HuSprGrpData[temp_r31->group]; - HuSprPriSet(temp_r31->unk04, arg1, arg2); + HuSprPriSet(temp_r31->group, arg1, arg2); } s16 HuWinSprIDGet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - return temp_r31->unk06[arg1]; + return temp_r31->sprite_id[arg1]; } void HuWinSprKill(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - HuSprGrpMemberKill(temp_r31->unk04, arg1); - temp_r31->unk06[arg1] = -1; + HuSprGrpMemberKill(temp_r31->group, arg1); + temp_r31->sprite_id[arg1] = -1; } void HuWinDispOff(s16 arg0) { @@ -1410,11 +1419,11 @@ void HuWinDispOff(s16 arg0) { s16 var_r30; for (var_r30 = 0; var_r30 < 30; var_r30++) { - if (temp_r31->unk06[var_r30] != -1) { - HuSprAttrSet(temp_r31->unk04, var_r30, 4); + if (temp_r31->sprite_id[var_r30] != -1) { + HuSprAttrSet(temp_r31->group, var_r30, 4); } } - temp_r31->unk4C |= 8; + temp_r31->attr |= 8; } void HuWinDispOn(s16 arg0) { @@ -1422,11 +1431,11 @@ void HuWinDispOn(s16 arg0) { s16 var_r30; for (var_r30 = 0; var_r30 < 30; var_r30++) { - if (temp_r31->unk06[var_r30] != -1) { - HuSprAttrReset(temp_r31->unk04, var_r30, 4); + if (temp_r31->sprite_id[var_r30] != -1) { + HuSprAttrReset(temp_r31->group, var_r30, 4); } } - temp_r31->unk4C = temp_r31->unk4C & ~8; + temp_r31->attr = temp_r31->attr & ~8; } void HuWinComKeyWait(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4) { @@ -1464,11 +1473,11 @@ void HuWinComKeySet(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { } void _HuWinComKeySet(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4) { - winComKeyBuf[comKeyIdx].unk04[0] = arg0; - winComKeyBuf[comKeyIdx].unk04[1] = arg1; - winComKeyBuf[comKeyIdx].unk04[2] = arg2; - winComKeyBuf[comKeyIdx].unk04[3] = arg3; - winComKeyBuf[comKeyIdx].unk00 = arg4; + winComKeyBuf[comKeyIdx].player[0] = arg0; + winComKeyBuf[comKeyIdx].player[1] = arg1; + winComKeyBuf[comKeyIdx].player[2] = arg2; + winComKeyBuf[comKeyIdx].player[3] = arg3; + winComKeyBuf[comKeyIdx].time = arg4; comKeyIdx++; comKeyIdx &= 0xFF; } @@ -1479,7 +1488,7 @@ void HuWinComKeyGet(s16 arg0, u32* arg1) { if (comKeyIdx == comKeyIdxNow) { for (var_r31 = 0; var_r31 < 4; var_r31++) { - if (!(temp_r30->unk02 & (1 << var_r31))) { + if (!(temp_r30->player_disable & (1 << var_r31))) { arg1[var_r31] = HuPadDStkRep[var_r31] | HuPadBtnDown[var_r31]; } else { arg1[var_r31] = 0; @@ -1487,17 +1496,17 @@ void HuWinComKeyGet(s16 arg0, u32* arg1) { } } else { for (var_r31 = 0; var_r31 < 4; var_r31++) { - arg1[var_r31] = winComKeyBuf[comKeyIdxNow].unk04[var_r31]; + arg1[var_r31] = winComKeyBuf[comKeyIdxNow].player[var_r31]; if (arg1[var_r31] == 0xFFFFFFFF) { - if (!(temp_r30->unk02 & (1 << var_r31))) { + if (!(temp_r30->player_disable & (1 << var_r31))) { arg1[var_r31] = HuPadDStkRep[var_r31] | HuPadBtnDown[var_r31]; } else { arg1[var_r31] = 0; } } } - winComKeyBuf[comKeyIdxNow].unk00--; - if (winComKeyBuf[comKeyIdxNow].unk00 <= 0) { + winComKeyBuf[comKeyIdxNow].time--; + if (winComKeyBuf[comKeyIdxNow].time <= 0) { comKeyIdxNow++; comKeyIdxNow &= 0xFF; } @@ -1638,7 +1647,7 @@ static void GetMesMaxSizeSub(u32 arg0) { break; case 0xE: var_r31++; - var_r29 = spcFontTbl[*var_r31 - 1].unk06 + 1; + var_r29 = spcFontTbl[*var_r31 - 1].w + 1; break; case 0x1F: var_r31++; @@ -1684,7 +1693,7 @@ static s32 GetMesMaxSizeSub2(SomeWindowStruct* arg0, u8* arg1) { case 0x20: break; case 0xA: - if (var_r27 != 0 && !(arg0->unk4C & 0x100)) { + if (var_r27 != 0 && !(arg0->attr & 0x100)) { var_r29 = 0; var_r26 = 1; } @@ -1711,7 +1720,7 @@ static s32 GetMesMaxSizeSub2(SomeWindowStruct* arg0, u8* arg1) { break; case 0xE: var_r31++; - var_r29 = spcFontTbl[*var_r31 - 1].unk06 + 1; + var_r29 = spcFontTbl[*var_r31 - 1].w + 1; break; case 0x1F: var_r31++; @@ -1747,19 +1756,19 @@ s32 HuWinKeyWaitNumGet(u32 arg0) { void HuWinPushKeySet(s16 arg0, s16 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk154 = arg1; + temp_r31->push_key = arg1; } void HuWinDisablePlayerSet(s16 arg0, u8 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk02 |= arg1; + temp_r31->player_disable |= arg1; } void HuWinDisablePlayerReset(s16 arg0, s32 arg1) { SomeWindowStruct* temp_r31 = &winData[arg0]; - temp_r31->unk02 &= ~arg1; + temp_r31->player_disable &= ~arg1; } void HuWinExCreate(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 arg4) { @@ -1767,25 +1776,25 @@ void HuWinExCreate(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 arg4) { } static s32 winPortraitTbl[] = { - 0x0086000F, - 0x00860010, - 0x00860011, - 0x00860012, - 0x00860013, - 0x00860014, - 0x00860015, - 0x00860016, - 0x00860017, - 0x00860018, - 0x00860019, - 0x0086001A, - 0x0086001B, - 0x00860009, - 0x0086000A, - 0x0086000B, - 0x0086000C, - 0x0086000D, - 0x0086000E + MAKE_DATA_NUM(DATADIR_WIN, 15), + MAKE_DATA_NUM(DATADIR_WIN, 16), + MAKE_DATA_NUM(DATADIR_WIN, 17), + MAKE_DATA_NUM(DATADIR_WIN, 18), + MAKE_DATA_NUM(DATADIR_WIN, 19), + MAKE_DATA_NUM(DATADIR_WIN, 20), + MAKE_DATA_NUM(DATADIR_WIN, 21), + MAKE_DATA_NUM(DATADIR_WIN, 22), + MAKE_DATA_NUM(DATADIR_WIN, 23), + MAKE_DATA_NUM(DATADIR_WIN, 24), + MAKE_DATA_NUM(DATADIR_WIN, 25), + MAKE_DATA_NUM(DATADIR_WIN, 26), + MAKE_DATA_NUM(DATADIR_WIN, 27), + MAKE_DATA_NUM(DATADIR_WIN, 9), + MAKE_DATA_NUM(DATADIR_WIN, 10), + MAKE_DATA_NUM(DATADIR_WIN, 11), + MAKE_DATA_NUM(DATADIR_WIN, 12), + MAKE_DATA_NUM(DATADIR_WIN, 13), + MAKE_DATA_NUM(DATADIR_WIN, 14) }; static inline void HuWinExCreateStyledInlineFunc(s16 arg0, s16 arg1, f32 arg2, f32 arg3) { @@ -1794,10 +1803,10 @@ static inline void HuWinExCreateStyledInlineFunc(s16 arg0, s16 arg1, f32 arg2, f SomeWindowStruct* var_3; void* var_4; - var_4 = HuAR_ARAMtoMRAMFileRead(winPortraitTbl[arg1], 0x10000000, 2); + var_4 = HuAR_ARAMtoMRAMFileRead(winPortraitTbl[arg1], MEMORY_DEFAULT_NUM, 2); var_2 = HuSprAnimRead(var_4); var_3 = &winData[arg0]; - var_1 = HuSprCreate(var_2, var_3->unk48 - 1, 0); + var_1 = HuSprCreate(var_2, var_3->prio - 1, 0); HuWinSprSet(arg0, var_1, arg2, arg3); } @@ -1811,7 +1820,7 @@ s16 HuWinExCreateStyled(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 arg4, s16 ar temp_r28 = HuWinCreate(arg0, arg1, arg2, arg3, arg5); temp_r24 = &winData[temp_r28]; if (arg5 == 1) { - temp_r24->unk62 = 9; + temp_r24->mess_shadow_color = 9; } if (arg4 >= 0) { HuWinExCreateStyledInlineFunc(temp_r28, arg4, 48.0f, 48.0f); @@ -1826,31 +1835,31 @@ void HuWinExAnimIn(s16 arg0) { s16 temp_r22; _HuWinHomeClear(temp_r31); - if (temp_r31->unk06[2] == -1) { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 0.0f); + if (temp_r31->sprite_id[2] == -1) { + HuSprScaleSet(temp_r31->group, 0, 1.0f, 0.0f); HuWinDispOn(arg0); for (var_r30 = 0; var_r30 <= 10; var_r30++) { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 1.0 - 1.1 * cos(M_PI * (9.0f * var_r30) / 180.0)); + HuSprScaleSet(temp_r31->group, 0, 1.0f, 1.0 - 1.1 * cos(M_PI * (9.0f * var_r30) / 180.0)); HuPrcVSleep(); } - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 1.0f); + HuSprScaleSet(temp_r31->group, 0, 1.0f, 1.0f); } else { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 0.0f); - HuSprScaleSet(temp_r31->unk04, 2, 1.0f, 0.0f); + HuSprScaleSet(temp_r31->group, 0, 1.0f, 0.0f); + HuSprScaleSet(temp_r31->group, 2, 1.0f, 0.0f); HuWinDispOn(arg0); for (var_r30 = 0; var_r30 <= 20; var_r30++) { if (var_r30 <= 10) { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 1.1 * (1.0 - cos(M_PI * (9.0f * var_r30) / 180.0))); + HuSprScaleSet(temp_r31->group, 0, 1.0f, 1.1 * (1.0 - cos(M_PI * (9.0f * var_r30) / 180.0))); } else { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, 1.0f); + HuSprScaleSet(temp_r31->group, 0, 1.0f, 1.0f); } if (var_r30 > 10) { temp_r22 = var_r30 - 10; - HuSprScaleSet(temp_r31->unk04, 2, 1.0f, 1.0 - 1.1 * cos(M_PI * (9.0f * temp_r22) / 180.0)); + HuSprScaleSet(temp_r31->group, 2, 1.0f, 1.0 - 1.1 * cos(M_PI * (9.0f * temp_r22) / 180.0)); } HuPrcVSleep(); } - HuSprScaleSet(temp_r31->unk04, 2, 1.0f, 1.0f); + HuSprScaleSet(temp_r31->group, 2, 1.0f, 1.0f); } } @@ -1861,20 +1870,20 @@ void HuWinExAnimOut(s16 arg0) { s16 temp_r22; _HuWinHomeClear(temp_r31); - if (temp_r31->unk06[2] == -1) { + if (temp_r31->sprite_id[2] == -1) { for (var_r30 = 0; var_r30 <= 10; var_r30++) { - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); + HuSprScaleSet(temp_r31->group, 0, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); HuPrcVSleep(); } HuWinDispOff(arg0); } else { for (var_r30 = 0; var_r30 <= 15; var_r30++) { if (var_r30 <= 10) { - HuSprScaleSet(temp_r31->unk04, 2, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); + HuSprScaleSet(temp_r31->group, 2, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); } if (var_r30 > 5) { temp_r22 = var_r30 - 5; - HuSprScaleSet(temp_r31->unk04, 0, 1.0f, cos(M_PI * (9.0f * temp_r22) / 180.0)); + HuSprScaleSet(temp_r31->group, 0, 1.0f, cos(M_PI * (9.0f * temp_r22) / 180.0)); } HuPrcVSleep(); } @@ -1891,14 +1900,14 @@ void HuWinExAnimPopIn(s16 arg0, s16 arg1) { s16 var_r30; for (var_r30 = 0; var_r30 <= 10; var_r30++) { - HuSprScaleSet(temp_r28->unk04, 2, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); + HuSprScaleSet(temp_r28->group, 2, 1.0f, cos(M_PI * (9.0f * var_r30) / 180.0)); HuPrcVSleep(); } HuWinSprKill(arg0, 2); HuWinExCreateStyledInlineFunc(arg0, arg1, 48.0f, 48.0f); for (var_r30 = 0; var_r30 <= 10; var_r30++) { - HuSprScaleSet(temp_r28->unk04, 2, 1.0f, sin(M_PI * (9.0f * var_r30) / 180.0)); + HuSprScaleSet(temp_r28->group, 2, 1.0f, sin(M_PI * (9.0f * var_r30) / 180.0)); HuPrcVSleep(); } - HuSprScaleSet(temp_r28->unk04, 2, 1.0f, 1.0f); + HuSprScaleSet(temp_r28->group, 2, 1.0f, 1.0f); }