Dupe EntityBreakable, CreateEntityFromCurrentEntity (#853)

Deduping EntityBreakable needs more disassembly in rwrp 8DF0
This commit is contained in:
ser-pounce 2023-12-16 19:09:15 +01:00 committed by GitHub
parent 126a3dcaff
commit 3054be9d5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 3 deletions

View File

@ -24,7 +24,6 @@ UnkEntityFunc0 = 0x8018E024;
SetStep = 0x8018E1C0;
InitializeEntity = 0x8018E290;
EntityDummy = 0x8018E38C;
ReplaceBreakableWithItemDrop = 0x8018E978;
CollectGold = 0x8018EC90;
CollectSubweapon = 0x8018ED6C;
CollectLifeVessel = 0x8018EF28;

View File

@ -11,7 +11,36 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_80188DF0);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_80188ED0);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", EntityBreakable);
extern u8* D_801805B8[];
extern Entity D_8007D858;
extern char D_801805E0;
extern u16 D_80180440[];
extern u8 D_801805F8[];
extern u8 D_801805D8[];
extern u16 D_801805E8[];
void EntityBreakable(Entity* entity) {
Entity* temp_v0;
u16 temp_s0 = entity->params >> 0xC;
if (entity->step != 0) {
func_8018D6B0(D_801805B8[temp_s0], entity);
if (entity->unk44 != 0) {
g_api.PlaySfx(NA_SE_BREAK_CANDLE);
temp_v0 = AllocEntity(&D_8007D858, &D_8007D858 + 32);
if (temp_v0 != NULL) {
CreateEntityFromCurrentEntity(2, temp_v0);
temp_v0->params = (&D_801805E0)[temp_s0];
}
ReplaceBreakableWithItemDrop(entity);
}
} else {
InitializeEntity(D_80180440);
entity->zPriority = g_unkGraphicsStruct.g_zEntityCenter.S16.unk0 - 20;
entity->blendMode = D_801805F8[temp_s0];
entity->hitboxHeight = D_801805D8[temp_s0];
entity->animSet = D_801805E8[temp_s0];
}
}
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_801891C0);

View File

@ -135,7 +135,13 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018C5B4);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018C72C);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018C7E0);
void CreateEntityFromCurrentEntity(u16 entityId, Entity* entity) {
DestroyEntity(entity);
entity->entityId = entityId;
entity->pfnUpdate = PfnEntityUpdates[entityId - 1];
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
}
void CreateEntityFromEntity(u16 entityId, Entity* source, Entity* entity) {
DestroyEntity(entity);