Skip to content

Commit 3907ce7

Browse files
authored
zAssetTypes: Static Data and Stubs (#420)
* Add declarations for AnimTable functions * zAssetTypes: Define static data and stub out Read/Unload methods
1 parent 40c21e9 commit 3907ce7

21 files changed

+336
-23
lines changed

src/SB/Core/x/xAnim.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ struct xAnimPlay
161161
void (*BeforeAnimMatrices)(xAnimPlay*, xQuat*, xVec3*, S32);
162162
};
163163

164+
class AnimTableList { // size: 0xC
165+
public:
166+
char * name; // offset 0x0, size 0x4
167+
class xAnimTable * (* constructor)(); // offset 0x4, size 0x4
168+
unsigned int id; // offset 0x8, size 0x4
169+
};
170+
164171
void xAnimInit();
165172
void xAnimTempTransitionInit(U32 count);
166173
xAnimFile* xAnimFileNew(void* rawData, const char* name, U32 flags, xAnimFile** linkedList);

src/SB/Game/zAssetTypes.cpp

Lines changed: 245 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,203 @@
88
#include <rpworld.h>
99
#include <xAnim.h>
1010

11+
void* Curve_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
12+
void* ATBL_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
13+
void* RWTX_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
14+
void* Model_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
15+
void* BSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
16+
void* JSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize);
17+
void* SndInfoRead(void*, unsigned int, void*, unsigned int, unsigned int*);
18+
void Model_Unload(void*, U32);
19+
void BSP_Unload(void*, U32);
20+
void JSP_Unload(void*, U32);
21+
void Anim_Unload(void*, U32);
22+
void TextureRW3_Unload(void*, U32);
23+
void LightKit_Unload(void*, U32);
24+
void MovePoint_Unload(void*, U32);
25+
26+
static xJSPHeader sDummyEmptyJSP;
27+
28+
static st_PACKER_ASSETTYPE assetTypeHandlers[78] = {
29+
{'BSP ', 0, 0, BSP_Read, NULL, NULL, NULL, NULL, BSP_Unload, NULL},
30+
{'JSP ', 0, 0, JSP_Read, NULL, NULL, NULL, NULL, JSP_Unload, NULL},
31+
{'TXD '},
32+
{'MODL', 0, 0, Model_Read, NULL, NULL, NULL, NULL, Model_Unload, NULL},
33+
{'ANIM', 0, 0, NULL, NULL, NULL, NULL, NULL, Anim_Unload, NULL},
34+
{'RWTX', 0, 0, RWTX_Read, NULL, NULL, NULL, NULL, TextureRW3_Unload, NULL},
35+
{'LKIT', 0, 0, NULL, NULL, NULL, NULL, NULL, LightKit_Unload, NULL},
36+
{'CAM '},
37+
{'PLYR'},
38+
{'NPC '},
39+
{'ITEM'},
40+
{'PKUP'},
41+
{'TRIG'},
42+
{'SDF '},
43+
{'TEX '},
44+
{'TXT '},
45+
{'ENV '},
46+
{'ATBL', 0, 0, ATBL_Read, NULL, NULL, NULL, NULL, NULL, NULL},
47+
{'MINF'},
48+
{'PICK'},
49+
{'PLAT'},
50+
{'PEND'},
51+
{'MRKR'},
52+
{'MVPT', 0, 0, NULL, NULL, NULL, NULL, NULL, MovePoint_Unload, NULL},
53+
{'TIMR'},
54+
{'CNTR'},
55+
{'PORT'},
56+
{'SND '},
57+
{'SNDS'},
58+
{'GRUP'},
59+
{'MPHT'},
60+
{'SFX '},
61+
{'SNDI', 0, 0, SndInfoRead, NULL, NULL, NULL, NULL, NULL, NULL},
62+
{'HANG'},
63+
{'SIMP'},
64+
{'BUTN'},
65+
{'SURF'},
66+
{'DSTR'},
67+
{'BOUL'},
68+
{'MAPR'},
69+
{'GUST'},
70+
{'VOLU'},
71+
{'UI '},
72+
{'UIFT'},
73+
{'TEXT'},
74+
{'COND'},
75+
{'DPAT'},
76+
{'PRJT'},
77+
{'LOBM'},
78+
{'FOG '},
79+
{'LITE'},
80+
{'PARE'},
81+
{'PARS'},
82+
{'CSN '},
83+
{'CTOC'},
84+
{'CSNM'},
85+
{'EGEN'},
86+
{'ALST'},
87+
{'RAW '},
88+
{'LODT'},
89+
{'SHDW'},
90+
{'DYNA'},
91+
{'VIL '},
92+
{'VILP'},
93+
{'COLL'},
94+
{'PARP'},
95+
{'PIPT'},
96+
{'DSCO'},
97+
{'JAW '},
98+
{'SHRP'},
99+
{'FLY '},
100+
{'TRCK'},
101+
{'CRV ', 0, 0, Curve_Read, NULL, NULL, NULL, NULL, NULL, NULL},
102+
{'ZLIN'},
103+
{'DUPC'},
104+
{'SLID'},
105+
{'CRDT'},
106+
};
107+
108+
static HackModelRadius hackRadiusTable[3] = { { 0xFA77E6FAU, 20.0f },
109+
{ 0x5BD0EDACU, 1000.0f },
110+
{ 0xED21A1C6U, 50.0f } };
111+
112+
static char* jsp_shadow_hack_textures[5] = {
113+
"beach_towel", "wood_board_Nails_singleV2", "wood_board_Nails_singleV3",
114+
"glass_broken", "ground_path_alpha",
115+
};
116+
117+
struct AnimTableList animTable[33] = {
118+
{ "ZNPC_AnimTable_Test", ZNPC_AnimTable_Test, 0 },
119+
{ "ZNPC_AnimTable_Dutchman", ZNPC_AnimTable_Dutchman, 0 },
120+
{ "ZNPC_AnimTable_Duplotron", ZNPC_AnimTable_Duplotron, 0 },
121+
{ "ZNPC_AnimTable_Common", ZNPC_AnimTable_Common, 0 },
122+
{ "ZNPC_AnimTable_BossPlankton", ZNPC_AnimTable_BossPlankton, 0 },
123+
{ "ZNPC_AnimTable_BossSandy", ZNPC_AnimTable_BossSandy, 0 },
124+
{ "ZNPC_AnimTable_SleepyTime", ZNPC_AnimTable_SleepyTime, 0 },
125+
{ "ZNPC_AnimTable_BossSandyHead", ZNPC_AnimTable_BossSandyHead, 0 },
126+
{ "ZNPC_AnimTable_Hammer", ZNPC_AnimTable_Hammer, 0 },
127+
{ "ZNPC_AnimTable_TTSauce", ZNPC_AnimTable_TTSauce, 0 },
128+
{ "ZNPC_AnimTable_KingJelly", ZNPC_AnimTable_KingJelly, 0 },
129+
{ "ZNPC_AnimTable_Slick", ZNPC_AnimTable_Slick, 0 },
130+
{ "ZNPC_AnimTable_TarTar", ZNPC_AnimTable_TarTar, 0 },
131+
{ "ZNPC_AnimTable_Villager", ZNPC_AnimTable_Villager, 0 },
132+
{ "ZNPC_AnimTable_BalloonBoy", ZNPC_AnimTable_BalloonBoy, 0 },
133+
{ "ZNPC_AnimTable_Fodder", ZNPC_AnimTable_Fodder, 0 },
134+
{ "ZNPC_AnimTable_Prawn", ZNPC_AnimTable_Prawn, 0 },
135+
{ "ZNPC_AnimTable_Neptune", ZNPC_AnimTable_Neptune, 0 },
136+
{ "ZNPC_AnimTable_BossSB1", ZNPC_AnimTable_BossSB1, 0 },
137+
{ "ZNPC_AnimTable_BossSBobbyArm", ZNPC_AnimTable_BossSBobbyArm, 0 },
138+
{ "ZNPC_AnimTable_Monsoon", ZNPC_AnimTable_Monsoon, 0 },
139+
{ "ZNPC_AnimTable_ArfDog", ZNPC_AnimTable_ArfDog, 0 },
140+
{ "ZNPC_AnimTable_ArfArf", ZNPC_AnimTable_ArfArf, 0 },
141+
{ "ZNPC_AnimTable_BossSB2", ZNPC_AnimTable_BossSB2, 0 },
142+
{ "ZNPC_AnimTable_Tiki", ZNPC_AnimTable_Tiki, 0 },
143+
{ "ZNPC_AnimTable_Tubelet", ZNPC_AnimTable_Tubelet, 0 },
144+
{ "ZNPC_AnimTable_Ambient", ZNPC_AnimTable_Ambient, 0 },
145+
{ "ZNPC_AnimTable_GLove", ZNPC_AnimTable_GLove, 0 },
146+
{ "ZNPC_AnimTable_LassoGuide", ZNPC_AnimTable_LassoGuide, 0 },
147+
{ "ZNPC_AnimTable_Chuck", ZNPC_AnimTable_Chuck, 0 },
148+
{ "ZNPC_AnimTable_Jelly", ZNPC_AnimTable_Jelly, 0 },
149+
{ "ZNPC_AnimTable_SuperFriend", ZNPC_AnimTable_SuperFriend, 0 },
150+
{
151+
"ZNPC_AnimTable_BossPatrick\0SB_run1L\0SB_run1R\0SC_run_kelpL\0Pat_run_rock_dryL\0Pat_run_rock_dryR\0\0Debug%02d",
152+
ZNPC_AnimTable_BossPatrick,
153+
0,
154+
},
155+
};
156+
157+
static xAnimTable* (*tableFuncList[48])() = {
158+
zEntPlayer_AnimTable,
159+
ZNPC_AnimTable_Common,
160+
zPatrick_AnimTable,
161+
zSandy_AnimTable,
162+
ZNPC_AnimTable_Villager,
163+
zSpongeBobTongue_AnimTable,
164+
ZNPC_AnimTable_LassoGuide,
165+
ZNPC_AnimTable_Hammer,
166+
ZNPC_AnimTable_TarTar,
167+
ZNPC_AnimTable_GLove,
168+
ZNPC_AnimTable_Monsoon,
169+
ZNPC_AnimTable_SleepyTime,
170+
ZNPC_AnimTable_ArfDog,
171+
ZNPC_AnimTable_ArfArf,
172+
ZNPC_AnimTable_Chuck,
173+
ZNPC_AnimTable_Tubelet,
174+
ZNPC_AnimTable_Slick,
175+
ZNPC_AnimTable_Ambient,
176+
ZNPC_AnimTable_Tiki,
177+
ZNPC_AnimTable_Fodder,
178+
ZNPC_AnimTable_Duplotron,
179+
ZNPC_AnimTable_Jelly,
180+
ZNPC_AnimTable_Test,
181+
ZNPC_AnimTable_Neptune,
182+
ZNPC_AnimTable_KingJelly,
183+
ZNPC_AnimTable_Dutchman,
184+
ZNPC_AnimTable_Prawn,
185+
ZNPC_AnimTable_BossSandy,
186+
ZNPC_AnimTable_BossPatrick,
187+
ZNPC_AnimTable_BossSB1,
188+
ZNPC_AnimTable_BossSB2,
189+
ZNPC_AnimTable_BossSBobbyArm,
190+
ZNPC_AnimTable_BossPlankton,
191+
zEntPlayer_BoulderVehicleAnimTable,
192+
ZNPC_AnimTable_BossSandyHead,
193+
ZNPC_AnimTable_BalloonBoy,
194+
xEnt_AnimTable_AutoEventSmall,
195+
ZNPC_AnimTable_SlickShield,
196+
ZNPC_AnimTable_SuperFriend,
197+
ZNPC_AnimTable_ThunderCloud,
198+
XHUD_AnimTable_Idle,
199+
ZNPC_AnimTable_NightLight,
200+
ZNPC_AnimTable_HazardStd,
201+
ZNPC_AnimTable_FloatDevice,
202+
anim_table, // Cruise Bubble anim table based on PS2 DWARF data
203+
ZNPC_AnimTable_BossSandyScoreboard,
204+
zEntPlayer_TreeDomeSBAnimTable,
205+
NULL,
206+
};
207+
11208
extern xJSPHeader* sTempJSP;
12209
extern xJSPHeader sDummyEmptyJSP;
13210

