Skip to content

Commit

Permalink
Merge pull request #115 from t895/low-hanging-fruit
Browse files Browse the repository at this point in the history
A few small functions
  • Loading branch information
TheOnlyZac authored Nov 15, 2024
2 parents efa48b2 + 55d982b commit 6277631
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 19 deletions.
4 changes: 4 additions & 0 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ SetClockEnabled__FP5CLOCKi = 0x1430C0; // type:func
StartupClock__Fv = 0x1430C8; // type:func
TickNow__Fv = 0x1430F8; // type:func

D_0024CD4C = 0x24cd4c; // size:0x4
g_rtClock = 0x261850; // size:0x4
g_rtClockPowerUp = 0x261854; // size:0x4
g_clock = 0x261858; // size:0x20
Expand Down Expand Up @@ -772,6 +773,7 @@ CcharmMost__Fv = 0x160D98; // type:func
reload_post_death = 0x160DA0; // type:func

// data
D_00247AB0 = 0x247ab0; // size:0x2c
g_pgsCur = 0x2623c0; // size:0x4
g_pwsCur = 0x2623c4; // size:0x4
g_plsCur = 0x2623c8; // size:0x4
Expand Down Expand Up @@ -1187,6 +1189,8 @@ LimitVectorLength = 0x1EE2B0; // type:func
////////////////////////////////////////////////////////////////
// P2/wipe.c
////////////////////////////////////////////////////////////////
WipeToWorldWarp = 0x1F0428; // type:func

g_pwipe = 0x275f80;
g_wipe = 0x275f84;

Expand Down
3 changes: 1 addition & 2 deletions include/binoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

struct BINOC : public BLOT
{
void *vtbinoc;
undefined1 padding_0[116];
undefined1 padding_0[144];
float value0;
undefined4 value1;
undefined1 padding_1[4];
Expand Down
2 changes: 2 additions & 0 deletions include/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct CLOCK
TICK tickFrame;
};

extern float D_0024CD4C;

extern float g_rtClock;
extern float g_rtClockPowerUp;
extern CLOCK g_clock;
Expand Down
6 changes: 6 additions & 0 deletions include/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ struct GAME
int cgoldLatest;
};

struct LevelLoadData
{
};

extern const LevelLoadData *D_00247AB0[];

/**
* @brief Calls StartGame.
*/
Expand Down
13 changes: 5 additions & 8 deletions include/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ struct BLOT
{
VTBLOT *pvtblot;
VTNOTE *pvtnote;
VTBINOC *pvtbinoc;
VTTIMER *pvttimer;
};
CFont *pfont;
undefined1 achzDraw[512];
Expand All @@ -86,21 +88,15 @@ struct BLOT
float xOn, yOn;
float dx, dy;
float width, height;
float easing;
float uOn;
float dtAppear;
float dtVisible;
float dtDisappear;
float dtBlotsExtra;
BLOTS blots;
float tBlots;
float *ptNow;
UIS uis;
int blotMode;
int selectedIndex;
undefined4 unk_0;
float dgDisplayMax;
undefined4 unk_1;
undefined4 *pfnsmack;
int fActive;
};

// MARK: Timer
Expand Down Expand Up @@ -185,6 +181,7 @@ extern TOTALS g_totals;

struct NOTE : public BLOT
{
undefined1 padding_0[24];
struct NOTE *unk278;
};

Expand Down
46 changes: 46 additions & 0 deletions include/vtables.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,50 @@ struct VTNOTE
int (*pfnFIncludeBlotForPeg)(BLOT *);
};

struct VTBINOC
{
void (*pfnInitBinoc)(BLOT *);
void (*pfnPostBinocLoad)(BLOT *);
void (*pfnUpdateBlot)(BLOT *);
void (*pfnOnBinocActive)(BLOT *);
void (*pfnUpdateBinocActive)(BLOT *);
void (*pfnOnBinocReset)(BLOT *);
void (*pfnOnBinocPush)(BLOT *);
void (*pfnOnBinocPop)(BLOT *);
void (*pfnSetBinocAchzDraw)(BLOT *, const char *);
void (*pfnDrawBinoc)(BLOT *);
void (*pfnRenderBlot)(BLOT *);
void (*pfnDtAppearBinoc)(BLOT *);
void (*pfnDtVisibleBlot)(BLOT *);
void (*pfnDtDisappearBinoc)(BLOT *);
void (*pfnShowBlot)(BLOT *);
void (*pfnHideBlot)(BLOT *);
void (*pfnSetBinocBlots)(BLOT *);
void (*pfnSetBlotClock)(BLOT *);
int (*pfnFIncludeBlotForPeg)(BLOT *);
};

struct VTTIMER
{
void (*pfnInitBlot)(BLOT *);
void (*pfnPostTimerLoad)(BLOT *);
void (*pfnUpdateTimer)(BLOT *);
void (*pfnOnBlotActive)(BLOT *);
void (*pfnUpdateBlotActive)(BLOT *);
void (*pfnOnBlotReset)(BLOT *);
void (*pfnOnBlotPush)(BLOT *);
void (*pfnOnBlotPop)(BLOT *);
void (*pfnSetBlotAchzDraw)(BLOT *, const char *);
void (*pfnDrawTimer)(BLOT *);
void (*pfnRenderBlot)(BLOT *);
void (*pfnDtAppearBlot)(BLOT *);
void (*pfnDtVisibleBlot)(BLOT *);
void (*pfnDtDisappearBlot)(BLOT *);
void (*pfnShowBlot)(BLOT *);
void (*pfnHideBlot)(BLOT *);
void (*pfnSetBlotBlots)(BLOT *);
void (*pfnSetBlotClock)(BLOT *);
int (*pfnFIncludeBlotForPeg)(BLOT *);
};

