diff --git a/Makefile.psp.mk b/Makefile.psp.mk index a216b71c10..1b9d746cb9 100644 --- a/Makefile.psp.mk +++ b/Makefile.psp.mk @@ -107,7 +107,7 @@ $(BUILD_DIR)/%.s.o: %.s OPT_HIGH = -O4,p #need this because otherwise the comma breaks the if-statement OPT_OVL = $(if $(findstring dra, $@), $(OPT_HIGH), -Op) # Allow override. Any file in this list will get Op. -OPT_LO_OVERRIDES = 67F0.c.o 22A40.c.o 23FE0.c.o 32DA0.c.o 3AE30.c.o 60D80.c.o 60F10.c.o +OPT_LO_OVERRIDES = 67F0.c.o 86A0.c.o 22A40.c.o 23FE0.c.o 32DA0.c.o 3AE30.c.o 60D80.c.o 60F10.c.o OPTIMIZATION = $(if $(filter $(notdir $@),$(OPT_LO_OVERRIDES)), -Op, $(OPT_OVL)) $(BUILD_DIR)/%.c.o: %.c $(MWCCPSP) $(MWCCGAP_APP) diff --git a/config/splat.pspeu.dra.yaml b/config/splat.pspeu.dra.yaml index 3103e0adba..11b73f4e65 100644 --- a/config/splat.pspeu.dra.yaml +++ b/config/splat.pspeu.dra.yaml @@ -174,6 +174,8 @@ segments: - [0x67E90, c, dra_psp/67E90] - [0x680C0, c, dra_psp/680C0] - [0x68D80, data] + - [0x6A8B8, .data, dra_psp/86A0] # Subwpn clut/u/v + - [0x6A8F8, data] - [0x6DDE8, .data, dra_psp/186E8] # "\no\n" - [0x6DDF0, .data, dra_psp/186E8] # func_psp_090F5188 strings - [0x6DE50, data] diff --git a/config/symbols.pspeu.dra.txt b/config/symbols.pspeu.dra.txt index 4d1ae42a3d..303606e476 100644 --- a/config/symbols.pspeu.dra.txt +++ b/config/symbols.pspeu.dra.txt @@ -16,6 +16,8 @@ func_801026BC = 0x090E28D0; func_801027A4 = 0x090E29A8; func_801027C4 = 0x090E29B0; func_80102CD8 = 0x090E2EC8; +DrawRichterHudSubweapon = 0x090E5020; +DrawHudSubweapon = 0x090E62B8; SetNextRoomToLoad = 0x090E73D0; func_800F0CD8 = 0x090E74E8; func_800F24F4 = 0x090E8B30; @@ -149,6 +151,7 @@ ExecCdSoundCommands = 0x09143ED8; CheckCollision = 0x09144C90; g_ApiInit = 0x0914A628; g_LevelHPIncrease = 0x09160B90; +D_800C52F8 = 0x09170960; D_800AFDA4 = 0x0917C638; g_DraEntityTbl = 0x09183838; g_SubwpnDefs = 0x09190EC8; @@ -157,6 +160,8 @@ D_8013799C = 0x091CDC70; D_801379A0 = 0x091CDC74; D_801379A4 = 0x091CDC78; D_801379A8 = 0x091CDC7C; +g_PlayerHud = 0x091CDC90; +g_HealingMailTimer = 0x091CDCBC; D_8013B5E8 = 0x091CDCC0; D_80137598 = 0x091CDD38; g_DebugWaitInfoTimer = 0x091CE268; diff --git a/config/symbols.pspeu.txt b/config/symbols.pspeu.txt index cb2162dd41..61c4251345 100644 --- a/config/symbols.pspeu.txt +++ b/config/symbols.pspeu.txt @@ -6,6 +6,7 @@ DrawSync = 0x0891B448; VSync = 0x0891B5BC; LoadImage = 0x0891BFE4; ClearImage = 0x0891CA60; +LoadTPage = 0x0891CF3C; ClearOTag = 0x0891D0E0; PutDrawEnv = 0x0891D484; PutDispEnv = 0x0891D68C; @@ -70,5 +71,6 @@ g_Clut = 0x091F5DF8; g_Clut_2800 = 0x091F85F8; g_Clut_2860 = 0x091F8658; g_GameTimer = 0x091FC460; +g_Timer = 0x091FC468; g_CurrentBuffer = 0x091FC4E0; g_CastleFlags = 0x09234730; diff --git a/src/dra/5F60C.c b/src/dra/5F60C.c index 4e5a6d1a2b..e277d971ca 100644 --- a/src/dra/5F60C.c +++ b/src/dra/5F60C.c @@ -1027,9 +1027,9 @@ void DrawHudSubweapon() { s32 statXPos; s32 hpdiff; s32 mpFillSteps; - s32 leading_zeros; s32 digitSpacing; - u16 clut; + u32 clut; + u32 leading_zeros; if (g_StageId == STAGE_ST0 || g_PlayableCharacter != PLAYER_ALUCARD) { DrawRichterHudSubweapon(); @@ -1041,13 +1041,13 @@ void DrawHudSubweapon() { prim->drawMode = DRAW_ABSPOS | DRAW_TPAGE2 | DRAW_TPAGE | DRAW_TRANSP; prim = prim->next; prim->p2--; - if (prim->p2 == 0) { + if (!prim->p2) { prim->p1 += 1; if (prim->p1 == 0xF) { prim->p1 = 0; - prim->p2 = rand() + 8; + prim->p2 = (rand() & 0xFF) + 8; prim->p3--; - if (prim->p3 != 0) { + if (prim->p3) { prim->p1 = 1; prim->p2 = 1; } else { @@ -1066,7 +1066,7 @@ void DrawHudSubweapon() { prim->v3 = g_HudSubwpnSpriteV[prim->p1 - 1] + 16; } } - if (prim->p1 != 0) { + if (prim->p1) { prim->drawMode = DRAW_ABSPOS; } else { prim->drawMode = DRAW_HIDE; @@ -1106,9 +1106,8 @@ void DrawHudSubweapon() { } if ((CheckEquipmentItemCount(ITEM_HEALING_MAIL, EQUIP_ARMOR)) && - ((g_Player.status & - (PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK4000000)) == - PLAYER_STATUS_UNK4000000)) { + (g_Player.status & PLAYER_STATUS_UNK4000000) && + !(g_Player.status & PLAYER_STATUS_TRANSFORM)) { g_HealingMailTimer[0]++; if (g_HealingMailTimer[0] >= 128) { g_Player.unk56 = 2; @@ -1127,12 +1126,16 @@ void DrawHudSubweapon() { mpFillSteps = (g_Status.mp * 50) / g_Status.mpMax; LoadTPage(D_800C52F8[10] + 4, 0, 0, 0x3DC, 0x100, 8, mpFillSteps); // Use one clut if MP is full, otherwise a different one - prim->clut = mpFillSteps == 50 ? 0x162 : 0x174; + if (mpFillSteps == 50) { + prim->clut = 0x162; + } else { + prim->clut = 0x174; + } if (D_8013B5E8 == 0) { hpdiff = g_Status.hp - g_PlayerHud.displayHP; if (hpdiff > 0) { - if (hpdiff >= 11) { + if (hpdiff > 10) { g_PlayerHud.displayHP += (hpdiff) / 10; } else { g_PlayerHud.displayHP++; @@ -1156,18 +1159,18 @@ void DrawHudSubweapon() { func_800EA5E4(1); // Normal health display } - if (g_PlayerHud.displayHP >= 1000) { + if (g_PlayerHud.displayHP > 999) { leading_zeros = 0; digitSpacing = 6; statXPos = 3; - } else if (g_PlayerHud.displayHP >= 100) { + } else if (g_PlayerHud.displayHP > 99) { leading_zeros = 1; digitSpacing = 6; - statXPos = 0; + statXPos = 6 - digitSpacing; } else { digitSpacing = 7; - statXPos = -6; - if (g_PlayerHud.displayHP >= 10) { + statXPos = 8 - digitSpacing * 2; + if (g_PlayerHud.displayHP > 9) { leading_zeros = 2; } else { leading_zeros = 3; @@ -1175,10 +1178,12 @@ void DrawHudSubweapon() { } // Thousands digit of HP prim = prim->next; - prim->u2 = prim->u0 = ((g_PlayerHud.displayHP / 1000) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = ((g_PlayerHud.displayHP / 1000) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos; - prim->x1 = prim->x3 = statXPos + 8; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; if (leading_zeros != 0) { @@ -1187,10 +1192,12 @@ void DrawHudSubweapon() { } // Hundreds digit of HP prim = prim->next; - prim->u2 = prim->u0 = (((g_PlayerHud.displayHP / 100) % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = (((g_PlayerHud.displayHP / 100) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos + digitSpacing; - prim->x1 = prim->x3 = statXPos + digitSpacing + 8; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; if (leading_zeros != 0) { leading_zeros--; @@ -1198,52 +1205,61 @@ void DrawHudSubweapon() { } // Tens digit of HP prim = prim->next; - prim->u2 = prim->u0 = (((g_PlayerHud.displayHP / 10) % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = (((g_PlayerHud.displayHP / 10) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos + (digitSpacing * 2); - prim->x1 = prim->x3 = statXPos + (digitSpacing * 2) + 8; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; if (leading_zeros != 0) { + leading_zeros--; prim->drawMode = DRAW_HIDE; } // Ones digit of HP prim = prim->next; - prim->u2 = prim->u0 = ((g_PlayerHud.displayHP % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = ((g_PlayerHud.displayHP % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos + (digitSpacing * 3); - prim->x1 = prim->x3 = statXPos + (digitSpacing * 3) + 8; + prim->x1 = prim->x3 = prim->x0 + 8; - if (g_Status.hearts >= 1000) { + if (g_Status.hearts > 999) { leading_zeros = 0; statXPos = 0x3B; - } else if (g_Status.hearts >= 100) { + } else if (g_Status.hearts > 99) { leading_zeros = 1; statXPos = 0x37; } else { statXPos = 0x33; - if (g_Status.hearts >= 10) { + if (g_Status.hearts > 9) { leading_zeros = 2; } else { leading_zeros = 3; } } - // Seems like this should be a simple || but that doesn't work here. - if (func_800FE3C4(&subwpn, 0, false) == 0) { - clut = 0x196; - } else if (g_Timer & 2) { - clut = 0x196; + if (func_800FE3C4(&subwpn, 0, false)) { + // Enable flickering with g_Timer + if (g_Timer & 2) { + clut = 0x196; + } else { + clut = 0x193; + } } else { - clut = 0x193; + clut = 0x196; } // Thousands digit of hearts prim = prim->next; - prim->u2 = prim->u0 = ((g_Status.hearts / 1000) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = ((g_Status.hearts / 1000) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos; - prim->x1 = prim->x3 = statXPos + 8; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; prim->clut = clut; if (leading_zeros != 0) { @@ -1252,10 +1268,12 @@ void DrawHudSubweapon() { } // Hundreds digit of hearts prim = prim->next; - prim->u2 = prim->u0 = (((g_Status.hearts / 100) % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = (((g_Status.hearts / 100) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos + 4; - prim->x1 = prim->x3 = statXPos + 0xC; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; prim->clut = clut; if (leading_zeros != 0) { @@ -1264,20 +1282,25 @@ void DrawHudSubweapon() { } // Tens digit of hearts prim = prim->next; - prim->u2 = prim->u0 = (((g_Status.hearts / 10) % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; + prim->u0 = (((g_Status.hearts / 10) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; prim->x0 = prim->x2 = statXPos + 8; - prim->x1 = prim->x3 = statXPos + 0x10; + prim->x1 = prim->x3 = prim->x0 + 8; prim->drawMode = DRAW_ABSPOS; prim->clut = clut; if (leading_zeros != 0) { + leading_zeros--; prim->drawMode = DRAW_HIDE; } // Ones digit of hearts prim = prim->next; - prim->u2 = prim->u0 = ((g_Status.hearts % 10) * 8) + 0x20; - prim->u3 = prim->u1 = prim->u0 + 8; - prim->x0 = prim->x2 = statXPos + 0xC; - prim->x1 = prim->x3 = statXPos + 0x14; + prim->u0 = ((g_Status.hearts % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + 12; + prim->x1 = prim->x3 = prim->x0 + 8; prim->clut = clut; } diff --git a/src/dra_psp/86A0.c b/src/dra_psp/86A0.c index 39decf6beb..437e3302cb 100644 --- a/src/dra_psp/86A0.c +++ b/src/dra_psp/86A0.c @@ -1,11 +1,313 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "../dra/dra.h" -INCLUDE_ASM("dra_psp/psp/dra_psp/86A0", func_psp_090E5020); +#define HUD_NUM_SPRITES 14 + +extern PlayerHud g_PlayerHud; +extern s32 g_HealingMailTimer[1]; // maybe part of g_PlayerHud +extern s32 D_8013B5E8; + +INCLUDE_ASM("dra_psp/psp/dra_psp/86A0", DrawRichterHudSubweapon); INCLUDE_ASM("dra_psp/psp/dra_psp/86A0", func_psp_090E6058); -INCLUDE_ASM("dra_psp/psp/dra_psp/86A0", func_psp_090E62B8); +u16 g_HudSubwpnSpriteClut[HUD_NUM_SPRITES] = { + 0x0175, 0x0176, 0x0175, 0x0176, 0x0175, 0x0176, 0x0175, + 0x0176, 0x0176, 0x0175, 0x0176, 0x0175, 0x0176, 0x0175, +}; +u8 g_HudSubwpnSpriteU[HUD_NUM_SPRITES] = { + 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, + 0x20, 0x20, 0x20, 0x10, 0x10, 0x00, 0x00}; +u8 g_HudSubwpnSpriteV[HUD_NUM_SPRITES] = { + 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; + +void DrawHudSubweapon() { + SubweaponDef subwpn; + RECT rect; + Primitive* prim; + + s32 statXPos; + s32 hpdiff; + s32 mpFillSteps; + s32 digitSpacing; + u32 clut; + u32 leading_zeros; + + if (g_StageId == STAGE_ST0 || g_PlayableCharacter != PLAYER_ALUCARD) { + DrawRichterHudSubweapon(); + return; + } + func_800EB4F8(D_800C52F8[g_Status.subWeapon], 0, 0x3C0, 0x120); + prim = &g_PrimBuf[g_PlayerHud.primIndex1]; + if (g_Status.subWeapon != 0) { + prim->drawMode = DRAW_ABSPOS | DRAW_TPAGE2 | DRAW_TPAGE | DRAW_TRANSP; + prim = prim->next; + prim->p2--; + if (!prim->p2) { + prim->p1 += 1; + if (prim->p1 == 0xF) { + prim->p1 = 0; + prim->p2 = (rand() & 0xFF) + 8; + prim->p3--; + if (prim->p3) { + prim->p1 = 1; + prim->p2 = 1; + } else { + prim->p3 = (rand() & 7) + 1; + } + } else { + prim->p2 = 1; + prim->clut = g_HudSubwpnSpriteClut[prim->p1 - 1]; + prim->u0 = g_HudSubwpnSpriteU[prim->p1 - 1]; + prim->v0 = g_HudSubwpnSpriteV[prim->p1 - 1]; + prim->u1 = g_HudSubwpnSpriteU[prim->p1 - 1] + 16; + prim->v1 = g_HudSubwpnSpriteV[prim->p1 - 1]; + prim->u2 = g_HudSubwpnSpriteU[prim->p1 - 1]; + prim->v2 = g_HudSubwpnSpriteV[prim->p1 - 1] + 16; + prim->u3 = g_HudSubwpnSpriteU[prim->p1 - 1] + 16; + prim->v3 = g_HudSubwpnSpriteV[prim->p1 - 1] + 16; + } + } + if (prim->p1) { + prim->drawMode = DRAW_ABSPOS; + } else { + prim->drawMode = DRAW_HIDE; + } + prim = prim->next; + prim->drawMode = DRAW_ABSPOS; + } else { + prim->drawMode = DRAW_HIDE; + prim = prim->next; + prim->drawMode = DRAW_HIDE; + prim = prim->next; + prim->drawMode = DRAW_HIDE; + } + + // Want to use prim = prim->next->next->next but that uses wrong register + prim = prim->next; + prim = prim->next; + prim = prim->next; + rect.x = 988; + rect.y = 256; + rect.w = 2; + rect.h = 56; + + ClearImage(&rect, 0, 0, 0); + if (!(g_Status.D_80097BF8 & 1)) { + if (!(g_GameTimer & 0x3F)) { + g_Status.mp++; + } + if ((CheckEquipmentItemCount(ITEM_MYSTIC_PENDANT, EQUIP_ACCESSORY) != + 0) && + ((g_GameTimer & 0x3F) == 0x1F)) { + g_Status.mp++; + } + if (g_Status.mp > g_Status.mpMax) { + g_Status.mp = g_Status.mpMax; + } + } + + if ((CheckEquipmentItemCount(ITEM_HEALING_MAIL, EQUIP_ARMOR)) && + (g_Player.status & PLAYER_STATUS_UNK4000000) && + !(g_Player.status & PLAYER_STATUS_TRANSFORM)) { + g_HealingMailTimer[0]++; + if (g_HealingMailTimer[0] >= 128) { + g_Player.unk56 = 2; + g_Player.unk58 = 1; + g_HealingMailTimer[0] = 0; + } + } else { + g_HealingMailTimer[0] = 0; + } + + // Why in the world would this call be in the HUD code? This codebase is + // awful. + DecrementStatBuffTimers(); + + // Represents MP fill level in fraction of 50 (2% each) + mpFillSteps = (g_Status.mp * 50) / g_Status.mpMax; + LoadTPage( + (u_long*)(D_800C52F8[10] + 4), 0, 0, 0x3DC, 0x100, 8, mpFillSteps); + // Use one clut if MP is full, otherwise a different one + if (mpFillSteps == 50) { + prim->clut = 0x162; + } else { + prim->clut = 0x174; + } + + if (D_8013B5E8 == 0) { + hpdiff = g_Status.hp - g_PlayerHud.displayHP; + if (hpdiff > 0) { + if (hpdiff > 10) { + g_PlayerHud.displayHP += (hpdiff) / 10; + } else { + g_PlayerHud.displayHP++; + } + } + if (hpdiff < 0) { + if (hpdiff < -10) { + g_PlayerHud.displayHP += (hpdiff) / 10; + } else { + g_PlayerHud.displayHP--; + } + } + } else { + D_8013B5E8--; + } + if (g_PlayerHud.displayHP == g_Status.hpMax) { + func_800EA5E4(2); // Likely related to HP showing bold when full + } else if (g_PlayerHud.displayHP <= g_Status.hpMax >> 2) { + func_800EA5E4(3); // Show yellow if under 1/4 health + } else { + func_800EA5E4(1); // Normal health display + } + + if (g_PlayerHud.displayHP > 999) { + leading_zeros = 0; + digitSpacing = 6; + statXPos = 3; + } else if (g_PlayerHud.displayHP > 99) { + leading_zeros = 1; + digitSpacing = 6; + statXPos = 6 - digitSpacing; + } else { + digitSpacing = 7; + statXPos = 8 - digitSpacing * 2; + if (g_PlayerHud.displayHP > 9) { + leading_zeros = 2; + } else { + leading_zeros = 3; + } + } + // Thousands digit of HP + prim = prim->next; + prim->u0 = ((g_PlayerHud.displayHP / 1000) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Hundreds digit of HP + prim = prim->next; + prim->u0 = (((g_PlayerHud.displayHP / 100) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + digitSpacing; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Tens digit of HP + prim = prim->next; + prim->u0 = (((g_PlayerHud.displayHP / 10) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + (digitSpacing * 2); + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Ones digit of HP + prim = prim->next; + prim->u0 = ((g_PlayerHud.displayHP % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + (digitSpacing * 3); + prim->x1 = prim->x3 = prim->x0 + 8; + + if (g_Status.hearts > 999) { + leading_zeros = 0; + statXPos = 0x3B; + } else if (g_Status.hearts > 99) { + leading_zeros = 1; + statXPos = 0x37; + } else { + statXPos = 0x33; + if (g_Status.hearts > 9) { + leading_zeros = 2; + } else { + leading_zeros = 3; + } + } + + if (func_800FE3C4(&subwpn, 0, false)) { + // Enable flickering with g_Timer + if (g_Timer & 2) { + clut = 0x196; + } else { + clut = 0x193; + } + } else { + clut = 0x196; + } + + // Thousands digit of hearts + prim = prim->next; + prim->u0 = ((g_Status.hearts / 1000) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + prim->clut = clut; + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Hundreds digit of hearts + prim = prim->next; + prim->u0 = (((g_Status.hearts / 100) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + 4; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + prim->clut = clut; + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Tens digit of hearts + prim = prim->next; + prim->u0 = (((g_Status.hearts / 10) % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + 8; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->drawMode = DRAW_ABSPOS; + prim->clut = clut; + if (leading_zeros != 0) { + leading_zeros--; + prim->drawMode = DRAW_HIDE; + } + // Ones digit of hearts + prim = prim->next; + prim->u0 = ((g_Status.hearts % 10) * 8) + 0x20; + prim->u2 = prim->u0; + prim->u1 = prim->u0 + 8; + prim->u3 = prim->u1; + prim->x0 = prim->x2 = statXPos + 12; + prim->x1 = prim->x3 = prim->x0 + 8; + prim->clut = clut; +} INCLUDE_ASM("dra_psp/psp/dra_psp/86A0", func_psp_090E7090); diff --git a/src/st/wrp_psp/blit_char.c b/src/st/wrp_psp/blit_char.c index 5399d7be93..30c4efaa9c 100644 --- a/src/st/wrp_psp/blit_char.c +++ b/src/st/wrp_psp/blit_char.c @@ -14,20 +14,19 @@ u8 func_psp_0923C2F8(u8 arg0) { extern s32 D_91ED5F8; extern u8* D_psp_0924BC78; -extern u8* D_psp_0924BC70; +extern s32 D_psp_0924BC70; extern s32 D_psp_0924BC68; // PSP unique? -void func_psp_0923C390(u8* arg0, s32 arg1) { +void func_psp_0923C390(s32 arg0, s32 arg1) { D_psp_0924BC78 = (u8*)&D_91ED5F8; D_psp_0924BC70 = arg0; D_psp_0924BC68 = arg1; } u8 func_psp_0923C2F8(u8 arg0); -void func_891CF3C(u8*, s32, s32, u8*, s32, s32, s32); -char* BlitChar(char* str, s32 xOffset, u8* pix, s32 stride) { +char* BlitChar(char* str, s32 xOffset, s32 posX, s32 posY) { const u16 MINSCODE = 0x8140; const u16 RIGHT_DOUBLE_QUOTATION_MARK = 0x8168; @@ -51,7 +50,7 @@ char* BlitChar(char* str, s32 xOffset, u8* pix, s32 stride) { s32 pos; ch = 0; - func_psp_0923C390(pix, stride); + func_psp_0923C390(posX, posY); size = 0x90; for (i = 0; i < size * 16; i++) { @@ -164,11 +163,11 @@ char* BlitChar(char* str, s32 xOffset, u8* pix, s32 stride) { } } - func_891CF3C(D_psp_0924BC78, 0, 0, D_psp_0924BC70 + sp34, - D_psp_0924BC68 + xOffset, size << 1, 0x10); + LoadTPage((u_long*)D_psp_0924BC78, 0, 0, D_psp_0924BC70 + sp34, + D_psp_0924BC68 + xOffset, size << 1, 0x10); D_psp_0924BC78 += size * 0x10; if (ch == 1) { - BlitChar(str, xOffset + 0x10, pix, stride + 0x10); + BlitChar(str, xOffset + 0x10, posX, posY + 0x10); } }