Skip to content

Commit

Permalink
Match SetFsp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyZac authored Oct 27, 2024
1 parent 7be6153 commit 5123729
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 52 deletions.
7 changes: 7 additions & 0 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,13 @@ RT_JtSpeedUpClock = 0x274f84; // size:0x4
RT_JtSlowDownClock = 0x274f88; // size:0x4


////////////////////////////////////////////////////////////////
// P2/steprail.c
////////////////////////////////////////////////////////////////
func_001D32D8__FiP2JTl = 0x1D32D8; // type:func
func_001D31D0__FP2LOi = 0x1D31D0; // type:func


////////////////////////////////////////////////////////////////
// P2/sw.c
////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions include/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ struct CLOCK
TICK tickFrame;
};

extern float g_rtClock;
extern float g_rtClockPowerUp;
extern CLOCK g_clock;
//extern TICK s_tickLastRaw;; // Should be static?

/**
* @brief Sets the rate of the global clock.
*
Expand Down
1 change: 1 addition & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "include_asm.h"
#include "include_rodata.h"
#include "types.h"
#include "vtables.h"

/**
* @brief RGBA color value.
Expand Down
92 changes: 89 additions & 3 deletions include/jt.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,108 @@
#include "common.h"
#include <step.h>

/**
* JT state.
*
* @note Based on May proto, may be inaccurate.
*/
enum JTS
{
JTS_Stand = 0,
JTS_Run = 1,
JTS_Jump = 2,
JTS_Hang = 3,
JTS_Zap = 4,
JTS_Sidestep = 5,
JTS_Hide = 6,
JTS_Pipe = 7,
JTS_Edge = 8,
JTS_Celebrate = 9,
JTS_Rush = 10,
JTS_Puppet = 11,
JTS_Peek = 12,
JTS_Ski = 13,
JTS_Ball = 14,
JTS_Max = 15
};

/**
* JT body state.
*
* @note Based on May proto, may be inaccurate.
*/
enum JTBS
{
JTBS_Nil = -1,
JTBS_Jump_Init = 0,
JTBS_Jump_Rise = 1,
JTBS_Jump_Fall = 2,
JTBS_Jump_Boost = 3,
JTBS_Jump_In = 4,
JTBS_Jump_Out = 5,
JTBS_Jump_Thrown = 6,
JTBS_Jump_Smash = 7,
JTBS_Jump_Dive = 8,
JTBS_Jump_Target = 9,
JTBS_Jump_Spire = 10,
JTBS_Jump_Rail = 11,
JTBS_Jump_Hshape = 12,
JTBS_Jump_Hpnt = 13,
JTBS_Hide_Stand = 14,
JTBS_Hide_Sidestep = 15,
JTBS_Hide_PeekLeft = 16,
JTBS_Hide_PeekRight = 17,
JTBS_Hide_Run = 18,
JTBS_Hide_Spin = 19,
JTBS_Pipe_Init = 20,
JTBS_Pipe_Stay = 21,
JTBS_Pipe_Up = 22,
JTBS_Pipe_Down = 23,
JTBS_Pipe_Spin = 24,
JTBS_Celebrate_Key = 25,
JTBS_Celebrate_Timed = 26,
JTBS_Celebrate_UseKey = 27,
JTBS_Rush_Attack = 28,
JTBS_Rush_Bounce = 29,
JTBS_Peek_Enter = 30,
JTBS_Peek_Peek = 31,
JTBS_Peek_Exit = 32,
JTBS_Zap_Blunt = 33,
JTBS_Zap_Electric = 34,
JTBS_Zap_Fire = 35,
JTBS_Zap_Water = 36
};

/**
* @brief Sly entity.
*
* JT = "jewel thief" = codename for Sly.
*
* @todo Implement struct.
* @todo Match all structs it inherits from.
*/
struct JT : public STEP
{
// ...
uchar padding[0x1248];
LO *ploMine_1518;
uchar padding2[0xd03];
int unk2220;
uchar padding3[0x52c];
int unk2750;
};

/**
* @brief Sets the JT state and JT body state on the given JT.
*
* @param pjt Pointer to the JT instance.
* @param jts JT state value
* @param JTBS JT body state value
*/
void SetJtJts(JT *pjt, JTS jts, JTBS jtbs);

/**
* @brief Stubbed, does nothing.
*
* @param pjt Pointer to JT entity.
* @param pjt Pointer to JT instance.
* @param fProfile Profile flag.
*
* @deprecated
Expand Down
9 changes: 7 additions & 2 deletions include/po.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
#include <so.h>

/**
* @brief TBD
* @brief Player object.
*
* @todo Implement struct.
* @todo Implement struct fields.
*/
struct PO : public SO
{
// ...
};

/**
* @brief Gets a pointer to the current PO.
*/
PO *PpoCur();

