Rename some entity functions (#826)

After finding a copy of GetFreeDraEntity in RIC, I decided to rename the
function (in both DRA and RIC) to GetFreeEntity. Similarly, the function
right after it is GetFreeEntityReverse (since its logic runs in
reverse).

I also found CreateEntFactoryFromEntity in RIC, so I renamed that to
match the version in DRA. We will need to go through and use the FACTORY
macro for its uses, but I'm not going to tackle that quite yet.

Seems there is a lot of work to be done making RIC catch up to DRA,
we'll see if I keep working on that moving forward, it's neat to find
the ways the two match.
This commit is contained in:
bismurphy 2023-12-10 13:08:41 -05:00 committed by GitHub
parent 5f4011493c
commit 968a14a380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 90 additions and 78 deletions

View File

@ -691,7 +691,7 @@ g_api_CheckCollision = 0x8003C7BC;
g_api_func_80102CD8 = 0x8003C7C0;
g_api_UpdateAnim = 0x8003C7C4;
g_api_SetSpeedX = 0x8003C7C8;
g_api_GetFreeDraEntity = 0x8003C7CC;
g_api_GetFreeEntity = 0x8003C7CC;
g_api_GetEquipProperties = 0x8003C7D0;
g_api_func_800EA5E4 = 0x8003C7D4;
g_api_LoadGfxAsync = 0x8003C7D8;

View File

@ -4,4 +4,7 @@ GetTeleportToOtherCastle = 0x80156CCC;
UpdateEntityRichter = 0x80157BFC;
SetPlayerStep = 0x8015C908;
SetSpeedX = 0x8015CA84;
GetFreeEntity = 0x8015F8F8;
GetFreeEntityReverse = 0x8015F96C;
CreateEntFactoryFromEntity = 0x801606BC;
g_DebugWaitInfoTimer = 0x80174F7C;

View File

@ -691,7 +691,7 @@ g_api_CheckCollision = 0x8003C7BC;
g_api_func_80102CD8 = 0x8003C7C0;
g_api_UpdateAnim = 0x8003C7C4;
g_api_SetSpeedX = 0x8003C7C8;
g_api_GetFreeDraEntity = 0x8003C7CC;
g_api_GetFreeEntity = 0x8003C7CC;
g_api_GetEquipProperties = 0x8003C7D0;
g_api_func_800EA5E4 = 0x8003C7D4;
g_api_LoadGfxAsync = 0x8003C7D8;

View File

@ -1132,7 +1132,7 @@ typedef struct {
/* 8003C7C0 */ void (*func_80102CD8)(s32 arg0);
/* 8003C7C4 */ void (*UpdateAnim)(FrameProperty* frameProps, s32* arg1);
/* 8003C7C8 */ void (*SetSpeedX)(s32 value);
/* 8003C7CC */ Entity* (*GetFreeDraEntity)(s16 start, s16 end);
/* 8003C7CC */ Entity* (*GetFreeEntity)(s16 start, s16 end);
/* 8003C7D0 */ void (*GetEquipProperties)(
s32 handId, Equipment* res, s32 equipId);
/* 8003C7D4 */ s32 (*func_800EA5E4)(u32);
@ -1206,7 +1206,7 @@ extern void (*g_api_CheckCollision)(s32 x, s32 y, Collider* res, s32 unk);
extern void (*g_api_func_80102CD8)(s32 arg0);
extern void (*g_api_UpdateAnim)(FrameProperty* frameProps, s32* arg1);
extern void (*g_api_SetSpeedX)(s32 value);
extern Entity* (*g_api_GetFreeDraEntity)(s16 start, s16 end);
extern Entity* (*g_api_GetFreeEntity)(s16 start, s16 end);
extern void (*g_api_GetEquipProperties)(
s32 handId, Equipment* res, s32 equipId);
extern s32 (*g_api_func_800EA5E4)(u32);

View File

@ -1220,8 +1220,10 @@ void func_801186EC(void) {
func_8010E570(0);
}
}
Entity* GetFreeDraEntity(s16 start, s16 end) {
// Given a range of start and end values, finds an unused entity
// slot in g_Entities to fill in. Starts at start, and goes to
// end-1. If none in the range are available, returns NULL.
Entity* GetFreeEntity(s16 start, s16 end) {
Entity* entity = &g_Entities[start];
s16 i;
@ -1232,8 +1234,9 @@ Entity* GetFreeDraEntity(s16 start, s16 end) {
}
return NULL;
}
Entity* func_80118810(s16 start, s16 end) {
// Like GetFreeEntity, but searches for an open spot
// starting from the end and working backward
Entity* GetFreeEntityReverse(s16 start, s16 end) {
Entity* entity = &g_Entities[end - 1];
s16 i;
@ -1394,7 +1397,7 @@ void func_80118C28(s32 arg0) {
}
s32 func_80118C84(s16 arg0, s16 arg1) {
Entity* entity = GetFreeDraEntity(0x38, 0x40);
Entity* entity = GetFreeEntity(0x38, 0x40);
if (entity != NULL) {
DestroyEntity(entity);

View File

@ -305,7 +305,7 @@ Entity* CreateEntFactoryFromEntity(
// Weird thing needed for callers to match
s16 arg2 = arg2_raw;
newFactory = GetFreeDraEntity(8, 16);
newFactory = GetFreeEntity(8, 16);
if (newFactory == NULL) {
return NULL;
}
@ -448,19 +448,19 @@ void EntityEntFactory(Entity* self) {
newEntity = &g_Entities[startIndex];
g_Player.unk48 = 0;
} else if (self->ext.factory.unk9C == 0) {
newEntity = func_80118810(startIndex, endIndex + 1);
newEntity = GetFreeEntityReverse(startIndex, endIndex + 1);
} else if (self->ext.factory.unk9C == 8) {
if ((self->ext.factory.unkA6 % 3) == 0) {
newEntity = GetFreeDraEntity(17, 32);
newEntity = GetFreeEntity(17, 32);
}
if ((self->ext.factory.unkA6 % 3) == 1) {
newEntity = GetFreeDraEntity(32, 48);
newEntity = GetFreeEntity(32, 48);
}
if ((self->ext.factory.unkA6 % 3) == 2) {
newEntity = GetFreeDraEntity(48, 64);
newEntity = GetFreeEntity(48, 64);
}
} else {
newEntity = GetFreeDraEntity(startIndex, endIndex + 1);
newEntity = GetFreeEntity(startIndex, endIndex + 1);
}
if (newEntity == NULL) {

View File

@ -14,7 +14,7 @@ void CheckCollision(s32 x, s32 y, Collider* res, s32 unk);
void func_80102CD8(s32 start);
u32 UpdateAnim(s8* frameProps, s32* frames);
void SetSpeedX(s32 speed);
Entity* GetFreeDraEntity(s16 start, s16 end);
Entity* GetFreeEntity(s16 start, s16 end);
void GetEquipProperties(s32 handId, Equipment* res, s32 equipId);
s32 func_800EA5E4(u32 arg0);
void LoadGfxAsync(s32 gfxId);
@ -74,7 +74,7 @@ GameApi g_ApiInit = {
func_80102CD8,
UpdateAnim,
SetSpeedX,
GetFreeDraEntity,
GetFreeEntity,
GetEquipProperties,
func_800EA5E4,
LoadGfxAsync,

View File

@ -54,7 +54,7 @@ bool InitGame(void) {
api.func_80102CD8 = NULL;
api.UpdateAnim = NULL;
api.SetSpeedX = NULL;
api.GetFreeDraEntity = NULL;
api.GetFreeEntity = NULL;
api.GetEquipProperties = NULL;
api.func_800EA5E4 = func_800EA5E4;
api.LoadGfxAsync = LoadGfxAsync;

View File

@ -194,7 +194,7 @@ void func_80158B04(s32 arg0) {
PLAYER.posY.i.hi -= 16;
PLAYER.posX.i.hi = var_s0 + PLAYER.posX.i.hi;
func_801606BC(g_CurrentEntity, 0x10004, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x10004, 0);
PLAYER.posY.i.hi += 16;
PLAYER.posX.i.hi = PLAYER.posX.i.hi - var_s0;
@ -223,7 +223,7 @@ void func_80158BFC(void) {
}
PLAYER.posX.i.hi = var_s0 + PLAYER.posX.i.hi;
PLAYER.posY.i.hi -= 16;
func_801606BC(g_CurrentEntity, 0x80004, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x80004, 0);
D_8015459C = 0x60;
PLAYER.posY.i.hi += 16;
PLAYER.posX.i.hi = PLAYER.posX.i.hi - var_s0;
@ -272,7 +272,7 @@ void func_80158BFC(void) {
g_Player.unk46 = 2;
PLAYER.step_s++;
func_8015C920(&D_80155730);
func_801606BC(g_CurrentEntity, 0x11, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x11, 0);
break;
}
g_Player.unk46 = 0;
@ -331,7 +331,7 @@ void func_80158FA4(void) {
if (g_Player.D_80072F16 == 0) {
if (!(g_Player.pl_vram_flag & 0xC)) {
func_8015C920(&D_8015539C);
func_801606BC(g_CurrentEntity, 0x0, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x0, 0);
}
} else {
PLAYER.velocityX = 0;
@ -416,7 +416,7 @@ void func_801590A0(void) {
g_Player.unk46 = 2;
PLAYER.step_s += 1;
func_8015C920(D_80155740);
func_801606BC(g_CurrentEntity, 0x11U, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x11U, 0);
} else {
g_Player.unk46 = 0;
PLAYER.step_s = 0;
@ -558,21 +558,21 @@ void func_8015AFE0(void) {
void func_8015B098(void) {
if ((PLAYER.animCurFrame == 0xB5) && (PLAYER.animFrameDuration == 1)) {
func_801606BC(g_CurrentEntity, 0x23, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x23, 0);
g_api.PlaySfx(NA_SE_UNK_62F);
}
if (PLAYER.animFrameDuration < 0) {
func_8015CD98(0);
g_Player.unk46 = 0;
func_801606BC(g_CurrentEntity, 0x450021, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x450021, 0);
g_Player.D_80072F00 = 0x800;
}
if (!(g_Player.pl_vram_flag & 1)) {
func_8015CF08();
g_Player.unk46 = 0;
func_801606BC(g_CurrentEntity, 0x450021, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x450021, 0);
g_Player.D_80072F00 = 0x800;
}
}

View File

@ -10,8 +10,8 @@ void func_8015B348(void) {
if (PLAYER.velocityX == 0) {
func_8015C920(&D_80155748);
g_Player.D_80072F1A = 4;
func_801606BC(g_CurrentEntity, 0x1D, 0);
func_801606BC(g_CurrentEntity, 0x90021, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x1D, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x90021, 0);
D_801545AC = 0;
PLAYER.step_s++;
}
@ -27,7 +27,7 @@ void func_8015B348(void) {
if ((D_801545AC) == 0) {
PLAYER.drawFlags = 0;
PLAYER.rotY = 0x100;
func_801606BC(g_CurrentEntity, 0x17, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x17, 0);
D_801545A8 = 0x90;
PLAYER.step_s++;
}
@ -40,7 +40,7 @@ void func_8015B348(void) {
func_8015C920(&D_801558B4);
PLAYER.palette = 0x814E;
g_CurrentEntity->velocityY = FIX(-1);
func_801606BC(g_CurrentEntity, 0x16, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x16, 0);
D_801545A8 = 0x30;
g_api.PlaySfx(0x6E2);
D_80174F78 = 0xA0;
@ -53,10 +53,10 @@ void func_8015B348(void) {
if ((D_801545A8) == 0) {
PLAYER.velocityY = 0;
D_801545A8 = 0xC0;
func_801606BC(g_CurrentEntity, 0x24, 0);
func_801606BC(g_CurrentEntity, 0x20025, 0);
func_801606BC(g_CurrentEntity, 0x30026, 0);
func_801606BC(g_CurrentEntity, 0x40027, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x24, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x20025, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x30026, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x40027, 0);
PLAYER.palette = 0x813D;
g_Player.D_80072F1A = 0;
PLAYER.step_s++;
@ -93,13 +93,13 @@ void func_8015B348(void) {
if (D_801545A8 == 5) {
PLAYER.animFrameIdx = 6;
PLAYER.palette = 0x8120;
func_801606BC(g_CurrentEntity, 0x1C, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x1C, 0);
}
D_801545A8--;
if (D_801545A8 == 0) {
func_8015C920(&D_801558D4);
g_api.PlaySfx(NA_SE_UNK_62F);
func_801606BC(g_CurrentEntity, 0x1B, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x1B, 0);
PLAYER.step_s++;
break;
}
@ -123,7 +123,7 @@ void func_8015B348(void) {
func_8015CF08();
func_8015C920(&D_801558DC);
g_Player.D_80072F1A = 4;
func_801606BC(g_CurrentEntity, 0x90021, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x90021, 0);
}
break;
}

View File

@ -8,7 +8,7 @@ void func_8015BCD0(void) {
switch (PLAYER.step_s) {
case 0:
if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 &&
func_801606BC(g_CurrentEntity, 0x4D, 0) == NULL) {
CreateEntFactoryFromEntity(g_CurrentEntity, 0x4D, 0) == NULL) {
PLAYER.animFrameDuration = 2;
}
if (PLAYER.animFrameDuration < 0) {
@ -19,7 +19,7 @@ void func_8015BCD0(void) {
case 2:
func_8015BB80();
if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 &&
func_801606BC(g_CurrentEntity, 0x2004D, 0) == NULL) {
CreateEntFactoryFromEntity(g_CurrentEntity, 0x2004D, 0) == NULL) {
PLAYER.animFrameDuration = 2;
}
if (PLAYER.animFrameDuration < 0) {
@ -30,7 +30,7 @@ void func_8015BCD0(void) {
case 4:
func_8015BB80();
if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 &&
func_801606BC(g_CurrentEntity, 0x4004D, 0) == NULL) {
CreateEntFactoryFromEntity(g_CurrentEntity, 0x4004D, 0) == NULL) {
PLAYER.animFrameDuration = 2;
}
if (PLAYER.animFrameDuration < 0) {
@ -68,7 +68,7 @@ void func_8015BE84(void) {
if (g_Player.pl_vram_flag & 1) {
g_CurrentEntity->velocityX /= 2;
func_801606BC(g_CurrentEntity, 0x0, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x0, 0);
PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1;
func_8015CCC8(3, PLAYER.velocityX);
g_api.PlaySfx(0x64B);
@ -121,12 +121,12 @@ void func_8015C178(void) {
} else {
if (!(g_GameTimer & 3) && PLAYER.animFrameIdx < 0x12 &&
g_Player.pl_vram_flag & 1) {
func_801606BC(g_CurrentEntity, 0x20018, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x20018, 0);
}
if (PLAYER.animFrameIdx == 18 && PLAYER.animFrameDuration == 1 &&
(g_Player.pl_vram_flag & 1)) {
func_801606BC(g_CurrentEntity, 0x0, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x0, 0);
}
}
}

View File

@ -73,7 +73,7 @@ void func_8015CAAC(s32 speed) {
void func_8015CAD4(s32 arg0, s16 arg1) {
if (arg0 == 0) {
func_801606BC(g_CurrentEntity, 0x15002C, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x15002C, 0);
if (arg1 >= g_Player.D_80072F1A) {
g_Player.D_80072F1A = arg1;
}
@ -181,7 +181,7 @@ void func_8015CE7C(void) {
SetSpeedX(0x24000);
g_Player.D_80072F16 = 0x28;
PLAYER.velocityY = 0;
func_801606BC(g_CurrentEntity, 0x50001, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x50001, 0);
}
}
@ -254,7 +254,7 @@ void func_8015D120(void) {
g_Player.pl_high_jump_timer = 0;
func_8015C920(&D_8015579C);
func_8015CC28();
func_801606BC(g_CurrentEntity, 0x2DU, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x2DU, 0);
g_api.PlaySfx(0x6FB);
g_Player.D_80072F18 = 4;
if (g_Player.unk72 != 0) {

View File

@ -25,13 +25,13 @@ s32 func_8015D250(void) {
return 5;
}
func_801606BC(g_CurrentEntity, subweapon.blueprintNum, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, subweapon.blueprintNum, 0);
g_Player.D_80072F14 = 4;
switch (PLAYER.step) {
case 25:
PLAYER.step = 0;
func_801606BC(g_CurrentEntity, 0x0, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x0, 0);
func_8015C920(D_801555E8);
break;
@ -67,7 +67,7 @@ void func_8015D9D4(void) {
g_CurrentEntity->velocityY = 0;
SetSpeedX(0x58000);
func_8015CC28();
func_801606BC(g_CurrentEntity, 0x19, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x19, 0);
g_api.PlaySfx(0x707);
g_Player.D_80072F18 = 4;
}
@ -79,10 +79,10 @@ void func_8015DA60(void) {
g_CurrentEntity->velocityY = FIX(-2);
SetSpeedX(0x58000);
func_8015CC28();
func_801606BC(g_CurrentEntity, 0x19, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x19, 0);
g_api.PlaySfx(0x6FA);
g_Player.D_80072F18 = 4;
func_801606BC(g_CurrentEntity, 0x1F, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x1F, 0);
}
void func_8015DB04(void) {
@ -92,7 +92,7 @@ void func_8015DB04(void) {
SetSpeedX(0x58000);
g_Player.unk46 = 5;
g_Player.D_80072F18 = 4;
func_801606BC(g_CurrentEntity, 0x1A, 0);
CreateEntFactoryFromEntity(g_CurrentEntity, 0x1A, 0);
func_8015CC28();
g_api.PlaySfx(0x6FB);
g_api.PlaySfx(0x707);

View File

@ -39,7 +39,7 @@ INCLUDE_ASM("asm/us/ric/nonmatchings/22380", func_8015F414);
INCLUDE_ASM("asm/us/ric/nonmatchings/22380", func_8015F680);
Entity* func_8015F8F8(s16 start, s16 end) {
Entity* GetFreeEntity(s16 start, s16 end) {
Entity* entity = &g_Entities[start];
s16 i;
@ -51,7 +51,7 @@ Entity* func_8015F8F8(s16 start, s16 end) {
return NULL;
}
Entity* func_8015F96C(s16 start, s16 end) {
Entity* GetFreeEntityReverse(s16 start, s16 end) {
Entity* entity = &g_Entities[end - 1];
s16 i;
for (i = end - 1; i >= start; i--, entity--) {
@ -177,25 +177,27 @@ void func_801603BC(void) {}
INCLUDE_ASM("asm/us/ric/nonmatchings/22380", func_801603C4);
Entity* func_801606BC(Entity* srcEntity, u32 arg1, s32 arg2) {
// Similar to the version in DRA but with some logic removed
Entity* CreateEntFactoryFromEntity(
Entity* source, u32 factoryParams, s32 arg2) {
/**
* arg2 is unused, but needed to match other functions that call
* this function, probably part of the code for a debug build
*/
Entity* entity = func_8015F8F8(8, 0x10);
Entity* entity = GetFreeEntity(8, 0x10);
if (entity != NULL) {
DestroyEntity(entity);
entity->entityId = E_ENTITYFACTORY;
entity->ext.generic.unk8C.entityPtr = srcEntity;
entity->posX.val = srcEntity->posX.val;
entity->posY.val = srcEntity->posY.val;
entity->facingLeft = srcEntity->facingLeft;
entity->zPriority = srcEntity->zPriority;
entity->params = arg1 & 0xFFF;
entity->ext.generic.unkA0 = (arg1 >> 8) & 0xFF00;
entity->ext.generic.unk8C.entityPtr = source;
entity->posX.val = source->posX.val;
entity->posY.val = source->posY.val;
entity->facingLeft = source->facingLeft;
entity->zPriority = source->zPriority;
entity->params = factoryParams & 0xFFF;
entity->ext.generic.unkA0 = (factoryParams >> 8) & 0xFF00;
if (srcEntity->flags & FLAG_UNK_10000) {
if (source->flags & FLAG_UNK_10000) {
entity->flags |= FLAG_UNK_10000;
}
} else {
@ -374,7 +376,7 @@ void func_80161C2C(Entity* self) {
if ((self->animFrameIdx == 8) && (self->unk4C != D_80154C80)) {
self->blendMode = 0x10;
if (!(params & 1) && (self->animFrameDuration == step)) {
func_801606BC(self, 0x40004, 0);
CreateEntFactoryFromEntity(self, 0x40004, 0);
}
}
@ -404,7 +406,7 @@ void func_80161EF8(Entity* self) {
case 1:
if ((self->animFrameIdx == 6) &&
(self->animFrameDuration == self->step) && (rand() & 1)) {
func_801606BC(self, 4, 0);
CreateEntFactoryFromEntity(self, 4, 0);
}
self->posY.val += self->velocityY;
if (self->animFrameDuration < 0) {

View File

@ -36,7 +36,7 @@ void func_80162C84(Entity* entity) {
func_8015C920(&D_80154EF8);
entity->velocityX = 0;
entity->step++;
func_801606BC(entity, 0x40000, 0);
CreateEntFactoryFromEntity(entity, 0x40000, 0);
}
break;
@ -51,7 +51,7 @@ void func_80162C84(Entity* entity) {
case 3:
entity->ext.generic.unk7C.s--;
if ((entity->ext.generic.unk7C.s) == 0) {
func_801606BC(entity, 0x1E, 0);
CreateEntFactoryFromEntity(entity, 0x1E, 0);
entity->step++;
}
break;

View File

@ -12,7 +12,7 @@ void func_8016E324(Entity* entity) {
if ((entity->ext.generic.unk7C.s) == 0) {
case 3:
case 5:
func_801606BC(entity, 0x39, 0);
CreateEntFactoryFromEntity(entity, 0x39, 0);
entity->step++;
case 2:
case 4:
@ -22,7 +22,7 @@ void func_8016E324(Entity* entity) {
entity->ext.generic.unk7C.s = 0;
entity->posX.val = FIX(128.0);
entity->posY.val = 0;
func_801606BC(entity, 0x10004, 0);
CreateEntFactoryFromEntity(entity, 0x10004, 0);
entity->step++;
}
}
@ -33,7 +33,7 @@ void func_8016E324(Entity* entity) {
if (entity->ext.generic.unk7C.s >= 16) {
DestroyEntity(entity);
g_Player.unk4E = 1;
func_801606BC(entity, 0x3A, 0);
CreateEntFactoryFromEntity(entity, 0x3A, 0);
}
break;
}

View File

@ -15,7 +15,7 @@ void func_801705EC(Entity* entity) {
case 7:
temp = entity->ext.generic.unk7E.modeU16 + 1;
entity->ext.generic.unk7E.modeU16 = temp;
func_801606BC(entity, (temp << 0x10) | 0x3F, 0);
CreateEntFactoryFromEntity(entity, (temp << 0x10) | 0x3F, 0);
entity->ext.generic.unk7C.s = 0;
entity->step++;
break;
@ -314,7 +314,7 @@ void func_80170F64(Entity* self) {
}
break;
case 3:
func_801606BC(
CreateEntFactoryFromEntity(
self, FACTORY(D_801758B0[self->ext.et_80170F64.unk7C] * 0x100, 68),
0);
if (++self->ext.et_80170F64.unk7C >= 8) {

View File

@ -71,7 +71,7 @@ extern void DebugShowWaitInfo(const char* str);
extern void func_8015F9F0(Entity* entity);
extern void func_8015FAB8(Entity*);
extern s32 func_8015FDB0(POLY_GT4* poly, s16 posX, s16 posY);
extern Entity* func_801606BC(Entity* entity, u32 arg1, s32 arg2);
extern Entity* CreateEntFactoryFromEntity(Entity* entity, u32 arg1, s32 arg2);
extern void func_80162604(Entity* entity);
extern void func_80167964(Entity* entity);
extern s32 func_8016840C(s16 x, s16 y);

View File

@ -142,7 +142,7 @@ def get_sdk_funcs():
def get_main_funcs():
# hardcode this one in there, it's not in any assembly file
functions = ["g_MainGame"]
for file in Path("asm/us/main").rglob("*.s"):
for file in Path("asm/us/main").rglob("*[!data].s"):
with open(file) as f:
lines = f.readlines()
for line in lines:
@ -201,12 +201,16 @@ def find_func_match(caller, candidates):
if longest_match_count == 1:
return candidates[prefix_lengths.index(max(prefix_lengths))]
elif longest_match_count > 1:
# Currently the only overlap is in UpdateAnim, which is in both dra and servant,
# but is called from ric and some weapons. Hard-code this to use the dra version.
assert candidates[0].name == "UpdateAnim"
# We have a tie. This happens when there are multiple copies of a function,
# but neither matches the caller's overlay. For example, UpdateAnim is in both DRA
# and tt_000, while being called from RIC (and some weapons). CreateEntFactoryFromEntity
# is in both DRA and RIC, while being called from tt_000. When we run into these situations,
# we will use the DRA version, since it's the overarching unifier for the rest of the game.
for candidate in candidates:
if candidate.unique_name.startswith("dra."):
return candidate
print("Can't resolve tie, none in DRA!")
exit(4)
else:
print("No candidates!")
exit(3)