diff options
| author | Roman971 <32455037+Roman971@users.noreply.github.com> | 2020-05-18 20:24:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-18 14:24:00 -0400 |
| commit | e29b77919bd98375e31760ed082cf014c58dbef8 (patch) | |
| tree | e0e7c454be393eaba1b1bb52036191d41fa98af2 /include | |
| parent | 785011c33c2a95222dd88a57f43808bcdc1cff91 (diff) | |
Decompile most effect files in "code" (#144)
- `z_effect`: Matched and essentially all documented.
- `z_eff_spark.c`: Decompiled (1 non matching left) and mostly documented.
- `z_eff_shield_particle.c`: Matched and mostly documented.
- `z_eff_blure.c`: Decompiled (5 non matchings left) and partially documented.
- `z_effect_soft_sprite.c`: Matched and mostly documented.
- `z_eff_ss_dead.c`: Matched but not documented.
- `z_effect_soft_sprite_dlftbls.c`: "Matched" (only data, contains the effect ss overlay table).
- `z_effect_soft_sprite_old_init.c`: Not decompiled, but functions are categorized by effect ss overlay. And they should be decompiled at the same time as their corresponding effect ss in the future.
Other changes:
- Added a lot of types/enums to `z64effect.h`and moved+renamed some structs from `z64.h` to this header
- Added effect ss overlay segments to `segment_symbols.h` and effect ss init vars to `initvars.h`
- Added a macro called `VTX_T` to generate a `Vtx_t` in the same style as `VTX`
- Fixed `flg_set.c` .bss to be in the right file
- Removed `tools/overlayhelpers/batchdisasm` since it's no longer relevant
- Removed unused leftover asm from recent PRs
Diffstat (limited to 'include')
| -rw-r--r-- | include/color.h | 5 | ||||
| -rw-r--r-- | include/functions.h | 141 | ||||
| -rw-r--r-- | include/initvars.h | 37 | ||||
| -rw-r--r-- | include/macros.h | 4 | ||||
| -rw-r--r-- | include/segment_symbols.h | 37 | ||||
| -rw-r--r-- | include/ultra64/gbi.h | 8 | ||||
| -rw-r--r-- | include/variables.h | 32 | ||||
| -rw-r--r-- | include/z64.h | 39 | ||||
| -rw-r--r-- | include/z64actor.h | 4 | ||||
| -rw-r--r-- | include/z64effect.h | 283 |
10 files changed, 438 insertions, 152 deletions
diff --git a/include/color.h b/include/color.h index d18fb9844..c809ed17d 100644 --- a/include/color.h +++ b/include/color.h @@ -15,6 +15,11 @@ typedef union { u32 rgba; } Color_RGBA8; +// Variant without u32 union +typedef struct { + u8 r, g, b, a; +} Color_RGBA8_n; + typedef struct { f32 r, g, b, a; } Color_RGBAf; diff --git a/include/functions.h b/include/functions.h index 0c9648668..aa35d73e5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -161,80 +161,130 @@ void __osSetWatchLo(u32); Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params); -// ? func_8001FDF0(?); -// ? func_80020184(?); -// ? func_800208E0(?); -// ? func_80020A50(?); -// ? func_80020F60(?); -// ? func_80020FC0(?); -// ? func_800214D0(?); -// ? func_80021F00(?); -// ? func_800224F4(?); -// ? func_80022A10(?); -// ? func_8002389C(?); -void func_80024F0C(UNK_TYPE); +void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); +void EffectBlure_AddSpace(EffectBlure* this); +void EffectBlure_Init1(void* thisx, void* initParamsx); +void EffectBlure_Init2(void* thisx, void* initParamsx); +void EffectBlure_Destroy(void* thisx); +s32 EffectBlure_Update(void* thisx); +void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx); +void EffectShieldParticle_Init(void* thisx, void* initParamsx); +void EffectShieldParticle_Destroy(void* thisx); +s32 EffectShieldParticle_Update(void* thisx); +void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx); +void EffectSpark_Init(void* thisx, void* initParamsx); +void EffectSpark_Destroy(void* thisx); +s32 EffectSpark_Update(void* thisx); +void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx); void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026400(GlobalContext*, Color_RGBA8*, u8, s16); -void func_80026608(GlobalContext*); +void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026608(GlobalContext* globalCtx); void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026860(GlobalContext*, Color_RGBA8*, u8, s16); +void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); void func_80026A6C(GlobalContext* globalCtx); -GlobalContext* func_80026B00(void); -// ? func_80026B0C(?); -// ? func_80026C1C(?); -// ? func_80026C2C(?); -void Effect_Add(GlobalContext* globalCtx, s32* idp, s32 type, u8 arg3, u8 arg4, void* initParams); -// ? func_80026E74(?); -// ? func_80026F70(?); -// ? func_8002709C(?); -// ? func_800271A8(?); -// ? func_800272B0(?); -// ? func_80027410(?); Effect_SS_Clear -// ? func_800274E0(?); Effect_SS_Delete -void Effect_SS_ResetEntry(LoadedParticleEntry* particle); -// ? func_800275D0(?); -// ? func_80027798(?); -// ? func_80027A40(?); -// ? func_80027AE0(?); -// ? func_80027B98(?); -// ? func_80027BDC(?); -// ? func_80027E34(?); -// ? func_80027E84(?); +GlobalContext* Effect_GetGlobalCtx(void); +void* Effect_GetByIndex(s32 index); +void Effect_InitContext(GlobalContext* globalCtx); +void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); +void Effect_DrawAll(GraphicsContext* gfxCtx); +void Effect_UpdateAll(GlobalContext* globalCtx); +void Effect_Delete(GlobalContext* globalCtx, s32 index); +void Effect_DeleteAll(GlobalContext* globalCtx); +void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize); +void EffectSs_ClearAll(GlobalContext* globalCtx); +void EffectSs_Delete(EffectSs* effectSs); +void EffectSs_Reset(EffectSs* effectSs); +void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs); +void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams); +void EffectSs_UpdateAll(GlobalContext* globalCtx); +void EffectSs_DrawAll(GlobalContext* globalCtx); +s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2); +s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2); +u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2); +// ? func_80027F80(?); // ? func_800281E8(?); // ? func_8002829C(?); // ? func_80028304(?); +// ? func_8002836C(?); +// ? func_800283D4(?); +// ? func_8002843C(?); +// ? func_800284A4(?); +// ? func_80028510(?); // ? func_8002857C(?); +// ? func_800285EC(?); // ? func_8002865C(?); void func_800286CC(GlobalContext*, Vec3f*, Vec3f*, Vec3f*, s16, s16); // ? func_8002873C(?); // ? func_800287AC(?); +// ? func_8002881C(?); +// ? func_80028858(?); // ? func_80028894(?); +// ? func_80028990(?); +// ? func_80028A54(?); +// ? func_80028B18(?); void func_80028B74(GlobalContext*, Vec3f*, UNK_PTR, UNK_PTR, Color_RGB8*, Color_RGB8*); // ? func_80028BB0(?); +// ? func_80028CEC(?); +// ? func_80028DC4(?); +// ? func_80028E1C(?); +// ? func_80028E84(?); // ? func_80028EF4(?); +// ? func_80028F84(?); // ? func_80028FD8(?); +// ? func_80029024(?); // ? func_80029060(?); -void Effect_SpawnFragment(GlobalContext* globalCtx, Vec3f* burstDepthY, Vec3f* burstDepthX, Vec3f* burstOrigin, - s16 gravityInfluence, s16 u0, s16 rotSpeed, s16 burstVel, u8 u1, s16 scale, u8 u2, s16 jitter, - s32 duration, s16 u3, s16 objNumber, u32 dList); +// ? func_800290F0(?); +// ? func_80029184(?); +// ? func_800291D8(?); // ? func_800292DC(?); // ? func_80029320(?); +// ? func_800293A0(?); +// ? func_800293E4(?); // ? func_80029444(?); +// ? func_8002949C(?); +// ? func_80029530(?); // ? func_80029568(?); +// ? func_800295A0(?); +// ? func_80029618(?); +// ? func_80029694(?); // ? func_80029724(?); +// ? func_800297A4(?); +// ? func_800298EC(?); // ? func_8002993C(?); void func_800299AC(GlobalContext* globalCtx, Vec3f* v); +// ? func_80029B30(?); +// ? func_80029B90(?); +// ? func_80029C00(?); // ? func_80029C50(?); void func_80029CA4(GlobalContext* globalCtx, s32 a, Vec3f* pos); +// ? func_80029CC8(?); +// ? func_80029CF0(?); +// ? func_80029D5C(?); +// ? func_80029DBC(?); +// ? func_80029E24(?); +void func_80029E8C(GlobalContext* globalCtx, Vec3f* burstDepthY, Vec3f* burstDepthX, Vec3f* burstOrigin, + s16 gravityInfluence, s16 u0, s16 rotSpeed, s16 burstVel, u8 u1, s16 scale, u8 u2, s16 jitter, + s32 duration, s16 u3, s16 objectId, u32 dList); // ? func_80029F44(?); +// ? func_80029FAC(?); +// ? func_8002A140(?); +// ? func_8002A1DC(?); +// ? func_8002A2A4(?); // ? func_8002A32C(?); // ? func_8002A3C4(?); +// ? func_8002A484(?); +// ? func_8002A4D4(?); +// ? func_8002A5F4(?); void func_8002A65C(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 arg3, s16 arg4); void func_8002A6B8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* arg2, Vec3f* arg3, u32 arg4, s32 arg5, u32 arg6, u32 arg7, u32 arg8, u32 arg9, u32 arg10, u32 arg11, u32 arg12, u32 arg13, u32 arg14, u32 arg15); +// ? func_8002A770(?); +// ? func_8002A824(?); // ? func_8002A894(?); +// ? func_8002A90C(?); // ? func_8002A95C(?); // ? func_8002A9F4(?); +// ? func_8002AA44(?); // ? func_8002AAB0(?); void Overlay_LoadGameState(GameStateOverlay* overlayEntry); void Overlay_FreeGameState(GameStateOverlay* overlayEntry); @@ -930,7 +980,7 @@ void Lights_SetAmbientColor(LightingContext* lightCtx, u8 red, u8 green, u8 blue LightMapper* Lights_CreateMapper(LightingContext* lightCtx, GraphicsContext* gfxCtx); void Lights_ClearHead(GlobalContext* globalCtx, LightingContext* lightCtx); void Lights_RemoveAll(GlobalContext* globalCtx, LightingContext* lightCtx); -z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, LightInfo* info); +z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, void* info); void Lights_Remove(GlobalContext* globalCtx, LightingContext* lightCtx, z_Light* light); LightMapper* func_8007A960(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue); // ? func_8007A9B4(?); @@ -1238,20 +1288,20 @@ void func_800A6888(GlobalContext*, PSkinAwb*); // ? func_800A6AC4(?); // ? func_800A6E10(?); void func_800A6EF4(MtxF* mf, Vec3f* src, Vec3f* dest); -// ? func_800A6FA0(?); +void func_800A6FA0(MtxF* mf1, MtxF* mf2, MtxF* dest); // ? func_800A72FC(?); // ? func_800A730C(?); // ? func_800A735C(?); // ? func_800A73E0(?); void func_800A76A4(MtxF* dest, f32 x, f32 y, f32 z); -// ? func_800A7704(?); +void func_800A7704(MtxF* dest, s16 x, s16 y, s16 z); // ? func_800A7894(?); void func_800A7A24(MtxF* dest, f32 x, f32 y, f32 z); // ? func_800A7B04(?); // ? func_800A7B84(?); // ? func_800A7C60(?); -// ? func_800A7E70(?); -// ? func_800A7EC0(?); +Mtx* func_800A7E70(GraphicsContext* gfxCtx, MtxF* src); +void func_800A7EC0(MtxF* dest, s16 arg1, f32 x, f32 y, f32 z); // ? func_800A81A0(?); // ? func_800A82C8(?); // ? func_800A9A9C(?); @@ -1597,7 +1647,8 @@ void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y); void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx); -void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* entry, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx, u32 lrx, u32 uly, u32 lry); +void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* entry, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx, + u32 lrx, u32 uly, u32 lry); void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxCtx); void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, GameState* state); void SysCfb_Init(s32 n64dd); diff --git a/include/initvars.h b/include/initvars.h index a78e302cb..4489b2bb2 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -1,6 +1,43 @@ #ifndef _INITVARS_H_ #define _INITVARS_H_ +extern EffectSsInit Effect_Ss_Dust_InitVars; +extern EffectSsInit Effect_Ss_KiraKira_InitVars; +extern EffectSsInit Effect_Ss_Bomb_InitVars; +extern EffectSsInit Effect_Ss_Bomb2_InitVars; +extern EffectSsInit Effect_Ss_Blast_InitVars; +extern EffectSsInit Effect_Ss_G_Spk_InitVars; +extern EffectSsInit Effect_Ss_D_Fire_InitVars; +extern EffectSsInit Effect_Ss_Bubble_InitVars; +extern EffectSsInit Effect_Ss_G_Ripple_InitVars; +extern EffectSsInit Effect_Ss_G_Splash_InitVars; +extern EffectSsInit Effect_Ss_G_Magma_InitVars; +extern EffectSsInit Effect_Ss_G_Fire_InitVars; +extern EffectSsInit Effect_Ss_Lightning_InitVars; +extern EffectSsInit Effect_Ss_Dt_Bubble_InitVars; +extern EffectSsInit Effect_Ss_Hahen_InitVars; +extern EffectSsInit Effect_Ss_Stick_InitVars; +extern EffectSsInit Effect_Ss_Sibuki_InitVars; +extern EffectSsInit Effect_Ss_Sibuki2_InitVars; +extern EffectSsInit Effect_Ss_G_Magma2_InitVars; +extern EffectSsInit Effect_Ss_Stone1_InitVars; +extern EffectSsInit Effect_Ss_HitMark_InitVars; +extern EffectSsInit Effect_Ss_Fhg_Flash_InitVars; +extern EffectSsInit Effect_Ss_K_Fire_InitVars; +extern EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars; +extern EffectSsInit Effect_Ss_Kakera_InitVars; +extern EffectSsInit Effect_Ss_Ice_Piece_InitVars; +extern EffectSsInit Effect_Ss_En_Ice_InitVars; +extern EffectSsInit Effect_Ss_Fire_Tail_InitVars; +extern EffectSsInit Effect_Ss_En_Fire_InitVars; +extern EffectSsInit Effect_Ss_Extra_InitVars; +extern EffectSsInit Effect_Ss_Fcircle_InitVars; +extern EffectSsInit Effect_Ss_Dead_Db_InitVars; +extern EffectSsInit Effect_Ss_Dead_Dd_InitVars; +extern EffectSsInit Effect_Ss_Dead_Ds_InitVars; +extern EffectSsInit Effect_Ss_Dead_Sound_InitVars; +extern EffectSsInit Effect_Ss_Ice_Smoke_InitVars; + extern ActorInit Player_InitVars; extern ActorInit En_Test_InitVars; extern ActorInit En_GirlA_InitVars; diff --git a/include/macros.h b/include/macros.h index c92ff3cf6..480a7de6a 100644 --- a/include/macros.h +++ b/include/macros.h @@ -67,7 +67,9 @@ * `cbnz` blue component of color vertex, or z component of normal vertex * `a` alpha */ -#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a }, }, } +#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } } + +#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } #define VIEWPORT_INIT(viewport, by, rx, ty, lx) \ viewport.bottomY = by; \ diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 8b5ae8eb8..f4a72a8d6 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -63,6 +63,43 @@ DECLARE_OVERLAY_SEGMENT(kaleido_scope) DECLARE_OVERLAY_SEGMENT(player_actor) DECLARE_OVERLAY_SEGMENT(map_mark_data) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dust) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_KiraKira) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bomb) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bomb2) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Blast) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Spk) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_D_Fire) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bubble) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Ripple) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Splash) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Magma) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Fire) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Lightning) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dt_Bubble) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Hahen) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stick) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sibuki) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sibuki2) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Magma2) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stone1) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_HitMark) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fhg_Flash) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_K_Fire) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Solder_Srch_Ball) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Kakera) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Piece) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Ice) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fire_Tail) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Fire) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Extra) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fcircle) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Db) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Dd) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Ds) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Sound) +DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Smoke) + DECLARE_OVERLAY_SEGMENT(En_Test) DECLARE_OVERLAY_SEGMENT(En_GirlA) DECLARE_OVERLAY_SEGMENT(En_Part) diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index a10033e67..503507910 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -2762,12 +2762,12 @@ _DW({ \ #else /* F3DEX_GBI_2 */ #define gSPSetGeometryMode(pkt, word) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_SETGEOMETRYMODE, 24, 8); \ _g->words.w1 = (unsigned int)(word); \ -} +}) #define gsSPSetGeometryMode(word) \ { \ @@ -2775,12 +2775,12 @@ _DW({ \ } #define gSPClearGeometryMode(pkt, word) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8); \ _g->words.w1 = (unsigned int)(word); \ -} +}) #define gsSPClearGeometryMode(word) \ { \ diff --git a/include/variables.h b/include/variables.h index e16fec19c..20c84d098 100644 --- a/include/variables.h +++ b/include/variables.h @@ -35,7 +35,7 @@ extern u32 D_03012B20; //extern ? D_04002280; //extern ? D_04003238; extern u32 D_04004298; -//extern ? D_04006020; +extern u8 D_04006020[]; extern Gfx D_0400C820[]; extern u32 D_0400CB70; extern u32 D_04010130; @@ -46,7 +46,7 @@ extern u32 D_0401E370; //extern ? D_0402CF30; //extern ? D_04037730; //extern ? D_04038F00; -//extern ? D_04038FB0; +extern u8 D_04038FB0[]; extern u32 D_0403B030; extern u32 D_0403BBA0; extern u32 D_0403BCD8; @@ -153,14 +153,6 @@ extern u8 D_80114930[]; //extern ? D_801157DC; //extern ? D_801157EC; //extern ? D_801157FC; -//extern ? D_80115810; -//extern ? D_80115860; -//extern ? D_80115868; -//extern ? D_8011587C; -//extern ? D_801158A4; -extern EffectTableInfo EffectSS2Info; // 801158B0 -//extern ? D_801158B4; -//extern u32 D_801158B8; //extern ? D_801158C0; //extern ? D_801158CC; //extern ? D_801158D0; @@ -184,15 +176,14 @@ extern EffectTableInfo EffectSS2Info; // 801158B0 //extern ? D_801159A8; //extern ? D_801159A9; //extern ? D_801159AA; -//extern ? D_801159C0; -//extern ? D_801159CC; +extern EffectSsOverlay gEffectSsOverlayTable[37]; //extern ? D_80115DC0; //extern ? D_80115F68; //extern ? D_80115F6C; //extern ? D_80115F70; extern Gfx D_80116280[]; extern ActorOverlay gActorOverlayTable[471]; // original name: "actor_dlftbls" 801162A0 -extern s32 gMaxProfile; +extern s32 gMaxActorId; // original name: "MaxProfile" //extern ? D_80119E2C; //extern ? D_80119E52; //extern ? D_80119E54; @@ -850,8 +841,6 @@ extern s32 gSystemArenaLogSeverity; extern s32 D_80134D20; //extern ? D_80135130; //extern ? D_80135158; -extern char D_80135180[]; -extern char D_80135194[]; //extern ? D_801351A8; //extern ? D_801351BC; //extern ? D_801351F8; @@ -906,7 +895,6 @@ extern char D_80135194[]; //extern ? D_80135780; //extern ? D_8013579C; //extern ? D_801357C0; -extern char D_801357DC[]; //extern ? D_801357F8; //extern ? D_8013581C; //extern ? D_80135838; @@ -3297,19 +3285,7 @@ extern char D_80146238[]; extern u8 D_80155F50[]; extern u8 D_80157580[]; extern u8 D_80157D30[]; -extern GlobalContext* D_80157DA0; -//extern ? D_80157DA4; -//extern ? D_80157DA8; -//extern ? D_80158304; -//extern ? D_80158BF8; -//extern ? D_80158BFC; -//extern ? D_80158C00; -//extern ? D_8015910C; -//extern ? D_8015A7D0; -//extern ? D_8015B62C; -//extern ? D_8015B630; //extern ? D_8015BB90; -//extern ? D_8015BB94; //extern ? D_8015BC30; //extern ? D_8015BC3C; //extern ? D_8015BC48; diff --git a/include/z64.h b/include/z64.h index dde6e85e2..b1eb8a888 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1113,24 +1113,6 @@ typedef enum { DPM_ENEMY = 2 } DynaPolyMoveFlag; -typedef struct LoadedParticleEntry { - /* 0x0000 */ Vec3f position; - /* 0x000C */ Vec3f velocity; - /* 0x0018 */ Vec3f acceleration; - /* 0x0024 */ void(*update)(GlobalContext*, s32, struct LoadedParticleEntry*); - /* 0x0028 */ void(*draw)(GlobalContext*, s32, struct LoadedParticleEntry*); - /* 0x002C */ f32 unk_2C; // Probaly a Vec3f - /* 0x0030 */ f32 unk_30; - /* 0x0034 */ f32 unk_34; - /* 0x0038 */ u32 unk_38; - /* 0x003C */ u32 unk_3C; - /* 0x0042 */ u16 unk_40[13]; - /* 0x005A */ u16 flags; // bit 0: set if this entry is not considered free on a priority tie bit 1: ? bit 2: ? - /* 0x005C */ s16 life; // -1 means this entry is free - /* 0x005E */ u8 priority; // Lower value means higher priority - /* 0x005F */ u8 type; -} LoadedParticleEntry; // size = 0x60 - // Some animation related structure typedef struct { /* 0x00 */ AnimationHeader* animation; @@ -1162,27 +1144,6 @@ typedef struct { } struct_80034A14_arg1; typedef struct { - /* 0x00 */ u32 unk_00; - /* 0x04 */ u32(*init)(GlobalContext*, u32, LoadedParticleEntry*, void*); -} ParticleOverlayInfo; - -typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x0C */ void* vramStart; - /* 0x08 */ void* vramEnd; - /* 0x10 */ void* loadedRamAddr; - /* 0x14 */ ParticleOverlayInfo* overlayInfo; - /* 0x18 */ u32 unk_18; // Always 0x01000000? -} ParticleOverlay; - -typedef struct { - /* 0x00 */ LoadedParticleEntry* data_table; // Name from debug assert - /* 0x04 */ s32 searchIndex; - /* 0x08 */ s32 size; -} EffectTableInfo; - -typedef struct { /* 0x00 */ s8 scene; /* 0x01 */ s8 spawn; /* 0x02 */ u16 field; diff --git a/include/z64actor.h b/include/z64actor.h index d328b6433..c912a26c5 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -4,7 +4,6 @@ #include <z64animation.h> #include <z64math.h> -#define ACTOR_DLF_MAX 471 #define ACTOR_NUMBER_MAX 200 #define INVISIBLE_ACTOR_MAX 20 #define AM_FIELD_SIZE 0x27A0 @@ -770,7 +769,8 @@ typedef enum { /* 0x01D3 */ ACTOR_EN_ZL4, /* 0x01D4 */ ACTOR_EN_MM2, /* 0x01D5 */ ACTOR_BG_JYA_BLOCK, - /* 0x01D6 */ ACTOR_OBJ_WARP2BLOCK + /* 0x01D6 */ ACTOR_OBJ_WARP2BLOCK, + /* 0x01D7 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" } ActorID; #endif diff --git a/include/z64effect.h b/include/z64effect.h index 2c158cdae..9383aa97d 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -1,56 +1,273 @@ #ifndef _Z64EFFECT_H_ #define _Z64EFFECT_H_ + #include <color.h> +struct GraphicsContext; +struct GlobalContext; + +/* Effects */ + +#define SPARK_COUNT 3 +#define BLURE_COUNT 25 +#define SHIELD_PARTICLE_COUNT 3 + +#define TOTAL_EFFECT_COUNT SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT + +typedef struct { + /* 0x00 */ u8 active; + /* 0x01 */ u8 unk_01; + /* 0x02 */ u8 unk_02; +} EffectStatus; // size = 0x03 + typedef struct { /* 0x00 */ Vec3f velocity; /* 0x0C */ Vec3f position; - /* 0x18 */ Vec3s unk_18; - /* 0x1E */ Vec3s unk_1E; -} EffSparkParticle; // size = 0x24 + /* 0x18 */ Vec3s unkVelocity; + /* 0x1E */ Vec3s unkPosition; +} EffectSparkElement; // size = 0x24 typedef struct { /* 0x000 */ Vec3s position; - /* 0x008 */ s32 numParticles; // Will be calculated as particleFactor1 * particleFactor2 + 2 - /* 0x00C */ EffSparkParticle particles[32]; - /* 0x48C */ f32 velocity; + /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 + /* 0x00C */ EffectSparkElement elements[32]; + /* 0x48C */ f32 speed; /* 0x490 */ f32 gravity; - /* 0x494 */ u32 particleFactor1; - /* 0x498 */ u32 particleFactor2; - /* 0x49C */ Color_RGBA8 colorStart[4]; - /* 0x4AC */ Color_RGBA8 colorEnd[4]; - /* 0x4BC */ s32 age; + /* 0x494 */ u32 uDiv; // "u_div" + /* 0x498 */ u32 vDiv; // "v_div" + /* 0x49C */ Color_RGBA8_n colorStart[4]; + /* 0x4AC */ Color_RGBA8_n colorEnd[4]; + /* 0x4BC */ s32 timer; /* 0x4C0 */ s32 duration; -} EffSparkParams; // size = 0x4C4 +} EffectSparkInit; // size = 0x4C4 -// gz has trail related structs but they seem to be different in dbg typedef struct { - /* 0x0000 */ char unk_00[0x184]; - /* 0x0184 */ Color_RGBA8 p1Start; - /* 0x0188 */ Color_RGBA8 p2Start; - /* 0x018C */ Color_RGBA8 p1End; - /* 0x0190 */ Color_RGBA8 p2End; - /* 0x0194 */ u32 unk_194; // these are proably bytes - /* 0x0198 */ u32 unk_198; - /* 0x019C */ u32 unk_19C; - /* 0x01A0 */ -} TrailEffect; // size = unk + /* 0x000 */ Vec3s position; + /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 + /* 0x00C */ EffectSparkElement elements[32]; + /* 0x48C */ f32 speed; + /* 0x490 */ f32 gravity; + /* 0x494 */ u32 uDiv; // "u_div" + /* 0x498 */ u32 vDiv; // "v_div" + /* 0x49C */ Color_RGBA8_n colorStart[4]; + /* 0x4AC */ Color_RGBA8_n colorEnd[4]; + /* 0x4BC */ s32 timer; + /* 0x4C0 */ s32 duration; +} EffectSpark; // size = 0x4C4 typedef struct { - /* 0x00 */ u8 numParticles; + /* 0x00 */ s32 state; + /* 0x04 */ s32 timer; + /* 0x08 */ Vec3s p1; + /* 0x0E */ Vec3s p2; + /* 0x14 */ u16 flags; +} EffectBlureElement; // size = 0x18 + +typedef struct { + /* 0x000 */ char unk_00[0x184]; + /* 0x184 */ Color_RGBA8_n p1StartColor; + /* 0x188 */ Color_RGBA8_n p2StartColor; + /* 0x18C */ Color_RGBA8_n p1EndColor; + /* 0x190 */ Color_RGBA8_n p2EndColor; + /* 0x194 */ s32 elemDuration; + /* 0x198 */ s32 unkFlag; + /* 0x19C */ s32 calcMode; +} EffectBlureInit1; // size = 0x1A0 + +typedef struct { + /* 0x00 */ s32 calcMode; + /* 0x04 */ u16 flags; + /* 0x06 */ s16 addAngleChange; + /* 0x08 */ Color_RGBA8_n p1StartColor; + /* 0x0C */ Color_RGBA8_n p2StartColor; + /* 0x10 */ Color_RGBA8_n p1EndColor; + /* 0x14 */ Color_RGBA8_n p2EndColor; + /* 0x18 */ u8 elemDuration; + /* 0x19 */ u8 unkFlag; + /* 0x1A */ u8 drawMode; // 0: simple; 1: simple with alt colors; 2+: smooth + /* 0x1B */ u8 mode4Param; + /* 0x1C */ Color_RGBA8_n altPrimColor; // used with drawMode 1 + /* 0x20 */ Color_RGBA8_n altEnvColor; // used with drawMode 1 +} EffectBlureInit2; // size = 0x24 + +typedef struct { + /* 0x000 */ EffectBlureElement elements[16]; + /* 0x180 */ s32 calcMode; + /* 0x184 */ f32 mode4Param; + /* 0x188 */ u16 flags; + /* 0x18A */ s16 addAngleChange; + /* 0x18C */ s16 addAngle; + /* 0x18E */ Color_RGBA8_n p1StartColor; + /* 0x192 */ Color_RGBA8_n p2StartColor; + /* 0x196 */ Color_RGBA8_n p1EndColor; + /* 0x19A */ Color_RGBA8_n p2EndColor; + /* 0x19E */ u8 numElements; // "now_edge_num" + /* 0x19F */ u8 elemDuration; + /* 0x1A0 */ u8 unkFlag; + /* 0x1A1 */ u8 drawMode; // 0: simple; 1: simple with alt colors; 2+: smooth + /* 0x1A2 */ Color_RGBA8_n altPrimColor; // used with drawMode 1 + /* 0x1A6 */ Color_RGBA8_n altEnvColor; // used with drawMode 1 +} EffectBlure; // size = 0x1AC + +typedef struct { + /* 0x00 */ f32 initialSpeed; + /* 0x04 */ f32 endXChange; + /* 0x08 */ f32 endX; + /* 0x0C */ f32 startXChange; + /* 0x10 */ f32 startX; + /* 0x14 */ s16 yaw; + /* 0x16 */ s16 pitch; +} EffectShieldParticleElement; // size = 0x18 + +typedef struct { + /* 0x00 */ u8 numElements; /* 0x02 */ Vec3s position; - /* 0x08 */ Color_RGBA8 primColorStart; - /* 0x0C */ Color_RGBA8 envColorStart; - /* 0x10 */ Color_RGBA8 primColorMid; - /* 0x14 */ Color_RGBA8 envColorMid; - /* 0x18 */ Color_RGBA8 primColorEnd; - /* 0x1C */ Color_RGBA8 envColorEnd; - /* 0x20 */ f32 acceleration; + /* 0x08 */ Color_RGBA8_n primColorStart; + /* 0x0C */ Color_RGBA8_n envColorStart; + /* 0x10 */ Color_RGBA8_n primColorMid; + /* 0x14 */ Color_RGBA8_n envColorMid; + /* 0x18 */ Color_RGBA8_n primColorEnd; + /* 0x1C */ Color_RGBA8_n envColorEnd; + /* 0x20 */ f32 deceleration; /* 0x24 */ f32 maxInitialSpeed; /* 0x28 */ f32 lengthCutoff; /* 0x2C */ u8 duration; /* 0x2E */ LightInfoPositionalParams lightParams; - /* 0x3C */ s32 hasLight; -} EffShieldParticleInit; // size = 0x40 + /* 0x3C */ s32 lightDecay; // halves light radius every frame when set to 1 +} EffectShieldParticleInit; // size = 0x40 + +typedef struct { + /* 0x000 */ EffectShieldParticleElement elements[16]; + /* 0x180 */ u8 numElements; + /* 0x182 */ Vec3s position; + /* 0x188 */ Color_RGBA8_n primColorStart; + /* 0x18C */ Color_RGBA8_n envColorStart; + /* 0x190 */ Color_RGBA8_n primColorMid; + /* 0x194 */ Color_RGBA8_n envColorMid; + /* 0x198 */ Color_RGBA8_n primColorEnd; + /* 0x19C */ Color_RGBA8_n envColorEnd; + /* 0x1A0 */ f32 deceleration; + /* 0x1A4 */ char unk_1A4[0x04]; + /* 0x1A8 */ f32 maxInitialSpeed; + /* 0x1AC */ f32 lengthCutoff; + /* 0x1B0 */ u8 duration; + /* 0x1B1 */ u8 timer; + /* 0x1B2 */ LightInfoPositional lightInfo; + /* 0x1C0 */ z_Light* light; + /* 0x1C4 */ s32 lightDecay; // halves light radius every frame when set to 1 +} EffectShieldParticle; // size = 0x1C8 + +typedef struct { + /* 0x0000 */ struct GlobalContext* globalCtx; + struct { + EffectStatus status; + EffectSpark effect; + } /* 0x0004 */ sparks[SPARK_COUNT]; + struct { + EffectStatus status; + EffectBlure effect; + } /* 0x0E5C */ blures[BLURE_COUNT]; + struct { + EffectStatus status; + EffectShieldParticle effect; + } /* 0x388C */ shieldParticles[SHIELD_PARTICLE_COUNT]; +} EffectContext; // size = 0x3DF0 + +typedef struct { + /* 0x00 */ u32 size; + /* 0x04 */ void (*init)(void* effect, void* initParms); + /* 0x08 */ void (*destroy)(void* effect); + /* 0x0C */ s32 (*update)(void* effect); + /* 0x10 */ void (*draw)(void* effect, struct GraphicsContext* gfxCtx); +} EffectInfo; // size = 0x14 + +typedef enum { + /* 0x00 */ EFFECT_SPARK, + /* 0x01 */ EFFECT_BLURE1, + /* 0x02 */ EFFECT_BLURE2, + /* 0x03 */ EFFECT_SHIELD_PARTICLE +} EffectType; + +/* Effect Soft Sprites */ + +struct EffectSs; + +typedef struct { + /* 0x00 */ u32 type; + /* 0x04 */ u32 (*init)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs, void* initParams); +} EffectSsInit; // size = 0x08 + +typedef struct { + /* 0x00 */ u32 vromStart; + /* 0x04 */ u32 vromEnd; + /* 0x08 */ void* vramStart; + /* 0x0C */ void* vramEnd; + /* 0x10 */ void* loadedRamAddr; + /* 0x14 */ EffectSsInit* initInfo; + /* 0x18 */ u8 unk_18; +} EffectSsOverlay; // size = 0x1C + +typedef struct EffectSs { + /* 0x00 */ Vec3f pos; + /* 0x0C */ Vec3f velocity; + /* 0x18 */ Vec3f accel; + /* 0x24 */ void (*update)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); + /* 0x28 */ void (*draw)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); + /* 0x2C */ Vec3f unk_2C; + /* 0x38 */ u32 unk_38; + /* 0x3C */ u32 unk_3C; + /* 0x40 */ s16 regs[13]; // specific per effect + /* 0x5A */ u16 flags; + /* 0x5C */ s16 life; // -1 means this entry is free + /* 0x5E */ u8 priority; // Lower value means higher priority + /* 0x5F */ u8 type; +} EffectSs; // size = 0x60 + +typedef struct { + /* 0x00 */ EffectSs* table; // "data_table" + /* 0x04 */ s32 searchStartIndex; + /* 0x08 */ s32 tableSize; +} EffectSsInfo; // size = 0x0C + +typedef enum { + /* 0x00 */ EFFECT_SS_DUST, + /* 0x01 */ EFFECT_SS_KIRAKIRA, + /* 0x02 */ EFFECT_SS_BOMB, + /* 0x03 */ EFFECT_SS_BOMB2, + /* 0x04 */ EFFECT_SS_BLAST, + /* 0x05 */ EFFECT_SS_G_SPK, + /* 0x06 */ EFFECT_SS_D_FIRE, + /* 0x07 */ EFFECT_SS_BUBBLE, + /* 0x08 */ EFFECT_SS_UNSET, + /* 0x09 */ EFFECT_SS_G_RIPPLE, + /* 0x0A */ EFFECT_SS_G_SPLASH, + /* 0x0B */ EFFECT_SS_G_MAGMA, + /* 0x0C */ EFFECT_SS_G_FIRE, + /* 0x0D */ EFFECT_SS_LIGHTNING, + /* 0x0E */ EFFECT_SS_DT_BUBBLE, + /* 0x0F */ EFFECT_SS_HAHEN, + /* 0x10 */ EFFECT_SS_STICK, + /* 0x11 */ EFFECT_SS_SIBUKI, + /* 0x12 */ EFFECT_SS_SIBUKI2, + /* 0x13 */ EFFECT_SS_G_MAGMA2, + /* 0x14 */ EFFECT_SS_STONE1, + /* 0x15 */ EFFECT_SS_HITMARK, + /* 0x16 */ EFFECT_SS_FHG_FLASH, + /* 0x17 */ EFFECT_SS_K_FIRE, + /* 0x18 */ EFFECT_SS_SOLDER_SRCH_BALL, + /* 0x19 */ EFFECT_SS_KAKERA, + /* 0x1A */ EFFECT_SS_ICE_PIECE, + /* 0x1B */ EFFECT_SS_EN_ICE, + /* 0x1C */ EFFECT_SS_FIRE_TAIL, + /* 0x1D */ EFFECT_SS_EN_FIRE, + /* 0x1E */ EFFECT_SS_EXTRA, + /* 0x1F */ EFFECT_SS_FCIRCLE, + /* 0x20 */ EFFECT_SS_DEAD_DB, + /* 0x21 */ EFFECT_SS_DEAD_DD, + /* 0x22 */ EFFECT_SS_DEAD_DS, + /* 0x23 */ EFFECT_SS_DEAD_SOUND, + /* 0x24 */ EFFECT_SS_ICE_SMOKE, + /* 0x25 */ EFFECT_SS_TYPE_MAX // originally "EFFECT_SS2_TYPE_LAST_LABEL" +} EffectSsType; #endif |
