1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +00:00

Speedmeter Small cleanup (#1554)

* Small cleanup

* x
This commit is contained in:
Derek Hensley 2023-09-25 03:29:15 -07:00 committed by GitHub
parent 873c55faad
commit 4d7558df0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 23 deletions

View File

@ -8,28 +8,13 @@ struct GameState;
typedef struct { typedef struct {
/* 0x00 */ char unk_00[0x18]; /* 0x00 */ char unk_00[0x18];
/* 0x18 */ s32 unk_18; /* 0x18 */ s32 x; // Unused
/* 0x1C */ s32 y; /* 0x1C */ s32 y;
} SpeedMeter; // size = 0x20 } SpeedMeter; // size = 0x20
typedef struct {
/* 0x00 */ s32 maxval;
/* 0x04 */ s32 val;
/* 0x08 */ u16 backColor;
/* 0x0A */ u16 foreColor;
/* 0x0C */ s32 ulx;
/* 0x10 */ s32 lrx;
/* 0x14 */ s32 uly;
/* 0x18 */ s32 lry;
} SpeedMeterAllocEntry; // size = 0x1C
void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y);
void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Init(SpeedMeter* this);
void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this);
void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx); void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx);
void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx,
u32 lrx, u32 uly, u32 lry);
void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, struct GraphicsContext* gfxCtx);
void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, struct GraphicsContext* gfxCtx, struct GameState* state); void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, struct GraphicsContext* gfxCtx, struct GameState* state);
#endif #endif

View File

@ -74,15 +74,26 @@ SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = {
{ &gGraphUpdatePeriod, 0, 10, GPACK_RGBA5551(255, 0, 255, 1) }, { &gGraphUpdatePeriod, 0, 10, GPACK_RGBA5551(255, 0, 255, 1) },
}; };
typedef struct {
/* 0x00 */ s32 maxval;
/* 0x04 */ s32 val;
/* 0x08 */ u16 backColor;
/* 0x0A */ u16 foreColor;
/* 0x0C */ s32 ulx;
/* 0x10 */ s32 lrx;
/* 0x14 */ s32 uly;
/* 0x18 */ s32 lry;
} SpeedMeterAllocEntry; // size = 0x1C
#define gDrawRect(gfx, color, ulx, uly, lrx, lry) \ #define gDrawRect(gfx, color, ulx, uly, lrx, lry) \
gDPPipeSync(gfx); \ gDPPipeSync(gfx); \
gDPSetFillColor(gfx, ((color) << 16) | (color)); \ gDPSetFillColor(gfx, ((color) << 16) | (color)); \
gDPFillRectangle(gfx, (ulx), (uly), (lrx), (lry)); \ gDPFillRectangle(gfx, (ulx), (uly), (lrx), (lry)); \
gDPPipeSync(gfx) gDPPipeSync(gfx)
void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y) { void SpeedMeter_InitImpl(SpeedMeter* this, u32 x, u32 y) {
LogUtils_CheckNullPointer("this", this, "../speed_meter.c", 181); LogUtils_CheckNullPointer("this", this, "../speed_meter.c", 181);
this->unk_18 = arg1; this->x = x;
this->y = y; this->y = y;
} }
@ -207,7 +218,7 @@ void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, Gam
u32 ulx = 30; u32 ulx = 30;
u32 lrx = 290; u32 lrx = 290;
SpeedMeterAllocEntry entry; SpeedMeterAllocEntry entry;
u32 pad2; TwoHeadArena* tha;
s32 y; s32 y;
TwoHeadGfxArena* thga; TwoHeadGfxArena* thga;
u32 zeldaFreeMax; u32 zeldaFreeMax;
@ -237,10 +248,9 @@ void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, Gam
y++; y++;
} }
thga = (TwoHeadGfxArena*)&state->tha; tha = &state->tha;
//! @bug THA_GetRemaining call should be THGA_GetRemaining like the others below, harmless as-is SpeedMeter_InitAllocEntry(&entry, tha->size, tha->size - THA_GetRemaining(tha), GPACK_RGBA5551(0, 0, 255, 1),
SpeedMeter_InitAllocEntry(&entry, thga->size, thga->size - THA_GetRemaining(&thga->tha), GPACK_RGBA5551(0, 255, 0, 1), ulx, lrx, y, y);
GPACK_RGBA5551(0, 0, 255, 1), GPACK_RGBA5551(0, 255, 0, 1), ulx, lrx, y, y);
SpeedMeter_DrawAllocEntry(&entry, gfxCtx); SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
y++; y++;