MAR duplicates (#1618)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped

Matches 72% of the entire overlay in one go. Around 80% of the overlay
code is made of duplicate function.

A few observations:
* `func_us_8018AC0C` seems to be an older, buggy version of
`func_801B246C` and it seem to indicate `ObjInit2` was either a `u16`
array or there were macros involved.
* `e_breakable` is the same function, but the data changes in most
overlays; I had to pull the data out. The SFX ID is also different.

Data handled through the asset manager and BSS will come as part of a
separate PR.
This commit is contained in:
Luciano Ciccariello 2024-09-16 18:19:29 +01:00 committed by GitHub
parent 43a9009fc6
commit d91155004a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 324 additions and 354 deletions

View File

@ -23,8 +23,8 @@ options:
- .data
- .rodata
- .text
- .bss
- .sbss
- .bss
ld_bss_is_noload: false
disasm_unknown: true
include_macro_inc: False
@ -38,21 +38,21 @@ segments:
subalign: 4
subsegments:
- [0x0, data]
- [0x30C, data] # e_init
- [0x4E8, data] # st_common
- [0x568, data] # e_breakable
- [0x310, .data, e_init]
- [0x4E8, .data, st_debug]
- [0x568, .data, e_breakable]
- [0x5D4, data] # AFC4
- [0x764, data] # st_update
- [0x790, data] # collision
- [0xB50, data] # e_red_door
- [0xB68, data] # st_common??
- [0xD68, data] # e_collect
- [0x1058, data] # e_misc
- [0x764, .data, st_update]
- [0x790, .data, collision]
- [0xB50, .data, e_red_door]
- [0xB68, .data, st_common]
- [0xD68, .data, e_collect]
- [0x1058, .data, e_misc]
- [0x1174, .data, e_particles]
- [0x11F4, .data, e_room_fg]
- [0x1280, data] # 17FEC
- [0x12EC, data] # rooms
- [0x1308, data] # e_life_up
- [0x1308, .data, e_life_up]
- [0x135C, data] # e_layout
- [0x1424, data]
- [0xA9EC, .rodata, AFC4]
@ -74,7 +74,7 @@ segments:
- [0x11838, c, e_collect]
- [0x12DA4, c, blit_char]
- [0x13054, c, e_misc]
- [0x16708, c, e_stage_name]
- [0x16538, c, e_stage_name]
- [0x1738C, c, e_particles]
- [0x17BD0, c, e_room_fg]
- [0x17CBC, c, popup]
@ -82,4 +82,5 @@ segments:
- [0x1911C, c, prim_helpers]
- [0x1994C, c, e_life_up]
- [0x1A200, sbss]
- [0x1AF30, .bss, e_collect]
- [0x1AF70]

View File

@ -59,7 +59,7 @@ segments:
- [0x2610, data] # bloody skeleton
- [0x26B8, data] # magically sealed door
- [0x272C, .data, rooms]
- [0x2830, data, D_80182830]
- [0x2830, .data, e_life_up]
- [0x2884, .data, e_layout] # layout entries data
- [0x3B0C, data]
- [0x16A5C, .data, tile_data] # tile data
@ -91,7 +91,7 @@ segments:
- [0x308E8, .rodata, e_magically_sealed_door]
- [0x30900, .rodata, e_stage_name]
- [0x30934, .rodata, prim_helpers]
- [0x3093C, .rodata, lifeupspawn]
- [0x3093C, .rodata, e_life_up]
- [0x30958, c]
- [0x30EEC, c, e_breakable]
- [0x311C0, c]
@ -126,7 +126,7 @@ segments:
- [0x47CF0, c, e_magically_sealed_door]
- [0x48ADC, c, e_stage_name]
- [0x49930, c, prim_helpers]
- [0x4A160, c, lifeupspawn]
- [0x4A160, c, e_life_up]
- [0x4AA14, .bss, create_entity]
- [0x4AA24, .bss, bss]
- [0x4B740, .bss, e_collect]

View File

@ -1,100 +1,21 @@
g_InitializeData0 = 0x8018039C;
g_eInitGeneric2 = 0x801803E4;
g_pStObjLayoutHorizontal = 0x80180168;
g_pStObjLayoutVertical = 0x8018023C;
D_80180A60 = 0x801803B4;
D_80180608 = 0x80180744;
g_StoneDoorTiles = 0x801812DC;
EntityUnkId12 = 0x8018ACD4;
EntityBreakable = 0x8018AE90;
EntityMariaCutscene = 0x8018B850;
Random = 0x8018CF70;
Update = 0x8018CFA0;
UpdateStageEntities = 0x8018D29C;
HitDetection = 0x8018D3A4;
EntityDamageDisplay = 0x8018E4BC;
CreateEntityFromLayout = 0x8018EB60;
CreateEntityWhenInHorizontalRange = 0x8018EC24;
FindFirstEntityAbove = 0x8018EE54;
FindFirstEntityBelow = 0x8018EEA0;
CreateEntitiesAbove = 0x8018EEF8;
CreateEntitiesBelow = 0x8018EFF4;
InitRoomEntities = 0x8018F3BC;
UpdateRoomPosition = 0x8018F534;
CreateEntityFromCurrentEntity = 0x8018F5E8;
CreateEntityFromEntity = 0x8018F65C;
EntityIsNearPlayer2 = 0x8018F6D8;
EntityRedDoor = 0x8018F750;
DestroyEntity = 0x80190388;
DestroyEntitiesFromIndex = 0x801903F4;
PreventEntityFromRespawning = 0x80190470;
AnimateEntity = 0x801904B8;
UnkAnimFunc = 0x80190570;
GetDistanceToPlayerX = 0x80190688;
GetDistanceToPlayerY = 0x801906C4;
GetSideToPlayer = 0x801906F8;
MoveEntity = 0x8019073C;
FallEntity = 0x8019076C;
UnkCollisionFunc3 = 0x80190798;
UnkCollisionFunc2 = 0x80190A10;
AllocEntity = 0x80190BF8;
GetSineScaled = 0x80190C58;
GetSine = 0x80190C84;
SetEntityVelocityFromAngle = 0x80190CA0;
Ratan2Shifted = 0x80190D0C;
GetAngleBetweenEntitiesShifted = 0x80190D44;
GetAnglePointToEntity = 0x80190D8C;
AdjustValueWithinThreshold = 0x80190DD4;
UnkEntityFunc0 = 0x80190E2C;
Ratan2 = 0x80190EB8;
GetAngleBetweenEntities = 0x80190EE8;
GetNormalizedAngle = 0x80190F68;
SetStep = 0x80190FC8;
SetSubStep = 0x80190FE8;
EntityExplosionSpawn = 0x80191004;
InitializeEntity = 0x80191098;
EntityDummy = 0x80191194;
UnkCollisionFunc = 0x801911BC;
CheckFieldCollision = 0x801912E4;
GetPlayerCollisionWith = 0x8019143C;
ReplaceBreakableWithItemDrop = 0x80191780;
CollectHeart = 0x80191A18;
CollectGold = 0x80191A98;
CollectHeartVessel = 0x80191C8C;
EntityPrizeDrop = 0x80191DA8;
EntityExplosion = 0x8019261C;
BlinkItem = 0x80192718;
EntityEquipItemDrop = 0x801927BC;
BlitChar = 0x80192DA4;
EntityRelicOrb = 0x80193054;
EntityHeartDrop = 0x80193B24;
EntityMessageBox = 0x80193C40;
CheckColliderOffsets = 0x8019419C;
EntityUnkId13 = 0x8019428C;
EntityUnkId14Spawner = 0x8019439C;
EntityUnkId15Spawner = 0x801944CC;
EntityUnkId14 = 0x801945B4;
EntityUnkId15 = 0x801946A4;
EntityOlroxDrool = 0x80194798;
UnkCollisionFunc5 = 0x801949C8;
UnkCollisionFunc4 = 0x80194AC4;
EntityIntenseExplosion = 0x80195044;
InitializeUnkEntity = 0x80195144;
MakeEntityFromId = 0x80195210;
MakeExplosions = 0x801952D8;
EntityBigRedFireball = 0x80195390;
UnkRecursivePrimFunc1 = 0x80195568;
UnkRecursivePrimFunc2 = 0x80195B48;
ClutLerp = 0x80196248;
PlaySfxPositional = 0x80196440;
EntityStageNamePopup = 0x80196708;
EntitySoulStealOrb = 0x8019738C;
EntityEnemyBlood = 0x80197720;
EntityRoomForeground = 0x80197BD0;
BottomCornerText = 0x80197CBC;
EntityClockRoomController = 0x80197FEC;
EntityClockHands = 0x80198574;
EntityBirdcageDoor = 0x80198688;
EntityStatue = 0x80198944;
EntityStatueGear = 0x80198C74;
EntityStoneDoor = 0x80198F24;
UnkPolyFunc2 = 0x80199868;
PrimDecreaseBrightness = 0x801998E8;
EntityLifeUpSpawn = 0x8019994C;
g_LayoutObjHorizontal = 0x8019A260;
g_LayoutObjVertical = 0x8019A264;
g_LayoutObjPosHorizontal = 0x8019A268;
g_LayoutObjPosVertical = 0x8019A26C;
g_Statues = 0x8019AF28;

View File

@ -71,6 +71,19 @@ def apply_psx_stage(config, version, name):
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_boss(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"BOSS/{name}/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/bo{name}.map"
config["source_directories"] = [
f"src/boss/{name}",
f"src/boss/{name}_psp",
"include",
f"asm/{version}/boss/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_saturn(config, name):
config["arch"] = "sh2"
config["baseimg"] = f"disks/saturn" + (f"/{name}.PRG").upper()
@ -88,6 +101,12 @@ def apply(config, args):
name = args.overlay or "dra"
if name.startswith("st/"):
apply_psx_stage(config, version, name[3:])
elif name.startswith("st"):
apply_psx_stage(config, version, name[2:])
elif name.startswith("bo/"):
apply_psx_boss(config, version, name[3:])
elif name.startswith("bo"):
apply_psx_boss(config, version, name[2:])
elif name.startswith("tt_"):
apply_psx_servant(config, version, name)
elif name.startswith("w_"):

View File

@ -1,4 +1,2 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/blit_char", BlitChar);
#include "../../st/blit_char.h"

View File

@ -1,6 +1,2 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/collision", HitDetection);
INCLUDE_ASM("boss/mar/nonmatchings/collision", EntityDamageDisplay);
#include "../../st/collision.h"

View File

@ -1,33 +1,19 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
// clang-format off
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntityFromLayout);
// TODO: import BSS and use create_entity.h
extern u16* g_LayoutObjHorizontal;
extern u16* g_LayoutObjVertical;
extern u8 g_LayoutObjPosHorizontal;
extern u8 g_LayoutObjPosVertical;
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntityWhenInHorizontalRange);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", func_us_8018ED3C);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", FindFirstEntityAbove);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", FindFirstEntityBelow);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntitiesAbove);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntitiesBelow);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", func_us_8018F108);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", func_us_8018F154);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", func_us_8018F1AC);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", func_us_8018F2A8);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", InitRoomEntities);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", UpdateRoomPosition);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntityFromCurrentEntity);
INCLUDE_ASM("boss/mar/nonmatchings/create_entity", CreateEntityFromEntity);
#include "../../st/st_private.h"
#include "../../st/create_entity_from_layout.h"
#include "../../st/create_entity_in_range.h"
#include "../../st/find_entity_horizontal.h"
#include "../../st/create_entities_horizontal.h"
#include "../../st/find_entity_vertical.h"
#include "../../st/create_entities_vertical.h"
#include "../../st/init_room_entities.h"
#include "../../st/update_room_position.h"
#include "../../st/create_entity_from_entity.h"

