mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-26 22:40:33 +00:00
Dedupe no0
clock room entities (#1808)
Some checks failed
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (i686, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Build Debug Module tool / build (push) Has been cancelled
Some checks failed
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (i686, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Build Debug Module tool / build (push) Has been cancelled
This commit is contained in:
parent
96d4ac2b2e
commit
0699def0d3
@ -35,7 +35,7 @@ segments:
|
||||
- name: bomar
|
||||
type: code
|
||||
start: 0
|
||||
vram: 0x80180000
|
||||
vram: 0x80180000
|
||||
align: 4
|
||||
subalign: 4
|
||||
subsegments:
|
||||
@ -58,7 +58,7 @@ segments:
|
||||
- [0x1058, .data, e_misc]
|
||||
- [0x1174, .data, e_particles]
|
||||
- [0x11F4, .data, e_room_fg]
|
||||
- [0x1280, data] # 17FEC
|
||||
- [0x1280, data, clock_room]
|
||||
- [0x12EC, .data, rooms]
|
||||
- [0x1308, .data, e_life_up]
|
||||
- [0x135C, .data, e_layout] # layout entries data
|
||||
@ -77,7 +77,7 @@ segments:
|
||||
- [0xAAC8, .rodata, e_collect]
|
||||
- [0xAB50, .rodata, e_misc]
|
||||
- [0xAB9C, .rodata, e_stage_name]
|
||||
- [0xABD0, .rodata, 17FEC]
|
||||
- [0xABD0, .rodata, clock_room]
|
||||
- [0xABE8, .rodata, prim_helpers]
|
||||
- [0xABF0, .rodata, e_life_up]
|
||||
- [0xAC0C, c, st_debug]
|
||||
@ -96,7 +96,7 @@ segments:
|
||||
- [0x1738C, c, e_particles]
|
||||
- [0x17BD0, c, e_room_fg]
|
||||
- [0x17CBC, c, popup]
|
||||
- [0x17FEC, c]
|
||||
- [0x17FEC, c, clock_room]
|
||||
- [0x1911C, c, prim_helpers]
|
||||
- [0x1994C, c, e_life_up]
|
||||
- [0x1A200, .bss, unk]
|
||||
|
@ -54,6 +54,8 @@ segments:
|
||||
- [0x184C, .data, e_collect]
|
||||
- [0x1B3C, .data, e_misc]
|
||||
- [0x1C14, data]
|
||||
- [0x1C34, data, clock_room]
|
||||
- [0x1CA0, data]
|
||||
- [0x2478, .data, e_axe_knight]
|
||||
- [0x25CC, data]
|
||||
- [0x2680, .data, e_skeleton]
|
||||
@ -63,7 +65,8 @@ segments:
|
||||
- [0x4137C, .rodata, e_red_door]
|
||||
- [0x41394, .rodata, e_collect]
|
||||
- [0x4141C, .rodata, e_misc]
|
||||
- [0x41468, .rodata, 4C750]
|
||||
- [0x41468, .rodata, clock_room]
|
||||
- [0x414A8, .rodata, 4C750]
|
||||
- [0x414B8, .rodata, e_stage_name]
|
||||
- [0x414EC, .rodata, unk_4F4A8]
|
||||
- [0x4178C, .rodata, e_axe_knight]
|
||||
@ -86,6 +89,8 @@ segments:
|
||||
- [0x4A21C, c, blit_char]
|
||||
- [0x4A4CC, c, e_misc]
|
||||
- [0x4C750, c]
|
||||
- [0x4CAAC, c, clock_room]
|
||||
- [0x4E2E0, c]
|
||||
- [0x4E654, c, e_stage_name]
|
||||
- [0x4F4A8, c, unk_4F4A8]
|
||||
- [0x5AEBC, c, e_axe_knight]
|
||||
|
@ -1,3 +1,14 @@
|
||||
actor_names = 0x80180680;
|
||||
MAR_PrizeDrops = 0x80180744;
|
||||
bird_cage_pos_x = 0x80181280;
|
||||
bird_cage_pos_y = 0x80181284;
|
||||
statue_pos_x_1 = 0x80181288;
|
||||
statue_pos_x_2 = 0x8018128C;
|
||||
gear_pos_x = 0x80181290;
|
||||
stone_door_pos_x_1 = 0x80181294;
|
||||
stone_door_pos_x_2 = 0x80181298;
|
||||
statue_pos_x_3 = 0x801812A0;
|
||||
anim_bird_cage = 0x801812A8;
|
||||
anim_gear_1 = 0x801812C4;
|
||||
anim_gear_2 = 0x801812D0;
|
||||
g_StoneDoorTiles = 0x801812DC;
|
||||
|
@ -53,6 +53,17 @@ explode_startFrame = 0x80181BF0;
|
||||
explode_lifetime = 0x80181BF4;
|
||||
g_olroxDroolCollOffsets = 0x80181BFC;
|
||||
g_UnkEntityAnimData = 0x80181C04;
|
||||
bird_cage_pos_x = 0x80181C34;
|
||||
bird_cage_pos_y = 0x80181C38;
|
||||
statue_pos_x_1 = 0x80181C3C;
|
||||
statue_pos_x_2 = 0x80181C40;
|
||||
gear_pos_x = 0x80181C44;
|
||||
stone_door_pos_x_1 = 0x80181C48;
|
||||
stone_door_pos_x_2 = 0x80181C4C;
|
||||
statue_pos_x_3 = 0x80181C54;
|
||||
anim_bird_cage = 0x80181C5C;
|
||||
anim_gear_1 = 0x80181C78;
|
||||
anim_gear_2 = 0x80181C84;
|
||||
g_StoneDoorTiles = 0x80181C90;
|
||||
anim_bone_rot = 0x801821DC;
|
||||
steps = 0x801825AC;
|
||||
@ -157,7 +168,14 @@ MakeExplosions = 0x801CC1D0;
|
||||
EntityBigRedFireball = 0x801CC288;
|
||||
ClutLerp = 0x801CC460;
|
||||
PlaySfxPositional = 0x801CC658;
|
||||
EntityClockHands = 0x801CD750;
|
||||
EntityBirdcageDoor = 0x801CD864;
|
||||
UpdateStatueTiles = 0x801CDAD4;
|
||||
EntityStatue = 0x801CDB20;
|
||||
EntityStatueGear = 0x801CDE48;
|
||||
UpdateStoneDoorTiles = 0x801CE058;
|
||||
EntityStoneDoor = 0x801CE0F8;
|
||||
EntityClockRoomUnused = 0x801CE2D8;
|
||||
StageNamePopupHelper = 0x801CE654;
|
||||
EntityStageNamePopup = 0x801CE824;
|
||||
func_801CD78C = 0x801D2374;
|
||||
@ -186,4 +204,5 @@ g_LayoutObjHorizontal = 0x801DE8CC;
|
||||
g_LayoutObjVertical = 0x801DE8D0;
|
||||
g_LayoutObjPosHorizontal = 0x801DE8D4;
|
||||
g_LayoutObjPosVertical = 0x801DE8D8;
|
||||
g_Statues = 0x801DF548;
|
||||
g_ItemIconSlots = 0x801DF54C;
|
||||
|
@ -536,6 +536,8 @@ enum Sfx {
|
||||
SFX_VO_RIC_DEATH,
|
||||
SFX_VO_RIC_HYDRO_STORM, // 0x700
|
||||
SFX_VO_RIC_PAIN_A,
|
||||
SFX_CLOCK_BELL = 1958,
|
||||
SFX_CLOCK_ROOM_TICK = 1961
|
||||
};
|
||||
|
||||
#endif
|
||||
|
179
src/boss/mar/clock_room.c
Normal file
179
src/boss/mar/clock_room.c
Normal file
@ -0,0 +1,179 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include <stage.h>
|
||||
#include "mar.h"
|
||||
#include "sfx.h"
|
||||
|
||||
void EntityClockRoomController(Entity* self) {
|
||||
PlayerStatus* status = &g_Status;
|
||||
const int birdcageDoor1 = 7;
|
||||
const int birdcageDoor2 = 8;
|
||||
const int stoneDoors = 14;
|
||||
const int minuteHand = 5;
|
||||
const int hourHand = 6;
|
||||
const int statues = 1;
|
||||
const int shadow = 9;
|
||||
const int gears = 12;
|
||||
Entity* newEntity;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
u16 i, j;
|
||||
|
||||
// Plays the clock bell
|
||||
if (self->ext.clockRoom.bellTimer != 0) {
|
||||
if (self->ext.clockRoom.bellDuration == 0) {
|
||||
g_api.PlaySfx(SFX_CLOCK_BELL);
|
||||
if (--self->ext.clockRoom.bellTimer) {
|
||||
self->ext.clockRoom.bellDuration = 64;
|
||||
}
|
||||
} else {
|
||||
self->ext.clockRoom.bellDuration--;
|
||||
}
|
||||
}
|
||||
|
||||
// Controls the statues
|
||||
if (D_800973FC == 0) {
|
||||
if (PLAYER.posY.i.hi > 128) {
|
||||
g_Statues[RIGHT_STATUE] = false;
|
||||
}
|
||||
} else if (self->ext.clockRoom.unk8A == 0) {
|
||||
g_Statues[RIGHT_STATUE] = true;
|
||||
}
|
||||
|
||||
self->ext.clockRoom.unk8A = D_800973FC;
|
||||
if (self->step != 0) {
|
||||
if ((status->timerFrames == 0) && (status->timerSeconds == 0)) {
|
||||
if (status->timerMinutes & 1) {
|
||||
g_Statues[LEFT_STATUE] = false;
|
||||
} else {
|
||||
g_Statues[LEFT_STATUE] = true;
|
||||
}
|
||||
}
|
||||
} else if (status->timerMinutes & 1) {
|
||||
g_Statues[LEFT_STATUE] = false;
|
||||
} else {
|
||||
g_Statues[LEFT_STATUE] = true;
|
||||
}
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
if (g_Timer == ((g_Timer / 60) * 0x3C)) {
|
||||
g_api.PlaySfx(SFX_CLOCK_ROOM_TICK);
|
||||
}
|
||||
|
||||
primIndex = g_api.AllocPrimitives(PRIM_G4, 1);
|
||||
if (primIndex == -1) {
|
||||
return;
|
||||
}
|
||||
self->primIndex = primIndex;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
prim->r0 = prim->g0 = prim->b0 = 0;
|
||||
prim->y2 = prim->y3 = prim->x1 = prim->x3 = 0x100;
|
||||
prim->priority = 0x1F0;
|
||||
prim->y0 = prim->y1 = prim->x0 = prim->x2 = 0;
|
||||
prim->blendMode = 8;
|
||||
LOW(prim->r1) = LOW(prim->r0);
|
||||
LOW(prim->r2) = LOW(prim->r0);
|
||||
LOW(prim->r3) = LOW(prim->r0);
|
||||
|
||||
InitializeEntity(g_EInitCommon);
|
||||
g_api.PlaySfx(SET_STOP_MUSIC);
|
||||
D_80097928 = 1;
|
||||
g_Statues[RIGHT_STATUE] = false; // right statue closed
|
||||
self->animSet = ANIMSET_OVL(1);
|
||||
self->animCurFrame = 23;
|
||||
D_80097910 = 0;
|
||||
self->zPriority = 0x40;
|
||||
|
||||
// Create clock hands
|
||||
newEntity = &self[5];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_CLOCK_HANDS, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Clock set
|
||||
self[minuteHand].ext.clockRoom.hand = status->timerMinutes * 0x3C;
|
||||
self[hourHand].ext.clockRoom.hand =
|
||||
(status->timerHours * 0x12C) + (status->timerMinutes * 5);
|
||||
|
||||
// Create Birdcage doors
|
||||
newEntity = &self[birdcageDoor1];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_BIRDCAGE_DOOR, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
if ((status->timerMinutes >= 10) && (status->timerMinutes < 30)) {
|
||||
self[birdcageDoor1].ext.birdcage.state = true;
|
||||
} else {
|
||||
self[birdcageDoor1].ext.birdcage.state = false;
|
||||
}
|
||||
|
||||
if ((status->timerMinutes >= 30) && (status->timerMinutes < 50)) {
|
||||
self[birdcageDoor2].ext.birdcage.state = true;
|
||||
} else {
|
||||
self[birdcageDoor2].ext.birdcage.state = false;
|
||||
}
|
||||
|
||||
// Shadow for the Bighorn sheep head on the center
|
||||
CreateEntityFromCurrentEntity(E_CLOCK_ROOM_SHADOW, &self[shadow]);
|
||||
self[shadow].animSet = ANIMSET_OVL(1);
|
||||
self[shadow].animCurFrame = 23;
|
||||
self[shadow].zPriority = 0x40;
|
||||
self[shadow].palette = 0x804B;
|
||||
self[shadow].drawFlags = FLAG_DRAW_UNK8;
|
||||
self[shadow].blendMode = 0x10;
|
||||
self[shadow].flags = FLAG_DESTROY_IF_OUT_OF_CAMERA |
|
||||
FLAG_POS_CAMERA_LOCKED | FLAG_KEEP_ALIVE_OFFCAMERA;
|
||||
self[shadow].posY.i.hi += 4;
|
||||
|
||||
// Create path blocking statues
|
||||
newEntity = &self[statues];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_STATUE, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Create the gears that drive the statues
|
||||
newEntity = &self[gears];
|
||||
for (j = 0; j < 2; j++) {
|
||||
CreateEntityFromCurrentEntity(E_STATUE_GEAR, newEntity);
|
||||
newEntity->params = j;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Create the stones on the floor
|
||||
newEntity = &self[stoneDoors];
|
||||
for (j = 0; j < 2; j++) {
|
||||
CreateEntityFromCurrentEntity(E_STONE_DOOR, newEntity);
|
||||
newEntity->params = j;
|
||||
newEntity++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (status->timerFrames == 0) {
|
||||
g_api.PlaySfx(SFX_CLOCK_ROOM_TICK);
|
||||
}
|
||||
|
||||
// Update clock hands
|
||||
self[minuteHand].ext.clockRoom.hand = status->timerMinutes * 0x3C;
|
||||
self[hourHand].ext.clockRoom.hand =
|
||||
(status->timerHours * 0x12C) + (status->timerMinutes * 5);
|
||||
if ((status->timerSeconds == 0) && (status->timerFrames == 0) &&
|
||||
(status->timerMinutes == 0)) {
|
||||
self->ext.clockRoom.bellTimer =
|
||||
((status->timerHours + 11) % 12) + 1;
|
||||
if (self->ext.clockRoom.bellTimer == 0) {
|
||||
self->ext.clockRoom.bellTimer = 12;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../../st/clock_room_entities.h"
|
@ -28,7 +28,7 @@ void EntityBirdcageDoor(Entity* self);
|
||||
void EntityStatue(Entity* self);
|
||||
void EntityStatueGear(Entity* self);
|
||||
void EntityStoneDoor(Entity* self);
|
||||
void func_us_80199114(Entity* self);
|
||||
void EntityClockRoomUnused(Entity* self);
|
||||
void EntityDummy(Entity* self);
|
||||
void OVL_EXPORT(EntityCutscene)(Entity* self);
|
||||
void func_us_8018C90C(Entity* self);
|
||||
@ -48,7 +48,7 @@ PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
|
||||
EntityGreyPuff, EntityClockRoomController,
|
||||
EntityClockHands, EntityBirdcageDoor,
|
||||
EntityStatue, EntityStatueGear,
|
||||
EntityStoneDoor, func_us_80199114,
|
||||
EntityStoneDoor, EntityClockRoomUnused,
|
||||
EntityDummy, OVL_EXPORT(EntityCutscene),
|
||||
func_us_8018C90C, func_us_8018CA94,
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ typedef enum {
|
||||
/* 0x1A */ E_STATUE_GEAR,
|
||||
/* 0x1B */ E_STONE_DOOR,
|
||||
/* 0x1C */ E_ID_1C,
|
||||
/* 0x1D */ E_DUMMY_1D,
|
||||
/* 0x1D */ E_CLOCK_ROOM_SHADOW,
|
||||
} EntityIDs;
|
||||
|
||||
typedef enum Statues {
|
||||
|
@ -1,182 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include <stage.h>
|
||||
#include "mar.h"
|
||||
#include "sfx.h"
|
||||
|
||||
void EntityClockRoomController(Entity* self) {
|
||||
PlayerStatus* status = &g_Status;
|
||||
const int birdcageDoor1 = 7;
|
||||
const int birdcageDoor2 = 8;
|
||||
const int stoneDoors = 14;
|
||||
const int minuteHand = 5;
|
||||
const int hourHand = 6;
|
||||
const int statues = 1;
|
||||
const int shadow = 9;
|
||||
const int gears = 12;
|
||||
Entity* newEntity;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
u16 i, j;
|
||||
|
||||
// Plays the clock bell
|
||||
if (self->ext.clockRoom.bellTimer != 0) {
|
||||
if (self->ext.clockRoom.bellDuration == 0) {
|
||||
g_api.PlaySfx(0x7A6); // Clock bell
|
||||
if (--self->ext.clockRoom.bellTimer) {
|
||||
self->ext.clockRoom.bellDuration = 64;
|
||||
}
|
||||
} else {
|
||||
self->ext.clockRoom.bellDuration--;
|
||||
}
|
||||
}
|
||||
|
||||
// Controls the statues
|
||||
if (D_800973FC == 0) {
|
||||
if (PLAYER.posY.i.hi > 128) {
|
||||
g_Statues[RIGHT_STATUE] = false;
|
||||
}
|
||||
} else if (self->ext.clockRoom.unk8A == 0) {
|
||||
g_Statues[RIGHT_STATUE] = true;
|
||||
}
|
||||
|
||||
self->ext.clockRoom.unk8A = D_800973FC;
|
||||
if (self->step != 0) {
|
||||
if ((status->timerFrames == 0) && (status->timerSeconds == 0)) {
|
||||
if (status->timerMinutes & 1) {
|
||||
g_Statues[LEFT_STATUE] = false;
|
||||
} else {
|
||||
g_Statues[LEFT_STATUE] = true;
|
||||
}
|
||||
}
|
||||
} else if (status->timerMinutes & 1) {
|
||||
g_Statues[LEFT_STATUE] = false;
|
||||
} else {
|
||||
g_Statues[LEFT_STATUE] = true;
|
||||
}
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
if (g_Timer == ((g_Timer / 60) * 0x3C)) {
|
||||
g_api.PlaySfx(0x7A9); // Clock tick
|
||||
}
|
||||
|
||||
primIndex = g_api.AllocPrimitives(PRIM_G4, 1);
|
||||
if (primIndex == -1) {
|
||||
return;
|
||||
}
|
||||
self->primIndex = primIndex;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
prim->r0 = prim->g0 = prim->b0 = 0;
|
||||
prim->y2 = prim->y3 = prim->x1 = prim->x3 = 0x100;
|
||||
prim->priority = 0x1F0;
|
||||
prim->y0 = prim->y1 = prim->x0 = prim->x2 = 0;
|
||||
prim->blendMode = 8;
|
||||
LOW(prim->r1) = LOW(prim->r0);
|
||||
LOW(prim->r2) = LOW(prim->r0);
|
||||
LOW(prim->r3) = LOW(prim->r0);
|
||||
|
||||
InitializeEntity(g_EInitCommon);
|
||||
g_api.PlaySfx(SET_STOP_MUSIC);
|
||||
D_80097928 = 1;
|
||||
g_Statues[RIGHT_STATUE] = false; // right statue closed
|
||||
self->animSet = ANIMSET_OVL(1);
|
||||
self->animCurFrame = 23;
|
||||
D_80097910 = 0;
|
||||
self->zPriority = 0x40;
|
||||
|
||||
// Create clock hands
|
||||
newEntity = &self[5];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_CLOCK_HANDS, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Clock set
|
||||
self[minuteHand].ext.clockRoom.hand = status->timerMinutes * 0x3C;
|
||||
self[hourHand].ext.clockRoom.hand =
|
||||
(status->timerHours * 0x12C) + (status->timerMinutes * 5);
|
||||
|
||||
// Create Birdcage doors
|
||||
newEntity = &self[birdcageDoor1];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_BIRDCAGE_DOOR, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
if ((status->timerMinutes >= 10) && (status->timerMinutes < 30)) {
|
||||
self[birdcageDoor1].ext.birdcage.state = true;
|
||||
} else {
|
||||
self[birdcageDoor1].ext.birdcage.state = false;
|
||||
}
|
||||
|
||||
if ((status->timerMinutes >= 30) && (status->timerMinutes < 50)) {
|
||||
self[birdcageDoor2].ext.birdcage.state = true;
|
||||
} else {
|
||||
self[birdcageDoor2].ext.birdcage.state = false;
|
||||
}
|
||||
|
||||
// Shadow for the Bighorn sheep head on the center
|
||||
CreateEntityFromCurrentEntity(E_DUMMY_1D, &self[shadow]);
|
||||
self[shadow].animSet = ANIMSET_OVL(1);
|
||||
self[shadow].animCurFrame = 23;
|
||||
self[shadow].zPriority = 0x40;
|
||||
self[shadow].palette = 0x804B;
|
||||
self[shadow].drawFlags = FLAG_DRAW_UNK8;
|
||||
self[shadow].blendMode = 0x10;
|
||||
self[shadow].flags = FLAG_DESTROY_IF_OUT_OF_CAMERA |
|
||||
FLAG_POS_CAMERA_LOCKED | FLAG_KEEP_ALIVE_OFFCAMERA;
|
||||
self[shadow].posY.i.hi += 4;
|
||||
|
||||
// Create path blocking statues
|
||||
newEntity = &self[statues];
|
||||
for (i = 0; i < 2; i++) {
|
||||
CreateEntityFromCurrentEntity(E_STATUE, newEntity);
|
||||
newEntity->params = i;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Create the gears that drive the statues
|
||||
newEntity = &self[gears];
|
||||
for (j = 0; j < 2; j++) {
|
||||
CreateEntityFromCurrentEntity(E_STATUE_GEAR, newEntity);
|
||||
newEntity->params = j;
|
||||
newEntity++;
|
||||
}
|
||||
|
||||
// Create the stones on the floor
|
||||
newEntity = &self[stoneDoors];
|
||||
for (j = 0; j < 2; j++) {
|
||||
CreateEntityFromCurrentEntity(E_STONE_DOOR, newEntity);
|
||||
newEntity->params = j;
|
||||
newEntity++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (status->timerFrames == 0) {
|
||||
g_api.PlaySfx(0x7A9); // clock tick
|
||||
}
|
||||
|
||||
// Update clock hands
|
||||
self[minuteHand].ext.clockRoom.hand = status->timerMinutes * 0x3C;
|
||||
self[hourHand].ext.clockRoom.hand =
|
||||
(status->timerHours * 0x12C) + (status->timerMinutes * 5);
|
||||
if ((status->timerSeconds == 0) && (status->timerFrames == 0) &&
|
||||
(status->timerMinutes == 0)) {
|
||||
self->ext.clockRoom.bellTimer =
|
||||
((status->timerHours + 11) % 12) + 1;
|
||||
if (self->ext.clockRoom.bellTimer == 0) {
|
||||
self->ext.clockRoom.bellTimer = 12;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Entity ID 0x17
|
||||
void EntityClockHands(Entity* self) {
|
||||
Entity* handShadow = &self[5];
|
||||
u16 params = self->params;
|
||||
@ -189,7 +13,7 @@ void EntityClockHands(Entity* self) {
|
||||
self->drawFlags = FLAG_DRAW_ROTZ;
|
||||
|
||||
// Create hand shadows
|
||||
CreateEntityFromCurrentEntity(E_DUMMY_1D, handShadow);
|
||||
CreateEntityFromCurrentEntity(E_CLOCK_ROOM_SHADOW, handShadow);
|
||||
handShadow->drawFlags = FLAG_DRAW_UNK8 | FLAG_DRAW_ROTZ;
|
||||
handShadow->blendMode = 0x10;
|
||||
handShadow->animSet = ANIMSET_OVL(1);
|
||||
@ -208,12 +32,12 @@ void EntityClockHands(Entity* self) {
|
||||
handShadow->rotZ = self->rotZ &= 0xFFF;
|
||||
}
|
||||
|
||||
extern u16 D_us_801812A8[];
|
||||
extern u16 anim_bird_cage[];
|
||||
// todo: overlapping arrays
|
||||
extern s16 D_us_80181280[];
|
||||
extern s16 D_us_80181284[];
|
||||
extern s16 bird_cage_pos_x[];
|
||||
extern s16 bird_cage_pos_y[];
|
||||
|
||||
// Birdcage doors on the clock Entity ID 0x18
|
||||
// Birdcage doors on the clock
|
||||
void EntityBirdcageDoor(Entity* self) {
|
||||
u16 params = self->params;
|
||||
|
||||
@ -221,13 +45,13 @@ void EntityBirdcageDoor(Entity* self) {
|
||||
case 0:
|
||||
InitializeEntity(g_EInitCommon);
|
||||
self->animSet = ANIMSET_OVL(1);
|
||||
self->animCurFrame = D_us_801812A8[self->ext.birdcage.state & 1];
|
||||
self->animCurFrame = anim_bird_cage[self->ext.birdcage.state & 1];
|
||||
self->zPriority = 0x3C;
|
||||
self->rotX = self->rotY = 0x100;
|
||||
self->ext.birdcage.prevState = self->ext.birdcage.state;
|
||||
self->unk6C = 0x80;
|
||||
self->posX.i.hi = D_us_80181280[params] - g_Tilemap.scrollX.i.hi;
|
||||
self->posY.i.hi = D_us_80181284[params] - g_Tilemap.scrollY.i.hi;
|
||||
self->posX.i.hi = bird_cage_pos_x[params] - g_Tilemap.scrollX.i.hi;
|
||||
self->posY.i.hi = bird_cage_pos_y[params] - g_Tilemap.scrollY.i.hi;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@ -255,7 +79,7 @@ void EntityBirdcageDoor(Entity* self) {
|
||||
self->posX.val += FIX(0.125);
|
||||
if (--self->ext.birdcage.timer == 0) {
|
||||
self->ext.birdcage.timer = 64;
|
||||
self->animCurFrame = D_us_801812A8[self->ext.birdcage.state & 1];
|
||||
self->animCurFrame = anim_bird_cage[self->ext.birdcage.state & 1];
|
||||
self->posX.i.hi -= 8;
|
||||
self->posY.i.hi += 8;
|
||||
self->step++;
|
||||
@ -295,11 +119,10 @@ void UpdateStatueTiles(s32 tilePos, s32 tile) {
|
||||
}
|
||||
}
|
||||
|
||||
extern u16 D_us_80181288[];
|
||||
extern u16 D_us_8018128C[];
|
||||
extern s32 D_us_801812A0[];
|
||||
extern u16 statue_pos_x_1[];
|
||||
extern u16 statue_pos_x_2[];
|
||||
extern s32 statue_pos_x_3[];
|
||||
|
||||
// Entity ID 0x19
|
||||
void EntityStatue(Entity* self) {
|
||||
Entity* entity = &self[2];
|
||||
Entity* statueGear = &self[11];
|
||||
@ -317,14 +140,14 @@ void EntityStatue(Entity* self) {
|
||||
self->zPriority = 0x40;
|
||||
|
||||
if (g_Statues[params] == 0) {
|
||||
self->posX.i.hi += D_us_80181288[params];
|
||||
self->posX.i.hi += statue_pos_x_1[params];
|
||||
if (self->params != 0) {
|
||||
UpdateStatueTiles(2, 0x597);
|
||||
} else {
|
||||
UpdateStatueTiles(12, 0x597);
|
||||
}
|
||||
} else {
|
||||
self->posX.i.hi += D_us_8018128C[params];
|
||||
self->posX.i.hi += statue_pos_x_2[params];
|
||||
if (self->params != 0) {
|
||||
UpdateStatueTiles(2, 0);
|
||||
} else {
|
||||
@ -336,14 +159,18 @@ void EntityStatue(Entity* self) {
|
||||
self->posY.i.hi -= 58;
|
||||
|
||||
// Create shadow for the statue
|
||||
CreateEntityFromCurrentEntity(E_DUMMY_1D, entity);
|
||||
CreateEntityFromCurrentEntity(E_CLOCK_ROOM_SHADOW, entity);
|
||||
entity->animSet = ANIMSET_OVL(1);
|
||||
entity->animCurFrame = params + 10;
|
||||
entity->zPriority = 0x3F;
|
||||
entity->drawFlags = FLAG_DRAW_UNK8;
|
||||
#ifdef STAGE_IS_NO0
|
||||
entity->drawMode = DRAW_TPAGE;
|
||||
#else
|
||||
entity->blendMode = 0x10;
|
||||
entity->flags = FLAG_DESTROY_IF_OUT_OF_CAMERA | FLAG_POS_CAMERA_LOCKED |
|
||||
FLAG_KEEP_ALIVE_OFFCAMERA;
|
||||
#endif
|
||||
entity->posY.i.hi += 8;
|
||||
break;
|
||||
|
||||
@ -380,9 +207,9 @@ void EntityStatue(Entity* self) {
|
||||
}
|
||||
|
||||
if (self->ext.statue.step != 0) {
|
||||
self->posX.val += D_us_801812A0[params];
|
||||
self->posX.val += statue_pos_x_3[params];
|
||||
} else {
|
||||
self->posX.val -= D_us_801812A0[params];
|
||||
self->posX.val -= statue_pos_x_3[params];
|
||||
}
|
||||
|
||||
if (--self->ext.statue.timer == 0) {
|
||||
@ -403,11 +230,11 @@ void EntityStatue(Entity* self) {
|
||||
entity->posX.i.hi = self->posX.i.hi;
|
||||
}
|
||||
|
||||
extern u8 D_us_801812C4[];
|
||||
extern u8 D_us_801812D0[];
|
||||
extern u16 D_us_80181290[];
|
||||
extern u8 anim_gear_1[];
|
||||
extern u8 anim_gear_2[];
|
||||
extern u16 gear_pos_x[];
|
||||
|
||||
// Gears that spin while the statues are moving Entity ID 0x1A
|
||||
// Gears that spin while the statues are moving
|
||||
void EntityStatueGear(Entity* self) {
|
||||
u16 params = self->params;
|
||||
Primitive* prim;
|
||||
@ -420,7 +247,7 @@ void EntityStatueGear(Entity* self) {
|
||||
self->animSet = ANIMSET_OVL(1);
|
||||
self->animCurFrame = 17;
|
||||
self->zPriority = 0x80;
|
||||
self->posX.i.hi += D_us_80181290[params];
|
||||
self->posX.i.hi += gear_pos_x[params];
|
||||
self->posY.i.hi -= 44;
|
||||
self->step = 0;
|
||||
self->step_s++;
|
||||
@ -456,14 +283,14 @@ void EntityStatueGear(Entity* self) {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
AnimateEntity(D_us_801812C4, self);
|
||||
AnimateEntity(anim_gear_1, self);
|
||||
if (self->ext.statue.step == 0) {
|
||||
self->step = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
AnimateEntity(D_us_801812D0, self);
|
||||
AnimateEntity(anim_gear_2, self);
|
||||
if (self->ext.statue.step == 0) {
|
||||
self->step = 1;
|
||||
}
|
||||
@ -494,8 +321,8 @@ void UpdateStoneDoorTiles(bool doorState) {
|
||||
}
|
||||
|
||||
// todo overlapping?
|
||||
extern s16 D_us_80181294[];
|
||||
extern s16 D_us_80181298[];
|
||||
extern s16 stone_door_pos_x_1[];
|
||||
extern s16 stone_door_pos_x_2[];
|
||||
|
||||
// Stone doors on the floor leading to CEN Entity ID 0x1B
|
||||
void EntityStoneDoor(Entity* self) {
|
||||
@ -508,10 +335,10 @@ void EntityStoneDoor(Entity* self) {
|
||||
self->animCurFrame = params + 27;
|
||||
self->zPriority = 0x40;
|
||||
if (g_CastleFlags[CLOCK_ROOM_DOORS] == 0) {
|
||||
self->posX.i.hi += D_us_80181294[params];
|
||||
self->posX.i.hi += stone_door_pos_x_1[params];
|
||||
UpdateStoneDoorTiles(true);
|
||||
} else {
|
||||
self->posX.i.hi += D_us_80181298[params];
|
||||
self->posX.i.hi += stone_door_pos_x_2[params];
|
||||
UpdateStoneDoorTiles(false);
|
||||
}
|
||||
self->posY.i.hi += 88;
|
||||
@ -539,11 +366,15 @@ void EntityStoneDoor(Entity* self) {
|
||||
} else {
|
||||
self->posX.i.hi--;
|
||||
}
|
||||
#ifdef STAGE_IS_NO0
|
||||
g_backbufferY = 1;
|
||||
#else
|
||||
if (self->ext.stoneDoor.unk80 % 2) {
|
||||
g_backbufferY = 1;
|
||||
} else {
|
||||
g_backbufferY = 0;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
g_backbufferY = 0;
|
||||
}
|
||||
@ -557,4 +388,4 @@ void EntityStoneDoor(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_us_80199114(void) {}
|
||||
void EntityClockRoomUnused(void) {}
|
@ -77,39 +77,4 @@ void func_us_801CC8F8(Entity* self) {
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CC9B4);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CCAAC);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CCBE4);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CCC2C);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CCC74);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CD750);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CD864);
|
||||
|
||||
void UpdateStatueTiles(s32 tilePos, s32 tile) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
g_Tilemap.fg[tilePos] = tile;
|
||||
tilePos++;
|
||||
g_Tilemap.fg[tilePos] = tile;
|
||||
tilePos += 15;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CDB20);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CDE48);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CE058);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CE0F8);
|
||||
|
||||
void func_us_801CE2D8(void) {}
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4C750", func_us_801CE2E0);
|
||||
|
||||
INCLUDE_RODATA("st/no0/nonmatchings/4C750", D_us_801C14A8);
|
||||
|
4
src/st/no0/4E2E0.c
Normal file
4
src/st/no0/4E2E0.c
Normal file
@ -0,0 +1,4 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/4E2E0", func_us_801CE2E0);
|
13
src/st/no0/clock_room.c
Normal file
13
src/st/no0/clock_room.c
Normal file
@ -0,0 +1,13 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include "common.h"
|
||||
#include "no0.h"
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/clock_room", func_us_801CCAAC);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/clock_room", func_us_801CCBE4);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/clock_room", func_us_801CCC2C);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/clock_room", func_us_801CCC74);
|
||||
|
||||
#include "../clock_room_entities.h"
|
@ -29,11 +29,12 @@ typedef enum EntityIDs {
|
||||
/* 0x11 */ E_ID_11 = 0x11,
|
||||
/* 0x14 */ E_ID_14 = 0x14,
|
||||
/* 0x15 */ E_GREY_PUFF,
|
||||
/* 0x1D */ E_CLOCK_ROOM_SHADOW = 0x20,
|
||||
/* 0x48 */ E_AXE_KNIGHT_AXE = 0x48,
|
||||
/* 0x49 */ E_WARG_EXP_OPAQUE,
|
||||
/* 0x4D */ E_SKELETON = 0x4D,
|
||||
/* 0x4E */ E_SKELETON_THROWN_BONE,
|
||||
/* 0x4F */ E_SKELETON_PIECES
|
||||
/* 0x4F */ E_SKELETON_PIECES,
|
||||
} EntityIDs;
|
||||
|
||||
extern s16 g_SineTable[];
|
||||
@ -47,3 +48,6 @@ extern u16 g_EInitAxeKnightAxe[];
|
||||
extern u16 g_EInitSkeleton[];
|
||||
extern u16 g_EInitSkeletonPieces[];
|
||||
extern u16 g_EInitSkeletonBone[];
|
||||
|
||||
// Clock room
|
||||
extern u16 g_Statues[];
|
||||
|
Loading…
Reference in New Issue
Block a user