33#include "text/msg_ids.h"
62#define FLAG_ALTIN_PEAK_ROOM_3_SWITCH 0x323
63#define FLAG_ALTIN_PEAK_ROOM_5_SWITCH 0x325
64#define FLAG_ALTIN_PEAK_ROOM_6_SWITCH 0x326
65#define FLAG_ALTIN_PEAK_ROOM_7_SWITCH 0x327
90#define SCENE_MINE_ROOM(n) ((s32)&SceneId_AltinPeak##n)
150#define SEARCH_CHEST_FACING(facing) \
151 (SEARCH(SEARCH_CHEST) | EVENT_TOUCH_FACING | (facing))
321 leader->sprite->image.priority = 3;
326 if (!((logActor->
y.
fixed >> 14) < (leader->
y.
fixed >> 14)))
367 column = block->
x.
fixed >> 20;
485 s16 v = *reg & 0xfdff;
515 waterLayer = mapWork + 356;
516 for (step = 0; step <= 23; step++) {
535 }
while ((
u32)(
timer << 16) <= 0x640000);
559 waterLayer = mapWork + 356;
560 for (step = 23; step >= 0; step--) {
571 }
while ((
u32)(
timer << 16) <= 0x640000);
596 waterLayer = mapWork + 356;
597 for (step = 23; step >= 0; step--) {
608 }
while ((
u32)(
timer << 16) <= 0x640000);
746 sprite = actor->sprite;
748 originHeight = actor->
y.
fixed;
763 actor->
x.
fixed = (cosine << 4) + originX;
774 actor->
x.
fixed = (cosine << 4) + originX;
782 rotationStep += rotationStep >> 3;
786 actor->
x.
fixed = (cosine << 4) + originX;
788 actor->
y.
fixed = originHeight - (sine << 3);
790 if (sprite->
rotation + rotationStep > 0xbfff) {
859 rock->sprite->rotation = 0xc000;
886 }
while (leader->
timer == 0);
890 }
while (boulder->
timer == 0);
967 message = MsgAltinWatchFallingRocks;
1087 if (*shakeDelay != 0) {
1088 if (--*shakeDelay == 1)
1097 object->effect.countdown = 0;
1107 if (beast->
timer == 0) {
1109 object->effect.countdown = 1;
1113 if (++beast->
timer == 60)
1274 actor->effect.countdown = 0;
1307 actor->effect.countdown = 0;
1327 for (waitedFrames = 0; waitedFrames < 60 &&
gKeysPressed == 0;
1432 map->
flags &= 0xfdff;
1625 actor->sprite->rotation = 0x8000;
1631 actor->sprite->rotation = 0xc000;
1653 s32 statuesDefeated;
1659 if (statuesDefeated != 0) {
1671 if (entrance == 1 || entrance == 98) {
1700 spray->sprite->image.priority = 1;
1716 (spray->
timer << 12) +
1721 (spray->
timer << 12) +
1725 if (spray->
timer <= 3) {
1743 if (spray->
timer != 0)
1793 if (debris !=
NULL) {
1808 debris->sprite->image.priority = 1;
1825 if (framePhase == 0) {
1827 }
else if (framePhase == 2) {
1963 const s32 *celebrate;
2127 x =
object->x.
fixed & 0xfff00000;
2129 z =
object->z.
fixed & 0xfff00000;
2130 object->acceleration =
PIXELS(2);
2135 object->terrainId = 0;
2136 object->x.fixed =
x;
2137 object->z.
fixed = centerZ;
2138 object->velocityX = 0;
2139 object->velocityZ = 0;
2144 sprite =
object->sprite;
2154 leader->
z.
fixed = centerZ;
2155 leader->sprite->image.priority = 0;
2160 leader->sprite->image.priority = 2;
2175 angle = (
object->facing + 0x4000) & 0xc000;
2179 x = (point->
x +
PIXELS(8)) & 0xfff00000;
2180 z = (point->
z +
PIXELS(8)) & 0xfff00000;
2185 while (turnFrame < 16) {
2190 object->x.fixed = point->
x;
2191 object->z.fixed = point->
z;
2192 object->facing = angle + 0x4000;
2208 angle = (
object->facing - 0x4000) & 0xc000;
2212 x = (point->
x +
PIXELS(8)) & 0xfff00000;
2213 z = (point->
z +
PIXELS(8)) & 0xfff00000;
2218 while (turnFrame < 16) {
2223 object->x.fixed = point->
x;
2224 object->z.fixed = point->
z;
2225 object->facing = angle - 0x4000;
2250 angle &=
object->facing;
2251 radius =
object->y.fixed /
Q16_ONE;
2255 if (--*timer == 20) {
2266 object->x.fixed = point->
x;
2267 object->z.fixed = point->
z;
2273 if (ahead == behind) {
2275 }
else if (ahead > behind) {
2293 if (heading == -1) {
2294 heading =
object->facing;
2296 for (directionIndex = 0; directionIndex <= 3; directionIndex++) {
2297 position.
x =
object->x.fixed;
2298 position.
y =
object->y.fixed;
2299 position.
z =
object->z.fixed;
2306 if (directionIndex == 4) {
2309 object->terrainId = 2;
2316 object->facing = heading;
2317 object->speed =
PIXELS(2);
2318 object->acceleration =
PIXELS(1) / 20;
2320 object->timer =
object->y.fixed /
Q16_ONE;
2322 position.
x =
object->x.fixed;
2323 position.
y =
object->y.fixed;
2324 position.
z =
object->z.fixed;
2395 SC_CALL(Scene_TurnTowardTarget),
2546 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2551 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2552 {1,
CONDITION_ALWAYS, 456, 0, 520,
FACING_NORTH, 0, 0, 56, 506, 530, 0},
2553 {98,
CONDITION_ALWAYS, 456, 0, 488,
FACING_NORTH, 0, 0, 56, 506, 530, 0},
2554 {99,
CONDITION_ALWAYS, 104, 0, 232,
FACING_SOUTH, 0, 0, 56, 506, 530, 0},
2559 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2560 {1,
CONDITION_ALWAYS, 248, 0, 464,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2561 {2,
CONDITION_ALWAYS, 56, 0, 72,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2566 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2567 {1,
CONDITION_ALWAYS, 488, 0, 560,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2568 {2,
CONDITION_ALWAYS, 664, 0, 380,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2569 {3,
CONDITION_ALWAYS, 904, 0, 214,
FACING_NORTH, 0, 842, 40, 1016, 248, 0},
2570 {98,
CONDITION_ALWAYS, 488, 0, 560,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2571 {99,
CONDITION_ALWAYS, 320, 0, 472,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2576 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2577 {1,
CONDITION_ALWAYS, 248, 0, 498,
FACING_NORTH, 0, 24, 0, 648, 560, 0},
2578 {2,
CONDITION_ALWAYS, 119, 0, 108,
FACING_SOUTH, 0, 24, 0, 648, 560, 0},
2579 {3,
CONDITION_ALWAYS, 567, 0, 105,
FACING_SOUTH, 0, 24, 0, 648, 560, 0},
2580 {4,
CONDITION_ALWAYS, 887, 0, 798,
FACING_NORTH, 0, 712, 568, 960, 860, 0},
2581 {5,
CONDITION_ALWAYS, 791, 0, 679,
FACING_SOUTH, 0, 712, 560, 960, 860, 0},
2582 {6,
CONDITION_ALWAYS, 88, 0, 840,
FACING_NORTH, 0, 32, 704, 272, 864, 0},
2583 {7,
CONDITION_ALWAYS, 216, 0, 840,
FACING_NORTH, 0, 32, 704, 272, 864, 0},
2588 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2589 {1,
CONDITION_ALWAYS, 585, 0, 501,
FACING_NORTH, 0, 0, 0, 798, 530, 0},
2590 {98,
CONDITION_ALWAYS, 585, 0, 501,
FACING_NORTH, 0, 0, 0, 798, 530, 0},
2591 {99,
CONDITION_ALWAYS, 747, 0, 258,
FACING_SOUTH, 0, 0, 0, 798, 530, 0},
2596 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2597 {1,
CONDITION_ALWAYS, 568, 0, 348,
FACING_NORTH, 0, 0, 0, 798, 530, 0},
2598 {2,
CONDITION_ALWAYS, 295, 0, 95,
FACING_SOUTH, 0, 0, 0, 798, 530, 0},
2599 {3,
CONDITION_ALWAYS, 442, 0, 774,
FACING_NORTH, 0, 0, 530, 512, 948, 0},
2600 {4,
CONDITION_ALWAYS, 72, 0, 870,
FACING_NORTH, 0, 0, 530, 512, 948, 0},
2601 {5,
CONDITION_ALWAYS, 918, 0, 712,
FACING_SOUTH, 0, 520, 570, 992, 786, 0},
2602 {6,
CONDITION_ALWAYS, 615, 0, 684,
FACING_SOUTH, 0, 520, 570, 992, 786, 0},
2607 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2608 {1,
CONDITION_ALWAYS, 72, 0, 502,
FACING_NORTH, 0, 0, 0, 820, 568, 0},
2609 {2,
CONDITION_ALWAYS, 152, 0, 174,
FACING_SOUTH, 0, 0, 0, 820, 568, 0},
2610 {3,
CONDITION_ALWAYS, 264, 0, 890,
FACING_NORTH, 0, 144, 720, 384, 908, 0},
2615 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2616 {1,
CONDITION_ALWAYS, 392, 0, 116,
FACING_SOUTH, 0, 0, 0, 830, 564, 0},
2617 {2,
CONDITION_ALWAYS, 40, 0, 116,
FACING_NORTH, 0, 0, 0, 830, 564, 0},
2618 {3,
CONDITION_ALWAYS, 520, 0, 616,
FACING_SOUTH, 0, 244, 564, 1024, 1024, 0},
2619 {4,
CONDITION_ALWAYS, 408, 0, 970,
FACING_NORTH, 0, 244, 564, 1024, 1024, 0},
2620 {5,
CONDITION_ALWAYS, 951, 0, 791,
FACING_SOUTH, 0, 244, 564, 1024, 1024, 0},
2625 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2626 {1,
CONDITION_ALWAYS, 361, 0, 309,
FACING_NORTH, 0, 0, 0, 524, 816, 0},
2627 {2,
CONDITION_ALWAYS, 89, 0, 749,
FACING_NORTH, 0, 0, 0, 524, 816, 0},
2628 {3,
CONDITION_ALWAYS, 728, 0, 717,
FACING_NORTH, 0, 618, 0, 990, 854, 0},
2629 {4,
CONDITION_ALWAYS, 935, 0, 493,
FACING_SOUTH, 0, 618, 0, 990, 854, 0},
2630 {5,
CONDITION_ALWAYS, 791, 0, 566,
FACING_SOUTH, 0, 618, 0, 990, 854, 0},
2631 {6,
CONDITION_ALWAYS, 792, 16, 577,
FACING_SOUTH, 0, 618, 0, 998, 854, 0},
2636 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2637 {1,
CONDITION_ALWAYS, 88, 4, 424,
FACING_SOUTH, 0, 0, 0, 448, 524, 0},
2638 {98,
CONDITION_ALWAYS, 88, 4, 424,
FACING_SOUTH, 0, 0, 0, 448, 524, 0},
2639 {99,
CONDITION_ALWAYS, 328, 0, 118,
FACING_NORTH, 0, 0, 0, 448, 524, 0},
2644 {0,
CONDITION_ALWAYS, 160, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2645 {1,
CONDITION_ALWAYS, 408, 0, 517,
FACING_NORTH, 0, 0, 0, 540, 590, 0},
2646 {2,
CONDITION_ALWAYS, 198, 0, 336,
FACING_SOUTH, 0, 0, 0, 540, 590, 0},
2647 {3,
CONDITION_ALWAYS, 568, 0, 136,
FACING_NORTH, 0, 480, 15, 684, 180, 0},
2648 {4,
CONDITION_ALWAYS, 73, 0, 190,
FACING_NORTH, 0, 0, 0, 540, 590, 0},
2978 0x10000, 0x10b55, 0x1172b, 0x12387, 0x1306f, 0x13dea, 0x14bfd,
2979 0x15ab0, 0x16a09, 0x17a11, 0x18ace, 0x19c49, 0x1ae89, 0x1c199,
2980 0x1d581, 0x1ea4b, 0x20000, 0x216ab, 0x22e56, 0x2470f, 0x260df,
2981 0x27bd4, 0x297fb, 0x2b560, 0x2d413, 0x2f422, 0x3159c, 0x33892,
2982 0x35d13, 0x38333, 0x3ab03, 0x3d495, 0x40000,
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.
void ObjectMotion_EnableActionAndResetMotion(u32 objectId)
The event command "stop actor": stops its action and puts it back under event control (dispatch scrip...
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 SceneEvent gAltinPeak_Events7[]
static void AltinPeak_FreezeRoom7SecondPuddle(void)
Frost on room 7's second puddle.
static void AltinPeak_FightRoom1Beast(void)
Talking to (or reading the mind of) a room's water beast starts its battle; afterwards the party retu...
static void AltinPeak_MarkActorTerrainCell(s32 actorId)
Makes a puddle walkable to the actor checks and marks its map cell.
static void AltinPeak_UpdateBeastHops(union FieldObject *object)
Update callback of the hopping water beast: once a second it leaps up and lands with a splash (SE_229...
s32 gAltinPeak_StatueSinkScript[]
The guardian statue and its shadow flatten into the floor over 60 frames.
static void AltinPeak_UpdateFrostPillarPriority(void)
Scheduler task in room 7: while the leader stands higher than 48 pixels the second pillar is drawn un...
static void AltinPeak_StopLogAndJumpOff(struct FieldActor *object)
The log reaches the end of its run: it settles in the middle of its cell and the party leader jumps o...
static void AltinPeak_BeastFreezesWidePuddle(void)
Room 1's water beast casts Frost on the wide puddle.
static void AltinPeak_RestoreRoom6(void)
Room 6: arriving at entrance 2 the log waits there; the frozen puddle, the water level and the switch...
struct SceneEvent gAltinPeak_Events9[]
static void AltinPeak_RestoreRoom1(void)
Room 1: after its beast's battle the Frost Jewel is found and the water drains; the beast stays where...
struct ScenePlacement gAltinPeak_Placements11[]
@ FLAG_THIRD_PUDDLE_FROZEN
Frost has frozen room 7's third puddle.
@ FLAG_GARET_WATCHING_ROCKS
Garet has come out to look at room 9's falling-rock sign.
@ FLAG_SECOND_PUDDLE_FROZEN
Frost has frozen room 1's wide puddle or room 7's second.
static void AltinPeak_FlipRoom7Switch(void)
Searching room 7's switch flips it.
struct SceneEvent gAltinPeak_Events6[]
static void AltinPeak_SpawnDebris(void)
Scheduler task while the boulder crashes: every third frame a piece of rock (the boulder's own sprite...
struct SceneEvent gAltinPeak_Events3[]
struct SceneEntrance gAltinPeak_Entrances11[]
static void AltinPeak_DrainAfterSecondBeast(void)
Back from room 3's beast battle: the beast is gone, the log waits at (328, 424), the switch is back i...
struct SceneEntrance gAltinPeak_Entrances4[]
#define SEARCH_CHEST_FACING(facing)
A chest searched while facing the given way.
static void AltinPeak_SettleRoom7Block(void)
Move on room 7's block: the cell it left becomes free again and the cell it now stands on (column 24 ...
static void AltinPeak_RunBoulderChase(s32 boulderDelay)
Room 9's rockfall.
static void AltinPeak_RestoreRoom10(void)
Room 10: the guardian statue stands until the Hydros statues are beaten; after their battle the party...
struct SceneEntrance gAltinPeak_Entrances1[]
struct SceneEvent gAltinPeak_Events4[]
static void AltinPeak_RestoreRoom4(void)
Room 4: its water is up until the second drain; entrances 6 and 7 skip the arrival event.
struct SceneRegion gAltinPeak_Regions9[]
s32 gAltinPeak_FaceLeaderScript[]
Room 1's beast keeps turning to face the party leader.
@ ACTOR_ROOM1_WIDE_PUDDLE
static void AltinPeak_PlayHydrosRumble(void)
Scheduler task while the statue wakes: a rumble (SE_183) every second.
static void AltinPeak_StartHydrosBattle(void)
Stepping toward room 10's guardian statue: the leader walks up to it, it rumbles and slides forward,...
static void AltinPeak_FlipRoom5Switch(void)
Searching room 5's switch flips it.
static void AltinPeak_SparkleIce(union FieldObject *object)
Update callback of the frozen wide puddle: its ice glints every eight frames.
static void AltinPeak_InitSpray(struct FieldActor *spray)
Gives a new spray particle its look: standing still, on sprite priority 1 and at 0....
s32 gAltinPeak_PuddleGrowScript[]
The new puddle grows to full size over 108 frames.
#define FLAG_ALTIN_PEAK_ROOM_3_SWITCH
s32 gAltinPeak_SprayDirection
static void AltinPeak_RestoreRoom9(void)
Room 9: the boulder is put away; once the rockfall is over the rock lies toppled and the rubble fills...
static void AltinPeak_FlipRoom3Switch(void)
Searching room 3's switch flips it. "You flipped the switch.".
static void AltinPeak_RollLog(s32 id, s32 heading)
Rolls the log the party leader rides: it sets off the first way it can roll, starting from heading (o...
struct SceneEntrance gAltinPeak_Entrances9[]
static void AltinPeak_SpawnSpray(void)
Scheduler task while a beast spits: every fourth frame a spray particle starts from its spout,...
s32 gAltinPeak_MiaScript[]
static __inline__ void AltinPeak_PlayLandingShake(s32 amplitude, s32 holdFrames)
The beast lands with a splash, shaking the screen for holdFrames.
u32 gAltinPeak_RollRadii[]
The log's speed factor by its height against where it set off: 2 to the power i / 16 for i from 0 to ...
static void AltinPeak_FightRoom5Beast(void)
struct ScenePlacement gAltinPeak_Placements1[]
static void AltinPeak_FreezeRoom1WidePuddle(void)
Frost on room 1's wide puddle, three cells across: the cells take the ice's attributes and the ice is...
static void AltinPeak_FreezeRoom7Puddle(void)
Frost on room 7's first puddle.
static void AltinPeak_RestoreRoom5(void)
Room 5: after its beast's battle the third drain runs; while the water is up the beast spits it; the ...
struct SceneEntrance gAltinPeak_EntrancesOther[]
static void AltinPeak_RestoreRoom7(void)
Room 7: the block, the three frozen puddles and the switch are restored.
static void AltinPeak_TurnLogLeft(struct FieldActor *object)
The log turns a quarter turn left.
s32 gAltinPeak_RumbleTicks
Frames since the statue's last rumble.
static s32 AltinPeak_ShadowFollowBoulder(union FieldObject *object)
struct ScenePlacement gAltinPeak_Placements6[]
struct SceneEvent gAltinPeak_EventsOther[]
static void AltinPeak_FlipRoom6Switch(void)
Searching room 6's switch flips it.
#define FLAG_ALTIN_PEAK_ROOM_6_SWITCH
static void AltinPeak_RestoreBlockAutomaticPriority(void)
Stepping off room 7's block: it sorts against the leader again.
struct SceneEvent gAltinPeak_Events1[]
@ ACTOR_ROOM7_SECOND_PUDDLE
@ ACTOR_ROOM7_THIRD_PUDDLE
static void AltinPeak_FreezeRoom5Puddle(void)
Frost on room 5's puddle.
static UNUSED void AltinPeak_ReservedNoOp(void)
static void AltinPeak_ToggleRoom5SwitchCells(void)
Flips room 5's switch, the same way.
struct SceneEntrance gAltinPeak_Entrances5[]
struct SceneRegion gAltinPeak_Regions10[]
static void AltinPeak_StepPaletteAnim(void)
Scheduler task that cycles the water's palette colors through gAltinPeak_PaletteScript.
struct SceneEvent gAltinPeak_Events2[]
static void AltinPeak_FreezeRoom7ThirdPuddle(void)
Frost on room 7's third puddle.
struct SceneEntrance gAltinPeak_Entrances10[]
static void AltinPeak_RestoreRoom3(void)
Room 3: after its beast's battle the second drain runs; while the water is up the beast spits it; the...
struct SceneEvent gAltinPeak_Events8[]
struct ScenePlacement gAltinPeak_Placements5[]
static void AltinPeak_AwardFrostJewelAndDrain(void)
Back from room 1's beast battle: the beast is gone and the party finds the Frost Jewel; the camera pa...
struct ScenePlacement gAltinPeak_Placements9[]
s8 gAltinPeak_PaletteScript[]
The water's palette cycle: pairs of a color offset and the frames it holds, repeating from the top at...
static void AltinPeak_FreezeRoom6Puddle(void)
Frost on room 6's puddle.
s32 gAltinPeak_LeaderFleePath[]
The party leader flees down the winding path ahead of the boulder, marks the arrival,...
struct SceneEntrance gAltinPeak_Entrances8[]
static void AltinPeak_DrainAfterThirdBeast(void)
Back from room 5's beast battle, the same way, with the third drain.
struct SceneEntrance gAltinPeak_Entrances7[]
struct SceneEntrance gAltinPeak_Entrances3[]
static void AltinPeak_DrainSecondWater(void)
The second drain: the same sinking and flicker over the cells the water leaves behind,...
struct ScenePlacement gAltinPeak_Placements8[]
static void AltinPeak_PushRoom7Block(void)
Walking east into room 7's block pushes it one cell along with a scrape; the leader follows it and it...
static void AltinPeak_FightRoom3Beast(void)
struct SceneEvent gAltinPeak_Events11[]
#define FLAG_ALTIN_PEAK_ROOM_7_SWITCH
#define SCENE_MINE_ROOM(n)
static void AltinPeak_CelebrateHydrosVictory(void)
Back from the Hydros statues' battle: Garet, Ivan and Mia step out.
static void AltinPeak_TurnLogRight(struct FieldActor *object)
The log turns a quarter turn right around the corner it reaches.
static void AltinPeak_PlaceBlockUnderLeader(void)
Stepping onto room 7's block: it is drawn under the party leader.
#define FLAG_ALTIN_PEAK_ROOM_5_SWITCH
s32 gAltinPeak_RejoinScript[]
Garet, Ivan and Mia walk back to the leader and rejoin the party.
static void AltinPeak_StartPaletteAnim(void)
Starts the water's palette cycle.
struct ScenePlacement gAltinPeak_Placements3[]
static void AltinPeak_StartSpitting(s32 x, s32 y, s32 z, s32 facing)
A water beast starts spitting water from (x, y, z) toward facing (east, 0, or west,...
static void AltinPeak_AdvanceLog(struct FieldActor *object)
Rolls the log on by a frame and picks its animation from the terrain ahead of and behind it: flat,...
s32 gAltinPeak_GaretScript[]
Garet, Ivan and Mia step out beside the leader after the Hydros battle.
static void AltinPeak_ShowFirstBeastRoute(void)
Stepping near room 1's water beast the first time: the camera finds it, it cries out and hops away ar...
struct ScenePlacement gAltinPeak_PlacementsOther[]
static void AltinPeak_DriftSpray(union FieldObject *object)
Update callback of a spray particle: it grows while drifting away from the beast, then curls and flat...
static void AltinPeak_StartLogCountdown(struct FieldActor *object)
The log rolls over a marked cell: SE_288 plays, and SE_184 and SE_233 follow as its countdown runs ou...
static void AltinPeak_ToggleRoom3SwitchCells(void)
Flips room 3's switch to its other position, redrawing it and changing the cell its position opens or...
s32 gAltinPeak_IvanScript[]
static void AltinPeak_ForceRockOver(void)
Force on room 9's wall: it rumbles, the rock on it rocks one way and back, then topples with a crash,...
static void AltinPeak_ReadFallingRockSign(void)
Searching room 9's sign, which can bring the rockfall.
struct SceneEvent gAltinPeak_Events5[]
static void AltinPeak_RestoreRoom11(void)
Room 11: arriving at entrance 2 the block stands at its pushed place.
static void AltinPeak_DrainFirstWater(void)
The first drain, after the Frost Jewel is found: the screen shakes, the water layer sinks 24 pixels,...
static void AltinPeak_ShowSecondBeastRoute(void)
Stepping near the beast again: it hops back over the ice and settles down, spitting water.
struct SceneEvent gAltinPeak_Events10[]
s32 gAltinPeak_BoulderPath[]
Room 9's boulder rolls straight down the path, and marks its arrival.
static s32 AltinPeak_FlyDebris(struct ScriptInterpreter *interpreter)
Script callback for a piece of flying rock debris: it moves by its velocity, grows by its z velocity ...
s32 gAltinPeak_DebrisScript[]
A piece of debris flies for 60 frames and is freed.
struct SceneEntrance gAltinPeak_Entrances6[]
struct SceneEntrance gAltinPeak_Entrances2[]
s32 gAltinPeak_SprayOrigin[3]
struct SceneEvent gAltinPeak_Events1Drained[]
static void AltinPeak_FlickerStatue(void)
Scheduler task while the statue sinks: it flickers every other frame.
struct ScenePlacement gAltinPeak_Placements10[]
static void AltinPeak_RideLog(s32 log)
Talking to a log: the party leader jumps onto it, and once the leader has landed on top the log rolls...
static void AltinPeak_FreezeRoom1Puddle(void)
Frost on a puddle freezes it into an ice pillar the party can stand on: the puddle's cell takes the p...
struct ScenePlacement gAltinPeak_Placements7[]
static void AltinPeak_TalkToDjinni(void)
Talking to the Djinni in room 7 makes it hop and starts the battle for Djinni 23.
static void Water_FlickerOut(void)
Interrupt handler while the water layer vanishes: each time, background 1 (the water) stays on only w...
static void AltinPeak_DrainThirdWater(void)
The third drain, likewise.
static UNUSED void AltinPeak_RequestPsynergy(void)
Request the original unused Frost action.
u16 gAltinPeak_FlickerTimer
s32 ResourceMetadata_Register(struct AnimationObject *sprite, s32 id)
Adds a layer of animation id to a sprite, in its first free layer of four.
void ResourceMetadata_ClearRecord(struct AnimationEntry *record)
Zeroes one animation layer (struct AnimationEntry); does nothing for NULL.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
The battle animation state, render objects and effect entries, and the palette buffer work.
struct BattleEffectBuffers * gPaletteBufferWork
Calls through a function pointer, by argument count.
void(*) SchedulerCallback(void)
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.
Djinn numbers, named from the English release.
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...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
FacingObject, the view of an object that turns to face a target.
s16 gAltinPeak_PaletteStep
s16 gAltinPeak_PaletteHold
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_SetDestination(s32 actor, s32 x, s32 z)
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)
void Engine_PsynergyBegin(s32 ability, s32 flags)
struct FieldActor * Engine_ActorLookup(s32 actor)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
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_PsynergyRaiseHands(void)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_PsynergyLowerHands(void)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
void Engine_ItemShowFound(s32 item, s32 height)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
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.
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_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_EventOpenScreen(void)
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_ActorWaitForMove(s32 actor)
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_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
static void Map_CopyCells(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
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.
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_PsynergyPlayEffect(s32 effect)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
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)
void Engine_PsynergySetTarget(s32 caster, s32 target)
static struct FieldActor * Actor_Get(s32 actor)
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
@ ACTOR_FALLS
falls by its gravity and bounces
#define SCENE_TRANSITION(style, variant)
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
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)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Event_End(void)
static void FieldObject_SetTargetAndCallback(s32 object, s32 target, const s32 *actions)
static s32 Task_AddCallback(void(*callback)(void), s32 priority)
Calls the main-image scheduler through engine_call.h.
static s32 Math_Cos(s32 angle)
static void Task_Wait(s32 frames)
static void Event_Begin(void)
static void FieldVector_AddPolarOffset(s32 radius, s32 heading, struct FieldPosition *probe)
static s32 Math_Sin(s32 angle)
static void Actor_SetAnimation(s32 actor, s32 animation)
static void Event_Wait(s32 frames)
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_SCENE_TEMP_05
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_ALTIN_PEAK_DRAGON_SHIELD
room 5's chest
#define FLAG_SCENE_TEMP_00
#define FLAG_ALTIN_PEAK_SECOND_BEAST_ROUTE_SEEN
#define FLAG_ALTIN_PEAK_BOULDER_FALLEN
Room 9's boulder has fallen and rolled down after the party leader.
#define FLAG_ALTIN_PEAK_LUCKY_MEDAL
room 8's chest
#define FLAG_ALTIN_PEAK_COOKIE
room 3's chest
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_ALTIN_PEAK_FIRST_BEAST_ROUTE_SEEN
Room 1's water beast has been seen hopping along its first and its second route.
#define FLAG_ALTIN_PEAK_LIFTING_GEM
room 10's chest
#define FLAG_ALTIN_MINE_SECOND_DRAIN
#define FLAG_HYDROS_STATUES_DEFEATED
#define FLAG_FUCHIN_FALLS_ORB_OF_FORCE_FOUND
The Orb of Force's chest in Fuchin Falls has been opened.
#define FLAG_ALTIN_MINE_THIRD_DRAIN
#define FLAG_SCENE_TEMP_01
#define FLAG_ALTIN_PEAK_VIAL
room 11's chest
#define FLAG_SCENE_TEMP_04
#define FLAG_ALTIN_PEAK_PSY_CRYSTAL
room 7's chest
#define FLAG_ALTIN_MINE_FIRST_DRAIN
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...
volatile u32 gFrameCount
Frames WaitFrames has finished.
GameState, the game's state: play time, coins, the scene and the leader's position,...
#define Battle_SetStart(mode)
Sets the battle start type.
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
void Event_LoadAreaScript(const struct SceneEvent *events)
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.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
#define Iwram_MulQ16(left, right)
The keypad state the VBlank interrupt keeps.
volatile u32 gKeysPressed
Keys that went down this frame.
Small statement macros both games use for positions, velocities and bounds.
#define SET_VELOCITY(p, vx, vy, vz)
#define ABS(v)
The magnitude of v. v is read twice.
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
#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,...
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 Battle_ResetEffectCounter(void)
Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs i...
void BattleEffect_CleanupSceneObjects(void)
Ends a Psynergy effect: frees the effect slots still in use and, unless another effect is being resol...
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone.
void Event_SetNextDestination(s32 scene, s32 entrance)
Sets the scene and entrance that the field goes to next (gGameState.nextScene and nextEntrance).
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
void Field_RequestDjinnBattle(s32 flag, s32 no)
Sets up the battle with Djinni number no.
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
Scene numbers, named after their places.
The field object script interpreter and the operands its commands read.
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_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.
u16 rotation
1/65536 turns
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 count
layers in use, up to the last one present
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
u16 palette[0x1c0]
The source palette, RGB555: 224 BG colours, then 224 OBJ colours; palette[0] is the backdrop.
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 psynergyRequest
a field Psynergy to use, as owner << 10 | Psynergy
s32 transitionFrames
frames
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 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
u8 paused
nonzero skips its script and motion, not its update
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 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 velocityZ
16.16 fixed-point pixels per frame
u8 frozen
Nonzero skips steering, terrain, gravity and floating; its velocity still moves it (ScriptMotionObjec...
void(*) update(union FieldObject *object)
Called each frame while the effect is live: the spawner sets BattleFx_UpdateObjectMotionScaleAndLinke...
s32 countdown
Frames until a scene's update hook releases the effect: 20 for Altin Peak's spray,...
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...
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.
s32 GetMapCellCollision(s32 layer, s32 x, s32 y)
Returns the collision code of a layer's cell at (x, y) in 16.16 pixels.
void SetMapCellCollision(u32 layer, s32 x, s32 y, u32 collisionCode)
Sets the collision code of a layer's cell at (x, y) in 16.16 pixels.
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
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.