@@ -16,7 +213,18 @@ void zAssetShutdown()
16213
xSTShutdown();
17214
}
18215

19-
#if 0
216+
void* Model_Read(void*, unsigned int, void*, unsigned int, unsigned int*) {
217+
218+
}
219+
220+
void* Curve_Read(void*, unsigned int, void*, unsigned int, unsigned int*) {
221+
222+
}
223+
224+
void Model_Unload(void*, U32) {
225+
226+
}
227+
20228
// Ghidra's output here is not helpful
21229
void* BSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize)
22230
{
@@ -33,7 +241,7 @@ void* BSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsiz
33241
{
34242
// damn
35243
// chunk header info is austack in ghidra :/
36-
RwStreamReadChunkHeaderInfo(stream, chunkHeaderInfo);
244+
RwStreamReadChunkHeaderInfo(stream, &chunkHeaderInfo);
37245
*outsize = 0;
38246
}
39247
else
@@ -48,7 +256,10 @@ void* BSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsiz
48256
}
49257
return bsp;
50258
}
51-
#endif
259+
260+
void BSP_Unload(void*, U32) {
261+
262+
}
52263

53264
void* JSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize)
54265
{
@@ -65,7 +276,15 @@ void* JSP_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsiz
65276
return retjsp;
66277
}
67278

