SubS Actor Getters OK (#475)

* Bring over matching actor getters

* Add arg names

* Rename functions

* Adjust rename_sym script to update sizes csvs

* Fix wrong function prototype

* whitespace

* Rename functions

* Fix actorfixer

* Format

* Add function comments and file header

* Fix merge

* format

* Fix merge

* format

* Move D_0407D590 down

* Fix merge

* Steal idea from z_actor PR to return  directly

* Swap function name order

* Fix merge
This commit is contained in:
Derek Hensley 2022-01-03 23:28:25 -08:00 committed by GitHub
parent be952305d8
commit 7611d833d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 177 additions and 90 deletions

View File

@ -2618,7 +2618,7 @@ void func_8013A46C(s32 flag);
u32 func_8013A4C4(s32 flag);
s16 func_8013A504(s16 val);
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError);
Actor* func_8013A7C0(GlobalContext* globalCtx, s32 arg1);
struct EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5);
Gfx* func_8013A860(GlobalContext* globalCtx, s32 idx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkActorDraw, Actor* actor, Mtx** mtx, Gfx* gfx);
Gfx* func_8013AB00(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkActorDraw, Actor* actor, Gfx* gfx);
s32 func_8013AD6C(GlobalContext* globalCtx);
@ -2631,7 +2631,7 @@ void func_8013B350(Vec3f* arg0, f32* arg1, f32 arg2, s32 arg3, s32 arg4, Vec3s*
s32 func_8013B6B0(Path* path, f32* arg1, s32* arg2, s32 arg3, s32 arg4, s32* arg5, f32* arg6, Vec3f* arg7, s32 arg8);
void func_8013B878(GlobalContext* globalCtx, Path* path, s32 arg2, Vec3f* arg3);
Path* func_8013BB34(GlobalContext* globalCtx, u8 arg1, s32 arg2);
Actor* func_8013BB7C(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId);
Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId);
s32 func_8013BC6C(SkelAnime* skelAnime, ActorAnimationEntryS* arg1, s32 arg2);
s32 func_8013BD40(Actor* actor, Path* path, s32 arg2);
Path* func_8013BEDC(GlobalContext* globalCtx, u8 arg1, u8 arg2, s32* arg3);
@ -2652,7 +2652,7 @@ s32 func_8013D768(Actor* actor, Vec3f* arg1, s16 arg2);
s16 func_8013D83C(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq);
s8 func_8013D8DC(s8 arg0, GlobalContext* globalCtx);
s8 func_8013D924(s16 arg0, GlobalContext* globalCtx);
Actor* func_ActorCategoryIterateById(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId);
Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId);
s32 func_8013D9C8(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3);
s32 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2);
s32 func_8013DC40(Path* arg0, s32 arg1, s32 arg2, Vec3f* arg3);
@ -2667,7 +2667,7 @@ s32 func_8013E2D4(Actor* actor, s16 arg1, s16 arg2, s32 arg3);
s32 func_8013E3B8(Actor* actor, s16 cutscenes[], s16 len);
void func_8013E4B0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Plane* plane);
s32 func_8013E5CC(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4, Vec3f* arg5);
Actor* func_8013E640(GlobalContext* globalCtx, Actor* arg1, Actor* actorListStart, u8 actorCategory, s16 actorId, void* arg5, func_8013E640_arg6 arg6);
Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, void* verifyData, VerifyActor verifyActor);
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, Vec3s* arg5, func_8013E748_arg6 arg6);
s32 func_8013E7C0(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2);
void func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, s16 arg5, s16 arg6);

View File

@ -1504,7 +1504,7 @@ typedef struct {
typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, Vec3s*);
typedef s32 (*func_8013E640_arg6)(struct GlobalContext*, Actor*, Actor*, void*);
typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
struct struct_8013DF3C_arg1;
typedef void (*struct_8013DF3C_arg1_unk_func1)(struct GlobalContext*, struct struct_8013DF3C_arg1*);

View File

