General Cleanup 11 (#992)

* char -> UNK_TYPE1

* SubS fixes

* func_800B8500

* macros

* misc

* A few more GET_{ACTOR} vs {ACTOR}_GETw

* More Macros

* fix

* PARSE_TYPE -> GET_TYPE

* 1 more
This commit is contained in:
Derek Hensley
2022-08-15 21:42:21 -04:00
committed by GitHub
parent f3a51c5403
commit bb96e47f8d
75 changed files with 253 additions and 252 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) {
// Actors which may be pictographed anywhere
switch (actor->id) {
case ACTOR_EN_KAKASI:
if (GET_KAKASI_ABOVE_GROUND(actor) == 1) {
if (KAKASI_GET_ABOVE_GROUND(actor) == 1) {
seen |= PICTO_SEEN_ANYWHERE;
break; //! @bug break is inside conditional, meaning it falls through if it is false
}
@@ -15,7 +15,7 @@ typedef struct ArmsHook {
/* 0x1EC */ Vec3f unk1EC;
/* 0x1F8 */ Actor* grabbed;
/* 0x1FC */ Vec3f unk1FC;
/* 0x208 */ char unk208[0x2];
/* 0x208 */ UNK_TYPE1 unk208[0x2];
/* 0x20A */ s16 timer;
/* 0x20C */ ArmsHookActionFunc actionFunc;
} ArmsHook; // size = 0x210
@@ -153,7 +153,7 @@ void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) {
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) {
func_80C0A86C(this, play, 4, 14, 1);
Flags_UnsetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this));
Flags_UnsetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor));
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND);
func_80C0AC74(this);
} else {
@@ -167,7 +167,7 @@ void func_80C0AC74(BgIkninSusceil* this) {
}
void func_80C0AC90(BgIkninSusceil* this, PlayState* play) {
if (Flags_GetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this))) {
if (Flags_GetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor))) {
func_80C0ACD4(this);
}
}
@@ -3,7 +3,7 @@
#include "global.h"
#define GET_SUSCEIL_SWITCHFLAG(this) (((this)->dyna.actor.params) & 0x7F)
#define SUSCEIL_GET_SWITCHFLAG(thisx) (((thisx)->params) & 0x7F)
struct BgIkninSusceil;
@@ -145,7 +145,7 @@ void BgKin2Bombwall_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
bombwallCollider = &this->collider;
Collider_InitCylinder(play, bombwallCollider);
if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this))) {
if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor))) {
Actor_MarkForDeath(&this->dyna.actor);
} else {
DynaPolyActor_LoadMesh(play, &this->dyna, &gOceanSpiderHouseBombableWallCol);
@@ -184,7 +184,7 @@ void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this) {
void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) {
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this));
Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor));
SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN);
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
this->dyna.actor.draw = NULL;
@@ -1,7 +1,7 @@
#ifndef Z_BG_KIN2_BOMBWALL_H
#define Z_BG_KIN2_BOMBWALL_H
#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) (thisx->dyna.actor.params & 0x7F)
#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
#include "global.h"
@@ -49,8 +49,8 @@ void BgLadder_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->switchFlag = GET_BGLADDER_SWITCHFLAG(thisx);
thisx->params = GET_BGLADDER_SIZE(thisx);
this->switchFlag = BGLADDER_GET_SWITCHFLAG(thisx);
thisx->params = BGLADDER_GET_SIZE(thisx);
DynaPolyActor_Init(&this->dyna, 0);
size = thisx->params;
@@ -3,8 +3,8 @@
#include "global.h"
#define GET_BGLADDER_SIZE(actor) ((actor)->params & 0xFF)
#define GET_BGLADDER_SWITCHFLAG(actor) (((actor)->params >> 8) & 0xFF)
#define BGLADDER_GET_SIZE(thisx) ((thisx)->params & 0xFF)
#define BGLADDER_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0xFF)
struct BgLadder;
@@ -18,10 +18,10 @@ typedef struct BgLadder {
} BgLadder; // size = 0x164
typedef enum {
LADDER_SIZE_12RUNG,
LADDER_SIZE_16RUNG,
LADDER_SIZE_20RUNG,
LADDER_SIZE_24RUNG,
/* 0 */ LADDER_SIZE_12RUNG,
/* 1 */ LADDER_SIZE_16RUNG,
/* 2 */ LADDER_SIZE_20RUNG,
/* 3 */ LADDER_SIZE_24RUNG,
} BgLadderSize;
extern const ActorInit Bg_Ladder_InitVars;
@@ -25,9 +25,9 @@ typedef enum {
typedef struct DmChar07 {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ char pad15C[0x14C];
/* 0x15C */ UNK_TYPE1 pad15C[0x14C];
/* 0x2A8 */ DmChar07ActionFunc actionFunc;
/* 0x2AC */ char pad2AC[0xD];
/* 0x2AC */ UNK_TYPE1 pad2AC[0xD];
/* 0x2B9 */ u8 spotlightFlags;
/* 0x2BA */ u8 isStage;
} DmChar07; // size = 0x2BC
@@ -10,7 +10,7 @@ typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*);
#define DOORSHUTTER_GET_1F(thisx) ((thisx)->params & 0x1F)
#define DOORSHUTTER_GET_7F(thisx) ((thisx)->params & 0x7F)
#define DOORSHUTTER_GET_380(thisx) (((thisx)->params >> 7) & 7)
#define DOORSHUTTER_GET_FC00(thisx) (((u16)(thisx)->params >> 0xA))
#define DOORSHUTTER_GET_FC00(thisx) ((u16)(thisx)->params >> 0xA)
typedef struct DoorShutter {
/* 0x0000 */ Actor actor;
@@ -16,10 +16,6 @@
#define THIS ((DoorSpiral*)thisx)
#define GET_ORIENTATION_PARAM(this) ((((Actor*)(this))->params >> 7) & 0x1)
#define GET_UNK145_PARAM(this) ((((Actor*)(this))->params >> 8) & 0x3)
#define GET_TRANSITION_ID_PARAM(this) ((u16)((Actor*)(this))->params >> 10)
typedef enum {
/* 0 */ SPIRAL_OVERWORLD, // does not display anything as there is not a DL in GAMEPLAY_KEEP for it
/* 1 */ SPIRAL_DUNGEON,
@@ -179,7 +175,7 @@ static InitChainEntry sInitChain[] = {
void DoorSpiral_Init(Actor* thisx, PlayState* play) {
DoorSpiral* this = THIS;
s32 pad;
s32 transition = GET_TRANSITION_ID_PARAM(thisx);
s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx);
s8 objBankId;
if (this->actor.room != play->doorCtx.transitionActorList[transition].sides[0].room) {
@@ -188,8 +184,8 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) {
}
Actor_ProcessInitChain(&this->actor, sInitChain);
this->unk145 = GET_UNK145_PARAM(thisx); // set but never used
this->orientation = GET_ORIENTATION_PARAM(thisx);
this->unk145 = DOORSPIRAL_GET_UNK145(thisx); // set but never used
this->orientation = DOORSPIRAL_GET_ORIENTATION(thisx);
this->objectType = DoorSpiral_GetObjectType(play);
objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId);
this->bankIndex = objBankId;
@@ -204,7 +200,7 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) {
}
void DoorSpiral_Destroy(Actor* thisx, PlayState* play) {
s32 transition = GET_TRANSITION_ID_PARAM(thisx);
s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx);
play->doorCtx.transitionActorList[transition].id *= -1;
}
@@ -281,7 +277,7 @@ void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) {
player->doorType = 4;
player->doorDirection = this->orientation;
player->doorActor = &this->actor;
transition = GET_TRANSITION_ID_PARAM(this);
transition = DOORSPIRAL_GET_TRANSITION_ID(&this->actor);
player->doorNext = ((u16)play->doorCtx.transitionActorList[transition].params) >> 10;
func_80122F28(player);
@@ -5,6 +5,10 @@
struct DoorSpiral;
#define DOORSPIRAL_GET_ORIENTATION(thisx) (((thisx)->params >> 7) & 0x1)
#define DOORSPIRAL_GET_UNK145(thisx) (((thisx)->params >> 8) & 0x3)
#define DOORSPIRAL_GET_TRANSITION_ID(thisx) ((u16)(thisx)->params >> 10)
typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*);
typedef struct DoorSpiral {
+1 -1
View File
@@ -128,7 +128,7 @@ void EnAni_Init(Actor* thisx, PlayState* play) {
this->treeReachTimer = 0;
this->blinkFunc = EnAni_DefaultBlink;
if (GET_ANI_TYPE(thisx) == ANI_TYPE_TREE_HANGING) {
if (ANI_GET_TYPE(thisx) == ANI_TYPE_TREE_HANGING) {
Animation_Change(&this->skelAnime, &gAniTreeHangingAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gAniTreeHangingAnim), ANIMMODE_ONCE, 0.0f);
this->actionFunc = EnAni_HangInTree;
+1 -1
View File
@@ -33,6 +33,6 @@ enum EnAniType {
/* 1 */ ANI_TYPE_TREE_HANGING = 1,
};
#define GET_ANI_TYPE(thisx) (thisx->params & 0xFF)
#define ANI_GET_TYPE(thisx) ((thisx)->params & 0xFF)
#endif // Z_EN_ANI_H
@@ -181,8 +181,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) {
Actor_ProcessInitChain(&this->actor, sInitChain);
// thisx req to match
this->switchFlags = GET_BIGPO_SWITCHFLAGS(thisx);
this->switchFlags = BIGPO_GET_SWITCHFLAGS(thisx);
thisx->params &= 0xFF;
if (thisx->params == ENBIGPO_POSSIBLEFIRE) {
if (Flags_GetSwitch(play, this->switchFlags)) {
@@ -64,6 +64,6 @@ enum EnBigpoType {
/* 5 */ ENBIGPO_UNK5,
};
#define GET_BIGPO_SWITCHFLAGS(thisx) ((u8)(thisx->params >> 0x8))
#define BIGPO_GET_SWITCHFLAGS(thisx) (u8)((thisx)->params >> 0x8)
#endif // Z_EN_BIGPO_H
@@ -509,7 +509,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) {
} else {
this->actor.textId = 0x716;
}
func_800B8500(&this->actor, play, 400.0f, 400.0f, -1);
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
this->actionFunc = func_809C5AA4;
} else {
Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f);
@@ -524,7 +524,7 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) {
this->actionFunc = func_809C5598;
}
} else {
func_800B8500(&this->actor, play, 400.0f, 400.0f, -1);
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
}
}
@@ -15,7 +15,7 @@ typedef struct EnDyExtra {
/* 0x14C */ s16 unk14C;
/* 0x14E */ s16 unk14E;
/* 0x150 */ f32 unk150;
/* 0x154 */ char unk154[0xC];
/* 0x154 */ UNK_TYPE1 unk154[0xC];
/* 0x160 */ Vec3f unk160;
} EnDyExtra; // size = 0x16C
@@ -114,7 +114,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.targetMode = 6;
this->dyna.actor.colChkInfo.health = 1;
this->scale = 0.1;
this->switchFlag = GET_ENCOUNT2_SWITCH_FLAG(this);
this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor);
if (this->switchFlag == 0x7F) {
this->switchFlag = -1;
@@ -137,6 +137,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) {
void EnEncount2_Destroy(Actor* thisx, PlayState* play) {
EnEncount2* this = THIS;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyJntSph(play, &this->collider);
}
@@ -33,7 +33,7 @@ typedef struct EnEncount2 {
/* 0x01D0 */ EnEncount2Effect effects[EN_ENCOUNT2_EFFECT_COUNT];
} EnEncount2; // size = 0x2A70
#define GET_ENCOUNT2_SWITCH_FLAG(actor) ((s16)(((Actor*)actor)->params & 0x7F))
#define ENCOUNT2_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
extern const ActorInit En_Encount2_InitVars;

Some files were not shown because too many files have changed in this diff Show More