21#include "text/msg_ids.h"
42#define FLAG_SOL_SANCTUM_STATUE_HALL_VISITED 0x30a
43#define FLAG_SOL_SANCTUM_STATUE_PUZZLE_EXPLAINED 0x30b
46#define SOL_SANCTUM_STATUE_BACK_SCROLL_ROW_Y_OFFSET 6
48#define SOL_SANCTUM_STATUE_BACK_SCROLL_ROW_Y_OFFSET 8
51#define SOL_SANCTUM_STATUE_ROW_SPRITE_COUNT 9
52#define SOL_SANCTUM_STATUE_SPRITE_WIDTH 32
61 s32 statueRow,
s32 leaderColumn,
73#define NULL ((void *)0)
178 for (flash = 0; flash != 22; flash++) {
337 if (leader !=
NULL) {
344 if (leader !=
NULL) {
367 work->transitionFrames = 32;
543 leader->
z.
part.pixel);
551 leader->
z.
part.pixel);
558 work->transitionFrames = 16;
570 s32 cameraPosition[3];
581 savedOrigin = map->
origin;
584 map->
origin = cameraPosition;
585 for (frame = 0; frame != 30; frame++) {
586 cameraPosition[2] +=
PIXELS(1);
597 savedOrigin = map->
origin;
598 map->
origin = cameraPosition;
599 for (frame = 0; frame != 30; frame++) {
600 cameraPosition[2] -=
PIXELS(1);
607 for (frame = 0; frame != 6; frame++) {
613 for (frame = 0; frame != 10; frame++) {
619 for (frame = 0; frame != 12; frame++) {
629 if (approachSide == 1) {
630 for (frame = 0; frame != 30; frame++) {
631 cameraPosition[2] -=
PIXELS(1);
634 }
else if (approachSide == 2) {
635 for (frame = 0; frame != 30; frame++) {
636 cameraPosition[2] +=
PIXELS(1);
640 map->
origin = savedOrigin;
661 if ((
u32)(screenY + 16) <= 175) {
846 s32 *attributeWords = spriteWords;
848 *attributeWords++ = 0;
849 *attributeWords++ = 0x40004000;
851 *attributeWords = tile | 0xac00;
855 s32 *attributeWords = spriteWords;
857 *attributeWords++ = 0;
858 *attributeWords++ = 0x40004000;
860 *attributeWords = tile | 0xdc00;
864 s32 *attributeWords = spriteWords;
866 *attributeWords++ = 0;
867 *attributeWords++ = 0x40004000;
869 *attributeWords = tile | 0xc00;
944 column = leaderPosition->
x.
fixed >> 20;
946 if ((leader->
z.
fixed >> 20) == 8) {
947 if ((
u32)(column - 17) <= 1) {
961 if (row == 7 && (
u32)(column - 13) <= 1) {
971 if (row == 7 && (
u32)(column - 21) <= 1) {
991 if (statue !=
NULL) {
992 statueZ = statue->
z.
fixed;
994 if ((statueZ >> 20) == 8) {
997 if ((
u32)(leader->
z.
fixed >> 19) <= 17) {
1070 if (movingActor != 0) {
1071 if ((movingActor->
z.
fixed >> 20) == 8) {
1138 row = statue->
z.
fixed >> 20;
1146 if (statue !=
NULL) {
1164 if (statue !=
NULL) {
1174 if (statue !=
NULL) {
1182 s32 statueRow,
s32 leaderColumn,
1194 (leaderRow << 4) + 8);
1195 statueX = statueColumn << 4;
1196 statueZ = statueRow << 4;
1206 if (actor ==
NULL || (actor->
x.
fixed >> 20) != column) {
1209 if ((actor->
z.
fixed >> 20) != row) {
1435#define COPY_CELLS(copy) \
1436 Map_CopyCellsTo((copy).srcX, (copy).srcY, (copy).destX, (copy).destY, \
1437 (copy).width, (copy).height)
1458 for (pulse = 0; pulse != 20; pulse++) {
1471 if (exitResult == -1) {
1490 }
else if (exitResult == 0 &&
1506 if (exitResult == 1) {
1571 {0,
CONDITION_ALWAYS, 287, 0, 176,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1572 {1,
CONDITION_ALWAYS, 646, 0, 329,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1573 {2,
CONDITION_ALWAYS, 647, 0, 470,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1574 {3,
CONDITION_ALWAYS, 576, 0, 136,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1575 {4,
CONDITION_ALWAYS, 576, 0, 136,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1576 {5,
CONDITION_ALWAYS, 576, 0, 136,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1577 {6,
CONDITION_ALWAYS, 576, 0, 136,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1578 {99,
CONDITION_ALWAYS, 576, 0, 136,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
Calls through a function pointer, by argument count.
The task scheduler: tasks, their order and the scheduler's state.
The engine calls the debug menus import, and their palette swatch tiles.
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
u8 gSolSanctumStatue_SpriteRowsGfx[]
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
s32 Engine_LeaderCheckAhead(void)
static void Actor_SetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
void Engine_HeapRelease(s32 slot)
s32 Engine_VramLoad(s32 block, s32 size, const void *data)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
static void Event_PlayCue(s32 cue)
static void Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
s32 Engine_GameFlagIsSet(s32 flag)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ObjectMotionSetPositionAndCommit(s32 actor, s32 x, s32 z)
void Engine_MapRedraw(void)
static void Camera_MoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static struct FieldActor * Actor_Get(s32 actor)
@ TRANSITION_BACKDROP_FADE
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
#define SCENE_TRANSITION(style, variant)
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define PSYNERGY_PHASE_ON_ACTOR(ability, phase)
A Psynergy event on an actor at one phase of the cast, as PSYNERGY_IN_AREA is for an area.
#define SCENE_EXITS(scene)
#define SCENE_EXIT(exit, scene, entrance)
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Field_SetMapCellCollision(s32 a0, s32 a1, s32 a2, s32 a3)
16.16 fixed-point constants, sine and cosine, and the library division.
#define Q16_ONE
One in the engine's signed 16.16 fixed-point format.
Game flags, named where their meaning is shown.
#define FLAG_SOL_SANCTUM_RIGHT_BEAM_SHINING
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_SOL_SANCTUM_CENTER_STATUE_MOVED
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_SOL_SANCTUM_FALLING_LIGHTS_SEEN
The statues' lights have flashed and fallen through the Luna room.
#define FLAG_SOL_SANCTUM_ERUPTED
The volcano has erupted and the sanctum's rooms rumble and shake.
#define FLAG_SOL_SANCTUM_NORTHEAST_SEAL_OPEN
#define FLAG_SOL_SANCTUM_LEFT_BEAM_SHINING
The statues beside the hall's centre shine their beams.
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_SOL_SANCTUM_SOUTHEAST_SEAL_OPEN
#define FLAG_SOL_SANCTUM_STATUE_TRAP_SPRUNG
The statues' lights have flashed as Kraden stood among them.
#define FLAG_SOL_SANCTUM_SOUTHWEST_SEAL_OPEN
#define FLAG_SOL_SANCTUM_ALL_SEALS_OPEN
#define FLAG_SCENE_TEMP_07
#define FLAG_SOL_SANCTUM_NORTHWEST_SEAL_OPEN
A statue stands on its seal and the seal's light shines.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
Small statement macros both games use for positions, velocities and bounds.
#define SET_VELOCITY(p, vx, vy, vz)
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
The heaps: allocating and freeing blocks.
The reel game's title lettering.
struct UiWindow * UiText_OpenMessageAtObject(s32 actor, s32 unused)
The event command "open message": opens the event's current message in a speech window next to the sp...
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
A scene overlay's imports: queueing a scene sound and setting up its record buffer.
s32 Resource_DecodeByteLz(const void *source, void *destination)
Decodes a byte-oriented LZ resource and returns its unpacked byte count.
void InitializeSceneRecordBuffer()
static void Event_PushLeftBeamStatueEast(void)
Walking into the left beam statue from the west: it slides east in front of the centre and shines its...
static void Event_PushNorthwestStatue(void)
Walking into the northwest statue: the leader pushes it onto its seal.
struct ScenePlacement gSolSanctumStatue_Placements[]
static void Event_NortheastStatueMoved(void)
Moving the northeast statue with Move: on its seal, the seal opens.
static void Event_BlockRightTriggerCell(void)
Starting Move beside the right beam statue: as the left one, on actor 12.
static void SolSanctumStatue_OpenNorthwestSeal(void)
Configures the northwest seal animation and statue return position.
struct SceneEntrance gSolSanctumStatue_Entrances[]
static void Event_LeftBeamStatueMoved(void)
Moving the left beam statue with Move: its cell is freed, and in front of the centre it shines its be...
static UNUSED void SolSanctumStatue_MoveUnusedNorthwestStatue(void)
Unused sequence moving the northwest statue to its seal position.
static void Event_PushLeftBeamStatueNorth(void)
Walking into the left beam statue from the south: it slides one cell north.
static void SolSanctumStatue_OpenSouthwestSeal(void)
Configures the southwest seal animation and statue return position.
static void Event_PushRightBeamStatueNorth(void)
Walking into the right beam statue from the south: it slides one cell north.
static void Event_PushNortheastStatue(void)
Walking into the northeast statue: the leader pushes it onto its seal.
const struct SceneRegion * SolSanctumStatue_GetRegions(void)
s32 SolSanctumStatue_Initialize(void)
Restores the hall's statues, beams and seals from their flags and plays Kraden's arrival cutscenes.
static void Event_PushSouthwestStatue(void)
Walking into the southwest statue: the leader pushes it onto its seal.
struct SceneEvent gSolSanctumStatue_Events[]
static void SolSanctumStatue_InitializeScrollingSprites(void)
Loads three graphic strips and initializes their scrolling sprite rows.
#define FLAG_SOL_SANCTUM_STATUE_HALL_VISITED
static void Event_PushRightBeamStatueWest(void)
Walking into the right beam statue from the east: as the left one.
static void SolSanctumStatue_OpenNortheastSeal(void)
Configures the northeast seal animation and statue return position.
static s32 SolSanctumStatue_SelectStoryExit(void)
Chooses the cutscene in the Luna and Sol rooms that a newly opened seal leads to, and requests its ex...
StatueHallActor
The placed actors: Kraden, the eight statues, and the centre statue in its two places.
@ ACTOR_MOVED_CENTER_STATUE
@ ACTOR_RIGHT_BEAM_STATUE
static void SolSanctumStatue_OpenSeal(void)
Animates the seal and either advances the story or resets its statue.
static void Event_RightBeamStatueMoved(void)
Moving the right beam statue with Move: as the left one.
static void Event_PushCenterStatueNorth(void)
Walking into the centre statue from the south: the leader pushes it north.
#define FLAG_SOL_SANCTUM_STATUE_PUZZLE_EXPLAINED
static void SolSanctumStatue_OpenCentralHole(void)
Animates the floor opening after both light beams meet, then lets the centre statue drop in if it sta...
static void SolSanctumStatue_VisitStatueHall(void)
Kraden comes back after the trap to find the hole in the floor, has the party tell how it opened,...
static void Event_PushRightBeamStatueSouth(void)
Walking into the right beam statue from the north: it slides one cell south.
static void SolSanctumStatue_RunSealOpenedSequence(void)
Pans toward the seals' lights, which flash ever faster until the stairway in the floor is uncovered,...
const struct SceneEvent * SolSanctumStatue_GetEvents(void)
Returns the statues' Move and push events, each row only until its seal or beam is done.
static void SolSanctumStatue_ExplainStatuePuzzle(void)
Kraden comes back after the falling lights to warn that the statues are a trap, and leaves the myster...
#define SOL_SANCTUM_STATUE_ROW_SPRITE_COUNT
static void Event_CenterStatueMoved(void)
Moving the centre statue with Move, or a beam completing the pair: with both beams shining the statue...
static void Event_PushSoutheastStatue(void)
Walking into the southeast statue: the leader pushes it onto its seal.
static union @133327075273071043343026314075216362254362256270 sScrollingSprites
#define SOL_SANCTUM_STATUE_SPRITE_WIDTH
s32 gSolSanctumStatue_ScrollPhase
static void SolSanctumStatue_OpenSoutheastSeal(void)
Configures the southeast seal animation and statue return position.
static s32 SolSanctumStatue_IsActorAtCell(s32 actorId, s32 column, s32 row)
Returns 1 when the actor stands in the given map cell.
static void Event_BlockLeftTriggerCell(void)
Starting Move beside the left beam statue: its cell is blocked while the leader stands beside it.
static void SolSanctumStatue_ShineRightBeam(void)
Draws the right beam and opens the floor when the left beam is also lit.
static void Event_SouthwestStatueMoved(void)
Moving the southwest statue with Move: on its seal, the seal opens.
static void Event_SayThenWait(s32 speaker, s32 frames)
Shows the selected message from one speaker and waits the requested frames.
static void SolSanctumStatue_UpdateScrollingSprites(void)
Draws the three parallax rows while they overlap the screen.
static void Event_NorthwestStatueMoved(void)
Moving the northwest statue with Move: on its seal, the seal opens.
const u32 * SolSanctumStatue_GetExits(void)
const struct SceneEntrance * SolSanctumStatue_GetEntrances(void)
static void Event_CheckAheadFacingNorth(void)
Walking north over cell code 10: the way ahead is checked as on any field.
static struct SealScene sSealScene
The scene's bss, in this order; as commons of one object the linker would sort them itself.
static void Event_PushLeftBeamStatueSouth(void)
Walking into the left beam statue from the north: it slides one cell south.
static void Event_CheckAheadFacingSouth(void)
Walking south over cell code 11: the way ahead is checked as on any field.
static void SolSanctumStatue_ShineLeftBeam(void)
Draws the left beam and opens the floor when the right beam is also lit.
static void Event_SoutheastStatueMoved(void)
Moving the southeast statue with Move: on its seal, the seal opens.
const struct ScenePlacement * SolSanctumStatue_GetPlacements(void)
Returns Kraden (actor 8), the eight statues (9 to 16), the centre statue (17) and its moved copy (18)...
#define SOL_SANCTUM_STATUE_BACK_SCROLL_ROW_Y_OFFSET
u32 gSolSanctumStatue_Exits[]
static void Event_BlockCenterTriggerCells(void)
Starting Move beside the centre statue: its cells are blocked while the leader stands in their row.
static void SolSanctumStatue_PushStatue(s32 statueId, s32 statueColumn, s32 statueRow, s32 leaderColumn, s32 leaderRow)
Moves the leader and statue together to the centers of their target cells.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
The hardware sprite attributes one part of an animated sprite (its image or its shadow) is drawn with...
u16 y
The OAM entry's attributes 0 to 2.
A block of map cells copied from one place in the map to another.
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s32 startTransition
SCENE_TRANSITION(style, variant).
s32 transitionFrames
frames
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u8 steeringFlags
ActorSteeringFlag bits.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
union FieldCoordinate z
16.16 fixed-point pixels
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
The seal being opened: its cell animations, its flag, where the leader jumps back to and where its st...
struct CellCopy stairs[3]
s32 unused[3]
never read or written; the bss keeps its 12 bytes
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
The patch levels: our groups of the measured changes from the Japanese release.
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.