View File

@ -1,4 +1,35 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
#include "mar.h"
INCLUDE_ASM("boss/mar/nonmatchings/e_breakable", EntityBreakable);
static u8 anim_1[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 anim_2[] = {4, 0, 4, 0, 0, 0, 0, 0};
static u8 anim_3[] = {4, 12, 4, 13, 4, 14, 4, 15, 4, 16, 0, 0};
static u8* g_eBreakableAnimations[] = {
anim_1, anim_2, anim_3, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {8, 8, 8, 0, 0, 0, 0, 0};
#ifndef VERSION_PSP // on PSP this is in the BSS section, not data
static u8 g_eBreakableExplosionTypes[] = {0, 0, 0, 0, 0, 0, 0, 0};
#else
extern u8 g_eBreakableExplosionTypes[];
#endif
static u16 g_eBreakableanimSets[] = {
ANIMSET_DRA(3), ANIMSET_DRA(3), ANIMSET_OVL(1), 0, 0, 0, 0, 0};
static u8 g_eBreakableDrawModes[] = {
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT};
#ifndef VERSION_PSP
// on PSP this might be either optimised out to BSS or completely removed
static u8 unused[] = {0, 0, 0, 0, 0, 0, 0, 0};
#endif
#define SFX_BREAKABLE_HIT 0x67E
#include "../../st/e_breakable.h"

View File

@ -1,46 +1,2 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", func_us_80191838);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", func_us_801918BC);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", CollectHeart);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", CollectGold);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", func_us_80191B74);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", CollectHeartVessel);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", func_us_80191D30);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", func_us_80191D80);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAC8);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAD0);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAD8);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAE0);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAE8);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAF0);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AAF8);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AB00);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AB08);
INCLUDE_RODATA("boss/mar/nonmatchings/e_collect", D_us_8018AB10);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", EntityPrizeDrop);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", EntityExplosion);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", BlinkItem);
INCLUDE_ASM("boss/mar/nonmatchings/e_collect", EntityEquipItemDrop);
#include "../../st/e_collect.h"

