33#include "text/msg_ids.h"
41#define ALTIN_COOK_LAST_POT_X 384
43#define ALTIN_COOK_LAST_POT_X 380
46#define SCENE_ALTIN_VILLAGE ((s32)&SceneId_Altin1)
47#define SCENE_ALTIN_HOUSES ((s32)&SceneId_Altin2)
112#define WATER_BEAST_HOP_PERIOD 60
113#define WATER_SPRAY_LIFETIME 20
114#define WATER_SPRAY_START_SCALE 0x4ccc
118#define ALTIN_FACES_COUNTER(facing) FACING_IS_NORTH(facing)
120#define ALTIN_FACES_COUNTER(facing) \
121 ((u32)(((facing) + 0x5fff) << 16) <= 0x3ffe0000)
127#define WATER_SPRAY_LATERAL_STEP(timer, wobble) \
128 ((timer) * 0x1000 + (wobble) * 0x8000)
130#define WATER_SPRAY_LATERAL_STEP(timer, wobble) \
131 (((timer) << 12) + ((wobble) << 15))
428 s32 coordinatesByteOffset;
447 doorByteOffset = doorIndex << 3;
448 coordinatesByteOffset = doorByteOffset + 4;
449 column = *(
s16 *)(doorBytes + coordinatesByteOffset);
450 row = *(
s16 *)(doorBytes + coordinatesByteOffset + 2);
455 rightColumn = column + 2;
516 if (*shakeFrames != 0) {
517 if (--*shakeFrames == 1)
522 beast->
y.
fixed += -0x18000;
536 if (beast->
timer == 0) {
572 if ((block->
x.
fixed >> 20) == 22) {
721 spray->sprite->image.priority = 1;
735 if (spray->
timer <= 3) {
740 spray->
z.
fixed += 0x20000;
746 if (spray->
timer != 0)
839 {0,
CONDITION_ALWAYS, 380, 0, 433,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
844 {0,
CONDITION_ALWAYS, 380, 0, 433,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
845 {1,
CONDITION_ALWAYS, 488, 0, 184,
FACING_WEST, 0, -1, -1, -1, -1, 0},
846 {2,
CONDITION_ALWAYS, 168, 0, 216,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
847 {3,
CONDITION_ALWAYS, 336, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
848 {4,
CONDITION_ALWAYS, 424, 0, 344,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
849 {5,
CONDITION_ALWAYS, 136, 0, 312,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
850 {6,
CONDITION_ALWAYS, 280, 0, 408,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
851 {7,
CONDITION_ALWAYS, 456, 0, 224,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
852 {8,
CONDITION_ALWAYS, 184, 0, 408,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
853 {9,
CONDITION_ALWAYS, 168, 0, 440,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
854 {10,
CONDITION_ALWAYS, 24, 0, 456,
FACING_SOUTHEAST, 0, -1, -1, -1, -1, 0},
855 {11,
CONDITION_ALWAYS, 264, 0, 224,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
856 {12,
CONDITION_ALWAYS, 328, 0, 264,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
857 {13,
CONDITION_ALWAYS, 343, 0, 177,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
862 {0,
CONDITION_ALWAYS, 200, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
863 {1,
CONDITION_ALWAYS, 159, 0, 258,
FACING_NORTH, 0, 25, 16, 255, 300, 0},
864 {2,
CONDITION_ALWAYS, 336, 0, 213,
FACING_NORTH, 0, 268, 40, 500, 250, 0},
865 {3,
CONDITION_ALWAYS, 688, 0, 204,
FACING_NORTH, 0, 542, 40, 768, 250, 0},
866 {4,
CONDITION_ALWAYS, 240, 0, 500,
FACING_NORTH, 0, 110, 336, 350, 540, 0},
867 {5,
CONDITION_ALWAYS, 496, 0, 504,
FACING_NORTH, 0, 360, 336, 600, 540, 0},
868 {6,
CONDITION_ALWAYS, 752, 0, 516,
FACING_NORTH, 0, 635, 280, 845, 556, 0},
869 {7,
CONDITION_ALWAYS, 80, 0, 864,
FACING_NORTH, 0, 16, 638, 432, 912, 0},
870 {8,
CONDITION_ALWAYS, 68, 0, 728,
FACING_SOUTH, 0, 16, 638, 432, 912, 0},
871 {9,
CONDITION_ALWAYS, 690, 0, 732,
FACING_SOUTH, 0, 480, 626, 896, 882, 0},
1009 MSGNO(MsgAltinWeCanGoBackToWork)},
1011 MSGNO(MsgAltinItsAlmostLikeTheyreTurningThe)},
1013 MSGNO(MsgAltinIWasAfraidMoreWaterWould)},
1016 MSGNO(MsgAltinIHopeAltinMineWillThrive)},
1018 MSGNO(MsgAltinEvenTheToughestOfMinersCant)},
1020 MSGNO(MsgAltinTheWaterSeepedIntoTheMine)},
1022 MSGNO(MsgAltinIfTheWaterBeastsContinueTo)},
1024 MSGNO(MsgAltinItsSoHumidInsideThatCave)},
1027 MSGNO(MsgAltinThatStrangeChamberInTheMines)},
1029 MSGNO(MsgAltinUghTheMonstersSpewedOutAll)},
1031 MSGNO(MsgAltinYouFoughtPrettyWellDespiteAll)},
1034 MSGNO(MsgAltinThatMineIsFullOfHoles)},
1037 MSGNO(MsgAltinTheOldGuardianStatuesAlwaysCreeped)},
1039 MSGNO(MsgAltinItllBeBetterThanDiggingUp)},
1041 MSGNO(MsgAltinIUsedToFindAllSorts)},
1043 MSGNO(MsgAltinAllMyArmorInventoryIsRusting)},
1045 MSGNO(MsgAltinIfMyGoodsAreWetIll)},
1092 MSGNO(MsgAltinLeavingAltinForTolbiWellThats)},
1095 MSGNO(MsgAltinTheMerchantsMustBeHavingA)},
1099 MSGNO(MsgAltinIWonderWhatBusinessThatGirl)},
1102 MSGNO(MsgAltinIThoughtTheVillageWasDone)},
1104 MSGNO(MsgAltinTheySayYouCanStillFind)},
1106 MSGNO(MsgAltinIHateSittingAroundLikeThis)},
1109 MSGNO(MsgAltinHowCanITrulyBeHappy)},
1112 MSGNO(MsgAltinCripesAncientRuinsDownInThe)},
1114 MSGNO(MsgAltinMyHusbandsSenseForFindingTreasure)},
1116 MSGNO(MsgAltinIHadNoIdeaThereWere)},
1118 MSGNO(MsgAltinMomAndPopKnowSomethingAbout)},
1120 MSGNO(MsgAltinIWonderIfMomAndPop)},
1124 MSGNO(MsgAltinIveHeardOfAPassageIn)},
1127 MSGNO(MsgAltinWellIfYouAreImpressedThen)},
1130 MSGNO(MsgAltinTheGirlFromXianBoughtAll)},
1132 MSGNO(MsgAltinWellComeThroughThisAllRight)},
1134 MSGNO(MsgAltinIThinkThatTempleWasCalled)},
1137 MSGNO(MsgAltinYouWontBeAbleToGo)},
1140 MSGNO(MsgAltinNoOneCanGoWestOf)},
1144 MSGNO(MsgAltinItWillTakeSomeTimeBefore)},
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 struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
const u32 * Scene_GetExits(void)
Both scenes share one exit table.
const struct SceneRegion * Scene_GetRegions(void)
s32 Scene_Initialize(void)
Sets up whichever scene is being entered and runs its arrival events.
struct ScenePlacement gAltinHouses_Placements[]
static void Village_ApplyWaterLevel(void)
Sets up the village: the map half showing the current water level (the cells kept in four 32 by 32 bl...
static void Village_EnterDoor(void)
Walking north into one of the village's doors: everyone stops, the door opens and the party leader wa...
struct ScenePlacement gAltinOther_Placements[]
@ FLAG_WATER_DROPPED_TWICE
@ FLAG_WATER_DROPPED_ONCE
u16 gAltinVillage_MineDoorCells[]
The opening pictures of the village's doors, two cells square.
#define SCENE_ALTIN_VILLAGE
static void Houses_AskAboutMonsters(void)
The grateful villager asks whether the party defeated the monsters.
static void Houses_TalkToInnkeeper(void)
The innkeeper opens the inn across the counter, and otherwise talks about the flood or,...
static void Spray_Drift(union FieldObject *fieldObject)
Update callback of a spray particle: it drifts and grows with a random wobble, then curls upward and ...
#define WATER_SPRAY_LATERAL_STEP(timer, wobble)
struct DoorAnim gAltinVillage_Doors[]
Each door trigger's opening picture and cell, from trigger 2.
AltinVillageActor
The village's actors.
@ ACTOR_SECOND_GROUND_SPRITE
@ ACTOR_THIRD_GROUND_SPRITE
@ ACTOR_FLOODED_ITEM_SELLER
@ ACTOR_FIRST_GROUND_SPRITE
Three ground sprites drawn under the party.
@ ACTOR_RETURNING_VILLAGER_B
@ ACTOR_GREETING_VILLAGER
@ ACTOR_FLOODED_ARMOR_SELLER
The armor and item sellers, waiting outside while their shops are under water.
@ ACTOR_RETURNING_VILLAGER_A
Villagers who come back as the water recedes.
@ ACTOR_RETURNING_VILLAGER_C
AltinHouseActor
The houses' actors.
@ ACTOR_ROOM_TWO_SECOND_GUEST
@ ACTOR_ROOM_TWO_GUEST
The family in Room Two, until the second drop.
@ ACTOR_ROOM_ONE_GUEST
The family sheltering in the inn's Room One until the first drop.
@ ACTOR_ROOM_ONE_SECOND_GUEST
static void Village_AskAboutHydros(void)
A villager asks whether the slain hydros creatures gushed water.
static void Beast_SpawnSpray(void)
Scheduler task while the water beast spits: every fourth frame a spray particle starts from its spout...
static void Beast_Hop(union FieldObject *fieldObject)
Update callback of the hopping water beast: once a second it leaps up, falls back with a splash that ...
static void Houses_AskAboutMineBeasts(void)
A miner asks whether the remaining beasts are deep below.
#define ALTIN_COOK_LAST_POT_X
static void Village_AskAboutFirstVisit(void)
A villager asks whether this is the party's first visit; either way, the flood has changed Altin.
#define ALTIN_FACES_COUNTER(facing)
static void Altin_TalkToItemSeller(void)
The item seller, the same way: she reopens after the first drop.
static void Beast_HopAway(void)
The water beast hops away across the flood and dives in with a splash.
u16 gAltinVillage_DoorCellsD[]
static void Village_AskAboutRuins(void)
A villager asks whether the party really found ruins deep in the mine.
struct SceneEntrance gAltinOther_Entrances[]
static s32 Leader_FacesCounter(void)
Returns whether the party leader faces north, toward a shop counter: its facing lies strictly between...
static void Village_ScareOffBeast(void)
Stepping near the water beast: the camera pans to it, it stops spitting, turns to the party,...
u16 gAltinVillage_DoorCellsG[]
static void Village_CheckBlockMoved(void)
After Move: remembers whether the block now stands in map column 22, the spot it is pushed to.
u16 gAltinVillage_DoorCellsE[]
static void Houses_TalkToWeaponSeller(void)
The weapon seller: until the water drains he cannot sell; afterwards he opens his shop when spoken to...
struct SceneEvent gAltinHouses_Events[]
#define SCENE_ALTIN_HOUSES
struct SceneEntrance gAltinHouses_Entrances[]
#define WATER_SPRAY_LIFETIME
#define WATER_BEAST_HOP_PERIOD
static void Altin_TalkToArmorSeller(void)
The armor seller, in either scene: outside, while his shop is under water, he laments; once it has dr...
static void Houses_AskAboutWayWest(void)
A guest asks whether the party seeks the way west, and points to the bottom of the mine.
@ FIRST_DOOR_TRIGGER
The door triggers are numbered from 2 in the village's event table.
static void Village_WalkThroughDoorway(void)
Walking north into a doorway without a door: the leader walks out.
static void Village_TalkToThirstyVillager(void)
While the beasts live, this villager complains that their water cannot be drunk, and the first time t...
u16 gAltinVillage_DoorCellsF[]
static void Spray_Initialize(struct FieldActor *spray)
Gives a new spray particle its look: standing still, drawn on sprite priority 1 and at 0....
u16 gAltinVillage_DoorCellsA[]
#define WATER_SPRAY_START_SCALE
static void Houses_AskAboutXianGirl(void)
A guest asks whether the party is who the girl from Xian was looking for.
static void Houses_PlaceSheltering(void)
Sets up the houses: the families still sheltering in the inn's rooms, the weapon seller waiting there...
s32 gAltinHouses_CookScript[]
The cook from Xian paces between his pots, nodding over each.
u16 gAltinVillage_DoorCellsC[]
struct SceneEvent gAltinVillage_Events[]
struct SceneEvent gAltinOther_Events[]
struct ScenePlacement gAltinVillage_Placements[]
struct SceneEntrance gAltinVillage_Entrances[]
struct FieldActor * Camera_GetEventObject(void)
The event command "get view centre": returns the camera object.
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.
void FieldScene_PrepareActors(struct ScenePlacement *entry)
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,...
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)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_InnOpen(s32 inn, s32 keeper)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void Event_SkipMessages(s32 count)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
void Engine_EventWaitForScreen(void)
void Engine_ActorDestroy(s32 actor)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
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_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.
#define MAP_CELL_STEPS_END
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
static s32 Event_AskYesNo(s32 speaker, s32 flags)
static void Actor_CenterAndWalk(s32 actor, s32 priority, s32 dz)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
void Engine_ShopOpen(s32 shop, s32 keeper)
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)
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
#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 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 PLACEMENT_SHARE_PREVIOUS_SPRITE
#define TOUCH_FACING(facing)
#define FIND_COINS(coins)
Game flags, named where their meaning is shown.
#define FLAG_ALTIN_BLOCK_MOVED
pushed to its place by Move
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_ALTIN_NUT
a barrel in the houses
#define FLAG_SCENE_TEMP_40
#define FLAG_ALTIN_WATER_BEAST_LEFT
jumped back into the flood
#define FLAG_ALTIN_MINE_SECOND_DRAIN
#define FLAG_HYDROS_STATUES_DEFEATED
#define FLAG_ALTIN_SLEEP_BOMB
a bed in the houses
#define FLAG_ALTIN_MINE_THIRD_DRAIN
#define FLAG_SCENE_TEMP_41
#define FLAG_ALTIN_COINS
a barrel in the houses
#define FLAG_SCENE_TEMP_42
#define FLAG_ALTIN_MINE_FIRST_DRAIN
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.
Item numbers, named from the English release.
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_SYNC
Wait for arrival.
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_WAIT(n)
Wait n frames.
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
Scene numbers, named after their places.
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_EventEnd(void)
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
Each village door the party can walk through: its opening picture and the cell it is drawn at.
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
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...
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
u8 paused
nonzero skips its script and motion, not its update
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
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 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...
s32 countdown
Frames until a scene's update hook releases the effect: 20 for Altin Peak's spray,...
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,...
u8 talkFacing
enum ActorTalkFacing; 3 follows the leader afterwards
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 FieldEffect effect
The patch levels: our groups of the measured changes from the Japanese release.