Replace Actor_MarkForDeath with Actor_Kill (#1118)

* Replace `Actor_MarkForDeath` with `Actor_Kill`

* Replace if-else with early returns, as per hensldm's review

* Respond to Elliptic's review

* Redundant spelling
This commit is contained in:
Tom Overton
2022-10-15 05:35:55 +01:00
committed by GitHub
parent a38f45b268
commit 638f5062cb
338 changed files with 1301 additions and 1190 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ Floats usually need an `f` on the end to match, or IDO will use doubles. Our flo
bar();
```
**Exception**: After `Actor_MarkForDeath` or sometimes setting the action function, if it makes sense to do so (this expresses the finality a bit better).
**Exception**: After `Actor_Kill` or sometimes setting the action function, if it makes sense to do so (this expresses the finality a bit better).
## Macros and enums
+1 -1
View File
@@ -619,7 +619,7 @@ f32 func_800B64FC(PlayState* play, f32 arg1, Vec3f* arg2, u32* arg3);
void* func_800B6584(PlayState* play, s16 id, void* arg2, size_t size);
void* func_800B6608(PlayState* play, s16 id);
void* func_800B6680(PlayState* play, s16 id);
void Actor_MarkForDeath(Actor* actor);
void Actor_Kill(Actor* actor);
void Actor_SetWorldToHome(Actor* actor);
void Actor_SetFocus(Actor* actor, f32 height);
void Actor_SetWorldRotToShape(Actor* actor);
+5 -5
View File
@@ -1026,7 +1026,7 @@ void* func_800B6680(PlayState* play, s16 id) {
return NULL;
}
void Actor_MarkForDeath(Actor* actor) {
void Actor_Kill(Actor* actor) {
actor->draw = NULL;
actor->update = NULL;
actor->flags &= ~ACTOR_FLAG_1;
@@ -2346,7 +2346,7 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
}
} else {
if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
Actor_MarkForDeath(actor);
Actor_Kill(actor);
} else {
s32 tmp = (params->unk_08 == 0);
@@ -2872,7 +2872,7 @@ void func_800BA6FC(PlayState* play, ActorContext* actorCtx) {
while (actor != NULL) {
if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
Actor_MarkForDeath(actor);
Actor_Kill(actor);
}
actor = actor->next;
@@ -2896,7 +2896,7 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) {
if (!actor->isDrawn) {
actor = Actor_Delete(actorCtx, actor, play);
} else {
Actor_MarkForDeath(actor);
Actor_Kill(actor);
Actor_Destroy(actor, play);
actor = actor->next;
}
@@ -2925,7 +2925,7 @@ void func_800BA8B8(PlayState* play, ActorContext* actorCtx) {
if (!actor->isDrawn) {
actor = Actor_Delete(actorCtx, actor, play);
} else {
Actor_MarkForDeath(actor);
Actor_Kill(actor);
Actor_Destroy(actor, play);
actor = actor->next;
}
+6 -6
View File
@@ -86,7 +86,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->collectibleFlag = 0;
this->actor.params = ITEM00_RECOVERY_HEART;
} else {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
}
@@ -358,7 +358,7 @@ void func_800A640C(EnItem00* this, PlayState* play) {
if (this->unk152 == 0) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) &&
(this->actor.params != ITEM00_HEART_CONTAINER)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
}
}
@@ -464,7 +464,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
}
if (this->unk152 == 0) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -510,7 +510,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D);
if (this->actor.floorHeight <= BGCHECK_Y_MIN) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
}
@@ -659,7 +659,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
case ITEM00_COMPASS:
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
}
return;
@@ -672,7 +672,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
} else if (getItemId != GI_NONE) {
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
}
return;
} else {
@@ -130,7 +130,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if ((this->actor.parent == NULL) || (!Player_IsHoldingHookshot(player))) {
ArmsHook_DetachHookFromActor(this);
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -90,7 +90,7 @@ void FireArrow_ChargeAndWait(ArrowFire* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
if (this->radius < 10) {
@@ -156,7 +156,7 @@ void FireArrow_Hit(ArrowFire* this, PlayState* play) {
}
if (this->timer == 0) {
this->timer = 255;
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
if (this->timer >= 13) {
@@ -171,7 +171,7 @@ void FireArrow_Fly(ArrowFire* this, PlayState* play) {
s32 pad2;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -194,7 +194,7 @@ void FireArrow_Fly(ArrowFire* this, PlayState* play) {
}
if (arrow->unk_260 < 34) {
if (this->alpha < 35) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
this->alpha -= 25;
@@ -205,7 +205,7 @@ void ArrowFire_Update(Actor* thisx, PlayState* play) {
ArrowFire* this = (ArrowFire*)thisx;
if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
this->actionFunc(this, play);
@@ -65,7 +65,7 @@ void ArrowIce_Charge(ArrowIce* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -136,7 +136,7 @@ void ArrowIce_Hit(ArrowIce* this, PlayState* play) {
if (this->timer == 0) {
this->timer = 255;
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
}
}
@@ -146,7 +146,7 @@ void ArrowIce_Fly(ArrowIce* this, PlayState* play) {
s32 pad;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
// copy position and rotation from arrow
@@ -166,7 +166,7 @@ void ArrowIce_Fly(ArrowIce* this, PlayState* play) {
this->alpha = 255;
} else if (arrow->unk_260 < 34) {
if (this->alpha < 35) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
} else {
this->alpha -= 25;
}
@@ -177,7 +177,7 @@ void ArrowIce_Update(Actor* thisx, PlayState* play) {
ArrowIce* this = THIS;
if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
} else {
this->actionFunc(this, play);
@@ -64,7 +64,7 @@ void ArrowLight_Charge(ArrowLight* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -129,7 +129,7 @@ void ArrowLight_Hit(ArrowLight* this, PlayState* play) {
}
if (this->timer == 0) {
this->timer = 255;
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
}
@@ -139,7 +139,7 @@ void ArrowLight_Fly(ArrowLight* this, PlayState* play) {
s32 pad[2];
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
@@ -162,7 +162,7 @@ void ArrowLight_Fly(ArrowLight* this, PlayState* play) {
}
if (arrow->unk_260 < 34) {
if (this->alpha < 35) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
this->alpha -= 25;
@@ -173,7 +173,7 @@ void ArrowLight_Update(Actor* thisx, PlayState* play) {
ArrowLight* this = THIS;
if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
return;
}
this->actionFunc(this, play);
@@ -104,12 +104,12 @@ void BgAstrBombwall_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_LoadMesh(play, &this->dyna, &object_astr_obj_Colheader_002498);
Collider_InitTris(play, &this->collider);
if (Flags_GetSwitch(play, BGASTRBOMBWALL_GET_SWITCHFLAG(thisx))) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
this->dyna.actor.flags |= ACTOR_FLAG_10000000;
if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements)) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
BgAstrBombwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot, &this->collider);
@@ -216,7 +216,7 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) {
this->unk_15C = Object_GetIndex(&play->objectCtx, sp24->unk_00);
if ((this->unk_15C < 0) || !sp24->unk_14(this, play)) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
@@ -286,7 +286,7 @@ void func_808B782C(BgBreakwall* this, PlayState* play) {
void func_808B78A4(BgBreakwall* this, PlayState* play) {
if (gSaveContext.save.weekEventReg[55] & 0x80) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -92,7 +92,7 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) {
for (j = 0; j < sLoadedDoorCount; j++) {
if (sIsLoaded[j] == this->index) {
this->stateFlags |= BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED;
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
}
@@ -125,7 +125,7 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) {
break;
default:
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
break;
}
}
@@ -174,7 +174,7 @@ void BgCtowerGear_UpdateOrgan(Actor* thisx, PlayState* play) {
func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId);
break;
case 3:
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
break;
}
}
@@ -167,7 +167,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) {
if ((this->unk_160 == 9) || (this->unk_160 == 8)) {
if (D_80A2BBF4.unk_00 != 0) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
this->unk_170 = this->dyna.actor.room;
@@ -178,7 +178,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.shape.rot.z = 0;
} else if (this->unk_160 == 6) {
if (D_80A2BBF4.unk_01 != 0) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
this->unk_171 = this->dyna.actor.world.rot.z;
@@ -238,7 +238,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.world.rot.z = 0;
this->dyna.actor.shape.rot.z = 0;
if (Flags_GetSwitch(play, this->unk_1C0)) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
break;
}
this->unk_18C = 0;
@@ -350,7 +350,7 @@ void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) {
if (play->roomCtx.curRoom.num != this->unk_171) {
if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) {
D_80A2BBF4.unk_01 = 0;
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
}
@@ -452,7 +452,7 @@ void func_80A2A688(BgDblueMovebg* this, PlayState* play) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 60.0f, 2.0f) &&
(this->unk_180 <= 0)) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -632,7 +632,7 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) {
if (play->roomCtx.curRoom.num != this->unk_171) {
if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) {
D_80A2BBF4.unk_00 = 0;
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
}
@@ -733,7 +733,7 @@ void func_80A2B274(Actor* thisx, PlayState* play) {
s16 temp_v1;
if (this != D_80A2BBF0) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
@@ -166,7 +166,7 @@ void func_809AC7F8(BgFireWall* this, PlayState* play) {
void func_809AC970(BgFireWall* this, PlayState* play) {
if (Math_StepToF(&this->actor.scale.y, 0.005f, this->unk_158)) {
Actor_MarkForDeath(&this->actor);
Actor_Kill(&this->actor);
}
}
@@ -154,7 +154,7 @@ void BgHakaBombwall_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
Collider_InitCylinder(play, &this->collider);
if (Flags_GetSwitch(play, BGHAKABOMBWALL_GET_7F(thisx))) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
} else {
DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000148);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
@@ -211,7 +211,7 @@ void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play) {
this->csTimer--;
if (this->csTimer <= 0) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -317,7 +317,7 @@ void BgHakuginBombwall_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
if (Flags_GetSwitch(play, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor))) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
@@ -414,7 +414,7 @@ void func_80ABCE60(BgHakuginBombwall* this, PlayState* play) {
this->unk_1AC--;
if (this->unk_1AC <= 0) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
} else if (this->unk_1AC == ptr->unk_2C) {
ptr->unk_28(this, play);
}
@@ -709,7 +709,7 @@ void BgHakuginPost_Init(Actor* thisx, PlayState* play) {
func_80A9CA94(this);
} else {
func_80A9AFB4(this, play, &D_80A9E028);
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -158,7 +158,7 @@ void func_80AC4D2C(BgIcefloe* this, PlayState* play) {
}
this->dyna.actor.scale.y -= 0.0026f;
if (this->dyna.actor.scale.y <= 0.0f) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -178,8 +178,7 @@ void BgIcicle_Fall(BgIcicle* this, PlayState* play) {
func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId);
this->actionFunc = BgIcicle_Regrow;
} else {
Actor_MarkForDeath(&this->dyna.actor);
return;
Actor_Kill(&this->dyna.actor);
}
} else {
Actor_MoveWithGravity(&this->dyna.actor);
@@ -225,7 +224,7 @@ void BgIcicle_UpdateAttacked(BgIcicle* this, PlayState* play) {
BgIcicle_Break(this, play, 40.0f);
}
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}
@@ -239,7 +239,7 @@ void BgIkanaBombwall_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
if (Flags_GetSwitch(play, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor))) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
return;
}
@@ -349,14 +349,14 @@ void func_80BD5134(BgIkanaBombwall* this, PlayState* play) {
this->unk_1AC--;
if (this->unk_1AC <= 0) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
} else if (this->dyna.actor.cutscene >= 0) {
if (ActorCutscene_GetCurrentIndex() != this->dyna.actor.cutscene) {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
} else {
Actor_MarkForDeath(&this->dyna.actor);
Actor_Kill(&this->dyna.actor);
}
}

Some files were not shown because too many files have changed in this diff Show More