mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2025-02-21 13:41:58 +00:00
Dedupe CreateEntityFromLayout (#459)
This commit is contained in:
parent
d57fa76c19
commit
1ae33eee29
@ -17,6 +17,7 @@ Update = 0x80190E7C;
|
||||
UpdateStageEntities = 0x80191178;
|
||||
TestCollisions = 0x80191280;
|
||||
EntityNumericDamage = 0x80192398;
|
||||
CreateEntityFromLayout = 0x80192A3C;
|
||||
CreateEntityWhenInVerticalRange = 0x80192B00;
|
||||
CreateEntityWhenInHorizontalRange = 0x80192C18;
|
||||
InitRoomEntities = 0x80193298;
|
||||
|
@ -3,6 +3,7 @@ D_80180040 = 0x80180040;
|
||||
g_Cluts = 0x80180160;
|
||||
g_TileLayers = 0x80180394;
|
||||
g_EntityGfxs = 0x80180888;
|
||||
PfnEntityUpdates = 0x80180A94;
|
||||
g_BossFlag = 0x80181010;
|
||||
UNK_Invincibility0 = 0x80181574;
|
||||
c_GoldPrizes = 0x80181D14;
|
||||
|
@ -1,10 +1,12 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
PfnEntityUpdates = 0x801803E4;
|
||||
UNK_Invincibility0 = 0x80180690;
|
||||
g_Rooms = 0x801811AC;
|
||||
Random = 0x8018A168;
|
||||
Update = 0x8018A198;
|
||||
UpdateStageEntities = 0x8018A494;
|
||||
TestCollisions = 0x8018A59C;
|
||||
CreateEntityFromLayout = 0x8018BD58;
|
||||
CreateEntityWhenInVerticalRange = 0x8018BE1C;
|
||||
CreateEntityWhenInHorizontalRange = 0x8018BF34;
|
||||
DestroyEntity = 0x8018D580;
|
||||
|
@ -3,7 +3,7 @@ INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityNumericDamage);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80192A3C);
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
@ -32,7 +32,7 @@ void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
if (entity->entityId == E_NONE) {
|
||||
func_80192A3C(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
}
|
||||
break;
|
||||
case 0x8000:
|
||||
@ -40,7 +40,7 @@ void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
case 0xA000:
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
func_80192A3C(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ void CreateEntityWhenInHorizontalRange(LayoutEntity* layoutObj) {
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
if (entity->entityId == E_NONE) {
|
||||
func_80192A3C(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
}
|
||||
break;
|
||||
case 0x8000:
|
||||
@ -80,7 +80,7 @@ void CreateEntityWhenInHorizontalRange(LayoutEntity* layoutObj) {
|
||||
case 0xA000:
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
func_80192A3C(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ typedef enum {
|
||||
} EntityIDs;
|
||||
|
||||
void CreateEntityFromCurrentEntity(u16 entityId, Entity* entity);
|
||||
void func_80192A3C(Entity*, LayoutEntity*);
|
||||
void CreateEntityFromLayout(Entity*, LayoutEntity*);
|
||||
extern u16 func_80194E44(u16 arg0, u16 arg1, u16 arg2);
|
||||
|
||||
extern LayoutEntity* D_801801EC[];
|
||||
|
12
src/st/create_entity_from_layout.h
Normal file
12
src/st/create_entity_from_layout.h
Normal file
@ -0,0 +1,12 @@
|
||||
extern PfnEntityUpdate PfnEntityUpdates[];
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/dre/nonmatchings/173C4", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/173C4", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/mad/nonmatchings/EDB8", func_8018EDB8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/mad/nonmatchings/EDB8", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = initDesc->entityId >> 0xA & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/no3/nonmatchings/41C80", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/no3/nonmatchings/41C80", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/np3/nonmatchings/394F0", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/394F0", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
Entity* entity;
|
||||
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/nz0/nonmatchings/39908", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/39908", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = D_80180A90[entity->entityId];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
@ -300,7 +291,7 @@ void func_801BBA98(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 entityId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = entityId;
|
||||
entity->pfnUpdate = D_80180A90[entityId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entityId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -308,7 +299,7 @@ void CreateEntityFromCurrentEntity(u16 entityId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 entityId, Entity* ent1, Entity* ent2) {
|
||||
DestroyEntity(ent2);
|
||||
ent2->entityId = entityId;
|
||||
ent2->pfnUpdate = D_80180A90[entityId];
|
||||
ent2->pfnUpdate = PfnEntityUpdates[entityId - 1];
|
||||
ent2->posX.i.hi = ent1->posX.i.hi;
|
||||
ent2->posY.i.hi = ent1->posY.i.hi;
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ void func_801C16B4(Entity* entity) {
|
||||
void func_801C1780(u16 entityId, Entity* src, Entity* dst) {
|
||||
DestroyEntity(dst);
|
||||
dst->entityId = entityId;
|
||||
dst->pfnUpdate = D_80180A90[entityId];
|
||||
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
|
||||
dst->posX.i.hi = src->posX.i.hi;
|
||||
dst->posY.i.hi = src->posY.i.hi;
|
||||
dst->unk5A = src->unk5A;
|
||||
|
@ -44,7 +44,7 @@ void func_801C4CC0(void);
|
||||
extern u8 D_8003BE6F[];
|
||||
LayoutEntity* D_801808EC[];
|
||||
LayoutEntity* D_801809C0[];
|
||||
extern PfnEntityUpdate D_80180A90[];
|
||||
extern PfnEntityUpdate PfnEntityUpdates[];
|
||||
extern const u16 D_80180BE0[];
|
||||
extern u16 D_80180BEC[];
|
||||
extern u16 D_80180BF8[];
|
||||
|
@ -3,7 +3,7 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018B6B4);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018BD58);
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
@ -32,7 +32,7 @@ void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
if (entity->entityId == 0) {
|
||||
func_8018BD58(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
}
|
||||
break;
|
||||
case 0x8000:
|
||||
@ -40,7 +40,7 @@ void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
case 0xA000:
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
func_8018BD58(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ void CreateEntityWhenInHorizontalRange(LayoutEntity* layoutObj) {
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
if (entity->entityId == 0) {
|
||||
func_8018BD58(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
}
|
||||
break;
|
||||
case 0x8000:
|
||||
@ -80,7 +80,7 @@ void CreateEntityWhenInHorizontalRange(LayoutEntity* layoutObj) {
|
||||
case 0xA000:
|
||||
entity =
|
||||
&g_Entities[STAGE_ENTITY_START + (u8)layoutObj->entityRoomIndex];
|
||||
func_8018BD58(entity, layoutObj);
|
||||
CreateEntityFromLayout(entity, layoutObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ extern s16 D_80180A94[];
|
||||
extern ObjInit2 D_80181134[];
|
||||
extern LayoutEntity* D_80195A30;
|
||||
extern LayoutEntity* D_80195A34;
|
||||
void func_8018BD58(Entity*, LayoutEntity*);
|
||||
void CreateEntityFromLayout(Entity*, LayoutEntity*);
|
||||
|
||||
// *** EntitySoulStealOrb properties START ***
|
||||
|
||||
|
@ -3,16 +3,7 @@ INCLUDE_ASM("asm/us/st/st0/nonmatchings/31CA0", TestCollisions);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/st0/nonmatchings/31CA0", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
|
@ -22,16 +22,7 @@ INCLUDE_ASM("asm/us/st/wrp/nonmatchings/861C", TestCollisions);
|
||||
// DECOMP_ME_WIP EntityNumericDamage https://decomp.me/scratch/m0PKE
|
||||
INCLUDE_ASM("asm/us/st/wrp/nonmatchings/861C", EntityNumericDamage);
|
||||
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->entityId = initDesc->entityId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1];
|
||||
entity->posX.i.hi = initDesc->posX - g_Camera.posX.i.hi;
|
||||
entity->posY.i.hi = initDesc->posY - g_Camera.posY.i.hi;
|
||||
entity->params = initDesc->params;
|
||||
entity->entityRoomIndex = initDesc->entityRoomIndex >> 8;
|
||||
entity->unk68 = (initDesc->entityId >> 0xA) & 7;
|
||||
}
|
||||
#include "../create_entity_from_layout.h"
|
||||
|
||||
void CreateEntityWhenInVerticalRange(LayoutEntity* layoutObj) {
|
||||
s16 yClose;
|
||||
|
Loading…
x
Reference in New Issue
Block a user