Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawRichterHUD matching for PSP #2037

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/symbols.pspeu.dra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func_80106A28 = 0x0913EC20;
LoadMonsterLibrarianPreview = 0x0913F780;
func_801071CC = 0x0913F7F8;
func_80107250 = 0x0913F860;
func_801072DC = 0x0913F8D0;
SetPrimRect = 0x0913F8D8;
SetTexturedPrimRect = 0x0913F908;
func_80131F68 = 0x09140610;
Expand Down
54 changes: 32 additions & 22 deletions src/dra/5F60C.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,21 +579,28 @@ void InitStatsAndGear(bool isDeathTakingItems) {
func_800F53A4();
}

#ifdef VERSION_PSP
#define RIC_HUD_NUM_SPRITES 10
#else
#define RIC_HUD_NUM_SPRITES 9
#endif

void DrawRichterHud(void) {
s32 i;
Primitive* prim;

g_PlayerHud.unk0C = 400;
g_PlayerHud.unk10 = 400;
D_801397FC = 0;
D_80139008 = 0;
g_PlayerHud.unk28 = 0;
D_8003C744 = 0;
g_PlayerHud.unk0C = 400;
g_PlayerHud.unk10 = 400;
g_PlayerHud.unk14 = 48;
g_PlayerHud.unk18 = 0;
g_PlayerHud.unk1C = g_PlayerHud.unk20 =
g_PlayerHud.unk0C * 100 / g_PlayerHud.unk10;
g_PlayerHud.unk24 = 0;
g_PlayerHud.unk20 = 40000 / (u32)g_PlayerHud.unk0C;
g_PlayerHud.unk1C = 40000 / g_PlayerHud.unk10;
g_PlayerHud.primIndex1 = func_800EDD9C(PRIM_GT4, 9);
g_PlayerHud.primIndex1 = func_800EDD9C(PRIM_GT4, RIC_HUD_NUM_SPRITES);
prim = &g_PrimBuf[g_PlayerHud.primIndex1];

SetTexturedPrimRect(prim, 2, 22, 32, 96, 0, 0);
Expand Down Expand Up @@ -654,30 +661,33 @@ void DrawRichterHud(void) {
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

// Extra HUD sprite on PSP! Should identify what this is.
#ifdef VERSION_PSP
SetTexturedPrimRect(prim, 18, 38, 8, 8, 0, 0);
prim->tpage = 0x1B;
prim->clut = 0x102;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;
#endif

SetTexturedPrimRect(prim, 33, 20, 64, 24, 64, 40);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1EF;
prim->drawMode = DRAW_ABSPOS;

g_PlayerHud.primIndex2 = func_800EDD9C(4, 16);
prim = &g_PrimBuf[g_PlayerHud.primIndex2];
if (prim != 0) {
s32 u = 32;
s32 x = 216;
do {
SetTexturedPrimRect(prim, x, 22, 2, 96, u, 0);
func_801072DC(prim);
prim->tpage = 0x1B;
prim->clut = 0x100;
prim->priority = 0x1EE;
prim->drawMode = DRAW_HIDE;
prim->p1 = (rand() & 0x3F) + 1;
prim->p2 = 0;
prim = prim->next;
u += 2;
x += 2;
} while (prim != 0);
for (prim = &g_PrimBuf[g_PlayerHud.primIndex2], i = 0; prim != 0; i++,
prim = prim->next) {
SetTexturedPrimRect(prim, 216 + i * 2, 22, 2, 96, 32 + i * 2, 0);
func_801072DC(prim);
prim->tpage = 0x1B;
prim->clut = 0x100;
prim->priority = 0x1EE;
prim->drawMode = DRAW_HIDE;
prim->p1 = (rand() & 0x3F) + 1;
prim->p2 = 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/dra/63ED4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ void func_80107250(Primitive* prim, s32 colorIntensity) {

void func_801072BC(POLY_GT4* poly) { func_80107250(poly, 0); }

void func_801072DC(POLY_GT4* poly) { func_80107250(poly, 0x80); }
void func_801072DC(Primitive* prim) { func_80107250(prim, 0x80); }

void func_801072FC(POLY_G4* poly) {
setRGB0(poly, 0, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/dra/dra.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ extern s32 D_800B0918;
extern s32 D_800B091C;
extern s32 D_800B0920;

void func_801072DC(POLY_GT4* poly);
void func_801072DC(Primitive* prim);
void InitializePads(void);
void ReadPads(void);
void ClearBackbuffer(void);
Expand Down
2 changes: 1 addition & 1 deletion src/dra_psp/61F30.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ INCLUDE_ASM("dra_psp/psp/dra_psp/61F30", func_80107250);

INCLUDE_ASM("dra_psp/psp/dra_psp/61F30", func_psp_0913F8C8);

INCLUDE_ASM("dra_psp/psp/dra_psp/61F30", func_psp_0913F8D0);
INCLUDE_ASM("dra_psp/psp/dra_psp/61F30", func_801072DC);

#include "../set_prim_rect.h"
118 changes: 114 additions & 4 deletions src/dra_psp/67F0.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,120 @@ 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", DrawRichterHud);
extern PlayerHud g_PlayerHud;
extern s32 g_HealingMailTimer[1]; // maybe part of g_PlayerHud

#ifdef VERSION_PSP
#define RIC_HUD_NUM_SPRITES 10
#else
#define RIC_HUD_NUM_SPRITES 9
#endif

void DrawRichterHud(void) {
s32 i;
Primitive* prim;

D_801397FC = 0;
D_80139008 = 0;
g_PlayerHud.unk28 = 0;
D_8003C744 = 0;
g_PlayerHud.unk0C = 400;
g_PlayerHud.unk10 = 400;
g_PlayerHud.unk14 = 48;
g_PlayerHud.unk18 = 0;
g_PlayerHud.unk1C = g_PlayerHud.unk20 =
g_PlayerHud.unk0C * 100 / g_PlayerHud.unk10;
g_PlayerHud.unk24 = 0;
g_PlayerHud.primIndex1 = func_800EDD9C(PRIM_GT4, RIC_HUD_NUM_SPRITES);
prim = &g_PrimBuf[g_PlayerHud.primIndex1];

SetTexturedPrimRect(prim, 2, 22, 32, 96, 0, 0);
prim->tpage = 0x1B;
prim->clut = 0x101;
prim->priority = 0x1EF;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, g_PlayerHud.unk14 + 216, 22, 32, 96, 32, 0);
prim->tpage = 0x1B;
prim->clut = 0x100;
prim->priority = 0x1EF;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, 4, 112, 9, 3, 64, 89);
prim->tpage = 0x1B;
prim->clut = 0x105;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, g_PlayerHud.unk14 + 228, 112, 9, 3, 64, 89);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim->p1 = 0;
prim->p2 = 6;
prim = prim->next;

SetTexturedPrimRect(prim, g_PlayerHud.unk14 + 236, 112, 9, 3, 64, 89);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, 14, 27, 8, 8, 0, 96);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, 22, 27, 8, 8, 0, 96);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

SetTexturedPrimRect(prim, 18, 38, 8, 8, 0, 0);
prim->tpage = 0x1B;
prim->clut = 0x102;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;

// Extra HUD sprite on PSP! Should identify what this is.
#ifdef VERSION_PSP
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set up exactly the same as the previous prim so I'd think it's displaying the same thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. Good catch. Can't imagine why they would possibly do that then.

SetTexturedPrimRect(prim, 18, 38, 8, 8, 0, 0);
prim->tpage = 0x1B;
prim->clut = 0x102;
prim->priority = 0x1F0;
prim->drawMode = DRAW_ABSPOS;
prim = prim->next;
#endif

SetTexturedPrimRect(prim, 33, 20, 64, 24, 64, 40);
prim->tpage = 0x1B;
prim->clut = 0x103;
prim->priority = 0x1EF;
prim->drawMode = DRAW_ABSPOS;

g_PlayerHud.primIndex2 = func_800EDD9C(4, 16);
for (prim = &g_PrimBuf[g_PlayerHud.primIndex2], i = 0; prim != 0; i++,
prim = prim->next) {
SetTexturedPrimRect(prim, 216 + i * 2, 22, 2, 96, 32 + i * 2, 0);
func_801072DC(prim);
prim->tpage = 0x1B;
prim->clut = 0x100;
prim->priority = 0x1EE;
prim->drawMode = DRAW_HIDE;
prim->p1 = (rand() & 0x3F) + 1;
prim->p2 = 0;
}
}

extern s32 D_psp_091472F8[];
extern s32 D_psp_09147418[];
Expand Down Expand Up @@ -188,9 +301,6 @@ u16 g_HudSpriteBlend[HUD_NUM_SPRITES] = {
0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
};

extern PlayerHud g_PlayerHud;
extern s32 g_HealingMailTimer[1]; // maybe part of g_PlayerHud

// Need these for now, they might be changed later.
extern Primitive* func_psp_090E4CD0(Primitive*);
extern Primitive* func_psp_090E4828(Primitive*);
Expand Down
Loading