#endif // VTABLES_H
5 changes: 5 additions & 0 deletions include/wipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "common.h"
#include <transition.h>
#include <oid.h>

/**
* @brief Wipe Kind
Expand Down Expand Up @@ -48,4 +49,8 @@ struct WIPE
extern WIPE *g_pwipe;
extern WIPE g_wipe;

extern "C" {
void WipeToWorldWarp(const void *pchzWorld, OID oidWarp, WIPEK wipek);
}

#endif // WIPE_H
2 changes: 1 addition & 1 deletion src/P2/binoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void InitBinoc(BINOC *binoc, BLOTK blotk)

void ResetBinoc(BINOC *binoc)
{
binoc->pvtblot->pfnSetBlotAchzDraw(binoc, 0);
binoc->pvtbinoc->pfnSetBinocAchzDraw(binoc, 0);
SetBinocLookat(binoc, (ALO *)0);
binoc->dxReticle = 0.0f;
binoc->dyReticle = 0.0f;
Expand Down
7 changes: 6 additions & 1 deletion src/P2/game.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <game.h>
#include <wipe.h>

void StartupGame(void)
{
Expand Down Expand Up @@ -51,7 +52,11 @@ INCLUDE_ASM(const s32, "P2/game", UnloadGame__Fv);

INCLUDE_ASM(const s32, "P2/game", RetryGame__Fv);

INCLUDE_ASM(const s32, "P2/game", StartGame__Fv);
void StartGame()
{
UnloadGame();
WipeToWorldWarp(D_00247AB0, OID_Nil, WIPEK_Fade);
}

INCLUDE_ASM(const s32, "P2/game", FUN_00160948);

Expand Down
46 changes: 39 additions & 7 deletions src/P2/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,55 @@ INCLUDE_ASM(const s32, "P2/screen", UpdateTimer__FP5TIMER);

INCLUDE_ASM(const s32, "P2/screen", DrawTimer__FP5TIMER);

INCLUDE_ASM(const s32, "P2/screen", SetTimer__FP5TIMERf);
void SetTimer(TIMER *ptimer, float dt) {
float threshold = D_0024CD4C;
ptimer->pfntnThreshold = (undefined1 *)0;
ptimer->fThreshold = 0;
ptimer->dtExpire = 0.0;
ptimer->pfntnExpire = (undefined1 *)0;
ptimer->fStopped = 0;
*(int*)&ptimer->rgba = 0xff808080; // Union?
ptimer->svt = -1.0;
ptimer->nSecondsLast = -1;
ptimer->nTenthsLast = -1;
ptimer->dtThreshold = threshold;
ptimer->dt = dt;
SetTimerTimers(ptimer, TIMERS_Paused);
RebuildTimerAchzDraw(ptimer, 0.0);
ptimer->pvttimer->pfnShowBlot(ptimer);
}

INCLUDE_ASM(const s32, "P2/screen", SetTimerSpeed__FP5TIMERf);
void SetTimerSpeed(TIMER *ptimer, float svt) {
ptimer->svt = svt;
}

INCLUDE_ASM(const s32, "P2/screen", SetTimerExpire__FP5TIMERfPFP5TIMER9TIMERNOTK_v);

INCLUDE_ASM(const s32, "P2/screen", StartTimer__FP5TIMER);
void StartTimer(TIMER *ptimer) {
SetTimerTimers(ptimer, TIMERS_Running);
}

INCLUDE_ASM(const s32, "P2/screen", StopTimer__FP5TIMER);
void StopTimer(TIMER *ptimer) {
ptimer->fStopped = 1;
SetTimerTimers(ptimer, TIMERS_Expired);
}

INCLUDE_ASM(const s32, "P2/screen", RebuildTimerAchzDraw__FP5TIMERf);

INCLUDE_ASM(const s32, "P2/screen", SetTimerTimers__FP5TIMER6TIMERS);
void SetTimerTimers(TIMER *ptimer, TIMERS timers) {
if (ptimer->timers != timers) {
ptimer->timers = timers;
ptimer->tTimers = g_clock.t;
}
}

INCLUDE_ASM(const s32, "P2/screen", DtVisibleTrunkctr__FP8TRUNKCTR);
float DtVisibleTrunkctr(TRUNKCTR *ptrunkctr) {
return 0.0;
}

INCLUDE_ASM(const s32, "P2/screen", DtVisibleCrusherctr__FP10CRUSHERCTR);
float DtVisibleCrusherctr(CRUSHERCTR *pcrusherctr) {
return 0.0;
}

INCLUDE_ASM(const s32, "P2/screen", func_001ABE60);

Expand Down
3 changes: 3 additions & 0 deletions src/P2/wipe.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <wipe.h>

INCLUDE_ASM(const s32, "P2/wipe", WipeToWorldWarp);

0 comments on commit 6277631

Please sign in to comment.