92
src/boss/mar/e_init.c Normal file
View File

@ -0,0 +1,92 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
void EntityBreakable(Entity* self);
void EntityExplosion(Entity* self);
void EntityPrizeDrop(Entity* self);
void EntityDamageDisplay(Entity* self);
void EntityRedDoor(Entity* self);
void EntityIntenseExplosion(Entity* self);
void EntitySoulStealOrb(Entity* self);
void EntityRoomForeground(Entity* self);
void EntityStageNamePopup(Entity* self);
void EntityEquipItemDrop(Entity* self);
void EntityRelicOrb(Entity* self);
void EntityHeartDrop(Entity* self);
void EntityEnemyBlood(Entity* self);
void EntityMessageBox(Entity* self);
void EntityDummy(Entity* self);
void EntityDummy(Entity* self);
void func_us_8018AC0C(Entity* self);
void EntityUnkId12(Entity* self);
void EntityUnkId13(Entity* self);
void EntityUnkId14(Entity* self);
void EntityUnkId15(Entity* self);
void EntityClockRoomController(Entity* self);
void EntityClockHands(Entity* self);
void EntityBirdcageDoor(Entity* self);
void EntityStatue(Entity* self);
void EntityStatueGear(Entity* self);
void EntityStoneDoor(Entity* self);
void func_us_80199114(Entity* self);
void EntityDummy(Entity* self);
void EntityMariaCutscene(Entity* self);
void func_us_8018C90C(Entity* self);
void func_us_8018CA94(Entity* self);
PfnEntityUpdate PfnEntityUpdates[] = {
EntityBreakable, EntityExplosion,
EntityPrizeDrop, EntityDamageDisplay,
EntityRedDoor, EntityIntenseExplosion,
EntitySoulStealOrb, EntityRoomForeground,
EntityStageNamePopup, EntityEquipItemDrop,
EntityRelicOrb, EntityHeartDrop,
EntityEnemyBlood, EntityMessageBox,
EntityDummy, EntityDummy,
func_us_8018AC0C, EntityUnkId12,
EntityUnkId13, EntityUnkId14,
EntityUnkId15, EntityClockRoomController,
EntityClockHands, EntityBirdcageDoor,
EntityStatue, EntityStatueGear,
EntityStoneDoor, func_us_80199114,
EntityDummy, EntityMariaCutscene,
func_us_8018C90C, func_us_8018CA94,
};
u16 g_eBreakableInit[] = {0x0003, 0x0000, 0x0000, 0x0000, 0x0000};
u16 g_InitializeData0[] = {0x0003, 0x0000, 0x0000, 0x0000, 0x0001};
u16 g_InitializeEntityData0[] = {0x0003, 0x0000, 0x0000, 0x0000, 0x0002};
u16 D_80180A60[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0004};
u16 g_EInitGeneric[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0005};
u16 g_InitDataEnt13[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0002};
u16 g_EntityUnkId12Init[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0001};
u16 g_eInitGeneric2[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0003};
u16 g_eDamageDisplayInit[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0003};
static u16 unused[][6] = {
{0x0000, 0x0000, 0x0000, 0x0000, 0x0133, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0134, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0135, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0136, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0137, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0138, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0139, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013A, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013B, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013C, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013D, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013E, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x013F, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0140, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0141, 0x0000},
};
static u8 D_us_801804B0[] = {0x40, 0x2F, 0xFF, 0x00};
ObjInit2 D_80180C10[] = {
{0x8001, 0x007F, 0, 0, 0x0000, 0x00, 0x30, 0x00000000, D_us_801804B0},
};
u16 g_eRedDoorTiles[][8] = {
{0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000},
{0x04FA, 0x04FA, 0x04FA, 0x04FA, 0x0000, 0x0000, 0x0000, 0x0000},
};