68-
void Anim_Unload(void*, U32)
279+
void JSP_Unload(void*, U32) {
280+
281+
}
282+
283+
void* RWTX_Read(void*, unsigned int, void*, unsigned int, unsigned int*) {
284+
285+
}
286+
287+
void TextureRW3_Unload(void*, U32)
69288
{
70289
}
71290

@@ -74,9 +293,29 @@ U8 dummyEffectCB(U32, xAnimActiveEffect*, xAnimSingle*, void*)
74293
return 0;
75294
}
76295

296+
void* ATBL_Read(void*, unsigned int, void*, unsigned int, unsigned int*) {
297+
298+
}
299+
300+
void Anim_Unload(void*, U32)
301+
{
302+
}
303+
304+
void LightKit_Unload(void*, U32)
305+
{
306+
}
307+
308+
void MovePoint_Unload(void*, U32)
309+
{
310+
311+
}
312+
313+
void* SndInfoRead(void*, unsigned int, void*, unsigned int, unsigned int*) {
314+
315+
}
77316

78-
U32 xSndPlay3D(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags,
79-
xEnt* ent, F32 radius, sound_category category, F32 delay)
317+
U32 xSndPlay3D(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, xEnt* ent, F32 radius,
318+
sound_category category, F32 delay)
80319
{
81320
return xSndPlay3D(id, vol, pitch, priority, flags, ent, radius / 4.0f, radius, category, delay);
82321
}

