diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index 2f6aac2dda..ead4263dcf 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -1,63 +1,83 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/functions.h b/include/functions.h index ff0a9985ec..ebc3447d4d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -594,7 +594,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play); void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos); void func_800B4AEC(PlayState* play, Actor* actor, f32 y); void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play); -void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3); +void Actor_GetProjectedPos(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW); void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play); @@ -2345,13 +2345,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -s32 func_8013A240(PlayState* play); -void func_8013A41C(s32 flag); -void func_8013A46C(s32 flag); -u32 func_8013A4C4(s32 flag); -s16 func_8013A504(s16 val); -s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError); - void View_ViewportToVp(Vp* dest, Viewport* src); void View_Init(View* view, GraphicsContext* gfxCtx); void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); diff --git a/include/macros.h b/include/macros.h index 5d1829c4c5..f713bf736b 100644 --- a/include/macros.h +++ b/include/macros.h @@ -11,6 +11,9 @@ #define SCREEN_WIDTH_HIGH_RES 576 #define SCREEN_HEIGHT_HIGH_RES 454 +#define PROJECTED_TO_SCREEN_X(projectedPos, invW) ((projectedPos).x * (invW) * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2)) +#define PROJECTED_TO_SCREEN_Y(projectedPos, invW) ((projectedPos).y * (invW) * (-SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2)) + #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) diff --git a/include/z64actor.h b/include/z64actor.h index baec8e81a1..e1fc334a32 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -9,6 +9,7 @@ // This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD. #define AM_FIELD_SIZE SEGMENT_SIZE(ovl_Arrow_Fire) + #define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC collisions #define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects. @@ -222,6 +223,7 @@ typedef struct { /* 0x15A */ s16 pad15A; } DynaPolyActor; // size = 0x15C + typedef enum { /* 0x00 */ ITEM00_RUPEE_GREEN, /* 0x01 */ ITEM00_RUPEE_BLUE, diff --git a/include/z64item.h b/include/z64item.h index 5e8e3a656f..3e3c608b94 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -558,7 +558,7 @@ typedef enum { typedef enum { /* -1 */ EXCH_ITEM_MINUS1 = -1, // Unknown usage or function /* 0x00 */ EXCH_ITEM_NONE, - /* 0x13 */ EXCH_ITEM_13 = 0x13, + /* 0x13 */ EXCH_ITEM_PICTO_BOX = 0x13, /* 0x1E */ EXCH_ITEM_1E = 0x1E, // BOTTLE_MUSHROOM /* 0x2A */ EXCH_ITEM_MOON_TEAR = 0x2A, /* 0x2B */ EXCH_ITEM_DEED_LAND, diff --git a/include/z64save.h b/include/z64save.h index 103fe6a536..b153f745d7 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -143,8 +143,8 @@ typedef struct Save { /* 0x00F8 */ PermanentSceneFlags permanentSceneFlags[120]; /* 0x0E18 */ u8 unk_E18[0x54]; /* 0x0E6C */ u32 dekuPlaygroundHighScores[3]; - /* 0x0E78 */ u32 pictoFlags0; - /* 0x0E7C */ u32 pictoFlags1; + /* 0x0E78 */ u32 pictoFlags0; // Flags set by `PictoActor`s if pictograph is valid + /* 0x0E7C */ u32 pictoFlags1; // Flags set by Snap_ValidatePictograph() to record errors; volatile since that function is run many times in succession /* 0x0E80 */ u32 unk_E80; /* 0x0E84 */ u32 unk_E84; /* 0x0E88 */ u32 unk_E88[7]; // Invadepoh flags diff --git a/include/z64snap.h b/include/z64snap.h new file mode 100644 index 0000000000..fb3f861861 --- /dev/null +++ b/include/z64snap.h @@ -0,0 +1,52 @@ +#ifndef Z64_SNAP_H +#define Z64_SNAP_H + +#include "PR/ultratypes.h" +#include "z64actor.h" + +typedef s32 (*PictoValidationFunc)(struct PlayState*, Actor*); + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x144 */ PictoValidationFunc validationFunc; +} PictoActor; + +// Picto box flags + +typedef enum { + // Used externally, set and read by actors + /* 0x00 */ PICTOGRAPH_0, + /* 0x01 */ PICTOGRAPH_IN_SWAMP, + /* 0x02 */ PICTOGRAPH_MONKEY, + /* 0x03 */ PICTOGRAPH_BIG_OCTO, + /* 0x04 */ PICTOGRAPH_LULU_HEAD, + /* 0x05 */ PICTOGRAPH_LULU_RIGHT_ARM, + /* 0x06 */ PICTOGRAPH_LULU_LEFT_ARM, // Need all three of these to qualify as a good picture + /* 0x07 */ PICTOGRAPH_SCARECROW, + /* 0x08 */ PICTOGRAPH_TINGLE, + /* 0x09 */ PICTOGRAPH_PIRATE_GOOD, + /* 0x0A */ PICTOGRAPH_DEKU_KING, + /* 0x0B */ PICTOGRAPH_PIRATE_TOO_FAR, // overlaps with PICTOGRAPH_PIRATE_GOOD, but that is checked first + + // Used internally, test for failures of position, angle etc. + /* 0x3B */ PICTOGRAPH_BEHIND_COLLISION = 0x3B, + /* 0x3C */ PICTOGRAPH_BEHIND_BG, + /* 0x3D */ PICTOGRAPH_NOT_IN_VIEW, + /* 0x3E */ PICTOGRAPH_BAD_ANGLE, + /* 0x3F */ PICTOGRAPH_BAD_DISTANCE +} PictographFlag; + +// The following macros are subject to renaming once the capture system is better understood +#define PICTO_RESOLUTION_HORIZONTAL 150 +#define PICTO_RESOLUTION_VERTICAL 105 +#define PICTO_CAPTURE_REGION_TOPLEFT_X ((SCREEN_WIDTH - PICTO_RESOLUTION_HORIZONTAL) / 2) +#define PICTO_CAPTURE_REGION_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_RESOLUTION_VERTICAL) / 2) + +s32 Snap_RecordPictographedActors(PlayState* play); +void Snap_SetFlag(s32 flag); +void Snap_UnsetFlag(s32 flag); +u32 Snap_CheckFlag(s32 flag); +s16 Snap_AbsS(s16 val); +s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleRange); + +#endif diff --git a/spec b/spec index 2fe3386463..e161e5939b 100644 --- a/spec +++ b/spec @@ -1499,8 +1499,7 @@ beginseg name "ovl_En_Ge1" compress include "build/src/overlays/actors/ovl_En_Ge1/z_en_ge1.o" - include "build/data/ovl_En_Ge1/ovl_En_Ge1.data.o" - include "build/data/ovl_En_Ge1/ovl_En_Ge1.reloc.o" + include "build/src/overlays/actors/ovl_En_Ge1/ovl_En_Ge1_reloc.o" endseg beginseg diff --git a/src/code/graph.c b/src/code/graph.c index f625cb7b61..481aa1da0e 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "system_malloc.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" diff --git a/src/code/z_actor.c b/src/code/z_actor.c index cee64182b4..64d9c97f45 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -391,12 +391,12 @@ void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) { } } -void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, arg2, arg3); - if (*arg3 < 1.0f) { - *arg3 = 1.0f; +void Actor_GetProjectedPos(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, worldPos, projectedPos, invW); + if (*invW < 1.0f) { + *invW = 1.0f; } else { - *arg3 = 1.0f / *arg3; + *invW = 1.0f / *invW; } } @@ -419,7 +419,7 @@ TatlColor sTatlColorList[] = { { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } } + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, }; void func_800B4F78(TargetContext* targetCtx, s32 type, PlayState* play) { @@ -480,9 +480,9 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { TargetContextEntry* entry; s16 alpha = 255; f32 var1 = 1.0f; - Vec3f spBC; + Vec3f projectedPos; s32 spB8; - f32 spB4; + f32 invW; s32 spB0; s32 spAC; f32 var2; @@ -505,22 +505,22 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { alpha = targetCtx->unk48; } - Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &spBC, &spB4); + Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &projectedPos, &invW); - spBC.x = (160 * (spBC.x * spB4)) * var1; - spBC.x = CLAMP(spBC.x, -320.0f, 320.0f); + projectedPos.x = (160 * (projectedPos.x * invW)) * var1; + projectedPos.x = CLAMP(projectedPos.x, -320.0f, 320.0f); - spBC.y = (120 * (spBC.y * spB4)) * var1; - spBC.y = CLAMP(spBC.y, -240.0f, 240.0f); + projectedPos.y = (120 * (projectedPos.y * invW)) * var1; + projectedPos.y = CLAMP(projectedPos.y, -240.0f, 240.0f); - spBC.z = spBC.z * var1; + projectedPos.z = projectedPos.z * var1; targetCtx->unk4C--; if (targetCtx->unk4C < 0) { targetCtx->unk4C = 2; } - Target_SetPos(targetCtx, targetCtx->unk4C, spBC.x, spBC.y, spBC.z); + Target_SetPos(targetCtx, targetCtx->unk4C, projectedPos.x, projectedPos.y, projectedPos.z); if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_730)) { OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39); @@ -1966,18 +1966,19 @@ void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { f32 w; Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &w); - *x = (projectedPos.x * w * (SCREEN_WIDTH / 2)) + (SCREEN_WIDTH / 2); - *y = (projectedPos.y * w * -(SCREEN_HEIGHT / 2)) + (SCREEN_HEIGHT / 2); + *x = PROJECTED_TO_SCREEN_X(projectedPos, w); + *y = PROJECTED_TO_SCREEN_Y(projectedPos, w); } s32 func_800B8934(PlayState* play, Actor* actor) { - Vec3f sp2C; - f32 sp28; + Vec3f projectedPos; + f32 invW; s32 pad[2]; - Actor_GetProjectedPos(play, &actor->focus.pos, &sp2C, &sp28); + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); - return (sp2C.x * sp28 >= -1.0f) && (sp2C.x * sp28 <= 1.0f) && (sp2C.y * sp28 >= -1.0f) && (sp2C.y * sp28 <= 1.0f); + return (projectedPos.x * invW >= -1.0f) && (projectedPos.x * invW <= 1.0f) && (projectedPos.y * invW >= -1.0f) && + (projectedPos.y * invW <= 1.0f); } s32 Actor_HasParent(Actor* actor, PlayState* play) { diff --git a/src/code/z_lights.c b/src/code/z_lights.c index b602c66b14..92e9beb307 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -380,20 +380,20 @@ void Lights_GlowCheck(PlayState* play) { if (light->info->type == LIGHT_POINT_GLOW) { Vec3f pos; - Vec3f multDest; - f32 wDest; + Vec3f projectedPos; + f32 invW; pos.x = params->x; pos.y = params->y; pos.z = params->z; - Actor_GetProjectedPos(play, &pos, &multDest, &wDest); + Actor_GetProjectedPos(play, &pos, &projectedPos, &invW); params->drawGlow = 0; - if ((multDest.z > 1) && (fabsf(multDest.x * wDest) < 1) && (fabsf(multDest.y * wDest) < 1)) { - s32 wX = multDest.x * wDest * 160 + 160; - s32 wY = multDest.y * wDest * -120 + 120; - s32 wZ = (s32)((multDest.z * wDest) * 16352) + 16352; + if ((projectedPos.z > 1) && (fabsf(projectedPos.x * invW) < 1) && (fabsf(projectedPos.y * invW) < 1)) { + s32 wX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 wY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)((projectedPos.z * invW) * 16352) + 16352; s32 zBuf = func_80178A94(wX, wY); if (wZ < zBuf) { diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 8372c350a1..daf85190af 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -7,119 +7,119 @@ { { 0, 0 }, 0, 0, 0, 0 } SceneTableEntry gSceneTable[] = { - SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(KAKUSIANA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(SPOT00, 0x0000, SCENE_DRAW_CFG_NOTHING), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_WITCH_SHOP, 0x011A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_HAKASHITA, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_AYASHIISHOP, 0x010E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_OMOYA, 0x0132, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOWLING, 0x0108, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SONCHONOIE, 0x010B, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_IKANA, 0x0141, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KAIZOKU, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MILK_BAR, 0x010C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_INISIE_N, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TAKARAYA, 0x0109, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_INISIE_R, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_OKUJOU, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_OPENINGDAN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MITURIN, 0x011F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_13HUBUKINOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_CASTLE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DEKUTES, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MITURIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SYATEKI_MIZU, 0x0107, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_HAKUGIN, 0x012B, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_ROMANYMAE, 0x0149, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_PIRATE, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SYATEKI_MORI, 0x011B, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SINKAI, 0x0135, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_YOUSEI_IZUMI, 0x013E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KINSTA1, 0x011E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KINDAN2, 0x013F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TENMON_DAI, 0x0114, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_DEKU, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_22DEKUCITY, 0x0118, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KAJIYA, 0x0127, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_00KEIKOKU, 0x0100, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_POSTHOUSE, 0x0111, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_LABO, 0x013A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DANPEI2TEST, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_16GORON_HOUSE, 0x0124, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_33ZORACITY, 0x0136, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_8ITEMSHOP, 0x010F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_F01, 0x012E, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_INISIE_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_30GYOSON, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_31MISAKI, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TAKARAKUJI, 0x0112, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_TORIDE, 0x0138, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_FISHERMAN, 0x013B, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORONSHOP, 0x0129, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DEKU_KING, 0x011C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_GORON, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_24KEMONOMITI, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_F01_B, 0x0130, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F01C, 0x012F, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOTI, 0x0106, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_HAKUGIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_20SICHITAI, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_21MITURINMAE, 0x0117, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_ZORA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_11GORONNOSATO2, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SEA, 0x013D, SCENE_DRAW_CFG_GREAT_BAY_TEMPLE), - SCENE_ENTRY(Z2_35TAKI, 0x0137, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_REDEAD, 0x0145, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_BANDROOM, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_11GORONNOSATO, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORON_HAKA, 0x012A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SECOM, 0x0143, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), - SCENE_ENTRY(Z2_10YUKIYAMANOMURA, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TOUGITES, 0x0146, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_DANPEI, 0x0120, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_IKANAMAE, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_DOUJOU, 0x0110, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_MUSICHOUSE, 0x0147, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), - SCENE_ENTRY(Z2_IKNINSIDE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MAP_SHOP, 0x0119, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F40, 0x0140, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F41, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_10YUKIYAMANOMURA2, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_14YUKIDAMANOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_12HAKUGINMAE, 0x0125, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_17SETUGEN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_17SETUGEN2, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SEA_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_RANDOM, 0x012C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_YADOYA, 0x010A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KONPEKI_ENT, 0x0139, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_INSIDETOWER, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_26SARUNOMORI, 0x011D, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LOST_WOODS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_LINK, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SOUGEN, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOMYA, 0x010D, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_KYOJINNOMA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KOEPONARACE, 0x0131, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORONRACE, 0x0126, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_TOWN, 0x0101, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_ICHIBA, 0x0102, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BACKTOWN, 0x0103, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_CLOCKTOWER, 0x0104, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_ALLEY, 0x0105, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x00 */ SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x01 */ SCENE_ENTRY_NONE(), + /* 0x02 */ SCENE_ENTRY_NONE(), + /* 0x03 */ SCENE_ENTRY_NONE(), + /* 0x04 */ SCENE_ENTRY_NONE(), + /* 0x05 */ SCENE_ENTRY_NONE(), + /* 0x06 */ SCENE_ENTRY_NONE(), + /* 0x07 */ SCENE_ENTRY(KAKUSIANA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x08 */ SCENE_ENTRY(SPOT00, 0x0000, SCENE_DRAW_CFG_NOTHING), + /* 0x09 */ SCENE_ENTRY_NONE(), + /* 0x0A */ SCENE_ENTRY(Z2_WITCH_SHOP, 0x011A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0B */ SCENE_ENTRY(Z2_LAST_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0C */ SCENE_ENTRY(Z2_HAKASHITA, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0D */ SCENE_ENTRY(Z2_AYASHIISHOP, 0x010E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0E */ SCENE_ENTRY_NONE(), + /* 0x0F */ SCENE_ENTRY_NONE(), + /* 0x10 */ SCENE_ENTRY(Z2_OMOYA, 0x0132, SCENE_DRAW_CFG_DEFAULT), + /* 0x11 */ SCENE_ENTRY(Z2_BOWLING, 0x0108, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x12 */ SCENE_ENTRY(Z2_SONCHONOIE, 0x010B, SCENE_DRAW_CFG_DEFAULT), + /* 0x13 */ SCENE_ENTRY(Z2_IKANA, 0x0141, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x14 */ SCENE_ENTRY(Z2_KAIZOKU, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x15 */ SCENE_ENTRY(Z2_MILK_BAR, 0x010C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x16 */ SCENE_ENTRY(Z2_INISIE_N, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x17 */ SCENE_ENTRY(Z2_TAKARAYA, 0x0109, SCENE_DRAW_CFG_DEFAULT), + /* 0x18 */ SCENE_ENTRY(Z2_INISIE_R, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x19 */ SCENE_ENTRY(Z2_OKUJOU, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x1A */ SCENE_ENTRY(Z2_OPENINGDAN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1B */ SCENE_ENTRY(Z2_MITURIN, 0x011F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1C */ SCENE_ENTRY(Z2_13HUBUKINOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x1D */ SCENE_ENTRY(Z2_CASTLE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1E */ SCENE_ENTRY(Z2_DEKUTES, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1F */ SCENE_ENTRY(Z2_MITURIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x20 */ SCENE_ENTRY(Z2_SYATEKI_MIZU, 0x0107, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x21 */ SCENE_ENTRY(Z2_HAKUGIN, 0x012B, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x22 */ SCENE_ENTRY(Z2_ROMANYMAE, 0x0149, SCENE_DRAW_CFG_DEFAULT), + /* 0x23 */ SCENE_ENTRY(Z2_PIRATE, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x24 */ SCENE_ENTRY(Z2_SYATEKI_MORI, 0x011B, SCENE_DRAW_CFG_DEFAULT), + /* 0x25 */ SCENE_ENTRY(Z2_SINKAI, 0x0135, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x26 */ SCENE_ENTRY(Z2_YOUSEI_IZUMI, 0x013E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x27 */ SCENE_ENTRY(Z2_KINSTA1, 0x011E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x28 */ SCENE_ENTRY(Z2_KINDAN2, 0x013F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x29 */ SCENE_ENTRY(Z2_TENMON_DAI, 0x0114, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2A */ SCENE_ENTRY(Z2_LAST_DEKU, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x2B */ SCENE_ENTRY(Z2_22DEKUCITY, 0x0118, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2C */ SCENE_ENTRY(Z2_KAJIYA, 0x0127, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2D */ SCENE_ENTRY(Z2_00KEIKOKU, 0x0100, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2E */ SCENE_ENTRY(Z2_POSTHOUSE, 0x0111, SCENE_DRAW_CFG_DEFAULT), + /* 0x2F */ SCENE_ENTRY(Z2_LABO, 0x013A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x30 */ SCENE_ENTRY(Z2_DANPEI2TEST, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x31 */ SCENE_ENTRY_NONE(), + /* 0x32 */ SCENE_ENTRY(Z2_16GORON_HOUSE, 0x0124, SCENE_DRAW_CFG_DEFAULT), + /* 0x33 */ SCENE_ENTRY(Z2_33ZORACITY, 0x0136, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x34 */ SCENE_ENTRY(Z2_8ITEMSHOP, 0x010F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x35 */ SCENE_ENTRY(Z2_F01, 0x012E, SCENE_DRAW_CFG_DEFAULT), + /* 0x36 */ SCENE_ENTRY(Z2_INISIE_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x37 */ SCENE_ENTRY(Z2_30GYOSON, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x38 */ SCENE_ENTRY(Z2_31MISAKI, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x39 */ SCENE_ENTRY(Z2_TAKARAKUJI, 0x0112, SCENE_DRAW_CFG_DEFAULT), + /* 0x3A */ SCENE_ENTRY_NONE(), + /* 0x3B */ SCENE_ENTRY(Z2_TORIDE, 0x0138, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3C */ SCENE_ENTRY(Z2_FISHERMAN, 0x013B, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3D */ SCENE_ENTRY(Z2_GORONSHOP, 0x0129, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3E */ SCENE_ENTRY(Z2_DEKU_KING, 0x011C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3F */ SCENE_ENTRY(Z2_LAST_GORON, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x40 */ SCENE_ENTRY(Z2_24KEMONOMITI, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x41 */ SCENE_ENTRY(Z2_F01_B, 0x0130, SCENE_DRAW_CFG_DEFAULT), + /* 0x42 */ SCENE_ENTRY(Z2_F01C, 0x012F, SCENE_DRAW_CFG_DEFAULT), + /* 0x43 */ SCENE_ENTRY(Z2_BOTI, 0x0106, SCENE_DRAW_CFG_DEFAULT), + /* 0x44 */ SCENE_ENTRY(Z2_HAKUGIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x45 */ SCENE_ENTRY(Z2_20SICHITAI, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x46 */ SCENE_ENTRY(Z2_21MITURINMAE, 0x0117, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x47 */ SCENE_ENTRY(Z2_LAST_ZORA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x48 */ SCENE_ENTRY(Z2_11GORONNOSATO2, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x49 */ SCENE_ENTRY(Z2_SEA, 0x013D, SCENE_DRAW_CFG_GREAT_BAY_TEMPLE), + /* 0x4A */ SCENE_ENTRY(Z2_35TAKI, 0x0137, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4B */ SCENE_ENTRY(Z2_REDEAD, 0x0145, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4C */ SCENE_ENTRY(Z2_BANDROOM, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4D */ SCENE_ENTRY(Z2_11GORONNOSATO, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4E */ SCENE_ENTRY(Z2_GORON_HAKA, 0x012A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4F */ SCENE_ENTRY(Z2_SECOM, 0x0143, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), + /* 0x50 */ SCENE_ENTRY(Z2_10YUKIYAMANOMURA, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x51 */ SCENE_ENTRY(Z2_TOUGITES, 0x0146, SCENE_DRAW_CFG_DEFAULT), + /* 0x52 */ SCENE_ENTRY(Z2_DANPEI, 0x0120, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x53 */ SCENE_ENTRY(Z2_IKANAMAE, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x54 */ SCENE_ENTRY(Z2_DOUJOU, 0x0110, SCENE_DRAW_CFG_DEFAULT), + /* 0x55 */ SCENE_ENTRY(Z2_MUSICHOUSE, 0x0147, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), + /* 0x56 */ SCENE_ENTRY(Z2_IKNINSIDE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x57 */ SCENE_ENTRY(Z2_MAP_SHOP, 0x0119, SCENE_DRAW_CFG_DEFAULT), + /* 0x58 */ SCENE_ENTRY(Z2_F40, 0x0140, SCENE_DRAW_CFG_DEFAULT), + /* 0x59 */ SCENE_ENTRY(Z2_F41, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x5A */ SCENE_ENTRY(Z2_10YUKIYAMANOMURA2, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5B */ SCENE_ENTRY(Z2_14YUKIDAMANOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x5C */ SCENE_ENTRY(Z2_12HAKUGINMAE, 0x0125, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5D */ SCENE_ENTRY(Z2_17SETUGEN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5E */ SCENE_ENTRY(Z2_17SETUGEN2, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5F */ SCENE_ENTRY(Z2_SEA_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x60 */ SCENE_ENTRY(Z2_RANDOM, 0x012C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x61 */ SCENE_ENTRY(Z2_YADOYA, 0x010A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x62 */ SCENE_ENTRY(Z2_KONPEKI_ENT, 0x0139, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x63 */ SCENE_ENTRY(Z2_INSIDETOWER, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x64 */ SCENE_ENTRY(Z2_26SARUNOMORI, 0x011D, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x65 */ SCENE_ENTRY(Z2_LOST_WOODS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x66 */ SCENE_ENTRY(Z2_LAST_LINK, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x67 */ SCENE_ENTRY(Z2_SOUGEN, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x68 */ SCENE_ENTRY(Z2_BOMYA, 0x010D, SCENE_DRAW_CFG_DEFAULT), + /* 0x69 */ SCENE_ENTRY(Z2_KYOJINNOMA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x6A */ SCENE_ENTRY(Z2_KOEPONARACE, 0x0131, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x6B */ SCENE_ENTRY(Z2_GORONRACE, 0x0126, SCENE_DRAW_CFG_DEFAULT), + /* 0x6C */ SCENE_ENTRY(Z2_TOWN, 0x0101, SCENE_DRAW_CFG_DEFAULT), + /* 0x6D */ SCENE_ENTRY(Z2_ICHIBA, 0x0102, SCENE_DRAW_CFG_DEFAULT), + /* 0x6E */ SCENE_ENTRY(Z2_BACKTOWN, 0x0103, SCENE_DRAW_CFG_DEFAULT), + /* 0x6F */ SCENE_ENTRY(Z2_CLOCKTOWER, 0x0104, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x70 */ SCENE_ENTRY(Z2_ALLEY, 0x0105, SCENE_DRAW_CFG_MAT_ANIM), }; static EntranceTableEntry sMayorsResidenceEntrance0[] = { @@ -782,17 +782,17 @@ static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { sSwampShootingGalleryEntrance0, }; -static EntranceTableEntry sPinaccleRockEntrance0[] = { +static EntranceTableEntry sPinnacleRockEntrance0[] = { { 0x25, 0x00, 0x4A14 }, }; -static EntranceTableEntry sPinaccleRockEntrance1[] = { +static EntranceTableEntry sPinnacleRockEntrance1[] = { { 0x25, 0x01, 0x0A14 }, }; -static EntranceTableEntry* sPinaccleRockEntranceTable[] = { - sPinaccleRockEntrance0, - sPinaccleRockEntrance1, +static EntranceTableEntry* sPinnacleRockEntranceTable[] = { + sPinnacleRockEntrance0, + sPinnacleRockEntrance1, }; static EntranceTableEntry sFairyFountainEntrance0[] = { @@ -2657,116 +2657,116 @@ static EntranceTableEntry* sCutsceneEntranceTable[] = { { 0, NULL, NULL } static SceneEntranceTableEntry sSceneEntranceTable[] = { - SCENE_ENTRANCE(sMayorsResidenceEntranceTable, "Z2_SONCHONOIE"), - SCENE_ENTRANCE(sMajorasLairEntranceTable, "Z2_LAST_BS"), - SCENE_ENTRANCE(sMagicHagsPotionShopEntranceTable, "Z2_WITCH_SHOP"), - SCENE_ENTRANCE(sRanchHouseEntranceTable, "Z2_OMOYA"), - SCENE_ENTRANCE(sHoneyAndDarlingsShopEntranceTable, "Z2_BOWLING"), - SCENE_ENTRANCE(sBeneathTheGraveryardEntranceTable, "Z2_HAKASHITA"), - SCENE_ENTRANCE(sSouthernSwampClearedEntranceTable, "Z2_20SICHITAI2"), - SCENE_ENTRANCE(sCuriosityShopEntranceTable, "Z2_AYASHIISHOP"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sGrottosEntranceTable, "KAKUSIANA"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sCutsceneEntranceTable, "SPOT00"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sIkanaCanyonEntranceTable, "Z2_IKANA"), - SCENE_ENTRANCE(sPiratesFortressEntranceTable, "Z2_KAIZOKU"), - SCENE_ENTRANCE(sMilkBarEntranceTable, "Z2_MILK_BAR"), - SCENE_ENTRANCE(sStoneTowerTempleEntranceTable, "Z2_INISIE_N"), - SCENE_ENTRANCE(sTreasureChestShopEntranceTable, "Z2_TAKARAYA"), - SCENE_ENTRANCE(sStoneTowerTempleReversedEntranceTable, "Z2_INISIE_R"), - SCENE_ENTRANCE(sClockTowerRooftopEntranceTable, "Z2_OKUJOU"), - SCENE_ENTRANCE(sOpeningDungeonEntranceTable, "Z2_OPENINGDAN"), - SCENE_ENTRANCE(sWoodfallTempleEntranceTable, "Z2_MITURIN"), - SCENE_ENTRANCE(sPathToMountainVillageEntranceTable, "Z2_13HUBUKINOMITI"), - SCENE_ENTRANCE(sIkanaCastleEntranceTable, "Z2_CASTLE"), - SCENE_ENTRANCE(sDekuScrubPlaygroundEntranceTable, "Z2_DEKUTES"), - SCENE_ENTRANCE(sOdolwasLairEntranceTable, "Z2_MITURIN_BS"), - SCENE_ENTRANCE(sTownShootingGalleryEntranceTable, "Z2_SYATEKI_MIZU"), - SCENE_ENTRANCE(sSnowheadTempleEntranceTable, "Z2_HAKUGIN"), - SCENE_ENTRANCE(sMilkRoadEntranceTable, "Z2_ROMANYMAE"), - SCENE_ENTRANCE(sPiratesFortressInteriorEntranceTable, "Z2_PIRATE"), - SCENE_ENTRANCE(sSwampShootingGalleryEntranceTable, "Z2_SYATEKI_MORI"), - SCENE_ENTRANCE(sPinaccleRockEntranceTable, "Z2_SINKAI"), - SCENE_ENTRANCE(sFairyFountainEntranceTable, "Z2_YOUSEI_IZUMI"), - SCENE_ENTRANCE(sSwampSpiderHouseEntranceTable, "Z2_KINSTA1"), - SCENE_ENTRANCE(sOceansideSpiderHouseEntranceTable, "Z2_KINDAN2"), - SCENE_ENTRANCE(sAstralObservatoryEntranceTable, "Z2_TENMON_DAI"), - SCENE_ENTRANCE(sMoonDekuTrialEntranceTable, "Z2_LAST_DEKU"), - SCENE_ENTRANCE(sDekuPalaceEntranceTable, "Z2_22DEKUCITY"), - SCENE_ENTRANCE(sMountainSmithyEntranceTable, "Z2_KAJIYA"), - SCENE_ENTRANCE(sTerminaFieldEntranceTable, "Z2_00KEIKOKU"), - SCENE_ENTRANCE(sPostOfficeEntranceTable, "Z2_POSTHOUSE"), - SCENE_ENTRANCE(sMarineResearchLabEntranceTable, "Z2_LABO"), - SCENE_ENTRANCE(sDampesHouseEntranceTable, "Z2_DANPEI2TEST"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sGoronShrineEntranceTable, "Z2_16GORON_HOUSE"), - SCENE_ENTRANCE(sZoraHallEntranceTable, "Z2_33ZORACITY"), - SCENE_ENTRANCE(sTradingPostEntranceTable, "Z2_8ITEMSHOP"), - SCENE_ENTRANCE(sRomaniRanchEntranceTable, "Z2_F01"), - SCENE_ENTRANCE(sTwinmoldsLairEntranceTable, "Z2_INISIE_BS"), - SCENE_ENTRANCE(sGreatBayCoastEntranceTable, "Z2_30GYOSON"), - SCENE_ENTRANCE(sZoraCapeEntranceTable, "Z2_31MISAKI"), - SCENE_ENTRANCE(sLotteryShopEntranceTable, "Z2_TAKARAKUJI"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sPiratesFortressExteriorEntranceTable, "Z2_TORIDE"), - SCENE_ENTRANCE(sFishermansHutEntranceTable, "Z2_FISHERMAN"), - SCENE_ENTRANCE(sGoronShopEntranceTable, "Z2_GORONSHOP"), - SCENE_ENTRANCE(sDekuKingsChamberEntranceTable, "Z2_DEKU_KING"), - SCENE_ENTRANCE(sMoonGoronTrialEntranceTable, "Z2_LAST_GORON"), - SCENE_ENTRANCE(sRoadToSouthernSwampEntranceTable, "Z2_24KEMONOMITI"), - SCENE_ENTRANCE(sDoggyRacetrackEntranceTable, "Z2_F01_B"), - SCENE_ENTRANCE(sCuccoShackEntranceTable, "Z2_F01C"), - SCENE_ENTRANCE(sIkanaGraveyardEntranceTable, "Z2_BOTI"), - SCENE_ENTRANCE(sGohtsLairEntranceTable, "Z2_HAKUGIN_BS"), - SCENE_ENTRANCE(sSouthernSwampPoisonedEntranceTable, "Z2_20SICHITAI"), - SCENE_ENTRANCE(sWoodfallEntranceTable, "Z2_21MITURINMAE"), - SCENE_ENTRANCE(sMoonZoraTrialEntranceTable, "Z2_LAST_ZORA"), - SCENE_ENTRANCE(sGoronVillageSpringEntranceTable, "Z2_11GORONNOSATO2"), - SCENE_ENTRANCE(sGreatBayTempleEntranceTable, "Z2_SEA"), - SCENE_ENTRANCE(sWaterfallRapidsEntranceTable, "Z2_35TAKI"), - SCENE_ENTRANCE(sBeneathTheWellEntranceTable, "Z2_REDEAD"), - SCENE_ENTRANCE(sZoraHallRoomsEntranceTable, "Z2_BANDROOM"), - SCENE_ENTRANCE(sGoronVillageWinterEntranceTable, "Z2_11GORONNOSATO"), - SCENE_ENTRANCE(sGoronGraveryardEntranceTable, "Z2_GORON_HAKA"), - SCENE_ENTRANCE(sSakonsHideoutEntranceTable, "Z2_SECOM"), - SCENE_ENTRANCE(sMountainVillageWinterEntranceTable, "Z2_10YUKIYAMANOMURA"), - SCENE_ENTRANCE(sGhostHutEntranceTable, "Z2_TOUGITES"), - SCENE_ENTRANCE(sDekuShrineEntranceTable, "Z2_DANPEI"), - SCENE_ENTRANCE(sRoadToIkanaEntranceTable, "Z2_IKANAMAE"), - SCENE_ENTRANCE(sSwordmansSchoolEntranceTable, "Z2_DOUJOU"), - SCENE_ENTRANCE(sMusicBoxHouseEntranceTable, "Z2_MUSICHOUSE"), - SCENE_ENTRANCE(sIgosDuIkanasLairEntranceTable, "Z2_IKNINSIDE"), - SCENE_ENTRANCE(sTouristInformationEntranceTable, "Z2_MAP_SHOP"), - SCENE_ENTRANCE(sStoneTowerEntranceTable, "Z2_F40"), - SCENE_ENTRANCE(sStoneTowerInvertedEntranceTable, "Z2_F41"), - SCENE_ENTRANCE(sMountainVillageSpringEntranceTable, "Z2_10YUKIYAMANOMURA2"), - SCENE_ENTRANCE(sPathToSnowheadEntranceTable, "Z2_14YUKIDAMANOMITI"), - SCENE_ENTRANCE(sSnowheadEntranceTable, "Z2_12HAKUGINMAE"), - SCENE_ENTRANCE(sPathToGoronVillageWinterEntranceTable, "Z2_17SETUGEN"), - SCENE_ENTRANCE(sPathToGoronVillageSpringEntranceTable, "Z2_17SETUGEN2"), - SCENE_ENTRANCE(sGyorgsLairEntranceTable, "Z2_SEA_BS"), - SCENE_ENTRANCE(sSecretShrineEntranceTable, "Z2_RANDOM"), - SCENE_ENTRANCE(sStockPotInnEntranceTable, "Z2_YADOYA"), - SCENE_ENTRANCE(sGreatBayCutsceneEntranceTable, "Z2_KONPEKI_ENT"), - SCENE_ENTRANCE(sClockTowerInteriorEntranceTable, "Z2_INSIDETOWER"), - SCENE_ENTRANCE(sWoodsOfMysteryEntranceTable, "Z2_26SARUNOMORI"), - SCENE_ENTRANCE(sLostWoodsEntranceTable, "Z2_LOST_WOODS"), - SCENE_ENTRANCE(sMoonLinkTrialEntranceTable, "Z2_LAST_LINK"), - SCENE_ENTRANCE(sTheMoonEntranceTable, "Z2_SOUGEN"), - SCENE_ENTRANCE(sBombShopEntranceTable, "Z2_BOMYA"), - SCENE_ENTRANCE(sGiantsChamberEntranceTable, "Z2_KYOJINNOMA"), - SCENE_ENTRANCE(sGormanTrackEntranceTable, "Z2_KOEPONARACE"), - SCENE_ENTRANCE(sGoronRacetrackEntranceTable, "Z2_GORONRACE"), - SCENE_ENTRANCE(sEastClockTownEntranceTable, "Z2_TOWN"), - SCENE_ENTRANCE(sWestClockTownEntranceTable, "Z2_ICHIBA"), - SCENE_ENTRANCE(sNorthClockTownEntranceTable, "Z2_BACKTOWN"), - SCENE_ENTRANCE(sSouthClockTownEntranceTable, "Z2_CLOCKTOWER"), - SCENE_ENTRANCE(sLaundryPoolEntranceTable, "Z2_ALLEY"), + /* 0x00 */ SCENE_ENTRANCE(sMayorsResidenceEntranceTable, "Z2_SONCHONOIE"), + /* 0x01 */ SCENE_ENTRANCE(sMajorasLairEntranceTable, "Z2_LAST_BS"), + /* 0x02 */ SCENE_ENTRANCE(sMagicHagsPotionShopEntranceTable, "Z2_WITCH_SHOP"), + /* 0x03 */ SCENE_ENTRANCE(sRanchHouseEntranceTable, "Z2_OMOYA"), + /* 0x04 */ SCENE_ENTRANCE(sHoneyAndDarlingsShopEntranceTable, "Z2_BOWLING"), + /* 0x05 */ SCENE_ENTRANCE(sBeneathTheGraveryardEntranceTable, "Z2_HAKASHITA"), + /* 0x06 */ SCENE_ENTRANCE(sSouthernSwampClearedEntranceTable, "Z2_20SICHITAI2"), + /* 0x07 */ SCENE_ENTRANCE(sCuriosityShopEntranceTable, "Z2_AYASHIISHOP"), + /* 0x08 */ SCENE_ENTRANCE_NONE(), + /* 0x09 */ SCENE_ENTRANCE_NONE(), + /* 0x0A */ SCENE_ENTRANCE(sGrottosEntranceTable, "KAKUSIANA"), + /* 0x0B */ SCENE_ENTRANCE_NONE(), + /* 0x0C */ SCENE_ENTRANCE_NONE(), + /* 0x0D */ SCENE_ENTRANCE_NONE(), + /* 0x0E */ SCENE_ENTRANCE(sCutsceneEntranceTable, "SPOT00"), + /* 0x0F */ SCENE_ENTRANCE_NONE(), + /* 0x10 */ SCENE_ENTRANCE(sIkanaCanyonEntranceTable, "Z2_IKANA"), + /* 0x11 */ SCENE_ENTRANCE(sPiratesFortressEntranceTable, "Z2_KAIZOKU"), + /* 0x12 */ SCENE_ENTRANCE(sMilkBarEntranceTable, "Z2_MILK_BAR"), + /* 0x13 */ SCENE_ENTRANCE(sStoneTowerTempleEntranceTable, "Z2_INISIE_N"), + /* 0x14 */ SCENE_ENTRANCE(sTreasureChestShopEntranceTable, "Z2_TAKARAYA"), + /* 0x15 */ SCENE_ENTRANCE(sStoneTowerTempleReversedEntranceTable, "Z2_INISIE_R"), + /* 0x16 */ SCENE_ENTRANCE(sClockTowerRooftopEntranceTable, "Z2_OKUJOU"), + /* 0x17 */ SCENE_ENTRANCE(sOpeningDungeonEntranceTable, "Z2_OPENINGDAN"), + /* 0x18 */ SCENE_ENTRANCE(sWoodfallTempleEntranceTable, "Z2_MITURIN"), + /* 0x19 */ SCENE_ENTRANCE(sPathToMountainVillageEntranceTable, "Z2_13HUBUKINOMITI"), + /* 0x1A */ SCENE_ENTRANCE(sIkanaCastleEntranceTable, "Z2_CASTLE"), + /* 0x1B */ SCENE_ENTRANCE(sDekuScrubPlaygroundEntranceTable, "Z2_DEKUTES"), + /* 0x1C */ SCENE_ENTRANCE(sOdolwasLairEntranceTable, "Z2_MITURIN_BS"), + /* 0x1D */ SCENE_ENTRANCE(sTownShootingGalleryEntranceTable, "Z2_SYATEKI_MIZU"), + /* 0x1E */ SCENE_ENTRANCE(sSnowheadTempleEntranceTable, "Z2_HAKUGIN"), + /* 0x1F */ SCENE_ENTRANCE(sMilkRoadEntranceTable, "Z2_ROMANYMAE"), + /* 0x20 */ SCENE_ENTRANCE(sPiratesFortressInteriorEntranceTable, "Z2_PIRATE"), + /* 0x21 */ SCENE_ENTRANCE(sSwampShootingGalleryEntranceTable, "Z2_SYATEKI_MORI"), + /* 0x22 */ SCENE_ENTRANCE(sPinnacleRockEntranceTable, "Z2_SINKAI"), + /* 0x23 */ SCENE_ENTRANCE(sFairyFountainEntranceTable, "Z2_YOUSEI_IZUMI"), + /* 0x24 */ SCENE_ENTRANCE(sSwampSpiderHouseEntranceTable, "Z2_KINSTA1"), + /* 0x25 */ SCENE_ENTRANCE(sOceansideSpiderHouseEntranceTable, "Z2_KINDAN2"), + /* 0x26 */ SCENE_ENTRANCE(sAstralObservatoryEntranceTable, "Z2_TENMON_DAI"), + /* 0x27 */ SCENE_ENTRANCE(sMoonDekuTrialEntranceTable, "Z2_LAST_DEKU"), + /* 0x28 */ SCENE_ENTRANCE(sDekuPalaceEntranceTable, "Z2_22DEKUCITY"), + /* 0x29 */ SCENE_ENTRANCE(sMountainSmithyEntranceTable, "Z2_KAJIYA"), + /* 0x2A */ SCENE_ENTRANCE(sTerminaFieldEntranceTable, "Z2_00KEIKOKU"), + /* 0x2B */ SCENE_ENTRANCE(sPostOfficeEntranceTable, "Z2_POSTHOUSE"), + /* 0x2C */ SCENE_ENTRANCE(sMarineResearchLabEntranceTable, "Z2_LABO"), + /* 0x2D */ SCENE_ENTRANCE(sDampesHouseEntranceTable, "Z2_DANPEI2TEST"), + /* 0x2E */ SCENE_ENTRANCE_NONE(), + /* 0x2F */ SCENE_ENTRANCE(sGoronShrineEntranceTable, "Z2_16GORON_HOUSE"), + /* 0x30 */ SCENE_ENTRANCE(sZoraHallEntranceTable, "Z2_33ZORACITY"), + /* 0x31 */ SCENE_ENTRANCE(sTradingPostEntranceTable, "Z2_8ITEMSHOP"), + /* 0x32 */ SCENE_ENTRANCE(sRomaniRanchEntranceTable, "Z2_F01"), + /* 0x33 */ SCENE_ENTRANCE(sTwinmoldsLairEntranceTable, "Z2_INISIE_BS"), + /* 0x34 */ SCENE_ENTRANCE(sGreatBayCoastEntranceTable, "Z2_30GYOSON"), + /* 0x35 */ SCENE_ENTRANCE(sZoraCapeEntranceTable, "Z2_31MISAKI"), + /* 0x36 */ SCENE_ENTRANCE(sLotteryShopEntranceTable, "Z2_TAKARAKUJI"), + /* 0x37 */ SCENE_ENTRANCE_NONE(), + /* 0x38 */ SCENE_ENTRANCE(sPiratesFortressExteriorEntranceTable, "Z2_TORIDE"), + /* 0x39 */ SCENE_ENTRANCE(sFishermansHutEntranceTable, "Z2_FISHERMAN"), + /* 0x3A */ SCENE_ENTRANCE(sGoronShopEntranceTable, "Z2_GORONSHOP"), + /* 0x3B */ SCENE_ENTRANCE(sDekuKingsChamberEntranceTable, "Z2_DEKU_KING"), + /* 0x3C */ SCENE_ENTRANCE(sMoonGoronTrialEntranceTable, "Z2_LAST_GORON"), + /* 0x3D */ SCENE_ENTRANCE(sRoadToSouthernSwampEntranceTable, "Z2_24KEMONOMITI"), + /* 0x3E */ SCENE_ENTRANCE(sDoggyRacetrackEntranceTable, "Z2_F01_B"), + /* 0x3F */ SCENE_ENTRANCE(sCuccoShackEntranceTable, "Z2_F01C"), + /* 0x40 */ SCENE_ENTRANCE(sIkanaGraveyardEntranceTable, "Z2_BOTI"), + /* 0x41 */ SCENE_ENTRANCE(sGohtsLairEntranceTable, "Z2_HAKUGIN_BS"), + /* 0x42 */ SCENE_ENTRANCE(sSouthernSwampPoisonedEntranceTable, "Z2_20SICHITAI"), + /* 0x43 */ SCENE_ENTRANCE(sWoodfallEntranceTable, "Z2_21MITURINMAE"), + /* 0x44 */ SCENE_ENTRANCE(sMoonZoraTrialEntranceTable, "Z2_LAST_ZORA"), + /* 0x45 */ SCENE_ENTRANCE(sGoronVillageSpringEntranceTable, "Z2_11GORONNOSATO2"), + /* 0x46 */ SCENE_ENTRANCE(sGreatBayTempleEntranceTable, "Z2_SEA"), + /* 0x47 */ SCENE_ENTRANCE(sWaterfallRapidsEntranceTable, "Z2_35TAKI"), + /* 0x48 */ SCENE_ENTRANCE(sBeneathTheWellEntranceTable, "Z2_REDEAD"), + /* 0x49 */ SCENE_ENTRANCE(sZoraHallRoomsEntranceTable, "Z2_BANDROOM"), + /* 0x4A */ SCENE_ENTRANCE(sGoronVillageWinterEntranceTable, "Z2_11GORONNOSATO"), + /* 0x4B */ SCENE_ENTRANCE(sGoronGraveryardEntranceTable, "Z2_GORON_HAKA"), + /* 0x4C */ SCENE_ENTRANCE(sSakonsHideoutEntranceTable, "Z2_SECOM"), + /* 0x4D */ SCENE_ENTRANCE(sMountainVillageWinterEntranceTable, "Z2_10YUKIYAMANOMURA"), + /* 0x4E */ SCENE_ENTRANCE(sGhostHutEntranceTable, "Z2_TOUGITES"), + /* 0x4F */ SCENE_ENTRANCE(sDekuShrineEntranceTable, "Z2_DANPEI"), + /* 0x50 */ SCENE_ENTRANCE(sRoadToIkanaEntranceTable, "Z2_IKANAMAE"), + /* 0x51 */ SCENE_ENTRANCE(sSwordmansSchoolEntranceTable, "Z2_DOUJOU"), + /* 0x52 */ SCENE_ENTRANCE(sMusicBoxHouseEntranceTable, "Z2_MUSICHOUSE"), + /* 0x53 */ SCENE_ENTRANCE(sIgosDuIkanasLairEntranceTable, "Z2_IKNINSIDE"), + /* 0x54 */ SCENE_ENTRANCE(sTouristInformationEntranceTable, "Z2_MAP_SHOP"), + /* 0x55 */ SCENE_ENTRANCE(sStoneTowerEntranceTable, "Z2_F40"), + /* 0x56 */ SCENE_ENTRANCE(sStoneTowerInvertedEntranceTable, "Z2_F41"), + /* 0x57 */ SCENE_ENTRANCE(sMountainVillageSpringEntranceTable, "Z2_10YUKIYAMANOMURA2"), + /* 0x58 */ SCENE_ENTRANCE(sPathToSnowheadEntranceTable, "Z2_14YUKIDAMANOMITI"), + /* 0x59 */ SCENE_ENTRANCE(sSnowheadEntranceTable, "Z2_12HAKUGINMAE"), + /* 0x5A */ SCENE_ENTRANCE(sPathToGoronVillageWinterEntranceTable, "Z2_17SETUGEN"), + /* 0x5B */ SCENE_ENTRANCE(sPathToGoronVillageSpringEntranceTable, "Z2_17SETUGEN2"), + /* 0x5C */ SCENE_ENTRANCE(sGyorgsLairEntranceTable, "Z2_SEA_BS"), + /* 0x5D */ SCENE_ENTRANCE(sSecretShrineEntranceTable, "Z2_RANDOM"), + /* 0x5E */ SCENE_ENTRANCE(sStockPotInnEntranceTable, "Z2_YADOYA"), + /* 0x5F */ SCENE_ENTRANCE(sGreatBayCutsceneEntranceTable, "Z2_KONPEKI_ENT"), + /* 0x60 */ SCENE_ENTRANCE(sClockTowerInteriorEntranceTable, "Z2_INSIDETOWER"), + /* 0x61 */ SCENE_ENTRANCE(sWoodsOfMysteryEntranceTable, "Z2_26SARUNOMORI"), + /* 0x62 */ SCENE_ENTRANCE(sLostWoodsEntranceTable, "Z2_LOST_WOODS"), + /* 0x63 */ SCENE_ENTRANCE(sMoonLinkTrialEntranceTable, "Z2_LAST_LINK"), + /* 0x64 */ SCENE_ENTRANCE(sTheMoonEntranceTable, "Z2_SOUGEN"), + /* 0x65 */ SCENE_ENTRANCE(sBombShopEntranceTable, "Z2_BOMYA"), + /* 0x66 */ SCENE_ENTRANCE(sGiantsChamberEntranceTable, "Z2_KYOJINNOMA"), + /* 0x67 */ SCENE_ENTRANCE(sGormanTrackEntranceTable, "Z2_KOEPONARACE"), + /* 0x68 */ SCENE_ENTRANCE(sGoronRacetrackEntranceTable, "Z2_GORONRACE"), + /* 0x69 */ SCENE_ENTRANCE(sEastClockTownEntranceTable, "Z2_TOWN"), + /* 0x6A */ SCENE_ENTRANCE(sWestClockTownEntranceTable, "Z2_ICHIBA"), + /* 0x6B */ SCENE_ENTRANCE(sNorthClockTownEntranceTable, "Z2_BACKTOWN"), + /* 0x6C */ SCENE_ENTRANCE(sSouthClockTownEntranceTable, "Z2_CLOCKTOWER"), + /* 0x6D */ SCENE_ENTRANCE(sLaundryPoolEntranceTable, "Z2_ALLEY"), }; /** diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 2156950f1f..246309749c 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -1,80 +1,96 @@ #include "global.h" +#include "z64snap.h" +#include "overlays/actors/ovl_En_Kakasi/z_en_kakasi.h" -typedef struct { - Actor actor; - s32 (*pictoFunc)(PlayState* play, Actor* actor); -} PictoActor; +#define PICTO_SEEN_IN_SCENE 1 +#define PICTO_SEEN_ANYWHERE 2 -s32 func_8013A240(PlayState* play) { +/** + * Test every loaded actor to see if it is a pictographable `PictoActor`, and if so, run its `validationFunc` to set + * appropriate flags. + * + * @return s32 Number of pictograph actors validly captured. + */ +s32 Snap_RecordPictographedActors(PlayState* play) { PictoActor* pictoActor; Actor* actor; - s32 type = 0; + s32 category = 0; s32 seen; - s32 count = 0; + s32 validCount = 0; gSaveContext.save.pictoFlags0 = 0; gSaveContext.save.pictoFlags1 = 0; if (play->sceneNum == SCENE_20SICHITAI) { - func_8013A41C(1); + Snap_SetFlag(PICTOGRAPH_IN_SWAMP); } - for (; type < 12; type++) { - for (actor = play->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) { + for (; category < ACTORCAT_MAX; category++) { + for (actor = play->actorCtx.actorLists[category].first; actor != NULL; actor = actor->next) { seen = 0; + // Actors which must be pictographed in a specific scene switch (play->sceneNum) { case SCENE_20SICHITAI: if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) { - seen = 1; + seen = PICTO_SEEN_IN_SCENE; } break; + default: seen = 0; + break; } if (actor->id) { ; // Needed to match } + // Actors which may be pictographed anywhere switch (actor->id) { case ACTOR_EN_KAKASI: - if ((actor->params & 1) == 1) { - seen |= 2; + if (GET_KAKASI_ABOVE_GROUND(actor) == 1) { + seen |= PICTO_SEEN_ANYWHERE; break; //! @bug break is inside conditional, meaning it falls through if it is false } + // FALLTHROUGH case ACTOR_EN_ZOV: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_BAL: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_DNQ: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_GE1: case ACTOR_EN_GE3: case ACTOR_EN_KAIZOKU: case ACTOR_EN_GE2: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; } - if (seen != 0) { + // If actor is recordable, run its validity function and record if valid + if (seen) { pictoActor = (PictoActor*)actor; - if (pictoActor->pictoFunc != NULL) { - if ((pictoActor->pictoFunc)(play, actor) == 0) { - count++; + if (pictoActor->validationFunc != NULL) { + if ((pictoActor->validationFunc)(play, actor) == 0) { + validCount++; } } } } } - return count; + return validCount; } -void func_8013A41C(s32 flag) { +// Only used in this file +void Snap_SetFlag(s32 flag) { if (flag < 0x20) { gSaveContext.save.pictoFlags0 |= (1 << flag); } else { @@ -83,7 +99,8 @@ void func_8013A41C(s32 flag) { } } -void func_8013A46C(s32 flag) { +// Unused +void Snap_UnsetFlag(s32 flag) { if (flag < 0x20) { gSaveContext.save.pictoFlags0 &= ~(1 << flag); } else { @@ -92,7 +109,7 @@ void func_8013A46C(s32 flag) { } } -u32 func_8013A4C4(s32 flag) { +u32 Snap_CheckFlag(s32 flag) { SaveContext* saveCtx = &gSaveContext; if (flag < 0x20) { @@ -103,13 +120,29 @@ u32 func_8013A4C4(s32 flag) { } } -s16 func_8013A504(s16 val) { - return (val >= 0) ? val : -val; +s16 Snap_AbsS(s16 val) { + return ABS(val); } -s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, - s16 angleError) { - Vec3f screenSpace; +/** + * Test if a pictograph is a valid pictograph of an actor + * + * @param play + * @param actor Actor to test + * @param flag Flag to set if checks successful + * @param pos position of point to test (generally a particular point in the actor's model) + * @param rot rotation of point to test (for facing camera) + * @param distanceMin closest point may be + * @param distanceMax farthest away point may be + * @param angleRange Size of range that counts as facing the camera (-1 is used for any allowed) + * @return s32 0 on success, `or`ed combination of the validity flag indices if not + * + * @note It is generally not possible to recover the actual failure mode(s) from the return value: oring `ret` with the + * actual flag rather than its index would rectify this. + */ +s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, + f32 distanceMax, s16 angleRange) { + Vec3f projectedPos; s16 x; s16 y; f32 distance; @@ -119,42 +152,51 @@ s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* ro s32 ret = 0; s32 bgId; + // Check distance distance = OLib_Vec3fDist(pos, &camera->eye); if ((distance < distanceMin) || (distanceMax < distance)) { - func_8013A41C(0x3F); - ret = 0x3F; + Snap_SetFlag(PICTOGRAPH_BAD_DISTANCE); + ret = PICTOGRAPH_BAD_DISTANCE; } - x = func_8013A504(Camera_GetCamDirPitch(camera) + rot->x); - y = func_8013A504(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF)); - if ((0 < angleError) && ((angleError < x) || (angleError < y))) { - func_8013A41C(0x3E); - ret |= 0x3E; + // Check rot is facing camera? + x = Snap_AbsS(Camera_GetCamDirPitch(camera) + rot->x); + y = Snap_AbsS(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF)); + if ((0 < angleRange) && ((angleRange < x) || (angleRange < y))) { + Snap_SetFlag(PICTOGRAPH_BAD_ANGLE); + ret |= PICTOGRAPH_BAD_ANGLE; } - Actor_GetProjectedPos(play, pos, &screenSpace, &distance); - x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85; - y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67; - if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) { - func_8013A41C(0x3D); - ret |= 0x3D; + // Check in capture region + Actor_GetProjectedPos(play, pos, &projectedPos, &distance); + // Convert to projected position to device coordinates, shift to be relative to the capture region's top-left corner + x = (s16)PROJECTED_TO_SCREEN_X(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_X; + y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_Y; + + // checks if the coordinates are within the capture region + if ((x < 0) || (x > PICTO_RESOLUTION_HORIZONTAL) || (y < 0) || (y > PICTO_RESOLUTION_VERTICAL)) { + Snap_SetFlag(PICTOGRAPH_NOT_IN_VIEW); + ret |= PICTOGRAPH_NOT_IN_VIEW; } - if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true, + // Check not obscured by bg collision + if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &projectedPos, &poly, true, true, true, true, &bgId)) { - func_8013A41C(0x3C); - ret |= 0x3C; + Snap_SetFlag(PICTOGRAPH_BEHIND_BG); + ret |= PICTOGRAPH_BEHIND_BG; } + // Check not obscured by actor collision actors[0] = actor; actors[1] = &GET_PLAYER(play)->actor; if (CollisionCheck_LineOCCheck(play, &play->colChkCtx, pos, &camera->eye, actors, 2)) { - func_8013A41C(0x3B); - ret |= 0x3B; + Snap_SetFlag(PICTOGRAPH_BEHIND_COLLISION); + ret |= PICTOGRAPH_BEHIND_COLLISION; } + // If all of the above checks pass, set the flag if (ret == 0) { - func_8013A41C(flag); + Snap_SetFlag(flag); } return ret; diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 57a6f33127..b3a79895eb 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -183,19 +183,19 @@ void func_80C168D0(DemoSyoten* this, PlayState* play) { s32 pad; Path* path = this->unk_3E8; Vec3s* points; - Vec3f sp30; - Vec3f sp24; - f32 sp20; + Vec3f worldPos; + Vec3f projectedPos; + f32 invW; if (path != NULL) { points = Lib_SegmentedToVirtual(this->unk_3E8->points); points += this->unk_3EC; - Math_Vec3s_ToVec3f(&sp30, points); - Actor_GetProjectedPos(play, &sp30, &sp24, &sp20); - Math_Vec3f_Copy(&sp30, &this->actor.projectedPos); - sp30.z = sp30.y; - sp24.z = sp24.y; - this->actor.shape.rot.z = -Math_Vec3f_Yaw(&sp24, &sp30); + Math_Vec3s_ToVec3f(&worldPos, points); + Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW); + Math_Vec3f_Copy(&worldPos, &this->actor.projectedPos); + worldPos.z = worldPos.y; + projectedPos.z = projectedPos.y; + this->actor.shape.rot.z = -Math_Vec3f_Yaw(&projectedPos, &worldPos); } } diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.c b/src/overlays/actors/ovl_En_Bal/z_en_bal.c index 9617e0559b..dec839006a 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.c +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.c @@ -100,7 +100,7 @@ extern UNK_TYPE D_0600D530; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61A44.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61A6C.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/EnBal_ValidatePictograph.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61ADC.s") diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.h b/src/overlays/actors/ovl_En_Bal/z_en_bal.h index 9184cfa688..7f64293dbc 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.h +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.h @@ -2,14 +2,15 @@ #define Z_EN_BAL_H #include "global.h" +#include "z64snap.h" struct EnBal; typedef void (*EnBalActionFunc)(struct EnBal*, PlayState*); typedef struct EnBal { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x48]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ char unk_148[0x44]; /* 0x18C */ EnBalActionFunc actionFunc; /* 0x190 */ char unk_190[0x224]; } EnBal; // size = 0x3B4 diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 2b1111809f..1022d45f82 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -15,7 +15,7 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play); void EnBigokuta_Update(Actor* thisx, PlayState* play); void EnBigokuta_Draw(Actor* thisx, PlayState* play); -void func_80AC2B4C(PlayState* play, EnBigokuta* this); +s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx); void EnBigokuta_SetupIdle(EnBigokuta* this); void EnBigokuta_Idle(EnBigokuta* this, PlayState* play); void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play); @@ -95,28 +95,28 @@ static InitChainEntry sInitChain[] = { void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->picto.actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gBigOctoSkel, &gBigOctoIdleAnim, this->jointTable, this->morphTable, BIGOKUTA_LIMB_MAX); - Collider_InitAndSetCylinder(play, &this->shellCollider, &this->actor, &sShellCylinderInit); - Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + Collider_InitAndSetCylinder(play, &this->shellCollider, &this->picto.actor, &sShellCylinderInit); + Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sBodyCylinderInit); + CollisionCheck_SetInfo(&this->picto.actor.colChkInfo, NULL, &sColChkInfoInit); + this->cutscene = ActorCutscene_GetAdditionalCutscene(this->picto.actor.cutscene); if (gSaveContext.save.weekEventReg[20] & 2 || - ((this->actor.params != 0xFF) && Flags_GetSwitch(play, this->actor.params))) { - Actor_MarkForDeath(&this->actor); + ((this->picto.actor.params != 0xFF) && Flags_GetSwitch(play, this->picto.actor.params))) { + Actor_MarkForDeath(&this->picto.actor); } else { - this->actor.world.pos.y -= 99.0f; + this->picto.actor.world.pos.y -= 99.0f; EnBigokuta_SetupIdle(this); } - this->subCamAt.x = (Math_SinS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.x; - this->subCamAt.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->subCamAt.z = (Math_CosS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.z; + this->subCamAt.x = (Math_SinS(this->picto.actor.home.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->subCamAt.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->subCamAt.z = (Math_CosS(this->picto.actor.home.rot.y) * 66.0f) + this->picto.actor.world.pos.z; - this->unkFunc = func_80AC2B4C; // set but never called + this->picto.validationFunc = EnBigokuta_ValidatePictograph; } void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { @@ -129,15 +129,15 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* subCamAt, Vec3f* subCamEye) { s16 angle; - ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + ActorCutscene_Start(this->picto.actor.cutscene, &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); Play_CameraSetAtEye(play, this->subCamId, subCamAt, subCamEye); - angle = BINANG_SUB(Actor_YawToPoint(&this->actor, subCamEye), this->actor.home.rot.y); + angle = BINANG_SUB(Actor_YawToPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); if (angle > 0) { - angle = BINANG_ADD(this->actor.home.rot.y, 0x1800); + angle = BINANG_ADD(this->picto.actor.home.rot.y, 0x1800); } else { - angle = BINANG_SUB(this->actor.home.rot.y, 0x1800); + angle = BINANG_SUB(this->picto.actor.home.rot.y, 0x1800); } this->subCamEye.x = (Math_SinS(angle) * 250.0f) + this->subCamAt.x; @@ -160,37 +160,38 @@ void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { subCam = Play_GetCamera(play, this->subCamId); Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->actor.cutscene); + ActorCutscene_Stop(this->picto.actor.cutscene); } } void EnBigokuta_ShootPlayer(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (&this->actor == player->actor.parent) { + if (&this->picto.actor == player->actor.parent) { player->actor.parent = NULL; player->unk_AE8 = 100; player->actor.velocity.y = 0.0f; - player->actor.world.pos.x += 20.0f * Math_SinS(this->actor.home.rot.y); - player->actor.world.pos.z += 20.0f * Math_CosS(this->actor.home.rot.y); - func_800B8D50(play, &this->actor, 10.0f, this->actor.home.rot.y, 10.0f, 4); + player->actor.world.pos.x += 20.0f * Math_SinS(this->picto.actor.home.rot.y); + player->actor.world.pos.z += 20.0f * Math_CosS(this->picto.actor.home.rot.y); + func_800B8D50(play, &this->picto.actor, 10.0f, this->picto.actor.home.rot.y, 10.0f, 4); } EnBigokuta_ResetCamera(this, play); } -void func_80AC2B4C(PlayState* play, EnBigokuta* this) { - func_8013A530(play, &this->actor, 3, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_BIG_OCTO, &thisx->focus.pos, &thisx->shape.rot, 280.0f, + 1800.0f, -1); } s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { WaterBox* box; s32 bgId; - this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->actor.home.pos.y, &box) || - (this->actor.home.pos.y <= this->actor.floorHeight)) { + this->picto.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->picto.actor.floorPoly, &bgId, + &this->picto.actor, &this->picto.actor.world.pos); + if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->picto.actor.world.pos.x, this->picto.actor.world.pos.z, + &this->picto.actor.home.pos.y, &box) || + (this->picto.actor.home.pos.y <= this->picto.actor.floorHeight)) { return false; } else { return true; @@ -200,9 +201,9 @@ s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { void EnBigokuta_SpawnRipple(EnBigokuta* this, PlayState* play) { Vec3f ripplePos; - ripplePos.x = this->actor.world.pos.x; - ripplePos.y = this->actor.home.pos.y; - ripplePos.z = this->actor.world.pos.z; + ripplePos.x = this->picto.actor.world.pos.x; + ripplePos.y = this->picto.actor.home.pos.y; + ripplePos.z = this->picto.actor.world.pos.z; EffectSsGRipple_Spawn(play, &ripplePos, 1000, 1400, 0); } @@ -215,9 +216,10 @@ void EnBigokuta_Idle(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 99.0f, 2.5f); - Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); - if ((this->actor.xzDistToPlayer < 300.0f) && ((player->actor.world.pos.y - this->actor.home.pos.y) < 100.0f)) { + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 99.0f, 2.5f); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 0x1000); + if ((this->picto.actor.xzDistToPlayer < 300.0f) && + ((player->actor.world.pos.y - this->picto.actor.home.pos.y) < 100.0f)) { EnBigokuta_SetupRise(this, play); } } @@ -228,19 +230,19 @@ void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play) { s16 angle = 0; Animation_PlayOnce(&this->skelAnime, &gBigOctoRiseOutOfWaterAnim); - splashPos.y = this->actor.home.pos.y; + splashPos.y = this->picto.actor.home.pos.y; for (i = 0; i < 8; i++) { - splashPos.x = Math_SinS(angle) * 70.0f + this->actor.world.pos.x; - splashPos.z = Math_CosS(angle) * 70.0f + this->actor.world.pos.z; + splashPos.x = Math_SinS(angle) * 70.0f + this->picto.actor.world.pos.x; + splashPos.z = Math_CosS(angle) * 70.0f + this->picto.actor.world.pos.z; EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, Rand_S16Offset(1000, 200)); angle = BINANG_ADD(angle, 0x2000); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_LAND); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_LAND); this->actionFunc = EnBigokuta_RiseOutOfWater; } void EnBigokuta_RiseOutOfWater(EnBigokuta* this, PlayState* play) { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 15.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 15.0f); if (SkelAnime_Update(&this->skelAnime)) { EnBigokuta_SetupIdleAboveWater(this); } @@ -253,27 +255,27 @@ void EnBigokuta_SetupIdleAboveWater(EnBigokuta* this) { void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 2.5f); - Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 2.5f); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 0x1000); - if ((this->actor.xzDistToPlayer > 400.0f) || (this->actor.playerHeightRel > 200.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_SINK); + if ((this->picto.actor.xzDistToPlayer > 400.0f) || (this->picto.actor.playerHeightRel > 200.0f)) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_SINK); EnBigokuta_SetupIdle(this); - } else if ((this->actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { + } else if ((this->picto.actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { EnBigokuta_SetupSuckInPlayer(this, play); } } void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { - if (this->actor.cutscene != -1) { + if (this->picto.actor.cutscene != -1) { if (this->subCamId != SUB_CAM_ID_DONE) { EnBigokuta_MoveCamera(this, play); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + } else if (ActorCutscene_GetCanPlayNext(this->picto.actor.cutscene)) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); EnBigokuta_SetupCutsceneCamera(this, play, &mainCam->at, &mainCam->eye); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); } } } @@ -281,19 +283,19 @@ void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->actor.parent = &this->actor; - this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + player->actor.parent = &this->picto.actor; + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); this->timer = 0; Animation_Change(&this->skelAnime, &gBigOctoIdleAnim, 1.0f, 12.0f, 12.0f, ANIMMODE_ONCE, -3.0f); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); - this->playerHoldPos.x = (Math_SinS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.x; - this->playerHoldPos.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->playerHoldPos.z = (Math_CosS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.z; + this->playerHoldPos.x = (Math_SinS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->playerHoldPos.z = (Math_CosS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SLIME_DEAD); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_SLIME_DEAD); this->actionFunc = EnBigokuta_SuckInPlayer; } @@ -302,7 +304,7 @@ void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play) { EnBigokuta_UpdateOrSetupCam(this, play); SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 49.5f, 10.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 49.5f, 10.0f); if (this->timer < 9) { this->timer++; @@ -311,19 +313,19 @@ void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play) { player->unk_AE8 = 0; Math_Vec3f_Copy(&player->actor.world.pos, &this->playerPos); if (Math_Vec3f_StepTo(&player->actor.world.pos, &this->playerHoldPos, sqrtf(this->timer) * 5.0f) < 0.1f) { - s16 rotY = this->actor.shape.rot.y; + s16 rotY = this->picto.actor.shape.rot.y; - if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x800)) { + if (Math_ScaledStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 0x800)) { EnBigokuta_SetupHoldPlayer(this); } - this->playerHoldPos.x = (Math_SinS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.x; - this->playerHoldPos.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->playerHoldPos.z = (Math_CosS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.z; + this->playerHoldPos.x = (Math_SinS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->playerHoldPos.z = (Math_CosS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.z; Math_Vec3f_Copy(&player->actor.world.pos, &this->playerHoldPos); Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); - player->actor.shape.rot.y += BINANG_SUB(this->actor.shape.rot.y, rotY); + player->actor.shape.rot.y += BINANG_SUB(this->picto.actor.shape.rot.y, rotY); } else { Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); player->actor.velocity.y = 0.0f; @@ -345,7 +347,7 @@ void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play) { if (this->timer == 0) { EnBigokuta_ShootPlayer(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_REVERSE); } } else if (this->timer == -24) { EnBigokuta_SetupIdleAboveWater(this); @@ -362,21 +364,21 @@ void EnBigokuta_SetupDeathCutscene(EnBigokuta* this) { void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { Player* player; - this->actor.colorFilterTimer = Animation_GetLastFrame(&gBigOctoDeathAnim); + this->picto.actor.colorFilterTimer = Animation_GetLastFrame(&gBigOctoDeathAnim); if (this->timer != 0) { this->timer--; if (this->timer == 0) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); EnBigokuta_SetupDeathEffects(this); } } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + ActorCutscene_Start(this->cutscene, &this->picto.actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(play, &this->actor, 7); + func_800B724C(play, &this->picto.actor, 7); } else { player = GET_PLAYER(play); player->stateFlags1 |= 0x20; @@ -394,8 +396,8 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { void EnBigokuta_SetupDeathEffects(EnBigokuta* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBigOctoDeathAnim, -5.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_DEAD2); - this->actor.flags &= ~1; + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_DEAD2); + this->picto.actor.flags &= ~1; this->timer = 10; this->actionFunc = EnBigokuta_PlayDeathEffects; } @@ -407,7 +409,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { static Color_RGBA8 D_80AC45B8 = { 150, 150, 150, 0 }; if (SkelAnime_Update(&this->skelAnime)) { - this->actor.world.pos.y -= 0.2f; + this->picto.actor.world.pos.y -= 0.2f; if (this->timer > 0) { this->timer--; @@ -415,44 +417,44 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { if (this->timer == 6) { Vec3f dustPos; - dustPos.x = this->actor.world.pos.x; - dustPos.y = this->actor.world.pos.y + 150.0f; - dustPos.z = this->actor.world.pos.z; + dustPos.x = this->picto.actor.world.pos.x; + dustPos.y = this->picto.actor.world.pos.y + 150.0f; + dustPos.z = this->picto.actor.world.pos.z; func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_80AC45B0, &D_80AC45B4, 1200, 20); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_OCTAROCK_DEAD2); } } else { - this->actor.world.pos.y -= 0.2f; + this->picto.actor.world.pos.y -= 0.2f; - if (Math_StepToF(&this->actor.scale.y, 0.001f, 0.001f)) { + if (Math_StepToF(&this->picto.actor.scale.y, 0.001f, 0.001f)) { s32 i; Vec3f bubbleVel; Vec3f bubblePos; - SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); - bubblePos.y = this->actor.world.pos.y; + SoundSource_PlaySfxAtFixedWorldPos(play, &this->picto.actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); + bubblePos.y = this->picto.actor.world.pos.y; for (i = 0; i < 20; i++) { bubbleVel.x = randPlusMinusPoint5Scaled(10.0f); bubbleVel.y = Rand_ZeroFloat(5.5f) + 5.5f; bubbleVel.z = randPlusMinusPoint5Scaled(10.0f); - bubblePos.x = this->actor.world.pos.x + (2.0f * bubbleVel.x); - bubblePos.z = this->actor.world.pos.z + (2.0f * bubbleVel.z); + bubblePos.x = this->picto.actor.world.pos.x + (2.0f * bubbleVel.x); + bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z); EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0, &D_80AC45B8, Rand_S16Offset(150, 50), 25, 0); } - if (this->actor.params != 0xFF) { - Flags_SetSwitch(play, this->actor.params); + if (this->picto.actor.params != 0xFF) { + Flags_SetSwitch(play, this->picto.actor.params); } ActorCutscene_Stop(this->cutscene); - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(play, &this->actor, 6); + func_800B724C(play, &this->picto.actor, 6); } else { Player* player = GET_PLAYER(play); @@ -461,18 +463,19 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { } if (this->drawDmgEffAlpha > 0.0f) { - this->drawDmgEffAlpha = this->actor.scale.y * 30.30303f; + this->drawDmgEffAlpha = this->picto.actor.scale.y * 30.30303f; } } } else { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 15.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 15.0f); } } s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { - this->actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); + this->picto.actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); - if ((this->actor.child != NULL) && (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < 250.0f)) { + if ((this->picto.actor.child != NULL) && + (Actor_XZDistanceBetweenActors(&this->picto.actor, this->picto.actor.child) < 250.0f)) { return true; } else { return false; @@ -484,7 +487,7 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { ((this->bodyCollider.base.acFlags & AC_HIT) || ((play->sceneNum == SCENE_20SICHITAI || play->sceneNum == SCENE_20SICHITAI2) && EnBigokuta_IsNearSwampBoat(this, play)))) { - Enemy_StartFinishingBlow(play, &this->actor); + Enemy_StartFinishingBlow(play, &this->picto.actor); if (this->bodyCollider.base.acFlags & AC_HIT) { if (this->bodyCollider.info.acHitInfo->toucher.dmgFlags & 0x1000) { // Ice Arrow @@ -503,7 +506,7 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { } this->bodyCollider.base.acFlags &= ~AC_HIT; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); + Actor_SetColorFilter(&this->picto.actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); EnBigokuta_ShootPlayer(this, play); EnBigokuta_SetupDeathCutscene(this); } @@ -514,7 +517,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; if (!EnBigokuta_IsInWater(this, play)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); return; } @@ -526,9 +529,11 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((this->bodyCollider.base.acFlags & AC_ON)) { - this->shellCollider.dim.pos.x = Math_SinS(this->actor.shape.rot.y) * -20.0f + this->actor.world.pos.x; - this->shellCollider.dim.pos.y = this->actor.world.pos.y; - this->shellCollider.dim.pos.z = Math_CosS(this->actor.shape.rot.y) * -20.0f + this->actor.world.pos.z; + this->shellCollider.dim.pos.x = + Math_SinS(this->picto.actor.shape.rot.y) * -20.0f + this->picto.actor.world.pos.x; + this->shellCollider.dim.pos.y = this->picto.actor.world.pos.y; + this->shellCollider.dim.pos.z = + Math_CosS(this->picto.actor.shape.rot.y) * -20.0f + this->picto.actor.world.pos.z; this->bodyCollider.dim.pos.x = this->shellCollider.dim.pos.x; this->bodyCollider.dim.pos.y = this->shellCollider.dim.pos.y; @@ -537,7 +542,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->shellCollider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->shellCollider.base); - Actor_SetFocus(&this->actor, 82.5f); + Actor_SetFocus(&this->picto.actor, 82.5f); } if (this->drawDmgEffAlpha > 0.0f) { @@ -546,7 +551,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.6f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 1.2f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 1.2f, 0.030000001f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + func_800B9010(&this->picto.actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -658,18 +663,18 @@ void EnBigokuta_Draw(Actor* thisx, PlayState* play) { gDPSetEnvColor(&gfx[1], 255, 255, 255, 255); POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnBigokuta_OverrideLimbDraw, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + EnBigokuta_OverrideLimbDraw, EnBigokuta_PostLimbDraw, &this->picto.actor, &gfx[2]); } else { Scene_SetRenderModeXlu(play, 1, 2); gfx = POLY_XLU_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); - gDPSetEnvColor(&gfx[1], 0, 0, 0, (this->actor.scale.y * 7727.273f)); + gDPSetEnvColor(&gfx[1], 0, 0, 0, (this->picto.actor.scale.y * 7727.273f)); POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + NULL, EnBigokuta_PostLimbDraw, &this->picto.actor, &gfx[2]); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index ba59e9a976..fdb9d561db 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -2,16 +2,15 @@ #define Z_EN_BIGOKUTA_H #include "global.h" +#include "z64snap.h" #include "assets/objects/object_bigokuta/object_bigokuta.h" struct EnBigokuta; typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); -typedef void (*EnBigokutaUnkFunc)(PlayState*, struct EnBigokuta*); typedef struct EnBigokuta { - /* 0x000 */ Actor actor; - /* 0x144 */ EnBigokutaUnkFunc unkFunc; // possibly something to do with photographing + /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ EnBigokutaActionFunc actionFunc; /* 0x190 */ u8 drawDmgEffType; diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 36a8b69114..218b41cb6b 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -80,8 +80,9 @@ static AnimationInfoS D_80A5349C[] = { { &object_dnq_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -void func_80A52530(PlayState* play, EnDnq* this) { - func_8013A530(play, &this->actor, 10, &this->actor.focus.pos, &this->actor.world.rot, 120.0f, 480.0f, 0x38E3); +s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_DEKU_KING, &thisx->focus.pos, &thisx->world.rot, 120.0f, + 480.0f, 0x38E3); } s32 func_80A5257C(EnDnq* this, s32 arg1) { @@ -111,7 +112,7 @@ s32 func_80A5257C(EnDnq* this, s32 arg1) { } void func_80A52604(EnDnq* this, PlayState* play) { - Collider_UpdateCylinder(&this->actor, &this->collider); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -120,7 +121,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { if (play->csCtx.state != 0) { if (!(this->unk_37C & 0x20)) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_1; this->unk_1DC = 0xFF; this->unk_37C |= 0x20; } @@ -128,7 +129,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { ret = true; } else { if (this->unk_37C & 0x20) { - this->actor.flags |= ACTOR_FLAG_1; + this->picto.actor.flags |= ACTOR_FLAG_1; this->unk_1DC = 0xFF; this->unk_37C &= ~0x20; SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -196,10 +197,10 @@ s32 func_80A52944(EnDnq* this) { if (this->unk_386 == 0) { func_80A5257C(this, 12); this->unk_38C = 1; - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; this->unk_386 = 1; phi_v1 = this->unk_38C * 0x2000; - this->actor.shape.rot.y += phi_v1; + this->picto.actor.shape.rot.y += phi_v1; } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_386++; if (this->unk_386 >= 6) { @@ -214,8 +215,8 @@ s32 func_80A52944(EnDnq* this) { func_80A5257C(this, 13); this->skelAnime.curFrame = 0.0f; } - this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.shape.rot.y += phi_v1; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; + this->picto.actor.shape.rot.y += phi_v1; } this->unk_38A = 0; @@ -233,7 +234,7 @@ s32 func_80A52A78(EnDnq* this, PlayState* play) { this->unk_388 = play->state.frames % 5; } - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; if (this->unk_38C != 0) { this->unk_38C--; } @@ -256,7 +257,7 @@ s32 func_80A52B68(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 temp = play->msgCtx.currentTextId; - if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->actor)) { + if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->picto.actor)) { switch (temp) { case 0x89B: func_80A5257C(this, 18); @@ -300,9 +301,9 @@ void func_80A52C6C(EnDnq* this, PlayState* play) { Vec3f sp1C; Math_Vec3f_Copy(&sp1C, &player->actor.world.pos); - Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.world.rot.y, &sp34, &sp28); + Lib_Vec3f_TranslateAndRotateY(&this->picto.actor.world.pos, this->picto.actor.world.rot.y, &sp34, &sp28); Math_Vec3f_Copy(&this->unk_370, &sp28); - this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&sp28, &sp1C); + this->picto.actor.xzDistToPlayer = Math_Vec3f_DistXZ(&sp28, &sp1C); } s32* func_80A52CF8(EnDnq* this, PlayState* play) { @@ -320,7 +321,7 @@ s32* func_80A52CF8(EnDnq* this, PlayState* play) { s32 func_80A52D44(EnDnq* this, PlayState* play) { s32 ret = false; - if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { SubS_UpdateFlags(&this->unk_37C, 0, 7); this->unk_380 = func_80A52CF8(this, play); this->actionFunc = func_80A52FB8; @@ -332,7 +333,7 @@ s32 func_80A52D44(EnDnq* this, PlayState* play) { void func_80A52DC8(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + s16 yaw = this->picto.actor.yawTowardsPlayer - this->picto.actor.world.rot.y; if (yaw <= 0x3800) { SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -350,37 +351,37 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { } } - this->unk_394 = this->actor.xzDistToPlayer; + this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); - if (this->actor.xzDistToPlayer < this->unk_390) { + if (this->picto.actor.xzDistToPlayer < this->unk_390) { player->unk_B2B = 0x1A; } - this->actor.xzDistToPlayer = this->unk_394; + this->picto.actor.xzDistToPlayer = this->unk_394; if (gSaveContext.save.weekEventReg[83] & 8) { func_80A52A78(this, play); } else if (this->unk_3A4 == 0) { - Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 3, 0x2AA8); func_80A526F8(this); } else { func_80A52944(this); } } else { - Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 3, 0x2AA8); this->unk_390 = 70.0f; } } void func_80A52FB8(EnDnq* this, PlayState* play) { - s16 sp2E = this->actor.yawTowardsPlayer; + s16 sp2E = this->picto.actor.yawTowardsPlayer; - if (func_8010BF58(&this->actor, play, this->unk_380, NULL, &this->unk_1E0)) { + if (func_8010BF58(&this->picto.actor, play, this->unk_380, NULL, &this->unk_1E0)) { SubS_UpdateFlags(&this->unk_37C, 3, 7); this->unk_386 = 0; this->actionFunc = func_80A52DC8; } else { - Math_ApproachS(&this->actor.shape.rot.y, sp2E, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, sp2E, 3, 0x2AA8); } } @@ -400,7 +401,7 @@ void func_80A53038(EnDnq* this, PlayState* play) { } if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KINGNUTS_DAMAGE); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_KINGNUTS_DAMAGE); } if (((this->unk_398 == 3) || (this->unk_398 == 6)) && @@ -408,21 +409,21 @@ void func_80A53038(EnDnq* this, PlayState* play) { func_80A5257C(this, this->unk_398 + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, temp_v0); } } void EnDnq_Init(Actor* thisx, PlayState* play) { EnDnq* this = THIS; - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 14.0f); + ActorShape_Init(&this->picto.actor.shape, 0.0f, NULL, 14.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_dnq_Skel_00EB48, NULL, this->jointTable, this->morphTable, 33); this->unk_398 = -1; func_80A5257C(this, 0); - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - Actor_SetScale(&this->actor, 0.02f); - this->actor.targetMode = 1; + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->picto.actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + Actor_SetScale(&this->picto.actor, 0.02f); + this->picto.actor.targetMode = 1; this->unk_386 = 0; this->unk_37C = 0; SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -431,7 +432,7 @@ void EnDnq_Init(Actor* thisx, PlayState* play) { } else { this->unk_3A4 = 0; } - this->unk_144 = func_80A52530; + this->picto.validationFunc = EnDnq_ValidatePictograph; this->actionFunc = func_80A52DC8; } @@ -451,13 +452,13 @@ void EnDnq_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80A52B68(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); - this->unk_394 = this->actor.xzDistToPlayer; + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 30.0f, 12.0f, 0.0f, 4); + this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); - func_8013C964(&this->actor, play, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, EXCH_ITEM_NONE, - this->unk_37C & 7); - this->actor.xzDistToPlayer = this->unk_394; - Actor_SetFocus(&this->actor, 46.0f); + func_8013C964(&this->picto.actor, play, this->unk_390, fabsf(this->picto.actor.playerHeightRel) + 1.0f, + EXCH_ITEM_NONE, this->unk_37C & 7); + this->picto.actor.xzDistToPlayer = this->unk_394; + Actor_SetFocus(&this->picto.actor, 46.0f); func_80A52604(this, play); } } @@ -467,5 +468,5 @@ void EnDnq_Draw(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); + NULL, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h index 6c3027c8b9..9e4bbd52ae 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h @@ -2,15 +2,14 @@ #define Z_EN_DNQ_H #include "global.h" +#include "z64snap.h" struct EnDnq; typedef void (*EnDnqActionFunc)(struct EnDnq*, PlayState*); -typedef void (*EnDnqFunc)(PlayState*, struct EnDnq*); typedef struct EnDnq { - /* 0x000 */ Actor actor; - /* 0x144 */ EnDnqFunc unk_144; + /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ EnDnqActionFunc actionFunc; /* 0x190 */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index ae4903c022..a222a1905e 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -15,7 +15,6 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play); void EnGe1_Update(Actor* thisx, PlayState* play); void EnGe1_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit En_Ge1_InitVars = { ACTOR_EN_GE1, ACTORCAT_NPC, @@ -28,45 +27,432 @@ const ActorInit En_Ge1_InitVars = { (ActorFunc)EnGe1_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809464D0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_ENEMY, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x01000202, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_ENEMY, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x01000202, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 20, 40, 0, { 0, 0, 0 } }, }; -#endif +//! State flags -extern ColliderCylinderInit D_809464D0; +//! Disable normal movement to let pathing function control it completely. +#define GERUDO_WHITE_STATE_DISABLE_MOVEMENT (1 << 3) -extern UNK_TYPE D_06002B98; +typedef enum { + /* 0 */ GERUDO_WHITE_HAIR_BOB, + /* 1 */ GERUDO_WHITE_HAIR_STRAIGHT, + /* 2 */ GERUDO_WHITE_HAIR_SPIKEY +} GerudoWhiteHairstyle; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Init.s") +typedef enum { + /* -1 */ GERUDO_WHITE_ANIM_NONE = -1, + /* 0 */ GERUDO_WHITE_ANIM_ARMS_FOLDED, + /* 1 */ GERUDO_WHITE_ANIM_UNFOLDING_ARMS, // Unused + /* 2 */ GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, + /* 3 */ GERUDO_WHITE_ANIM_STIFFENING, + /* 4 */ GERUDO_WHITE_ANIM_STIFF_SHIVERING, + /* 5 */ GERUDO_WHITE_ANIM_TRUDGING_OFF, + /* 6 */ GERUDO_WHITE_ANIM_EXCITED_CLAPPING, + /* 7 */ GERUDO_WHITE_ANIM_SALUTE, + /* 8 */ GERUDO_WHITE_ANIM_LEADING_BOAT, + /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY, +} GerudoWhiteAnimations; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Destroy.s") +void EnGe1_SetAnimation(EnGe1* this, s16 index, u8 mode, f32 morphFrames); +void EnGe1_ShadowDraw(Actor* actor, Lights* lights, PlayState* play); +void EnGe1_Wait(EnGe1* this, PlayState* play); +void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play); +s32 EnGe1_ValidatePictograph(PlayState* play, Actor* this); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_809457EC.s") +void EnGe1_Init(Actor* thisx, PlayState* play) { + EnGe1* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945924.s") + ActorShape_Init(&this->picto.actor.shape, 0.0f, EnGe1_ShadowDraw, 30.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteArmsFoldedAnim, this->jointTable, + this->morphTable, GERUDO_WHITE_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + this->picto.actor.targetMode = 6; + Actor_SetScale(&this->picto.actor, 0.01f); + this->curAnim = this->csAction = -1; // GERUDO_WHITE_ANIM_NONE + this->stateFlags = 0; + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); + this->actionFunc = EnGe1_Wait; + this->picto.validationFunc = EnGe1_ValidatePictograph; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945A00.s") + switch (GERUDO_WHITE_GET_TYPE(&this->picto.actor)) { + default: + this->hairstyle = GERUDO_WHITE_HAIR_BOB; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945A9C.s") + case GERUDO_WHITE_TYPE_HAIR_STRAIGHT: + this->hairstyle = GERUDO_WHITE_HAIR_STRAIGHT; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945B60.s") + case GERUDO_WHITE_TYPE_HAIR_SPIKEY: + this->hairstyle = GERUDO_WHITE_HAIR_SPIKEY; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945C50.s") + case GERUDO_WHITE_TYPE_CUTSCENE: // Only type used in-game + this->hairstyle = GERUDO_WHITE_HAIR_BOB; + this->actionFunc = EnGe1_PerformCutsceneActions; + this->picto.actor.draw = NULL; + this->picto.actor.flags |= ACTOR_FLAG_20 | ACTOR_FLAG_10; + this->picto.actor.flags &= ~ACTOR_FLAG_1; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945CAC.s") + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.velocity.y = -9.0f; + this->picto.actor.gravity = -1.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945CE4.s") +void EnGe1_Destroy(Actor* thisx, PlayState* play) { + EnGe1* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Update.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946190.s") +void EnGe1_SetAnimation(EnGe1* this, s16 index, u8 mode, f32 morphFrames) { + static AnimationHeader* sAnimations[] = { + &gGerudoWhiteArmsFoldedAnim, // GERUDO_WHITE_ANIM_ARMS_FOLDED, + &gGerudoWhiteUnfoldingArmsAnim, // GERUDO_WHITE_ANIM_UNFOLDING_ARMS + &gGerudoWhiteStandingHeadBowedAnim, // GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, + &gGerudoWhiteStiffeningAnim, // GERUDO_WHITE_ANIM_STIFFENING, + &gGerudoWhiteStiffShiveringAnim, // GERUDO_WHITE_ANIM_STIFF_SHIVERING, + &gGerudoWhiteTrudgingOffAnim, // GERUDO_WHITE_ANIM_TRUDGING_OFF, + &gGerudoWhiteExcitedClappingAnim, // GERUDO_WHITE_ANIM_EXCITED_CLAPPING, + &gGerudoWhiteSaluteAnim, // GERUDO_WHITE_ANIM_SALUTE, + &gGerudoWhiteGreatBayCutsceneAnim, // GERUDO_WHITE_ANIM_LEADING_BOAT, + &gGerudoWhiteGreatBayCutsceneAnim, // GERUDO_WHITE_ANIM_BLOWN_AWAY, + }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946238.s") + // The GERUDO_WHITE_ANIM_LEADING_BOAT / GERUDO_WHITE_ANIM_BLOWN_AWAY cases are single frames of an "animation" used + // as static poses. + switch (index) { + case GERUDO_WHITE_ANIM_LEADING_BOAT: + Animation_Change(&this->skelAnime, sAnimations[index], 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946368.s") + case GERUDO_WHITE_ANIM_BLOWN_AWAY: + Animation_Change(&this->skelAnime, sAnimations[index], 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Draw.s") + default: + Animation_Change(&this->skelAnime, sAnimations[index], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[index]), mode, morphFrames); + break; + } + + this->curAnim = index; +} + +void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) { + s16 yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + + if ((ABS_ALT(yawDiff) <= 0x4300) && (this->picto.actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->picto.actor, &this->headRot, &this->torsoRot, this->picto.actor.focus.pos); + } else { + Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); + } +} + +void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play) { + Vec3f pos; + EnGe1* this = THIS; + + Math_Vec3f_Copy(&pos, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->picto.actor.world.pos, &this->waistPos); + func_800B4AEC(play, &this->picto.actor, 50.0f); + this->picto.actor.world.pos.y = MAX(this->picto.actor.floorHeight, pos.y); + ActorShadow_DrawCircle(&this->picto.actor, lights, play); + Math_Vec3f_Copy(&this->picto.actor.world.pos, &pos); +} + +void EnGe1_SetupPath(EnGe1* this, PlayState* play) { + s32 pad; + Vec3s* point; + Vec3f nextPoint; + + this->curPoint = 0; + if (GERUDO_WHITE_GET_PATH(&this->picto.actor) != 0x3F) { + this->path = &play->setupPathList[GERUDO_WHITE_GET_PATH(&this->picto.actor)]; + if (this->path != NULL) { + point = Lib_SegmentedToVirtual(this->path->points); + Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, point); + this->curPoint++; + point++; + Math_Vec3s_ToVec3f(&nextPoint, point); + + this->picto.actor.world.rot.y = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.world.rot.x = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.speedXZ = 15.0f; + } + } else { + this->path = NULL; + } +} + +/** + * @return s32 true if close to next point or no path set. + */ +s32 EnGe1_FollowPath(EnGe1* this) { + s32 pad; + Path* path = this->path; + Vec3s* points; + Vec3f point; + s16 yawTarget; + s16 pitchTarget; + + if (path == NULL) { + return true; + } + + points = Lib_SegmentedToVirtual(this->path->points); + points += this->curPoint; + + Math_Vec3s_ToVec3f(&point, points); + yawTarget = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &point); + pitchTarget = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &point); + Math_SmoothStepToS(&this->picto.actor.world.rot.y, yawTarget, 0xA, 0x3E8, 0x64); + Math_SmoothStepToS(&this->picto.actor.world.rot.x, pitchTarget, 6, 0x7D0, 0xC8); + Actor_MoveWithoutGravityReverse(&this->picto.actor); + + if (Math_Vec3f_DistXYZ(&this->picto.actor.world.pos, &point) < 40.0f) { + return true; + } else { + return false; + } +} + +void EnGe1_Scream(EnGe1* this) { + if ((s32)Rand_ZeroFloat(2.0f) == 0) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO00); + } else { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO01); + } +} + +void EnGe1_Wait(EnGe1* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnGe1_LookAtPlayer(this, play); +} + +void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { + s16 csAction; + + if (SkelAnime_Update(&this->skelAnime) && (this->csAction == 3)) { + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_STIFF_SHIVERING, ANIMMODE_LOOP, 0.0f); + } + + if (Cutscene_CheckActorAction(play, 0x79)) { + this->picto.actor.draw = EnGe1_Draw; + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x79)]->action; + switch (csAction) { + case 8: + this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + break; + + case 9: + this->stateFlags |= GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + break; + + default: + this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 0x79)); + break; + } + + if (this->csAction != csAction) { + this->csAction = csAction; + + switch (this->csAction) { + // Aveil cutscene + case 1: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); + break; + + case 2: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, ANIMMODE_LOOP, 0.0f); + break; + + case 3: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_STIFFENING, ANIMMODE_ONCE, 0.0f); + break; + + case 4: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_TRUDGING_OFF, ANIMMODE_ONCE, 0.0f); + break; + + case 5: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_EXCITED_CLAPPING, ANIMMODE_LOOP, 0.0f); + break; + + case 6: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_SALUTE, ANIMMODE_ONCE, 0.0f); + break; + + case 7: + Actor_MarkForDeath(&this->picto.actor); + break; + + // Twister cutscene + case 8: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_LEADING_BOAT, ANIMMODE_ONCE, 0.0f); + break; + + case 9: + EnGe1_SetAnimation(this, GERUDO_WHITE_ANIM_BLOWN_AWAY, ANIMMODE_ONCE, 0.0f); + EnGe1_SetupPath(this, play); + this->stateFlags |= GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + break; + } + + SkelAnime_Update(&this->skelAnime); + } + + if ((this->curAnim == GERUDO_WHITE_ANIM_TRUDGING_OFF) && + (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 25.0f))) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + + if ((this->curAnim == GERUDO_WHITE_ANIM_SALUTE) && Animation_OnFrame(&this->skelAnime, 14.0f)) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + } else { + this->picto.actor.draw = NULL; + } + + if (this->csAction == 9) { + if ((this->curPoint < this->path->count) && EnGe1_FollowPath(this)) { + this->curPoint++; + } + + // Tumble in the air + this->picto.actor.shape.rot.x += 0x3E8; + this->picto.actor.shape.rot.y += 0x7D0; + this->picto.actor.shape.rot.z += 0x1F4; + + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe1_Scream(this); + } + } +} + +void EnGe1_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnGe1* this = THIS; + + if (this->picto.actor.draw != NULL) { + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + if (!(this->stateFlags & GERUDO_WHITE_STATE_DISABLE_MOVEMENT)) { + Actor_MoveWithGravity(&this->picto.actor); + } + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, 5); + this->actionFunc(this, play); + this->torsoRot.x = this->torsoRot.y = this->torsoRot.z = 0; + + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); + } + + this->eyeIndex = this->blinkTimer; + if (this->eyeIndex >= 3) { + this->eyeIndex = 0; + } +} + +s32 EnGe1_ValidatePictograph(PlayState* play, Actor* thisx) { + s32 ret = Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 400.0f, -1); + + ret |= Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 1200.0f, -1); + + return ret; +} + +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + s32 pad; + EnGe1* this = THIS; + + if (limbIndex == GERUDO_WHITE_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; + } + if (this->curAnim == GERUDO_WHITE_ANIM_ARMS_FOLDED) { + // Make small fidgeting movements if in standing animation. + if ((limbIndex == GERUDO_WHITE_LIMB_TORSO) || (limbIndex == GERUDO_WHITE_LIMB_LEFT_FOREARM) || + (limbIndex == GERUDO_WHITE_LIMB_RIGHT_FOREARM)) { + rot->y += (s16)(Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f); + rot->z += (s16)(Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f); + } + } + return false; +} + +void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Gfx* sHairstyleDLs[] = { + gGerudoWhiteHairstyleBobDL, + gGerudoWhiteHairstyleStraightFringeDL, + gGerudoWhiteHairstyleSpikyDL, + }; + static Vec3f sInitialFocusPos = { 600.0f, 700.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + EnGe1* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + switch (limbIndex) { + case GERUDO_WHITE_LIMB_WAIST: + Matrix_MultVec3f(&sZeroVec, &this->waistPos); + break; + + case GERUDO_WHITE_LIMB_HEAD: + gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLs[this->hairstyle]); + Matrix_MultVec3f(&sInitialFocusPos, &this->picto.actor.focus.pos); + break; + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnGe1_Draw(Actor* thisx, PlayState* play) { + static TexturePtr sEyeTextures[] = { + gGerudoWhiteEyeOpenTex, + gGerudoWhiteEyeHalfTex, + gGerudoWhiteEyeClosedTex, + }; + s32 pad; + EnGe1* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C5B0(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, &this->picto.actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index a3c04a93a9..b27a3c3de5 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -2,14 +2,41 @@ #define Z_EN_GE1_H #include "global.h" +#include "z64snap.h" +#include "objects/object_ge1/object_ge1.h" + +#define GERUDO_WHITE_GET_TYPE(thisx) (((thisx)->params) & 0xF) +#define GERUDO_WHITE_GET_PATH(thisx) ((((thisx)->params) & 0xFC00) >> 10) + +//! Only the first type is used +typedef enum { + /* 0 */ GERUDO_WHITE_TYPE_CUTSCENE, + /* 1 */ GERUDO_WHITE_TYPE_HAIR_STRAIGHT, + /* 2 */ GERUDO_WHITE_TYPE_HAIR_SPIKEY +} GerudoWhiteType; struct EnGe1; typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); typedef struct EnGe1 { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x184]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ ColliderCylinder collider; + /* 0x194 */ SkelAnime skelAnime; + /* 0x1D8 */ Vec3f waistPos; + /* 0x1E4 */ Vec3s jointTable[GERUDO_WHITE_LIMB_MAX]; + /* 0x244 */ Vec3s morphTable[GERUDO_WHITE_LIMB_MAX]; + /* 0x2A4 */ Vec3s headRot; + /* 0x2AA */ Vec3s torsoRot; + /* 0x2B0 */ Path* path; + /* 0x2B4 */ s32 curPoint; + /* 0x2B8 */ s16 eyeIndex; + /* 0x2BA */ s16 blinkTimer; + /* 0x2BC */ u16 stateFlags; + /* 0x2BE */ s16 curAnim; // Index + /* 0x2C0 */ s16 csAction; + /* 0x2C2 */ s16 screamTimer; + /* 0x2C4 */ u8 hairstyle; /* 0x2C8 */ EnGe1ActionFunc actionFunc; } EnGe1; // size = 0x2CC diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 0ea6d71dda..556fea9ec5 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1364,15 +1364,15 @@ void func_80B45648(EnInvadepoh* this) { } } -s32 func_80B456A8(PlayState* play, Vec3f* vec) { - Vec3f multDest; - f32 wDest; +s32 func_80B456A8(PlayState* play, Vec3f* worldPos) { + Vec3f projectedPos; + f32 invW; - Actor_GetProjectedPos(play, vec, &multDest, &wDest); - if (((multDest.z > 1.0f) && (fabsf(multDest.x * wDest) < 1.0f)) && (fabsf(multDest.y * wDest) < 1.0f)) { - s32 wX = (multDest.x * wDest * 160.0f) + 160.0f; - s32 wY = (multDest.y * wDest * -120.0f) + 120.0f; - s32 wZ = (s32)(multDest.z * wDest * 16352.0f) + 0x3FE0; + Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); + if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { + s32 wX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 wY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 0x3FE0; s32 zBuf = func_80178A94(wX, wY); if (wZ < zBuf) { return true; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 9125b48f18..bc48b6ee03 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -21,7 +21,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play); void EnKakasi_InitTimeSkipDialogue(EnKakasi* this); void EnKakasi_SetupIdleStanding(EnKakasi* this); -void EnKakasi_8096F88C(PlayState* play, EnKakasi* this); +s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx); void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play); void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play); @@ -146,44 +146,44 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { s32 tempCutscene; s32 i; - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &D_80971D80); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80); SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); - this->songSummonDist = GET_KAKASI_SUMMON_DISTANCE(&this->actor) * 20.0f; + this->songSummonDist = GET_KAKASI_SUMMON_DISTANCE(&this->picto.actor) * 20.0f; if (this->songSummonDist < 40.0f) { this->songSummonDist = 40.0f; } - this->unkHeight = (this->actor.world.rot.z * 20.0f) + 60.0f; - this->actor.world.rot.z = 0; - this->actor.targetMode = 0; - if (this->actor.world.rot.x > 0 && this->actor.world.rot.x < 8) { - this->actor.targetMode = GET_KAKASI_TARGETMODE(thisx); + this->unkHeight = (this->picto.actor.world.rot.z * 20.0f) + 60.0f; + this->picto.actor.world.rot.z = 0; + this->picto.actor.targetMode = 0; + if (this->picto.actor.world.rot.x > 0 && this->picto.actor.world.rot.x < 8) { + this->picto.actor.targetMode = GET_KAKASI_TARGETMODE(thisx); } - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; - this->aboveGroundStatus = GET_KAKASI_ABOVE_GROUND(&this->actor); - this->actor.world.rot.x = 0; - this->actor.flags |= ACTOR_FLAG_400; - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Actor_SetScale(&this->actor, 0.01f); + this->aboveGroundStatus = GET_KAKASI_ABOVE_GROUND(&this->picto.actor); + this->picto.actor.world.rot.x = 0; + this->picto.actor.flags |= ACTOR_FLAG_400; + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); i = 0; - tempCutscene = this->actor.cutscene; + tempCutscene = this->picto.actor.cutscene; while (tempCutscene != -1) { //! FAKE: tempCutscene = ActorCutscene_GetAdditionalCutscene(this->actorCutscenes[i] = tempCutscene); i++; } - if (this->aboveGroundStatus) { + if (this->aboveGroundStatus != 0) { if (gSaveContext.save.weekEventReg[79] & 8) { this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; EnKakasi_SetupIdleUnderground(this); } else { - Actor_SetFocus(&this->actor, 60.0f); - this->unkFunc = EnKakasi_8096F88C; + Actor_SetFocus(&this->picto.actor, 60.0f); + this->picto.validationFunc = EnKakasi_ValidatePictograph; if (gSaveContext.save.weekEventReg[83] & 1) { EnKakasi_InitTimeSkipDialogue(this); } else { @@ -203,34 +203,31 @@ void EnKakasi_SetAnimation(EnKakasi* this, s32 index) { sAnimModes[this->animIndex], -4.0f); } -/* - * set by init, called... nowhere? left over from OOT? - */ -void EnKakasi_8096F88C(PlayState* play, EnKakasi* this) { - func_8013A530(play, &this->actor, 0x7, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, 0x7, &thisx->focus.pos, &thisx->shape.rot, 280.0f, 1800.0f, -1); } void EnKakasi_CheckAnimationSfx(EnKakasi* this) { if (this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING || this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL) { if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } if (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR || this->animIndex == ENKAKASI_ANIM_SLOWROLL) { if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 9.0f) || Animation_OnFrame(&this->skelanime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_KAKASHI_JUMP); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); } if (Animation_OnFrame(&this->skelanime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_ROLL); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } if (this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER || this->animIndex == ENKAKASI_ANIM_TWIRL) { if (Animation_OnFrame(&this->skelanime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASH_LONGI_ROLL); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } } } @@ -249,7 +246,7 @@ void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { player->actor.world.pos.z = -190.0f; } - Math_SmoothStepToS(&player->actor.shape.rot.y, (this->actor.yawTowardsPlayer + 0x8000), 5, 1000, 0); + Math_SmoothStepToS(&player->actor.shape.rot.y, (this->picto.actor.yawTowardsPlayer + 0x8000), 5, 1000, 0); } /* @@ -290,7 +287,7 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) { } if (this->unk190 != 0) { Math_ApproachF(&this->skelanime.playSpeed, 1.0f, 0.1f, 0.2f); - this->actor.shape.rot.y += 0x800; + this->picto.actor.shape.rot.y += 0x800; } } @@ -306,22 +303,22 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && !(gSaveContext.eventInf[1] & 0x80)) { - if (this->actor.textId == 0) { + if (this->picto.actor.textId == 0) { // dialogue after skipped time 'did you feel that? went by in an instant' - this->actor.textId = 0x1653; + this->picto.actor.textId = 0x1653; gSaveContext.save.weekEventReg[83] &= (u8)~1; this->talkState = TEXT_STATE_5; player->stateFlags1 |= 0x20; - this->actor.flags |= ACTOR_FLAG_10000; + this->picto.actor.flags |= ACTOR_FLAG_10000; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { player->stateFlags1 &= ~0x20; this->unkState196 = 2; - this->actor.flags &= ~ACTOR_FLAG_10000; + this->picto.actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnKakasi_RegularDialogue; } else { - func_800B8500(&this->actor, play, 9999.9f, 9999.9f, -1); + func_800B8500(&this->picto.actor, play, 9999.9f, 9999.9f, -1); } } } @@ -338,20 +335,20 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { s16 y; // first talk to scarecrow dialogue - this->actor.textId = 0x1644; - if (func_800B8718(&this->actor, &play->state)) { + this->picto.actor.textId = 0x1644; + if (func_800B8718(&this->picto.actor, &play->state)) { this->skelanime.playSpeed = 1.0f; EnKakasi_SetupSongTeach(this, play); return; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->skelanime.playSpeed = 1.0f; EnKakasi_SetupDialogue(this); return; } if (play->actorCtx.unk5 & 0x4) { - Actor_GetScreenPos(play, &this->actor, &x, &y); - if (this->actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && + Actor_GetScreenPos(play, &this->picto.actor, &x, &y); + if (this->picto.actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { // faster shaking EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); @@ -370,9 +367,9 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { } else if (this->animIndex != ENKAKASI_ANIM_IDLE) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_IDLE); } - if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->actor, play, 100.0f); - func_800B874C(&this->actor, play, 100.0f, 80.0f); + if (this->picto.actor.xzDistToPlayer < 120.0f) { + func_800B8614(&this->picto.actor, play, 100.0f); + func_800B874C(&this->picto.actor, play, 100.0f, 80.0f); } } @@ -392,9 +389,9 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { u32 saveContextDay = gSaveContext.save.day; f32 currentAnimeFrame = this->skelanime.curFrame; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 2000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 2000, 0); // if first dialogue - if (this->actor.textId != 0x1644 && this->animeFrameCount <= currentAnimeFrame && + if (this->picto.actor.textId != 0x1644 && this->animeFrameCount <= currentAnimeFrame && this->animIndex == ENKAKASI_ANIM_SLOWROLL) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -402,7 +399,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } // if dialogue: oh sorry come back again - if (this->actor.textId == 0x1651 || this->actor.textId == 0x1659) { + if (this->picto.actor.textId == 0x1651 || this->picto.actor.textId == 0x1659) { if (this->animeFrameCount <= currentAnimeFrame && this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER) { if (++this->unkCounter1A4 >= 2) { this->unkCounter1A4 = 0; @@ -412,7 +409,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } if (this->unkState1A8 == 2 && this->unkState196 == 2) { - func_800B7298(play, &this->actor, 0x49); + func_800B7298(play, &this->picto.actor, 0x49); this->unkState1A8 = 0; } @@ -420,12 +417,12 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { func_801477B4(play); if (this->talkState == TEXT_STATE_5) { // bad song input - if (this->unkState196 == 2 && this->actor.textId == 0x1647) { - func_800B7298(play, &this->actor, 6); + if (this->unkState196 == 2 && this->picto.actor.textId == 0x1647) { + func_800B7298(play, &this->picto.actor, 6); } // after timeskip - if (this->actor.textId == 0x1653) { + if (this->picto.actor.textId == 0x1653) { u32 saveContextDay2 = gSaveContext.save.day; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { @@ -434,21 +431,21 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (saveContextDay2 == 3 && gSaveContext.save.isNight) { // text: dangerous outside - this->actor.textId = 0x164F; + this->picto.actor.textId = 0x164F; } else if (gSaveContext.save.isNight) { // text: would you like to skip time? - this->actor.textId = 0x164E; + this->picto.actor.textId = 0x164E; } else { // text: would you like to skip time? 2 - this->actor.textId = 0x1645; + this->picto.actor.textId = 0x1645; } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); return; - } else if (this->actor.textId == 0x165D || this->actor.textId == 0x165F || this->actor.textId == 0x1660 || - this->actor.textId == 0x1652) { - func_800B7298(play, &this->actor, 4); + } else if (this->picto.actor.textId == 0x165D || this->picto.actor.textId == 0x165F || + this->picto.actor.textId == 0x1660 || this->picto.actor.textId == 0x1652) { + func_800B7298(play, &this->picto.actor, 4); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); @@ -458,55 +455,55 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); this->actionFunc = EnKakasi_DancingRemark; } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); this->actionFunc = EnKakasi_DancingRemark; } } return; - } else if (this->actor.textId == 0x1645 || this->actor.textId == 0x164E) { - this->actor.textId = 0x1650; // "Shall we dance? No Yes" + } else if (this->picto.actor.textId == 0x1645 || this->picto.actor.textId == 0x164E) { + this->picto.actor.textId = 0x1650; // "Shall we dance? No Yes" if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x1644) { + } else if (this->picto.actor.textId == 0x1644) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (gSaveContext.save.isNight) { - this->actor.textId = 0x164E; + this->picto.actor.textId = 0x164E; } else { - this->actor.textId = 0x1645; + this->picto.actor.textId = 0x1645; } - } else if (this->actor.textId == 0x164F) { + } else if (this->picto.actor.textId == 0x164F) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->actor.textId = 0x165A; - } else if (this->actor.textId == 0x1651) { + this->picto.actor.textId = 0x165A; + } else if (this->picto.actor.textId == 0x1651) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->actor.textId = 0x1654; - } else if (this->actor.textId == 0x1654) { - this->actor.textId = 0x1655; - } else if (this->actor.textId == 0x1655) { - this->actor.textId = 0x1656; + this->picto.actor.textId = 0x1654; + } else if (this->picto.actor.textId == 0x1654) { + this->picto.actor.textId = 0x1655; + } else if (this->picto.actor.textId == 0x1655) { + this->picto.actor.textId = 0x1656; this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x1658) { - this->actor.textId = 0x1659; - } else if (this->actor.textId == 0x165A) { - this->actor.textId = 0x165B; - } else if (this->actor.textId == 0x165B) { - this->actor.textId = 0x165C; + } else if (this->picto.actor.textId == 0x1658) { + this->picto.actor.textId = 0x1659; + } else if (this->picto.actor.textId == 0x165A) { + this->picto.actor.textId = 0x165B; + } else if (this->picto.actor.textId == 0x165B) { + this->picto.actor.textId = 0x165C; this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x165E) { - this->actor.textId = 0x165F; + } else if (this->picto.actor.textId == 0x165E) { + this->picto.actor.textId = 0x165F; } else { EnKakasi_SetupIdleStanding(this); return; @@ -516,24 +513,24 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (play->msgCtx.choiceIndex == 1) { func_8019F208(); - if (this->actor.textId == 0x1656) { - this->actor.textId = 0x1658; - } else if (this->actor.textId == 0x165C) { - this->actor.textId = 0x165E; + if (this->picto.actor.textId == 0x1656) { + this->picto.actor.textId = 0x1658; + } else if (this->picto.actor.textId == 0x165C) { + this->picto.actor.textId = 0x165E; } else if (saveContextDay == 3 && gSaveContext.save.isNight) { - this->actor.textId = 0x164F; + this->picto.actor.textId = 0x164F; } else { - this->actor.textId = 0x1652; + this->picto.actor.textId = 0x1652; } EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); } else { func_8019F230(); - if (this->actor.textId == 0x1656) { // would you like to learn a song? yes/no - this->actor.textId = 0x1657; - } else if (this->actor.textId == 0x165C) { // would you like to learn a song? yes/no - this->actor.textId = 0x165D; + if (this->picto.actor.textId == 0x1656) { // would you like to learn a song? yes/no + this->picto.actor.textId = 0x1657; + } else if (this->picto.actor.textId == 0x165C) { // would you like to learn a song? yes/no + this->picto.actor.textId = 0x165D; } else { - this->actor.textId = 0x1651; + this->picto.actor.textId = 0x1651; } this->unkCounter1A4 = 0; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { @@ -541,13 +538,13 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } } } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); } } void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { - this->actor.textId = 0x1646; - Message_StartTextbox(play, this->actor.textId, &this->actor); + this->picto.actor.textId = 0x1646; + Message_StartTextbox(play, this->picto.actor.textId, &this->picto.actor); this->subCamId = SUB_CAM_ID_DONE; this->subCamFov = 0.0f; this->subCamFovNext = 60.0f; @@ -575,9 +572,9 @@ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { } else { this->unkState1A8 = 1; - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->actionFunc = EnKakasi_TeachingSong; } } @@ -587,7 +584,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { Vec3f tempVec; EnKakasi_CheckPlayerPosition(this, play); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); if (this->unkState1A8 == 0) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -598,21 +595,21 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->unkState1A8 = 1; this->unkState1A8 = 1; } if (this->unkState1A8 == 1) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; this->subCamEyeNext.x = D_80971DCC[this->unk190].x; this->subCamEyeNext.y = D_80971DCC[this->unk190].y; this->subCamEyeNext.z = D_80971DCC[this->unk190].z; Math_Vec3f_Copy(&tempVec, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &tempVec, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.actor.home, &tempVec, &this->subCamEyeNext, 1); Math_Vec3f_Copy(&this->subCamAtNext, &this->unk22C); Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); @@ -623,11 +620,11 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { this->unk190 = 0; this->unkCounter1A4 = 0; ActorCutscene_Stop(this->actorCutscenes[0]); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YASE_DEAD); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; this->subCamId = SUB_CAM_ID_DONE; - this->actor.textId = 0x1647; + this->picto.actor.textId = 0x1647; this->unkState1A8 = 2; this->talkState = TEXT_STATE_5; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -673,19 +670,19 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { f32 tempAnimFrame = this->skelanime.curFrame; Vec3f vec3fCopy; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); - Math_SmoothStepToS(&player->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); + Math_SmoothStepToS(&player->actor.shape.rot.y, this->picto.actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); if (this->unk190 == 0) { func_801477B4(play); - func_800B7298(play, &this->actor, 0x56); - this->actor.textId = 0x1648; - Message_StartTextbox(play, (this->actor.textId), &this->actor); + func_800B7298(play, &this->picto.actor, 0x56); + this->picto.actor.textId = 0x1648; + Message_StartTextbox(play, (this->picto.actor.textId), &this->picto.actor); this->unkState1A8 = 0; this->unk190 = 1; } - if (this->actor.textId == 0x1648 && this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR && + if (this->picto.actor.textId == 0x1648 && this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR && this->animeFrameCount <= tempAnimFrame) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { @@ -693,7 +690,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } } - if (this->actor.textId == 0x164B && this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING && + if (this->picto.actor.textId == 0x164B && this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING && this->animeFrameCount <= tempAnimFrame) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { @@ -711,21 +708,21 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); return; } - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - func_800B7298(play, &this->actor, 0x56); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + func_800B7298(play, &this->picto.actor, 0x56); this->unkState1A8 = 1; } if (this->subCamId != SUB_CAM_ID_DONE) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; EnKakasi_CheckPlayerPosition(this, play); this->subCamEyeNext.x = D_80971FA0[this->unk190].x; this->subCamEyeNext.y = D_80971FA0[this->unk190].y; this->subCamEyeNext.z = D_80971FA0[this->unk190].z; Math_Vec3f_Copy(&vec3fCopy, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &vec3fCopy, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.actor.home, &vec3fCopy, &this->subCamEyeNext, 1); this->subCamAtNext.x = D_80971FE8[this->unk190].x + this->unk22C.x; this->subCamAtNext.y = D_80971FE8[this->unk190].y + this->unk22C.y; this->subCamAtNext.z = D_80971FE8[this->unk190].z + this->unk22C.z; @@ -746,26 +743,26 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->unk190 = 5; } - if (this->actor.textId == 0x1648) { - func_800B7298(play, &this->actor, 7); - this->actor.textId = 0x1649; + if (this->picto.actor.textId == 0x1648) { + func_800B7298(play, &this->picto.actor, 7); + this->picto.actor.textId = 0x1649; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); } - } else if (this->actor.textId == 0x1649) { - this->actor.textId = 0x1660; + } else if (this->picto.actor.textId == 0x1649) { + this->picto.actor.textId = 0x1660; this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x164A) { - this->actor.textId = 0x164B; + } else if (this->picto.actor.textId == 0x164A) { + this->picto.actor.textId = 0x164B; - } else if (this->actor.textId == 0x164B) { - this->actor.textId = 0x164C; + } else if (this->picto.actor.textId == 0x164B) { + this->picto.actor.textId = 0x164C; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); } else { - if (this->actor.textId == 0x164C || this->actor.textId == 0x1661) { + if (this->picto.actor.textId == 0x164C || this->picto.actor.textId == 0x1661) { EnKakasi_SetupDigAway(this); return; } @@ -775,13 +772,13 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->talkState = TEXT_STATE_5; if (play->msgCtx.choiceIndex == 1) { func_8019F208(); // play 0x4808 sfx (decide) and calls Audio_StopSfxById - this->actor.textId = 0x164A; + this->picto.actor.textId = 0x164A; } else { func_8019F230(); // play 0x480A sfx (cancel) and calls Audio_StopSfxById - this->actor.textId = 0x1661; + this->picto.actor.textId = 0x1661; } } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); } } @@ -798,8 +795,8 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { } else if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { @@ -815,7 +812,7 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) { this->subCamFov = 0.0f; this->subCamFovNext = 60.0f; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); func_8016566C(0xB4); this->actionFunc = EnKakasi_DancingNightAway; } @@ -827,14 +824,14 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { currentFrame = this->skelanime.curFrame; EnKakasi_CheckPlayerPosition(this, play); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); - this->unk22C.y = this->actor.home.pos.y + 50.0f; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; this->subCamEyeNext.x = D_80971E38[this->unk190].x; this->subCamEyeNext.y = D_80971E38[this->unk190].y; this->subCamEyeNext.z = D_80971E38[this->unk190].z; Math_Vec3f_Copy(&localVec3f, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &localVec3f, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.actor.home, &localVec3f, &this->subCamEyeNext, 1); if (1) {} this->subCamAtNext.x = D_80971EEC[this->unk190].x + this->unk22C.x; @@ -845,7 +842,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); } if (this->unk190 >= 7 && this->unk190 != 0xE) { - this->actor.shape.rot.y += 0x800; + this->picto.actor.shape.rot.y += 0x800; } func_8096FAAC(this, play); @@ -919,7 +916,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->unk190++; this->unk204 = 0xA; if (this->unk190 == 0xE) { - func_800B7298(play, &this->actor, 0x49); + func_800B7298(play, &this->picto.actor, 0x49); func_80165690(); this->unk204 = 0x14; } @@ -927,8 +924,8 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { return; case 14: // goes off once for some camera changes, - // otherwise its the end when camera is back to normal and link is confused - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); + // otherwise it's the end when camera is back to normal and Player is confused + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); if (this->unk204 == 0) { player = GET_PLAYER(play); @@ -963,7 +960,7 @@ void EnKakasi_SetupDigAway(EnKakasi* this) { this->unkCounter1A4 = 0; this->subCamFovNext = 60.0f; this->subCamFov = 60.0f; - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->unkState196 = 4; this->actionFunc = EnKakasi_DiggingAway; } @@ -973,13 +970,13 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Vec3f tempWorldPos; if (this->subCamId != SUB_CAM_ID_DONE) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; this->subCamEyeNext.x = D_80972030.x; this->subCamEyeNext.y = D_80972030.y; this->subCamEyeNext.z = D_80972030.z; Math_Vec3f_Copy(&tempunk238, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &tempunk238, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.actor.home, &tempunk238, &this->subCamEyeNext, 1); this->subCamAtNext.x = ((f32)D_8097203C.x) + this->unk22C.x; // cast req this->subCamAtNext.y = ((f32)D_8097203C.y) + this->unk22C.y; this->subCamAtNext.z = ((f32)D_8097203C.z) + this->unk22C.z; @@ -993,11 +990,11 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { return; } - this->actor.shape.rot.y += 0x3000; + this->picto.actor.shape.rot.y += 0x3000; Math_SmoothStepToS(&this->unk190, 500, 5, 50, 0); if ((play->gameplayFrames % 4) == 0) { - Math_Vec3f_Copy(&tempWorldPos, &this->actor.world.pos); - tempWorldPos.y = this->actor.floorHeight; + Math_Vec3f_Copy(&tempWorldPos, &this->picto.actor.world.pos); + tempWorldPos.y = this->picto.actor.floorHeight; tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); @@ -1006,16 +1003,16 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); } else { - Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 5, 4.0f, 200, 10, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, + this->picto.actor.shape.shadowScale - 20.0f, 5, 4.0f, 200, 10, 1); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } } - Math_ApproachF(&this->actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); - if (fabsf(this->actor.shape.yOffset + 6000.0f) < 10.0f) { + Math_ApproachF(&this->picto.actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); + if (fabsf(this->picto.actor.shape.yOffset + 6000.0f) < 10.0f) { gSaveContext.save.weekEventReg[79] |= 8; - func_800B7298(play, &this->actor, 6); + func_800B7298(play, &this->picto.actor, 6); ActorCutscene_Stop(this->actorCutscenes[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; @@ -1024,17 +1021,17 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupIdleUnderground(EnKakasi* this) { - this->actor.shape.yOffset = -7000.0; - this->actor.draw = NULL; - this->actor.flags |= ACTOR_FLAG_8000000; + this->picto.actor.shape.yOffset = -7000.0; + this->picto.actor.draw = NULL; + this->picto.actor.flags |= ACTOR_FLAG_8000000; this->unkState196 = 5; this->actionFunc = EnKakasi_IdleUnderground; } void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { - if ((gSaveContext.save.weekEventReg[79] & 8) && this->actor.xzDistToPlayer < this->songSummonDist && + if ((gSaveContext.save.weekEventReg[79] & 8) && this->picto.actor.xzDistToPlayer < this->songSummonDist && (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->picto.actor.flags &= ~ACTOR_FLAG_8000000; play->msgCtx.ocarinaMode = 4; this->actionFunc = EnKakasi_SetupRiseOutOfGround; } @@ -1056,27 +1053,27 @@ void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[cutsceneIndex]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actor.draw = EnKakasi_Draw; + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->picto.actor); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); + this->picto.actor.draw = EnKakasi_Draw; this->unkState196 = 6; this->actionFunc = EnKakasi_RisingOutOfGround; } } void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { - this->actor.shape.rot.y += 0x3000; + this->picto.actor.shape.rot.y += 0x3000; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - if (this->actor.shape.yOffset < -10.0f) { + if (this->picto.actor.shape.yOffset < -10.0f) { if ((play->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 10, 8.0f, 500, 10, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, + this->picto.actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } - Math_ApproachF(&this->actor.shape.yOffset, 0.0f, 0.5f, 200.0f); + Math_ApproachF(&this->picto.actor.shape.yOffset, 0.0f, 0.5f, 200.0f); } else { EnKakasi_SetupIdleRisen(this); } @@ -1084,23 +1081,23 @@ void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { void EnKakasi_SetupIdleRisen(EnKakasi* this) { // text: great to see you again - this->actor.textId = 0x164D; + this->picto.actor.textId = 0x164D; this->unkState196 = 7; this->actionFunc = EnKakasi_IdleRisen; - this->actor.shape.yOffset = 0.0f; + this->picto.actor.shape.yOffset = 0.0f; } void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = EnKakasi_RisenDialogue; } else { - func_800B8614(&this->actor, play, 70.0f); + func_800B8614(&this->picto.actor, play, 70.0f); } } void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); @@ -1113,33 +1110,33 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelanime); - if (this->actor.draw != NULL) { + if (this->picto.actor.draw != NULL) { EnKakasi_CheckAnimationSfx(this); } - this->actor.world.rot.y = this->actor.shape.rot.y; + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; DECR(this->postTeachTimer); DECR(this->unk204); if (this->unkState196 != 5) { if (this->unk1BC.x != 0.0f || this->unk1BC.z != 0.0f) { - Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk1BC); - this->actor.focus.pos.y += 10.0f; + Math_Vec3f_Copy(&this->picto.actor.focus.pos, &this->unk1BC); + this->picto.actor.focus.pos.y += 10.0f; if (this->subCamId == CAM_ID_MAIN) { - Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); + Math_Vec3s_Copy(&this->picto.actor.focus.rot, &this->picto.actor.world.rot); } else { - Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.home.rot); + Math_Vec3s_Copy(&this->picto.actor.focus.rot, &this->picto.actor.home.rot); } } } else { - Actor_SetFocus(&this->actor, this->unkHeight); + Actor_SetFocus(&this->picto.actor, this->unkHeight); } this->actionFunc(this, play); - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); - if (this->actor.draw != NULL) { - Collider_UpdateCylinder(&this->actor, &this->collider); + Actor_MoveWithGravity(&this->picto.actor); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 50.0f, 50.0f, 100.0f, 0x1C); + if (this->picto.actor.draw != NULL) { + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -1157,5 +1154,5 @@ void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, - EnKakasi_PostLimbDraw, &this->actor); + EnKakasi_PostLimbDraw, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index c1a788d466..b6010d1223 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -2,15 +2,14 @@ #define Z_EN_KAKASI_H #include "global.h" +#include "z64snap.h" struct EnKakasi; typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*); -typedef void (*EnKakasiUnkFunc)(PlayState*, struct EnKakasi*); typedef struct EnKakasi { - /* 0x000 */ Actor actor; - /* 0x144 */ EnKakasiUnkFunc unkFunc; // used for one z_snap calling function? + /* 0x000 */ PictoActor picto; /* 0x148 */ EnKakasiActionFunc actionFunc; /* 0x14C */ SkelAnime skelanime; /* 0x190 */ s16 unk190; // camera index for song teaching angles? diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 9a63f38a1d..8b6b66208b 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -239,12 +239,12 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { } if (this->unk_29C & 2) { - Vec3f sp38; - f32 sp34; + Vec3f projectedPos; + f32 invW; f32 temp_f0; - Actor_GetProjectedPos(play, &this->unk_2B4, &sp38, &sp34); - temp_f0 = sp38.x * sp34; + Actor_GetProjectedPos(play, &this->unk_2B4, &projectedPos, &invW); + temp_f0 = projectedPos.x * invW; if (this->unk_2E6 > 0) { this->unk_2E6--; } diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c index fb8be21f2d..14c235f517 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c @@ -73,7 +73,7 @@ extern UNK_TYPE D_060105DC; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5A64.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5B38.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_ValidatePictograph.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5B84.s") diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h index 495b8f07bb..9baee87f08 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h @@ -2,14 +2,15 @@ #define Z_EN_MNK_H #include "global.h" +#include "z64snap.h" struct EnMnk; typedef void (*EnMnkActionFunc)(struct EnMnk*, PlayState*); typedef struct EnMnk { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x2A4]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ char unk_148[0x2A0]; /* 0x3E8 */ EnMnkActionFunc actionFunc; } EnMnk; // size = 0x3EC diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 817648daa5..706d7d801e 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -6,6 +6,7 @@ */ #include "z_en_shn.h" +#include "z64snap.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,7 +16,7 @@ void EnShn_Init(Actor* thisx, PlayState* play); void EnShn_Destroy(Actor* thisx, PlayState* play); void EnShn_Update(Actor* thisx, PlayState* play); void EnShn_Draw(Actor* thisx, PlayState* play); -void func_80AE69E8(EnShn* this, PlayState* play); + void func_80AE6A64(EnShn* this, PlayState* play); // Could be something related to text/dialogue? @@ -62,21 +63,18 @@ const ActorInit En_Shn_InitVars = { (ActorFunc)EnShn_Draw, }; -static AnimationInfoS sAnimations[] = { - { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, 0 }, - { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, -4 }, - { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, 0 }, - { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, -4 }, -}; - -static s32 D_80AE7258[] = { 0, 2, 3, 8, 10, 1 }; - void func_80AE6130(EnShn* this) { this->skelAnime.playSpeed = this->playSpeed; SkelAnime_Update(&this->skelAnime); } s32 func_80AE615C(EnShn* this, s32 arg1) { + static AnimationInfoS sAnimations[] = { + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, 0 }, + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, -4 }, + { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, 0 }, + { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, -4 }, + }; s32 phi_v0 = 0; s32 phi_v1 = 0; @@ -103,7 +101,7 @@ s32 EnShn_IsFacingPlayer(EnShn* this) { } if (phi_v1 == 0) { this->unk_2EC ^= 1; - this->unk_2C8 = Rand_S16Offset(0x1E, 0x1E); + this->unk_2C8 = Rand_S16Offset(30, 30); } if (this->unk_2EC != 0) { range = 120.0f; @@ -228,6 +226,10 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { } s32 func_80AE6704(Actor* thisx, PlayState* play) { + static s32 sPictographFlags[] = { + PICTOGRAPH_0, PICTOGRAPH_MONKEY, PICTOGRAPH_BIG_OCTO, + PICTOGRAPH_TINGLE, PICTOGRAPH_DEKU_KING, PICTOGRAPH_IN_SWAMP, + }; EnShn* this = THIS; s32 ret = 0; @@ -240,12 +242,13 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { this->unk_2C6++; } break; + case 1: case 2: case 3: case 4: case 5: - if (func_8013A4C4(D_80AE7258[this->unk_2C6])) { + if (Snap_CheckFlag(sPictographFlags[this->unk_2C6])) { this->unk_2C6 = 6; ret = 1; REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); @@ -253,6 +256,7 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { this->unk_2C6++; } break; + case 6: gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800B7298(play, &this->actor, 7); @@ -284,12 +288,12 @@ UNK_TYPE* func_80AE6880(EnShn* this, PlayState* play) { s32 func_80AE68F0(EnShn* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 ret = 0; + s32 ret = false; if (this->unk_1D8 & 7) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1D8 &= ~0x180; - if (player->exchangeItemId == EXCH_ITEM_13) { + if (player->exchangeItemId == EXCH_ITEM_PICTO_BOX) { this->unk_1D8 |= 0x80; this->unk_2E4 = player->exchangeItemId; } else if (player->exchangeItemId != EXCH_ITEM_NONE) { @@ -303,7 +307,7 @@ s32 func_80AE68F0(EnShn* this, PlayState* play) { this->unk_1D8 |= 8; } this->actionFunc = func_80AE6A64; - ret = 1; + ret = true; } } return ret; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index ddf924872d..15d4cf3e54 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -5,6 +5,7 @@ */ #include "z_en_tsn.h" +#include "z64snap.h" #include "objects/object_tsn/object_tsn.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) @@ -324,12 +325,12 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { this->actionFunc = func_80AE0704; if (sp24 == 19) { if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { - if (func_8013A4C4(1 | 8)) { + if (Snap_CheckFlag(PICTOGRAPH_PIRATE_GOOD)) { player->actor.textId = 0x107B; return; } - if (func_8013A4C4(1 | 2 | 8)) { + if (Snap_CheckFlag(PICTOGRAPH_PIRATE_TOO_FAR)) { player->actor.textId = 0x10A9; return; } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 1c781a92d3..b0dd0e033f 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -5,6 +5,7 @@ */ #include "z_en_zot.h" +#include "z64snap.h" #include "objects/object_zo/object_zo.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -955,8 +956,9 @@ void func_80B985EC(EnZot* this, PlayState* play) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { func_801477B4(play); - if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && func_8013A4C4(4)) { - if (func_8013A4C4(5) && func_8013A4C4(6)) { + if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && + Snap_CheckFlag(PICTOGRAPH_LULU_HEAD)) { + if (Snap_CheckFlag(PICTOGRAPH_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTOGRAPH_LULU_LEFT_ARM)) { player->actor.textId = 0x12AE; } else { player->actor.textId = 0x12AC; diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index e026843e22..5da61c9662 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -26,7 +26,7 @@ void func_80BD1C84(EnZov* this, PlayState* play); void func_80BD1D94(EnZov* this, PlayState* play); void func_80BD1DB8(EnZov* this, PlayState* play); void func_80BD1F1C(EnZov* this, PlayState* play); -s32 func_80BD1FC8(PlayState* play, EnZov* this); +s32 EnZov_ValidatePictograph(PlayState* play, Actor* thisx); const ActorInit En_Zov_InitVars = { ACTOR_EN_ZOV, @@ -82,10 +82,10 @@ static s8 D_80BD2770[] = { void EnZov_Init(Actor* thisx, PlayState* play) { EnZov* this = THIS; - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Actor_SetScale(&this->actor, 0.01f); - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_zov_Skel_016258, &object_zov_Anim_00D3EC, this->jontTable, this->morphTable, 23); Animation_PlayLoop(&this->skelAnime, &object_zov_Anim_00D3EC); @@ -93,35 +93,35 @@ void EnZov_Init(Actor* thisx, PlayState* play) { this->unk_320 = 0; this->unk_32C = -1; this->unk_326 = -1; - this->unk_328[0] = this->actor.cutscene; + this->unk_328[0] = this->picto.actor.cutscene; this->unk_328[1] = 0x7C; this->unk_322 = 0; this->actionFunc = func_80BD1C84; - this->unk_144 = func_80BD1FC8; + this->picto.validationFunc = EnZov_ValidatePictograph; - Math_Vec3f_Copy(&this->unk_2FC, &this->actor.world.pos); - Math_Vec3f_Copy(&this->unk_308, &this->actor.world.pos); - Math_Vec3f_Copy(&this->unk_314, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_2FC, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->unk_308, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->unk_314, &this->picto.actor.world.pos); - switch (ENZOV_GET_F(&this->actor)) { + switch (ENZOV_GET_F(&this->picto.actor)) { case ENZOV_F_1: this->actionFunc = func_80BD1F1C; func_80BD1570(this, 9, ANIMMODE_LOOP); if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); return; } break; case ENZOV_F_2: this->actionFunc = func_80BD1C38; - this->actor.shape.shadowDraw = NULL; + this->picto.actor.shape.shadowDraw = NULL; break; default: this->unk_320 |= 2; if ((gSaveContext.save.weekEventReg[55] & 0x80) || (gSaveContext.save.weekEventReg[53] & 0x20)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); } break; } @@ -175,8 +175,8 @@ void func_80BD1570(EnZov* this, s16 index, u8 mode) { } s32 func_80BD15A4(EnZov* this, PlayState* play) { - if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && - Actor_IsFacingPlayer(&this->actor, 0x3000)) { + if ((this->picto.actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->picto.actor, 0x3000, play) && + Actor_IsFacingPlayer(&this->picto.actor, 0x3000)) { return true; } return false; @@ -213,7 +213,7 @@ void func_80BD160C(EnZov* this, PlayState* play) { this->unk_320 |= 1; if (textId != 0) { - Message_StartTextbox(play, textId, &this->actor); + Message_StartTextbox(play, textId, &this->picto.actor); } } @@ -314,9 +314,9 @@ void func_80BD19FC(EnZov* this, PlayState* play) { this->unk_324--; } else { func_80BD13DC(this); - Message_StartTextbox(play, 0x1021, &this->actor); + Message_StartTextbox(play, 0x1021, &this->picto.actor); ((EnElf*)(GET_PLAYER(play)->tatlActor))->unk_264 |= 4; - Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); + Actor_ChangeFocus(&this->picto.actor, play, GET_PLAYER(play)->tatlActor); this->actionFunc = func_80BD187C; } } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -367,18 +367,18 @@ void func_80BD1BF0(EnZov* this, PlayState* play) { void func_80BD1C38(EnZov* this, PlayState* play) { if (func_80BD1AE0(this, play)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 504)); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 504)); } } void func_80BD1C84(EnZov* this, PlayState* play) { func_80BD1764(this); - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = func_80BD187C; func_80BD160C(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + func_800B8614(&this->picto.actor, play, 120.0f); } if (Cutscene_CheckActorAction(play, 0x1F8)) { @@ -399,7 +399,7 @@ void func_80BD1D30(EnZov* this, PlayState* play) { } else { textId = 0x1031; } - Message_StartTextbox(play, textId, &this->actor); + Message_StartTextbox(play, textId, &this->picto.actor); } void func_80BD1D94(EnZov* this, PlayState* play) { @@ -408,8 +408,8 @@ void func_80BD1D94(EnZov* this, PlayState* play) { void func_80BD1DB8(EnZov* this, PlayState* play) { func_80BD1764(this); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); - this->actor.world.rot.y = this->actor.shape.rot.y; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x1000, 0x200); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { @@ -423,7 +423,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { break; case 0x1039: - play->nextEntranceIndex = play->setupExitList[ENZOV_GET_FE00(&this->actor)]; + play->nextEntranceIndex = play->setupExitList[ENZOV_GET_FE00(&this->picto.actor)]; play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[78] |= 1; @@ -443,26 +443,29 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { void func_80BD1F1C(EnZov* this, PlayState* play) { func_80BD1764(this); - if (this->actor.home.rot.y != this->actor.shape.rot.y) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200); - this->actor.world.rot.y = this->actor.shape.rot.y; + if (this->picto.actor.home.rot.y != this->picto.actor.shape.rot.y) { + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 2, 0x1000, 0x200); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = func_80BD1DB8; func_80BD1D30(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + func_800B8614(&this->picto.actor, play, 120.0f); } } -s32 func_80BD1FC8(PlayState* play, EnZov* this) { +s32 EnZov_ValidatePictograph(PlayState* play, Actor* thisx) { s32 ret; - s32 pad; + EnZov* this = THIS; - ret = func_8013A530(play, &this->actor, 4, &this->actor.focus.pos, &this->actor.shape.rot, 10.0f, 300.0f, -1); - ret |= func_8013A530(play, &this->actor, 5, &this->unk_308, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); - ret |= func_8013A530(play, &this->actor, 6, &this->unk_314, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret = Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_HEAD, &this->picto.actor.focus.pos, + &this->picto.actor.shape.rot, 10.0f, 300.0f, -1); + ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_RIGHT_ARM, &this->unk_308, + &this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_LEFT_ARM, &this->unk_314, + &this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000); return ret; } @@ -470,10 +473,10 @@ void EnZov_Update(Actor* thisx, PlayState* play) { s32 pad; EnZov* this = THIS; - Actor_MoveWithGravity(&this->actor); - Collider_UpdateCylinder(&this->actor, &this->collider); + Actor_MoveWithGravity(&this->picto.actor); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 10.0f, 10.0f, 10.0f, 4); this->actionFunc(this, play); @@ -482,7 +485,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { } if ((this->unk_320 & 1) && func_80BD15A4(this, play)) { - Actor_TrackPlayer(play, &this->actor, &this->unk_2F0, &this->unk_2F6, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->picto.actor, &this->unk_2F0, &this->unk_2F6, this->picto.actor.focus.pos); } else { if ((this->unk_320 & 0x10) && (this->unk_322 == 0)) { Math_SmoothStepToS(&this->unk_2F0.x, -0x1B58, 6, 0x1838, 0x64); @@ -508,7 +511,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); } else if (ActorCutscene_GetCanPlayNext(this->unk_328[this->unk_32C])) { - ActorCutscene_Start(this->unk_328[this->unk_32C], &this->actor); + ActorCutscene_Start(this->unk_328[this->unk_32C], &this->picto.actor); } else { ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); } @@ -535,8 +538,8 @@ void EnZov_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnZov* this = THIS; if (limbIndex == 12) { - Matrix_MultVec3f(&D_80BD2744, &this->actor.focus.pos); - Math_Vec3f_Copy(&this->unk_2FC, &this->actor.focus.pos); + Matrix_MultVec3f(&D_80BD2744, &this->picto.actor.focus.pos); + Math_Vec3f_Copy(&this->unk_2FC, &this->picto.actor.focus.pos); this->unk_2FC.y += 10.0f; } @@ -629,5 +632,5 @@ void EnZov_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnZov_OverrideLimbDraw, EnZov_PostLimbDraw, &this->actor); + EnZov_OverrideLimbDraw, EnZov_PostLimbDraw, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.h b/src/overlays/actors/ovl_En_Zov/z_en_zov.h index cabb82b435..25966f9940 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.h +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.h @@ -2,11 +2,11 @@ #define Z_EN_ZOV_H #include "global.h" +#include "z64snap.h" struct EnZov; typedef void (*EnZovActionFunc)(struct EnZov*, PlayState*); -typedef s32 (*EnZovUnkFunc)(PlayState*, struct EnZov*); #define ENZOV_GET_F(thisx) ((thisx)->params & 0xF) #define ENZOV_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) @@ -15,8 +15,7 @@ typedef s32 (*EnZovUnkFunc)(PlayState*, struct EnZov*); #define ENZOV_F_2 2 typedef struct EnZov { - /* 0x000 */ Actor actor; - /* 0x144 */ EnZovUnkFunc unk_144; + /* 0x000 */ PictoActor picto; /* 0x148 */ Vec3s jontTable[23]; /* 0x1D2 */ Vec3s morphTable[23]; /* 0x25C */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c index 5fec022ad2..df880906ee 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -8,6 +8,7 @@ #include "z_obj_grass.h" #include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "prevent_bss_reordering.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 55e98cf598..a10ae84cac 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2649,12 +2649,12 @@ 0x80139FA0:("SkinMatrix_SetYRotation",), 0x8013A068:("SkinMatrix_MulYRotation",), 0x8013A174:("SkinMatrix_SetZRotation",), - 0x8013A240:("func_8013A240",), - 0x8013A41C:("func_8013A41C",), - 0x8013A46C:("func_8013A46C",), - 0x8013A4C4:("func_8013A4C4",), - 0x8013A504:("func_8013A504",), - 0x8013A530:("func_8013A530",), + 0x8013A240:("Snap_RecordPictographedActors",), + 0x8013A41C:("Snap_SetFlag",), + 0x8013A46C:("Snap_UnsetFlag",), + 0x8013A4C4:("Snap_CheckFlag",), + 0x8013A504:("Snap_AbsS",), + 0x8013A530:("Snap_ValidatePictograph",), 0x8013A7C0:("SubS_FindDoor",), 0x8013A860:("SubS_DrawTransformFlexLimb",), 0x8013AB00:("SubS_DrawTransformFlex",), @@ -7539,18 +7539,18 @@ 0x809455A0:("ItemInbox_Draw",), 0x80945650:("EnGe1_Init",), 0x809457C0:("EnGe1_Destroy",), - 0x809457EC:("func_809457EC",), - 0x80945924:("func_80945924",), - 0x80945A00:("func_80945A00",), - 0x80945A9C:("func_80945A9C",), - 0x80945B60:("func_80945B60",), - 0x80945C50:("func_80945C50",), - 0x80945CAC:("func_80945CAC",), - 0x80945CE4:("func_80945CE4",), + 0x809457EC:("EnGe1_SetAnimation",), + 0x80945924:("EnGe1_LookAtPlayer",), + 0x80945A00:("EnGe1_ShadowDraw",), + 0x80945A9C:("EnGe1_SetupPath",), + 0x80945B60:("EnGe1_FollowPath",), + 0x80945C50:("EnGe1_Scream",), + 0x80945CAC:("EnGe1_Wait",), + 0x80945CE4:("EnGe1_PerformCutsceneActions",), 0x8094607C:("EnGe1_Update",), - 0x80946190:("func_80946190",), - 0x80946238:("func_80946238",), - 0x80946368:("func_80946368",), + 0x80946190:("EnGe1_ValidatePictograph",), + 0x80946238:("EnGe1_OverrideLimbDraw",), + 0x80946368:("EnGe1_PostLimbDraw",), 0x80946400:("EnGe1_Draw",), 0x809466A0:("ObjBlockstop_Init",), 0x809466F0:("ObjBlockstop_CheckForBlock",), @@ -8017,7 +8017,7 @@ 0x8096F5E0:("EnKakasi_Destroy",), 0x8096F60C:("EnKakasi_Init",), 0x8096F800:("EnKakasi_SetAnimation",), - 0x8096F88C:("EnKakasi_8096F88C",), + 0x8096F88C:("EnKakasi_ValidatePictograph",), 0x8096F8D8:("func_8096F8D8",), 0x8096FA18:("func_8096FA18",), 0x8096FAAC:("func_8096FAAC",), @@ -10591,7 +10591,7 @@ 0x80A52018:("func_80A52018",), 0x80A52074:("func_80A52074",), 0x80A52134:("func_80A52134",), - 0x80A52530:("func_80A52530",), + 0x80A52530:("EnDnq_ValidatePictograph",), 0x80A5257C:("func_80A5257C",), 0x80A52604:("func_80A52604",), 0x80A52648:("func_80A52648",), @@ -10760,7 +10760,7 @@ 0x80A619EC:("EnBal_Destroy",), 0x80A61A18:("func_80A61A18",), 0x80A61A44:("func_80A61A44",), - 0x80A61A6C:("func_80A61A6C",), + 0x80A61A6C:("EnBal_ValidatePictograph",), 0x80A61ADC:("func_80A61ADC",), 0x80A61B5C:("func_80A61B5C",), 0x80A61C9C:("func_80A61C9C",), @@ -11720,7 +11720,7 @@ 0x80AB53DC:("EnMnk_Init",), 0x80AB59E8:("EnMnk_Destroy",), 0x80AB5A64:("func_80AB5A64",), - 0x80AB5B38:("func_80AB5B38",), + 0x80AB5B38:("EnMnk_ValidatePictograph",), 0x80AB5B84:("func_80AB5B84",), 0x80AB5BCC:("func_80AB5BCC",), 0x80AB5C14:("func_80AB5C14",), @@ -11916,7 +11916,7 @@ 0x80AC299C:("EnBigokuta_MoveCamera",), 0x80AC2A1C:("EnBigokuta_ResetCamera",), 0x80AC2A7C:("EnBigokuta_ShootPlayer",), - 0x80AC2B4C:("func_80AC2B4C",), + 0x80AC2B4C:("EnBigokuta_ValidatePictograph",), 0x80AC2B98:("EnBigokuta_IsInWater",), 0x80AC2C30:("EnBigokuta_SpawnRipple",), 0x80AC2C84:("EnBigokuta_SetupIdle",), @@ -15728,7 +15728,7 @@ 0x80BD1D94:("func_80BD1D94",), 0x80BD1DB8:("func_80BD1DB8",), 0x80BD1F1C:("func_80BD1F1C",), - 0x80BD1FC8:("func_80BD1FC8",), + 0x80BD1FC8:("EnZov_ValidatePictograph",), 0x80BD20B4:("EnZov_Update",), 0x80BD2380:("EnZov_OverrideLimbDraw",), 0x80BD2404:("EnZov_PostLimbDraw",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 88e031ba9f..179e45e97a 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -8437,12 +8437,12 @@ 0x809453C4:("D_809453C4","f32","",0x4), 0x80945600:("Item_Inbox_InitVars","UNK_TYPE1","",0x1), 0x809464B0:("En_Ge1_InitVars","UNK_TYPE1","",0x1), - 0x809464D0:("D_809464D0","UNK_TYPE1","",0x1), - 0x809464FC:("D_809464FC","UNK_TYPE1","",0x1), - 0x80946524:("D_80946524","UNK_TYPE1","",0x1), - 0x80946530:("D_80946530","UNK_TYPE1","",0x1), - 0x8094653C:("D_8094653C","UNK_TYPE1","",0x1), - 0x80946548:("D_80946548","UNK_TYPE1","",0x1), + 0x809464D0:("sCylinderInit","ColliderCylinderInit","",0x1), + 0x809464FC:("sAnimations","AnimationHeader","10",0x28), + 0x80946524:("sHairstyleDLs","Gfx*","3",0xC), + 0x80946530:("sInitialFocusPos","Vec3f","",0xC), + 0x8094653C:("sZeroVec","Vec3f","",0xC), + 0x80946548:("sEyeTextures","TexturePtr","3",0xC), 0x80946560:("jtbl_80946560","UNK_PTR","",0x4), 0x80946880:("Obj_Blockstop_InitVars","UNK_TYPE1","",0x1), 0x80947A40:("En_Sda_InitVars","UNK_TYPE1","",0x1), diff --git a/undefined_syms.txt b/undefined_syms.txt index c9a2964db2..4ea51aaf00 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1080,11 +1080,6 @@ D_0600007C = 0x0600007C; D_0600CFE0 = 0x0600CFE0; D_06011058 = 0x06011058; -// ovl_En_Ge1 - -D_06002B98 = 0x06002B98; -D_06002CA0 = 0x06002CA0; - // ovl_En_Ge2 D_0600030C = 0x0600030C;