From 253209d7222155b5085a109d92a8281319a5b457 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:27:03 +1000 Subject: [PATCH] Bottle Params (#1328) * bottle param docs * none to any * reorder * macro use * PR Review * brackets --- src/code/z_demo.c | 6 +- src/code/z_en_item00.c | 7 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c | 5 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 15 ++- src/overlays/actors/ovl_En_Butte/z_en_butte.h | 12 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 124 +++++++++--------- src/overlays/actors/ovl_En_Dnp/z_en_dnp.h | 10 +- .../actors/ovl_En_Dragon/z_en_dragon.c | 4 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 45 ++++--- src/overlays/actors/ovl_En_Elf/z_en_elf.h | 34 +++-- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 + src/overlays/actors/ovl_En_Go/z_en_go.c | 3 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 7 +- .../actors/ovl_En_Insect/z_en_insect.h | 2 + src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 6 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 11 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 35 +++-- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 11 +- .../actors/ovl_En_Mushi2/z_en_mushi2.h | 8 ++ src/overlays/actors/ovl_En_Ot/z_en_ot.c | 66 +++++----- src/overlays/actors/ovl_En_Ot/z_en_ot.h | 21 ++- .../actors/ovl_En_Tag_Obj/z_en_tag_obj.c | 3 +- src/overlays/actors/ovl_En_Test5/z_en_test5.h | 2 + .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 86 ++++++------ .../actors/ovl_En_Zoraegg/z_en_zoraegg.h | 60 +++++---- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 4 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h | 10 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 4 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 37 +++--- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h | 19 ++- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 10 +- .../actors/ovl_player_actor/z_player.c | 83 +++++++----- 32 files changed, 437 insertions(+), 315 deletions(-) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 771e767225..7abd9db767 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -4,6 +4,7 @@ #include "z64rumble.h" #include "z64shrink_window.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" void CutsceneHandler_DoNothing(PlayState* play, CutsceneContext* csCtx); void CutsceneHandler_StartManual(PlayState* play, CutsceneContext* csCtx); @@ -816,8 +817,9 @@ void CutsceneCmd_GiveTatlToPlayer(PlayState* play, CutsceneContext* csCtx, CsCmd if (player->tatlActor != NULL) { return; } - player->tatlActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, player->actor.world.pos.x, - player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 0); + player->tatlActor = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, player->actor.world.pos.x, player->actor.world.pos.y, + player->actor.world.pos.z, 0, 0, 0, FAIRY_PARAMS(FAIRY_TYPE_0, false, 0)); } } } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 0f1836dfbe..55ab1a7082 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -1,6 +1,7 @@ #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_gi_hearts/object_gi_hearts.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "overlays/actors/ovl_En_Elforg/z_en_elforg.h" #define FLAGS 0x00000000 @@ -929,7 +930,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { newParamFF = params & 0xFF; if (newParamFF == ITEM00_FLEXIBLE) { spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); + spawnPos->z, 0, 0, 0, FAIRY_PARAMS(FAIRY_TYPE_2, true, param7F00 >> 8)); if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) { SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } @@ -990,7 +991,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { if ((((params & 0xFF) == ITEM00_FLEXIBLE) || ((params & 0xFF) == ITEM00_BIG_FAIRY)) && (param10000 == 0)) { if ((params & 0xFF) == ITEM00_FLEXIBLE) { spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); + spawnPos->z, 0, 0, 0, FAIRY_PARAMS(FAIRY_TYPE_2, true, param7F00 >> 8)); } else { spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, @@ -1373,7 +1374,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP if (dropId == ITEM00_FLEXIBLE) { if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, - 2); + FAIRY_PARAMS(FAIRY_TYPE_2, false, 0)); SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); return; } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c index 1b9e930093..f7b4288377 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c @@ -12,6 +12,7 @@ */ #include "z_bg_sinkai_kabe.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #include "objects/object_sinkai_kabe/object_sinkai_kabe.h" #define FLAGS (ACTOR_FLAG_10) @@ -99,8 +100,8 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { pos.z += (Math_CosS(this->dyna.actor.world.rot.y + 0x8000) * 500.0f); if (shouldSpawnSeahorse) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, pos.x, pos.y, pos.z, 0, - this->dyna.actor.shape.rot.y, 0, 0x4000, this->dyna.actor.csId, - this->dyna.actor.halfDaysBits, NULL); + this->dyna.actor.shape.rot.y, 0, SEAHORSE_PARAMS(SEAHORSE_TYPE_1, 0, 0), + this->dyna.actor.csId, this->dyna.actor.halfDaysBits, NULL); } Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 0d7b608230..d27aaf6795 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -5,6 +5,7 @@ */ #include "z_en_butte.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -164,8 +165,8 @@ void EnButte_Init(Actor* thisx, PlayState* play) { s32 pad; EnButte* this = THIS; - if (ENBUTTE_GET(&this->actor) == ENBUTTE_MINUS1) { - this->actor.params = ENBUTTE_0; + if (BUTTERFLY_GET(&this->actor) == BUTTERFLY_MINUS1) { + this->actor.params = BUTTERFLY_0; } this->actor.world.rot.y = Rand_Next(); @@ -173,7 +174,7 @@ void EnButte_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_ProcessInitChain(&this->actor, sInitChain); - if ((ENBUTTE_GET_1(&this->actor) & 0xFF) == ENBUTTE_1) { + if ((BUTTERFLY_GET_1(&this->actor) & 0xFF) == BUTTERFLY_1) { this->actor.uncullZoneScale = 200.0f; } @@ -286,7 +287,7 @@ void func_8091C794(EnButte* this, PlayState* play) { func_8091C0A0(this, &D_8091D324[this->unk_24E]); } - if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) && + if ((BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_252 <= 0) && ((Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z) < SQ(120.0f)) || @@ -381,7 +382,7 @@ void func_8091CFB4(EnButte* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); } else if (this->unk_24C == 4) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, - this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, 2); + this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_PARAMS(FAIRY_TYPE_2, false, 0)); this->unk_250 = 0; } else if (this->unk_24C <= 0) { func_8091D070(this); @@ -415,7 +416,7 @@ void EnButte_Update(Actor* thisx, PlayState* play) { this->unk_256 += 0x1000; this->unk_258 += 0x600; - if (ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) { + if (BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) { if (GET_PLAYER(play)->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0) { if (this->unk_252 > 0) { this->unk_252--; @@ -450,7 +451,7 @@ void EnButte_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } - if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (this->actionFunc == func_8091CFB4)) { + if ((BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) && (this->actionFunc == func_8091CFB4)) { func_8091C178(this, play); } } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index b035d2845d..39c24a5331 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -8,12 +8,14 @@ struct EnButte; typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); -#define ENBUTTE_GET(thisx) ((thisx)->params) -#define ENBUTTE_GET_1(thisx) ((thisx)->params & 1) +#define BUTTERFLY_GET(thisx) ((thisx)->params) +#define BUTTERFLY_GET_1(thisx) ((thisx)->params & 1) -#define ENBUTTE_MINUS1 -1 -#define ENBUTTE_0 0 -#define ENBUTTE_1 1 +#define BUTTERFLY_MINUS1 -1 +#define BUTTERFLY_0 0 +#define BUTTERFLY_1 1 + +#define BUTTERFLY_PARAMS(param) (param) typedef struct EnButte { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 8263001aa1..0ef492e9c8 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -25,11 +25,11 @@ void func_80B3D3F8(EnDnp* this, PlayState* play); void func_80B3D558(EnDnp* this, PlayState* play); typedef enum { - /* 0 */ EN_DNP_EYE_OPEN, - /* 1 */ EN_DNP_EYE_HALF, - /* 2 */ EN_DNP_EYE_CLOSED, - /* 3 */ EN_DNP_EYE_ANGRY, - /* 4 */ EN_DNP_EYE_MAX + /* 0 */ DEKU_PRINCESS_EYE_OPEN, + /* 1 */ DEKU_PRINCESS_EYE_HALF, + /* 2 */ DEKU_PRINCESS_EYE_CLOSED, + /* 3 */ DEKU_PRINCESS_EYE_ANGRY, + /* 4 */ DEKU_PRINCESS_EYE_MAX } EnDnpEyeIndex; ActorInit En_Dnp_InitVars = { @@ -67,33 +67,33 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum { - /* -1 */ EN_DNP_ANIM_NONE = -1, - /* 0 */ EN_DNP_ANIM_JUMP_KICK, // Can be triggered by a cutscene, but no cutscene in the final game does so - /* 1 */ EN_DNP_ANIM_HURRY, - /* 2 */ EN_DNP_ANIM_CUTSCENE_HURRY, - /* 3 */ EN_DNP_ANIM_HURRY_END, - /* 4 */ EN_DNP_ANIM_SCOLD, // Unused - /* 5 */ EN_DNP_ANIM_LAUGH_START, - /* 6 */ EN_DNP_ANIM_LAUGH_LOOP, - /* 7 */ EN_DNP_ANIM_TURN_AROUND, - /* 8 */ EN_DNP_ANIM_BOW, - /* 9 */ EN_DNP_ANIM_RUN, // Unused - /* 10 */ EN_DNP_ANIM_THINK_START, - /* 11 */ EN_DNP_ANIM_THINK_LOOP, - /* 12 */ EN_DNP_ANIM_ARMS_TOGETHER_START, - /* 13 */ EN_DNP_ANIM_ARMS_TOGETHER_LOOP, - /* 14 */ EN_DNP_ANIM_GREETING, - /* 15 */ EN_DNP_ANIM_IDLE, - /* 16 */ EN_DNP_ANIM_CUTSCENE_IDLE, - /* 17 */ EN_DNP_ANIM_UNUSED_WALK, // Unused - /* 18 */ EN_DNP_ANIM_WALK, // Can be triggered by a cutscene, but no cutscene in the final game does so - /* 19 */ EN_DNP_ANIM_ANGRY_START, - /* 20 */ EN_DNP_ANIM_ANGRY_LOOP, - /* 21 */ EN_DNP_ANIM_JUMP, - /* 22 */ EN_DNP_ANIM_BOUNCE_START, - /* 23 */ EN_DNP_ANIM_BOUNCE_LOOP, - /* 24 */ EN_DNP_ANIM_GLARE_START, - /* 25 */ EN_DNP_ANIM_GLARE_LOOP + /* -1 */ DEKU_PRINCESS_ANIM_NONE = -1, + /* 0 */ DEKU_PRINCESS_ANIM_JUMP_KICK, // Can be triggered by a cutscene, but no cutscene in the final game does so + /* 1 */ DEKU_PRINCESS_ANIM_HURRY, + /* 2 */ DEKU_PRINCESS_ANIM_CUTSCENE_HURRY, + /* 3 */ DEKU_PRINCESS_ANIM_HURRY_END, + /* 4 */ DEKU_PRINCESS_ANIM_SCOLD, // Unused + /* 5 */ DEKU_PRINCESS_ANIM_LAUGH_START, + /* 6 */ DEKU_PRINCESS_ANIM_LAUGH_LOOP, + /* 7 */ DEKU_PRINCESS_ANIM_TURN_AROUND, + /* 8 */ DEKU_PRINCESS_ANIM_BOW, + /* 9 */ DEKU_PRINCESS_ANIM_RUN, // Unused + /* 10 */ DEKU_PRINCESS_ANIM_THINK_START, + /* 11 */ DEKU_PRINCESS_ANIM_THINK_LOOP, + /* 12 */ DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START, + /* 13 */ DEKU_PRINCESS_ANIM_ARMS_TOGETHER_LOOP, + /* 14 */ DEKU_PRINCESS_ANIM_GREETING, + /* 15 */ DEKU_PRINCESS_ANIM_IDLE, + /* 16 */ DEKU_PRINCESS_ANIM_CUTSCENE_IDLE, + /* 17 */ DEKU_PRINCESS_ANIM_UNUSED_WALK, // Unused + /* 18 */ DEKU_PRINCESS_ANIM_WALK, // Can be triggered by a cutscene, but no cutscene in the final game does so + /* 19 */ DEKU_PRINCESS_ANIM_ANGRY_START, + /* 20 */ DEKU_PRINCESS_ANIM_ANGRY_LOOP, + /* 21 */ DEKU_PRINCESS_ANIM_JUMP, + /* 22 */ DEKU_PRINCESS_ANIM_BOUNCE_START, + /* 23 */ DEKU_PRINCESS_ANIM_BOUNCE_LOOP, + /* 24 */ DEKU_PRINCESS_ANIM_GLARE_START, + /* 25 */ DEKU_PRINCESS_ANIM_GLARE_LOOP } EnDnpAnimation; static AnimationInfoS sAnimationInfo[] = { @@ -130,39 +130,40 @@ static s32 D_80B3DE58[] = { }; s32 func_80B3CA20(EnDnp* this) { - if ((this->animIndex == EN_DNP_ANIM_CUTSCENE_HURRY) || (this->animIndex == EN_DNP_ANIM_RUN)) { + if ((this->animIndex == DEKU_PRINCESS_ANIM_CUTSCENE_HURRY) || (this->animIndex == DEKU_PRINCESS_ANIM_RUN)) { if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } - } else if ((this->animIndex == EN_DNP_ANIM_GLARE_START) || (this->animIndex == EN_DNP_ANIM_TURN_AROUND)) { + } else if ((this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_TURN_AROUND)) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } - } else if (this->animIndex == EN_DNP_ANIM_GREETING) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_GREETING) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } - } else if (this->animIndex == EN_DNP_ANIM_BOW) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_BOW) { if (Animation_OnFrame(&this->skelAnime, 9.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } - } else if ((this->animIndex == EN_DNP_ANIM_UNUSED_WALK) && (this->animIndex == EN_DNP_ANIM_WALK)) { + } else if ((this->animIndex == DEKU_PRINCESS_ANIM_UNUSED_WALK) && (this->animIndex == DEKU_PRINCESS_ANIM_WALK)) { //! @bug: Impossible to reach, && should be an || if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } - } else if (this->animIndex == EN_DNP_ANIM_JUMP) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_JUMP) { if (Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } - } else if (this->animIndex == EN_DNP_ANIM_BOUNCE_LOOP) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_BOUNCE_LOOP) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } @@ -194,9 +195,9 @@ void func_80B3CC80(EnDnp* this, PlayState* play) { void func_80B3CD1C(EnDnp* this) { if ((this->unk_322 & 0x80) && (DECR(this->blinkTimer) == 0)) { this->eyeIndex++; - if (this->eyeIndex >= EN_DNP_EYE_MAX) { + if (this->eyeIndex >= DEKU_PRINCESS_EYE_MAX) { this->blinkTimer = Rand_S16Offset(30, 30); - this->eyeIndex = EN_DNP_EYE_OPEN; + this->eyeIndex = DEKU_PRINCESS_EYE_OPEN; } } } @@ -287,11 +288,11 @@ s32 func_80B3D044(EnDnp* this, PlayState* play) { void func_80B3D11C(EnDnp* this, PlayState* play) { static s32 sCsAnimations[] = { - EN_DNP_ANIM_JUMP_KICK, EN_DNP_ANIM_CUTSCENE_IDLE, EN_DNP_ANIM_GREETING, - EN_DNP_ANIM_THINK_START, EN_DNP_ANIM_WALK, EN_DNP_ANIM_ARMS_TOGETHER_START, - EN_DNP_ANIM_LAUGH_START, EN_DNP_ANIM_TURN_AROUND, EN_DNP_ANIM_CUTSCENE_HURRY, - EN_DNP_ANIM_ANGRY_START, EN_DNP_ANIM_JUMP, EN_DNP_ANIM_BOUNCE_START, - EN_DNP_ANIM_GLARE_START, EN_DNP_ANIM_BOW, + DEKU_PRINCESS_ANIM_JUMP_KICK, DEKU_PRINCESS_ANIM_CUTSCENE_IDLE, DEKU_PRINCESS_ANIM_GREETING, + DEKU_PRINCESS_ANIM_THINK_START, DEKU_PRINCESS_ANIM_WALK, DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START, + DEKU_PRINCESS_ANIM_LAUGH_START, DEKU_PRINCESS_ANIM_TURN_AROUND, DEKU_PRINCESS_ANIM_CUTSCENE_HURRY, + DEKU_PRINCESS_ANIM_ANGRY_START, DEKU_PRINCESS_ANIM_JUMP, DEKU_PRINCESS_ANIM_BOUNCE_START, + DEKU_PRINCESS_ANIM_GLARE_START, DEKU_PRINCESS_ANIM_BOW, }; s32 cueChannel; s32 cueId; @@ -306,27 +307,30 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { cueId = play->csCtx.actorCues[cueChannel]->id; if (this->cueId != (u8)cueId) { EnDnp_ChangeAnim(this, sCsAnimations[cueId]); - if (this->animIndex == EN_DNP_ANIM_CUTSCENE_IDLE) { + if (this->animIndex == DEKU_PRINCESS_ANIM_CUTSCENE_IDLE) { this->unk_322 |= 8; } else { this->unk_322 &= ~8; } - if (this->animIndex == EN_DNP_ANIM_ANGRY_START) { + if (this->animIndex == DEKU_PRINCESS_ANIM_ANGRY_START) { Actor_PlaySfx(&this->actor, NA_SE_VO_DHVO04); } - if (this->animIndex == EN_DNP_ANIM_GLARE_START) { + if (this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START) { this->unk_322 &= ~0x80; - this->eyeIndex = EN_DNP_EYE_ANGRY; + this->eyeIndex = DEKU_PRINCESS_EYE_ANGRY; this->blinkTimer = 0; } } this->cueId = cueId; - if (((this->animIndex == EN_DNP_ANIM_THINK_START) || (this->animIndex == EN_DNP_ANIM_ARMS_TOGETHER_START) || - (this->animIndex == EN_DNP_ANIM_LAUGH_START) || (this->animIndex == EN_DNP_ANIM_ANGRY_START) || - (this->animIndex == EN_DNP_ANIM_BOUNCE_START) || (this->animIndex == EN_DNP_ANIM_GLARE_START)) && + if (((this->animIndex == DEKU_PRINCESS_ANIM_THINK_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_LAUGH_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_ANGRY_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_BOUNCE_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START)) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnDnp_ChangeAnim(this, this->animIndex + 1); } @@ -401,32 +405,32 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 16.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gDekuPrincessSkel, NULL, this->jointTable, this->morphTable, DEKU_PRINCESS_LIMB_MAX); - this->animIndex = EN_DNP_ANIM_NONE; - EnDnp_ChangeAnim(this, EN_DNP_ANIM_IDLE); + this->animIndex = DEKU_PRINCESS_ANIM_NONE; + EnDnp_ChangeAnim(this, DEKU_PRINCESS_ANIM_IDLE); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->unk_322 = 0; this->actor.targetMode = 0; this->unk_322 |= (0x100 | 0x80 | 0x10); this->actor.gravity = -1.0f; - if (EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_RELEASED_FROM_BOTTLE) { + if (DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE) { this->actor.flags &= ~ACTOR_FLAG_1; - Actor_SetScale(&this->actor, 0.00085000007f); + Actor_SetScale(&this->actor, 0.85f * 0.001f); SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.csId = 16; this->actionFunc = func_80B3D47C; - } else if (((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_WOODFALL_TEMPLE) && + } else if (((DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_WOODFALL_TEMPLE) && !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) || - ((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_DEKU_KINGS_CHAMBER) && + ((DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_DEKU_KINGS_CHAMBER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20))) { Actor_SetScale(&this->actor, 0.0085f); SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_322 |= 0x400; if ((play->sceneId == SCENE_MITURIN) && CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40)) { this->unk_322 |= 0x20; - EnDnp_ChangeAnim(this, EN_DNP_ANIM_HURRY); + EnDnp_ChangeAnim(this, DEKU_PRINCESS_ANIM_HURRY); } this->actionFunc = func_80B3D2D4; } else { diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h index 9b02f19d37..4bd0fe14c1 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h @@ -8,12 +8,14 @@ struct EnDnp; typedef void (*EnDnpActionFunc)(struct EnDnp*, PlayState*); -#define EN_DNP_GET_TYPE(thisx) ((thisx)->params & 7) +#define DEKU_PRINCESS_GET_TYPE(thisx) ((thisx)->params & 7) + +#define DEKU_PRINCESS_PARAMS(type) ((type) & 7) typedef enum { - /* 0 */ EN_DNP_TYPE_WOODFALL_TEMPLE, - /* 1 */ EN_DNP_TYPE_RELEASED_FROM_BOTTLE, - /* 2 */ EN_DNP_TYPE_DEKU_KINGS_CHAMBER + /* 0 */ DEKU_PRINCESS_TYPE_WOODFALL_TEMPLE, + /* 1 */ DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE, + /* 2 */ DEKU_PRINCESS_TYPE_DEKU_KINGS_CHAMBER } EnDnpType; typedef struct EnDnp { diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index fae9fc4fcb..69773f8212 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -5,6 +5,7 @@ */ #include "z_en_dragon.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -682,7 +683,8 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { seahorsePos.y += -100.0f + BREG(33); seahorsePos.z += (Math_CosS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, - seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.csId, + seahorsePos.z, 0, this->actor.shape.rot.y, 0, + SEAHORSE_PARAMS(SEAHORSE_TYPE_1, 0, 0), this->actor.csId, this->actor.halfDaysBits, NULL)) { SET_WEEKEVENTREG(WEEKEVENTREG_13_01); switch (this->pythonIndex) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 11719bd43d..a69d30e384 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -298,7 +298,7 @@ void func_8088CC48(EnElf* this, PlayState* play) { func_8088CBAC(this, play); this->unk_25C = 0; this->disappearTimer = 240; - if ((this->fairyFlags & 0x400) && Flags_GetCollectible(play, this->unk_260)) { + if ((this->fairyFlags & 0x400) && Flags_GetCollectible(play, this->collectibleFlag)) { Actor_Kill(&this->actor); } } @@ -320,7 +320,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { EnElf* this = THIS; Player* player = GET_PLAYER(play); s32 colorConfig; - s32 params; + s32 fairyType; Actor_ProcessInitChain(thisx, sInitChain); SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, @@ -340,15 +340,15 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_240 = 0.0f; colorConfig = 0; - this->unk_260 = ENELF_GET_FE00(&this->actor); - params = ENELF_GET_F(&this->actor); - if (thisx->params & 0x100) { + this->collectibleFlag = FAIRY_GET_COLLECTIBLE_FLAG(&this->actor); + fairyType = FAIRY_GET_TYPE(&this->actor); + if (FAIRY_GET_BOOL_PARAM(thisx)) { this->fairyFlags |= 0x400; } - this->actor.params = params; - switch (params) { - case 0: + this->actor.params = fairyType; + switch (fairyType) { + case FAIRY_TYPE_0: thisx->room = -1; EnElf_SetupAction(this, func_8088E850); func_8088C51C(this, 0); @@ -364,7 +364,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_266 = QuestHint_GetTatlTextId(play); break; - case 1: + case FAIRY_TYPE_1: colorConfig = -1; gSaveContext.jinxTimer = 0; EnElf_SetupAction(this, func_8088E0F0); @@ -376,7 +376,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_250 = 0.0f; break; - case 5: + case FAIRY_TYPE_5: colorConfig = -1; EnElf_SetupAction(this, func_8088E484); this->unk_254 = 0.0f; @@ -387,7 +387,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_250 = 7.0f; break; - case 7: + case FAIRY_TYPE_7: this->fairyFlags |= 0x200; thisx->shape.shadowDraw = ActorShadow_DrawWhiteCircle; this->fairyFlags |= 0x100; @@ -397,7 +397,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 2: + case FAIRY_TYPE_2: this->fairyFlags |= 0x100; colorConfig = -1; this->fairyFlags |= 0x800; @@ -406,7 +406,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 6: + case FAIRY_TYPE_6: colorConfig = -1; this->fairyFlags |= 0x800; this->fairyFlags |= 0x2000; @@ -414,25 +414,25 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 9: + case FAIRY_TYPE_9: this->fairyFlags |= 0x1000; - case 10: + case FAIRY_TYPE_10: colorConfig = -2; func_8088CC48(this, play); break; - case 8: + case FAIRY_TYPE_8: Actor_Kill(thisx); return; - case 3: + case FAIRY_TYPE_3: colorConfig = Rand_ZeroFloat(11.99f) + 1.0f; EnElf_SetupAction(this, func_8088E018); func_8088C51C(this, 0); break; - case 4: + case FAIRY_TYPE_4: EnElf_SetupAction(this, func_8088E0E0); func_8088C51C(this, 6); this->fairyFlags |= 8; @@ -441,10 +441,13 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { for (i = 0; i < 8; i++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, thisx->world.pos.x, thisx->world.pos.y - 30.0f, - thisx->world.pos.z, 0, 0, 0, 6); + thisx->world.pos.z, 0, 0, 0, FAIRY_PARAMS(FAIRY_TYPE_6, false, 0)); } } break; + + default: + break; } this->unk_23C = 3.0f; @@ -659,7 +662,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { func_8088D9BC(this, play); if (Actor_HasParent(&this->actor, play)) { if (this->fairyFlags & 0x400) { - Flags_SetCollectible(play, this->unk_260); + Flags_SetCollectible(play, this->collectibleFlag); } Actor_Kill(&this->actor); return; @@ -689,7 +692,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { this->unk_246 = 0; EnElf_SetupAction(this, func_8088E0F0); if (this->fairyFlags & 0x400) { - Flags_SetCollectible(play, this->unk_260); + Flags_SetCollectible(play, this->collectibleFlag); } return; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index 18e444e97b..ae34be352b 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -8,8 +8,25 @@ struct EnElf; typedef void (*EnElfActionFunc)(struct EnElf*, PlayState*); typedef void (*EnElfUnkFunc)(struct EnElf*, PlayState*); -#define ENELF_GET_F(thisx) ((thisx)->params & 0xF) -#define ENELF_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define FAIRY_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define FAIRY_GET_BOOL_PARAM(thisx) ((thisx)->params & 0x100) +#define FAIRY_GET_COLLECTIBLE_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) + +#define FAIRY_PARAMS(type, boolParam, collectibleFlag) (((type) /* & 0xF */) | (((boolParam) & 0x1) << 8) | ((((collectibleFlag) & 0x7F) << 9) & 0xFE00)) + +typedef enum { + /* 0x0 */ FAIRY_TYPE_0, + /* 0x1 */ FAIRY_TYPE_1, + /* 0x2 */ FAIRY_TYPE_2, + /* 0x3 */ FAIRY_TYPE_3, + /* 0x4 */ FAIRY_TYPE_4, + /* 0x5 */ FAIRY_TYPE_5, + /* 0x6 */ FAIRY_TYPE_6, + /* 0x7 */ FAIRY_TYPE_7, + /* 0x8 */ FAIRY_TYPE_8, + /* 0x9 */ FAIRY_TYPE_9, + /* 0xA */ FAIRY_TYPE_10 +} FairyType; typedef struct EnElf { /* 0x000 */ Actor actor; @@ -39,7 +56,7 @@ typedef struct EnElf { /* 0x25A */ u16 timer; /* 0x25C */ s16 unk_25C; /* 0x25E */ s16 disappearTimer; - /* 0x260 */ s16 unk_260; + /* 0x260 */ s16 collectibleFlag; /* 0x262 */ u16 fairyFlags; /* 0x264 */ u16 unk_264; /* 0x266 */ u16 unk_266; @@ -49,15 +66,4 @@ typedef struct EnElf { /* 0x270 */ EnElfActionFunc actionFunc; } EnElf; // size = 0x274 -typedef enum { - /* 0 */ ENELF_TYPE_0, - /* 1 */ ENELF_TYPE_1, - /* 2 */ ENELF_TYPE_2, - /* 3 */ ENELF_TYPE_3, - /* 4 */ ENELF_TYPE_4, - /* 5 */ ENELF_TYPE_5, - /* 6 */ ENELF_TYPE_6, - /* 7 */ ENELF_TYPE_7 -} FairyType; - #endif // Z_EN_ELF_H diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 2a348051e1..4261a4f83e 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -14,6 +14,8 @@ typedef enum { /* 2 */ ENFISH_2 } EnFishParam; +#define FISH_PARAMS(param) (param) + typedef struct EnFish { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 2659c042ff..cb13f95042 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -2062,7 +2062,8 @@ void EnGo_Frozen(EnGo* this, PlayState* play) { Actor* actorCollidedWith = this->colliderCylinder.base.ac; if ((this->actionFlags & ENGO_FLAG_HIT_BY_OTHER) && - (((actorCollidedWith != NULL) && (actorCollidedWith->id == ACTOR_OBJ_AQUA) && AQUA_HOT(actorCollidedWith)) || + (((actorCollidedWith != NULL) && (actorCollidedWith->id == ACTOR_OBJ_AQUA) && + (AQUA_GET_TYPE(actorCollidedWith) != AQUA_TYPE_COLD)) || (this->actor.colChkInfo.damageEffect == ENGO_DMGEFF_FIRE))) { this->actionFunc = EnGo_AwaitThaw; } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 2b98ba7c61..d4ae8ed264 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -6,6 +6,7 @@ #include "z_en_gs.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "objects/object_gs/object_gs.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -282,7 +283,8 @@ void func_8099807C(EnGs* this, PlayState* play) { case OCARINA_SONG_EPONAS: if (!Flags_GetSwitch(play, this->unk_196)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 2); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, + FAIRY_PARAMS(FAIRY_TYPE_2, false, 0)); Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); Flags_SetSwitch(play, this->unk_196); } @@ -291,7 +293,8 @@ void func_8099807C(EnGs* this, PlayState* play) { case OCARINA_SONG_STORMS: if (!Flags_GetSwitch(play, this->unk_196)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 7); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, + FAIRY_PARAMS(FAIRY_TYPE_7, false, 0)); Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); Flags_SetSwitch(play, this->unk_196); } diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h index ea40254141..4e1f5b7624 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -9,6 +9,8 @@ typedef void (*EnInsectActionFunc)(struct EnInsect*, PlayState*); #define ENINSECT_GET_1(thisx) ((thisx)->params & 1) +#define ENINSECT_PARAMS(param) (param) + typedef struct EnInsect { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index cb7972f042..23e19bba2d 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -10,6 +10,7 @@ #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_ishi/object_ishi.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000) @@ -353,8 +354,9 @@ void func_8095E204(EnIshi* this, PlayState* play) { for (i = 0; i < 3; i++) { if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.csId, this->actor.halfDaysBits, NULL) == NULL) { + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + ENINSECT_PARAMS(true), this->actor.csId, this->actor.halfDaysBits, + NULL) == NULL) { break; } } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 16ce971535..39e092e2fb 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -9,6 +9,7 @@ #include "objects/object_kusa/object_kusa.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000) @@ -251,8 +252,8 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { } } else if (KUSA_GET_TYPE(&this->actor) == ENKUSA_TYPE_REGROWING_GRASS) { Item_DropCollectible(play, &this->actor.world.pos, 3); - } else { - collectible = func_800A8150(KUSA_GET_PARAM_3F(&this->actor)); + } else { // ENKUSA_TYPE_GRASS_2 + collectible = func_800A8150(KUSA_GET_PARAM_FC(&this->actor)); if (collectible >= 0) { collectableParams = KUSA_GET_COLLECTIBLE_ID(&this->actor); Item_DropCollectible(play, &this->actor.world.pos, (collectableParams << 8) | collectible); @@ -327,9 +328,9 @@ void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { u32 numBugs; for (numBugs = 0; numBugs < 3; numBugs++) { - Actor* bug = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.csId, this->actor.halfDaysBits, 0); + Actor* bug = Actor_SpawnAsChildAndCutscene( + &play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINSECT_PARAMS(true), this->actor.csId, this->actor.halfDaysBits, 0); if (bug == NULL) { break; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index b231f3e0e1..1871b1dbe1 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -7,6 +7,19 @@ struct EnKusa; typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); +#define KUSA_GET_TYPE(thisx)((thisx)->params & 0x3) + +// `ENKUSA_TYPE_BUSH` and `ENKUSA_TYPE_GRASS` +#define KUSA_GET_RAND_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0xF) +#define KUSA_GET_PARAM_0C(thisx) (((thisx)->params >> 12) & 1) + +// `ENKUSA_TYPE_REGROWING_GRASS`, `ENKUSA_TYPE_BUSH` and `ENKUSA_TYPE_GRASS` +#define KUSA_SHOULD_SPAWN_BUGS(thisx) (((thisx)->params >> 4) & 1) + +// `ENKUSA_TYPE_GRASS_2` +#define KUSA_GET_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0x7F) +#define KUSA_GET_PARAM_FC(thisx) (((thisx)->params >> 2) & 0x3F) + typedef enum { /* 0 */ ENKUSA_TYPE_BUSH, /* 1 */ ENKUSA_TYPE_REGROWING_GRASS, @@ -14,6 +27,19 @@ typedef enum { /* 3 */ ENKUSA_TYPE_GRASS_2 } EnKusaType; +#define KUSA_BUSH_PARAMS(spawnBugs, randCollectibleId, param0C) \ + ((ENKUSA_TYPE_BUSH & 0x3) | (((spawnBugs) & 1) << 4) | (((randCollectibleId) & 0xF) << 8) | (((param0C) & 1) << 12)) + +#define KUSA_REGROWING_GRASS_PARAMS(spawnBugs) \ + ((ENKUSA_TYPE_REGROWING_GRASS & 0x3) | (((spawnBugs) & 1) << 4)) + +#define KUSA_GRASS_PARAMS(spawnBugs, randCollectibleId, param0C) \ + ((ENKUSA_TYPE_GRASS & 0x3) | (((spawnBugs) & 1) << 4) | (((randCollectibleId) & 0xF) << 8) | (((param0C) & 1) << 12)) + +#define KUSA_GRASS_2_PARAMS(paramFC, collectibleId) \ + ((ENKUSA_TYPE_GRASS_2 & 0x3) | (((paramFC) & 0x3F) << 2) | (((collectibleId) & 0x7F) << 8)) + + typedef struct EnKusa { /* 0x000 */ Actor actor; /* 0x144 */ EnKusaActionFunc actionFunc; @@ -25,13 +51,4 @@ typedef struct EnKusa { /* 0x198 */ u8 isInWater; } EnKusa; // size = 0x19C -#define KUSA_GET_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0x7F) -#define KUSA_GET_RAND_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0xF) -#define KUSA_SHOULD_SPAWN_BUGS(thisx) (((thisx)->params >> 0x4) & 1) -#define KUSA_GET_PARAM_0C(thisx) (((thisx)->params >> 0xC) & 0x1) -#define KUSA_GET_PARAM_3F(thisx) (((thisx)->params >> 0x2) & 0x3F) - - -#define KUSA_GET_TYPE(thisx)((thisx)->params & 0x3) - #endif // Z_EN_KUSA_H diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 98b01d728e..e7f14e8a8c 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -103,7 +103,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 20, ICHAIN_STOP), }; -static f32 D_80A6BA14[] = { 0.06f, 0.1f, 0.13f }; +f32 D_80A6BA14[] = { + 0.06f, // ENMUSHI2_0 + 0.1f, // ENMUSHI2_1 + 0.13f, // ENMUSHI2_2 +}; void func_80A687A0(EnMushi2* this) { MtxF* matrix = Matrix_GetCurrent(); @@ -743,7 +747,7 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) { s32 sp3C; Actor_ProcessInitChain(&this->actor, sInitChain); - if (!ENMUSHI2_GET_3(&this->actor)) { + if (ENMUSHI2_GET_3(&this->actor) == ENMUSHI2_0) { func_80A68A78(this, play); } this->actor.shape.rot.y += Rand_S16Offset(-2000, 4000); @@ -759,7 +763,8 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = 30; sp3C = func_80A69EE4(this, play); - if ((sp3C == 0) && func_80A68860(this, play) && func_80A68910(this, play) && !ENMUSHI2_GET_3(&this->actor)) { + if ((sp3C == 0) && func_80A68860(this, play) && func_80A68910(this, play) && + (ENMUSHI2_GET_3(&this->actor) == ENMUSHI2_0)) { func_80A6A024(this); } diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h index 1a776a52ad..e0c381133c 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h @@ -9,6 +9,14 @@ typedef void (*EnMushi2ActionFunc)(struct EnMushi2*, PlayState*); #define ENMUSHI2_GET_3(thisx) ((thisx)->params & 3) +#define ENMUSHI2_PARAMS(param) ((param) & 3) + +typedef enum { + /* 0 */ ENMUSHI2_0, + /* 1 */ ENMUSHI2_1, + /* 2 */ ENMUSHI2_2 +} EnMush2Param; + typedef struct { /* 0x0 */ s16 unk_00; /* 0x2 */ s16 unk_02; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index ab2e30cee1..48e3c3c031 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -106,9 +106,9 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 params, Vec3f* vec, s32* index) { +void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 pathIndex, Vec3f* vec, s32* index) { s32 i; - Path* path = &play->setupPathList[params]; + Path* path = &play->setupPathList[pathIndex]; f32 dist; Vec3f sp58; Vec3f sp4C; @@ -117,7 +117,7 @@ void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 params, Vec3f* vec, s32* ind for (i = 0; i < path->count; i++) { Math_Vec3s_ToVec3f(&sp58, &((Vec3s*)Lib_SegmentedToVirtual(path->points))[i]); dist = Math_Vec3f_DistXYZ(pos, &sp58); - if (dist < minDist) { + if (minDist > dist) { minDist = dist; Math_Vec3f_Copy(&sp4C, &sp58); *index = i; @@ -137,8 +137,8 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); this->unk_388 = 0; - this->unk_33C = ENOT_GET_C000(&this->actor); - if (this->unk_33C == 0) { + this->type = SEAHORSE_GET_TYPE(&this->actor); + if (this->type == SEAHORSE_TYPE_0) { D_80B5E880 = this; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -155,7 +155,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Animation_GetLastFrame(&sAnimations[0].animation->common) * Rand_ZeroOne(), Animation_GetLastFrame(&sAnimations[0].animation->common), sAnimations[0].mode, sAnimations[0].morphFrames); - this->unk_346 = ENOT_GET_7F(&this->actor); + this->pathIndex = SEAHORSE_GET_PATH_INDEX(&this->actor); this->unk_344 = this->actor.world.rot.z; this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; @@ -169,10 +169,10 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->unk_744.g = 200; this->unk_744.b = 80; - switch (ENOT_GET_C000(&this->actor)) { - case 1: + switch (SEAHORSE_GET_TYPE(&this->actor)) { + case SEAHORSE_TYPE_1: D_80B5E884 = this; - Actor_SetScale(&this->actor, 0.012999999f); + Actor_SetScale(&this->actor, 1.3f * 0.01f); switch (this->unk_344) { case 0: @@ -185,7 +185,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Sum(&this->actor.world.pos, &sp64, &sp64); this->unk_360 = (EnOt*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, sp64.x, sp64.y, sp64.z, 0, BINANG_ROT180(this->actor.shape.rot.y), 1, - ENOT_GET_3FFF(&this->actor) | 0x8000); + SEAHORSE_PARAMS_PARTNER(&this->actor, SEAHORSE_TYPE_2)); if (this->unk_360 != NULL) { this->unk_360->unk_360 = this; this->unk_3A0 = 0; @@ -223,7 +223,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { } break; - case 2: + case SEAHORSE_TYPE_2: D_80B5E888 = this; switch (this->unk_344) { @@ -248,7 +248,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { break; case 1: - Actor_SetScale(&this->actor, 0.012999999f); + Actor_SetScale(&this->actor, 1.3f * 0.01f); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_01)) { func_80B5C244(this, play); @@ -262,7 +262,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { } break; - case 3: + case SEAHORSE_TYPE_3: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -276,6 +276,9 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } break; + + default: + break; } } @@ -407,7 +410,7 @@ void func_80B5C25C(EnOt* this, PlayState* play) { this->unk_32C |= 0x80; } - if ((this->unk_33C == 2) && (this->unk_32C & 0x80) && (this->unk_360->unk_32C & 0x80)) { + if ((this->type == SEAHORSE_TYPE_2) && (this->unk_32C & 0x80) && (this->unk_360->unk_32C & 0x80)) { this->unk_32C |= 0x100; this->unk_360->unk_32C |= 0x100; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 2, &this->animIndex); @@ -501,7 +504,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { sp3E = Actor_WorldYawTowardPoint(&player->actor, &this->unk_394); Matrix_RotateYS(BINANG_ADD(sp3E, 0x4000), MTXMODE_NEW); - if (this->unk_33C == 2) { + if (this->type == SEAHORSE_TYPE_2) { Matrix_MultVecZ(26.259998f, &sp30); } else { if (this->unk_73C == 0) { @@ -527,7 +530,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_348.x, 1.0f, 2.0f, 0.01f); Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_348.z, 1.0f, 2.0f, 0.01f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (this->unk_33C == 1)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (this->type == SEAHORSE_TYPE_1)) { this->actor.textId = 0; this->unk_384 = 1; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -581,9 +584,9 @@ void func_80B5C9D0(EnOt* this, PlayState* play) { } void func_80B5CA30(EnOt* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); + Math_SmoothStepToF(&this->actor.scale.x, 1.3f * 0.01f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); - if (this->actor.scale.x == 0.012999999f) { + if (this->actor.scale.x == 1.3f * 0.01f) { this->unk_360->unk_32C |= 0x1000; this->unk_360->unk_360 = this; func_80B5C9A8(this, play); @@ -596,9 +599,9 @@ void func_80B5CAD0(EnOt* this, PlayState* play) { } void func_80B5CB0C(EnOt* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); + Math_SmoothStepToF(&this->actor.scale.x, 1.3f * 0.01f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); - if (this->actor.scale.x == 0.012999999f) { + if (this->actor.scale.x == 1.3f * 0.01f) { this->unk_32C |= 0x800; func_80B5CE6C(this, play); } @@ -708,7 +711,7 @@ void func_80B5CEC8(EnOt* this, PlayState* play) { } } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (ENOT_GET_C000(&this->actor) == 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (SEAHORSE_GET_TYPE(&this->actor) == 1)) { if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.playerHeightRel) <= 130.0f)) { player->unk_B2B = 29; } @@ -753,14 +756,14 @@ void func_80B5D160(EnOt* this, PlayState* play) { if (temp == 0) { switch (this->unk_384) { case 0: - if ((this->unk_33C != 1) && (this->unk_33C == 2)) { + if ((this->type != SEAHORSE_TYPE_1) && (this->type == SEAHORSE_TYPE_2)) { if (this->unk_32C & 1) { if (this->unk_32C & 4) { phi_a1 = 0x106A; } else { phi_a1 = 0x1069; } - } else if (Flags_GetSwitch(play, ENOT_GET_3F80(&this->actor))) { + } else if (Flags_GetSwitch(play, SEAHORSE_GET_SWITCH_FLAG(&this->actor))) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_10)) { phi_a1 = 0x106C; } else { @@ -883,10 +886,10 @@ s32 EnOt_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) } void func_80B5D648(EnOt* this, PlayState* play) { - func_80B5B2E0(play, &this->actor.world.pos, this->unk_346, &this->unk_348, &this->unk_340); + func_80B5B2E0(play, &this->actor.world.pos, this->pathIndex, &this->unk_348, &this->unk_340); Math_Vec3f_Copy(&this->unk_330, &this->actor.world.pos); - SubS_ActorPathing_Init(play, &this->unk_330, &this->actor, &this->actorPath, play->setupPathList, this->unk_346, 0, - 0, this->unk_340, 0); + SubS_ActorPathing_Init(play, &this->unk_330, &this->actor, &this->actorPath, play->setupPathList, this->pathIndex, + 0, 0, this->unk_340, 0); this->unk_32C = 0; this->actorPath.pointOffset.x = 0.0f; this->actorPath.pointOffset.y = 0.0f; @@ -896,7 +899,7 @@ void func_80B5D648(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - Flags_SetSwitch(play, ENOT_GET_3F80(&this->actor)); + Flags_SetSwitch(play, SEAHORSE_GET_SWITCH_FLAG(&this->actor)); this->actionFunc = func_80B5D750; } @@ -996,10 +999,11 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_04)) { Vec3f sp50; - func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); + func_80B5B2E0(play, &this->actor.world.pos, SEAHORSE_GET_PATH_INDEX(&this->actor), &sp50, &this->unk_340); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, - this->actor.shape.rot.y, 1, ENOT_GET_3FFF(&this->actor) | 0x8000, - this->actor.csId, this->actor.halfDaysBits, NULL) != NULL) { + this->actor.shape.rot.y, 1, + SEAHORSE_PARAMS_PARTNER(&this->actor, SEAHORSE_TYPE_2), this->actor.csId, + this->actor.halfDaysBits, NULL) != NULL) { this->unk_32C |= 8; } } else if (D_80B5E888 != NULL) { @@ -1015,7 +1019,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { EnOt* temp = D_80B5E888; temp->unk_32C |= 8; - temp->unk_346 = ENOT_GET_7F(&this->actor); + temp->pathIndex = SEAHORSE_GET_PATH_INDEX(&this->actor); temp->actor.params = this->actor.params; temp->actor.csId = this->actor.csId; this->unk_32C |= 8; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.h b/src/overlays/actors/ovl_En_Ot/z_en_ot.h index 8b01c66548..aa90ffa0b0 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -7,10 +7,19 @@ struct EnOt; typedef void (*EnOtActionFunc)(struct EnOt*, PlayState*); -#define ENOT_GET_7F(thisx) ((thisx)->params & 0x7F) -#define ENOT_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) -#define ENOT_GET_3FFF(thisx) ((thisx)->params & 0x3FFF) -#define ENOT_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) +#define SEAHORSE_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) +#define SEAHORSE_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 7) & 0x7F) +#define SEAHORSE_GET_TYPE(thisx) (((thisx)->params >> 0xE) & 3) + +#define SEAHORSE_PARAMS(type, pathIndex, switchFlag) (((pathIndex) & 0x7F) | (((switchFlag) & 0x7F) << 7) | (((type) & 3) << 0xE)) +#define SEAHORSE_PARAMS_PARTNER(thisx, type) (((thisx)->params & 0x3FFF) | (((type) & 3) << 0xE)) + +typedef enum SeahorseType { + /* 0 */ SEAHORSE_TYPE_0, + /* 1 */ SEAHORSE_TYPE_1, + /* 2 */ SEAHORSE_TYPE_2, + /* 3 */ SEAHORSE_TYPE_3 +} SeahorseType; typedef struct { /* 0x00 */ u8 unk_00; @@ -39,10 +48,10 @@ typedef struct EnOt { /* 0x2C0 */ ActorPathing actorPath; /* 0x32C */ u16 unk_32C; /* 0x330 */ Vec3f unk_330; - /* 0x33C */ s32 unk_33C; + /* 0x33C */ s32 type; /* 0x340 */ s32 unk_340; /* 0x344 */ s16 unk_344; - /* 0x346 */ s16 unk_346; + /* 0x346 */ s16 pathIndex; /* 0x348 */ Vec3f unk_348; /* 0x354 */ s16 unk_354; /* 0x356 */ s16 csIdList[4]; diff --git a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c index 2cc547e9aa..9a4b0f2d7e 100644 --- a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c +++ b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c @@ -5,6 +5,7 @@ */ #include "z_en_tag_obj.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #define FLAGS 0x00000000 @@ -60,7 +61,7 @@ void EnTagObj_Update(Actor* thisx, PlayState* play) { if (!this->hasSpawnedSeahorse) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, 0); + this->actor.world.pos.z, 0, 0, 0, SEAHORSE_PARAMS(SEAHORSE_TYPE_0, 0, 0)); this->hasSpawnedSeahorse = true; } } diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.h b/src/overlays/actors/ovl_En_Test5/z_en_test5.h index 8d0c477848..7a4b656b50 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.h +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.h @@ -5,6 +5,8 @@ #define ENTEST5_IS_HOT_SPRING(thisx) ((thisx)->params != 0) +#define ENTEST5_PARAMS(isHotSpringWater) (isHotSpringWater) + struct EnTest5; // SpringWaterModifier typedef void (*EnTest5ActionFunc)(struct EnTest5*, PlayState*); diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index e45026d5b9..632292857f 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -98,15 +98,15 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -10.0f; this->actor.gravity = -5.0f; - switch (ENZORAEGG_GET_1F(&this->actor)) { - case ENZORAEGG_1F_00: - if (Flags_GetSwitch(play, ENZORAEGG_GET_FE00(&this->actor))) { + switch (ZORA_EGG_GET_TYPE(&this->actor)) { + case ZORA_EGG_TYPE_00: + if (Flags_GetSwitch(play, ZORA_EGG_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } break; - case ENZORAEGG_1F_11: + case ZORA_EGG_TYPE_11: if (func_80B319A8(play) >= 7) { Actor_Kill(&this->actor); this->actor.home.rot.z = 1; @@ -114,26 +114,26 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { } break; - case ENZORAEGG_1F_03: - case ENZORAEGG_1F_04: - case ENZORAEGG_1F_05: - case ENZORAEGG_1F_06: - case ENZORAEGG_1F_07: - case ENZORAEGG_1F_08: - case ENZORAEGG_1F_09: + case ZORA_EGG_TYPE_03: + case ZORA_EGG_TYPE_04: + case ZORA_EGG_TYPE_05: + case ZORA_EGG_TYPE_06: + case ZORA_EGG_TYPE_07: + case ZORA_EGG_TYPE_08: + case ZORA_EGG_TYPE_09: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; } break; - case ENZORAEGG_1F_0A: - case ENZORAEGG_1F_0B: - case ENZORAEGG_1F_0C: - case ENZORAEGG_1F_0D: - case ENZORAEGG_1F_0E: - case ENZORAEGG_1F_0F: - case ENZORAEGG_1F_10: + case ZORA_EGG_TYPE_0A: + case ZORA_EGG_TYPE_0B: + case ZORA_EGG_TYPE_0C: + case ZORA_EGG_TYPE_0D: + case ZORA_EGG_TYPE_0E: + case ZORA_EGG_TYPE_0F: + case ZORA_EGG_TYPE_10: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; @@ -141,50 +141,50 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { break; } - switch (ENZORAEGG_GET_1F(&this->actor)) { - case ENZORAEGG_1F_00: + switch (ZORA_EGG_GET_TYPE(&this->actor)) { + case ZORA_EGG_TYPE_00: this->actionFunc = func_80B320E0; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.targetMode = 3; break; - case ENZORAEGG_1F_01: + case ZORA_EGG_TYPE_01: this->actionFunc = func_80B322BC; func_80B31590(this); break; - case ENZORAEGG_1F_02: + case ZORA_EGG_TYPE_02: this->actionFunc = func_80B32390; func_80B31590(this); break; - case ENZORAEGG_1F_03: - case ENZORAEGG_1F_04: - case ENZORAEGG_1F_05: - case ENZORAEGG_1F_06: - case ENZORAEGG_1F_07: - case ENZORAEGG_1F_08: - case ENZORAEGG_1F_09: - this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03]; + case ZORA_EGG_TYPE_03: + case ZORA_EGG_TYPE_04: + case ZORA_EGG_TYPE_05: + case ZORA_EGG_TYPE_06: + case ZORA_EGG_TYPE_07: + case ZORA_EGG_TYPE_08: + case ZORA_EGG_TYPE_09: + this->cueType = cueTypes[ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_03]; Animation_PlayOnce(&this->skelAnime, &object_zoraegg_Anim_001E08); this->unk_1EC = 1; this->unk_1EE = 0; this->unk_1EF = 0; this->actionFunc = func_80B32B10; - if (((ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03) >= func_80B319A8(play)) { + if ((ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_03) >= func_80B319A8(play)) { this->actionFunc = func_80B32B3C; this->actor.draw = NULL; } break; - case ENZORAEGG_1F_0A: - case ENZORAEGG_1F_0B: - case ENZORAEGG_1F_0C: - case ENZORAEGG_1F_0D: - case ENZORAEGG_1F_0E: - case ENZORAEGG_1F_0F: - case ENZORAEGG_1F_10: - this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_0A]; + case ZORA_EGG_TYPE_0A: + case ZORA_EGG_TYPE_0B: + case ZORA_EGG_TYPE_0C: + case ZORA_EGG_TYPE_0D: + case ZORA_EGG_TYPE_0E: + case ZORA_EGG_TYPE_0F: + case ZORA_EGG_TYPE_10: + this->cueType = cueTypes[ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_0A]; this->unk_1EC = 2; this->actionFunc = func_80B324B0; Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); @@ -193,7 +193,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { this->unk_1EA |= 3; break; - case ENZORAEGG_1F_11: + case ZORA_EGG_TYPE_11: Actor_SetScale(&this->actor, 0.0006f); this->actionFunc = func_80B32D08; this->actor.world.pos.y -= this->actor.shape.yOffset * this->actor.scale.y; @@ -254,7 +254,7 @@ Actor* func_80B31CB4(PlayState* play) { Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { - if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_11) && + if ((actor->id == ACTOR_EN_ZORAEGG) && (ZORA_EGG_GET_TYPE(actor) == ZORA_EGG_TYPE_11) && (actor->home.rot.z == 0)) { actor->home.rot.z = 1; return actor; @@ -268,7 +268,7 @@ Actor* func_80B31D14(PlayState* play) { Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { - if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_03)) { + if ((actor->id == ACTOR_EN_ZORAEGG) && (ZORA_EGG_GET_TYPE(actor) == ZORA_EGG_TYPE_03)) { return actor; } actor = actor->next; @@ -337,7 +337,7 @@ void func_80B32094(EnZoraegg* this, PlayState* play) { void func_80B320E0(EnZoraegg* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - Flags_SetSwitch(play, ENZORAEGG_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ZORA_EGG_GET_SWITCH_FLAG(&this->actor)); Actor_Kill(&this->actor); } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B32094; diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h index f8895af3ff..84fce59dfc 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h @@ -7,37 +7,39 @@ struct EnZoraegg; typedef void (*EnZoraeggActionFunc)(struct EnZoraegg*, PlayState*); -#define ENZORAEGG_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENZORAEGG_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define ZORA_EGG_GET_TYPE(thisx) ((thisx)->params & 0x1F) +#define ZORA_EGG_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) + +#define ZORA_EGG_PARAMS(type, switchFlag) (((type) & 0x1F) | (((switchFlag) & 0x7F) << 9)) typedef enum { - /* 0x00 */ ENZORAEGG_1F_00, - /* 0x01 */ ENZORAEGG_1F_01, - /* 0x02 */ ENZORAEGG_1F_02, - /* 0x03 */ ENZORAEGG_1F_03, - /* 0x04 */ ENZORAEGG_1F_04, - /* 0x05 */ ENZORAEGG_1F_05, - /* 0x06 */ ENZORAEGG_1F_06, - /* 0x07 */ ENZORAEGG_1F_07, - /* 0x08 */ ENZORAEGG_1F_08, - /* 0x09 */ ENZORAEGG_1F_09, - /* 0x0A */ ENZORAEGG_1F_0A, - /* 0x0B */ ENZORAEGG_1F_0B, - /* 0x0C */ ENZORAEGG_1F_0C, - /* 0x0D */ ENZORAEGG_1F_0D, - /* 0x0E */ ENZORAEGG_1F_0E, - /* 0x0F */ ENZORAEGG_1F_0F, - /* 0x10 */ ENZORAEGG_1F_10, - /* 0x11 */ ENZORAEGG_1F_11, - /* 0x12 */ ENZORAEGG_1F_12, - /* 0x13 */ ENZORAEGG_1F_13, - /* 0x14 */ ENZORAEGG_1F_14, - /* 0x15 */ ENZORAEGG_1F_15, - /* 0x16 */ ENZORAEGG_1F_16, - /* 0x17 */ ENZORAEGG_1F_17, - /* 0x18 */ ENZORAEGG_1F_18, - /* 0x19 */ ENZORAEGG_1F_19 -} EnZoraeggParam; + /* 0x00 */ ZORA_EGG_TYPE_00, + /* 0x01 */ ZORA_EGG_TYPE_01, + /* 0x02 */ ZORA_EGG_TYPE_02, + /* 0x03 */ ZORA_EGG_TYPE_03, + /* 0x04 */ ZORA_EGG_TYPE_04, + /* 0x05 */ ZORA_EGG_TYPE_05, + /* 0x06 */ ZORA_EGG_TYPE_06, + /* 0x07 */ ZORA_EGG_TYPE_07, + /* 0x08 */ ZORA_EGG_TYPE_08, + /* 0x09 */ ZORA_EGG_TYPE_09, + /* 0x0A */ ZORA_EGG_TYPE_0A, + /* 0x0B */ ZORA_EGG_TYPE_0B, + /* 0x0C */ ZORA_EGG_TYPE_0C, + /* 0x0D */ ZORA_EGG_TYPE_0D, + /* 0x0E */ ZORA_EGG_TYPE_0E, + /* 0x0F */ ZORA_EGG_TYPE_0F, + /* 0x10 */ ZORA_EGG_TYPE_10, + /* 0x11 */ ZORA_EGG_TYPE_11, + /* 0x12 */ ZORA_EGG_TYPE_12, + /* 0x13 */ ZORA_EGG_TYPE_13, + /* 0x14 */ ZORA_EGG_TYPE_14, + /* 0x15 */ ZORA_EGG_TYPE_15, + /* 0x16 */ ZORA_EGG_TYPE_16, + /* 0x17 */ ZORA_EGG_TYPE_17, + /* 0x18 */ ZORA_EGG_TYPE_18, + /* 0x19 */ ZORA_EGG_TYPE_19 +} ZoraEggType; typedef struct EnZoraegg { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index ca4efd4bbb..7324448a44 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -199,7 +199,7 @@ void func_80ACBD34(ObjAqua* this) { } void func_80ACBD48(ObjAqua* this, PlayState* play) { - if ((AQUA_HOT(&this->actor) == 1) && (this->alpha > 90)) { + if ((AQUA_GET_TYPE(&this->actor) == AQUA_TYPE_HOT) && (this->alpha > 90)) { func_80ACB940(this, play); } if (this->alpha > 5) { @@ -228,7 +228,7 @@ void func_80ACBDFC(ObjAqua* this, PlayState* play) { this->alpha = (s32)(temp * 3.25f) + 10; this->actor.shape.shadowAlpha = this->alpha; this->unk_198 += 1000; - if (AQUA_HOT(&this->actor) == 1) { + if (AQUA_GET_TYPE(&this->actor) == AQUA_TYPE_HOT) { f32 temp_f2 = this->actor.scale.x * 10000.0f; EffectSsBubble_Spawn(play, &this->actor.world.pos, temp_f2 * -0.5f, temp_f2, temp_f2, diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h index a47ea661aa..12dcedc1c8 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h @@ -3,8 +3,14 @@ #include "global.h" -#define AQUA_HOT(thisx) ((thisx)->params & 1) -#define OBJAQUA_1 1 +#define AQUA_GET_TYPE(thisx) ((thisx)->params & 1) + +#define AQUA_PARAMS(type) ((type) & 1) + +typedef enum { + /* 0 */ AQUA_TYPE_COLD, + /* 1 */ AQUA_TYPE_HOT +} AquaType; struct ObjAqua; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index d1601e69d8..9b3a08bda3 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -193,13 +193,13 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { ((this->colliders2[0].base.ac->id != ACTOR_OBJ_AQUA) && (this->colliders2[0].info.acHitInfo->toucher.dmgFlags == 0x800)) || ((this->colliders2[0].base.ac->id == ACTOR_OBJ_AQUA) && - (this->colliders2[0].base.ac->params == OBJAQUA_1)))) || + (this->colliders2[0].base.ac->params == AQUA_TYPE_HOT)))) || ((this->colliders2[1].base.acFlags & AC_HIT) && ((this->colliders2[1].base.ac == NULL) || ((this->colliders2[1].base.ac->id != ACTOR_OBJ_AQUA) && (this->colliders2[1].info.acHitInfo->toucher.dmgFlags == 0x800)) || ((this->colliders2[1].base.ac->id == ACTOR_OBJ_AQUA) && - (this->colliders2[1].base.ac->params == OBJAQUA_1))))) { + (this->colliders2[1].base.ac->params == AQUA_TYPE_HOT))))) { CutsceneManager_Queue(this->actor.csId); this->unk_14A = 0; this->actionFunc = func_80931E58; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index f63201966d..49a0bb656e 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -5,6 +5,10 @@ */ #include "z_obj_mure.h" +#include "overlays/actors/ovl_En_Butte/z_en_butte.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" +#include "overlays/actors/ovl_En_Kusa/z_en_kusa.h" #define FLAGS 0x00000000 @@ -32,8 +36,12 @@ ActorInit Obj_Mure_InitVars = { (ActorFunc)NULL, }; -static f32 sZClip[] = { - 1600.0f, 1600.0f, 1000.0f, 1000.0f, 1000.0f, +static f32 sZClip[OBJMURE_TYPE_MAX] = { + 1600.0f, // OBJMURE_TYPE_GRASS + 1600.0f, // OBJMURE_TYPE_UNDEFINED + 1000.0f, // OBJMURE_TYPE_FISH + 1000.0f, // OBJMURE_TYPE_BUGS + 1000.0f, // OBJMURE_TYPE_BUTTERFLY }; static s32 sMaxChildSpawns[] = { @@ -43,12 +51,20 @@ static s32 sMaxChildSpawns[] = { 0, }; -static s16 sSpawnActorIds[] = { - ACTOR_EN_KUSA, 0, ACTOR_EN_FISH, ACTOR_EN_INSECT, ACTOR_EN_BUTTE, +static s16 sSpawnActorIds[OBJMURE_TYPE_MAX] = { + ACTOR_EN_KUSA, // OBJMURE_TYPE_GRASS + ACTOR_PLAYER, // OBJMURE_TYPE_UNDEFINED + ACTOR_EN_FISH, // OBJMURE_TYPE_FISH + ACTOR_EN_INSECT, // OBJMURE_TYPE_BUGS + ACTOR_EN_BUTTE, // OBJMURE_TYPE_BUTTERFLY }; -static s16 sSpawnParams[] = { - 0, 2, -1, 0, -1, +static s16 sSpawnParams[OBJMURE_TYPE_MAX] = { + KUSA_BUSH_PARAMS(false, 0, false), // OBJMURE_TYPE_GRASS + PLAYER_PARAMS(2, PLAYER_INITMODE_0), // OBJMURE_TYPE_UNDEFINED + FISH_PARAMS(ENFISH_MINUS1), // OBJMURE_TYPE_FISH + ENINSECT_PARAMS(false), // OBJMURE_TYPE_BUGS + BUTTERFLY_PARAMS(BUTTERFLY_MINUS1), // OBJMURE_TYPE_BUTTERFLY }; static InitChainEntry sInitChain[] = { @@ -57,15 +73,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -typedef enum { - /* 0 */ OBJMURE_TYPE_GRASS, - /* 1 */ OBJMURE_TYPE_UNDEFINED, - /* 2 */ OBJMURE_TYPE_FISH, - /* 3 */ OBJMURE_TYPE_BUGS, - /* 4 */ OBJMURE_TYPE_BUTTERFLY, - /* 5 */ OBJMURE_TYPE_MAX -} ObjMureType; - typedef enum { /* 0 */ OBJMURE_CHILD_STATE_0, /* 1 */ OBJMURE_CHILD_STATE_DEAD, diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h index 7bf2d40b76..57a099dc1c 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -7,6 +7,20 @@ struct ObjMure; typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); +#define OBJ_MURE_GET_CHNUM(thisx) (((thisx)->params >> 12) & 0xF) +#define OBJ_MURE_GET_PTN(thisx) (((thisx)->params >> 8) & 0x7) +#define OBJ_MURE_GET_SVNUM(thisx) (((thisx)->params >> 5) & 0x3) +#define OBJ_MURE_GET_TYPE(thisx) ((thisx)->params & 0x1F) + +typedef enum { + /* 0 */ OBJMURE_TYPE_GRASS, + /* 1 */ OBJMURE_TYPE_UNDEFINED, + /* 2 */ OBJMURE_TYPE_FISH, + /* 3 */ OBJMURE_TYPE_BUGS, + /* 4 */ OBJMURE_TYPE_BUTTERFLY, + /* 5 */ OBJMURE_TYPE_MAX +} ObjMureType; + #define OBJMURE_MAX_SPAWNS 15 typedef struct { @@ -29,9 +43,4 @@ typedef struct ObjMure { /* 0x1A0 */ s16 unk_1A0; } ObjMure; // size = 0x1A4 -#define OBJ_MURE_GET_CHNUM(thisx) (((thisx)->params >> 12) & 0xF) -#define OBJ_MURE_GET_PTN(thisx) (((thisx)->params >> 8) & 0x7) -#define OBJ_MURE_GET_SVNUM(thisx) (((thisx)->params >> 5) & 0x3) -#define OBJ_MURE_GET_TYPE(thisx) ((thisx)->params & 0x1F) - #endif // Z_OBJ_MURE_H diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 815b21b9bd..491dee5457 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -90,14 +90,18 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play2) { CutsceneManager_Stop(this->actor.csId); switch (params) { case SHOTSUN_FAIRY_SPAWNER_SUNS: - fairyType = ENELF_TYPE_7; + fairyType = FAIRY_TYPE_7; break; + case SHOTSUN_FAIRY_SPAWNER_STORMS: - fairyType = ENELF_TYPE_7; + fairyType = FAIRY_TYPE_7; + break; + + default: break; } Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, fairyType); + this->actor.home.pos.z, 0, 0, 0, FAIRY_PARAMS(fairyType, false, 0)); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 27192e894d..20d16f8174 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4,6 +4,7 @@ * Description: Player */ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64horse.h" #include "z64quake.h" @@ -17,12 +18,20 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Boom/z_en_boom.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" +#include "overlays/actors/ovl_En_Dnp/z_en_dnp.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Ishi/z_en_ishi.h" +#include "overlays/actors/ovl_En_Mushi2/z_en_mushi2.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #include "overlays/actors/ovl_En_Test3/z_en_test3.h" +#include "overlays/actors/ovl_En_Test5/z_en_test5.h" #include "overlays/actors/ovl_En_Test7/z_en_test7.h" #include "overlays/actors/ovl_En_Torch2/z_en_torch2.h" +#include "overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h" +#include "overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h" #include "overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h" @@ -5910,12 +5919,12 @@ void func_80835BF8(Vec3f* srcPos, s16 rotY, f32 radius, Vec3f* dstPos) { dstPos->z = Math_CosS(rotY) * radius + srcPos->z; } -Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* translation, Vec3f* arg3, s32 elfParams) { - Vec3f pos; +Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* translation, Vec3f* pos, s32 fairyParams) { + Vec3f spawnPos; - Player_TranslateAndRotateY(this, translation, arg3, &pos); + Player_TranslateAndRotateY(this, translation, pos, &spawnPos); - return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, elfParams); + return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, fairyParams); } f32 func_80835CD8(PlayState* play, Player* this, Vec3f* arg2, Vec3f* pos, CollisionPoly** outPoly, s32* outBgId) { @@ -9916,7 +9925,7 @@ void func_80840770(PlayState* play, Player* this) { Player_StopCutscene(this); this->csId = play->playerCsIds[PLAYER_CS_ID_REVIVE]; this->unk_AE8 = 60; - Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D2A4, 5); + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D2A4, FAIRY_PARAMS(FAIRY_TYPE_5, false, 0)); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { play->gameOverCtx.state = GAMEOVER_DEATH_FADE_OUT; @@ -10533,7 +10542,8 @@ void Player_Init(Actor* thisx, PlayState* play) { if ((this->actor.draw != NULL) && gSaveContext.save.hasTatl && ((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) && (play->sceneId != SCENE_SPOT00)) { - this->tatlActor = Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D340, 0); + this->tatlActor = + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D340, FAIRY_PARAMS(FAIRY_TYPE_0, false, 0)); if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; @@ -16836,21 +16846,23 @@ void Player_Action_67(Player* this, PlayState* play) { } } +#define BOTTLE_CATCH_PARAMS_ANY -1 + struct_8085D798 D_8085D798[] = { - { ACTOR_EN_ELF, 2, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, - { ACTOR_EN_FISH, -1, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x62 }, - { ACTOR_EN_INSECT, -1, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, - { ACTOR_EN_MUSHI2, -1, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, - { ACTOR_EN_TEST5, 0, ITEM_SPRING_WATER, PLAYER_IA_BOTTLE_SPRING_WATER, 0x67 }, - { ACTOR_EN_TEST5, 1, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, - { ACTOR_BG_GORON_OYU, -1, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, - { ACTOR_EN_ZORAEGG, -1, ITEM_ZORA_EGG, PLAYER_IA_BOTTLE_ZORA_EGG, 0x69 }, - { ACTOR_EN_DNP, -1, ITEM_DEKU_PRINCESS, PLAYER_IA_BOTTLE_DEKU_PRINCESS, 0x5F }, - { ACTOR_EN_OT, -1, ITEM_SEAHORSE, PLAYER_IA_BOTTLE_SEAHORSE, 0x6E }, - { ACTOR_OBJ_KINOKO, -1, ITEM_MUSHROOM, PLAYER_IA_BOTTLE_SEAHORSE, 0x6B }, - { ACTOR_EN_POH, -1, ITEM_POE, PLAYER_IA_BOTTLE_POE, 0x65 }, - { ACTOR_EN_BIGPO, -1, ITEM_BIG_POE, PLAYER_IA_BOTTLE_BIG_POE, 0x66 }, - { ACTOR_EN_ELF, 6, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, + { ACTOR_EN_ELF, FAIRY_PARAMS(FAIRY_TYPE_2, false, 0), ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, + { ACTOR_EN_FISH, BOTTLE_CATCH_PARAMS_ANY, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x62 }, + { ACTOR_EN_INSECT, BOTTLE_CATCH_PARAMS_ANY, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, + { ACTOR_EN_MUSHI2, BOTTLE_CATCH_PARAMS_ANY, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, + { ACTOR_EN_TEST5, ENTEST5_PARAMS(false), ITEM_SPRING_WATER, PLAYER_IA_BOTTLE_SPRING_WATER, 0x67 }, + { ACTOR_EN_TEST5, ENTEST5_PARAMS(true), ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, + { ACTOR_BG_GORON_OYU, BOTTLE_CATCH_PARAMS_ANY, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, + { ACTOR_EN_ZORAEGG, BOTTLE_CATCH_PARAMS_ANY, ITEM_ZORA_EGG, PLAYER_IA_BOTTLE_ZORA_EGG, 0x69 }, + { ACTOR_EN_DNP, BOTTLE_CATCH_PARAMS_ANY, ITEM_DEKU_PRINCESS, PLAYER_IA_BOTTLE_DEKU_PRINCESS, 0x5F }, + { ACTOR_EN_OT, BOTTLE_CATCH_PARAMS_ANY, ITEM_SEAHORSE, PLAYER_IA_BOTTLE_SEAHORSE, 0x6E }, + { ACTOR_OBJ_KINOKO, BOTTLE_CATCH_PARAMS_ANY, ITEM_MUSHROOM, PLAYER_IA_BOTTLE_SEAHORSE, 0x6B }, + { ACTOR_EN_POH, BOTTLE_CATCH_PARAMS_ANY, ITEM_POE, PLAYER_IA_BOTTLE_POE, 0x65 }, + { ACTOR_EN_BIGPO, BOTTLE_CATCH_PARAMS_ANY, ITEM_BIG_POE, PLAYER_IA_BOTTLE_BIG_POE, 0x66 }, + { ACTOR_EN_ELF, FAIRY_PARAMS(FAIRY_TYPE_6, false, 0), ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, }; void Player_Action_68(Player* this, PlayState* play) { @@ -16900,7 +16912,8 @@ void Player_Action_68(Player* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(D_8085D798); i++) { if (((interactRangeActor->id == entry->actorId) && - ((entry->actorParams < 0) || (interactRangeActor->params == entry->actorParams)))) { + ((entry->actorParams <= BOTTLE_CATCH_PARAMS_ANY) || + (interactRangeActor->params == entry->actorParams)))) { break; } entry++; @@ -16934,17 +16947,17 @@ void Player_Action_69(Player* this, PlayState* play) { Player_StopCutscene(this); func_80839E74(this, play); } else if (PlayerAnimation_OnFrame(&this->skelAnime, 37.0f)) { - s32 sp2C = 8; + s32 fairyParams = FAIRY_PARAMS(FAIRY_TYPE_8, false, 0); Player_PlaySfx(this, NA_SE_EV_BOTTLE_CAP_OPEN); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_AUTO_JUMP); if (this->itemAction == PLAYER_IA_BOTTLE_FAIRY) { Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); - sp2C = 1; + fairyParams = FAIRY_PARAMS(FAIRY_TYPE_1, false, 0); } - Player_SpawnFairy(play, this, &this->leftHandWorld.pos, &D_8085D7EC, sp2C); + Player_SpawnFairy(play, this, &this->leftHandWorld.pos, &D_8085D7EC, fairyParams); } } @@ -16958,17 +16971,17 @@ void Player_Action_70(Player* this, PlayState* play) { 0x28, // PLAYER_FORM_HUMAN }; static struct_8085D80C D_8085D80C[] = { - { ACTOR_EN_FISH, 0 }, // PLAYER_BOTTLE_FISH - { ACTOR_OBJ_AQUA, 0 }, // PLAYER_BOTTLE_SPRING_WATER - { ACTOR_OBJ_AQUA, 1 }, // PLAYER_BOTTLE_HOT_SPRING_WATER - { ACTOR_EN_ZORAEGG, 0x11 }, // PLAYER_BOTTLE_ZORA_EGG - { ACTOR_EN_DNP, 1 }, // PLAYER_BOTTLE_DEKU_PRINCESS - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_GOLD_DUST - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_1C - { ACTOR_EN_OT, 0x8000 }, // PLAYER_BOTTLE_SEAHORSE - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_MUSHROOM - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_HYLIAN_LOACH - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_BUG + { ACTOR_EN_FISH, FISH_PARAMS(ENFISH_0) }, // PLAYER_BOTTLE_FISH + { ACTOR_OBJ_AQUA, AQUA_PARAMS(AQUA_TYPE_COLD) }, // PLAYER_BOTTLE_SPRING_WATER + { ACTOR_OBJ_AQUA, AQUA_PARAMS(AQUA_TYPE_HOT) }, // PLAYER_BOTTLE_HOT_SPRING_WATER + { ACTOR_EN_ZORAEGG, ZORA_EGG_PARAMS(ZORA_EGG_TYPE_11, 0) }, // PLAYER_BOTTLE_ZORA_EGG + { ACTOR_EN_DNP, DEKU_PRINCESS_PARAMS(DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE) }, // PLAYER_BOTTLE_DEKU_PRINCESS + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_GOLD_DUST + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_1C + { ACTOR_EN_OT, SEAHORSE_PARAMS(SEAHORSE_TYPE_2, 0, 0) }, // PLAYER_BOTTLE_SEAHORSE + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_MUSHROOM + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_HYLIAN_LOACH + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_BUG }; static AnimSfxEntry D_8085D838[] = { ANIMSFX(ANIMSFX_TYPE_VOICE, 38, NA_SE_VO_LI_AUTO_JUMP, CONTINUE),