Skip to content

Commit

Permalink
Import no0 EntityStageDecorations data (#1951)
Browse files Browse the repository at this point in the history
I've imported and documented the data, slight refactor from @mrmidi's
previous commit
  • Loading branch information
JoshSchreuder authored Nov 30, 2024
1 parent e803604 commit bffeeb1
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 37 deletions.
6 changes: 4 additions & 2 deletions config/splat.us.stno0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ segments:
- [0x0, data]
- [0x778, data, e_laydef]
- [0x920, .data, e_init]
- [0xC8C, data]
- [0xC8C, .data, e_stage_decoration]
- [0xE94, data, 419EC]
- [0xF04, .data, e_breakable]
- [0xFC0, data]
- [0x1100, .data, d_prize_drops]
Expand Down Expand Up @@ -92,7 +93,8 @@ segments:
- [0x41818, .rodata, e_skeleton]
- [0x41834, .rodata, e_magically_sealed_door]
- [0x4184C, .rodata, prim_helpers]
- [0x41854, c, first_c_file]
- [0x41854, c, e_stage_decoration]
- [0x419EC, c, 419EC]
- [0x41E48, c, e_breakable]
- [0x41F98, c, e_elevator]
- [0x42A34, c, 42A34]
Expand Down
33 changes: 0 additions & 33 deletions src/st/no0/first_c_file.c → src/st/no0/419EC.c
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "no0.h"

extern u16 D_us_80180C8C[];
extern u16 D_us_80180CE8[];
extern u16 D_us_80180D10[];
extern u16 D_us_80180D38[];
extern u8 D_us_80180D60[];
extern u8 D_us_80180D88[];
extern s32 D_us_80180DB0[];
extern u16 D_us_80180DFC[];
extern u8* D_us_80180E48[];

void func_us_801C1854(Entity* self) {
u16 params = self->params;

if (self->step == 0) {
InitializeEntity(g_EInitCommon);

self->animSet = D_us_80180C8C[params];
self->zPriority = D_us_80180CE8[params];
self->unk5A = D_us_80180D10[params];
self->palette = D_us_80180D38[params];
self->drawFlags = D_us_80180D60[params * 2];
self->drawMode = D_us_80180D88[params * 2];

if (D_us_80180DB0[params] != 0) {
self->flags = D_us_80180DB0[params];
}

self->facingLeft = D_us_80180DFC[params * 2];
}

AnimateEntity(D_us_80180E48[params], self);
}

#include "../player_is_within_hitbox.h"

extern u16 D_us_80180ADC[];
Expand Down
4 changes: 2 additions & 2 deletions src/st/no0/e_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void EntityEnemyBlood(Entity*);
void EntityMessageBox(Entity*);
void EntityDummy(Entity*);
void EntityDummy(Entity*);
void func_us_801C1854(Entity*);
void EntityStageDecoration(Entity*);
void func_801B0AA4(Entity*);
void EntityUnkId13(Entity*);
void EntityExplosionVariants(Entity*);
Expand Down Expand Up @@ -100,7 +100,7 @@ PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
EntityMessageBox,
EntityDummy,
EntityDummy,
func_us_801C1854,
EntityStageDecoration,
func_801B0AA4,
EntityUnkId13,
EntityExplosionVariants,
Expand Down
120 changes: 120 additions & 0 deletions src/st/no0/e_stage_decoration.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "no0.h"

// There are 19 decorations which can overlay the background
// based on self->params:
// 0: angel statue left (east exit)
// 1: bird wreath (south area)
// 2: angel statue left (east exit)
// 3: angel statue right (east exit)
// 4: wall lamp brasier (main clock room)
// 5: clock face 1 (long grandfather clock corridors)
// 6: clock face 2 (long grandfather clock corridors)
// 7: clock face 3 (long grandfather clock corridors)
// 8: tall rectangular window highlight 1
// 9: tall rectangular window highlight 2
// 10: tall rectangular window highlight 3
// 11: tall rectangular window highlight 4
// 12: clock face 2 (facing left)
// 13: clock face 3 (facing left)
// 14: tall rectangular window highlight 2 (facing left)
// 15: tall rectangular window highlight 4 (facing left)
// 16: red moveable floor (facing right)
// 17: red moveable floor (facing left)
// 18: tall rectangular window highlight 3 (facing left)

static u16 animset[] = {
ANIMSET_DRA(6), ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1),
ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1),
ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1),
ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1),
ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_OVL(1), ANIMSET_DRA(0)};

static u8 angel_statue_left[] = {0x40, 0x01, 0xFF, 0x00};
static u8 anim_2[] = {0x40, 0x06, 0xFF, 0x00};
static u8 angel_statue_left_2[] = {0x40, 0x01, 0xFF, 0x00};
static u8 angel_statue_right[] = {0x40, 0x02, 0xFF, 0x00};
static u8 lamp_brasier[] = {0x40, 0x2F, 0xFF, 0x00};
static u8 clock_face_1[] = {0x04, 0x22, 0x00, 0x00};
static u8 clock_face_2[] = {0x04, 0x23, 0x00, 0x00};
static u8 clock_face_3[] = {0x04, 0x24, 0x00, 0x00};
static u8 window_highlight_1[] = {0x04, 0x25, 0x00, 0x00};
static u8 window_highlight_2[] = {0x04, 0x26, 0x00, 0x00};
static u8 window_highlight_3[] = {0x04, 0x27, 0x00, 0x00};
static u8 window_highlight_4[] = {0x04, 0x28, 0x00, 0x00};
static u8 red_moveable_floor[] = {0x04, 0x2A, 0x00, 0x00};

static u16 zPriority[] = {
0x01FA, 0x0040, 0x006A, 0x006A, 0x003F, 0x0080, 0x0080,
0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080,
0x0080, 0x0080, 0x009E, 0x009E, 0x0080, 0x0000};

static u16 unk5A[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static u16 palette[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static u16 drawFlags[] = {
FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT,
FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT,
FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT,
FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT,
FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT, FLAG_DRAW_DEFAULT};
static u16 drawMode[] = {
DRAW_TPAGE,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_TPAGE2 | DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_TPAGE,
DRAW_DEFAULT,
DRAW_DEFAULT,
DRAW_TPAGE,
DRAW_DEFAULT};
static s32 flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static u32 facingLeft[] = {
false, false, false, false, false, false, false, false, false, false,
false, false, true, true, true, true, false, true, true};
static u8* animations[] = {
angel_statue_left, anim_2,
angel_statue_left_2, angel_statue_right,
lamp_brasier, clock_face_1,
clock_face_2, clock_face_3,
window_highlight_1, window_highlight_2,
window_highlight_3, window_highlight_4,
clock_face_2, clock_face_3,
window_highlight_2, window_highlight_4,
red_moveable_floor, red_moveable_floor,
window_highlight_3};

void EntityStageDecoration(Entity* self) {
u16 params = self->params;

if (self->step == 0) {
InitializeEntity(g_EInitCommon);

self->animSet = animset[params];
self->zPriority = zPriority[params];
self->unk5A = unk5A[params];
self->palette = palette[params];
self->drawFlags = drawFlags[params];
self->drawMode = drawMode[params];

if (flags[params] != 0) {
self->flags = flags[params];
}

self->facingLeft = facingLeft[params];
}

AnimateEntity(animations[params], self);
}

0 comments on commit bffeeb1

Please sign in to comment.