View File

@ -1,4 +1,3 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/e_life_up", EntityLifeUpSpawn);
#include "mar.h"
#include "../../st/e_life_up.h"

View File

@ -1,48 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
#include "mar.h"
INCLUDE_RODATA("boss/mar/nonmatchings/e_misc", D_us_8018AB50);
#ifndef CASTLE_FLAG_BANK
#define CASTLE_FLAG_BANK -0x118
#endif
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityRelicOrb);
void EntityUnkId13(Entity* self);
void EntityUnkId14(Entity* self);
void EntityUnkId15(Entity* self);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityHeartDrop);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityMessageBox);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", CheckColliderOffsets);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityUnkId13);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityUnkId14Spawner);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityUnkId15Spawner);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityUnkId14);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityUnkId15);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityOlroxDrool);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", UnkCollisionFunc5);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", UnkCollisionFunc4);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityIntenseExplosion);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", InitializeUnkEntity);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", MakeEntityFromId);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", MakeExplosions);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", EntityBigRedFireball);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", UnkRecursivePrimFunc1);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", UnkRecursivePrimFunc2);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", ClutLerp);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", PlaySfxPositional);
INCLUDE_ASM("boss/mar/nonmatchings/e_misc", func_us_80196538);
#include "../../st/e_misc.h"

