diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 11b6a0861..cd93dfe3a 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1087,7 +1087,7 @@ - + @@ -1112,10 +1112,10 @@ - - - - + + + + @@ -1285,12 +1285,18 @@ - - - - + + + + + + + + + + - + @@ -1303,14 +1309,17 @@ + + - + - + + @@ -1343,11 +1352,11 @@ - - - - - + + + + + diff --git a/assets/xml/objects/object_hakugin_obj.xml b/assets/xml/objects/object_hakugin_obj.xml index 412d0bdd3..b4badbd1d 100644 --- a/assets/xml/objects/object_hakugin_obj.xml +++ b/assets/xml/objects/object_hakugin_obj.xml @@ -6,37 +6,37 @@ - + - + - + - + - + - + - + diff --git a/assets/xml/objects/object_pp.xml b/assets/xml/objects/object_pp.xml index 1ac690935..dc51c202c 100644 --- a/assets/xml/objects/object_pp.xml +++ b/assets/xml/objects/object_pp.xml @@ -1,131 +1,153 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pst.xml b/assets/xml/objects/object_pst.xml index 3649877ea..d2b5323d6 100644 --- a/assets/xml/objects/object_pst.xml +++ b/assets/xml/objects/object_pst.xml @@ -1,14 +1,15 @@  + - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_taru.xml b/assets/xml/objects/object_taru.xml index 763fe1b2e..4a23d2923 100644 --- a/assets/xml/objects/object_taru.xml +++ b/assets/xml/objects/object_taru.xml @@ -1,12 +1,12 @@  - - - + + + - - - + + + diff --git a/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml b/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml new file mode 100644 index 000000000..0c23d17cd --- /dev/null +++ b/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/overlays/ovl_En_Bom.xml b/assets/xml/overlays/ovl_En_Bom.xml index 08902add6..15bfa097c 100644 --- a/assets/xml/overlays/ovl_En_Bom.xml +++ b/assets/xml/overlays/ovl_En_Bom.xml @@ -1,9 +1,20 @@ + - - - - - + + + + + + + + + + + + + + + diff --git a/include/functions.h b/include/functions.h index 02605d61f..7592cb6f4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -556,20 +556,19 @@ void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0); void EffectSsHitmark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); -// void EffectSsFhgFlash_SpawnShock(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5); +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params); void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected, s16 drawFlag); void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); // void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void EffectSsIcePiece_SpawnBurst(void); -// void EffectSsEnIce_SpawnFlyingVec3f(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, Color_RGBA8* pzParm4, Color_RGBA8* param_5, UNK_TYPE4 param_6); void func_800B2B44(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); // void func_800B2B7C(void); void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); // void EffectSsFireTail_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE4 uParm4, Vec3f* param_5, UNK_TYPE2 param_6, Color_RGBA8* param_7, Color_RGBA8* param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE4 param_11); // void EffectSsFireTail_SpawnFlame(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); // void EffectSsFireTail_SpawnFlameOnPlayer(void); -void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags, s16 bodyPart); // void EffectSsEnFire_SpawnVec3s(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); @@ -691,7 +690,7 @@ s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange); s32 func_800B8804(Actor* actor, PlayState* play, f32 xzRange); s32 func_800B886C(Actor* actor, PlayState* play); void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); -s32 func_800B8934(PlayState* play, Actor* actor); +s32 Actor_OnScreen(PlayState* play, Actor* actor); s32 Actor_HasParent(Actor* actor, PlayState* play); s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); s32 Actor_PickUpNearby(Actor* actor, PlayState* play, s32 getItemId); @@ -1106,8 +1105,8 @@ Camera* Camera_Alloc(View* view, CollisionContext* bg, PlayState* play); void Camera_Free(Camera* camera); void Camera_Init(Camera* camera, View* view, CollisionContext* bg, PlayState* play); // void func_800DDFE0(void); -void func_800DE0EC(Camera* camera, Actor* actor); -// s32 func_800DE308(Camera* camera, UNK_TYPE2 uParm2); +void Camera_InitPlayerSettings(Camera* camera, Player* player); +s32 Camera_ChangeStatus(Camera* camera, s16 status); // void func_800DE324(void); // void func_800DE62C(void); // void func_800DE840(void); @@ -1128,7 +1127,7 @@ void Camera_GetCamDir(Vec3s* dst, Camera* camera); s16 Camera_GetCamDirPitch(Camera* camera); s16 Camera_GetCamDirYaw(Camera* camera); void Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown); -void func_800DFD78(Camera* camera, s32 paramFlag, void* value); +s32 Camera_SetViewParam(Camera* camera, s32 viewFlag, void* param); // UNK_TYPE4 func_800DFEF0(s32 param_1, u16 param_2); // UNK_TYPE4 func_800DFF18(Camera* iParm1, UNK_TYPE2 uParm2); // UNK_TYPE4 func_800DFF34(s32 param_1); @@ -1136,7 +1135,7 @@ void func_800DFD78(Camera* camera, s32 paramFlag, void* value); s16 Camera_SetFlags(Camera* iParm1, s16 flags); s16 Camera_ClearFlags(Camera* camera, s16 flags); s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamDataId, f32 arg3, s16 timer1, s16 timer2, s16 timer3); -// UNK_TYPE4 func_800E007C(Camera* param_1, Camera* param_2); +s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera); // UNK_TYPE4 func_800E01AC(void); Vec3f* Camera_GetQuakeOffset(Vec3f* dst, Camera* camera); // void func_800E01DC(s32 param_1, u32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); @@ -2575,18 +2574,18 @@ void func_80165690(void); // void func_80165EC0(void); // void func_80166060(void); Gfx* func_801660B8(PlayState* play, Gfx* gfx); -void Play_Fini(GameState* thisx); +void Play_Destroy(GameState* thisx); // void func_801663C4(void); // void func_80166644(void); // void func_801668B4(void); void func_80166968(PlayState* play, Camera* camera); void func_80166B30(PlayState* play); -void func_80167814(PlayState* play); +void Play_Update(PlayState* play); void func_80167DE4(PlayState* play); // void func_80167F0C(void); void Play_Draw(PlayState* play); void func_80168DAC(PlayState* play); -void Play_Update(PlayState* play); +void Play_Main(PlayState* play); s32 Play_InCsMode(PlayState* play); f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); // void func_801691F0(void); @@ -2594,19 +2593,19 @@ void* Play_LoadScene(PlayState* play, RomFile* entry); void func_8016927C(PlayState* play, s16 sParm2); // void func_801692C4(PlayState* play, UNK_TYPE1 uParm2); // void Play_SceneInit(PlayState* play, s32 sceneIndex, UNK_TYPE1 param_3); -UNK_RET func_80169474(PlayState* play, Vec3f* v1, Vec3f* v2); -s32 Play_CreateSubCamera(PlayState* play); -s32 Play_GetActiveCamId(PlayState* play); -void Play_CameraChangeStatus(PlayState* play, s16 camId, s16 status); +void Play_GetScreenPos(PlayState* play, Vec3f* worldPos, Vec3f* screenPos); +s16 Play_CreateSubCamera(PlayState* play); +s16 Play_GetActiveCamId(PlayState* play); +s32 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status); void Play_ClearCamera(PlayState* play, s16 camId); Camera* Play_GetCamera(PlayState* play, s16 camId); -s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); -void Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); -void Play_CameraSetFov(PlayState* play, s16 camId, f32 fov); -void Play_CameraSetRoll(PlayState* play, s16 camId, s16 roll); +s32 Play_SetCameraAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); +s32 Play_SetCameraAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +s32 Play_SetCameraFov(PlayState* play, s16 camId, f32 fov); +s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll); void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId); -// void func_80169A50(void); -void Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting); +s32 func_80169A50(PlayState* play, s16 camId, Player* player, s16 setting); +s32 Play_ChangeCameraSetting(PlayState* play, s16 camId, s16 setting); void func_80169AFC(PlayState* play, s16 camId, s16 arg2); u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); @@ -2808,7 +2807,7 @@ void SpeedMeter_DrawTimeEntries(void* displayList, GraphicsContext* gfxCtx); void SpeedMeter_DrawAllocEntries(void* displayList, GraphicsContext* gfxCtx, GameState* gameState); void func_801780F0(Mtx* param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5, f32 param_6, f32 param_7); // void func_801781EC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_8017842C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); +void func_8017842C(MtxF* arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 arg10); // void func_80178750(void); // void func_80178818(void); void func_80178978(void); @@ -3150,9 +3149,7 @@ u32 Audio_NextRandom(void); void Audio_InitMesgQueues(void); void Audio_InvalDCache(void* buf, size_t size); void Audio_WritebackDCache(void* buf, size_t size); -// void func_80194790(void); -// void func_80194840(void); -// void func_801948B0(void); +s32 osAiSetNextBuffer(void* buf, u32 size); void AudioPlayback_NoteDisable(Note* note); void AudioPlayback_ProcessNotes(void); SoundFontSound* AudioPlayback_InstrumentGetSound(Instrument* instrument, s32 semitone); diff --git a/include/variables.h b/include/variables.h index f908fd43a..a2731ff12 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1582,13 +1582,6 @@ extern s32 gAudioContextInitalized; // extern UNK_TYPE1 D_801D5FF8; // extern UNK_TYPE4 D_801D5FFC; extern UNK_PTR D_801D6000; -// extern UNK_TYPE1 D_801D6010; -// extern UNK_TYPE1 D_801D6014; -// extern UNK_TYPE1 D_801D6028; -// extern UNK_TYPE1 D_801D6098; -// extern UNK_TYPE1 D_801D6100; -extern UNK_PTR D_801D6188; -extern UNK_PTR D_801D618C; // extern UNK_TYPE4 D_801D6190; // extern UNK_TYPE4 D_801D6194; // extern UNK_TYPE1 D_801D6200; diff --git a/include/z64.h b/include/z64.h index c9cbeb1bc..50667fc3e 100644 --- a/include/z64.h +++ b/include/z64.h @@ -98,17 +98,17 @@ typedef struct { } AnimatedMaterial; // size = 0x8 typedef struct { - /* 0x00 */ Vec3s pos; - /* 0x06 */ s16 unk_06; - /* 0x08 */ Gfx* opa; - /* 0x0C */ Gfx* xlu; -} PolygonDlist2; // size = 0x8 + /* 0x0 */ Vec3s pos; + /* 0x6 */ s16 unk_06; + /* 0x8 */ Gfx* opa; + /* 0xC */ Gfx* xlu; +} PolygonDlist2; // size = 0x10 typedef struct { - /* 0x00 */ u8 type; - /* 0x01 */ u8 num; // number of dlist entries - /* 0x04 */ void* start; - /* 0x08 */ void* end; + /* 0x0 */ u8 type; + /* 0x1 */ u8 num; // number of dlist entries + /* 0x4 */ void* start; + /* 0x8 */ void* end; } PolygonType2; // size = 0xC typedef struct { @@ -156,7 +156,7 @@ typedef struct { /* 0xA */ u8 colorsIndex; /* 0xB */ u8 flags; /* 0xC */ u8 lightParamsIndex; -} FireObjInitParams; // size = 0xD +} FireObjInitParams; // size = 0x10 typedef struct FireObjColors { /* 0x0 */ Color_RGBA8 primColor; @@ -183,17 +183,17 @@ typedef struct { } GameInfo; // size = 0x15D4 typedef struct { - /* 0x0000 */ u32 size; - /* 0x0004 */ void* bufp; - /* 0x0008 */ void* head; - /* 0x000C */ void* tail; + /* 0x0 */ u32 size; + /* 0x4 */ void* bufp; + /* 0x8 */ void* head; + /* 0xC */ void* tail; } TwoHeadArena; // size = 0x10 typedef struct { - /* 0x0000 */ u32 size; - /* 0x0004 */ Gfx* bufp; - /* 0x0008 */ Gfx* p; - /* 0x000C */ Gfx* d; + /* 0x0 */ u32 size; + /* 0x4 */ Gfx* bufp; + /* 0x8 */ Gfx* p; + /* 0xC */ Gfx* d; } TwoHeadGfxArena; // size = 0x10 typedef struct { @@ -663,29 +663,29 @@ typedef struct { } EnvironmentContext; // size = 0x100 typedef struct { - /* 0x00000 */ View view; - /* 0x00168 */ void* skyboxStaticSegment[4]; - /* 0x00178 */ void* skyboxPaletteStaticSegment; - /* 0x0017C */ Gfx* dListBuf; - /* 0x00180 */ Gfx* roomDL; - /* 0x00184 */ Vtx* roomVtx; - /* 0x00188 */ DmaRequest unk188; - /* 0x001A8 */ DmaRequest unk1A8; - /* 0x001C8 */ DmaRequest unk1C8; - /* 0x001E8 */ OSMesgQueue loadQueue; - /* 0x00200 */ OSMesg loadMsg; - /* 0x00204 */ s16 skyboxShouldDraw; - /* 0x00208 */ f32 rotX; - /* 0x0020C */ f32 rotY; - /* 0x00210 */ f32 rotZ; - /* 0x00214 */ Vec3f eye; - /* 0x00220 */ s16 angle; - /* 0x00222 */ u8 primR; - /* 0x00223 */ u8 primG; - /* 0x00224 */ u8 primB; - /* 0x00225 */ u8 envR; - /* 0x00226 */ u8 envG; - /* 0x00227 */ u8 envB; + /* 0x000 */ View view; + /* 0x168 */ void* skyboxStaticSegment[4]; + /* 0x178 */ void* skyboxPaletteStaticSegment; + /* 0x17C */ Gfx* dListBuf; + /* 0x180 */ Gfx* roomDL; + /* 0x184 */ Vtx* roomVtx; + /* 0x188 */ DmaRequest unk188; + /* 0x1A8 */ DmaRequest unk1A8; + /* 0x1C8 */ DmaRequest unk1C8; + /* 0x1E8 */ OSMesgQueue loadQueue; + /* 0x200 */ OSMesg loadMsg; + /* 0x204 */ s16 skyboxShouldDraw; + /* 0x208 */ f32 rotX; + /* 0x20C */ f32 rotY; + /* 0x210 */ f32 rotZ; + /* 0x214 */ Vec3f eye; + /* 0x220 */ s16 angle; + /* 0x222 */ u8 primR; + /* 0x223 */ u8 primG; + /* 0x224 */ u8 primB; + /* 0x225 */ u8 envR; + /* 0x226 */ u8 envG; + /* 0x227 */ u8 envB; } SkyboxContext; // size = 0x228 typedef enum { @@ -693,8 +693,8 @@ typedef enum { } SkyboxId; typedef struct ListAlloc { - /* 0x00 */ struct ListAlloc* prev; - /* 0x04 */ struct ListAlloc* next; + /* 0x0 */ struct ListAlloc* prev; + /* 0x4 */ struct ListAlloc* next; } ListAlloc; // size = 0x8 typedef struct { @@ -1003,7 +1003,7 @@ struct FireObjLight { /* 0x00 */ LightNode* light; /* 0x04 */ LightInfo lightInfo; /* 0x12 */ u8 lightParamsIndex; -}; // size = 0x13 +}; // size = 0x14 #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 @@ -1062,22 +1062,21 @@ struct FireObj { }; // size = 0x8B typedef struct { - /* 0x00 */ u8 seqIndex; - /* 0x01 */ u8 nightSeqIndex; - /* 0x02 */ u8 unk_02; + /* 0x0 */ u8 seqIndex; + /* 0x1 */ u8 nightSeqIndex; + /* 0x2 */ u8 unk_02; } SoundContext; // size = 0x3 typedef struct { - /* 0x00 */ s32 enabled; - /* 0x04 */ s32 timer; + /* 0x0 */ s32 enabled; + /* 0x4 */ s32 timer; } FrameAdvanceContext; // size = 0x8 typedef enum { - /* 00 */ GAMEOVER_INACTIVE, - /* 01 */ GAMEOVER_DEATH_START, - /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground - /* 03 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out - + /* 0 */ GAMEOVER_INACTIVE, + /* 1 */ GAMEOVER_DEATH_START, + /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground + /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out /* 20 */ GAMEOVER_REVIVE_START = 20, /* 21 */ GAMEOVER_REVIVE_RUMBLE, /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground @@ -1086,8 +1085,8 @@ typedef enum { } GameOverState; typedef struct { - /* 0x00 */ u16 state; -} GameOverContext; // size = 0x02 + /* 0x0 */ u16 state; +} GameOverContext; // size = 0x2 struct PlayState { /* 0x00000 */ GameState state; @@ -1199,17 +1198,17 @@ typedef struct { } struct_800BD888_arg1; // size = 0x28 typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8 color; - /* 0x0C */ Color_RGBA8 envColor; + /* 0x0 */ u32 type; + /* 0x4 */ u32 setScissor; + /* 0x8 */ Color_RGBA8 color; + /* 0xC */ Color_RGBA8 envColor; } struct_801F8010; // size = 0x10 typedef struct { - /* 0x00 */ u32 useRgba; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8 primColor; - /* 0x08 */ Color_RGBA8 envColor; + /* 0x0 */ u32 useRgba; + /* 0x4 */ u32 setScissor; + /* 0x8 */ Color_RGBA8 primColor; + /* 0xC */ Color_RGBA8 envColor; } struct_801F8020; // size = 0x10 typedef struct { @@ -1237,9 +1236,9 @@ typedef struct { } TargetRangeParams; // size = 0x8 typedef struct { - /* 0x00 */ u8* value; - /* 0x04 */ const char* name; -} FlagSetEntry; // size = 0x08 + /* 0x0 */ u8* value; + /* 0x4 */ const char* name; +} FlagSetEntry; // size = 0x8 // TODO: Dedicated Header? #define FRAM_BASE_ADDRESS 0x08000000 // FRAM Base Address in Cart Memory diff --git a/include/z64actor.h b/include/z64actor.h index e1fc334a3..175d9ef22 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -32,18 +32,18 @@ typedef struct { } DamageTable; // size = 0x20 typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 cylRadius; - /* 0x04 */ s16 cylHeight; - /* 0x06 */ u8 mass; -} CollisionCheckInfoInit; + /* 0x0 */ u8 health; + /* 0x2 */ s16 cylRadius; + /* 0x4 */ s16 cylHeight; + /* 0x6 */ u8 mass; +} CollisionCheckInfoInit; // size = 0x8 typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 cylRadius; - /* 0x04 */ s16 cylHeight; - /* 0x06 */ s16 cylYShift; - /* 0x08 */ u8 mass; + /* 0x0 */ u8 health; + /* 0x2 */ s16 cylRadius; + /* 0x4 */ s16 cylHeight; + /* 0x6 */ s16 cylYShift; + /* 0x8 */ u8 mass; } CollisionCheckInfoInit2; // size = 0xC typedef struct { @@ -398,8 +398,8 @@ typedef struct ActorContext { } ActorContext; // size = 0x284 typedef enum { - /* 00 */ ACTOR_DRAW_DMGEFF_FIRE, - /* 01 */ ACTOR_DRAW_DMGEFF_BLUE_FIRE, + /* 0 */ ACTOR_DRAW_DMGEFF_FIRE, + /* 1 */ ACTOR_DRAW_DMGEFF_BLUE_FIRE, /* 10 */ ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX = 10, /* 11 */ ACTOR_DRAW_DMGEFF_FROZEN_SFX, /* 20 */ ACTOR_DRAW_DMGEFF_LIGHT_ORBS = 20, diff --git a/include/z64animation.h b/include/z64animation.h index cceb2547f..b697dbfdf 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -34,49 +34,49 @@ typedef enum { } AnimationTapers; typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; // The first child's index into the limb table. - /* 0x07 */ u8 sibling; // The parent limb's next limb index into the limb table. - /* 0x08 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; // The first child's index into the limb table. + /* 0x7 */ u8 sibling; // The parent limb's next limb index into the limb table. + /* 0x8 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the // far model display list. } StandardLimb; // size = 0xC // Model has limbs with only rigid meshes typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; - /* 0x07 */ u8 sibling; - /* 0x08 */ Gfx* dLists[2]; // Near and far + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; + /* 0x7 */ u8 sibling; + /* 0x8 */ Gfx* dLists[2]; // Near and far } LodLimb; // size = 0x10 // Model has limbs with only rigid meshes typedef struct { - /* 0x00 */ void** segment; - /* 0x04 */ u8 limbCount; + /* 0x0 */ void** segment; + /* 0x4 */ u8 limbCount; } SkeletonHeader; // size = 0x8 // Model has limbs with flexible meshes typedef struct { - /* 0x00 */ SkeletonHeader sh; - /* 0x08 */ u8 dListCount; + /* 0x0 */ SkeletonHeader sh; + /* 0x8 */ u8 dListCount; } FlexSkeletonHeader; // size = 0xC // Index into the frame data table. typedef struct { - /* 0x00 */ u16 x; - /* 0x02 */ u16 y; - /* 0x04 */ u16 z; -} JointIndex; // size = 0x06 + /* 0x0 */ u16 x; + /* 0x2 */ u16 y; + /* 0x4 */ u16 z; +} JointIndex; // size = 0x6 typedef struct { - /* 0x00 */ s16 frameCount; -} AnimationHeaderCommon; + /* 0x0 */ s16 frameCount; +} AnimationHeaderCommon; // size = 0x2 typedef struct { - /* 0x000 */ AnimationHeaderCommon common; - /* 0x004 */ s16* frameData; // referenced as tbl - /* 0x008 */ JointIndex* jointIndices; // referenced as ref_tbl - /* 0x00C */ u16 staticIndexMax; + /* 0x0 */ AnimationHeaderCommon common; + /* 0x4 */ s16* frameData; // referenced as tbl + /* 0x8 */ JointIndex* jointIndices; // referenced as ref_tbl + /* 0xC */ u16 staticIndexMax; } AnimationHeader; // size = 0x10 typedef struct { @@ -89,10 +89,10 @@ typedef struct { } JointKey; // size = 0x12 typedef struct { - /* 0x00 */ s16 frameCount; - /* 0x02 */ s16 limbCount; - /* 0x04 */ s16* frameData; - /* 0x08 */ JointKey* jointKey; + /* 0x0 */ s16 frameCount; + /* 0x2 */ s16 limbCount; + /* 0x4 */ s16* frameData; + /* 0x8 */ JointKey* jointKey; } LegacyAnimationHeader; // size = 0xC typedef enum { @@ -105,46 +105,46 @@ typedef enum { } AnimationType; typedef struct { - /* 0x000 */ DmaRequest req; - /* 0x020 */ OSMesgQueue msgQueue; - /* 0x038 */ OSMesg msg; + /* 0x00 */ DmaRequest req; + /* 0x20 */ OSMesgQueue msgQueue; + /* 0x38 */ OSMesg msg; } AnimEntryLoadFrame; // size = 0x3C typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; } AnimEntryCopyAll; // size = 0xC typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* base; - /* 0x008 */ Vec3s* mod; - /* 0x00C */ f32 weight; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* base; + /* 0x8 */ Vec3s* mod; + /* 0xC */ f32 weight; } AnimEntryInterp; // size = 0x10 typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; - /* 0x00C */ u8* copyFlag; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; + /* 0xC */ u8* copyFlag; } AnimEntryCopyTrue; // size = 0x10 typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; - /* 0x00C */ u8* copyFlag; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; + /* 0xC */ u8* copyFlag; } AnimEntryCopyFalse; // size = 0x10 typedef struct { - /* 0x000 */ struct Actor* actor; - /* 0x004 */ struct SkelAnime* skelAnime; - /* 0x008 */ f32 unk08; + /* 0x0 */ struct Actor* actor; + /* 0x4 */ struct SkelAnime* skelAnime; + /* 0x8 */ f32 unk08; } AnimEntryMoveActor; // size = 0xC typedef union { @@ -157,8 +157,8 @@ typedef union { } AnimationEntryData; // size = 0x3C typedef struct { - /* 0x000 */ u8 type; - /* 0x004 */ AnimationEntryData data; + /* 0x00 */ u8 type; + /* 0x04 */ AnimationEntryData data; } AnimationEntry; // size = 0x40 typedef struct AnimationContext { @@ -167,8 +167,8 @@ typedef struct AnimationContext { } AnimationContext; // size = 0xC84 typedef struct { - /* 0x000 */ AnimationHeaderCommon common; - /* 0x004 */ u32 segment; + /* 0x0 */ AnimationHeaderCommon common; + /* 0x4 */ u32 segment; } LinkAnimationHeader; // size = 0x8 typedef struct SkelAnime { @@ -234,19 +234,19 @@ typedef struct { } AnimationInfo; // size = 0x18 typedef struct { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ s16 startFrame; - /* 0x0A */ s16 frameCount; - /* 0x0C */ u8 mode; - /* 0x0E */ s16 morphFrames; + /* 0x0 */ AnimationHeader* animation; + /* 0x4 */ f32 playSpeed; + /* 0x8 */ s16 startFrame; + /* 0xA */ s16 frameCount; + /* 0xC */ u8 mode; + /* 0xE */ s16 morphFrames; } AnimationInfoS; // size = 0x10 typedef struct AnimationSpeedInfo { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ u8 mode; - /* 0x0C */ f32 morphFrames; + /* 0x0 */ AnimationHeader* animation; + /* 0x4 */ f32 playSpeed; + /* 0x8 */ u8 mode; + /* 0xC */ f32 morphFrames; } AnimationSpeedInfo; // size = 0x10 struct SkeletonInfo; @@ -256,18 +256,18 @@ typedef s32 (*UnkKeyframeCallback)(struct PlayState* play, struct SkeletonInfo* // Keyframe limb? typedef struct { - /* 0x00 */ Gfx* dList; - /* 0x04 */ u8 unk_4; - /* 0x05 */ u8 flags; - /* 0x06 */ Vec3s root; + /* 0x0 */ Gfx* dList; + /* 0x4 */ u8 unk_4; + /* 0x5 */ u8 flags; + /* 0x6 */ Vec3s root; } Struct_801BFA14_Arg1_Field4; // size = 0xC // Other limb type? typedef struct { - /* 0x00 */ Gfx* dList; - /* 0x04 */ u8 unk_4; - /* 0x05 */ u8 flags; - /* 0x06 */ u8 unk_6; // transform limb draw index + /* 0x0 */ Gfx* dList; + /* 0x4 */ u8 unk_4; + /* 0x5 */ u8 flags; + /* 0x6 */ u8 unk_6; // transform limb draw index } Struct_801BFA14_Arg1_Field4_2; // size = 0x8 typedef struct { @@ -279,18 +279,18 @@ typedef struct { }; /* 0x08 */ s16* unk_8; /* 0x0C */ s16* unk_C; - /* 0x0C */ char unk_10[0x2]; + /* 0x10 */ char unk_10[0x2]; /* 0x12 */ s16 unk_12; -} Struct_801BFA14_Arg1; +} Struct_801BFA14_Arg1; // size = 0x14 typedef struct { /* 0x00 */ u16* unk_0; /* 0x04 */ s16* unk_4; /* 0x08 */ s16* unk_8; /* 0x0C */ s16* unk_C; - /* 0x0C */ char unk_10[0x2]; + /* 0x10 */ char unk_10[0x2]; /* 0x12 */ s16 unk_12; -} SkeletonInfo_1C; +} SkeletonInfo_1C; // size = 0x14 typedef struct { /* 0x00 */ f32 unk_0; @@ -299,7 +299,7 @@ typedef struct { /* 0x0C */ f32 unk_C; /* 0x10 */ f32 unk_10; /* 0x14 */ s32 unk_14; -} FrameControl; +} FrameControl; // size = 0x18 // FlexKeyframeSkeleton ? typedef struct SkeletonInfo { @@ -310,7 +310,7 @@ typedef struct SkeletonInfo { /* 0x24 */ f32 unk_24; // duration? current time? /* 0x28 */ Vec3s* frameData; // array of 3 Vec3s /* 0x2C */ s16* unk_2C; -} SkeletonInfo; +} SkeletonInfo; // size = 0x30 typedef s32 (*OverrideKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos); diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index f0d24fd6f..b42938354 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -72,20 +72,20 @@ typedef struct { } ScaleRotPos; // size = 0x20 typedef struct CollisionPoly { - /* 0x00 */ u16 type; + /* 0x0 */ u16 type; union { - u16 vtxData[3]; + /* 0x2 */ u16 vtxData[3]; struct { - /* 0x02 */ u16 flags_vIA; // 0xE000 is poly exclusion flags (xpFlags), 0x1FFF is vtxId - /* 0x04 */ u16 flags_vIB; // 0xE000 is flags, 0x1FFF is vtxId + /* 0x2 */ u16 flags_vIA; // 0xE000 is poly exclusion flags (xpFlags), 0x1FFF is vtxId + /* 0x4 */ u16 flags_vIB; // 0xE000 is flags, 0x1FFF is vtxId // 0x2000 = poly IsConveyor surface - /* 0x06 */ u16 vIC; + /* 0x6 */ u16 vIC; }; }; - /* 0x08 */ Vec3s normal; // Unit normal vector + /* 0x8 */ Vec3s normal; // Unit normal vector // Value ranges from -0x7FFF to 0x7FFF, representing -1.0 to 1.0; 0x8000 is invalid - /* 0x0E */ s16 dist; // Plane distance from origin along the normal + /* 0xE */ s16 dist; // Plane distance from origin along the normal } CollisionPoly; // size = 0x10 typedef struct { @@ -158,9 +158,10 @@ typedef struct { /* 0x2 */ u16 next; // index of the next SSNode in the list, or SS_NULL if last element } SSNode; // size = 0x4 +// represents a linked list of type SSNode typedef struct { - u16 head; // index of the first SSNode in the list, or SS_NULL if the list is empty -} SSList; // represents a linked list of type SSNode + /* 0x0 */ u16 head; // index of the first SSNode in the list, or SS_NULL if the list is empty +} SSList; // size = 0x2 typedef struct { /* 0x0 */ u16 max; @@ -313,8 +314,9 @@ typedef struct { } BgSpecialSceneMeshSubdivision; // size = 0xC typedef struct { - s16 sceneId; - Vec3s subdivAmount; - s32 nodeListMax; // if -1, dynamically compute max nodes -} BgCheckSceneSubdivisionEntry; + /* 0x0 */ s16 sceneId; + /* 0x2 */ Vec3s subdivAmount; + /* 0x8 */ s32 nodeListMax; // if -1, dynamically compute max nodes +} BgCheckSceneSubdivisionEntry; // size = 0xC + #endif diff --git a/include/z64collision_check.h b/include/z64collision_check.h index fbfcff7ae..434b74a3a 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -21,54 +21,54 @@ typedef struct { } Collider; // size = 0x18 typedef struct { - /* 0x00 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x01 */ u8 atFlags; // Information flags for AT collisions. - /* 0x02 */ u8 acFlags; // Information flags for OC collisions. - /* 0x03 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x04 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. - /* 0x05 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInit; // size = 0x06 + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for OC collisions. + /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x4 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. + /* 0x5 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInit; // size = 0x6 typedef struct { - /* 0x00 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x01 */ u8 atFlags; // Information flags for AT collisions. - /* 0x02 */ u8 acFlags; // Information flags for AC collisions. - /* 0x03 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x04 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInitType1; // size = 0x05 + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for AC collisions. + /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x4 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInitType1; // size = 0x5 typedef struct { - /* 0x00 */ struct Actor* actor; // Attached actor - /* 0x04 */ u8 atFlags; // Information flags for AT collisions. - /* 0x05 */ u8 acFlags; // Information flags for AC collisions. - /* 0x06 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x07 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInitToActor; // size = 0x08 + /* 0x0 */ struct Actor* actor; // Attached actor + /* 0x4 */ u8 atFlags; // Information flags for AT collisions. + /* 0x5 */ u8 acFlags; // Information flags for AC collisions. + /* 0x6 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x7 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInitToActor; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 damage; // Damage or Stun Timer -} ColliderTouch; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer +} ColliderTouch; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 damage; // Damage or Stun Timer -} ColliderTouchInit; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer +} ColliderTouchInit; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 defense; // Damage Resistance - /* 0x06 */ Vec3s hitPos; // Point of contact -} ColliderBump; // size = 0x0C + /* 0x0 */ u32 dmgFlags; // Bumper damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance + /* 0x6 */ Vec3s hitPos; // Point of contact +} ColliderBump; // size = 0xC typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper exclusion mask - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 defense; // Damage Resistance -} ColliderBumpInit; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Bumper exclusion mask + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance +} ColliderBumpInit; // size = 0x8 typedef struct ColliderInfo { /* 0x00 */ ColliderTouch toucher; // Damage properties when acting as an AT collider @@ -100,10 +100,10 @@ typedef struct { } ColliderJntSphElementDim; // size = 0x18 typedef struct { - /* 0x00 */ u8 limb; // attached limb - /* 0x02 */ Sphere16 modelSphere; // model space sphere - /* 0x0A */ s16 scale; // world space sphere = model * scale * 0.01 -} ColliderJntSphElementDimInit; // size = 0x0C + /* 0x0 */ u8 limb; // attached limb + /* 0x2 */ Sphere16 modelSphere; // model space sphere + /* 0xA */ s16 scale; // world space sphere = model * scale * 0.01 +} ColliderJntSphElementDimInit; // size = 0xC typedef struct { /* 0x00 */ ColliderInfo info; @@ -128,15 +128,15 @@ typedef struct { } ColliderJntSphInit; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderJntSphElementInit* elements; + /* 0x0 */ ColliderInitType1 base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderJntSphElementInit* elements; } ColliderJntSphInitType1; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitToActor base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderJntSphElementInit* elements; + /* 0x0 */ ColliderInitToActor base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderJntSphElementInit* elements; } ColliderJntSphInitToActor; // size = 0x10 typedef struct { @@ -190,9 +190,9 @@ typedef struct { } ColliderTrisInit; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderTrisElementInit* elements; + /* 0x0 */ ColliderInitType1 base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderTrisElementInit* elements; } ColliderTrisInitType1; // size = 0x10 typedef struct { @@ -254,8 +254,8 @@ typedef struct { } CollisionCheckContext; // size = 0x29C typedef struct { - /* 0 */ u8 blood; - /* 1 */ u8 effect; + /* 0x0 */ u8 blood; + /* 0x1 */ u8 effect; } HitInfo; // size = 0x2 typedef enum { diff --git a/include/z64cutscene.h b/include/z64cutscene.h index aa0681de5..430cef331 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -5,11 +5,11 @@ #include "unk.h" typedef struct { - /* 0x00 */ s8 continueFlag; - /* 0x01 */ s8 cameraRoll; - /* 0x02 */ u16 nextPointFrame; - /* 0x04 */ f32 viewAngle; // in degrees - /* 0x08 */ Vec3s pos; + /* 0x0 */ s8 continueFlag; + /* 0x1 */ s8 cameraRoll; + /* 0x2 */ u16 nextPointFrame; + /* 0x4 */ f32 viewAngle; // in degrees + /* 0x8 */ Vec3s pos; } CutsceneCameraPoint; // size = 0x10 typedef struct { @@ -86,13 +86,13 @@ typedef struct { } CsCmdTextbox; // size = 0xC typedef enum { - /* 0 */ CS_TEXTBOX_TYPE_DEFAULT, - /* 1 */ CS_TEXTBOX_TYPE_1, - /* 2 */ CS_TEXTBOX_TYPE_LEARN_SONG, - /* 3 */ CS_TEXTBOX_TYPE_3, - /* 4 */ CS_TEXTBOX_TYPE_BOSSES_REMAINS, - /* 5 */ CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS, - /* 0xFFFF */ CS_TEXTBOX_TYPE_NONE = 0xFFFF + /* -1 */ CS_TEXTBOX_TYPE_NONE = -1, + /* 0 */ CS_TEXTBOX_TYPE_DEFAULT, + /* 1 */ CS_TEXTBOX_TYPE_1, + /* 2 */ CS_TEXTBOX_TYPE_LEARN_SONG, + /* 3 */ CS_TEXTBOX_TYPE_3, + /* 4 */ CS_TEXTBOX_TYPE_BOSSES_REMAINS, + /* 5 */ CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS } CutsceneTextboxType; typedef struct { diff --git a/include/z64dma.h b/include/z64dma.h index 570aa8432..3b17d04d0 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -15,10 +15,10 @@ typedef struct { } DmaRequest; // size = 0x20 typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ u32 romStart; - /* 0x0C */ u32 romEnd; + /* 0x0 */ u32 vromStart; + /* 0x4 */ u32 vromEnd; + /* 0x8 */ u32 romStart; + /* 0xC */ u32 romEnd; } DmaEntry; // size = 0x10 #endif diff --git a/include/z64effect.h b/include/z64effect.h index fb9d9e159..dde996eb7 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -33,10 +33,10 @@ struct PlayState; #define rgObjBankIndex regs[11] typedef struct { - /* 0x00 */ u8 active; - /* 0x01 */ u8 unk1; - /* 0x02 */ u8 unk2; -} EffectStatus; // size = 0x03 + /* 0x0 */ u8 active; + /* 0x1 */ u8 unk1; + /* 0x2 */ u8 unk2; +} EffectStatus; // size = 0x3 typedef struct { /* 0x00 */ Vec3f velocity; @@ -227,11 +227,11 @@ typedef struct { } EffectInfo; // size = 0x14 typedef enum { - /* 0x00 */ EFFECT_SPARK, - /* 0x01 */ EFFECT_BLURE1, - /* 0x02 */ EFFECT_BLURE2, - /* 0x03 */ EFFECT_SHIELD_PARTICLE, - /* 0x04 */ EFFECT_TIRE_MARK + /* 0 */ EFFECT_SPARK, + /* 1 */ EFFECT_BLURE1, + /* 2 */ EFFECT_BLURE2, + /* 3 */ EFFECT_SHIELD_PARTICLE, + /* 4 */ EFFECT_TIRE_MARK } EffectType; /* Effect Soft Sprites */ @@ -243,9 +243,9 @@ typedef void(*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct Effe typedef void(*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* particle); typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ EffectSsInitFunc init; -} EffectSsInit; // size = 0x08 + /* 0x0 */ u32 type; + /* 0x4 */ EffectSsInitFunc init; +} EffectSsInit; // size = 0x8 typedef struct { /* 0x00 */ u32 vromStart; diff --git a/include/z64item.h b/include/z64item.h index 3e3c608b9..b823443bb 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -7,9 +7,9 @@ // TODO fill out these enums typedef enum { - /* 0x0 */ EQUIP_TYPE_SWORD, - /* 0x1 */ EQUIP_TYPE_SHIELD, - /* 0x2 */ EQUIP_TYPE_MAX + /* 0 */ EQUIP_TYPE_SWORD, + /* 1 */ EQUIP_TYPE_SHIELD, + /* 2 */ EQUIP_TYPE_MAX } EquipmentType; typedef enum { @@ -29,14 +29,14 @@ typedef enum { } EquipValueShield; typedef enum { - /* 0x00 */ UPG_QUIVER, - /* 0x01 */ UPG_BOMB_BAG, - /* 0x02 */ UPG_STRENGTH, - /* 0x03 */ UPG_SCALE, - /* 0x04 */ UPG_WALLET, - /* 0x05 */ UPG_BULLET_BAG, - /* 0x06 */ UPG_STICKS, - /* 0x07 */ UPG_NUTS + /* 0 */ UPG_QUIVER, + /* 1 */ UPG_BOMB_BAG, + /* 2 */ UPG_STRENGTH, + /* 3 */ UPG_SCALE, + /* 4 */ UPG_WALLET, + /* 5 */ UPG_BULLET_BAG, + /* 6 */ UPG_STICKS, + /* 7 */ UPG_NUTS } UpgradeType; typedef enum { diff --git a/include/z64light.h b/include/z64light.h index 60736b62e..df7c1b4fa 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -82,9 +82,9 @@ typedef struct LightContext { } LightContext; // size = 0x10 typedef enum LightType { - /* 0x00 */ LIGHT_POINT_NOGLOW, - /* 0x01 */ LIGHT_DIRECTIONAL, - /* 0x02 */ LIGHT_POINT_GLOW + /* 0 */ LIGHT_POINT_NOGLOW, + /* 1 */ LIGHT_DIRECTIONAL, + /* 2 */ LIGHT_POINT_GLOW } LightType; typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec); diff --git a/include/z64math.h b/include/z64math.h index 3732222cc..16ab72e8a 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -6,47 +6,47 @@ #define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z typedef struct { - /* 0x00 */ s16 x; - /* 0x02 */ s16 z; -} Vec2s; // size = 0x04 + /* 0x0 */ s16 x; + /* 0x2 */ s16 z; +} Vec2s; // size = 0x4 typedef struct { - /* 0x00 */ f32 x; - /* 0x04 */ f32 z; -} Vec2f; // size = 0x08 + /* 0x0 */ f32 x; + /* 0x4 */ f32 z; +} Vec2f; // size = 0x8 typedef struct { - /* 0x00 */ f32 x; - /* 0x04 */ f32 y; - /* 0x08 */ f32 z; -} Vec3f; // size = 0x0C + /* 0x0 */ f32 x; + /* 0x4 */ f32 y; + /* 0x8 */ f32 z; +} Vec3f; // size = 0xC typedef struct { - /* 0x00 */ u16 x; - /* 0x02 */ u16 y; - /* 0x04 */ u16 z; -} Vec3us; // size = 0x06 + /* 0x0 */ u16 x; + /* 0x2 */ u16 y; + /* 0x4 */ u16 z; +} Vec3us; // size = 0x6 typedef struct { - /* 0x00 */ s16 x; - /* 0x02 */ s16 y; - /* 0x04 */ s16 z; -} Vec3s; // size = 0x06 + /* 0x0 */ s16 x; + /* 0x2 */ s16 y; + /* 0x4 */ s16 z; +} Vec3s; // size = 0x6 typedef struct { - /* 0x00 */ s32 x; - /* 0x04 */ s32 y; - /* 0x08 */ s32 z; -} Vec3i; // size = 0x0C + /* 0x0 */ s32 x; + /* 0x4 */ s32 y; + /* 0x8 */ s32 z; +} Vec3i; // size = 0xC typedef struct { - /* 0x00 */ Vec3s center; - /* 0x06 */ s16 radius; -} Sphere16; // size = 0x08 + /* 0x0 */ Vec3s center; + /* 0x6 */ s16 radius; +} Sphere16; // size = 0x8 typedef struct { - /* 0x00 */ Vec3f center; - /* 0x0C */ f32 radius; + /* 0x0 */ Vec3f center; + /* 0xC */ f32 radius; } Spheref; // size = 0x10 /* @@ -64,11 +64,11 @@ typedef struct { } TriNorm; // size = 0x34 typedef struct { - /* 0x00 */ s16 radius; - /* 0x02 */ s16 height; - /* 0x04 */ s16 yShift; - /* 0x06 */ Vec3s pos; -} Cylinder16; // size = 0x0C + /* 0x0 */ s16 radius; + /* 0x2 */ s16 height; + /* 0x4 */ s16 yShift; + /* 0x6 */ Vec3s pos; +} Cylinder16; // size = 0xC typedef struct { /* 0x00 */ f32 radius; @@ -89,10 +89,10 @@ typedef struct { // Defines a point in the spherical coordinate system typedef struct { - /* 0x00 */ f32 r; // radius - /* 0x04 */ s16 pitch; // polar (zenith) angle - /* 0x06 */ s16 yaw; // azimuthal angle -} VecSph; // size = 0x08 + /* 0x0 */ f32 r; // radius + /* 0x4 */ s16 pitch; // polar (zenith) angle + /* 0x6 */ s16 yaw; // azimuthal angle +} VecSph; // size = 0x8 #define LERPIMP(v0, v1, t) ((v0) + (((v1) - (v0)) * (t))) #define F32_LERP(v0, v1, t) ((1.0f - (t)) * (f32)(v0) + (t) * (f32)(v1)) diff --git a/include/z64player.h b/include/z64player.h index 0f74f5a6c..4dd47424e 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -7,38 +7,38 @@ struct Player; typedef enum { - /* 0x00 */ PLAYER_SHIELD_NONE, - /* 0x01 */ PLAYER_SHIELD_HEROS_SHIELD, - /* 0x02 */ PLAYER_SHIELD_MIRROR_SHIELD, - /* 0x03 */ PLAYER_SHIELD_MAX + /* 0 */ PLAYER_SHIELD_NONE, + /* 1 */ PLAYER_SHIELD_HEROS_SHIELD, + /* 2 */ PLAYER_SHIELD_MIRROR_SHIELD, + /* 3 */ PLAYER_SHIELD_MAX } PlayerShield; typedef enum { - /* 0x00 */ PLAYER_BOOTS_FIERCE_DEITY, - /* 0x01 */ PLAYER_BOOTS_HYLIAN, - /* 0x02 */ PLAYER_BOOTS_GIANT, - /* 0x03 */ PLAYER_BOOTS_DEKU, - /* 0x04 */ PLAYER_BOOTS_ZORA_LAND, - /* 0x05 */ PLAYER_BOOTS_ZORA_UNDERWATER, - /* 0x06 */ PLAYER_BOOTS_GORON, - /* 0x07 */ PLAYER_BOOTS_MAX + /* 0 */ PLAYER_BOOTS_FIERCE_DEITY, + /* 1 */ PLAYER_BOOTS_HYLIAN, + /* 2 */ PLAYER_BOOTS_GIANT, + /* 3 */ PLAYER_BOOTS_DEKU, + /* 4 */ PLAYER_BOOTS_ZORA_LAND, + /* 5 */ PLAYER_BOOTS_ZORA_UNDERWATER, + /* 6 */ PLAYER_BOOTS_GORON, + /* 7 */ PLAYER_BOOTS_MAX } PlayerBoots; typedef enum { - /* 0x00 */ PLAYER_STRENGTH_DEKU, - /* 0x01 */ PLAYER_STRENGTH_HUMAN, - /* 0x02 */ PLAYER_STRENGTH_ZORA, - /* 0x03 */ PLAYER_STRENGTH_GORON, - /* 0x04 */ PLAYER_STRENGTH_MAX + /* 0 */ PLAYER_STRENGTH_DEKU, + /* 1 */ PLAYER_STRENGTH_HUMAN, + /* 2 */ PLAYER_STRENGTH_ZORA, + /* 3 */ PLAYER_STRENGTH_GORON, + /* 4 */ PLAYER_STRENGTH_MAX } PlayerStrength; typedef enum { - /* 0x00 */ PLAYER_FORM_FIERCE_DEITY, - /* 0x01 */ PLAYER_FORM_GORON, - /* 0x02 */ PLAYER_FORM_ZORA, - /* 0x03 */ PLAYER_FORM_DEKU, - /* 0x04 */ PLAYER_FORM_HUMAN, - /* 0x05 */ PLAYER_FORM_MAX + /* 0 */ PLAYER_FORM_FIERCE_DEITY, + /* 1 */ PLAYER_FORM_GORON, + /* 2 */ PLAYER_FORM_ZORA, + /* 3 */ PLAYER_FORM_DEKU, + /* 4 */ PLAYER_FORM_HUMAN, + /* 5 */ PLAYER_FORM_MAX } PlayerTransformation; typedef enum { @@ -248,12 +248,12 @@ typedef struct { } struct_80122D44_arg1; // size >= 0x114 typedef struct struct_80122744_arg1 { - /* 0x00 */ s8 unk_00; - /* 0x01 */ s8 unk_01; - /* 0x02 */ s8 unk_02; - /* 0x03 */ s8 unk_03; - /* 0x04 */ Vec3s* unk_04; -} struct_80122744_arg1; // size = 0x08 + /* 0x0 */ s8 unk_00; + /* 0x1 */ s8 unk_01; + /* 0x2 */ s8 unk_02; + /* 0x3 */ s8 unk_03; + /* 0x4 */ Vec3s* unk_04; +} struct_80122744_arg1; // size = 0x8 // #define PLAYER_STATE1_1 (1 << 0) diff --git a/include/z64save.h b/include/z64save.h index b153f745d..6ed297e6e 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -56,10 +56,10 @@ typedef struct Inventory { } Inventory; // size = 0x88 typedef struct HorseData { - /* 0x00 */ s16 scene; // "spot_no" - /* 0x02 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" - /* 0x08 */ s16 yaw; // "horse_a" -} HorseData; // size = 0x0A + /* 0x0 */ s16 scene; // "spot_no" + /* 0x2 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" + /* 0x8 */ s16 yaw; // "horse_a" +} HorseData; // size = 0xA typedef struct RespawnData { /* 0x00 */ Vec3f pos; @@ -92,32 +92,32 @@ typedef struct CycleSceneFlags { } CycleSceneFlags; // size = 0x14 typedef struct SaveOptions { - /* 0x00 */ u16 optionId; // "option_id" - /* 0x02 */ u8 language; // "j_n" - /* 0x03 */ s8 audioSetting; // "s_sound" - /* 0x04 */ u8 languageSetting; // "language" - /* 0x05 */ u8 zTargetSetting; // "z_attention", 0: Switch; 1: Hold -} SaveOptions; // size = 0x06 + /* 0x0 */ u16 optionId; // "option_id" + /* 0x2 */ u8 language; // "j_n" + /* 0x3 */ s8 audioSetting; // "s_sound" + /* 0x4 */ u8 languageSetting; // "language" + /* 0x5 */ u8 zTargetSetting; // "z_attention", 0: Switch; 1: Hold +} SaveOptions; // size = 0x6 typedef struct SavePlayerData { - /* 0x0000 */ char newf[6]; // "newf" Will always be "ZELDA3 for a valid save - /* 0x0006 */ u16 deaths; // "savect" - /* 0x0008 */ char playerName[8]; // "player_name" - /* 0x0010 */ s16 healthCapacity; // "max_life" - /* 0x0012 */ s16 health; // "now_life" - /* 0x0014 */ s8 magicLevel; // "magic_max" - /* 0x0015 */ s8 magic; // "magic_now" - /* 0x0016 */ s16 rupees; // "lupy_count" - /* 0x0018 */ u16 swordHealth; // "long_sword_hp" - /* 0x001A */ u16 tatlTimer; // "navi_timer" - /* 0x001C */ u8 magicAcquired; // "magic_mode" - /* 0x001D */ u8 doubleMagic; // "magic_ability" - /* 0x001E */ u8 doubleDefense; // "life_ability" - /* 0x001F */ u8 unk_1F; // "ocarina_round" - /* 0x0020 */ u8 unk_20; // "first_memory" - /* 0x0022 */ u16 owlActivationFlags; // "memory_warp_point" - /* 0x0024 */ u8 unk_24; // "last_warp_pt" - /* 0x0026 */ s16 savedSceneNum; // "scene_data_ID" + /* 0x00 */ char newf[6]; // "newf" Will always be "ZELDA3 for a valid save + /* 0x06 */ u16 deaths; // "savect" + /* 0x08 */ char playerName[8]; // "player_name" + /* 0x10 */ s16 healthCapacity; // "max_life" + /* 0x12 */ s16 health; // "now_life" + /* 0x14 */ s8 magicLevel; // "magic_max" + /* 0x15 */ s8 magic; // "magic_now" + /* 0x16 */ s16 rupees; // "lupy_count" + /* 0x18 */ u16 swordHealth; // "long_sword_hp" + /* 0x1A */ u16 tatlTimer; // "navi_timer" + /* 0x1C */ u8 magicAcquired; // "magic_mode" + /* 0x1D */ u8 doubleMagic; // "magic_ability" + /* 0x1E */ u8 doubleDefense; // "life_ability" + /* 0x1F */ u8 unk_1F; // "ocarina_round" + /* 0x20 */ u8 unk_20; // "first_memory" + /* 0x22 */ u16 owlActivationFlags; // "memory_warp_point" + /* 0x24 */ u8 unk_24; // "last_warp_pt" + /* 0x26 */ s16 savedSceneNum; // "scene_data_ID" } SavePlayerData; // size = 0x28 typedef struct Save { diff --git a/include/z64scene.h b/include/z64scene.h index 297bb2672..9eff2f291 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -9,211 +9,210 @@ #define SPAWN_ROT_FLAGS(rotation, flags) (((rotation) << 7) | (flags)) typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x0 */ uintptr_t vromStart; + /* 0x4 */ uintptr_t vromEnd; } RomFile; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdBase; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdBase; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdSpawnList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdSpawnList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdCsCameraList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdCsCameraList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdColHeader; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdColHeader; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdRoomList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdRoomList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ s8 west; - /* 0x05 */ s8 vertical; - /* 0x06 */ s8 south; - /* 0x07 */ u8 clothIntensity; -} SCmdWindSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ s8 west; + /* 0x5 */ s8 vertical; + /* 0x6 */ s8 south; + /* 0x7 */ u8 clothIntensity; +} SCmdWindSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdEntranceList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdEntranceList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 cUpElfMsgNum; - /* 0x04 */ u32 subKeepIndex; -} SCmdSpecialFiles; + /* 0x0 */ u8 code; + /* 0x1 */ u8 cUpElfMsgNum; + /* 0x4 */ u32 subKeepIndex; +} SCmdSpecialFiles; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 gpFlag1; - /* 0x04 */ u32 gpFlag2; -} SCmdRoomBehavior; + /* 0x0 */ u8 code; + /* 0x1 */ u8 gpFlag1; + /* 0x4 */ u32 gpFlag2; +} SCmdRoomBehavior; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdMesh; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdMesh; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdObjectList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdObjectList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdLightList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdLightList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdPathList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdPathList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdTransiActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdTransiActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdLightSettingList; -// Cloudmodding has this as Environment Settings + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdLightSettingList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 hour; - /* 0x05 */ u8 min; - /* 0x06 */ u8 unk6; -} SCmdTimeSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 hour; + /* 0x5 */ u8 min; + /* 0x6 */ u8 unk6; +} SCmdTimeSettings; // size = 0x7 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 skyboxId; - /* 0x05 */ u8 unk5; - /* 0x06 */ u8 unk6; -} SCmdSkyboxSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 skyboxId; + /* 0x5 */ u8 unk5; + /* 0x6 */ u8 unk6; +} SCmdSkyboxSettings; // size = 0x7 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 unk4; - /* 0x05 */ u8 unk5; -} SCmdSkyboxDisables; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 unk4; + /* 0x5 */ u8 unk5; +} SCmdSkyboxDisables; // size = 0x6 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdExitList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdExitList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdEndMarker; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdEndMarker; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 bgmId; - /* 0x02 */ UNK_TYPE1 pad2[4]; - /* 0x06 */ u8 nighttimeSFX; - /* 0x07 */ u8 musicSeq; -} SCmdSoundSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 bgmId; + /* 0x2 */ UNK_TYPE1 pad2[4]; + /* 0x6 */ u8 nighttimeSFX; + /* 0x7 */ u8 musicSeq; +} SCmdSoundSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[5]; - /* 0x07 */ u8 echo; -} SCmdEchoSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[5]; + /* 0x7 */ u8 echo; +} SCmdEchoSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdCutsceneData; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdCutsceneData; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 cameraMovement; - /* 0x04 */ u32 area; -} SCmdMiscSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 cameraMovement; + /* 0x4 */ u32 area; +} SCmdMiscSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdAltHeaders; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdAltHeaders; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdWorldMapVisited; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdWorldMapVisited; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdTextureAnimations; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdTextureAnimations; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdCutsceneActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdCutsceneActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdMinimapSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdMinimapSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdMinimapChests; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdMinimapChests; // size = 0x8 typedef struct { /* 0x0 */ Gfx* opaqueDl; @@ -292,17 +291,17 @@ typedef struct { struct { s8 room; // Room to switch to s8 bgCamDataId; // How the camera reacts during the transition. -2 for spiral staircase. -1 for generic door. 0+ will index scene CamData - } /* 0x00 */ sides[2]; // 0 = front, 1 = back - /* 0x04 */ s16 id; - /* 0x06 */ Vec3s pos; - /* 0x0C */ s16 rotY; - /* 0x0E */ u16 params; + } /* 0x0 */ sides[2]; // 0 = front, 1 = back + /* 0x4 */ s16 id; + /* 0x6 */ Vec3s pos; + /* 0xC */ s16 rotY; + /* 0xE */ u16 params; } TransitionActorEntry; // size = 0x10 typedef struct { - /* 0x00 */ u8 numTransitionActors; - /* 0x04 */ TransitionActorEntry* transitionActorList; -} DoorContext; + /* 0x0 */ u8 numTransitionActors; + /* 0x4 */ TransitionActorEntry* transitionActorList; +} DoorContext; // size = 0x8 typedef struct { /* 0x0 */ s16 id; @@ -343,7 +342,7 @@ typedef struct { /* 0xA */ u8 unk_A; /* 0xB */ u8 drawConfig; /* 0xC */ u8 unk_C; -} SceneTableEntry; // size = 0x10; +} SceneTableEntry; // size = 0x10 typedef struct { /* 0x0 */ u8 r; @@ -392,101 +391,102 @@ typedef struct { } ObjectContext; // size = 0x958 typedef struct { - u8 headerType; -} MeshHeaderBase; + /* 0x0 */ u8 headerType; +} MeshHeaderBase; // size = 0x1 typedef struct { - MeshHeaderBase base; - - u8 numEntries; - u32 dListStart; - u32 dListEnd; -} MeshHeader0; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ u32 dListStart; + /* 0x8 */ u32 dListEnd; +} MeshHeader0; // size = 0xC typedef struct { - u32 opaqueDList; - u32 translucentDList; -} MeshEntry0; + /* 0x0 */ u32 opaqueDList; + /* 0x4 */ u32 translucentDList; +} MeshEntry0; // size = 0x8 typedef struct { - MeshHeaderBase base; - u8 format; - u32 entryRecord; -} MeshHeader1Base; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 format; + /* 0x4 */ u32 entryRecord; +} MeshHeader1Base; // size = 0x8 typedef struct { - MeshHeader1Base base; - u32 imagePtr; // 0x08 - u32 unknown; // 0x0C - u32 unknown2; // 0x10 - u16 bgWidth; // 0x14 - u16 bgHeight; // 0x16 - u8 imageFormat; // 0x18 - u8 imageSize; // 0x19 - u16 imagePal; // 0x1A - u16 imageFlip; // 0x1C -} MeshHeader1Single; + /* 0x00 */ MeshHeader1Base base; + /* 0x08 */ u32 imagePtr; + /* 0x0C */ u32 unknown; + /* 0x10 */ u32 unknown2; + /* 0x14 */ u16 bgWidth; + /* 0x16 */ u16 bgHeight; + /* 0x18 */ u8 imageFormat; + /* 0x19 */ u8 imageSize; + /* 0x1A */ u16 imagePal; + /* 0x1C */ u16 imageFlip; +} MeshHeader1Single; // size = 0x20 typedef struct { - MeshHeader1Base base; - u8 bgCnt; - u32 bgRecordPtr; -} MeshHeader1Multi; + /* 0x0 */ MeshHeader1Base base; + /* 0x8 */ u8 bgCnt; + /* 0xC */ u32 bgRecordPtr; +} MeshHeader1Multi; // size = 0x10 typedef struct { - u16 unknown; // 0x00 - s8 bgID; // 0x02 - u32 imagePtr; // 0x04 - u32 unknown2; // 0x08 - u32 unknown3; // 0x0C - u16 bgWidth; // 0x10 - u16 bgHeight; // 0x12 - u8 imageFmt; // 0x14 - u8 imageSize; // 0x15 - u16 imagePal; // 0x16 - u16 imageFlip; // 0x18 -} BackgroundRecord; + /* 0x00 */ u16 unknown; + /* 0x02 */ s8 bgID; + /* 0x04 */ u32 imagePtr; + /* 0x08 */ u32 unknown2; + /* 0x0C */ u32 unknown3; + /* 0x10 */ u16 bgWidth; + /* 0x12 */ u16 bgHeight; + /* 0x14 */ u8 imageFmt; + /* 0x15 */ u8 imageSize; + /* 0x16 */ u16 imagePal; + /* 0x18 */ u16 imageFlip; +} BackgroundRecord; // size = 0x1C typedef struct { - s16 playerXMax, playerZMax; - s16 playerXMin, playerZMin; - u32 opaqueDList; - u32 translucentDList; -} MeshEntry2; + /* 0x0 */ s16 playerXMax; + /* 0x2 */ s16 playerZMax; + /* 0x4 */ s16 playerXMin; + /* 0x6 */ s16 playerZMin; + /* 0x8 */ u32 opaqueDList; + /* 0xC */ u32 translucentDList; +} MeshEntry2; // size = 0x10 typedef struct { - MeshHeaderBase base; - u8 numEntries; - u32 dListStart; - u32 dListEnd; -} MeshHeader2; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ u32 dListStart; + /* 0x8 */ u32 dListEnd; +} MeshHeader2; // size = 0xC typedef struct { - /* 0x00 */ u8 count; // number of points in the path - /* 0x01 */ u8 unk1; - /* 0x02 */ s16 unk2; - /* 0x04 */ Vec3s* points; // Segment Address to the array of points + /* 0x0 */ u8 count; // number of points in the path + /* 0x1 */ u8 unk1; + /* 0x2 */ s16 unk2; + /* 0x4 */ Vec3s* points; // Segment Address to the array of points } Path; // size = 0x8 typedef struct { - /* 0x00 */ UNK_TYPE2 unk0; - /* 0x02 */ UNK_TYPE2 unk2; - /* 0x04 */ UNK_TYPE2 unk4; - /* 0x06 */ UNK_TYPE2 unk6; - /* 0x08 */ UNK_TYPE2 unk8; + /* 0x0 */ UNK_TYPE2 unk0; + /* 0x2 */ UNK_TYPE2 unk2; + /* 0x4 */ UNK_TYPE2 unk4; + /* 0x6 */ UNK_TYPE2 unk6; + /* 0x8 */ UNK_TYPE2 unk8; } MinimapEntry; // size = 0xA typedef struct { - /* 0x00 */ MinimapEntry* entry; - /* 0x04 */ UNK_TYPE unk4; + /* 0x0 */ MinimapEntry* entry; + /* 0x4 */ UNK_TYPE unk4; } MinimapList; // size = 0x8 typedef struct { - /* 0x00 */ UNK_TYPE2 unk0; - /* 0x02 */ UNK_TYPE2 unk2; - /* 0x04 */ UNK_TYPE2 unk4; - /* 0x06 */ UNK_TYPE2 unk6; - /* 0x08 */ UNK_TYPE2 unk8; + /* 0x0 */ UNK_TYPE2 unk0; + /* 0x2 */ UNK_TYPE2 unk2; + /* 0x4 */ UNK_TYPE2 unk4; + /* 0x6 */ UNK_TYPE2 unk6; + /* 0x8 */ UNK_TYPE2 unk8; } MinimapChest; // size = 0xA // TODO: consider merging with bgCamInfo? diff --git a/include/z64schedule.h b/include/z64schedule.h index 8dba85d4d..cff6224f4 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -32,25 +32,25 @@ #define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time) typedef enum { - /* 0 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch - /* 1 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch - /* 2 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch - /* 3 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch - /* 4 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct) - /* 5 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything - /* 6 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value - /* 7 */ SCHEDULE_CMD_ID_NOP, // No-Op - /* 8 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch - /* 9 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value - /* 10 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch - /* 11 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch - /* 12 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch - /* 13 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch - /* 14 */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values - /* 15 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_S, // Branches if the current time is less than the command time, short range branch - /* 16 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_L, // Branches if the current time is less than the command time, long range branch - /* 17 */ SCHEDULE_CMD_ID_BRANCH_S, // Always branch, short range branch - /* 18 */ SCHEDULE_CMD_ID_BRANCH_L, // Always branch, long range branch + /* 0x00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch + /* 0x01 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch + /* 0x02 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch + /* 0x03 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch + /* 0x04 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct) + /* 0x05 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything + /* 0x06 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value + /* 0x07 */ SCHEDULE_CMD_ID_NOP, // No-Op + /* 0x08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch + /* 0x09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value + /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch + /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch + /* 0x0C */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch + /* 0x0D */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch + /* 0x0E */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values + /* 0x0F */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_S, // Branches if the current time is less than the command time, short range branch + /* 0x10 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_L, // Branches if the current time is less than the command time, long range branch + /* 0x11 */ SCHEDULE_CMD_ID_BRANCH_S, // Always branch, short range branch + /* 0x12 */ SCHEDULE_CMD_ID_BRANCH_L, // Always branch, long range branch } ScheduleCommandId; typedef enum { diff --git a/include/z64skin.h b/include/z64skin.h index fdc61a5ef..360e265e6 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -33,18 +33,18 @@ typedef struct { } SkinTransformation; // size = 0xA typedef struct { - /* 0x00 */ u16 vtxCount; // number of vertices in this modif entry - /* 0x02 */ u16 transformCount; - /* 0x04 */ u16 unk_04; // index of limbTransformations - /* 0x08 */ SkinVertex* skinVertices; - /* 0x0C */ SkinTransformation* limbTransformations; + /* 0x0 */ u16 vtxCount; // number of vertices in this modif entry + /* 0x2 */ u16 transformCount; + /* 0x4 */ u16 unk_04; // index of limbTransformations + /* 0x8 */ SkinVertex* skinVertices; + /* 0xC */ SkinTransformation* limbTransformations; } SkinLimbModif; // size = 0x10 typedef struct { - /* 0x00 */ u16 totalVtxCount; // total vertex count for all modif entries - /* 0x02 */ u16 limbModifCount; // count of limbModifCount - /* 0x04 */ SkinLimbModif* limbModifications; - /* 0x08 */ Gfx* dlist; + /* 0x0 */ u16 totalVtxCount; // total vertex count for all modif entries + /* 0x2 */ u16 limbModifCount; // count of limbModifCount + /* 0x4 */ SkinLimbModif* limbModifications; + /* 0x8 */ Gfx* dlist; } SkinAnimatedLimbData; // size = 0xC // ZAPD compatibility typedefs @@ -58,11 +58,11 @@ typedef SkinLimbModif Struct_800A598C; #define SKIN_LIMB_TYPE_NORMAL 11 typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; - /* 0x07 */ u8 sibling; - /* 0x08 */ s32 segmentType; // Type of data contained in segment - /* 0x0C */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; + /* 0x7 */ u8 sibling; + /* 0x8 */ s32 segmentType; // Type of data contained in segment + /* 0xC */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise } SkinLimb; // size = 0x10 typedef struct { @@ -71,11 +71,11 @@ typedef struct { } SkinLimbVtx; // size = 0xC typedef struct { - /* 0x000 */ SkeletonHeader* skeletonHeader; - /* 0x004 */ MtxF mtx; - /* 0x044 */ s32 limbCount; - /* 0x048 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb - /* 0x04C */ SkelAnime skelAnime; + /* 0x00 */ SkeletonHeader* skeletonHeader; + /* 0x04 */ MtxF mtx; + /* 0x44 */ s32 limbCount; + /* 0x48 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb + /* 0x4C */ SkelAnime skelAnime; } Skin; // size = 0x90 typedef void (*SkinPostDraw)(struct Actor* thisx, struct PlayState* play, Skin* skin); diff --git a/include/z64transition.h b/include/z64transition.h index 998dd9198..9630b4a3f 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -13,16 +13,16 @@ typedef struct { /* 0x18 */ void (*setColor)(void* transition, u32 color); /* 0x1C */ void (*setEnvColor)(void* transition, u32 color); /* 0x20 */ s32 (*isDone)(void* transition); -} TransitionInit; +} TransitionInit; // size = 0x24 typedef struct { - /* 0x000 */ char unk_0[0xC]; + /* 0x0 */ char unk_0[0xC]; } TransitionFade; // size = 0xC extern const TransitionInit TransitionFade_InitVars; typedef struct { - /* 0x000 */ char unk_0[0x20]; + /* 0x00 */ char unk_0[0x20]; } TransitionCircle; // size = 0x20 extern const TransitionInit TransitionCircle_InitVars; diff --git a/spec b/spec index 1a434fbe8..07bf3ddc6 100644 --- a/spec +++ b/spec @@ -614,8 +614,7 @@ beginseg include "build/src/code/audio/code_80192BE0.o" include "build/data/code/code_80192BE0.data.o" include "build/src/code/audio/audio_dcache.o" - include "build/src/code/audio/code_80194790.o" - include "build/data/code/code_80194790.data.o" + include "build/src/code/audio/aisetnextbuf.o" include "build/src/code/audio/audio_playback.o" include "build/src/code/audio/audio_effects.o" include "build/src/code/audio/audio_seqplayer.o" @@ -1872,8 +1871,7 @@ beginseg name "ovl_Effect_Ss_Fhg_Flash" compress include "build/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.o" - include "build/data/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.data.o" - include "build/data/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash_reloc.o" endseg beginseg @@ -1909,24 +1907,21 @@ beginseg name "ovl_Effect_Ss_En_Ice" compress include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.data.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice_reloc.o" endseg beginseg name "ovl_Effect_Ss_Fire_Tail" compress include "build/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.o" - include "build/data/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail.data.o" - include "build/data/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail_reloc.o" endseg beginseg name "ovl_Effect_Ss_En_Fire" compress include "build/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.o" - include "build/data/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire.data.o" - include "build/data/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire_reloc.o" endseg beginseg @@ -2047,8 +2042,7 @@ beginseg name "ovl_Obj_Mure3" compress include "build/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.o" - include "build/data/ovl_Obj_Mure3/ovl_Obj_Mure3.data.o" - include "build/data/ovl_Obj_Mure3/ovl_Obj_Mure3.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Mure3/ovl_Obj_Mure3_reloc.o" endseg beginseg @@ -2129,8 +2123,7 @@ beginseg name "ovl_Obj_Makekinsuta" compress include "build/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.o" - include "build/data/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta.data.o" - include "build/data/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta_reloc.o" endseg beginseg @@ -2567,8 +2560,7 @@ beginseg name "ovl_En_Bigpamet" compress include "build/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.o" - include "build/data/ovl_En_Bigpamet/ovl_En_Bigpamet.data.o" - include "build/data/ovl_En_Bigpamet/ovl_En_Bigpamet.reloc.o" + include "build/src/overlays/actors/ovl_En_Bigpamet/ovl_En_Bigpamet_reloc.o" endseg beginseg @@ -2719,8 +2711,7 @@ beginseg name "ovl_En_Test2" compress include "build/src/overlays/actors/ovl_En_Test2/z_en_test2.o" - include "build/data/ovl_En_Test2/ovl_En_Test2.data.o" - include "build/data/ovl_En_Test2/ovl_En_Test2.reloc.o" + include "build/src/overlays/actors/ovl_En_Test2/ovl_En_Test2_reloc.o" endseg beginseg @@ -3143,8 +3134,7 @@ beginseg name "ovl_Dm_Char06" compress include "build/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.o" - include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.data.o" - include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char06/ovl_Dm_Char06_reloc.o" endseg beginseg @@ -3219,8 +3209,7 @@ beginseg name "ovl_Bg_Hakugin_Elvpole" compress include "build/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.o" - include "build/data/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole.data.o" - include "build/data/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole_reloc.o" endseg beginseg @@ -3563,8 +3552,7 @@ beginseg name "ovl_Mir_Ray2" compress include "build/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.o" - include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.data.o" - include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.reloc.o" + include "build/src/overlays/actors/ovl_Mir_Ray2/ovl_Mir_Ray2_reloc.o" endseg beginseg @@ -3736,8 +3724,7 @@ beginseg name "ovl_En_Pp" compress include "build/src/overlays/actors/ovl_En_Pp/z_en_pp.o" - include "build/data/ovl_En_Pp/ovl_En_Pp.data.o" - include "build/data/ovl_En_Pp/ovl_En_Pp.reloc.o" + include "build/src/overlays/actors/ovl_En_Pp/ovl_En_Pp_reloc.o" endseg beginseg @@ -3801,8 +3788,7 @@ beginseg name "ovl_En_Pst" compress include "build/src/overlays/actors/ovl_En_Pst/z_en_pst.o" - include "build/data/ovl_En_Pst/ovl_En_Pst.data.o" - include "build/data/ovl_En_Pst/ovl_En_Pst.reloc.o" + include "build/src/overlays/actors/ovl_En_Pst/ovl_En_Pst_reloc.o" endseg beginseg @@ -4223,8 +4209,7 @@ beginseg name "ovl_Obj_Taru" compress include "build/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.o" - include "build/data/ovl_Obj_Taru/ovl_Obj_Taru.data.o" - include "build/data/ovl_Obj_Taru/ovl_Obj_Taru.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Taru/ovl_Obj_Taru_reloc.o" endseg beginseg @@ -5003,8 +4988,7 @@ beginseg name "ovl_Bg_Last_Bwall" compress include "build/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.o" - include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.data.o" - include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall_reloc.o" endseg beginseg @@ -5028,8 +5012,7 @@ beginseg name "ovl_Obj_Danpeilift" compress include "build/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.o" - include "build/data/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift.data.o" - include "build/data/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift_reloc.o" endseg beginseg @@ -5057,8 +5040,7 @@ beginseg name "ovl_Dm_Ah" compress include "build/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.o" - include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.data.o" - include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Ah/ovl_Dm_Ah_reloc.o" endseg beginseg @@ -5093,8 +5075,7 @@ beginseg name "ovl_En_Paper" compress include "build/src/overlays/actors/ovl_En_Paper/z_en_paper.o" - include "build/data/ovl_En_Paper/ovl_En_Paper.data.o" - include "build/data/ovl_En_Paper/ovl_En_Paper.reloc.o" + include "build/src/overlays/actors/ovl_En_Paper/ovl_En_Paper_reloc.o" endseg beginseg diff --git a/src/code/audio/aisetnextbuf.c b/src/code/audio/aisetnextbuf.c new file mode 100644 index 000000000..b82f28e6f --- /dev/null +++ b/src/code/audio/aisetnextbuf.c @@ -0,0 +1,107 @@ +#include "global.h" + +//! Note that this is not the same as the original libultra +//! osAiSetNextBuffer, see comments in the function + +s32 osAiSetNextBuffer(void* buf, u32 size) { + static u8 D_801D6010 = false; + u32 bufAdjusted = (u32)buf; + s32 status; + + if (D_801D6010) { + bufAdjusted = (u32)buf - 0x2000; + } + if ((((u32)buf + size) & 0x1FFF) == 0) { + D_801D6010 = true; + } else { + D_801D6010 = false; + } + + // Originally a call to __osAiDeviceBusy + status = HW_REG(AI_STATUS_REG, s32); + if (status & AI_STATUS_AI_FULL) { + return -1; + } + + // OS_K0_TO_PHYSICAL replaces osVirtualToPhysical, this replacement + // assumes that only KSEG0 addresses are given + HW_REG(AI_DRAM_ADDR_REG, u32) = OS_K0_TO_PHYSICAL(bufAdjusted); + HW_REG(AI_LEN_REG, u32) = size; + return 0; +} + +//! Note that the remaining data and functions are unused and not part of the +//! original libultra osAiSetNextBuffer + +s16 D_801D6014[] = { + 19720, 18360, 17680, 16320, 14960, 13600, 12240, 10880, 9520, 0, +}; +s8 D_801D6028[7][16] = { + { 0, 1, 2, 2, 1, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3 }, { 0, 1, 2, 3, 3, 2, 1, 4, 5, 6, 7, 8, 7, 6, 5, 4 }, + { 0, 1, 2, 3, 4, 4, 3, 2, 1, 5, 6, 7, 8, 7, 6, 5 }, { 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 6, 7, 8, 7, 6 }, + { 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 7, 8, 7 }, { 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 8 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1 }, +}; +s16 D_801D6098[7][17] = { + { 0, 268, 560, 834, 1126, 1418, 1692, 1966, 2240, 2514, 2718, 2922, 3196, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1674, 1966, 2240, 2514, 2788, 2992, 3196, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2222, 2514, 2788, 3062, 3266, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2204, 2478, 2770, 3062, 3336, 3540, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2222, 2514, 2752, 3026, 3318, 3610, 3814, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2134, 2408, 2682, 2956, 3230, 3504, 3796, 4088, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2134, 2338, 2612, 2886, 3163, 3434, 3708, 4000, 4292 }, +}; +s16* D_801D6188 = D_801D6098[0]; +s8* D_801D618C = D_801D6028[0]; + +// Unused +void func_80194804(s32 index) { + D_801D6188 = D_801D6098[index]; + D_801D618C = D_801D6028[index]; +} + +// Only used below +s16 func_80194840(s32 arg0) { + s32 i; + s32 j = 0; + + for (i = 1; i < 16; i++) { + if (arg0 < D_801D6188[i]) { + break; + } + j++; + } + + if (i == 16) { + return 0; + } else { + j = D_801D618C[j]; + return D_801D6014[j]; + } +} + +// Unused +s32 func_801948B0(s32* arg0, s32* arg1) { + s32 temp_v0; + s32 phi_s0 = *arg0; + s32 phi_s1 = *arg1; + + while (true) { + temp_v0 = func_80194840(phi_s0); + if (temp_v0 == 0) { + return -1; + } + + if (phi_s1 < temp_v0) { + break; + } + + phi_s1 -= temp_v0; + phi_s0++; + } + + *arg0 = phi_s0; + *arg1 = phi_s1; + + return 0; +} diff --git a/src/code/audio/code_80194790.c b/src/code/audio/code_80194790.c deleted file mode 100644 index 9ba2436de..000000000 --- a/src/code/audio/code_80194790.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194790.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194804.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194840.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_801948B0.s") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f63fe4e8f..34e5fe4a2 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -393,11 +393,7 @@ void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) { void Actor_GetProjectedPos(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, worldPos, projectedPos, invW); - if (*invW < 1.0f) { - *invW = 1.0f; - } else { - *invW = 1.0f / *invW; - } + *invW = (*invW < 1.0f) ? 1.0f : (1.0f / *invW); } void Target_SetPos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { @@ -507,11 +503,11 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &projectedPos, &invW); - projectedPos.x = (160 * (projectedPos.x * invW)) * var1; - projectedPos.x = CLAMP(projectedPos.x, -320.0f, 320.0f); + projectedPos.x = ((SCREEN_WIDTH / 2) * (projectedPos.x * invW)) * var1; + projectedPos.x = CLAMP(projectedPos.x, -SCREEN_WIDTH, SCREEN_WIDTH); - projectedPos.y = (120 * (projectedPos.y * invW)) * var1; - projectedPos.y = CLAMP(projectedPos.y, -240.0f, 240.0f); + projectedPos.y = ((SCREEN_HEIGHT / 2) * (projectedPos.y * invW)) * var1; + projectedPos.y = CLAMP(projectedPos.y, -SCREEN_HEIGHT, SCREEN_HEIGHT); projectedPos.z = projectedPos.z * var1; @@ -588,8 +584,8 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS PlayState* play = (PlayState*)gameState; Actor* sp68 = NULL; s32 category; - Vec3f sp58; - f32 sp54; + Vec3f projectedPos; + f32 invW; if ((player->unk_730 != 0) && (player->unk_AE3[player->unk_ADE] == 2)) { targetCtx->unk_94 = NULL; @@ -641,8 +637,9 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS } if (actor != NULL && targetCtx->unk4B == 0) { - Actor_GetProjectedPos(play, &actor->focus.pos, &sp58, &sp54); - if ((sp58.z <= 0.0f) || (fabsf(sp58.x * sp54) >= 1.0f) || (fabsf(sp58.y * sp54) >= 1.0f)) { + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); + if ((projectedPos.z <= 0.0f) || (fabsf(projectedPos.x * invW) >= 1.0f) || + (fabsf(projectedPos.y * invW) >= 1.0f)) { actor = NULL; } } @@ -1963,14 +1960,15 @@ s32 func_800B886C(Actor* actor, PlayState* play) { void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { Vec3f projectedPos; - f32 w; + f32 invW; - Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &w); - *x = PROJECTED_TO_SCREEN_X(projectedPos, w); - *y = PROJECTED_TO_SCREEN_Y(projectedPos, w); + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); + + *x = PROJECTED_TO_SCREEN_X(projectedPos, invW); + *y = PROJECTED_TO_SCREEN_Y(projectedPos, invW); } -s32 func_800B8934(PlayState* play, Actor* actor) { +s32 Actor_OnScreen(PlayState* play, Actor* actor) { Vec3f projectedPos; f32 invW; s32 pad[2]; @@ -4058,7 +4056,7 @@ s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*text } else if (*arg2) { *arg2 = arg5(play, actor); return false; - } else if (!func_800B8934(play, actor)) { + } else if (!Actor_OnScreen(play, actor)) { return false; } else if (!func_800B8614(actor, play, arg3)) { return false; @@ -4544,7 +4542,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0, (gameplayFrames * 2) & 0xFF, 64, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); effectAlphaScaled = effectAlpha * 255.0f; @@ -4575,7 +4573,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceVtxDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); } limbPos = limbPosStart; // reset limbPos @@ -4655,7 +4653,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } break; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 63a06b512..20420d6ef 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -372,9 +372,9 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE0E0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE0EC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_InitPlayerSettings.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE308.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeStatus.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE324.s") @@ -416,7 +416,7 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_AddQuake.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFD78.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetViewParam.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFEF0.s") @@ -432,7 +432,7 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeDoorCam.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E007C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_Copy.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E01AC.s") diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index b6a5c46fa..b28e50364 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -659,15 +659,15 @@ void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3 * param determines where the ligntning should go * 0: dont attach to any actor. spawns at the position specified by pos * 1: spawn at one of Player's body parts, chosen at random - * 2: spawn at one of Phantom Ganon's body parts, chosen at random + * 2 - 6: spawn at one of Goht's body parts */ -void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) { +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params) { EffectSsFhgFlashInitParams initParams; initParams.actor = actor; Math_Vec3f_Copy(&initParams.pos, pos); initParams.scale = scale; - initParams.param = param; + initParams.params = params; initParams.type = FHGFLASH_SHOCK; EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); @@ -780,15 +780,15 @@ void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) { // EffectSsEnIce Spawn Functions -void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, - f32 scale) { +void EffectSsEnIce_SpawnFlying(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, + f32 scale) { EffectSsEnIceInitParams initParams; initParams.actor = actor; Math_Vec3f_Copy(&initParams.pos, pos); Color_RGBA8_Copy(&initParams.primColor, prim); Color_RGBA8_Copy(&initParams.envColor, env); - initParams.type = 0; + initParams.type = ENICE_TYPE_FLYING; initParams.scale = scale; if (actor != NULL) { @@ -802,7 +802,7 @@ void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) { static Color_RGBA8 primColor = { 150, 150, 150, 250 }; static Color_RGBA8 envColor = { 235, 245, 255, 255 }; - EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale); + EffectSsEnIce_SpawnFlying(play, actor, pos, &primColor, &envColor, scale); } void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) { @@ -823,7 +823,7 @@ void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.scale = scale; initParams.life = life; - initParams.type = 1; + initParams.type = ENICE_TYPE_NORMAL; EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams); } @@ -872,14 +872,14 @@ void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPar // EffectSsEnFire Spawn Functions -void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); initParams.actor = actor; initParams.scale = scale; - initParams.unk_12 = arg4; + initParams.params = params; initParams.flags = flags; initParams.bodyPart = bodyPart; @@ -890,7 +890,7 @@ void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 sc EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } -void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 params, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -899,8 +899,8 @@ void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 sc initParams.pos.z = pos->z; initParams.actor = actor; initParams.scale = scale; - initParams.unk_12 = arg4; - initParams.flags = flags | 0x8000; + initParams.params = params; + initParams.flags = flags | ENFIRE_FLAGS_BODYPART_POS_VEC3S; initParams.bodyPart = bodyPart; if (actor != NULL) { diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index f77fc5158..d0b88b3db 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -162,7 +162,8 @@ void FireObj_Draw(PlayState* play, FireObj* fire) { Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 2df62a054..a79c732d8 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -17,7 +17,7 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), GAMESTATE_OVERLAY(select, MapSelect_Init, MapSelect_Destroy, sizeof(MapSelectState)), GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)), - GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(PlayState)), + GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)), GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)), diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 92e9beb30..e3e732eb3 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -379,22 +379,22 @@ void Lights_GlowCheck(PlayState* play) { LightPoint* params = &light->info->params.point; if (light->info->type == LIGHT_POINT_GLOW) { - Vec3f pos; + Vec3f worldPos; Vec3f projectedPos; f32 invW; - pos.x = params->x; - pos.y = params->y; - pos.z = params->z; - Actor_GetProjectedPos(play, &pos, &projectedPos, &invW); + worldPos.x = params->x; + worldPos.y = params->y; + worldPos.z = params->z; + Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW); params->drawGlow = 0; if ((projectedPos.z > 1) && (fabsf(projectedPos.x * invW) < 1) && (fabsf(projectedPos.y * invW) < 1)) { - s32 wX = PROJECTED_TO_SCREEN_X(projectedPos, invW); - s32 wY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); - s32 wZ = (s32)((projectedPos.z * invW) * 16352) + 16352; - s32 zBuf = func_80178A94(wX, wY); + s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)((projectedPos.z * invW) * 16352.0f) + 16352; + s32 zBuf = func_80178A94(screenPosX, screenPosY); if (wZ < zBuf) { params->drawGlow = 1; diff --git a/src/code/z_play.c b/src/code/z_play.c index 6d90048f5..014fb6279 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -34,7 +34,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801660B8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Fini.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Destroy.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801663C4.s") @@ -46,7 +46,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166B30.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167814.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167DE4.s") @@ -56,7 +56,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80168DAC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Main.s") s32 Play_InCsMode(PlayState* this) { return (this->csCtx.state != 0) || Player_InCsMode(this); @@ -74,39 +74,217 @@ s32 Play_InCsMode(PlayState* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_SceneInit.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169474.s") +void Play_GetScreenPos(PlayState* this, Vec3f* worldPos, Vec3f* screenPos) { + f32 invW; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CreateSubCamera.s") + // screenPos temporarily stores the projectedPos + Actor_GetProjectedPos(this, worldPos, screenPos, &invW); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCamId.s") + screenPos->x = (SCREEN_WIDTH / 2) + (screenPos->x * invW * (SCREEN_WIDTH / 2)); + screenPos->y = (SCREEN_HEIGHT / 2) - (screenPos->y * invW * (SCREEN_HEIGHT / 2)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeStatus.s") +s16 Play_CreateSubCamera(PlayState* this) { + s16 subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearCamera.s") + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (this->cameraPtrs[subCamId] == NULL) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s") + // if no subCameras available + if (subCamId == NUM_CAMS) { + return CAM_ID_NONE; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCamera.s") + this->cameraPtrs[subCamId] = &this->subCameras[subCamId - CAM_ID_SUB_FIRST]; + Camera_Init(this->cameraPtrs[subCamId], &this->view, &this->colCtx, this); + this->cameraPtrs[subCamId]->camId = subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEye.s") + return subCamId; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s") +s16 Play_GetActiveCamId(PlayState* this) { + return this->activeCamId; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetFov.s") +s32 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetRoll.s") + if (status == CAM_STATUS_ACTIVE) { + this->activeCamId = camIdx; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CopyCamera.s") + return Camera_ChangeStatus(this->cameraPtrs[camIdx], status); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169A50.s") +void Play_ClearCamera(PlayState* this, s16 camId) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeSetting.s") + if (this->cameraPtrs[camIdx] != NULL) { + Camera_ChangeStatus(this->cameraPtrs[camIdx], CAM_STATUS_INACTIVE); + this->cameraPtrs[camIdx] = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AFC.s") +void Play_ClearAllSubCameras(PlayState* this) { + s16 subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraGetUID.s") + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (this->cameraPtrs[subCamId] != NULL) { + Play_ClearCamera(this, subCamId); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s") + this->activeCamId = CAM_ID_MAIN; +} + +Camera* Play_GetCamera(PlayState* this, s16 camId) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + + return this->cameraPtrs[camIdx]; +} + +/** + * @return bit-packed success if each of the params were applied + */ +s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { + s32 successfullySet = 0; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + + camera->dist = Math3D_Distance(at, eye); + + if (camera->focalActor != NULL) { + camera->atActorOffset.x = at->x - camera->focalActor->world.pos.x; + camera->atActorOffset.y = at->y - camera->focalActor->world.pos.y; + camera->atActorOffset.z = at->z - camera->focalActor->world.pos.z; + } else { + camera->atActorOffset.x = camera->atActorOffset.y = camera->atActorOffset.z = 0.0f; + } + + camera->atLerpStepScale = 0.01f; + + return successfullySet; +} + +/** + * @return bit-packed success if each of the params were applied + */ +s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { + s32 successfullySet = 0; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_UP, up); + + camera->dist = Math3D_Distance(at, eye); + + if (camera->focalActor != NULL) { + camera->atActorOffset.x = at->x - camera->focalActor->world.pos.x; + camera->atActorOffset.y = at->y - camera->focalActor->world.pos.y; + camera->atActorOffset.z = at->z - camera->focalActor->world.pos.z; + } else { + camera->atActorOffset.x = camera->atActorOffset.y = camera->atActorOffset.z = 0.0f; + } + + camera->atLerpStepScale = 0.01f; + + return successfullySet; +} + +/** + * @return true if the fov was successfully set + */ +s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov) { + s32 successfullySet = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1; + + if (1) {} + return successfullySet; +} + +s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + camera->roll = roll; + + return 1; +} + +void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) { + s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? this->activeCamId : srcCamId; + s16 destCamId1 = (destCamId == CAM_ID_NONE) ? this->activeCamId : destCamId; + + Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]); +} + +// Same as Play_ChangeCameraSetting but also calls Camera_InitPlayerSettings +s32 func_80169A50(PlayState* this, s16 camId, Player* player, s16 setting) { + Camera* camera; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + + camera = this->cameraPtrs[camIdx]; + Camera_InitPlayerSettings(camera, player); + return Camera_ChangeSetting(camera, setting); +} + +s32 Play_ChangeCameraSetting(PlayState* this, s16 camId, s16 setting) { + return Camera_ChangeSetting(Play_GetCamera(this, camId), setting); +} + +// Related to bosses and fishing +void func_80169AFC(PlayState* this, s16 camId, s16 timer) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + s16 i; + + Play_ClearCamera(this, camIdx); + + for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { + if (this->cameraPtrs[i] != NULL) { + Play_ClearCamera(this, i); + } + } + + if (timer <= 0) { + Play_ChangeCameraStatus(this, CAM_ID_MAIN, CAM_STATUS_ACTIVE); + this->cameraPtrs[CAM_ID_MAIN]->childCamId = this->cameraPtrs[CAM_ID_MAIN]->doorTimer2 = 0; + } +} + +s16 Play_GetCameraUID(PlayState* this, s16 camId) { + Camera* camera = this->cameraPtrs[camId]; + + if (camera != NULL) { + return camera->uid; + } else { + return -1; + } +} + +// Unused in both MM and OoT, purpose is very unclear +s16 func_80169BF8(PlayState* this, s16 camId, s16 uid) { + Camera* camera = this->cameraPtrs[camId]; + + if (camera != NULL) { + return 0; + } else if (camera->uid != uid) { + return 0; + } else if (camera->status != CAM_STATUS_ACTIVE) { + return 2; + } else { + return 1; + } +} u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex) { ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex]; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 98a237b10..100cb3f8a 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -706,8 +706,8 @@ void func_80123E90(PlayState* play, Actor* actor) { player->unk_730 = actor; player->unk_A78 = actor; player->stateFlags1 |= PLAYER_STATE1_10000; - func_800DFD78(Play_GetCamera(play, CAM_ID_MAIN), 8, actor); - Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), 9); + Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET); } s32 func_80123F14(PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c index b119c46af..8100c6205 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c @@ -5,6 +5,7 @@ */ #include "z_bg_hakugin_elvpole.h" +#include "objects/object_hakugin_obj/object_hakugin_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -17,7 +18,6 @@ void BgHakuginElvpole_Draw(Actor* thisx, PlayState* play); void func_80ABD92C(BgHakuginElvpole* this, PlayState* play); -#if 0 const ActorInit Bg_Hakugin_Elvpole_InitVars = { ACTOR_BG_HAKUGIN_ELVPOLE, ACTORCAT_BG, @@ -30,17 +30,104 @@ const ActorInit Bg_Hakugin_Elvpole_InitVars = { (ActorFunc)BgHakuginElvpole_Draw, }; -#endif +void BgHakuginElvpole_Init(Actor* thisx, PlayState* play) { + s32 pad; + CollisionHeader* colHeader = NULL; + BgHakuginElvpole* this = THIS; -extern UNK_TYPE D_0600ACB8; -extern UNK_TYPE D_0600BF40; + Actor_SetScale(&this->dyna.actor, 0.1f); + this->actionFunc = func_80ABD92C; + DynaPolyActor_Init(&this->dyna, 0); + CollisionHeader_GetVirtual(&object_hakugin_obj_Colheader_00BF40, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->unk_15C = 0; + this->unk_160 = false; + if ((BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor) != 0x7F) && + Flags_GetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor))) { + this->unk_15E = 0x64; + } else { + this->unk_15E = -1; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 320.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Init.s") +void BgHakuginElvpole_Destroy(Actor* thisx, PlayState* play) { + BgHakuginElvpole* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Destroy.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/func_80ABD92C.s") +void func_80ABD92C(BgHakuginElvpole* this, PlayState* play) { + s32 pad; + s32 sp28 = false; + f32 var_fv1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Update.s") + if (this->unk_15E > 0) { + if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) < -120.0f) { + this->dyna.actor.world.pos.y += 4.0f; + sp28 = true; + } else if (this->unk_15E > 0) { + if (this->unk_15E == 100) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + } + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 120.0f; + //! FAKE: + if (1) {} + this->unk_15E--; + } + } else if (this->unk_15E == 0) { + if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) > -320.0f) { + this->dyna.actor.world.pos.y -= 4.0f; + sp28 = true; + } else { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 320.0f; + Flags_UnsetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor)); + this->unk_15E = -1; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + } + } else if ((BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor) != 0x7F) && + Flags_GetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor))) { + this->unk_15E = 0x64; + this->unk_160 = true; + } + if (sp28 || (this->unk_15C & 7)) { + if (this->unk_15C & 1) { + var_fv1 = 1.0f; + } else { + var_fv1 = -1.0f; + } + this->unk_15C++; + this->dyna.actor.world.pos.x = (Math_SinS(this->unk_15C * 0x2000) * var_fv1) + this->dyna.actor.home.pos.x; + this->dyna.actor.world.pos.z = (Math_CosS(this->unk_15C * 0x2000) * var_fv1) + this->dyna.actor.home.pos.z; + func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + } else { + this->unk_15C = 0; + } + if (this->unk_160) { + if (this->dyna.actor.cutscene == -1) { + this->unk_160 = false; + return; + } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->unk_160 = false; + return; + } + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Draw.s") +void BgHakuginElvpole_Update(Actor* thisx, PlayState* play) { + BgHakuginElvpole* this = THIS; + + this->actionFunc(this, play); +} + +void BgHakuginElvpole_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, object_hakugin_obj_DL_00ACB8); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h index 777c49864..b8316a4e6 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h @@ -5,11 +5,15 @@ struct BgHakuginElvpole; +#define BGHAKUGINELVPOLE_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) + typedef void (*BgHakuginElvpoleActionFunc)(struct BgHakuginElvpole*, PlayState*); typedef struct BgHakuginElvpole { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x20]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ s16 unk_15C; + /* 0x15E */ s16 unk_15E; + /* 0x160 */ u16 unk_160; /* 0x164 */ BgHakuginElvpoleActionFunc actionFunc; } BgHakuginElvpole; // size = 0x168 diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index a1795d849..2b4c24381 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -10,12 +10,33 @@ #define THIS ((BgLastBwall*)thisx) +typedef struct { + /* 0x0 */ Vec3s* posOffsets; + /* 0x4 */ s16* indices; + /* 0x8 */ s32 count; +} BgLastBwallInitColliderStruct; // size = 0xC + +typedef struct { + /* 0x0 */ Gfx* dList; + /* 0x4 */ void* pad4; + /* 0x8 */ CollisionHeader* colHeader; +} BgLastBwallModelInfo; // size = 0xC + void BgLastBwall_Init(Actor* thisx, PlayState* play); void BgLastBwall_Destroy(Actor* thisx, PlayState* play); void BgLastBwall_Update(Actor* thisx, PlayState* play); void BgLastBwall_Draw(Actor* thisx, PlayState* play); -#if 0 +void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider, + BgLastBwallInitColliderStruct* arg4); +void func_80C187E4(BgLastBwall* this); +void func_80C184EC(BgLastBwall* this, PlayState* play); +void func_80C187F8(BgLastBwall* this, PlayState* play); +void func_80C1886C(BgLastBwall* this, PlayState* play); +void func_80C18884(BgLastBwall* this, PlayState* play); +void func_80C188C4(BgLastBwall* this, PlayState* play); +void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play); + const ActorInit Bg_Last_Bwall_InitVars = { ACTOR_BG_LAST_BWALL, ACTORCAT_BG, @@ -28,57 +49,217 @@ const ActorInit Bg_Last_Bwall_InitVars = { (ActorFunc)BgLastBwall_Draw, }; -// static ColliderTrisElementInit sTrisElementsInit[2] = { -static ColliderTrisElementInit D_80C189C0[2] = { +static ColliderTrisElementInit sTrisElementsInit[] = { { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000008, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { -70.0f, 0.0f, 3.0f }, { 70.0f, 0.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000008, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { 70.0f, 0.0f, 3.0f }, { 70.0f, 200.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } }, }, }; -// static ColliderTrisInit sTrisInit = { -static ColliderTrisInit D_80C18A38 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_TRIS, }, - ARRAY_COUNT(sTrisElementsInit), D_80C189C0, // sTrisElementsInit, +static ColliderTrisInit sTrisInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_TRIS, + }, + ARRAY_COUNT(sTrisElementsInit), + sTrisElementsInit, }; -// static InitChainEntry sInitChain[] = { +static BgLastBwallModelInfo D_80C18A48[] = { + { object_last_obj_DL_0001A8, NULL, &object_last_obj_Colheader_000288 }, + { object_last_obj_DL_001318, NULL, &object_last_obj_Colheader_001450 }, +}; + +static Vec3s D_80C18A60[] = { + { 280, 280, -40 }, + { 280, 280, 120 }, + { 280, 400, 120 }, + { 280, 400, -40 }, +}; + +static s16 D_80C18A78[] = { 0, 1, 2, 0, 2, 3 }; + +static BgLastBwallInitColliderStruct D_80C18A84 = { D_80C18A60, D_80C18A78, 2 }; + +static Vec3s D_80C18A90[] = { + { -80, 400, -80 }, + { -80, 400, 80 }, + { 80, 400, 80 }, + { 80, 400, -80 }, +}; + +static s16 D_80C18AA8[] = { 0, 3, 2, 0, 2, 1 }; + +static BgLastBwallInitColliderStruct D_80C18AB4 = { D_80C18A90, D_80C18AA8, 2 }; + +static BgLastBwallInitColliderStruct* D_80C18AC0[] = { &D_80C18A84, &D_80C18AB4 }; + static InitChainEntry D_80C18AC8[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider, + BgLastBwallInitColliderStruct* arg4) { + s32 i; + s32 j; + Vec3f sp6C[3]; + Vec3f sp60; + Vec3f sp54; -extern ColliderTrisElementInit D_80C189C0[2]; -extern ColliderTrisInit D_80C18A38; -extern InitChainEntry D_80C18AC8[]; + Matrix_RotateYS(rot->y, MTXMODE_NEW); + Matrix_RotateXS(rot->x, MTXMODE_APPLY); + Matrix_RotateZS(rot->z, MTXMODE_APPLY); + for (i = 0; i < init->count; i++) { + for (j = 0; j < 3; j++) { + Math_Vec3s_ToVec3f(&sp60, &arg4->posOffsets[arg4->indices[j]]); + Matrix_MultVec3f(&sp60, &sp54); + Math_Vec3f_Sum(&sp54, pos, &sp6C[j]); + } -extern UNK_TYPE D_06000098; + arg4->indices += 3; + Collider_SetTrisVertices(collider, i, &sp6C[0], &sp6C[1], &sp6C[2]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18240.s") +void BgLastBwall_Init(Actor* thisx, PlayState* play) { + s32 pad; + BgLastBwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Init.s") + Actor_ProcessInitChain(&this->dyna.actor, D_80C18AC8); + this->type = BGLASTBWALL_GET_TYPE(&this->dyna.actor); + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80C18A48[this->type].colHeader); + Collider_InitTris(play, &this->colliderTris); + if (Flags_GetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor))) { + Actor_MarkForDeath(&this->dyna.actor); + } else if (!Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, &sTrisInit, this->colliderTrisElement)) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + BgLastBwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot, + &this->colliderTris, D_80C18AC0[this->type]); + SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + func_80C187E4(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Destroy.s") +void BgLastBwall_Destroy(Actor* thisx, PlayState* play) { + BgLastBwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C184EC.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187E4.s") +void func_80C184EC(BgLastBwall* this, PlayState* play) { + f32 randVar; + Vec3f spD0; + Vec3f effectPosAndAccel; + s32 var_v0; + Vec3f effectVelocity; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187F8.s") + Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + Matrix_RotateZS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + for (i = 0; i < 30; i++) { + switch (this->type) { + case BGLASTBWALL_TYPE_0: + spD0.x = 280.0f; + spD0.y = Rand_Centered() * 160.0f + 320.0f; + spD0.z = Rand_Centered() * 160.0f; + Matrix_MultVec3f(&spD0, &effectPosAndAccel); + Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel); + break; + case BGLASTBWALL_TYPE_1: + spD0.x = Rand_Centered() * 160.0f; + spD0.y = 400.0f; + spD0.z = Rand_Centered() * 160.0f; + Matrix_MultVec3f(&spD0, &effectPosAndAccel); + Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel); + break; + } + func_800BBFB0(play, &effectPosAndAccel, 50.0f, 2, Rand_ZeroOne() * 120.0f + 20.0f, + Rand_ZeroOne() * 240.0f + 20.0f, 0); + effectVelocity.x = Rand_ZeroOne() * 2.5f; + effectVelocity.y = Rand_ZeroOne() * 2.5f + 1.0f; + effectVelocity.z = Rand_ZeroOne() * 2.5f; + randVar = Rand_ZeroOne(); + if (randVar < 0.2f) { + var_v0 = 0x60; + } else if (randVar < 0.6f) { + var_v0 = 0x40; + } else { + var_v0 = 0x20; + } + EffectSsKakera_Spawn(play, &effectPosAndAccel, &effectVelocity, &effectPosAndAccel, -260, var_v0, 20, 0, 0, 10, + 0, 0, 50, -1, OBJECT_LAST_OBJ, object_last_obj_DL_000098); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C1886C.s") +void func_80C187E4(BgLastBwall* this) { + this->actionFunc = func_80C187F8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18884.s") +void func_80C187F8(BgLastBwall* this, PlayState* play) { + if (this->colliderTris.base.acFlags & 2) { + this->colliderTris.base.acFlags &= ~2; + Flags_SetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor)); + func_80C1886C(this, play); + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C188C4.s") +void func_80C1886C(BgLastBwall* this, PlayState* play) { + this->actionFunc = func_80C18884; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18928.s") +void func_80C18884(BgLastBwall* this, PlayState* play) { + if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + func_80C188C4(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Update.s") +void func_80C188C4(BgLastBwall* this, PlayState* play) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + this->dyna.actor.draw = NULL; + func_80C184EC(this, play); + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + this->actionFunc = BgLastBwall_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Draw.s") +void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play) { +} + +void BgLastBwall_Update(Actor* thisx, PlayState* play) { + BgLastBwall* this = THIS; + + this->actionFunc(this, play); +} + +void BgLastBwall_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + BgLastBwall* this = THIS; + + Gfx_DrawDListOpa(play, D_80C18A48[this->type].dList); +} diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h index c393b55af..d24b8ba42 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h @@ -2,16 +2,27 @@ #define Z_BG_LAST_BWALL_H #include "global.h" +#include "objects/object_last_obj/object_last_obj.h" struct BgLastBwall; typedef void (*BgLastBwallActionFunc)(struct BgLastBwall*, PlayState*); +#define BGLASTBWALL_GET_SWITCHFLAGS(thisx) ((thisx)->params & 0x7F) +#define BGLASTBWALL_GET_TYPE(thisx) (((thisx)->params >> 0xC) & 0xF) + +typedef enum { + BGLASTBWALL_TYPE_0 = 0, + BGLASTBWALL_TYPE_1 = 1, +} BgLastBwallType; + typedef struct BgLastBwall { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgLastBwallActionFunc actionFunc; - /* 0x160 */ char unk_160[0xDC]; + /* 0x160 */ ColliderTris colliderTris; + /* 0x180 */ ColliderTrisElement colliderTrisElement[2]; + /* 0x238 */ u8 type; + /* 0x23A */ s16 cutscenes[1]; } BgLastBwall; // size = 0x23C extern const ActorInit Bg_Last_Bwall_InitVars; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 8a1d3e76b..3ed675c5f 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1634,8 +1634,8 @@ void func_809DD934(Boss02* this, PlayState* play) { if (player->stateFlags1 & 0x100) { Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_8016566C(150); this->unk_1D14 = 0; this->subCamAtVel = 0.0f; @@ -2032,7 +2032,7 @@ void func_809DD934(Boss02* this, PlayState* play) { this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY); Matrix_MultVecY(1.0f, &this->subCamUp); - Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); ShrinkWindow_SetLetterboxTarget(27); } } @@ -2060,8 +2060,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { } Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 2; this->unk_1D1C = 0; @@ -2157,8 +2157,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == -1) { Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 101; this->unk_1D1C = 0; this->subCamAtVel = 1.0f; @@ -2238,7 +2238,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if ((this->unk_1D20 != 0) && (this->subCamId != SUB_CAM_ID_DONE)) { subCamEye = this->subCamEye; subCamEye.y += sp58 * D_809DF5B0; - Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &subCamEye, &this->subCamUp); + Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &subCamEye, &this->subCamUp); this->subCamUp.z = this->subCamUp.x = 0.0f; this->subCamUp.y = 1.0f; ShrinkWindow_SetLetterboxTarget(27); diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 33c6b6fc7..32258b61d 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -1151,8 +1151,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->actor.world.rot.y = -0x7B30; this->prevPlayerPos.y = 1850.0f; @@ -1409,8 +1409,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); } } @@ -1451,8 +1451,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_2BE = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x); // Player is above water && Player is standing on ground @@ -1643,7 +1643,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -1665,8 +1665,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->csState = 1; this->unk_2BE = 0xBB8; @@ -1734,7 +1734,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 2fb1e79b7..3524efa53 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -260,8 +260,8 @@ void func_809EC568(Boss04* this, PlayState* play) { this->unk_704 = 0; Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 7); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; @@ -405,8 +405,8 @@ void func_809EC568(Boss04* this, PlayState* play) { } Math_Vec3f_Copy(&subCamAt, &this->subCamAt); subCamAt.y += Math_SinS(this->subCamAtOscillator * 0x4000) * this->subCamAtOscillator * 1.5f; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &this->subCamEye); - Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); Math_ApproachF(&this->subCamFov, 60.0f, 0.1f, 1.0f); } this->actor.shape.rot.y = this->actor.yawTowardsPlayer; diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 29506a372..045a76995 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -201,8 +201,8 @@ void func_809F24C8(Boss06* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); D_809F4970->unk_151 = 1; this->unk_1C9 = 1; this->unk_1C8 = 1; @@ -340,7 +340,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { ShrinkWindow_SetLetterboxTarget(27); - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } #else @@ -625,7 +625,7 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); Matrix_Pop(); } diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.c b/src/overlays/actors/ovl_Boss_07/z_boss_07.c index c444cfb2c..4e32f027f 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.c +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.c @@ -736,7 +736,7 @@ void Boss07_Wrath_Intro(Boss07* this, PlayState* play) { Matrix_MultVec3f(&this->csCamNextAt, &this->csCamAt); if (this->csCamIndex != 0) { ShrinkWindow_SetLetterboxTarget(0x1B); - Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); } } @@ -780,8 +780,8 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); this->csCamIndex = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, 0, 1); - Play_CameraChangeStatus(play, this->csCamIndex, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->csCamIndex, 7); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_DEAD_ROD); case 1: this->unk_ABC8 = 0; @@ -986,7 +986,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { sp5C.x = this->csCamAt.x + spA8.x; sp5C.y = this->csCamAt.y + spA8.y; sp5C.z = this->csCamAt.z + spA8.z; - Play_CameraSetAtEye(play, this->csCamIndex, &sp5C, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &sp5C, &this->csCamEye); } SkelAnime_Update(&this->skelAnime); this->unk_ABC8++; @@ -2750,7 +2750,7 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { Matrix_MultVec3f(&this->csCamNextAt, &this->csCamAt); if (this->csCamIndex != 0) { ShrinkWindow_SetLetterboxTarget(0x1B); - Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); } } @@ -3077,8 +3077,8 @@ void Boss07_Incarnation_Death(Boss07* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->csCamIndex = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, 0, 1); - Play_CameraChangeStatus(play, this->csCamIndex, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->csCamIndex, 7); this->unk_ABC8 = 0; this->csState = 10; func_8016566C(150); @@ -3187,7 +3187,7 @@ void Boss07_Incarnation_Death(Boss07* this, PlayState* play) { this->unk_17F4 = (Math_CosS(this->unk_ABC8 * 0x2000) * 0.1f) + 1.0f; if (this->csCamIndex != 0) { ShrinkWindow_SetLetterboxTarget(0x1B); - Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); } } @@ -4032,8 +4032,8 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->csCamIndex = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, 0, 1); - Play_CameraChangeStatus(play, this->csCamIndex, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->csCamIndex, 7); this->unk_ABC8 = 0; this->csState = 1; this->unk_160 = KREG(76) + 150; @@ -4243,7 +4243,7 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { sp50.x = this->csCamAt.x; sp50.y = this->csCamAt.y + sp8C; sp50.z = this->csCamAt.z; - Play_CameraSetAtEye(play, this->csCamIndex, &sp50, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &sp50, &this->csCamEye); } } @@ -4279,8 +4279,8 @@ void Boss07_Mask_Death(Boss07* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1U); this->csCamIndex = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, 0, 1); - Play_CameraChangeStatus(play, this->csCamIndex, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->csCamIndex, 7); this->unk_ABC8 = 0; this->csState = 1; this->csCamNextAt.z = 0.0f; @@ -4334,7 +4334,7 @@ void Boss07_Mask_Death(Boss07* this, PlayState* play) { if (sp54.y < 30.0f) { sp54.y = 30.0f; } - Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &sp54); + Play_SetCameraAtEye(play, this->csCamIndex, &this->csCamAt, &sp54); } } @@ -5523,8 +5523,8 @@ void Boss07_Static_Update(Actor* thisx, PlayState* play2) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->csCamIndex = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, 0, 1); - Play_CameraChangeStatus(play, this->csCamIndex, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->csCamIndex, 7); this->unk_ABC8 = 0; this->csState = 2; func_8016566C(150); @@ -5626,7 +5626,7 @@ void Boss07_Static_Update(Actor* thisx, PlayState* play2) { } } ShrinkWindow_SetLetterboxTarget(27); - Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_SetCameraAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h index ce809a32a..4b8227021 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h @@ -18,13 +18,22 @@ typedef struct BossHakuginEffect { #define BOSS_HAKUGIN_EFFECT_COUNT 180 +typedef struct BossHakuginFhgFlashUnkStruct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ char unk_0C[0x8]; +} BossHakuginFhgFlashUnkStruct; // size = 0x14 + typedef struct BossHakugin { /* 0x0000 */ Actor actor; /* 0x0144 */ char unk_0144[0x44]; /* 0x0188 */ BossHakuginActionFunc actionFunc; - /* 0x018C */ char unk_018C[0x86C]; + /* 0x018C */ char unk_018C[0x5]; + /* 0x0191 */ u8 unk_191; + /* 0x018C */ char unk_0192[0x866]; /* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT]; - /* 0x2618 */ char unk_2618[0x11F8]; + /* 0x2618 */ char unk_2618[0x8E8]; + /* 0x2F00 */ BossHakuginFhgFlashUnkStruct unk_2F00[7][15]; + /* 0x3734 */ char unk_3734[0xDC]; } BossHakugin; // size = 0x3810 extern const ActorInit Boss_Hakugin_InitVars; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 8aba01fc0..64c42a1ce 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -515,11 +515,11 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) { worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + Play_GetScreenPos(play, &worldPos, &screenPos); // checking if particle is on screen - if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && - screenPos.y < SCREEN_HEIGHT) { + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); scaleAlpha = this->effects[i].alpha / 50.0f; if (scaleAlpha > 1.0f) { @@ -604,11 +604,11 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) { worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + Play_GetScreenPos(play, &worldPos, &screenPos); // checking if effect is on screen - if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && - screenPos.y < SCREEN_HEIGHT) { + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); alphaScale = this->effects[i].alpha / 50.0f; if (alphaScale > 1.0f) { diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 4a4fc6956..541a4d93d 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -15,10 +15,6 @@ void DmAh_Destroy(Actor* thisx, PlayState* play); void DmAh_Update(Actor* thisx, PlayState* play); void DmAh_Draw(Actor* thisx, PlayState* play); -void func_80C1D7FC(DmAh* this, PlayState* play); -void func_80C1D92C(DmAh* this, PlayState* play); - -#if 0 const ActorInit Dm_Ah_InitVars = { ACTOR_DM_AH, ACTORCAT_NPC, @@ -31,32 +27,232 @@ const ActorInit Dm_Ah_InitVars = { (ActorFunc)DmAh_Draw, }; -#endif +static AnimationInfoS sAnimations[] = { + { &object_ah_Anim_001860, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_ah_Anim_000DDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +}; -extern UNK_TYPE D_06009E70; +s32 func_80C1D410(DmAh* this, s32 animationIndex) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D410.s") + if (animationIndex != this->animationIndex) { + this->animationIndex = animationIndex; + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, animationIndex); + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D458.s") +void func_80C1D458(DmAh* this) { + if (DECR(this->unk_286) == 0) { + this->unk_284++; + if (this->unk_284 >= 4) { + this->unk_286 = Rand_S16Offset(30, 30); + this->unk_284 = 0; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D4D0.s") +s32 func_80C1D4D0(DmAh* this, s32 arg1) { + s32 pad; + Vec3f sp40; + Vec3f sp34; + s16 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D6E0.s") + Math_Vec3f_Copy(&sp40, &this->unk_280->world.pos); + Math_Vec3f_Copy(&sp34, &this->actor.world.pos); + temp_v0 = Math_Vec3f_Yaw(&sp34, &sp40); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D78C.s") + Math_ApproachS(&this->unk_28C, (temp_v0 - this->unk_290) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_28C = CLAMP(this->unk_28C, -0x1FFE, 0x1FFE); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D7FC.s") + Math_ApproachS(&this->unk_290, (temp_v0 - this->unk_28C) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_290 = CLAMP(this->unk_290, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D92C.s") + if (this->unk_280->id == ACTOR_PLAYER) { + sp40.y = ((Player*)this->unk_280)->bodyPartsPos[7].y + 3.0f; + } else { + Math_Vec3f_Copy(&sp40, &this->unk_280->focus.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Init.s") + Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); + Math_ApproachS(&this->unk_28A, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28E, 4, 0x2AA8); + this->unk_28A = CLAMP(this->unk_28A, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Destroy.s") + Math_ApproachS(&this->unk_28E, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28A, 4, 0x2AA8); + this->unk_28E = CLAMP(this->unk_28E, -0x1C70, 0x1C70); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Update.s") +s32 func_80C1D6E0(DmAh* this, PlayState* play) { + if (this->unk_280 != NULL) { + func_80C1D4D0(this, play); + this->unk_27C &= ~1; + this->unk_27C |= 2; + } else if (this->unk_27C & 2) { + this->unk_27C &= ~2; + this->unk_28A = 0; + this->unk_28C = 0; + this->unk_28E = 0; + this->unk_290 = 0; + this->unk_288 = 20; + } else if (DECR(this->unk_288) == 0) { + this->unk_27C |= 1; + } + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DAD4.s") +Actor* func_80C1D78C(PlayState* play) { + Actor* tempActor; + Actor* foundActor = NULL; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DB24.s") + while (true) { + foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AN); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Draw.s") + if ((foundActor == NULL) || (foundActor->update != NULL)) { + break; + } + + tempActor = foundActor->next; + if (tempActor == NULL || false) { + foundActor = NULL; + break; + } + foundActor = tempActor; + } + return foundActor; +} + +void func_80C1D7FC(DmAh* this, PlayState* play) { + s32 D_80C1DE00[] = { 0, 0, 0, 0, 0 }; + u16 csAction; + s32 actionIndex; + + if (play->csCtx.state != 0) { + if (!this->unk_29C) { + this->action = 0xFF; + this->unk_29C = true; + this->animationIndex2 = this->animationIndex; + } + if (Cutscene_CheckActorAction(play, 0x232)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x232); + csAction = play->csCtx.actorActions[actionIndex]->action; + if (this->action != (u8)csAction) { + this->action = csAction; + func_80C1D410(this, D_80C1DE00[csAction]); + } + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + } + } else if (this->unk_29C) { + this->unk_29C = false; + func_80C1D410(this, this->animationIndex2); + } +} + +void func_80C1D92C(DmAh* this, PlayState* play) { +} + +void DmAh_Init(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ah_Skel_009E70, NULL, this->morphTable, this->jointTable, + OBJECT_AH_LIMB_MAX); + this->animationIndex = -1; + func_80C1D410(this, 0); + this->actor.flags &= ~ACTOR_FLAG_1; + Actor_SetScale(&this->actor, 0.01f); + this->unk_27C |= 1; + if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + this->unk_280 = func_80C1D78C(play); + func_80C1D410(this, 1); + this->actionFunc = func_80C1D92C; + } else { + this->actionFunc = func_80C1D7FC; + } +} + +void DmAh_Destroy(Actor* thisx, PlayState* play) { +} + +void DmAh_Update(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + this->actionFunc(this, play); + func_80C1D6E0(this, play); + SkelAnime_Update(&this->skelAnime); + func_80C1D458(this); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); +} + +static Vec3f D_80C1DE14 = { 1000.0f, 0.0f, 0.0f }; + +void DmAh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + if (limbIndex == OBJECT_AH_LIMB_07) { + Matrix_MultVec3f(&D_80C1DE14, &thisx->focus.pos); + Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot); + } +} + +void DmAh_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { + DmAh* this = THIS; + s32 stepRot; + s32 overrideRot; + + if (!(this->unk_27C & 1)) { + if (this->unk_27C & 2) { + overrideRot = true; + } else { + overrideRot = false; + } + stepRot = true; + } else { + stepRot = false; + overrideRot = false; + } + + if (limbIndex == OBJECT_AH_LIMB_07) { + SubS_UpdateLimb(BINANG_ADD(this->unk_28A + this->unk_28E, 0x4000), + BINANG_ADD(this->unk_28C + this->unk_290 + this->actor.shape.rot.y, 0x4000), &this->unk_18C, + &this->unk_1A4, stepRot, overrideRot); + Matrix_Pop(); + Matrix_Translate(this->unk_18C.x, this->unk_18C.y, this->unk_18C.z, MTXMODE_NEW); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->unk_1A4.y, MTXMODE_APPLY); + Matrix_RotateXS(this->unk_1A4.x, MTXMODE_APPLY); + Matrix_RotateZS(this->unk_1A4.z, MTXMODE_APPLY); + Matrix_Push(); + } else if (limbIndex == OBJECT_AH_LIMB_02) { + SubS_UpdateLimb(BINANG_ADD(this->unk_28E, 0x4000), BINANG_ADD(this->unk_290 + this->actor.shape.rot.y, 0x4000), + &this->unk_198, &this->unk_1AA, stepRot, overrideRot); + Matrix_Pop(); + Matrix_Translate(this->unk_198.x, this->unk_198.y, this->unk_198.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->unk_1AA.y, MTXMODE_APPLY); + Matrix_RotateXS(this->unk_1AA.x, MTXMODE_APPLY); + Matrix_RotateZS(this->unk_1AA.z, MTXMODE_APPLY); + Matrix_Push(); + } +} + +static TexturePtr D_80C1DE20[] = { object_ah_Tex_008D70, object_ah_Tex_009570 }; + +static TexturePtr D_80C1DE28[] = { + object_ah_Tex_006D70, object_ah_Tex_007570, object_ah_Tex_007D70, object_ah_Tex_007570, object_ah_Tex_008570, +}; + +void DmAh_Draw(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1DE28[this->unk_284])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1DE20[0])); + + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, NULL, DmAh_PostLimbDraw, DmAh_TransformLimbDraw, + &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h index f52f92d69..dc9a437ed 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h @@ -2,6 +2,7 @@ #define Z_DM_AH_H #include "global.h" +#include "objects/object_ah/object_ah.h" struct DmAh; @@ -9,9 +10,27 @@ typedef void (*DmAhActionFunc)(struct DmAh*, PlayState*); typedef struct DmAh { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ DmAhActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x114]; + /* 0x18C */ Vec3f unk_18C; + /* 0x198 */ Vec3f unk_198; + /* 0x1A4 */ Vec3s unk_1A4; + /* 0x1AA */ Vec3s unk_1AA; + /* 0x1B0 */ Vec3s morphTable[OBJECT_AH_LIMB_MAX]; + /* 0x216 */ Vec3s jointTable[OBJECT_AH_LIMB_MAX]; + /* 0x27C */ u16 unk_27C; + /* 0x27E */ u8 action; + /* 0x280 */ Actor* unk_280; + /* 0x284 */ s16 unk_284; + /* 0x286 */ s16 unk_286; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ s16 unk_28C; + /* 0x28E */ s16 unk_28E; + /* 0x290 */ s16 unk_290; + /* 0x294 */ s32 animationIndex; + /* 0x298 */ s32 animationIndex2; + /* 0x29C */ s32 unk_29C; } DmAh; // size = 0x2A0 extern const ActorInit Dm_Ah_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c index 191fb16c4..a419ed5aa 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c @@ -15,11 +15,9 @@ void DmChar06_Destroy(Actor* thisx, PlayState* play); void DmChar06_Update(Actor* thisx, PlayState* play); void DmChar06_Draw(Actor* thisx, PlayState* play); +void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc); void func_80AAE6F0(DmChar06* this, PlayState* play); -void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc); - -#if 0 const ActorInit Dm_Char06_InitVars = { ACTOR_DM_CHAR06, ACTORCAT_ITEMACTION, @@ -32,18 +30,60 @@ const ActorInit Dm_Char06_InitVars = { (ActorFunc)DmChar06_Draw, }; -#endif +void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -extern UNK_TYPE D_06006868; +void DmChar06_Init(Actor* thisx, PlayState* play) { + DmChar06* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_SetupAction.s") + gSaveContext.save.weekEventReg[33] |= 0x80; + Actor_SetScale(&this->actor, 1.0f); + this->alpha = 255; + DmChar06_SetupAction(this, func_80AAE6F0); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Init.s") +void DmChar06_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Destroy.s") +void func_80AAE6F0(DmChar06* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x1CF)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 0x1CF); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/func_80AAE6F0.s") + if ((play->csCtx.frames >= play->csCtx.actorActions[actionIndex]->startFrame) && + (play->csCtx.actorActions[actionIndex]->endFrame >= play->csCtx.frames)) { + if (play->csCtx.actorActions[actionIndex]->action == 1) { + this->alpha = 255; + } else if (play->csCtx.actorActions[actionIndex]->action == 2) { + f32 lerp = 1.0f - Environment_LerpWeight(play->csCtx.actorActions[actionIndex]->endFrame, + play->csCtx.actorActions[actionIndex]->startFrame, + play->csCtx.frames); + this->alpha = 255 * lerp; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Update.s") +void DmChar06_Update(Actor* thisx, PlayState* play) { + DmChar06* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Draw.s") + this->actionFunc(this, play); +} + +void DmChar06_Draw(Actor* thisx, PlayState* play) { + s32 pad; + DmChar06* this = THIS; + + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_yukiyama_Matanimheader_006868)); + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + Scene_SetRenderModeXlu(play, 1, 2); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_yukiyama_DL_0013A8); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h index 49a026063..c6b83b4ff 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h @@ -2,6 +2,7 @@ #define Z_DM_CHAR06_H #include "global.h" +#include "assets/objects/object_yukiyama/object_yukiyama.h" struct DmChar06; @@ -9,9 +10,10 @@ typedef void (*DmChar06ActionFunc)(struct DmChar06*, PlayState*); typedef struct DmChar06 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x14C]; + /* 0x144 */ UNK_TYPE1 pad144[0x14C]; /* 0x290 */ DmChar06ActionFunc actionFunc; - /* 0x294 */ char unk_294[0x10]; + /* 0x294 */ UNK_TYPE1 pad294[0xC]; + /* 0x2A0 */ u8 alpha; } DmChar06; // size = 0x2A4 extern const ActorInit Dm_Char06_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 3d84f5356..5688dd43c 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1152,9 +1152,10 @@ void DmStk_WaitForTelescope(DmStk* this, PlayState* play) { Vec3f screenPos; if (!(gSaveContext.save.weekEventReg[74] & 0x20)) { - func_80169474(play, &this->actor.world.pos, &screenPos); + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); if (play->view.fovy < 25.0f) { - if ((screenPos.x >= 70.0f) && (screenPos.x < 250.0f) && (screenPos.y >= 30.0f) && (screenPos.y < 210.0f)) { + if ((screenPos.x >= 70.0f) && (screenPos.x < (SCREEN_WIDTH - 70.0f)) && (screenPos.y >= 30.0f) && + (screenPos.y < (SCREEN_HEIGHT - 30.0f))) { func_800FE484(); this->actionFunc = DmStk_StartTelescopeCutscene; } diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index a9314b9fa..488ed0482 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -699,7 +699,7 @@ void EnBb_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) & 0x1FF, 32, 128)); currentMatrixState->mf[3][1] -= 47.0f * this->flameScaleY; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index c489ba806..2193203fe 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -741,7 +741,7 @@ void EnBbfall_Draw(Actor* thisx, PlayState* play2) { currentMatrixState->mf[3][1] = pos->y; currentMatrixState->mf[3][2] = pos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); opacity -= 35; if (opacity < 0) { diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 1022d45f8..bb3f28bee 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -131,7 +131,7 @@ void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* su ActorCutscene_Start(this->picto.actor.cutscene, &this->picto.actor); this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); - Play_CameraSetAtEye(play, this->subCamId, subCamAt, subCamEye); + Play_SetCameraAtEye(play, this->subCamId, subCamAt, subCamEye); angle = BINANG_SUB(Actor_YawToPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); if (angle > 0) { @@ -150,7 +150,7 @@ void EnBigokuta_MoveCamera(EnBigokuta* this, PlayState* play) { Math_Vec3f_StepTo(&subCam->eye, &this->subCamEye, 20.0f); Math_Vec3f_StepTo(&subCam->at, &this->subCamAt, 20.0f); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCam->eye); } void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { @@ -158,7 +158,7 @@ void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->picto.actor.cutscene); } diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 1820a91c8..d24b2df49 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -6,6 +6,8 @@ #include "z_en_bigpamet.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_400) @@ -30,8 +32,19 @@ void func_80A28D0C(EnBigpamet* this, PlayState* play); void func_80A28DC0(EnBigpamet* this, PlayState* play); void func_80A28E98(EnBigpamet* this, PlayState* play); void func_80A28EE8(EnBigpamet* this, PlayState* play); +void func_80A281B4(EnBigpamet* this); +void func_80A28274(EnBigpamet* this); +void func_80A28378(EnBigpamet* this); +void func_80A28E40(EnBigpamet* this); +void func_80A28618(EnBigpamet* this); +void func_80A2966C(Actor* thisx, PlayState* play); +void func_80A286C0(EnBigpamet* this); +void func_80A28760(EnBigpamet* this); +void func_80A28970(EnBigpamet* this); +void func_80A28A28(EnBigpamet* this); +void func_80A28D80(EnBigpamet* this); +void func_80A28ED4(EnBigpamet* this); -#if 0 const ActorInit En_Bigpamet_InitVars = { ACTOR_EN_BIGPAMET, ACTORCAT_BOSS, @@ -44,18 +57,29 @@ const ActorInit En_Bigpamet_InitVars = { (ActorFunc)EnBigpamet_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A29700 = { - { COLTYPE_HARD, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x04 }, { 0xF7CF7FFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HARD, + AT_NONE | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x04 }, + { 0xF7CF7FFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 53, 50, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A2972C = { 1, 53, 60, 250 }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 53, 60, 250 }; -// static DamageTable sDamageTable = { -static DamageTable D_80A29734 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -90,121 +114,760 @@ static DamageTable D_80A29734 = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A29764[] = { - ICHAIN_S8(hintId, 1, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), - ICHAIN_F32(gravity, -2, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 4333, ICHAIN_CONTINUE), +TexturePtr D_80A29754[] = { + object_tl_Tex_0055A0, + object_tl_Tex_0057A0, + object_tl_Tex_0059A0, + object_tl_Tex_0057A0, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_S8(hintId, 1, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), + ICHAIN_F32(gravity, -2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 4333, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, 5, ICHAIN_STOP), }; -#endif +s32 D_80A29778 = 0; +Vec3f D_80A2977C = { 0.0f, 1.0f, 0.0f }; +Color_RGBA8 D_80A29788 = { 250, 250, 250, 255 }; +Color_RGBA8 D_80A2978C = { 180, 180, 180, 255 }; -extern ColliderCylinderInit D_80A29700; -extern CollisionCheckInfoInit D_80A2972C; -extern DamageTable D_80A29734; -extern InitChainEntry D_80A29764[]; +void EnBigpamet_Init(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + s32 i; -extern UNK_TYPE D_06000440; -extern UNK_TYPE D_06000AF4; -extern UNK_TYPE D_06001C68; -extern UNK_TYPE D_060031DC; -extern UNK_TYPE D_06004210; -extern UNK_TYPE D_0600823C; + Actor_ProcessInitChain(&this->actor, sInitChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Init.s") + SkelAnime_InitFlex(play, &this->skelAnime2, &object_tl_Skel_007C70, &object_tl_Anim_004210, this->jointTable2, + this->morphTable2, OBJECT_TL_2_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime1, &object_tl_Skel_001A50, &object_tl_Anim_000B30, this->jointTable1, + this->morphTable1, OBJECT_TL_1_LIMB_MAX); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 55.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2768C.s") + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A276F4.s") + if (!D_80A29778) { + for (i = 0; i < ARRAY_COUNT(D_80A29754); i++) { + D_80A29754[i] = Lib_SegmentedToVirtual(D_80A29754[i]); + } + D_80A29778 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2778C.s") + this->actor.params = ENBIGPAMET_1; + func_80A281B4(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27970.s") +void EnBigpamet_Destroy(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27B58.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27DD8.s") +void func_80A2768C(EnBigpamet* this) { + if (this->unk_29C != 0) { + this->unk_29C++; + if (this->unk_29C == 4) { + this->unk_29C = 0; + } + } else if (Rand_ZeroOne() < 0.05f) { + this->unk_29C = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27FE8.s") +void func_80A276F4(EnBigpamet* this) { + if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + this->actor.parent->shape.rot.y = this->actor.shape.rot.y; + this->actor.parent->shape.rot.z = this->actor.shape.rot.z; + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->unk_2AC, this->actor.world.pos.z, + &this->actor.shape.rot); + Matrix_MultVecY(46.0f, &this->actor.parent->world.pos); + } else if (this->actor.parent->params == GEKKO_REAR_ON_SNAPPER) { + this->actor.parent->world.pos.x = this->actor.world.pos.x; + this->actor.parent->world.pos.z = this->actor.world.pos.z; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2811C.s") +void func_80A2778C(EnBigpamet* this) { + f32 temp_fs1; + s16 temp_s1; + s16 temp_s2; + s32 i; + EnBigpametStruct* ptr; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A281B4.s") + this->unk_2A2 = 40; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A281DC.s") + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + temp_s2 = (s32)Rand_Next() >> 0x10; + temp_s1 = Rand_S16Offset(0x1800, 0x2800); + temp_fs1 = Rand_ZeroFloat(5.0f) + 7.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28274.s") + ptr->unk_0C.x = (temp_fs1 * Math_CosS(temp_s1)) * Math_SinS(temp_s2); + ptr->unk_0C.y = (temp_fs1 * Math_SinS(temp_s1)) + 3.0f; + ptr->unk_0C.z = (temp_fs1 * Math_CosS(temp_s1)) * Math_CosS(temp_s2); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A282C8.s") + ptr->unk_18.x = (s32)Rand_Next() >> 0x10; + ptr->unk_18.y = (s32)Rand_Next() >> 0x10; + ptr->unk_18.z = (s32)Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28378.s") + ptr->unk_00.x = (Math_SinS(temp_s2) * 40.0f) + this->actor.world.pos.x; + ptr->unk_00.y = this->actor.floorHeight; + ptr->unk_00.z = (Math_CosS(temp_s2) * 40.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A283A0.s") + ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A283F0.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2844C.s") +void func_80A27970(EnBigpamet* this, PlayState* play2) { + Vec3f sp9C; + f32 temp_fs1 = this->actor.depthInWater + this->actor.world.pos.y; + s32 sp94; + s32 i; + s16 temp_s0; + f32 temp_fs0; + CollisionPoly* sp84; + PlayState* play = play2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A284E4.s") + for (i = 0; i < 2; i++) { + temp_fs0 = Rand_ZeroFloat(30.0f) + 30.0f; + temp_s0 = Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2855C.s") + sp9C.x = (Math_SinS(temp_s0) * temp_fs0) + this->actor.world.pos.x; + sp9C.y = Rand_ZeroFloat(10.0f) + this->actor.floorHeight + 8.0f; + sp9C.z = (Math_CosS(temp_s0) * temp_fs0) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28618.s") + if (BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &sp84, &sp94, &this->actor, &sp9C) < temp_fs1) { + sp9C.y = temp_fs1; + EffectSsGSplash_Spawn(play, &sp9C, NULL, NULL, 0, Rand_S16Offset(1000, 200)); + } else { + func_800B12F0(play, &sp9C, &D_80A2977C, &gZeroVec3f, Rand_S16Offset(950, 100), Rand_S16Offset(10, 10), 20); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2866C.s") +void func_80A27B58(EnBigpamet* this) { + EnBigpametStruct* ptr; + s32 i; + Vec3f sp64; + f32 temp_fs0; + s16 temp_s2; + f32 temp_fs2; + s16 temp_s1; + f32 temp_fs3; + s16 var_s1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A286C0.s") + sp64.x = (Math_SinS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.x; + sp64.y = this->actor.world.pos.y; + sp64.z = (Math_CosS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28708.s") + this->unk_2A2 = 40; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28760.s") + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + temp_s1 = (s32)randPlusMinusPoint5Scaled(20480.0f) + this->actor.wallYaw; + temp_s2 = Rand_S16Offset(0x1000, 0x3000); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A287E8.s") + temp_fs2 = Math_SinS(temp_s2); + temp_fs3 = Math_CosS(temp_s2); + temp_fs0 = Rand_ZeroFloat(5.0f) + 7.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28970.s") + ptr->unk_0C.x = Math_SinS(temp_s1) * (temp_fs0 * temp_fs3); + ptr->unk_0C.y = (temp_fs0 * temp_fs2) + 3.0f; + ptr->unk_0C.z = Math_CosS(temp_s1) * (temp_fs0 * temp_fs3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A289C8.s") + ptr->unk_18.x = (s32)Rand_Next() >> 0x10; + ptr->unk_18.y = (s32)Rand_Next() >> 0x10; + ptr->unk_18.z = (s32)Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28A28.s") + if ((s16)(temp_s1 - this->actor.wallYaw) > 0) { + var_s1 = this->actor.wallYaw + 0x4000; + } else { + var_s1 = this->actor.wallYaw - 0x4000; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28A98.s") + ptr->unk_00.x = (Math_SinS(var_s1) * (60.0f * temp_fs3)) + sp64.x; + ptr->unk_00.y = (60.0f * temp_fs2) + sp64.y; + ptr->unk_00.z = (Math_CosS(var_s1) * (60.0f * temp_fs3)) + sp64.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28B98.s") + ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28D0C.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28D80.s") +void func_80A27DD8(EnBigpamet* this, PlayState* play) { + s32 i; + Vec3f pos; + Vec3f sp8C; + f32 temp_fs0; + f32 temp_fs4; + f32 temp_fs5; + s16 temp_s0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28DC0.s") + temp_fs4 = Math_SinS(this->actor.wallYaw + 0x4000); + temp_fs5 = Math_CosS(this->actor.wallYaw + 0x4000); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28E40.s") + sp8C.x = Math_SinS(this->actor.wallYaw + 0x8000) * 50.0f + this->actor.world.pos.x; + sp8C.y = this->actor.world.pos.y; + sp8C.z = (Math_CosS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28E98.s") + sp8C.x += (this->actor.world.pos.x - sp8C.x) * 0.3f; + sp8C.z += (this->actor.world.pos.z - sp8C.z) * 0.3f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28ED4.s") + for (i = 0; i < 4; i++) { + temp_fs0 = Rand_ZeroFloat(60.0f) + 50.0f; + temp_s0 = Rand_Next() >> 0x11; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28EE8.s") + pos.x = (Math_CosS(temp_s0) * temp_fs0 * temp_fs4) + sp8C.x; + pos.y = (Math_SinS(temp_s0) * temp_fs0) + sp8C.y; + pos.z = (Math_CosS(temp_s0) * temp_fs0 * temp_fs5) + sp8C.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29028.s") + func_800B12F0(play, &pos, &gZeroVec3f, &gZeroVec3f, Rand_S16Offset(950, 100), Rand_S16Offset(20, 10), 20); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29094.s") +void func_80A27FE8(EnBigpamet* this, PlayState* play) { + Vec3f pos; + s16 sp32; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Update.s") + if (this->actor.depthInWater > 0.0f) { + pos.x = this->actor.world.pos.x; + pos.z = this->actor.world.pos.z; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A292A8.s") + EffectSsGRipple_Spawn(play, &pos, 500, 900, 0); + pos.y += 8.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A293E4.s") + if (this->actionFunc != func_80A28D0C) { + sp32 = (s32)randPlusMinusPoint5Scaled(0x8000) + this->actor.world.rot.y; + pos.x -= 55.0f * Math_SinS(sp32); + pos.z -= 55.0f * Math_CosS(sp32); + } + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, Rand_S16Offset(1400, 200)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29494.s") +void func_80A2811C(EnBigpamet* this, PlayState* play) { + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Draw.s") + if ((this->actor.depthInWater > 0.0f) && ((play->gameplayFrames % 14) == 0)) { + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; + pos.z = this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29580.s") + EffectSsGRipple_Spawn(play, &pos, 500, 900, 0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29628.s") +void func_80A281B4(EnBigpamet* this) { + this->actor.draw = NULL; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionFunc = func_80A281DC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2966C.s") +void func_80A281DC(EnBigpamet* this, PlayState* play) { + WaterBox* sp2C; + f32 sp28; + + if (this->actor.parent->params == GEKKO_GET_SNAPPER) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, &sp2C)) { + this->actor.depthInWater = sp28 - this->actor.world.pos.y; + } else { + this->actor.depthInWater = this->actor.world.pos.y; + } + + func_80A2778C(this); + func_80A27970(this, play); + func_80A28274(this); + } +} + +void func_80A28274(EnBigpamet* this) { + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_004210); + this->actor.draw = EnBigpamet_Draw; + this->unk_29E = 20; + this->actionFunc = func_80A282C8; +} + +void func_80A282C8(EnBigpamet* this, PlayState* play) { + if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 0.7f, 30.0f, 10.0f) < 1.0f) { + this->unk_29E--; + if (this->unk_29E >= 16) { + func_80A27970(this, play); + } + if (this->unk_29E == 0) { + func_80A28378(this); + } + } else { + func_80A27970(this, play); + } +} + +void func_80A28378(EnBigpamet* this) { + this->actor.parent->params = GEKKO_INIT_SNAPPER; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A283A0; +} + +void func_80A283A0(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + func_80A28E40(this); + } +} + +void func_80A283F0(EnBigpamet* this) { + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_00823C); + this->actor.speedXZ = 1.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actor.params = ENBIGPAMET_1; + this->actionFunc = func_80A2844C; +} + +void func_80A2844C(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + + if (this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) { + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->actor.parent), 0x400); + this->actor.world.rot.y = this->actor.shape.rot.y; + } else if (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER) { + this->actor.speedXZ = 0.0f; + } else if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + func_80A28E40(this); + } +} + +void func_80A284E4(EnBigpamet* this) { + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_001C68, -3.0f); + this->unk_29E = 0; + this->unk_2A8 = 1.0f; + this->unk_2A4 = 1.0f; + this->actor.speedXZ = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_VOICE); + Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_FROG_VOICE1); + this->actionFunc = func_80A2855C; +} + +void func_80A2855C(EnBigpamet* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime2)) { + func_80A28618(this); + } else if (this->skelAnime2.curFrame > 2.0f) { + this->unk_2A8 = 1.5f - ((this->skelAnime2.curFrame - 2.0f) * 0.23333333f); + this->unk_2A4 = 1.5f - ((this->skelAnime2.curFrame - 2.0f) * 0.083333336f); + } else { + f32 curFrame = this->skelAnime2.curFrame; + + this->unk_2A4 = this->unk_2A8 = (0.25f * curFrame) + 1.0f; + } +} + +void func_80A28618(EnBigpamet* this) { + this->actor.draw = func_80A2966C; + this->unk_2A8 = 0.5f; + this->actor.speedXZ = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); + this->actionFunc = func_80A2866C; +} + +void func_80A2866C(EnBigpamet* this, PlayState* play) { + this->unk_2A8 += 0.2f; + if (this->unk_2A8 > 1.1f) { + func_80A286C0(this); + } +} + +void func_80A286C0(EnBigpamet* this) { + this->collider.info.bumper.dmgFlags = 0xF7CF7FFF; + this->collider.base.atFlags |= AT_ON; + this->actor.shape.rot.z = 0x680; + this->unk_29E = 15; + this->unk_2A8 = 1.0f; + this->actionFunc = func_80A28708; +} + +void func_80A28708(EnBigpamet* this, PlayState* play) { + this->unk_29E--; + this->actor.shape.rot.y += 0x3B00; + func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG); + if (this->unk_29E == 0) { + func_80A28760(this); + } +} + +void func_80A28760(EnBigpamet* this) { + this->actor.speedXZ = 15.0f; + if (this->actor.bgCheckFlags & 8) { + s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.wallYaw; + + this->actor.bgCheckFlags &= ~8; + + if (temp_v1 > 0x3C00) { + this->actor.world.rot.y = this->actor.wallYaw + 0x3C00; + } else if (temp_v1 < -0x3C00) { + this->actor.world.rot.y = this->actor.wallYaw - 0x3C00; + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + } + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + } + this->unk_29E = 0; + this->actionFunc = func_80A287E8; +} + +void func_80A287E8(EnBigpamet* this, PlayState* play) { + s16 quake; + + this->actor.shape.rot.y += 0x3B00; + func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG); + this->unk_29E++; + this->unk_29E = CLAMP_MAX(this->unk_29E, 20); + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + if ((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0) { + this->actor.world.rot.y = this->actor.world.rot.y - 0x300; + } else { + this->actor.world.rot.y = this->actor.world.rot.y + 0x300; + } + } + + if (play->gameplayFrames & 1) { + func_80A27FE8(this, play); + } + + if (this->actor.bgCheckFlags & 8) { + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + this->actor.velocity.y = this->unk_29E * 0.375f; + Quake_SetSpeed(quake, 0x4E20); + Quake_SetQuakeValues(quake, 15, 0, 0, 0); + Quake_SetCountdown(quake, 10); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + func_80A27B58(this); + func_80A27DD8(this, play); + func_80A28970(this); + } +} + +void func_80A28970(EnBigpamet* this) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); + this->actor.shape.rot.z = 0; + this->collider.base.atFlags &= ~AT_ON; + this->collider.info.bumper.dmgFlags = 0xF7CFFFFF; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A289C8; +} + +void func_80A289C8(EnBigpamet* this, PlayState* play) { + this->unk_2A8 -= 0.1f; + if (this->unk_2A8 < 0.5f) { + func_80A28A28(this); + } + func_80A27DD8(this, play); +} + +void func_80A28A28(EnBigpamet* this) { + this->actor.draw = EnBigpamet_Draw; + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_0031DC, -3.0f); + this->unk_2A8 = 0.1f; + this->unk_2A4 = 1.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_80A28A98; +} + +void func_80A28A98(EnBigpamet* this, PlayState* play) { + f32 curFrame; + + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x600); + + if (SkelAnime_Update(&this->skelAnime2)) { + if ((this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + func_80A283F0(this); + } else { + func_80A284E4(this); + } + } else { + curFrame = this->skelAnime2.curFrame; + + if (curFrame > 7.0f) { + this->unk_2A8 = 1.5f - ((curFrame - 7.0f) * (1.0f / 6.0f)); + this->unk_2A4 = 1.5f - ((curFrame - 7.0f) * (1.0f / 6.0f)); + } else { + this->unk_2A8 = (0.2f * curFrame) + 0.1f; + this->unk_2A4 = ((1.0f / 14.0f) * curFrame) + 1.0f; + } + } +} + +void func_80A28B98(EnBigpamet* this, PlayState* play) { + Actor* collectible; + + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_000AF4); + + this->collider.base.atFlags &= ~AT_ON; + this->collider.info.bumper.dmgFlags = 0xF7CFFFFF; + this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + this->collider.base.acFlags &= ~AC_ON; + + this->actor.velocity.y = 22.0f; + this->actor.speedXZ = 5.0f; + + if ((this->actor.draw == func_80A2966C) && (this->actionFunc != func_80A28DC0)) { + this->actor.draw = EnBigpamet_Draw; + } else if (this->collider.base.ac != NULL) { + this->actor.world.rot.y = BINANG_ROT180(Actor_YawBetweenActors(&this->actor, this->collider.base.ac)); + } + + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.bgCheckFlags &= ~1; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.params = ENBIGPAMET_0; + + if ((this->actor.parent->params == GEKKO_ON_SNAPPER) || (this->actor.parent->params == GEKKO_REAR_ON_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + this->actor.parent->params = GEKKO_CUTSCENE; + } + + collectible = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); + if (collectible != NULL) { + collectible->velocity.y = 15.0f; + collectible->world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_REVERSE); + this->actionFunc = func_80A28D0C; +} + +void func_80A28D0C(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + if (this->actor.bgCheckFlags & 1) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); + func_80A27FE8(this, play); + func_80A28D80(this); + } + this->actor.shape.rot.x += 0x800; + this->actor.shape.rot.z += 0x1000; +} + +void func_80A28D80(EnBigpamet* this) { + this->actor.draw = func_80A2966C; + this->actor.speedXZ = 0.0f; + this->actor.shape.rot.x = 0; + this->actor.shape.rot.z = 0; + this->unk_2A8 = 0.0f; + this->collider.base.acFlags |= AC_ON; + this->actionFunc = func_80A28DC0; +} + +void func_80A28DC0(EnBigpamet* this, PlayState* play) { + this->actor.shape.rot.x = (s32)Rand_Next() >> 0x16; + this->actor.shape.rot.z = (s32)Rand_Next() >> 0x16; + if ((this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + func_80A28A28(this); + } else if (this->actor.parent->params == GEKKO_DEFEAT) { + func_80A28ED4(this); + } +} + +void func_80A28E40(EnBigpamet* this) { + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_000440, -2.0f); + this->actor.flags |= ACTOR_FLAG_1; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A28E98; +} + +void func_80A28E98(EnBigpamet* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime2)) { + func_80A284E4(this); + } +} + +void func_80A28ED4(EnBigpamet* this) { + this->actionFunc = func_80A28EE8; +} + +void func_80A28EE8(EnBigpamet* this, PlayState* play) { + Vec3f pos; + s16 sp3A; + + this->actor.shape.rot.x = (s32)Rand_Next() >> 0x16; + this->actor.shape.rot.z = (s32)Rand_Next() >> 0x16; + + if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.00075f)) { + sp3A = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + + pos.x = (Math_SinS(sp3A) * 20.0f) + this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 25.0f; + pos.z = (Math_CosS(sp3A) * 20.0f) + this->actor.world.pos.z; + + func_800B0DE0(play, &pos, &gZeroVec3f, &gZeroVec3f, &D_80A29788, &D_80A2978C, 800, 50); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_NPC_FADEAWAY); + Actor_MarkForDeath(&this->actor); + } + + this->actor.scale.y = this->actor.scale.x; + this->actor.scale.z = this->actor.scale.x; +} + +void func_80A29028(EnBigpamet* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + if ((this->actor.colChkInfo.damageEffect == 0xF) && (this->actor.parent->params != GEKKO_JUMP_ON_SNAPPER) && + (this->actionFunc != func_80A28E98)) { + func_80A28B98(this, play); + } + } +} + +void func_80A29094(EnBigpamet* this) { + EnBigpametStruct* ptr = &this->unk_2FC[0]; + s32 i; + + for (i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + ptr->unk_0C.y -= 1.0f; + + Math_Vec3f_Sum(&ptr->unk_00, &ptr->unk_0C, &ptr->unk_00); + + ptr->unk_18.x += (s16)((Rand_Next() >> 0x17) + 0x700); + ptr->unk_18.y += (s16)((Rand_Next() >> 0x17) + 0x900); + ptr->unk_18.z += (s16)((Rand_Next() >> 0x17) + 0xB00); + } +} + +void EnBigpamet_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnBigpamet* this = THIS; + + func_80A2768C(this); + func_80A29028(this, play); + + this->actionFunc(this, play); + + if (this->unk_2A2 > 0) { + this->unk_2A2--; + func_80A29094(this); + } + + if ((this->actionFunc != func_80A281DC) && (this->actionFunc != func_80A282C8)) { + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 50.0f, 60.0f, 0x1F); + func_80A276F4(this); + Actor_SetFocus(&this->actor, 25.0f); + + Collider_UpdateCylinder(&this->actor, &this->collider); + + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + + if (this->actionFunc != func_80A287E8) { + func_80A2811C(this, play); + } + } +} + +void func_80A292A8(EnBigpamet* this, PlayState* play) { + s32 i; + EnBigpametStruct* ptr; + + if (this->unk_2A2 > 0) { + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); + + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &ptr->unk_18); + Matrix_Scale(ptr->unk_20, ptr->unk_20, ptr->unk_20, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); + } + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +s32 EnBigpamet_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if ((this->actionFunc == func_80A2855C) || (this->actionFunc == func_80A28A98)) { + if (limbIndex == OBJECT_TL_2_LIMB_02) { + Matrix_Scale(this->unk_2A4, this->unk_2A8, this->unk_2A4, MTXMODE_APPLY); + } else if ((limbIndex == OBJECT_TL_2_LIMB_0B) || (limbIndex == OBJECT_TL_2_LIMB_09) || + (limbIndex == OBJECT_TL_2_LIMB_07) || (limbIndex == OBJECT_TL_2_LIMB_05)) { + Matrix_Scale(this->unk_2A4, this->unk_2A8, this->unk_2A8, MTXMODE_APPLY); + } + } + return false; +} + +void EnBigpamet_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_2_LIMB_01) { + this->unk_2AC = Matrix_GetCurrent()->yw; + } +} + +void EnBigpamet_Draw(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, D_80A29754[this->unk_29C]); + + SkelAnime_DrawFlexOpa(play, this->skelAnime2.skeleton, this->skelAnime2.jointTable, this->skelAnime2.dListCount, + EnBigpamet_OverrideLimbDraw2, EnBigpamet_PostLimbDraw2, &this->actor); + func_80A292A8(this, play); + + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnBigpamet_OverrideLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_1_LIMB_01) { + if (this->actionFunc == func_80A28D0C) { + pos->y -= 2500.0f; + } else { + pos->y -= 700.0f; + } + } + + if ((this->unk_2A8 != 1.0f) && (limbIndex == OBJECT_TL_1_LIMB_03)) { + Matrix_Scale(1.0f, this->unk_2A8, this->unk_2A8, MTXMODE_APPLY); + } + + return false; +} + +void EnBigpamet_PostLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_1_LIMB_01) { + this->unk_2AC = Matrix_GetCurrent()->yw; + } +} + +void func_80A2966C(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime1.skeleton, this->skelAnime1.jointTable, this->skelAnime1.dListCount, + EnBigpamet_OverrideLimbDraw1, EnBigpamet_PostLimbDraw1, &this->actor); + func_80A292A8(this, play); +} diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h index b2d01d468..07d3265c0 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h @@ -2,18 +2,42 @@ #define Z_EN_BIGPAMET_H #include "global.h" +#include "objects/object_tl/object_tl.h" struct EnBigpamet; typedef void (*EnBigpametActionFunc)(struct EnBigpamet*, PlayState*); +enum { + /* 0 */ ENBIGPAMET_0, + /* 1 */ ENBIGPAMET_1, +}; + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3s unk_18; + /* 0x20 */ f32 unk_20; +} EnBigpametStruct; // size = 0x24 + typedef struct EnBigpamet { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x154]; + /* 0x144 */ SkelAnime skelAnime2; + /* 0x188 */ Vec3s jointTable2[OBJECT_TL_2_LIMB_MAX]; + /* 0x1D6 */ Vec3s morphTable2[OBJECT_TL_2_LIMB_MAX]; + /* 0x224 */ SkelAnime skelAnime1; + /* 0x268 */ Vec3s jointTable1[OBJECT_TL_1_LIMB_MAX]; + /* 0x280 */ Vec3s morphTable1[OBJECT_TL_1_LIMB_MAX]; /* 0x298 */ EnBigpametActionFunc actionFunc; - /* 0x29C */ char unk_29C[0x10]; + /* 0x29C */ u8 unk_29C; + /* 0x29E */ s16 unk_29E; + /* 0x2A0 */ UNK_TYPE1 pad2A0[2]; + /* 0x2A2 */ s16 unk_2A2; + /* 0x2A4 */ f32 unk_2A4; + /* 0x2A8 */ f32 unk_2A8; /* 0x2AC */ f32 unk_2AC; - /* 0x2B0 */ char unk_2B0[0x31C]; + /* 0x2B0 */ ColliderCylinder collider; + /* 0x2FC */ EnBigpametStruct unk_2FC[20]; } EnBigpamet; // size = 0x5CC extern const ActorInit En_Bigpamet_InitVars; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 6ba8eac96..e0585b8f5 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -278,7 +278,7 @@ void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, PlayState* play) { subCam->eye.x -= 1.5f * Math_SinS(this->actor.yawTowardsPlayer); subCam->eye.z -= 1.5f * Math_CosS(this->actor.yawTowardsPlayer); } - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } } @@ -338,7 +338,7 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, PlayState* play) { subCamEye.x = ((this->actor.world.pos.x - this->fires[0].pos.x) * 1.8f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = ((this->actor.world.pos.z - this->fires[0].pos.z) * 1.8f) + this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_SpawnCutsceneStage2; } @@ -460,7 +460,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { this->idleTimer--; if (this->idleTimer == 0) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; if (this->actor.params == ENBIGPO_SUMMONED) { dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); @@ -957,7 +957,7 @@ void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, PlayState* play) { subCamEye.x = (Math_SinS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = (Math_CosS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_DoNothing; @@ -1444,7 +1444,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); @@ -1471,7 +1471,7 @@ void EnBigpo_RevealedFire(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 6f48cdb7a..f953f17ab 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -795,7 +795,7 @@ void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, PlayState* play) { Math_StepToF(&subCamAt.y, GBT_ROOM_5_MIN_Y + 87.5f, 10.0f); Math_StepToF(&subCamAt.z, this->actor.world.pos.z, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } /** @@ -810,7 +810,7 @@ void EnBigslime_JerkCameraPlayerHit(EnBigslime* this, PlayState* play) { Math_Vec3f_Diff(&subCam->eye, &subCam->at, &subCamEye); Math_Vec3f_Scale(&subCamEye, 0.9f); Math_Vec3f_Sum(&subCamEye, &subCam->at, &subCamEye); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** @@ -828,7 +828,7 @@ void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, PlayState* play, s32 notic subCamEye.z = Math_CosS(yawOffset) * zoom + subCam->at.z; subCamEye.y = subCam->at.y + -4.0f + (noticeTimer * 2.0f); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** @@ -836,7 +836,7 @@ void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, PlayState* play, s32 notic * center of the roof. This is used when the minislimes merges into bigslime. */ void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, PlayState* play) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); } void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { @@ -844,7 +844,7 @@ void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); @@ -1495,7 +1495,7 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, PlayState* play) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s16 yaw; - Play_CameraSetAtEye(play, this->subCamId, &mainCam->at, &mainCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &mainCam->at, &mainCam->eye); this->grabPlayerTimer = 15; this->wavySurfaceTimer = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; @@ -2343,7 +2343,7 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { subCamEye.x = (Math_SinS(yawOffset) * 250.0f) + subCamAt.x; subCamEye.y = subCamAt.y + 60.0f; subCamEye.z = (Math_CosS(yawOffset) * 250.0f) + subCamAt.z; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { this->minislime[i]->actor.params = MINISLIME_DEFEAT_IDLE; @@ -2370,7 +2370,7 @@ void EnBigslime_CutsceneDefeat(EnBigslime* this, PlayState* play) { subCamAt.x = this->actor.world.pos.x; subCamAt.y = this->actor.world.pos.y + 40.0f; subCamAt.z = this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); } } @@ -2410,7 +2410,7 @@ void EnBigslime_GekkoDespawn(EnBigslime* this, PlayState* play) { Math_Vec3f_Diff(&subCam->eye, &this->subCamDistToFrog, &subCamEye); subCamEye.y -= 1.8f; subCamAt.y -= 1.7f; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } } @@ -2466,7 +2466,7 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) { subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom); subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom); subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); if (this->spawnFrogTimer == 0) { EnBigslime_EndCutscene(this, play); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 3271d8bcb..87f5cf1ba 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -24,13 +24,13 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a void func_80872BC0(PlayState* play, s32 arg1); typedef struct { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ Vec3f unk_0C; - /* 0x18 */ s16 unk_18; - /* 0x1A */ s16 unk_1A; -} EnBomStruct; // size = 0x1C + /* 0x00 */ Vec3f pos; + /* 0x0C */ Vec3f velocity; + /* 0x18 */ s16 rotY; + /* 0x1A */ s16 rotX; +} PowderKegFuseSegment; // size = 0x1C -static EnBomStruct D_80874650[16]; +static PowderKegFuseSegment sPowderKegFuseSegments[16]; const ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, @@ -640,8 +640,8 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873CA0); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_808742F8); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegBarrelDL); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegGoronSkullDL); func_808726DC(play, &this->actor.home.pos, &sp58, &sp4C, this->timer); func_80872BC0(play, this->timer); @@ -652,14 +652,14 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { } void func_80872648(PlayState* play, Vec3f* arg1) { - EnBomStruct* ptr = &D_80874650[0]; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; s32 i; - for (i = 0; i < ARRAY_COUNT(D_80874650); i++, ptr++) { - Math_Vec3f_Copy(&ptr->unk_00, arg1); - Math_Vec3f_Copy(&ptr->unk_0C, &gZeroVec3f); - ptr->unk_18 = 0; - ptr->unk_1A = 0x4000; + for (i = 0; i < ARRAY_COUNT(sPowderKegFuseSegments); i++, fuseSegmentPtr++) { + Math_Vec3f_Copy(&fuseSegmentPtr->pos, arg1); + Math_Vec3f_Copy(&fuseSegmentPtr->velocity, &gZeroVec3f); + fuseSegmentPtr->rotY = 0; + fuseSegmentPtr->rotX = 0x4000; } } @@ -668,23 +668,23 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a f32 temp_f20; Vec3f spCC; Vec3f spC0; - EnBomStruct* ptr = &D_80874650[0]; - EnBomStruct* ptr2 = &D_80874650[1]; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; + PowderKegFuseSegment* fuseSegmentPtr2 = &sPowderKegFuseSegments[1]; f32 temp_f26 = Math_Vec3f_DistXYZ(arg3, arg1); s32 spB0; f32 temp_f2; f32 distXZ; - Math_Vec3f_Copy(&ptr->unk_00, arg1); + Math_Vec3f_Copy(&fuseSegmentPtr->pos, arg1); Math_Vec3f_Diff(arg2, arg1, &spCC); - ptr->unk_18 = Math_FAtan2F(spCC.z, spCC.x); + fuseSegmentPtr->rotY = Math_FAtan2F(spCC.z, spCC.x); distXZ = sqrtf(SQXZ(spCC)); - ptr->unk_1A = Math_FAtan2F(distXZ, spCC.y); + fuseSegmentPtr->rotX = Math_FAtan2F(distXZ, spCC.y); spB0 = (arg4 / 240) + 1; - for (i = 0; i < spB0; i++, ptr++, ptr2++, arg4 -= 240) { + for (i = 0; i < spB0; i++, fuseSegmentPtr++, fuseSegmentPtr2++, arg4 -= 240) { f32 phi_f22; CollisionPoly* spA0; s32 sp9C; @@ -696,8 +696,8 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a phi_f22 = (arg4 % 240) * (1.0f / 240) * 8.0f; } - Math_Vec3f_Sum(&ptr2->unk_00, &ptr2->unk_0C, &ptr2->unk_00); - temp_f20 = Math_Vec3f_DistXYZAndStoreDiff(arg3, &ptr2->unk_00, &spCC); + Math_Vec3f_Sum(&fuseSegmentPtr2->pos, &fuseSegmentPtr2->velocity, &fuseSegmentPtr2->pos); + temp_f20 = Math_Vec3f_DistXYZAndStoreDiff(arg3, &fuseSegmentPtr2->pos, &spCC); if (temp_f20 < temp_f26) { if (temp_f20 == 0.0f) { spCC.x = 0.0f; @@ -709,33 +709,35 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a spCC.y *= temp_f20; spCC.z *= temp_f20; } - Math_Vec3f_Sum(arg3, &spCC, &ptr2->unk_00); + Math_Vec3f_Sum(arg3, &spCC, &fuseSegmentPtr2->pos); } - if (Math_Vec3f_DistXYZAndStoreDiff(&ptr->unk_00, &ptr2->unk_00, &spCC) == 0.0f) { + if (Math_Vec3f_DistXYZAndStoreDiff(&fuseSegmentPtr->pos, &fuseSegmentPtr2->pos, &spCC) == 0.0f) { spCC.x = 0.0f; spCC.y = phi_f22; spCC.z = 0.0f; } - ptr2->unk_18 = Math_FAtan2F(spCC.z, spCC.x); + fuseSegmentPtr2->rotY = Math_FAtan2F(spCC.z, spCC.x); distXZ = sqrtf(SQXZ(spCC)); - ptr2->unk_1A = Math_FAtan2F(distXZ, spCC.y); + fuseSegmentPtr2->rotX = Math_FAtan2F(distXZ, spCC.y); - ptr2->unk_18 = (s16)CLAMP(BINANG_SUB(ptr2->unk_18, ptr->unk_18), -8000, 8000) + ptr->unk_18; - ptr2->unk_1A = (s16)CLAMP(BINANG_SUB(ptr2->unk_1A, ptr->unk_1A), -8000, 8000) + ptr->unk_1A; + fuseSegmentPtr2->rotY = + (s16)CLAMP(BINANG_SUB(fuseSegmentPtr2->rotY, fuseSegmentPtr->rotY), -8000, 8000) + fuseSegmentPtr->rotY; + fuseSegmentPtr2->rotX = + (s16)CLAMP(BINANG_SUB(fuseSegmentPtr2->rotX, fuseSegmentPtr->rotX), -8000, 8000) + fuseSegmentPtr->rotX; - temp_f20 = Math_CosS(ptr2->unk_1A) * phi_f22; - spC0.x = Math_SinS(ptr2->unk_18) * temp_f20; - spC0.z = Math_CosS(ptr2->unk_18) * temp_f20; - spC0.y = Math_SinS(ptr2->unk_1A) * phi_f22; + temp_f20 = Math_CosS(fuseSegmentPtr2->rotX) * phi_f22; + spC0.x = Math_SinS(fuseSegmentPtr2->rotY) * temp_f20; + spC0.z = Math_CosS(fuseSegmentPtr2->rotY) * temp_f20; + spC0.y = Math_SinS(fuseSegmentPtr2->rotX) * phi_f22; - Math_Vec3f_Sum(&ptr->unk_00, &spC0, &ptr2->unk_00); - Math_Vec3f_Copy(&sp90, &ptr2->unk_00); + Math_Vec3f_Sum(&fuseSegmentPtr->pos, &spC0, &fuseSegmentPtr2->pos); + Math_Vec3f_Copy(&sp90, &fuseSegmentPtr2->pos); sp90.y += 50.0f; - temp_f2 = BgCheck_EntityRaycastFloor3(&play->colCtx, &spA0, &sp9C, &sp90) - ptr2->unk_00.y; + temp_f2 = BgCheck_EntityRaycastFloor3(&play->colCtx, &spA0, &sp9C, &sp90) - fuseSegmentPtr2->pos.y; if (temp_f2 >= 0.0f) { spC0.y += temp_f2; if (phi_f22 < spC0.y) { @@ -753,48 +755,48 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a spC0.z *= temp_f2; } - Math_Vec3f_Sum(&ptr->unk_00, &spC0, &ptr2->unk_00); - Math_Vec3f_Copy(&ptr2->unk_0C, &gZeroVec3f); + Math_Vec3f_Sum(&fuseSegmentPtr->pos, &spC0, &fuseSegmentPtr2->pos); + Math_Vec3f_Copy(&fuseSegmentPtr2->velocity, &gZeroVec3f); } - ptr2->unk_0C.y += -1.0f; - if (ptr2->unk_0C.y < -10.0f) { - ptr2->unk_0C.y = -10.0f; + fuseSegmentPtr2->velocity.y += -1.0f; + if (fuseSegmentPtr2->velocity.y < -10.0f) { + fuseSegmentPtr2->velocity.y = -10.0f; } } - Math_Vec3f_Copy(arg1, &ptr->unk_00); + Math_Vec3f_Copy(arg1, &fuseSegmentPtr->pos); } void func_80872BC0(PlayState* play, s32 arg1) { s32 temp_s5; s32 i; - EnBomStruct* ptr = &D_80874650[0]; - EnBomStruct* ptr2; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; + PowderKegFuseSegment* fuseSegmentPtr2; OPEN_DISPS(play->state.gfxCtx); - Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); - Matrix_RotateZYX(ptr->unk_1A, ptr->unk_18, 0, MTXMODE_APPLY); + Matrix_Translate(fuseSegmentPtr->pos.x, fuseSegmentPtr->pos.y, fuseSegmentPtr->pos.z, MTXMODE_NEW); + Matrix_RotateZYX(fuseSegmentPtr->rotX, fuseSegmentPtr->rotY, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80872F98); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseMaterialDL); temp_s5 = (arg1 / 240) + 1; - ptr2 = &D_80874650[1]; + fuseSegmentPtr2 = &sPowderKegFuseSegments[1]; - for (i = 1; i < temp_s5; i++, ptr2++) { - Matrix_Translate(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, MTXMODE_NEW); - Matrix_RotateZYX(ptr2->unk_1A, ptr2->unk_18, 0, MTXMODE_APPLY); + for (i = 1; i < temp_s5; i++, fuseSegmentPtr2++) { + Matrix_Translate(fuseSegmentPtr2->pos.x, fuseSegmentPtr2->pos.y, fuseSegmentPtr2->pos.z, MTXMODE_NEW); + Matrix_RotateZYX(fuseSegmentPtr2->rotX, fuseSegmentPtr2->rotY, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((i % 2) == 0) { - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873020); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseModel1DL); } else { - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873040); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseModel2DL); } } diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 6c8019837..c457a623e 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -558,8 +558,8 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { case 1: Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->subCamEye.x = mainCam->eye.x; @@ -595,7 +595,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index c9719f613..eb7719150 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -365,7 +365,7 @@ void func_8089ABF4(EnDinofos* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Camera* subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { @@ -488,7 +488,7 @@ void func_8089B288(EnDinofos* this, PlayState* play) { this->unk_290--; Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, this->unk_2AC); Math_Vec3f_StepTo(&subCam->at, &this->unk_2C8, this->unk_2A8); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCam->eye); if (this->unk_290 == 0) { func_8089B320(this); } @@ -522,7 +522,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { subCamAt.y = subCam->at.y; } - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); if (this->actor.bgCheckFlags & 1) { func_8089B4A4(this); } @@ -547,7 +547,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { this->unk_290++; if (this->unk_290 < 8) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } if (this->skelAnime.curFrame > 35.0f) { @@ -556,7 +556,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); if (this->skelAnime.curFrame <= 55.0f) { func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); } @@ -1215,7 +1215,7 @@ void func_8089D318(EnDinofos* this, PlayState* play) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y; subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); func_8089CFAC(this); } else { func_8089B100(this, play); diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 566a198e5..ea2e68d37 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -1000,7 +1000,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(&gfxXlu[2], 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(&gfxXlu[3], 255, 0, 0, 0); - gSPDisplayList(&gfxXlu[4], gGameplayKeepDrawFlameDL); + gSPDisplayList(&gfxXlu[4], gEffFire1DL); POLY_XLU_DISP = gfxXlu + 5; diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index 37613dab4..285d58cbc 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -449,7 +449,7 @@ void EnDragon_SetSubCamEyeAt(EnDragon* this, PlayState* play, Vec3f subCamEye, V this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); Math_Vec3f_Copy(&this->subCamEye, &subCamEye); Math_Vec3f_Copy(&this->subCamAt, &subCamAt); - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index f0e2d5c42..6b8ae91aa 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -823,7 +823,7 @@ void func_80B2A094(EnFish2* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &subCamEye); } - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_350 == NULL) || (this->unk_350->update == NULL)) { this->unk_350 = NULL; this->unk_2B0++; @@ -857,7 +857,7 @@ void func_80B2A23C(EnFish2* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &subCamAt); } - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_2B4 == 0) && (D_80B2B2E4 == 3)) { D_80B2B2E0 = D_80B2B2EC = D_80B2B2E4 = 0; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 0aabfc969..59e3abdb4 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -5156,8 +5156,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 1: sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; @@ -5283,8 +5283,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 10: Cutscene_Start(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); @@ -5324,8 +5324,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 20: Cutscene_Start(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); @@ -5432,7 +5432,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if (sSubCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_SetCameraAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 1019062c6..395302b48 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1082,7 +1082,7 @@ void func_80A137C0(EnGo* this, PlayState* play, f32 arg2, f32 arg3) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)arg3); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 1fa6a22a7..6ad13b371 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -1099,7 +1099,7 @@ void EnGs_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index f3ec0c245..230a848cf 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -138,8 +138,8 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { this->unk_17C = -1; Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FREE0); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &mainCamAt, &mainCamEye); - Play_CameraSetFov(play, CAM_ID_MAIN, 45.0f); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &mainCamAt, &mainCamEye); + Play_SetCameraFov(play, CAM_ID_MAIN, 45.0f); func_800FE484(); return false; } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index f1f8aff6e..a1c33264e 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -647,7 +647,7 @@ void EnIk_SetupReactToAttack(EnIk* this, s32 arg1) { void EnIk_ReactToAttack(EnIk* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); } if (SkelAnime_Update(&this->skelAnime)) { if (this->subCamId != SUB_CAM_ID_DONE) { @@ -742,7 +742,7 @@ void EnIk_PlayCutscene(EnIk* this, PlayState* play) { subCamEye.x = (Math_SinS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 20.0f; subCamEye.z = (Math_CosS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } if (this->actor.colChkInfo.health != 0) { EnIk_SetupReactToAttack(this, false); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index e7d37de26..da51baa4c 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -1240,7 +1240,7 @@ s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { } return 0; } - if (!func_800B8934(play, &this->actor)) { + if (!Actor_OnScreen(play, &this->actor)) { return 0; } yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 556fea9ec..56bf0e0f0 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1370,10 +1370,10 @@ s32 func_80B456A8(PlayState* play, Vec3f* worldPos) { Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { - s32 wX = PROJECTED_TO_SCREEN_X(projectedPos, invW); - s32 wY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); - s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 0x3FE0; - s32 zBuf = func_80178A94(wX, wY); + s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; + s32 zBuf = func_80178A94(screenPosX, screenPosY); if (wZ < zBuf) { return true; } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index bc48b6ee0..119131d48 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -265,8 +265,8 @@ void func_8096FAAC(EnKakasi* this, PlayState* play) { Math_ApproachF(&this->subCamFov, this->subCamFovNext, 0.3f, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); } } diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 538b7b28d..e50cf0da5 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -174,7 +174,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_144 * -20) & 0x1FF, 0x20, 0x80)); - sp68 = gGameplayKeepDrawFlameDL; + sp68 = gEffFire1DL; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sp6C->unk_00.r, sp6C->unk_00.g, sp6C->unk_00.b, sp6C->unk_00.a); gDPSetEnvColor(POLY_XLU_DISP++, sp6C->unk_04.r, sp6C->unk_04.g, sp6C->unk_04.b, 0); } else { diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 420d40b78..5feb50245 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -332,7 +332,7 @@ void EnPametfrog_ShakeCamera(EnPametfrog* this, PlayState* play, f32 magShakeXZ, subCamEye.x = (Math_SinS(subCamYaw) * magShakeXZ) + subCam->at.x; subCamEye.y = subCam->at.y + magShakeY; subCamEye.z = (Math_CosS(subCamYaw) * magShakeXZ) + subCam->at.z; - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { @@ -340,7 +340,7 @@ void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); func_800B724C(play, &this->actor, 6); @@ -509,7 +509,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, PlayState* play) { subCamEye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 100.0f; subCamEye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); this->actionFunc = EnPametfrog_FallOffSnapper; } @@ -839,7 +839,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.world.pos.x + (xzDist * this->unk_2DC.x); subCamEye.y = (this->actor.world.pos.y + this->actor.home.pos.y) * 0.5f; subCamEye.z = this->actor.world.pos.z + (xzDist * this->unk_2DC.z); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); } this->actionFunc = EnPametfrog_FallInAir; @@ -857,7 +857,7 @@ void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { } else { this->spinYaw += 0xF00; if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &Play_GetCamera(play, this->subCamId)->eye); } @@ -906,7 +906,7 @@ void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); subCamEye.y = this->actor.child->focus.pos.y + 20.0f; subCamEye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.child->focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.child->focus.pos, &subCamEye); this->actor.params = GEKKO_DEFEAT; this->timer = 38; this->actionFunc = EnPametfrog_DefeatGekko; @@ -931,7 +931,7 @@ void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; subCamEye.y = this->actor.world.pos.y + 20.0f; subCamEye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); this->timer = 20; this->actionFunc = EnPametfrog_DefeatSnapper; } @@ -1189,7 +1189,7 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { subCamEye.y = subCamAt.y + 4.0f; // Zooms in on Gekko - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->timer = 0; this->actor.hintId = 0x5F; this->actionFunc = EnPametfrog_CallSnapper; @@ -1221,7 +1221,7 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { subCamEye.z = (Math_CosS(yaw) * 500.0f) + subCamAt.z; // Zooms in on Snapper spawn point - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->quake = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(this->quake, 18000); Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.c b/src/overlays/actors/ovl_En_Paper/z_en_paper.c index 5554c9182..fd6ac6778 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.c +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.c @@ -5,6 +5,7 @@ */ #include "z_en_paper.h" +#include "objects/object_bal/object_bal.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) @@ -17,8 +18,11 @@ void EnPaper_Draw(Actor* thisx, PlayState* play); void func_80C1F480(EnPaper* this, PlayState* play); void func_80C1F4FC(EnPaper* this, PlayState* play); +void func_80C1F46C(EnPaper* this); +void func_80C1F4E8(EnPaper* this); +void func_80C1F55C(EnPaper* this, EnPaperStruct* arg1); +void func_80C1F6E0(EnPaper* this, EnPaperStruct* arg1); -#if 0 const ActorInit En_Paper_InitVars = { ACTOR_EN_PAPER, ACTORCAT_ITEMACTION, @@ -31,28 +35,165 @@ const ActorInit En_Paper_InitVars = { (ActorFunc)EnPaper_Draw, }; -#endif +Vec3f D_80C1FC60 = { 0.0f, 0.0f, 1.0f }; -extern UNK_TYPE D_0600D5A0; +void EnPaper_Init(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Init.s") + Actor_SetScale(&this->actor, 0.01f); + this->timer = 70; + this->unk_D78 = D_80C1FC60; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + func_80C1F46C(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Destroy.s") +void EnPaper_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F46C.s") +void func_80C1F46C(EnPaper* this) { + this->actionFunc = func_80C1F480; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F480.s") +void func_80C1F480(EnPaper* this, PlayState* play) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F4E8.s") + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++) { + func_80C1F55C(this, &this->unk_148[i]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F4FC.s") + func_80C1F4E8(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F55C.s") +void func_80C1F4E8(EnPaper* this) { + this->actionFunc = func_80C1F4FC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F6E0.s") +void func_80C1F4FC(EnPaper* this, PlayState* play) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F87C.s") + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++) { + func_80C1F6E0(this, &this->unk_148[i]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Update.s") +void func_80C1F55C(EnPaper* this, EnPaperStruct* arg1) { + Matrix_RotateZYX(Rand_Next(), Rand_Next(), Rand_Next(), MTXMODE_NEW); + Matrix_MultVec3f(&D_80C1FC60, &arg1->unk_0C); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Draw.s") + arg1->unk_18 = this->actor.world.pos; + + arg1->unk_18.x += Rand_Centered() * 4.0f; + arg1->unk_18.y += Rand_Centered() * 4.0f; + arg1->unk_18.z += Rand_Centered() * 4.0f; + + arg1->unk_24 = this->actor.velocity; + + arg1->unk_24.x += Rand_Centered() * 9.0f; + arg1->unk_24.y += Rand_ZeroOne() * 6.0f; + arg1->unk_24.z += Rand_Centered() * 9.0f; + + arg1->unk_30 = Rand_Next(); + arg1->unk_32 = (Rand_Next() >> 4) + 0x16C; + + Matrix_RotateAxisS(arg1->unk_30, &arg1->unk_0C, MTXMODE_NEW); + Matrix_MultVec3f(&D_80C1FC60, &arg1->unk_00); +} + +void func_80C1F6E0(EnPaper* this, EnPaperStruct* arg1) { + f32 sp1C = Math_CosS(arg1->unk_30); + f32 sp18 = Math_SinS(arg1->unk_30); + f32 temp_ft4 = 1.0f - sp1C; + + if (arg1->unk_18.y < (this->actor.floorHeight - 40.0f)) { + return; + } + + arg1->unk_24.y += this->actor.gravity; + + arg1->unk_24.x -= 0.2f * fabsf(arg1->unk_00.x) * (arg1->unk_24.x + this->unk_D78.x); + arg1->unk_24.y -= 0.2f * fabsf(arg1->unk_00.y) * (arg1->unk_24.y + this->unk_D78.y); + arg1->unk_24.z -= 0.2f * fabsf(arg1->unk_00.z) * (arg1->unk_24.z + this->unk_D78.z); + + arg1->unk_30 += arg1->unk_32; + + arg1->unk_18.x += arg1->unk_24.x; + arg1->unk_18.y += arg1->unk_24.y; + arg1->unk_18.z += arg1->unk_24.z; + + arg1->unk_00.x = (arg1->unk_0C.x * temp_ft4 * arg1->unk_0C.z) - (arg1->unk_0C.y * sp18); + arg1->unk_00.y = (arg1->unk_0C.y * temp_ft4 * arg1->unk_0C.z) + (arg1->unk_0C.x * sp18); + arg1->unk_00.z = (arg1->unk_0C.z * temp_ft4 * arg1->unk_0C.z) + sp1C; +} + +void func_80C1F87C(EnPaper* this) { + f32 sp2C = (Rand_Centered() * 4.0f) + 6.0f; + f32 sp28; + + this->unk_D78.y = Math_SinS(this->actor.shape.rot.x) * -sp2C; + + sp28 = Math_CosS(this->actor.shape.rot.x) * -sp2C; + this->unk_D78.x = Math_SinS(this->actor.shape.rot.y) * sp28; + this->unk_D78.z = Math_CosS(this->actor.shape.rot.y) * sp28; + + this->actor.shape.rot.x += (s16)(Rand_Next() >> 8); + this->actor.shape.rot.y += (s16)(Rand_Next() >> 6); + + if (ABS_ALT(this->actor.shape.rot.x) > 0x1555) { + if (this->actor.shape.rot.x > 0) { + this->actor.shape.rot.x = 0x1555; + } else { + this->actor.shape.rot.x = -0x1555; + } + } +} + +void EnPaper_Update(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; + + this->actionFunc(this, play); + + func_80C1F87C(this); + if (this->timer == 0) { + Actor_MarkForDeath(&this->actor); + } else { + this->timer--; + } +} + +void EnPaper_Draw(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; + EnPaperStruct* ptr = this->unk_148; + s32 i; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C5B0(play->state.gfxCtx); + + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); + gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, SHADE, 0, 0, 0, SHADE, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED); + gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_FOG | G_LIGHTING | G_SHADING_SMOOTH); + + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++, ptr++) { + if (i == 0) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + } else if (i == 30) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 32, 32, 255); + } else if (i == 40) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 64, 128, 255, 255); + } else if (i == 50) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 64, 255, 128, 255); + } + + if ((this->actor.floorHeight - 40.0f) < ptr->unk_18.y) { + MtxF* mf = GRAPH_ALLOC(play->state.gfxCtx, sizeof(MtxF)); + + func_8017842C(mf, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, ptr->unk_30, ptr->unk_0C.x, + ptr->unk_0C.y, ptr->unk_0C.z, ptr->unk_18.x, ptr->unk_18.y, ptr->unk_18.z); + + gSPMatrix(POLY_OPA_DISP++, mf, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_bal_DL_00D5A0); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.h b/src/overlays/actors/ovl_En_Paper/z_en_paper.h index 9c4e6cc50..457229c3d 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.h +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.h @@ -7,10 +7,21 @@ struct EnPaper; typedef void (*EnPaperActionFunc)(struct EnPaper*, PlayState*); +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3f unk_18; + /* 0x24 */ Vec3f unk_24; + /* 0x30 */ s16 unk_30; + /* 0x32 */ s16 unk_32; +} EnPaperStruct; // size = 0x34 + typedef struct EnPaper { /* 0x000 */ Actor actor; /* 0x144 */ EnPaperActionFunc actionFunc; - /* 0x148 */ char unk_148[0xC40]; + /* 0x148 */ EnPaperStruct unk_148[60]; + /* 0xD78 */ Vec3f unk_D78; + /* 0xD84 */ s16 timer; } EnPaper; // size = 0xD88 extern const ActorInit En_Paper_InitVars; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 4ee47164f..b9afa5229 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1252,7 +1252,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index ee58c770a..7766fa8fa 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -5,6 +5,7 @@ */ #include "z_en_pp.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -15,41 +16,103 @@ void EnPp_Destroy(Actor* thisx, PlayState* play); void EnPp_Update(Actor* thisx, PlayState* play); void EnPp_Draw(Actor* thisx, PlayState* play); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_80B21624 = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0xF), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0xC), - /* Zora boomerang */ DMG_ENTRY(1, 0xF), - /* Normal arrow */ DMG_ENTRY(1, 0xF), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0xD), - /* Goron punch */ DMG_ENTRY(1, 0xC), - /* Sword */ DMG_ENTRY(1, 0xF), - /* Goron pound */ DMG_ENTRY(0, 0xE), - /* Fire arrow */ DMG_ENTRY(1, 0x2), - /* Ice arrow */ DMG_ENTRY(1, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0xF), - /* Deku spin */ DMG_ENTRY(0, 0x1), - /* Deku bubble */ DMG_ENTRY(1, 0xF), - /* Deku launch */ DMG_ENTRY(2, 0xC), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0xF), - /* Zora punch */ DMG_ENTRY(1, 0xF), - /* Spin attack */ DMG_ENTRY(1, 0xF), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0xC), +void EnPp_SetupIdle(EnPp* this); +void EnPp_Idle(EnPp* this, PlayState* play); +void EnPp_SetupCharge(EnPp* this); +void EnPp_Charge(EnPp* this, PlayState* play); +void EnPp_SetupAttack(EnPp* this); +void EnPp_Attack(EnPp* this, PlayState* play); +void EnPp_SetupBounced(EnPp* this); +void EnPp_Bounced(EnPp* this, PlayState* play); +void EnPp_SetupRoar(EnPp* this); +void EnPp_Roar(EnPp* this, PlayState* play); +void EnPp_SetupJump(EnPp* this); +void EnPp_Jump(EnPp* this, PlayState* play); +void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play); +void EnPp_Damaged(EnPp* this, PlayState* play); +void EnPp_SetupDead(EnPp* this, PlayState* play); +void EnPp_Dead(EnPp* this, PlayState* play); +void EnPp_Mask_Detach(EnPp* this, PlayState* play); +void EnPp_BodyPart_SetupMove(EnPp* this); +void EnPp_BodyPart_Move(EnPp* this, PlayState* play); + +typedef enum { + /* 0 */ EN_PP_COLLISION_RESULT_OK, + /* 1 */ EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_INTO_WALL, + /* 2 */ EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE, +} EnPpCollisionResult; + +typedef enum { + /* 0 */ EN_PP_ACTION_IDLE, + /* 1 */ EN_PP_ACTION_CHARGE, + /* 2 */ EN_PP_ACTION_ATTACK, + /* 3 */ EN_PP_ACTION_BOUNCED, + /* 4 */ EN_PP_ACTION_ROAR, + /* 5 */ EN_PP_ACTION_JUMP, + /* 6 */ EN_PP_ACTION_STUNNED_OR_FROZEN, + /* 7 */ EN_PP_ACTION_MASK_DETACH, + /* 8 */ EN_PP_ACTION_DAMAGED, + /* 9 */ EN_PP_ACTION_DEAD, + /* 10 */ EN_PP_ACTION_MASK_DEAD, + /* 11 */ EN_PP_ACTION_SPAWN_BODY_PARTS, + /* 12 */ EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS, + /* 13 */ EN_PP_ACTION_BODY_PART_MOVE, +} EnPpAction; + +typedef enum { + /* 0 */ EN_PP_MASK_DETACH_STATE_START, + /* 1 */ EN_PP_MASK_DETACH_STATE_FALL, + /* 2 */ EN_PP_MASK_DETACH_STATE_DIE, +} EnPpMaskDetachState; + +static s32 sCurrentDeadBodyPartIndex = 0; + +typedef enum { + /* 0x0 */ EN_PP_DMGEFF_JUMP, // Forces the Hiploop to jump + /* 0x1 */ EN_PP_DMGEFF_STUN, // Stuns the Hiploop + /* 0x2 */ EN_PP_DMGEFF_FIRE, // Damages and sets the Hiploop on fire + /* 0x3 */ EN_PP_DMGEFF_FREEZE, // Damages and freezes the Hiploop in ice + /* 0x4 */ EN_PP_DMGEFF_LIGHT_ORB, // Damages and surrounds the Hiploop with light orbs + /* 0x5 */ EN_PP_DMGEFF_ELECTRIC_STUN, // Stuns and surrounds the Hiploop with electric sparks + /* 0xC */ EN_PP_DMGEFF_KNOCK_OFF_MASK = 0xC, // Knocks off the Hiploop's mask or deals regular damage + /* 0xD */ EN_PP_DMGEFF_HOOKSHOT, // Pulls the Hiploop's mask to the player or deals regular damage + /* 0xE */ EN_PP_DMGEFF_GORON_POUND, // Knocks off the Hiploop's mask or forces it to jump + /* 0xF */ EN_PP_DMGEFF_DAMAGE, // Deals regular damage +} EnPpDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Horse trample */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Explosives */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* Zora boomerang */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Normal arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Hookshot */ DMG_ENTRY(1, EN_PP_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* Sword */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Goron pound */ DMG_ENTRY(0, EN_PP_DMGEFF_GORON_POUND), + /* Fire arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, EN_PP_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Deku spin */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Deku bubble */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Deku launch */ DMG_ENTRY(2, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, EN_PP_DMGEFF_ELECTRIC_STUN), + /* Normal shield */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Light ray */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Thrown object */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Zora punch */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Spin attack */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Sword beam */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Normal Roll */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Unblockable */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Powder Keg */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), }; const ActorInit En_Pp_InitVars = { @@ -64,116 +127,1500 @@ const ActorInit En_Pp_InitVars = { (ActorFunc)EnPp_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80B21664[1] = { +static ColliderJntSphElementInit sMaskColliderJntSphElementsInit[1] = { { - { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK2, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 0 }, 1 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80B21688 = { - { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80B21664, // sJntSphElementsInit, +static ColliderJntSphInit sMaskColliderJntSphInit = { + { + COLTYPE_HARD, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sMaskColliderJntSphElementsInit), + sMaskColliderJntSphElementsInit, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80B21698[1] = { +static ColliderJntSphElementInit sBodyColliderJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 0 }, 1 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80B216BC = { - { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80B21698, // sJntSphElementsInit, +static ColliderJntSphInit sBodyColliderJntSphInit = { + { + COLTYPE_HARD, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sBodyColliderJntSphElementsInit), + sBodyColliderJntSphElementsInit, }; -// static ColliderQuadInit sQuadInit = { -static ColliderQuadInit D_80B216CC = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_QUAD, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, BUMP_NONE, OCELEM_NONE, }, +static ColliderQuadInit sQuadInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_QUAD, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x08 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, + BUMP_NONE, + OCELEM_NONE, + }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -#endif +static Color_RGBA8 sDustPrimColor = { 60, 50, 20, 255 }; -extern DamageTable D_80B21624; -extern ColliderJntSphElementInit D_80B21664[1]; -extern ColliderJntSphInit D_80B21688; -extern ColliderJntSphElementInit D_80B21698[1]; -extern ColliderJntSphInit D_80B216BC; -extern ColliderQuadInit D_80B216CC; +static Color_RGBA8 sDustEnvColor = { 40, 30, 30, 255 }; -extern UNK_TYPE D_0600A844; +typedef enum { + /* 0 */ EN_PP_ANIM_IDLE, + /* 1 */ EN_PP_ANIM_WALK, + /* 2 */ EN_PP_ANIM_WIND_UP, + /* 3 */ EN_PP_ANIM_CHARGE, + /* 4 */ EN_PP_ANIM_ATTACK, + /* 5 */ EN_PP_ANIM_DAMAGE, + /* 6 */ EN_PP_ANIM_ROAR, + /* 7 */ EN_PP_ANIM_TURN_TO_FACE_PLAYER, + /* 8 */ EN_PP_ANIM_JUMP, + /* 9 */ EN_PP_ANIM_LAND +} EnPpAnimation; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Init.s") +static AnimationHeader* sAnimations[] = { + &gHiploopIdleAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopChargeAnim, &gHiploopAttackAnim, + &gHiploopDamageAnim, &gHiploopRoarAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopWalkAnim, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Destroy.s") +static u8 sAnimationModes[] = { + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E29C.s") +static s16 sLedgeCheckAngles[] = { 0x0000, 0x1000, 0xF000 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E3D4.s") +void EnPp_Init(Actor* thisx, PlayState* play) { + EnPp* this = THIS; + EffectBlureInit1 blureInit; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E5A8.s") + this->actor.targetMode = 4; + this->actor.colChkInfo.mass = 60; + this->actor.colChkInfo.health = 3; + this->actor.colChkInfo.damageTable = &sDamageTable; + SkelAnime_InitFlex(play, &this->skelAnime, &gHiploopSkel, &gHiploopIdleAnim, this->jointTable, this->morphTable, + HIPLOOP_LIMB_MAX); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E680.s") + if (EN_PP_GET_ATTACK_RANGE(&this->actor) == 0) { + this->attackRange = 200.0f; + } else { + this->attackRange = EN_PP_GET_ATTACK_RANGE(&this->actor) * 40.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E778.s") + this->chargesInStraightLines = EN_PP_DOES_CHARGE_IN_STRAIGHT_LINES(&this->actor); + if (this->chargesInStraightLines) { + this->actor.params &= 1; + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E958.s") + if (this->actor.params < 0) { + this->actor.params = EN_PP_TYPE_MASKED; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E970.s") + if (EN_PP_GET_TYPE(&this->actor) >= EN_PP_TYPE_BODY_PART_BASE) { + this->deadBodyPartIndex = sCurrentDeadBodyPartIndex; + sCurrentDeadBodyPartIndex++; + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_SetScale(&this->actor, 0.03f); + EnPp_BodyPart_SetupMove(this); + } else { + Collider_InitAndSetJntSph(play, &this->maskCollider, &this->actor, &sMaskColliderJntSphInit, + this->maskColliderElements); + Collider_InitAndSetJntSph(play, &this->bodyCollider, &this->actor, &sBodyColliderJntSphInit, + this->bodyColliderElements); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EBD8.s") + this->bodyCollider.elements[0].dim.scale = 1.0f; + if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { + this->actor.hintId = 0x25; + this->maskColliderElements[0].info.toucherFlags &= ~TOUCH_ON; + this->maskColliderElements[0].info.bumperFlags &= ~BUMP_ON; + this->maskColliderElements[0].info.ocElemFlags &= ~OCELEM_ON; + this->maskCollider.base.colType = COLTYPE_HIT2; + this->maskCollider.elements[0].dim.modelSphere.radius = 42; + this->maskCollider.elements[0].dim.scale = 1.0f; + this->maskCollider.elements[0].dim.modelSphere.center.x = 400; + this->maskCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyCollider.elements[0].dim.modelSphere.radius = 20; + this->bodyCollider.elements[0].dim.scale = 1.0f; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } else { + this->actor.hintId = 0x26; + this->maskCollider.elements[0].dim.modelSphere.radius = 10; + this->maskCollider.elements[0].dim.scale = 1.0f; + this->maskCollider.elements[0].dim.modelSphere.center.x = 1000; + this->maskCollider.elements[0].dim.modelSphere.center.y = -500; + this->bodyCollider.elements[0].dim.modelSphere.radius = 25; + this->bodyCollider.elements[0].dim.scale = 1.0f; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyColliderElements[0].info.bumperFlags |= BUMP_HOOKABLE; + this->maskCollider.elements[0].info.toucher.damage = 0x10; + //! FAKE: Needed to fix some regs + //! https://decomp.me/scratch/6Yd1B + if (this->actor.world.rot.z) {} + if (this->actor.world.rot.z) {} + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EC24.s") + Collider_InitQuad(play, &this->hornCollider); + Collider_SetQuad(play, &this->hornCollider, &this->actor, &sQuadInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EFFC.s") + blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = + blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = + blureInit.p1EndColor[0] = blureInit.p1EndColor[1] = blureInit.p1EndColor[2] = blureInit.p2EndColor[0] = + blureInit.p2EndColor[1] = blureInit.p2EndColor[2] = 255; + blureInit.p2StartColor[3] = 64; + blureInit.p1EndColor[3] = blureInit.p2EndColor[3] = 0; + blureInit.elemDuration = 8; + blureInit.unkFlag = false; + blureInit.calcMode = 2; + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F048.s") + Actor_SetScale(&this->actor, 0.03f); + this->floorPolyForCircleShadow = NULL; + this->actor.gravity = -3.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F0A4.s") + if ((EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) || + (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_NO_MASK)) { + EnPp_SetupIdle(this); + } else { + EnPp_SetupJump(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F188.s") +void EnPp_Destroy(Actor* thisx, PlayState* play) { + EnPp* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F244.s") + if (EN_PP_GET_TYPE(&this->actor) < EN_PP_TYPE_BODY_PART_BASE) { + Collider_DestroyJntSph(play, &this->maskCollider); + Collider_DestroyJntSph(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->hornCollider); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F29C.s") + Effect_Destroy(play, this->blureIndex); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F4A0.s") +/** + * This function converts the Hiploop's world position to polar coordinates, + * converts those polar coordinates back into Cartesian coordinates, and then + * checks to see if this doubly-converted position is similar to the original + * world position. This seemingly always returns true, and logically it should + * always return true unless there are errors in how math is implemented. + */ +s32 EnPp_PointlessPosCheck(EnPp* this) { + f32 diffX = this->actor.home.pos.x - this->actor.world.pos.x; + f32 diffZ = this->actor.home.pos.z - this->actor.world.pos.z; + f32 radius; + s16 angle; + Vec3f nearDuplicateWorldPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F560.s") + // This converts the vector between the Hiploop's home and world positions into polar + // coordinates. In other words, if the home position is at the origin, then the world + // position can be found at (radius, angle). + radius = sqrtf(SQ(diffX) + SQ(diffZ)); + angle = Math_Vec3f_Yaw(&this->actor.home.pos, &this->actor.world.pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F664.s") + // This takes the polar coordinates we found earlier and converts them *back* into + // Cartesian coordinates by adding them back to the home position. This ends up creating + // a near-duplicate of the Hiploop's original world position. + Math_Vec3f_Copy(&nearDuplicateWorldPos, &this->actor.home.pos); + nearDuplicateWorldPos.x += Math_SinS(angle) * radius; + nearDuplicateWorldPos.z += Math_CosS(angle) * radius; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F6B4.s") + Math_ApproachF(&this->actor.world.pos.x, nearDuplicateWorldPos.x, 0.3f, 2.0f); + Math_ApproachF(&this->actor.world.pos.z, nearDuplicateWorldPos.z, 0.3f, 2.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F770.s") + // This computes the difference between the Hiploop's original world position and the + // near-duplicate position created earlier. Since the two positions are almost identical, + // the differences are tiny. + diffX = this->actor.world.pos.x - nearDuplicateWorldPos.x; + diffZ = this->actor.world.pos.z - nearDuplicateWorldPos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F940.s") + // Since the two differences are always tiny, this is always true. + if (sqrtf(SQ(diffX) + SQ(diffZ)) < 2.0f) { + this->actor.world.pos.x = nearDuplicateWorldPos.x; + this->actor.world.pos.z = nearDuplicateWorldPos.z; + return true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FAD0.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FC7C.s") +/** + * Spawns dust behind the Hiploop's back feet. + */ +void EnPp_SpawnDust(EnPp* this, PlayState* play) { + s32 i; + Vec3f pos; + Vec3f velocity; + Vec3f accel; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FF20.s") + for (i = 0; i < ARRAY_COUNT(this->backFootPos); i++) { + velocity.x = randPlusMinusPoint5Scaled(2.0f); + velocity.y = Rand_ZeroFloat(2.0f) + 1.0f; + velocity.z = randPlusMinusPoint5Scaled(2.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20030.s") + accel.y = -0.1f; + accel.z = 0.0f; + accel.x = 0.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B202B8.s") + pos.x = this->backFootPos[i].x + randPlusMinusPoint5Scaled(10.0f); + pos.y = Rand_ZeroFloat(3.0f) + this->actor.floorHeight + 1.0f; + pos.z = this->backFootPos[i].z + randPlusMinusPoint5Scaled(10.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B203BC.s") + func_800B0EB0(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (Rand_ZeroFloat(50.0f) + 60.0f), + 30, (Rand_ZeroFloat(5.0f) + 20.0f)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20668.s") +void EnPp_ChangeAnim(EnPp* this, s32 animIndex) { + f32 morphFrames = -10.0f; + f32 playSpeed; + f32 startFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Update.s") + this->animIndex = animIndex; + this->endFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20E6C.s") + if (this->animIndex >= EN_PP_ANIM_WIND_UP) { + morphFrames = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20F70.s") + playSpeed = 1.0f; + if (this->animIndex == EN_PP_ANIM_TURN_TO_FACE_PLAYER) { + playSpeed = 2.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Draw.s") + startFrame = 0.0f; + if (this->action == EN_PP_ACTION_BODY_PART_MOVE) { + startFrame = this->endFrame; + } + + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, startFrame, this->endFrame, + sAnimationModes[this->animIndex], morphFrames); +} + +void EnPp_PlaySfxForAnimation(EnPp* this) { + if (this->action != EN_PP_ACTION_STUNNED_OR_FROZEN) { + switch (this->animIndex) { + case EN_PP_ANIM_WALK: + case EN_PP_ANIM_TURN_TO_FACE_PLAYER: + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOTSTEP); + } + break; + + case EN_PP_ANIM_WIND_UP: + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOT - SFX_FLAG); + break; + + case EN_PP_ANIM_CHARGE: + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_RUN - SFX_FLAG); + break; + + case EN_PP_ANIM_ATTACK: + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + } + break; + + case EN_PP_ANIM_ROAR: + if (Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + } + break; + + default: + break; + } + } +} + +/** + * Checks to see if the Hiploop is about to walk off a ledge or into a wall. + */ +s32 EnPp_CheckCollision(EnPp* this, PlayState* play) { + s16 angle; + s32 i; + + angle = this->actor.world.rot.y; + if (this->action == EN_PP_ACTION_DAMAGED) { + angle = this->targetRotY; + } + + Math_Vec3f_Copy(&this->wallCheckPos, &this->actor.world.pos); + for (i = 0; i < ARRAY_COUNT(this->ledgeCheckPos); i++) { + Math_Vec3f_Copy(&this->ledgeCheckPos[i], &this->actor.world.pos); + this->ledgeCheckPos[i].x += Math_SinS(sLedgeCheckAngles[i] + angle) * 70.0f; + this->ledgeCheckPos[i].y = this->actor.floorHeight - 10.0f; + this->ledgeCheckPos[i].z += Math_CosS(sLedgeCheckAngles[i] + angle) * 70.0f; + if (!BgCheck_SphVsFirstPoly(&play->colCtx, &this->ledgeCheckPos[i], 20.0f)) { + return EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE; + } + } + + this->wallCheckPos.x += Math_SinS(angle) * 40.0f; + this->wallCheckPos.y = this->actor.world.pos.y + 20.0f; + if (this->chargesInStraightLines) { + // This prevents the Hiploops in Woodfall from acting strangely when they move from + // a wooden platform onto one of the ramps; without this, they'll suddenly slow down + // and start roaring when they try to climb the small lip. + this->wallCheckPos.y += 20.0f; + } + + this->wallCheckPos.z += Math_CosS(angle) * 40.0f; + if (BgCheck_SphVsFirstWall(&play->colCtx, &this->wallCheckPos, 10.0f)) { + return EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_INTO_WALL; + } + + return EN_PP_COLLISION_RESULT_OK; +} + +void EnPp_SetupIdle(EnPp* this) { + this->action = EN_PP_ACTION_IDLE; + this->actionFunc = EnPp_Idle; +} + +/** + * Alternates between stopping in place, spinning around in random directions, and walking forward. + */ +void EnPp_Idle(EnPp* this, PlayState* play) { + Vec3f posToLookAt; + + SkelAnime_Update(&this->skelAnime); + if (this->hasBeenDamaged || (this->actor.xzDistToPlayer < this->attackRange)) { + EnPp_SetupCharge(this); + } else { + if ((this->timer == 0) && (this->secondaryTimer == 0)) { + this->secondaryTimer = Rand_ZeroFloat(20.0f) + 20.0f; + Math_Vec3f_Copy(&posToLookAt, &this->actor.home.pos); + posToLookAt.x += randPlusMinusPoint5Scaled(50.0f); + posToLookAt.z += randPlusMinusPoint5Scaled(50.0f); + this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &posToLookAt); + this->actor.speedXZ = 0.0f; + if (this->animIndex != EN_PP_ANIM_IDLE) { + EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); + } + } + + if (this->secondaryTimer == 1) { + this->timer = Rand_ZeroFloat(40.0f) + 40.0f; + } + + if (EnPp_CheckCollision(this, play) != EN_PP_COLLISION_RESULT_OK) { + this->timer = 0; + if (this->animIndex != EN_PP_ANIM_WALK) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WALK); + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, 0x258, 0); + } else if ((this->secondaryTimer == 0) && (this->timer != 0)) { + if (this->animIndex == EN_PP_ANIM_IDLE) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WALK); + } + + if ((this->maskBounceRotationalVelocity < 0x64) && + (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f)) { + Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.3f, 1.0f); + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, + (this->maskBounceRotationalVelocity + 0x258), 0); + Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); + } + } +} + +void EnPp_SetupCharge(EnPp* this) { + this->secondaryTimer = this->timer = 0; + this->actionVar.isCharging = false; + EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); + this->action = EN_PP_ACTION_CHARGE; + this->actionFunc = EnPp_Charge; +} + +/** + * Charges either directly at the player or in a straight line, depending on the type of Hiploop. + */ +void EnPp_Charge(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + s32 yawDiff; + Vec3f distanceFromWorldPos; + + SkelAnime_Update(&this->skelAnime); + + if (!this->actionVar.isCharging || (this->animIndex == EN_PP_ANIM_WIND_UP)) { + this->targetRotY = this->actor.yawTowardsPlayer; + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(300.0f, &distanceFromWorldPos); + this->targetPos.x += distanceFromWorldPos.x; + this->targetPos.z += distanceFromWorldPos.z; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, (this->maskBounceRotationalVelocity + 0x7D0), + 0); + } + + Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); + if (!this->actionVar.isCharging) { + Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); + if (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f) { + if (this->chargesInStraightLines) { + this->actor.world.rot.y = this->targetRotY; + } + + this->actionVar.isCharging = true; + } + } else if (this->animIndex == EN_PP_ANIM_TURN_TO_FACE_PLAYER) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WIND_UP); + } else if (this->animIndex == EN_PP_ANIM_WIND_UP) { + if (this->endFrame <= curFrame) { + this->chargeAndBounceSpeed = 14.0f; + this->timer = 20; + EnPp_ChangeAnim(this, EN_PP_ANIM_CHARGE); + } + } else if (this->animIndex == EN_PP_ANIM_CHARGE) { + if (EnPp_CheckCollision(this, play) != EN_PP_COLLISION_RESULT_OK) { + this->actor.speedXZ = 0.0f; + EnPp_SetupRoar(this); + return; + } + + if (!this->chargesInStraightLines) { + Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.3f, 1.0f); + } else { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + if (this->timer < 10) { + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + } + } + + if (this->timer == 0) { + EnPp_SetupRoar(this); + return; + } + + if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && (!(this->bodyCollider.base.atFlags & AT_BOUNCED))) { + if ((this->maskCollider.base.atFlags & AT_HIT) || (this->bodyCollider.base.atFlags & AT_HIT)) { + EnPp_SetupAttack(this); + return; + } + } else if (this->chargesInStraightLines) { + EnPp_SetupBounced(this); + return; + } else { + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED) { + this->actor.speedXZ *= -1.0f; + } else { + this->actor.speedXZ *= -0.5f; + } + + EnPp_SetupRoar(this); + return; + } + } + + if (((this->animIndex == EN_PP_ANIM_WIND_UP) || (this->animIndex == EN_PP_ANIM_CHARGE)) && + (this->secondaryTimer == 0)) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } +} + +void EnPp_SetupAttack(EnPp* this) { + EnPp_ChangeAnim(this, EN_PP_ANIM_ATTACK); + this->hornColliderOn = true; + this->action = EN_PP_ACTION_ATTACK; + this->actor.speedXZ = 0.0f; + this->actionFunc = EnPp_Attack; +} + +void EnPp_Attack(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + + SkelAnime_Update(&this->skelAnime); + if (this->endFrame <= curFrame) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupBounced(EnPp* this) { + Vec3f distanceFromWorldPos; + s32 yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &distanceFromWorldPos); + this->timer = 10; + this->targetPos.x += distanceFromWorldPos.x; + this->targetPos.z += distanceFromWorldPos.z; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->actor.speedXZ = 0.0f; + this->action = EN_PP_ACTION_BOUNCED; + this->chargeAndBounceSpeed = 14.0f; + this->actionFunc = EnPp_Bounced; +} + +/** + * Pushes the Hiploop back for a half-second, then forces it to charge again. + */ +void EnPp_Bounced(EnPp* this, PlayState* play) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + if ((this->timer == 0) && (EnPp_PointlessPosCheck(this))) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupRoar(EnPp* this) { + this->actionVar.hasDoneFirstRoar = false; + this->timer = 20; + this->secondaryTimer = 0; + this->chargeAndBounceSpeed = 14.0f; + EnPp_ChangeAnim(this, EN_PP_ANIM_ROAR); + this->action = EN_PP_ACTION_ROAR; + this->actionFunc = EnPp_Roar; +} + +/** + * Slows the Hiploop down and makes it do two roars. Afterwards, it will make the Hiploop charge again. + */ +void EnPp_Roar(EnPp* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 curFrame = this->skelAnime.curFrame; + + SkelAnime_Update(&this->skelAnime); + + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->actor.speedXZ = 0.0f; + this->chargeAndBounceSpeed = 0.0f; + } + + if (!this->chargesInStraightLines) { + if ((fabsf(this->actor.home.pos.y - this->actor.world.pos.y) > 100.0f) && + (fabsf(this->actor.floorHeight - player->actor.floorHeight) > 100.0f)) { + EnPp_SetupDead(this, play); + return; + } + } else if (this->chargeAndBounceSpeed) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + if (this->timer < 10) { + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + } + } + + Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); + if ((this->actor.speedXZ > 0.3f) && (this->secondaryTimer == 0)) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + if (!this->actionVar.hasDoneFirstRoar && (this->endFrame <= curFrame)) { + this->skelAnime.startFrame = 6.0f; + this->actionVar.hasDoneFirstRoar = true; + } + + if (this->timer == 0) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupJump(EnPp* this) { + s32 yawDiff; + + this->secondaryTimer = 0; + this->actionVar.hasLandedFromJump = false; + this->timer = this->secondaryTimer; + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 20.0f; + this->actor.gravity = -3.0f; + EnPp_ChangeAnim(this, EN_PP_ANIM_JUMP); + + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->actor.world.rot.y = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->actor.world.rot.y = this->actor.home.rot.y; + } + + this->targetRotY = this->actor.world.rot.y; + } + + this->actionVar.hasLandedFromJump = false; + this->action = EN_PP_ACTION_JUMP; + this->actionFunc = EnPp_Jump; +} + +/** + * Makes the Hiploop jump straight up. Once it lands, the Hiploop will be forced to be idle. + */ +void EnPp_Jump(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + s32 yawDiff; + + SkelAnime_Update(&this->skelAnime); + + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + EnPp_PointlessPosCheck(this); + } else { + this->targetRotY = this->actor.yawTowardsPlayer; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, 0x1388, 0); + if (!this->actionVar.hasLandedFromJump) { + if (this->actor.bgCheckFlags & 1) { + this->actionVar.hasLandedFromJump = true; + EnPp_ChangeAnim(this, EN_PP_ANIM_LAND); + } + } else if (this->endFrame <= curFrame) { + EnPp_SetupIdle(this); + } +} + +void EnPp_SetupStunnedOrFrozen(EnPp* this) { + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + this->actor.speedXZ = 0.0f; + this->action = EN_PP_ACTION_STUNNED_OR_FROZEN; + this->actionFunc = EnPp_StunnedOrFrozen; +} + +/** + * Locks the Hiploop in place until the draw damage effect timer or the stun timer reaches 0. + * When the stun wears off, this forces the Hiploop to charge. + */ +void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { + if ((this->drawDmgEffTimer != 0) && (this->drawDmgEffTimer < 60)) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + } + } + + if ((this->secondaryTimer == 0) && (this->drawDmgEffTimer == 0)) { + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, + 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupDamaged(EnPp* this, PlayState* play) { + Vec3f temp; + s32 pad; + s32 yawDiff; + + if (!this->chargesInStraightLines) { + Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); + Matrix_MultVecZ(-30.0f, &temp); + Math_Vec3f_Copy(&this->damagedVelocity, &temp); + } else { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &temp); + this->timer = 10; + this->targetPos.x += temp.x; + this->targetPos.z += temp.z; + } + + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer != 0)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + this->secondaryTimer = 0; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->targetRotY = this->actor.yawTowardsPlayer + 0x8000; + this->action = EN_PP_ACTION_DAMAGED; + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->damagedVelocity.z = 0.0f; + this->damagedVelocity.x = 0.0f; + this->actor.speedXZ = 0.0f; + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_DAMAGE); + this->actionFunc = EnPp_Damaged; +} + +/** + * Makes the Hiploop move backwards and spin quickly. + */ +void EnPp_Damaged(EnPp* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + SkelAnime_Update(&this->skelAnime); + this->actor.world.rot.y += 0x1000; + if (this->secondaryTimer == 0) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + if (this->chargesInStraightLines) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, 25.0f); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, 25.0f); + this->actor.world.rot.y += 0x1000; + if ((this->timer == 0) && (EnPp_PointlessPosCheck(this))) { + EnPp_SetupCharge(this); + } + } else if ((this->actor.colorFilterTimer == 0) && (this->damagedVelocity.x < 1.0f) && + (this->damagedVelocity.z < 1.0f)) { + EnPp_SetupCharge(this); + } + + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->damagedVelocity.z = 0.0f; + this->damagedVelocity.x = 0.0f; + this->actor.speedXZ = 0.0f; + } + + if ((fabsf(this->actor.home.pos.y - this->actor.world.pos.y) > 100.0f) && + (fabsf(this->actor.floorHeight - player->actor.floorHeight) > 100.0f)) { + EnPp_SetupDead(this, play); + } +} + +void EnPp_SetupDead(EnPp* this, PlayState* play) { + Vec3f deadVelocity; + s32 yawDiff; + + this->secondaryTimer = this->timer = 0; + if (!this->chargesInStraightLines) { + Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); + Matrix_MultVecZ(-30.0f, &deadVelocity); + Math_Vec3f_Copy(&this->damagedVelocity, &deadVelocity); + } else { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &deadVelocity); + this->targetPos.x += deadVelocity.x; + this->targetPos.z += deadVelocity.z; + } + + this->maskBounceRotationalVelocity = this->actionVar.isCharging = 0; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->timer = 15; + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_HIPLOOP_DEAD); + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + this->action = EN_PP_ACTION_DEAD; + this->actionFunc = EnPp_Dead; +} + +/** + * Makes the Hiploop move backwards and spin even quicker than when it's damaged. + * If the Hiploop ends up in the water while it's moving backwards, this function + * will make some splashes too. After a short amount of time, this will spawn body + * parts that fly away from the Hiploop. + */ +void EnPp_Dead(EnPp* this, PlayState* play) { + Vec3f splashPos; + WaterBox* waterBox; + f32 waterSurface; + s32 isUnderWater; + s32 i; + + SkelAnime_Update(&this->skelAnime); + this->actor.world.rot.y += 0x3000; + waterSurface = this->actor.world.pos.y - 30.0f; + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + if (this->drawDmgEffTimer == 0) { + return; + } + + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + if (this->secondaryTimer == 0) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + isUnderWater = false; + if ((this->action == EN_PP_ACTION_DEAD) && + (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox))) { + if (this->actor.world.pos.y < waterSurface) { + for (i = 0; i < 5; i++) { + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); + splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + isUnderWater = true; + } + } + + if (this->chargesInStraightLines) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, 25.0f); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, 25.0f); + } + + if ((this->action == EN_PP_ACTION_DEAD) && (isUnderWater || (this->timer == 1))) { + this->action = EN_PP_ACTION_SPAWN_BODY_PARTS; + } + + if (this->action == EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS) { + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_UNMASKED) { + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x70); + } else { + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xE0); + } + + Actor_MarkForDeath(&this->actor); + } +} + +/** + * Spawns an unmasked Hiploop and prepares the mask to fly through the air. + */ +void EnPp_Mask_SetupDetach(EnPp* this, PlayState* play) { + s32 yawDiff; + EnPp* pp = (EnPp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PP, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.world.rot.x, this->actor.shape.rot.y, + this->actor.world.rot.z, EN_PP_TYPE_UNMASKED); + + if (pp != NULL) { + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + pp->chargesInStraightLines = true; + pp->actor.world.rot.y = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + pp->actor.world.rot.y = this->actor.home.rot.y; + } + } + + this->actor.gravity = 0.0f; + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_START; + EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); + SkelAnime_Update(&this->skelAnime); + this->action = EN_PP_ACTION_MASK_DETACH; + this->actionFunc = EnPp_Mask_Detach; + } +} + +/** + * Moves the mask through the air and eventually makes it burst into flames. + */ +void EnPp_Mask_Detach(EnPp* this, PlayState* play) { + if (((this->actor.flags & ACTOR_FLAG_2000) != ACTOR_FLAG_2000) || (this->action == EN_PP_ACTION_MASK_DEAD)) { + switch (this->actionVar.maskDetachState) { + case EN_PP_MASK_DETACH_STATE_START: + this->action = EN_PP_ACTION_MASK_DEAD; + this->maskAccelY = 50.0f; + this->maskVelocity.y = -230.0f; + this->maskVelocity.x = -150.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_MASC_OFF); + this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_FALL; + break; + + case EN_PP_MASK_DETACH_STATE_FALL: + if (this->maskPos.y > 800.0f) { + this->maskAccelY = 50.0f; + this->actionVar.maskDetachState++; + this->maskVelocity.y = -200.0f; + this->maskVelocity.x = -150.0f; + } + break; + + case EN_PP_MASK_DETACH_STATE_DIE: + if (this->maskPos.y > 900.0f) { + if (this->maskVelocity.y > 0.0f) { + Vec3f maskFirePos; + Vec3f sMaskFireVelocityAndAccel[] = { + { 1.0f, 0.0f, 0.5f }, { 1.0f, 0.0f, -0.5f }, { -1.0f, 0.0f, 0.5f }, + { -1.0f, 0.0f, -0.5f }, { 0.5f, 0.0f, 1.0f }, { -0.5f, 0.0f, 1.0f }, + { 0.5f, 0.0f, -1.0f }, { -0.5f, 0.0f, -1.0f }, { 0.0f, 0.0f, 0.0f }, + }; + s32 i; + + for (i = 0; i < ARRAY_COUNT(sMaskFireVelocityAndAccel); i++) { + Math_Vec3f_Copy(&maskFirePos, &this->maskFlamesBasePos); + maskFirePos.x += randPlusMinusPoint5Scaled(20.0f); + maskFirePos.y = this->actor.floorHeight; + maskFirePos.z += randPlusMinusPoint5Scaled(20.0f); + func_800B3030(play, &maskFirePos, &sMaskFireVelocityAndAccel[i], + &sMaskFireVelocityAndAccel[i], 70, 0, 2); + } + + Actor_MarkForDeath(&this->actor); + } + } + break; + } + + this->maskVelocity.y += this->maskAccelY; + this->maskRot.z += 0x2000; + this->maskPos.x += this->maskVelocity.x; + this->maskPos.y += this->maskVelocity.y; + this->maskPos.z += this->maskVelocity.z; + } +} + +void EnPp_BodyPart_SetupMove(EnPp* this) { + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 13.0f; + this->actor.gravity = -2.0f; + this->timer = Rand_S16Offset(30, 30); + this->deadBodyPartRotationalVelocity.x = (this->deadBodyPartIndex * 0x2E) + 0xFF00; + this->deadBodyPartRotationalVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00; + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) { + this->actor.speedXZ = Rand_ZeroFloat(4.0f) + 4.0f; + this->actor.world.rot.y = ((s32)randPlusMinusPoint5Scaled(223.0f) + 0x1999) * this->deadBodyPartIndex; + } + + this->action = EN_PP_ACTION_BODY_PART_MOVE; + this->actionFunc = EnPp_BodyPart_Move; +} + +/** + * Makes the body part fly through the air. If it touches water, it will make a splash. + */ +void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { + s32 pad; + Vec3f splashPos; + WaterBox* waterBox; + f32 waterSurface; + s32 i; + + SkelAnime_Update(&this->skelAnime); + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + this->deadBodyPartDrawDmgEffCount = 10; + for (i = 0; i < ARRAY_COUNT(this->deadBodyPartDrawDmgEffPos); i++) { + Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[i], &this->deadBodyPartPos); + this->deadBodyPartDrawDmgEffPos[i].x += Math_SinS(0xCCC * i) * 15.0f; + this->deadBodyPartDrawDmgEffPos[i].y += -5.0f; + this->deadBodyPartDrawDmgEffPos[i].z += Math_CosS(0xCCC * i) * 15.0f; + } + } else { + Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[0], &this->deadBodyPartPos); + this->deadBodyPartDrawDmgEffCount = 1; + this->actor.shape.rot.x += this->deadBodyPartRotationalVelocity.x; + this->actor.shape.rot.z += this->deadBodyPartRotationalVelocity.z; + } + + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox) && + (this->actor.world.pos.y < (waterSurface + 5.0f))) { + this->timer = 0; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + for (i = 0; i < 6; i++) { + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); + splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); + } + } else { + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, 400); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + } + + if ((this->timer == 0) || (this->actor.bgCheckFlags & 1)) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnPp_UpdateDamage(EnPp* this, PlayState* play) { + s16 yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); + s32 attackBouncedOffMask = false; + s32 attackDealsDamage = false; + + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + if ((yawDiff < (BREG(2) + 0x4A9C)) || (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED)) { + this->actor.flags |= ACTOR_FLAG_200; + } else { + this->actor.flags &= ~ACTOR_FLAG_200; + } + } + + if ((EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) && (this->action < EN_PP_ACTION_MASK_DETACH)) { + if (this->maskCollider.elements[0].info.bumperFlags & BUMP_HIT) { + if (yawDiff < (BREG(2) + 0x4A9C)) { + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_HOOKSHOT) { + EnPp_Mask_SetupDetach(this, play); + } else if ((this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_GORON_POUND) || + (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_KNOCK_OFF_MASK)) { + EnPp_Mask_SetupDetach(this, play); + this->action = EN_PP_ACTION_MASK_DEAD; + } + } else { + attackBouncedOffMask = true; + } + } else if (this->maskCollider.elements[0].info.bumperFlags & BUMP_HIT) { + attackBouncedOffMask = true; + } + } + + if (this->bodyCollider.elements[0].info.bumperFlags & BUMP_HIT) { + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED) { + if ((this->action < EN_PP_ACTION_DAMAGED) && (this->action != EN_PP_ACTION_JUMP)) { + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_HOOKSHOT) { + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + return; + } + attackDealsDamage = true; + } + + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_ELECTRIC_STUN) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_STUN) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + this->secondaryTimer = 40; + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if ((this->actor.colChkInfo.damageEffect != EN_PP_DMGEFF_GORON_POUND) && + (this->actor.colChkInfo.damageEffect != EN_PP_DMGEFF_JUMP)) { + attackDealsDamage = true; + this->hasBeenDamaged = true; + this->actor.speedXZ = 0.0f; + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_FIRE) { + this->drawDmgEffTimer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } else if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_FREEZE) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + Actor_ApplyDamage(&this->actor); + this->drawDmgEffTimer = 80; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; + this->drawDmgEffScale = 0.0f; + this->drawDmgEffFrozenSteamScale = 1.5f; + } + + if (this->actor.colChkInfo.health <= 0) { + EnPp_SetupDead(this, play); + } else { + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if ((this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_LIGHT_ORB) && + ((((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX)) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, + this->actor.focus.pos.y, this->actor.focus.pos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_SetColorFilter(&this->actor, 0x8000, 255, 0, 25); + this->drawDmgEffTimer = 20; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + } + } else if (this->action != EN_PP_ACTION_JUMP) { + EnPp_SetupJump(this); + } + } + + if (attackDealsDamage) { + Actor_ApplyDamage(&this->actor); + if (this->actor.colChkInfo.health > 0) { + EnPp_SetupDamaged(this, play); + } else { + EnPp_SetupDead(this, play); + } + } + } else { + attackBouncedOffMask = true; + } + } + + if (attackBouncedOffMask && (((this->action == EN_PP_ACTION_IDLE)) || (this->action == EN_PP_ACTION_CHARGE) || + (this->action == EN_PP_ACTION_ROAR))) { + this->secondaryTimer = 0; + this->timer = 10; + this->maskBounceRotationalVelocity = 0x20D0; + this->actor.speedXZ = 0.0f; + if (this->action == EN_PP_ACTION_CHARGE) { + this->actionVar.isCharging = false; + EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); + this->maskBounceRotationalVelocity = 0x1B58; + } + + this->targetRotY = this->actor.yawTowardsPlayer; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_BOUND); + } + } +} + +void EnPp_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnPp* this = THIS; + WaterBox* waterBox; + f32 waterSurface; + + DECR(this->timer); + + if (this->secondaryTimer != 0) { + this->secondaryTimer--; + } + + if (this->drawDmgEffTimer != 0) { + this->drawDmgEffTimer--; + } + + this->actionFunc(this, play); + EnPp_PlaySfxForAnimation(this); + Actor_MoveWithGravity(&this->actor); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { + this->maskCollider.elements[0].dim.modelSphere.radius = 42; + this->maskCollider.elements[0].dim.modelSphere.center.x = 400; + this->maskCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyCollider.elements[0].dim.modelSphere.radius = 20; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } else { + this->maskCollider.elements[0].dim.modelSphere.radius = 25; + this->maskCollider.elements[0].dim.modelSphere.center.x = 780; + this->maskCollider.elements[0].dim.modelSphere.center.y = -500; + this->bodyCollider.elements[0].dim.modelSphere.radius = 25; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } + } + + if ((this->action < EN_PP_ACTION_DEAD) && + (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox)) && + (this->actor.world.pos.y < waterSurface)) { + EnPp_SetupDead(this, play); + return; + } + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + EnPp_UpdateDamage(this, play); + Actor_SetFocus(&this->actor, 40.0f); + if ((this->action == EN_PP_ACTION_DEAD) || (this->actor.bgCheckFlags & 1)) { + this->actor.world.pos.x += this->damagedVelocity.x; + this->actor.world.pos.z += this->damagedVelocity.z; + Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); + Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); + } + } + + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, 0x1F); + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + this->actor.shape.rot.y = this->actor.world.rot.y; + } + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (this->floorPolyForCircleShadow == NULL) { + this->floorPolyForCircleShadow = this->actor.floorPoly; + } + + if ((this->action < EN_PP_ACTION_DEAD) || (this->action == EN_PP_ACTION_JUMP)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->maskCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + } + + if ((this->action < EN_PP_ACTION_MASK_DETACH) && (this->action != EN_PP_ACTION_STUNNED_OR_FROZEN)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->maskCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); + } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + if (this->hornColliderOn) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->hornCollider.base); + } + } +} + +s32 EnPp_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnPp* this = THIS; + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if ((limbIndex != HIPLOOP_LIMB_MASK) && + ((this->action == EN_PP_ACTION_MASK_DETACH) || (this->action == EN_PP_ACTION_MASK_DEAD))) { + *dList = NULL; + } + + if ((limbIndex == HIPLOOP_LIMB_MASK) && (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED)) { + *dList = NULL; + } + + if (limbIndex == HIPLOOP_LIMB_MASK) { + rot->x += (s16)this->maskRot.x; + rot->y += (s16)this->maskRot.y; + rot->z += (s16)this->maskRot.z; + pos->x += this->maskPos.x; + pos->y += this->maskPos.y; + pos->z += this->maskPos.z; + } + } else if ((limbIndex + EN_PP_TYPE_BODY_PART_BASE) != EN_PP_GET_TYPE(&this->actor)) { + *dList = NULL; + } + + return false; +} + +void EnPp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f sVertexOffset1 = { 0.0f, 0.0f, 0.0f }; + static Vec3f sVertexOffset2 = { 0.0f, 0.0f, 0.0f }; + EnPp* this = THIS; + Vec3f blureVertex1; + Vec3f blureVertex2; + + Matrix_Push(); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (limbIndex == HIPLOOP_LIMB_BACK_RIGHT_FOOT) { + Matrix_MultVec3f(&gZeroVec3f, &this->backFootPos[0]); + } + + if (limbIndex == HIPLOOP_LIMB_BACK_LEFT_FOOT) { + Matrix_MultVec3f(&gZeroVec3f, &this->backFootPos[1]); + } + + if ((limbIndex == HIPLOOP_LIMB_MASK) && (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED)) { + Matrix_MultVec3f(&gZeroVec3f, &this->maskFlamesBasePos); + if (this->hornColliderOn) { + if ((this->skelAnime.curFrame > 26.0f) || (this->action >= EN_PP_ACTION_MASK_DETACH)) { + this->hornColliderOn = false; + EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); + } else if ((this->skelAnime.curFrame > 0.0f) && (this->skelAnime.curFrame < 10.0f)) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + sVertexOffset1.x = 1160.0f; + sVertexOffset1.y = -900.0f; + sVertexOffset1.z = 0.0f; + sVertexOffset2.x = 100.0f; + sVertexOffset2.y = 300.0f; + sVertexOffset2.z = 0.0f; + Math_Vec3f_Copy(&this->hornCollider.dim.quad[3], &this->hornCollider.dim.quad[1]); + Math_Vec3f_Copy(&this->hornCollider.dim.quad[2], &this->hornCollider.dim.quad[0]); + Matrix_MultVec3f(&sVertexOffset1, &this->hornCollider.dim.quad[1]); + Matrix_MultVec3f(&sVertexOffset2, &this->hornCollider.dim.quad[0]); + Collider_SetQuadVertices(&this->hornCollider, &this->hornCollider.dim.quad[0], + &this->hornCollider.dim.quad[1], &this->hornCollider.dim.quad[2], + &this->hornCollider.dim.quad[3]); + Matrix_MultVec3f(&sVertexOffset1, &blureVertex1); + Matrix_MultVec3f(&sVertexOffset2, &blureVertex2); + EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &blureVertex1, &blureVertex2); + } + } + } + } else { + if ((EN_PP_GET_TYPE(&this->actor) >= EN_PP_TYPE_BODY_PART_BASE) && + ((limbIndex + EN_PP_TYPE_BODY_PART_BASE) == EN_PP_GET_TYPE(&this->actor))) { + Matrix_MultVec3f(&gZeroVec3f, &this->deadBodyPartPos); + } + } + + Matrix_Pop(); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + Collider_UpdateSpheres(limbIndex, &this->maskCollider); + Collider_UpdateSpheres(limbIndex, &this->bodyCollider); + if ((limbIndex == HIPLOOP_LIMB_BODY) || (limbIndex == HIPLOOP_LIMB_FRONT_LEFT_LOWER_LEG) || + (limbIndex == HIPLOOP_LIMB_FRONT_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_LEFT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_BACK_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_CENTER_WING_BASE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_BACK_LEFT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_EYE) || + (limbIndex == HIPLOOP_LIMB_LEFT_EYE)) { + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosCount]); + this->bodyPartsPosCount++; + if (this->bodyPartsPosCount >= ARRAY_COUNT(this->bodyPartsPos)) { + this->bodyPartsPosCount = 0; + } + + if ((this->action == EN_PP_ACTION_SPAWN_BODY_PARTS) && (this->deadBodyPartsSpawnedCount < 6) && + ((limbIndex == HIPLOOP_LIMB_BODY) || (limbIndex == HIPLOOP_LIMB_FRONT_LEFT_LOWER_LEG) || + (limbIndex == HIPLOOP_LIMB_FRONT_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_LEFT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_RIGHT_WING_MIDDLE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PP, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, + this->actor.world.rot.z, limbIndex + 7); + this->deadBodyPartsSpawnedCount++; + if (this->deadBodyPartsSpawnedCount >= 6) { + this->action = EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS; + } + } + } + } +} + +void EnPp_Draw(Actor* thisx, PlayState* play) { + EnPp* this = THIS; + MtxF mtxF; + Vec3f pos; + f32 scale; + f32 alpha; + + func_8012C2DC(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPp_OverrideLimbDraw, EnPp_PostLimbDraw, &this->actor); + + if (this->deadBodyPartDrawDmgEffCount != 0) { + scale = 0.4f; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + scale = 0.6f; + } + + Actor_DrawDamageEffects(play, &this->actor, this->deadBodyPartDrawDmgEffPos, this->deadBodyPartDrawDmgEffCount, + scale, scale, 1.0f, ACTOR_DRAW_DMGEFF_BLUE_FIRE); + } + + if (this->drawDmgEffTimer != 0) { + alpha = this->drawDmgEffTimer * 0.05f; + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + this->drawDmgEffScale += 0.3f; + if (this->drawDmgEffScale > 0.5f) { + this->drawDmgEffScale = 0.5f; + } + + Math_ApproachF(&this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, 0.1f, 0.04f); + } else { + this->drawDmgEffScale = 0.8f; + this->drawDmgEffFrozenSteamScale = 0.8f; + } + + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); + } + + if (this->floorPolyForCircleShadow != NULL) { + if ((this->action != EN_PP_ACTION_MASK_DETACH) && (this->action < EN_PP_ACTION_DEAD)) { + OPEN_DISPS(play->state.gfxCtx); + + func_8012C448(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); + + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.x += (Math_SinS(this->actor.world.rot.y) * -13.0f); + pos.y = this->actor.floorHeight; + pos.z += (Math_CosS(this->actor.world.rot.y) * -13.0f); + func_800C0094(this->actor.floorPoly, pos.x, pos.y, pos.z, &mtxF); + + Matrix_Mult(&mtxF, MTXMODE_NEW); + Matrix_Scale(0.5f, 1.0f, 0.5f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); + + CLOSE_DISPS(play->state.gfxCtx); + } + } +} diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 4fab409b2..291c6473b 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -2,16 +2,82 @@ #define Z_EN_PP_H #include "global.h" +#include "objects/object_pp/object_pp.h" struct EnPp; typedef void (*EnPpActionFunc)(struct EnPp*, PlayState*); +#define EN_PP_GET_TYPE(thisx) ((thisx)->params) +#define EN_PP_DOES_CHARGE_IN_STRAIGHT_LINES(thisx) (((thisx)->params >> 8) & 1) +#define EN_PP_GET_ATTACK_RANGE(thisx) ((thisx)->world.rot.z) + +typedef enum { + /* 0 */ EN_PP_TYPE_MASKED, + /* 1 */ EN_PP_TYPE_NO_MASK, + /* 2 */ EN_PP_TYPE_UNMASKED, + /* 7 */ EN_PP_TYPE_BODY_PART_BASE = 7, + /* 8 */ EN_PP_TYPE_BODY_PART_BODY, + /* 10 */ EN_PP_TYPE_BODY_PART_FRONT_LEFT_LOWER_LEG = 10, + /* 13 */ EN_PP_TYPE_BODY_PART_FRONT_RIGHT_LOWER_LEG = 13, + /* 17 */ EN_PP_TYPE_BODY_PART_LEFT_WING_MIDDLE = 17, + /* 23 */ EN_PP_TYPE_BODY_PART_RIGHT_WING_MIDDLE = 23, + /* 26 */ EN_PP_TYPE_BODY_PART_CENTER_WING_MIDDLE = 26, +} EnPpType; + typedef struct EnPp { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x17C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[HIPLOOP_LIMB_MAX]; + /* 0x224 */ Vec3s morphTable[HIPLOOP_LIMB_MAX]; /* 0x2C0 */ EnPpActionFunc actionFunc; - /* 0x2C4 */ char unk_2C4[0x328]; + /* 0x2C4 */ s16 chargesInStraightLines; // If false, the Hiploop will instead charge directly at the player. + /* 0x2C6 */ s16 deadBodyPartIndex; + /* 0x2C8 */ s16 action; + /* 0x2CA */ s16 timer; + /* 0x2CC */ s16 secondaryTimer; + /* 0x2C8 */ s16 hornColliderOn; + /* 0x2D0 */ s16 targetRotY; + /* 0x2D2 */ union { + s16 isCharging; + s16 hasDoneFirstRoar; + s16 hasLandedFromJump; + s16 maskDetachState; + } actionVar; + /* 0x2D4 */ s16 maskBounceRotationalVelocity; // Controls the speed that the Hiploop rotates to face the player when an attack bounces off the mask. + /* 0x2D6 */ s16 deadBodyPartsSpawnedCount; + /* 0x2D8 */ f32 endFrame; + /* 0x2DC */ f32 chargeAndBounceSpeed; + /* 0x2DC */ Vec3f ledgeCheckPos[3]; + /* 0x304 */ Vec3f wallCheckPos; + /* 0x310 */ Vec3f backFootPos[2]; + /* 0x328 */ Vec3f maskFlamesBasePos; + /* 0x334 */ Vec3f maskPos; + /* 0x340 */ Vec3f maskRot; + /* 0x34C */ Vec3f maskVelocity; + /* 0x358 */ Vec3f targetPos; + /* 0x364 */ Vec3f deadBodyPartPos; + /* 0x370 */ s32 deadBodyPartDrawDmgEffCount; + /* 0x374 */ Vec3f deadBodyPartDrawDmgEffPos[10]; + /* 0x3EC */ Vec3s deadBodyPartRotationalVelocity; + /* 0x3F2 */ s16 drawDmgEffTimer; + /* 0x3F4 */ s16 drawDmgEffType; + /* 0x3F8 */ f32 drawDmgEffScale; + /* 0x3FC */ f32 drawDmgEffFrozenSteamScale; + /* 0x400 */ f32 attackRange; + /* 0x404 */ s32 hasBeenDamaged; + /* 0x408 */ Vec3f bodyPartsPos[11]; + /* 0x48C */ s16 bodyPartsPosCount; + /* 0x490 */ f32 maskAccelY; + /* 0x494 */ ColliderJntSph maskCollider; + /* 0x4B4 */ ColliderJntSphElement maskColliderElements[1]; + /* 0x4F4 */ ColliderJntSph bodyCollider; + /* 0x514 */ ColliderJntSphElement bodyColliderElements[1]; + /* 0x554 */ ColliderQuad hornCollider; + /* 0x5D4 */ CollisionPoly* floorPolyForCircleShadow; + /* 0x5D8 */ s32 blureIndex; + /* 0x5DC */ s32 animIndex; + /* 0x5DC */ Vec3f damagedVelocity; } EnPp; // size = 0x5EC extern const ActorInit En_Pp_InitVars; diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index e26ac6bed..37ab66ee7 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -15,10 +15,109 @@ void EnPst_Destroy(Actor* thisx, PlayState* play); void EnPst_Update(Actor* thisx, PlayState* play); void EnPst_Draw(Actor* thisx, PlayState* play); -void func_80B2BD98(EnPst* this, PlayState* play); -void func_80B2BE54(EnPst* this, PlayState* play); +void EnPst_FollowSchedule(EnPst* this, PlayState* play); +void EnPst_Talk(EnPst* this, PlayState* play); + +typedef enum { + /* 0 */ POSTBOX_SCH_NONE, + /* 1 */ POSTBOX_SCH_AVAILABLE, + /* 2 */ POSTBOX_SCH_CHECKED_BY_POSTMAN +} PostboxScheduleResult; + +typedef enum { + /* 0 */ POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM, + /* 1 */ POSTBOX_BEHAVIOUR_TAKE_ITEM, +} PostboxBehaviour; + +static u8 D_80B2C200[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(9, 31, 9, 35, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C20C[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 3, 10, 7, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C218[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 35, 10, 39, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C224[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 53, 10, 57, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C230[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(11, 25, 11, 29, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +s32 D_80B2C23C[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C288[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C2D4[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C320[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C36C[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C3B8[] = { + 0x0E27A10C, 0x0F27A20C, 0x12005108, 0x000F0600, 0x0C000013, 0x000C0C11, + 0x51080700, 0x0C060001, 0x00001300, 0x010C0700, 0x000E27A3, 0x0C161000, +}; + +s32 D_80B2C3E8[] = { + 0x2C27870C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C408[] = { + 0x2C27870C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C428[] = { + 0x2C27870C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C448[] = { + 0x2C27870C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C468[] = { + 0x2C27870C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C488[] = { 0x2C27A40C, 0x10000000 }; + +s32 D_80B2C490[] = { 0x2C27850C, 0x10000000 }; -#if 0 const ActorInit En_Pst_InitVars = { ACTOR_EN_PST, ACTORCAT_PROP, @@ -31,51 +130,315 @@ const ActorInit En_Pst_InitVars = { (ActorFunc)EnPst_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B2C4B8 = { - { COLTYPE_HIT1, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT1, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 28, 72, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80B2C4E4 = { 1, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -#endif +static AnimationInfoS sAnimationInfo[] = { { &gPostboxOpenSlotAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 } }; -extern ColliderCylinderInit D_80B2C4B8; -extern CollisionCheckInfoInit2 D_80B2C4E4; +void EnPst_UpdateCollision(EnPst* this, PlayState* play) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} -extern UNK_TYPE D_06001A80; +s32 EnPst_HandleLetterDay1(EnPst* this) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x2; + case POSTBOX_NORTH_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x4; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x8; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x10; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x20; + default: + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B830.s") +s32 EnPst_HandleLetterDay2(EnPst* this) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x40; + case POSTBOX_NORTH_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x80; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x1; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x2; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x4; + default: + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B874.s") +s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) { + s32 itemActionParam = 0; + s32 scriptBranch = 0; + EnPst* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B8F4.s") + switch (this->behaviour) { + case POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM: + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + case TEXT_STATE_16: + itemActionParam = func_80123810(play); + scriptBranch = 0; + if ((itemActionParam == PLAYER_AP_LETTER_TO_KAFEI) || + (itemActionParam == PLAYER_AP_LETTER_MAMA)) { + this->exchangeItemId = itemActionParam; + this->behaviour++; + scriptBranch = 1; + } else if (itemActionParam < PLAYER_AP_NONE) { + this->behaviour++; + scriptBranch = 3; + } else if (itemActionParam != PLAYER_AP_NONE) { + this->behaviour++; + scriptBranch = 2; + } + } + break; + } + break; + case POSTBOX_BEHAVIOUR_TAKE_ITEM: + if (this->exchangeItemId == EXCH_ITEM_LETTER_TO_KAFEI) { + scriptBranch = 1; + } + break; + } + return scriptBranch; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B974.s") +s32* EnPst_GetMsgEventScript(EnPst* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_POSTMAN) { + return D_80B2C3B8; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BAA4.s") + if (this->stateFlags & 0x10) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return D_80B2C3E8; + case POSTBOX_NORTH_CLOCKTOWN: + return D_80B2C408; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return D_80B2C428; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return D_80B2C448; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return D_80B2C468; + default: + return NULL; + } + } else if (this->stateFlags & 0x20) { + if (this->exchangeItemId == EXCH_ITEM_LETTER_MAMA) { + return D_80B2C488; + } else { + return D_80B2C490; + } + } else { + this->msgEventCallback = EnPst_ChooseBehaviour; + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return D_80B2C23C; + case POSTBOX_NORTH_CLOCKTOWN: + return D_80B2C288; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return D_80B2C2D4; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return D_80B2C320; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return D_80B2C36C; + default: + return NULL; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BBFC.s") +s32 EnPst_CheckTalk(EnPst* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BCF8.s") + if (this->stateFlags & 7) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->stateFlags &= ~0x30; + if (player->exchangeItemId == EXCH_ITEM_LETTER_TO_KAFEI) { + this->stateFlags |= 0x10; + this->exchangeItemId = player->exchangeItemId; + } else if (player->exchangeItemId != EXCH_ITEM_NONE) { + this->stateFlags |= 0x20; + this->exchangeItemId = player->exchangeItemId; + } + // If Letter to Kafei is deposited, value is set to 2 + this->isLetterToKafeiDeposited = EnPst_HandleLetterDay1(this); + SubS_UpdateFlags(&this->stateFlags, 0, 7); + this->behaviour = 0; + this->msgEventCallback = NULL; + this->stateFlags |= 0x40; + this->msgEventScript = EnPst_GetMsgEventScript(this, play); + this->actionFunc = EnPst_Talk; + ret = true; + } + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD30.s") +s32 EnPst_UpdateFlagsSubs(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { + SubS_UpdateFlags(&this->stateFlags, 3, 7); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD88.s") +s32 EnPst_ProcessScheduleOutput(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD98.s") + this->stateFlags = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BE54.s") + switch (scheduleOutput->result) { + case POSTBOX_SCH_AVAILABLE: + ret = EnPst_UpdateFlagsSubs(this, play, scheduleOutput); + break; + case POSTBOX_SCH_CHECKED_BY_POSTMAN: + ret = true; + break; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Init.s") +/* The postbox does not have any necessary custom logic when following their schedule, + * instead it is all done in the process step. This is why this function is empty + */ +void EnPst_HandleSchedule(EnPst* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Destroy.s") +void EnPst_FollowSchedule(EnPst* this, PlayState* play) { + static u8* sScheduleScripts[] = { + D_80B2C200, D_80B2C20C, D_80B2C218, D_80B2C224, D_80B2C230, + }; + s16 params = this->actor.params; + ScheduleOutput scheduleOutput; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Update.s") + if (!Schedule_RunScript(play, sScheduleScripts[params], &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && + !EnPst_ProcessScheduleOutput(this, play, &scheduleOutput))) { + this->actor.shape.shadowDraw = NULL; + this->actor.flags &= ~ACTOR_FLAG_1; + scheduleOutput.result = POSTBOX_SCH_NONE; + } else { + this->actor.shape.shadowDraw = ActorShadow_DrawCircle; + this->actor.flags |= ACTOR_FLAG_1; + } + this->scheduleResult = scheduleOutput.result; + EnPst_HandleSchedule(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2C11C.s") +void EnPst_Talk(EnPst* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->msgEventArg4)) { + if (EnPst_HandleLetterDay1(this) != this->isLetterToKafeiDeposited) { + switch (gSaveContext.save.day) { + case 1: + gSaveContext.save.weekEventReg[91] |= 4; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Draw.s") + case 2: + if (EnPst_HandleLetterDay2(this)) { + gSaveContext.save.weekEventReg[91] |= 8; + } else { + gSaveContext.save.weekEventReg[91] |= 4; + } + break; + + default: + gSaveContext.save.weekEventReg[91] |= 8; + break; + } + } + SubS_UpdateFlags(&this->stateFlags, 3, 7); + this->msgEventArg4 = 0; + this->actionFunc = EnPst_FollowSchedule; + } +} + +void EnPst_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnPst* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gPostboxSkel, NULL, this->jointTable, this->morphTable, + POSTBOX_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + SubS_UpdateFlags(&this->stateFlags, 3, 7); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); + this->actor.targetMode = 0; + Actor_SetScale(&this->actor, 0.02f); + this->actionFunc = EnPst_FollowSchedule; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); +} + +void EnPst_Destroy(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void EnPst_Update(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + EnPst_CheckTalk(this, play); + this->actionFunc(this, play); + if (this->scheduleResult != POSTBOX_SCH_NONE) { + if (Actor_IsFacingPlayer(&this->actor, 0x1FFE)) { + this->unk214 = 0; + func_8013C964(&this->actor, play, 60.0f, 20.0f, 0, this->stateFlags & 7); + } + Actor_SetFocus(&this->actor, 20.0f); + EnPst_UpdateCollision(this, play); + } +} + +s32 EnPst_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnPst* this = THIS; + f32 yTranslation; + + if (limbIndex == POSTBOX_LIMB_MAIL_SLOT) { + if (this->stateFlags & 0x40) { + yTranslation = -100.0f; + } else { + yTranslation = 0.0f; + } + Matrix_Translate(0.0f, yTranslation, 0.0f, MTXMODE_APPLY); + } + return false; +} + +void EnPst_Draw(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + if (this->scheduleResult != POSTBOX_SCH_NONE) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPst_OverrideLimbDraw, NULL, &this->actor); + } +} diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.h b/src/overlays/actors/ovl_En_Pst/z_en_pst.h index ba60b4bf0..1f85a1dec 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.h +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.h @@ -2,16 +2,38 @@ #define Z_EN_PST_H #include "global.h" +#include "objects/object_pst/object_pst.h" + +typedef enum { + /* 0 */ POSTBOX_SOUTH_UPPER_CLOCKTOWN, + /* 1 */ POSTBOX_NORTH_CLOCKTOWN, + /* 2 */ POSTBOX_EAST_UPPER_CLOCKTOWN, + /* 3 */ POSTBOX_EAST_LOWER_CLOCKTOWN, + /* 4 */ POSTBOX_SOUTH_LOWER_CLOCKTOWN, +} PostboxType; struct EnPst; typedef void (*EnPstActionFunc)(struct EnPst*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnPst { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnPstActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x94]; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ u8 scheduleResult; + /* 0x1DC */ s32* msgEventScript; + /* 0x1E0 */ s32 msgEventArg4; + /* 0x1E4 */ Vec3s jointTable[POSTBOX_LIMB_MAX]; + /* 0x1F6 */ Vec3s morphTable[POSTBOX_LIMB_MAX]; + /* 0x208 */ u16 stateFlags; + /* 0x20A */ UNK_TYPE1 pad20A[4]; + /* 0x20E */ s16 behaviour; + /* 0x210 */ MsgEventFunc msgEventCallback; + /* 0x214 */ s32 unk214; // Set and not used + /* 0x218 */ s32 exchangeItemId; + /* 0x21C */ s32 isLetterToKafeiDeposited; } EnPst; // size = 0x220 extern const ActorInit En_Pst_InitVars; diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index b7a417531..fce03f2b8 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -214,11 +214,12 @@ f32 func_80BCD4D0(Path* path, s32 count, Vec3f* arg2, Vec3s* arg3) { } void func_80BCD590(EnScopecrow* this, PlayState* play) { - Vec3f sp1C; + Vec3f screenPos; - func_80169474(play, &this->actor.world.pos, &sp1C); + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); - if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f) && (sp1C.y < 150.0f)) { + if ((screenPos.x >= 130.0f) && (screenPos.x < (SCREEN_WIDTH - 130.0f)) && (screenPos.y >= 90.0f) && + (screenPos.y < (SCREEN_HEIGHT - 90.0f))) { this->actor.draw = EnScopecrow_Draw; this->actionFunc = func_80BCD640; } diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 2954bc041..b110161d5 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -190,11 +190,11 @@ s16 func_80BCAF0C(EnScopenuts* this) { } void func_80BCAFA8(EnScopenuts* this, PlayState* play) { - Vec3f sp1C; + Vec3f screenPos; - func_80169474(play, &this->actor.world.pos, &sp1C); - if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f)) { - if (sp1C.y < 150.0f) { + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); + if ((screenPos.x >= 130.0f) && (screenPos.x < (SCREEN_WIDTH - 130.0f)) && (screenPos.y >= 90.0f)) { + if (screenPos.y < (SCREEN_HEIGHT - 90.0f)) { this->actor.draw = EnScopenuts_Draw; this->unk_348 = 10; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 10); diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index 962925216..4a051fc23 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -5,6 +5,12 @@ */ #include "z_en_test2.h" +#include "objects/object_dekucity_ana_obj/object_dekucity_ana_obj.h" +#include "objects/object_sichitai_obj/object_sichitai_obj.h" +#include "objects/object_yukimura_obj/object_yukimura_obj.h" +#include "objects/object_hakugin_obj/object_hakugin_obj.h" +#include "objects/object_meganeana_obj/object_meganeana_obj.h" +#include "objects/object_haka_obj/object_haka_obj.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80) @@ -12,8 +18,15 @@ void EnTest2_Init(Actor* thisx, PlayState* play); void EnTest2_Update(Actor* thisx, PlayState* play); +void EnTest2_UpdateForLens(Actor* thisx, PlayState* play); +void EnTest2_Draw(Actor* thisx, PlayState* play); + +typedef struct EnTest2ModelInfo { + /* 0x0 */ Gfx* dList1; + /* 0x4 */ Gfx* dList2; + /* 0x8 */ AnimatedMaterial* animMat; +} EnTest2ModelInfo; // size = 0xC -#if 0 const ActorInit En_Test2_InitVars = { ACTOR_EN_TEST2, ACTORCAT_BG, @@ -26,22 +39,105 @@ const ActorInit En_Test2_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A3E74C[] = { +static EnTest2ModelInfo sModelInfo[] = { + { object_dekucity_ana_obj_DL_000040, NULL, NULL }, + { object_sichitai_obj_DL_001820, NULL, NULL }, + { object_yukimura_obj_DL_0008C0, NULL, NULL }, + { object_hakugin_obj_DL_0016D8, NULL, object_hakugin_obj_Matanimheader_0017A8 }, + { object_hakugin_obj_DL_002018, NULL, object_hakugin_obj_Matanimheader_0020E8 }, + { object_hakugin_obj_DL_005268, NULL, object_hakugin_obj_Matanimheader_005338 }, + { object_meganeana_obj_DL_000110, object_meganeana_obj_DL_000080, NULL }, + { object_haka_obj_DL_000F70, NULL, NULL }, + { object_haka_obj_DL_001200, NULL, NULL }, + { object_hakugin_obj_DL_004928, NULL, object_hakugin_obj_Matanimheader_0049F8 }, + { object_hakugin_obj_DL_002978, NULL, object_hakugin_obj_Matanimheader_002A58 }, + { object_hakugin_obj_DL_000D38, NULL, object_hakugin_obj_Matanimheader_000E48 }, + { object_hakugin_obj_DL_0035A8, NULL, object_hakugin_obj_Matanimheader_003888 }, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP), }; -#endif +static s16 sObjectIds[] = { + OBJECT_DEKUCITY_ANA_OBJ, OBJECT_SICHITAI_OBJ, OBJECT_YUKIMURA_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, + OBJECT_HAKUGIN_OBJ, OBJECT_MEGANEANA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKUGIN_OBJ, + OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, +}; -extern InitChainEntry D_80A3E74C[]; +void EnTest2_Init(Actor* thisx, PlayState* play) { + EnTest2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + if ((this->actor.params == EN_TEST2_PARAMS_B) || (this->actor.params == EN_TEST2_PARAMS_C)) { + this->actor.flags |= ACTOR_FLAG_20; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Update.s") +void EnTest2_Update(Actor* thisx, PlayState* play) { + s32 pad; + s32 objectIndex; + EnTest2ModelInfo* modelInfo; + EnTest2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E4EC.s") + objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[this->actor.params]); + if (objectIndex < 0) { + Actor_MarkForDeath(&this->actor); + return; + } + if (Object_IsLoaded(&play->objectCtx, objectIndex)) { + modelInfo = &sModelInfo[this->actor.params]; + this->actor.objBankIndex = objectIndex; + this->actor.draw = EnTest2_Draw; + if (modelInfo->animMat != NULL) { + Actor_SetObjectDependency(play, &this->actor); + this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); + } + if (play->roomCtx.currRoom.unk5) { + this->actor.update = EnTest2_UpdateForLens; + } else { + this->actor.update = Actor_Noop; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E524.s") +void EnTest2_UpdateForLens(Actor* thisx, PlayState* play) { + EnTest2* this = THIS; + + if (play->actorCtx.unk4 == 100) { + this->actor.flags |= ACTOR_FLAG_80; + } else { + this->actor.flags &= ~ACTOR_FLAG_80; + } +} + +void EnTest2_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnTest2* this = THIS; + Gfx* dList = sModelInfo[this->actor.params].dList2; + + if (this->animMat != NULL) { + AnimatedMat_Draw(play, this->animMat); + } + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (dList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, dList); + } + gSPDisplayList(POLY_XLU_DISP++, sModelInfo[this->actor.params].dList1); + + CLOSE_DISPS(play->state.gfxCtx); + } else { + if (dList != NULL) { + Gfx_DrawDListXlu(play, dList); + } + Gfx_DrawDListOpa(play, sModelInfo[this->actor.params].dList1); + } +} diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.h b/src/overlays/actors/ovl_En_Test2/z_en_test2.h index b8eabec2c..ccbba11e7 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.h +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.h @@ -7,9 +7,14 @@ struct EnTest2; typedef struct EnTest2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ AnimatedMaterial* animMat; } EnTest2; // size = 0x148 +typedef enum { + /* 0xB */ EN_TEST2_PARAMS_B = 0xB, + /* 0xC */ EN_TEST2_PARAMS_C +} EnTest2_Params; + extern const ActorInit En_Test2_InitVars; #endif // Z_EN_TEST2_H diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index cc96be020..17587b32a 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -577,7 +577,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { VEC3F_LERPIMPDST(&subCamEye, &subCam->eye, &sp54, sp4C); - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } else if ((this->unk_27A < 11) && (this->unk_27A > 0)) { subCam->fov += (mainCam->fov - subCam->fov) / this->unk_27A; } @@ -750,9 +750,9 @@ void func_80A92188(EnTest6* this, PlayState* play) { } else if (this->unk_27A < 16) { subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); - Play_CameraSetAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); - Play_CameraSetFov(play, subCamId, this->subCamFov); - Play_CameraSetRoll(play, subCamId, 0); + Play_SetCameraAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); + Play_SetCameraFov(play, subCamId, this->subCamFov); + Play_SetCameraRoll(play, subCamId, 0); } switch (this->unk_27A) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 3969f9c6e..21302d512 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -359,17 +359,18 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) { // type 4_2 pirates fortres only? void func_80967060(EnWeatherTag* this, PlayState* play) { - Vec3f vec1; - Vec3f vec2; + Vec3f worldPos; + Vec3f screenPos; - vec1.x = 1055.0f; - vec1.y = -145.0f; - vec1.z = 181.0f; + worldPos.x = 1055.0f; + worldPos.y = -145.0f; + worldPos.z = 181.0f; - func_80169474(play, &vec1, &vec2); + Play_GetScreenPos(play, &worldPos, &screenPos); if (play->view.fovy < 25.0f) { - if ((vec2.x >= 70.0f) && (vec2.x < 250.0f) && (vec2.y >= 30.0f) && (vec2.y < 210.0f)) { + if ((screenPos.x >= 70.0f) && (screenPos.x < (SCREEN_WIDTH - 70.0f)) && (screenPos.y >= 30.0f) && + (screenPos.y < (SCREEN_HEIGHT - 30.0f))) { EnWeatherTag_SetupAction(this, func_80967148); } } diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c index 6acbc2689..215b63776 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c @@ -15,7 +15,6 @@ void MirRay2_Destroy(Actor* thisx, PlayState* play); void MirRay2_Update(Actor* thisx, PlayState* play); void MirRay2_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Mir_Ray2_InitVars = { ACTOR_MIR_RAY2, ACTORCAT_ITEMACTION, @@ -28,33 +27,102 @@ const ActorInit Mir_Ray2_InitVars = { (ActorFunc)MirRay2_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80AF4350[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0x00200000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00200000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 0, { { 0, 0, 0 }, 50 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80AF4374 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_OTHER, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80AF4350, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_OTHER, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; -#endif +void func_80AF3F70(MirRay2* this) { + this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements->dim.worldSphere.center.y = this->actor.world.pos.y; + this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; + this->collider.elements->dim.worldSphere.radius = this->range * this->collider.elements->dim.scale; +} -extern ColliderJntSphElementInit D_80AF4350[1]; -extern ColliderJntSphInit D_80AF4374; +void func_80AF3FE0(MirRay2* this, PlayState* play) { + if (this->actor.xzDistToPlayer < this->range) { + Math_StepToS(&this->radius, 150, 50); + } else { + Math_StepToS(&this->radius, 0, 50); + } + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, + this->actor.world.pos.z, 255, 255, 255, this->radius); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3F70.s") +void MirRay2_Init(Actor* thisx, PlayState* play) { + s32 pad; + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3FE0.s") + if (this->actor.home.rot.x <= 0) { + this->range = 100.0f; + } else { + this->range = this->actor.home.rot.x * 4.0f; + } + Actor_SetScale(&this->actor, 1.0f); + if (MIRRAY2_GET_F(&this->actor) != 1) { + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawWhiteCircle, this->range * 0.02f); + } + func_80AF3FE0(this, play); + this->light = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->elements); + func_80AF3F70(this); + this->actor.shape.rot.x = 0; + this->actor.world.rot.x = this->actor.shape.rot.x; + if (MIRRAY2_GET_F(thisx) != 1) { + if ((MIRRAY2_GET_SWITCH_FLAGS(thisx) != 0x7F) && !Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) { + this->unk1A4 |= 1; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Init.s") +void MirRay2_Destroy(Actor* thisx, PlayState* play) { + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Destroy.s") + LightContext_RemoveLight(play, &play->lightCtx, this->light); + Collider_DestroyJntSph(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Update.s") +void MirRay2_Update(Actor* thisx, PlayState* play) { + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Draw.s") + if (this->unk1A4 & 1) { + if (Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) { + this->unk1A4 &= ~1; + } + } else { + func_80AF3FE0(this, play); + if (MIRRAY2_GET_F(thisx) != 1) { + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + this->actor.shape.shadowAlpha = 0x50; + } else { + func_80AF3F70(this); + } + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } +} + +void MirRay2_Draw(Actor* thisx, PlayState* play) { +} diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h index 26f478ea3..ac5202bdb 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h @@ -5,9 +5,18 @@ struct MirRay2; +#define MIRRAY2_GET_F(thisx) ((thisx)->params & 0xF) +#define MIRRAY2_GET_SWITCH_FLAGS(thisx) (((thisx)->params & 0xFE00) >> 9) + typedef struct MirRay2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x7C]; + /* 0x144 */ ColliderJntSph collider; + /* 0x164 */ ColliderJntSphElement elements; + /* 0x1A4 */ u16 unk1A4; + /* 0x1A6 */ s16 radius; + /* 0x1A8 */ f32 range; + /* 0x1AC */ LightNode* light; + /* 0x1B0 */ LightInfo lightInfo; } MirRay2; // size = 0x1C0 extern const ActorInit Mir_Ray2_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 7c7359040..f0049800d 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -288,8 +288,10 @@ void ObjAqua_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZS(rotation * -1, MTXMODE_APPLY); Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, MTXMODE_APPLY); } + Matrix_RotateYS(yaw, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 7bfeaf96c..db26a87d2 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -429,7 +429,7 @@ void ObjChan_DrawFire(ObjChan* this, PlayState* play) { gSPSegment(&dl[1], 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -sp4C * 20, 32, 128)); gDPSetPrimColor(&dl[2], 128, 128, 255, 255, 0, 255); gDPSetEnvColor(&dl[3], 255, 0, 0, 0); - gSPDisplayList(&dl[4], &gGameplayKeepDrawFlameDL); + gSPDisplayList(&dl[4], gEffFire1DL); POLY_XLU_DISP = &dl[5]; CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index fb395f8d0..be3f365e3 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -15,7 +15,12 @@ void ObjDanpeilift_Destroy(Actor* thisx, PlayState* play); void ObjDanpeilift_Update(Actor* thisx, PlayState* play); void ObjDanpeilift_Draw(Actor* thisx, PlayState* play); -#if 0 +void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index); +void ObjDanpeilift_DoNothing(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Teleport(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Wait(ObjDanpeilift* this, PlayState* play); + const ActorInit Obj_Danpeilift_InitVars = { ACTOR_OBJ_DANPEILIFT, ACTORCAT_BG, @@ -28,35 +33,171 @@ const ActorInit Obj_Danpeilift_InitVars = { (ActorFunc)ObjDanpeilift_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1B540[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index) { + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]); +} -extern InitChainEntry D_80C1B540[]; +void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { + Path* path; + ObjDanpeiliftActionFunc tempActionFunc; + ObjDanpeilift* this = THIS; -extern UNK_TYPE D_06000180; -extern UNK_TYPE D_06000BA0; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + this->dyna.actor.shape.rot.x = 0; + this->dyna.actor.world.rot.x = 0; + this->dyna.actor.shape.rot.z = 0; + this->dyna.actor.world.rot.z = 0; + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_obj_danpeilift_Colheader_000BA0); + if (this->dyna.bgId == BG_ACTOR_MAX) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + this->speed = OBJDANPEILIFT_GET_SPEED(thisx); + if (this->speed < 0.0f) { + this->speed = -this->speed; + } + if (this->speed < 0.01f) { + this->actionFunc = ObjDanpeilift_DoNothing; + } else { + path = &play->setupPathList[OBJDANPEILIFT_GET_PATH(thisx)]; + this->curPoint = OBJDANPEILIFT_GET_STARTING_POINT(thisx); + this->endPoint = path->count - 1; + this->direction = 1; + this->points = Lib_SegmentedToVirtual(path->points); + ObjDanpeilift_UpdatePosition(this, this->curPoint); + this->actionFunc = ObjDanpeilift_Move; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1ADC0.s") +void ObjDanpeilift_Destroy(Actor* thisx, PlayState* play) { + ObjDanpeilift* this = THIS; + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Init.s") +void ObjDanpeilift_DoNothing(ObjDanpeilift* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Destroy.s") +void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { + Actor* thisx = &this->dyna.actor; + Vec3f nextPoint; + f32 speed; + f32 target; + f32 step; + s32 isTeleporting; + s32 isPosUpdated; + Vec3s* endPoint; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1AF84.s") + Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction); + Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity); + speed = Math3D_Vec3fMagnitude(&thisx->velocity); + if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) { + target = ((this->speed - 2.0f) * 0.1f) + 2.0f; + step = this->speed * 0.03f; + } else { + target = this->speed; + step = this->speed * 0.16f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1AF94.s") + Math_StepToF(&thisx->speedXZ, target, step); + if ((thisx->speedXZ + 0.05f) < speed) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / speed); + thisx->world.pos.x += thisx->velocity.x; + thisx->world.pos.y += thisx->velocity.y; + thisx->world.pos.z += thisx->velocity.z; + } else { + this->curPoint += this->direction; + thisx->speedXZ *= 0.4f; + isTeleporting = OBJDANPEILIFT_SHOULD_TELEPORT(thisx); + isPosUpdated = true; + if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || + ((this->curPoint <= 0) && (this->direction < 0))) { + if (!isTeleporting) { + this->direction = -this->direction; + this->waitTimer = 10; + this->actionFunc = ObjDanpeilift_Wait; + } else { + endPoint = &this->points[this->endPoint]; + this->curPoint = this->direction > 0 ? 0 : this->endPoint; + if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || + (this->points[0].z != endPoint->z)) { + this->actionFunc = ObjDanpeilift_Teleport; + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + isPosUpdated = false; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1B210.s") + if (isPosUpdated) { + ObjDanpeilift_UpdatePosition(this, this->curPoint); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1B26C.s") +void ObjDanpeilift_Teleport(ObjDanpeilift* this, PlayState* play) { + if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + ObjDanpeilift_UpdatePosition(this, this->curPoint); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + this->actionFunc = ObjDanpeilift_Move; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Update.s") +void ObjDanpeilift_Wait(ObjDanpeilift* this, PlayState* play) { + this->waitTimer--; + if (this->waitTimer <= 0) { + this->actionFunc = ObjDanpeilift_Move; + this->dyna.actor.speedXZ = 0.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Draw.s") +void ObjDanpeilift_Update(Actor* thisx, PlayState* play) { + f32 step; + ObjDanpeilift* this = THIS; + + this->actionFunc(this, play); + Actor_SetFocus(&this->dyna.actor, 10.0f); + if (this->cutsceneTimer > 0) { + this->cutsceneTimer--; + if (this->cutsceneTimer == 0) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + } + } + if (OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx)) { + f32 target; + + this->isWeightOnPrev = this->isWeightOn; + this->isWeightOn = DynaPolyActor_IsInRidingMovingState(&this->dyna) ? 1 : 0; + if ((this->isWeightOn != this->isWeightOnPrev) && (this->maxHeight < 1.0f)) { + this->cycle = -0x8000; + this->maxHeight = 6.0f; + } + this->cycle += 0xCE4; + Math_StepToF(&this->maxHeight, 0.0f, 0.12f); + step = this->isWeightOn ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f + : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; + target = this->isWeightOn ? -8.0f : 0.0f; + Math_StepToF(&this->cycleSpeed, target, step); + this->dyna.actor.shape.yOffset = ((Math_SinS(this->cycle) * this->maxHeight) + this->cycleSpeed) * 10.0f; + } + if ((OBJDANPEILIFT_GET_TYPE(thisx) == 1) && (this->dyna.actor.child != NULL)) { + if (this->dyna.actor.child->update == NULL) { + this->dyna.actor.child = NULL; + } else { + this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x; + this->dyna.actor.child->world.pos.y = + this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y); + this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z; + } + } +} + +void ObjDanpeilift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_obj_danpeilift_DL_000180); +} diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 8b915a184..31f6b90c4 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -2,16 +2,34 @@ #define Z_OBJ_DANPEILIFT_H #include "global.h" +#include "objects/object_obj_danpeilift/object_obj_danpeilift.h" struct ObjDanpeilift; typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, PlayState*); +#define OBJDANPEILIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) +#define OBJDANPEILIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) +#define OBJDANPEILIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) +#define OBJDANPEILIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) +#define OBJDANPEILIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) +#define OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx) (((thisx)->params >> 0xE) & 1) + typedef struct ObjDanpeilift { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjDanpeiliftActionFunc actionFunc; - /* 0x160 */ char unk_160[0x2C]; + /* 0x160 */ f32 speed; + /* 0x164 */ s32 endPoint; + /* 0x168 */ s32 curPoint; + /* 0x16C */ s32 direction; + /* 0x170 */ Vec3s* points; + /* 0x174 */ s32 isWeightOn; + /* 0x178 */ s32 isWeightOnPrev; + /* 0x17C */ f32 cycleSpeed; + /* 0x180 */ f32 maxHeight; + /* 0x184 */ s16 cycle; + /* 0x186 */ s16 waitTimer; + /* 0x188 */ s16 cutsceneTimer; } ObjDanpeilift; // size = 0x18C extern const ActorInit Obj_Danpeilift_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 45503c0de..0210b5ba7 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -354,7 +354,7 @@ void ObjIcePoly_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, 0, (play->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_148); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c index cc65a7730..21b764593 100644 --- a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c +++ b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c @@ -204,7 +204,7 @@ void ObjJgameLight_Draw(Actor* thisx, PlayState* play) { MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 6c2d8a356..90aa5fa40 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -14,7 +14,10 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play); void ObjMakekinsuta_Update(Actor* thisx, PlayState* play); -#if 0 +s32 func_8099FA40(ObjMakekinsuta* this, PlayState* play); +void func_8099FB64(Actor* thisx, PlayState* play); +void func_8099FD7C(Actor* thisx, PlayState* play); + const ActorInit Obj_Makekinsuta_InitVars = { ACTOR_OBJ_MAKEKINSUTA, ACTORCAT_ITEMACTION, @@ -27,25 +30,112 @@ const ActorInit Obj_Makekinsuta_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8099FE30[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1, ICHAIN_STOP), }; -#endif +s32 func_8099FA40(ObjMakekinsuta* this, PlayState* play) { + s32 chestFlag = -1; + s32 skulltulaParams = (OBJMAKEKINSUTA_GET_1F(&this->actor) << 2) | 0xFF01; -extern InitChainEntry D_8099FE30[]; + if (OBJMAKEKINSUTA_GETS_3(skulltulaParams)) { + chestFlag = OBJMAKEKINSUTA_GETS_3FC(skulltulaParams); + } + return (chestFlag < 0) == true || !Flags_GetTreasure(play, chestFlag); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FA40.s") +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + if (!func_8099FA40(this, play)) { + this->unk144 = -1; + } + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + Actor_MarkForDeath(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Destroy.s") +void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FB64.s") + if (func_8099FA40(this, play)) { + Flags_UnsetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Update.s") +void func_8099FB64(Actor* thisx, PlayState* play) { + s32 pad[0x2]; + Actor* actor; + Vec3f destVec; + s16 rotY; + f32 speedXZ; + s32 rotCheck; + static Vec3f D_8099FE3C = { 0.0f, 1.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FD7C.s") + rotCheck = thisx->shape.rot.x == 0; + if (rotCheck) { + rotCheck = thisx->shape.rot.z == 0; + } + + if (rotCheck) { + rotY = thisx->shape.rot.y; + } else { + Matrix_RotateYS(thisx->shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(thisx->shape.rot.x, MTXMODE_APPLY); + Matrix_RotateZS(thisx->shape.rot.z, MTXMODE_APPLY); + Matrix_MultVec3f(&D_8099FE3C, &destVec); + rotY = Math_FAtan2F(destVec.z, destVec.x); + } + actor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, + 0, rotY, 0, (OBJMAKEKINSUTA_GET_1F(thisx) << 2) | 0xFF01); + if (actor != NULL) { + actor->parent = thisx; + if (rotCheck) { + actor->velocity.y = 10.0f; + actor->speedXZ = 3.0f; + } else { + speedXZ = sqrtf((destVec.x * destVec.x) + (destVec.z * destVec.z)); + actor->velocity.y = (4 * destVec.y) + 4.0f; + actor->speedXZ = (2 * speedXZ) + 2.0f; + } + } +} + +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; + + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + this->actor.update = func_8099FD7C; + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } else { + if (this->unk144 >= 0) { + if (this->unk144 == 0) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + if (Rand_ZeroOne() < 0.1f) { + this->unk144 = Rand_S16Offset(0x28, 0x50); + } else { + this->unk144 = 8; + } + } else { + this->unk144--; + } + } + } +} + +void func_8099FD7C(Actor* thisx, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(thisx->cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx); + if (thisx->cutscene >= 0) { + func_800B7298(play, thisx, 4); + } + func_8099FB64(thisx, play); + thisx->update = Actor_Noop; + thisx->flags &= ~ACTOR_FLAG_10; + } else { + ActorCutscene_SetIntentToPlay(thisx->cutscene); + } +} diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h index 57c855179..d5bc998f0 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h @@ -5,9 +5,14 @@ struct ObjMakekinsuta; +#define OBJMAKEKINSUTA_GET_1F(thisx) (((thisx)->params >> 8) & 0x1F) +#define OBJMAKEKINSUTA_GETS_3(params) ((params & 3) & 0xFF) +#define OBJMAKEKINSUTA_GETS_3FC(params) (((params & 0x3FC) >> 2) & 0xFF) +#define OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx) ((thisx)->params & 0x7F) + typedef struct ObjMakekinsuta { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s8 unk144; } ObjMakekinsuta; // size = 0x148 extern const ActorInit Obj_Makekinsuta_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index c8a5188b0..edefba93a 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -14,11 +14,13 @@ void ObjMure3_Init(Actor* thisx, PlayState* play); void ObjMure3_Destroy(Actor* thisx, PlayState* play); void ObjMure3_Update(Actor* thisx, PlayState* play); +void func_8098F598(ObjMure3* this); void func_8098F5AC(ObjMure3* this, PlayState* play); +void func_8098F5D0(ObjMure3* this); void func_8098F5E4(ObjMure3* this, PlayState* play); +void func_8098F66C(ObjMure3* this); void func_8098F680(ObjMure3* this, PlayState* play); -#if 0 const ActorInit Obj_Mure3_InitVars = { ACTOR_OBJ_MURE3, ACTORCAT_BG, @@ -31,41 +33,168 @@ const ActorInit Obj_Mure3_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8098F748[] = { +static s16 sRupeeCounts[] = { 5, 5, 7, 0 }; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -#endif +void func_8098F040(ObjMure3* this, PlayState* play) { + s32 i; + Vec3f spawnPos; -extern InitChainEntry D_8098F748[]; + Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos); + for (i = 0; i < 5; i++, spawnPos.y += 20.0f) { + if (!((this->unk164 >> i) & 1)) { + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x10001); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F040.s") +void func_8098F110(ObjMure3* this, PlayState* play) { + s32 i; + Vec3f spawnPos; + f32 sin = Math_SinS(this->actor.world.rot.y); + f32 cos = Math_CosS(this->actor.world.rot.y); + f32 dist; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F110.s") + spawnPos.y = this->actor.world.pos.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F220.s") + for (i = 0, dist = -40.0f; i < 5; i++, dist += 20.0f) { + if (!((this->unk164 >> i) & 1)) { + spawnPos.x = this->actor.world.pos.x + (sin * dist); + spawnPos.z = this->actor.world.pos.z + (cos * dist); + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x4000); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F364.s") +void func_8098F220(ObjMure3* this, PlayState* play) { + s16 yRot; + Vec3f spawnPos; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F438.s") + spawnPos.y = this->actor.world.pos.y; + yRot = this->actor.world.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Init.s") + for (i = 0; i < 6; i++) { + if (!((this->unk164 >> i) & 1)) { + spawnPos.x = (Math_SinS(yRot) * 40.0f) + this->actor.world.pos.x; + spawnPos.z = (Math_CosS(yRot) * 40.0f) + this->actor.world.pos.z; + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x4000); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + yRot += 0x2AAA; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Destroy.s") + if (!((this->unk164 >> 6) & 1)) { + spawnPos.x = this->actor.world.pos.x; + spawnPos.z = this->actor.world.pos.z; + this->unk160 = Item_DropCollectible2(play, &spawnPos, 0x4002); + if (this->unk160 != NULL) { + this->unk160->room = this->actor.room; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F598.s") +void func_8098F364(ObjMure3* this, s32 play) { + s16 count = sRupeeCounts[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)]; + s32 i; + EnItem00** collectible; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5AC.s") + for (i = 0; i < count; i++) { + collectible = &this->unk148[i]; + if ((!((this->unk164 >> i) & 1)) && (*collectible != NULL)) { + if (((*collectible)->unk1A4 != 0) || ((*collectible)->actor.update == NULL)) { + this->unk164 |= (1 << i); + } else { + Actor_MarkForDeath(&(*collectible)->actor); + } + } + *collectible = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5D0.s") +void func_8098F438(ObjMure3* this, PlayState* play) { + s16 count = sRupeeCounts[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)]; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5E4.s") + for (i = 0; i < count; i++) { + EnItem00** collectible = &this->unk148[i]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F66C.s") + if ((*collectible != NULL) && !((this->unk164 >> i) & 1)) { + if ((*collectible)->unk1A4 != 0) { + Flags_SetSwitch(play, OBJMURE3_PARAMS_7F(&this->actor)); + } + if ((*collectible)->actor.update == NULL) { + this->unk164 |= (1 << i); + this->unk148[i] = NULL; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F680.s") +void ObjMure3_Init(Actor* thisx, PlayState* play) { + ObjMure3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Update.s") + if (Flags_GetSwitch(play, OBJMURE3_PARAMS_7F(&this->actor))) { + Actor_MarkForDeath(&this->actor); + return; + } + Actor_ProcessInitChain(&this->actor, sInitChain); + func_8098F598(this); +} + +void ObjMure3_Destroy(Actor* thisx, PlayState* play) { +} + +void func_8098F598(ObjMure3* this) { + this->actionFunc = func_8098F5AC; +} + +void func_8098F5AC(ObjMure3* this, PlayState* play) { + func_8098F5D0(this); +} + +void func_8098F5D0(ObjMure3* this) { + this->actionFunc = func_8098F5E4; +} + +void func_8098F5E4(ObjMure3* this, PlayState* play) { + static ObjMure3SpawnFunc sSpawnFuncs[] = { func_8098F040, func_8098F110, func_8098F220 }; + + if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) { + this->actor.flags |= ACTOR_FLAG_10; + sSpawnFuncs[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)](this, play); + func_8098F66C(this); + } +} + +void func_8098F66C(ObjMure3* this) { + this->actionFunc = func_8098F680; +} + +void func_8098F680(ObjMure3* this, PlayState* play) { + func_8098F438(this, play); + if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) >= SQ(1450.0f)) { + this->actor.flags &= ~ACTOR_FLAG_10; + func_8098F364(this, play); + func_8098F5D0(this); + } +} + +void ObjMure3_Update(Actor* thisx, PlayState* play) { + ObjMure3* this = THIS; + + this->actionFunc(this, play); +} diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h index d21751198..2b6c4f891 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -3,14 +3,20 @@ #include "global.h" +#define OBJMURE3_PARAMS_7F(thisx) ((thisx)->params & 0x7F) +#define OBJMURE3_PARAMS_RUPEEINDEX(thisx) (((thisx)->params >> 13) & 7) + struct ObjMure3; typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); +typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, PlayState*); typedef struct ObjMure3 { /* 0x000 */ Actor actor; /* 0x144 */ ObjMure3ActionFunc actionFunc; - /* 0x148 */ char unk_148[0x20]; + /* 0x148 */ EnItem00* unk148[6]; + /* 0x160 */ Actor* unk160; + /* 0x164 */ u16 unk164; } ObjMure3; // size = 0x168 extern const ActorInit Obj_Mure3_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c index 9d3476ff6..6a5298728 100644 --- a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c +++ b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c @@ -19,11 +19,11 @@ void ObjRotlift_Draw(Actor* thisx, PlayState* play); void ObjRotlift_MoveDekuFlowers(ObjRotlift* this); -typedef struct ModelInfo { +typedef struct ObjRotliftModelInfo { /* 0x0 */ Gfx* dList; /* 0x4 */ AnimatedMaterial* animMat; /* 0x8 */ CollisionHeader* colHeader; -} ModelInfo; // size = 0xC +} ObjRotliftModelInfo; // size = 0xC const ActorInit Obj_Rotlift_InitVars = { ACTOR_OBJ_ROTLIFT, @@ -37,7 +37,7 @@ const ActorInit Obj_Rotlift_InitVars = { (ActorFunc)ObjRotlift_Draw, }; -struct ModelInfo sModelInfo[] = { +struct ObjRotliftModelInfo sModelInfo[] = { { gDekuMoonDungeonRotatingPlatformsDL, gDekuMoonDungeonRotatingPlatformsUnusedTexAnim, @@ -87,7 +87,7 @@ void ObjRotlift_Init(Actor* thisx, PlayState* play2) { s32 type = OBJROTLIFT_GET_TYPE(&this->dyna.actor); s32 dekuFlowerParams; s32 i; - ModelInfo* modelInfo; + ObjRotliftModelInfo* modelInfo; ObjEtcetera** dekuFlowers; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -146,7 +146,7 @@ void ObjRotlift_Update(Actor* thisx, PlayState* play) { void ObjRotlift_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjRotlift* this = THIS; - ModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)]; + ObjRotliftModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)]; // Neither of the displaylists reference other segments, so this call is ultimately pointless. AnimatedMat_Draw(play, modelInfo->animMat); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 61a6c1bce..c14a5213a 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -315,8 +315,9 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY); Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - thisx->shape.rot.y), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 32a44878b..9aadc668c 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -1,10 +1,15 @@ /* * File: z_obj_taru.c * Overlay: ovl_Obj_Taru - * Description: Wooden Barrel + * Description: Wooden Barrel and Breakable Pirate Panel */ #include "z_obj_taru.h" +#include "overlays/actors/ovl_En_Sw/z_en_sw.h" +#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h" +#include "objects/object_taru/object_taru.h" +#include "objects/object_kibako2/object_kibako2.h" #define FLAGS 0x00000000 @@ -15,7 +20,10 @@ void ObjTaru_Destroy(Actor* thisx, PlayState* play); void ObjTaru_Update(Actor* thisx, PlayState* play); void ObjTaru_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80B9C07C(ObjTaru* this, PlayState* play); +void func_80B9C174(ObjTaru* this, PlayState* play); +void func_80B9C1A0(ObjTaru* this, PlayState* play); + const ActorInit Obj_Taru_InitVars = { ACTOR_OBJ_TARU, ACTORCAT_BG, @@ -28,55 +36,309 @@ const ActorInit Obj_Taru_InitVars = { (ActorFunc)ObjTaru_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B9C340 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x80000508, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x80000508, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 30, 50, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B9C36C[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 3300, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -#endif +s32 func_80B9B6E0(ObjTaru* this, PlayState* play) { + s32 chestFlag = -1; + s32 skulltulaParams = (OBJ_TSUBO_P001F(&this->dyna.actor) * 4) | 0xFF01; -extern ColliderCylinderInit D_80B9C340; -extern InitChainEntry D_80B9C36C[]; + if (ENSW_GETS_3(skulltulaParams)) { + chestFlag = ENSW_GETS_3FC(skulltulaParams); + } -extern UNK_TYPE D_06000420; -extern UNK_TYPE D_06001040; -extern UNK_TYPE D_06001100; -extern UNK_TYPE D_06001CB0; + return (chestFlag < 0) == true || !Flags_GetTreasure(play, chestFlag); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B6E0.s") +void func_80B9B74C(ObjTaru* this, PlayState* play) { + s32 pad[2]; + Vec3f* thisPos = &this->dyna.actor.world.pos; + Vec3f pos; + Vec3f velocity; + s16 angle; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B74C.s") + for (i = 0, angle = 0; i < 0x10; i++, angle += 0x4E20) { + f32 sin = Math_SinS(angle); + f32 cos = Math_CosS(angle); + f32 tempRand = Rand_ZeroOne() * 30.0f; + s32 phi_s0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B9C8.s") + pos.x = sin * tempRand; + pos.y = (Rand_ZeroOne() * 10.0f) + 2.0f; + pos.z = cos * tempRand; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BC64.s") + velocity.x = pos.x * 0.2f; + velocity.y = (Rand_ZeroOne() * 10.0f) + 2.0f; + velocity.z = pos.z * 0.2f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BCBC.s") + pos.x += thisPos->x; + pos.y += thisPos->y; + pos.z += thisPos->z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BD84.s") + tempRand = Rand_ZeroOne(); + if (tempRand < 0.05f) { + phi_s0 = 0x60; + } else if (tempRand < 0.7f) { + phi_s0 = 0x40; + } else { + phi_s0 = 0x20; + } + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, 0, + 70, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragment1DL); + } + func_800BBFB0(play, thisPos, 90.0f, 6, 100, 160, 1); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Init.s") +void func_80B9B9C8(ObjTaru* this, PlayState* play) { + s32 phi_s5; + s32 i; + s32 j; + Vec3f spD8; + Vec3f spCC; + s32 pad[2]; + f32 sin; + f32 cos; + s32 phi_fp; + Vec3f* thisPos = &this->dyna.actor.world.pos; + f32 temp_fs0; + f32 temp_fs1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Destroy.s") + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BF7C.s") + if (OBJ_TARU_GET_100(&this->dyna.actor)) { + phi_fp = 0; + phi_s5 = 8; + } else { + phi_fp = 2; + phi_s5 = 6; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C07C.s") + for (i = 0; i < 4; i++) { + for (j = phi_fp; j < phi_s5; j++) { + temp_fs0 = randPlusMinusPoint5Scaled(10.0f) + -105.0f + (j * 30.0f); + temp_fs1 = randPlusMinusPoint5Scaled(4.0f); + spD8.x = temp_fs0 * cos; + spD8.y = randPlusMinusPoint5Scaled(10.0f) + 15.0f + (i * 30.0f); + spD8.z = temp_fs0 * sin; + spCC.x = (spD8.x * 0.05f) + (temp_fs1 * sin); + spCC.y = Rand_ZeroFloat(5.0f) + 2.0f; + spCC.z = (spD8.z * 0.05f) + (temp_fs1 * cos); + spD8.x += thisPos->x; + spD8.y += thisPos->y; + spD8.z += thisPos->z; + EffectSsKakera_Spawn(play, &spD8, &spCC, &spD8, -0x64, 0x20, 0x1C, 4, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, + 0, 0x5A, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragment2DL); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C174.s") +void func_80B9BC64(ObjTaru* this, PlayState* play) { + s32 item; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C1A0.s") + item = func_800A8150(OBJ_TARU_GET_3F(&this->dyna.actor)); + if (item >= 0) { + Item_DropCollectible(play, &this->dyna.actor.world.pos, (OBJ_TARU_GET_7F00(&this->dyna.actor) << 8) | item); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Update.s") +void func_80B9BCBC(ObjTaru* this, PlayState* play) { + s32 pad; + s32 params1F; + Actor* spawnedActor; + s16 rotY; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Draw.s") + if (func_80B9B6E0(this, play)) { + params1F = (OBJ_TARU_GET_1F(&this->dyna.actor) * 4) | 0xFF01; + rotY = (Rand_Next() >> 0x11) + this->dyna.actor.yawTowardsPlayer + 0xC000; + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, rotY, 0, params1F); + if (spawnedActor != NULL) { + spawnedActor->parent = &this->dyna.actor; + spawnedActor->velocity.y = 12.0f; + spawnedActor->speedXZ = 2.0f; + } + } +} + +void func_80B9BD84(ObjTaru* this, PlayState* play) { + if (!OBJ_TARU_GET_8000(&this->dyna.actor)) { + func_80B9BC64(this, play); + } else { + func_80B9BCBC(this, play); + } +} + +void ObjTaru_Init(Actor* thisx, PlayState* play) { + s32 pad; + ObjTaru* this = THIS; + s32 params8000; + + DynaPolyActor_Init(&this->dyna, 0); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + + if (OBJ_TARU_GET_80(thisx)) { + if (Flags_GetSwitch(play, OBJ_TARU_GET_7F(thisx))) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + DynaPolyActor_LoadMesh(play, &this->dyna, &object_taru_Colheader_001CB0); + } + if (OBJ_TARU_GET_100(&this->dyna.actor)) { + this->dyna.actor.scale.x = 0.2f; + } + } else { + params8000 = OBJ_TARU_GET_8000(thisx); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_taru_Colheader_000FC8); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + + if (params8000 == 0) { + if (Item_CanDropBigFairy(play, OBJ_TARU_GET_3F(&this->dyna.actor), OBJ_TARU_GET_7F00(&this->dyna.actor))) { + this->unk_1AC = 1; + this->dyna.actor.flags |= ACTOR_FLAG_10; + } + } + if ((params8000 != 1) || (!func_80B9B6E0(this, play))) { + this->unk_1AD = -1; + } + } + this->actionFunc = func_80B9C07C; +} + +void ObjTaru_Destroy(Actor* thisx, PlayState* play) { + ObjTaru* this = THIS; + + if (!OBJ_TARU_GET_80(thisx)) { + Collider_DestroyCylinder(play, &this->collider); + } + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} + +s32 func_80B9BF7C(ObjTaru* this) { + s32 pad; + s32 phi_a3 = false; + + if ((!OBJ_TARU_GET_80(&this->dyna.actor)) && (this->collider.base.acFlags & AC_HIT)) { + Actor* ac = this->collider.base.ac; + + this->collider.base.acFlags &= ~AC_HIT; + if (ac != NULL) { + if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80000000) { + phi_a3 = false; + if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &ac->world.pos) < SQ(160.0f)) { + phi_a3 = true; + } + } else if (this->collider.info.acHitInfo->toucher.dmgFlags & 8) { + if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &ac->world.pos) < SQ(100.0f)) { + phi_a3 = true; + } + } else if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x500) { + phi_a3 = true; + } + } + } else if (this->dyna.actor.home.rot.z != 0) { + phi_a3 = true; + } + return phi_a3; +} + +void func_80B9C07C(ObjTaru* this, PlayState* play) { + if (func_80B9BF7C(this)) { + if (!OBJ_TARU_GET_80(&this->dyna.actor)) { + func_80B9B74C(this, play); + } else { + func_80B9B9C8(this, play); + } + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 0x14, NA_SE_EV_WOODBOX_BREAK); + if (OBJ_TARU_GET_80(&this->dyna.actor)) { + this->actionFunc = func_80B9C1A0; + } else { + this->dyna.actor.flags |= ACTOR_FLAG_10; + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + this->dyna.actor.draw = NULL; + this->actionFunc = func_80B9C174; + } + } else { + if (this->dyna.actor.xzDistToPlayer < 600.0f) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + } +} + +void func_80B9C174(ObjTaru* this, PlayState* play) { + func_80B9BD84(this, play); + Actor_MarkForDeath(&this->dyna.actor); +} + +void func_80B9C1A0(ObjTaru* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + Flags_SetSwitch(play, OBJ_TARU_GET_7F(&this->dyna.actor)); + Actor_MarkForDeath(&this->dyna.actor); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjTaru_Update(Actor* thisx, PlayState* play) { + ObjTaru* this = THIS; + + if (!OBJ_TARU_GET_80(thisx)) { + if (this->unk_1AC != 0) { + play->actorCtx.unk5 |= 8; + } + if (this->unk_1AD >= 0) { + switch (this->unk_1AD) { + case 0: + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); + if (Rand_ZeroOne() < 0.1f) { + this->unk_1AD = Rand_S16Offset(40, 80); + } else { + this->unk_1AD = 8; + } + break; + default: + this->unk_1AD--; + break; + } + } + } + this->actionFunc(this, play); +} + +void ObjTaru_Draw(Actor* thisx, PlayState* play) { + Gfx* dList; + ObjTaru* this = THIS; + + if (OBJ_TARU_GET_80(thisx)) { + dList = gObjTaruBreakablePiratePanelDL; + } else { + dList = gObjTaruBarrelDL; + } + Gfx_DrawDListOpa(play, dList); +} diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h index d1220bf33..063e90ef4 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h @@ -3,15 +3,24 @@ #include "global.h" +#define OBJ_TARU_GET_100(thisx) ((thisx)->params & 0x100) +#define OBJ_TARU_GET_1F(thisx) ((thisx)->params & 0x1F) +#define OBJ_TARU_GET_3F(thisx) ((thisx)->params & 0x3F) +#define OBJ_TARU_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJ_TARU_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJ_TARU_GET_80(thisx) ((thisx)->params & 0x80) +#define OBJ_TARU_GET_8000(thisx) (((thisx)->params >> 0xF) & 1) + struct ObjTaru; typedef void (*ObjTaruActionFunc)(struct ObjTaru*, PlayState*); typedef struct ObjTaru { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x64]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ ColliderCylinder collider; /* 0x1A8 */ ObjTaruActionFunc actionFunc; - /* 0x1AC */ char unk_1AC[0x4]; + /* 0x1AC */ s8 unk_1AC; + /* 0x1AD */ s8 unk_1AD; } ObjTaru; // size = 0x1B0 extern const ActorInit Obj_Taru_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 5a733ecba..6e5b44772 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -76,7 +76,7 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + subCamAt.x; subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + subCamAt.z; subCamEye.y = subCamAt.y + 4.0f; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->actionFunc = func_808A7BA0; } @@ -85,7 +85,7 @@ void func_808A7BA0(ObjWturn* this, PlayState* play) { func_808A7C04(this, play); } func_800B8FE8(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG); - Play_CameraSetRoll(play, this->subCamId, this->actor.shape.rot.z); + Play_SetCameraRoll(play, this->subCamId, this->actor.shape.rot.z); } void func_808A7C04(ObjWturn* this, PlayState* play) { @@ -107,7 +107,7 @@ void func_808A7C78(ObjWturn* this, PlayState* play) { this->unk_14A++; player->actor.world.pos.y = this->actor.world.pos.y + this->unk_14A * 4.0f; - Play_CameraSetAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp); + Play_SetCameraAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp); if (this->unk_14A == 1) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 0b4e2014e..a21e6c4f1 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -501,8 +501,8 @@ void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { void func_808DD3C8(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjectKankyo* this = THIS; - Vec3f spC4; - Vec3f spB8; + Vec3f worldPos; + Vec3f screenPos; s16 i; u8 pad2; u8 spB4; @@ -535,12 +535,14 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { } for (i = 0; i < sp68; i++) { - spC4.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; - spC4.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; - spC4.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(play, &spC4, &spB8); + worldPos.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; + worldPos.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; + worldPos.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - if ((spB8.x >= 0.0f) && (spB8.x < 320.0f) && (spB8.y >= 0.0f) && (spB8.y < 240.0f)) { + Play_GetScreenPos(play, &worldPos, &screenPos); + + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { if (!spB4) { spB4 = true; @@ -555,10 +557,10 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex)); } - Matrix_Translate(spC4.x, spC4.y, spC4.z, MTXMODE_NEW); + Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); tempf = (i & 7) * 0.008f; Matrix_Scale(0.05f + tempf, 0.05f + tempf, 0.05f + tempf, MTXMODE_APPLY); - temp_f2 = Math_Vec3f_DistXYZ(&spC4, &play->view.eye) / 300.0f; + temp_f2 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye) / 300.0f; temp_f2 = ((1.0f < temp_f2) ? 0.0f : (((1.0f - temp_f2) > 1.0f) ? 1.0f : 1.0f - temp_f2)); gDPPipeSync(POLY_XLU_DISP++); @@ -577,8 +579,8 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { void func_808DD970(Actor* thisx, PlayState* play2) { f32 temp_f0; f32 temp_f20; - Vec3f spBC; - Vec3f spB0; + Vec3f worldPos; + Vec3f screenPos; f32 tempf; s16 i; f32 phi_f26; @@ -607,15 +609,17 @@ void func_808DD970(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < this->unk_114C; i++) { - spBC.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; - spBC.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; - spBC.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(play, &spBC, &spB0); + worldPos.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; + worldPos.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; + worldPos.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - if ((spB0.x >= 0.0f) && (spB0.x < 320.0f) && (spB0.y >= 0.0f) && (spB0.y < 240.0f)) { - Matrix_Translate(spBC.x, spBC.y, spBC.z, MTXMODE_NEW); + Play_GetScreenPos(play, &worldPos, &screenPos); + + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { + Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); - temp_f0 = Math_Vec3f_DistXYZ(&spBC, &play->view.eye); + temp_f0 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye); temp_f0 = (u8)(255.0f * phi_f26) * (1.0f - (temp_f0 / 300.0f)); gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 49448b32e..fab6f8788 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -5,23 +5,144 @@ */ #include "z_eff_ss_en_fire.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScaleMax regs[0] +#define rScale regs[1] +#define rLifespan regs[2] +#define rUnused regs[3] +#define rPitch regs[4] +#define rYaw regs[5] +#define rReg6 regs[6] +#define rBodyPart regs[7] +#define rFlags regs[8] +#define rScroll regs[9] #define PARAMS ((EffectSsEnFireInitParams*)initParamsx) -s32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; -#endif +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsEnFireInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Init.s") + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = 20; + this->rLifespan = this->life; + this->actor = initParams->actor; + this->rScroll = Rand_ZeroOne() * 20.0f; + this->draw = EffectSsEnFire_Draw; + this->update = EffectSsEnFire_Update; + this->rUnused = -15; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Draw.s") + if (initParams->bodyPart < 0) { + this->rYaw = Math_Vec3f_Yaw(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.y; + this->rPitch = + Math_Vec3f_Pitch(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.x; + this->vec.z = Math_Vec3f_DistXYZ(&initParams->pos, &initParams->actor->world.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Update.s") + this->rScaleMax = initParams->scale; + + if (initParams->params & ENFIRE_PARAMS_USE_SCALE) { + this->rScale = initParams->scale; + } else { + this->rScale = 0; + } + + this->rReg6 = initParams->params & 0x7FFF; + this->rBodyPart = initParams->bodyPart; + this->rFlags = initParams->flags; + + return 1; +} + +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + f32 scale; + s16 camYaw; + s32 pad[3]; + s16 redGreen; + + OPEN_DISPS(gfxCtx); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000); + Matrix_RotateYS(camYaw, MTXMODE_APPLY); + + scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + redGreen = this->life - 5; + + if (redGreen < 0) { + redGreen = 0; + } + + func_8012C2DC(play->state.gfxCtx); + gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0); + gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -20) & 0x1FF, 0x20, 0x80)); + + if ((this->rFlags & 0x7FFF) || (this->life < 18)) { + gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); + } else { + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + } + + CLOSE_DISPS(gfxCtx); +} + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3f firePos[10]; +} FireActorF; // size = 0x1BC + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3s firePos[10]; +} FireActorS; // size = 0x180 + +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { + this->rScroll++; + + if (this->actor != NULL) { + if (this->actor->colorFilterTimer >= 22) { + this->life++; + } + if (this->actor->update != NULL) { + Math_SmoothStepToS(&this->rScale, this->rScaleMax, 1, this->rScaleMax >> 3, 0); + + if (this->rBodyPart < 0) { + Matrix_Translate(this->actor->world.pos.x, this->actor->world.pos.y, this->actor->world.pos.z, + MTXMODE_NEW); + Matrix_RotateYS(this->rYaw + this->actor->shape.rot.y, MTXMODE_APPLY); + Matrix_RotateXS(this->rPitch + this->actor->shape.rot.x, MTXMODE_APPLY); + Matrix_MultVec3f(&this->vec, &this->pos); + } else if (this->rFlags & ENFIRE_FLAGS_BODYPART_POS_VEC3S) { + this->pos.x = ((FireActorS*)this->actor)->firePos[this->rBodyPart].x; + this->pos.y = ((FireActorS*)this->actor)->firePos[this->rBodyPart].y; + this->pos.z = ((FireActorS*)this->actor)->firePos[this->rBodyPart].z; + } else { + this->pos.x = ((FireActorF*)this->actor)->firePos[this->rBodyPart].x; + this->pos.y = ((FireActorF*)this->actor)->firePos[this->rBodyPart].y; + this->pos.z = ((FireActorF*)this->actor)->firePos[this->rBodyPart].z; + } + } else if (this->rReg6 != 0) { + this->life = 0; + } else { + this->actor = NULL; + } + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index 987e426da..9fb959824 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -3,11 +3,14 @@ #include "global.h" +#define ENFIRE_FLAGS_BODYPART_POS_VEC3S (1 << 15) +#define ENFIRE_PARAMS_USE_SCALE (1 << 15) + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 scale; - /* 0x12 */ s16 unk_12; + /* 0x12 */ s16 params; /* 0x14 */ s16 flags; /* 0x16 */ s16 bodyPart; } EffectSsEnFireInitParams; // size = 0x18 diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index aa5ec5140..7d6cf277c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -1,30 +1,157 @@ /* * File: z_eff_ss_en_ice.c * Overlay: ovl_Effect_Ss_En_Ice - * Description: + * Description: Ice clumps */ #include "z_eff_ss_en_ice.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rLifespan regs[0] +#define rYaw regs[1] +#define rPitch regs[2] +#define rRotSpeed regs[3] +#define rPrimColorR regs[4] +#define rPrimColorG regs[5] +#define rPrimColorB regs[6] +#define rPrimColorA regs[7] +#define rEnvColorR regs[8] +#define rEnvColorG regs[9] +#define rEnvColorB regs[10] +#define rAlphaMode regs[11] +#define rScale regs[12] #define PARAMS ((EffectSsEnIceInitParams*)initParamsx) -s32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void func_8097F62C(PlayState* play, u32 index, EffectSs* this); -void func_8097F7EC(PlayState* play, u32 index, EffectSs* this); +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; -#endif +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsEnIceInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Init.s") + if (initParams->type == ENICE_TYPE_FLYING) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Draw.s") + if (initParams->actor != NULL) { + Math_Vec3f_Diff(&this->pos, &initParams->actor->world.pos, &this->vec); + } else { + Math_Vec3f_Copy(&this->vec, &initParams->pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F62C.s") + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = 10; + this->actor = initParams->actor; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_UpdateFlying; + this->rScale = initParams->scale * 100.0f; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rAlphaMode = 1; + this->rPitch = randPlusMinusPoint5Scaled(0x10000); + } else if (initParams->type == ENICE_TYPE_NORMAL) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->vec, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &initParams->velocity); + Math_Vec3f_Copy(&this->accel, &initParams->accel); + this->life = initParams->life; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_Update; + this->rLifespan = initParams->life; + this->rScale = initParams->scale * 100.0f; + this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x); + this->rPitch = 0; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rAlphaMode = 0; + } else { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F7EC.s") + return 1; +} + +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; + f32 scale = this->rScale * 0.01f; + u32 gameplayFrames = play->gameplayFrames; + f32 alpha; + + OPEN_DISPS(gfxCtx); + + if (this->rAlphaMode != 0) { + alpha = this->life * 12.0f; + } else if ((this->rLifespan > 0) && (this->life < (this->rLifespan >> 1))) { + alpha = (this->life * 2.0f) / this->rLifespan; + alpha *= 255.0f; + } else { + alpha = 255.0f; + } + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_RotateYS(this->rYaw, MTXMODE_APPLY); + Matrix_RotateXS(this->rPitch, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + func_8012C2DC(play->state.gfxCtx); + func_800BCC68(&this->pos, play); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, + (gameplayFrames * 2) & 0xFF, 0x40, 0x20)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, + this->rPrimColorA); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, (u32)alpha); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { + s16 rand; + + if ((this->actor != NULL) && (this->actor->update != NULL)) { + if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) { + Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos); + this->life++; + } else if (this->life == 9) { + this->accel.x = Math_SinS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } else { + this->actor = NULL; + if (this->life >= 9) { + rand = randPlusMinusPoint5Scaled(0xFFFF); + this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f); + this->life = 8; + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } +} + +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { + this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing +} diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index ed0c6d457..46b162cc1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -3,6 +3,11 @@ #include "global.h" +typedef enum EffectSsEnIceType { + /* 0 */ ENICE_TYPE_FLYING, + /* 1 */ ENICE_TYPE_NORMAL +} EffectSsEnIceType; + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 073b6bb1d..764828bf4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -1,27 +1,119 @@ /* * File: z_eff_ss_fhg_flash.c * Overlay: ovl_Effect_Ss_Fhg_Flash - * Description: + * Description: Shock and Light Ball Effect */ #include "z_eff_ss_fhg_flash.h" +#include "overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h" +#include "assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.h" + +#define rAlpha regs[0] +#define rXZRot regs[3] +#define rParams regs[4] +#define rScale regs[8] #define PARAMS ((EffectSsFhgFlashInitParams*)initParamsx) -s32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, EffectSsFhgFlash_Init, }; -#endif +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + EffectSsFhgFlashInitParams* initParams = PARAMS; + Vec3f noActorPos = { 0.0f, -1000.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Init.s") + this->actor = initParams->actor; + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = (s32)(Rand_ZeroOne() * 10.0f) + 111; + this->rScale = (s32)Rand_ZeroFloat(initParams->scale) + initParams->scale; + this->rAlpha = 255; + this->draw = EffectSsFhgFlash_Draw; + this->update = EffectSsFhgFlash_Update; + this->rParams = initParams->params; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Draw.s") + if (initParams->params != FHGFLASH_SHOCK_NO_ACTOR) { + this->pos = noActorPos; + this->gfx = gEffFhgFlashDL; + } else { + this->pos = initParams->pos; + this->gfx = gEffFhgFlashDL; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Update.s") + return 1; +} + +#include "overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.c" + +void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this) { + s32 pad; + GraphicsContext* gfxCtx = play->state.gfxCtx; + f32 scale = this->rScale / 100.0f; + + OPEN_DISPS(gfxCtx); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + if (this->rParams != FHGFLASH_SHOCK_NO_ACTOR) { + func_8012C448(play->state.gfxCtx); + Matrix_RotateXS(this->rXZRot, MTXMODE_APPLY); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2); + } else { + func_8012C2DC(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); + } + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 155, 0); + Matrix_RotateZS(this->rXZRot, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { + s16 randBodyPart; + s16 rand = Rand_ZeroOne() * 20000.0f; + + this->rXZRot = (this->rXZRot + rand) + 0x4000; + if (this->rParams == FHGFLASH_SHOCK_PLAYER) { + Player* player = GET_PLAYER(play); + + randBodyPart = Rand_ZeroFloat(18 - 0.1f); + this->pos.x = player->bodyPartsPos[randBodyPart].x + randPlusMinusPoint5Scaled(10.0f); + this->pos.y = player->bodyPartsPos[randBodyPart].y + randPlusMinusPoint5Scaled(15.0f); + this->pos.z = player->bodyPartsPos[randBodyPart].z + randPlusMinusPoint5Scaled(10.0f); + } else if ((this->rParams >= FHGFLASH_SHOCK_GOHT_2) && (this->rParams <= FHGFLASH_SHOCK_GOHT_6)) { + s32 pad; + Vec3f* bodyPartPos; + BossHakugin* goht = (BossHakugin*)this->actor; + s32 index = goht->unk_191 - 3; + + if (index < 0) { + bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00; + } else { + bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00; + } + + this->pos.x = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->x; + this->pos.y = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->y; + this->pos.z = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->z; + } + if (this->life < 100) { + this->rAlpha -= 50; + if (this->rAlpha < 0) { + this->rAlpha = 0; + this->life = 0; + } + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h index 0598377f8..c464047b5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h @@ -23,7 +23,11 @@ typedef enum { typedef enum { /* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR, /* 0x01 */ FHGFLASH_SHOCK_PLAYER, - /* 0x02 */ FHGFLASH_SHOCK_PG + /* 0x02 */ FHGFLASH_SHOCK_GOHT_2, + /* 0x03 */ FHGFLASH_SHOCK_GOHT_3, + /* 0x04 */ FHGFLASH_SHOCK_GOHT_4, + /* 0x05 */ FHGFLASH_SHOCK_GOHT_5, + /* 0x06 */ FHGFLASH_SHOCK_GOHT_6 } FhgFlashLightningParam; typedef struct { @@ -31,7 +35,7 @@ typedef struct { /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; /* 0x24 */ s16 scale; - /* 0x26 */ u8 param; + /* 0x26 */ u8 params; /* 0x28 */ Actor* actor; /* 0x2C */ u8 type; } EffectSsFhgFlashInitParams; // size = 0x30 diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index ea4c47da5..da4de14d6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -1,27 +1,142 @@ /* * File: z_eff_ss_fire_tail.c * Overlay: ovl_Effect_Ss_Fire_Tail - * Description: + * Description: Fire (burned by something) */ #include "z_eff_ss_fire_tail.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScale regs[0] +#define rLifespan regs[1] +#define rReg2 regs[2] +#define rReg3 regs[3] +#define rPrimColorR regs[4] +#define rPrimColorG regs[5] +#define rPrimColorB regs[6] +#define rEnvColorR regs[7] +#define rEnvColorG regs[8] +#define rEnvColorB regs[9] +#define rReg10 regs[10] +#define rBodyPart regs[11] +#define rType regs[12] #define PARAMS ((EffectSsFireTailInitParams*)initParamsx) -s32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; -#endif +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsFireTailInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Init.s") + this->pos = initParams->pos; + this->vec = initParams->unk_14; + this->velocity.x = 0.0f; + this->velocity.y = 0.0f; + this->velocity.z = 0.0f; + this->accel.x = 0.0f; + this->accel.y = 0.0f; + this->accel.z = 0.0f; + this->life = initParams->life; + this->actor = initParams->actor; + this->draw = EffectSsFireTail_Draw; + this->update = EffectSsFireTail_Update; + this->rScale = initParams->scale * 1000.0f; + this->rLifespan = initParams->life; + this->rReg2 = -10; + this->rReg3 = -15; + if (initParams->unk_20 == 0) { + initParams->unk_20 = 1; + } + this->rReg10 = initParams->unk_20; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rBodyPart = initParams->bodyPart; + this->rType = initParams->type; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Update.s") +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; + s16 yawDiff; + Vec3f scale; + f32 temp1; + f32 temp2; + f32 dist; + + OPEN_DISPS(gfxCtx); + + scale.x = scale.y = scale.z = 0.0f; + + if (this->actor != NULL) { + this->vec = this->actor->velocity; + + if (this->rBodyPart < 0) { + Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, + this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); + } else { + Player* player = GET_PLAYER(play); + s16 bodyPart = this->rBodyPart; + + this->pos.x = + player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); + this->pos.y = player->bodyPartsPos[bodyPart].y; + this->pos.z = + player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + } + } else { + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + } + + yawDiff = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + temp1 = fabsf(Math_CosS(yawDiff)); + temp2 = Math_SinS(yawDiff); + dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); + Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(temp2 * this->rReg2 * dist), MTXMODE_APPLY); + temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); + temp2 = 1.0f - SQ(temp2); + scale.x = scale.y = scale.z = temp2 * (this->rScale * (0.001f * 0.01f)); + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); + temp1 = (this->rReg3 * 0.01f * temp1 * dist) + 1.0f; + + if (temp1 < 0.1f) { + temp1 = 0.1f; + } + + Matrix_Scale(1.0f, temp1, 1.0f / temp1, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->state.frames * -20) & 0x1FF, 32, 128)); + + if (this->rType != 0) { + gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); + } else { + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this) { + this->rScale *= 0.9f; +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 8b59e40fa..32d457d74 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -71,7 +71,7 @@ void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, gEffIceFragmentDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL); CLOSE_DISPS(gfxCtx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index d027f09dd..4aa209639 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -76,7 +76,7 @@ void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(gfxCtx); } diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 22762b51a..ffa305cdd 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -484,7 +484,7 @@ 0x8018EB60 : "audio_load", 0x80192BE0 : "code_80192BE0", 0x80194710 : "audio_dcache", - 0x80194790 : "code_80194790", + 0x80194790 : "aisetnextbuf", 0x80194930 : "audio_playback", 0x80196A00 : "audio_effects", 0x801974D0 : "audio_seqplayer", @@ -587,7 +587,7 @@ 0x801D5FB0 : "audio_synthesis", 0x801D5FE0 : "audio_load", 0x801D5FF0 : "code_80192BE0", - 0x801D6010 : "code_80194790", + 0x801D6010 : "aisetnextbuf", 0x801D6190 : "audio_effects", 0x801D61A0 : "audio_seqplayer", 0x801D6200 : "audio_dramStack", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 6e04aa64b..30810b613 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -635,7 +635,7 @@ 0x800B2810:("EffectSsKakera_Spawn",), 0x800B28C8:("EffectSsIcePiece_Spawn",), 0x800B2930:("EffectSsIcePiece_SpawnBurst",), - 0x800B2AC4:("EffectSsEnIce_SpawnFlyingVec3f",), + 0x800B2AC4:("EffectSsEnIce_SpawnFlying",), 0x800B2B44:("func_800B2B44",), 0x800B2B7C:("func_800B2B7C",), 0x800B2BC0:("EffectSsEnIce_Spawn",), @@ -783,7 +783,7 @@ 0x800B882C:("func_800B882C",), 0x800B886C:("func_800B886C",), 0x800B8898:("Actor_GetScreenPos",), - 0x800B8934:("func_800B8934",), + 0x800B8934:("Actor_OnScreen",), 0x800B89F8:("Actor_HasParent",), 0x800B8A1C:("Actor_PickUp",), 0x800B8B84:("Actor_PickUpNearby",), @@ -1258,8 +1258,8 @@ 0x800DDDD0:("Camera_Init",), 0x800DDFE0:("func_800DDFE0",), 0x800DE0E0:("func_800DE0E0",), - 0x800DE0EC:("func_800DE0EC",), - 0x800DE308:("func_800DE308",), + 0x800DE0EC:("Camera_InitPlayerSettings",), + 0x800DE308:("Camera_ChangeStatus",), 0x800DE324:("func_800DE324",), 0x800DE62C:("func_800DE62C",), 0x800DE840:("func_800DE840",), @@ -1280,7 +1280,7 @@ 0x800DFCB4:("Camera_GetCamDirPitch",), 0x800DFCDC:("Camera_GetCamDirYaw",), 0x800DFD04:("Camera_AddQuake",), - 0x800DFD78:("func_800DFD78",), + 0x800DFD78:("Camera_SetViewParam",), 0x800DFEF0:("func_800DFEF0",), 0x800DFF18:("func_800DFF18",), 0x800DFF34:("func_800DFF34",), @@ -1288,7 +1288,7 @@ 0x800DFF60:("Camera_SetFlags",), 0x800DFF84:("Camera_ClearFlags",), 0x800DFFAC:("Camera_ChangeDoorCam",), - 0x800E007C:("func_800E007C",), + 0x800E007C:("Camera_Copy",), 0x800E01AC:("func_800E01AC",), 0x800E01B8:("Camera_GetQuakeOffset",), 0x800E01DC:("func_800E01DC",), @@ -2986,18 +2986,18 @@ 0x80165EC0:("func_80165EC0",), 0x80166060:("func_80166060",), 0x801660B8:("func_801660B8",), - 0x8016613C:("Play_Fini",), + 0x8016613C:("Play_Destroy",), 0x801663C4:("func_801663C4",), 0x80166644:("func_80166644",), 0x801668B4:("func_801668B4",), 0x80166968:("func_80166968",), 0x80166B30:("func_80166B30",), - 0x80167814:("func_80167814",), + 0x80167814:("Play_Update",), 0x80167DE4:("func_80167DE4",), 0x80167F0C:("func_80167F0C",), 0x80168090:("Play_Draw",), 0x80168DAC:("func_80168DAC",), - 0x80168F64:("Play_Update",), + 0x80168F64:("Play_Main",), 0x801690CC:("Play_InCsMode",), 0x80169100:("func_80169100",), 0x801691F0:("func_801691F0",), @@ -3005,22 +3005,22 @@ 0x8016927C:("func_8016927C",), 0x801692C4:("func_801692C4",), 0x801693D4:("Play_SceneInit",), - 0x80169474:("func_80169474",), + 0x80169474:("Play_GetScreenPos",), 0x801694DC:("Play_CreateSubCamera",), 0x80169584:("Play_GetActiveCamId",), - 0x80169590:("Play_CameraChangeStatus",), + 0x80169590:("Play_ChangeCameraStatus",), 0x80169600:("Play_ClearCamera",), 0x80169668:("Play_ClearAllSubCameras",), 0x801696D4:("Play_GetCamera",), - 0x8016970C:("Play_CameraSetAtEye",), - 0x8016981C:("Play_CameraSetAtEyeUp",), - 0x80169940:("Play_CameraSetFov",), - 0x80169988:("Play_CameraSetRoll",), + 0x8016970C:("Play_SetCameraAtEye",), + 0x8016981C:("Play_SetCameraAtEyeUp",), + 0x80169940:("Play_SetCameraFov",), + 0x80169988:("Play_SetCameraRoll",), 0x801699D4:("Play_CopyCamera",), 0x80169A50:("func_80169A50",), - 0x80169AC0:("Play_CameraChangeSetting",), + 0x80169AC0:("Play_ChangeCameraSetting",), 0x80169AFC:("func_80169AFC",), - 0x80169BC4:("Play_CameraGetUID",), + 0x80169BC4:("Play_GetCameraUID",), 0x80169BF8:("func_80169BF8",), 0x80169C64:("Play_GetActorCsCamSetting",), 0x80169C84:("Play_GetActorCsCamFuncData",), @@ -3722,7 +3722,7 @@ 0x801946E4:("Audio_InitMesgQueues",), 0x80194710:("Audio_InvalDCache",), 0x80194750:("Audio_WritebackDCache",), - 0x80194790:("func_80194790",), + 0x80194790:("osAiSetNextBuffer",), 0x80194804:("func_80194804",), 0x80194840:("func_80194840",), 0x801948B0:("func_801948B0",), @@ -8221,8 +8221,8 @@ 0x8097F020:("EffectSsIcePiece_Update",), 0x8097F0D0:("EffectSsEnIce_Init",), 0x8097F2F0:("EffectSsEnIce_Draw",), - 0x8097F62C:("func_8097F62C",), - 0x8097F7EC:("func_8097F7EC",), + 0x8097F62C:("EffectSsEnIce_UpdateFlying",), + 0x8097F7EC:("EffectSsEnIce_Update",), 0x8097F880:("EffectSsFireTail_Init",), 0x8097F99C:("EffectSsFireTail_Draw",), 0x8097FE8C:("EffectSsFireTail_Update",), @@ -10036,11 +10036,11 @@ 0x80A29094:("func_80A29094",), 0x80A29150:("EnBigpamet_Update",), 0x80A292A8:("func_80A292A8",), - 0x80A293E4:("func_80A293E4",), - 0x80A29494:("func_80A29494",), + 0x80A293E4:("EnBigpamet_OverrideLimbDraw2",), + 0x80A29494:("EnBigpamet_PostLimbDraw2",), 0x80A294D8:("EnBigpamet_Draw",), - 0x80A29580:("func_80A29580",), - 0x80A29628:("func_80A29628",), + 0x80A29580:("EnBigpamet_OverrideLimbDraw1",), + 0x80A29628:("EnBigpamet_PostLimbDraw1",), 0x80A2966C:("func_80A2966C",), 0x80A29A80:("func_80A29A80",), 0x80A29C18:("BgDblueMovebg_Init",), @@ -10347,8 +10347,8 @@ 0x80A3E248:("ObjSmork_Draw",), 0x80A3E390:("EnTest2_Init",), 0x80A3E3E4:("EnTest2_Update",), - 0x80A3E4EC:("func_80A3E4EC",), - 0x80A3E524:("func_80A3E524",), + 0x80A3E4EC:("EnTest2_UpdateForLens",), + 0x80A3E524:("EnTest2_Draw",), 0x80A3E7E0:("func_80A3E7E0",), 0x80A3E80C:("func_80A3E80C",), 0x80A3E870:("func_80A3E870",), @@ -13202,37 +13202,37 @@ 0x80B1D484:("EnPoSisters_Draw",), 0x80B1DEB0:("EnPp_Init",), 0x80B1E234:("EnPp_Destroy",), - 0x80B1E29C:("func_80B1E29C",), - 0x80B1E3D4:("func_80B1E3D4",), - 0x80B1E5A8:("func_80B1E5A8",), - 0x80B1E680:("func_80B1E680",), - 0x80B1E778:("func_80B1E778",), - 0x80B1E958:("func_80B1E958",), - 0x80B1E970:("func_80B1E970",), - 0x80B1EBD8:("func_80B1EBD8",), - 0x80B1EC24:("func_80B1EC24",), - 0x80B1EFFC:("func_80B1EFFC",), - 0x80B1F048:("func_80B1F048",), - 0x80B1F0A4:("func_80B1F0A4",), - 0x80B1F188:("func_80B1F188",), - 0x80B1F244:("func_80B1F244",), - 0x80B1F29C:("func_80B1F29C",), - 0x80B1F4A0:("func_80B1F4A0",), - 0x80B1F560:("func_80B1F560",), - 0x80B1F664:("func_80B1F664",), - 0x80B1F6B4:("func_80B1F6B4",), - 0x80B1F770:("func_80B1F770",), - 0x80B1F940:("func_80B1F940",), - 0x80B1FAD0:("func_80B1FAD0",), - 0x80B1FC7C:("func_80B1FC7C",), - 0x80B1FF20:("func_80B1FF20",), - 0x80B20030:("func_80B20030",), - 0x80B202B8:("func_80B202B8",), - 0x80B203BC:("func_80B203BC",), - 0x80B20668:("func_80B20668",), + 0x80B1E29C:("EnPp_PointlessPosCheck",), + 0x80B1E3D4:("EnPp_SpawnDust",), + 0x80B1E5A8:("EnPp_ChangeAnim",), + 0x80B1E680:("EnPp_PlaySfxForAnimation",), + 0x80B1E778:("EnPp_CheckCollision",), + 0x80B1E958:("EnPp_SetupIdle",), + 0x80B1E970:("EnPp_Idle",), + 0x80B1EBD8:("EnPp_SetupCharge",), + 0x80B1EC24:("EnPp_Charge",), + 0x80B1EFFC:("EnPp_SetupAttack",), + 0x80B1F048:("EnPp_Attack",), + 0x80B1F0A4:("EnPp_SetupBounced",), + 0x80B1F188:("EnPp_Bounced",), + 0x80B1F244:("EnPp_SetupRoar",), + 0x80B1F29C:("EnPp_Roar",), + 0x80B1F4A0:("EnPp_SetupJump",), + 0x80B1F560:("EnPp_Jump",), + 0x80B1F664:("EnPp_SetupStunnedOrFrozen",), + 0x80B1F6B4:("EnPp_StunnedOrFrozen",), + 0x80B1F770:("EnPp_SetupDamaged",), + 0x80B1F940:("EnPp_Damaged",), + 0x80B1FAD0:("EnPp_SetupDead",), + 0x80B1FC7C:("EnPp_Dead",), + 0x80B1FF20:("EnPp_Mask_SetupDetach",), + 0x80B20030:("EnPp_Mask_Detach",), + 0x80B202B8:("EnPp_BodyPart_SetupMove",), + 0x80B203BC:("EnPp_BodyPart_Move",), + 0x80B20668:("EnPp_UpdateDamage",), 0x80B20B40:("EnPp_Update",), - 0x80B20E6C:("func_80B20E6C",), - 0x80B20F70:("func_80B20F70",), + 0x80B20E6C:("EnPp_OverrideLimbDraw",), + 0x80B20F70:("EnPp_PostLimbDraw",), 0x80B21344:("EnPp_Draw",), 0x80B21B00:("EnHakurock_Init",), 0x80B21BB4:("EnHakurock_Destroy",), @@ -13372,21 +13372,21 @@ 0x80B2ADB0:("func_80B2ADB0",), 0x80B2AF80:("func_80B2AF80",), 0x80B2B180:("func_80B2B180",), - 0x80B2B830:("func_80B2B830",), - 0x80B2B874:("func_80B2B874",), - 0x80B2B8F4:("func_80B2B8F4",), - 0x80B2B974:("func_80B2B974",), - 0x80B2BAA4:("func_80B2BAA4",), - 0x80B2BBFC:("func_80B2BBFC",), - 0x80B2BCF8:("func_80B2BCF8",), - 0x80B2BD30:("func_80B2BD30",), - 0x80B2BD88:("func_80B2BD88",), - 0x80B2BD98:("func_80B2BD98",), - 0x80B2BE54:("func_80B2BE54",), + 0x80B2B830:("EnPst_UpdateCollision",), + 0x80B2B874:("EnPst_HandleLetterDay1",), + 0x80B2B8F4:("EnPst_HandleLetterDay2",), + 0x80B2B974:("EnPst_ChooseBehaviour",), + 0x80B2BAA4:("EnPst_GetMsgEventScript",), + 0x80B2BBFC:("EnPst_CheckTalk",), + 0x80B2BCF8:("EnPst_UpdateFlagsSubs",), + 0x80B2BD30:("EnPst_ProcessScheduleOutput",), + 0x80B2BD88:("EnPst_Idle",), + 0x80B2BD98:("EnPst_FollowSchedule",), + 0x80B2BE54:("EnPst_Talk",), 0x80B2BF3C:("EnPst_Init",), 0x80B2C04C:("EnPst_Destroy",), 0x80B2C078:("EnPst_Update",), - 0x80B2C11C:("func_80B2C11C",), + 0x80B2C11C:("EnPst_OverrideLimbDraw",), 0x80B2C18C:("EnPst_Draw",), 0x80B2C6F0:("EnPoh_Init",), 0x80B2C8B8:("EnPoh_Destroy",), @@ -16856,7 +16856,7 @@ 0x80C18120:("BgLbfshot_Init",), 0x80C1817C:("BgLbfshot_Destroy",), 0x80C181B0:("BgLbfshot_Draw",), - 0x80C18240:("func_80C18240",), + 0x80C18240:("BgLastBwall_InitCollider",), 0x80C1838C:("BgLastBwall_Init",), 0x80C184B8:("BgLastBwall_Destroy",), 0x80C184EC:("func_80C184EC",), @@ -16865,7 +16865,7 @@ 0x80C1886C:("func_80C1886C",), 0x80C18884:("func_80C18884",), 0x80C188C4:("func_80C188C4",), - 0x80C18928:("func_80C18928",), + 0x80C18928:("BgLastBwall_DoNothing",), 0x80C18938:("BgLastBwall_Update",), 0x80C1895C:("BgLastBwall_Draw",), 0x80C18B90:("func_80C18B90",), @@ -16912,13 +16912,13 @@ 0x80C1A98C:("EnInvadepohDemo_Destroy",), 0x80C1A9C0:("EnInvadepohDemo_Update",), 0x80C1A9E4:("EnInvadepohDemo_Draw",), - 0x80C1ADC0:("func_80C1ADC0",), + 0x80C1ADC0:("ObjDanpeilift_UpdatePosition",), 0x80C1ADFC:("ObjDanpeilift_Init",), 0x80C1AF50:("ObjDanpeilift_Destroy",), - 0x80C1AF84:("func_80C1AF84",), - 0x80C1AF94:("func_80C1AF94",), - 0x80C1B210:("func_80C1B210",), - 0x80C1B26C:("func_80C1B26C",), + 0x80C1AF84:("ObjDanpeilift_DoNothing",), + 0x80C1AF94:("ObjDanpeilift_Move",), + 0x80C1B210:("ObjDanpeilift_Teleport",), + 0x80C1B26C:("ObjDanpeilift_Wait",), 0x80C1B2A4:("ObjDanpeilift_Update",), 0x80C1B4E4:("ObjDanpeilift_Draw",), 0x80C1B640:("EnFall2_Init",), @@ -16964,8 +16964,8 @@ 0x80C1D93C:("DmAh_Init",), 0x80C1DA48:("DmAh_Destroy",), 0x80C1DA58:("DmAh_Update",), - 0x80C1DAD4:("func_80C1DAD4",), - 0x80C1DB24:("func_80C1DB24",), + 0x80C1DAD4:("DmAh_PostLimbDraw",), + 0x80C1DB24:("DmAh_TransformLimbDraw",), 0x80C1DCD8:("DmAh_Draw",), 0x80C1DED0:("func_80C1DED0",), 0x80C1DF18:("func_80C1DF18",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index c5c7bd749..f2392622b 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -5731,7 +5731,7 @@ 0x808743E8:("D_808743E8","f32","",0x4), 0x808743EC:("D_808743EC","f32","",0x4), 0x808743F0:("D_808743F0","f32","",0x4), - 0x80874650:("D_80874650","s80874650","[16]",0x1c0), + 0x80874650:("sPowderKegFuseSegments","PowderKegFuseSegment","[16]",0x1c0), 0x80874668:("D_80874668","UNK_TYPE1","",0x1), 0x8087466A:("D_8087466A","UNK_TYPE1","",0x1), 0x8087466C:("D_8087466C","UNK_TYPE1","",0x1), @@ -13899,27 +13899,22 @@ 0x80B1DB54:("D_80B1DB54","f32","",0x4), 0x80B1DB58:("D_80B1DB58","f32","",0x4), 0x80B1DB5C:("D_80B1DB5C","f32","",0x4), - 0x80B21620:("D_80B21620","UNK_TYPE4","",0x4), - 0x80B21624:("D_80B21624","UNK_TYPE1","",0x1), + 0x80B21620:("sCurrentDeadBodyPartIndex","UNK_TYPE4","",0x4), + 0x80B21624:("sDamageTable","UNK_TYPE1","",0x1), 0x80B21644:("En_Pp_InitVars","UNK_TYPE1","",0x1), - 0x80B21664:("D_80B21664","UNK_TYPE1","",0x1), - 0x80B21688:("D_80B21688","UNK_TYPE1","",0x1), - 0x80B21698:("D_80B21698","UNK_TYPE1","",0x1), - 0x80B216BC:("D_80B216BC","UNK_TYPE1","",0x1), - 0x80B216CC:("D_80B216CC","UNK_TYPE1","",0x1), - 0x80B2171C:("D_80B2171C","UNK_TYPE1","",0x1), - 0x80B21720:("D_80B21720","UNK_TYPE1","",0x1), - 0x80B21724:("D_80B21724","UNK_TYPE1","",0x1), - 0x80B2174C:("D_80B2174C","UNK_TYPE1","",0x1), - 0x80B21758:("D_80B21758","UNK_TYPE2","",0x2), - 0x80B2175E:("D_80B2175E","UNK_TYPE1","",0x1), - 0x80B21760:("D_80B21760","UNK_TYPE4","",0x4), - 0x80B217CC:("D_80B217CC","f32","",0x4), - 0x80B217D0:("D_80B217D0","f32","",0x4), - 0x80B217D4:("D_80B217D4","f32","",0x4), - 0x80B217D8:("D_80B217D8","f32","",0x4), - 0x80B217DC:("D_80B217DC","f32","",0x4), - 0x80B217E0:("D_80B217E0","f32","",0x4), + 0x80B21664:("sMaskColliderJntSphElementsInit","UNK_TYPE1","",0x1), + 0x80B21688:("sMaskColliderJntSphInit","UNK_TYPE1","",0x1), + 0x80B21698:("sBodyColliderJntSphElementsInit","UNK_TYPE1","",0x1), + 0x80B216BC:("sBodyColliderJntSphInit","UNK_TYPE1","",0x1), + 0x80B216CC:("sQuadInit","UNK_TYPE1","",0x1), + 0x80B2171C:("sDustPrimColor","UNK_TYPE1","",0x1), + 0x80B21720:("sDustEnvColor","UNK_TYPE1","",0x1), + 0x80B21724:("sAnimations","UNK_TYPE1","",0x1), + 0x80B2174C:("sAnimationModes","UNK_TYPE1","",0x1), + 0x80B21758:("sLedgeCheckAngles","UNK_TYPE2","",0x2), + 0x80B21760:("sMaskFireVelocityAndAccel","UNK_TYPE4","",0x4), + 0x80B217CC:("sVertexOffset1","f32","",0x4), + 0x80B217D8:("sVertexOffset2","f32","",0x4), 0x80B217F0:("D_80B217F0","f32","",0x4), 0x80B217F4:("jtbl_80B217F4","UNK_PTR","",0x4), 0x80B21810:("D_80B21810","f32","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index da595fb89..21430d537 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -138,7 +138,8 @@ wordReplace = { "func_800BE22C": "Actor_ApplyDamage", "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos", "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos", - "func_8016970C": "Play_CameraSetAtEye", + "func_8016970C": "Play_SetCameraAtEye", + "Play_CameraSetAtEye": "Play_SetCameraAtEye", "func_800BBA88": "Enemy_StartFinishingBlow", "ShrinkWindow_Step": "ShrinkWindow_Update", "ShrinkWindow_Fini": "ShrinkWindow_Destroy", @@ -451,17 +452,25 @@ wordReplace = { "func_800DFFAC": "Camera_ChangeDoorCam", "func_801694DC": "Play_CreateSubCamera", "Play_GetActiveCameraIndex": "Play_GetActiveCamId", - "func_80169590": "Play_CameraChangeStatus", + "func_80169590": "Play_ChangeCameraStatus", + "Play_CameraChangeStatus": "Play_ChangeCameraStatus", "func_80169600": "Play_ClearCamera", "func_80169668": "Play_ClearAllSubCameras", - "func_8016981C": "Play_CameraSetAtEyeUp", - "func_80169940": "Play_CameraSetFov", - "func_80169988": "Play_CameraSetRoll", + "func_8016981C": "Play_SetCameraAtEyeUp", + "func_80169940": "Play_SetCameraFov", + "func_80169988": "Play_SetCameraRoll", + "Play_CameraSetAtEyeUp": "Play_SetCameraAtEyeUp", + "Play_CameraSetFov": "Play_SetCameraFov", + "Play_CameraSetRoll": "Play_SetCameraRoll", "func_801699D4": "Play_CopyCamera", - "func_80169AC0": "Play_CameraChangeSetting", - "func_80169BC4": "Play_CameraGetUID", + "func_80169AC0": "Play_ChangeCameraSetting", + "Play_CameraChangeSetting": "Play_ChangeCameraSetting", + "func_80169BC4": "Play_GetCameraUID", + "Play_CameraGetUID": "Play_GetCameraUID", "func_80169C64": "Play_GetActorCsCamSetting", + "Play_GetCsCamDataSetting": "Play_GetActorCsCamSetting", "func_80169C84": "Play_GetActorCsCamFuncData", + "Play_GetCsCamDataVec3s": "Play_GetActorCsCamFuncData", "convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber", "func_80169D40": "Play_SaveCycleSceneFlags", "func_80169DCC": "Play_SetRespawnData", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index cb8e980c2..3ac8d0ff3 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -149,7 +149,7 @@ asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsSolderSrchBall_Spaw asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKakera_Spawn.s,EffectSsKakera_Spawn,0x800B2810,0x2E asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_Spawn.s,EffectSsIcePiece_Spawn,0x800B28C8,0x1A asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_SpawnBurst.s,EffectSsIcePiece_SpawnBurst,0x800B2930,0x65 -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlyingVec3f.s,EffectSsEnIce_SpawnFlyingVec3f,0x800B2AC4,0x20 +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlying.s,EffectSsEnIce_SpawnFlying,0x800B2AC4,0x20 asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B44.s,func_800B2B44,0x800B2B44,0xE asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B7C.s,func_800B2B7C,0x800B2B7C,0x11 asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_Spawn.s,EffectSsEnIce_Spawn,0x800B2BC0,0x22 @@ -297,7 +297,7 @@ asm/non_matchings/code/z_actor/func_800B8804.s,func_800B8804,0x800B8804,0xA asm/non_matchings/code/z_actor/func_800B882C.s,func_800B882C,0x800B882C,0x10 asm/non_matchings/code/z_actor/func_800B886C.s,func_800B886C,0x800B886C,0xB asm/non_matchings/code/z_actor/Actor_GetScreenPos.s,Actor_GetScreenPos,0x800B8898,0x27 -asm/non_matchings/code/z_actor/func_800B8934.s,func_800B8934,0x800B8934,0x31 +asm/non_matchings/code/z_actor/Actor_OnScreen.s,Actor_OnScreen,0x800B8934,0x31 asm/non_matchings/code/z_actor/Actor_HasParent.s,Actor_HasParent,0x800B89F8,0x9 asm/non_matchings/code/z_actor/Actor_PickUp.s,Actor_PickUp,0x800B8A1C,0x5A asm/non_matchings/code/z_actor/Actor_PickUpNearby.s,Actor_PickUpNearby,0x800B8B84,0xB @@ -772,8 +772,8 @@ asm/non_matchings/code/z_camera/Camera_Free.s,Camera_Free,0x800DDDA8,0xA asm/non_matchings/code/z_camera/Camera_Init.s,Camera_Init,0x800DDDD0,0x84 asm/non_matchings/code/z_camera/func_800DDFE0.s,func_800DDFE0,0x800DDFE0,0x40 asm/non_matchings/code/z_camera/func_800DE0E0.s,func_800DE0E0,0x800DE0E0,0x3 -asm/non_matchings/code/z_camera/func_800DE0EC.s,func_800DE0EC,0x800DE0EC,0x87 -asm/non_matchings/code/z_camera/func_800DE308.s,func_800DE308,0x800DE308,0x7 +asm/non_matchings/code/z_camera/Camera_InitPlayerSettings.s,Camera_InitPlayerSettings,0x800DE0EC,0x87 +asm/non_matchings/code/z_camera/Camera_ChangeStatus.s,Camera_ChangeStatus,0x800DE308,0x7 asm/non_matchings/code/z_camera/func_800DE324.s,func_800DE324,0x800DE324,0xC2 asm/non_matchings/code/z_camera/func_800DE62C.s,func_800DE62C,0x800DE62C,0x85 asm/non_matchings/code/z_camera/func_800DE840.s,func_800DE840,0x800DE840,0x14 @@ -794,7 +794,7 @@ asm/non_matchings/code/z_camera/Camera_GetCamDir.s,Camera_GetCamDir,0x800DFC90,0 asm/non_matchings/code/z_camera/Camera_GetCamDirPitch.s,Camera_GetCamDirPitch,0x800DFCB4,0xA asm/non_matchings/code/z_camera/Camera_GetCamDirYaw.s,Camera_GetCamDirYaw,0x800DFCDC,0xA asm/non_matchings/code/z_camera/Camera_AddQuake.s,Camera_AddQuake,0x800DFD04,0x1D -asm/non_matchings/code/z_camera/func_800DFD78.s,func_800DFD78,0x800DFD78,0x5E +asm/non_matchings/code/z_camera/Camera_SetViewParam.s,Camera_SetViewParam,0x800DFD78,0x5E asm/non_matchings/code/z_camera/func_800DFEF0.s,func_800DFEF0,0x800DFEF0,0xA asm/non_matchings/code/z_camera/func_800DFF18.s,func_800DFF18,0x800DFF18,0x7 asm/non_matchings/code/z_camera/func_800DFF34.s,func_800DFF34,0x800DFF34,0x4 @@ -802,7 +802,7 @@ asm/non_matchings/code/z_camera/func_800DFF44.s,func_800DFF44,0x800DFF44,0x7 asm/non_matchings/code/z_camera/Camera_SetFlags.s,Camera_SetFlags,0x800DFF60,0x9 asm/non_matchings/code/z_camera/Camera_ClearFlags.s,Camera_ClearFlags,0x800DFF84,0xA asm/non_matchings/code/z_camera/Camera_ChangeDoorCam.s,Camera_ChangeDoorCam,0x800DFFAC,0x34 -asm/non_matchings/code/z_camera/func_800E007C.s,func_800E007C,0x800E007C,0x4C +asm/non_matchings/code/z_camera/Camera_Copy.s,Camera_Copy,0x800E007C,0x4C asm/non_matchings/code/z_camera/func_800E01AC.s,func_800E01AC,0x800E01AC,0x3 asm/non_matchings/code/z_camera/Camera_GetQuakeOffset.s,Camera_GetQuakeOffset,0x800E01B8,0x9 asm/non_matchings/code/z_camera/func_800E01DC.s,func_800E01DC,0x800E01DC,0x13 @@ -2500,18 +2500,18 @@ asm/non_matchings/code/z_play/func_80165E7C.s,func_80165E7C,0x80165E7C,0x11 asm/non_matchings/code/z_play/func_80165EC0.s,func_80165EC0,0x80165EC0,0x68 asm/non_matchings/code/z_play/func_80166060.s,func_80166060,0x80166060,0x16 asm/non_matchings/code/z_play/func_801660B8.s,func_801660B8,0x801660B8,0x21 -asm/non_matchings/code/z_play/Play_Fini.s,Play_Fini,0x8016613C,0xA2 +asm/non_matchings/code/z_play/Play_Destroy.s,Play_Destroy,0x8016613C,0xA2 asm/non_matchings/code/z_play/func_801663C4.s,func_801663C4,0x801663C4,0xA0 asm/non_matchings/code/z_play/func_80166644.s,func_80166644,0x80166644,0x9C asm/non_matchings/code/z_play/func_801668B4.s,func_801668B4,0x801668B4,0x2D asm/non_matchings/code/z_play/func_80166968.s,func_80166968,0x80166968,0x72 asm/non_matchings/code/z_play/func_80166B30.s,func_80166B30,0x80166B30,0x339 -asm/non_matchings/code/z_play/func_80167814.s,func_80167814,0x80167814,0x174 +asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80167814,0x174 asm/non_matchings/code/z_play/func_80167DE4.s,func_80167DE4,0x80167DE4,0x4A asm/non_matchings/code/z_play/func_80167F0C.s,func_80167F0C,0x80167F0C,0x61 asm/non_matchings/code/z_play/Play_Draw.s,Play_Draw,0x80168090,0x347 asm/non_matchings/code/z_play/func_80168DAC.s,func_80168DAC,0x80168DAC,0x6E -asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80168F64,0x5A +asm/non_matchings/code/z_play/Play_Main.s,Play_Main,0x80168F64,0x5A asm/non_matchings/code/z_play/Play_InCsMode.s,Play_InCsMode,0x801690CC,0xD asm/non_matchings/code/z_play/func_80169100.s,func_80169100,0x80169100,0x3C asm/non_matchings/code/z_play/func_801691F0.s,func_801691F0,0x801691F0,0xC @@ -2519,22 +2519,22 @@ asm/non_matchings/code/z_play/Play_LoadScene.s,Play_LoadScene,0x80169220,0x17 asm/non_matchings/code/z_play/func_8016927C.s,func_8016927C,0x8016927C,0x12 asm/non_matchings/code/z_play/func_801692C4.s,func_801692C4,0x801692C4,0x44 asm/non_matchings/code/z_play/Play_SceneInit.s,Play_SceneInit,0x801693D4,0x28 -asm/non_matchings/code/z_play/func_80169474.s,func_80169474,0x80169474,0x1A +asm/non_matchings/code/z_play/Play_GetScreenPos.s,Play_GetScreenPos,0x80169474,0x1A asm/non_matchings/code/z_play/Play_CreateSubCamera.s,Play_CreateSubCamera,0x801694DC,0x2A asm/non_matchings/code/z_play/Play_GetActiveCamId.s,Play_GetActiveCamId,0x80169584,0x3 -asm/non_matchings/code/z_play/Play_CameraChangeStatus.s,Play_CameraChangeStatus,0x80169590,0x1C +asm/non_matchings/code/z_play/Play_ChangeCameraStatus.s,Play_ChangeCameraStatus,0x80169590,0x1C asm/non_matchings/code/z_play/Play_ClearCamera.s,Play_ClearCamera,0x80169600,0x1A asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s,Play_ClearAllSubCameras,0x80169668,0x1B asm/non_matchings/code/z_play/Play_GetCamera.s,Play_GetCamera,0x801696D4,0xE -asm/non_matchings/code/z_play/Play_CameraSetAtEye.s,Play_CameraSetAtEye,0x8016970C,0x44 -asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s,Play_CameraSetAtEyeUp,0x8016981C,0x49 -asm/non_matchings/code/z_play/Play_CameraSetFov.s,Play_CameraSetFov,0x80169940,0x12 -asm/non_matchings/code/z_play/Play_CameraSetRoll.s,Play_CameraSetRoll,0x80169988,0x13 +asm/non_matchings/code/z_play/Play_SetCameraAtEye.s,Play_SetCameraAtEye,0x8016970C,0x44 +asm/non_matchings/code/z_play/Play_SetCameraAtEyeUp.s,Play_SetCameraAtEyeUp,0x8016981C,0x49 +asm/non_matchings/code/z_play/Play_SetCameraFov.s,Play_SetCameraFov,0x80169940,0x12 +asm/non_matchings/code/z_play/Play_SetCameraRoll.s,Play_SetCameraRoll,0x80169988,0x13 asm/non_matchings/code/z_play/Play_CopyCamera.s,Play_CopyCamera,0x801699D4,0x1F asm/non_matchings/code/z_play/func_80169A50.s,func_80169A50,0x80169A50,0x1C -asm/non_matchings/code/z_play/Play_CameraChangeSetting.s,Play_CameraChangeSetting,0x80169AC0,0xF +asm/non_matchings/code/z_play/Play_ChangeCameraSetting.s,Play_ChangeCameraSetting,0x80169AC0,0xF asm/non_matchings/code/z_play/func_80169AFC.s,func_80169AFC,0x80169AFC,0x32 -asm/non_matchings/code/z_play/Play_CameraGetUID.s,Play_CameraGetUID,0x80169BC4,0xD +asm/non_matchings/code/z_play/Play_GetCameraUID.s,Play_GetCameraUID,0x80169BC4,0xD asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B asm/non_matchings/code/z_play/Play_GetActorCsCamSetting.s,Play_GetActorCsCamSetting,0x80169C64,0x8 asm/non_matchings/code/z_play/Play_GetActorCsCamFuncData.s,Play_GetActorCsCamFuncData,0x80169C84,0xE @@ -3238,7 +3238,7 @@ asm/non_matchings/code/code_80192BE0/Audio_NextRandom.s,Audio_NextRandom,0x80194 asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s,Audio_InitMesgQueues,0x801946E4,0xB asm/non_matchings/code/code_80194710/Audio_InvalDCache.s,Audio_InvalDCache,0x80194710,0x10 asm/non_matchings/code/code_80194710/Audio_WritebackDCache.s,Audio_WritebackDCache,0x80194750,0x10 -asm/non_matchings/code/code_80194710/func_80194790.s,func_80194790,0x80194790,0x1D +asm/non_matchings/code/code_80194710/osAiSetNextBuffer.s,osAiSetNextBuffer,0x80194790,0x1D asm/non_matchings/code/code_80194710/func_80194804.s,func_80194804,0x80194804,0xF asm/non_matchings/code/code_80194710/func_80194840.s,func_80194840,0x80194840,0x1C asm/non_matchings/code/code_80194710/func_801948B0.s,func_801948B0,0x801948B0,0x20 diff --git a/undefined_syms.txt b/undefined_syms.txt index 017116100..8b904ceda 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -431,8 +431,6 @@ D_0403F230 = 0x0403F230; D_04044300 = 0x04044300; D_0404F250 = 0x0404F250; D_04050550 = 0x04050550; -D_04050648 = 0x04050648; -D_040506E0 = 0x040506E0; D_04050D10 = 0x04050D10; D_040510B0 = 0x040510B0; D_04051180 = 0x04051180; @@ -932,18 +930,6 @@ D_06001398 = 0x06001398; D_06000074 = 0x06000074; D_06001E60 = 0x06001E60; -// ovl_En_Bigpamet - -D_06000440 = 0x06000440; -D_06000AF4 = 0x06000AF4; -D_06000B30 = 0x06000B30; -D_06001A50 = 0x06001A50; -D_06001C68 = 0x06001C68; -D_060031DC = 0x060031DC; -D_06004210 = 0x06004210; -D_06007C70 = 0x06007C70; -D_0600823C = 0x0600823C; - // ovl_En_Bombal D_06000A00 = 0x06000A00; @@ -1297,11 +1283,6 @@ D_06006F38 = 0x06006F38; D_06006FD8 = 0x06006FD8; D_06009930 = 0x06009930; -// ovl_En_Pp - -D_0600A844 = 0x0600A844; -D_06012768 = 0x06012768; - // ovl_En_Pr2 D_06003904 = 0x06003904;