From 49f6d0265073137700279496b4aa794651db1dba Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Tue, 18 Jan 2022 23:57:04 +0000 Subject: [PATCH] Add more menu symbols --- config/symbols.txt | 47 ++++++--- include/dra.h | 45 +++++++- src/dra/42398.c | 253 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 318 insertions(+), 27 deletions(-) diff --git a/config/symbols.txt b/config/symbols.txt index b122929de..3ee8c660a 100644 --- a/config/symbols.txt +++ b/config/symbols.txt @@ -737,12 +737,12 @@ D_80097A8D = 0x80097A8D; D_80097B36 = 0x80097B36; D_80097B90 = 0x80097B90; D_80097B9C = 0x80097B9C; -player_hp = 0x80097BA0; -player_hp_max = 0x80097BA4; -player_heart = 0x80097BA8; -player_heart_max = 0x80097BAC; -player_mp = 0x80097BB0; -player_mp_max = 0x80097BB4; +g_playerHp = 0x80097BA0; +g_playerHpMax = 0x80097BA4; +g_playerHeart = 0x80097BA8; +g_playerHeartMax = 0x80097BAC; +g_playerMp = 0x80097BB0; +g_playerMpMax = 0x80097BB4; player_stat_str = 0x80097BB8; player_stat_con = 0x80097BBC; player_stat_int = 0x80097BC0; @@ -755,10 +755,10 @@ D_80097BD8 = 0x80097BD8; D_80097BDC = 0x80097BDC; D_80097BE0 = 0x80097BE0; D_80097BE4 = 0x80097BE4; -player_level = 0x80097BE8; -player_exp = 0x80097BEC; -player_gold = 0x80097BF0; -player_kill_count = 0x80097BF4; +g_playerLevel = 0x80097BE8; +g_playerExp = 0x80097BEC; +g_playerGold = 0x80097BF0; +g_killCount = 0x80097BF4; player_equip_right_hand = 0x80097BF8; player_equip_left_hand = 0x80097BFC; player_equip_head = 0x80097C00; @@ -775,9 +775,9 @@ D_80097C28 = 0x80097C28; D_80097C2A = 0x80097C2A; D_80097C2C = 0x80097C2C; D_80097C2E = 0x80097C2E; -D_80097C30 = 0x80097C30; -D_80097C34 = 0x80097C34; -D_80097C38 = 0x80097C38; +g_timeHours = 0x80097C30; +g_timeMinutes = 0x80097C34; +g_timeSeconds = 0x80097C38; D_80097C3C = 0x80097C3C; D_80097C40 = 0x80097C40; D_80097C44 = 0x80097C44; @@ -817,7 +817,22 @@ D_800987B4 = 0x800987B4; D_80098850 = 0x80098850; c_chPlaystationButtons = 0x800A2D70; c_chShoulderButtons = 0x800A2D74; -c_strKills = 0x800A8284; +c_strALUCARD = 0x800A8258; +c_strSTR = 0x800A825C; +c_strCON = 0x800A8260; +c_strINT = 0x800A8264; +c_strLCK = 0x800A8268; +c_strEXP = 0x800A826C; +c_strNEXT = 0x800A8270; +c_strGOLD = 0x800A8274; +c_strLEVEL = 0x800A8278; +c_strTIME = 0x800A827C; +c_strROOMS = 0x800A8280; +c_strKILLS = 0x800A8284; +c_strHP = 0x800A8288; +c_strMP = 0x800A828C; +c_strHEART = 0x800A8290; +c_strSTATUS = 0x800A8294; c_strButton = 0x800A8298; c_strCloak = 0x800A829C; c_strCloak2 = 0x800A82A0; @@ -837,6 +852,7 @@ c_strStereo = 0x800A82DC; c_strMono = 0x800A82E0; c_strWindow = 0x800A82E4; c_strTime = 0x800A82E8; +c_strALUCART = 0x800A8300; c_strEquip = 0x800A83C8; c_strSpells = 0x800A83CC; c_strRelics = 0x800A83D0; @@ -856,6 +872,7 @@ c_strThrow2 = 0x800A8404; c_strShield = 0x800A8408; c_strMedicine = 0x800A840C; c_strDarkMethamorphosis = 0x800A8410; +c_arrExpNext = 0x800AC784; rect = 0x800ACD98; c_backbufferClear = 0x800ACDA0; aPbav = 0x800B107C; @@ -1090,6 +1107,7 @@ SetRoomForegroundLayer = 0x800ED774; SetRoomBackgroundLayer = 0x800ED90C; LoadRoomLayer = 0x800ED9F4; CheckCollision = 0x800EF45C; +IsAlucart = 0x800F4944; IsSpriteOutsideDrawArea = 0x800F54CC; ScissorSprite = 0x800F57C8; DrawMenuChar = 0x800F678C; @@ -1098,6 +1116,7 @@ DrawMenuInt = 0x800F68F4; DrawSettingsButton = 0x800F6FA4; DrawSettingsReverseCloak = 0x800F70DC; DrawSettingsSound = 0x800F7168; +DrawPauseMenu = 0x800F74B4; SetMenuBackgroundRect = 0x80107330; CopyMapOverlayCallback = 0x801074BC; nullsub_10 = 0x801362A4; diff --git a/include/dra.h b/include/dra.h index 10b04e9fa..af7f43b49 100644 --- a/include/dra.h +++ b/include/dra.h @@ -47,6 +47,7 @@ typedef struct extern s32 D_8006C39C; extern s32 D_8006C3A0; +extern s32 D_80072F2C; extern s32 D_80073060; extern s32 D_80073080; extern s16 D_80073404; @@ -61,8 +62,38 @@ extern s32 D_800974A0; extern s32 D_800974AC; extern u8 D_8009798A; extern u8 D_80097A8D; +extern s32 g_playerLevel; +extern s32 g_playerExp; +extern s32 g_playerGold; +extern s32 g_killCount; +extern s32 g_playerHeart; +extern s32 g_playerHeartMax; +extern s32 g_playerHp; +extern s32 g_playerHpMax; +extern s32 g_playerMp; +extern s32 g_playerMpMax; +extern s32 D_80097C20; +extern s32 D_80097C24; +extern s32 g_timeHours; +extern s32 g_timeMinutes; +extern s32 g_timeSeconds; -extern const char *c_strKills; +extern const char* c_strALUCARD; +extern const char* c_strSTR; +extern const char* c_strCON; +extern const char* c_strINT; +extern const char* c_strLCK; +extern const char* c_strEXP; +extern const char* c_strNEXT; +extern const char* c_strGOLD; +extern const char* c_strLEVEL; +extern const char* c_strTIME; +extern const char* c_strROOMS; +extern const char *c_strKILLS; +extern const char* c_strHP; +extern const char* c_strMP; +extern const char* c_strHEART; +extern const char* c_strSTATUS; extern const char *c_strButton; extern const char *c_strCloak; extern const char *c_strCloak2; @@ -82,6 +113,7 @@ extern const char *c_strStereo; extern const char *c_strMono; extern const char *c_strWindow; extern const char *c_strTime; +extern const char* c_strALUCART; extern const char *c_strSSword; extern s32 D_800A4B04; extern s32 D_800A7718; @@ -110,17 +142,24 @@ extern s32 D_80137E64; extern s32 D_80137E68; extern s32 D_80138F20; extern s32 D_80138F7C; +extern s16 D_80139000; extern s16 D_8013901C; extern s8 D_80139020; +extern s16 D_801390DC; +extern s16 D_801390DE; +extern s16 D_801390E0; extern s16 D_801396EA; extern u16 D_801396F4; extern s32 D_8013980C; extern u8 D_80139810; extern s32 D_80139828; +extern s16 D_80139A70; +extern u8 D_8013AEEC; extern s32 D_8013B158; extern s32 D_8013B3D0; +extern s16 D_8013B3E8[]; extern s32 D_8013B5E8; -extern s16 D_8013B61C; +extern s32 D_8013B61C; extern s32 D_8013B660; extern s16 D_8013B668; extern s32 D_8013B694; @@ -137,6 +176,7 @@ void func_800EDAE4(void); void func_800F4994(void); void func_800F4F48(void); void func_800F4FD0(void); +bool IsAlucart(); void func_800F53A4(void); s32 IsSpriteOutsideDrawArea(s32 x0, s32 x1, s32 y0, s32 y1, MenuContext* a5); bool ScissorSprite(SPRT* arg0, MenuContext* arg1); @@ -145,6 +185,7 @@ void func_800F5E68(MenuContext*, s32 iOption, s32 x, s32 y, s32 w, s32 h, s32, s s32 func_800F62E8(s32 arg0); void DrawMenuChar(s32 ch, int x, int y, void* context); void DrawMenuStr(const char* str, s32 x, s32 y, MenuContext* context); +void DrawMenuInt(s32 value, s32 x, s32 y, MenuContext*); void DrawSettingsReverseCloak(MenuContext* context); void DrawSettingsSound(MenuContext* context); void func_800F8858(MenuContext* context); diff --git a/src/dra/42398.c b/src/dra/42398.c index 2bde947c1..843a4cf88 100644 --- a/src/dra/42398.c +++ b/src/dra/42398.c @@ -378,7 +378,7 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F298C); INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F483C); -INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F4944); +INCLUDE_ASM("asm/dra/nonmatchings/42398", IsAlucart); INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F4994); @@ -592,7 +592,197 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F7244); INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F72BC); -INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F74B4); +#ifndef NON_MATCHING +INCLUDE_ASM("asm/dra/nonmatchings/42398", DrawPauseMenu); +#else +void func_800F622C(MenuContext* context); +void func_800F66BC(s32, s32 x, s32 y, MenuContext*, s32); +void func_800F6998(s32, s32 x, s32 y, MenuContext*, s32); +extern s32 D_8003C760; +extern s32 D_8003C9B0; +extern s32 D_8003C9FC; +extern s32 D_80097C1C; +extern s32 D_800A2D68; +extern s32 D_800A2D6C; +extern const char* D_800A83AC[]; +extern s32 c_arrExpNext[]; +extern s16 D_8013761C; +extern s32/*?*/ D_8013763A; +extern const u8 c_chPlaystationButtons[]; +extern const u8 c_chShoulderButtons[]; +extern s32 g_menuButtonSettingsConfig; +extern s32 player_stat_str; + +void DrawPauseMenu(s32 arg0) { + MenuContext* context; + s32 temp_s0; + s32 temp_s0_2; + s32 temp_s1; + s32 temp_s1_2; + s32 temp_s4; + s32 temp_v0; + s32 playerLevel; + s32 temp_v1_2; + const char* strPlayerName; + s32 expNext; + s32 phi_s4; + s32 phi_s3; + s32 phi_s5; + char phi_a0_3; + s32 phi_a1; + s32 phi_a0_4; + s32 phi_a1_2; + s32 phi_a2; + s32 phi_s4_2; + s32 phi_s3_2; + s32 phi_s0; + s32* phi_s5_2; + s32* phi_s1; + s32 phi_a0_5; + s32 phi_a1_3; + s32 phi_s5_3; + + context = &D_8013761C + (arg0 * 15); + func_800F53A4(); + if (arg0 == 1) { + func_800F622C(context); + + if (IsAlucart() != 0) { + strPlayerName = c_strALUCART; + } else { + strPlayerName = c_strALUCARD; + } + DrawMenuStr(strPlayerName, 0x80, 0x28, context); + DrawMenuStr(c_strHP, 0x60, 0x38, context); + DrawMenuInt(g_playerHp, 0xA8, 0x38, context); + DrawMenuChar(0xF, 0xB0, 0x38, context); + DrawMenuInt(g_playerHpMax, 0xD0, 0x38, context); + DrawMenuStr(c_strMP, 0x60, 0x44, context); + DrawMenuInt(g_playerMp, 0xA8, 0x44, context); + DrawMenuChar(0xF, 0xB0, 0x44, context); + DrawMenuInt(g_playerMpMax, 0xD0, 0x44, context); + DrawMenuStr(c_strHEART, 0x60, 0x50, context); + DrawMenuInt(g_playerHeart, 0xA8, 0x50, context); + DrawMenuChar(0xF, 0xB0, 0x50, context); + DrawMenuInt(g_playerHeartMax, 0xD0, 0x50, context); + DrawMenuStr(c_strEXP, 0x20, 0xB0, context); + DrawMenuInt(g_playerExp, 0x90, 0xB0, context); + DrawMenuStr(c_strNEXT, 0x20, 0xBC, context); + playerLevel = g_playerLevel; + if (playerLevel != 99) { + expNext = c_arrExpNext[playerLevel] - g_playerExp; + } else { + expNext = 0; + } + DrawMenuInt(expNext, 0x90, 0xBC, context); + DrawMenuStr(c_strGOLD, 0x20, 0xC8, context); + DrawMenuInt(g_playerGold, 0x90, 0xC8, context); + DrawMenuStr(c_strLEVEL, 0xF8, 0x28, context); + DrawMenuInt(g_playerLevel, 0x130, 0x28, context); + DrawMenuStr(c_strSTATUS, 0xF8, 0x38, context); + + temp_v1_2 = D_80072F2C; + phi_s4 = 0x25; + if ((temp_v1_2 & 0x8000) != 0) { + phi_s4 = 0x28; + } + if ((temp_v1_2 & 0x4000) != 0) { + phi_s4 = 0x26; + } + if ((temp_v1_2 & 0x80) != 0) { + phi_s4 = 0x27; + } + if (func_800F4944() != 0) { + phi_s4 = 0x2D; + } + DrawMenuStr((&c_strGOLD)[phi_s4], 0x104, 0x44, context); // TODO probably wrong + DrawMenuStr(c_strROOMS, 0xF0, 0x96, context); + DrawMenuInt(D_8003C760, 0x148, 0x96, context); + DrawMenuStr(c_strKILLS, 0xF0, 0xA4, context); + DrawMenuInt(g_killCount, 0x148, 0xA4, context); + DrawMenuStr(c_strTIME, 0xD0, 0xC0, context); + DrawMenuInt(g_timeHours, 0x108, 0xC0, context); + DrawMenuChar(0x1A, 0x110, 0xC0, context); + func_800F6998(g_timeMinutes, 0x120, 0xC0, context, 2); + DrawMenuChar(0x1A, 0x128, 0xC0, context); + func_800F6998(g_timeSeconds, 0x138, 0xC0, context, 2); + } + + phi_s3 = 0xE8; + if (context == &D_8013763A) { + phi_s3 = 0xF8; + phi_s5 = 0x58; + } else { + phi_s5 = 0x50; + } + func_800F66BC(D_800A2D68, phi_s3, phi_s5, context, 1); + + temp_s1 = g_menuButtonSettingsConfig; + phi_a1 = phi_s3 + 0x2C; + if (temp_s1 < 4) { + phi_a0_3 = (s32) c_chPlaystationButtons[temp_s1]; + } else { + DrawMenuChar((s32) c_chPlaystationButtons[temp_s1], phi_s3 + 0x28, phi_s5, context); + phi_a0_3 = (s32) c_chShoulderButtons[temp_s1]; + phi_a1 = phi_s3 + 0x30; + } + DrawMenuChar(phi_a0_3, phi_a1, phi_s5, context); + DrawMenuInt(D_80097C1C, phi_s3 + 0x4C, phi_s5, context); + + temp_s1_2 = D_8003C9FC; + phi_a1_2 = phi_s3 + 0x2C; + if (temp_s1_2 < 4) { + phi_a0_4 = (s32)c_chPlaystationButtons[temp_s1_2]; + phi_a2 = phi_s5 + 0xA; + } else { + temp_s0 = phi_s5 + 0xA; + DrawMenuChar((s32)c_chPlaystationButtons[temp_s1_2], phi_s3 + 0x28, temp_s0, context); + phi_a0_4 = (s32)c_chShoulderButtons[temp_s1_2]; + phi_a1_2 = phi_s3 + 0x30; + phi_a2 = temp_s0; + } + DrawMenuChar(phi_a0_4, phi_a1_2, phi_a2, context); + temp_s0_2 = phi_s3 + 0x4C; + DrawMenuInt(D_80097C20, temp_s0_2, phi_s5 + 0xA, context); + func_800F66BC(D_800A2D6C, phi_s3, phi_s5 + 0x14, context, 1); + DrawMenuInt(D_80097C24, temp_s0_2, phi_s5 + 0x1A, context); + + if (context == &D_8013763A) { + phi_s3_2 = 0x20; + phi_s5_3 = 0x78; + } else { + DrawMenuStr(D_800A83AC[D_8003C9B0], 8, 0x28, context); + phi_s3_2 = 0xC; + phi_s5_3 = 0x46; + } + phi_s4_2 = 0; + phi_s0 = phi_s5_3; + phi_s5_2 = &player_stat_str; + phi_s1 = &player_stat_str + 0x10; + do { + DrawMenuStr(*(&c_strSTR + (phi_s4_2 * 4)), phi_s3_2, phi_s0, context); + DrawMenuInt(*phi_s5_2, phi_s3_2 + 0x2C, phi_s0, context); + temp_v0 = *phi_s1; + if (temp_v0 != 0) { + if (temp_v0 > 0) { + DrawMenuChar(0xB, phi_s3_2 + 0x34, phi_s0, context); + phi_a0_5 = *phi_s1; + phi_a1_3 = phi_s3_2 + 0x44; + } else { + DrawMenuChar(0xD, phi_s3_2 + 0x34, phi_s0, context); + phi_a0_5 = -(s32) *phi_s1; + phi_a1_3 = phi_s3_2 + 0x44; + } + DrawMenuInt(phi_a0_5, phi_a1_3, phi_s0, context); + } + temp_s4 = phi_s4_2 + 1; + phi_s4_2 = temp_s4; + phi_s0 += 0xC; + phi_s5_2 += 4; + phi_s1 += 4; + } while (temp_s4 < 4); +} +#endif INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F7B60); @@ -609,28 +799,28 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F86E4); #ifndef NON_MATCHING INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800F8754); #else -void func_800F8754(MenuContext* context, s32 arg1, s32 arg2) { - s32 buttonId; +void func_800F8754(MenuContext* context, s32 x, s32 y) { + s32 curX; s32 phi_a1; if (D_801375DC == 0) { D_8013784C = 1; } - DrawMenuStr(c_strSpells, arg1 + 14, arg2 + 20, context); + DrawMenuStr(c_strSpells, x + 14, y + 20, context); if (D_801375FC == 0) { D_8013784C = 1; } else { D_8013784C = 0; } - phi_a1 = arg1 + 2; - DrawMenuStr(c_strFamiliars, phi_a1, arg2 + 68, context); + phi_a1 = x + 2; + DrawMenuStr(c_strFamiliars, phi_a1, y + 68, context); D_8013784C = 0; - DrawMenuStr(c_strEquip, arg1 + 18, arg2 + 4, context); - buttonId = arg1 + 0xE; - DrawMenuStr(c_strRelics, buttonId, arg2 + 36, context); - DrawMenuStr(c_strSystem, buttonId, arg2 + 52, context); + DrawMenuStr(c_strEquip, x + 18, y + 4, context); + curX = x + 0xE; + DrawMenuStr(c_strRelics, curX, y + 36, context); + DrawMenuStr(c_strSystem, curX, y + 52, context); } #endif @@ -1676,7 +1866,48 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80134678); INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80134714); +#ifndef NON_MATCHING INCLUDE_ASM("asm/dra/nonmatchings/42398", func_801347F8); +#else +void func_801347F8(s32 arg0) { + if (D_8013AEEC == 0) + return; + + if (((arg0 - 0x601) & 0xFFFF) < 0x2E0U) { + s16 playerLevel = D_80139000; + s32 temp_v0 = playerLevel * 3; + *(&D_801390DC + temp_v0) = arg0 - 0x600; + D_80139000 = ++playerLevel; + *(&D_801390DE + temp_v0) = 0xFFFF; + *(&D_801390E0 + temp_v0) = 0; + if (playerLevel == 0x100) { + D_80139000 = 0; + } + } else { + s16 temp_v0_2; + s16 temp_v0_3; + if (arg0 < 0x85) { + if (arg0 < 0x80) { + if (arg0 < 0x12 && arg0 >= 0x10) { + D_8013980C = 1; + } + } else { + D_8013B61C = 1; + } + } else if (arg0 < 0x95 && arg0 >= 0x90) { + D_8013B61C = 1; + } + + temp_v0_2 = D_80139A70; + temp_v0_3 = temp_v0_2 + 1; + D_80139A70 = temp_v0_3; + D_8013B3E8[temp_v0_2] = arg0; + if (temp_v0_3 == 0x100) { + D_80139A70 = 0; + } + } +} +#endif INCLUDE_ASM("asm/dra/nonmatchings/42398", func_8013493C);