@ -15,6 +15,8 @@ struct GlobalContext;
struct Lights;
struct CollisionPoly;
struct EnDoor;
typedef void(*ActorFunc)(struct Actor* this, struct GlobalContext* globalCtx);
typedef struct {

View File

@ -66,7 +66,7 @@ Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
f32 minDist = 0.0f;
do {
doorIter = func_ActorCategoryIterateById(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door = doorIter;
dist = Actor_DistanceBetweenActors(actor, door);
if (!isSetup || (dist < minDist)) {

View File

@ -1,6 +1,40 @@
#include "global.h"
/*
* File: z_sub_s.c
* Description: Various miscellaneous helpers
*/
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013A7C0.s")
#include "global.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
/**
* Finds the first EnDoor instance with unk_1A4 == 5 and the specified unk_1A5.
*/
EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5) {
Actor* actor = NULL;
EnDoor* door;
while (true) {
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door = (EnDoor*)actor;
if (actor == NULL) {
break;
}
if ((door->unk_1A4 == 5) && (door->unk_1A5 == (u8)unk_1A5)) {
break;
}
if (actor->next == NULL) {
door = NULL;
break;
}
actor = actor->next;
}
return door;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013A860.s")
@ -26,7 +60,40 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BB34.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BB7C.s")
/**
* Finds the nearest actor instance of a specified Id and category to an actor.
*/
Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId) {
Actor* actorIter = NULL;
Actor* actorTmp;
f32 dist;
Actor* closestActor = NULL;
f32 minDist = 99999.0f;
s32 isSetup = false;
do {
actorIter = SubS_FindActor(globalCtx, actorIter, actorCategory, actorId);
actorTmp = actorIter;
if (actorTmp == NULL) {
break;
}
actorIter = actorTmp;
if (actorIter != actor) {
dist = Actor_DistanceBetweenActors(actor, actorIter);
if (!isSetup || dist < minDist) {
closestActor = actorIter;
minDist = dist;
isSetup = true;
}
}
actorIter = actorIter->next;
} while (actorIter != NULL);
return closestActor;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BC6C.s")
@ -68,7 +135,22 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D924.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_ActorCategoryIterateById.s")
/**
* Finds the first actor instance of a specified Id and category.
*/
Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId) {
Actor* actor = actorListStart;
if (actor == NULL) {
actor = globalCtx->actorCtx.actorList[actorCategory].first;
}
while (actor != NULL && actorId != actor->id) {
actor = actor->next;
}
return actor;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D9C8.s")
@ -100,7 +182,27 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E5CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E640.s")
/**
* Finds the first actor instance of a specified Id and category verified with a custom callback.
* The callback should return `true` when the actor is succesfully verified.
*/
Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory,
s16 actorId, void* verifyData, VerifyActor verifyActor) {
Actor* actorIter = actorListStart;
if (actorListStart == NULL) {
actorIter = globalCtx->actorCtx.actorList[actorCategory].first;
}
while (actorIter != NULL && (actorId != actorIter->id ||
(actorId == actorIter->id &&
(verifyActor == NULL ||
(verifyActor != NULL && !verifyActor(globalCtx, actor, actorIter, verifyData)))))) {
actorIter = actorIter->next;
}
return actorIter;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E748.s")

View File

@ -464,7 +464,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx) {
Play_CameraSetAtEye(globalCtx, MAIN_CAM, &subCam->at, &subCam->eye);
this->cutsceneSubCamId = SUBCAM_FREE;
if (this->actor.params == ENBIGPO_SUMMONED) {
dampe = func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_TK);
dampe = SubS_FindActor(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_TK);
if (dampe != NULL) {
// if dampe exists, switch to viewing his running away cutscene
dampe->params = this->actor.cutscene;

View File

@ -2585,8 +2585,7 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globa
EnBigslime_SetPlayerParams(this, globalCtx);
this->rotation = 0;
EnBigslime_SetupFreeze(this);
minislime = (EnMinislime*)func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_ITEMACTION,
ACTOR_ARROW_ICE);
minislime = (EnMinislime*)SubS_FindActor(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_ARROW_ICE);
if (minislime != NULL) {
minislime->shakeRefPos.z = -100.0f;
}

View File

@ -116,8 +116,7 @@ void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx) {
return;
}
} else {
this->moonsTear =
(ObjMoonStone*)func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE);
this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE);
}
func_800B8500(&this->actor, globalCtx, 60.0f, 10.0f, 0);
}
@ -350,8 +349,7 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
func_8013E3B8(&this->actor, this->cutscenes,
ARRAY_COUNT(this->cutscenes)); /* initializes all elements of cutscenes to -1 */
this->moonsTear =
(ObjMoonStone*)func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE);
this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE);
switch (gSaveContext.entranceIndex) {
case 0x4C00: /* Observatory from ECT */

View File

@ -135,7 +135,7 @@ void func_80A714B4(EnDno* this, GlobalContext* globalCtx) {
Actor* actor = NULL;
do {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
if (actor != NULL) {
if ((s32)ENDNO_GET_F(actor) == ENDNO_GET_F_1) {
Actor_SetSwitchFlag(globalCtx, ENDNO_GET_7F0(actor));
@ -165,8 +165,7 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) {
Vec3f sp70;
do {
crace =
(BgCraceMovebg*)func_ActorCategoryIterateById(globalCtx, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
crace = (BgCraceMovebg*)SubS_FindActor(globalCtx, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
if (crace != NULL) {
if (ENDNO_GET_F(&crace->actor) == ENDNO_GET_F_0 && !(crace->unk_170 & 1)) {
if (func_8013E5CC(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C, &this->actor.prevPos,
@ -188,7 +187,7 @@ void func_80A71788(EnDno* this, GlobalContext* globalCtx) {
Actor* actor = NULL;
do {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
if (actor != NULL) {
Actor_UnsetSwitchFlag(globalCtx, ENDNO_GET_7F0(actor));
actor = actor->next;
@ -202,7 +201,7 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor* actor = NULL;
while (true) {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_DNO);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_DNO);
if (actor != NULL) {
if (actor != thisx) {
Actor_MarkForDeath(thisx);
@ -249,7 +248,7 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_MarkForDeath(thisx);
} else {
func_8013E1C8(&this->skelAnime, sAnimations, 13, &this->unk_32C);
this->unk_460 = func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ);
this->unk_460 = SubS_FindActor(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ);
if (this->unk_460 == NULL) {
Actor_MarkForDeath(thisx);
} else {

View File

@ -12,7 +12,10 @@ typedef struct EnDoor {
/* 0x144 */ char unk_144[0x5C];
/* 0x1A0 */ s8 unk_1A0;
/* 0x1A1 */ s8 unk_1A1;
/* 0x1A2 */ char unk_1A2[0x5];
/* 0x1A2 */ char unk_1A2[0x2];
/* 0x1A4 */ u8 unk_1A4;
/* 0x1A5 */ u8 unk_1A5;
/* 0x1A6 */ s8 unk_1A6;
/* 0x1A7 */ s8 unk_1A7;
/* 0x1A8 */ char unk_1A8[0x20];
/* 0x1C8 */ EnDoorActionFunc actionFunc;

View File

@ -100,7 +100,7 @@ s32 func_80B0F660(EnGb2* this, GlobalContext* globalCtx) {
Actor* phi_s0 = NULL;
while (true) {
temp_v0 = func_ActorCategoryIterateById(globalCtx, phi_s0, ACTORCAT_NPC, ACTOR_EN_GB2);
temp_v0 = SubS_FindActor(globalCtx, phi_s0, ACTORCAT_NPC, ACTOR_EN_GB2);
if (temp_v0 == NULL) {
break;
}

View File

@ -259,7 +259,7 @@ Vec3f* func_80BB19C0(Vec3f* arg0, EnGeg* this, GlobalContext* globalCtx) {
u8 func_80BB1B14(EnGeg* this, GlobalContext* globalCtx) {
Actor* explosive;
Actor* mm = func_ActorCategoryIterateById(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_EN_MM);
Actor* mm = SubS_FindActor(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_EN_MM);
if (mm != NULL) {
this->unk_4B0 = Math_Vec3f_Yaw(&this->actor.world.pos, &mm->world.pos);

View File

@ -159,7 +159,7 @@ Actor* func_8094DEE0(EnGm* this, GlobalContext* globalCtx, u8 arg2, s16 arg3) {
Actor* actor;
while (true) {
actor = func_ActorCategoryIterateById(globalCtx, foundActor, arg2, arg3);
actor = SubS_FindActor(globalCtx, foundActor, arg2, arg3);
foundActor = actor;
if (actor == NULL) {
break;
@ -212,7 +212,7 @@ EnDoor* func_8094DF90(GlobalContext* globalCtx, s32 arg1) {
phi_a1 = -1;
}
return (EnDoor*)func_8013A7C0(globalCtx, phi_a1);
return SubS_FindDoor(globalCtx, phi_a1);
}
s32 func_8094DFF8(EnGm* this, GlobalContext* globalCtx) {

View File

@ -953,7 +953,7 @@ Actor* func_80A13400(EnGo* this, GlobalContext* globalCtx) {
Actor* retActor = NULL;
while (true) {
actor = func_ActorCategoryIterateById(globalCtx, retActor, ACTORCAT_NPC, ACTOR_EN_GO);
actor = SubS_FindActor(globalCtx, retActor, ACTORCAT_NPC, ACTOR_EN_GO);
retActor = actor;
if ((actor != NULL) && ((EnGo*)actor != this) && (ENGO_GET_F(actor) == ENGO_F_4) &&

View File

@ -35,7 +35,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx);
void func_80999A8C(EnGs* this, GlobalContext* globalCtx);
void func_80999AC0(EnGs* this);
extern Gfx D_0407D590[];
extern Gfx gGameplayKeepDrawFlameDL[];
extern Gfx D_06000950[];
extern Gfx D_060009D0[];
extern Gfx D_06000A60[];
@ -363,7 +363,7 @@ void func_809984F4(EnGs* this, GlobalContext* globalCtx) {
EnGs* gossipStone = NULL;
do {
gossipStone = (EnGs*)func_ActorCategoryIterateById(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS);
gossipStone = (EnGs*)SubS_FindActor(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS);
if (gossipStone != NULL) {
if ((this != gossipStone) && (this->unk_194 == gossipStone->unk_194)) {
gossipStone->unk_19A |= 1;
@ -396,8 +396,7 @@ void func_809985B8(EnGs* this, GlobalContext* globalCtx) {
gossipStone = NULL;
do {
gossipStone =
(EnGs*)func_ActorCategoryIterateById(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS);
gossipStone = (EnGs*)SubS_FindActor(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS);
if (gossipStone != NULL) {
if ((gossipStone != this) && (gossipStone->actor.params == ENGS_2) &&
(gossipStone->unk_198 == this->unk_198)) {
@ -1103,7 +1102,7 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80));
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, D_0407D590);
gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);

View File

@ -369,7 +369,7 @@ void func_808F38F8(EnIn* this, GlobalContext* globalCtx) {
this->unk4A4 = NULL;
while (true) {
//! @bug: Infinite loop if there is only one ACTOR_EN_IN
this->unk4A4 = (EnIn*)func_ActorCategoryIterateById(globalCtx, &this->unk4A4->actor, ACTORCAT_NPC, ACTOR_EN_IN);
this->unk4A4 = (EnIn*)SubS_FindActor(globalCtx, &this->unk4A4->actor, ACTORCAT_NPC, ACTOR_EN_IN);
if (this->unk4A4 != NULL && this->unk4A4 != this) {
break;
}

View File

@ -315,7 +315,7 @@ Actor* func_80AF7CB0(EnPm* this, GlobalContext* globalCtx, u8 actorCat, s16 acto
Actor* actor;
while (true) {
actor = func_ActorCategoryIterateById(globalCtx, phi_s0, actorCat, actorId);
actor = SubS_FindActor(globalCtx, phi_s0, actorCat, actorId);
phi_s0 = actor;
if (actor == NULL) {
@ -338,7 +338,7 @@ Actor* func_80AF7CB0(EnPm* this, GlobalContext* globalCtx, u8 actorCat, s16 acto
return phi_s0;
}
Actor* func_80AF7D60(GlobalContext* globalCtx, s32 arg1) {
EnDoor* func_80AF7D60(GlobalContext* globalCtx, s32 arg1) {
s32 phi_a1;
switch (arg1) {
@ -367,7 +367,7 @@ Actor* func_80AF7D60(GlobalContext* globalCtx, s32 arg1) {
return NULL;
}
return func_8013A7C0(globalCtx, phi_a1);
return SubS_FindDoor(globalCtx, phi_a1);
}
Actor* func_80AF7DC4(EnPm* this, GlobalContext* globalCtx, s32 arg2) {
@ -375,7 +375,7 @@ Actor* func_80AF7DC4(EnPm* this, GlobalContext* globalCtx, s32 arg2) {
Actor* actor;
while (true) {
actor = func_ActorCategoryIterateById(globalCtx, phi_s0, ACTORCAT_PROP, ACTOR_EN_PST);
actor = SubS_FindActor(globalCtx, phi_s0, ACTORCAT_PROP, ACTOR_EN_PST);
phi_s0 = actor;
if (actor == NULL) {
@ -942,7 +942,7 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) {
u16 sp56 = gSaveContext.time - 0x3FFC;
u8 sp55 = this->actor.params & 0xFF;
Actor* sp50;
EnDoor* sp50;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
@ -955,7 +955,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->unk_234 = func_8013BB34(globalCtx, sp55, D_80AFB430[arg2->unk0]);
}
if ((sp50 != NULL) && (sp50->update != NULL)) {
if ((sp50 != NULL) && (sp50->actor.update != NULL)) {
if (this->unk_234 != 0) {
sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points);
Math_Vec3s_ToVec3f(&sp40, &sp4C[0]);
@ -964,7 +964,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
Math_Vec3f_Copy(&this->unk_278, &sp34);
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp40, &sp34);
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
temp = this->actor.world.rot.y - sp50->shape.rot.y;
temp = this->actor.world.rot.y - sp50->actor.shape.rot.y;
if (ABS_ALT(temp) <= 0x4000) {
this->unk_260 = -0x4B;
} else {
@ -1409,7 +1409,7 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
}
s32 func_80AF9D04(EnPm* this, GlobalContext* globalCtx) {
EnDoor* sp44 = (EnDoor*)func_80AF7D60(globalCtx, this->unk_258);
EnDoor* sp44 = func_80AF7D60(globalCtx, this->unk_258);
Vec3f sp38;
Vec3f* sp28;
f32 temp;

View File

@ -689,7 +689,7 @@ s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg
if (this->unk428 == 10 || this->unk428 == 11 || this->unk428 == 2) {
return 0;
}
sp48 = (EnDoor*)func_8013BB7C(&this->actor, globalCtx, ACTORCAT_DOOR, ACTOR_EN_DOOR);
sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, globalCtx, ACTORCAT_DOOR, ACTOR_EN_DOOR);
sp24 = D_80BAE8F8[unkStruct->unk0];
if ((sp48 != NULL) && (sp24 >= 0)) {
this->unk404 = func_8013BB34(globalCtx, sp47, sp24);

View File

@ -429,7 +429,7 @@ void func_80C11338(EnThiefbird* this, GlobalContext* globalCtx) {
this->unk_3EC = NULL;
do {
item = (EnItem00*)func_ActorCategoryIterateById(globalCtx, &item->actor, ACTORCAT_MISC, ACTOR_EN_ITEM00);
item = (EnItem00*)SubS_FindActor(globalCtx, &item->actor, ACTORCAT_MISC, ACTOR_EN_ITEM00);
if (item != NULL) {
if (item->unk152 > 0) {
if (Actor_XZDistanceBetweenActors(&player->actor, &item->actor) > 10.0f) {

View File

@ -450,7 +450,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
door1 = NULL;
label:
do {
door1 = func_ActorCategoryIterateById(globalCtx, door1, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door1 = SubS_FindActor(globalCtx, door1, ACTORCAT_DOOR, ACTOR_EN_DOOR);
if (door1 != NULL) {
if (Actor_XZDistanceBetweenActors(&this->actor, door1) <= 120.0f) {
if (ABS(BINANG_SUB(Actor_YawToPoint(&this->actor, &door1->world.pos), this->actor.shape.rot.y)) <=
@ -466,7 +466,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
} else {
door2 = NULL;
do {
door2 = func_ActorCategoryIterateById(globalCtx, door2, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door2 = SubS_FindActor(globalCtx, door2, ACTORCAT_DOOR, ACTOR_EN_DOOR);
if (door2 != NULL) {
if (Actor_XZDistanceBetweenActors(&this->actor, door2) <= 160.0f) {
sp4C4 = (EnDoor*)door2;
@ -682,7 +682,7 @@ void func_80AED940(EnTk* this, GlobalContext* globalCtx) {
actor = NULL;
do {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_TK);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_TK);
if (actor != NULL) {
if (ENTK_GET_F(actor) == 1) {
Math_Vec3f_Copy(&this->unk_2EC, &actor->world.pos);
@ -933,7 +933,7 @@ void func_80AEE374(EnTk* this, GlobalContext* globalCtx) {
sp30.unk_00 = NULL;
sp30.unk_04 = FLT_MAX;
func_8013E640(globalCtx, &this->actor, NULL, ACTORCAT_NPC, ACTOR_EN_TK, &sp30, func_80AEE300);
SubS_FindActorCustom(globalCtx, &this->actor, NULL, ACTORCAT_NPC, ACTOR_EN_TK, &sp30, func_80AEE300);
if (sp30.unk_00 == 0) {
Actor_MarkForDeath(&this->actor);
} else {
@ -971,7 +971,7 @@ void func_80AEE4D0(EnTk* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, 37.0f)) {
bigPoe = NULL;
do {
bigPoe = func_ActorCategoryIterateById(globalCtx, bigPoe, ACTORCAT_PROP, ACTOR_EN_BIGPO);
bigPoe = SubS_FindActor(globalCtx, bigPoe, ACTORCAT_PROP, ACTOR_EN_BIGPO);
if (bigPoe != NULL) {
if ((bigPoe->params == 3) && (Actor_DistanceBetweenActors(&this->actor, bigPoe) < 80.0f)) {

View File

@ -56,7 +56,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, GlobalContext* globalCtx) {
if (1) {}
do {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_ENEMY, ACTOR_EN_SW);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_ENEMY, ACTOR_EN_SW);
if (actor == NULL) {
break;
}
@ -71,7 +71,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, GlobalContext* globalCtx) {
actor = NULL;
do {
actor = func_ActorCategoryIterateById(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_SW);
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_SW);
if (actor == NULL) {
break;

View File

@ -301,28 +301,13 @@ animdict = {
"func_8017F9C0": "Math3D_XZInSphere",
"func_8017FA34": "Math3D_XYInSphere",
"func_8017FAA8": "Math3D_YZInSphere",
"func_8013A7C0": "SubS_FindDoor",
"func_8013E640": "SubS_FindActorCustom",
"func_ActorCategoryIterateById": "SubS_FindActor",
"func_8013BB7C": "SubS_FindNearestActor",
"func_800A81F0": "EffectBlure_AddVertex",
"func_800A8514": "EffectBlure_AddSpace",
"Effect_GetParams": "Effect_GetByIndex",
"D_0407D590": "gGameplayKeepDrawFlameDL",
"skelanime.unk03": "skelanime.taper",
"skelanime.animCurrentSeg": "skelanime.animation",
"skelanime.initialFrame": "skelanime.startFrame",
"skelanime.animFrameCount": "skelanime.endFrame",
"skelanime.totalFrames": "skelanime.animLength",
"skelanime.animCurrentFrame": "skelanime.curFrame",
"skelanime.animPlaybackSpeed": "skelanime.playSpeed",
"skelanime.limbDrawTbl": "skelanime.jointTable",
"skelanime.transitionDrawTbl": "skelanime.morphTable",
"skelanime.transCurrentFrame": "skelanime.morphWeight",
"skelanime.transitionStep": "skelanime.morphRate",
"skelanime.animUpdate": "skelanime.update",
"skelanime.flags": "skelanime.moveFlags",
"skelanime.prevFrameRot": "skelanime.prevRot",
"skelanime.prevFramePos": "skelanime.prevTransl",
"skelanime.unk3E": "skelanime.baseTransl",
"skelAnime.unk03": "skelAnime.taper",
"skelAnime.animCurrentSeg": "skelAnime.animation",
@ -340,16 +325,16 @@ animdict = {
"skelAnime.prevFrameRot": "skelAnime.prevRot",
"skelAnime.prevFramePos": "skelAnime.prevTransl",
"skelAnime.unk3E": "skelAnime.baseTransl",
"actor.yDistToWater" : "actor.depthInWater",
"actor.yDistToPlayer" : "actor.playerHeightRel",
"actor.yDistToWater": "actor.depthInWater",
"actor.yDistToPlayer": "actor.playerHeightRel",
"globalCtx->mf_187FC": "globalCtx->billboardMtxF",
"globalCtx->projectionMatrix": "globalCtx->viewProjectionMtxF",
"globalCtx->mf_187FC" : "globalCtx->billboardMtxF",
"globalCtx->projectionMatrix" : "globalCtx->viewProjectionMtxF",
"D_801D15B0" : "gZeroVec3f",
"D_801D15BC" : "gZeroVec3s",
"D_801D1DE0" : "gIdentityMtx",
"D_801D1E20" : "gIdentityMtxF",
"D_0407D590": "gGameplayKeepDrawFlameDL",
"D_801D15B0": "gZeroVec3f",
"D_801D15BC": "gZeroVec3s",
"D_801D1DE0": "gIdentityMtx",
"D_801D1E20": "gIdentityMtxF",
}
def replace_anim(file):

View File

@ -2655,7 +2655,7 @@
0x8013A4C4:("func_8013A4C4",),
0x8013A504:("func_8013A504",),
0x8013A530:("func_8013A530",),
0x8013A7C0:("func_8013A7C0",),
0x8013A7C0:("SubS_FindDoor",),
0x8013A860:("func_8013A860",),
0x8013AB00:("func_8013AB00",),
0x8013AD6C:("func_8013AD6C",),
@ -2668,7 +2668,7 @@
0x8013B6B0:("func_8013B6B0",),
0x8013B878:("func_8013B878",),
0x8013BB34:("func_8013BB34",),
0x8013BB7C:("func_8013BB7C",),
0x8013BB7C:("SubS_FindNearestActor",),
0x8013BC6C:("func_8013BC6C",),
0x8013BD40:("func_8013BD40",),
0x8013BEDC:("func_8013BEDC",),
@ -2689,7 +2689,7 @@
0x8013D83C:("func_8013D83C",),
0x8013D8DC:("func_8013D8DC",),
0x8013D924:("func_8013D924",),
0x8013D960:("func_ActorCategoryIterateById",),
0x8013D960:("SubS_FindActor",),
0x8013D9C8:("func_8013D9C8",),
0x8013DB90:("func_8013DB90",),
0x8013DC40:("func_8013DC40",),
@ -2705,7 +2705,7 @@
0x8013E3B8:("func_8013E3B8",),
0x8013E4B0:("func_8013E4B0",),
0x8013E5CC:("func_8013E5CC",),
0x8013E640:("func_8013E640",),
0x8013E640:("SubS_FindActorCustom",),
0x8013E748:("func_8013E748",),
0x8013E7C0:("func_8013E7C0",),
0x8013E8F8:("func_8013E8F8",),

View File

@ -10,4 +10,4 @@ fi
#echo "Replace $1 with $2?"
#read
grep -rl "$1" asm/**/*.s src/**/*.{c,h} include/**/*.h tools/disasm/functions.txt tools/disasm/variables.txt | xargs sed -i "s/\b$1\b/$2/g"
grep -rl "$1" asm/**/*.s src/**/*.{c,h} include/**/*.h tools/disasm/functions.txt tools/disasm/variables.txt tools/sizes/*.csv | xargs sed -i "s/\b$1\b/$2/g"

View File

@ -2169,7 +2169,7 @@ asm/non_matchings/code/z_snap/func_8013A46C.s,func_8013A46C,0x8013A46C,0x16
asm/non_matchings/code/z_snap/func_8013A4C4.s,func_8013A4C4,0x8013A4C4,0x10
asm/non_matchings/code/z_snap/func_8013A504.s,func_8013A504,0x8013A504,0xB
asm/non_matchings/code/z_snap/func_8013A530.s,func_8013A530,0x8013A530,0xA4
asm/non_matchings/code/z_sub_s/func_8013A7C0.s,func_8013A7C0,0x8013A7C0,0x28
asm/non_matchings/code/z_sub_s/SubS_FindDoor.s,SubS_FindDoor,0x8013A7C0,0x28
asm/non_matchings/code/z_sub_s/func_8013A860.s,func_8013A860,0x8013A860,0xA8
asm/non_matchings/code/z_sub_s/func_8013AB00.s,func_8013AB00,0x8013AB00,0x9B
asm/non_matchings/code/z_sub_s/func_8013AD6C.s,func_8013AD6C,0x8013AD6C,0xC
@ -2182,7 +2182,7 @@ asm/non_matchings/code/z_sub_s/func_8013B350.s,func_8013B350,0x8013B350,0xD8
asm/non_matchings/code/z_sub_s/func_8013B6B0.s,func_8013B6B0,0x8013B6B0,0x72
asm/non_matchings/code/z_sub_s/func_8013B878.s,func_8013B878,0x8013B878,0xAF
asm/non_matchings/code/z_sub_s/func_8013BB34.s,func_8013BB34,0x8013BB34,0x12
asm/non_matchings/code/z_sub_s/func_8013BB7C.s,func_8013BB7C,0x8013BB7C,0x3C
asm/non_matchings/code/z_sub_s/SubS_FindNearestActor.s,SubS_FindNearestActor,0x8013BB7C,0x3C
asm/non_matchings/code/z_sub_s/func_8013BC6C.s,func_8013BC6C,0x8013BC6C,0x35
asm/non_matchings/code/z_sub_s/func_8013BD40.s,func_8013BD40,0x8013BD40,0x67
asm/non_matchings/code/z_sub_s/func_8013BEDC.s,func_8013BEDC,0x8013BEDC,0x63
@ -2203,7 +2203,7 @@ asm/non_matchings/code/z_sub_s/func_8013D768.s,func_8013D768,0x8013D768,0x35
asm/non_matchings/code/z_sub_s/func_8013D83C.s,func_8013D83C,0x8013D83C,0x28
asm/non_matchings/code/z_sub_s/func_8013D8DC.s,func_8013D8DC,0x8013D8DC,0x12
asm/non_matchings/code/z_sub_s/func_8013D924.s,func_8013D924,0x8013D924,0xF
asm/non_matchings/code/z_sub_s/func_ActorCategoryIterateById.s,func_ActorCategoryIterateById,0x8013D960,0x1A
asm/non_matchings/code/z_sub_s/SubS_FindActor.s,SubS_FindActor,0x8013D960,0x1A
asm/non_matchings/code/z_sub_s/func_8013D9C8.s,func_8013D9C8,0x8013D9C8,0x72
asm/non_matchings/code/z_sub_s/func_8013DB90.s,func_8013DB90,0x8013DB90,0x2C
asm/non_matchings/code/z_sub_s/func_8013DC40.s,func_8013DC40,0x8013DC40,0x23
@ -2219,7 +2219,7 @@ asm/non_matchings/code/z_sub_s/func_8013E2D4.s,func_8013E2D4,0x8013E2D4,0x39
asm/non_matchings/code/z_sub_s/func_8013E3B8.s,func_8013E3B8,0x8013E3B8,0x3E
asm/non_matchings/code/z_sub_s/func_8013E4B0.s,func_8013E4B0,0x8013E4B0,0x47
asm/non_matchings/code/z_sub_s/func_8013E5CC.s,func_8013E5CC,0x8013E5CC,0x1D
asm/non_matchings/code/z_sub_s/func_8013E640.s,func_8013E640,0x8013E640,0x42
asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s,SubS_FindActorCustom,0x8013E640,0x42
asm/non_matchings/code/z_sub_s/func_8013E748.s,func_8013E748,0x8013E748,0x1E
asm/non_matchings/code/z_sub_s/func_8013E7C0.s,func_8013E7C0,0x8013E7C0,0x4E
asm/non_matchings/code/z_sub_s/func_8013E8F8.s,func_8013E8F8,0x8013E8F8,0x16

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2169 asm/non_matchings/code/z_snap/func_8013A4C4.s func_8013A4C4 0x8013A4C4 0x10
2170 asm/non_matchings/code/z_snap/func_8013A504.s func_8013A504 0x8013A504 0xB
2171 asm/non_matchings/code/z_snap/func_8013A530.s func_8013A530 0x8013A530 0xA4
2172 asm/non_matchings/code/z_sub_s/func_8013A7C0.s asm/non_matchings/code/z_sub_s/SubS_FindDoor.s func_8013A7C0 SubS_FindDoor 0x8013A7C0 0x28
2173 asm/non_matchings/code/z_sub_s/func_8013A860.s func_8013A860 0x8013A860 0xA8
2174 asm/non_matchings/code/z_sub_s/func_8013AB00.s func_8013AB00 0x8013AB00 0x9B
2175 asm/non_matchings/code/z_sub_s/func_8013AD6C.s func_8013AD6C 0x8013AD6C 0xC
2182 asm/non_matchings/code/z_sub_s/func_8013B6B0.s func_8013B6B0 0x8013B6B0 0x72
2183 asm/non_matchings/code/z_sub_s/func_8013B878.s func_8013B878 0x8013B878 0xAF
2184 asm/non_matchings/code/z_sub_s/func_8013BB34.s func_8013BB34 0x8013BB34 0x12
2185 asm/non_matchings/code/z_sub_s/func_8013BB7C.s asm/non_matchings/code/z_sub_s/SubS_FindNearestActor.s func_8013BB7C SubS_FindNearestActor 0x8013BB7C 0x3C
2186 asm/non_matchings/code/z_sub_s/func_8013BC6C.s func_8013BC6C 0x8013BC6C 0x35
2187 asm/non_matchings/code/z_sub_s/func_8013BD40.s func_8013BD40 0x8013BD40 0x67
2188 asm/non_matchings/code/z_sub_s/func_8013BEDC.s func_8013BEDC 0x8013BEDC 0x63
2203 asm/non_matchings/code/z_sub_s/func_8013D83C.s func_8013D83C 0x8013D83C 0x28
2204 asm/non_matchings/code/z_sub_s/func_8013D8DC.s func_8013D8DC 0x8013D8DC 0x12
2205 asm/non_matchings/code/z_sub_s/func_8013D924.s func_8013D924 0x8013D924 0xF
2206 asm/non_matchings/code/z_sub_s/func_ActorCategoryIterateById.s asm/non_matchings/code/z_sub_s/SubS_FindActor.s func_ActorCategoryIterateById SubS_FindActor 0x8013D960 0x1A
2207 asm/non_matchings/code/z_sub_s/func_8013D9C8.s func_8013D9C8 0x8013D9C8 0x72
2208 asm/non_matchings/code/z_sub_s/func_8013DB90.s func_8013DB90 0x8013DB90 0x2C
2209 asm/non_matchings/code/z_sub_s/func_8013DC40.s func_8013DC40 0x8013DC40 0x23
2219 asm/non_matchings/code/z_sub_s/func_8013E3B8.s func_8013E3B8 0x8013E3B8 0x3E
2220 asm/non_matchings/code/z_sub_s/func_8013E4B0.s func_8013E4B0 0x8013E4B0 0x47
2221 asm/non_matchings/code/z_sub_s/func_8013E5CC.s func_8013E5CC 0x8013E5CC 0x1D
2222 asm/non_matchings/code/z_sub_s/func_8013E640.s asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s func_8013E640 SubS_FindActorCustom 0x8013E640 0x42
2223 asm/non_matchings/code/z_sub_s/func_8013E748.s func_8013E748 0x8013E748 0x1E
2224 asm/non_matchings/code/z_sub_s/func_8013E7C0.s func_8013E7C0 0x8013E7C0 0x4E
2225 asm/non_matchings/code/z_sub_s/func_8013E8F8.s func_8013E8F8 0x8013E8F8 0x16