Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove THIS macro #1756

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions src/code/z_en_a_keep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY)

#define THIS ((EnAObj*)thisx)

void EnAObj_Init(Actor* thisx, PlayState* play);
void EnAObj_Destroy(Actor* thisx, PlayState* play);
void EnAObj_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -50,7 +48,7 @@ static InitChainEntry sInitChain[] = {
};

void EnAObj_Init(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
EnAObj* this = (EnAObj*)thisx;

this->actor.textId = AOBJ_GET_TEXTID(&this->actor);
this->actor.params = AOBJ_GET_TYPE(&this->actor);
Expand All @@ -63,7 +61,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {
}

void EnAObj_Destroy(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
EnAObj* this = (EnAObj*)thisx;

Collider_DestroyCylinder(play, &this->collision);
}
Expand All @@ -89,7 +87,7 @@ void EnAObj_Talk(EnAObj* this, PlayState* play) {
}

void EnAObj_Update(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
EnAObj* this = (EnAObj*)thisx;

this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 45.0f);
Expand Down
10 changes: 4 additions & 6 deletions src/code/z_en_item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#define FLAGS 0x00000000

#define THIS ((EnItem00*)thisx)

void EnItem00_Init(Actor* thisx, PlayState* play);
void EnItem00_Destroy(Actor* thisx, PlayState* play);
void EnItem00_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -74,7 +72,7 @@ void EnItem00_SetObject(EnItem00* this, PlayState* play, f32* shadowOffset, f32*
}

void EnItem00_Init(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
EnItem00* this = (EnItem00*)thisx;
s32 pad;
f32 shadowOffset = 980.0f;
f32 shadowScale = 6.0f;
Expand Down Expand Up @@ -312,7 +310,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
}

void EnItem00_Destroy(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
EnItem00* this = (EnItem00*)thisx;

Collider_DestroyCylinder(play, &this->collider);
}
Expand Down Expand Up @@ -489,7 +487,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
}

