diff --git a/soh/include/functions.h b/soh/include/functions.h index db0db0da7..bd5203790 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -78,7 +78,7 @@ OSPiHandle* osDriveRomInit(void); void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name); void StackCheck_Cleanup(StackEntry* entry); -StackStatus StackCheck_GetState(StackEntry* entry); +s32 StackCheck_GetState(StackEntry* entry); u32 StackCheck_CheckAll(void); u32 StackCheck_Check(StackEntry* entry); f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min, @@ -477,7 +477,7 @@ void func_8002F948(Actor* actor, u16 sfxId); void func_8002F974(Actor* actor, u16 sfxId); void func_8002F994(Actor* actor, s32 arg1); s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); -void func_800304B0(GlobalContext* globalCtx); +void Actor_DisableLens(GlobalContext* globalCtx); void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry); void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); s32 func_800314D4(GlobalContext* globalCtx, Actor* actorB, Vec3f* arg2, f32 arg3); @@ -1357,13 +1357,13 @@ void func_800AA4A8(View* view, f32 fovy, f32 near, f32 far); void func_800AA4E0(View* view, f32* fovy, f32* near, f32* far); void View_SetViewport(View* view, Viewport* viewport); void View_GetViewport(View* view, Viewport* viewport); -void func_800AA76C(View* view, f32 arg1, f32 arg2, f32 arg3); -void func_800AA78C(View* view, f32 arg1, f32 arg2, f32 arg3); -s32 func_800AA7AC(View* view, f32 arg1); -void func_800AA7B8(View* view); -void func_800AA814(View* view); -void func_800AA840(View* view, Vec3f vec1, Vec3f vec2, f32 arg3); -s32 func_800AA890(View* view, Mtx* mtx); +void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ); +void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); +s32 View_SetDistortionSpeed(View* view, f32 speed); +void View_InitDistortion(View* view); +void View_ClearDistortion(View* view); +void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed); +s32 View_StepDistortion(View* view, Mtx* projectionMtx); void func_800AAA50(View* view, s32 arg1); s32 func_800AAA9C(View* view); s32 func_800AB0A8(View* view); diff --git a/soh/include/variables.h b/soh/include/variables.h index 64256a284..2dc9d45f4 100644 --- a/soh/include/variables.h +++ b/soh/include/variables.h @@ -101,7 +101,7 @@ extern "C" extern void* gItemIcons[0x82]; extern u8 gItemAgeReqs[]; extern u8 gItemSlots[56]; - extern void (*gSceneCmdHandlers[26])(GlobalContext*, SceneCmd*); + extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*); extern s16 gLinkObjectIds[2]; extern u32 gObjectTableSize; extern RomFile gObjectTable[OBJECT_ID_MAX]; diff --git a/soh/include/z64.h b/soh/include/z64.h index d9570ae5e..1f0bbc25c 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -202,11 +202,11 @@ typedef struct { /* 0x00A0 */ Mtx viewing; /* 0x00E0 */ Mtx* projectionPtr; /* 0x00E4 */ Mtx* viewingPtr; - /* 0x00E8 */ Vec3f unk_E8; - /* 0x00F4 */ Vec3f unk_F4; - /* 0x0100 */ f32 unk_100; - /* 0x0104 */ Vec3f unk_104; - /* 0x0110 */ Vec3f unk_110; + /* 0x00E8 */ Vec3f distortionOrientation; + /* 0x00F4 */ Vec3f distortionScale; + /* 0x0100 */ f32 distortionSpeed; + /* 0x0104 */ Vec3f curDistortionOrientation; + /* 0x0110 */ Vec3f curDistortionScale; /* 0x011C */ u16 normal; // used to normalize the projection matrix /* 0x0120 */ s32 flags; /* 0x0124 */ s32 unk_124; @@ -273,11 +273,10 @@ typedef struct { /* 0x0000 */ u8 freezeFlashTimer; /* 0x0001 */ char unk_01[0x01]; /* 0x0002 */ u8 unk_02; - /* 0x0003 */ u8 unk_03; + /* 0x0003 */ u8 lensActive; /* 0x0004 */ char unk_04[0x04]; /* 0x0008 */ u8 total; // total number of actors loaded - /* 0x0009 */ char unk_09[0x03]; - /* 0x000C */ ActorListEntry actorLists[12]; + /* 0x000C */ ActorListEntry actorLists[ACTORCAT_MAX]; /* 0x006C */ TargetContext targetCtx; struct { /* 0x0104 */ u32 swch; @@ -890,13 +889,10 @@ void* xluDL; typedef struct { /* 0x00 */ u8 type; - /* 0x01 */ u8 num; // number of dlist entries - /* 0x04 */ void* start; - /* 0x08 */ void* end; -} Polygon; // size = 0xC +} PolygonBase; typedef struct { - /* 0x00 */ u8 type; + /* 0x00 */ PolygonBase base; /* 0x01 */ u8 num; // number of dlist entries /* 0x04 */ void* start; /* 0x08 */ void* end; @@ -917,7 +913,7 @@ typedef struct { } BgImage; // size = 0x1C typedef struct { - /* 0x00 */ u8 type; + /* 0x00 */ PolygonBase base; /* 0x01 */ u8 format; // 1 = single, 2 = multi /* 0x04 */ Gfx* dlist; union { @@ -955,27 +951,51 @@ typedef struct { } PolygonDlist2; // size = 0x8 typedef struct { - /* 0x00 */ u8 type; + /* 0x00 */ PolygonBase base; /* 0x01 */ u8 num; // number of dlist entries /* 0x04 */ void* start; /* 0x08 */ void* end; } PolygonType2; // size = 0xC typedef union { - Polygon polygon; + PolygonBase base; PolygonType0 polygon0; PolygonType1 polygon1; PolygonType2 polygon2; -} Mesh; // "Ground Shape" +} MeshHeader; // "Ground Shape" + +typedef enum { + /* 0 */ LENS_MODE_HIDE_ACTORS, // lens actors are visible by default, and hidden by using lens (for example, fake walls) + /* 1 */ LENS_MODE_SHOW_ACTORS // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) +} LensMode; + +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE1_0, + /* 1 */ ROOM_BEHAVIOR_TYPE1_1, + /* 2 */ ROOM_BEHAVIOR_TYPE1_2, + /* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused + /* 4 */ ROOM_BEHAVIOR_TYPE1_4, // unused + /* 5 */ ROOM_BEHAVIOR_TYPE1_5 +} RoomBehaviorType1; + +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE2_0, + /* 1 */ ROOM_BEHAVIOR_TYPE2_1, + /* 2 */ ROOM_BEHAVIOR_TYPE2_2, + /* 3 */ ROOM_BEHAVIOR_TYPE2_3, + /* 4 */ ROOM_BEHAVIOR_TYPE2_4, + /* 5 */ ROOM_BEHAVIOR_TYPE2_5, + /* 6 */ ROOM_BEHAVIOR_TYPE2_6 +} RoomBehaviorType2; typedef struct { /* 0x00 */ s8 num; /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 unk_02; - /* 0x03 */ u8 unk_03; + /* 0x02 */ u8 behaviorType2; + /* 0x03 */ u8 behaviorType1; /* 0x04 */ s8 echo; - /* 0x05 */ u8 showInvisActors; - /* 0x08 */ Mesh* mesh; // original name: "ground_shape" + /* 0x05 */ u8 lensMode; + /* 0x08 */ MeshHeader* meshHeader; // original name: "ground_shape" /* 0x0C */ void* segment; /* 0x10 */ char unk_10[0x4]; } Room; // size = 0x14 @@ -1244,7 +1264,7 @@ typedef struct GlobalContext { /* 0x11DF0 */ RomFile* roomList; /* 0x11DF4 */ ActorEntry* linkActorEntry; /* 0x11DF8 */ ActorEntry* setupActorList; - /* 0x11DFC */ UNK_PTR unk_11DFC; + /* 0x11DFC */ void* unk_11DFC; /* 0x11E00 */ EntranceEntry* setupEntranceList; /* 0x11E04 */ s16* setupExitList; /* 0x11E08 */ Path* setupPathList; diff --git a/soh/include/z64actor.h b/soh/include/z64actor.h index 6ecb10c49..cd58ac20b 100644 --- a/soh/include/z64actor.h +++ b/soh/include/z64actor.h @@ -79,7 +79,7 @@ typedef struct { typedef struct { /* 0x00 */ DamageTable* damageTable; - /* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body + /* 0x04 */ Vec3f displacement; // Amount to correct actor velocity by when colliding into a body /* 0x10 */ s16 cylRadius; // Used for various purposes /* 0x12 */ s16 cylHeight; // Used for various purposes /* 0x14 */ s16 cylYShift; // Unused. Purpose inferred from Cylinder16 and CollisionCheck_CylSideVsLineSeg @@ -158,7 +158,7 @@ typedef struct Actor { /* 0x084 */ f32 yDistToWater; // Distance to the surface of active waterbox. Negative value means above water /* 0x088 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags /* 0x08A */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player - /* 0x08C */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis + /* 0x08C */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player /* 0x090 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane /* 0x094 */ f32 yDistToPlayer; // Dist is negative if the actor is above the player /* 0x098 */ CollisionCheckInfo colChkInfo; // Variables related to the Collision Check system @@ -338,7 +338,8 @@ typedef enum { /* 0x08 */ ACTORCAT_MISC, /* 0x09 */ ACTORCAT_BOSS, /* 0x0A */ ACTORCAT_DOOR, - /* 0x0B */ ACTORCAT_CHEST + /* 0x0B */ ACTORCAT_CHEST, + /* 0x0C */ ACTORCAT_MAX } ActorCategory; //#define DEFINE_ACTOR(_0, enum, _2) enum, diff --git a/soh/include/z64animation.h b/soh/include/z64animation.h index 899d389cc..6bbf79159 100755 --- a/soh/include/z64animation.h +++ b/soh/include/z64animation.h @@ -23,7 +23,7 @@ typedef enum { /* 3 */ ANIMMODE_ONCE_INTERP, /* 4 */ ANIMMODE_LOOP_PARTIAL, /* 5 */ ANIMMODE_LOOP_PARTIAL_INTERP -} AnimationModes; +} AnimationMode; typedef enum { /* -1 */ ANIMTAPER_DECEL = -1, @@ -241,21 +241,21 @@ typedef s32 (*AnimUpdateFunc)(); typedef struct SkelAnime { /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton - /* 0x01 */ u8 mode; // 0: loop, 2: play once, 4: partial loop. +1 to interpolate between frames. + /* 0x01 */ u8 mode; // See `AnimationMode` /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. - /* 0x0C */ f32 startFrame; // In mode 4, start of partial loop. - /* 0x10 */ f32 endFrame; // In mode 2, Update returns true when curFrame is equal to this. In mode 4, end of partial loop. - /* 0x14 */ f32 animLength; // Total number of frames in the current animation's file. + /* 0x0C */ f32 startFrame; // In mode ANIMMODE_LOOP_PARTIAL*, start of partial loop. + /* 0x10 */ f32 endFrame; // In mode ANIMMODE_ONCE*, Update returns true when curFrame is equal to this. In mode ANIMMODE_LOOP_PARTIAL*, end of partial loop. + /* 0x14 */ f32 animLength; // Total number of frames in the current animation. /* 0x18 */ f32 curFrame; // Current frame in the animation /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate. /* 0x20 */ Vec3s* jointTable; // Current translation of model and rotations of all limbs /* 0x24 */ Vec3s* morphTable; // Table of values used to morph between animations /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1] /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph - /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph + /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph. /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. diff --git a/soh/include/z64camera.h b/soh/include/z64camera.h index a25129bc7..37b822c23 100644 --- a/soh/include/z64camera.h +++ b/soh/include/z64camera.h @@ -1203,8 +1203,8 @@ typedef struct { /* 0x14A */ s16 unk_14A; /* 0x14C */ s16 unk_14C; /* 0x14E */ s16 childCamIdx; - /* 0x150 */ s16 unk_150; - /* 0x152 */ s16 unk_152; + /* 0x150 */ s16 waterDistortionTimer; + /* 0x152 */ s16 distortionFlags; /* 0x154 */ s16 prevSetting; /* 0x156 */ s16 nextCamDataIdx; /* 0x158 */ s16 nextBGCheckId; diff --git a/soh/include/z64scene.h b/soh/include/z64scene.h index 400ecfee8..0e05224b6 100644 --- a/soh/include/z64scene.h +++ b/soh/include/z64scene.h @@ -423,20 +423,20 @@ typedef enum { typedef enum { /* 0x00 */ SCENE_CMD_ID_SPAWN_LIST, /* 0x01 */ SCENE_CMD_ID_ACTOR_LIST, - /* 0x02 */ SCENE_CMD_ID_UNUSED_02, - /* 0x03 */ SCENE_CMD_ID_COL_HEADER, + /* 0x02 */ SCENE_CMD_ID_UNUSED_2, + /* 0x03 */ SCENE_CMD_ID_COLLISION_HEADER, /* 0x04 */ SCENE_CMD_ID_ROOM_LIST, /* 0x05 */ SCENE_CMD_ID_WIND_SETTINGS, /* 0x06 */ SCENE_CMD_ID_ENTRANCE_LIST, /* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES, /* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR, - /* 0x09 */ SCENE_CMD_ID_UNK_09, - /* 0x0A */ SCENE_CMD_ID_MESH, + /* 0x09 */ SCENE_CMD_ID_UNDEFINED_9, + /* 0x0A */ SCENE_CMD_ID_MESH_HEADER, /* 0x0B */ SCENE_CMD_ID_OBJECT_LIST, /* 0x0C */ SCENE_CMD_ID_LIGHT_LIST, /* 0x0D */ SCENE_CMD_ID_PATH_LIST, - /* 0x0E */ SCENE_CMD_ID_TRANSI_ACTOR_LIST, - /* 0x0F */ SCENE_CMD_ID_ENV_LIGHT_SETTINGS, + /* 0x0E */ SCENE_CMD_ID_TRANSITION_ACTOR_LIST, + /* 0x0F */ SCENE_CMD_ID_LIGHT_SETTINGS_LIST, /* 0x10 */ SCENE_CMD_ID_TIME_SETTINGS, /* 0x11 */ SCENE_CMD_ID_SKYBOX_SETTINGS, /* 0x12 */ SCENE_CMD_ID_SKYBOX_DISABLES, @@ -446,7 +446,8 @@ typedef enum { /* 0x16 */ SCENE_CMD_ID_ECHO_SETTINGS, /* 0x17 */ SCENE_CMD_ID_CUTSCENE_DATA, /* 0x18 */ SCENE_CMD_ID_ALTERNATE_HEADER_LIST, - /* 0x19 */ SCENE_CMD_ID_MISC_SETTINGS + /* 0x19 */ SCENE_CMD_ID_MISC_SETTINGS, + /* 0x20 */ SCENE_CMD_ID_MAX } SceneCommandTypeID; #define SCENE_CMD_SPAWN_LIST(numSpawns, spawnList) \ @@ -456,10 +457,10 @@ typedef enum { { SCENE_CMD_ID_ACTOR_LIST, numActors, CMD_PTR(actorList) } #define SCENE_CMD_UNUSED_02(unk, data) \ - { SCENE_CMD_ID_UNUSED_02, unk, CMD_PTR(data) } + { SCENE_CMD_ID_UNUSED_2, unk, CMD_PTR(data) } #define SCENE_CMD_COL_HEADER(colHeader) \ - { SCENE_CMD_ID_COL_HEADER, 0, CMD_PTR(colHeader) } + { SCENE_CMD_ID_COLLISION_HEADER, 0, CMD_PTR(colHeader) } #define SCENE_CMD_ROOM_LIST(numRooms, roomList) \ { SCENE_CMD_ID_ROOM_LIST, numRooms, CMD_PTR(roomList) } @@ -478,10 +479,10 @@ typedef enum { curRoomUnk2 | _SHIFTL(showInvisActors, 8, 1) | _SHIFTL(disableWarpSongs, 10, 1) } #define SCENE_CMD_UNK_09() \ - { SCENE_CMD_ID_UNK_09, 0, CMD_W(0) } + { SCENE_CMD_ID_UNDEFINED_9, 0, CMD_W(0) } #define SCENE_CMD_MESH(meshHeader) \ - { SCENE_CMD_ID_MESH, 0, CMD_PTR(meshHeader) } + { SCENE_CMD_ID_MESH_HEADER, 0, CMD_PTR(meshHeader) } #define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \ { SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) } @@ -493,10 +494,10 @@ typedef enum { { SCENE_CMD_ID_PATH_LIST, 0, CMD_PTR(pathList) } #define SCENE_CMD_TRANSITION_ACTOR_LIST(numActors, list) \ - { SCENE_CMD_ID_TRANSI_ACTOR_LIST, numActors, CMD_PTR(list) } + { SCENE_CMD_ID_TRANSITION_ACTOR_LIST, numActors, CMD_PTR(list) } #define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \ - { SCENE_CMD_ID_ENV_LIGHT_SETTINGS, numLightSettings, CMD_PTR(lightSettingsList) } + { SCENE_CMD_ID_LIGHT_SETTINGS_LIST, numLightSettings, CMD_PTR(lightSettingsList) } #define SCENE_CMD_TIME_SETTINGS(hour, min, speed) \ { SCENE_CMD_ID_TIME_SETTINGS, 0, CMD_BBBB(hour, min, speed, 0) } diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index bddd2cfaa..37856aa81 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -85,8 +85,8 @@ typedef struct SaveStateInfo { OnePointCsFull D_8011D8DC_copy[3]; OnePointCsFull D_8011D954_copy[4]; OnePointCsFull D_8011D9F4_copy[3]; - int16_t D_8011DB08_copy; - int16_t D_8011DB0C_copy; + int16_t depthPhase_copy; + int16_t screenPlanePhase_copy; int32_t sOOBTimer_copy; f32 D_8015CE50_copy; f32 D_8015CE54_copy; @@ -437,8 +437,8 @@ void SaveState::BackupCameraData(void) { memcpy(info->D_8011D8DC_copy, D_8011D8DC, sizeof(info->D_8011D8DC_copy)); memcpy(info->D_8011D954_copy, D_8011D954, sizeof(info->D_8011D954_copy)); memcpy(info->D_8011D9F4_copy, D_8011D9F4, sizeof(info->D_8011D9F4_copy)); - info->D_8011DB08_copy = D_8011DB08; - info->D_8011DB0C_copy = D_8011DB0C; + info->depthPhase_copy = depthPhase; + info->screenPlanePhase_copy = screenPlanePhase; info->sOOBTimer_copy = sOOBTimer; info->D_8015CE50_copy = D_8015CE50; info->D_8015CE54_copy = D_8015CE54; @@ -465,8 +465,8 @@ void SaveState::LoadCameraData(void) { memcpy(D_8011D8DC, info->D_8011D8DC_copy, sizeof(info->D_8011D8DC_copy)); memcpy(D_8011D954, info->D_8011D954_copy, sizeof(info->D_8011D954_copy)); memcpy(D_8011D9F4, info->D_8011D9F4_copy, sizeof(info->D_8011D9F4_copy)); - D_8011DB08 = info->D_8011DB08_copy; - D_8011DB0C = info->D_8011DB0C_copy; + depthPhase = info->depthPhase_copy; + screenPlanePhase = info->screenPlanePhase_copy; sOOBTimer = info->sOOBTimer_copy; D_8015CE50 = info->D_8015CE50_copy; D_8015CE54 = info->D_8015CE54_copy; diff --git a/soh/soh/Enhancements/savestates_extern.inc b/soh/soh/Enhancements/savestates_extern.inc index b950333e5..33aeabf4c 100644 --- a/soh/soh/Enhancements/savestates_extern.inc +++ b/soh/soh/Enhancements/savestates_extern.inc @@ -24,8 +24,8 @@ extern "C" OnePointCsFull D_8011D88C[]; extern "C" OnePointCsFull D_8011D8DC[]; extern "C" OnePointCsFull D_8011D954[]; extern "C" OnePointCsFull D_8011D9F4[]; -extern "C" int16_t D_8011DB08; -extern "C" int16_t D_8011DB0C; +extern "C" int16_t depthPhase; +extern "C" int16_t screenPlanePhase; extern "C" int32_t sOOBTimer; extern "C" f32 D_8015CE50; extern "C" f32 D_8015CE54; diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 8c5839f6e..73953c681 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -16,7 +16,7 @@ extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene); -bool func_80098508(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetStartPositionList* cmdStartPos = (Ship::SetStartPositionList*)cmd; @@ -61,8 +61,7 @@ bool func_80098508(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x01: Actor List -bool func_800985DC(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetActorList* cmdActor = (Ship::SetActorList*)cmd; globalCtx->numSetupActors = cmdActor->entries.size(); @@ -92,8 +91,7 @@ bool func_800985DC(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { return false; } -// Scene Command 0x02: Unused 02 -bool func_80098630(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandUnused2(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { // Do we need to implement this? //globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); @@ -101,8 +99,7 @@ bool func_80098630(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x03: Collision Header -bool func_80098674(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandCollisionHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetCollisionHeader* cmdCol = (Ship::SetCollisionHeader*)cmd; @@ -208,8 +205,7 @@ bool func_80098674(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x04: Room List -bool func_800987A4(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandRoomList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetRoomList* cmdRoomList = (Ship::SetRoomList*)cmd; @@ -226,8 +222,7 @@ bool func_800987A4(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x06: Entrance List -bool func_800987F8(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandEntranceList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetEntranceList* otrEntrance = (Ship::SetEntranceList*)cmd; @@ -249,8 +244,7 @@ bool func_800987F8(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x07: Special Files -bool func_8009883C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSpecialFiles(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetSpecialObjects* otrSpecial = (Ship::SetSpecialObjects*)cmd; @@ -266,42 +260,40 @@ bool func_8009883C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x08: Room Behavior -bool func_80098904(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandRoomBehavior(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetRoomBehavior* cmdRoom = (Ship::SetRoomBehavior*)cmd; - globalCtx->roomCtx.curRoom.unk_03 = cmdRoom->gameplayFlags; - globalCtx->roomCtx.curRoom.unk_02 = cmdRoom->gameplayFlags2 & 0xFF; - globalCtx->roomCtx.curRoom.showInvisActors = (cmdRoom->gameplayFlags2 >> 8) & 1; + globalCtx->roomCtx.curRoom.behaviorType1 = cmdRoom->gameplayFlags; + globalCtx->roomCtx.curRoom.behaviorType2 = cmdRoom->gameplayFlags2 & 0xFF; + globalCtx->roomCtx.curRoom.lensMode = (cmdRoom->gameplayFlags2 >> 8) & 1; globalCtx->msgCtx.disableWarpSongs = (cmdRoom->gameplayFlags2 >> 0xA) & 1; return false; } -// Scene Command 0x0A: Mesh Header -bool func_80098958(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetMesh* otrMesh = (Ship::SetMesh*)cmd; - + if (otrMesh->cachedGameData != nullptr) - globalCtx->roomCtx.curRoom.mesh = (Mesh*)otrMesh->cachedGameData; + globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->cachedGameData; else { - globalCtx->roomCtx.curRoom.mesh = (Mesh*)malloc(sizeof(Mesh)); - globalCtx->roomCtx.curRoom.mesh->polygon.type = otrMesh->meshHeaderType; - globalCtx->roomCtx.curRoom.mesh->polygon.num = otrMesh->meshes.size(); + globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)malloc(sizeof(MeshHeader)); + globalCtx->roomCtx.curRoom.meshHeader->base.type = otrMesh->meshHeaderType; + globalCtx->roomCtx.curRoom.meshHeader->polygon0.num = otrMesh->meshes.size(); if (otrMesh->meshHeaderType == 2) - globalCtx->roomCtx.curRoom.mesh->polygon.start = malloc(sizeof(PolygonDlist2) * globalCtx->roomCtx.curRoom.mesh->polygon.num); + globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist2) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num); else - globalCtx->roomCtx.curRoom.mesh->polygon.start = malloc(sizeof(PolygonDlist) * globalCtx->roomCtx.curRoom.mesh->polygon.num); + globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num); - for (int i = 0; i < globalCtx->roomCtx.curRoom.mesh->polygon.num; i++) + for (int i = 0; i < globalCtx->roomCtx.curRoom.meshHeader->polygon0.num; i++) { if (otrMesh->meshHeaderType == 2) { - PolygonDlist2* arr = (PolygonDlist2*)globalCtx->roomCtx.curRoom.mesh->polygon.start; + PolygonDlist2* arr = (PolygonDlist2*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start; PolygonDlist2* dlist = &arr[i]; if (otrMesh->meshes[i].opa != "") @@ -331,7 +323,7 @@ bool func_80098958(GlobalContext* globalCtx, Ship::SceneCommand* cmd) dlist->pos.z = otrMesh->meshes[i].z; dlist->unk_06 = otrMesh->meshes[i].unk_06; - //globalCtx->roomCtx.curRoom.mesh->polygon.start = dlist; + //globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist; } else if (otrMesh->meshHeaderType == 1) { @@ -347,58 +339,58 @@ bool func_80098958(GlobalContext* globalCtx, Ship::SceneCommand* cmd) else pType->xlu = 0; - globalCtx->roomCtx.curRoom.mesh->polygon1.dlist = (Gfx*)pType; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.dlist = (Gfx*)pType; - globalCtx->roomCtx.curRoom.mesh->polygon1.format = otrMesh->meshes[0].imgFmt; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.format = otrMesh->meshes[0].imgFmt; if (otrMesh->meshes[0].imgFmt == 1) { - globalCtx->roomCtx.curRoom.mesh->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.source = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.source = (void*)(OTRGlobals::Instance->context->GetResourceManager()->LoadFile( otrMesh->meshes[0].images[0].sourceBackground)) .get() ->buffer.get(); - globalCtx->roomCtx.curRoom.mesh->polygon1.single.siz = otrMesh->meshes[0].images[0].siz; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.width = otrMesh->meshes[0].images[0].width; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.height = otrMesh->meshes[0].images[0].height; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0; - globalCtx->roomCtx.curRoom.mesh->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.siz = otrMesh->meshes[0].images[0].siz; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.width = otrMesh->meshes[0].images[0].width; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.height = otrMesh->meshes[0].images[0].height; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount; } else { - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.count = otrMesh->meshes[0].images.size(); - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list = - (BgImage*)calloc(sizeof(BgImage), globalCtx->roomCtx.curRoom.mesh->polygon1.multi.count); + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count = otrMesh->meshes[0].images.size(); + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list = + (BgImage*)calloc(sizeof(BgImage), globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count); for (size_t i = 0; i < otrMesh->meshes[0].images.size(); i++) { - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].source = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].source = (void*)(OTRGlobals::Instance->context->GetResourceManager()->LoadFile( otrMesh->meshes[0].images[i].sourceBackground)) .get() ->buffer.get(); - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].height = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].height = otrMesh->meshes[0].images[i].height; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].tlutCount = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].tlutCount = otrMesh->meshes[0].images[i].tlutCount; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].unk_00 = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_00 = otrMesh->meshes[0].images[i].unk_00; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].unk_0C = + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_0C = otrMesh->meshes[0].images[i].unk_0C; - globalCtx->roomCtx.curRoom.mesh->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id; + globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id; } } } else { - PolygonDlist* arr = (PolygonDlist*)globalCtx->roomCtx.curRoom.mesh->polygon.start; + PolygonDlist* arr = (PolygonDlist*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start; PolygonDlist* dlist = &arr[i]; if (otrMesh->meshes[i].opa != "") @@ -421,11 +413,11 @@ bool func_80098958(GlobalContext* globalCtx, Ship::SceneCommand* cmd) else dlist->xlu = 0; - //globalCtx->roomCtx.curRoom.mesh->polygon.start = dlist; + //globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist; } } - otrMesh->cachedGameData = globalCtx->roomCtx.curRoom.mesh; + otrMesh->cachedGameData = globalCtx->roomCtx.curRoom.meshHeader; } return false; @@ -433,8 +425,7 @@ bool func_80098958(GlobalContext* globalCtx, Ship::SceneCommand* cmd) extern "C" void* func_800982FC(ObjectContext * objectCtx, s32 bankIndex, s16 objectId); -// Scene Command 0x0B: Object List -bool func_8009899C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetObjectList* cmdObj = (Ship::SetObjectList*)cmd; @@ -496,8 +487,7 @@ bool func_8009899C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x0C: Light List -bool func_80098B74(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandLightList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetLightList* cmdLight = (Ship::SetLightList*)cmd; @@ -521,8 +511,7 @@ bool func_80098B74(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x0D: Path -bool func_80098C24(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandPathList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetPathways* cmdPath = (Ship::SetPathways*)cmd; @@ -548,8 +537,7 @@ bool func_80098C24(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x0E: Transition Actor List -bool func_80098C68(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandTransitionActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetTransitionActorList* cmdActor = (Ship::SetTransitionActorList*)cmd; globalCtx->transiActorCtx.numActors = cmdActor->entries.size(); @@ -576,8 +564,7 @@ bool func_80098C68(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { // transiActorCtx->numActors = 0; //} -// Scene Command 0x0F: Light Setting List -bool func_80098CC8(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandLightSettingsList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetLightingSettings* otrLight = (Ship::SetLightingSettings*)cmd; @@ -618,7 +605,7 @@ bool func_80098CC8(GlobalContext* globalCtx, Ship::SceneCommand* cmd) } // Scene Command 0x11: Skybox Settings -bool func_80098D1C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSkyboxSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetSkyboxSettings* cmdSky = (Ship::SetSkyboxSettings*)cmd; @@ -629,8 +616,7 @@ bool func_80098D1C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x12: Skybox Disables -bool func_80098D5C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSkyboxDisables(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetSkyboxModifier* cmdSky = (Ship::SetSkyboxModifier*)cmd; @@ -640,8 +626,7 @@ bool func_80098D5C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x10: Time Settings -bool func_80098D80(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetTimeSettings* cmdTime = (Ship::SetTimeSettings*)cmd; @@ -685,8 +670,7 @@ bool func_80098D80(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x05: Wind Settings -bool func_80099090(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandWindSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetWind* cmdWind = (Ship::SetWind*)cmd; s8 x = cmdWind->windWest; @@ -702,8 +686,7 @@ bool func_80099090(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { return false; } -// Scene Command 0x13: Exit List -bool func_800990F0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandExitList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::ExitList* cmdExit = (Ship::ExitList*)cmd; @@ -715,13 +698,11 @@ bool func_800990F0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x09: Undefined -bool func_80099134(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandUndefined9(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { return false; } -// Scene Command 0x15: Sound Settings -bool func_80099140(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandSoundSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetSoundSettings* cmdSnd = (Ship::SetSoundSettings*)cmd; globalCtx->sequenceCtx.seqId = cmdSnd->musicSequence; @@ -734,8 +715,7 @@ bool func_80099140(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { return false; } -// Scene Command 0x16: Echo Setting -bool func_8009918C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandEchoSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetEchoSettings* cmdEcho = (Ship::SetEchoSettings*)cmd; @@ -744,8 +724,7 @@ bool func_8009918C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x18: Alternate Headers -bool func_800991A0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetAlternateHeaders* cmdHeaders = (Ship::SetAlternateHeaders*)cmd; @@ -799,8 +778,7 @@ bool func_800991A0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x17: Cutscene Data -bool func_8009934C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandCutsceneData(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetCutscenes* cmdCS = (Ship::SetCutscenes*)cmd; @@ -811,8 +789,8 @@ bool func_8009934C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -// Scene Command 0x19: Misc. Settings (Camera & World Map Area) -bool func_800993C0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +// Camera & World Map Area +bool Scene_CommandMiscSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { Ship::SetCameraSettings* cmdCam = (Ship::SetCameraSettings*)cmd; @@ -838,10 +816,32 @@ bool func_800993C0(GlobalContext* globalCtx, Ship::SceneCommand* cmd) bool (*sceneCommands[])(GlobalContext*, Ship::SceneCommand*) = { - func_80098508, func_800985DC, func_80098630, func_80098674, func_800987A4, func_80099090, func_800987F8, - func_8009883C, func_80098904, func_80099134, func_80098958, func_8009899C, func_80098B74, func_80098C24, - func_80098C68, func_80098CC8, func_80098D80, func_80098D1C, func_80098D5C, func_800990F0, 0, - func_80099140, func_8009918C, func_8009934C, func_800991A0, func_800993C0, + Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST + Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST + Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 + Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER + Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST + Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS + Scene_CommandEntranceList, // SCENE_CMD_ID_ENTRANCE_LIST + Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES + Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR + Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9 + Scene_CommandMeshHeader, // SCENE_CMD_ID_MESH_HEADER + Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST + Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST + Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST + Scene_CommandTransitionActorList, // SCENE_CMD_ID_TRANSITION_ACTOR_LIST + Scene_CommandLightSettingsList, // SCENE_CMD_ID_LIGHT_SETTINGS_LIST + Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS + Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS + Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES + Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST + NULL, // SCENE_CMD_ID_END + Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS + Scene_CommandEchoSettings, // SCENE_CMD_ID_ECHO_SETTINGS + Scene_CommandCutsceneData, // SCENE_CMD_ID_CUTSCENE_DATA + Scene_CommandAlternateHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST + Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS }; s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene) diff --git a/soh/src/boot/stackcheck.c b/soh/src/boot/stackcheck.c index 2b216f0bd..e1acf911b 100644 --- a/soh/src/boot/stackcheck.c +++ b/soh/src/boot/stackcheck.c @@ -72,7 +72,7 @@ void StackCheck_Cleanup(StackEntry* entry) { } } -StackStatus StackCheck_GetState(StackEntry* entry) { +s32 StackCheck_GetState(StackEntry* entry) { u32* last; size_t used; size_t free; diff --git a/soh/src/boot/z_std_dma.c b/soh/src/boot/z_std_dma.c index d7948b104..c817c84e2 100644 --- a/soh/src/boot/z_std_dma.c +++ b/soh/src/boot/z_std_dma.c @@ -11,7 +11,7 @@ s32 sDmaMgrCurFileLine; u32 D_80009460 = 0; u32 gDmaMgrDmaBuffSize = 0x2000; -u32 sDmaMgrDataExistError = 0; +u32 sDmaMgrIsRomCompressed = false; // dmadata filenames #define DEFINE_DMA_ENTRY(name) #name, @@ -289,7 +289,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) { } if (!found) { - if (sDmaMgrDataExistError) { + if (sDmaMgrIsRomCompressed) { DmaMgr_Error(req, NULL, "DATA DON'T EXIST", "該当するデータが存在しません"); return; } @@ -385,14 +385,14 @@ void DmaMgr_Init(void) { //(uintptr_t)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart)); osSyncPrintf("dma_rom_ad[]\n"); - sDmaMgrDataExistError = 0; + sDmaMgrIsRomCompressed = false; name = sDmaMgrFileNames; iter = gDmaDataTable; idx = 0; while (iter->vromEnd != 0) { if (iter->romEnd != 0) { - sDmaMgrDataExistError = 1; + sDmaMgrIsRomCompressed = true; } osSyncPrintf( diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index d624fc42d..caff63c8e 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -651,7 +651,7 @@ void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) { } /** - * Tests if current scene unknown flag is set. + * Tests if unknown flag is set. */ s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) { if (flag < 0x20) { @@ -662,7 +662,7 @@ s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) { } /** - * Sets current scene unknown flag. + * Sets unknown flag. */ void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) { if (flag < 0x20) { @@ -673,7 +673,7 @@ void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) { } /** - * Unsets current scene unknown flag. + * Unsets unknown flag. */ void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag) { if (flag < 0x20) { @@ -1395,7 +1395,7 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { } void func_8002DE74(GlobalContext* globalCtx, Player* player) { - if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) { + if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(globalCtx)) { Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, MAIN_CAM), CAM_SET_HORSE); } } @@ -2348,9 +2348,9 @@ void func_80030488(GlobalContext* globalCtx) { LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10); } -void func_800304B0(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.unk_03 != 0) { - globalCtx->actorCtx.unk_03 = 0; +void Actor_DisableLens(GlobalContext* globalCtx) { + if (globalCtx->actorCtx.lensActive) { + globalCtx->actorCtx.lensActive = false; func_800876C8(globalCtx); } } @@ -2390,7 +2390,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* func_8002FA60(globalCtx); } -u32 D_80116068[] = { +u32 D_80116068[ACTORCAT_MAX] = { 0x100000C0, 0x100000C0, 0x00000000, 0x100004C0, 0x00000080, 0x300000C0, 0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0, }; @@ -2643,26 +2643,35 @@ void func_80030ED8(Actor* actor) { } } -void func_80030FA8(GraphicsContext* gfxCtx) { +#define LENS_MASK_WIDTH 64 +#define LENS_MASK_HEIGHT 64 +// 26 and 6 are for padding between the mask texture and the screen borders +#define LENS_MASK_OFFSET_S ((SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) - 26) +#define LENS_MASK_OFFSET_T ((SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) - 6) + +void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); - gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, - G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, LENS_MASK_WIDTH, + LENS_MASK_HEIGHT, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, + G_TX_NOLOD); s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; s32 w = OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH) << 2; - float ratio = OTRGetAspectRatio(); - - gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, 384, 224, 892, 732); - // TODO: Do correct math to fix it - gSPWideTextureRectangle(POLY_XLU_DISP++, x, 0, x + abs(x), 960, G_TX_RENDERTILE, 0, 0, 0, 0); - gSPWideTextureRectangle(POLY_XLU_DISP++, 0, 0, w, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597); + gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, (SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2, + (SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, (SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1) << 2, + (SCREEN_HEIGHT / 2 + LENS_MASK_HEIGHT - 1) << 2); + gSPWideTextureRectangle(POLY_XLU_DISP++, x, 0, x + abs(x), SCREEN_HEIGHT << 2, G_TX_RENDERTILE, 0, 0, 0, 0); + gSPWideTextureRectangle(POLY_XLU_DISP++, 0, 0, w, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, + LENS_MASK_OFFSET_S << 5, LENS_MASK_OFFSET_T << 5, + (1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH, + (1 << 10) * (SCREEN_HEIGHT - 2 * LENS_MASK_OFFSET_T) / SCREEN_HEIGHT); gDPPipeSync(POLY_XLU_DISP++); CLOSE_DISPS(gfxCtx); } -void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { +void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; @@ -2675,28 +2684,41 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv gDPPipeSync(POLY_XLU_DISP++); - if (globalCtx->roomCtx.curRoom.showInvisActors == 0) { + if (globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { + // Update both the color frame buffer and the z-buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2); + gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255); + + // the z-buffer will later only allow drawing inside the lens circle } else { + // Update the z-buffer but not the color frame buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); + + // inverts the mask image, which initially is 0 inner and 74 outer, + // by setting the combiner to draw 74 - image instead of the image gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 74, 74, 74, 74); + + // the z-buffer will later only allow drawing outside the lens circle } + // Together with the depth source set above, this sets the depth to the closest. + // For a pixel with such a depth value, the z-buffer will reject drawing to that pixel. gDPSetPrimDepth(POLY_XLU_DISP++, 0, 0); - func_80030FA8(gfxCtx); + // The z-buffer will be updated where the mask is not fully transparent. + Actor_DrawLensOverlay(gfxCtx); // "Magic lens invisible Actor display START" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", numInvisibleActors); @@ -2711,7 +2733,9 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv // "Magic lens invisible Actor display END" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors); - if (globalCtx->roomCtx.curRoom.showInvisActors != 0) { + if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + // Draw the lens overlay to the color frame buffer + gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)" gDPPipeSync(POLY_XLU_DISP++); @@ -2723,7 +2747,7 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255); - func_80030FA8(gfxCtx); + Actor_DrawLensOverlay(gfxCtx); gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 1); // "Blue spectacles (exterior)" } @@ -2808,8 +2832,8 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_7) && - ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) || - (actor->room != globalCtx->roomCtx.curRoom.num))) { + ((globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || + globalCtx->actorCtx.lensActive || (actor->room != globalCtx->roomCtx.curRoom.num))) { ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX); invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; @@ -2835,10 +2859,10 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || (HREG(72) != 0)) { - if (globalCtx->actorCtx.unk_03 != 0) { - func_8003115C(globalCtx, invisibleActorCounter, invisibleActors); + if (globalCtx->actorCtx.lensActive) { + Actor_DrawLensActors(globalCtx, invisibleActorCounter, invisibleActors); if ((globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx)) { - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); } } } @@ -3195,6 +3219,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); + if (spawnedActor == NULL) { return NULL; } diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index c0b70a904..ea37cab1a 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -11,7 +11,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags); s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags); s32 Camera_QRegInit(void); -s32 Camera_CheckWater(Camera* camera); +s32 Camera_UpdateWater(Camera* camera); #define RELOAD_PARAMS \ (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14 || R_RELOAD_CAM_PARAMS) @@ -28,6 +28,12 @@ s32 Camera_CheckWater(Camera* camera); #define FLG_ADJSLOPE (1 << 0) #define FLG_OFFGROUND (1 << 7) +#define DISTORTION_HOT_ROOM (1 << 0) +#define DISTORTION_UNDERWATER_WEAK (1 << 1) +#define DISTORTION_UNDERWATER_MEDIUM (1 << 2) +#define DISTORTION_UNDERWATER_STRONG (1 << 3) +#define DISTORTION_UNDERWATER_FISHING (1 << 4) + #include "z_camera_data.inc" /*===============================================================*/ @@ -972,7 +978,7 @@ s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) { f32 phi_f2; Vec3f posOffsetTarget; Vec3f atTarget; - f32 sp38; // unused + f32 pad; f32 temp_ret; PosRot* playerPosRot = &camera->playerPosRot; @@ -7004,19 +7010,20 @@ void func_80057FC4(Camera* camera) { if (camera != &camera->globalCtx->mainCamera) { camera->prevSetting = camera->setting = CAM_SET_FREE0; camera->unk_14C &= ~0x4; - } else if (camera->globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) { - switch (camera->globalCtx->roomCtx.curRoom.unk_03) { - case 1: + } else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) { + switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) { + case ROOM_BEHAVIOR_TYPE1_1: Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_DUNGEON0; break; - case 0: + case ROOM_BEHAVIOR_TYPE1_0: osSyncPrintf("camera: room type: default set field\n"); Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_NORMAL0; break; default: - osSyncPrintf("camera: room type: default set etc (%d)\n", camera->globalCtx->roomCtx.curRoom.unk_03); + osSyncPrintf("camera: room type: default set etc (%d)\n", + camera->globalCtx->roomCtx.curRoom.behaviorType1); Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_NORMAL0; camera->unk_14C |= 4; @@ -7095,7 +7102,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) { osSyncPrintf(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n"); if (camera->thisIdx == MAIN_CAM) { - Camera_CheckWater(camera); + Camera_UpdateWater(camera); } } @@ -7203,7 +7210,7 @@ void Camera_PrintSettings(Camera* camera) { } } -s32 Camera_CheckWater(Camera* camera) { +s32 Camera_UpdateWater(Camera* camera) { f32 waterY; s16 newQuakeId; s32 waterLightsIndex; @@ -7280,7 +7287,7 @@ s32 Camera_CheckWater(Camera* camera) { camera->unk_14C |= 0x100; osSyncPrintf("kankyo changed water, sound on\n"); Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex); - camera->unk_150 = 0x50; + camera->waterDistortionTimer = 80; } Audio_SetExtraFilter(0x20); @@ -7299,13 +7306,13 @@ s32 Camera_CheckWater(Camera* camera) { } } - if (camera->unk_150 > 0) { - camera->unk_150--; - camera->unk_152 |= 8; - } else if (camera->globalCtx->sceneNum == 0x49) { - camera->unk_152 |= 0x10; + if (camera->waterDistortionTimer > 0) { + camera->waterDistortionTimer--; + camera->distortionFlags |= DISTORTION_UNDERWATER_STRONG; + } else if (camera->globalCtx->sceneNum == SCENE_TURIBORI) { + camera->distortionFlags |= DISTORTION_UNDERWATER_FISHING; } else { - camera->unk_152 |= 2; + camera->distortionFlags |= DISTORTION_UNDERWATER_WEAK; } } else { if (camera->unk_14C & 0x100) { @@ -7315,21 +7322,18 @@ s32 Camera_CheckWater(Camera* camera) { if (*quakeId != 0) { Quake_RemoveFromIdx(*quakeId); } - camera->unk_150 = 0; - camera->unk_152 = 0; + camera->waterDistortionTimer = 0; + camera->distortionFlags = 0; } Audio_SetExtraFilter(0); } //! @bug: doesn't always return a value, but sometimes does. } -/** - * Sets the room to be hot camera quake flag - */ -s32 Camera_SetRoomHotFlag(Camera* camera) { - camera->unk_152 &= ~1; - if (camera->globalCtx->roomCtx.curRoom.unk_02 == 3) { - camera->unk_152 |= 1; +s32 Camera_UpdateHotRoom(Camera* camera) { + camera->distortionFlags &= ~DISTORTION_HOT_ROOM; + if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { + camera->distortionFlags |= DISTORTION_HOT_ROOM; } return 1; @@ -7364,80 +7368,87 @@ s32 Camera_DbgChangeMode(Camera* camera) { return true; } -s16 D_8011DB08 = 0x3F0; -s16 D_8011DB0C = 0x156; -void func_80058E8C(Camera* camera) { - s32 pad3; - f32 sp60; - s32 pad; - s32 pad1; - s32 pad4; - f32 phi_f2; - s32 pad2; - f32 phi_f0; - f32 phi_f20; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; +s16 depthPhase = 0x3F0; +s16 screenPlanePhase = 0x156; +void Camera_UpdateDistortion(Camera* camera) { + f32 scaleFactor; + f32 speedFactor; + f32 depthPhaseStep; + f32 screenPlanePhaseStep; + s32 pad[5]; + f32 xScale; + f32 yScale; + f32 zScale; + f32 speed; - if (camera->unk_152 != 0) { - if (camera->unk_152 & 4) { - phi_f0 = 0.0f; - phi_f2 = 170.0f; - sp3C = 0.01f; - sp40 = -0.01f; - sp38 = 0.0f; - sp34 = 0.6f; - phi_f20 = camera->unk_150 / 60.0f; - sp60 = 1.0f; - } else if (camera->unk_152 & 8) { - phi_f0 = 248.0f; - phi_f2 = -90.0f; - sp38 = 0.2f; - sp34 = 0.2f; - sp40 = -0.3f; - sp3C = 0.3f; - phi_f20 = camera->unk_150 / 80.0f; - sp60 = 1.0f; - } else if (camera->unk_152 & 2) { - phi_f0 = 359.2f; - phi_f2 = -18.5f; - sp40 = 0.09f; - sp38 = 0.01f; - sp3C = 0.09f; - sp34 = 0.08f; - phi_f20 = + if (camera->distortionFlags != 0) { + if (camera->distortionFlags & DISTORTION_UNDERWATER_MEDIUM) { + depthPhaseStep = 0.0f; + screenPlanePhaseStep = 170.0f; + + xScale = -0.01f; + yScale = 0.01f; + zScale = 0.0f; + + speed = 0.6f; + scaleFactor = camera->waterDistortionTimer / 60.0f; + speedFactor = 1.0f; + } else if (camera->distortionFlags & DISTORTION_UNDERWATER_STRONG) { + depthPhaseStep = 248.0f; + screenPlanePhaseStep = -90.0f; + + xScale = -0.3f; + yScale = 0.3f; + zScale = 0.2f; + + speed = 0.2f; + scaleFactor = camera->waterDistortionTimer / 80.0f; + speedFactor = 1.0f; + } else if (camera->distortionFlags & DISTORTION_UNDERWATER_WEAK) { + depthPhaseStep = 359.2f; + screenPlanePhaseStep = -18.5f; + + xScale = 0.09f; + yScale = 0.09f; + zScale = 0.01f; + + speed = 0.08f; + scaleFactor = (((camera->waterYPos - camera->eye.y) > 150.0f ? 1.0f : (camera->waterYPos - camera->eye.y) / 150.0f) * 0.45f) + (camera->speedRatio * 0.45f); - sp60 = phi_f20; - } else if (camera->unk_152 & 1) { - // hot room flag - phi_f2 = 150.0f; - phi_f0 = 0.0f; - sp3C = 0.01f; - sp38 = 0.01f; - sp40 = -0.01f; - sp34 = 0.6f; - sp60 = 1.0f; - phi_f20 = 1.0f; + speedFactor = scaleFactor; + } else if (camera->distortionFlags & DISTORTION_HOT_ROOM) { + // Gives the hot-room a small mirage-like appearance + depthPhaseStep = 0.0f; + screenPlanePhaseStep = 150.0f; + xScale = -0.01f; + yScale = 0.01f; + zScale = 0.01f; + + speed = 0.6f; + speedFactor = 1.0f; + scaleFactor = 1.0f; } else { + // DISTORTION_UNDERWATER_FISHING return; } - D_8011DB08 += DEGF_TO_BINANG(phi_f0); - D_8011DB0C += DEGF_TO_BINANG(phi_f2); - Math_CosS(D_8011DB08); - Math_SinS(D_8011DB08); - Math_SinS(D_8011DB0C); - func_800AA76C(&camera->globalCtx->view, 0.0f, 0.0f, 0.0f); - func_800AA78C(&camera->globalCtx->view, Math_SinS(D_8011DB0C) * (sp40 * phi_f20) + 1.0f, - Math_CosS(D_8011DB0C) * (sp3C * phi_f20) + 1.0f, Math_CosS(D_8011DB08) * (sp38 * phi_f20) + 1.0f); - func_800AA7AC(&camera->globalCtx->view, sp34 * sp60); + + depthPhase += DEGF_TO_BINANG(depthPhaseStep); + screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep); + + View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f, + Math_SinS(screenPlanePhase) * 0.0f); + View_SetDistortionScale(&camera->globalCtx->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f, + Math_CosS(screenPlanePhase) * (yScale * scaleFactor) + 1.0f, + Math_CosS(depthPhase) * (zScale * scaleFactor) + 1.0f); + View_SetDistortionSpeed(&camera->globalCtx->view, speed * speedFactor); + camera->unk_14C |= 0x40; + } else if (camera->unk_14C & 0x40) { - func_800AA814(&camera->globalCtx->view); + View_ClearDistortion(&camera->globalCtx->view); camera->unk_14C &= ~0x40; } } @@ -7506,8 +7517,8 @@ Vec3s Camera_Update(Camera* camera) { if (sOOBTimer < 200) { if (camera->status == CAM_STAT_ACTIVE) { - Camera_CheckWater(camera); - Camera_SetRoomHotFlag(camera); + Camera_UpdateWater(camera); + Camera_UpdateHotRoom(camera); } if (!(camera->unk_14C & 4)) { @@ -7647,7 +7658,8 @@ Vec3s Camera_Update(Camera* camera) { camera->skyboxOffset = quake.eyeOffset; - func_80058E8C(camera); + Camera_UpdateDistortion(camera); + if ((camera->globalCtx->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) { View_SetScale(&camera->globalCtx->view, 0.79f); } else { @@ -7844,7 +7856,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { func_80078884(0); break; case 2: - if (camera->globalCtx->roomCtx.curRoom.unk_03 == 1) { + if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { func_80078884(NA_SE_SY_ATTENTION_URGENCY); } else { func_80078884(NA_SE_SY_ATTENTION_ON); diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 7fd9a7480..a8bc385f8 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -36,8 +36,8 @@ typedef struct { } LightningBolt; // size = 0x20 typedef struct { - /* 0x00 */ s32 unk0; - /* 0x04 */ s32 unk1; + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; } Struct_8011FAF0; // size = 0x8 Struct_8011FAF0 D_8011FAF0[] = { @@ -215,7 +215,7 @@ u8 sGameOverLightsIntensity; u16 D_8015FDB0; s32 func_8006F0A0(s32 a0) { - s32 ret = ((a0 >> 4 & 0x7FF) << D_8011FAF0[a0 >> 15 & 7].unk0) + D_8011FAF0[a0 >> 15 & 7].unk1; + s32 ret = ((a0 >> 4 & 0x7FF) << D_8011FAF0[a0 >> 15 & 7].unk_00) + D_8011FAF0[a0 >> 15 & 7].unk_04; return ret; } @@ -2454,7 +2454,7 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 f32 temp; s32 i; - if (globalCtx->roomCtx.curRoom.unk_03 != 5 && func_800C0CB8(globalCtx)) { + if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(globalCtx)) { arg1 = CLAMP_MIN(arg1, 0.0f); arg1 = CLAMP_MAX(arg1, 1.0f); diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 24211c590..ba589f56c 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -817,7 +817,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; } - if ((globalCtx->roomCtx.curRoom.unk_03 == 1) && (interfaceCtx->minimapAlpha >= 0xFF)) { + if ((globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { interfaceCtx->minimapAlpha = 255; } } @@ -2781,7 +2781,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 2: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 1; @@ -2793,7 +2793,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 1: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 6; @@ -2821,7 +2821,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 4: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 4; @@ -3010,8 +3010,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { } if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) || !hasLens || - (globalCtx->actorCtx.unk_03 == 0)) { - globalCtx->actorCtx.unk_03 = 0; + !globalCtx->actorCtx.lensActive) { + globalCtx->actorCtx.lensActive = false; Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.unk_13F0 = 0; @@ -5884,7 +5884,8 @@ void Interface_Update(GlobalContext* globalCtx) { gTimeIncrement = sPrevTimeIncrement; globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; } - } else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) { + } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && + (interfaceCtx->restrictions.sunsSong != 3)) { if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime < 0xC001)) { gSaveContext.nextDayTime = 0; globalCtx->fadeTransition = 4; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 104b7f1e4..622a64a94 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -306,7 +306,7 @@ void Gameplay_Init(GameState* thisx) { Audio_SetExtraFilter(0); Quake_Init(); - for (i = 0; i < 4; i++) { + for (i = 0; i < ARRAY_COUNT(globalCtx->cameraPtrs); i++) { globalCtx->cameraPtrs[i] = NULL; } @@ -1932,7 +1932,7 @@ void Gameplay_TriggerRespawn(GlobalContext* globalCtx) { } s32 func_800C0CB8(GlobalContext* globalCtx) { - return (globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) && + return (globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) && (YREG(15) != 0x40) && (globalCtx->sceneNum != SCENE_HAIRAL_NIWA); } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 2db533821..99425bd8d 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -322,7 +322,7 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) { IREG(69) = bootRegs[15]; MREG(95) = bootRegs[16]; - if (globalCtx->roomCtx.curRoom.unk_03 == 2) { + if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { REG(45) = 500; } } @@ -615,7 +615,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { TextTriggerEntry* triggerEntry; s32 var; - if (globalCtx->roomCtx.curRoom.unk_02 == 3) { // Room is hot + if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot var = 0; } else if ((this->unk_840 > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater diff --git a/soh/src/code/z_rcp.c b/soh/src/code/z_rcp.c index 7050973e1..c6a50cf94 100644 --- a/soh/src/code/z_rcp.c +++ b/soh/src/code/z_rcp.c @@ -1012,7 +1012,7 @@ void func_80093C80(GlobalContext* globalCtx) { func_80093D18(gfxCtx); - if (globalCtx->roomCtx.curRoom.unk_03 == 3) { + if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) { OPEN_DISPS(gfxCtx); gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE); diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index d73533ff8..593406d69 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -53,7 +53,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } - polygon0 = &room->mesh->polygon0; + polygon0 = &room->meshHeader->polygon0; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon0->start); for (i = 0; i < polygon0->num; i++) { if ((flags & 1) && (polygonDlist->opa != NULL)) { @@ -113,7 +113,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } - polygon2 = &room->mesh->polygon2; + polygon2 = &room->meshHeader->polygon2; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon2->start); spA4 = spB8; @@ -346,7 +346,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { camera = GET_ACTIVE_CAM(globalCtx); sp9C = (camera->setting == CAM_SET_PREREND_FIXED); - polygon1 = &room->mesh->polygon1; + polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); sp98 = (flags & 1) && sp9C && polygon1->single.source && !(SREG(25) & 1); sp94 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2); @@ -447,7 +447,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { camera = GET_ACTIVE_CAM(globalCtx); sp98 = (camera->setting == CAM_SET_PREREND_FIXED); - polygon1 = &room->mesh->polygon1; + polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); bgImage = func_80096A74(polygon1, globalCtx); sp94 = (flags & 1) && sp98 && bgImage->source && !(SREG(25) & 1); @@ -494,7 +494,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { // Room Draw Polygon Type 1 void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) { - PolygonType1* polygon1 = &room->mesh->polygon1; + PolygonType1* polygon1 = &room->meshHeader->polygon1; if (polygon1->format == 1) { func_80096680(globalCtx, room, flags); @@ -626,8 +626,8 @@ void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { if (room->segment != NULL) { gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); - ASSERT(room->mesh->polygon.type < ARRAY_COUNTU(sRoomDrawHandlers)); - sRoomDrawHandlers[room->mesh->polygon.type](globalCtx, room, flags); + ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers)); + sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags); } } diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index a80fa62ea..145d039a1 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -168,11 +168,11 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { osSyncPrintf("*** Scene_Word = { code=%d, data1=%02x, data2=%04x } ***\n", cmdCode, sceneCmd->base.data1, sceneCmd->base.data2); - if (cmdCode == 0x14) { + if (cmdCode == SCENE_CMD_ID_END) { break; } - if (cmdCode <= 0x19) { + if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) { gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd); } else { osSyncPrintf(VT_FGCOL(RED)); @@ -184,7 +184,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { return 0; } -void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; s16 linkObjectId; @@ -197,19 +197,16 @@ void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) { Object_Spawn(&globalCtx->objectCtx, linkObjectId); } -// Scene Command 0x01: Actor List -void func_800985DC(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->numSetupActors = cmd->actorList.num; globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); } -// Scene Command 0x02: Unused 02 -void func_80098630(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); } -// Scene Command 0x03: Collision Header -void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) { CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment); colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); @@ -221,19 +218,16 @@ void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) { BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); } -// Scene Command 0x04: Room List -void func_800987A4(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->numRooms = cmd->roomList.num; globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); } -// Scene Command 0x06: Entrance List -void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); } -// Scene Command 0x07: Special Files -void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId); gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); @@ -244,21 +238,18 @@ void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Command 0x08: Room Behavior -void func_80098904(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.unk_03 = cmd->roomBehavior.gpFlag1; - globalCtx->roomCtx.curRoom.unk_02 = cmd->roomBehavior.gpFlag2 & 0xFF; - globalCtx->roomCtx.curRoom.showInvisActors = (cmd->roomBehavior.gpFlag2 >> 8) & 1; +void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { + globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; + globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; + globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; } -// Scene Command 0x0A: Mesh Header -void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.mesh = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); +void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) { + globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); } -// Scene Command 0x0B: Object List -void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -307,8 +298,7 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->objectCtx.num = i; } -// Scene Command 0x0C: Light List -void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment); @@ -318,13 +308,11 @@ void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Command 0x0D: Path List -void func_80098C24(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); } -// Scene Command 0x0E: Transition Actor List -void func_80098C68(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->transiActorCtx.numActors = cmd->transiActorList.num; globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); } @@ -333,27 +321,23 @@ void TransitionActor_InitContext(GameState* state, TransitionActorContext* trans transiActorCtx->numActors = 0; } -// Scene Command 0x0F: Light Setting List -void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); } -// Scene Command 0x11: Skybox Settings -void func_80098D1C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->skyboxId = cmd->skyboxSettings.skyboxId; globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk_05; globalCtx->envCtx.indoors = cmd->skyboxSettings.unk_06; } -// Scene Command 0x12: Skybox Disables -void func_80098D5C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04; globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05; } -// Scene Command 0x10: Time Settings -void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.dayTime = ((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000); @@ -388,8 +372,7 @@ void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Command 0x05: Wind Settings -void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { s8 x = cmd->windSettings.x; s8 y = cmd->windSettings.y; s8 z = cmd->windSettings.z; @@ -401,17 +384,14 @@ void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07; } -// Scene Command 0x13: Exit List -void func_800990F0(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); } -// Scene Command 0x09: Undefined -void func_80099134(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) { } -// Scene Command 0x15: Sound Settings -void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId; globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; @@ -420,13 +400,11 @@ void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Command 0x16: Echo Setting -void func_8009918C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo; } -// Scene Command 0x18: Alternate Headers -void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 pad; SceneCmd* altHeader; @@ -439,7 +417,7 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) { if (altHeader != NULL) { Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); - (cmd + 1)->base.code = 0x14; + (cmd + 1)->base.code = SCENE_CMD_ID_END; } else { // "Coughh! There is no specified dataaaaa!" osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!"); @@ -453,21 +431,20 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) { if (altHeader != NULL) { Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); - (cmd + 1)->base.code = 0x14; + (cmd + 1)->base.code = SCENE_CMD_ID_END; } } } } } -// Scene Command 0x17: Cutscene Data -void func_8009934C(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) { osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment); globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); } -// Scene Command 0x19: Misc. Settings (Camera & World Map Area) -void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) { +// Camera & World Map Area +void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) { YREG(15) = cmd->miscSettings.cameraMovement; gSaveContext.worldMapArea = cmd->miscSettings.area; @@ -487,11 +464,33 @@ void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void (*gSceneCmdHandlers[])(GlobalContext*, SceneCmd*) = { - func_80098508, func_800985DC, func_80098630, func_80098674, func_800987A4, func_80099090, func_800987F8, - func_8009883C, func_80098904, func_80099134, func_80098958, func_8009899C, func_80098B74, func_80098C24, - func_80098C68, func_80098CC8, func_80098D80, func_80098D1C, func_80098D5C, func_800990F0, NULL, - func_80099140, func_8009918C, func_8009934C, func_800991A0, func_800993C0, +void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = { + Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST + Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST + Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 + Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER + Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST + Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS + Scene_CommandEntranceList, // SCENE_CMD_ID_ENTRANCE_LIST + Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES + Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR + Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9 + Scene_CommandMeshHeader, // SCENE_CMD_ID_MESH_HEADER + Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST + Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST + Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST + Scene_CommandTransitionActorList, // SCENE_CMD_ID_TRANSITION_ACTOR_LIST + Scene_CommandLightSettingsList, // SCENE_CMD_ID_LIGHT_SETTINGS_LIST + Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS + Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS + Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES + Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST + NULL, // SCENE_CMD_ID_END + Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS + Scene_CommandEchoSettings, // SCENE_CMD_ID_ECHO_SETTINGS + Scene_CommandCutsceneData, // SCENE_CMD_ID_CUTSCENE_DATA + Scene_CommandAlternateHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST + Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS }; RomFile sNaviMsgFiles[] = { diff --git a/soh/src/code/z_scene_table.c b/soh/src/code/z_scene_table.c index ea1f45863..4987cba2f 100644 --- a/soh/src/code/z_scene_table.c +++ b/soh/src/code/z_scene_table.c @@ -2401,12 +2401,14 @@ void func_8009FE58(GlobalContext* globalCtx) { temp = 0.020000001f; if (globalCtx->pauseCtx.state == 0) { - func_800AA76C(&globalCtx->view, ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_CosS(D_8012A39C), - ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A39C), - ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A3A0)); - func_800AA78C(&globalCtx->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), - 1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C))); - func_800AA7AC(&globalCtx->view, 0.95f); + View_SetDistortionOrientation(&globalCtx->view, + ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_CosS(D_8012A39C), + ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A39C), + ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A3A0)); + View_SetDistortionScale(&globalCtx->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), + 1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), + 1.f + (1 * temp * Math_CosS(D_8012A39C))); + View_SetDistortionSpeed(&globalCtx->view, 0.95f); } switch (globalCtx->roomCtx.unk_74[0]) { diff --git a/soh/src/code/z_view.c b/soh/src/code/z_view.c index 6b70bfac0..c84634a6b 100644 --- a/soh/src/code/z_view.c +++ b/soh/src/code/z_view.c @@ -64,7 +64,7 @@ void View_Init(View* view, GraphicsContext* gfxCtx) { view->unk_124 = 0; view->flags = 1 | 2 | 4; - func_800AA7B8(view); + View_InitDistortion(view); } void View_GetParams(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up) { @@ -193,81 +193,87 @@ void func_800AA550(View* view) { CLOSE_DISPS(gfxCtx); } -void func_800AA76C(View* view, f32 x, f32 y, f32 z) { - view->unk_E8.x = x; - view->unk_E8.y = y; - view->unk_E8.z = z; +void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ) { + view->distortionOrientation.x = rotX; + view->distortionOrientation.y = rotY; + view->distortionOrientation.z = rotZ; } -void func_800AA78C(View* view, f32 x, f32 y, f32 z) { - view->unk_F4.x = x; - view->unk_F4.y = y; - view->unk_F4.z = z; +void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ) { + view->distortionScale.x = scaleX; + view->distortionScale.y = scaleY; + view->distortionScale.z = scaleZ; } -s32 func_800AA7AC(View* view, f32 arg1) { - view->unk_100 = arg1; +s32 View_SetDistortionSpeed(View* view, f32 speed) { + view->distortionSpeed = speed; } -void func_800AA7B8(View* view) { - view->unk_E8.x = 0.0f; - view->unk_E8.y = 0.0f; - view->unk_E8.z = 0.0f; - view->unk_F4.x = 1.0f; - view->unk_F4.y = 1.0f; - view->unk_F4.z = 1.0f; - view->unk_104 = view->unk_E8; - view->unk_110 = view->unk_F4; - view->unk_100 = 0.0f; +void View_InitDistortion(View* view) { + view->distortionOrientation.x = 0.0f; + view->distortionOrientation.y = 0.0f; + view->distortionOrientation.z = 0.0f; + view->distortionScale.x = 1.0f; + view->distortionScale.y = 1.0f; + view->distortionScale.z = 1.0f; + view->curDistortionOrientation = view->distortionOrientation; + view->curDistortionScale = view->distortionScale; + view->distortionSpeed = 0.0f; } -void func_800AA814(View* view) { - view->unk_E8.x = 0.0f; - view->unk_E8.y = 0.0f; - view->unk_E8.z = 0.0f; - view->unk_F4.x = 1.0f; - view->unk_F4.y = 1.0f; - view->unk_F4.z = 1.0f; - view->unk_100 = 1.0f; +void View_ClearDistortion(View* view) { + view->distortionOrientation.x = 0.0f; + view->distortionOrientation.y = 0.0f; + view->distortionOrientation.z = 0.0f; + view->distortionScale.x = 1.0f; + view->distortionScale.y = 1.0f; + view->distortionScale.z = 1.0f; + view->distortionSpeed = 1.0f; } -void func_800AA840(View* view, Vec3f vec1, Vec3f vec2, f32 arg3) { - view->unk_E8 = vec1; - view->unk_F4 = vec2; - view->unk_100 = arg3; +void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed) { + view->distortionOrientation = orientation; + view->distortionScale = scale; + view->distortionSpeed = speed; } -s32 func_800AA890(View* view, Mtx* mtx) { - MtxF mf; +s32 View_StepDistortion(View* view, Mtx* projectionMtx) { + MtxF projectionMtxF; - if (view->unk_100 == 0.0f) { - return 0; - } else if (view->unk_100 == 1.0f) { - view->unk_104 = view->unk_E8; - view->unk_110 = view->unk_F4; - view->unk_100 = 0.0f; + if (view->distortionSpeed == 0.0f) { + return false; + } else if (view->distortionSpeed == 1.0f) { + view->curDistortionOrientation = view->distortionOrientation; + view->curDistortionScale = view->distortionScale; + view->distortionSpeed = 0.0f; } else { - view->unk_104.x += ((view->unk_E8.x - view->unk_104.x) * view->unk_100); - view->unk_104.y += ((view->unk_E8.y - view->unk_104.y) * view->unk_100); - view->unk_104.z += ((view->unk_E8.z - view->unk_104.z) * view->unk_100); + view->curDistortionOrientation.x = + F32_LERPIMP(view->curDistortionOrientation.x, view->distortionOrientation.x, view->distortionSpeed); + view->curDistortionOrientation.y = + F32_LERPIMP(view->curDistortionOrientation.y, view->distortionOrientation.y, view->distortionSpeed); + view->curDistortionOrientation.z = + F32_LERPIMP(view->curDistortionOrientation.z, view->distortionOrientation.z, view->distortionSpeed); - view->unk_110.x += ((view->unk_F4.x - view->unk_110.x) * view->unk_100); - view->unk_110.y += ((view->unk_F4.y - view->unk_110.y) * view->unk_100); - view->unk_110.z += ((view->unk_F4.z - view->unk_110.z) * view->unk_100); + view->curDistortionScale.x = + F32_LERPIMP(view->curDistortionScale.x, view->distortionScale.x, view->distortionSpeed); + view->curDistortionScale.y = + F32_LERPIMP(view->curDistortionScale.y, view->distortionScale.y, view->distortionSpeed); + view->curDistortionScale.z = + F32_LERPIMP(view->curDistortionScale.z, view->distortionScale.z, view->distortionSpeed); } - Matrix_MtxToMtxF(mtx, &mf); - Matrix_Put(&mf); - Matrix_RotateX(view->unk_104.x, MTXMODE_APPLY); - Matrix_RotateY(view->unk_104.y, MTXMODE_APPLY); - Matrix_RotateZ(view->unk_104.z, MTXMODE_APPLY); - Matrix_Scale(view->unk_110.x, view->unk_110.y, view->unk_110.z, MTXMODE_APPLY); - Matrix_RotateZ(-view->unk_104.z, MTXMODE_APPLY); - Matrix_RotateY(-view->unk_104.y, MTXMODE_APPLY); - Matrix_RotateX(-view->unk_104.x, MTXMODE_APPLY); - MATRIX_TOMTX(mtx); + Matrix_MtxToMtxF(projectionMtx, &projectionMtxF); + Matrix_Put(&projectionMtxF); + Matrix_RotateX(view->curDistortionOrientation.x, MTXMODE_APPLY); + Matrix_RotateY(view->curDistortionOrientation.y, MTXMODE_APPLY); + Matrix_RotateZ(view->curDistortionOrientation.z, MTXMODE_APPLY); + Matrix_Scale(view->curDistortionScale.x, view->curDistortionScale.y, view->curDistortionScale.z, MTXMODE_APPLY); + Matrix_RotateZ(-view->curDistortionOrientation.z, MTXMODE_APPLY); + Matrix_RotateY(-view->curDistortionOrientation.y, MTXMODE_APPLY); + Matrix_RotateX(-view->curDistortionOrientation.x, MTXMODE_APPLY); + Matrix_ToMtx(projectionMtx, "../z_view.c", 566); - return 1; + return true; } void func_800AAA50(View* view, s32 arg1) { @@ -424,7 +430,7 @@ s32 func_800AAA9C(View* view) { view->projection = *projection; - func_800AA890(view, projection); + View_StepDistortion(view, projection); gSPPerspNormalize(POLY_OPA_DISP++, view->normal); gSPMatrix(POLY_OPA_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index b97d8fd8a..2bc55edc1 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -40,7 +40,7 @@ void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 69bb00d4d..a223c1fd6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -293,7 +293,7 @@ void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->switchFlag)) { Math_StepToS(&this->vFlameScale, 350, 20); } - if (globalCtx->actorCtx.unk_03) { + if (globalCtx->actorCtx.lensActive) { this->dyna.actor.flags |= ACTOR_FLAG_7; } else { this->dyna.actor.flags &= ~ACTOR_FLAG_7; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 596f1df7a..4203925b9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -93,7 +93,7 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { this->dyna.actor.objBankIndex = this->objBankIndex; this->dyna.actor.draw = BgHakaMegane_Draw; Actor_SetObjectDependency(globalCtx, &this->dyna.actor); - if (globalCtx->roomCtx.curRoom.showInvisActors) { + if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { this->actionFunc = func_8087DBF0; collision = sCollisionHeaders[this->dyna.actor.params]; if (collision != NULL) { @@ -109,7 +109,7 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { thisx->flags |= ACTOR_FLAG_7; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } else { diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 35e96895a..e952edff7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -260,7 +260,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { &scytheVertices[2]); } - if ((this->unk_151 == 0) || (globalCtx->actorCtx.unk_03 != 0)) { + if ((this->unk_151 == 0) || globalCtx->actorCtx.lensActive) { scytheVertices[0].x = this->actor.world.pos.x + blureEffectVertices1[this->actor.params].z * actorRotYSin + blureEffectVertices1[this->actor.params].x * actorRotYCos; scytheVertices[0].y = this->actor.world.pos.y + blureEffectVertices1[this->actor.params].y; diff --git a/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index d3c91fc36..7c94a16c5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -41,7 +41,7 @@ void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 81b2135b8..96257051c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -157,7 +157,7 @@ static CollisionHeader* sColHeaders[] = { &gObjectMizuObjectsBwallCol_001DE8, &gObjectMizuObjectsBwallCol_001DE8, }; -static InitChainEntry D_8089D854[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), @@ -175,7 +175,7 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { BgMizuBwall* this = (BgMizuBwall*)thisx; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_8089D854); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->yRot = this->dyna.actor.world.pos.y; this->dList = sDLists[(u16)this->dyna.actor.params & 0xF]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 39b79c9bf..6099eb527 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -52,7 +52,7 @@ static CollisionHeader* D_8089EB70[] = { &gObjectMizuObjectsMovebgCol_003590, &gObjectMizuObjectsMovebgCol_0015F8, }; -static InitChainEntry D_8089EB90[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), @@ -87,7 +87,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader* colHeader = NULL; Vec3f sp48; - Actor_ProcessInitChain(thisx, D_8089EB90); + Actor_ProcessInitChain(thisx, sInitChain); ((BgMizuMovebg*)thisx)->homeY = thisx->world.pos.y; ((BgMizuMovebg*)thisx)->dlist = D_8089EB50[MOVEBG_TYPE(thisx->params)]; DynaPolyActor_Init(&((BgMizuMovebg*)thisx)->dyna, DPM_PLAYER); diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 17ef9f44f..a375ea7d3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -114,7 +114,7 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { tri[1].x = tri[0].x; tri[1].z = tri[2].z; Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]); - this->unk16C = 0.0f; + this->unk_16C = 0.0f; } else { CollisionHeader_GetVirtual(&gDTWebWallCol, &colHeader); this->actionFunc = BgYdanSp_WallWebIdle; @@ -251,7 +251,7 @@ void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { this->timer--; } - this->dyna.actor.world.pos.y = (sinf((f32)this->timer * (M_PI / 20)) * this->unk16C) + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.y = (sinf((f32)this->timer * (M_PI / 20)) * this->unk_16C) + this->dyna.actor.home.pos.y; if (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 190.0f) { func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); this->timer = 40; @@ -295,7 +295,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { sqrtFallDistance = sqrtf(CLAMP_MIN(player->fallDistance, 0.0f)); if (player->fallDistance > 750.0f) { if (this->dyna.actor.xzDistToPlayer < 80.0f) { - this->unk16C = 200.0f; + this->unk_16C = 200.0f; this->dyna.actor.room = -1; this->dyna.actor.flags |= ACTOR_FLAG_4; this->timer = 40; @@ -305,20 +305,20 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { } } unk = sqrtFallDistance + sqrtFallDistance; - if (this->unk16C < unk) { + if (this->unk_16C < unk) { if (unk > 2.0f) { - this->unk16C = unk; + this->unk_16C = unk; this->timer = 14; } } if (player->actor.speedXZ != 0.0f) { - if (this->unk16C < 0.1f) { + if (this->unk_16C < 0.1f) { this->timer = 14; } - if (this->unk16C < 2.0f) { - this->unk16C = 2.0f; + if (this->unk_16C < 2.0f) { + this->unk_16C = 2.0f; } else { - this->unk16C = this->unk16C; + this->unk_16C = this->unk_16C; } } } @@ -328,10 +328,10 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->timer = 14; } - this->dyna.actor.world.pos.y = sinf((f32)this->timer * (M_PI / 7)) * this->unk16C + this->dyna.actor.home.pos.y; - Math_ApproachZeroF(&this->unk16C, 1.0f, 0.8f); + this->dyna.actor.world.pos.y = sinf((f32)this->timer * (M_PI / 7)) * this->unk_16C + this->dyna.actor.home.pos.y; + Math_ApproachZeroF(&this->unk_16C, 1.0f, 0.8f); if (this->timer == 13) { - if (this->unk16C > 3.0f) { + if (this->unk_16C > 3.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WEB_VIBRATION); } else { Audio_StopSfxById(NA_SE_EV_WEB_VIBRATION); diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h index 65f1faa8f..9d0a000a0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h @@ -14,7 +14,7 @@ typedef struct BgYdanSp { /* 0x0168 */ u8 isDestroyedSwitchFlag; /* 0x0169 */ u8 burnSwitchFlag; /* 0x016A */ s16 timer; - /* 0x016C */ f32 unk16C; + /* 0x016C */ f32 unk_16C; /* 0x0170 */ ColliderTris trisCollider; /* 0x0190 */ ColliderTrisElement trisColliderItems[2]; } BgYdanSp; // size = 0x0248 diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 234ef4a11..70b338fea 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -681,9 +681,9 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } else if (this->unk_1BC != 2) { if (((s32)this->skelAnime.curFrame == 1) || ((s32)this->skelAnime.curFrame == 31)) { if ((s32)this->skelAnime.curFrame == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_410, 25.0f, 0xA, 8.0f, 0x1F4, 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_410, 25.0f, 10, 8.0f, 500, 10, false); } else { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_404, 25.0f, 0xA, 8.0f, 0x1F4, 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_404, 25.0f, 10, 8.0f, 500, 10, false); } if (this->unk_1BC != 0) { @@ -778,8 +778,8 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 0x1F4, 0xA, - 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + false); } } } @@ -1413,8 +1413,8 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Camera_AddQuake(&globalCtx->mainCamera, 2, 1, 8); } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 0x1F4, - 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + false); } tempSin = cornerPos->x - this->actor.world.pos.x; tempCos = cornerPos->z - this->actor.world.pos.z; @@ -1538,8 +1538,8 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 0x1F4, - 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + false); } } Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.2f, 0.1f, 0.0f); diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 1f5455e24..5a85426c5 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -185,11 +185,11 @@ void BossGanon2_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_808FD4D4(BossGanon2* this, GlobalContext* globalCtx, s16 arg2, s16 arg3) { if ((arg2 == 0) || (arg2 == 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 0x1F4, 0xA, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 500, 10, true); } if ((arg2 == 0) || (arg2 == 2)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 0x1F4, 0xA, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 500, 10, true); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_WALK); diff --git a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 455ed94b0..da92eee0d 100644 --- a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -374,12 +374,12 @@ void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx) { void BossGoma_PlayEffectsAndSfx(BossGoma* this, GlobalContext* globalCtx, s16 arg2, s16 amountMinus1) { if (arg2 == 0 || arg2 == 1 || arg2 == 3) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, - 500, 10, 1); + 500, 10, true); } if (arg2 == 0 || arg2 == 2 || arg2 == 3) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, - 500, 10, 1); + 500, 10, true); } if (arg2 == 0) { @@ -1384,7 +1384,7 @@ void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx) { this->framesUntilNextAction = 150; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } /** @@ -1410,7 +1410,7 @@ void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); if (this->timer == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); @@ -2088,7 +2088,7 @@ void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, sDeadLimbLifetime[limbIndex] + 100); if (babyGohma != NULL) { - babyGohma->bossLimbDl = *dList; + babyGohma->bossLimbDL = *dList; babyGohma->actor.objBankIndex = this->actor.objBankIndex; } } diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 31d1488a7..56fffb6c9 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -2637,7 +2637,7 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { BossSst_HeadCollisionCheck(this, globalCtx); this->actionFunc(this, globalCtx); if (this->vVanish) { - if ((globalCtx->actorCtx.unk_03 == 0) || (thisx->colorFilterTimer != 0)) { + if (!globalCtx->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { this->actor.flags &= ~ACTOR_FLAG_7; } else { this->actor.flags |= ACTOR_FLAG_7; diff --git a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 6e93d77f7..75a00a43a 100644 --- a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -568,8 +568,8 @@ void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { if (this->dyna.actor.velocity.y > 20.0f) { this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y; - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 0xA, 8.0f, 0x1F4, - 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 10, 8.0f, 500, + 10, false); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); @@ -606,7 +606,7 @@ void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); func_8099803C(globalCtx, 2, 10, parent->subCameraId); Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, - 10, 1); + 10, true); } } } diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index cf0159eed..97ba202bb 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -38,9 +38,9 @@ void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) { EfcErupc_SetupAction(this, EfcErupc_UpdateAction); Actor_SetScale(&this->actor, 1.0f); EfcErupc_InitParticles(this->particles); - this->unk14C = this->unk14E = this->unk150 = 0; - this->unk152 = 5; - this->unk154 = -100; + this->unk_14C = this->unk_14E = this->unk_150 = 0; + this->unk_152 = 5; + this->unk_154 = -100; } void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -55,22 +55,22 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.state != 0) { if (globalCtx->csCtx.npcActions[1] != NULL) { if (globalCtx->csCtx.npcActions[1]->action == 2) { - if (this->unk150 == 30) { + if (this->unk_150 == 30) { func_800788CC(NA_SE_IT_EARTHQUAKE); } - if (this->unk150 <= 64) { - if (this->unk154 < 200) { - this->unk154 += 10; + if (this->unk_150 <= 64) { + if (this->unk_154 < 200) { + this->unk_154 += 10; } } else { - if (this->unk154 > -100) { - this->unk154 -= 10; + if (this->unk_154 > -100) { + this->unk_154 -= 10; } } - this->unk150++; + this->unk_150++; } else { - if (this->unk154 > -100) { - this->unk154 -= 10; + if (this->unk_154 > -100) { + this->unk_154 -= 10; } } } @@ -79,28 +79,28 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.npcActions[2] != NULL) { switch (globalCtx->csCtx.npcActions[2]->action) { case 2: - if (this->unk14E == 0) { + if (this->unk_14E == 0) { func_800F3F3C(6); gSaveContext.eventChkInf[2] |= 0x8000; } - this->unk14E++; + this->unk_14E++; break; case 3: - this->unk14E = 30; + this->unk_14E = 30; } - this->unk14C++; + this->unk_14C++; } } accel.z = 0.0f; accel.x = 0.0f; pos.y = this->actor.world.pos.y + 300.0f; - for (i = 0; i < this->unk152; i++) { + for (i = 0; i < this->unk_152; i++) { pos.x = Rand_CenteredFloat(100.0f) + this->actor.world.pos.x; pos.z = Rand_CenteredFloat(100.0f) + this->actor.world.pos.z; vel.x = Rand_CenteredFloat(100.0f); vel.y = Rand_ZeroFloat(100.0f); vel.z = Rand_CenteredFloat(100.0f); - accel.y = this->unk154 * 0.1f; + accel.y = this->unk_154 * 0.1f; EfcErupc_AddParticle(this->particles, &pos, &vel, &accel, 80.0f); } } @@ -121,16 +121,16 @@ void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk14C * 1, this->unk14E * -4, 32, 64, 1, - this->unk14C * 4, this->unk14E * -20, 64, 64)); + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_14C * 1, this->unk_14E * -4, 32, 64, 1, + this->unk_14C * 4, this->unk_14E * -20, 64, 64)); gSPSegment( POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk150 * -4, 16, 128, 1, 0, this->unk150 * 12, 32, 32)); + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); gSPSegment( POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk150 * -4, 16, 128, 1, 0, this->unk150 * 12, 32, 32)); + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); Matrix_Push(); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index 596159815..e3edf503b 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -26,11 +26,11 @@ typedef struct { typedef struct EfcErupc { /* 0x0000 */ Actor actor; - /* 0x014C */ s16 unk14C; - /* 0x014E */ s16 unk14E; - /* 0x0150 */ s16 unk150; - /* 0x0152 */ s16 unk152; - /* 0x0154 */ s16 unk154; + /* 0x014C */ s16 unk_14C; + /* 0x014E */ s16 unk_14E; + /* 0x0150 */ s16 unk_150; + /* 0x0152 */ s16 unk_152; + /* 0x0154 */ s16 unk_154; /* 0x0158 */ EfcErupcParticles particles[EFC_ERUPC_NUM_PARTICLES]; /* 0x18C8 */ EfcErupcActionFunc actionFunc; } EfcErupc; // size = 0x18CC diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c index d1b18ef2d..a5ee34ba6 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -269,7 +269,7 @@ void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 0x12C, 0xF, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 300, 15, false); } void EnAm_SetupSleep(EnAm* this) { diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c index c2a878288..19749933e 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -99,10 +99,10 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.world.pos.y = this->actor.home.pos.y + 100.0f; for (i = 13; i >= 0; i--) { - this->unk200[i] = sp38; - this->unk2A8[i].x = -0x4000; - this->unk158[i] = this->actor.world.pos; - this->unk158[i].y = this->actor.world.pos.y - (i + 1) * 32.0f; + this->unk_200[i] = sp38; + this->unk_2A8[i].x = -0x4000; + this->unk_158[i] = this->actor.world.pos; + this->unk_158[i].y = this->actor.world.pos.y - (i + 1) * 32.0f; } this->actor.targetMode = 4; @@ -134,8 +134,8 @@ void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnBa_SetupIdle(EnBa* this) { - this->unk14C = 2; - this->unk31C = 1500; + this->unk_14C = 2; + this->unk_31C = 1500; this->actor.speedXZ = 10.0f; EnBa_SetupAction(this, EnBa_Idle); } @@ -152,41 +152,41 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 100.0f, 1.0f, 10.0f, 0.0f); } - this->unk2FC = this->actor.world.pos; + this->unk_2FC = this->actor.world.pos; if (globalCtx->gameplayFrames % 16 == 0) { - this->unk308.z += Rand_CenteredFloat(180.0f); - this->unk314 += Rand_CenteredFloat(180.0f); - this->unk308.x = Math_SinF(this->unk308.z) * 80.0f; - this->unk308.y = Math_CosF(this->unk314) * 80.0f; + this->unk_308.z += Rand_CenteredFloat(180.0f); + this->unk_314 += Rand_CenteredFloat(180.0f); + this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; + this->unk_308.y = Math_CosF(this->unk_314) * 80.0f; } - this->unk2FC.y -= 448.0f; - this->unk2FC.x += this->unk308.x; - this->unk2FC.z += this->unk308.y; - func_80033AEC(&this->unk2FC, &this->unk158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f); + this->unk_2FC.y -= 448.0f; + this->unk_2FC.x += this->unk_308.x; + this->unk_2FC.z += this->unk_308.y; + func_80033AEC(&this->unk_2FC, &this->unk_158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f); for (i = 12; i >= 0; i--) { - func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp5C, 0); - Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW); + func_80035844(&this->unk_158[i + 1], &this->unk_158[i], &sp5C, 0); + Matrix_Translate(this->unk_158[i + 1].x, this->unk_158[i + 1].y, this->unk_158[i + 1].z, MTXMODE_NEW); Matrix_RotateZYX(sp5C.x, sp5C.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i]); } - func_80035844(&this->unk158[0], &this->unk2FC, &sp5C, 0); + func_80035844(&this->unk_158[0], &this->unk_2FC, &sp5C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk2A8[0].y, 3, this->unk31C, 182); - Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk2A8[0].x, 3, this->unk31C, 182); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_2A8[0].y, 3, this->unk_31C, 182); + Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk_2A8[0].x, 3, this->unk_31C, 182); Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); - this->unk2A8[13].y = sp5C.y; - this->unk2A8[13].x = sp5C.x + 0x8000; + Matrix_MultVec3f(&D_809B8080, &this->unk_158[0]); + this->unk_2A8[13].y = sp5C.y; + this->unk_2A8[13].x = sp5C.x + 0x8000; for (i = 0; i < 13; i++) { - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[i + 1].y, 3, this->unk31C, 182); - Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[i + 1].x, 3, this->unk31C, 182); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Math_SmoothStepToS(&this->unk_2A8[i].y, this->unk_2A8[i + 1].y, 3, this->unk_31C, 182); + Math_SmoothStepToS(&this->unk_2A8[i].x, this->unk_2A8[i + 1].x, 3, this->unk_31C, 182); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } - this->unk2A8[13].x = this->unk2A8[12].x; - this->unk2A8[13].y = this->unk2A8[12].y; + this->unk_2A8[13].x = this->unk_2A8[12].x; + this->unk_2A8[13].y = this->unk_2A8[12].y; if (!(player->stateFlags1 & 0x4000000) && (this->actor.xzDistToPlayer <= 175.0f) && (this->actor.world.pos.y == this->actor.home.pos.y + 100.0f)) { EnBa_SetupSwingAtPlayer(this); @@ -194,10 +194,10 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { } void EnBa_SetupFallAsBlob(EnBa* this) { - this->unk14C = 0; + this->unk_14C = 0; this->actor.speedXZ = Rand_CenteredFloat(8.0f); this->actor.world.rot.y = Rand_CenteredFloat(65535.0f); - this->unk318 = 20; + this->unk_318 = 20; this->actor.gravity = -2.0f; EnBa_SetupAction(this, EnBa_FallAsBlob); } @@ -210,8 +210,8 @@ void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { this->actor.scale.y -= 0.001f; this->actor.scale.x += 0.0005f; this->actor.scale.z += 0.0005f; - this->unk318--; - if (this->unk318 == 0) { + this->unk_318--; + if (this->unk_318 == 0) { Actor_Kill(&this->actor); } } else { @@ -221,10 +221,10 @@ void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { } void EnBa_SetupSwingAtPlayer(EnBa* this) { - this->unk14C = 3; - this->unk318 = 20; - this->unk31A = 0; - this->unk31C = 1500; + this->unk_14C = 3; + this->unk_318 = 20; + this->unk_31A = 0; + this->unk_31C = 1500; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.speedXZ = 20.0f; EnBa_SetupAction(this, EnBa_SwingAtPlayer); @@ -238,71 +238,71 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { s16 phi_fp; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 1.0f, 10.0f, 0.0f); - if ((this->actor.xzDistToPlayer <= 175.0f) || (this->unk31A != 0)) { - if (this->unk318 == 20) { + if ((this->actor.xzDistToPlayer <= 175.0f) || (this->unk_31A != 0)) { + if (this->unk_318 == 20) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_UP); - this->unk31C = 1500; + this->unk_31C = 1500; } - if (this->unk318 != 0) { - this->unk31A = 10; - this->unk318--; - if (this->unk318 >= 11) { - this->unk2FC = player->actor.world.pos; - this->unk2FC.y += 30.0f; + if (this->unk_318 != 0) { + this->unk_31A = 10; + this->unk_318--; + if (this->unk_318 >= 11) { + this->unk_2FC = player->actor.world.pos; + this->unk_2FC.y += 30.0f; phi_fp = this->actor.yawTowardsPlayer; } else { - phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2FC); + phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2FC); } - Math_SmoothStepToS(&this->unk31C, 1500, 1, 30, 0); - func_80035844(&this->actor.world.pos, &this->unk158[0], &sp58, 0); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp58.y, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->actor.shape.rot.x, (sp58.x + 0x8000), 1, this->unk31C, 0); + Math_SmoothStepToS(&this->unk_31C, 1500, 1, 30, 0); + func_80035844(&this->actor.world.pos, &this->unk_158[0], &sp58, 0); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp58.y, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->actor.shape.rot.x, (sp58.x + 0x8000), 1, this->unk_31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX((this->actor.shape.rot.x - 0x8000), this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[0]); for (i = 0; i < 13; i++) { - Math_SmoothStepToS(&this->unk2A8[i].x, (i * 1200) - 0x4000, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX((this->unk2A8[i].x - 0x8000), this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); + Math_SmoothStepToS(&this->unk_2A8[i].x, (i * 1200) - 0x4000, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->unk_2A8[i].y, phi_fp, 1, this->unk_31C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX((this->unk_2A8[i].x - 0x8000), this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } } else { - if (this->unk31A == 10) { + if (this->unk_31A == 10) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_DOWN); } - if (this->unk31A != 0) { - this->unk31C = 8000; + if (this->unk_31A != 0) { + this->unk_31C = 8000; this->actor.speedXZ = 30.0f; - phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2FC); - temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000; - Math_SmoothStepToS(&this->actor.shape.rot.y, phi_fp, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0); + phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2FC); + temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_158[0]) + 0x8000; + Math_SmoothStepToS(&this->actor.shape.rot.y, phi_fp, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk_31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, this->unk158); + Matrix_MultVec3f(&D_809B8080, this->unk_158); for (i = 0; i < 13; i++) { - temp = -Math_CosS(this->unk31A * 0xCCC) * (i * 1200); - Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); + temp = -Math_CosS(this->unk_31A * 0xCCC) * (i * 1200); + Math_SmoothStepToS(&this->unk_2A8[i].x, temp - 0x4000, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->unk_2A8[i].y, phi_fp, 1, this->unk_31C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } - this->unk31A--; + this->unk_31A--; } else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) { EnBa_SetupIdle(this); } else { EnBa_SetupSwingAtPlayer(this); - this->unk318 = 27; - this->unk31C = 750; + this->unk_318 = 27; + this->unk_31C = 750; } } - this->unk2A8[13].x = this->unk2A8[12].x; - this->unk2A8[13].y = this->unk2A8[12].y; + this->unk_2A8[13].x = this->unk_2A8[12].x; + this->unk_2A8[13].y = this->unk_2A8[12].y; if (this->collider.base.atFlags & 2) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == &player->actor) { @@ -316,15 +316,15 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { EnBa_SetupIdle(this); } else { EnBa_SetupSwingAtPlayer(this); - this->unk318 = 27; - this->unk31C = 750; + this->unk_318 = 27; + this->unk_31C = 750; } } void func_809B7174(EnBa* this) { - this->unk14C = 1; - this->unk31C = 1500; - this->unk318 = 20; + this->unk_14C = 1; + this->unk_31C = 1500; + this->unk_318 = 20; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.speedXZ = 10.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_DAMAGE); @@ -337,43 +337,43 @@ void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { Vec3s sp6C; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 330.0f, 1.0f, 30.0f, 0.0f); - this->unk2FC = this->actor.world.pos; + this->unk_2FC = this->actor.world.pos; if (globalCtx->gameplayFrames % 16 == 0) { - this->unk308.z += Rand_CenteredFloat(180.0f); - this->unk314 += Rand_CenteredFloat(180.0f); - this->unk308.x = Math_SinF(this->unk308.z) * 80.0f; - this->unk308.y = Math_CosF(this->unk314) * 80.0f; + this->unk_308.z += Rand_CenteredFloat(180.0f); + this->unk_314 += Rand_CenteredFloat(180.0f); + this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; + this->unk_308.y = Math_CosF(this->unk_314) * 80.0f; } - this->unk2FC.y -= 448.0f; - this->unk2FC.x += this->unk308.x; - this->unk2FC.z += this->unk308.y; - func_80033AEC(&this->unk2FC, &this->unk158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f); + this->unk_2FC.y -= 448.0f; + this->unk_2FC.x += this->unk_308.x; + this->unk_2FC.z += this->unk_308.y; + func_80033AEC(&this->unk_2FC, &this->unk_158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f); for (i = 12; i >= 0; i--) { - func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp6C, 0); - Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW); + func_80035844(&this->unk_158[i + 1], &this->unk_158[i], &sp6C, 0); + Matrix_Translate(this->unk_158[i + 1].x, this->unk_158[i + 1].y, this->unk_158[i + 1].z, MTXMODE_NEW); Matrix_RotateZYX(sp6C.x, sp6C.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i]); } - func_80035844(&this->actor.world.pos, &this->unk158[0], &sp6C, 0); + func_80035844(&this->actor.world.pos, &this->unk_158[0], &sp6C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp6C.y, 3, this->unk31C, 182); - Math_SmoothStepToS(&this->actor.shape.rot.x, sp6C.x + 0x8000, 3, this->unk31C, 182); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp6C.y, 3, this->unk_31C, 182); + Math_SmoothStepToS(&this->actor.shape.rot.x, sp6C.x + 0x8000, 3, this->unk_31C, 182); Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[0]); for (i = 0; i < 13; i++) { - func_80035844(&this->unk158[i], &this->unk158[i + 1], &sp6C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Math_SmoothStepToS(&this->unk2A8[i].y, sp6C.y, 3, this->unk31C, 182); - Math_SmoothStepToS(&this->unk2A8[i].x, sp6C.x + 0x8000, 3, this->unk31C, 182); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); + func_80035844(&this->unk_158[i], &this->unk_158[i + 1], &sp6C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Math_SmoothStepToS(&this->unk_2A8[i].y, sp6C.y, 3, this->unk_31C, 182); + Math_SmoothStepToS(&this->unk_2A8[i].x, sp6C.x + 0x8000, 3, this->unk_31C, 182); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } - this->unk2A8[13].x = this->unk2A8[12].x; - this->unk2A8[13].y = this->unk2A8[12].y; - this->unk318--; - if (this->unk318 == 0) { + this->unk_2A8[13].x = this->unk_2A8[12].x; + this->unk_2A8[13].y = this->unk_2A8[12].y; + this->unk_318--; + if (this->unk_318 == 0) { EnBa_SetupIdle(this); } } @@ -384,29 +384,29 @@ void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { Vec3f sp74 = { 0.0f, 0.0f, 0.0f }; GlobalContext* globalCtx = globalCtx2; - this->unk31C = 2500; + this->unk_31C = 2500; EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40); - this->unk14C = 0; + this->unk_14C = 0; for (i = 7; i < 14; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BA, this->unk158[i].x, this->unk158[i].y, - this->unk158[i].z, 0, 0, 0, EN_BA_DEAD_BLOB); + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BA, this->unk_158[i].x, this->unk_158[i].y, + this->unk_158[i].z, 0, 0, 0, EN_BA_DEAD_BLOB); } - unk_temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->actor.shape.rot.x, unk_temp, 1, this->unk31C, 0); + unk_temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_158[0]) + 0x8000; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->actor.shape.rot.x, unk_temp, 1, this->unk_31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[0]); this->actor.flags &= ~ACTOR_FLAG_0; for (i = 5; i < 13; i++) { - Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&sp74, &this->unk158[i + 1]); + Math_SmoothStepToS(&this->unk_2A8[i].x, this->unk_2A8[5].x, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->unk_2A8[i].y, this->unk_2A8[5].y, 1, this->unk_31C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&sp74, &this->unk_158[i + 1]); } - this->unk31A = 15; + this->unk_31A = 15; EnBa_SetupAction(this, EnBa_Die); } @@ -415,32 +415,32 @@ void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { s16 temp; s32 i; - if (this->unk31A != 0) { + if (this->unk_31A != 0) { this->actor.speedXZ = 30.0f; - this->unk31C = 8000; + this->unk_31C = 8000; this->actor.world.pos.y += 8.0f; - temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0); + temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_158[0]) + 0x8000; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk_31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[0]); for (i = 0; i < 5; i++) { - temp = -Math_CosS(this->unk31A * 0x444) * (i * 400); - Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->unk2A8[i].y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); + temp = -Math_CosS(this->unk_31A * 0x444) * (i * 400); + Math_SmoothStepToS(&this->unk_2A8[i].x, temp - 0x4000, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->unk_2A8[i].y, this->actor.yawTowardsPlayer, 1, this->unk_31C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } for (i = 5; i < 13; i++) { - Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0); - Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); - Matrix_MultVec3f(&sp6C, &this->unk158[i + 1]); + Math_SmoothStepToS(&this->unk_2A8[i].x, this->unk_2A8[5].x, 1, this->unk_31C, 0); + Math_SmoothStepToS(&this->unk_2A8[i].y, this->unk_2A8[5].y, 1, this->unk_31C, 0); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX(this->unk_2A8[i].x - 0x8000, this->unk_2A8[i].y, 0, MTXMODE_APPLY); + Matrix_MultVec3f(&sp6C, &this->unk_158[i + 1]); } - this->unk31A--; + this->unk_31A--; } else { Flags_SetSwitch(globalCtx, this->upperParams); Actor_Kill(&this->actor); @@ -461,9 +461,9 @@ void EnBa_Update(Actor* thisx, GlobalContext* globalCtx) { } this->actionFunc(this, globalCtx); if (this->actor.params < EN_BA_DEAD_BLOB) { - this->actor.focus.pos = this->unk158[6]; + this->actor.focus.pos = this->unk_158[6]; } - if (this->unk14C >= 2) { + if (this->unk_14C >= 2) { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } @@ -493,9 +493,9 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 14; i++, mtx++) { FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); - Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY); - Matrix_Scale(this->unk200[i].x, this->unk200[i].y, this->unk200[i].z, MTXMODE_APPLY); + Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); + Matrix_RotateZYX(this->unk_2A8[i].x, this->unk_2A8[i].y, this->unk_2A8[i].z, MTXMODE_APPLY); + Matrix_Scale(this->unk_200[i].x, this->unk_200[i].y, this->unk_200[i].z, MTXMODE_APPLY); if ((i == 6) || (i == 13)) { switch (i) { case 13: diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h index 1996a09bc..1506fa253 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -17,19 +17,19 @@ typedef enum { typedef struct EnBa { /* 0x0000 */ Actor actor; - /* 0x014C */ s32 unk14C; - /* 0x0150 */ EnBaActionFunc actionFunc; - /* 0x0154 */ s16 upperParams; - /* 0x0156 */ s16 unk156; - /* 0x0158 */ Vec3f unk158[14]; - /* 0x0200 */ Vec3f unk200[14]; - /* 0x02A8 */ Vec3s unk2A8[14]; - /* 0x02FC */ Vec3f unk2FC; - /* 0x0308 */ Vec3f unk308; - /* 0x0314 */ f32 unk314; - /* 0x0318 */ s16 unk318; - /* 0x031A */ s16 unk31A; - /* 0x031C */ s16 unk31C; + /* 0x014C */ s32 unk_14C; + /* 0x0150 */ EnBaActionFunc actionFunc; + /* 0x0154 */ s16 upperParams; + /* 0x0156 */ s16 unk_156; + /* 0x0158 */ Vec3f unk_158[14]; + /* 0x0200 */ Vec3f unk_200[14]; + /* 0x02A8 */ Vec3s unk_2A8[14]; + /* 0x02FC */ Vec3f unk_2FC; + /* 0x0308 */ Vec3f unk_308; + /* 0x0314 */ f32 unk_314; + /* 0x0318 */ s16 unk_318; + /* 0x031A */ s16 unk_31A; + /* 0x031C */ s16 unk_31C; /* 0x0320 */ ColliderJntSph collider; /* 0x0340 */ ColliderJntSphElement colliderItems[2]; /* 0x03C0 */ u32 epoch; diff --git a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 17d451c49..4840fa29a 100644 --- a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -712,7 +712,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { this->actor.velocity.y = 10.0f; } this->actor.bgCheckFlags &= ~1; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); Math_SmoothStepToS(&this->actor.world.rot.y, -this->actor.yawTowardsPlayer, 1, 0xBB8, 0); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -1112,7 +1112,7 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { } else { this->actor.velocity.y = 0.0f; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); } if (this->actor.colorFilterTimer == 0) { this->actor.shape.yOffset = 200.0f; diff --git a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c index bc1b13a13..bf1d125dc 100644 --- a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -458,7 +458,7 @@ void func_809CF984(EnBw* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 3000; this->actor.flags &= ~ACTOR_FLAG_24; this->actor.speedXZ = 0.0f; @@ -492,7 +492,7 @@ void func_809CFC4C(EnBw* this, GlobalContext* globalCtx) { this->unk_258 += this->unk_25C; Math_SmoothStepToF(&this->unk_260, 0.075f, 1.0f, 0.005f, 0.0f); if (this->actor.bgCheckFlags & 2) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } if (this->unk_224 != 0) { @@ -542,7 +542,7 @@ void func_809CFF98(EnBw* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 0xBB8; this->unk_250 = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); @@ -665,7 +665,7 @@ void func_809D0424(EnBw* this, GlobalContext* globalCtx) { if (func_800355E4(globalCtx, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); } else { this->unk_230 = 1; } @@ -679,7 +679,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 0x10) && (this->actor.bgCheckFlags & 1)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); func_809D00F4(this); } else { if (this->collider2.base.acFlags & AC_HIT) { @@ -707,8 +707,8 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { if (func_800355E4(globalCtx, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 0xB, 4.0f, 0, - 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, + false); } else { this->unk_230 = 1; } diff --git a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 740f855f0..491a752b0 100644 --- a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -433,7 +433,7 @@ s32 EnDha_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDha_OverridePostDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDha_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f handVec = { 1100.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnDha* this = (EnDha*)thisx; @@ -462,5 +462,5 @@ void EnDha_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnDha_OverrideLimbDraw, EnDha_OverridePostDraw, this); + EnDha_OverrideLimbDraw, EnDha_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 2a6c0396d..feb889b1c 100644 --- a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -550,13 +550,13 @@ void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { if ((s32)this->skelAnime.curFrame < 21) { if (!this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 0xC8, 0xF, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = true; } } else { if (this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 0xC8, 0xF, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = false; } } @@ -641,11 +641,11 @@ void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { tailPos.x = this->sphElements[1].dim.worldSphere.center.x; tailPos.y = this->sphElements[1].dim.worldSphere.center.y; tailPos.z = this->sphElements[1].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); tailPos.x = this->sphElements[2].dim.worldSphere.center.x; tailPos.y = this->sphElements[2].dim.worldSphere.center.y; tailPos.z = this->sphElements[2].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); if (this->colliderBody.base.atFlags & AT_HIT) { Player* player = GET_PLAYER(globalCtx); diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 4f59f8982..7543ade93 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -268,18 +268,18 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) { EnEncount2_ParticleUpdate(this, globalCtx); if (!this->isNotDeathMountain) { - this->unk17C = this->envEffectsTimer / 60.0f; - this->unk160 = this->unk17C * -50.0f; - globalCtx->envCtx.adjAmbientColor[0] = (s16)this->unk160 * -1.5f; - globalCtx->envCtx.adjAmbientColor[1] = globalCtx->envCtx.adjAmbientColor[2] = this->unk160; - this->unk168 = this->unk17C * -20.0f; - globalCtx->envCtx.adjLight1Color[0] = (s16)this->unk168 * -1.5f; - globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = this->unk168; - this->unk170 = this->unk17C * -50.0f; - globalCtx->envCtx.adjFogNear = this->unk170; - globalCtx->envCtx.adjFogColor[0] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[0]) * this->unk17C); - globalCtx->envCtx.adjFogColor[1] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[1]) * this->unk17C); - globalCtx->envCtx.adjFogColor[2] = (u8)((150.0f - globalCtx->envCtx.lightSettings.fogColor[2]) * this->unk17C); + this->unk_17C = this->envEffectsTimer / 60.0f; + this->unk_160 = this->unk_17C * -50.0f; + globalCtx->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f; + globalCtx->envCtx.adjAmbientColor[1] = globalCtx->envCtx.adjAmbientColor[2] = this->unk_160; + this->unk_168 = this->unk_17C * -20.0f; + globalCtx->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f; + globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = this->unk_168; + this->unk_170 = this->unk_17C * -50.0f; + globalCtx->envCtx.adjFogNear = this->unk_170; + globalCtx->envCtx.adjFogColor[0] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[0]) * this->unk_17C); + globalCtx->envCtx.adjFogColor[1] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[1]) * this->unk_17C); + globalCtx->envCtx.adjFogColor[2] = (u8)((150.0f - globalCtx->envCtx.lightSettings.fogColor[2]) * this->unk_17C); } } diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 9e3aca0eb..8f900ef85 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -27,14 +27,14 @@ typedef struct EnEncount2 { /* 0x015A */ s16 isNotDeathMountain; /* 0x015C */ s16 collapseSpawnerInactive; /* 0x015E */ s16 particleSpawnTimer; - /* 0x0160 */ f32 unk160; + /* 0x0160 */ f32 unk_160; /* 0x0164 */ char unk164[0x4]; - /* 0x0168 */ f32 unk168; + /* 0x0168 */ f32 unk_168; /* 0x016C */ char unk16C[0x4]; - /* 0x0178 */ f32 unk170; + /* 0x0178 */ f32 unk_170; /* 0x0174 */ char unk174[0x4]; /* 0x0178 */ s16 envEffectsTimer; - /* 0x017C */ f32 unk17C; + /* 0x017C */ f32 unk_17C; /* 0x0180 */ u64 isQuaking; /* 0x0188 */ EnEncount2Particle particles[50]; } EnEncount2; // size = 0x0A20 diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index c5d0238e7..29632ebc3 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -546,10 +546,10 @@ void EnExItem_DrawHeartPiece(EnExItem* this, GlobalContext* globalCtx) { } void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex) { - static s16 sgiDrawIds[] = { GID_DINS_FIRE, GID_FARORES_WIND, GID_NAYRUS_LOVE }; + static s16 giDrawIds[] = { GID_DINS_FIRE, GID_FARORES_WIND, GID_NAYRUS_LOVE }; func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, sgiDrawIds[magicIndex]); + GetItem_Draw(globalCtx, giDrawIds[magicIndex]); } void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index) { diff --git a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index ddc27b993..683f0c44e 100644 --- a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -105,8 +105,8 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { break; case FIRE_ROCK_SPAWNED_FALLING1: // spawned by encount2 // sets unused vars? - this->unk17C.x = (f32)(Rand_CenteredFloat(50.0f) + player->actor.world.pos.x); - this->unk17C.z = (f32)(Rand_CenteredFloat(50.0f) + player->actor.world.pos.z); + this->unk_17C.x = (f32)(Rand_CenteredFloat(50.0f) + player->actor.world.pos.x); + this->unk_17C.z = (f32)(Rand_CenteredFloat(50.0f) + player->actor.world.pos.z); case FIRE_ROCK_SPAWNED_FALLING2: // spawned by encount2 and by the ceilling spawner this->scale = (Rand_ZeroFloat(2.0f) / 100.0f) + 0.02f; Actor_SetScale(&this->actor, this->scale); @@ -200,7 +200,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { func_80033E88(&this->actor, globalCtx, 5, 2); case FIRE_ROCK_BROKEN_PIECE1: Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, - 1, 8.0f, 500, 10, 0); + 1, 8.0f, 500, 10, false); for (i = 0; i < 5; i++) { flamePos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; flamePos.y = this->actor.floorHeight; @@ -211,7 +211,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { break; default: Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, - 3, 8.0f, 200, 10, 0); + 3, 8.0f, 200, 10, false); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); Actor_Kill(&this->actor); break; diff --git a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h index 8dfb334d1..9dd7de61f 100644 --- a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h +++ b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h @@ -27,7 +27,7 @@ typedef struct EnFireRock { /* 0x0168 */ EnFireRockActionFunc actionFunc; /* 0x016C */ f32 scale; /* 0x0170 */ Vec3f relativePos; - /* 0x017C */ Vec3f unk17C; // set but unused? + /* 0x017C */ Vec3f unk_17C; // set but unused? /* 0x0188 */ s16 timer; /* 0x018A */ s16 timer2; /* 0x018C */ s16 type; diff --git a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index c9f475e0e..1e0b4a4b2 100644 --- a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -722,7 +722,7 @@ s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL void* thisx, Gfx** gfx) { EnFirefly* this = (EnFirefly*)thisx; - if ((this->actor.draw == EnFirefly_DrawInvisible) && (globalCtx->actorCtx.unk_03 == 0)) { + if ((this->actor.draw == EnFirefly_DrawInvisible) && !globalCtx->actorCtx.lensActive) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; diff --git a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 53b3ae124..d457b2b03 100644 --- a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -255,7 +255,7 @@ void EnFloormas_SetupHover(EnFloormas* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; EnFloormas_MakeInvulnerable(this); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 0x12C, 0x64, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); this->actionFunc = EnFloormas_Hover; } diff --git a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 2fab87aff..9ce0a0589 100644 --- a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -371,8 +371,8 @@ void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->actor.bgCheckFlags &= ~2; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { EnGeldB_SetupReady(this); @@ -396,8 +396,8 @@ void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx) { } if (this->skelAnime.curFrame == 2.0f) { this->actor.gravity = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 300.0f, 1.0f, 20.5f, 0.0f); @@ -926,8 +926,8 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { if ((s32)this->skelAnime.curFrame < 9) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else if ((s32)this->skelAnime.curFrame == 13) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); this->swordState = 1; this->actor.speedXZ = 10.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_ATTACK); diff --git a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 9bd7afb68..179069b45 100644 --- a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -831,11 +831,11 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { break; case ENGOMA_BOSSLIMB: - if (this->bossLimbDl != NULL) { + if (this->bossLimbDL != NULL) { gSPSegment(POLY_OPA_DISP++, 0x08, EnGoma_NoBackfaceCullingDlist(globalCtx->state.gfxCtx)); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, this->bossLimbDl); + gSPDisplayList(POLY_OPA_DISP++, this->bossLimbDL); } break; } diff --git a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h index 493cf6996..bcce4b4d5 100644 --- a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h +++ b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h @@ -72,7 +72,7 @@ typedef struct EnGoma { /* 0x2F4 */ s32 unk_2F4; /* 0x2F8 */ s16 stunTimer; /* 0x2FC */ Vec3f shieldKnockbackVel; - /* 0x308 */ Gfx* bossLimbDl; // set by z_boss_goma + /* 0x308 */ Gfx* bossLimbDL; // set by z_boss_goma /* 0x30C */ ColliderCylinder colCyl1; /* 0x358 */ ColliderCylinder colCyl2; } EnGoma; // size = 0x03A4 diff --git a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 43fe481aa..4efd71755 100644 --- a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -197,7 +197,7 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { 24); ActorShape_Init(&this->actor.shape, 100.0f, ActorShadow_DrawCircle, 27.0f); this->actor.focus.pos = this->actor.world.pos; - this->unk2D4 = 0; + this->unk_2D4 = 0; this->actor.world.rot.y = 0; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 6; @@ -253,7 +253,7 @@ void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params > 0) { parent = (EnPeehat*)this->actor.parent; if (parent != NULL && parent->actor.update != NULL) { - parent->unk2FA--; + parent->unk_2FA--; } } } @@ -288,12 +288,12 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); - this->unk2D4 = 240; + this->unk_2D4 = 240; } else { s32 i; this->colCylinder.base.acFlags &= ~AC_HIT; - for (i = MAX_LARVA - this->unk2FA; i > 0; i--) { + for (i = MAX_LARVA - this->unk_2FA; i > 0; i--) { Actor* larva = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, @@ -303,10 +303,10 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { if (larva != NULL) { larva->velocity.y = 6.0f; larva->shape.rot.y = larva->world.rot.y = Rand_CenteredFloat(0xFFFF); - this->unk2FA++; + this->unk_2FA++; } } - this->unk2D4 = 8; + this->unk_2D4 = 8; } Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_DAMAGE); } @@ -315,8 +315,8 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) { Animation_Change(&this->skelAnime, &gPeehatRisingAnim, 0.0f, 3.0f, Animation_GetLastFrame(&gPeehatRisingAnim), ANIMMODE_ONCE, 0.0f); this->seekPlayerTimer = 600; - this->unk2D4 = 0; - this->unk2FA = 0; + this->unk_2D4 = 0; + this->unk_2FA = 0; this->state = PEAHAT_STATE_3; this->colCylinder.base.acFlags &= ~AC_HIT; EnPeehat_SetupAction(this, EnPeehat_Ground_StateGround); @@ -336,9 +336,9 @@ void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) { } else { this->actor.flags &= ~ACTOR_FLAG_0; Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); - if (this->unk2D4 != 0) { - this->unk2D4--; - if (this->unk2D4 & 4) { + if (this->unk_2D4 != 0) { + this->unk_2D4--; + if (this->unk_2D4 & 4) { Math_SmoothStepToF(&this->scaleShift, 0.205f, 1.0f, 0.235f, 0.0f); } else { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); @@ -353,8 +353,8 @@ void EnPeehat_Flying_SetStateGround(EnPeehat* this) { Animation_Change(&this->skelAnime, &gPeehatRisingAnim, 0.0f, 3.0f, Animation_GetLastFrame(&gPeehatRisingAnim), ANIMMODE_ONCE, 0.0f); this->seekPlayerTimer = 400; - this->unk2D4 = 0; - this->unk2FA = 0; //! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns + this->unk_2D4 = 0; + this->unk_2FA = 0; //! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns this->state = PEAHAT_STATE_4; EnPeehat_SetupAction(this, EnPeehat_Flying_StateGrounded); } @@ -366,9 +366,9 @@ void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) { } } else { Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); - if (this->unk2D4 != 0) { - this->unk2D4--; - if (this->unk2D4 & 4) { + if (this->unk_2D4 != 0) { + this->unk_2D4--; + if (this->unk_2D4 & 4) { Math_SmoothStepToF(&this->scaleShift, 0.205f, 1.0f, 0.235f, 0.0f); } else { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); @@ -391,14 +391,14 @@ void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx) { if (!IS_DAY || this->xzDistToRise < this->actor.xzDistToPlayer) { EnPeehat_Flying_SetStateLanding(this); } else if (this->actor.xzDistToPlayer < this->xzDistMax) { - if (this->unk2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) { + if (this->unk_2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) { Actor* larva = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(5.0f) + this->actor.world.pos.y, Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, 1); if (larva != NULL) { larva->shape.rot.y = larva->world.rot.y = Rand_CenteredFloat(0xFFFF); - this->unk2FA++; + this->unk_2FA++; } } } @@ -472,7 +472,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime) || this->animTimer == 0) { //! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns - this->unk2FA = 0; + this->unk_2FA = 0; EnPeehat_Flying_SetStateFly(this); } else { this->actor.world.pos.y += 18.0f; @@ -491,7 +491,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { void EnPeehat_Ground_SetStateSeekPlayer(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim); this->state = PEAHAT_STATE_SEEK_PLAYER; - this->unk2E0 = 0.0f; + this->unk_2E0 = 0.0f; EnPeehat_SetupAction(this, EnPeehat_Ground_StateSeekPlayer); } @@ -508,7 +508,7 @@ void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { } if (IS_DAY && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0); - if (this->unk2FA != 0) { + if (this->unk_2FA != 0) { this->actor.shape.rot.y += 0x1C2; } else { this->actor.shape.rot.y -= 0x1C2; @@ -526,7 +526,7 @@ void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim); this->state = PEAHAT_STATE_SEEK_PLAYER; - this->unk2D4 = 0; + this->unk_2D4 = 0; EnPeehat_SetupAction(this, EnPeehat_Larva_StateSeekPlayer); } @@ -545,10 +545,10 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { } else { Math_SmoothStepToF(&this->actor.velocity.y, -0.135f, 1.0f, 0.05f, 0.0f); } - if (this->unk2D4 == 0) { + if (this->unk_2D4 == 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 830, 0); } else { - this->unk2D4--; + this->unk_2D4--; } this->actor.shape.rot.y += 0x15E; SkelAnime_Update(&this->skelAnime); @@ -570,7 +570,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y -= 0x2000; } - this->unk2D4 = 40; + this->unk_2D4 = 40; } else if (this->colCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & 1) { Vec3f zeroVec = { 0, 0, 0 }; s32 i; @@ -651,7 +651,7 @@ void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { void EnPeehat_Ground_SetStateHover(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim); this->actor.speedXZ = Rand_ZeroOne() * 0.5f + 2.5f; - this->unk2D4 = Rand_ZeroOne() * 10 + 10; + this->unk_2D4 = Rand_ZeroOne() * 10 + 10; this->state = PEAHAT_STATE_15; EnPeehat_SetupAction(this, EnPeehat_Ground_StateHover); } @@ -664,17 +664,17 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { this->actor.world.pos.y -= 1.0f; } - this->actor.world.pos.y += Math_CosF(this->unk2E0) * 1.4f; - cos = Math_CosF(this->unk2E0) * 0.18f; - this->unk2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f; - this->unk2D4--; - if (this->unk2D4 <= 0) { + this->actor.world.pos.y += Math_CosF(this->unk_2E0) * 1.4f; + cos = Math_CosF(this->unk_2E0) * 0.18f; + this->unk_2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f; + this->unk_2D4--; + if (this->unk_2D4 <= 0) { this->actor.speedXZ = Rand_ZeroOne() * 0.5f + 2.5f; - this->unk2D4 = Rand_ZeroOne() * 10.0f + 10.0f; - this->unk2F4 = (Rand_ZeroOne() - 0.5f) * 1000.0f; + this->unk_2D4 = Rand_ZeroOne() * 10.0f + 10.0f; + this->unk_2F4 = (Rand_ZeroOne() - 0.5f) * 1000.0f; } SkelAnime_Update(&this->skelAnime); - this->actor.world.rot.y += this->unk2F4; + this->actor.world.rot.y += this->unk_2F4; if (this->seekPlayerTimer <= 0) { EnPeehat_Ground_SetStateLanding(this); this->riseDelayTimer = 40; @@ -686,7 +686,7 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk2FA = globalCtx->gameplayFrames & 1; + this->unk_2FA = globalCtx->gameplayFrames & 1; } else { EnPeehat_Ground_SetStateReturnHome(this); } @@ -713,9 +713,9 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { } else { this->actor.world.pos.y += 1.0f; } - this->actor.world.pos.y += Math_CosF(this->unk2E0) * 1.4f; - cos = Math_CosF(this->unk2E0) * 0.18f; - this->unk2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f; + this->actor.world.pos.y += Math_CosF(this->unk_2E0) * 1.4f; + cos = Math_CosF(this->unk_2E0) * 0.18f; + this->unk_2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f; yRot = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_SmoothStepToS(&this->actor.world.rot.y, yRot, 1, 600, 0); Math_SmoothStepToS(&this->actor.shape.rot.x, 4500, 1, 600, 0); @@ -728,7 +728,7 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->seekPlayerTimer = 400; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk2FA = (globalCtx->gameplayFrames & 1); + this->unk_2FA = (globalCtx->gameplayFrames & 1); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } @@ -763,7 +763,7 @@ void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) { EnPeehat_Ground_SetStateSeekPlayer(this); // Is PEAHAT_TYPE_GROUNDED if (this->actor.params < 0) { - this->unk2FA = (this->unk2FA != 0) ? 0 : 1; + this->unk_2FA = (this->unk_2FA != 0) ? 0 : 1; } } } @@ -803,11 +803,11 @@ void EnPeehat_Adult_SetStateDie(EnPeehat* this) { void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { if (this->isStateDieFirstUpdate) { - this->unk2D4--; - if (this->unk2D4 <= 0 || this->actor.colChkInfo.health == 0) { + this->unk_2D4--; + if (this->unk_2D4 <= 0 || this->actor.colChkInfo.health == 0) { Animation_MorphToPlayOnce(&this->skelAnime, &gPeehatRecoilAnim, -4.0f); this->bladeRotVel = 4000; - this->unk2D4 = 14; + this->unk_2D4 = 14; this->actor.speedXZ = 0; this->actor.velocity.y = 6; this->isStateDieFirstUpdate = 0; @@ -835,8 +835,8 @@ void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.speedXZ < 0) { this->actor.speedXZ += 0.25f; } - this->unk2D4--; - if (this->unk2D4 <= 0) { + this->unk_2D4--; + if (this->unk_2D4 <= 0) { if (this->actor.colChkInfo.health == 0) { EnPeehat_SetStateExplode(this); // if PEAHAT_TYPE_GROUNDED @@ -854,7 +854,7 @@ void EnPeehat_SetStateExplode(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim); this->state = PEAHAT_STATE_EXPLODE; this->animTimer = 5; - this->unk2E0 = 0.0f; + this->unk_2E0 = 0.0f; EnPeehat_SetupAction(this, EnPeehat_StateExplode); } diff --git a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index 726b47ad4..ffc7f265b 100644 --- a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -23,19 +23,19 @@ typedef struct EnPeehat { /* 0x02B4 */ s32 isStateDieFirstUpdate; /* 0x02B8 */ EnPeehatActionFunc actionFunc; /* 0x02BC */ Vec3f bladeTip[2]; // used to simulate the peahat's blades "digging up" earth - /* 0x02D4 */ s32 unk2D4; + /* 0x02D4 */ s32 unk_2D4; /* 0x02D8 */ f32 xzDistMax; // max xz dist to follow Link (PEAHAT_TYPE_GROUNDED) or spawn larva (PEAHAT_TYPE_FLYING) /* 0x02DC */ f32 xzDistToRise; // xz dist needed to rise from the ground - /* 0x02E0 */ f32 unk2E0; // rot? + /* 0x02E0 */ f32 unk_2E0; // rot? /* 0x02E4 */ f32 jiggleRot; /* 0x02E8 */ f32 jiggleRotInc; /* 0x02EC */ f32 scaleShift; // 0.0f for no distortion. used for "jiggle" effect when stabbed on ground /* 0x02F0 */ s16 bladeRotVel; // spinning blades rotational velocity /* 0x02F2 */ s16 bladeRot; // spinning blades rotation component - /* 0x02F4 */ s16 unk2F4; + /* 0x02F4 */ s16 unk_2F4; /* 0x02F6 */ s16 riseDelayTimer; // countdown timer until peahat is allowed to rise up from the ground /* 0x02F8 */ s16 seekPlayerTimer; // number of frames the peahat should seek the player before landing to rest - /* 0x02FA */ s16 unk2FA; // larva count (PEAHAT_TYPE_FLYING, PEAHAT_TYPE_GROUNDED), + /* 0x02FA */ s16 unk_2FA; // larva count (PEAHAT_TYPE_FLYING, PEAHAT_TYPE_GROUNDED), // shape rotation direction (PEAHAT_TYPE_GROUNDED) /* 0x02FC */ s16 animTimer; /* 0x0300 */ ColliderCylinder colCylinder; diff --git a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index a2c48c8db..493e2ec54 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -133,7 +133,7 @@ void EnPoDesert_UpdateSpeedModifier(EnPoDesert* this) { void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); - if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.unk_03)) { + if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.lensActive)) { if (this->currentPathPoint == 2) { if (Gameplay_InCsMode(globalCtx)) { this->actor.shape.rot.y += 0x800; @@ -198,7 +198,7 @@ void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 42.0f); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (globalCtx->actorCtx.unk_03) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } else { diff --git a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 7818d9e04..13c08dfc3 100644 --- a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -199,7 +199,7 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { if ((globalCtx->gameplayFrames % 4) == 0) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, 1); + 8.0f, 500, 10, true); } if (this->unk_278 == 0) { @@ -340,7 +340,7 @@ void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) { if ((this->unk_284 + 10.0f) <= this->actor.shape.yOffset) { if ((globalCtx->gameplayFrames % 4) == 0) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, 1); + 8.0f, 500, 10, true); } Math_ApproachF(&this->actor.shape.yOffset, this->unk_284, 1.0f, this->unk_288); diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 2d42c191e..8929e6362 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -153,7 +153,7 @@ typedef enum { } SkullKidAction; typedef struct { - u8 unk0; + u8 unk_0; EnSkj* skullkid; } EnSkjUnkStruct; @@ -371,7 +371,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(thisx, sInitChain); switch (type) { case 5: // Invisible on the small stump (sarias song)) - sSmallStumpSkullKid.unk0 = 1; + sSmallStumpSkullKid.unk_0 = 1; sSmallStumpSkullKid.skullkid = (EnSkj*)thisx; this->actor.destroy = NULL; this->actor.draw = NULL; @@ -382,7 +382,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { break; case 6: // Invisible on the short stump (ocarina game) - sSmallStumpSkullKid.unk0 = 1; + sSmallStumpSkullKid.unk_0 = 1; sSmallStumpSkullKid.skullkid = (EnSkj*)thisx; this->actor.destroy = NULL; this->actor.draw = NULL; @@ -421,7 +421,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((type > 0) && (type < 3)) { this->actor.targetMode = 7; this->posCopy = this->actor.world.pos; - sOcarinaMinigameSkullKids[type - 1].unk0 = 1; + sOcarinaMinigameSkullKids[type - 1].unk_0 = 1; sOcarinaMinigameSkullKids[type - 1].skullkid = this; this->minigameState = 0; this->alpha = 0; @@ -715,7 +715,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { if (!(gSaveContext.itemGetInf[1] & 0x40) && (this->actor.xzDistToPlayer < 200.0f)) { this->backflipFlag = 1; EnSkj_Backflip(this); - } else if (sSmallStumpSkullKid.unk0 != 0) { + } else if (sSmallStumpSkullKid.unk_0 != 0) { Player* player = GET_PLAYER(globalCtx); if (EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupWaitInRange(this); @@ -1222,7 +1222,7 @@ void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, GlobalContext* globalCtx) { s32 EnSkj_IsLeavingGame(EnSkj* this) { s32 paramDecr = this->actor.params - 1; - if (sOcarinaMinigameSkullKids[paramDecr].unk0 == 2) { + if (sOcarinaMinigameSkullKids[paramDecr].unk_0 == 2) { EnSkj_SetupLeaveOcarinaGame(this); return true; } @@ -1275,7 +1275,7 @@ void EnSkj_SetupLeaveOcarinaGame(EnSkj* this) { void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { s32 paramsDecr = this->actor.params - 1; - sOcarinaMinigameSkullKids[paramsDecr].unk0 = 0; + sOcarinaMinigameSkullKids[paramsDecr].unk_0 = 0; sOcarinaMinigameSkullKids[paramsDecr].skullkid = NULL; this->backflipFlag = 1; EnSkj_Backflip(this); @@ -1573,15 +1573,15 @@ void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { - sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk0 = 2; + sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk_0 = 2; } if (sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid != NULL) { - sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].unk0 = 2; + sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].unk_0 = 2; } - if ((sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk0 == 2) && - (sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].unk0 == 2)) { + if ((sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk_0 == 2) && + (sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].unk_0 == 2)) { func_800F5C2C(); Actor_Kill(&this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 51a512855..911678022 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -655,7 +655,7 @@ void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 16.0f, 0xC, 2.0f, 0x78, 0xA, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 16.0f, 12, 2.0f, 120, 10, false); } } diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c index e6359960e..5ae60ebf9 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1804,7 +1804,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params == STALFOS_TYPE_INVISIBLE) { - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawFeet; } else { @@ -1877,7 +1877,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_80864670, &sp64); if ((this->swordState >= 1) && - ((this->actor.params != STALFOS_TYPE_INVISIBLE) || (globalCtx->actorCtx.unk_03 != 0))) { + ((this->actor.params != STALFOS_TYPE_INVISIBLE) || globalCtx->actorCtx.lensActive)) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp70, &sp64); } else if (this->swordState >= 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->effectIndex)); @@ -1897,7 +1897,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V if ((this->unk_7C8 == 0x15) || (this->unk_7C8 == 0x16)) { if (this->actor.speedXZ != 0.0f) { Matrix_MultVec3f(&D_80864658, &sp64); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp64, 10.0f, 1, 8.0f, 0x64, 0xF, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp64, 10.0f, 1, 8.0f, 100, 15, false); } } } diff --git a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c index a20ca3be9..7969425ab 100644 --- a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -799,7 +799,7 @@ void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 3) { // Upon landing, spawn dust and make noise if (this->actor.bgCheckFlags & 2) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 0xB, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } this->vOnBackTimer--; diff --git a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 79b8d16c6..e7d5185d5 100644 --- a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -111,9 +111,9 @@ static DamageTable sDamageTable = { }; static InitChainEntry sInitChain[] = { - ICHAIN_S8(naviEnemyId, 0x30, 1), - ICHAIN_F32(targetArrowOffset, 5500, 1), - ICHAIN_F32_DIV1000(gravity, -1500, 0), + ICHAIN_S8(naviEnemyId, 0x30, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 5500, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -1500, ICHAIN_STOP), }; void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -186,7 +186,7 @@ void EnWallmas_SetupLand(EnWallmas* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, objSegChangee, 1.0f, 41.0f, Animation_GetLastFrame(objSegFrameCount), ANIMMODE_ONCE, -3.0f); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 0x12C, 0x64, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = EnWallmas_Land; } diff --git a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c index d2244e12e..c81a3a35f 100644 --- a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -557,7 +557,7 @@ void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx) { } if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (sp58 <= 0) && ((playSpeed + animPrevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } } } @@ -688,7 +688,7 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (animFrameSpeedDiff <= 0) && (animSpeed + animPrevFrame > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } if ((globalCtx->gameplayFrames & 95) == 0) { @@ -751,7 +751,7 @@ void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime)) { if ((curFrame != 15) && (this->actionTimer != 0)) { this->actor.shape.rot.y += (s16)(3276.0f * (1.5f + (this->actionTimer - 4) * 0.4f)); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); this->actionTimer--; } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (curFrame != 15)) { EnWf_SetupWait(this); @@ -1168,7 +1168,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (animFrameSpeedDiff <= 0) && ((animSpeed + animPrevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, 1); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } if ((globalCtx->gameplayFrames & 95) == 0) { diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 2753376ce..c7fdb65ad 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -668,8 +668,8 @@ void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~2; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1537,8 +1537,8 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.speedXZ = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); if (phi_f20 <= this->actor.xzDistToPlayer) { EnZf_SetupHopAndTaunt(this); diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index b0354008d..7b422d140 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -224,7 +224,7 @@ void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { ItemEtcetera* this = (ItemEtcetera*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { func_8002EBCC(&this->actor, globalCtx, 0); func_8002ED80(&this->actor, globalCtx, 0); diff --git a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 4958eacf5..3ae6cbfa1 100644 --- a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -137,7 +137,7 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { f32 colorScale; f32 fogScale; - if (globalCtx->roomCtx.curRoom.unk_03 != 5) { + if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) { intensity = CLAMP_MIN(intensity, 0.0f); intensity = CLAMP_MAX(intensity, 1.0f); fogScale = intensity - 0.2f; diff --git a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 04a3d960a..eb13445af 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -116,9 +116,9 @@ void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, sScales[(this->dyna.actor.params >> 1) & 1]); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->unk168.x = Rand_ZeroOne() * 65535.5f; - this->unk168.y = Rand_ZeroOne() * 65535.5f; - this->unk168.z = Rand_ZeroOne() * 65535.5f; + this->unk_168.x = Rand_ZeroOne() * 65535.5f; + this->unk_168.y = Rand_ZeroOne() * 65535.5f; + this->unk_168.z = Rand_ZeroOne() * 65535.5f; func_80B9651C(this); osSyncPrintf("(Dungeon Lift)(arg_data 0x%04x)\n", this->dyna.actor.params); } @@ -164,16 +164,16 @@ void func_80B96678(ObjLift* this, GlobalContext* globalCtx) { if (this->timer <= 0) { func_80B967C0(this); } else { - this->unk168.x += 10000; - this->dyna.actor.world.rot.x = (s16)(Math_SinS(this->unk168.x) * 300.0f) + this->dyna.actor.home.rot.x; - this->dyna.actor.world.rot.z = (s16)(Math_CosS(this->unk168.x) * 300.0f) + this->dyna.actor.home.rot.z; + this->unk_168.x += 10000; + this->dyna.actor.world.rot.x = (s16)(Math_SinS(this->unk_168.x) * 300.0f) + this->dyna.actor.home.rot.x; + this->dyna.actor.world.rot.z = (s16)(Math_CosS(this->unk_168.x) * 300.0f) + this->dyna.actor.home.rot.z; this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x; this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z; - this->unk168.y += 18000; - this->dyna.actor.world.pos.y = Math_SinS(this->unk168.y) + this->dyna.actor.home.pos.y; - this->unk168.z += 18000; - this->dyna.actor.world.pos.x = Math_SinS(this->unk168.z) * 3.0f + this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = Math_CosS(this->unk168.z) * 3.0f + this->dyna.actor.home.pos.z; + this->unk_168.y += 18000; + this->dyna.actor.world.pos.y = Math_SinS(this->unk_168.y) + this->dyna.actor.home.pos.y; + this->unk_168.z += 18000; + this->dyna.actor.world.pos.x = Math_SinS(this->unk_168.z) * 3.0f + this->dyna.actor.home.pos.x; + this->dyna.actor.world.pos.z = Math_CosS(this->unk_168.z) * 3.0f + this->dyna.actor.home.pos.z; } if ((this->timer & 3) == 3) { diff --git a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index 0bbf06a1f..7b3f717ac 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -11,7 +11,7 @@ typedef void (*ObjLiftActionFunc)(struct ObjLift*, GlobalContext*); typedef struct ObjLift { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ObjLiftActionFunc actionFunc; - /* 0x0168 */ Vec3s unk168; + /* 0x0168 */ Vec3s unk_168; /* 0x016E */ s16 timer; } ObjLift; // size = 0x0170 diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 1485d19fc..95c4cd087 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -2892,15 +2892,13 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { if (actionParam == PLAYER_AP_LENS) { if (func_80087708(globalCtx, 0, 3)) { - if (globalCtx->actorCtx.unk_03 != 0) { - func_800304B0(globalCtx); + if (globalCtx->actorCtx.lensActive) { + Actor_DisableLens(globalCtx); + } else { + globalCtx->actorCtx.lensActive = true; } - else { - globalCtx->actorCtx.unk_03 = 1; - } - func_80078884((globalCtx->actorCtx.unk_03 != 0) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); - } - else { + func_80078884((globalCtx->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); + } else { func_80078884(NA_SE_SY_ERROR); } return; @@ -4443,7 +4441,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { .sides[(doorDirection > 0) ? 0 : 1] .effects; - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); } } else { @@ -4501,7 +4499,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType != PLAYER_DOORTYPE_FAKE) { this->stateFlags1 |= PLAYER_STATE1_29; - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); if (((doorActor->params >> 7) & 7) == 3) { sp4C.x = doorActor->world.pos.x - (sp6C * sp74); @@ -5338,8 +5336,8 @@ void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) { s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) { s32 sp2C; - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (globalCtx->roomCtx.curRoom.unk_03 != 2) && - (D_808535E4 != 7) && + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && + (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && (SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { sp2C = this->unk_84B[this->unk_846]; @@ -5538,7 +5536,8 @@ s32 func_8083C544(Player* this, GlobalContext* globalCtx) { } s32 func_8083C61C(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && (this->actor.bgCheckFlags & 1) && (AMMO(ITEM_NUT) != 0)) { + if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + (this->actor.bgCheckFlags & 1) && (AMMO(ITEM_NUT) != 0)) { func_80835C58(globalCtx, this, func_8084E604, 0); func_80832264(globalCtx, this, &gPlayerAnim_003048); this->unk_6AD = 0; @@ -6161,7 +6160,7 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { func_80832F54(globalCtx, this, 0x9B); this->actor.parent = this->rideActor; func_80832224(this); - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); return 1; } @@ -7158,9 +7157,8 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { this->stateFlags2 |= PLAYER_STATE2_28; if (this->stateFlags1 & PLAYER_STATE1_11) { anim = func_80833338(this); - } - else { - sp38 = globalCtx->roomCtx.curRoom.unk_02; + } else { + sp38 = globalCtx->roomCtx.curRoom.behaviorType2; if (heathIsCritical) { if (this->unk_6AC >= 0) { sp38 = 7; @@ -8398,7 +8396,7 @@ static struct_80832924 D_808545F0[] = { void func_80843CEC(Player* this, GlobalContext* globalCtx) { if (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0) { - if ((globalCtx->roomCtx.curRoom.unk_02 == 3) || (D_808535E4 == 9) || + if ((globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || ((func_80838144(D_808535E4) >= 0) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_8083821C(this); @@ -9579,7 +9577,7 @@ void func_80846A68(GlobalContext* globalCtx, Player* this) { this->stateFlags1 |= PLAYER_STATE1_29; } -static InitChainEntry D_80854708[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; @@ -9592,7 +9590,7 @@ static Vec3s D_80854730 = { -57, 3377, 0 }; void Player_InitCommon(Player* this, GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader) { this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; - Actor_ProcessInitChain(&this->actor, D_80854708); + Actor_ProcessInitChain(&this->actor, sInitChain); this->swordEffectIndex = TOTAL_EFFECT_COUNT; this->currentYaw = this->actor.world.rot.y; func_80834644(globalCtx, this); @@ -9919,13 +9917,13 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_22) || func_80833BCC(this) || !Player_IsChildWithHylianShield(this))) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) && - (func_8008E9C4(this) || - ((D_808535E4 != 7) && - (func_80833B2C(this) || ((globalCtx->roomCtx.curRoom.unk_03 != 2) && - !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { + (func_8008E9C4(this) || + ((D_808535E4 != 7) && (func_80833B2C(this) || + ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { doAction = DO_ACTION_ATTACK; - } - else if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && func_80833BCC(this) && (sp20 > 0)) { + } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + func_80833BCC(this) && (sp20 > 0)) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER) || diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index cfaf9e26d..73da17185 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -130,11 +130,11 @@ void Title_Calc(TitleContext* this) { this->ult++; if (gSkipLogoTest || gLoadFileSelect) { - this->exit = 1; + this->exit = true; } #else - this->exit = 1; + this->exit = true; #endif }