Alchemy
Loading...
Searching...
No Matches

vale_kraden.c

Go to the documentation of this file.
1/// @file
2/// The north of Vale around Kraden's cottage: the fence above the village, the
3/// path down to the plaza, and the cottage's gate.
4
5#include "game_state.h"
6#include "unit/import.h"
11#include "battle.h"
12#include "debug.h"
13#include "field.h"
14#include "game.h"
15#include "graphics.h"
16#include "menu.h"
17#include "minigame.h"
18#include "sound.h"
19#include "system.h"
20#include "call.h"
21#include "types.h"
22#include "field_event.h"
23#include "field_service.h"
24#include "field_scene.h"
25#include "text/msg_ids.h"
26#include "ability_ids.h"
27#include "item_ids.h"
28#include "objcmd.h"
29#include "facing_object.h"
30#include "fixed_math.h"
31#include "palbuf.h"
32#include "flags.h"
33#include "songs.h"
34
35// FLAG_SCENE_TEMP_42: the cottage's gate stands open since Kraden went in.
36
38 /// The west rock. "It's a huge rock that Isaac's strength can't even budge."
47};
48
50
53}
54
55const struct SceneRegion *ValeKraden_GetRegions(void) { return NULL; }
56
58
59/// Returns the one placement table for every visit; ValeKraden_Initialize
60/// removes the actors a visit does not use.
63}
64
65/// Selects the events for the current visit to Vale: after Kalay
66/// (FLAG_REACHED_KALAY), on the stormy night (FLAG_VALE_STORM), else the day
67/// the story begins.
68const struct SceneEvent *ValeKraden_GetEvents(void) {
71 }
74 }
75 return gValeKraden_Events;
76}
77
78/// Finishes the party's nod together before the next line of dialogue.
79static __inline__ void ValeKraden_NodTogether(void) {
83}
84
85/// Turns all three party members toward the strangers.
86static __inline__ void ValeKraden_FacePartySouth(void) {
90}
91
92/// Starts a companion walking back to Isaac's current pixel position.
93static __inline__ void ValeKraden_WalkTowardLeader(s32 companionId) {
94 struct FieldActor *leader;
95
98 if (leader != NULL) {
99 Actor_SetDestination(companionId, leader->x.part.pixel,
100 leader->z.part.pixel);
101 }
102}
103
104/// The child at the fence asks whether Isaac hears the growls beyond it; once
105/// the party has left Vale, he means to climb it someday.
106///
107/// Reached by talking to the onlooker at the fence (actor 12) in the day's
108/// events.
109static void Event_TalkToFenceOnlooker(void) {
110 s32 message;
111
114 Engine_EventSetMessage(MsgValeIllClimbTheFenceSomeday);
116 } else {
117 message = MsgValeHearAwfulGrowls;
118 Engine_EventSetMessage(message);
123 if (Engine_EventChooseYesNo(0, 0) == 0) {
124 Engine_EventSetMessage(message + 1);
125 } else {
126 Engine_EventSetMessage(message + 2);
127 }
131 }
133}
134
135/// Talking to Kraden outside his cottage: he talks Isaac, Garet and Jenna into
136/// a secret look at Sol Sanctum, then goes inside to prepare.
137///
138/// Reached by talking to Kraden (actor 13) in the day's events, until
139/// FLAG_SANCTUM_VISIT_PLANNED is set. Ends by taking exit 13 into the cottage
140/// (scene 8, entrance 22); the party comes back by entrance 10, where
141/// Event_KradenSetsOff goes on.
143 struct FieldActor *leader;
144 s32 x, z;
145 s32 sneakingMessage;
146
148 // Isaac walks up to Kraden, who greets him.
151 Engine_EventSetMessage(MsgValeKradenOhIsaac);
158 // Garet and Jenna step out of Isaac and stand either side of him.
160 x = leader->x.part.pixel;
161 z = leader->z.part.pixel;
164 Actor_SetSpeed(JENNA, PIXELS(1) / 2, PIXELS(1) / 4);
165 Actor_SetSpeed(GARET, PIXELS(1) / 2, PIXELS(1) / 4);
166 Actor_WalkTo(JENNA, 248, 264);
167 Actor_WalkToAndWait(GARET, 216, 264);
172 // Jenna sees something is bothering Kraden; he hedges.
182 // Garet names Saturos and Menardi; Kraden finds them persistent.
190 // Jenna asks whether they wanted something from him; it seems so.
197 // The three are puzzled, and Jenna asks what he means.
205 // Kraden: they spoke of Mt. Aleph and Sol Sanctum as if they had seen
206 // them.
215 // Kraden looks from one to another and asks whether that is not strange.
221 if (Engine_EventChooseYesNo(0, 0) == 0) {
222 Engine_EventSetMessage(MsgValeYouCannotEnterMtAleph);
223 } else {
224 Engine_EventSetMessage(MsgValeKradenIWaitedYearsFor);
225 }
230 // Jenna fears they are thieves; Garet would tell the high elders.
231 Engine_EventSetMessage(MsgValeJennaTheyMightBeThieves);
236 Engine_ActorJump(GARET, 4, 30);
239 // The three agree and turn to go.
252 // Kraden stops them: nothing can be done until what he was told is
253 // confirmed.
266 // Jenna asks what to do; Kraden means to go and confirm it.
273 // The three start; Garet asks whether he means Sol Sanctum itself, and
274 // Jenna thinks it impossible.
276 Engine_ActorJump(GARET, 2, 0);
277 Engine_ActorJump(JENNA, 2, 10);
291 // Kraden asks whether the ban on climbing Mt. Aleph should stop them;
292 // either way, they will only look.
298 if (Engine_EventChooseYesNo(0, 0) == 0) {
299 Engine_EventSetMessage(MsgValeKradenWeOnlyCheckThe);
300 } else {
301 Engine_EventSetMessage(MsgValeKradenWeOnlyCheckMt);
302 }
304 // Garet asks Isaac whether it is fine if they are not seen.
305 sneakingMessage = MsgValeFineIfTheyDontSee;
306 Engine_EventSetMessage(sneakingMessage);
310 if (Engine_EventChooseYesNo(0, 0) == 0) {
311 Engine_EventSetMessage((sneakingMessage + 1));
312 } else {
313 Engine_EventSetMessage((sneakingMessage + 2));
314 }
316 // Jenna makes it their secret; a yes earns the warning not even to tell
317 // Isaac's mother, a no only nods and skips it.
318 Engine_EventSetMessage(MsgValeJennaOurSecret);
323 if (Engine_EventChooseYesNo(0, 0) == 1) {
324 Engine_ActorJump(JENNA, 2, 20);
326 } else {
333 }
334 // Kraden: then it is decided.
345 // Kraden makes Isaac the leader; Garet and Jenna squabble over who would
346 // be nervous.
350 if (Engine_EventChooseYesNo(0, 0) == 0) {
351 Engine_EventSetMessage(MsgValeGaretYouCanHandleThe);
352 } else {
353 Engine_EventSetMessage(MsgValeGaretIllTakeOverIf);
354 }
366 // Kraden hops, eager to start.
373 // Kraden opens his gate and goes in to prepare; the screen closes and the
374 // party follows him through exit 13.
388 }
389}
390
391/// Arriving by entrance 10, from the cottage: Kraden comes out ready, and
392/// everyone joins Isaac for the mountain. "This is our best bet." The mountain
393/// is Mt. Aleph.
394///
395/// Called by ValeKraden_Initialize on entrance 10 unless the party keeps its
396/// position. Sets FLAG_SANCTUM_VISIT_PLANNED and FLAG_SCENE_TEMP_42 (the gate
397/// stays open), and removes Kraden, Garet, Jenna, Saturos and Menardi.
398static void Event_KradenSetsOff(void) {
399 struct FieldActor *actor;
400 s32 facing;
401
406 actor = Object_GetById(GARET);
408 actor->facing = facing;
409 actor = Object_GetById(JENNA);
410 actor->facing = facing;
416 // Kraden comes out of the gate: this is their best bet.
417 Actor_SetSpeed(ACTOR_KRADEN, PIXELS(4) / 5, PIXELS(2) / 5);
422 Engine_EventSetMessage(MsgValeKradenOurBestBet);
427 // Isaac nods to Garet, then to Jenna.
439 Actor_SetSpeed(GARET, PIXELS(4) / 5, PIXELS(2) / 5);
440 Actor_SetSpeed(JENNA, PIXELS(4) / 5, PIXELS(2) / 5);
442 // Garet, Jenna and Kraden walk into Isaac and vanish; the strangers are
443 // gone too.
462}
463
464/// Walking into the cottage: the gate opens unless Kraden left it open.
465///
466/// Reached by walking north into cell code 3, by day and after Kalay; takes
467/// exit 3 into the cottage.
468static void Event_EnterCottage(void) {
472 }
475}
476
477/// Walking past the two strangers: Isaac, Garet and Jenna overhear Saturos and
478/// Menardi, confront them and are warned off.
479///
480/// Reached by stepping on cell code 7 in the day's events; runs once, setting
481/// FLAG_MET_SATUROS_AND_MENARDI. Saturos and Menardi are left turning to watch
482/// the leader.
484 struct FieldActor *actor;
485 s32 x, z;
486 s32 strangersMessage;
487 s32 accusationMessage;
488
490 return;
491 }
492
496
497 // Saturos is overheard: the villagers know little of Sol Sanctum.
498 strangersMessage = MsgValeTheyKnowLittleOfThe;
499 Engine_EventSetMessage(strangersMessage);
501
502 // Isaac hurries forward and Garet and Jenna step out beside him.
507
509 x = actor->x.part.pixel;
510 z = actor->z.part.pixel;
513
514 Actor_SetSpeed(JENNA, PIXELS(6) / 5, PIXELS(3) / 5);
515 Actor_SetSpeed(GARET, PIXELS(6) / 5, PIXELS(3) / 5);
516 Actor_WalkTo(JENNA, 376, 328);
517 Actor_WalkToAndWait(GARET, 408, 328);
527 // The camera pans down to the strangers, and their theme plays.
528 Camera_SetSpeed(PIXELS(6), PIXELS(3) / 4);
529 Camera_MoveTo(PIXELS(215), -1, PIXELS(345), 1);
533
534 // Saturos and Menardi talk of the elders and of using Kraden, stubborn
535 // and cunning as he is.
550 // They sense they are watched; Saturos looks about, and both walk round to
551 // face the party.
564 Actor_WalkTo(ACTOR_SATUROS, 392, 360);
566 Actor_WalkTo(ACTOR_MENARDI, 376, 360);
568 Camera_MoveTo(PIXELS(393), -1, PIXELS(339), 1);
569 Actor_WalkTo(ACTOR_SATUROS, 392, 360);
575 // Saturos demands what they are doing; Garet throws it back; Menardi asks
576 // whether they were eavesdropping.
584
585 if (Engine_EventChooseYesNo(0, 0) == 0) {
586 Engine_EventSetMessage(strangersMessage + 10);
587 } else {
588 Engine_EventSetMessage(strangersMessage + 11);
589 }
590
593
594 // Garet accuses them of sneaking around; Menardi guesses Kraden's
595 // engagement was with the children, and Jenna says they are off to meet
596 // him.
597 accusationMessage = MsgValeYoureTheOnesSneakingAround;
598 Engine_EventSetMessage(accusationMessage);
611 // Saturos asks whether their appointment is important enough to drive the
612 // strangers away.
616
617 if (Engine_EventChooseYesNo(0, 0) == 0) {
618 Engine_EventSetMessage(accusationMessage + 5);
619 } else {
620 Engine_EventSetMessage(accusationMessage + 6);
621 }
622
631 // Saturos lets them go; Jenna is surprised and Menardi doubts him, but he
632 // sees no reason to delay the children.
633 Engine_EventSetMessage(MsgValeSaturosGo);
656 Actor_SetSpeed(ACTOR_MENARDI, PIXELS(1) / 2, PIXELS(1) / 4);
657 Actor_SetSpeed(ACTOR_SATUROS, PIXELS(1) / 2, PIXELS(1) / 4);
658
659 // The pair back away south without turning round.
664
665 Actor_WalkTo(ACTOR_SATUROS, 392, 376);
668
673
677 // Garet: let's go. The village music returns and Garet and Jenna walk back
678 // into Isaac; the strangers keep turning to watch him.
685
689
701}
702
703/// Walking up to the cottage: Kraden paces, wondering aloud who the strangers
704/// were and what they know of Sol Sanctum and the Elemental Stars.
705///
706/// Reached by stepping on cell code 5 in the day's events; runs once, setting
707/// FLAG_OVERHEARD_KRADEN.
708static void Event_OverhearKraden(void) {
709 struct FieldActor *leader;
710
712 } else {
715 // Kraden wonders aloud who they were, while Garet and Jenna step out of
716 // Isaac behind him.
717 Engine_EventSetMessage(MsgValeWho);
720 {
721 s32 x = leader->x.part.pixel;
722 s32 z = leader->z.part.pixel;
723
726 }
727 Actor_SetSpeed(JENNA, PIXELS(4) / 5, PIXELS(2) / 5);
728 Actor_SetSpeed(GARET, PIXELS(4) / 5, PIXELS(2) / 5);
729 Actor_WalkTo(JENNA, 296, 328);
730 Actor_WalkToAndWait(GARET, 280, 328);
737 // The camera goes up to the gate. Pacing, Kraden says they know more of
738 // Sol Sanctum than Vale's elders.
739 Engine_CameraMoveTo(PIXELS(232), -1, PIXELS(240), 1);
744 Actor_SetSpeed(ACTOR_KRADEN, PIXELS(1) / 5, PIXELS(1) / 10);
753 // He turns over what they said of the elements and the Elemental Stars,
754 // things even he does not know.
772 // The camera returns to Isaac, and Garet and Jenna walk back into him.
777 if (leader != 0) {
778 Engine_ActorSetDestination(GARET, leader->x.part.pixel,
779 leader->z.part.pixel);
780 }
785 if (leader != 0) {
786 Engine_ActorSetDestination(JENNA, leader->x.part.pixel,
787 leader->z.part.pixel);
788 }
793 }
794}
795
796/// Places the actors for the storm or for the day, and plays the arrival from
797/// the cottage.
798///
799/// The scene's initialize entry. On the stormy night (FLAG_VALE_STORM) it
800/// starts the lightning, removes the day's people, lays the survivor by the
801/// fence (unless FLAG_VALE_ROCKSLIDE_SURVIVOR_ESCAPED) and blocks the cells
802/// the rockslide covers. By day it removes the rocks and Garet, runs
803/// Event_KradenSetsOff from entrance 10, removes Kraden and the strangers once
804/// FLAG_SANCTUM_VISIT_PLANNED is set, and places the cottage visitor after
805/// Kalay. Clears FLAG_SCENE_TEMP_42 when the party keeps its position.
807 struct FieldActor *actor;
808 s32 debrisRow;
809
810 if (gGameState.entrance == 5 || gGameState.entrance == 6) {
812 }
815 }
816 // The rockslide chapter replaces residents with debris and a survivor.
826 {
827 struct FieldActor *actor = Object_GetById(8);
828
829 actor->collisionFlags = 8 | actor->collisionFlags;
830 }
835 {
836 s32 collisionRadius = 12;
837
838 actor->radius = collisionRadius;
839 }
844 }
845 debrisRow = 21;
847 Map_CopyCellAttributes(9, 24, 1, 1, 14, debrisRow);
848 Map_CopyCellAttributes(9, 24, 1, 1, 15, debrisRow);
849 Map_CopyCellAttributes(9, 24, 1, 1, 23, 19);
850 Map_CopyCellAttributes(9, 24, 1, 1, 24, 19);
851 debrisRow = 20;
852 Map_CopyCellAttributes(9, 24, 1, 1, 23, 20);
853 Map_CopyCellAttributes(9, 24, 1, 1, 24, 20);
854 } else {
861 if (gGameState.entrance == 10) {
863 }
864 }
869 } else {
879 }
880 }
883 }
885 }
886 return 0;
887}
888
889/// The man hurt in the rockslide asks whether he will die: yes, and he gives
890/// up; no, and he finds he is unhurt and runs off to the plaza.
891///
892/// Reached on the stormy night by talking to him (actor 11), or by stepping
893/// on cell code 20 until he has given up. Sets
894/// FLAG_VALE_ROCKSLIDE_SURVIVOR_GAVE_UP on yes, or
895/// FLAG_VALE_ROCKSLIDE_SURVIVOR_ESCAPED on no; once he has escaped it does
896/// nothing.
898 struct FieldActor *leader;
899 s32 message;
900
905 Engine_EventSetMessage(MsgValeSaveYourselves);
908 } else {
912 // He gasps out the rockslide and the monsters; Isaac and Garet hurry
913 // over to him.
914 message = MsgValeRockslideDestroyedFence;
915 Engine_EventSetMessage(message);
918 Engine_CameraMoveTo(PIXELS(98), -1, PIXELS(283), 1);
922 if (leader != 0) {
923 Engine_ActorSetPosition(GARET, leader->x.fixed, leader->z.fixed);
924 }
925 Actor_WalkToAndWait(GARET, 110, 279);
929 // He asks whether he will die. Yes: he gives up and tells them to save
930 // themselves.
932 if (Engine_EventChooseYesNo(0, 0) == 0) {
935 Engine_EventSetMessage((message + 2));
938 } else {
939 // No: he laments, then jumps up, finds he is not hurt at all, and
940 // warns them of the monsters on the way to the plaza.
943 Engine_EventSetMessage((message + 3));
956 // Follow his escape until the party can see that he is unharmed.
974 }
975 // Garet walks back into Isaac.
978 if (leader != 0) {
979 Engine_ActorSetDestination(GARET, leader->x.part.pixel,
980 leader->z.part.pixel);
981 }
985 }
986 }
987}
988
989/// On the stormy night, a monster attacks by the broken fence.
990///
991/// Reached by stepping on cell code 10 until
992/// FLAG_VALE_STORM_FIRST_MONSTER_FOUGHT is set. Sets it and
993/// FLAG_VALE_STORM_MONSTER_FOUGHT, and starts encounter 0 of table 12.
994static void Event_FightFirstMonster(void) {
995 struct EventWork *work;
996
998
999 work = gEventWork;
1001 work->transitionFrames = 64;
1002
1007}
1008
1009/// On the stormy night, a second monster attacks by the broken fence.
1010///
1011/// Reached by stepping on cell code 11 until
1012/// FLAG_VALE_STORM_SECOND_MONSTER_FOUGHT is set. Sets it and
1013/// FLAG_VALE_STORM_MONSTER_FOUGHT, and starts encounter 1 of table 12.
1014static void Event_FightSecondMonster(void) {
1015 struct EventWork *work;
1016
1018
1019 work = gEventWork;
1021 work->transitionFrames = 64;
1022
1027}
1028
1029/// After the party has reached Kalay, a villager at the cottage asks Isaac
1030/// about his memories of it.
1031///
1032/// Reached by talking to the cottage visitor (actor 16) in the events after
1033/// Kalay.
1036 Engine_EventSetMessage(MsgValeMemoriesOfThisCottage);
1037 Engine_EventAskYesNo(16, 0);
1039}
1040
1041/// Leads the party away from the broken fence, then leaves the map.
1043 SC_ARG(2), SC_MOVE(PIXELS(72), 0, PIXELS(294)),
1044 SC_SYNC, SC_MOVE(PIXELS(77), 0, PIXELS(329)),
1045 SC_SYNC, SC_MOVE(PIXELS(70), 0, PIXELS(415)),
1046 SC_SYNC, SC_POS(0, 0, 0),
1047 SC_END,
1048};
1049
1050/// Alternates the survivor's width and height while he lies by the fence.
1052 SC_ADD(SW_SCALE_Y, -Q16_ONE / 16),
1053 SC_ADD(SW_SCALE_X, Q16_ONE / 32),
1054 SC_WAIT(2),
1055 SC_ADD(SW_SCALE_Y, Q16_ONE / 32),
1056 SC_ADD(SW_SCALE_X, -Q16_ONE / 64),
1057 SC_WAIT(2),
1058 SC_ADD(SW_SCALE_Y, Q16_ONE / 64),
1059 SC_ADD(SW_SCALE_X, -Q16_ONE / 128),
1060 SC_WAIT(2),
1061 SC_ADD(SW_SCALE_Y, Q16_ONE / 64),
1062 SC_ADD(SW_SCALE_X, -Q16_ONE / 128),
1063 SC_WAIT(2),
1066 SC_WAIT(60),
1068};
1069
1070/// Keeps a linked actor facing its current target.
1072 SC_CALL(Scene_TurnTowardTarget),
1074};
1075
1077 {0, CONDITION_ALWAYS, 228, 0, 172, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1078 {1, CONDITION_ALWAYS, 454, 0, 290, FACING_WEST, 0, -1, -1, -1, -1, 0},
1079 {2, CONDITION_ALWAYS, 454, 0, 443, FACING_WEST, 0, -1, -1, -1, -1, 0},
1080 {3, CONDITION_ALWAYS, 229, 0, 233, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1081 {4, CONDITION_ALWAYS, 72, 0, 80, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1082 {6, CONDITION_ALWAYS, 104, 0, 104, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1083 {10, CONDITION_ALWAYS, 232, 0, 264, FACING_NORTH, 0, -1, -1, -1, -1, 0},
1085};
1086
1088 SCENE_EXITS(6), SCENE_EXIT(1, 4, 3), SCENE_EXIT(2, 4, 4),
1089 SCENE_EXIT(3, 8, 2), SCENE_EXIT(4, 93, 1), SCENE_EXIT(6, 93, 3),
1090 SCENE_EXIT(11, 3, 3), SCENE_EXIT(12, 3, 4), SCENE_EXIT(13, 8, 22),
1092};
1093
1094// clang-format off
1096 { 0x127, CONDITION_ALWAYS, ACTOR_STAND,
1097 PIXELS(72), 0, PIXELS(256), FACING_SOUTH, TALK_KEEP_FACING, 0 },
1099 PIXELS(240), 0, PIXELS(353), FACING_SOUTH, TALK_KEEP_FACING, 0 },
1101 PIXELS(384), 0, PIXELS(328), FACING_SOUTH, TALK_KEEP_FACING, 0 },
1103 PIXELS(83), 0, PIXELS(273), FACING_SOUTH, TALK_FACE_PARTY, 0 },
1107 PIXELS(232), 0, PIXELS(232), FACING_SOUTH, TALK_FACE_PARTY, 0 },
1109 PIXELS(1608), 0, PIXELS(1608), FACING_NORTH, TALK_FACE_PARTY, 0 },
1111 PIXELS(1608), 0, PIXELS(1608), FACING_NORTH, TALK_FACE_PARTY, 0 },
1113 PIXELS(232), 0, PIXELS(344), FACING_SOUTH + FACING_STEP, 3, 0 },
1115 PIXELS(200), 0, PIXELS(344), FACING_SOUTHEAST + FACING_STEP, 3, 0 },
1118 { SCENE_TABLE_END },
1119};
1120
1124 { EVENT_TALK, ACTOR_SATUROS, CONDITION_ALWAYS, MSGNO(MsgValeDoNotKeepKradenWaiting) },
1125 { EVENT_TALK, ACTOR_MENARDI, CONDITION_ALWAYS, MSGNO(MsgValeLeaveBeforeWeChangeMinds) },
1126 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_FENCE_ONLOOKER, CONDITION_ALWAYS, MSGNO(MsgValeCuriousBeyondFence) },
1127 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
1128 { EVENT_EXIT, 2, CONDITION_ALWAYS, 2 },
1130 { EVENT_EXIT, 4, CONDITION_ALWAYS, 4 },
1131 { EVENT_EXIT, 6, CONDITION_ALWAYS, 6 },
1136 { SCENE_EVENTS_END },
1137};
1138
1140 { EVENT_EXIT, 1, CONDITION_ALWAYS, 11 },
1141 { EVENT_EXIT, 2, CONDITION_ALWAYS, 12 },
1142 { EVENT_TALK, ACTOR_WEST_ROCK, CONDITION_ALWAYS, MSGNO(MsgValeRockCannotBeMoved) },
1143 { EVENT_TALK, ACTOR_EAST_ROCK, CONDITION_ALWAYS, MSGNO(MsgValeRockCannotBeMoved) },
1148 { SEARCH(SEARCH_JAR), 100, CONDITION_ALWAYS, 0 },
1149 { SCENE_EVENTS_END },
1150};
1151
1153 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
1154 { EVENT_EXIT, 2, CONDITION_ALWAYS, 2 },
1156 { EVENT_EXIT, 4, CONDITION_ALWAYS, 4 },
1157 { EVENT_EXIT, 6, CONDITION_ALWAYS, 6 },
1158 { EVENT_TALK, ACTOR_FENCE_ONLOOKER, CONDITION_ALWAYS, MSGNO(MsgValeWonderBeyondFence) },
1160 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_FENCE_ONLOOKER, CONDITION_ALWAYS, MSGNO(MsgValeAdventuresBeyondFence) },
1161 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_COTTAGE_VISITOR, CONDITION_ALWAYS, MSGNO(MsgValeLonelyWithoutKraden) },
1163#if TBS_PATCH_3
1165#endif
1166 { SCENE_EVENTS_END },
1167};
1168// clang-format on
1169
1171 MAP_CELL_STEP(2, 36, 2, 2, 1),
1172 MAP_CELL_STEP(4, 36, 2, 2, 1),
1174};
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_LIFT
Definition ability_ids.h:18
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Calls through a function pointer, by argument count.
#define GARET
Jerald.
#define JENNA
Jasmine.
The engine calls the debug menus import, and their palette swatch tiles.
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,...
@ 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
#define SPEAKER_PORTRAIT_LEFT
Definition field_event.h:54
static s32 Event_OpenMessage(s32 speaker, s32 flags)
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
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)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
#define GameFlag_IsSet
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)
#define EMOTE_IN_FRONT
Definition field_event.h:49
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Actor_RunActionScriptAndWait(s32 actor, const s32 *script)
Runs a script, waiting at most 300 frames for its final command.
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
#define GameFlag_Set
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(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_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
#define MAP_CELL_STEPS_END
Definition field_event.h:61
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_MapAnimateCells(const u16 *steps, s32 destX, s32 destY)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
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)
static void ColorBuffer_ApplySource(s32 value, s32 mode)
@ ACTOR_LINK_KEEP_MOTION
Definition field_obj.h:148
@ TRANSITION_WINDOW
Definition field_obj.h:17
@ TRANSITION_BACKDROP_FADE
Definition field_obj.h:16
#define SCENE_TRANSITION(style, variant)
Definition field_obj.h:20
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
Definition field_obj.h:166
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
#define FIND_ITEM(item)
@ EVENT_TOUCH
@ EVENT_EXIT
@ EVENT_TALK
@ 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_PARTY_LEADER
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FLAG_PARTY_LEFT_VALE
Definition field_scene.h:50
@ TALK_KEEP_FACING
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
@ ACTOR_STAND
#define SEARCH(target)
#define SCENE_EXITS_END
Definition field_scene.h:77
#define TOUCH_WALKING_INTO(facing)
@ 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)
@ SEARCH_JAR
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)
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_MET_SATUROS_AND_MENARDI
Definition flags.h:99
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_OVERHEARD_KRADEN
Kraden wondered aloud about the strangers.
Definition flags.h:445
#define FLAG_VALE_ROCKSLIDE_SURVIVOR_GAVE_UP
The man hurt in the rockslide believes he will die.
Definition flags.h:447
#define FLAG_REACHED_KALAY
Set whenever Kalay is entered; Vale's villagers then talk of the party's journey.
Definition flags.h:441
#define FLAG_SANCTUM_VISIT_PLANNED
Definition flags.h:96
#define FLAG_VALE_STORM_MONSTER_FOUGHT
A monster was fought on the stormy night: Vale's music changes (song 23).
Definition flags.h:453
#define FLAG_VALE_ROCKSLIDE_SURVIVOR_ESCAPED
He found he was unhurt and ran to the plaza.
Definition flags.h:449
#define FLAG_VALE_STORM_FIRST_MONSTER_FOUGHT
Definition flags.h:450
#define FLAG_VALE_STORM
The prologue's stormy night: lightning over Vale, the rockslide and the monsters loose in the village...
Definition flags.h:438
#define FLAG_KEEP_PARTY_POSITION
Definition flags.h:93
#define FLAG_VALE_KRADEN_JAR_ELIXIR
The jar's Elixir by the cottage; after Kalay it is searchable only from the third patch.
Definition flags.h:456
#define FLAG_SCENE_TEMP_42
Definition flags.h:779
#define FLAG_VALE_STORM_SECOND_MONSTER_FOUGHT
Definition flags.h:451
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.
void Effect_SoundAndFlash(void)
Item numbers, named from the English release.
@ ITEM_ELIXIR
Definition item_ids.h:48
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_SET(w, v)
Write a work value.
Definition objcmd.h:37
#define SC_LOOP(n, to)
Repeat up to n times.
Definition objcmd.h:28
#define SC_POS(x, y, z)
Set position.
Definition objcmd.h:18
#define SC_SYNC
Wait for arrival.
Definition objcmd.h:17
#define SC_FOREVER
Definition objcmd.h:14
#define SC_ADD(w, v)
Definition objcmd.h:38
#define SC_ARG(v)
Definition objcmd.h:44
#define SC_MOVE(x, y, z)
Move toward the target.
Definition objcmd.h:19
#define SC_WAIT(n)
Wait n frames.
Definition objcmd.h:16
#define SC_TOP
Script start.
Definition objcmd.h:13
#define SC_END
Return to the main script.
Definition objcmd.h:32
@ SW_SCALE_Y
Definition objcmd.h:63
@ SW_SCALE_X
Definition objcmd.h:62
#define SC_CALL(fn)
Definition objcmd.h:50
Palette fades, the battle effect palette buffers and the colour channel curves.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
Definition palbuf.h:72
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone.
Definition requests.c:14
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
Definition scene.c:355
Song and sound effect ids, indices into gSound_SongTable.
#define SE_DOOR_OPEN
Definition songs.h:153
#define MUS_061
Definition songs.h:65
#define MUS_017
Definition songs.h:27
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_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#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
u16 message
the next message, advanced as each window opens
Definition event_work.h:47
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
u16 radius
Collision radius in pixels: 16, or half the sprite metadata's boxY, when created; the overlap checks ...
Definition field_obj.h:43
u8 steeringFlags
ActorSteeringFlag bits.
Definition field_obj.h:92
union FieldCoordinate x
16.16 fixed-point pixels
Definition field_obj.h:35
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
u16 facing
1/65536 turns
Definition field_obj.h:34
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
Definition field_obj.h:91
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
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
static __inline__ void ValeKraden_NodTogether(void)
Finishes the party's nod together before the next line of dialogue.
Definition vale_kraden.c:79
static void Event_OverhearKraden(void)
Walking up to the cottage: Kraden paces, wondering aloud who the strangers were and what they know of...
static __inline__ void ValeKraden_FacePartySouth(void)
Turns all three party members toward the strangers.
Definition vale_kraden.c:86
static void Event_MeetSaturosAndMenardi(void)
Walking past the two strangers: Isaac, Garet and Jenna overhear Saturos and Menardi,...
const struct ScenePlacement * ValeKraden_GetPlacements(void)
Returns the one placement table for every visit; ValeKraden_Initialize removes the actors a visit doe...
Definition vale_kraden.c:61
static void Event_KradenPlansSanctumVisit(void)
Talking to Kraden outside his cottage: he talks Isaac, Garet and Jenna into a secret look at Sol Sanc...
static void Event_FightSecondMonster(void)
On the stormy night, a second monster attacks by the broken fence.
static void Event_EnterCottage(void)
Walking into the cottage: the gate opens unless Kraden left it open.
struct SceneEvent gValeKraden_StormEvents[]
static void Event_TalkToCottageVisitor(void)
After the party has reached Kalay, a villager at the cottage asks Isaac about his memories of it.
struct ScenePlacement gValeKraden_Placements[]
const struct SceneEntrance * ValeKraden_GetEntrances(void)
Definition vale_kraden.c:51
s32 ValeKraden_Initialize(void)
Places the actors for the storm or for the day, and plays the arrival from the cottage.
s32 gValeKraden_RockslideSurvivorSwayActions[]
Alternates the survivor's width and height while he lies by the fence.
static void Event_TalkToFenceOnlooker(void)
The child at the fence asks whether Isaac hears the growls beyond it; once the party has left Vale,...
static __inline__ void ValeKraden_WalkTowardLeader(s32 companionId)
Starts a companion walking back to Isaac's current pixel position.
Definition vale_kraden.c:93
struct SceneEvent gValeKraden_Events[]
static void Event_TalkToRockslideSurvivor(void)
The man hurt in the rockslide asks whether he will die: yes, and he gives up; no, and he finds he is ...
static void Event_FightFirstMonster(void)
On the stormy night, a monster attacks by the broken fence.
s32 gValeKraden_FaceTargetActions[]
Keeps a linked actor facing its current target.
struct SceneEntrance gValeKraden_Entrances[]
const u32 * ValeKraden_GetExits(void)
Definition vale_kraden.c:57
u32 gValeKraden_Exits[]
s32 gValeKraden_RockslideSurvivorEscapeActions[]
Leads the party away from the broken fence, then leaves the map.
const struct SceneRegion * ValeKraden_GetRegions(void)
Definition vale_kraden.c:55
static void Event_KradenSetsOff(void)
Arriving by entrance 10, from the cottage: Kraden comes out ready, and everyone joins Isaac for the m...
const struct SceneEvent * ValeKraden_GetEvents(void)
Selects the events for the current visit to Vale: after Kalay (FLAG_REACHED_KALAY),...
Definition vale_kraden.c:68
ValeKradenActor
Definition vale_kraden.c:37
@ ACTOR_ROCKSLIDE_SURVIVOR
Definition vale_kraden.c:41
@ ACTOR_COTTAGE_VISITOR
Definition vale_kraden.c:46
@ ACTOR_WEST_ROCK
The west rock. "It's a huge rock that Isaac's strength can't even budge.".
Definition vale_kraden.c:39
@ ACTOR_EAST_ROCK
Definition vale_kraden.c:40
@ ACTOR_FENCE_ONLOOKER
Definition vale_kraden.c:42
u16 gValeKraden_GateCells[]
struct SceneEvent gValeKraden_EventsAfterKalay[]
void FieldFx_StartLightning(void)
Starts the storm's lightning (FieldFx_UpdateLightning): builds the dark (0x10003) and lit (0x10005) p...
Definition weather.c:425