30#include "text/msg_ids.h"
244 if (exitIndex == 6) {
250 originOffset = exitIndex << 2;
252 column = *(
s16 *)(originBytes + originOffset);
253 rowOffset = originOffset + 2;
254 row = *(
s16 *)(originBytes + rowOffset);
259 if (exitIndex == 6) {
265 if (exitIndex == 4) {
284 if ((jillTree->
x.
fixed >> 20) == 6) {
295 leader->
scaleX = -0x10000;
302 leader->
scaleX = -0x10000;
309 leader->
scaleX = -0x10000;
467 if (entrance == 10) {
469 }
else if (entrance == 9) {
474 if (entrance == 11) {
497 blockRow = block->
z.
fixed >> 20;
498 leaderColumn = (leader->
x.
fixed >> 20);
499 leaderRow = (leader->
z.
fixed >> 20);
506 if ((blockX >> 20) != 16 || blockRow != 13) {
510 if (leaderColumn == 16) {
511 if (leaderRow == 13) {
516 if (blockRow == 13) {
542 if (populationState != 0) {
575 if (crossingState != 0) {
583 fallenTree->sprite->rotation = 0x4000;
584 fallenTree->
y.
fixed += -0x80000;
609 blockColumn = actor->
x.
fixed >> 20;
610 blockRow = actor->
z.
fixed >> 20;
613 for (cellOffset = 0; cellOffset < 20; cellOffset += 2) {
652 direction = leader->
facing >> 12;
653 block = SceneActor_FindActorAtCell(
660 destination.
y = block->
y.
fixed;
677 block->
x.
fixed = destination.
x;
678 block->
z.
fixed = destination.
z;
721 sprite = effect->sprite;
743 if (block->
z.
fixed >> 20 == 6)
748 if (block->
z.
fixed >> 20 == 9)
755 SC_CALL(Scene_TurnTowardTarget),
766 {1,
CONDITION_ALWAYS, 240, 0, 472,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
767 {2,
CONDITION_ALWAYS, 224, 0, 88,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
768 {3,
CONDITION_ALWAYS, 376, 0, 360,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
769 {4,
CONDITION_ALWAYS, 200, 0, 328,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
770 {5,
CONDITION_ALWAYS, 104, 0, 344,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
771 {6,
CONDITION_ALWAYS, 168, 0, 216,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
772 {7,
CONDITION_ALWAYS, 72, 0, 216,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
773 {8,
CONDITION_ALWAYS, 296, 0, 184,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
774 {9,
CONDITION_ALWAYS, 400, 0, 168,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
775 {10,
CONDITION_ALWAYS, 40, 0, 152,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
776 {11,
CONDITION_ALWAYS, 264, 0, 200,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
781 {0,
CONDITION_ALWAYS, 168, 0, 168,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
782 {1,
CONDITION_ALWAYS, 56, 0, 376,
FACING_EAST, 0, 16, 16, 400, 400, 0},
783 {2,
CONDITION_ALWAYS, 376, 0, 184,
FACING_WEST, 0, 16, 16, 400, 400, 0},
788 {0,
CONDITION_ALWAYS, 232, 0, 144,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
789 {1,
CONDITION_ALWAYS, 120, 0, 408,
FACING_NORTH, 0, 0, 288, 240, 448, 0},
790 {2,
CONDITION_ALWAYS, 120, 0, 384,
FACING_SOUTH, 0, 0, 288, 240, 448, 0},
791 {3,
CONDITION_ALWAYS, 72, 4, 128,
FACING_NORTH, 0, 32, 32, 384, 304, 0},
792 {4,
CONDITION_ALWAYS, 296, 4, 224,
FACING_NORTH, 0, 32, 32, 384, 304, 0},
798 66, 26, 128, 78, 38, 140, -1, 3,
799 290, 26, 224, 302, 38, 236, -1, 4,
800 -1, 0, 0, 0, 0, 0, 0, 0,
1015 MAP_CELL_STEP(37, 33, 4, 2, 5),
MAP_CELL_STEP(33, 33, 4, 2, 5),
MAP_CELL_STEPS_END,
1019 MAP_CELL_STEP(35, 43, 2, 2, 5),
MAP_CELL_STEP(33, 43, 2, 2, 5),
MAP_CELL_STEPS_END,
1023 MAP_CELL_STEP(35, 52, 2, 2, 5),
MAP_CELL_STEP(33, 52, 2, 2, 5),
MAP_CELL_STEPS_END,
1027 MAP_CELL_STEP(35, 54, 2, 2, 5),
MAP_CELL_STEP(33, 54, 2, 2, 5),
MAP_CELL_STEPS_END,
1031 MAP_CELL_STEP(35, 48, 2, 2, 5),
MAP_CELL_STEP(33, 48, 2, 2, 5),
MAP_CELL_STEPS_END,
1035 MAP_CELL_STEP(35, 46, 2, 2, 5),
MAP_CELL_STEP(33, 46, 2, 2, 5),
MAP_CELL_STEPS_END,
1039 MAP_CELL_STEP(35, 50, 2, 2, 5),
MAP_CELL_STEP(33, 50, 2, 2, 5),
MAP_CELL_STEPS_END,
1053 0x140036, 0x12002b, 0x130025, 0xb0029, 0xb0023, 0x90031, 0x60037,
1057 0x12091208, 0x1308120a, 0x130a1309, 0x1409130b, 0x140b140a,
1062#define DIRECTION_STEP(dx, dz) (((dx) << 16) | ((dz) & 0xffff))
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.
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),...
static void Event_PushBlock(void)
Pushing a block: it slides one cell ahead with the leader behind it, if the cell is free.
static void Event_CheckAhead(void)
Checks the blocked direction before allowing another movement step.
const struct SceneEvent * Bilibin_GetEvents(void)
@ JILL_TREE
Jill as a tree, about to be swept downstream.
@ GANG_MEMBER_WEST
Jill's two friends. With her they were the "Gang of Three".
struct SceneEvent gBilibinEvents3[]
u16 gBilibin_DoorSteps1[]
static void Bilibin_RestoreRiverActors(void)
Sets up the river: before the curse is lifted, Jill and her friends are trees here; afterwards they a...
u16 gBilibinEntrancesOther[]
static void Bilibin_RestoreVillageActors(void)
Restores the village population and entrance-dependent actor positions.
struct SceneEntrance gBilibinEntrances2[]
static void Event_AskAboutImil(void)
Asks whether the party has visited Imil to the north.
static void Event_AskAboutSoutheastRoute(void)
Asks whether the party tried the route southeast from Bilibin.
u16 gBilibin_DoorSteps5[]
static void Bilibin_UpdateRaisedBlockCells(void)
Updates the two passage cells according to the movable block's current row.
struct SpawnCounter gBilibin_RiverEffectTimer
s32 gBilibin_FacingCellSteps[]
struct ScenePlacement gBilibinPlacements3[]
struct SceneEvent gBilibinEvents2[]
s32 gBilibin_TransientEffectScript[]
static void Event_AskAboutBeingATree(void)
Once the curse is lifted, the man who was the entrance tree asks whether the party can believe it.
static void Event_PullJillFromRiver(void)
Move on Jill, a tree caught in the river: from cell column 6, by the bank, the leader pulls her ashor...
static void Event_ExamineTreeMan(void)
The tree at the village entrance almost looks like a man; looked at again, like a living person.
const struct SceneRegion * Bilibin_GetRegions(void)
Only the raised approach supplies exit-region boxes.
u16 gBilibin_DoorSteps0[]
static void Event_GustJoins(void)
Gust, Jupiter Djinni 0, joins the party on the warehouse approach.
static void Event_AskAboutCurseBreakers(void)
Asks whether the party are the three warriors who broke the curse.
s32 Bilibin_Initialize(void)
Restores the current map's actors, collision cells and opening transition.
static void Event_JillGivesHardNut(void)
Back on the riverbank once the curse is lifted, Jill and her friends recognize the party,...
const struct SceneEntrance * Bilibin_GetEntrances(void)
u16 gBilibin_DoorSteps3[]
struct ScenePlacement gBilibinPlacements1[]
struct SceneEntrance gBilibinEntrances3[]
static void Event_AskAboutEntranceTree(void)
Asks whether the party saw the strange tree at the entrance.
u16 gBilibin_DoorSteps6[]
static void Event_InspectHumanShapedTree(void)
Describes the human shape shared by the river's transformed villagers.
u16 gBilibin_DoorSteps4[]
struct SceneEvent gBilibinEventsOther[]
u32 gBilibin_RiverBlockCells[]
static void Bilibin_UpdateVillageBlockCells(void)
Updates collision cells around the movable block and moves an overlapping leader clear.
static void Event_OpenDoorAndLeave(void)
Walking into a door: everyone stops, the door opens and the leader walks through it.
static void Bilibin_RestoreRaisedEntrance(void)
Restores the block cells and starts the raised arrivals above floor height.
u16 * gBilibin_DoorSteps[]
const u32 * Bilibin_GetExits(void)
Returns the packed exit destinations shared by the three maps.
struct SceneEvent gBilibinEvents1[]
static void Event_ReadRestrictedAreaSign(void)
Reads the sign restricting entry without permission.
struct ScenePlacement gBilibinPlacements2[]
static void Bilibin_SpawnRiverEffect(struct FieldActor *actor)
Spawns the semi-transparent effect, which frees itself after thirty frames.
struct SceneEntrance gBilibinEntrances1[]
@ TREE_MAN
the cursed traveler, a tree at the village entrance
@ VILLAGE_BLOCK
the block moved with Move
@ FORMER_TREE_MAN
the same man once the curse is lifted
static void Event_ReadWarehouseSign(void)
Reads McCoy's warning on the hidden warehouse.
u16 gBilibin_DoorSteps2[]
static void Event_InspectWell(void)
Reads the two-part description of the deep well.
const struct ScenePlacement * Bilibin_GetPlacements(void)
Selects the village, river or raised-approach actors.
struct ScenePlacement gBilibinPlacementsOther[]
s32 gBilibin_FaceLeaderScript[]
static void Bilibin_UpdateRiverBlockCells(void)
Restores ten river cells, then clears the movable block's current cell.
static void Bilibin_UpdateRiverEffect(void)
Runs every frame in the river: while the controlled actor is west of x 142 and below 8 pixels high,...
Calls through a function pointer, by argument count.
The engine calls the debug menus import, and their palette swatch tiles.
void Djinn_JoinParty(s32 slot, s32 element, s32 djinn)
A Djinni joins the party: djinn (0 to 19) of element goes to the member with the fewest Djinn,...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
static s32 FieldObject_CheckMovementCollision(struct FieldActor *actor, struct FieldPosition *position)
FacingObject, the view of an object that turns to face a target.
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)
s32 Engine_LeaderCheckAhead(void)
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)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
void Engine_MessageShowCentered(s32 message, s32 flags)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
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_ActorJump(s32 actor, s32 height, s32 frames)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ItemShowFound(s32 item, s32 height)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
void Engine_PsynergyCancel(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_CameraWaitForMove(void)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
#define MAP_CELL_STEPS_END
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_MapAnimateCells(const u16 *steps, s32 destX, s32 destY)
static void Actor_CenterAndWalk(s32 actor, s32 priority, s32 dz)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
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 void Actor_SetAttachedEffect(s32 actor, s32 effect)
static struct FieldActor * Actor_Get(s32 actor)
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 IF_FLAG_SET(flag)
#define FIND_MESSAGE(message)
#define SCENE_EXIT(exit, scene, entrance)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define FIND_COINS(coins)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void FieldObject_SetTargetAndCallback(s32 object, s32 target, const s32 *actions)
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_MCCOY_PALACE_VISITED
set on every entry to the palace
#define FLAG_BILIBIN_JILL_GIFT_RECEIVED
her thanks, a Hard Nut
#define FLAG_MCCOY_PALACE_ADMITTED
The gate guards have let the party into the palace.
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_KOLIMA_CURSE_LIFTED
#define FLAG_BILIBIN_JILL_RESCUED
Jill, a tree, pulled from the river.
#define FLAG_SATUROS_BEATEN_AT_MERCURY
Saturos is beaten at Mercury Lighthouse: the Hermes fountain at its foot flows again.
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.
The main-image routines scene overlays import.
Item numbers, named from the English release.
void RunSceneTransitionEffect(s32 x, s32 y)
Starts the wave effect of caster sourceId on target targetId: fades the palettes toward a hue that sh...
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
Scene numbers, named after their places.
Song and sound effect ids, indices into gSound_SongTable.
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()
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
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 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 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.
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...
s32 velocityZ
16.16 fixed-point pixels per frame
u8 terrainId
The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the ce...
s32 z
16.16 fixed-point pixels
s32 selectedActor
the leader: its unit and its actor
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...
Counts frames between the river effects, one every 30 frames.
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