View File

@ -1,6 +1,2 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/e_red_door", EntityIsNearPlayer2);
INCLUDE_ASM("boss/mar/nonmatchings/e_red_door", EntityRedDoor);
#include "../../st/e_red_door.h"

View File

@ -1,4 +1,4 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/e_stage_name", EntityStageNamePopup);
#include "../../st/e_stage_name.h"

View File

@ -2,7 +2,8 @@
#ifndef MAR_H
#define MAR_H
extern u16 g_Statues[];
#include <stage.h>
typedef enum {
/* 0x00 */ E_NONE,
/* 0x01 */ E_BREAKABLE,
@ -22,7 +23,9 @@ typedef enum {
/* 0x0F */ E_DUMMY_0F,
/* 0x10 */ E_DUMMY_10,
/* 0x16 */ E_CLOCKROOM_CONTROLLER = 0x16,
/* 0x14 */ E_ID_14 = 0x14,
/* 0x15 */ E_ID_15,
/* 0x16 */ E_CLOCKROOM_CONTROLLER,
/* 0x17 */ E_CLOCK_HANDS,
/* 0x18 */ E_BIRDCAGE_DOOR,
/* 0x19 */ E_STATUE,
@ -39,5 +42,6 @@ typedef enum Statues {
extern u16 g_eInitGeneric2[];
extern s32 D_800973FC;
extern u16 g_Statues[];
#endif

View File

@ -1,70 +1,3 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/st_common", DestroyEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", DestroyEntitiesFromIndex);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", PreventEntityFromRespawning);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", AnimateEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", UnkAnimFunc);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetDistanceToPlayerX);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetDistanceToPlayerY);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetSideToPlayer);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", MoveEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", FallEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", UnkCollisionFunc3);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", UnkCollisionFunc2);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", AllocEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetSineScaled);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetSine);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", SetEntityVelocityFromAngle);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", Ratan2Shifted);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetAngleBetweenEntitiesShifted);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetAnglePointToEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", AdjustValueWithinThreshold);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", UnkEntityFunc0);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", Ratan2);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetAngleBetweenEntities);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", func_us_80190F20);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetNormalizedAngle);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", SetStep);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", SetSubStep);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", EntityExplosionSpawn);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", InitializeEntity);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", EntityDummy);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", UnkCollisionFunc);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", CheckFieldCollision);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", GetPlayerCollisionWith);
INCLUDE_ASM("boss/mar/nonmatchings/st_common", ReplaceBreakableWithItemDrop);
#include "mar.h"
#include "../../st/st_common.h"

