From 8efc382b9f9c670063611e32b21cac53345bd3b2 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Fri, 13 Dec 2024 03:34:39 -0800 Subject: Remove THIS macro (#1756) * Remove THIS macro * Revert changes to the documentation * Undo revert to STYLE.md --- src/code/z_en_a_keep.c | 8 +++----- src/code/z_en_item00.c | 10 ++++------ src/code/z_fbdemo_fade.c | 18 ++++++++---------- 3 files changed, 15 insertions(+), 21 deletions(-) (limited to 'src/code') diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 54244f33c..92b1d4b67 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -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); @@ -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); @@ -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); } @@ -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); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 0be9a94a1..e7058ba3b 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -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); @@ -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; @@ -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); } @@ -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; @@ -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) { diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 7f27355e3..e1526784e 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -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 @@ -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: @@ -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; @@ -71,7 +69,7 @@ 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: @@ -79,7 +77,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) { 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); @@ -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; @@ -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; -- cgit v1.2.3