1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-06-08 01:21:52 +00:00

Child Ruto Part 6: Switch flag and type functions (#2574)

* Child Ruto Part 6: Switch flag and type functions

* Add type enum and getter macros

* Fix macros

* Fix macros better

* Revert improper usage

* Move macros to header

* Refactor enum

* Move type enum to header
This commit is contained in:
Jordan Longstaff 2025-06-05 13:24:11 -04:00 committed by GitHub
parent 892bddbcce
commit 61284297bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 27 deletions

View file

@ -209,16 +209,16 @@ void func_80AEADD8(EnRu1* this) {
this->unk_34C = 0;
}
u8 func_80AEADE0(EnRu1* this) {
u8 params = PARAMS_GET_U(this->actor.params, 8, 8);
u8 EnRu1_GetSwitchFlag(EnRu1* this) {
u8 switchFlag = ENRU1_SWITCH_FLAG(&this->actor);
return params;
return switchFlag;
}
u8 func_80AEADF0(EnRu1* this) {
u8 params = PARAMS_GET_U(this->actor.params, 0, 8);
u8 EnRu1_GetType(EnRu1* this) {
u8 type = ENRU1_TYPE(&this->actor);
return params;
return type;
}
void EnRu1_Destroy(Actor* thisx, PlayState* play) {
@ -2046,7 +2046,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) {
if (!(DEBUG_FEATURES && IS_CUTSCENE_LAYER) && EnRu1_IsCsStateIdle(play)) {
curRoomNum = play->roomCtx.curRoom.num;
SET_INFTABLE(INFTABLE_145);
Flags_SetSwitch(play, func_80AEADE0(this));
Flags_SetSwitch(play, EnRu1_GetSwitchFlag(this));
EnRu1_SetPlatformCamSetting(this, 1);
this->action = 42;
this->actor.room = curRoomNum;
@ -2285,36 +2285,36 @@ void EnRu1_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17);
func_80AEAD20(&this->actor, play);
switch (func_80AEADF0(this)) {
case 0:
switch (EnRu1_GetType(this)) {
case ENRU1_TYPE_BOSS_ROOM:
EnRu1_InitInBossRoom(this, play);
break;
case 1:
case ENRU1_TYPE_FOUNTAIN:
EnRu1_InitOutsideJabuJabu(this, play);
break;
case 2:
case ENRU1_TYPE_HOLES_ROOM:
EnRu1_InitInJabuJabuHolesRoom(this, play);
break;
case 3:
case ENRU1_TYPE_BASEMENT:
EnRu1_InitInJabuJabuBasement(this, play);
break;
case 4:
case ENRU1_TYPE_SAPPHIRE_ROOM:
EnRu1_InitInSapphireRoom(this, play);
break;
case 5:
case ENRU1_TYPE_BESIDE_KZ:
EnRu1_InitBesideKingZora(this, play);
break;
case 6:
case ENRU1_TYPE_BESIDE_DOOR_SWITCH:
EnRu1_InitBesideDoorSwitch(this, play);
break;
#if DEBUG_FEATURES
case 10:
case ENRU1_TYPE_DEBUG:
func_80AF0050(this, play);
break;
#endif
default:
Actor_Kill(&this->actor);
PRINTF(T("該当 arge_data = %d 無し\n", "Relevant arge_data = %d unacceptable\n"), func_80AEADF0(this));
PRINTF(T("該当 arge_data = %d 無し\n", "Relevant arge_data = %d unacceptable\n"), EnRu1_GetType(this));
break;
}
}

View file

@ -7,6 +7,9 @@
#include "overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#define ENRU1_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 8)
#define ENRU1_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 8)
struct EnRu1;
typedef void (*EnRu1ActionFunc)(struct EnRu1*, struct PlayState*);
@ -57,17 +60,30 @@ typedef struct EnRu1 {
/* 0x0374 */ NpcInteractInfo interactInfo;
} EnRu1; // size = 0x039C
typedef enum EnRu1Type {
/* 0 */ ENRU1_TYPE_BOSS_ROOM,
/* 1 */ ENRU1_TYPE_FOUNTAIN,
/* 2 */ ENRU1_TYPE_HOLES_ROOM,
/* 3 */ ENRU1_TYPE_BASEMENT,
/* 4 */ ENRU1_TYPE_SAPPHIRE_ROOM,
/* 5 */ ENRU1_TYPE_BESIDE_KZ,
/* 6 */ ENRU1_TYPE_BESIDE_DOOR_SWITCH,
#if DEBUG_FEATURES
/* 10 */ ENRU1_TYPE_DEBUG = 10,
#endif
} EnRu1Type;
typedef enum RutoLimb {
/* 0 */ RUTO_CHILD_NONE,
/* 1 */ RUTO_CHILD_ROOT,
/* 2 */ RUTO_CHILD_LEFT_THIGH,
/* 3 */ RUTO_CHILD_LEFT_SHIN,
/* 4 */ RUTO_CHILD_LEFT_FOOT,
/* 5 */ RUTO_CHILD_RIGHT_THIGH,
/* 6 */ RUTO_CHILD_RIGHT_SHIN,
/* 7 */ RUTO_CHILD_RIGHT_FOOT,
/* 8 */ RUTO_CHILD_CHEST,
/* 9 */ RUTO_CHILD_LEFT_UPPER_ARM,
/* 0 */ RUTO_CHILD_NONE,
/* 1 */ RUTO_CHILD_ROOT,
/* 2 */ RUTO_CHILD_LEFT_THIGH,
/* 3 */ RUTO_CHILD_LEFT_SHIN,
/* 4 */ RUTO_CHILD_LEFT_FOOT,
/* 5 */ RUTO_CHILD_RIGHT_THIGH,
/* 6 */ RUTO_CHILD_RIGHT_SHIN,
/* 7 */ RUTO_CHILD_RIGHT_FOOT,
/* 8 */ RUTO_CHILD_CHEST,
/* 9 */ RUTO_CHILD_LEFT_UPPER_ARM,
/* 10 */ RUTO_CHILD_LEFT_FIN,
/* 11 */ RUTO_CHILD_LEFT_HAND,
/* 12 */ RUTO_CHILD_RIGHT_UPPER_ARM,