DrawHud working for PSP (#2024)

Next one to go with my previous function. Hoping to get full
code-sharing working soon.
This commit is contained in:
bismurphy 2025-01-03 16:26:47 -05:00 committed by GitHub
parent 2348cd0d40
commit 7dc6e68581
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 77 additions and 10 deletions

View File

@ -174,6 +174,7 @@ segments:
- [0x67E90, c, dra_psp/67E90]
- [0x680C0, c, dra_psp/680C0]
- [0x68D80, data]
- [0x6A818, .data, dra_psp/86A0] # DrawHud arrays
- [0x6A8B8, .data, dra_psp/86A0] # Subwpn clut/u/v
- [0x6A8F8, data]
- [0x6DDE8, .data, dra_psp/186E8] # "\no\n"

View File

@ -16,7 +16,9 @@ func_801026BC = 0x090E28D0;
func_801027A4 = 0x090E29A8;
func_801027C4 = 0x090E29B0;
func_80102CD8 = 0x090E2EC8;
DrawRichterHud = 0x090E4370;
DrawRichterHudSubweapon = 0x090E5020;
DrawHud = 0x090E6058;
DrawHudSubweapon = 0x090E62B8;
SetNextRoomToLoad = 0x090E73D0;
func_800F0CD8 = 0x090E74E8;

View File

@ -977,8 +977,8 @@ void DrawHud(void) {
s32 i;
D_8013B5E8 = 0;
g_HealingMailTimer[0] = 0;
g_PlayerHud.displayHP = g_Status.hp;
g_HealingMailTimer[0] = 0;
if ((g_StageId == STAGE_ST0) || (g_PlayableCharacter != PLAYER_ALUCARD)) {
DrawRichterHud();
@ -987,11 +987,8 @@ void DrawHud(void) {
g_PlayerHud.primIndex1 = func_800EDD9C(PRIM_GT4, HUD_NUM_SPRITES);
prim = &g_PrimBuf[g_PlayerHud.primIndex1];
if (!prim) {
return;
}
for (i = 0; prim != NULL; i++) {
for (i = 0; prim != NULL; i++, prim = prim->next) {
SetTexturedPrimRect(
prim, g_HudSpriteX[i], g_HudSpriteY[i], g_HudSpriteW[i],
g_HudSpriteH[i], g_HudSpriteU[i], g_HudSpriteV[i]);
@ -1011,11 +1008,9 @@ void DrawHud(void) {
if (i == 1) {
prim->p1 = 0;
prim->p2 = rand() + 8;
prim->p2 = (rand() & 0xFF) + 8;
prim->p3 = (7 & rand()) + 1;
}
prim = prim->next;
}
}

View File

@ -5,7 +5,7 @@ INCLUDE_ASM("dra_psp/psp/dra_psp/67F0", func_psp_090E3170);
INCLUDE_ASM("dra_psp/psp/dra_psp/67F0", func_psp_090E31F8);
INCLUDE_ASM("dra_psp/psp/dra_psp/67F0", func_psp_090E4370);
INCLUDE_ASM("dra_psp/psp/dra_psp/67F0", DrawRichterHud);
INCLUDE_ASM("dra_psp/psp/dra_psp/67F0", func_psp_090E4828);

View File

@ -3,13 +3,82 @@
#define HUD_NUM_SPRITES 14
u8 g_HudSpriteX[HUD_NUM_SPRITES] = {
90, 90, 90, 34, 2, 31, 3, 9, 15, 21, 59, 63, 67, 71,
};
u8 g_HudSpriteY[HUD_NUM_SPRITES] = {
25, 25, 25, 22, 19, 26, 33, 33, 33, 33, 34, 34, 34, 34,
};
u8 g_HudSpriteU[HUD_NUM_SPRITES] = {
0x00, 0x10, 0x68, 0x20, 0x00, 0x70, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
u8 g_HudSpriteV[HUD_NUM_SPRITES] = {
0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20,
0x20, 0x20, 0x20, 0x18, 0x18, 0x18, 0x18,
};
u8 g_HudSpriteW[HUD_NUM_SPRITES] = {
16, 16, 8, 72, 32, 8, 8, 8, 8, 8, 8, 8, 8, 8,
};
u8 g_HudSpriteH[HUD_NUM_SPRITES] = {
16, 16, 8, 24, 32, 56, 16, 16, 16, 16, 8, 8, 8, 8,
};
u16 g_HudSpriteClut[HUD_NUM_SPRITES] = {
0x0173, 0x0175, 0x0170, 0x0172, 0x0171, 0x0174, 0x0171,
0x0171, 0x0171, 0x0171, 0x0196, 0x0196, 0x0196, 0x0196,
};
u16 g_HudSpriteBlend[HUD_NUM_SPRITES] = {
DRAW_HIDE, DRAW_HIDE, DRAW_HIDE, 0x2000, 0x2000, 0x2000, 0x2000,
0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
};
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);
void DrawHud(void) {
Primitive* prim;
s32 i;
D_8013B5E8 = 0;
g_PlayerHud.displayHP = g_Status.hp;
g_HealingMailTimer[0] = 0;
if ((g_StageId == STAGE_ST0) || (g_PlayableCharacter != PLAYER_ALUCARD)) {
DrawRichterHud();
return;
}
g_PlayerHud.primIndex1 = func_800EDD9C(PRIM_GT4, HUD_NUM_SPRITES);
prim = &g_PrimBuf[g_PlayerHud.primIndex1];
for (i = 0; prim != NULL; i++, prim = prim->next) {
SetTexturedPrimRect(
prim, g_HudSpriteX[i], g_HudSpriteY[i], g_HudSpriteW[i],
g_HudSpriteH[i], g_HudSpriteU[i], g_HudSpriteV[i]);
prim->tpage = 0x1F;
prim->clut = g_HudSpriteClut[i];
prim->priority = 0x1F0;
prim->drawMode = g_HudSpriteBlend[i];
if (i == 5) {
SetPrimRect(prim, g_HudSpriteX[i], g_HudSpriteY[i], g_HudSpriteH[i],
g_HudSpriteW[i]);
prim->y0 = prim->y2;
prim->x1 = prim->x0;
prim->x2 = prim->x3;
prim->y3 = prim->y1;
}
if (i == 1) {
prim->p1 = 0;
prim->p2 = (rand() & 0xFF) + 8;
prim->p3 = (7 & rand()) + 1;
}
}
}
u16 g_HudSubwpnSpriteClut[HUD_NUM_SPRITES] = {
0x0175, 0x0176, 0x0175, 0x0176, 0x0175, 0x0176, 0x0175,