Alchemy
Loading...
Searching...
No Matches

suhalla.c

Go to the documentation of this file.
1/// @file
2/// Suhalla, the town at the edge of the Suhalla Desert. Once Babi's audience
3/// after Colosso has been held, its people stand and talk differently: the
4/// sandstorms have brought Tolbi's soldiers to the town.
5
6#include "game_state.h"
10#include "battle.h"
11#include "debug.h"
12#include "field.h"
13#include "game.h"
14#include "graphics.h"
15#include "menu.h"
16#include "minigame.h"
17#include "sound.h"
18#include "system.h"
19#include "types.h"
20#include "field_event.h"
21#include "text/msg_ids.h"
22#include "ability_ids.h"
23#include "field_scene.h"
24#include "item_ids.h"
25#include "songs.h"
26#include "flags.h"
27
28// FLAG_SCENE_TEMP_01: Growth has made the sprout grow.
29
30/// Arriving by this entrance also marks Babi's audience as held.
31enum { ENTRANCE_90 = 90 };
32
33/// The sprout at 72, 144, the last of the placements.
34enum { SPROUT = 16 };
35
36const struct SceneEntrance *Scene_GetEntrances(void) {
37 return gSuhallaEntrances;
38}
39
40const struct SceneRegion *Scene_GetRegions(void) { return NULL; }
41
42const u32 *Scene_GetExits(void) { return gSuhallaExits; }
43
44/// The townsfolk, who stand elsewhere after Babi's audience.
48 }
49 return gSuhallaPlacements;
50}
51
52/// A villager asks about Lalivero and answers yes or no.
53/// "Are you trying to get to Lalivero?"
54static void Event_AskIfGoingToLalivero(s32 actorId) {
55 s32 firstMessage = MsgSuhallaTryingGetLalivero;
56 Engine_EventSetMessage(firstMessage);
57 Engine_EventOpenMessage(actorId, 0);
60 Engine_EventSetMessage(firstMessage + 1);
61 } else {
62 Engine_EventSetMessage(firstMessage + 2);
63 }
64 Engine_EventShowMessage(actorId, 0);
65}
66
67/// After Babi's audience a villager asks whether the sandstorm brought the
68/// party to Suhalla, and answers yes or no.
69static void Event_AskIfBroughtBySandstorm(s32 actorId) {
70 s32 firstMessage = MsgSuhallaBroughtSuhallaSandstorm;
71 Engine_EventSetMessage(firstMessage);
72 Engine_EventOpenMessage(actorId, 0);
75 Engine_EventSetMessage(firstMessage + 1);
76 } else {
77 Engine_EventSetMessage(firstMessage + 2);
78 }
79 Engine_EventShowMessage(actorId, 0);
80}
81
82/// Growth on the sprout: the plant grows, and its map cell takes the
83/// attributes of the grown plant's cell.
84static void Event_GrowSprout(void) {
85 Map_CopyCellAttributes(25, 9, 1, 1, 4, 9);
87}
88
89/// The leader walks north into a doorway: the door opens, the leader steps
90/// through and the party leaves by that exit.
91static void Event_EnterDoor(void) {
92 struct EventWork *work = gEventWork;
93 s32 exitTrigger = work->touchedTrigger;
94 u16 cellX = gSuhallaDoorCells[exitTrigger][0];
95 u16 cellZ = gSuhallaDoorCells[exitTrigger][1];
96
99 // Walk through the opening while the exit transition counts down.
102 Engine_EventRequestExit(exitTrigger);
103}
104
105/// The same through the wide door of trigger 2.
106static void Event_EnterWideDoor(void) {
107 struct EventWork *work = gEventWork;
108 s32 exitTrigger = work->touchedTrigger;
109 u16 cellX = gSuhallaDoorCells[exitTrigger][0];
110 u16 cellZ = gSuhallaDoorCells[exitTrigger][1];
111
116 Engine_EventRequestExit(exitTrigger);
117}
118
119/// The doors, the townsfolk, the treasure and the sprout, before or after
120/// Babi's audience.
121const struct SceneEvent *Scene_GetEvents(void) {
123 return gSuhallaEventsLater;
124 }
125 return gSuhallaEvents;
126}
127
128/// Sets Suhalla up as the party enters, with the sprout grown if Growth was
129/// used on it.
131 struct EventWork *work;
132
135 }
136
137 work = gEventWork;
139 work->transitionFrames = 24;
140
144 }
145 return 0;
146}
147
149 {0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
150 {1, CONDITION_ALWAYS, 136, 0, 152, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
151 {2, CONDITION_ALWAYS, 256, 0, 120, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
152 {3, CONDITION_ALWAYS, 88, 0, 296, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
153 {4, CONDITION_ALWAYS, 216, 0, 280, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
154 {5, CONDITION_ALWAYS, 296, 0, 296, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
155 {6, CONDITION_ALWAYS, 120, 0, 272, FACING_EAST, 0, -1, -1, -1, -1, 0},
156 {10, CONDITION_ALWAYS, 40, 0, 176, FACING_EAST, 0, -1, -1, -1, -1, 0},
158};
159
161 SCENE_EXITS(167), SCENE_EXIT(1, 168, 1), SCENE_EXIT(2, 168, 2),
162 SCENE_EXIT(3, 168, 3), SCENE_EXIT(4, 168, 4), SCENE_EXIT(5, 168, 5),
163 SCENE_EXIT(10, 2, 27), SCENE_EXIT(11, 2, 56), SCENE_EXIT(12, 2, 57),
165};
166
167// clang-format off
170 PIXELS(104), 0, PIXELS(184), FACING_WEST, TALK_FACE_PARTY, 0 },
172 PIXELS(184), 0, PIXELS(304), FACING_WEST, TALK_FACE_PARTY, 0 },
176 PIXELS(-64), 0, PIXELS(-64), FACING_SOUTH, TALK_FACE_PARTY, 0 },
178 PIXELS(248), 0, PIXELS(168), FACING_NORTH, TALK_FACE_PARTY, 0 },
180 PIXELS(104), 0, PIXELS(320), FACING_SOUTHEAST, TALK_FACE_PARTY, 0 },
184 PIXELS(168), 0, PIXELS(208), FACING_SOUTH, TALK_FACE_PARTY, 0 },
186 PIXELS(72), 0, PIXELS(144), FACING_SOUTH, TALK_FACE_PARTY, 0 },
187 { SCENE_TABLE_END },
188};
189
192 PIXELS(104), 0, PIXELS(184), FACING_WEST, TALK_FACE_PARTY, 0 },
198 PIXELS(88), 0, PIXELS(336), FACING_SOUTHEAST, TALK_FACE_PARTY, 0 },
200 PIXELS(248), 0, PIXELS(168), FACING_NORTH, TALK_FACE_PARTY, 0 },
202 PIXELS(104), 0, PIXELS(320), FACING_SOUTHEAST, TALK_FACE_PARTY, 0 },
204 PIXELS(72), 0, PIXELS(104), FACING_SOUTH, TALK_FACE_PARTY, 0 },
206 PIXELS(168), 0, PIXELS(208), FACING_SOUTH, TALK_FACE_PARTY, 0 },
208 PIXELS(72), 0, PIXELS(144), FACING_SOUTH, TALK_FACE_PARTY, 0 },
209 { SCENE_TABLE_END },
210};
211
212/// The cell each door's opening is drawn at, by trigger.
214 { 0, 0 }, { 8, 7 }, { 15, 5 }, { 5, 16 }, { 13, 15 }, { 18, 16 },
215};
216
218 MAP_CELL_STEP(25, 0, 1, 2, 8), MAP_CELL_STEP(26, 0, 1, 2, 1), MAP_CELL_STEPS_END,
219};
220
222 MAP_CELL_STEP(26, 2, 2, 2, 8), MAP_CELL_STEP(28, 2, 2, 2, 1), MAP_CELL_STEPS_END,
223};
224
231 { EVENT_EXIT, 10, CONDITION_ALWAYS, 10 },
232 { EVENT_EXIT, 11, CONDITION_ALWAYS, 11 },
233 { EVENT_EXIT, 12, CONDITION_ALWAYS, 12 },
234 { EVENT_TALK, 8, CONDITION_ALWAYS, MSGNO(MsgSuhallaThisIsSuhallaDontTryCrossing) },
236 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgSuhallaWeGondowansWillNeverTrustAnyone) },
237 { EVENT_TALK, 12, CONDITION_ALWAYS, MSGNO(MsgSuhallaItHasBeenSaidForAges) },
238 { EVENT_TALK, 13, CONDITION_ALWAYS, MSGNO(MsgSuhallaYouCantGetToSouthernGondowan) },
239 { EVENT_TALK, 14, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheWorkersSayTherereHugeFestivals) },
240 { EVENT_TALK, 15, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheSandstormsSuddenlyIncreasedIHope) },
241 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 8, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheSuhallaHasLongBeenKnown) },
242 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgSuhallaThePeopleOfLaliveroHaveBeen) },
243 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheRulerOfTolbiTookA) },
244 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 12, CONDITION_ALWAYS, MSGNO(MsgSuhallaIKnowTheDesertSpiritsWill) },
245 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 13, CONDITION_ALWAYS, MSGNO(MsgSuhallaSouthernGondowanIsGuardedByThe) },
246 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 14, CONDITION_ALWAYS, MSGNO(MsgSuhallaIveHeardThatTolbisColossoIs) },
247 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 15, CONDITION_ALWAYS, MSGNO(MsgSuhallaNoneOfTheGrownUpsIn) },
248 { SEARCH(SEARCH_CHEST), 100, 0xfad, FIND_ITEM(ITEM_HARD_NUT) },
249 { SEARCH(SEARCH_JAR), 101, 0xfae, FIND_ITEM(ITEM_LUCKY_MEDAL) },
250 { SEARCH(SEARCH_JAR), 102, 0xfaf, FIND_COINS(5) },
253};
254
261 { EVENT_EXIT, 10, CONDITION_ALWAYS, 10 },
262 { EVENT_EXIT, 11, CONDITION_ALWAYS, 11 },
263 { EVENT_EXIT, 12, CONDITION_ALWAYS, 12 },
264 { EVENT_TALK, 8, CONDITION_ALWAYS, MSGNO(MsgSuhallaWelcomeToSuhallaIBetThe) },
265 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheDesertIsEnvelopedInSandstorms) },
266 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgSuhallaSoldiersFromTolbiWereCaughtIn) },
267 { EVENT_TALK, 11, CONDITION_ALWAYS, MSGNO(MsgSuhallaWeWereBroughtHereByThe) },
268 { EVENT_TALK, 12, CONDITION_ALWAYS, MSGNO(MsgSuhallaThisSandstormIsTheFaultOf) },
270 { EVENT_TALK, 14, CONDITION_ALWAYS, MSGNO(MsgSuhallaWhyAreTheSandstormsAttackingHumans) },
271 { EVENT_TALK, 15, CONDITION_ALWAYS, MSGNO(MsgSuhallaThoseSoldiersKeptMumblingAboutMonsters) },
272 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 8, CONDITION_ALWAYS, MSGNO(MsgSuhallaIBetTheseWarriorsWereBrought) },
273 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgSuhallaIWonderWhyThereAreSo) },
274 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheSoldiersFromTolbiWereCollapsing) },
275 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 11, CONDITION_ALWAYS, MSGNO(MsgSuhallaAfterYouGetSwallowedByA) },
276 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 12, CONDITION_ALWAYS, MSGNO(MsgSuhallaLatelyAllTheSandstormsHaveBeen) },
277 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 13, CONDITION_ALWAYS, MSGNO(MsgSuhallaIfYouFightTheStormsYoull) },
278 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 14, CONDITION_ALWAYS, MSGNO(MsgSuhallaGrownUpsSayTheSandstormsAttack) },
279 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 15, CONDITION_ALWAYS, MSGNO(MsgSuhallaTheySayTheSoldiersWereRavaged) },
280 { SEARCH(SEARCH_CHEST), 100, 0xfad, FIND_ITEM(ITEM_HARD_NUT) },
281 { SEARCH(SEARCH_JAR), 101, 0xfae, FIND_ITEM(ITEM_LUCKY_MEDAL) },
282 { SEARCH(SEARCH_JAR), 102, 0xfaf, FIND_COINS(5) },
285};
286// clang-format on
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_GROWTH
Definition ability_ids.h:10
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.
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,...
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
static void Event_PlayCue(s32 cue)
#define MAP_CELL_STEPS_END
Definition field_event.h:61
s32 Engine_GameFlagIsSet(s32 flag)
static void Actor_WalkBy(s32 actor, s32 dx, s32 dz)
void Engine_EventWait(s32 frames)
@ TRANSITION_BACKDROP_FADE
Definition field_obj.h:16
#define SCENE_TRANSITION(style, variant)
Definition field_obj.h:20
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
#define FIND_ITEM(item)
@ EVENT_EXIT
@ EVENT_TALK
#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
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
@ ACTOR_WANDER
@ 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_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
@ SEARCH_JAR
@ SEARCH_CHEST
#define FIND_COINS(coins)
Game flags, named where their meaning is shown.
#define FLAG_BABI_SPOKE_AFTER_COLOSSO
Babi and Iodem have spoken with the party after Colosso.
Definition flags.h:209
#define FLAG_SCENE_TEMP_01
Definition flags.h:714
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.
@ ITEM_HARD_NUT
Definition item_ids.h:53
@ ITEM_LUCKY_MEDAL
Definition item_ids.h:70
static void Event_EnterDoor(void)
The leader walks into a doorway: the door opens and the leader goes in.
Definition lunpa.c:438
The reel game's title lettering.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_DOOR_OPEN
Definition songs.h:153
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
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
s16 touchedTrigger
the step event a touch or exit event answers
Definition event_work.h:26
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...
struct SceneEvent gSuhallaEventsLater[]
Definition suhalla.c:255
@ SPROUT
Definition suhalla.c:34
@ ENTRANCE_90
Definition suhalla.c:31
u32 gSuhallaExits[]
Definition suhalla.c:160
struct SceneEntrance gSuhallaEntrances[]
Definition suhalla.c:148
u16 gSuhallaDoorOpenSteps[]
Definition suhalla.c:217
static void Event_AskIfGoingToLalivero(s32 actorId)
A villager asks about Lalivero and answers yes or no.
Definition suhalla.c:54
struct SceneEvent gSuhallaEvents[]
Definition suhalla.c:225
static void Event_EnterWideDoor(void)
The same through the wide door of trigger 2.
Definition suhalla.c:106
u16 gSuhallaWideDoorOpenSteps[]
Definition suhalla.c:221
s16 gSuhallaDoorCells[][2]
The cell each door's opening is drawn at, by trigger.
Definition suhalla.c:213
static void Event_GrowSprout(void)
Growth on the sprout: the plant grows, and its map cell takes the attributes of the grown plant's cel...
Definition suhalla.c:84
struct ScenePlacement gSuhallaPlacementsLater[]
Definition suhalla.c:190
static void Event_AskIfBroughtBySandstorm(s32 actorId)
After Babi's audience a villager asks whether the sandstorm brought the party to Suhalla,...
Definition suhalla.c:69
struct ScenePlacement gSuhallaPlacements[]
Definition suhalla.c:168
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
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13