z_object_switch OK (#527)

* z_obj_switch all functions attempted

* z_obj_switch OK

* Document z_obj_switch

* update gameplay_dangeon_keep references

* pr changes implemented

* fix warnings

* pr suggestions, name all functions
This commit is contained in:
mzxrules 2022-03-10 05:49:11 -05:00 committed by GitHub
parent 6ed7b0849c
commit f1560614d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1056 additions and 172 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ tags
# Project-specific ignores
*.z64
*.sra
*.bin
*.elf
archive/

View File

@ -14,20 +14,20 @@
<DList Name="gameplay_dangeon_keep_DL_007A50" Offset="0x7A50" />
<DList Name="gameplay_dangeon_keep_DL_007B20" Offset="0x7B20" />
<DList Name="gameplay_dangeon_keep_DL_007BF0" Offset="0x7BF0" />
<DList Name="gameplay_dangeon_keep_DL_007E00" Offset="0x7E00" />
<Collision Name="gameplay_dangeon_keep_Colheader_008018" Offset="0x8018" />
<DList Name="gRustyFloorSwitchDL" Offset="0x7E00" />
<Collision Name="gFloorSwitchCol" Offset="0x8018" />
<DList Name="gameplay_dangeon_keep_DL_0081D0" Offset="0x81D0" />
<DList Name="gameplay_dangeon_keep_DL_0083F0" Offset="0x83F0" />
<DList Name="gameplay_dangeon_keep_DL_0085F0" Offset="0x85F0" />
<DList Name="gEyeSwitchGoldDL" Offset="0x83F0" />
<DList Name="gEyeSwitchSilverDL" Offset="0x85F0" />
<Texture Name="gameplay_dangeon_keep_Tex_0086C0" OutName="tex_0086C0" Format="rgba16" Width="32" Height="32" Offset="0x86C0" />
<Texture Name="gameplay_dangeon_keep_Tex_008EC0" OutName="tex_008EC0" Format="rgba16" Width="32" Height="32" Offset="0x8EC0" />
<Texture Name="gameplay_dangeon_keep_Tex_0096C0" OutName="tex_0096C0" Format="rgba16" Width="32" Height="32" Offset="0x96C0" />
<Texture Name="gameplay_dangeon_keep_Tex_009EC0" OutName="tex_009EC0" Format="rgba16" Width="32" Height="32" Offset="0x9EC0" />
<Texture Name="gameplay_dangeon_keep_Tex_00A6C0" OutName="tex_00A6C0" Format="rgba16" Width="32" Height="32" Offset="0xA6C0" />
<Texture Name="gameplay_dangeon_keep_Tex_00AEC0" OutName="tex_00AEC0" Format="rgba16" Width="32" Height="32" Offset="0xAEC0" />
<Texture Name="gameplay_dangeon_keep_Tex_00B6C0" OutName="tex_00B6C0" Format="rgba16" Width="32" Height="32" Offset="0xB6C0" />
<Texture Name="gameplay_dangeon_keep_Tex_00BEC0" OutName="tex_00BEC0" Format="rgba16" Width="32" Height="32" Offset="0xBEC0" />
<Texture Name="gameplay_dangeon_keep_Tex_00C6C0" OutName="tex_00C6C0" Format="rgba16" Width="32" Height="32" Offset="0xC6C0" />
<Texture Name="gEyeSwitchGoldClosedTex" OutName="eye_gold_closed" Format="rgba16" Width="32" Height="32" Offset="0x96C0" />
<Texture Name="gEyeSwitchGoldOpeningTex" OutName="eye_gold_opening" Format="rgba16" Width="32" Height="32" Offset="0x9EC0" />
<Texture Name="gEyeSwitchGoldClosingTex" OutName="eye_gold_closing" Format="rgba16" Width="32" Height="32" Offset="0xA6C0" />
<Texture Name="gEyeSwitchGoldOpenTex" OutName="eye_gold_open" Format="rgba16" Width="32" Height="32" Offset="0xAEC0" />
<Texture Name="gEyeSwitchSilverOpenTex" OutName="eye_silver_open" Format="rgba16" Width="32" Height="32" Offset="0xB6C0" />
<Texture Name="gEyeSwitchSilverHalfTex" OutName="eye_silver_half" Format="rgba16" Width="32" Height="32" Offset="0xBEC0" />
<Texture Name="gEyeSwitchSilverClosedTex" OutName="eye_silver_closed" Format="rgba16" Width="32" Height="32" Offset="0xC6C0" />
<Texture Name="gameplay_dangeon_keep_Tex_00CEC0" OutName="tex_00CEC0" Format="rgba16" Width="32" Height="32" Offset="0xCEC0" />
<Texture Name="gameplay_dangeon_keep_Tex_00D6C0" OutName="tex_00D6C0" Format="rgba16" Width="32" Height="32" Offset="0xD6C0" />
<Texture Name="gameplay_dangeon_keep_Tex_00DEC0" OutName="tex_00DEC0" Format="rgba16" Width="32" Height="32" Offset="0xDEC0" />
@ -59,15 +59,15 @@
<Texture Name="gameplay_dangeon_keep_Tex_01A350" OutName="tex_01A350" Format="i8" Width="64" Height="64" Offset="0x1A350" />
<TextureAnimation Name="gameplay_dangeon_keep_Matanimheader_01B370" Offset="0x1B370" />
<DList Name="gameplay_dangeon_keep_DL_01B500" Offset="0x1B500" />
<DList Name="gameplay_dangeon_keep_DL_01B508" Offset="0x1B508" />
<DList Name="gFloorSwitch1DL" Offset="0x1B508" />
<DList Name="gameplay_dangeon_keep_DL_01B780" Offset="0x1B780" />
<DList Name="gameplay_dangeon_keep_DL_01B788" Offset="0x1B788" />
<DList Name="gFloorSwitch2DL" Offset="0x1B788" />
<DList Name="gameplay_dangeon_keep_DL_01B9F0" Offset="0x1B9F0" />
<DList Name="gameplay_dangeon_keep_DL_01B9F8" Offset="0x1B9F8" />
<DList Name="gameplay_dangeon_keep_DL_01BEE0" Offset="0x1BEE0" />
<DList Name="gameplay_dangeon_keep_DL_01BFB8" Offset="0x1BFB8" />
<DList Name="gameplay_dangeon_keep_DL_01C058" Offset="0x1C058" />
<TextureAnimation Name="gameplay_dangeon_keep_Matanimheader_01C118" Offset="0x1C118" />
<DList Name="gFloorSwitch3DL" Offset="0x1B9F8" />
<DList Name="gCrystalSwitchCoreDL" Offset="0x1BEE0" />
<DList Name="gCrystalSwitchDiamondDL" Offset="0x1BFB8" />
<DList Name="gCrystalSwitchBaseDL" Offset="0x1C058" />
<TextureAnimation Name="gCrystalSwitchAnimatedMat" Offset="0x1C118" />
<DList Name="gameplay_dangeon_keep_DL_01C220" Offset="0x1C220" />
<DList Name="gameplay_dangeon_keep_DL_01C228" Offset="0x1C228" />
<Texture Name="gameplay_dangeon_keep_Tex_01C2D8" OutName="tex_01C2D8" Format="rgba16" Width="32" Height="64" Offset="0x1C2D8" />

4
spec
View File

@ -1504,9 +1504,7 @@ beginseg
name "ovl_Obj_Switch"
compress
include "build/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.o"
include "build/data/ovl_Obj_Switch/ovl_Obj_Switch.data.o"
include "build/data/ovl_Obj_Switch/ovl_Obj_Switch.bss.o"
include "build/data/ovl_Obj_Switch/ovl_Obj_Switch.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Switch/ovl_Obj_Switch_reloc.o"
endseg
beginseg

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,26 @@
struct ObjSwitch;
typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, GlobalContext*);
typedef void (*ObjSwitchActionFunc)(struct ObjSwitch* this, GlobalContext* globalCtx);
typedef void (*ObjSwitchDrawFunc)(struct ObjSwitch* this, GlobalContext* globalCtx);
typedef void (*ObjSwitchSetupActionFunc)(struct ObjSwitch* this);
typedef enum {
/* 0 */ OBJSWITCH_TYPE_FLOOR,
/* 1 */ OBJSWITCH_TYPE_FLOOR_RUSTY, // Unused, incomplete implementation
/* 2 */ OBJSWITCH_TYPE_EYE,
/* 3 */ OBJSWITCH_TYPE_CRYSTAL,
/* 4 */ OBJSWITCH_TYPE_CRYSTAL_TARGETABLE,
/* 5 */ OBJSWITCH_TYPE_FLOOR_LARGE
} ObjSwitchType;
typedef enum {
/* 0 */ OBJSWITCH_SUBTYPE_ONCE, // Set Switch Flag when activated, stays activated
/* 1 */ OBJSWITCH_SUBTYPE_TOGGLE, // Toggle Switch Flag when activated
/* 2 */ OBJSWITCH_SUBTYPE_RESET, // Floor type only, set switch flag when pressed, unset when released
/* 3 */ OBJSWITCH_SUBTYPE_RESET_INVERTED, // Floor type only, set switch flag when not pressed, unset when pressed
/* 4 */ OBJSWITCH_SUBTYPE_SYNC // Crystal type only, syncronizes all crystal fl
} ObjSwitchSubType;
#define OBJSWITCH_GET_33(thisx) ((thisx)->params & 0x33)
#define OBJSWITCH_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F)
@ -14,12 +33,41 @@ typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, GlobalContext*);
#define OBJSWITCH_INVERSE_BLUE 0x30
typedef struct ObjSwitch {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x18];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x015C */ ObjSwitchActionFunc actionFunc;
/* 0x0160 */ char unk_160[0xF8];
/* 0x0160 */ s16 floorSwitchReleaseTimer;
/* 0x0162 */ s16 disableCrystalSwitchTimer;
/* 0x0164 */ s8 eyeTexIndex;
/* 0x0165 */ s8 sfxTimer;
/* 0x0168 */ s32 crystalAnimTimer;
/* 0x016C */ Color_RGB8 color;
/* 0x016F */ u8 collisionFlags;
/* 0x0170 */ s8 floorSwitchPlayerSnapState;
/* 0x0171 */ s8 nextSwitchFlagState;
/* 0x0172 */ s8 isPlayingCutscene;
/* 0x0174 */ ObjSwitchSetupActionFunc setupFunc;
union {
struct {
/* 0x0178 */ ColliderJntSph colliderJntSph;
/* 0x0198 */ ColliderJntSphElement colliderJntSphElements[1];
};
struct {
/* 0x0178 */ ColliderTris colliderTris;
/* 0x0198 */ ColliderTrisElement colliderTrisElements[2];
};
};
/* 0x0250 */ f32 floorSwitchUpScale;
/* 0x0254 */ f32 floorSwitchDownScale;
} ObjSwitch; // size = 0x258
extern const ActorInit Obj_Switch_InitVars;
#define OBJ_SWITCH_GET_TYPE(thisx) ((thisx)->params&7)
#define OBJ_SWITCH_GET_SUBTYPE(thisx) ((thisx)->params >> 4 & 7)
#define OBJ_SWITCH_GET_SWITCH_FLAG(thisx) ((thisx)->params >> 8 & 0x7F)
#define OBJ_SWITCH_IS_FROZEN(thisx) ((thisx)->params >> 7 & 1)
#define OBJ_SWITCH_UNSET_FROZEN(thisx) ((thisx)->params &= ~(1 << 7))
#define OBJ_SWITCH_IS_INVISIBLE(thisx) ((thisx)->params >> 3 & 1)
#define OBJ_SWITCH_GET_COLOR_ID(thisx) ((thisx)->home.rot.z&1)
#endif // Z_OBJ_SWITCH_H

