Skip to content

Commit

Permalink
Coin matches
Browse files Browse the repository at this point in the history
Matched InitDprize, InitCoin, InitCharm, and InitKey
Consequently had to also make some progress on ALO and DPrize

Also created FICG, not sure if it's in the right place
  • Loading branch information
LordBozo committed Aug 7, 2024
1 parent 2ae08c6 commit ba55d12
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/sly1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ segments:
- [0x43ed0, c, P2/clock]
- [0x44148, c, P2/cm]
- [0x47100, asm, P2/cnvo]
- [0x491A0, c, P2/coin]
- [0x47340, c, P2/coin]
- [0x4a398, asm, P2/cplcy]
- [0x4bbd0, asm, P2/credit]

Expand Down
16 changes: 14 additions & 2 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ snd_StreamSafeCdBreak = 0x11e2a0; // type:func
snd_SendIOPCommandAndWait = 0x11e6b8; // type:func
snd_SendIOPCommandNoWait = 0x11e8c8; // type:func

////////////////////////////////////////////////////////////////
// P2/alo.c
////////////////////////////////////////////////////////////////
InitAlo__FP3ALO = 0x123ED0; // type:func

////////////////////////////////////////////////////////////////
// P2/binoc.c
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -175,6 +180,8 @@ UpdateChkpnt__FP6CHKPNTf = 0x141690; // type:func
FUN_001417f0 = 0x1417F0; // type:func
TriggerChkpnt__FP6CHKPNT = 0x141870; // type:func

g_chkmgr = 0x261420; //size:0x430

////////////////////////////////////////////////////////////////
// P2/clock.c
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -322,9 +329,9 @@ CreateSwCharm__FP2SW = 0x148038; // type:func
AddLife__FPv = 0x148178; // type:func
OnCoinSmack__FP4COIN = 0x1481A0; // type:func
SetCoinDprizes__FP4COIN7DPRIZES = 0x148298; // type:func
FUN_00148400 = 0x148400; // type:func
InitCharm__FP5CHARM = 0x148400; // type:func
SetCharmDprizes__FP5CHARM7DPRIZES = 0x148470; // type:func
FUN_00148510 = 0x148510; // type:func
InitKey__FP3KEY = 0x148510; // type:func
SetKeyDprizes__FP3KEY7DPRIZES = 0x148598; // type:func
FUN_00148698 = 0x148698; // type:func
FUN_00148718 = 0x148718; // type:func
Expand Down Expand Up @@ -363,6 +370,11 @@ g_difficultyHard = 0x261e30; // size:0x5c
g_difficultyEasy = 0x261e90; // size:0x5c
g_difficulty = 0x261ef0; // size:0x20

////////////////////////////////////////////////////////////////
// P2/dl.c
////////////////////////////////////////////////////////////////
AppendDlEntry__FP2DLPv = 0x152470; // type:func

////////////////////////////////////////////////////////////////
// P2/find.c
////////////////////////////////////////////////////////////////
Expand Down
21 changes: 20 additions & 1 deletion include/alo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
#include <lo.h>
#include <dl.h>

struct FICG
{
uchar grficSweep;
uchar grficRush;
uchar grficSmash;
uchar grficBomb;
uchar grficShock;
};

/**
* @brief "Lightweight"
*
Expand All @@ -33,8 +42,18 @@ struct ALO : public LO
//XF xf;
//VECTOR pso

undefined4 padding[0x94];
undefined4 padding[0x88];
FICG ficg;

undefined1 padding2[0x16];
// ...
};

/**
* @brief Initializes an ALO
*
* @param palo ALO to initialize
*/
void InitAlo(ALO *palo);

#endif // ALO_H
3 changes: 2 additions & 1 deletion include/chkpnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct CHKMGR
OID unk_oid_0x428;
int fCheckpoint;
};
extern CHKMGR g_chkmgr;

void ResetChkmgrCheckpoints(CHKMGR *pchkmgr);

Expand All @@ -47,7 +48,7 @@ void ReturnChkmgrToCheckpoint(CHKMGR *pchkmgr);

void RestoreChkmgrFromCheckpoint(CHKMGR *pchkmgr);

