35#include "text/msg_ids.h"
148 if (waterOwner != -1) {
150 u16 requestPrompt = 1;
152 *stateSlot = requestPrompt;
297 void (*spawnOrbitSparks)(void);
298 const s32 *finalActions;
319 if (includeMia != 0) {
354 if (*paletteFrame != 24) {
357 }
while (*paletteFrame != 24);
371 }
while ((
u32)flash <= 3);
440 if (includeMia != 0) {
631 if (includeMia != 0) {
716 sprite = effect->sprite;
717 sprite->
flags = phase;
738 }
else if (step == 20) {
862 spark->
x.
fixed = position[0];
863 spark->
y.
fixed = position[1];
864 spark->
z.
fixed = position[2];
880 previousSprite =
NULL;
888 for (sparkIndex = 0; sparkIndex <= 5; sparkIndex++) {
895 spark->sprite->image.priority = 1;
922 if (inventorySlot != -1) {
955 {0,
CONDITION_ALWAYS, 209, 0, 279,
FACING_SOUTH, 0, 0, 0, 512, 448, 0},
956 {1,
CONDITION_ALWAYS, 136, 0, 424,
FACING_NORTH, 0, 0, 0, 512, 448, 0},
957 {2,
CONDITION_ALWAYS, 328, 16, 200,
FACING_SOUTH, 0, 0, 0, 512, 448, 0},
963 {320, 88, 176, 336, 104, 192, -1, 2},
964 {-1, 0, 0, 0, 0, 0, 0, 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).
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
The battle animation state, render objects and effect entries, and the palette buffer work.
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it use...
Calls through a function pointer, by argument count.
Character numbers, with each character's Japanese name.
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.
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)
static s32 Event_OpenMessage(s32 speaker, s32 flags)
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_ActorWalkByAndWait(s32 actor, s32 dx, s32 dz)
#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_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)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
static void Actor_RunActionScriptAndWait(s32 actor, const s32 *script)
Runs a script, waiting at most 300 frames for its final command.
#define SPEAKER_WINDOW_BELOW
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_GameFlagSet(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_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)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
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_EventWait(s32 frames)
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 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 USE_ITEM_ON_ACTOR(item)
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_IN_PARTY(character)
Flags 0 to 7: the character with that id (character_ids.h) is in the party (Party_AddActiveOwner).
#define FLAG_KOLIMA_CURSE_LIFTED
#define FLAG_TRET_DEFEATED
volatile u32 gFrameCount
Frames WaitFrames has finished.
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.
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.
The hardware's I/O registers and their bits, as pret names them.
Item numbers, named from the English release.
static void KolimaForestTree_ReadLaurelThoughts(void)
Reads Laurel's thoughts about the healing water or the danger beyond the river.
static void KolimaForestTree_PlayGesture(s32 auxiliaryActorId, s32 gesture)
Chooses Tret or Laurel's facial sequence through their auxiliary actor.
static void KolimaForestTree_ReadTretThoughts(void)
Reads Tret's regret before healing, or his concern for the forest afterward.
s32 gKolimaForestTreeEffectScript[]
static void KolimaForestTree_UpdateOrbitSpark(union FieldObject *fieldObject)
Expands a spark along its spiral for 120 frames, then releases its cache slot.
static void KolimaForestTree_UseHermesWater(void)
Heals Tret only after his hostile heart has been defeated.
static __inline__ void KolimaForestTree_AlternateFaceFrames(s32 actorId, s32 firstFrame, s32 secondFrame)
Alternates two facial frames twice, ending on the first frame.
static UNUSED void KolimaForestTree_ExitTouchedRegion(void)
Takes the touched exit after completing the leader's current movement.
u32 gKolimaForestTreeExits[]
s32 KolimaForestTree_Initialize(void)
Restores the trees' faces, collision and the dying forest's palette.
s32 gKolimaForestTree_RejoinPartyActions[]
static void KolimaForestTree_RejectHermesWater(void)
Shows Tret's hostile heart repelling the leader's attempt to help.
static __inline__ void KolimaForestTree_NodTogether(void)
Gives all four companions the same nod, waiting on Ivan's animation.
static void KolimaForestTree_SpawnRejectionSpark(void)
Spawns the growing sparks that repel the party leader.
static void KolimaForestTree_TalkToLaurel(void)
Introduces Laurel or hears her warning while Tret is still dying.
s32 gKolimaForestTreePlaySparkSound
s32 gKolimaForestTreeSparkOrigin[3]
struct ScenePlacement gKolimaForestTreePlacements[]
struct SceneEntrance gKolimaForestTreeEntrances[]
const struct ScenePlacement * KolimaForestTree_GetPlacements(void)
Returns Tret, Laurel and their auxiliary actors.
static void KolimaForestTree_TalkToTret(void)
Talks to Tret and offers the item prompt when Hermes' Water is available.
static void KolimaForestTree_SpawnOrbitSparks(void)
Emits six-spark rings at ten-frame intervals during each burst.
struct SceneEvent gKolimaForestTreeEvents[]
struct SceneRegion gKolimaForestTreeRegions[]
s32 gKolimaForestTree_MiaApproachActions[]
static void KolimaForestTree_RestoreTret(void)
Heals Tret, lifts Kolima's curse and hears the trees' warning.
s32 gKolimaForestTreePaletteFrame
static __inline__ void KolimaForestTree_FaceParty(s32 facing, s32 waitFrames)
Turns the companions together and pauses after the final facing change.
s32 gKolimaForestTree_GaretApproachActions[]
s32 gKolimaForestTree_IvanApproachActions[]
const struct SceneEvent * KolimaForestTree_GetEvents(void)
Returns the trees' dialogue, Mind Read and item-use events.
const struct SceneEntrance * KolimaForestTree_GetEntrances(void)
s32 gKolimaForestTreeSparkFrame
static void KolimaForestTree_ReplaceInventoryItem(s32 oldItemId, s32 newItemId)
Replaces the used water with its empty bottle in the same inventory slot.
const u32 * KolimaForestTree_GetExits(void)
Returns the connections to the bridge and Tret's interior.
const struct SceneRegion * KolimaForestTree_GetRegions(void)
Returns the region at the entrance to Tret's interior.
static void KolimaForestTree_UpdateHealingPalette(void)
Alternates the saved healthy and withered palettes over thirty frames.
Kolima, its forest bridge and the forest's tree: an effect (object 26) that stretches as it travels.
static s32 SceneEffect_AdvanceAngleUntilIdle(struct ScriptInterpreter *interpreter)
An object script call: widen the object by 0x1eb8 (about 0.12) a frame, and release it once it has re...
Small statement macros both games use for positions, velocities and bounds.
#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,...
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,...
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_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 Battle_ResetEffectCounter(void)
Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs i...
struct AnimationObject * Sprite_ShareVramCache(struct AnimationObject *sourceSprite, struct AnimationObject *sharedSprite)
Makes sourceSprite share sharedSprite's VRAM block, releasing its own; with no sharedSprite it keeps ...
Palette fades, the battle effect palette buffers and the colour channel curves.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
Declares nothing of its own: it only includes types.h.
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
Scene numbers, named after their places.
char SceneId_KolimaForestBridge
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
void KolimaPalette_Restore(s32 second)
Makes the healthy colours (second 0) or the cursed ones (second 1) the colours to fade to; the scene ...
void KolimaPalette_Curse(s32 strength)
Keeps the healthy colours, curses the background palettes 0 to 13 (all but colours 1 to 7 of palette ...
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
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s32 startTransition
SCENE_TRANSITION(style, variant).
s16 touchedTrigger
the step event a touch or exit event answers
u16 unk172
FieldWork's menu request; scenes set it to 1.
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 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u16 radius
Collision radius in pixels: 16, or half the sprite metadata's boxY, when created; the overlap checks ...
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 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
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 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.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
s16 retreatEntrance
where Retreat goes; the group's first entrance
s16 retreatScene
where Retreat goes; the group's first entrance
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.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).