1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 17:54:15 +00:00

Remove inline THIS-> from actors (#538)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* ZAP2 stuff

* ZAP why

* ZAP again

* THIS

* PLAYER
This commit is contained in:
petrie911 2020-12-17 16:49:41 -06:00 committed by GitHub
parent 6e78efd0c5
commit 0376242365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 93 additions and 70 deletions

View file

@ -80,8 +80,11 @@ void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetHeight(thisx, 0.0f);
}
void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &THIS->collider);
void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
BgJyaBombchuiwa* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) {

View file

@ -67,39 +67,39 @@ void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) {
BgPoSyokudai* this = THIS;
s32 pad;
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_ProcessInitChain(thisx, sInitChain);
this->flameColor = (THIS->actor.params >> 8) & 0xFF;
this->actor.params &= 0x3F;
this->flameColor = (thisx->params >> 8) & 0xFF;
thisx->params &= 0x3F;
this->actor.colChkInfo.mass = 0xFF;
thisx->colChkInfo.mass = 0xFF;
this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
Lights_PointGlowSetInfo(&this->lightInfo, this->actor.posRot.pos.x, (s16)this->actor.posRot.pos.y + 65,
this->actor.posRot.pos.z, 0, 0, 0, 0);
Lights_PointGlowSetInfo(&this->lightInfo, thisx->posRot.pos.x, (s16)thisx->posRot.pos.y + 65, thisx->posRot.pos.z,
0, 0, 0, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
this->collider.dim.pos.x = this->actor.posRot.pos.x;
this->collider.dim.pos.y = this->actor.posRot.pos.y;
this->collider.dim.pos.z = this->actor.posRot.pos.z;
this->collider.dim.pos.x = thisx->posRot.pos.x;
this->collider.dim.pos.y = thisx->posRot.pos.y;
this->collider.dim.pos.z = thisx->posRot.pos.z;
if (this->flameColor == POE_FLAME_PURPLE && Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_GREEN) &&
Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_BLUE) &&
Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(globalCtx, this->actor.params)) {
Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(globalCtx, thisx->params)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0,
this->actor.params);
thisx->params);
globalCtx->envCtx.unk_BF = 0x4;
} else if (!Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(globalCtx, 0x1B)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.posRot.pos.x,
this->actor.posRot.pos.y + 52.0f, this->actor.posRot.pos.z, 0, 0, 0,
(this->flameColor << 8) + this->actor.params + 0x1000);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, thisx->posRot.pos.x,
thisx->posRot.pos.y + 52.0f, thisx->posRot.pos.z, 0, 0, 0,
(this->flameColor << 8) + thisx->params + 0x1000);
} else if (!Flags_GetSwitch(globalCtx, this->actor.params)) {
} else if (!Flags_GetSwitch(globalCtx, thisx->params)) {
if (globalCtx->envCtx.unk_BF == 0xFF) {
globalCtx->envCtx.unk_BF = 4;
}

View file

@ -163,8 +163,11 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) {
osSyncPrintf("(field keep 蝶)(%x)(arg_data 0x%04x)\n", this, this->actor.params);
}
void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &THIS->collider);
void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnButte* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
void func_809CD56C(EnButte* this) {

View file

@ -538,8 +538,11 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.initPosRot.rot.z & 1);
}
void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &THIS->collider);
void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnGoroiwa* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
void func_80A4D5E0(EnGoroiwa* this) {

View file

@ -67,40 +67,38 @@ void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
void EnHata_Update(Actor* thisx, GlobalContext* globalCtx) {
GlobalContext* gblCtx;
s32 target;
void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnHata* this = THIS;
s32 pitch;
Vec3f sp48;
Vec3f sp48 = sVec;
Vec3f sp3C;
f32 sin;
sp48 = sVec;
SkelAnime_FrameUpdateMatrix(&THIS->skelAnime);
gblCtx = globalCtx;
THIS->limbs[3].y = THIS->limbs[12].y = -0x4000;
sp3C.x = gblCtx->envCtx.unk_A8;
sp3C.y = gblCtx->envCtx.unk_AA;
sp3C.z = gblCtx->envCtx.unk_AC;
if (gblCtx->envCtx.unk_B0 > 255.0f) {
gblCtx->envCtx.unk_B0 = 255.0f;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
this->limbs[3].y = this->limbs[12].y = -0x4000;
sp3C.x = globalCtx->envCtx.unk_A8;
sp3C.y = globalCtx->envCtx.unk_AA;
sp3C.z = globalCtx->envCtx.unk_AC;
if (globalCtx->envCtx.unk_B0 > 255.0f) {
globalCtx->envCtx.unk_B0 = 255.0f;
}
if (gblCtx->envCtx.unk_B0 < 0.0f) {
gblCtx->envCtx.unk_B0 = 0.0f;
if (globalCtx->envCtx.unk_B0 < 0.0f) {
globalCtx->envCtx.unk_B0 = 0.0f;
}
if (Math_Rand_ZeroOne() > 0.5f) {
THIS->unk_278 += 6000;
this->unk_278 += 6000;
} else {
THIS->unk_278 += 3000;
this->unk_278 += 3000;
}
sin = Math_Sins(THIS->unk_278) * 80.0f;
sin = Math_Sins(this->unk_278) * 80.0f;
pitch = -Math_Vec3f_Pitch(&sp48, &sp3C);
target = ((s32)((0x3A98 - pitch) * (1.0f - (gblCtx->envCtx.unk_B0 / (255.0f - sin))))) + pitch;
Math_SmoothScaleMaxMinS(&THIS->limbs[4].y, target, THIS->invScale, THIS->maxStep, THIS->minStep);
THIS->limbs[13].y = THIS->limbs[4].y;
THIS->limbs[4].z = -Math_Vec3f_Yaw(&sp48, &sp3C);
THIS->limbs[13].z = THIS->limbs[4].z;
THIS->skelAnime.animPlaybackSpeed = (Math_Rand_ZeroFloat(1.25f) + 2.75f) * (gblCtx->envCtx.unk_B0 / 255.0f);
pitch = ((s32)((0x3A98 - pitch) * (1.0f - (globalCtx->envCtx.unk_B0 / (255.0f - sin))))) + pitch;
Math_SmoothScaleMaxMinS(&this->limbs[4].y, pitch, this->invScale, this->maxStep, this->minStep);
this->limbs[13].y = this->limbs[4].y;
this->limbs[4].z = -Math_Vec3f_Yaw(&sp48, &sp3C);
this->limbs[13].z = this->limbs[4].z;
this->skelAnime.animPlaybackSpeed = (Math_Rand_ZeroFloat(1.25f) + 2.75f) * (globalCtx->envCtx.unk_B0 / 255.0f);
}
s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {

View file

@ -312,8 +312,11 @@ void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) {
EnIshi_SetupWait(this);
}
void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &THIS->collider);
void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnIshi* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void EnIshi_SetupWait(EnIshi* this) {

View file

@ -253,8 +253,11 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) {
func_80A9B7EC(this);
}
void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &THIS->collider);
void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnKusa* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void func_80A9B7EC(EnKusa* this) {

View file

@ -454,21 +454,22 @@ void EnKz_Update(Actor* thisx, GlobalContext* globalCtx) {
}
s32 EnKz_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 limb = limbIndex;
EnKz* this = THIS;
if (limb == 8 || limb == 9 || limb == 10) {
rot->y += Math_Sins(THIS->unk_2A6[limb]) * 200.0f;
rot->z += Math_Coss(THIS->unk_2BE[limb]) * 200.0f;
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 10) {
rot->y += Math_Sins(this->unk_2A6[limbIndex]) * 200.0f;
rot->z += Math_Coss(this->unk_2BE[limbIndex]) * 200.0f;
}
if (limbIndex) {}
return 0;
}
void EnKz_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
s32 limb = limbIndex;
EnKz* this = THIS;
Vec3f mult = { 2600.0f, 0.0f, 0.0f };
if (limb == 11) {
Matrix_MultVec3f(&mult, &THIS->actor.posRot2.pos);
if (limbIndex == 11) {
Matrix_MultVec3f(&mult, &this->actor.posRot2.pos);
}
}

View file

@ -314,7 +314,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) {
if ((this->unk_307 == 0) && (func_8002DB48(&this->actor, &player->actor) <= 45.0f) &&
(func_8002E084(&this->actor, 0x38E3))) {
player->actor.freezeTimer = 0;
if (globalCtx->grabPlayer(globalCtx, &player->actor) != 0) {
if (globalCtx->grabPlayer(globalCtx, player)) {
this->actor.flags &= ~1;
func_80AE33F0(this);
}
@ -854,9 +854,9 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
}
void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnRd* this = THIS;
s32 pad;
Vec3f thisPos = this->actor.posRot.pos;
EnRd* this = THIS;
Vec3f thisPos = thisx->posRot.pos;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rd.c", 1679);
@ -869,10 +869,10 @@ void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
POLY_OPA_DISP);
func_80033C30(&thisPos, &D_80AE4958, 255, globalCtx);
if (this->unk_31A != 0) {
this->actor.dmgEffectTimer++;
THIS->unk_31A--;
thisx->dmgEffectTimer++;
this->unk_31A--;
if (this->unk_31A % 4 == 0) {
EffectSsEnFire_SpawnVec3s(globalCtx, &this->actor, &this->firePos[this->unk_31A >> 2], 0x4B, 0, 0,
EffectSsEnFire_SpawnVec3s(globalCtx, thisx, &this->firePos[this->unk_31A >> 2], 0x4B, 0, 0,
(this->unk_31A >> 2));
}
}

View file

@ -82,8 +82,11 @@ void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &THIS->collider);
void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
ObjBombiwa* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) {

View file

@ -145,8 +145,11 @@ void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjComb_SetupWait(this);
}
void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &THIS->collider);
void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
ObjComb* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
void ObjComb_SetupWait(ObjComb* this) {

View file

@ -143,7 +143,10 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) {
}
void ObjTimeblock_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, THIS->dyna.dynaPolyId);
s32 pad;
ObjTimeblock* this = THIS;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) {
@ -330,8 +333,8 @@ void ObjTimeblock_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void ObjTimeblock_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (THIS->isVisible) {
Color_RGB8* primColor = &sPrimColors[THIS->dyna.actor.initPosRot.rot.z & 7];
if (((ObjTimeblock*)thisx)->isVisible) {
Color_RGB8* primColor = &sPrimColors[thisx->initPosRot.rot.z & 7];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_timeblock.c", 762);