Alchemy
Loading...
Searching...
No Matches

vale_eruption.c

Go to the documentation of this file.
1/// @file
2/// Vale's square during the eruption, where the villagers wait for Isaac and
3/// Garet to come down the mountain. The erupting mountain is Mt. Aleph.
4
5#include "game_state.h"
9#include "battle.h"
10#include "debug.h"
11#include "field.h"
12#include "game.h"
13#include "graphics.h"
14#include "menu.h"
15#include "minigame.h"
16#include "sound.h"
17#include "system.h"
18#include "types.h"
19#include "field_event.h"
20#include "field_scene.h"
21#include "text/msg_ids.h"
22#include "objcmd.h"
23#include "flags.h"
24#include "songs.h"
25#include "fixed_math.h"
26
27/// The placed actors, numbered in the order of gValeEruption_Placements;
28/// Garet's row places the party's Garet and takes no number.
30 /// The Great Healer (sprite 0x79, the healer of sanctum.c), who leads the
31 /// villagers into the sanctum. "Come into the sanctum, both of you."
33 /// Garet's grandfather, the mayor (sprite 0x75, whom the Great Healer calls
34 /// Mayor in sanctum.c). "Oooh, my grandson! Will Garet be safe in this
35 /// eruption?!?"
37 /// Isaac's mother (sprite 0x1f, Dora in sanctum.c). "Isaac and Garet went
38 /// to Mr. Kraden's house."
40 /// She calls the mayor Grandpa, and actor 12 calls her Sis. "Grandpa, we
41 /// don't even know if he's up there!"
43 /// The guard. "They were hanging around here while I was on guard duty."
45};
46
47static void Event_ReturnFromMtAleph(void);
48
49/// Returns where the party appears: entrance 15 is the path down from the
50/// mountain, Mt. Aleph.
53}
54
55const struct SceneRegion *ValeEruption_GetRegions(void) { return NULL; }
56
57/// Returns the one exit, into the sanctum (Sanctum's entrance 20), which
58/// Event_ReturnFromMtAleph takes.
60
61/// Returns Garet and the villagers gathered before the sanctum.
64}
65
66/// The square has no events of its own: everything happens on arrival.
69}
70
71/// Plays the return from the mountain when the party arrives by entrance 15.
72/// Called by Field_RunScene once the actors are placed; entrance 15 is where
73/// Sol Sanctum's approach leads after the eruption and before the party
74/// leaves Vale (its exit 1).
76 if (gGameState.entrance == 15) {
78 }
79 return 0;
80}
81
82/// The volcano shakes the square while the villagers wonder where Isaac and
83/// Garet are; the two come down the mountain, tell that Jenna and Kraden were
84/// taken away, and follow the elders into the sanctum.
85/// Called by ValeEruption_Initialize on arrival by entrance 15. Clears
86/// FLAG_SHOW_LOCATION_NAME, sets FLAG_VALE_RETURNED_FROM_MT_ALEPH and takes
87/// exit 1 into the sanctum, where Sanctum_RequestQuestAcceptance follows.
88static void Event_ReturnFromMtAleph(void) {
89 struct EventWork *work;
90 const s32 *actionScript;
91
101 Actor_WalkToAndWait(12, 256, 500);
103 // A lightning flash, then the screen opens on the square below.
104 BattleFx_StartBufferBlend(0x10003, 0x10006);
106 Engine_TaskWait(60);
107 Camera_MoveTo(PIXELS(256), -1, PIXELS(612), 0);
110 work = gEventWork;
111 work->startTransition = 0;
112 work->transitionFrames = 32;
114
115 // The camera pans up to the villagers as the ground shakes.
116 Camera_SetSpeed(0xcccc, 0x1999);
117 Camera_MoveTo(PIXELS(256), -1, PIXELS(500), 1);
129 Map_SetShake(-1, -1, 0xe666);
132
133 // "I thought Mt. Aleph was inactive..." The villagers worry about Isaac and
134 // Garet, last seen going to Kraden's house.
135 Engine_EventSetMessage(MsgValeMtAlephWasInactive);
141 // The mayor: "Oooh, my grandson!"
144 // Garet's sister doubts he is up there; actor 12 says someone saw him climb.
148 0);
152 Event_ShowMessage(12, 0);
153 // The guard saw them hanging around; Dora says they went to Kraden's house,
154 // and the mayor and Dora wonder what Alchemy has to do with the eruption.
183 Map_SetShake(-1, -1, 0xe666);
185
186 // Isaac and Garet come down the path, and Garet sees the villagers: "Uh-oh.
187 // It's Grandpa and the others."
188 Actor_SetSpeed(ACTOR_PARTY_LEADER, 0x8000, 0x4000);
189 Actor_SetSpeed(GARET, 0x8000, 0x4000);
191 Camera_SetSpeed(0x18000, 0x3000);
192 Camera_MoveTo(PIXELS(112), -1, PIXELS(320), 1);
197 Actor_MoveToAndWait(GARET, 104, 320);
205 Actor_SetSpeed(GARET, 0x18000, 0xc000);
207 Actor_MoveToAndWait(GARET, 105, 342);
215
216 // "What should we do, Isaac? Should we go back up?" Either way, the two stay.
218 if (Engine_EventChooseYesNo(0, 0) == 0) {
225 Actor_SetSpeed(GARET, Q16_ONE, 0x8000);
226 Actor_MoveToAndWait(GARET, 103, 320);
228 } else {
237 }
238
239 // The villagers spot them: "Garet!" "Isaac!"
240 // Actor 12 cries "Garet!" and the villagers turn to the path.
241 Event_ShowMessage(12, 0);
250 // The camera flies to Dora: "Isaac!" The Great Healer: "You're safe!"
251 Camera_SetSpeed(0x30000, 0x6000);
261 // The mayor: "Come over here, both of you!"
267 Camera_MoveTo(PIXELS(112), -1, PIXELS(320), 1);
277
278 // "Come over here, both of you!" The two walk down to the villagers.
279 Camera_SetSpeed(Q16_ONE, 0x2000);
280 Camera_MoveTo(PIXELS(214), -1, PIXELS(472), 1);
282 Actor_SetSpeed(GARET, Q16_ONE, 0x8000);
291 Actor_SetSpeed(ACTOR_GREAT_HEALER, 0xcccc, 0x6666);
297
298 // "Where have you been?" "What happened?"
305 // The Great Healer: "What happened?" The two look at each other and shake
306 // their heads.
318 // Dora notices who is missing.
323
324 // "Weren't Jenna and Kraden with you?" Yes: "They were taken away? By
325 // whom?"; no: "What do you mean, they were taken away?"
327 if (Engine_EventChooseYesNo(0, 0) == 0) {
328 // The mayor answers either reply; the other reply is skipped.
338 } else {
348 }
350 // Garet starts to tell, and both shake their heads again.
359
360 // "This is all very complicated... Come into the sanctum, both of you."
371 // The mayor agrees with a nod; the Great Healer sends them inside.
374 0);
388
389 // The sanctum's door opens and everyone files inside.
398 Actor_SetSpeed(ACTOR_DORA, 0xcccc, 0x6666);
408 Actor_WalkTo(ACTOR_DORA, 255, 390);
409 actionScript = gValeEruption_EnterSanctum;
412 Actor_SetActionScript(GARET, actionScript);
421 work = gEventWork;
422 work->startTransition = 0;
423 work->transitionFrames = 64;
425 Map_SetShake(-1, -1, 0xe666);
431}
432
433/// Isaac walks down from the path to the villagers before the sanctum.
435 SC_ARG(2), SC_MOVE(PIXELS(128), 0, PIXELS(378)),
436 SC_SYNC, SC_MOVE(PIXELS(203), 0, PIXELS(378)),
437 SC_SYNC, SC_MOVE(PIXELS(212), 0, PIXELS(472)),
438 SC_SYNC, SC_MOVE(PIXELS(214), 0, PIXELS(472)),
439 SC_SYNC, SC_ARG(1),
440 SC_END,
441};
442
443/// Garet follows him, stopping a little above.
445 SC_ARG(2), SC_MOVE(PIXELS(128), 0, PIXELS(378)),
446 SC_SYNC, SC_MOVE(PIXELS(203), 0, PIXELS(378)),
447 SC_SYNC, SC_MOVE(PIXELS(214), 0, PIXELS(455)),
448 SC_SYNC, SC_ARG(1),
449 SC_END,
450};
451
452/// Isaac, then Garet, walk through the sanctum's door.
454 SC_ARG(2), SC_MOVE(PIXELS(255), 0, PIXELS(452)),
455 SC_SYNC, SC_MOVE(PIXELS(255), 0, PIXELS(390)),
456 SC_SYNC, SC_ARG(1),
457 SC_END,
458};
459
461 {0, CONDITION_ALWAYS, 110, 0, 270, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
462 {15, CONDITION_ALWAYS, 103, 0, 284, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
464};
465
467 SCENE_EXITS(10),
468 SCENE_EXIT(1, 9, 20),
470};
471
472// clang-format off
475 PIXELS(104), 0, PIXELS(258), FACING_SOUTH, TALK_FACE_PARTY, 0 },
477 PIXELS(265), 0, PIXELS(468), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
479 PIXELS(246), 0, PIXELS(468), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
481 PIXELS(246), 0, PIXELS(487), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
483 PIXELS(265), 0, PIXELS(477), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
485 PIXELS(256), 0, PIXELS(490), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
487 PIXELS(265), 0, PIXELS(523), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
489 PIXELS(245), 0, PIXELS(532), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
491 PIXELS(256), 0, PIXELS(543), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
493 PIXELS(283), 0, PIXELS(536), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
495 PIXELS(235), 0, PIXELS(552), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
497 PIXELS(265), 0, PIXELS(561), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
499 PIXELS(247), 0, PIXELS(573), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
500 { SCENE_TABLE_END },
501};
502// clang-format on
503
506};
507
508/// The sanctum's door, two cells wide, opening in two steps.
510 MAP_CELL_STEP(0, 98, 2, 2, 2),
511 MAP_CELL_STEP(2, 98, 2, 2, 2),
513};
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
#define GARET
Jerald.
The engine calls the debug menus import, and their palette swatch tiles.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
@ ANIM_WALK
Definition field_event.h:44
@ ANIM_STAND
Definition field_event.h:43
@ ANIM_NOD
Definition field_event.h:45
@ ANIM_SHAKE_HEAD
Definition field_event.h:46
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)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveToActor(s32 actor, s32 pan)
#define EMOTE_IN_FRONT
Definition field_event.h:49
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
void Engine_EventCloseScreen(void)
static void Event_SkipMessages(s32 count)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
#define GameFlag_Clear
#define GameFlag_Set
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_EventOpenScreen(void)
void Engine_MapRenderWaitForValues(void)
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_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
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
Definition field_event.h:61
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
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_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
@ FACING_STEP
Definition field_scene.h:36
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
@ ACTOR_FIRST_PLACED
@ ACTOR_PARTY_LEADER
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ TALK_FACE_PARTY
@ ACTOR_STAND
#define SCENE_EXITS_END
Definition field_scene.h:77
@ FACING_EAST
Definition field_scene.h:26
@ FACING_SOUTHEAST
Definition field_scene.h:27
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_NORTHWEST
Definition field_scene.h:31
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
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.
Definition fixed_math.h:10
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_VALE_RETURNED_FROM_MT_ALEPH
Isaac and Garet followed the elders into the sanctum.
Definition flags.h:535
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 reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_SYNC
Wait for arrival.
Definition objcmd.h:17
#define SC_ARG(v)
Definition objcmd.h:44
#define SC_MOVE(x, y, z)
Move toward the target.
Definition objcmd.h:19
#define SC_END
Return to the main script.
Definition objcmd.h:32
@ ACTOR_DORA
Definition sanctum.c:58
Song and sound effect ids, indices into gSound_SongTable.
#define SE_188
Definition songs.h:183
#define SE_145
Definition songs.h:138
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_EventEnd(void)
void Engine_EventBegin(void)
void Engine_TaskWait()
void Engine_EventSetMessage()
#define NULL
Definition bilibin.h:6
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
Definition event_work.h:20
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
s32 transitionFrames
frames
Definition event_work.h:45
s16 entrance
Definition game_state.h:37
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
Definition field_scene.h:54
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,...
Definition field_scene.h:81
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.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
const struct SceneEntrance * ValeEruption_GetEntrances(void)
Returns where the party appears: entrance 15 is the path down from the mountain, Mt.
s32 ValeEruption_Initialize(void)
Plays the return from the mountain when the party arrives by entrance 15.
const struct SceneRegion * ValeEruption_GetRegions(void)
u16 gValeEruption_SanctumDoorOpens[]
The sanctum's door, two cells wide, opening in two steps.
u32 gValeEruption_Exits[]
const struct ScenePlacement * ValeEruption_GetPlacements(void)
Returns Garet and the villagers gathered before the sanctum.
static void Event_ReturnFromMtAleph(void)
The volcano shakes the square while the villagers wonder where Isaac and Garet are; the two come down...
ValeEruptionActor
The placed actors, numbered in the order of gValeEruption_Placements; Garet's row places the party's ...
@ ACTOR_GUARD
The guard. "They were hanging around here while I was on guard duty.".
@ ACTOR_GARETS_SISTER
She calls the mayor Grandpa, and actor 12 calls her Sis.
@ ACTOR_GREAT_HEALER
The Great Healer (sprite 0x79, the healer of sanctum.c), who leads the villagers into the sanctum.
@ ACTOR_GARETS_GRANDFATHER
Garet's grandfather, the mayor (sprite 0x75, whom the Great Healer calls Mayor in sanctum....
struct ScenePlacement gValeEruption_Placements[]
s32 gValeEruption_LeaderWalksDown[]
Isaac walks down from the path to the villagers before the sanctum.
struct SceneEntrance gValeEruption_Entrances[]
s32 gValeEruption_GaretWalksDown[]
Garet follows him, stopping a little above.
struct SceneEvent gValeEruption_Events[]
const struct SceneEvent * ValeEruption_GetEvents(void)
The square has no events of its own: everything happens on arrival.
s32 gValeEruption_EnterSanctum[]
Isaac, then Garet, walk through the sanctum's door.
const u32 * ValeEruption_GetExits(void)
Returns the one exit, into the sanctum (Sanctum's entrance 20), which Event_ReturnFromMtAleph takes.
void BattleFx_StartBufferBlend(s32 from, s32 to)
Flashes the palette once, 120 frames from now, from palette from to palette to (BattleFx_BuildBuffer ...
Definition weather.c:467
void FieldFx_LastLightning(void)
One last flash of lightning in 12 frames, then no more.
Definition weather.c:450