Skip to content

Commit

Permalink
Remove THIS macro (zeldaret#1047)
Browse files Browse the repository at this point in the history
* remove THIS

* fix

* forgot dorf
  • Loading branch information
fig02 committed Dec 4, 2021
1 parent 68899c2 commit e635e34
Show file tree
Hide file tree
Showing 433 changed files with 1,996 additions and 2,859 deletions.
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 @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
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 @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand Down
18 changes: 8 additions & 10 deletions src/code/z_fbdemo_circle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
16 changes: 7 additions & 9 deletions src/code/z_fbdemo_fade.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down
18 changes: 8 additions & 10 deletions src/code/z_fbdemo_triforce.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand All @@ -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;

Expand All @@ -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;
}
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
18 changes: 8 additions & 10 deletions src/code/z_fbdemo_wipe1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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) {
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
}
Loading

0 comments on commit e635e34

Please sign in to comment.