mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 06:54:14 -04:00
z_actor with some documentation, with 1 NON_EQUIVALENTs (#401)
* Match Player_GetHeight * Another bunch * Fix merge conflict * rename Gfx_DrawDListXlu * add WEEROR * Actor_Spawn * almost Actor_SpawnTransitionActors and Actor_Delete * A bunch of small actors * More renames * format * Some Player renames * a few more * import data * run formatter * func_800B7170 * whoops * Fix merge issues * Whoops 2 * func_800B83BC and func_800B83F8 * Actor_IsActorFacingPlayerAndWithinRange * add some prototypes * match Actor_UpdateBgCheckInfo * func_800B7678 * mark Actor_SpawnAsChildAndCutscene as non_matching * Actor_Draw * Update is chaotic * 2 new matches * func_800BC8B8 * Another bunch * function renames * run formatter * cleanup * remove unnecesary casts * add missing sfx * Fix renames * fix merge * func_800BF7CC * small bunch * another bunch * func_800BE184 non_matching * two more * split z_cheap_proc * Another bunch * another bunch * a few and a non matching * yeee * a * Actor_DrawAll non_equivalent * Actor_RecordUndrawnActor * i don't know what to put in this commit message * func_800B4B50 non matching * func_800B42F8 non matching * func_800B5040 * func_800B5814 non_equiv * func_800B6584 * func_800B6608 * func_800B6680 * func_800B7E04 * func_800B8118 * func_800b9170 * , * func_800BC4EC * func_800BA6FC * func_800BA798 * func_800BA8B8 * Actor_LoadOverlay * small cleanup * func_800BB2D0 * meh * func_800BBAC0 * func_800BC270 * func_800B5208 non matching * Fix warnings * meh * rename some ActorShadow_ functions * fairy * Flags_ * fix warnings * format * Actor_PickUp and family * func_800B8E58 * match Actor_RemoveFromCategory * another bit of docs * Match func_800B86C8 * And another bit * rename Player_GetRunSpeedLimit * func_800B9E84 * func_800BE63C * func_800BB8EC * match func_800B5814 * match func_800B9334 * cleanup * fix conflicts: first pass * another fix * actorfixer fix * fix conflicts * func_800BE680 non_equivalent * Improve func_800BE680 a bit * func_800BE680 equivalent (?) * func_800BE680 equivalent * Actor_UpdateActor equivalent * format * use some ExchangeItemID enum values * Some more cleaning * more cleanup * More name stealing from OoT * match func_800B82EC * match func_800B9D1C and a bit of cleanup * Add ACTOR_FLAGS placeholders * Renames and match func_800BE184 * last pass of name stealing * format * fix conflicts * more cleanup * more cleanup * cleanup and OVERLAY_RELOCATION_OFFSET macro * Remove prototypes of obviously internal-only functions, update variable names, forward declare where necessary, remove all `param_\d`s * remove newlines * minor rename * Use ACTOR_FLAGS in z_actor * Match func_800BE3D0 * Rename movement functions * Document Actor_CalcOffsetOrientedToDrawRotation * velX -> horizontalSpeed * A bit of documentation for actor movement functions * format * Fix merge issues * format * Format * Fix renames * fix warnings * fix conflicts * review :D * Update src/overlays/actors/ovl_En_Ma4/z_en_ma4.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Fix * format * Actor_SpawnSetupActors * engineer review * Update src/code/z_actor.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * A bunch of Engineer's reviews * more Engineer's review * a * whoops * run actorfixer * c'mon * 😮💨 * whoops * warning * More engineer's review * run format * I'm dumb * a * match func_800BE680 * Match Actor_DrawZTarget * Match Actor_SpawnAsChildAndCutscene, fix non-equivalent in Actor_UpdateActor * Fix merge issue * format * update actor * Steal a bit of @Thar0 documentation from OoT's z_message * Run actorfixer * Fix renames * Match func_800B4B50 thanks to @hensldm * Improve ActorShadow_DrawFeet thanks to @hensldm * whoops * Actor_PlaySfxAtProjectedPos * Actor_UpdateActor matched by @hensldm * Match func_800BA2FC by @hensldm * Match Actor_SpawnTransitionActors by @hensldm * Match func_800BB604 by @hensldm * Match Actor_DrawAll by @hensldm * ActorShadow_DrawFeet by @hensldm * Actor_UpdateAll by @hensldm * Match func_800BCCDC by @engineer124 * Small Actor_PlaySfxAtPos by @engineer124 * ACTOR_FLAGS_ALL and a bit of cleanup * Add invisible comment * Small docs pass * Fix merge * Engineer's review * format lol * Actor_DrawDoorLock docs * Actor_SpawnShieldParticlesMetal * fix merge issues * sActorFaultClient * fix * commit message * Run actorfixer.py && format.sh * Fix warnings * fixes * format * bss * Update include/functions.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Address review * Fix merge issues, format and such * fix merge issues * Add ACTORCAT_MAX * actorList -> actorLists * Fix merge issues * format * Enable WERROR on jenkinsfile * Fix merge * Use object symbols * address review * format * review * fix merge issues * fix * VRAM_PTR_SIZE, small cleanup and format * review Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
This commit is contained in:
@@ -63,7 +63,7 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80952BA0);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 35.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
|
||||
Actor_SetScale(&this->actor, 0.015f);
|
||||
this->actor.colChkInfo.mass = 0xFF;
|
||||
this->actionFunc = func_80952734;
|
||||
@@ -87,7 +87,7 @@ void func_80952734(EnMs* this, GlobalContext* globalCtx) {
|
||||
this->actor.textId = 0x932;
|
||||
}
|
||||
|
||||
if (func_800B84D0(&this->actor, globalCtx) != 0) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
|
||||
this->actionFunc = func_809527F8;
|
||||
return;
|
||||
}
|
||||
@@ -107,12 +107,12 @@ void func_809529AC(EnMs *this, GlobalContext *globalCtx) {
|
||||
func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0);
|
||||
this->actionFunc = func_80952A1C;
|
||||
} else {
|
||||
func_800B8A1C(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80952A1C(EnMs *this, GlobalContext *globalCtx) {
|
||||
if (func_800B84D0(&this->actor, globalCtx)) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
|
||||
func_80151938(globalCtx, 0x936U);
|
||||
this->actionFunc = func_809527F8;
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnMs* this = THIS;
|
||||
|
||||
Actor_SetHeight(&this->actor, 20.0f);
|
||||
Actor_SetFocus(&this->actor, 20.0f);
|
||||
this->actor.targetArrowOffset = 500.0f;
|
||||
Actor_SetScale(&this->actor, 0.015f);
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
@@ -156,7 +156,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
u8 temp_v0;
|
||||
u8 temp_v0_2;
|
||||
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 != 4) {
|
||||
if (temp_v0 != 5) {
|
||||
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
|
||||
@@ -168,7 +168,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
}
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
return;
|
||||
}
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
which is long, messy, and contains some rather nasty-looking control flow, including horrors like
|
||||
|
||||
```C
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 != 4) {
|
||||
if (temp_v0 != 5) {
|
||||
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
|
||||
@@ -238,7 +238,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
u8 temp_v0;
|
||||
u8 temp_v0_2;
|
||||
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 == 4) {
|
||||
goto block_7;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ block_5:
|
||||
goto block_17;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
@@ -290,7 +290,7 @@ block_13:
|
||||
return;
|
||||
block_15:
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
@@ -340,7 +340,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
u8 temp_v0;
|
||||
u8 temp_v0_2;
|
||||
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 == 4) {
|
||||
goto block_7;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ block_5:
|
||||
goto block_17;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
@@ -390,7 +390,7 @@ block_11:
|
||||
}
|
||||
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
@@ -410,7 +410,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
u8 temp_v0;
|
||||
u8 temp_v0_2;
|
||||
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 == 4) {
|
||||
goto block_7;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ block_5:
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
@@ -460,7 +460,7 @@ block_11:
|
||||
}
|
||||
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
@@ -509,7 +509,7 @@ So let us rewrite the entire second half as a switch:
|
||||
}
|
||||
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
@@ -540,7 +540,7 @@ There's a couple of other obvious things here:
|
||||
func_80151938(globalCtx, 0x937U);
|
||||
} else {
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
@@ -568,7 +568,7 @@ can be swapped round and made to wrap the switch. This leaves us with
|
||||
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
u8 temp_v0;
|
||||
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 == 4) {
|
||||
goto block_7;
|
||||
}
|
||||
@@ -588,7 +588,7 @@ block_5:
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
@@ -605,7 +605,7 @@ block_7:
|
||||
func_80151938(globalCtx, 0x937U);
|
||||
} else {
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
@@ -623,7 +623,7 @@ block_7:
|
||||
|
||||
Now, the top of the function also looks like a switch:
|
||||
```C
|
||||
temp_v0 = func_80152498(&globalCtx->msgCtx);
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 == 4) {
|
||||
goto block_7;
|
||||
}
|
||||
@@ -641,7 +641,7 @@ Putting all this together, we write down a function with no gotos in it:
|
||||
|
||||
```C
|
||||
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
switch (func_80152498(&globalCtx->msgCtx)) {
|
||||
switch (Message_GetState(&globalCtx->msgCtx)) {
|
||||
case 6:
|
||||
this->actionFunc = func_80952734;
|
||||
break;
|
||||
@@ -651,7 +651,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
break;
|
||||
|
||||
@@ -660,7 +660,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_801477B4(globalCtx);
|
||||
|
||||
|
||||
if (gSaveContext.rupees < 0xA) {
|
||||
play_sound(0x4806U);
|
||||
func_80151938(globalCtx, 0x935U);
|
||||
@@ -669,7 +669,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
func_80151938(globalCtx, 0x937U);
|
||||
} else {
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
@@ -694,7 +694,7 @@ Lastly, we can simplify `case 5` to replace the return in the if by the rest of
|
||||
|
||||
```C
|
||||
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
switch (func_80152498(&globalCtx->msgCtx)) {
|
||||
switch (Message_GetState(&globalCtx->msgCtx)) {
|
||||
case 6:
|
||||
this->actionFunc = func_80952734;
|
||||
break;
|
||||
@@ -702,7 +702,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
case 5:
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
func_801477B4(globalCtx);
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
break;
|
||||
@@ -712,7 +712,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_801477B4(globalCtx);
|
||||
|
||||
|
||||
if (gSaveContext.rupees < 0xA) {
|
||||
play_sound(0x4806U);
|
||||
func_80151938(globalCtx, 0x935U);
|
||||
@@ -721,7 +721,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
func_80151938(globalCtx, 0x937U);
|
||||
} else {
|
||||
func_8019F208();
|
||||
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
|
||||
func_801159EC(-0xA);
|
||||
this->actionFunc = func_809529AC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user