33#include "text/msg_ids.h"
266#define SANCTUM_NEW_FRIENDS_SPEAKER 2
268#define SANCTUM_NEW_FRIENDS_SPEAKER 1
385 paletteWork->
target[45] = 0x7c00;
386 paletteWork->
target[46] = 0x7c00;
387 paletteWork->
target[47] = 0x7c00;
388 paletteWork->
page = 0;
390 paletteWork->
step = 1;
417 actor->sprite->image.priority =
419 actor->sprite->shadow.priority =
675 for (effectIndex = 0; effectIndex < 6; effectIndex++) {
754 for (effectIndex = 0; effectIndex < 6; effectIndex++) {
1088 for (sparkIndex = 0; sparkIndex < 32; sparkIndex++) {
1375 sprite = actor->sprite;
1377 for (entryIndex = 0; entryIndex < sprite->
count; entryIndex++) {
1380 if (entry != 0 && entry->
script != 0) {
1427 u16 orbitAngle = *angle;
1436 currentX = effect->
x.
fixed;
1441 *angle = (*angle + effect->
work);
1452 orbitStep = angleStep;
1458 sprite = effect->sprite;
1464 effect->
timer = zero;
1466 effect->
work = orbitStep;
1470 sprite->
flags = clearFlags;
1472 sourceSprite = owner->sprite;
1479#if LANGUAGE != LANGUAGE_JAPANESE
1481#define QUESTION_WIDTH 25
1485#define QUESTION_WIDTH 17
1508 text = MsgSanctumGreatHealer;
1784 sprite = icon->sprite;
1785 sprite->
flags = zero;
1786 sprite->
count = zero;
1795 for (frame = 0; frame < 60; frame++) {
1814 switch (((
s16)spark->
work >> 2) & 3) {
1847 x += randomOffset << 16;
1855 sprite = spark->sprite;
1878 if ((
u32)((actor->
facing + 0x5fff) << 16) <= 0x3ffe0000) {
2090 { 0,
CONDITION_ALWAYS, 120, 0, 100,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
2091 { 1,
CONDITION_ALWAYS, 199, 0, 246,
FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2092 { 2,
CONDITION_ALWAYS, 199, 0, 164,
FACING_SOUTH, 0, 64, 8, 336, 272, 0 },
2093 { 10,
CONDITION_ALWAYS, 199, 0, 246,
FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2094 { 11,
CONDITION_ALWAYS, 199, 0, 246,
FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2095 { 12,
CONDITION_ALWAYS, 199, 0, 164,
FACING_SOUTH, 0, 64, 8, 336, 272, 0 },
2096 { 20,
CONDITION_ALWAYS, 192, 0, 168,
FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2097 { 21,
CONDITION_ALWAYS, 192, 0, 168,
FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2098 { 29,
CONDITION_ALWAYS, 200, 0, 240,
FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2099 { 32,
CONDITION_ALWAYS, 200, 0, 240,
FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2100 { 35,
CONDITION_ALWAYS, 200, 0, 240,
FACING_NORTH, 0, 128, 0, 320, 272, 0 },
Ability numbers, named from the English release.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void ObjectMotion_WaitForAnimationChange(u32 objectId)
Waits, at most 90 frames, for an actor's animation to change.
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.
The battle animation state, render objects and effect entries, and the palette buffer work.
struct BattleEffectBuffers * gPaletteBufferWork
The engine calls the debug menus import, and their palette swatch tiles.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
static void FieldUiTextResource_Initialize(struct MenuSprite *cursor, s32 *slot)
static void FieldUiTextResource_SetPosition(struct MenuSprite *cursor, s32 x, s32 y)
FacingObject, the view of an object that turns to face a target.
s32 CalculateFacingAngle(s32, s32)
Field effects, their scripts and the flags that spawn them.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
u32 Math_RemainderUnsigned(u32 dividend, u32 divisor)
static s32 Event_OpenMessage(s32 speaker, s32 flags)
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_SanctumOpen(s32 priest)
static void Actor_SetBuiltinAction(s32 actor, s32 action)
s32 Engine_EventChooseYesNo(s32 actor, 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_CameraMoveToActor(s32 actor, s32 pan)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
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)
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)
static void Event_ShowTwoMessagesAndWait(s32 speaker, s32 x, s32 y, s32 arg, s32 extra, s32 otherSpeaker, s32 otherX, s32 otherY, s32 otherArg, s32 otherExtra, s32 flags)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_ActorWaitForMove(s32 actor)
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)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
s32 Engine_MathCos(s32 angle)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
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)
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
#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)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
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_VAULT_THIEVES_JAILED
#define FLAG_REACHED_KALAY
Set whenever Kalay is entered; Vale's villagers then talk of the party's journey.
#define FLAG_SCENE_TEMP_00
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_KOLIMA_CURSE_LIFTED
#define FLAG_HYDROS_STATUES_DEFEATED
#define FLAG_SCENE_TEMP_01
#define FLAG_SANCTUM_QUEST_ACCEPTED
Isaac accepted the Great Healer's request to go to Sol Sanctum.
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
u32 gFrameTick
Counted up by every VBlank.
volatile u32 gFrameCount
Frames WaitFrames has finished.
static void Event_TalkToHealer(void)
Talking to the healer: across the counter from the south, the Sanctum's services; from elsewhere,...
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The screen blend's globals and the graphics routines.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
The hardware's I/O registers and their bits, as pret names them.
The keypad state the VBlank interrupt keeps.
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
The heaps: allocating and freeing blocks.
void Runtime_ReleaseHeapBlock(s32 slot)
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LABEL(n)
Branch destination.
#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_SYNC
Wait for arrival.
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
void Event_CallWithLastActiveObjectId(struct ScenePlacement *table)
Spawns the actors of a placement table after the last actor in use.
The object dispatcher's scripts: key checks, the player, the world map and the camera.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
@ PALETTE_TRANSFORM_SEPIA
#define ACTOR_ACTION_IDLE
The save workspace: slot headers and summaries.
static void Sanctum_StartCeremonyGroupMotion(void)
Starts the six group motions and waits for the final witness.
static void Event_AskAboutPsynergyChanges(void)
Talking to actor 10 after the party has left Vale: does Isaac feel a change in his Psynergy?
static void Event_TalkAboutGoldenStatue(void)
Talking to the attendant (actor 9) in Vale's Sanctum: about the golden statue and the healer.
static void Event_AskAboutNewAdepts(void)
Talking to actor 9 after the party grows: the actor asks about the new friends.
struct ScenePlacement gSanctum_PlacementD[]
struct ScenePlacement gSanctum_PlacementA[]
static void Sanctum_RaiseItemIcon(s32 item, s32 fixedX, s32 fixedY, s32 fixedZ)
Shows an item icon rising from the supplied fixed-point position.
s32 gSanctum_SparkEndScript[]
static void Sanctum_SpawnOrbitingEffect(s32 ownerId, s32 angleStep)
Creates an orbiting effect with the requested angular step.
s32 gSanctum_ItemIconEndScript[]
struct SceneEvent gSanctum_SceneTableF[]
static void Sanctum_SpawnActorSpark(s32 id)
Creates a short-lived spark beside the specified actor.
static void Sanctum_ShowHealerAfterimage(void)
Copies the healer into the afterimage actor.
static void Event_TalkToHealerOnVisit(void)
Talking to the healer on a later visit: healing from the front, otherwise words for this visit.
struct ScenePlacement gSanctum_PlacementSequenceB[]
static void Sanctum_UpdateOrbitingEffect(union FieldObject *fieldObject)
Advances an effect around its linked actor on an elliptical path.
struct ScenePlacement gSanctum_PlacementE[]
static void Sanctum_HideHealerAfterimage(void)
struct SceneEvent gSanctum_SceneTableH[]
static void Event_TalkAboutCurse(void)
Talking to this sanctum's healer: about the curse, lifted or not.
static void Sanctum_UpdateHealerAfterimage(union FieldObject *fieldObject)
Cycles the afterimage through four offsets from the healer.
static void Sanctum_UpdateRisingSpark(union FieldObject *object)
Moves a spark upward, cycles its scale, and expires its lifetime.
s32 Sanctum_Initialize(void)
Prepares the current visit and starts its opening scene.
struct SceneEvent gSanctum_SceneTableA[]
static void Sanctum_ReceiveWiseOnesMission(void)
Brings in the Wise One and prepares the party for its mission.
static void Sanctum_ReenactSolSanctum(void)
Has Isaac and Garet act out the events at Sol Sanctum.
const struct ScenePlacement * Sanctum_GetPlacements(void)
Chooses the actors for the current entrance.
const struct SceneEntrance * Sanctum_GetEntrances(void)
Returns the entrances shared by all Sanctum visits.
static void Sanctum_NodCeremonyGroup(void)
Has the party and four witnesses nod, waiting for the final witness.
static s32 Sanctum_ChooseRestartOption(void)
Offers the refusal ending's restart choices and returns the selection.
s32 gSanctum_OwnerEffectScript[]
static void Sanctum_RestoreCeremonyFloor(void)
Restores the two floor rectangles changed during the ceremony.
static void Event_ReconsiderQuest(void)
Talking to the Great Healer after refusing: changing his mind, Isaac accepts after all.
static s32 Sanctum_IsLeaderFacingHealer(void)
struct SceneEvent gSanctum_SceneTableC[]
static void Event_LeaveAfterRefusing(void)
Leaving after refusing: the room turns sepia and the game offers to start again.
struct ScenePlacement gSanctum_PlacementC[]
struct SceneEvent gSanctum_SceneTableB[]
struct SceneEvent gSanctum_SceneTableD[]
const u32 * Sanctum_GetExits(void)
static s32 Sanctum_FaceActorNamedByTimer(union FieldObject *fieldObject)
Faces the actor whose ID this callback stores in the timer field.
static void Sanctum_RequestQuestAcceptance(void)
Discusses Sol Sanctum and asks Isaac to accept the quest.
const struct SceneRegion * Sanctum_GetRegions(void)
#define SANCTUM_NEW_FRIENDS_SPEAKER
@ ACTOR_HEALER_AFTERIMAGE
s32 gSanctum_ItemIconGrowScript[]
struct SceneEntrance gSanctum_Entrances[]
static void Event_TalkAboutAltinMonsters(void)
Talking to this sanctum's healer: about the monsters, and the party's help in Altin.
static void Event_ReadMindAboutGoldenStatue(void)
Reading the attendant's mind (actor 9): about the statue and Psynergy.
struct SceneEvent gSanctum_SceneTableG[]
u32 gSanctum_LeaderCircleScript[]
struct SceneEvent gSanctum_SceneTableI[]
struct SceneEvent gSanctum_SceneTableE[]
struct ScenePlacement gSanctum_PlacementB[]
static void Sanctum_ShowCeremonyGroupEmotes(void)
Shows the same foreground reaction on the party and four witnesses.
static void Event_WarnBeforeLeaving(void)
Walking toward the door after refusing: the Great Healer warns that the choice is final.
u32 gSanctum_GaretCircleScript[]
static s32 Sanctum_MatchLeaderPriority(union FieldObject *fieldObject)
Keeps this actor at the party leader's drawing priority.
const struct SceneEvent * Sanctum_GetEvents(void)
Chooses interactions for the entrance and current story flags.
static void Event_TalkAboutJourneyFromXian(void)
Talking to this sanctum's healer, come from Xian.
void UiTextResource_Release(s32 value)
Frees an arrow sprite's tile slot.
Song and sound effect ids, indices into gSound_SongTable.
void AudioCommand_WaitForCompletion(void)
Waits a frame at a time for fanfare restoration, giving up after 300 frames.
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()
One animation layer of a sprite: its animation id, frames, running script and timer.
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
u8 * script
the running script; null when stopped (ANIM_CMD_END)
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.
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 count
layers in use, up to the last one present
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
u16 fullColor
256 colours; set for both parts when created
u16 priority
2 when created
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
u16 target[0x540]
the colours current moves toward, as current
u8 padding2a03
never named
u8 page
the packed page queued this frame
s8 duration
frames; 0 when the colours are not moving
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,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
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
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.
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 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
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...
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
void UiText_DrawResource(s32 message, struct UiWindow *window, s32 x, s32 y)
Decodes a message and draws it into a text canvas window at pixel (x, y).
The integer types, TRUE, UNUSED and the fixed-address macros.
Declares nothing of its own: it only includes edition.h and uiwindow.h.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
s32 SaveState_CountRecordsExcludingFlagged(s32 excludeSent)
Returns how many save files there are, leaving out those whose summary has its send flag set when exc...
void Ui_PrepareTransferForItem(s32 code)
Draws an item's icon from its inventory code into the glyph work buffer.
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,...
The window renderer's work.
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...