src/SB/Game/zAssetTypes.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,37 @@
88

99
#include "xJSP.h"
1010

11+
#include "zEntCruiseBubble.h"
12+
#include "zEntPlayerAnimationTables.h"
13+
#include "xHudModel.h"
14+
#include "zNPCTypeAmbient.h"
15+
#include "zNPCTypeCommon.h"
16+
#include "zNPCTypeBossPatrick.h"
17+
#include "zNPCTypeBossPlankton.h"
18+
#include "zNPCTypeBossSandy.h"
19+
#include "zNPCTypeBossSB1.h"
20+
#include "zNPCTypeBossSB2.h"
21+
#include "zNPCTypeDuplotron.h"
22+
#include "zNPCTypeDutchman.h"
23+
#include "zNPCHazard.h"
24+
#include "zNPCTypeKingJelly.h"
25+
#include "zNPCTypePrawn.h"
26+
#include "zNPCTypeRobot.h"
27+
#include "zNPCTypeTest.h"
28+
#include "zNPCTypeTiki.h"
29+
1130
struct RwMemory
1231
{
1332
U8* start;
1433
U32 length;
1534
};
1635

36+
class HackModelRadius {
37+
public:
38+
U32 assetid;
39+
F32 radius;
40+
};
41+
1742
void FootstepHackSceneEnter();
1843
void jsp_shadow_hack(xJSPHeader* param_1);
1944

