37#include "text/msg_ids.h"
72#define NULL ((void *)0)
117 for (i = 0; i != 6; i++) {
182 message = MsgSolSanctumVenusStarBagged;
216 for (i = 0; i != 6; i++) {
282 message = MsgSolSanctumPutMercuryStar;
329 for (i = 0; i != 6; i++) {
488 spriteFlags = &felix->sprite->flags;
514 for (i = 0; i != 90; i++) {
524 for (i = 0; i != 60; i++) {
820 u32 item = *inventoryEntry & 0x1ff;
822 if (item == 220 || item == 221 || item == 223)
825 }
while (remainingSlots >= 0);
828 messageA = MsgSolSanctumGuessTakeElemental;
832 if (starCount <= 2) {
843 if (starCount <= 2) {
844 messageB = MsgSolSanctumDontHandOver;
967 for (i = 0; i != 30; i++) {
1074 if (leader !=
NULL) {
1145 for (pass = 0; pass != 6; pass++) {
1174 if (leader !=
NULL) {
1293 s32 actorZ,
s32 speaker) {
1316 u8 *kradenSteeringFlags;
1319 s32 kradenMessageSpeaker;
1332 leaderSprite = &rising->sprite->flags;
1349 for (i = 0; i != 90; i++) {
1361 for (i = 0; i != 60; i++) {
1378 *leaderSprite = shown;
1391 if (leader !=
NULL) {
1395 if (leader !=
NULL) {
1458 kradenSprite = &rising->sprite->flags;
1459 *kradenSprite = zero;
1467 *kradenMotion = zero;
1484 for (i = 0; i != 90; i++) {
1494 for (i = 0; i != 60; i++) {
1510 *kradenSprite = shown;
1548 kradenSpeaker = 0x4009;
1835 s32 flags = 1 | *kradenSteeringFlags;
1836 *kradenSteeringFlags = flags;
1909 kradenMessageSpeaker = 0x8009;
1951 if (leader !=
NULL) {
1977 }
while ((
u32)ringActor <= 24);
2050 sprite = actor->sprite;
2085 if (freeSlots <= 3) {
2090 }
while (freeSlots <= 3);
2110 effectOptions = &options;
2113 effectOptions->
type = 0x11c;
2116 for (frame = 0; frame <= 31; frame++) {
2163 SC_CALL(Scene_TurnTowardTarget),
2211 {0,
CONDITION_ALWAYS, 472, 0, 322,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2287 MAP_CELL_STEP(59, 40, 3, 4, 6),
MAP_CELL_STEP(62, 40, 3, 4, 6),
MAP_CELL_STEP(65, 40, 3, 4, 6),
MAP_CELL_STEP(68, 40, 3, 4, 6),
MAP_CELL_STEP(71, 40, 3, 4, 6),
MAP_CELL_STEP(74, 40, 3, 4, 6),
MAP_CELL_STEP(77, 40, 3, 4, 6),
MAP_CELL_STEP(80, 40, 3, 4, 6),
MAP_CELL_STEP(83, 40, 3, 4, 0),
MAP_CELL_STEPS_END,
2330 0x9999, 0xcccc, 0xb333, 0x9999, 0xcccc, 0x9999, 0xb333, 0x9999,
2335 655, 458, 655, 458, 655, 458, 655, 655,
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
const s32 * gEffectScripts[]
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it use...
static void Event_CheckAhead(void)
Checks the blocked direction before allowing another movement step.
Calls through a function pointer, by argument count.
The engine calls the debug menus import, and their palette swatch tiles.
FacingObject, the view of an object that turns to face a target.
@ EFFECT_USE_PALETTE
options.palette, as its group child value
@ EFFECT_USE_START_SCALE
options.startScaleX and startScaleY
@ EFFECT_USE_TYPE
options.type, else object type 222
@ EFFECT_USE_PRIORITY
options.priority, as the sprite's priority
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
#define SPEAKER_PORTRAIT_LEFT
static s32 Event_OpenMessage(s32 speaker, s32 flags)
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_WorkSetValuesIfNonNegative(s32 first, s32 second, s32 third)
#define SPEAKER_WINDOW_ABOVE
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Actor_SetBuiltinAction(s32 actor, s32 action)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
#define SPEAKER_PORTRAIT_RIGHT
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_ItemLoadIcon(s32 item)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ItemShowFound(s32 item, s32 height)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
#define SPEAKER_WINDOW_BELOW
void Engine_HeapRelease(s32 slot)
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
s32 Engine_VramLoad(s32 block, s32 size, const void *data)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_MapRenderWaitForValues(void)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
void * Engine_HeapAllocate(s32 slot, s32 size)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
void Engine_ActorSetAttachedEffect(s32 actor, s32 effect)
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
#define MAP_CELL_STEPS_END
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_MapAnimateCells(const u16 *steps, s32 destX, s32 destY)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
void Engine_RunRisingObjectSequence(struct FieldActor *object, s32 mode)
static s32 Event_AskYesNo(s32 speaker, s32 flags)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
void Engine_ColorBufferInterpolate(s32 frames)
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 void Actor_SetAttachedEffect(s32 actor, s32 effect)
void Engine_ColorBufferApplyTarget(s32 value, s32 mode)
void Engine_ColorBufferApplySource(s32 value, s32 mode)
static struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
@ ACTOR_FOLLOWS_TERRAIN
moves with the ground height under it
@ ACTOR_FALLS
falls by its gravity and bounces
#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 SCENE_EXITS(scene)
#define SCENE_EXIT(exit, scene, entrance)
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void FieldObject_SetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
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_SHOW_LOCATION_NAME
#define FLAG_SOL_SANCTUM_MERCURY_STAR_BAGGED
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_SOL_SANCTUM_STAR_ROOM_COLLAPSED
#define FLAG_SOL_SANCTUM_VENUS_STAR_BAGGED
#define FLAG_SOL_SANCTUM_STARS_GIVEN_TO_ALEX
The Jupiter Star is bagged and Alex holds the four Elemental Stars.
#define FLAG_SOL_SANCTUM_STAR_ROOM_EXPLAINED
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
Font glyphs and their palettes.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
s32 PartyInventory_Discard(s32 itemId)
Discards one itemId from whoever carries it first, as Inventory_Discard does; always returns 0.
s32 Inventory_AddItem(s32 owner, s32 itemId)
Gives a unit one item, joining its first matching stack (up to 30) or taking the first free slot.
s32 Inventory_Count(s32 owner)
Counts filled inventory slots up to the first empty slot; the inventory is kept closed up,...
s32 Inventory_Discard(s32 owner, s32 slot)
Removes one item as Inventory_Remove does, and puts a rare item back into circulation (its counter go...
s32 Inventory_Find(s32 owner, s32 itemId)
Returns the first slot holding itemId (any quantity, equipped or not), or -1.
s32 PartyInventory_FindOwner(s32 itemId)
Returns who carries itemId, asking the selected character first, or -1.
s32 PartyInventory_Add(s32 itemId)
Gives the item to the first party member with room.
Item numbers, named from the English release.
s32 Shop_PickUnitItem(s32 *selectedUnit, s32 *selectedSlot)
Lets the player choose a party member, then one of its items that may be dropped.
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_POS(x, y, z)
Set position.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
void Party_RemoveOwnerRestored(s32 unit)
Takes unit out of the party, fully restoring its HP and PP and curing its poison.
void BattlePres_RunActionThenWaitIfModeZero(s32 actor, s32 flags, s32 wait)
The event command "show message and wait": shows the message, then waits wait frames.
Overlay objects and their records.
Palette fades, the battle effect palette buffers and the colour channel curves.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
#define ACTOR_ACTION_IDLE
s8 gSolSanctum_RingDirection[][3]
static void SolSanctumElementalStarRoom_OfferHostageGuarantee(void)
Has the captors offer a guarantee for their hostages' safety.
static void Event_TalkToJenna(void)
Talking to Jenna, or reading her mind: about the stars, or Felix alive.
static void Event_TakeMarsStar(void)
Searching the Mars Star's pedestal: Isaac takes the last star and the room begins to shake.
static void Event_BagJupiterStarAndMeetSaturos(void)
Searching the Jupiter Star's pedestal: the star is bagged, then Saturos and Menardi appear,...
static void SolSanctumElementalStarRoom_DemandElementalStars(void)
Reveals the masked intruder while the captors demand the stars.
static void SolSanctumElementalStarRoom_AlexTakesStars(void)
Has Alex collect the stars and returns the party to the final pedestal.
static void SolSanctumElementalStarRoom_UnmaskFelix(void)
Reveals Felix's identity and lets Isaac decide how to hand over the stars.
static s32 SolSanctumElementalStarRoom_PresentStar(s32 item, s32 x, s32 y, s32 z)
Animates a star's icon and replaces its owner's mythril bag with the star.
s32 SolSanctumElementalStarRoom_Initialize(void)
Restores pedestal state and runs the first-arrival scene when needed.
struct SceneEntrance gSolSanctumElementalStarRoom_Entrances[]
struct SceneEvent gSolSanctumElementalStarRoom_Events[]
u32 gSolSanctumElementalStarRoom_Exits[]
static void Event_BagMercuryStar(void)
Searching the Mercury Star's pedestal: as the Venus Star.
const struct SceneEntrance * SolSanctumElementalStarRoom_GetEntrances(void)
const u32 * SolSanctumElementalStarRoom_GetExits(void)
s32 gSolSanctumElementalStarRoom_PresentItemScript[]
static void Event_TalkToFelix(void)
Talking to Felix: he says nothing. "...".
static void Event_KradenStopsPartyLeaving(void)
Heading out before the stars are bagged: the party is called back.
static void Event_TalkToAlex(void)
Talking to Alex: only one star is left.
static void Event_TalkToKraden(void)
Talking to Kraden: about the stars still to bag, or the hostages.
const struct SceneRegion * SolSanctumElementalStarRoom_GetRegions(void)
u16 gSolSanctumElementalStarRoom_StarCells[]
static void SolSanctumElementalStarRoom_BagJupiterStar(void)
Reveals the Jupiter crossings and places the star in a mythril bag.
s32 gSolSanctumRing_ScaleSteps[]
const struct ScenePlacement * SolSanctumElementalStarRoom_GetPlacements(void)
s32 gSolSanctumRing_MaxScales[]
static void SolSanctumElementalStarRoom_ShowMessageAndWait(s32 speaker, s32 frames)
s32 gSolSanctumElementalStarRoom_AngleScript[]
static void SolSanctumElementalStarRoom_GiveMythrilBags(void)
Makes inventory room and gives the party four bags, preserving the dialogue.
static __inline__ void SolSanctumElementalStarRoom_SkipMessages(s32 amount)
Advances through the current dialogue's consecutive messages.
static void SolSanctumElementalStarRoom_RevealSaturosAndMenardi(void)
Brings Isaac and Garet back to discover Jenna and Kraden's captors.
static void Event_TalkToSaturos(void)
Talking to Saturos: he demands the last star.
static void Event_BagVenusStar(void)
Searching the Venus Star's pedestal: the room flashes, new crossings open between the pedestals,...
u8 gSolSanctum_RingSwing[][3]
const struct SceneEvent * SolSanctumElementalStarRoom_GetEvents(void)
Returns the star, dialogue, and boundary interactions.
static void SolSanctumElementalStarRoom_EnterStarRoom(void)
Introduces the room, explains the Elemental Stars, and gives out mythril bags.
static void SolSanctumElementalStarRoom_AnimateAlexTeleport(void)
Emits sparks while Alex disappears and reappears.
static void Event_TalkToMenardi(void)
Talking to Menardi, or reading her mind: she demands the last one.
u8 gSolSanctum_RingDrift[][3]
static void SolSanctumElementalStarRoom_LineUpFollowers(void)
Arranges the captors and hostages after the exchange.
struct ScenePlacement gSolSanctumElementalStarRoom_Placements[]
static void SolSanctumElementalStarRoom_ShowPedestal(s32 cameraX, s32 cameraZ, s32 actorX, s32 actorZ, s32 speaker)
Shows a pedestal while Kraden describes it, then returns to the party.
Song and sound effect ids, indices into gSound_SongTable.
#define MUS_TREASURE_FOUND
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_EventSetMessage()
void Engine_EventShowMessage()
void SolSanctum_StartFloatingLights(s32 first, u32 count)
Starts the floating lights: count actors (at most 10) from first, each drawn translucent and starting...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
u8 slot
VRAM cache entry holding its tiles.
u8 count
layers in use, up to the last one present
u16 fullColor
256 colours; set for both parts when created
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s16 type
the object type to create; 222 without the flag
s32 palette
passed to ObjectGroup_SetChildValue
s32 startScaleY
16.16 fixed point, 0x10000 full size
s32 priority
the sprite's priority
s32 startScaleX
16.16 fixed point, 0x10000 full size
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
u16 message
the next message, advanced as each window opens
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
struct FieldActor * linkedObject
The object its action script follows or faces.
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
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 velocityY
16.16 fixed-point pixels per frame
s32 gravity
Taken off the vertical velocity each frame while it is above the ground, in 16.16 fixed-point pixels ...
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
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 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
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
void UiWork_PushValueSlot(u32 value, u32 kind)
Adds a message argument of kind (MSG_ARG_) with value to the first free place of the argument table; ...
void UiText_ShowCenteredMessage(s32 message, s32 mode, s32 yOffset)
Shows a message centred on the screen (yOffset tiles lower) and waits until it is typed out,...