#endif // PO_H
13 changes: 11 additions & 2 deletions include/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ struct BLOTI
struct BLOT
{
union {
void *pvtblot;
VTBLOT *pvtblot;
VTNOTE *pvtnote;
};
CFont *pfont;
char achzDraw[512];
Expand Down Expand Up @@ -144,9 +145,17 @@ extern TOTALS g_totals;

struct NOTE : public BLOT
{
// empty
u32 unk260;
u32 unk264;
u32 unk268;
u32 unk26C;
u32 unk270;
u32 unk274;
struct NOTE* unk278;
};

extern NOTE g_note;

// MARK: Letterbox

struct LETTERBOX : public BLOT
Expand Down
20 changes: 14 additions & 6 deletions include/steppower.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
*/
enum FSP
{
FSP_Nil = -1,
FSP_Dive = 0,
FSP_SpeedUpClock = 1,
FSP_SlowDownClock = 2,
FSP_Ball = 3,
FSP_Max = 4
FSP_Nil=-1,
FSP_Dive=0,
FSP_Ball=1,
FSP_SlowDownClock=2,
FSP_Mine=3,
FSP_SpeedUpClock=4,
FSP_Decoy=5,
FSP_Stun=6,
FSP_Max=7
};

extern FSP g_fsp;

/*static const char *s_mpfspachz[] = {
"&2T&.: Dive",
"&2T&.: Roll",
Expand All @@ -32,6 +37,9 @@ enum FSP
};*/
extern const char *s_mpfspachz[];

extern float RT_JtSpeedUpClock;
extern float RT_JtSlowDownClock;

/**
* @brief Set the selected powerup.
*/
Expand Down
21 changes: 21 additions & 0 deletions include/steprail.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @file steprail.h
*
* @brief Rail behavior for STEP objects.
*/
#ifndef STEPRAIL_H
#define STEPRAIL_H
#include "common.h"
#include <jt.h>

/**
* @brief Unknown function, more research needed.
*/
void func_001D31D0(LO *param_1, int param_2);

/**
* @brief Unknown function, more research needed.
*/
void func_001D32D8(int param_1, JT *param_2, long param_3);

#endif // STEPRAIL_H
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ typedef float f32;
typedef double f64;

typedef uint size_t;
#define nullptr (void *)0x0

#endif // TYPES_H
83 changes: 45 additions & 38 deletions include/vtables.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,52 @@
#ifndef VTABLES_H
#define VTABLES_H

struct BLOT;

struct VTBLOT
{
void *pfnInitBlot;
void *pfnPostBlotLoad;
void *pfnUpdateBlot;
void *pfnOnBlotActive;
void *pfnUpdateBlotActive;
void *pfnOnBlotReset;
void *pfnOnBlotPush;
void *pfnOnBlotPop;
void *pfnSetBlotAchzDraw;
void *pfnDrawBlot;
void *pfnRenderBlot;
void *pfnDtAppearBlot;
void *pfnDtVisibleBlot;
void *pfnDtDisappearBlot;
void *pfnShowBlot;
void *pfnHideBlot;
void *pfnSetBlotBlots;
void *pfnSetBlotClock;
void *pfnFIncludeBlotForPeg;
void (*pfnInitBlot)(BLOT *);
void (*pfnPostBlotLoad)(BLOT *);
void (*pfnUpdateBlot)(BLOT *);
void (*pfnOnBlotActive)(BLOT *);
void (*pfnUpdateBlotActive)(BLOT *);
void (*pfnOnBlotReset)(BLOT *);
void (*pfnOnBlotPush)(BLOT *);
void (*pfnOnBlotPop)(BLOT *);
void (*pfnSetBlotAchzDraw)(BLOT *, const char *);
void (*pfnDrawBlot)(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 *);
};

struct VTNOTE
{
void *pfnInitBlot;
void *pfnPostNoteLoad;
void *pfnUpdateBlot;
void *pfnOnBlotActive;
void *pfnUpdateBlotActive;
void *pfnOnBlotReset;
void *pfnOnBlotPush;
void *pfnOnBlotPop;
void *pfnSetNoteAchzDraw;
void *pfnDrawNote;
void *pfnRenderBlot;
void *pfnDtAppearBlot;
void *pfnDtVisibleBlot;
void *pfnDtDisappearBlot;
void *pfnShowBlot;
void *pfnHideBlot;
void *pfnSetBlotBlots;
void *pfnSetBlotClock;
void *pfnFIncludeBlotForPeg;
void (*pfnInitBlot)(BLOT *);
void (*pfnPostNoteLoad)(BLOT *);
void (*pfnUpdateBlot)(BLOT *);
void (*pfnOnBlotActive)(BLOT *);
void (*pfnUpdateBlotActive)(BLOT *);
void (*pfnOnBlotReset)(BLOT *);
void (*pfnOnBlotPush)(BLOT *);
void (*pfnOnBlotPop)(BLOT *);
void (*pfnSetNoteAchzDraw)(BLOT *, const char *);
void (*pfnDrawNote)(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
Loading

0 comments on commit 5123729

Please sign in to comment.