Merge pull request #115 from t895/low-hanging-fruit

A few small functions
This commit is contained in:
Zac 2024-11-15 01:29:35 -05:00 committed by GitHub
commit 62776317c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 118 additions and 19 deletions

View File

@ -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
@ -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
@ -1187,6 +1189,8 @@ LimitVectorLength = 0x1EE2B0; // type:func
////////////////////////////////////////////////////////////////
// P2/wipe.c
////////////////////////////////////////////////////////////////
WipeToWorldWarp = 0x1F0428; // type:func
g_pwipe = 0x275f80;
g_wipe = 0x275f84;

View File

@ -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];

View File

@ -24,6 +24,8 @@ struct CLOCK
TICK tickFrame;
};
extern float D_0024CD4C;
extern float g_rtClock;
extern float g_rtClockPowerUp;
extern CLOCK g_clock;

View File

@ -225,6 +225,12 @@ struct GAME
int cgoldLatest;
};
struct LevelLoadData
{
};
extern const LevelLoadData *D_00247AB0[];
/**
* @brief Calls StartGame.
*/

View File

@ -74,6 +74,8 @@ struct BLOT
{
VTBLOT *pvtblot;
VTNOTE *pvtnote;
VTBINOC *pvtbinoc;
VTTIMER *pvttimer;
};
CFont *pfont;
undefined1 achzDraw[512];
@ -86,7 +88,7 @@ struct BLOT
float xOn, yOn;
float dx, dy;
float width, height;
float easing;
float uOn;
float dtAppear;
float dtVisible;
float dtDisappear;
@ -94,13 +96,7 @@ struct BLOT
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
@ -185,6 +181,7 @@ extern TOTALS g_totals;
struct NOTE : public BLOT
{
undefined1 padding_0[24];
struct NOTE *unk278;
};

View File

@ -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

View File

@ -6,6 +6,7 @@
#include "common.h"
#include <transition.h>
#include <oid.h>
/**
* @brief Wipe Kind
@ -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

View File

@ -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;

View File

@ -1,4 +1,5 @@
#include <game.h>
#include <wipe.h>
void StartupGame(void)
{
@ -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);

View File

@ -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);

3
src/P2/wipe.c Normal file
View File

@ -0,0 +1,3 @@
#include <wipe.h>
INCLUDE_ASM(const s32, "P2/wipe", WipeToWorldWarp);