void EnItem00_Update(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
EnItem00* this = (EnItem00*)thisx;
s32 pad;
Player* player = GET_PLAYER(play);
s32 sp38 = player->stateFlags3 & PLAYER_STATE3_1000;
Expand Down Expand Up @@ -703,7 +701,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {

void EnItem00_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnItem00* this = THIS;
EnItem00* this = (EnItem00*)thisx;

if (!(this->unk14E & this->unk150)) {
switch (this->actor.params) {
Expand Down
18 changes: 8 additions & 10 deletions src/code/z_fbdemo_fade.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "z64math.h"
#include "z64save.h"

#define THIS ((TransitionFade*)thisx)

typedef enum TransitionFadeDirection {
/* 0 */ TRANS_FADE_DIR_IN,
/* 1 */ TRANS_FADE_DIR_OUT
Expand Down Expand Up @@ -37,7 +35,7 @@ TransitionProfile TransitionFade_Profile = {
};

void TransitionFade_Start(void* thisx) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

switch (this->type) {
case TRANS_FADE_TYPE_NONE:
Expand All @@ -59,7 +57,7 @@ void TransitionFade_Start(void* thisx) {
}

void* TransitionFade_Init(void* thisx) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

bzero(this, sizeof(TransitionFade));
return this;
Expand All @@ -71,15 +69,15 @@ void TransitionFade_Destroy(void* thisx) {
void TransitionFade_Update(void* thisx, s32 updateRate) {
s32 alpha;
s16 newAlpha;
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

switch (this->type) {
case TRANS_FADE_TYPE_NONE:
break;

case TRANS_FADE_TYPE_ONE_WAY:
//! FAKE:
THIS->timer += updateRate;
((TransitionFade*)thisx)->timer += updateRate;

if (this->timer >= ((void)0, gSaveContext.transFadeDuration)) {
this->timer = ((void)0, gSaveContext.transFadeDuration);
Expand Down Expand Up @@ -114,7 +112,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) {
}

void TransitionFade_Draw(void* thisx, Gfx** gfxP) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;
Gfx* gfx;
Color_RGBA8_u32* color = &this->color;

Expand All @@ -128,19 +126,19 @@ void TransitionFade_Draw(void* thisx, Gfx** gfxP) {
}

s32 TransitionFade_IsDone(void* thisx) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

return this->isDone;
}

void TransitionFade_SetColor(void* thisx, u32 color) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

this->color.rgba = color;
}

void TransitionFade_SetType(void* thisx, s32 type) {
TransitionFade* this = THIS;
TransitionFade* this = (TransitionFade*)thisx;

if (type == TRANS_INSTANCE_TYPE_FILL_OUT) {
this->type = TRANS_FADE_TYPE_ONE_WAY;
Expand Down
10 changes: 4 additions & 6 deletions src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)

#define THIS ((ArmsHook*)thisx)

void ArmsHook_Init(Actor* thisx, PlayState* play);
void ArmsHook_Destroy(Actor* thisx, PlayState* play);
void ArmsHook_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -57,7 +55,7 @@ void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
}

void ArmsHook_Init(Actor* thisx, PlayState* play) {
ArmsHook* this = THIS;
ArmsHook* this = (ArmsHook*)thisx;

Collider_InitQuad(play, &this->collider);
Collider_SetQuad(play, &this->collider, &this->actor, &D_808C1BC0);
Expand All @@ -66,7 +64,7 @@ void ArmsHook_Init(Actor* thisx, PlayState* play) {
}

void ArmsHook_Destroy(Actor* thisx, PlayState* play) {
ArmsHook* this = THIS;
ArmsHook* this = (ArmsHook*)thisx;

if (this->attachedActor != NULL) {
this->attachedActor->flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED;
Expand Down Expand Up @@ -294,7 +292,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
}

void ArmsHook_Update(Actor* thisx, PlayState* play) {
ArmsHook* this = THIS;
ArmsHook* this = (ArmsHook*)thisx;

this->actionFunc(this, play);
this->unk1EC = this->unk1E0;
Expand All @@ -308,7 +306,7 @@ Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f };
Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };

void ArmsHook_Draw(Actor* thisx, PlayState* play) {
ArmsHook* this = THIS;
ArmsHook* this = (ArmsHook*)thisx;
f32 f0;
Player* player = GET_PLAYER(play);

Expand Down
8 changes: 3 additions & 5 deletions src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_UPDATE_DURING_OCARINA)

#define THIS ((ArrowFire*)thisx)

void ArrowFire_Init(Actor* thisx, PlayState* play);
void ArrowFire_Destroy(Actor* thisx, PlayState* play);
void ArrowFire_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -64,7 +62,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) {
}

void ArrowFire_Init(Actor* thisx, PlayState* play) {
ArrowFire* this = THIS;
ArrowFire* this = (ArrowFire*)thisx;

Actor_ProcessInitChain(&this->actor, sInitChain);
this->radius = 0;
Expand All @@ -79,7 +77,7 @@ void ArrowFire_Init(Actor* thisx, PlayState* play) {
}

void ArrowFire_Destroy(Actor* thisx, PlayState* play) {
ArrowFire* this = THIS;
ArrowFire* this = (ArrowFire*)thisx;

Magic_Reset(play);
Collider_DestroyQuad(play, &this->collider1);
Expand Down Expand Up @@ -239,7 +237,7 @@ void FireArrow_SetQuadVerticies(ArrowFire* this) {

void ArrowFire_Draw(Actor* thisx, PlayState* play) {
EnArrow* arrow;
ArrowFire* this = THIS;
ArrowFire* this = (ArrowFire*)thisx;
u32 frames = play->state.frames;
s32 pad;

Expand Down
8 changes: 3 additions & 5 deletions src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_UPDATE_DURING_OCARINA)

#define THIS ((ArrowIce*)thisx)

void ArrowIce_Init(Actor* thisx, PlayState* play);
void ArrowIce_Destroy(Actor* thisx, PlayState* play);
void ArrowIce_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -44,7 +42,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) {
}

void ArrowIce_Init(Actor* thisx, PlayState* play) {
ArrowIce* this = THIS;
ArrowIce* this = (ArrowIce*)thisx;

Actor_ProcessInitChain(&this->actor, sInitChain);
this->radius = 0;
Expand Down Expand Up @@ -174,7 +172,7 @@ void ArrowIce_Fly(ArrowIce* this, PlayState* play) {
}

void ArrowIce_Update(Actor* thisx, PlayState* play) {
ArrowIce* this = THIS;
ArrowIce* this = (ArrowIce*)thisx;

if ((play->msgCtx.msgMode == MSGMODE_E) || (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) {
Actor_Kill(&this->actor);
Expand All @@ -186,7 +184,7 @@ void ArrowIce_Update(Actor* thisx, PlayState* play) {

void ArrowIce_Draw(Actor* thisx, PlayState* play) {
s32 pad;
ArrowIce* this = THIS;
ArrowIce* this = (ArrowIce*)thisx;
Actor* transform;
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Expand Down
4 changes: 1 addition & 3 deletions src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_UPDATE_DURING_OCARINA)

#define THIS ((ArrowLight*)thisx)

void ArrowLight_Init(Actor* thisx, PlayState* play);
void ArrowLight_Destroy(Actor* thisx, PlayState* play);
void ArrowLight_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -170,7 +168,7 @@ void ArrowLight_Fly(ArrowLight* this, PlayState* play) {
}

void ArrowLight_Update(Actor* thisx, PlayState* play) {
ArrowLight* this = THIS;
ArrowLight* this = (ArrowLight*)thisx;

if ((play->msgCtx.msgMode == MSGMODE_E) || (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) {
Actor_Kill(&this->actor);
Expand Down
8 changes: 3 additions & 5 deletions src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#define FLAGS 0x00000000

#define THIS ((BgAstrBombwall*)thisx)

void BgAstrBombwall_Init(Actor* thisx, PlayState* play);
void BgAstrBombwall_Destroy(Actor* thisx, PlayState* play);
void BgAstrBombwall_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -99,7 +97,7 @@ void BgAstrBombwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot,

void BgAstrBombwall_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgAstrBombwall* this = THIS;
BgAstrBombwall* this = (BgAstrBombwall*)thisx;

Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Expand All @@ -120,7 +118,7 @@ void BgAstrBombwall_Init(Actor* thisx, PlayState* play) {
}

void BgAstrBombwall_Destroy(Actor* thisx, PlayState* play) {
BgAstrBombwall* this = THIS;
BgAstrBombwall* this = (BgAstrBombwall*)thisx;

DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
Expand Down Expand Up @@ -194,7 +192,7 @@ void func_80C0A4BC(BgAstrBombwall* this, PlayState* play) {
}

void BgAstrBombwall_Update(Actor* thisx, PlayState* play) {
BgAstrBombwall* this = THIS;
BgAstrBombwall* this = (BgAstrBombwall*)thisx;

this->actionFunc(this, play);
}
Expand Down
8 changes: 3 additions & 5 deletions src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#define FLAGS 0x00000000

#define THIS ((BgBotihasira*)thisx)

void BgBotihasira_Init(Actor* thisx, PlayState* play);
void BgBotihasira_Destroy(Actor* thisx, PlayState* play);
void BgBotihasira_Update(Actor* thisx, PlayState* play2);
Expand Down Expand Up @@ -52,7 +50,7 @@ static ColliderCylinderInit sCylinderInit = {

void BgBotihasira_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgBotihasira* this = THIS;
BgBotihasira* this = (BgBotihasira*)thisx;
CollisionHeader* colHeader = NULL;

if (this->dyna.actor.params == 0) {
Expand All @@ -67,7 +65,7 @@ void BgBotihasira_Init(Actor* thisx, PlayState* play) {
}

void BgBotihasira_Destroy(Actor* thisx, PlayState* play) {
BgBotihasira* this = THIS;
BgBotihasira* this = (BgBotihasira*)thisx;

if (this->dyna.actor.params == 0) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Expand All @@ -79,7 +77,7 @@ void BgBotihasira_DoNothing(BgBotihasira* this, PlayState* play) {

void BgBotihasira_Update(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
BgBotihasira* this = THIS;
BgBotihasira* this = (BgBotihasira*)thisx;

this->actionFunc(this, play);
if (this->dyna.actor.params != 0) {
Expand Down
Loading