From e635e34265e5e1bc830193930fa1ea9fd552db8d Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 4 Dec 2021 11:33:00 -0500 Subject: Remove THIS macro (#1047) * remove THIS * fix * forgot dorf --- src/code/z_en_a_keep.c | 8 +++----- src/code/z_en_item00.c | 10 ++++------ src/code/z_fbdemo_circle.c | 18 ++++++++---------- src/code/z_fbdemo_fade.c | 16 +++++++--------- src/code/z_fbdemo_triforce.c | 18 ++++++++---------- src/code/z_fbdemo_wipe1.c | 18 ++++++++---------- 6 files changed, 38 insertions(+), 50 deletions(-) (limited to 'src/code') diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 4dc68d04a..fd3edc86e 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -4,8 +4,6 @@ #define FLAGS 0x00000010 -#define THIS ((EnAObj*)thisx) - void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx); void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx); @@ -87,7 +85,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) { void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader* colHeader = NULL; s32 pad; - EnAObj* this = THIS; + EnAObj* this = (EnAObj*)thisx; f32 shadowScale = 6.0f; this->textId = (thisx->params >> 8) & 0xFF; @@ -186,7 +184,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { - EnAObj* this = THIS; + EnAObj* this = (EnAObj*)thisx; DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); @@ -320,7 +318,7 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) { } void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { - EnAObj* this = THIS; + EnAObj* this = (EnAObj*)thisx; this->actionFunc(this, globalCtx); Actor_MoveForward(&this->dyna.actor); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 3a9be44cb..ef85217cd 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -5,8 +5,6 @@ #define FLAGS 0x00000000 -#define THIS ((EnItem00*)thisx) - void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); @@ -331,7 +329,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) { } void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { - EnItem00* this = THIS; + EnItem00* this = (EnItem00*)thisx; s32 pad; f32 yOffset = 980.0f; f32 shadowScale = 6.0f; @@ -553,7 +551,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { - EnItem00* this = THIS; + EnItem00* this = (EnItem00*)thisx; Collider_DestroyCylinder(globalCtx, &this->collider); } @@ -729,7 +727,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { s16 sp3A = 0; s16 i; u32* temp; - EnItem00* this = THIS; + EnItem00* this = (EnItem00*)thisx; s32 pad; if (this->unk_15A > 0) { @@ -933,7 +931,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { - EnItem00* this = THIS; + EnItem00* this = (EnItem00*)thisx; f32 mtxScale; if (!(this->unk_156 & this->unk_158)) { diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 233665db1..54b64d2ed 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -34,10 +34,8 @@ Gfx sCircleDList[] = { gsSPEndDisplayList(), }; -#define THIS ((TransitionCircle*)thisx) - void TransitionCircle_Start(void* thisx) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; this->isDone = 0; @@ -92,7 +90,7 @@ void TransitionCircle_Start(void* thisx) { } void* TransitionCircle_Init(void* thisx) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; bzero(this, sizeof(*this)); return this; @@ -102,7 +100,7 @@ void TransitionCircle_Destroy(void* thisx) { } void TransitionCircle_Update(void* thisx, s32 updateRate) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; s32 temp_t2; s32 temp_t3; @@ -136,7 +134,7 @@ void TransitionCircle_Update(void* thisx, s32 updateRate) { void TransitionCircle_Draw(void* thisx, Gfx** gfxP) { Gfx* gfx = *gfxP; Mtx* modelView; - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; Gfx* texScroll; // These variables are a best guess based on the other transition types. f32 tPos = 0.0f; @@ -176,13 +174,13 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) { } s32 TransitionCircle_IsDone(void* thisx) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; return this->isDone; } void TransitionCircle_SetType(void* thisx, s32 type) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; if (type & 0x80) { this->unk_14 = (type >> 5) & 0x1; @@ -197,13 +195,13 @@ void TransitionCircle_SetType(void* thisx, s32 type) { } void TransitionCircle_SetColor(void* thisx, u32 color) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; this->color.rgba = color; } void TransitionCircle_SetEnvColor(void* thisx, u32 envColor) { - TransitionCircle* this = THIS; + TransitionCircle* this = (TransitionCircle*)thisx; this->envColor.rgba = envColor; } diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 518c31c33..dc2c6e1d0 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -12,10 +12,8 @@ static Gfx sRCPSetupFade[] = { gsSPEndDisplayList(), }; -#define THIS ((TransitionFade*)thisx) - void TransitionFade_Start(void* thisx) { - TransitionFade* this = THIS; + TransitionFade* this = (TransitionFade*)thisx; switch (this->fadeType) { case 0: @@ -32,7 +30,7 @@ void TransitionFade_Start(void* thisx) { } void* TransitionFade_Init(void* thisx) { - TransitionFade* this = THIS; + TransitionFade* this = (TransitionFade*)thisx; bzero(this, sizeof(*this)); return this; @@ -44,7 +42,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->fadeType) { case 0: @@ -84,7 +82,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->fadeColor; @@ -99,19 +97,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->fadeColor.rgba = color; } void TransitionFade_SetType(void* thisx, s32 type) { - TransitionFade* this = THIS; + TransitionFade* this = (TransitionFade*)thisx; if (type == 1) { this->fadeType = 1; diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c index b17e16101..22cbf6c18 100644 --- a/src/code/z_fbdemo_triforce.c +++ b/src/code/z_fbdemo_triforce.c @@ -2,10 +2,8 @@ #include "code/fbdemo_triforce/z_fbdemo_triforce.c" -#define THIS ((TransitionTriforce*)thisx) - void TransitionTriforce_Start(void* thisx) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; switch (this->state) { case 1: @@ -17,7 +15,7 @@ void TransitionTriforce_Start(void* thisx) { } void* TransitionTriforce_Init(void* thisx) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; bzero(this, sizeof(*this)); guOrtho(&this->projection, -160.0f, 160.0f, -120.0f, 120.0f, -1000.0f, 1000.0f, 1.0f); @@ -32,7 +30,7 @@ void TransitionTriforce_Destroy(void* thisx) { } void TransitionTriforce_Update(void* thisx, s32 updateRate) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; f32 temp_f0; s32 i; @@ -50,20 +48,20 @@ void TransitionTriforce_Update(void* thisx, s32 updateRate) { } void TransitionTriforce_SetColor(void* thisx, u32 color) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; this->color.rgba = color; } void TransitionTriforce_SetType(void* thisx, s32 type) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; this->fadeDirection = type; } // unused void TransitionTriforce_SetState(void* thisx, s32 state) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; this->state = state; } @@ -72,7 +70,7 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { Gfx* gfx = *gfxP; Mtx* modelView; f32 scale; - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; s32 pad; f32 rotation = this->transPos * 360.0f; @@ -119,7 +117,7 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { } s32 TransitionTriforce_IsDone(void* thisx) { - TransitionTriforce* this = THIS; + TransitionTriforce* this = (TransitionTriforce*)thisx; s32 ret = 0; diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index ca238643b..94e21c341 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -36,10 +36,8 @@ Gfx sWipeSyncDList[] = { gsSPEndDisplayList(), }; -#define THIS ((TransitionWipe*)thisx) - void TransitionWipe_Start(void* thisx) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; this->isDone = 0; @@ -54,7 +52,7 @@ void TransitionWipe_Start(void* thisx) { } void* TransitionWipe_Init(void* thisx) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; bzero(this, sizeof(*this)); return this; @@ -64,7 +62,7 @@ void TransitionWipe_Destroy(void* thisx) { } void TransitionWipe_Update(void* thisx, s32 updateRate) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; u8 unk1419; if (this->direction != 0) { @@ -87,7 +85,7 @@ void TransitionWipe_Update(void* thisx, s32 updateRate) { void TransitionWipe_Draw(void* thisx, Gfx** gfxP) { Gfx* gfx = *gfxP; Mtx* modelView; - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; s32 pad[4]; Gfx* tex; @@ -113,13 +111,13 @@ void TransitionWipe_Draw(void* thisx, Gfx** gfxP) { } s32 TransitionWipe_IsDone(void* thisx) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; return this->isDone; } void TransitionWipe_SetType(void* thisx, s32 type) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; if (type == 1) { this->direction = 1; @@ -135,13 +133,13 @@ void TransitionWipe_SetType(void* thisx, s32 type) { } void TransitionWipe_SetColor(void* thisx, u32 color) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; this->color.rgba = color; } void TransitionWipe_SetEnvColor(void* thisx, u32 color) { - TransitionWipe* this = THIS; + TransitionWipe* this = (TransitionWipe*)thisx; this->envColor.rgba = color; } -- cgit v1.2.3