diff --git a/config/splat.us.stcen.yaml b/config/splat.us.stcen.yaml index 86a67bf07..56a8a780d 100644 --- a/config/splat.us.stcen.yaml +++ b/config/splat.us.stcen.yaml @@ -38,7 +38,8 @@ segments: - [0x1300, data] - [0xD42C, rodata] - [0xD4B0, .rodata, D600] - - [0xD4D8, rodata] + - [0xD4D8, .rodata, 11280] # EntityRedDoor + - [0xD4F0, rodata] - [0xD578, .rodata, entity_relic_orb] - [0xD5B0, .rodata, entity_message_box] - [0xD5C4, .rodata, 18084] # EntityStageNamePopup diff --git a/config/splat.us.stdre.yaml b/config/splat.us.stdre.yaml index 8964b77c7..e627a369e 100644 --- a/config/splat.us.stdre.yaml +++ b/config/splat.us.stdre.yaml @@ -50,7 +50,8 @@ segments: - [0x1181C, rodata] - [0x118D0, rodata] - [0x11910, .rodata, 1697C] # EntityFadeToWhite - - [0x1193C, rodata] + - [0x1193C, .rodata, 173C4] # EntityRedDoor + - [0x11954, rodata] - [0x119C4, .rodata, 1C7DC] - [0x119DC, .rodata, entity_relic_orb] - [0x11A14, .rodata, entity_message_box] diff --git a/config/splat.us.stmad.yaml b/config/splat.us.stmad.yaml index cce406e91..35c84022e 100644 --- a/config/splat.us.stmad.yaml +++ b/config/splat.us.stmad.yaml @@ -65,6 +65,8 @@ segments: - [0x19A4, data] - [0x1D14, data] - [0xD794, rodata] + - [0xD7CC, .rodata, EDB8] # EntityRedDoor + - [0xD7E4, rodata] - [0xD83C, .rodata, 139E0] - [0xD85C, rodata] # EntityEquipItemDrop - [0xD874, .rodata, entity_relic_orb] diff --git a/config/splat.us.stno3.yaml b/config/splat.us.stno3.yaml index 7fd48dfde..2c151e4c9 100644 --- a/config/splat.us.stno3.yaml +++ b/config/splat.us.stno3.yaml @@ -64,7 +64,8 @@ segments: - [0x374F4, .rodata, 3FF00] # EntityDeathStolenItems - [0x37514, .rodata, 3FF00] # EntityDeath - [0x37564, .rodata, 3FF00] # EntityWargExplosionPuffOpaque - - [0x37578, rodata] + - [0x37578, .rodata, 41C80] # EntityRedDoor + - [0x37590, rodata] - [0x375E0, .rodata, 46684] # EntityPrizeDrop - [0x37600, .rodata, 46684] # EntityEquipItemDrop - [0x37618, .rodata, entity_relic_orb] diff --git a/config/splat.us.stnp3.yaml b/config/splat.us.stnp3.yaml index 6b0af6545..75534c341 100644 --- a/config/splat.us.stnp3.yaml +++ b/config/splat.us.stnp3.yaml @@ -60,7 +60,8 @@ segments: - [0x31EBC, .rodata, 365FC] # func_801B65FC - [0x31ED0, .rodata, 36990] # EntitySlogra .rodata, 36990 - [0x31EDC, rodata] # EntityGaibon .rodata, 36990 - - [0x31F00, rodata] + - [0x31F00, .rodata, 394F0] # EntityRedDoor + - [0x31F18, rodata] - [0x31F68, .rodata, 3DEF4] - [0x31FA0, .rodata, entity_relic_orb] - [0x31FD8, .rodata, entity_message_box] diff --git a/config/splat.us.stnz0.yaml b/config/splat.us.stnz0.yaml index b9a6ee2e7..ce5235684 100644 --- a/config/splat.us.stnz0.yaml +++ b/config/splat.us.stnz0.yaml @@ -87,6 +87,8 @@ segments: - [0x30618, rodata] # EntityGaibon .rodata, 33FCC - [0x3063C, .rodata, 36DE4] # func_801B7034 - [0x3064C, rodata] + - [0x30728, .rodata, 39908] # EntityRedDoor + - [0x30740, rodata] - [0x30790, .rodata, 3E30C] - [0x307B0, .rodata, 3E30C] - [0x307C8, .rodata, entity_relic_orb] diff --git a/config/splat.us.stst0.yaml b/config/splat.us.stst0.yaml index 1e6ff3826..900dd9134 100644 --- a/config/splat.us.stst0.yaml +++ b/config/splat.us.stst0.yaml @@ -58,6 +58,8 @@ segments: - [0x27BDC, .rodata, 2DAC8] # "can't get effect works!\n" - [0x27BFC, .rodata, 2DAC8] # func_801AF774 - [0x27C1C, rodata] + - [0x27C6C, .rodata, 31CA0] # EntityRedDoor + - [0x27C84, rodata] - [0x27C8C, .rodata, 36358] - [0x27CAC, rodata] - [0x27CC4, rodata] diff --git a/config/splat.us.stwrp.yaml b/config/splat.us.stwrp.yaml index 234231336..36b8fb463 100644 --- a/config/splat.us.stwrp.yaml +++ b/config/splat.us.stwrp.yaml @@ -74,7 +74,7 @@ segments: - [0x6E30, .rodata, 6FD0] - [0x6E70, .rodata, 73A0] # EntityWarpRoom - [0x6E90, .rodata, 73A0] # EntityWarpSmallRocks - - [0x6EA8, rodata] # EntityRedDoor + - [0x6EA8, .rodata, 861C] # EntityRedDoor - [0x6EC0, rodata] # CollectGold - [0x6F10, .rodata, D020] - [0x6F30, .rodata, D020] # EntityEquipItemDrop diff --git a/config/symbols.beta.txt b/config/symbols.beta.txt index f13d5e420..41d5817d0 100644 --- a/config/symbols.beta.txt +++ b/config/symbols.beta.txt @@ -103,6 +103,6 @@ SetGeomOffset = 0x8001803C; D_8003BE1E_mad = 0x8003BE1E; D_8003BF28_mad = 0x8003BF28; -D_80072E9C_mad = 0x80072E9C; -D_80072EB4_mad = 0x80072EB4; +PLAYER_zPriority = 0x80072E9C; +PLAYER_step = 0x80072EB4; D_80096ED0_mad = 0x80096ED0; diff --git a/config/symbols.stmad.txt b/config/symbols.stmad.txt index 914666c52..dd925985e 100644 --- a/config/symbols.stmad.txt +++ b/config/symbols.stmad.txt @@ -4,6 +4,7 @@ g_pStTileset = 0x801802A4; g_pStObjLayoutHorizontal = 0x801802F4; PfnEntityUpdates = 0x8018049C; g_eBreakableInit = 0x801804F0; +g_eInitGeneric2 = 0x80180544; g_eDamageDisplayInit = 0x80180550; g_eBreakableAnimations = 0x80180644; g_eBreakableHitboxes = 0x80180664; @@ -12,6 +13,8 @@ g_eBreakableanimSets = 0x80180674; g_eBreakableDrawModes = 0x80180684; g_eDamageDisplayClut = 0x801809C4; g_Rooms = 0x80181130; +g_eRedDoorUV = 0x801809D4; +g_eRedDoorTiles = 0x80180594; g_pStrObjLayout0 = 0x801811D4; g_pStrObjLayout1 = 0x801811E8; g_pStrObjLayout2 = 0x80181206; @@ -68,7 +71,6 @@ g_InitializeData0 = 0x801804FC; g_UnkPrimHelperRot = 0x8018D8C0; UnkPrimHelper = 0x80198FA0; EntityUnkId15 = 0x80195B44; -EntityIsNearPlayer = 0x801910A8; UnkPolyFunc2 = 0x801996EC; PrimDecreaseBrightness = 0x8019976C; g_LayoutObjHorizontal = 0x801997D8; diff --git a/config/symbols.us.stcen.txt b/config/symbols.us.stcen.txt index 7eca9447d..67fcf63ce 100644 --- a/config/symbols.us.stcen.txt +++ b/config/symbols.us.stcen.txt @@ -5,9 +5,12 @@ PfnEntityUpdates = 0x80180394; g_InitializeData0 = 0x80180410; g_InitializeEntityData0 = 0x8018041C; g_EInitGeneric = 0x80180434; +g_eInitGeneric2 = 0x80180458; g_eDamageDisplayInit = 0x80180464; +g_eRedDoorTiles = 0x801804A4; UNK_Invincibility0 = 0x801807B8; g_eDamageDisplayClut = 0x80180B94; +g_eRedDoorUV = 0x80180BA4; c_GoldPrizes = 0x80180F58; c_HeartPrizes = 0x80180FE8; g_Rooms = 0x801812D4; @@ -30,7 +33,6 @@ EntityDamageDisplay = 0x80192398; InitRoomEntities = 0x80193298; UpdateRoomPosition = 0x80193410; CreateEntityFromEntity = 0x80193538; -EntityIsNearPlayer = 0x801935B4; EntityRedDoor = 0x8019362C; DestroyEntity = 0x80194264; PreventEntityFromRespawning = 0x8019434C; diff --git a/config/symbols.us.stdre.txt b/config/symbols.us.stdre.txt index 033126693..34a714d47 100644 --- a/config/symbols.us.stdre.txt +++ b/config/symbols.us.stdre.txt @@ -6,7 +6,9 @@ g_eBreakableInit = 0x80180458; g_InitializeData0 = 0x80180464; g_InitializeEntityData0 = 0x80180470; g_EInitGeneric = 0x80180488; +g_eInitGeneric2 = 0x801804AC; g_eDamageDisplayInit = 0x801804B8; +g_eRedDoorTiles = 0x80180550; g_eBreakableAnimations = 0x80180610; g_eBreakableHitboxes = 0x80180630; g_eBreakableExplosionTypes = 0x80180638; @@ -15,6 +17,7 @@ g_eBreakableDrawModes = 0x80180650; g_CloneShootOrder = 0x801807D4; UNK_Invincibility0 = 0x8018097C; g_eDamageDisplayClut = 0x80180D58; +g_eRedDoorUV = 0x80180D68; c_GoldPrizes = 0x8018111C; c_HeartPrizes = 0x801811AC; g_Rooms = 0x80181498; @@ -43,12 +46,10 @@ InitRoomEntities = 0x801993DC; UpdateRoomPosition = 0x80199554; CreateEntityFromCurrentEntity = 0x80199608; CreateEntityFromEntity = 0x8019967C; -EntityIsNearPlayer = 0x801996F8; EntityRedDoor = 0x80199770; DestroyEntity = 0x8019A3A8; PreventEntityFromRespawning = 0x8019A490; AnimateEntity = 0x8019A4D8; -GetSideToPlayer = 0x8019A718; MoveEntity = 0x8019A75C; FallEntity = 0x8019A78C; AllocEntity = 0x8019AC18; diff --git a/config/symbols.us.stno3.txt b/config/symbols.us.stno3.txt index 335ee5270..1319c6995 100644 --- a/config/symbols.us.stno3.txt +++ b/config/symbols.us.stno3.txt @@ -6,7 +6,9 @@ g_eBreakableInit = 0x80180AAC; g_InitializeData0 = 0x80180AB8; g_InitializeEntityData0 = 0x80180AC4; g_EInitGeneric = 0x80180ADC; +g_eInitGeneric2 = 0x80180B00; g_eDamageDisplayInit = 0x80180B0C; +g_eRedDoorTiles = 0x80180DA0; g_eBreakableAnimations = 0x80180E50; g_eBreakableHitboxes = 0x80180E70; g_eBreakableExplosionTypes = 0x80180E78; @@ -15,6 +17,7 @@ g_eBreakableDrawModes = 0x80180E90; g_TrapDoorFlag = 0x8018123C; UNK_Invincibility0 = 0x80181CC0; g_eDamageDisplayClut = 0x8018209C; +g_eRedDoorUV = 0x801820AC; c_GoldPrizes = 0x80182460; c_HeartPrizes = 0x801824F0; g_Rooms = 0x80183CC4; @@ -75,7 +78,6 @@ InitRoomEntities = 0x801C3C98; UpdateRoomPosition = 0x801C3E10; CreateEntityFromCurrentEntity = 0x801C3EC4; CreateEntityFromEntity = 0x801C3F38; -EntityIsNearPlayer = 0x801C3FB4; EntityRedDoor = 0x801C402C; DestroyEntity = 0x801C4C64; PreventEntityFromRespawning = 0x801C4D4C; diff --git a/config/symbols.us.stnp3.txt b/config/symbols.us.stnp3.txt index d24d77b7f..3b0bacbe4 100644 --- a/config/symbols.us.stnp3.txt +++ b/config/symbols.us.stnp3.txt @@ -6,7 +6,9 @@ g_eBreakableInit = 0x80180A3C; g_InitializeData0 = 0x80180A48; g_InitializeEntityData0 = 0x80180A54; g_EInitGeneric = 0x80180A6C; +g_eInitGeneric2 = 0x80180A90; g_eDamageDisplayInit = 0x80180A9C; +g_eRedDoorTiles = 0x80180D78; g_eBreakableAnimations = 0x80180E28; g_eBreakableHitboxes = 0x80180E48; g_eBreakableExplosionTypes = 0x80180E50; @@ -15,6 +17,7 @@ g_eBreakableDrawModes = 0x80180E68; g_TrapDoorFlag = 0x80181104; UNK_Invincibility0 = 0x8018164C; g_eDamageDisplayClut = 0x80181A28; +g_eRedDoorUV = 0x80181A38; c_GoldPrizes = 0x80181DEC; c_HeartPrizes = 0x80181E7C; g_Rooms = 0x80183A7C; @@ -52,7 +55,6 @@ InitRoomEntities = 0x801BB508; UpdateRoomPosition = 0x801BB680; CreateEntityFromCurrentEntity = 0x801BB734; CreateEntityFromEntity = 0x801BB7A8; -EntityIsNearPlayer = 0x801BB824; EntityRedDoor = 0x801BB89C; DestroyEntity = 0x801BC4D4; PreventEntityFromRespawning = 0x801BC5BC; diff --git a/config/symbols.us.stnz0.txt b/config/symbols.us.stnz0.txt index 56bfbbee2..b2e5e08d3 100644 --- a/config/symbols.us.stnz0.txt +++ b/config/symbols.us.stnz0.txt @@ -8,13 +8,16 @@ PfnEntityUpdates = 0x80180A94; g_InitializeData0 = 0x80180BD4; g_InitializeEntityData0 = 0x80180BE0; g_EInitGeneric = 0x80180BF8; +g_eInitGeneric2 = 0x80180C1C; g_eDamageDisplayInit = 0x80180C28; +g_eRedDoorTiles = 0x80180D8C; g_CallElevator = 0x80180EEC; g_BossFlag = 0x80181010; g_ElevatorTarget = 0x801813A4; g_ElevatorTargetPos = 0x801813A8; UNK_Invincibility0 = 0x80181574; g_eDamageDisplayClut = 0x80181950; +g_eRedDoorUV = 0x80181960; c_GoldPrizes = 0x80181D14; c_HeartPrizes = 0x80181DA4; g_Rooms = 0x8018272C; @@ -51,7 +54,6 @@ InitRoomEntities = 0x801BB920; UpdateRoomPosition = 0x801BBA98; CreateEntityFromCurrentEntity = 0x801BBB4C; CreateEntityFromEntity = 0x801BBBC0; -EntityIsNearPlayer = 0x801BBC3C; EntityRedDoor = 0x801BBCB4; DestroyEntity = 0x801BC8EC; PreventEntityFromRespawning = 0x801BC9D4; diff --git a/config/symbols.us.stst0.txt b/config/symbols.us.stst0.txt index 77753caf3..134fbac4f 100644 --- a/config/symbols.us.stst0.txt +++ b/config/symbols.us.stst0.txt @@ -4,11 +4,14 @@ g_pStObjLayoutVertical = 0x801803E8; PfnEntityUpdates = 0x801804BC; g_InitializeData0 = 0x80180580; g_InitializeEntityData0 = 0x8018058C; +g_eInitGeneric2 = 0x801805BC; g_eDamageDisplayInit = 0x801805C8; +g_eRedDoorTiles = 0x8018064C; g_isSecretStairsButtonPressed = 0x8018089C; g_isDraculaFirstFormDefeated = 0x8018090C; UNK_Invincibility0 = 0x801815EC; g_eDamageDisplayClut = 0x80181968; +g_eRedDoorUV = 0x80181978; g_Rooms = 0x80182060; D_80183D1C = 0x80183D1C; D_80197F80 = 0x80197F80; @@ -41,7 +44,6 @@ InitRoomEntities = 0x801B393C; UpdateRoomPosition = 0x801B3AB4; CreateEntityFromCurrentEntity = 0x801B3B68; CreateEntityFromEntity = 0x801B3BDC; -EntityIsNearPlayer = 0x801B3C58; EntityRedDoor = 0x801B3CD0; DestroyEntity = 0x801B4908; DestroyEntitiesFromIndex = 0x801B4974; diff --git a/config/symbols.us.stwrp.txt b/config/symbols.us.stwrp.txt index 6a796f117..98625ae33 100644 --- a/config/symbols.us.stwrp.txt +++ b/config/symbols.us.stwrp.txt @@ -50,13 +50,10 @@ Random = 0x801881E8; TestCollisions = 0x8018861C; EntityDamageDisplay = 0x80189734; CreateEntityFromEntity = 0x8018A8D4; -EntityIsNearPlayer = 0x8018A950; EntityRedDoor = 0x8018A9C8; DestroyEntity = 0x8018B600; PreventEntityFromRespawning = 0x8018B6E8; -GetSideToPlayer = 0x8018B970; AllocEntity = 0x8018BE70; -InitializeEntity = 0x8018C310; CollectGold = 0x8018CD10; EntityEquipItemDrop = 0x8018DA34; EntityStageNamePopup = 0x8019198C; diff --git a/include/entity.h b/include/entity.h index 665b2ec80..c0e7f19f5 100644 --- a/include/entity.h +++ b/include/entity.h @@ -144,6 +144,13 @@ typedef struct { s32 yFloatSpeed; } ET_RelicOrb; +typedef struct { + /* 0x7C */ u32 unused7C; + /* 0x80 */ u32 unused80; + /* 0x84 */ s16 angle; + /* 0x86 */ s16 unk86; +} ET_RedDoor; + typedef struct { /* 0x7C */ struct Primitive* prim; /* 0x80 */ s32 unk80; @@ -943,6 +950,7 @@ typedef union { // offset=0x7C ET_EquipItemDrop equipItemDrop; ET_NumericDamage ndmg; ET_RelicOrb relicOrb; + ET_RedDoor door; ET_StagePopup stpopup; ET_MessageBox messageBox; ET_Weapon weapon; diff --git a/include/sfx.h b/include/sfx.h index 0b9eef51c..bfed6045a 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -193,7 +193,15 @@ typedef enum { MONO_SOUND, STEREO_SOUND } soundMode; #define NA_SE_EV_GLASS_BREAK 0x632 #define NA_SE_BREAK_CANDLE 0x634 #define NA_SE_PL_WARP 0x636 -#define NA_SE_EN_OPEN_DOOR 0x642 + +#if defined(VERSION_BETA) +#define SFX_OPEN_DOOR 0x640 +#define SFX_DOOR_UNKNOWN 0x64D +#else +#define SFX_OPEN_DOOR 0x642 +#define SFX_DOOR_UNKNOWN 0x64F +#endif + #define NA_SE_EN_COG_CLICK 0x642 #define NA_SE_EN_ROCK_BREAK 0x644 #define SOUND_BAT_SCREECH 0x64E diff --git a/src/saturn/game.c b/src/saturn/game.c index 57d667d32..d03df98dc 100644 --- a/src/saturn/game.c +++ b/src/saturn/game.c @@ -757,7 +757,7 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AACC, func_0607AACC); * 1 = Player is on the left side * 2 = Player is above */ -s16 GetSideToPlayer(Entity* self) { +s32 GetSideToPlayer(Entity* self) { Entity* player = &PLAYER; s16 side = 0; diff --git a/src/st/cen/11280.c b/src/st/cen/11280.c index 886e47a16..e89e9708b 100644 --- a/src/st/cen/11280.c +++ b/src/st/cen/11280.c @@ -5,8 +5,7 @@ INCLUDE_ASM("st/cen/nonmatchings/11280", TestCollisions); #include "../libstage.h" -// Red door (ID 05) -INCLUDE_ASM("st/cen/nonmatchings/11280", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/cen/1B274.c b/src/st/cen/1B274.c index 9a32c0165..82581c285 100644 --- a/src/st/cen/1B274.c +++ b/src/st/cen/1B274.c @@ -92,7 +92,7 @@ void EntityUnkId08(Entity* entity) { ObjInit2* objInit = &D_8018125C[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180458); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/cen/D600.c b/src/st/cen/D600.c index 31c77913e..eaf7b7bfb 100644 --- a/src/st/cen/D600.c +++ b/src/st/cen/D600.c @@ -12,7 +12,7 @@ void EntityBackgroundBlock(Entity* self) { ObjInit2* obj = &D_80180490[self->params].animSet; if (self->step == 0) { - InitializeEntity(D_80180458); + InitializeEntity(g_eInitGeneric2); self->animSet = obj->animSet; self->zPriority = obj->zPriority; self->unk5A = obj->unk4.s; diff --git a/src/st/cen/cen.h b/src/st/cen/cen.h index a12e8bff0..1a3944efa 100644 --- a/src/st/cen/cen.h +++ b/src/st/cen/cen.h @@ -55,7 +55,7 @@ extern u16 D_80180404[]; extern u16 g_InitializeData0[]; extern u16 D_80180428[]; extern u16 g_EInitGeneric[]; -extern u16 D_80180458[]; +extern u16 g_eInitGeneric2[]; extern u16 D_8018047C[]; // EntityElevator extern ObjInit2 D_80180490[]; diff --git a/src/st/dre/11A64.c b/src/st/dre/11A64.c index 150b8591f..6d5497d4a 100644 --- a/src/st/dre/11A64.c +++ b/src/st/dre/11A64.c @@ -11,7 +11,7 @@ void EntityUnkId11(Entity* entity) { ObjInit2* obj = (ObjInit2*)&D_80180528[entity->params * 10]; if (entity->step == 0) { - InitializeEntity(D_801804AC); + InitializeEntity(g_eInitGeneric2); entity->animSet = obj->animSet; entity->zPriority = obj->zPriority; entity->unk5A = obj->unk4.s; diff --git a/src/st/dre/173C4.c b/src/st/dre/173C4.c index 0b6b8bb5a..dbe17606f 100644 --- a/src/st/dre/173C4.c +++ b/src/st/dre/173C4.c @@ -5,7 +5,7 @@ INCLUDE_ASM("st/dre/nonmatchings/173C4", TestCollisions); #include "../libstage.h" -INCLUDE_ASM("st/dre/nonmatchings/173C4", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" @@ -104,7 +104,7 @@ s32 GetDistanceToPlayerY(void) { return yDistance; } -s16 GetSideToPlayer(void) { +s32 GetSideToPlayer(void) { s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi; if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) { diff --git a/src/st/dre/1E1C8.c b/src/st/dre/1E1C8.c index 72def81d7..7adc51da7 100644 --- a/src/st/dre/1E1C8.c +++ b/src/st/dre/1E1C8.c @@ -598,7 +598,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80181420[entity->params]; if (entity->step == 0) { - InitializeEntity(D_801804AC); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/dre/dre.h b/src/st/dre/dre.h index 250017f0d..32520e689 100644 --- a/src/st/dre/dre.h +++ b/src/st/dre/dre.h @@ -98,7 +98,7 @@ extern s32 D_801807F8[]; extern u8 D_80180830[]; extern s16 D_80180D80[]; extern u16 g_InitializeEntityData0[]; -extern u16 D_801804AC[]; +extern u16 g_eInitGeneric2[]; extern u16 D_801804F4[]; extern s8 c_HeartPrizes[]; extern PfnEntityUpdate PfnEntityUpdates[]; diff --git a/src/st/entity_red_door.h b/src/st/entity_red_door.h new file mode 100644 index 000000000..3112d208d --- /dev/null +++ b/src/st/entity_red_door.h @@ -0,0 +1,333 @@ +#include + +extern u8 g_eRedDoorUV[3][8]; +extern u16 g_eRedDoorTiles[2][8]; +void EntityRedDoor(Entity* self) { + Primitive* prim; + s32 i; + s16 angle; + u8* uv; + s16 x; + s16 y; + u8 sp3F; + s16 endX; + s16 scrollX; + s16 scrollY; + s32 tileIdx; + + switch (self->step) { + case 0: + InitializeEntity(g_eInitGeneric2); + self->animSet = 7; + self->animCurFrame = 1; + self->zPriority = PLAYER.zPriority - 0x20; + self->facingLeft = 0; + self->posY.i.hi += 0x1F; + + if (self->params & 0x100) { + self->ext.door.unk86 = -4; + } else { + self->ext.door.unk86 = 4; + } + self->posX.i.hi += self->ext.door.unk86; + self->primIndex = g_api.AllocPrimitives(PRIM_GT4, LEN(g_eRedDoorUV)); + if (self->primIndex == -1) { + DestroyEntity(self); + return; + } + self->flags |= FLAG_HAS_PRIMS; + uv = g_eRedDoorUV; + prim = &g_PrimBuf[self->primIndex]; + i = 0; + y = self->posY.i.hi - 0x1F; + while (prim != NULL) { + prim->u0 = uv[0]; + prim->u1 = uv[1]; + prim->u2 = uv[2]; + prim->u3 = uv[3]; + prim->v0 = uv[4]; + prim->v1 = uv[5]; + prim->v2 = uv[6]; + prim->v3 = uv[7]; + prim->tpage = 0x1F; + prim->clut = 0x198; + prim->priority = PLAYER.zPriority - 0x20; + prim->y0 = prim->y1 = y; + prim->y2 = prim->y3 = y + 62; + if (i == 0) { + prim->y0 = prim->y1 = y; + prim->y2 = prim->y3 = y + 62; + } + prim->drawMode = 6; + prim->r0 = prim->b0 = prim->g0 = 0x7F; + prim->r1 = prim->b1 = prim->g1 = 0x7F; + prim->r2 = prim->b2 = prim->g2 = 0x7F; + prim->r3 = prim->b3 = prim->g3 = 0x7F; + if (i == 2 && !(self->params & 0x100)) { + prim->drawMode |= 8; + } + if (i == 1 && (self->params & 0x100)) { + prim->drawMode |= 8; + } + i++; + uv += 8; + prim = prim->next; + } + if (EntityIsNearPlayer(self)) { + if (!(self->params & 0x100)) { + g_api.func_80134714(SFX_OPEN_DOOR, 0x60, -6); + self->ext.door.angle = 0x1000; + } + if (self->params & 0x100) { + g_api.func_80134714(SFX_OPEN_DOOR, 0x60, 6); + self->ext.door.angle = 0x800; + } + self->animCurFrame = 0; + self->step = 4; + PLAYER.velocityY = 0; + g_Player.D_80072EF4 = 0; + g_Player.D_80072EFC = 0x18; + } else { + self->ext.door.angle = 0xC00; + prim = &g_PrimBuf[self->primIndex]; + i = 0; + while (prim != NULL) { + prim->drawMode |= 8; + i++; + if (i == 3) { + break; + } + prim = prim->next; + } + } + break; + case 1: +#if defined(VERSION_BETA) + if (PLAYER.step == 1 && PLAYER.facingLeft != GetSideToPlayer() && + EntityIsNearPlayer(self)) +#else + if (!(((PLAYER.facingLeft != GetSideToPlayer()) & 1) ^ 1) && + ((PLAYER.step == 0x19 && g_PlayableCharacter) || + PLAYER.step == 1) && + EntityIsNearPlayer(self)) +#endif + { + if (!(self->params & 0x100)) { + g_api.func_80134714(SFX_OPEN_DOOR, 0x60, -6); + } + if (self->params & 0x100) { + g_api.func_80134714(SFX_OPEN_DOOR, 0x60, 6); + } + prim = &g_PrimBuf[self->primIndex]; + i = 0; + while (prim != NULL) { + if (i == 1 && !(self->params & 0x100)) { + prim->drawMode &= ~DRAW_HIDE; + } + if (i == 2 && (self->params & 0x100)) { + prim->drawMode &= ~DRAW_HIDE; + } + if (i == 0) { + prim->drawMode &= ~DRAW_HIDE; + } + i++; + prim = prim->next; + } + self->animCurFrame = 0; + g_Player.D_80072EF4 = 0; + g_Player.D_80072EFC = 2; + self->step++; + } + break; + case 2: + g_Player.D_80072EF4 = 0; + g_Player.D_80072EFC = 0x18; + if (!(self->params & 0x100)) { + self->ext.door.angle += 0x20; + if (self->ext.door.angle >= 0x1000) { + self->ext.door.angle = 0x1000; + } + if (self->ext.door.angle == 0x1000) { + self->step++; + } + } else { + self->ext.door.angle -= 0x20; + if (self->ext.door.angle <= 0x800) { + self->ext.door.angle = 0x800; + } + if (self->ext.door.angle == 0x800) { + self->step++; + } + } + break; + case 3: + if (g_Player.D_80072EFC >= 4) { + return; + } + if (!(self->params & 0x100)) { + g_Player.D_80072EF4 = PAD_LEFT; + } else { + g_Player.D_80072EF4 = PAD_RIGHT; + } + g_Player.D_80072EFC = 3; + break; + case 4: + if (!(self->params & 0x100)) { + g_Player.D_80072EF4 = PAD_RIGHT; + } else { + g_Player.D_80072EF4 = PAD_LEFT; + } + g_Player.D_80072EFC = 4; + if (EntityIsNearPlayer(self) == 0) { + self->step++; + } + break; + case 5: + g_Player.D_80072EF4 = 0; + g_Player.D_80072EFC = 4; + if (!(self->params & 0x100)) { + self->ext.door.angle -= 0x20; + if (self->ext.door.angle <= 0xC00) { + self->ext.door.angle = 0xC00; + } + } else { + self->ext.door.angle += 0x20; + if (self->ext.door.angle >= 0xC00) { + self->ext.door.angle = 0xC00; + } + } + if (self->ext.door.angle == 0xC00) { + prim = &g_PrimBuf[self->primIndex]; + for (i = 0; prim != NULL; i++, prim = prim->next) { + prim->drawMode |= 8; + } + if (!(self->params & 0x100)) { + g_api.func_80134714(SFX_DOOR_UNKNOWN, 0x60, -6); + } + if (self->params & 0x100) { + g_api.func_80134714(SFX_DOOR_UNKNOWN, 0x60, 6); + } + self->animCurFrame = 1; + self->step = 1; + } + break; + } + + if (self->step != 1) { + g_api.func_8010E168(1, 0x20); + g_api.func_8010DFF0(1, 1); + } + + x = self->posX.i.hi - self->ext.door.unk86; + if (self->params & 0x100) { + x--; + } else { + x++; + } + + i = 0; + angle = self->ext.door.angle; + prim = &g_PrimBuf[self->primIndex]; + for (; prim != NULL; i++, prim = prim->next) { + if (!(prim->drawMode & 8)) { + if (!(self->params & 0x100)) { + if (i == 0) { + endX = prim->x0 = prim->x2 = + x + ((rcos(angle) >> 8) * 32 >> 4); + prim->x1 = prim->x3 = + prim->x0 - ((rsin(angle) >> 4) * 6 >> 8); + if (angle > 0xF80) { + prim->x1 = prim->x3 = prim->x0 + 1; + } + if (angle > 0xE00) { + prim->u0 = prim->u2 = 178; + prim->u1 = prim->u3 = 182; + } + if (angle <= 0xE00) { + prim->u0 = prim->u2 = 177; + prim->u1 = prim->u3 = 183; + } + if (angle == 0x1000) { + prim->r1 = prim->b1 = prim->g1 = 63; + prim->r3 = prim->b3 = prim->g3 = 63; + } else { + prim->r1 = prim->b1 = prim->g1 = + 0x7F - ((angle & 0x3FF) >> 4); + prim->r3 = prim->b3 = prim->g3 = + 0x7F - ((angle & 0x3FF) >> 4); + } + } else { + prim->x0 = prim->x2 = x; + prim->x1 = prim->x3 = endX; + if (angle == 0x1000) { + prim->r0 = prim->b0 = prim->g0 = 63; + prim->r2 = prim->b2 = prim->g2 = 63; + } else { + prim->r0 = prim->b0 = prim->g0 = (angle & 0x3FF) >> 4; + prim->r2 = prim->b2 = prim->g2 = (angle & 0x3FF) >> 4; + } + } + } else { + if (i == 0) { + endX = prim->x1 = prim->x3 = + x + ((rcos(angle) >> 8) * 32 >> 4); + prim->x0 = prim->x2 = + prim->x1 + (((rsin(angle) >> 4) * 6) >> 8); + if (angle < 0x880) { + prim->x0 = prim->x2 = prim->x1 - 1; + } + if (angle < 0xA00) { + prim->u0 = prim->u2 = 178; + prim->u1 = prim->u3 = 182; + } + if (angle > 0xA00) { + prim->u0 = prim->u2 = 177; + prim->u1 = prim->u3 = 183; + } + if (angle == 0x800) { + prim->r0 = prim->b0 = prim->g0 = 127; + prim->r2 = prim->b2 = prim->g2 = 127; + } else { + prim->r0 = prim->b0 = prim->g0 = + 63 + ((angle & 0x3FF) >> 4); + prim->r2 = prim->b2 = prim->g2 = + 63 + ((angle & 0x3FF) >> 4); + } + } else { + prim->x0 = prim->x2 = endX - 1; + prim->x1 = prim->x3 = x; + if (angle == 0x800) { + prim->r1 = prim->b1 = prim->g1 = 63; + prim->r3 = prim->b3 = prim->g3 = 63; + } else { + prim->r1 = prim->b1 = prim->g1 = + 63 - ((angle & 0x3FF) >> 4); + prim->r3 = prim->b3 = prim->g3 = + 63 - ((angle & 0x3FF) >> 4); + } + } + } + } + } + + sp3F = self->params & 0xFF; + if (self->animCurFrame) { + for (i = 0; i < 4; i++) { + x = self->posX.i.hi; + y = self->posY.i.hi - 24 + i * 0x10; + scrollX = x + g_Tilemap.scrollX.i.hi; + scrollY = y + g_Tilemap.scrollY.i.hi; + tileIdx = (scrollX >> 4) + (scrollY >> 4) * g_Tilemap.hSize * 0x10; + g_Tilemap.fg[tileIdx] = g_eRedDoorTiles[sp3F][i]; + } + } else { + for (i = 0; i < 4; i++) { + x = self->posX.i.hi; + y = self->posY.i.hi - 24 + i * 0x10; + scrollX = x + g_Tilemap.scrollX.i.hi; + scrollY = y + g_Tilemap.scrollY.i.hi; + tileIdx = (scrollX >> 4) + (scrollY >> 4) * g_Tilemap.hSize * 0x10; + g_Tilemap.fg[tileIdx] = g_eRedDoorTiles[sp3F][i + 4]; + } + } +} diff --git a/src/st/get_side_to_player.h b/src/st/get_side_to_player.h index 5dc22a2fb..083b5afc9 100644 --- a/src/st/get_side_to_player.h +++ b/src/st/get_side_to_player.h @@ -4,7 +4,7 @@ * 1 = Player is on the left side * 2 = Player is above */ -s16 GetSideToPlayer(void) { +s32 GetSideToPlayer(void) { s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi; if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) { diff --git a/src/st/mad/15520.c b/src/st/mad/15520.c index 5b3efd95e..12c798f15 100644 --- a/src/st/mad/15520.c +++ b/src/st/mad/15520.c @@ -546,7 +546,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* obj = &D_801810F4[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180544); + InitializeEntity(g_eInitGeneric2); entity->animSet = obj->animSet; entity->zPriority = obj->zPriority; entity->unk5A = obj->unk4.s; diff --git a/src/st/mad/D8C8.c b/src/st/mad/D8C8.c index a8f4ca0ae..c32da6e15 100644 --- a/src/st/mad/D8C8.c +++ b/src/st/mad/D8C8.c @@ -109,7 +109,7 @@ void func_8018E5AC(Entity* self) { ObjInit2* objInit = &D_8018056C[self->params]; if (self->step == 0) { - InitializeEntity(D_80180544); + InitializeEntity(g_eInitGeneric2); self->animSet = objInit->animSet; self->zPriority = objInit->zPriority; self->unk5A = objInit->unk4.s; diff --git a/src/st/mad/EDB8.c b/src/st/mad/EDB8.c index 882a5e04a..5060e347c 100644 --- a/src/st/mad/EDB8.c +++ b/src/st/mad/EDB8.c @@ -49,7 +49,7 @@ void CreateEntitiesToTheLeft(s16 posX) { #include "../create_entity_from_entity.h" #include "../entity_is_near_player.h" -INCLUDE_ASM("asm/us/st/mad/nonmatchings/EDB8", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/mad/mad.h b/src/st/mad/mad.h index e699927e5..021cc634a 100644 --- a/src/st/mad/mad.h +++ b/src/st/mad/mad.h @@ -47,7 +47,7 @@ void EntityUnkId15(Entity* entity); extern u16 g_InitializeData0[]; extern u16 D_8018052C[]; extern u16 UNK_Invincibility0[]; -extern u16 D_80180544[]; +extern u16 g_eInitGeneric2[]; extern ObjInit2 D_8018056C[]; extern u16 D_80180D1C[]; extern u16 D_80180D4C[]; diff --git a/src/st/no3/377D4.c b/src/st/no3/377D4.c index aed4943f2..0639bc18e 100644 --- a/src/st/no3/377D4.c +++ b/src/st/no3/377D4.c @@ -11,7 +11,7 @@ void EntityCavernDoorVase(Entity* self) { ObjInit2* objInit = &D_80180BFC[self->params]; if (self->step == 0) { - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); self->animSet = objInit->animSet; self->zPriority = objInit->zPriority; self->facingLeft = objInit->unk4.U8.unk0; diff --git a/src/st/no3/3E134.c b/src/st/no3/3E134.c index 9811cbd79..7d87931dc 100644 --- a/src/st/no3/3E134.c +++ b/src/st/no3/3E134.c @@ -9,7 +9,7 @@ void EntityFlyingOwlAndLeaves(Entity* entity) { switch (entity->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(1); entity->animCurFrame = 56; if (entity->params != 0) { @@ -106,7 +106,7 @@ void EntityFallingLeaf(Entity* entity) { switch (entity->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(1); entity->animCurFrame = (entity->params & 1) + 63; entity->zPriority = 0xC1; diff --git a/src/st/no3/3FF00.c b/src/st/no3/3FF00.c index 32ce964db..195d7bd72 100644 --- a/src/st/no3/3FF00.c +++ b/src/st/no3/3FF00.c @@ -128,7 +128,7 @@ void EntityDeathStolenItem(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); break; case 1: @@ -289,7 +289,7 @@ void EntityDeath(Entity* self) { if (D_801D7DD0 & 0x80) { primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex != -1) { - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); self->animSet = ANIMSET_OVL(8); self->palette = 0x2D6; self->unk5A = 0x44; @@ -565,7 +565,7 @@ void EntityUnkId5B(Entity* entity) { switch (entity->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(8); entity->palette = 0x2D6; entity->animCurFrame = 0; @@ -605,7 +605,7 @@ void EntityUnkId5E(Entity* entity) { switch (entity->step) { case 0: animCurFrame = entity->animCurFrame; - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); entity->animCurFrame = animCurFrame; entity->animSet = ANIMSET_OVL(8); entity->palette = 0x2D6; diff --git a/src/st/no3/41C80.c b/src/st/no3/41C80.c index cf709ab12..ea851d1ea 100644 --- a/src/st/no3/41C80.c +++ b/src/st/no3/41C80.c @@ -5,7 +5,7 @@ INCLUDE_ASM("st/no3/nonmatchings/41C80", TestCollisions); #include "../libstage.h" -INCLUDE_ASM("st/no3/nonmatchings/41C80", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/no3/48A84.c b/src/st/no3/48A84.c index 78a97485f..fe4117807 100644 --- a/src/st/no3/48A84.c +++ b/src/st/no3/48A84.c @@ -555,7 +555,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80182764[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; @@ -991,7 +991,7 @@ void EntitySplashWater(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); if (temp_s2 != 0 && temp_s4 != 7) { primIndex = g_api.AllocPrimitives(PRIM_GT4, 4); } else { @@ -1184,7 +1184,7 @@ void EntitySurfacingWater(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { DestroyEntity(self); @@ -1330,7 +1330,7 @@ void EntitySideWaterSplash(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { prim = &g_PrimBuf[primIndex]; @@ -1416,7 +1416,7 @@ void EntitySmallWaterDrop(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_TILE, 1); if (primIndex == -1) { DestroyEntity(self); @@ -1487,7 +1487,7 @@ void EntityWaterDrop(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180B00); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.func_800EDB58(PRIM_TILE_ALT, 0x21); if (primIndex == -1) { DestroyEntity(self); diff --git a/src/st/no3/no3.h b/src/st/no3/no3.h index 11f5e9aa2..54e83aac1 100644 --- a/src/st/no3/no3.h +++ b/src/st/no3/no3.h @@ -97,7 +97,7 @@ extern u16 D_80180AD0[]; extern u16 g_EInitGeneric[]; extern u16 D_80180AE8[]; extern u16 D_80180AF4[]; -extern u16 D_80180B00[]; +extern u16 g_eInitGeneric2[]; extern u16 D_80180B18[]; extern u16 D_80180B48[]; extern u16 D_80180B54[]; diff --git a/src/st/np3/3246C.c b/src/st/np3/3246C.c index c6a897b6c..cedc0d195 100644 --- a/src/st/np3/3246C.c +++ b/src/st/np3/3246C.c @@ -10,7 +10,7 @@ void func_801B246C(Entity* self) { ObjInit2* temp_s0 = &D_80180C10[self->params]; if (self->step == 0) { - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); self->animSet = temp_s0->animSet; self->zPriority = temp_s0->zPriority; self->facingLeft = temp_s0->unk4.U8.unk0; diff --git a/src/st/np3/394F0.c b/src/st/np3/394F0.c index 733c3b447..8e42a4e0c 100644 --- a/src/st/np3/394F0.c +++ b/src/st/np3/394F0.c @@ -5,7 +5,7 @@ INCLUDE_ASM("st/np3/nonmatchings/394F0", TestCollisions); #include "../libstage.h" -INCLUDE_ASM("st/np3/nonmatchings/394F0", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/np3/402F4.c b/src/st/np3/402F4.c index 6e9d064d7..bf59b5a1f 100644 --- a/src/st/np3/402F4.c +++ b/src/st/np3/402F4.c @@ -677,7 +677,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_801820F0[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/np3/44DCC.c b/src/st/np3/44DCC.c index 9d6c108f2..2a3da1562 100644 --- a/src/st/np3/44DCC.c +++ b/src/st/np3/44DCC.c @@ -56,7 +56,7 @@ void EntitySplashWater(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); if (temp_s2 != 0 && temp_s4 != 7) { primIndex = g_api.AllocPrimitives(PRIM_GT4, 4); } else { @@ -249,7 +249,7 @@ void EntitySurfacingWater(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { DestroyEntity(self); @@ -395,7 +395,7 @@ void EntitySideWaterSplash(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { prim = &g_PrimBuf[primIndex]; @@ -481,7 +481,7 @@ void EntitySmallWaterDrop(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_TILE, 1); if (primIndex == -1) { DestroyEntity(self); @@ -552,7 +552,7 @@ void EntityWaterDrop(Entity* self) { switch (self->step) { case 0: - InitializeEntity(D_80180A90); + InitializeEntity(g_eInitGeneric2); primIndex = g_api.func_800EDB58(PRIM_TILE_ALT, 0x21); if (primIndex == -1) { DestroyEntity(self); diff --git a/src/st/np3/np3.h b/src/st/np3/np3.h index 3ebb1782c..3b2564022 100644 --- a/src/st/np3/np3.h +++ b/src/st/np3/np3.h @@ -70,7 +70,7 @@ extern u16 D_80180A60[]; extern u16 g_EInitGeneric[]; extern u16 D_80180A78[]; extern u16 D_80180A84[]; -extern u16 D_80180A90[]; +extern u16 g_eInitGeneric2[]; extern u16 D_80180AA8[]; extern u16 D_80180AB4[]; extern u16 D_80180AC0[]; diff --git a/src/st/nz0/30958.c b/src/st/nz0/30958.c index 50b150e66..23df9a7e4 100644 --- a/src/st/nz0/30958.c +++ b/src/st/nz0/30958.c @@ -10,7 +10,7 @@ void func_801B0958(Entity* self) { ObjInit2* temp_s0 = &D_80180D64[self->params]; if (self->step == 0) { - InitializeEntity(D_80180C1C); + InitializeEntity(g_eInitGeneric2); self->animSet = temp_s0->animSet; self->zPriority = temp_s0->zPriority; self->unk5A = temp_s0->unk4.u; diff --git a/src/st/nz0/39908.c b/src/st/nz0/39908.c index 1b025ad01..965daba8e 100644 --- a/src/st/nz0/39908.c +++ b/src/st/nz0/39908.c @@ -4,7 +4,7 @@ INCLUDE_ASM("st/nz0/nonmatchings/39908", TestCollisions); #include "../entity_damage_display.h" #include "../libstage.h" -INCLUDE_ASM("st/nz0/nonmatchings/39908", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/nz0/4070C.c b/src/st/nz0/4070C.c index 30d639340..5d9dac81e 100644 --- a/src/st/nz0/4070C.c +++ b/src/st/nz0/4070C.c @@ -710,7 +710,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80182014[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180C1C); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/nz0/nz0.h b/src/st/nz0/nz0.h index d71ca7607..de0ca3ab5 100644 --- a/src/st/nz0/nz0.h +++ b/src/st/nz0/nz0.h @@ -52,7 +52,7 @@ extern PfnEntityUpdate PfnEntityUpdates[]; extern const u16 g_InitializeEntityData0[]; extern u16 D_80180BEC[]; extern u16 g_EInitGeneric[]; // Init Elevator2 -extern u16 D_80180C1C[]; +extern u16 g_eInitGeneric2[]; extern u16 D_80180C34[]; // *** EntityBloodSkeleton properties START *** diff --git a/src/st/st0/27D64.c b/src/st/st0/27D64.c index 521eabb12..361b931ec 100644 --- a/src/st/st0/27D64.c +++ b/src/st/st0/27D64.c @@ -5,7 +5,7 @@ void func_801A7D64(Entity* self) { ObjInit2* obj = &D_80180638[self->params]; if (self->step == 0) { - InitializeEntity(D_801805BC); + InitializeEntity(g_eInitGeneric2); self->animSet = obj->animSet; self->zPriority = obj->zPriority; self->unk5A = obj->unk4.s; @@ -266,7 +266,7 @@ void func_801A8620(Entity* entity) { switch (entity->step) { case 0: - InitializeEntity(D_801805BC); + InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_DRA(2); entity->animCurFrame = 1; entity->zPriority = 0xB0; diff --git a/src/st/st0/31CA0.c b/src/st/st0/31CA0.c index df80e5f56..f890f2b5f 100644 --- a/src/st/st0/31CA0.c +++ b/src/st/st0/31CA0.c @@ -5,7 +5,7 @@ INCLUDE_ASM("st/st0/nonmatchings/31CA0", TestCollisions); #include "../libstage.h" -INCLUDE_ASM("st/st0/nonmatchings/31CA0", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" @@ -73,7 +73,7 @@ s32 GetDistanceToPlayerY(void) { return yDistance; } -s16 GetSideToPlayer(void) { +s32 GetSideToPlayer(void) { s16 side = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi; if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) { diff --git a/src/st/st0/36358.c b/src/st/st0/36358.c index 7301c408a..4b1577acf 100644 --- a/src/st/st0/36358.c +++ b/src/st/st0/36358.c @@ -863,7 +863,7 @@ void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80181FE8[entity->params]; if (entity->step == 0) { - InitializeEntity(D_801805BC); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/st0/st0.h b/src/st/st0/st0.h index 82232a9e0..79a7fc10a 100644 --- a/src/st/st0/st0.h +++ b/src/st/st0/st0.h @@ -28,7 +28,7 @@ typedef enum { } EntityIDs; void CreateEntityFromEntity(u16 entityId, Entity* source, Entity* entity); -s16 GetSideToPlayer(); +s32 GetSideToPlayer(); void MoveEntity(); void SetStep(u8); void EntityExplosion(Entity*); @@ -49,7 +49,7 @@ extern u16 D_80180574[]; extern u16 g_InitializeEntityData0[]; extern u16 D_80180598[]; // Init EntityCutscene extern u16 D_801805A4[]; -extern u16 D_801805BC[]; +extern u16 g_eInitGeneric2[]; extern u16 D_801805D4[]; // Init EntityStageTitleCard extern u16 D_801805E0[]; // Init EntityDracula extern u16 D_801805EC[]; // Init EntityDraculaFireball diff --git a/src/st/wrp/6FD0.c b/src/st/wrp/6FD0.c index a60f19348..f91f72e59 100644 --- a/src/st/wrp/6FD0.c +++ b/src/st/wrp/6FD0.c @@ -239,7 +239,7 @@ u16 D_8018047C[] = { u16 D_80180488[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, }; -u16 D_80180494[] = { +u16 g_eInitGeneric2[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, }; u16 g_eDamageDisplayInit[] = { @@ -266,11 +266,9 @@ ObjInit2 D_801804E0[] = { // Owned by EntityRedDoor to animate the tiles behind the door itself. // There is a loop in EntityRedDoor that forces to write those tiles // at every frame based on the door state to create the animation. -u16 D_80180508[] = { - /* 508 */ 0x001D, 0x0025, 0x0075, 0x007D, - /* 510 */ 0x00C6, 0x00C7, 0x00C8, 0x00C9, - /* 518 */ 0x001F, 0x0027, 0x0077, 0x007F, - /* 520 */ 0x00CA, 0x00CB, 0x00CC, 0x00CD, +u16 g_eRedDoorTiles[2][8] = { + {0x1D, 0x25, 0x75, 0x7D, 0xC6, 0xC7, 0xC8, 0xC9}, + {0x1F, 0x27, 0x77, 0x7F, 0xCA, 0xCB, 0xCC, 0xCD}, }; // owned by func_801870B0 @@ -653,31 +651,10 @@ u16 g_eDamageDisplayClut[] = { /* A7A */ 0x01B1, }; -u8 D_80180A7C[] = { - /* A7C */ 0xB1, - /* A7D */ 0xB7, - /* A7E */ 0xB1, - /* A7F */ 0xB7, - /* A80 */ 0x21, - /* A81 */ 0x21, - /* A82 */ 0x5F, - /* A83 */ 0x5F, - /* A84 */ 0x88, - /* A85 */ 0xA8, - /* A86 */ 0x88, - /* A87 */ 0xA8, - /* A88 */ 0x21, - /* A89 */ 0x21, - /* A8A */ 0x5F, - /* A8B */ 0x5F, - /* A8C */ 0xA8, - /* A8D */ 0x88, - /* A8E */ 0xA8, - /* A8F */ 0x88, - /* A90 */ 0x21, - /* A91 */ 0x21, - /* A92 */ 0x5F, - /* A93 */ 0x5F, +u8 g_eRedDoorUV[][8] = { + {0xB1, 0xB7, 0xB1, 0xB7, 0x21, 0x21, 0x5F, 0x5F}, + {0x88, 0xA8, 0x88, 0xA8, 0x21, 0x21, 0x5F, 0x5F}, + {0xA8, 0x88, 0xA8, 0x88, 0x21, 0x21, 0x5F, 0x5F}, }; s16 D_80180A94[] = { @@ -1060,7 +1037,7 @@ extern u16 g_ItemIconSlots[]; void func_80186FD0(Entity* arg0) { ObjInit2* objInit = &D_801804E0[arg0->params]; if (arg0->step == 0) { - InitializeEntity(D_80180494); + InitializeEntity(g_eInitGeneric2); arg0->animSet = objInit->animSet; arg0->zPriority = objInit->zPriority; arg0->unk5A = objInit->unk4.s; diff --git a/src/st/wrp/861C.c b/src/st/wrp/861C.c index 1742f2356..db1c56c37 100644 --- a/src/st/wrp/861C.c +++ b/src/st/wrp/861C.c @@ -17,7 +17,7 @@ INCLUDE_ASM("st/wrp/nonmatchings/861C", TestCollisions); #include "../libstage.h" -INCLUDE_ASM("st/wrp/nonmatchings/861C", EntityRedDoor); +#include "../entity_red_door.h" #include "../../destroy_entity.h" diff --git a/src/st/wrp/F420.c b/src/st/wrp/F420.c index 8277bbc26..a050386d9 100644 --- a/src/st/wrp/F420.c +++ b/src/st/wrp/F420.c @@ -797,11 +797,10 @@ ObjInit2 D_80181134[] = { {0x000C, 0x01EC, 0x0000, 0x0000, 0x00, 0x00, 0x10, 0x00, 0, D_80181130}, {0x000C, 0x0080, 0x0000, 0x0000, 0x00, 0x00, 0x10, 0x00, 0, D_8018112C}, }; -extern u16 D_80180494[]; void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80181134[entity->params]; if (entity->step == 0) { - InitializeEntity(D_80180494); + InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; entity->unk5A = objInit->unk4.s; diff --git a/src/st/wrp/wrp.h b/src/st/wrp/wrp.h index eff762232..0d9aa99c9 100644 --- a/src/st/wrp/wrp.h +++ b/src/st/wrp/wrp.h @@ -43,10 +43,13 @@ extern s32 D_8003C8B8; extern u16 g_InitializeData0[]; extern u16 D_80180458[]; extern u16 g_EInitGeneric[]; +extern u16 g_eInitGeneric2[]; extern u16 D_801804C4[]; +extern u16 g_eRedDoorTiles[2][8]; extern u32 D_80180608[]; extern u32 D_80180648; extern WarpCoord D_8018065C[]; +extern u8 g_eRedDoorUV[3][8]; extern u16 D_80180FE8[]; extern u32 D_80181044[]; extern u16 D_801810A0[]; // sestren: soul steal random angle offsets?