View File

@ -1,6 +1,38 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/st_debug", func_us_8018AC0C);
extern ObjInit2 D_80180C10[];
extern u16 g_eInitGeneric2[];
void func_us_8018AC0C(Entity* self) {
ObjInit2* objInit = &D_80180C10[self->params];
INCLUDE_ASM("boss/mar/nonmatchings/st_debug", EntityUnkId12);
if (self->step == 0) {
InitializeEntity(g_eInitGeneric2);
self->animSet = objInit->animSet;
self->zPriority = objInit->zPriority;
self->unk5A = LOH(objInit->facingLeft); // bug?
self->palette = objInit->palette;
self->drawFlags = objInit->drawFlags;
self->drawMode = objInit->drawMode;
if (objInit->unkC != 0) {
self->flags = objInit->unkC;
}
}
AnimateEntity(objInit->unk10, self);
}
static u8 g_EntityUnkId12Hitbox[] = {
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x20};
static u8 g_EntityUnkId12Data[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static u16 g_EntityUnkId12TilemapProps[] = {
0x0000, 0x0000, 0x0600, 0x0100, 0x0000, 0x0000, 0x0600, 0x01FC,
0x0000, 0x00FC, 0x0600, 0x01FC, 0x0000, 0x0000, 0x0600, 0x01FC,
0x0000, 0x00FC, 0x0600, 0x0300, 0x0000, 0x00FC, 0x0600, 0x01FC,
0x0000, 0x00FC, 0x0600, 0x0300, 0x0000, 0x0200, 0x0600, 0x0300,
0x0000, 0x01FC, 0x0500, 0x02FC, 0x0000, 0x0000, 0x0500, 0x0400,
0x0000, 0x0000, 0x0500, 0x0400, 0x0000, 0x01FC, 0x0500, 0x02FC,
0x00F0, 0x01FC, 0x0310, 0x02FC, 0x00F0, 0x01FC, 0x0310, 0x02FC,
};
#include "../../st/entity_unk_id12.h"

View File

@ -1,8 +1,2 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <stage.h>
INCLUDE_ASM("boss/mar/nonmatchings/st_update", Random);
INCLUDE_ASM("boss/mar/nonmatchings/st_update", Update);
INCLUDE_ASM("boss/mar/nonmatchings/st_update", UpdateStageEntities);
#include "../../st/st_update.h"

View File

@ -2,33 +2,8 @@
#include <stage.h>
#include <sfx.h>
static u8 D_801805A8[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 D_801805B0[] = {4, 0, 4, 0, 0, 0, 0, 0};
static u8* g_eBreakableAnimations[] = {
D_801805A8, D_801805B0, NULL, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {8, 8, 0, 0, 0, 0, 0, 0};
#ifndef VERSION_PSP // on PSP this is in the BSS section, not data
static u8 g_eBreakableExplosionTypes[] = {0, 0, 0, 0, 0, 0, 0, 0};
#else
extern u8 g_eBreakableExplosionTypes[];
#endif
static u16 g_eBreakableanimSets[] = {
ANIMSET_DRA(3), ANIMSET_DRA(3), 0, 0, 0, 0, 0, 0};
static u8 g_eBreakableDrawModes[] = {
DRAW_TPAGE | DRAW_TPAGE2 | DRAW_UNK_40,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT};
#ifndef VERSION_PSP
// on PSP this might be either optimised out to BSS or completely removed
static u8 unused[] = {0, 0, 0, 0, 0, 0, 0, 0};
#ifndef SFX_BREAKABLE_HIT
#define SFX_BREAKABLE_HIT SFX_CANDLE_HIT
#endif
extern u16 g_eBreakableInit[];
@ -43,7 +18,7 @@ void EntityBreakable(Entity* entity) {
AnimateEntity(g_eBreakableAnimations[breakableType], entity);
if (entity->hitParams) { // If the candle is destroyed
Entity* entityDropItem;
g_api.PlaySfx(SFX_CANDLE_HIT);
g_api.PlaySfx(SFX_BREAKABLE_HIT);
entityDropItem = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entityDropItem != NULL) {
CreateEntityFromCurrentEntity(E_EXPLOSION, entityDropItem);

View File

@ -1,7 +1,14 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "nz0.h"
SVECTOR D_80182830 = {-8, -8, 0};
SVECTOR D_80182838 = {8, -8, 0};
SVECTOR D_80182840 = {-8, 8, 0};
SVECTOR D_80182848 = {8, 8, 0};
u16 D_80182850[] = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D};
SVECTOR D_8018287C = {0, 0, 0};
// particle effect that spawns life up item
extern u16 g_EInitGeneric[];
void EntityLifeUpSpawn(Entity* self) {
s32 count_low_x1;
Collider collider;

View File

@ -134,7 +134,6 @@ u8 g_UnkEntityAnimData[] = {
#include "make_explosions.h"
extern u8 g_bigRedFireballAnim[];
u16 g_UnkRecursPrimVecOrder[] = {
0, 1, 3, 4, 1, 2, 4, 5, 3, 4, 6, 7, 4, 5, 7, 8};
#include "entity_big_red_fireball.h"

View File

@ -1,4 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
extern u16 g_InitializeEntityData0[];
void EntityIntenseExplosion(Entity* self) {
if (!self->step) {
InitializeEntity(g_InitializeEntityData0);

View File

@ -2,6 +2,7 @@
// params: message box duration
// ext.messageBox.label: box size and text to render
extern u16 g_InitializeData0[];
void EntityMessageBox(Entity* self) {
const u16 VramX = 0;
const u16 VramY = 0x180;

View File

@ -5,6 +5,7 @@
extern u32 g_olroxDroolCollOffsets[];
extern u16 g_InitializeEntityData0[];
void EntityOlroxDrool(Entity* self) {
s16 primIndex;
Primitive* prim;

View File

@ -15,6 +15,7 @@ u16 g_RelicOrbTextBg2EY[] = {32, 26, 20, 13, 7, 1, -5, -12};
u16 g_RelicOrbSparkleX[] = {-8, 4, -2, 8, 0, 4, -4, 2};
u16 g_RelicOrbSparkleY[] = {-2, 2, 4, -3, 0, 2, -4, 3};
extern u16 g_InitializeData0[];
extern u16 D_801997E8[0x600];
void BlinkItem(Entity* entity, u16 blinkFlag);

View File

@ -1,4 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
extern u16 g_EntityUnkId12Init[];
void EntityUnkId12(Entity* entity) {
u16 var_s0;
u16 params;

View File

@ -1,4 +1,33 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "np3.h"
static u8 anim_1[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 anim_2[] = {4, 0, 4, 0, 0, 0, 0, 0};
static u8* g_eBreakableAnimations[] = {
anim_1, anim_2, NULL, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {8, 8, 0, 0, 0, 0, 0, 0};
#ifndef VERSION_PSP // on PSP this is in the BSS section, not data
static u8 g_eBreakableExplosionTypes[] = {0, 0, 0, 0, 0, 0, 0, 0};
#else
extern u8 g_eBreakableExplosionTypes[];
#endif
static u16 g_eBreakableanimSets[] = {
ANIMSET_DRA(3), ANIMSET_DRA(3), 0, 0, 0, 0, 0, 0};
static u8 g_eBreakableDrawModes[] = {
DRAW_TPAGE | DRAW_TPAGE2 | DRAW_UNK_40,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT};
#ifndef VERSION_PSP
// on PSP this might be either optimised out to BSS or completely removed
static u8 unused[] = {0, 0, 0, 0, 0, 0, 0, 0};
#endif
#include "../e_breakable.h"

View File

@ -1,11 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "nz0.h"
static u8 D_80180DE4[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 D_80180DEC[] = {4, 4, 4, 5, 4, 6, 4, 5, 0, 0, 0, 0};
static u8 D_80180DF8[] = {4, 14, 4, 15, 4, 16, 4, 17, 0, 0, 0, 0};
static u8 anim_1[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 anim_2[] = {4, 4, 4, 5, 4, 6, 4, 5, 0, 0, 0, 0};
static u8 anim_3[] = {4, 14, 4, 15, 4, 16, 4, 17, 0, 0, 0, 0};
static u8* g_eBreakableAnimations[] = {
D_80180DE4, D_80180DEC, D_80180DF8, NULL, NULL, NULL, NULL, NULL};
anim_1, anim_2, anim_3, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {8, 8, 8, 0, 0, 0, 0, 0};
static u8 g_eBreakableExplosionTypes[] = {0, 0, 0, 0, 0, 0, 0, 0};
static u16 g_eBreakableanimSets[] = {

3
src/st/nz0/e_life_up.c Normal file
View File

@ -0,0 +1,3 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "nz0.h"
#include "../../st/e_life_up.h"

View File

@ -1,4 +1,33 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "wrp.h"
static u8 anim_1[] = {4, 1, 4, 2, 0, 0, 0, 0};
static u8 anim_2[] = {4, 0, 4, 0, 0, 0, 0, 0};
static u8* g_eBreakableAnimations[] = {
anim_1, anim_2, NULL, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {8, 8, 0, 0, 0, 0, 0, 0};
#ifndef VERSION_PSP // on PSP this is in the BSS section, not data
static u8 g_eBreakableExplosionTypes[] = {0, 0, 0, 0, 0, 0, 0, 0};
#else
extern u8 g_eBreakableExplosionTypes[];
#endif
static u16 g_eBreakableanimSets[] = {
ANIMSET_DRA(3), ANIMSET_DRA(3), 0, 0, 0, 0, 0, 0};
static u8 g_eBreakableDrawModes[] = {
DRAW_TPAGE | DRAW_TPAGE2 | DRAW_UNK_40,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT};
#ifndef VERSION_PSP
// on PSP this might be either optimised out to BSS or completely removed
static u8 unused[] = {0, 0, 0, 0, 0, 0, 0, 0};
#endif
#include "../e_breakable.h"