41#include "text/msg_ids.h"
128 while (record->
sprite != -1) {
129 piece = record->
actor;
168 volatile u32 *destination;
172 destination = (
volatile u32 *)0x04000014;
174 if (line == 227 || line <= 52) {
181 *destination = *source++;
182 destination = (
volatile u32 *)0x04000018;
183 *destination++ = *source++;
184 *destination = *source;
195 *destination++ = *source++;
196 *destination++ = *source++;
197 *destination = *source;
284 }
while (nextShakeChance <= 100);
399 for (; entry->
sprite != -1; entry++) {
401 x = (entry->
x << 20) + 0x200000;
402 z = (entry->
z << 20) + 0x80000;
404 x = (entry->
x << 20) + 0x80000;
405 z = (entry->
z << 20) + 0x200000;
410 entry->
actor = actor;
420 *(
s32 *)&actor->
y += height;
428 const struct BendLog *record = records;
432 s32 column = record->
x;
436 for (i = 3; i >= 0; i--) {
446 }
while (record->
sprite != -1);
452 while (run->
sprite != -1) {
475 for (i = 0; i <= 3; i++) {
512 point[2] / 0x100000);
515 for (i = 0; i <= 10; i++) {
516 point[0] = run->
x << 20;
517 point[2] = run->
z << 20;
524 x = point[0] + 0x200000;
525 z = point[2] + 0x80000;
527 x = point[0] + 0x80000;
528 z = point[2] + 0x200000;
530 run->
x = point[0] / 0x100000;
531 run->
z = point[2] / 0x100000;
539 quarter = facing / 0x4000;
571 {0xcd, 11, 9, 1,
NULL},
572 {0xcf, 12, 12, 0,
NULL},
573 {0xcf, 17, 12, 0,
NULL},
574 {0xcd, 13, 13, 1,
NULL},
575 {0xcf, 10, 18, 0,
NULL},
586 { 0,
CONDITION_ALWAYS, 407, 0, 276,
FACING_WEST, 0, -1, -1, -1, -1, 0 },
587 { 1,
CONDITION_ALWAYS, 50, 32, 369,
FACING_EAST, 0, -1, -1, -1, -1, 0 },
588 { 2,
CONDITION_ALWAYS, 162, 32, 84,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
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.
Calls through a function pointer, by argument count.
s32 Field_TryJumpForward(void)
Makes the leader jump two tiles forward, over the tile in front, when the map allows it (Map_CheckObj...
The engine calls the debug menus import, and their palette swatch tiles.
DMA channel registers, and the DMA and CPU fills.
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
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.
void ObjectDispatch_StartCamera(struct DispatchObject *object, s32 linkedObjectHandle)
Starts an object on the camera script (SC_CAMERA).
s16 * gKolimaForestBendLayout
struct BendLog * gKolimaForestBendRecords
u32 gKolimaForestBend_ShakeScroll[]
u16 * gKolimaForestBendReturned
u32 gKolimaForestBend_ShakeChance
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)
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
static void Event_PlayCue(s32 cue)
static void Map_CopyCells(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
s32 Engine_GameFlagIsSet(s32 flag)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_ActorSetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_EventWait(s32 frames)
#define SCENE_TRANSITION(style, variant)
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 EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define TOUCH_WALKING_INTO(facing)
Game flags, named where their meaning is shown.
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_KOLIMA_CURSE_LIFTED
void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler)
Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and...
struct EffectStep gMapCellBuffer[]
Map cells; battle effects reuse this as a particle array.
The screen blend's globals and the graphics routines.
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
The heap's work slots and HeapState.
The main-image routines scene overlays import.
The hardware's I/O registers and their bits, as pret names them.
The hardware's interrupt sources and the interrupt handler table.
Item numbers, named from the English release.
static void KolimaForestBend_DrawWaterLevel(void)
Draws the river at its level and sets each log to match: high water floats the logs 26 pixels up over...
const struct SceneRegion * KolimaForestBend_GetRegions(void)
static void KolimaForestBend_ShakeLines(void)
HBlank callback: selects the captured shake scroll above the split line.
struct SceneEvent gKolimaForestBendEvents[]
u8 gKolimaForestBend_PushAnimations[]
const struct SceneEntrance * KolimaForestBend_GetEntrances(void)
Where the party enters from the river and from Tret's tree.
struct BendLog gKolimaForestBend_DefaultRecords[]
The logs on a first visit, as struct BendLog: sprite 0xcd runs north to south and 0xcf west to east.
static void KolimaForestBend_PushShortLogWest(void)
Walking west into the short log: the leader shoves it west to x 72.
static void KolimaForestBend_PushShortLogEast(void)
Walking east into the short log: the leader shoves it east to x 104.
@ SHORT_LOG
slides between x 72 and x 104
@ SIGN
reads a warning. "Do not touch Floodgate Switch!"
u32 gKolimaForestBendExits[]
Exit 1 to the river (scene 42), exit 2 to Tret's tree (scene 44).
static void KolimaForestBend_MarkShortLogCells(void)
Gives the short log's column of cells its collision: column 4 at the west place, column 6 at the east...
static void KolimaForestBend_CaptureShakeScroll(void)
Captures three background scroll pairs and adds the vertical shake offset.
struct ScenePlacement gKolimaForestBendPlacements[]
struct SceneEntrance gKolimaForestBendEntrances[]
static void KolimaForestBend_JumpSouth(void)
Walking south into the gap: the leader jumps across.
static void KolimaForestBend_FlipFloodgateSwitch(void)
Searching the floodgate switch flips it.
s8 gKolimaForestBend_PushStepX[]
static void KolimaForestBend_RollLog(struct BendLog *logs)
Finds the log ahead of the leader and rolls it on, a cell at a time, up to eleven cells or until a ce...
static void KolimaForestBend_CreateLogs(struct BendLog *log)
Makes each log at the middle of its four cells, standing on the ground.
s32 KolimaForestBend_Initialize(void)
On entry: the logs' records come back from gSceneState, or on a first visit from the defaults with th...
const struct SceneEvent * KolimaForestBend_GetEvents(void)
The logs, the switch, the sign, the jump and the chest.
static struct BendLog * KolimaForestBend_FindLogAt(struct BendLog *run, s32 x, s32 y)
The log lying across the cell, or none.
const u32 * KolimaForestBend_GetExits(void)
The paths back to the river and on to Tret's tree.
static s32 KolimaForestBend_CheckLogFits(s32 x, s32 z, s32 mode)
Whether four cells from the one given, across or down, are free for a log: none is marked 0xff or hol...
void State_StampRecordCells(const struct BendLog *records, s32 value)
Writes a collision code into the four cells of each log.
s8 gKolimaForestBend_PushStepZ[]
static void KolimaForestBend_PushLog(void)
Walking into a log: it rolls ahead, and the cells of the logs are marked again where they now lie.
const struct ScenePlacement * KolimaForestBend_GetPlacements(void)
The short log, the switch and the sign.
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,...
Maps: their cells, layers, animations and blend scripts, and the map state.
static void Map_DrawCellPanel(s32 x, s32 y, s32 width, s32 height, s32 plane, s32 destX, s32 destY)
Draws the width by height cells at cell (x, y) of the map into screen block 5 from cell (destX,...
Declares nothing of its own: it only includes edition.h and types.h.
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 heaps: allocating and freeing blocks.
The reel game's title lettering.
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
FIELD_AT_OFFSET and the entity and camera views older scene code reads.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void KolimaPalette_Curse(s32 strength)
Keeps the healthy colours, curses the background palettes 0 to 13 (all but colours 1 to 7 of palette ...
A log's saved record: its sprite, first map cell and orientation, then its actor once created.
s16 sprite
sprite number; -1 ends the list
struct FieldActor * actor
created for this row; NULL in the defaults
s16 vertical
nonzero runs north to south; zero west to east
A field object as the object dispatcher's far calls take it.
s32 startTransition
SCENE_TRANSITION(style, variant).
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
u16 radius
Collision radius in pixels: 16, or half the sprite metadata's boxY, when created; the overlap checks ...
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 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 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...
Full event work allocated by Field_RunScene (heap slot 27).
struct ObjectRuntime * camera
the object the map view follows
One cell of a map layer: its metatile and flags, its collision code and an attribute indexing the col...
u8 attributeB
Indexes the 4-byte collision entries (gMapCollision): terrain kind in the first byte's low four bits,...
u8 collisionCode
The step code: 1 to 239 scene events, 240 and 241 encounter ground, 250 hazard, 252 to 254 for Field_...
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.
s32 Map_GetTerrainHeight(s32 layer, s32 x, s32 y)
Returns the ground height of a layer at (x, y) in 16.16 pixels: the height function of the cell's ter...
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels