Alchemy
Loading...
Searching...
No Matches

vault_jail.c

Go to the documentation of this file.
1/// @file
2/// Vault's jail, where the thieves who stole Hammet's Shaman's Rod are held; on
3/// the party's return a lone prisoner takes their place.
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 "ability_ids.h"
20#include "field_event.h"
21#include "field_scene.h"
22#include "flags.h"
23#include "item_ids.h"
24#include "songs.h"
25#include "text/msg_ids.h"
26
31};
32
37};
38
39enum { ENTRANCE_FROM_JAIL = 12 };
40
50};
51
57};
58
63};
64
65enum { CELL_COLLISION_FLAGS = 0x14 };
66
67/// Returns the entrances from Vault, Lunpa and the revisited Vault.
68const struct SceneEntrance *Scene_GetEntrances(void) { return gJailEntrances; }
69
70const struct SceneRegion *Scene_GetRegions(void) { return NULL; }
71
72/// Returns the exits to Vault, to the revisited Vault and to Lunpa.
73const u32 *Scene_GetExits(void) { return gJailExits; }
74
75/// Places the three jailed thieves, or, entered from the revisited Vault
76/// (entrance 10, after they have broken out), the lone prisoner.
80 }
82}
83
84/// Returns the thieves' events, or the prisoner's when the party came in from
85/// the revisited Vault, matching Scene_GetPlacements.
86const struct SceneEvent *Scene_GetEvents(void) {
89 }
90 return gJailThiefEvents;
91}
92
93/// The jailed leader glares at each of his men and snaps at them, then turns to
94/// the party: they got us this time, but you'll pay for this. "Shut yer yaps!"
95///
96/// Reached by talking to the thieves' leader (actor 8) while
97/// FLAG_VAULT_THIEVES_JAILED is set.
98static void Event_LeaderSilencesThieves(void) {
100
103
106
107 // "Shut yer yaps!"; the two thieves start.
108 Engine_EventSetMessage(MsgVaultThiefLeaderSilencesThieves);
110
114
115 // Turn from the two thieves to the party for the remaining dialogue.
118
121
123
125}
126
127/// The left thief wishes they had escaped to the cave northeast of the Goma
128/// Range.
129///
130/// Reached by talking to the left thief (actor 9) while
131/// FLAG_VAULT_THIEVES_JAILED is set.
136 Engine_EventSetMessage(MsgVaultLeftThiefRegretsEscape);
139}
140
141/// The right thief shakes his head: they should have skipped town sooner.
142///
143/// Reached by talking to the right thief (actor 10) while
144/// FLAG_VAULT_THIEVES_JAILED is set.
149 Engine_EventSetMessage(MsgVaultRightThiefRegretsStaying);
152}
153
154/// Mind Read on the leader: he'll be out of this jail before you know it.
155///
156/// Reached by Mind Read on actor 8 while FLAG_VAULT_THIEVES_JAILED is set; the
157/// two below are reached the same way on actors 9 and 10.
158static void Event_ReadLeaderMind(void) {
160 Engine_EventSetMessage(MsgVaultThiefLeaderThoughts);
163}
164
165/// Mind Read on the left thief: will he ever run free again?
166static void Event_ReadLeftThiefMind(void) {
168 Engine_EventSetMessage(MsgVaultLeftThiefThoughts);
171}
172
173/// Mind Read on the right thief: is this for stealing Hammet's Shaman's Rod?
174static void Event_ReadRightThiefMind(void) {
176 Engine_EventSetMessage(MsgVaultRightThiefThoughts);
179}
180
181/// The party steps out of the jail into Vault.
182///
183/// Reached by stepping on the Vault door (cell code 1) while the thieves are
184/// held; takes exit 1 to Vault's entrance 12. The prisoner's events leave by
185/// exit 2 instead, to the revisited Vault.
186static void Event_LeaveForVault(void) {
189}
190
191/// Opens the scene through a window transition and makes the occupants solid.
192///
193/// Called by the engine once the actors are placed. Coming up from Lunpa
194/// (entrance 2) clears FLAG_SHOW_LOCATION_NAME, so no place name is shown;
195/// otherwise it adds collision flags 0x14 to the prisoner or to the three
196/// thieves.
198 s16 entrance;
199
201 entrance = gGameState.entrance;
202
203 if (entrance == JAIL_ENTRANCE_FROM_LUNPA) {
205 } else if (entrance == JAIL_ENTRANCE_FROM_VAULT_REVISIT) {
207 } else {
211 }
212
213 return 0;
214}
215
216// clang-format off
218 { 0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
219 { JAIL_ENTRANCE_FROM_VAULT, CONDITION_ALWAYS, 80, 0, 232, FACING_NORTH, 0, 16, 48, 304, 256, 0 },
220 { JAIL_ENTRANCE_FROM_LUNPA, CONDITION_ALWAYS, 544, 0, 280, FACING_NORTH, 0, 440, 48, 680, 312, 0 },
221 { JAIL_ENTRANCE_FROM_VAULT_REVISIT, CONDITION_ALWAYS, 80, 0, 232, FACING_NORTH, 0, 16, 48, 304, 256, 0 },
222 { SCENE_TABLE_END },
223};
224
225const u32 gJailExits[] = {
231};
232
235 PIXELS(168), 0, PIXELS(144), FACING_SOUTH, TALK_FACE_PARTY, 0 },
240 { SCENE_TABLE_END },
241};
242
245 PIXELS(168), 0, PIXELS(144), FACING_SOUTH, TALK_FACE_PARTY, 0 },
246 { SCENE_TABLE_END },
247};
248
249const struct SceneEvent gJailThiefEvents[] = {
276};
277// clang-format on
278
283 MsgVaultPrisonerRegretsFight},
285 MsgVaultPrisonerThoughts},
287};
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
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.
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_SHAKE_HEAD
Definition field_event.h:46
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_GameFlagClear(s32 flag)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
@ TRANSITION_WINDOW
Definition field_obj.h:17
#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_TOUCH
@ EVENT_EXIT
@ EVENT_TALK
@ FACING_STEP
Definition field_scene.h:36
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define IF_FLAG_SET(flag)
Definition field_scene.h:48
@ SCENE_VAULT
Definition field_scene.h:14
@ SCENE_VAULT_JAIL
Definition field_scene.h:15
@ SCENE_LUNPA
Definition field_scene.h:17
@ SCENE_VAULT_REVISIT
Definition field_scene.h:16
#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
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
@ ACTOR_STAND
#define SEARCH(target)
#define SCENE_EXITS_END
Definition field_scene.h:77
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_SOUTH
Definition field_scene.h:28
#define PIXELS(value)
@ SEARCH_CHEST
#define FIND_COINS(coins)
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_VAULT_THIEVES_JAILED
Definition flags.h:106
#define FLAG_JAIL_CHEST_COINS
Definition flags.h:583
#define FLAG_JAIL_CHEST_WATER_OF_LIFE
Definition flags.h:579
#define FLAG_JAIL_CHEST_ANTIDOTE
Definition flags.h:582
#define FLAG_JAIL_CHEST_ELIXIR
Definition flags.h:584
#define FLAG_JAIL_CHEST_SMOKE_BOMB
Definition flags.h:580
#define FLAG_JAIL_CHEST_LUCKY_MEDAL
Definition flags.h:581
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_ELIXIR
Definition item_ids.h:48
@ ITEM_ANTIDOTE
Definition item_ids.h:47
@ ITEM_SMOKE_BOMB
Definition item_ids.h:67
@ ITEM_WATER_OF_LIFE
Definition item_ids.h:49
@ ITEM_LUCKY_MEDAL
Definition item_ids.h:70
The reel game's title lettering.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_MAP_EXIT
Definition songs.h:116
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#define NULL
Definition bilibin.h:6
@ JAIL_ENTRANCE_FROM_LUNPA
Definition lunpa.h:61
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
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
signed short s16
Definition types.h:12
@ ACTOR_THIEF_LEADER
JailEntrance
Definition vault_jail.c:27
@ JAIL_ENTRANCE_FROM_VAULT
Definition vault_jail.c:28
@ JAIL_ENTRANCE_FROM_VAULT_REVISIT
Definition vault_jail.c:30
static void Event_ReadLeaderMind(void)
Mind Read on the leader: he'll be out of this jail before you know it.
Definition vault_jail.c:158
const struct SceneEntrance gJailEntrances[]
Definition vault_jail.c:217
JailExit
Definition vault_jail.c:33
@ JAIL_EXIT_TO_VAULT_REVISIT
Definition vault_jail.c:35
@ JAIL_EXIT_TO_LUNPA
Definition vault_jail.c:36
@ JAIL_EXIT_TO_VAULT
Definition vault_jail.c:34
JailActor
Definition vault_jail.c:52
@ ACTOR_PRISONER
Definition vault_jail.c:56
@ ACTOR_LEFT_THIEF
Definition vault_jail.c:54
@ ACTOR_RIGHT_THIEF
Definition vault_jail.c:55
const struct ScenePlacement gJailThiefPlacements[]
Definition vault_jail.c:233
@ ENTRANCE_FROM_JAIL
Definition vault_jail.c:39
static void Event_LeftThiefRegretsEscape(void)
The left thief wishes they had escaped to the cave northeast of the Goma Range.
Definition vault_jail.c:132
static void Event_ReadRightThiefMind(void)
Mind Read on the right thief: is this for stealing Hammet's Shaman's Rod?
Definition vault_jail.c:174
static void Event_ReadLeftThiefMind(void)
Mind Read on the left thief: will he ever run free again?
Definition vault_jail.c:166
@ CELL_COLLISION_FLAGS
Definition vault_jail.c:65
const struct SceneEvent gJailPrisonerEvents[]
Definition vault_jail.c:279
const struct ScenePlacement gJailPrisonerPlacements[]
Definition vault_jail.c:243
JailSprite
Definition vault_jail.c:59
@ SPRITE_THIEF_LEADER
Definition vault_jail.c:60
@ SPRITE_THIEF
Definition vault_jail.c:61
@ SPRITE_PRISONER
Definition vault_jail.c:62
const struct SceneEvent gJailThiefEvents[]
Definition vault_jail.c:249
static void Event_RightThiefRegretsStaying(void)
The right thief shakes his head: they should have skipped town sooner.
Definition vault_jail.c:145
JailTrigger
Definition vault_jail.c:41
@ TRIGGER_CHEST_COINS
Definition vault_jail.c:48
@ TRIGGER_CHEST_ANTIDOTE
Definition vault_jail.c:47
@ TRIGGER_CHEST_LUCKY_MEDAL
Definition vault_jail.c:46
@ TRIGGER_LUNPA_DOOR
Definition vault_jail.c:43
@ TRIGGER_CHEST_ELIXIR
Definition vault_jail.c:49
@ TRIGGER_CHEST_WATER_OF_LIFE
Definition vault_jail.c:44
@ TRIGGER_CHEST_SMOKE_BOMB
Definition vault_jail.c:45
@ TRIGGER_VAULT_DOOR
Definition vault_jail.c:42
const u32 gJailExits[]
Definition vault_jail.c:225
static void Event_LeaveForVault(void)
The party steps out of the jail into Vault.
Definition vault_jail.c:186
static void Event_LeaderSilencesThieves(void)
The jailed leader glares at each of his men and snaps at them, then turns to the party: they got us t...
Definition vault_jail.c:98