mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-27 06:50:35 +00:00
Fix PfnEntityUpdates address across overlays (#339)
Thanks to the disassembly of the Saturn version (kudos to @sozud), I realised how we got some fake matches in the PSX all along.e567920005/src/saturn/game.c (L716)
Following the pattern from the Saturn version I was able to confirm my theory to use `objectId - 1` and fix some oddities I found while I was importing the `.data` section from PSX WRP:e567920005/src/st/wrp/6FD0.c (L200)
This commit is contained in:
parent
31715f6993
commit
6c3961981a
@ -5,7 +5,7 @@ g_pStTilesetDebug = 0x80180290;
|
||||
g_pStTileset = 0x801802A4;
|
||||
g_pStObjLayout = 0x801802F4;
|
||||
D_801803C8 = 0x801803C8;
|
||||
PfnEntityUpdates = 0x80180498;
|
||||
PfnEntityUpdates = 0x8018049C;
|
||||
g_eBreakableInit = 0x801804F0;
|
||||
D_80180634 = 0x80180634;
|
||||
D_8018063C = 0x8018063C;
|
||||
|
@ -1,4 +1,5 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
PfnEntityUpdates = 0x80180394;
|
||||
g_Rooms = 0x801812D4;
|
||||
EntityBackgroundBlock = 0x8018D600;
|
||||
EntityUnkId12 = 0x8018D6E0;
|
||||
|
@ -1,4 +1,5 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
PfnEntityUpdates = 0x801803C8;
|
||||
g_eBreakableInit = 0x80180458;
|
||||
g_eBreakableAnimations = 0x80180610;
|
||||
g_eBreakableHitboxes = 0x80180630;
|
||||
|
@ -1,6 +1,6 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
g_pStObjLayout = 0x8018077C;
|
||||
PfnEntityUpdates = 0x80180920;
|
||||
PfnEntityUpdates = 0x80180924;
|
||||
g_eBreakableInit = 0x80180AAC;
|
||||
g_eBreakableAnimations = 0x80180E50;
|
||||
g_eBreakableHitboxes = 0x80180E70;
|
||||
|
@ -1,6 +1,6 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
g_pStObjLayout = 0x80180728;
|
||||
PfnEntityUpdates = 0x801808CC;
|
||||
PfnEntityUpdates = 0x801808D0;
|
||||
g_eBreakableInit = 0x80180A3C;
|
||||
g_eBreakableAnimations = 0x80180E28;
|
||||
g_eBreakableHitboxes = 0x80180E48;
|
||||
|
@ -1,5 +1,5 @@
|
||||
g_SpriteBanks = 0x80180040;
|
||||
PfnEntityUpdates = 0x801804B8;
|
||||
PfnEntityUpdates = 0x801804BC;
|
||||
g_isSecretStairsButtonPressed = 0x8018089C;
|
||||
g_isDraculaFirstFormDefeated = 0x8018090C;
|
||||
g_Rooms = 0x80182060;
|
||||
|
@ -3,7 +3,7 @@ g_Cluts = 0x801800B4;
|
||||
g_TileLayers = 0x80180168;
|
||||
g_EntityGfxs = 0x801801EC;
|
||||
g_pStObjLayout = 0x8018023C;
|
||||
PfnEntityUpdates = 0x801803E0;
|
||||
PfnEntityUpdates = 0x801803E4;
|
||||
g_eBreakableInit = 0x80180440;
|
||||
g_eBreakableAnimations = 0x801805B8;
|
||||
g_eBreakableHitboxes = 0x801805D8;
|
||||
|
@ -906,15 +906,15 @@ INCLUDE_ASM("asm/us/st/cen/nonmatchings/D600", func_80193410);
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = D_80180390[objectId];
|
||||
entity->posX.i.hi = (s16)(u16)g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = (s16)(u16)g_CurrentEntity->posY.i.hi;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = D_80180390[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ extern u16 func_80194E44(u16 arg0, u16 arg1, u16 arg2);
|
||||
|
||||
extern LayoutObject* D_801801EC[];
|
||||
extern LayoutObject* D_801802C0[];
|
||||
extern PfnEntityUpdate D_80180390[];
|
||||
extern PfnEntityUpdate PfnEntityUpdates[];
|
||||
|
||||
extern u16 D_80180404[];
|
||||
extern u16 D_80180410[]; // Init
|
||||
|
@ -314,7 +314,7 @@ INCLUDE_ASM("asm/us/st/dre/nonmatchings/14214", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
entity->pfnUpdate = D_801803C4[entity->objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -516,7 +516,7 @@ void func_80199554(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = D_801803C4[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -524,7 +524,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = D_801803C4[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ void func_8019F170(Entity* entity) {
|
||||
void func_8019F23C(u16 objectId, Entity* src, Entity* dst) {
|
||||
DestroyEntity(dst);
|
||||
dst->objectId = objectId;
|
||||
dst->pfnUpdate = D_801803C4[objectId];
|
||||
dst->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
dst->posX.i.hi = src->posX.i.hi;
|
||||
dst->posY.i.hi = src->posY.i.hi;
|
||||
dst->unk5A = src->unk5A;
|
||||
|
@ -62,7 +62,7 @@ extern u32 D_8018125C[];
|
||||
extern s16 D_801812E4[];
|
||||
extern u32 D_801812F4[];
|
||||
extern u8 D_80181338[];
|
||||
extern PfnEntityUpdate D_801803C4[];
|
||||
extern PfnEntityUpdate PfnEntityUpdates[];
|
||||
extern u16 D_801804E8[];
|
||||
extern u16 D_8018050C[];
|
||||
extern u16 D_80180528[];
|
||||
|
@ -695,7 +695,7 @@ INCLUDE_ASM("asm/us/st/mad/nonmatchings/139E0", func_801966B0);
|
||||
void func_8019686C(u16 objectId, Entity* src, Entity* dst) {
|
||||
DestroyEntity(dst);
|
||||
dst->objectId = objectId;
|
||||
dst->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
dst->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
dst->posX.i.hi = src->posX.i.hi;
|
||||
dst->posY.i.hi = src->posY.i.hi;
|
||||
dst->unk5A = src->unk5A;
|
||||
|
@ -248,9 +248,7 @@ INCLUDE_ASM("asm/us/st/mad/nonmatchings/D8C8", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
do { //! FAKE https://decomp.me/scratch/zysYC
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId];
|
||||
} while (0);
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -473,7 +471,7 @@ void func_80190F04(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -481,7 +479,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* ent1, Entity* ent2) {
|
||||
DestroyEntity(ent2);
|
||||
ent2->objectId = objectId;
|
||||
ent2->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
ent2->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
ent2->posX.i.hi = (s16)ent1->posX.i.hi;
|
||||
ent2->posY.i.hi = (s16)ent1->posY.i.hi;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ INCLUDE_ASM("asm/us/st/no3/nonmatchings/3E134", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -608,7 +608,7 @@ void func_801C3E10(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -616,7 +616,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ void func_801C9AF8(u16 objectId, Entity* source, Entity* entity) {
|
||||
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
entity->unk5A = source->unk5A;
|
||||
|
@ -123,7 +123,7 @@ INCLUDE_ASM("asm/us/st/np3/nonmatchings/390BC", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -372,7 +372,7 @@ void func_801BB680(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -380,7 +380,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ void func_801C129C(Entity* entity) {
|
||||
void func_801C1368(u16 objectId, Entity* src, Entity* dst) {
|
||||
DestroyEntity(dst);
|
||||
dst->objectId = objectId;
|
||||
dst->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
dst->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
dst->posX.i.hi = src->posX.i.hi;
|
||||
dst->posY.i.hi = src->posY.i.hi;
|
||||
dst->unk5A = src->unk5A;
|
||||
|
@ -210,7 +210,7 @@ INCLUDE_ASM("asm/us/st/st0/nonmatchings/30030", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -505,7 +505,7 @@ void func_801B3AB4(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -513,7 +513,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ void func_801B8B80(u16 objectId, Entity* source, Entity* entity) {
|
||||
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
entity->unk5A = source->unk5A;
|
||||
|
@ -184,6 +184,7 @@ LayoutObject* D_80180310[] = {
|
||||
/* 3D4 */ D_80181400,
|
||||
/* 3D8 */ D_80181400,
|
||||
/* 3DC */ D_80181400,
|
||||
/* 3E0 */ D_80181400,
|
||||
};
|
||||
// *** Layout object definition end ***
|
||||
|
||||
@ -197,7 +198,6 @@ void EntityWarpRoom(Entity*);
|
||||
void EntityWarpSmallRocks(Entity*);
|
||||
void EntityPrizeDrop(Entity*);
|
||||
PfnEntityUpdate PfnEntityUpdates[] = {
|
||||
/* 3E0 */ (PfnEntityUpdate)D_80181400,
|
||||
/* 3E4 */ (PfnEntityUpdate)EntityBreakable,
|
||||
/* 3E8 */ (PfnEntityUpdate)EntityExplosion,
|
||||
/* 3EC */ (PfnEntityUpdate)EntityPrizeDrop,
|
||||
@ -1797,7 +1797,7 @@ INCLUDE_ASM("asm/us/st/wrp/nonmatchings/6FD0", EntityNumericDamage);
|
||||
void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = initDesc->objectId & 0x3FF;
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[entity->objectId - 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;
|
||||
@ -2095,7 +2095,7 @@ void func_8018A7AC(void) {
|
||||
void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = g_CurrentEntity->posX.i.hi;
|
||||
entity->posY.i.hi = g_CurrentEntity->posY.i.hi;
|
||||
}
|
||||
@ -2103,7 +2103,7 @@ void CreateEntityFromCurrentEntity(u16 objectId, Entity* entity) {
|
||||
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity) {
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
}
|
||||
|
@ -1006,7 +1006,7 @@ void func_80190494(u16 objectId, Entity* source, Entity* entity) {
|
||||
|
||||
DestroyEntity(entity);
|
||||
entity->objectId = objectId;
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId];
|
||||
entity->pfnUpdate = PfnEntityUpdates[objectId - 1];
|
||||
entity->posX.i.hi = source->posX.i.hi;
|
||||
entity->posY.i.hi = source->posY.i.hi;
|
||||
entity->unk5A = source->unk5A;
|
||||
|
Loading…
Reference in New Issue
Block a user