View File

@ -7361,62 +7361,62 @@
0x8093A3F4:("ObjBombiwa_Update",),
0x8093A418:("func_8093A418",),
0x8093A608:("func_8093A608",),
0x8093ABD0:("func_8093ABD0",),
0x8093AC6C:("func_8093AC6C",),
0x8093ADA8:("func_8093ADA8",),
0x8093AE1C:("func_8093AE1C",),
0x8093AE74:("func_8093AE74",),
0x8093AE88:("func_8093AE88",),
0x8093AEC4:("func_8093AEC4",),
0x8093AEF0:("func_8093AEF0",),
0x8093AF1C:("func_8093AF1C",),
0x8093AF54:("func_8093AF54",),
0x8093ABD0:("ObjSwitch_InitJntSphCollider",),
0x8093AC6C:("ObjSwitch_InitTrisCollider",),
0x8093ADA8:("ObjSwitch_SpawnIce",),
0x8093AE1C:("ObjSwitch_SetSwitchFlagState",),
0x8093AE74:("ObjSwitch_CrystalUpdateTimer",),
0x8093AE88:("ObjSwitch_StopCutscene",),
0x8093AEC4:("ObjSwitch_PlayFootSwitchSfx",),
0x8093AEF0:("ObjSwitch_PlayDiamondSwitchSfx",),
0x8093AF1C:("ObjSwitch_SetFloorSwitchSnapPlayerState",),
0x8093AF54:("ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge",),
0x8093B084:("ObjSwitch_Init",),
0x8093B59C:("ObjSwitch_Destroy",),
0x8093B648:("func_8093B648",),
0x8093B668:("func_8093B668",),
0x8093B6F4:("func_8093B6F4",),
0x8093B710:("func_8093B710",),
0x8093B92C:("func_8093B92C",),
0x8093B940:("func_8093B940",),
0x8093B9C0:("func_8093B9C0",),
0x8093B9E4:("func_8093B9E4",),
0x8093BB5C:("func_8093BB5C",),
0x8093BB70:("func_8093BB70",),
0x8093BBD0:("func_8093BBD0",),
0x8093BCC8:("func_8093BCC8",),
0x8093BCDC:("func_8093BCDC",),
0x8093BD34:("func_8093BD34",),
0x8093BD4C:("func_8093BD4C",),
0x8093BDAC:("func_8093BDAC",),
0x8093BDC0:("func_8093BDC0",),
0x8093BE10:("func_8093BE10",),
0x8093BE2C:("func_8093BE2C",),
0x8093BEF0:("func_8093BEF0",),
0x8093BF04:("func_8093BF04",),
0x8093BF50:("func_8093BF50",),
0x8093BF70:("func_8093BF70",),
0x8093C0A4:("func_8093C0A4",),
0x8093C0B8:("func_8093C0B8",),
0x8093C138:("func_8093C138",),
0x8093C15C:("func_8093C15C",),
0x8093C23C:("func_8093C23C",),
0x8093C250:("func_8093C250",),
0x8093C2B4:("func_8093C2B4",),
0x8093C2D4:("func_8093C2D4",),
0x8093C3C8:("func_8093C3C8",),
0x8093C3DC:("func_8093C3DC",),
0x8093C460:("func_8093C460",),
0x8093C488:("func_8093C488",),
0x8093C584:("func_8093C584",),
0x8093C598:("func_8093C598",),
0x8093B648:("ObjSwitch_TryPlayCutsceneInit",),
0x8093B668:("ObjSwitch_TryPlayCutscene",),
0x8093B6F4:("ObjSwitch_FloorSwitchUpInit",),
0x8093B710:("ObjSwitch_FloorSwitchUp",),
0x8093B92C:("ObjSwitch_FloorSwitchPushDownInit",),
0x8093B940:("ObjSwitch_FloorSwitchPushDown",),
0x8093B9C0:("ObjSwitch_FloorSwitchDownInit",),
0x8093B9E4:("ObjSwitch_FloorSwitchDown",),
0x8093BB5C:("ObjSwitch_FloorSwitchRiseUpInit",),
0x8093BB70:("ObjSwitch_FloorSwitchRiseUp",),
0x8093BBD0:("ObjSwitch_IsEyeSwitchHit",),
0x8093BCC8:("ObjSwitch_EyeSwitchFrozenInit",),
0x8093BCDC:("ObjSwitch_EyeSwitchUnfrozen",),
0x8093BD34:("ObjSwitch_EyeSwitchOpenInit",),
0x8093BD4C:("ObjSwitch_EyeSwitchOpen",),
0x8093BDAC:("ObjSwitch_EyeSwitchClosingInit",),
0x8093BDC0:("ObjSwitch_EyeSwitchClosing",),
0x8093BE10:("ObjSwitch_EyeSwitchClosedInit",),
0x8093BE2C:("ObjSwitch_EyeSwitchClosed",),
0x8093BEF0:("ObjSwitch_EyeSwitchOpeningInit",),
0x8093BF04:("ObjSwitch_EyeSwitchOpening",),
0x8093BF50:("ObjSwitch_CrystalSwitchOffInit",),
0x8093BF70:("ObjSwitch_CrystalSwitchOff",),
0x8093C0A4:("ObjSwitch_CrystalSwitchTurnOnInit",),
0x8093C0B8:("ObjSwitch_CrystalSwitchTurnOn",),
0x8093C138:("ObjSwitch_CrystalSwitchOnInit",),
0x8093C15C:("ObjSwitch_CrystalSwitchOn",),
0x8093C23C:("ObjSwitch_CrystalSwitchTurnOffInit",),
0x8093C250:("ObjSwitch_CrystalSwitchTurnOff",),
0x8093C2B4:("ObjSwitch_LargeFloorSwitchUpInit",),
0x8093C2D4:("ObjSwitch_LargeFloorSwitchUp",),
0x8093C3C8:("ObjSwitch_LargeFloorSwitchPushDownInit",),
0x8093C3DC:("ObjSwitch_LargeFloorSwitchPushDown",),
0x8093C460:("ObjSwitch_LargeFloorSwitchDownInit",),
0x8093C488:("ObjSwitch_LargeFloorSwitchDown",),
0x8093C584:("ObjSwitch_LargeFloorSwitchRiseUpInit",),
0x8093C598:("ObjSwitch_LargeFloorSwitchRiseUp",),
0x8093C5FC:("ObjSwitch_Update",),
0x8093C778:("func_8093C778",),
0x8093C888:("func_8093C888",),
0x8093C8B8:("func_8093C8B8",),
0x8093C99C:("func_8093C99C",),
0x8093CA80:("func_8093CA80",),
0x8093CAC4:("func_8093CAC4",),
0x8093C778:("ObjSwitch_DrawFloorSwitch",),
0x8093C888:("ObjSwitch_DrawRustyFloorSwitch",),
0x8093C8B8:("ObjSwitch_DrawVisibleEyeSwitch",),
0x8093C99C:("ObjSwitch_DrawInvisibleEyeSwitch",),
0x8093CA80:("ObjSwitch_DrawEyeSwitch",),
0x8093CAC4:("ObjSwitch_DrawCrystalSwitch",),
0x8093CC24:("ObjSwitch_Draw",),
0x8093D3C0:("func_8093D3C0",),
0x8093D628:("ObjLift_Init",),

View File

@ -510,13 +510,10 @@ D_05006760 = 0x05006760;
D_05007498 = 0x05007498;
D_050078A0 = 0x050078A0;
D_05007938 = 0x05007938;
D_05007E00 = 0x05007E00;
D_05008018 = 0x05008018;
D_050085F0 = 0x050085F0;
D_050089D0 = 0x050089D0;
D_050182A8 = 0x050182A8;
D_0501B370 = 0x0501B370;
D_0501B508 = 0x0501B508;
D_0501BEE0 = 0x0501BEE0;
D_0501BFB8 = 0x0501BFB8;
D_0501C058 = 0x0501C058;