32#include "text/msg_ids.h"
76#define ELEMENTAL_ARC_SCALE_X_DECREASE 7372
77#define EMBER_EMISSION_DISABLED 999
78#define ARC_SCAN_STILL_ACTIVE 888
134 sparkles = *particleWorkSlot;
151 eventWorkSlot = (
struct EventWork **)((
u8 *)particleWorkSlot - 8);
158 (*eventWorkSlot)->transitionFrames = 8;
544 }
while (frame != 60);
555 }
while (frame != 90);
579 actor->sprite->rotation = actor->
facing + 0x4000;
593 for (rockIndex = 16; rockIndex <= 31; rockIndex++) {
598 actor->sprite->image.priority = 0;
609 for (rockIndex = 0; rockIndex <= 15; rockIndex++) {
611 sprite = spun->sprite;
612 angle = rockIndex << 12;
621 for (rockIndex = 16; rockIndex <= 31; rockIndex++) {
646 for (emberIndex = 0; emberIndex < 16; emberIndex++) {
668 if (shakePixels != 0) {
679 for (emberIndex = 0; emberIndex < 16; emberIndex++) {
707 for (emberIndex = 0; emberIndex < 16; emberIndex++) {
718 ember->sprite->image.priority = 1;
759 switch (emissionLevel) {
819 for (rockIndex = 0; rockIndex <
ROCK_COUNT; rockIndex++) {
851 leaderSprite = leader->sprite;
852 garetSprite = garet->sprite;
853 for (frame = 0; frame < 20; frame++) {
1158 for (frame = 0; frame < 40; frame++) {
1171 while (flickerDelay--) {
1231 starSprite = star->sprite;
1232 starSprite->
flags = 0;
1233 starSprite->
count = 0;
1245 for (frame = 0; frame < 24; frame++) {
1337 for (frame = 0; frame < 40; frame++) {
1350 while (flickerDelay--) {
1373 for (frame = 0; frame < 40; frame++) {
1386 while (flickerDelay--) {
1425 for (frame = 0; frame < 40; frame++) {
1465 if (alternate != 0) {
1484 if (alternate != 0) {
1527 u32 arcIndex, clear;
1533 for (arcIndex = 0; arcIndex <= 15; arcIndex++)
1554 arcIndex++, origin += 2) {
1580 sprite = actor->sprite;
1581 sprite->
flags = clear;
1614 for (arcIndex = 0; arcIndex <= 9; arcIndex++) {
1638 for (arcIndex = 0; arcIndex <= 9; arcIndex++) {
1642 if ((
u32)age <= 8) {
1653 if ((
u32)age > 14) {
1709 if (waitFrames != 0) {
1749 for (effectIndex = 0; effectIndex < 2; ++effectIndex) {
1752 pair[effectIndex] =
child;
1755 sprite =
child->sprite;
1756 child->motionFlags = 0;
1758 child->linkedObject = parent;
1759 if (sprite !=
NULL) {
1774 pair[0]->
update = Effect_AnimateVerticalNegative;
1775 pair[0]->sprite->image.priority =
1781 risingEffect->sprite->image.priority = wiseOne->sprite->image.priority;
1782 risingEffect->
update = Effect_AnimateVerticalPositive;
1825 { 0,
CONDITION_ALWAYS, 472, 0, 322,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
1896 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,
1949 655, 458, 655, 458, 655, 458, 655, 655,
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
s32 AnimationObjects_SelectAnimation(struct AnimationObject *sprite, s32 animation)
Starts animation flags & 0x7f on every layer of a sprite (bit 7 keeps each layer's place and timer),...
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
B5Context, the object context a battle routine reads; most of its fields are still unnamed.
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.
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,...
void Engine_ObjectSetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
#define SPEAKER_PORTRAIT_LEFT
u32 Math_RemainderUnsigned(u32 dividend, u32 divisor)
static s32 Event_OpenMessage(s32 speaker, s32 flags)
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 Object_SetMode(struct FieldActor *object, s32 animation)
#define SPEAKER_WINDOW_ABOVE
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_ObjectSetPartPalettes(struct FieldActor *object, s32 palette)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
#define SPEAKER_PORTRAIT_RIGHT
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)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
void Engine_ItemLoadIcon(s32 item)
s32 Engine_MathSin(s32 angle)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
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)
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)
void Engine_ActorDestroy(s32 actor)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_EventOpenScreen(void)
void Engine_MapRenderWaitForValues(void)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
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)
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.
#define MAP_CELL_STEPS_END
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
void Engine_RunRisingObjectSequence(struct FieldActor *object, s32 mode)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
struct FieldActor * Engine_EventGetViewCenter(void)
s32 Engine_MathCos(s32 angle)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ObjectMotionSetPositionAndCommit(s32 actor, s32 x, s32 z)
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)
static struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
@ 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)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static s32 Task_AddCallback(void(*callback)(void), s32 priority)
Calls the main-image scheduler through engine_call.h.
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_ERUPTED
The volcano has erupted and the sanctum's rooms rumble and shake.
#define FLAG_SOL_SANCTUM_STAR_ROOM_COLLAPSED
#define FLAG_SCENE_TEMP_46
volatile u32 gFrameCount
Frames WaitFrames has finished.
BattleFxScene, the work of a battle or field Psynergy effect scene, and its arc objects.
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.
void * gEffectWork
Slot 56: points to a scene-specific structure.
The screen blend's globals and the graphics routines.
Item numbers, named from the English release.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
#define Iwram_MulQ16(left, right)
Small statement macros both games use for positions, velocities and bounds.
#define SET_VELOCITY(p, vx, vy, vz)
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_WAIT(n)
Wait n frames.
#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.
struct GroundParticleWork * gParticleWork
Palette fades, the battle effect palette buffers and the colour channel curves.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
The field object script interpreter and the operands its commands read.
s8 gSolSanctum_RingDirection[][3]
s32 gSolSanctumRing_ScaleSteps[]
s32 gSolSanctumRing_MaxScales[]
u8 gSolSanctum_RingSwing[][3]
u8 gSolSanctum_RingDrift[][3]
static void SolSanctumEruption_DrawFirstCollapseTiles(s32 alternate)
Selects the first collapsing tile patch and redraws the map.
struct SceneEvent gSolSanctumEruption_Events[]
const struct ScenePlacement * SolSanctumEruption_GetPlacements(void)
Returns Garet and Jenna, then the departure glow (actor 8), Kraden, Saturos, Menardi,...
static void SolSanctumEruption_SpawnEffectPair(struct FieldActor *parent)
Creates two vertical effects sharing the parent position and cached tiles.
static UNUSED void SolSanctumEruption_UnusedCallbackA(void)
#define ARC_SCAN_STILL_ACTIVE
s32 gEruption_EmberScript[]
const struct SceneEntrance * SolSanctumEruption_GetEntrances(void)
const struct SceneRegion * SolSanctumEruption_GetRegions(void)
static void SolSanctumEruption_FadeCameraTo(s32 x, s32 z)
Fades out, moves the camera and its focus actor, then fades back in.
static void SolSanctumEruption_ThrowEruptionRing(void)
Launches sixteen rocks outward, then resets their actors for ember emission.
static void SolSanctumEruption_PlayWiseOneRescue(void)
Left behind, Isaac and Garet face the Wise One, who makes the Mars Star glow, warns them of Alchemy's...
static void SolSanctumEruption_PlaceHostageGroup(void)
Stages Saturos, Menardi, Alex and Felix around Jenna and Kraden.
static void SolSanctumEruption_SetMaterializationTint(s32 enabled, s32 frames, s32 waitFrames)
Fades the object palette into or out of the materialization tint.
static void SolSanctumEruption_RaiseElementalArcs(u32 mode)
Stages and raises ten arc effects at one of the four chamber positions.
#define EMBER_EMISSION_DISABLED
u16 gSolSanctumEruption_StarCells[]
s32 SolSanctumEruption_Initialize(void)
Plays the eruption at entrance 10, the arrival from the Elemental Star room.
static void SolSanctumEruption_UpdateElementalArcs(void)
Stretches each active arc for eight frames, then lifts it out of view.
const u32 * SolSanctumEruption_GetExits(void)
static void SolSanctumEruption_ResetEmberEmission(void)
Resets the sixteen ember slots and their emission timers.
static UNUSED void SolSanctumEruption_UnusedCallbackB(void)
static void SolSanctumEruption_UpdateWiseOnePalette(void)
Cycles the Wise One's palette while it glows.
static void SolSanctumEruption_CycleActorPalette(struct FieldActor *actor)
Cycles six palettes while spawning the actor's vertical effects.
static void SolSanctumEruption_FlickerSecondCollapseTiles(void)
Randomly alternates the second tile patch on even frames, as the first.
const struct SceneEvent * SolSanctumEruption_GetEvents(void)
Returns the empty event table: the scene is one cutscene.
s32 gEruption_ArcOriginsHead[]
static void SolSanctumEruption_FlashMaterializingActor(struct FieldActor *actor)
Flashes the palette and spawns paired vertical effects every sixteen frames.
s32 gEruption_ArcOrigins[]
struct SceneEntrance gSolSanctumEruption_Entrances[]
struct ScenePlacement gSolSanctumEruption_Placements[]
static void SolSanctumEruption_DrawSecondCollapseTiles(s32 alternate)
Selects the second collapsing tile patch and redraws the map.
static void SolSanctumEruption_StepEmbers(void)
Retires landed embers and launches the next free one at the current frequency, shaking the map after ...
static void SolSanctumEruption_FlickerFirstCollapseTiles(void)
Randomly alternates the first tile patch on even frames.
static s32 SolSanctumEruption_AlignEmberToHeading(struct ScriptInterpreter *interpreter)
Keeps a flying ember sprite rotated a quarter-turn from its facing.
static void SolSanctumEruption_FinishMaterialization(void)
Ends the Wise One's palette animation and clears its attached effect.
u32 gSolSanctumEruption_Exits[]
static void SolSanctumEruption_PlaceBeforeStar(s32 actor)
Places an actor before the star, facing south, and draws it above the chamber floor.
static void SolSanctumEruption_RestoreCornerCellAttributes(void)
Restores eight corner-cell attributes from the chamber templates.
static void SolSanctumEruption_UpdateEmberFrequency(void)
Varies the ember emission interval and its duration.
static void SolSanctumEruption_PlayHostageScene(void)
Saturos's group argues over the Mars Star and leaves with Jenna and Kraden as hostages,...
#define ELEMENTAL_ARC_SCALE_X_DECREASE
static void SolSanctumEruption_RaiseAndShrinkActor(s32 actorId)
Lifts one departing actor and shrinks it together with the paired effect.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_SCENE_TRANSITION
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
Vale, its home, storm and Babi scenes, Sol Sanctum's eruption and Venus Lighthouse's aerie: Psynergy ...
void Scene_EndCutscenePsynergy(void)
Ends the cutscene's Psynergy and releases its effect work.
void Scene_BeginCutscenePsynergy(void)
Prepares the effect work and spark tiles of Move (ability 140) for the cutscene's Psynergy.
struct FieldActor * gArcEffects[]
u8 frame
frame shown, frameBase plus the facing offset; 255 none
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u16 rotation
1/65536 turns
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 retainCacheEntry
Keeps the VRAM cache entry when it is released or off screen.
u16 fullColor
256 colours; set for both parts when created
u16 tile
first sprite tile in VRAM
u16 priority
2 when created
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
u16 tileSlot
resource entry holding the spark tiles
void * child
the target's object, or NULL
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s32 transitionFrames
frames
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
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
s32 velocityX
16.16 fixed-point pixels per frame
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 terrainHeight
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 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.
s32 velocityZ
16.16 fixed-point pixels per frame
Work slot 29 while ground particles, motes or sparkles run.
s32 stopped
Prevent new sparkle bursts while set.
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 prefix that command handlers read from a field object's 0x70-byte slot.
u16 offset
bytes from the start of OBJ VRAM
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
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
The sprite VRAM block cache and its owners.
struct VramBlockCacheEntry gVramBlockCache[]
void FieldEffect_InitSparkles(void)
Starts the sparkles (FieldEffect_UpdateSparkles): loads their tiles and clears the 32 sparkles.