29#include "text/msg_ids.h"
66 s32 cameraX = *position++;
67 s32 cameraY = *position;
69 object->x.fixed = center[0] + (cameraX -
origin[0]);
70 object->y.fixed = center[1] + (cameraY -
origin[1]) / 2;
71 object->sprite->rotation += 0x600;
84 object->facing = value;
85 }
else if (sample == 9) {
88 object->facing = value;
112 }
else if (*state != 0) {
131 }
else if (*state != 0) {
547 actor->
y.
fixed = randomValue;
549 actor->
riseBaseY = ((randomValue * 3 << 13) >> 16) - 3 *
PIXELS(1) / 16;
608 for (frame = 0; frame < 32; frame++) {
711 *position++ += swayX;
732 return westSeats - eastSeats;
754 for (passenger = 0; passenger <= 8; passenger++) {
860 0x9090000, 0xd70090d, 0xdb315cb, 0x15f5164c,
861 0x1f0e1aad, 0x1f6f227a, 0x23f223b1, 0x2bf727f4,
865 { 0,
CONDITION_ALWAYS, 165, 0, 235,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
866 { 1,
CONDITION_ALWAYS, 184, 56, 352,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
867 { 10,
CONDITION_ALWAYS, 164, 96, 321,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
868 { 11,
CONDITION_ALWAYS, 164, 96, 321,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
869 { 12,
CONDITION_ALWAYS, 164, 96, 321,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
870 { 13,
CONDITION_ALWAYS, 164, 96, 321,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
871 { 14,
CONDITION_ALWAYS, 164, 96, 321,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
876 {176, 16, 348, 192, 32, 364, -1, 1},
877 {-1, 0, 0, 0, 0, 0, 0, 0},
953 7, 5, 8, 4, 9, 12, 6, 3,
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
struct FieldActor * Camera_GetEventObject(void)
The event command "get view centre": returns the camera object.
s32 Field_ClimbUp(void)
Climbing up (the player presses up at a climbable wall).
s32 Field_ClimbDown(void)
Climbing down (the player presses down at a climbable wall).
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.
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 void Actor_SetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
s32 Engine_MathSin(s32 angle)
void Engine_ItemShowFound(s32 item, s32 height)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
void Engine_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
s32 Engine_MathCos(s32 angle)
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)
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
#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 PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void FieldObject_SetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
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_TOLBI_SHIP_REACHED_TOLBI
The ship reached Tolbi. "The ship has arrived safely".
#define FLAG_TOLBI_SHIP_CREWMAN_CONFRONTED
#define FLAG_TOLBI_SHIP_ROWING
the oars are moving
#define FLAG_TOLBI_SHIP_FOURTH_SEAT_ROWERS
#define FLAG_TOLBI_SHIP_ANCHOR_CHARM_FOUND
#define FLAG_TOLBI_SHIP_SECOND_SEAT_ROWERS
#define FLAG_TOLBI_SHIP_FIRST_SEAT_ROWERS
The passengers chosen to row: a group of nine flags for each empty seat, one flag for each passenger,...
#define FLAG_TOLBI_SHIP_FIRST_ATTACK_REPELLED
The monster attacks fought off.
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_TOLBI_SHIP_AT_ISLAND
at anchor off the island
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_TOLBI_SHIP_ANCHOR_CHARM_RETURNED
The party gave back the captain's Anchor Charm and agreed to protect the ship.
#define FLAG_TOLBI_SHIP_WARRIORS_SEEK_CAPTAIN
#define FLAG_TOLBI_SHIP_MONSTERS_SIGHTED
The ship's place plays music 29, the monsters' theme, instead of 41.
#define FLAG_TOLBI_SHIP_THIRD_SEAT_ROWERS
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.
The screen blend's globals and the graphics routines.
The heap's work slots and HeapState.
The main-image routines scene overlays import.
Item numbers, named from the English release.
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_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 Event_CallWithLastActiveObjectId(struct ScenePlacement *table)
Spawns the actors of a placement table after the last actor in use.
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.
char SceneId_TolbiShipInteriors
The field object script interpreter and the operands its commands read.
Song and sound effect ids, indices into gSound_SongTable.
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
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).
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
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
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.
s32 riseBaseY
Zeroed by FieldObject_Create and not read by the engine; scene code keeps a resting height,...
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
s16 savedScene
where a defeat returns to without a defeat point
s16 savedEntrance
where a defeat returns to without a defeat point
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.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
struct SceneEntrance gTolbiShipMast_Entrances[]
const struct SceneRegion * TolbiShipMast_GetRegions(void)
Returns the ladder's three-dimensional activation region.
struct ScenePlacement gTolbiShipMast_Placements[]
struct ScenePlacement gTolbiShipMast_StagingObjects[]
static void TolbiShipMast_ClimbDownLadder(void)
Touching the ladder starts the descent.
s32 gTolbiShipMast_SwayUnused
const u32 * TolbiShipMast_GetExits(void)
Returns exits to the deck and the continuing ship scenes.
const struct ScenePlacement * TolbiShipMast_GetPlacements(void)
Returns the lookout's initial placement table.
s32 gTolbiShipMast_LookoutActions[]
static void TolbiShipMast_InitializeDriftingGroup(void)
Gives each of the seven approaching actors its own random drift and bob.
static void TolbiShipMast_GrowActorScale(union FieldObject *fieldObject)
Grows both axes by the same amount until the actor reaches full scale.
s32 gTolbiShipMast_DriftY
s32 TolbiShipMast_Initialize(void)
Starts the ship sway when allowed, then runs this entrance's mast sequence.
s32 gTolbiShipMast_FollowCameraActions[]
u32 gTolbiShipMast_Exits[]
s32 gTolbiShipMast_EnsembleWalk11[]
static void TolbiShipMast_SetupHiddenLeaderLookout(void)
Frames the lookout with the leader moved out of view, then announces course.
s32 gTolbiShipMast_EnsembleWalk10[]
static void TolbiShipMast_PrepareGroupDeparture(void)
Stops the drifting actions and gives the group its departure walking speed.
u32 gTolbiShipMast_PassengerRowValues[]
Each passenger's rowing value, in the order of their actors in the hold from 8.
struct SceneEvent gTolbiShipMast_Events[]
static s32 TolbiShipMast_FollowCameraAndRotate(struct ScriptInterpreter *interpreter)
Keeps the effect actor relative to the saved camera origin and rotates it.
s32 gTolbiShipMast_CameraOrigin[2]
s32 gTolbiShipMast_WaveActions[]
struct ScenePlacement gTolbiShipMast_EnsembleObjects[]
static void TolbiShipMast_AnnounceClearCourse(void)
The lookout scans both sides, announces a clear course and leaves by exit 10.
const struct SceneEntrance * TolbiShipMast_GetEntrances(void)
Returns the entrances from the ship's deck and scripted sequences.
s32 gTolbiShipMast_DriftX
static void TolbiShipMast_FindAnchorCharm(void)
Gives the Anchor Charm once either discovery flag permits the search.
struct ScenePlacement gTolbiShipMast_LandingObjects[]
s32 gTolbiShipMast_EnsembleWalk12[]
static s32 TolbiShipMast_ShrinkAndStopActor(struct ScriptInterpreter *interpreter)
Shrinks both axes; once small enough, clears the actor's position and speed.
static void TolbiShipMast_ShowMonsters(void)
Repeats actor 9's approach before the lookout reports monsters.
s32 gTolbiShipMast_EnsembleWalk14[]
s32 gTolbiShipMast_EnsembleWalk9[]
static s32 TolbiShipMast_GetSeatRowValue(u32 seat)
The rowing value of the passenger chosen for a seat, or 0 while it is empty.
static s32 TolbiShipMast_RandomizeLookoutFacing(struct ScriptInterpreter *interpreter)
A random sample of 6 or 9 turns the lookout to either side of north.
s32 gTolbiShipMast_DriftActions[]
const struct SceneEvent * TolbiShipMast_GetEvents(void)
Returns the ladder, lookout dialogue and Anchor Charm search events.
static void TolbiShipMast_RunLandingSequence(void)
Moves the drifting group aside, then stages the two landing actors.
static void TolbiShipMast_SetupVisibleLeaderLookout(void)
Keeps the leader visible for the course announcement.
static s32 TolbiShipMast_GetRowingBalance(void)
How evenly the chosen passengers row: the values of those at the west seats (the first and third fill...
struct SceneRegion gTolbiShipMast_Regions[]
s32 gTolbiShipMast_EnsembleWalk13[]
static void TolbiShipMast_UpdateSway(void)
Adds horizontal and vertical sway to the camera origin each frame.
static s32 TolbiShipMast_SwayActor(struct ScriptInterpreter *interpreter)
Randomly reverses horizontal drift and vertical bobbing at their limits.
u32 gTolbiShipMast_EnsembleWalk15[]
static void TolbiShipMast_InitializeDriftingActor(s32 actorId)
Initializes a drifting actor, retaining the random draws' original order.
static void TolbiShipMast_AnnounceLand(void)
Walks the seven actors away, then the lookout announces land.
s32 gTolbiShipMast_CameraCenter[2]
static void TolbiShipMast_StopDriftingActor(struct FieldActor *actor)
Clears the movement left by a drifting script before its staged approach.
static void TolbiShipMast_RunAvastScene(void)
Stages four approaching actors and the lookout's reaction. "Avast!".
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.