Alchemy
Loading...
Searching...
No Matches

lunpa_suhalla.c

Go to the documentation of this file.
1/// @file
2/// The buildings of Lunpa, and the house by the gate to Suhalla: homes, the
3/// weapon, armor and item shops, the inn and the temple. The shops and the inn
4/// only trade once Lunpa has reopened.
5
6#include "game_state.h"
7#include "field_event.h"
11#include "lunpa_suhalla.h"
12#include "scene_ids.h"
13#include "text/msg_ids.h"
14
15static void Event_TalkToInnkeeper(void);
16static void Event_TalkToChef(void);
17static void Event_ReadChefsThoughts(void);
18static void Event_TalkToInnClerk(void);
19static void Event_TalkToTemplePriest(void);
20static void Event_ReadItemMerchantsThoughts(void);
21static void Event_TalkToItemMerchant(void);
22static void Event_ReadWeaponMerchantsThoughts(void);
23static void Event_TalkToWeaponMerchant(void);
24static void Event_ReadArmorMerchantsThoughts(void);
25static void Event_TalkToArmorMerchant(void);
26static void Event_TalkToTravelingPriest(void);
27
28// clang-format off
30 { 0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
31 { ROOM_FIRST_HOME, CONDITION_ALWAYS, 192, 0, 184, FACING_NORTH, 0, 16, 0, 256, 224, 0 },
32 { ROOM_SECOND_HOME, CONDITION_ALWAYS, 432, 0, 264, FACING_NORTH, 0, 296, 48, 536, 288, 0 },
33 { ROOM_THIRD_HOME, CONDITION_ALWAYS, 160, 0, 584, FACING_NORTH, 0, 16, 400, 256, 624, 0 },
34 { ROOM_ARMS_SHOP, CONDITION_ALWAYS, 464, 0, 616, FACING_NORTH, 0, 296, 384, 536, 640, 0 },
35 { ROOM_ITEM_SHOP, CONDITION_ALWAYS, 704, 0, 584, FACING_NORTH, 0, 576, 352, 816, 608, 0 },
36 { ROOM_INN, CONDITION_ALWAYS, 288, 0, 840, FACING_NORTH, 0, 40, 656, 368, 944, 0 },
37 { ROOM_TEMPLE, CONDITION_ALWAYS, 688, 0, 280, FACING_NORTH, 0, 568, 32, 808, 304, 0 },
38 { ROOM_EIGHTH, CONDITION_ALWAYS, 560, 0, 880, FACING_NORTH, 0, 400, 656, 640, 912, 0 },
39 { ROOM_NINTH, CONDITION_ALWAYS, 672, 0, 888, FACING_NORTH, 0, 520, 656, 760, 896, 0 },
40 { ROOM_SUHALLA_GATE_HOUSE, CONDITION_ALWAYS, 832, 0, 848, FACING_NORTH, 0, 680, 656, 920, 896, 0 },
41 { ROOM_TEMPLE_SECOND_ENTRANCE, CONDITION_ALWAYS, 688, 0, 184, FACING_NORTH, 0, 568, 32, 808, 288, 0 },
43};
44
57};
58
61 PIXELS(144), 0, PIXELS(168), FACING_WEST, TALK_FACE_PARTY, 0 },
65 PIXELS(392), 0, PIXELS(240), FACING_SOUTH, TALK_FACE_PARTY, 0 },
67 PIXELS(403), 0, PIXELS(138), FACING_EAST, TALK_FACE_PARTY, 0 },
79 PIXELS(264), 0, PIXELS(744), FACING_SOUTH, TALK_FACE_PARTY, 0 },
83 PIXELS(144), 0, PIXELS(888), FACING_NORTHWEST, TALK_FACE_PARTY, 0 },
97};
98
108 { EVENT_TALK, ACTOR_FIRST_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsFirstHomeASealed) },
109 { EVENT_TALK, ACTOR_FIRST_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsFirstHomeBSealed) },
110 { EVENT_TALK, ACTOR_SECOND_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsSecondHomeASealed) },
111 { EVENT_TALK, ACTOR_SECOND_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsSecondHomeBSealed) },
112 { EVENT_TALK, ACTOR_THIRD_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsThirdHomeASealed) },
113 { EVENT_TALK, ACTOR_THIRD_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsThirdHomeBSealed) },
121 { EVENT_TALK, ACTOR_INN_CLERK, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsInnClerkSealed) },
122 { EVENT_TALK, ACTOR_INN_WORKER, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsInnWorkerSealed) },
127 MSGNO(MsgLunpaInteriorsFirstHomeASealedThoughts) },
129 MSGNO(MsgLunpaInteriorsFirstHomeBSealedThoughts) },
131 MSGNO(MsgLunpaInteriorsSecondHomeASealedThoughts) },
133 MSGNO(MsgLunpaInteriorsSecondHomeBSealedThoughts) },
135 MSGNO(MsgLunpaInteriorsThirdHomeASealedThoughts) },
137 MSGNO(MsgLunpaInteriorsThirdHomeBSealedThoughts) },
151 MSGNO(MsgLunpaInteriorsInnkeeperSealedThoughts) },
153 MSGNO(MsgLunpaInteriorsInnClerkSealedThoughts) },
155 MSGNO(MsgLunpaInteriorsInnWorkerSealedThoughts) },
159 MSGNO(MsgLunpaInteriorsTemplePriestSealedThoughts) },
163 { SEARCH(SEARCH_OVEN), TRIGGER_FIRST_OVEN, CONDITION_ALWAYS, FIND_MESSAGE(MSGNO(MsgLunpaInteriorsFirstOven)) },
164 { SEARCH(SEARCH_OVEN), TRIGGER_SECOND_OVEN, CONDITION_ALWAYS, FIND_MESSAGE(MSGNO(MsgLunpaInteriorsSecondOven)) },
166};
167
177 { EVENT_TALK, ACTOR_FIRST_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsFirstHomeAReopened) },
178 { EVENT_TALK, ACTOR_FIRST_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsFirstHomeBReopened) },
179 { EVENT_TALK, ACTOR_SECOND_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsSecondHomeAReopened) },
180 { EVENT_TALK, ACTOR_SECOND_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsSecondHomeBReopened) },
181 { EVENT_TALK, ACTOR_THIRD_HOME_RESIDENT_A, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsThirdHomeAReopened) },
182 { EVENT_TALK, ACTOR_THIRD_HOME_RESIDENT_B, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsThirdHomeBReopened) },
191 { EVENT_TALK, ACTOR_INN_WORKER, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsInnWorkerReopened) },
192 { EVENT_TALK, ACTOR_CHEF, CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsChefReopened) },
195 MSGNO(MsgLunpaInteriorsFirstHomeAReopenedThoughts) },
197 MSGNO(MsgLunpaInteriorsFirstHomeBReopenedThoughts) },
199 MSGNO(MsgLunpaInteriorsSecondHomeAReopenedThoughts) },
201 MSGNO(MsgLunpaInteriorsSecondHomeBReopenedThoughts) },
203 MSGNO(MsgLunpaInteriorsThirdHomeAReopenedThoughts) },
205 MSGNO(MsgLunpaInteriorsThirdHomeBReopenedThoughts) },
219 MSGNO(MsgLunpaInteriorsInnkeeperReopenedThoughts) },
221 MSGNO(MsgLunpaInteriorsInnClerkReopenedThoughts) },
223 MSGNO(MsgLunpaInteriorsInnWorkerReopenedThoughts) },
225 MSGNO(MsgLunpaInteriorsChefReopenedThoughts) },
227 MSGNO(MsgLunpaInteriorsTemplePriestReopenedThoughts) },
231 { SEARCH(SEARCH_OVEN), TRIGGER_FIRST_OVEN, CONDITION_ALWAYS, FIND_MESSAGE(MSGNO(MsgLunpaInteriorsFirstOven)) },
232 { SEARCH(SEARCH_OVEN), TRIGGER_SECOND_OVEN, CONDITION_ALWAYS, FIND_MESSAGE(MSGNO(MsgLunpaInteriorsSecondOven)) },
234};
235// clang-format on
236
242 CONDITION_ALWAYS, MSGNO(MsgLunpaInteriorsTravelingPriestThoughts)},
244};
245
247 return gInteriorEntrances;
248}
249
250const struct SceneRegion *Scene_GetRegions(void) { return NULL; }
251
252const u32 *Scene_GetExits(void) { return gInteriorExits; }
253
254/// The townsfolk, shopkeepers and the counters.
256 return gInteriorPlacements;
257}
258
259/// The gate house's events, or the town's before and after it reopens.
260const struct SceneEvent *Scene_GetEvents(void) {
263 }
266 }
268}
269
270/// Across the counter after Lunpa reopens, a room at the inn; otherwise the
271/// innkeeper offers a room or, while Lunpa is sealed, a bed at home.
272static void Event_TalkToInnkeeper(void) {
273 struct FieldActor *leader;
274
276 if (FACING_IS_NORTH(leader->facing)) {
279 return;
280 }
281 }
284 Engine_EventSetMessage(MsgLunpaInnkeeperOffersRoom);
286 } else {
287 Engine_EventSetMessage(MsgLunpaInnkeeperOffersOwnHome);
289 }
291}
292
293/// The chef offers the story of taking meals to the fortress; either way
294/// the party has heard of the prisoner.
295static void Event_TalkToChef(void) {
297 Engine_EventSetMessage(MsgLunpaChefOffersStory);
301}
302
303/// Mind Read on the chef, who pities the prisoner in the dungeon.
304static void Event_ReadChefsThoughts(void) {
306 Engine_EventSetMessage(MsgLunpaChefThinksOfPrisoner);
310}
311
312/// The inn's clerk asks whether the party is Donpa's guest.
313static void Event_TalkToInnClerk(void) {
315 Engine_EventSetMessage(MsgLunpaInnClerkAsksAboutGuest);
318}
319
320/// Across the counter, the sanctum; otherwise the priest talks about
321/// Dodonpa.
322static void Event_TalkToTemplePriest(void) {
323 struct FieldActor *leader;
324
326 if (FACING_IS_NORTH(leader->facing)) {
330 Engine_EventSetMessage(MsgLunpaTemplePriestReopened);
333 } else {
335 Engine_EventSetMessage(MsgLunpaTemplePriestSealed);
338 }
339}
340
341/// Mind Read on the item merchant.
345 Engine_EventSetMessage(MsgLunpaIsntWeaponsVendors);
348 } else {
350 Engine_EventSetMessage(MsgLunpaItemMerchantSealedThoughts);
353 }
354}
355
356/// Across the counter, the item shop; otherwise small talk.
357static void Event_TalkToItemMerchant(void) {
358 struct FieldActor *leader;
359
361 if (FACING_IS_NORTH(leader->facing)) {
365 Engine_EventSetMessage(MsgLunpaItemMerchantReopened);
368 } else {
370 Engine_EventSetMessage(MsgLunpaItemMerchantSealed);
373 }
374}
375
376/// Mind Read on the weapon merchant.
379 Engine_EventSetMessage(MsgLunpaWeaponMerchantReopenedThoughts);
381 } else {
382 Engine_EventSetMessage(MsgLunpaWeaponMerchantSealedThoughts);
384 }
385}
386
387/// After Lunpa reopens, across the counter, the weapon shop; otherwise
388/// small talk.
389static void Event_TalkToWeaponMerchant(void) {
390 struct FieldActor *leader;
391 s32 facing;
392
394 facing = leader->facing;
396 if (FACING_IS_NORTH(facing)) {
398 } else {
400 Engine_EventSetMessage(MsgLunpaWeaponMerchantReopened);
403 }
404 } else {
405 Engine_EventSetMessage(MsgLunpaWeaponMerchantSealed);
407 }
408}
409
410/// Mind Read on the armor merchant.
413 Engine_EventSetMessage(MsgLunpaArmorMerchantReopenedThoughts);
415 } else {
416 Engine_EventSetMessage(MsgLunpaArmorMerchantSealedThoughts);
418 }
419}
420
421/// After Lunpa reopens, across the counter, the armor shop; otherwise
422/// small talk.
423static void Event_TalkToArmorMerchant(void) {
424 struct FieldActor *leader;
425 s32 facing;
426
428 facing = leader->facing;
430 if (FACING_IS_NORTH(facing)) {
432 } else {
434 Engine_EventSetMessage(MsgLunpaArmorMerchantReopened);
437 }
438 } else {
439 Engine_EventSetMessage(MsgLunpaArmorMerchantSealed);
441 }
442}
443
444/// Sets the buildings up: the gate house is where a defeated party wakes,
445/// and the counters are drawn behind their keepers.
447 s16 entrance;
448
450 entrance = gGameState.entrance;
451 if (entrance == ROOM_SUHALLA_GATE_HOUSE) {
454 gGameState.savedEntrance = entrance;
455 }
459 return 0;
460}
461
462/// The traveling priest: across the counter, the temple priest's sanctum;
463/// otherwise his good will.
465 struct FieldActor *leader;
466
468 if (FACING_IS_NORTH(leader->facing)) {
470 } else {
471 Engine_EventSetMessage(MsgLunpaTravelingPriest);
473 }
474}
@ 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.
@ ACTOR_INNKEEPER
Definition altin.c:82
static void Event_TalkToInnkeeper(void)
Opens the inn across the counter, or discusses the curse in Kolima.
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_SanctumOpen(s32 priest)
void Engine_InnOpen(s32 inn, s32 keeper)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ShopOpen(s32 shop, s32 keeper)
@ TRANSITION_WINDOW
Definition field_obj.h:17
#define SCENE_TRANSITION(style, variant)
Definition field_obj.h:20
#define SCENE_EVENTS_END
#define FIND_ITEM(item)
@ EVENT_TALK
@ FACING_STEP
Definition field_scene.h:36
#define SCENE_EXITS(scene)
Definition field_scene.h:72
@ SCENE_SUHALLA_GATE
Definition field_scene.h:22
@ SCENE_LUNPA
Definition field_scene.h:17
@ SCENE_LUNPA_SUHALLA
Definition field_scene.h:18
#define FIND_MESSAGE(message)
#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 FACING_IS_NORTH(facing)
Definition field_scene.h:38
@ FACING_EAST
Definition field_scene.h:26
@ 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_OVEN
@ SEARCH_WOODEN_BOX
@ SEARCH_BARREL
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_LUNPA_WOODEN_BOX_LUCKY_MEDAL
in the town's buildings
Definition flags.h:289
#define FLAG_LUNPA_TRADE_REOPENED
Definition flags.h:123
#define FLAG_LUNPA_HEARD_OF_PRISONER
Definition flags.h:122
#define FLAG_LUNPA_BARREL_VIAL
in the town's buildings
Definition flags.h:290
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
@ ACTOR_ITEM_MERCHANT
Definition imil.c:62
@ ACTOR_ARMOR_MERCHANT
Definition imil.c:60
@ ACTOR_WEAPON_MERCHANT
Definition imil.c:59
@ ITEM_VIAL
Definition item_ids.h:42
@ ITEM_LUCKY_MEDAL
Definition item_ids.h:70
const struct ScenePlacement gInteriorPlacements[]
static void Event_TalkToTemplePriest(void)
Across the counter, the sanctum; otherwise the priest talks about Dodonpa.
static void Event_TalkToArmorMerchant(void)
After Lunpa reopens, across the counter, the armor shop; otherwise small talk.
static void Event_ReadArmorMerchantsThoughts(void)
Mind Read on the armor merchant.
static void Event_ReadItemMerchantsThoughts(void)
Mind Read on the item merchant.
const struct SceneEvent gInteriorSealedEvents[]
static void Event_ReadChefsThoughts(void)
Mind Read on the chef, who pities the prisoner in the dungeon.
static void Event_ReadWeaponMerchantsThoughts(void)
Mind Read on the weapon merchant.
static void Event_TalkToChef(void)
The chef offers the story of taking meals to the fortress; either way the party has heard of the pris...
const u32 gInteriorExits[]
static void Event_TalkToItemMerchant(void)
Across the counter, the item shop; otherwise small talk.
const struct SceneEntrance gInteriorEntrances[]
static void Event_TalkToTravelingPriest(void)
The traveling priest: across the counter, the temple priest's sanctum; otherwise his good will.
static void Event_TalkToWeaponMerchant(void)
After Lunpa reopens, across the counter, the weapon shop; otherwise small talk.
const struct SceneEvent gInteriorReopenedEvents[]
const struct SceneEvent gSuhallaGateHouseEvents[]
static void Event_TalkToInnClerk(void)
The inn's clerk asks whether the party is Donpa's guest.
Scene numbers, named after their places.
char SceneId_LunpaSuhalla
struct EventWork * gEventWork
void Engine_EventEnd(void)
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#define NULL
Definition bilibin.h:6
@ SPRITE_TOWNSPERSON_B
Definition lunpa.h:129
@ SPRITE_TOWNSPERSON_C
Definition lunpa.h:130
@ SPRITE_TOWNSPERSON_D
Definition lunpa.h:132
@ SPRITE_TOWNSPERSON_E
Definition lunpa.h:134
@ LUNPA_ENTRANCE_FROM_ITEM_SHOP
Definition lunpa.h:22
@ LUNPA_ENTRANCE_FROM_THIRD_HOME
Definition lunpa.h:20
@ LUNPA_ENTRANCE_FROM_FIRST_HOME
Definition lunpa.h:18
@ LUNPA_ENTRANCE_FROM_TEMPLE
Definition lunpa.h:24
@ LUNPA_ENTRANCE_FROM_INN
Definition lunpa.h:23
@ LUNPA_ENTRANCE_FROM_SECOND_HOME
Definition lunpa.h:19
@ LUNPA_ENTRANCE_FROM_EIGHTH_ROOM
Definition lunpa.h:25
@ LUNPA_ENTRANCE_FROM_ARMS_SHOP
Definition lunpa.h:21
@ ROOM_TEMPLE_SECOND_ENTRANCE
@ ROOM_EIGHTH
@ ROOM_INN
@ ROOM_NINTH
@ ROOM_SECOND_HOME
@ ROOM_SUHALLA_GATE_HOUSE
@ ROOM_ITEM_SHOP
@ ROOM_TEMPLE
@ ROOM_THIRD_HOME
@ ROOM_FIRST_HOME
@ ROOM_ARMS_SHOP
@ TRIGGER_BARREL
@ TRIGGER_WOODEN_BOX
@ TRIGGER_FIRST_OVEN
@ TRIGGER_SECOND_OVEN
@ SHOP_LUNPA_WEAPONS
@ SHOP_LUNPA_ARMOR
@ SHOP_LUNPA_ITEMS
@ INN_LUNPA
@ SPRITE_CHEF
@ SPRITE_COUNTER
@ SPRITE_INNKEEPER
@ SPRITE_TOWNSPERSON_A
@ SPRITE_ITEM_MERCHANT
@ SPRITE_WEAPON_MERCHANT
@ SPRITE_ARMOR_MERCHANT
@ SPRITE_PRIEST
@ SPRITE_TOWNSPERSON_F
#define ROOM_DOOR(room)
@ ACTOR_TEMPLE_PRIEST
@ ACTOR_ITEM_COUNTER
@ ACTOR_CHEF
@ ACTOR_FIRST_HOME_RESIDENT_A
@ ACTOR_THIRD_HOME_RESIDENT_A
@ ACTOR_SECOND_HOME_RESIDENT_B
@ ACTOR_FIRST_HOME_RESIDENT_B
@ ACTOR_TRAVELING_PRIEST
@ ACTOR_ARMOR_COUNTER
@ ACTOR_SECOND_HOME_RESIDENT_A
@ ACTOR_WEAPON_COUNTER
@ ACTOR_THIRD_HOME_RESIDENT_B
@ ACTOR_INN_WORKER
@ ACTOR_INN_CLERK
@ SUHALLA_GATE_ENTRANCE_FROM_LUNPA
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
u16 facing
1/65536 turns
Definition field_obj.h:34
s16 entrance
Definition game_state.h:37
s16 savedScene
where a defeat returns to without a defeat point
Definition game_state.h:38
s16 savedEntrance
where a defeat returns to without a defeat point
Definition game_state.h:39
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...
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12