Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ set(SOURCE_FILES_STAGE_CEN
src/st/cen/e_room_bg.c
src/st/cen/e_lock_camera.c
src/st/cen/e_breakable.c
src/st/cen/DB18.c
src/st/cen/d_prize_drops.c
src/st/cen/cutscene.c
src/st/cen/F890.c
Expand Down
1 change: 0 additions & 1 deletion config/splat.hd.stcen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ segments:
- [0xD5E8, c, e_room_bg]
- [0xD6C8, c, e_lock_camera]
- [0xD884, c, e_breakable]
- [0xDB00, c, DB18]
- [0xDEF4, c, cutscene]
- [0xF818, c, F890]
- [0x10DA0, c, st_update]
Expand Down
2 changes: 1 addition & 1 deletion config/splat.pspeu.stchi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ segments:
- [0x19770, .data, chi/en_thornweed_corpseweed]
- [0x19840, data]
- [0x1D3F8, .data, chi/e_red_door_tiles]
- [0x1D428, .data, chi_psp/dt_entity]
- [0x1D428, .data, chi/dt_entity]
- [0x1D630, data]
- [0x1D6D0, .data, chi/en_breakable]
- [0x1D758, .data, chi/en_stage_name]
Expand Down
1 change: 0 additions & 1 deletion config/splat.us.stcen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ segments:
- [0xD600, c, e_room_bg]
- [0xD6E0, c, e_lock_camera]
- [0xD89C, c, e_breakable]
- [0xDB18, c]
- [0xDF0C, c, cutscene]
- [0xF890, c]
- [0x10E4C, c, st_update]
Expand Down
6 changes: 0 additions & 6 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2095,11 +2095,6 @@ typedef struct {
/* 0x80 */ s16 timer;
} ET_BloodSkeleton;

typedef struct {
/* 0x7C */ s32 : 32;
/* 0x80 */ s16 angle;
} ET_UnusedCENEnt;

typedef struct {
// not a physical angular direction, but the swaying left and right
// moves in a sinusoidal manner so uses an angle internally.
Expand Down Expand Up @@ -3720,7 +3715,6 @@ typedef union { // offset=0x7C
ET_CEN_Elevator cenElevator;
ET_TOP_Elevator topElevator;
ET_BloodSkeleton bloodSkeleton;
ET_UnusedCENEnt unusedCENEnt;
ET_SmallRisingHeart smallRisingHeart;
ET_EntranceUnk16 entrance16;

Expand Down
116 changes: 0 additions & 116 deletions src/st/cen/DB18.c

This file was deleted.

7 changes: 6 additions & 1 deletion src/st/cen/cen.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

#define OVL_EXPORT(x) CEN_##x

enum OVL_EXPORT(Palette) {
PAL_NONE = 0,
PAL_BREAKABLE_DEBRIS = 0x159,
};

Comment on lines +12 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't all OVL_DRA palettes (anything without the top bit set) be shared? This could be moved to include since I think it's universal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not all non-8XXX palettes will be shared, only at most 0x100-0x1FF. That being said, there hasn't been a word either way. I'm not against adjusting this however is best, the enum is just the last word I've gotten..

typedef enum EntityIDs {
/* 0x00 */ E_NONE,
/* 0x01 */ E_ID_01,
Expand Down Expand Up @@ -39,7 +44,7 @@ typedef enum EntityIDs {
/* 0x1A */ E_ELEVATOR_STATIONARY_UNUSED,
/* 0x1B */ E_ELEVATOR_STATIONARY,
/* 0x1C */ E_MOVING_ELEVATOR,
/* 0x80 */ E_BREAKABLE_UNK0 = 0x80,
/* 0x80 */ E_BREAKABLE_DEBRIS = 0x80,
} EntityIDs;

void CreateEntityFromCurrentEntity(u16 entityId, Entity* entity);
Expand Down
98 changes: 4 additions & 94 deletions src/st/cen/e_breakable.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,8 @@
#include "game.h"
#include "sfx.h"

static u8 anim_1[] = {3, 14, 4, 15, 4, 16, 4, 17, 4, 18, 4, 19, 3, 20};
static u8 anim_2[] = {3, 21, 4, 22, 4, 23, 4, 24, 4, 25, 4, 26, 3, 27};
#define BREAKABLE_ZPRIORITY 176
#define NO_HITBOX_STATE

static u8* g_eBreakableAnimations[] = {
anim_1, anim_2, NULL, NULL, NULL, NULL, NULL, NULL};
static u8 g_eBreakableHitboxes[] = {12, 20, 0, 0, 0, 0, 0, 0};

static u8 g_eBreakableExplosionTypes[] = {3, 3, 0, 0, 0, 0, 0, 0};

static u16 g_eBreakableanimSets[] = {
ANIMSET_OVL(1), ANIMSET_OVL(1), 0, 0, 0, 0, 0, 0,
};

static u8 g_eBreakableDrawModes[] = {
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_TPAGE | DRAW_TPAGE2,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
};

static s16 xyOffsets[] = {
-4, -4, 3, -6, 2, 9, -4, 12, 0, 2, 0, 15, 0, 31,
};

void EntityBreakable(Entity* self) {
Entity* newEntity;
u16* ptr;
s32 j;
s32 i;
u16 breakableType = self->params >> 0xC;

if (self->step == 0) {
InitializeEntity(OVL_EXPORT(EInitBreakable));
self->zPriority = 0xB0;
self->drawMode = g_eBreakableDrawModes[breakableType];
newEntity = &self[1];
self->hitboxHeight = g_eBreakableHitboxes[breakableType];
self->animSet = g_eBreakableanimSets[breakableType];
DestroyEntity(newEntity);
CreateEntityFromEntity(E_BACKGROUND_BLOCK, self, newEntity);
if (breakableType != 0) {
self[1].posY.i.hi -= 32;
} else {
self[1].posY.i.hi -= 16;
}
newEntity->params = 1;
}

AnimateEntity(g_eBreakableAnimations[breakableType], self);

if (self->hitParams) {
g_api.PlaySfx(SFX_CANDLE_HIT);
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != 0) {
CreateEntityFromCurrentEntity(E_EXPLOSION, newEntity);
newEntity->params =
g_eBreakableExplosionTypes[breakableType] | 0x10;
}

for (ptr = &xyOffsets, i = 0; i < 4; i++) {
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != 0) {
CreateEntityFromEntity(E_BREAKABLE_UNK0, self, newEntity);
newEntity->posX.i.hi += *ptr;
ptr++;
newEntity->posY.i.hi = newEntity->posY.i.hi + *ptr;
ptr++;
if (breakableType != 0) {
newEntity->posY.i.hi -= 20;
}
newEntity->params = i;
}
}

if (breakableType != 0) {
for (j = 0; j < 3; j++) {
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != 0) {
CreateEntityFromEntity(E_BREAKABLE_UNK0, self, newEntity);
newEntity->posX.i.hi += *ptr;
ptr++;
newEntity->posY.i.hi += *ptr;
ptr++;
newEntity->params = j + 4;
}
}
}
ReplaceBreakableWithItemDrop(self);
DestroyEntity(&self[1]);
}
}
// These functions are unused since there are no breakables in CEN
#include "../e_breakable_with_lighting.h"
4 changes: 2 additions & 2 deletions src/st/cen/e_init.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "cen.h"

void EntityBreakable(Entity*);
void OVL_EXPORT(EntityBreakable)(Entity*);
void EntityExplosion(Entity*);
void EntityPrizeDrop(Entity*);
void EntityDamageDisplay(Entity*);
Expand Down Expand Up @@ -30,7 +30,7 @@ void EntityUnkId1B(Entity*);
void EntityMovingElevator(Entity*);

PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
EntityBreakable,
OVL_EXPORT(EntityBreakable),
EntityExplosion,
EntityPrizeDrop,
EntityDamageDisplay,
Expand Down
5 changes: 5 additions & 0 deletions src/st/chi/chi.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

#define OVL_EXPORT(x) CHI_##x

enum OVL_EXPORT(Palette) {
PAL_NONE = 0,
PAL_BREAKABLE_DEBRIS = 0x159,
};

typedef enum {
/* 0x00 */ E_NONE,
/* 0x01 */ E_BREAKABLE,
Expand Down
8 changes: 4 additions & 4 deletions src/st/chi/dt_entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "chi.h"

void EntityBreakableWithDebris(Entity*);
void OVL_EXPORT(EntityBreakable)(Entity*);
void EntityExplosion(Entity*);
void EntityPrizeDrop(Entity*);
void EntityDamageDisplay(Entity*);
Expand All @@ -31,7 +31,7 @@ void EntityDemonSwitchWall(Entity*);
void EntityDemonSwitch(Entity*);
void EntityBreakableWall(Entity*);
void EntityBreakableWallDebris(Entity*);
void EntityBreakableDebris(Entity*);
void OVL_EXPORT(EntityBreakableDebris)(Entity*);
void EntityFallingStairs(Entity*);
void EntityCerberusGateDebug(Entity*);
void EntityFallingStep(Entity*);
Expand All @@ -54,7 +54,7 @@ void EntityVenusWeedSpike(Entity*);

// D_8018055C
PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
EntityBreakableWithDebris,
OVL_EXPORT(EntityBreakable),
EntityExplosion,
EntityPrizeDrop,
EntityDamageDisplay,
Expand All @@ -79,7 +79,7 @@ PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
EntityDemonSwitch,
EntityBreakableWall,
EntityBreakableWallDebris,
EntityBreakableDebris,
OVL_EXPORT(EntityBreakableDebris),
EntityCerberusGateDebug,
EntityFallingStairs,
EntityFallingStep,
Expand Down
Loading
Loading