void IchkAllocChkmgr(CHKMGR *pchkmgr);
int IchkAllocChkmgr(CHKMGR *pchkmgr);

int FGetChkmgrIchk(CHKMGR *pchkmgr, int ichk);

Expand Down
54 changes: 48 additions & 6 deletions include/coin.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
struct DPRIZE;
struct COIN;
struct KEY;
struct CHARM;

/**
* @brief DPRIZE state.
Expand Down Expand Up @@ -43,20 +44,23 @@ enum DPRIZES
*/
struct DPRIZE : public ALO
{
DPRIZES dprizes; // State
OID oidInitialState;
float tDprizes;
DPRIZES dprizesInit;
OID oidInitialState;
DPRIZES dprizes; // State
float dtInitialSkip;
SM *psm; // State machine
SMA *psma; // State machine action
TARGET *ptarget;
VECTOR posCenter;
VECTOR vCenter;
VECTOR dvCenter;
float uGlintChance;
PNT *ppntFrontGlint;
PNT *ppntBackGlint;
int fLeft;
float uGlintChance;
float tGlint;
undefined4 unk_0[4];
int fNeverReuse;
int fReuseCandidate;
int fLastBounce;
Expand All @@ -67,14 +71,14 @@ struct DPRIZE : public ALO
float rzBounce;
float rxyBounce;
float radSmooth;
undefined4 unk_0;
VECTOR normalSmooth;
int fSwirlDone;
undefined4 unk_1;
DLE dle;
int ichkCollected;
EXPL *pexplCollect;
EXPL *pexplAttract;
float svcAtract;
float svcAttract;
float cAttract;
};

Expand All @@ -83,7 +87,8 @@ struct DPRIZE : public ALO
*/
struct COIN : public DPRIZE
{
// ...
LM lmDtMaxLifetime;
float tLose;
};

/**
Expand All @@ -94,4 +99,41 @@ struct KEY : public DPRIZE
// ...
};


/**
* @brief Charm.
*/
struct CHARM : public DPRIZE
{

};

/**
* @brief Initializes a DPrize
*
* @param pdprize DPrize to initialize
*/
void InitDprize(DPRIZE *pdprize);

/**
* @brief Initializes a DPrize
*
* @param pdprize DPrize to initialize
*/
void InitCoin(COIN *pcoin);

/**
* @brief Initializes a Charm
*
* @param pcharm Charm to initialize
*/
void InitCharm(CHARM *pcharm);

/**
* @brief Initializes a Charm
*
* @param pcharm Charm to initialize
*/
void InitKey(KEY *pkey);

#endif // COIN_H
1 change: 1 addition & 0 deletions include/dl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ struct DLR
};

void InitDl(DL *pdl,int ibDle);
void AppendDlEntry(DL *pdl,void *pv);

