34#include "text/msg_ids.h"
81#define NULL ((void *)0)
301 angle = (actor->
facing + 0x1000) & 0xe000;
342 actor->
y.
fixed -= 0x30000;
343 leader->
y.
fixed -= 0x30000;
346 actor->
y.
fixed -= 0x20000;
347 leader->
y.
fixed -= 0x20000;
350 actor->
y.
fixed += 0x20000;
351 leader->
y.
fixed += 0x20000;
354 actor->
y.
fixed += 0x20000;
355 leader->
y.
fixed += 0x20000;
358 actor->
y.
fixed += 0x10000;
359 leader->
y.
fixed += 0x10000;
1420 effectOptions = &options;
1423 effectOptions->
type = 0x11c;
1426 for (i = 0; i <= 31; i++) {
1437 left->
z.
fixed, 0, 0x40000, 0,
1450 right->
z.
fixed, 0, 0x40000, 0,
1475 effectOptions = &options;
1478 effectOptions->
type = 0x11c;
1481 for (i = 0; i <= 31; i++) {
1492 left->
z.
fixed, 0, -0x40000, 0,
1505 right->
z.
fixed, 0, -0x40000, 0,
1529 for (slot = 0; slot <= 65; slot++) {
1536 if (cell >= 4 && cell <= 8 &&
y + 8 <= row && row <
y + 11)
1555 for (i = 0; i <= 4; i++)
1559 for (i = 0; i <= 4; i++) {
1566 for (i = 0; i <= 227; i++) {
1568 for (j = 0; j < n; j++) {
1575 if (speed > 0x17fff)
1579 for (i = 0; i < n; i++)
1596 for (i = 0; i <= 4; i++)
1599 for (i = 0; i <= 4; i++) {
1606 for (i = 0; i <= 85; i++) {
1608 for (j = 0; j < n; j++) {
1613 if ((i & 3) == 3 && i > 75)
1643 object->coordinate08 =
1646 object->coordinate38 =
object->coordinate08;
1647 object->coordinate40 =
object->coordinate10;
1648 object->angle64 -= 0x200;
1696 if (beacon ==
NULL) {
1704 0x11c, beacon->
x.
fixed + 0x80000, beacon->
y.
fixed + height + 0x80000,
1706 height = height / 0x60000;
1708 if (spark ==
NULL) {
1751 {0,
CONDITION_ALWAYS, 172, 0, 149,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1752 {1,
CONDITION_ALWAYS, 8, 0, 8,
FACING_SOUTH, 0, 0, 0, 608, 424, 0},
1753 {2,
CONDITION_ALWAYS, 8, 0, 8,
FACING_SOUTH, 0, 0, 0, 608, 424, 0},
1754 {5,
CONDITION_ALWAYS, 504, 0, 152,
FACING_SOUTH, 0, 0, 0, 608, 424, 0},
1755 {51,
CONDITION_ALWAYS, 504, 0, 168,
FACING_SOUTH, 0, 0, 0, 608, 424, 0},
Ability numbers, named from the English release.
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.
const s32 * gEffectScripts[]
The engine calls the debug menus import, and their palette swatch tiles.
The engine call layer: one typed inline for each of the thirteen main-image routines below that the s...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
static s32 FieldObject_CheckMovementCollision(struct FieldActor *actor, struct FieldPosition *position)
@ 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,...
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)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
void Engine_PsynergyBegin(s32 ability, s32 flags)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
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_CameraMoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
void Engine_PsynergyRaiseHands(void)
void Engine_PsynergyLowerHands(void)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
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_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
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.
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_PsynergyPlayEffect(s32 effect)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
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_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_PsynergySetTarget(s32 caster, s32 target)
static struct FieldActor * Actor_Get(s32 actor)
static void ColorBuffer_ApplySource(s32 value, s32 mode)
Field objects and actors, and the scene transition styles.
@ TRANSITION_BACKDROP_FADE
#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 FIND_PSYNERGY_STONE
#define SCENE_EXIT(exit, scene, entrance)
#define EVENT_SCRIPT(script)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
Game flags, named where their meaning is shown.
#define FLAG_MERCURY_LIGHTHOUSE_LIT
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_SCENE_TEMP_00
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_MERCURY_AERIE_CONFRONTATION_DONE
The aerie's confrontation with Saturos, the battle and Alex's visit are over; set with FLAG_SATUROS_B...
#define FLAG_SATUROS_BEATEN_AT_MERCURY
Saturos is beaten at Mercury Lighthouse: the Hermes fountain at its foot flows again.
#define FLAG_SCENE_TEMP_50
volatile u32 gFrameCount
Frames WaitFrames has finished.
GameState, the game's state: play time, coins, the scene and the leader's position,...
#define Battle_SetStart(mode)
Sets the battle start type.
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
@ ACTOR_FIRST_PLATFORM
The platforms, in each platform room.
The main-image routines scene overlays import.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
Small statement macros both games use for positions, velocities and bounds.
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
const struct ScenePlacement * MercuryLighthouseAerie_GetPlacements(void)
The actors; only the first arrival places Jenna, Kraden, Felix and Menardi.
s32 MercuryLighthouseAerie_Initialize(void)
On arriving: the beacon flickers and the six platforms sit 50 pixels down; the first arrival (entranc...
static void MercuryLighthouseAerie_ConfrontSaturos(void)
Touching trigger 5 before the confrontation: Garet sees the lighthouse is lit.
static void MercuryLighthouseAerie_RaiseLift(void)
The lift rises with everything standing on it, slowing at the top.
struct SceneEntrance gMercuryLighthouseAerieEntrances[]
@ FLAG_ON_PLATFORM
The leader stands on a platform, which has dipped under the weight.
@ FLAG_HOSTAGES_GONE
Set on every arrival but the first: Jenna, Kraden, Felix and Menardi are placed only before it.
const struct SceneRegion * MercuryLighthouseAerie_GetRegions(void)
static void MercuryLighthouseAerie_RideLiftDown(void)
Touching trigger 12: the leader steps onto the lift and rides it down to the lighthouse's foot (exit ...
struct SceneEvent gMercuryLighthouseAerieEvents[]
static void MercuryLighthouseAerie_AlexAppears(void)
Entrance 2, back from the battle, unless resuming: Saturos is beaten, but not for long.
struct ScenePlacement gMercuryLighthouseAeriePlacements[]
static void MercuryLighthouseAerie_SaturosAndAlexWarpOut(void)
Saturos and Alex warp out in a column of sparkles and vanish.
static void MercuryLighthouseAerie_FlickerBeacon(void)
Every frame: while the view is near the top the beacon flame flickers between two sizes,...
static void MercuryLighthouseAerie_LowerLift(void)
The lift sinks with everything standing on it, speeding up.
static void MercuryLighthouseAerie_FindLiftRiders(s32 *out, s32 y)
MercuryLighthouseAerie_LowerLift passes its lift as a third argument, which this function does not ta...
const struct SceneEvent * MercuryLighthouseAerie_GetEvents(void)
u32 gMercuryLighthouseAerieExits[]
static void SceneEffect_UpdateArcPosition(union FieldObject *fieldObject)
A beacon spark's update: it swings round the flame, its angle stepping back each frame.
s32 gMercuryLighthouseAerie_SparkScript[]
static void MercuryLighthouseAerie_SettlePlatforms(void)
Touching trigger 11: the leader walks normally again and the platforms stop following.
MercuryLighthouseAerieActor
The aerie's actors.
@ ACTOR_LIFT_PLATFORM_1
The two platforms that stand on the lift and go up and down with it.
@ ACTOR_BEACON_FLAME
flickers and sheds sparks
static void MercuryLighthouseAerie_JumpToPlatform(void)
Walking into trigger 10 or 11: if nothing is in the way the leader jumps two cells ahead,...
const struct SceneEntrance * MercuryLighthouseAerie_GetEntrances(void)
static UNUSED void MercuryLighthouseAerie_AlexCastsPly(void)
Alex casts Ply on the statue; nothing calls it.
static void MercuryLighthouseAerie_CallLift(void)
Touching trigger 6 while the lift is down: the camera watches it rise with its statue.
const u32 * MercuryLighthouseAerie_GetExits(void)
One exit: the lift down to the lighthouse's foot.
s32 gMercuryLighthouseAerie_PlatformUnderfoot
static void MercuryLighthouseAerie_PartyArrives(void)
Entrance 1, unless resuming: the Adepts of lit elements regain their PP; the aerie shakes,...
static void MercuryLighthouseAerie_StepOntoPlatform(void)
Touching trigger 10 when not already on one: the platform underfoot dips with the leader and bobs bac...
static void MercuryLighthouseAerie_SaturosAndAlexWarpIn(void)
Saturos and Alex warp in where they have been placed.
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.
void BattleEffect_CleanupSceneObjects(void)
Ends a Psynergy effect: frees the effect slots still in use and, unless another effect is being resol...
Overlay objects and their records.
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone.
void Event_SetNextDestination(s32 scene, s32 entrance)
Sets the scene and entrance that the field goes to next (gGameState.nextScene and nextEntrance).
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
Scene numbers, named after their places.
char SceneId_MercuryLighthouseAerie1
Song and sound effect ids, indices into gSound_SongTable.
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
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()
s32 SceneActor_FindNearestSlotOfKindF2(void)
Returns the placed actor drawn with sprite 0xf2 nearest the leader, within 640 pixels,...
The event work, seen for its table of the scene's 66 actor slots.
struct FieldActor * actors[66]
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)
u16 priority
2 when created
A spark the beacon flame throws off, swinging round the flame on its arc.
struct FieldActor * source
struct AnimationObject * sprite
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).
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
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 terrainHeight
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
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
s32 z
16.16 fixed-point pixels
A field object as a Mercury Lighthouse beacon spark sees it: its position and target,...
s32 coordinate08
16.16 fixed-point pixels
struct OverlayObject * linkedObject
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.
A field coordinate, read whole or as its fraction and its whole pixels.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
void Party_RestorePpOfLitElements(void)
Restores the PP of each party member whose element group has a lit lighthouse: Venus or Mars for grou...