src/SB/Game/zEntCruiseBubble.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,4 +647,6 @@ namespace cruise_bubble
647647
xMat4x3* get_missle_mat();
648648
} // namespace cruise_bubble
649649

650+
xAnimTable* anim_table();
651+
650652
#endif
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "xAnim.h"
2+
3+
xAnimTable* zEntPlayer_BoulderVehicleAnimTable();
4+
xAnimTable* zEntPlayer_TreeDomeSBAnimTable();

src/SB/Game/zNPCHazard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ void zNPCHazard_KillEffects();
251251
S32 HAZ_ord_sorttest(void* vkey, void* vitem);
252252
void zNPCHazard_Timestep(F32 dt);
253253
void zNPCCommon_Hazards_RenderAll(S32 doOpaqueStuff);
254+
255+
xAnimTable* ZNPC_AnimTable_HazardStd();
256+
254257
NPCHazard* HAZ_Acquire();
255258
S32 HAZ_AvailablePool();
256259
void HAZ_Iterate(bool (*fp)(NPCHazard&, void*), void* context, S32 flag_filter);

src/SB/Game/zNPCTypeAmbient.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,8 @@ xFactoryInst* ZNPC_Create_Ambient(S32 who, RyzMemGrow* grow, void*);
8080
void ZNPC_Destroy_Ambient(xFactoryInst* inst);
8181
S32 JELY_grul_getAngry(xGoal* rawgoal, void* p1, en_trantype* trantype, F32 f, void* p2);
8282

83+
xAnimTable* ZNPC_AnimTable_Ambient();
84+
xAnimTable* ZNPC_AnimTable_Jelly();
85+
xAnimTable* ZNPC_AnimTable_Neptune();
86+
8387
#endif

src/SB/Game/zNPCTypeBoss.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ void ZNPC_Boss_Shutdown();
3131
xFactoryInst* ZNPC_Create_Boss(S32 who, RyzMemGrow* grow, void*);
3232
void ZNPC_Destroy_Boss(xFactoryInst* inst);
3333

34+
xAnimTable* ZNPC_AnimTable_BossSBobbyArm();
35+
3436
#define ANIM_COUNT 78
3537
extern U32 g_hash_bossanim[ANIM_COUNT];
3638
extern char* g_strz_bossanim[ANIM_COUNT];

src/SB/Game/zNPCTypeBossPatrick.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,6 @@ struct zNPCGoalBossPatFudge : zNPCGoalCommon
293293
void zNPCBPatrick_AddBoundEntsToGrid(zScene*);
294294
void zNPCBPatrick_GameIsPaused(zScene*);
295295

296+
xAnimTable* ZNPC_AnimTable_BossPatrick();
297+
296298
#endif

src/SB/Game/zNPCTypeBossPlankton.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,6 @@ struct zNPCGoalBPlanktonBomb : zNPCGoalCommon
237237
S32 Process(en_trantype*, float, void*, xScene*);
238238
};
239239

240+
xAnimTable * ZNPC_AnimTable_BossPlankton();
241+
240242
#endif

0 commit comments

Comments
 (0)