#endif // DL_H
1 change: 1 addition & 0 deletions include/oid.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
enum OID {
OID_Nil = -1,
OID_Unknown = 0x0,
OID__MERGED_STATICS = 0x1,
OID__VISIBILITY_MAP = 0x2,
Expand Down
2 changes: 2 additions & 0 deletions include/sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// todo Implement struct.
struct SW
{
undefined1 padding[0x1c53];
DL dlDprize;
};

extern SW *g_psw;
Expand Down
92 changes: 90 additions & 2 deletions src/P2/coin.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,102 @@
#include <coin.h>
#include <chkpnt.h>

void InitDprize(DPRIZE *pdprize)
{
pdprize->dprizesInit = DPRIZES_Normal;
pdprize->dprizes = DPRIZES_Nil;
pdprize->svcAttract = 30.0;
pdprize->oidInitialState = OID_Nil;
InitAlo((ALO *)pdprize);
AppendDlEntry(&pdprize->psw->dlDprize, pdprize);
pdprize->ichkCollected = IchkAllocChkmgr(&g_chkmgr);
pdprize->ficg.grficSmash = '\x10';
pdprize->ficg.grficRush = '\x10';
pdprize->ficg.grficSweep = '\x10';
pdprize->ficg.grficBomb = '\x10';
pdprize->fLastBounce = 1;
}

INCLUDE_ASM(const s32, "P2/coin", LoadDprizeFromBrx__FP6DPRIZEP18CBinaryInputStream);

INCLUDE_ASM(const s32, "P2/coin", CloneDprize__FP6DPRIZET0);

INCLUDE_ASM(const s32, "P2/coin", PostDprizeLoad__FP6DPRIZE);

INCLUDE_ASM(const s32, "P2/coin", ProjectDprizeTransform__FP6DPRIZEfi);

INCLUDE_ASM(const s32, "P2/coin", FFilterDprizeObjects__FP6DPRIZEP2SO);

INCLUDE_ASM(const s32, "P2/coin", CheckDprizeBounce__FP6DPRIZE);

INCLUDE_ASM(const s32, "P2/coin", CheckDprizeCollect__FP6DPRIZE);

INCLUDE_ASM(const s32, "P2/coin", FAbsorbDprizeWkr__FP6DPRIZEP3WKR);

INCLUDE_ASM(const s32, "P2/coin", UpdateDprize__FP6DPRIZEf);

INCLUDE_ASM(const s32, "P2/coin", RenderDprizeAll__FP6DPRIZEP2CMP2RO);

INCLUDE_ASM(const s32, "P2/coin", SetDprizeDprizes__FP6DPRIZE7DPRIZES);

void InitCoin(COIN *pcoin)
{
InitDprize((DPRIZE *)pcoin);
pcoin->sRadiusBounce = 45.0f;
pcoin->svLastBounceMax = 250.0f;
pcoin->sRadiusCollect = 50.0f;
pcoin->svLastBounce = 50.0f;
pcoin->rxyBounce = 0.6f;
pcoin->rzBounce = 0.75f;
pcoin->uGlintChance = 0.25f;
(pcoin->lmDtMaxLifetime).gMin = 8.0f;
(pcoin->lmDtMaxLifetime).gMax = 10.0f;
}

INCLUDE_ASM(const s32, "P2/coin", FUN_00147ed0);

INCLUDE_ASM(const s32, "P2/coin", FUN_00147ef8);

INCLUDE_ASM(const s32, "P2/coin", UpdateCoin__FP4COINf);

INCLUDE_ASM(const s32, "P2/coin", CreateSwCharm__FP2SW);

INCLUDE_ASM(const s32, "P2/coin", AddLife__FPv);

INCLUDE_ASM(const s32, "P2/coin", OnCoinSmack__FP4COIN);

INCLUDE_ASM(const s32, "P2/coin", SetCoinDprizes__FP4COIN7DPRIZES);

INCLUDE_ASM(const s32, "P2/coin", FUN_00148400);
void InitCharm(CHARM *pcharm)
{
InitDprize((DPRIZE *)pcharm);
pcharm->sRadiusBounce = 60.0f;
pcharm->sRadiusCollect = 60.0f;
pcharm->svLastBounceMax = 300.0f;
pcharm->svLastBounce = 0.0f;
pcharm->rxyBounce = .75f;
pcharm->rzBounce = 0.5f;
pcharm->uGlintChance = 0.35f;
}

INCLUDE_ASM(const s32, "P2/coin", SetCharmDprizes__FP5CHARM7DPRIZES);

INCLUDE_ASM(const s32, "P2/coin", FUN_00148510);
void InitKey(KEY *pkey)
{
InitDprize((DPRIZE *)pkey);
LS *pLVar1 = g_plsCur;
pkey->sRadiusBounce = 35.0f;
pkey->sRadiusCollect = 35.0f;
pkey->svLastBounceMax = 500.0f;
pkey->svLastBounce = 250.0f;
pkey->rxyBounce = 0.6f;
pkey->rzBounce = 0.6f;
pkey->uGlintChance = 0.75f;
if ((pLVar1->fls & FLS_KeyCollected) != 0)
{
pkey->dprizesInit = DPRIZES_Removed;
}
}

INCLUDE_ASM(const s32, "P2/coin", SetKeyDprizes__FP3KEY7DPRIZES);

Expand Down

0 comments on commit ba55d12

Please sign in to comment.