Alchemy
Loading...
Searching...
No Matches

vault_revisit.c

Go to the documentation of this file.
1/// @file
2/// Vault after the thieves escaped from jail, when the party passes through
3/// again.
4
5#include "game_state.h"
6#include "window.h"
10#include "unit/object/object.h"
12#include "unit/game/game.h"
14#include "field_obj.h"
15#include "types.h"
16#include "field_event.h"
17#include "field_scene.h"
18#include "battle.h"
19#include "debug.h"
20#include "field.h"
21#include "game.h"
22#include "graphics.h"
23#include "menu.h"
24#include "minigame.h"
25#include "sound.h"
26#include "system.h"
27#include "iwram_call.h"
28#include "tbs_edition.h"
29#include "inventory.h"
30#include "text/msg_ids.h"
31#include "edition.h"
32#include "call.h"
33#include "flags.h"
34#include "songs.h"
35
36enum {
37 ACTOR_GREETER = 8, ///< Vault's greeter. "You're the warriors who captured..."
38 ACTOR_LUNPA_GOSSIP = 11, ///< rumors of thieves from Lunpa running wild
39 /// Has talked with the mayor. "I was just talking about you with our mayor"
41 ACTOR_VOLCANO_WATCHER = 13, ///< if the volcano stays calm...
42 /// The two who walk in circles. "Hey, it's that warrior guy!"
44 /// Speaks of the grown-ups. "Grown-ups always get so scared"
46 ACTOR_WATCHMAN = 16, ///< Vault's watchman. "Did you guys check out the jail?"
51};
52
53/// Scene flags: what the townspeople have already said. A Mind Read before
54/// someone has spoken plays the conversation first.
55enum {
61};
62
63// Shared effect and proximity routines precede the scene's entry points.
65#include "common/effect_spawn.h"
67#include "common/vault_range.h"
68#include "common/vault_nearby.h"
69
70const struct SceneEntrance *Scene_GetEntrances(void) {
72}
73
74const struct SceneRegion *Scene_GetRegions(void) { return NULL; }
75
76const u32 *Scene_GetExits(void) { return gVaultRevisit_Exits; }
77
78/// Returns the villagers, dog, and Djinni placements.
81}
82
83/// Stands the actor still while showing the message already selected.
89}
90
91/// The party is recognized. "You're the warriors who captured the thieves a
92/// while back, aren't you? You've returned to Vault!"
97 Engine_EventSetMessage(MsgVaultWarriorsWhoCaptured);
100}
101
102/// There are rumors of thieves from Lunpa running wild, yet they have been
103/// quiet.
104static void Event_TalkOfLunpaThieves(void) {
105
106 Engine_EventSetMessage(MsgVaultRumorsThievesLunpa);
109}
110
111/// The villager was just talking about the party with the mayor: they are so
112/// strong, let those thieves attack.
113static void Event_PraisePartyStrength(void) {
114
118 Engine_GameFlagSet(0x868);
119 Engine_EventSetMessage(MsgVaultTalkingMayorStrong);
122}
123
124/// If the volcano stays calm and the southern bridge stays fixed, there is
125/// nothing to worry about.
126static void Event_HopeVolcanoStaysCalm(void) {
127
128 Engine_EventSetMessage(MsgVaultVolcanoStaysCalm);
131}
132
133/// The first walker stops circling. "Hey, it's that warrior guy!" and "Yeah,
134/// and Ivan, too." the first time, then "I'm so glad you came back to Vault!"
135static void Event_GreetWarriorGuy(void) {
136 struct FieldActor *actor = Actor_Get(ACTOR_FIRST_WALKER);
137 u16 facing = actor->facing;
138 s32 text;
139
142 text = MsgVaultWarriorGuy;
151 }
152 Engine_EventSetMessage(text + 2);
154 actor->facing = facing;
157 actor->timer = 1;
159}
160
161/// The second walker stops. "I wish Vault's elders were as brave as you!"
162static void Event_WishEldersWereBrave(void) {
163 struct FieldActor *actor;
164 s16 originalFacing;
165
167 originalFacing = actor->facing;
170 Engine_EventSetMessage(MsgVaultWishVaultsElders);
174 actor->facing = originalFacing;
177 actor->timer = 0;
178}
179
180/// Asks about the jail. "Did you guys check out the jail?" Yes: how did the
181/// thugs break out? No: the thieves broke out and got away.
182static void Event_AskAboutJailbreak(void) {
184 Engine_EventSetMessage(MsgVaultGuysCheckJail);
187 if (Engine_EventChooseYesNo(0, 0) != 0) {
188 gEventWork->message += 1;
189 }
193}
194
195/// Mind Read on the greeter before he has spoken: he turns and recognizes the
196/// party.
203 Engine_EventSetMessage(MsgVaultWarriorsWhoCaptured);
206}
207
208/// Mind Read: since Dodonpa took over, Lunpa's outlaws are no better than
209/// thieves.
210static void Event_ReadMindOnDodonpa(void) {
211 Engine_EventSetMessage(MsgVaultOnceDodonpaTook);
215}
216
217/// Mind Read before the villager has spoken: he turns and praises the party.
224 Engine_GameFlagSet(0x868);
225 Engine_EventSetMessage(MsgVaultTalkingMayorStrong);
228}
229
230/// Mind Read: it would have been great to have everything solved before
231/// winter.
232static void Event_ReadMindOnWinter(void) {
233 Engine_EventSetMessage(MsgVaultGreatEverythingSolved);
237}
238
239/// Mind Read on the first walker: watching the party makes one feel brave, or,
240/// before the walker has spoken, the greeting.
245 Engine_EventSetMessage(MsgVaultWatchingGuysMakes);
247 } else {
250 }
252 Actor_Get(ACTOR_FIRST_WALKER)->timer = 1;
253}
254
255/// Mind Read on the second walker: grown-ups always get so scared.
257 {
260 }
262 Engine_EventSetMessage(MsgVaultGrownUpsAlways);
265 {
266 s32 clear = 0;
268 actor->timer = clear;
269 }
270}
271
272/// Mind Read on the watchman: before he has asked about the jail he asks
273/// now; afterwards, the thieves must know the secret of the jail's lock.
274static void Event_ReadMindOnJailKey(void) {
275 s32 requestHeard;
276 s32 unpaused;
277
279 if (requestHeard == 0) {
281 Actor_Get(ACTOR_WATCHMAN)->paused = 1;
285 Engine_EventSetMessage(MsgVaultGuysCheckJail);
288 if (Engine_EventChooseYesNo(0, 0) != 0) {
290 }
292 Actor_Get(ACTOR_WATCHMAN)->paused = requestHeard;
296 } else {
297 Engine_EventSetMessage(MsgVaultNotLikeEasy);
298 Actor_Get(ACTOR_WATCHMAN)->paused = 1;
300 unpaused = 0;
301 Actor_Get(ACTOR_WATCHMAN)->paused = unpaused;
302 }
303}
304
305/// Gives the actor vertical velocity, moves it, and waits briefly for it to
306/// settle.
307static void VaultRevisit_JumpActorToAndWait(int actor, int x, int z,
308 int velocityY) {
309 struct FieldActor *jumpingActor = Object_GetById(actor);
310 int frames;
311 Engine_ActorSetSpeed(actor, PIXELS(3), PIXELS(3) / 2);
312 jumpingActor->gravity = PIXELS(1) / 2;
313 jumpingActor->bounce = 0;
314 jumpingActor->velocityY = velocityY;
315 Engine_ActorSetSpriteFlags(jumpingActor, 0);
317 Engine_ActorSetPosition(actor, x << 16, z << 16);
318 for (frames = 60; frames != 0; --frames) {
320 if ((s16)((u32)jumpingActor->velocityY >> 16) == 0)
321 break;
322 }
323 Engine_ActorSetSpriteFlags(jumpingActor, 1);
324 jumpingActor->gravity = PIXELS(1);
325}
326
327/// Ringing the bell makes the Djinni jump out and move to its new position
328/// once.
329static void Event_RingBell(void) {
339 // Let the Djinni leap from hiding before it walks to the bell.
341 PIXELS(7));
346 }
348}
349
350/// Walks the leader into a doorway during the sixteen-frame exit delay.
351static void Vault_WalkThroughExit(s32 x, s32 z, s32 exitId) {
352 s32 leaderId = ACTOR_PARTY_LEADER;
353
354 Actor_SetSpeed(leaderId, PIXELS(1) / 2, PIXELS(1) / 4);
355 Actor_WalkTo(leaderId, x, z);
358}
359
360static void Event_EnterSoutheastHouse(void) {
363 Vault_WalkThroughExit(408, 320, 5);
364}
365
369 Vault_WalkThroughExit(312, 304, 6);
370}
371
372static void Event_EnterCentralHouse(void) {
375 Vault_WalkThroughExit(216, 288, 7);
376}
377
378/// Opens the northeast house and uses its required sprite priority.
379static void Event_EnterNortheastHouse(void) {
381 struct AnimationObject *sprite = actor->sprite;
382
385 Map_CopyCellAttributes(33, 20, 1, 3, 23, 12);
387 sprite->image.priority = 3;
388 Vault_WalkThroughExit(376, 224, 8);
389}
390
391/// Opens the north house and uses its required sprite priority.
392static void Event_EnterNorthHouse(void) {
394 struct AnimationObject *sprite = actor->sprite;
395
398 Map_CopyCellAttributes(33, 20, 1, 3, 18, 10);
400 sprite->image.priority = 3;
401 Vault_WalkThroughExit(296, 176, 9);
402}
403
404static void Event_EnterNorthwestHouse(void) {
407 Vault_WalkThroughExit(120, 144, 10);
408}
409
410// The remaining doorway helper retains its position in the overlay.
412#include "ability_ids.h"
413#include "item_ids.h"
414#include "objcmd.h"
415
416/// The jail door opens and the party walks in, drawn behind the doorway.
417static void Event_EnterJail(void) {
419 struct AnimationObject *sprite = actor->sprite;
420
423 Map_CopyCellAttributes(33, 20, 1, 3, 4, 10);
425 sprite->image.priority = 3;
426 Vault_WalkThroughExit(72, 160, 12);
427}
428
429// Shared entrance toggles precede the Djinni and dog events.
430#include "common/vault_toggle.h"
431
432/// The Venus Djinni the bell called out joins the party when spoken to.
433static void Event_TalkToVenusDjinni(void) {
435}
436
437/// Jumps at the hidden passage, then pauses so the party can see the clue.
438static inline void VaultRevisit_DogJumpAtPassage(void) {
441}
442
443/// Given a Bone, the dog runs to the hidden passage and jumps there three
444/// times.
445static void Event_GiveBoneToDog(void) {
454 // Repeat the clue at the concealed passage, then step back.
463}
464
465/// Covers the hidden passage when Reveal ends.
466static void Event_HidePassage(void) {
467
468 Map_CopyCellAttributes(41, 43, 1, 1, 13, 25);
469 Map_CopyCellsTo(40, 42, 12, 22, 3, 3);
470}
471
472/// Restores the passage's visible tiles and collision cell during Reveal.
473static void Event_RevealPassage(void) {
474
475 Map_CopyCellAttributes(37, 43, 1, 1, 13, 25);
476 Map_CopyCellsTo(36, 42, 12, 22, 3, 3);
477}
478
479/// The dog barks; carrying a Bone before it has shown the passage lets the
480/// party give it one.
481static void Event_TalkToDog(void) {
483 Engine_EventSetMessage(MsgVaultRuffRrruff2);
489
492 gEventWork->unk172 = 1;
493 }
494
496}
497
498/// Describes the water heard at the bottom of the well.
499static void Event_PeerIntoWell(void) {
501 Engine_MessageShowCentered(MsgFieldPeeredWell, 1);
502 Engine_MessageShowCentered(MsgVaultCanHearWaterRumblingDown, 1);
504}
505
506/// Returns the town's talk, search, Psynergy, and doorway events.
507const struct SceneEvent *Scene_GetEvents(void) { return gVaultRevisit_Events; }
508
509/// Patched editions keep the bell's Djinni position when preserving the party.
511#if TBS_PATCH_1
513#else
514 return 0;
515#endif
516}
517
518/// Restores dog and Djinni progress, proximity reactions, and entrance flags.
520
521 struct FieldActor *actor;
522 s32 mode;
523
524 // Restore the passage cells and the town's ambient effect.
526 Map_CopyCellAttributes(55, 26, 4, 2, 23, 26);
528 Map_CopyCellsTo(45, 41, 8, 45, 3, 3);
530 // Resume the two walking villagers' proximity reactions.
532#ifdef UBFIX
534#else
535 actor->update = (void (*)(union FieldObject *))Vault_UpdateWalkingVillager;
536#endif
537 {
539 s32 mode = 1;
540 actor->timer = mode;
541 }
542 mode = 0;
544#ifdef UBFIX
546#else
547 actor->update = (void (*)(union FieldObject *))Vault_UpdateWalkingVillager;
548#endif
550 // Restore the dog's clue position and the bell's current Djinni position.
553 if (gGameState.entrance <= 2 &&
560 if (gGameState.entrance == 11)
562 if (gGameState.entrance == 13)
564 return 0;
565}
566
568 SC_WAIT(1), SC_LOOP(22, SC_TOP), SC_WAIT(1),
569 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
570};
571
573 SC_WAIT(1), SC_LOOP(44, SC_TOP), SC_WAIT(1),
574 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
575};
576
578 SC_WAIT(1), SC_LOOP(126, SC_TOP), SC_WAIT(1),
579 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
580};
581
582const s32 *gEffectScripts[] = {
586};
587
589 SC_ARG(2),
590 SC_SET(SW_SPEED, PIXELS(4) / 5),
591 SC_SET(SW_ACCEL, PIXELS(1) / 5),
592 SC_LABEL(1),
593 SC_MOVE(PIXELS(136), 0, PIXELS(376)),
594 SC_SYNC,
595 SC_MOVE(PIXELS(120), 0, PIXELS(376)),
596 SC_SYNC,
597 SC_MOVE(PIXELS(104), 0, PIXELS(392)),
598 SC_SYNC,
599 SC_MOVE(PIXELS(104), 0, PIXELS(408)),
600 SC_SYNC,
601 SC_MOVE(PIXELS(120), 0, PIXELS(424)),
602 SC_SYNC,
603 SC_MOVE(PIXELS(136), 0, PIXELS(424)),
604 SC_SYNC,
605 SC_MOVE(PIXELS(152), 0, PIXELS(408)),
606 SC_SYNC,
607 SC_MOVE(PIXELS(152), 0, PIXELS(392)),
608 SC_SYNC,
610 SC_END,
611};
612
614 SC_ARG(2),
615 SC_SET(SW_SPEED, PIXELS(4) / 5),
616 SC_SET(SW_ACCEL, PIXELS(1) / 5),
617 SC_LABEL(1),
618 SC_MOVE(PIXELS(120), 0, PIXELS(424)),
619 SC_SYNC,
620 SC_MOVE(PIXELS(136), 0, PIXELS(424)),
621 SC_SYNC,
622 SC_MOVE(PIXELS(152), 0, PIXELS(408)),
623 SC_SYNC,
624 SC_MOVE(PIXELS(152), 0, PIXELS(392)),
625 SC_SYNC,
626 SC_MOVE(PIXELS(136), 0, PIXELS(376)),
627 SC_SYNC,
628 SC_MOVE(PIXELS(120), 0, PIXELS(376)),
629 SC_SYNC,
630 SC_MOVE(PIXELS(104), 0, PIXELS(392)),
631 SC_SYNC,
632 SC_MOVE(PIXELS(104), 0, PIXELS(408)),
633 SC_SYNC,
635 SC_END,
636};
637
639 {0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
640 {1, CONDITION_ALWAYS, 400, 0, 472, FACING_NORTH, 0, -1, -1, -1, -1, 0},
641 {2, CONDITION_ALWAYS, 224, 0, 138, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
642 {5, CONDITION_ALWAYS, 408, 0, 344, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
643 {6, CONDITION_ALWAYS, 312, 0, 328, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
644 {7, CONDITION_ALWAYS, 216, 0, 312, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
645 {8, CONDITION_ALWAYS, 376, 0, 248, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
646 {9, CONDITION_ALWAYS, 296, 0, 200, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
647 {10, CONDITION_ALWAYS, 120, 0, 168, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
648 {11, CONDITION_ALWAYS, 64, 0, 294, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
649 {12, CONDITION_ALWAYS, 70, 0, 183, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
650 {13, CONDITION_ALWAYS, 217, 0, 409, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
651 {14, CONDITION_ALWAYS, 420, 0, 136, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
653};
654
659 SCENE_EXIT(5, 24, 5),
660 SCENE_EXIT(6, 24, 6),
661 SCENE_EXIT(7, 24, 7),
662 SCENE_EXIT(8, 24, 8),
663 SCENE_EXIT(9, 24, 9),
664 SCENE_EXIT(10, 24, 10),
665 SCENE_EXIT(11, 9, 11),
667 SCENE_EXIT(13, 96, 10),
668 SCENE_EXIT(14, 98, 1),
670};
671
672// clang-format off
683 PIXELS(124), 0, PIXELS(196), FACING_SOUTHEAST, TALK_FACE_PARTY, 0 },
687 PIXELS(132), 0, PIXELS(380), FACING_WEST, TALK_KEEP_FACING, 0 },
689 PIXELS(132), 0, PIXELS(420), FACING_EAST, TALK_KEEP_FACING, 0 },
698 { 0xf8, CONDITION_ALWAYS, 7,
699 0, 0, 0, FACING_NORTH, TALK_FACE_PARTY, 0 },
700 { 0x5a, 0x34, ACTOR_STAND,
701 PIXELS(344), 0, PIXELS(96), FACING_SOUTH, TALK_FACE_PARTY, 0 },
702 { SCENE_TABLE_END },
703};
704
706 MAP_CELL_STEP(35, 52, 2, 2, 4), MAP_CELL_STEP(33, 52, 2, 2, 4), MAP_CELL_STEPS_END,
707};
708
710 MAP_CELL_STEP(35, 50, 2, 2, 4), MAP_CELL_STEP(33, 50, 2, 2, 4), MAP_CELL_STEPS_END,
711};
712
714 MAP_CELL_STEP(35, 48, 2, 2, 4), MAP_CELL_STEP(33, 48, 2, 2, 4), MAP_CELL_STEPS_END,
715};
716
718 MAP_CELL_STEP(42, 48, 2, 2, 4), MAP_CELL_STEP(40, 48, 2, 2, 4), MAP_CELL_STEPS_END,
719};
720
722 MAP_CELL_STEP(42, 46, 2, 2, 4), MAP_CELL_STEP(40, 46, 2, 2, 4), MAP_CELL_STEPS_END,
723};
724
726 MAP_CELL_STEP(35, 46, 2, 2, 4), MAP_CELL_STEP(33, 46, 2, 2, 4), MAP_CELL_STEPS_END,
727};
728
730 MAP_CELL_STEP(35, 33, 2, 2, 4), MAP_CELL_STEP(33, 33, 2, 2, 4), MAP_CELL_STEPS_END,
731};
732
734 { EVENT_EXIT, 20, CONDITION_ALWAYS, 1 },
735 { EVENT_EXIT, 21, CONDITION_ALWAYS, 2 },
736 { EVENT_EXIT, 40, CONDITION_ALWAYS, 13 },
737 { EVENT_EXIT, 41, CONDITION_ALWAYS, 14 },
749 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgVaultYouveProbablyAlreadyHeardButThe) },
750 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgVaultIWonderWhatHappenedToHammet) },
757 { EVENT_TALK, 17, CONDITION_ALWAYS, MSGNO(MsgVaultTheThievesEscapedButIThink) },
759 { EVENT_TALK, 19, CONDITION_ALWAYS, MSGNO(MsgVaultThereYouSeeTheRoofRepairs) },
763 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_GREETER, CONDITION_ALWAYS, MSGNO(MsgVaultICantBelieveTheyreHereWhat) },
764 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgVaultWhenThoseGuysFromKalayCame) },
765 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, CONDITION_ALWAYS, MSGNO(MsgVaultYeahSomeWarriorsFromKalayCame) },
768 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_MAYORS_VISITOR, CONDITION_ALWAYS, MSGNO(MsgVaultThoseStupidThievesEscapedAndWe) },
775 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 17, CONDITION_ALWAYS, MSGNO(MsgVaultIKeepWonderingWasOurStatue) },
776 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_VAULT_DOG, IF_FLAG_SET(FLAG_VAULT_DOG_SHOWN_PASSAGE), MSGNO(MsgVaultCarefulSearchWillRevealPassage) },
777 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_VAULT_DOG, CONDITION_ALWAYS, MSGNO(MsgVaultIfYouBringMeSomeBones) },
778 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 19, CONDITION_ALWAYS, MSGNO(MsgVaultThatsTheLastOfTheRoof) },
785};
786// clang-format on
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_REVEAL
Definition ability_ids.h:19
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.
s32 gEffectScript0[]
const s32 * gEffectScripts[]
s32 gEffectScript1[]
s32 gEffectScript2[]
Calls through a function pointer, by argument count.
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine calls the debug menus import, and their palette swatch tiles.
void Djinn_JoinParty(s32 slot, s32 element, s32 djinn)
A Djinni joins the party: djinn (0 to 19) of element goes to the member with the fewest Djinn,...
Definition djinni.c:124
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
static UNUSED void * OverlayObject_CreateConfiguredObject(s32 x, s32 y, s32 z, s32 type)
A still effect in palette 15, at sprite priority 1, drawn under the actors.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
@ ANIM_STAND
Definition field_event.h:43
static s32 Event_OpenMessage(s32 speaker, s32 flags)
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
static void Actor_SetBuiltinAction(s32 actor, s32 action)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
#define GameFlag_IsSet
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
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_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
#define GameFlag_Set
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
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)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
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 struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
Definition field_obj.h:153
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 PSYNERGY_IN_AREA(ability, phase)
#define IF_FLAG_SET(flag)
Definition field_scene.h:48
@ SCENE_VAULT_JAIL
Definition field_scene.h:15
@ SCENE_VAULT_REVISIT
Definition field_scene.h:16
@ SCENE_WORLD_MAP
Definition field_scene.h:13
#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_KEEP_FACING
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define USE_ITEM_ON_ACTOR(item)
@ 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_NORTHWEST
Definition field_scene.h:31
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
@ SEARCH_WOODEN_BOX
@ SEARCH_UNNAMED
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_VAULT_BOX_NUT
Definition flags.h:563
#define FLAG_VAULT_DJINNI_CALLED_BY_BELL
Definition flags.h:109
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
Definition flags.h:15
#define FLAG_VAULT_DOG_SHOWN_PASSAGE
Definition flags.h:107
#define FLAG_SCENE_TEMP_00
Definition flags.h:713
#define FLAG_KEEP_PARTY_POSITION
Definition flags.h:93
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.
@ ACTOR_GREETER
Definition imil.c:53
s32 PartyInventory_Discard(s32 itemId)
Discards one itemId from whoever carries it first, as Inventory_Discard does; always returns 0.
Definition inventory.c:422
s32 PartyInventory_FindOwner(s32 itemId)
Returns who carries itemId, asking the selected character first, or -1.
Definition inventory.c:229
gOverflowItem, an item slot the spoils code uses when items are handed out.
Item numbers, named from the English release.
@ ITEM_BONE
Definition item_ids.h:72
@ ITEM_NUT
Definition item_ids.h:41
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LABEL(n)
Branch destination.
Definition objcmd.h:11
#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_FREE
Release.
Definition objcmd.h:43
#define SC_SYNC
Wait for arrival.
Definition objcmd.h:17
#define SC_FOREVER
Definition objcmd.h:14
#define SC_TO(n)
Definition objcmd.h:12
#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_ACCEL
Definition objcmd.h:68
@ SW_SPEED
Definition objcmd.h:67
Song and sound effect ids, indices into gSound_SongTable.
#define SE_DOOR_OPEN
Definition songs.h:153
#define SE_100
Definition songs.h:93
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_TaskWait()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#define NULL
Definition bilibin.h:6
Vault, before and after the thieves are caught: villagers who walk about stop when someone is close i...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
struct AnimationSpritePart image
Definition animspr.h:109
u16 priority
2 when created
Definition animspr.h:100
u16 unk172
FieldWork's menu request; scenes set it to 1.
Definition event_work.h:29
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
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
Definition field_obj.h:109
union FieldCoordinate x
16.16 fixed-point pixels
Definition field_obj.h:35
u8 paused
nonzero skips its script and motion, not its update
Definition field_obj.h:93
s32 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
Definition field_obj.h:64
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
Definition field_obj.h:51
s32 velocityY
16.16 fixed-point pixels per frame
Definition field_obj.h:53
s32 gravity
Taken off the vertical velocity each frame while it is above the ground, in 16.16 fixed-point pixels ...
Definition field_obj.h:68
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
u16 facing
1/65536 turns
Definition field_obj.h:34
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Definition field_obj.h:116
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.
Values that differ by patch level or language, chosen once for their code.
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
An object on the field, read as an actor or as an effect.
static void Event_EnterCentralHouse(void)
Animates the central house door before entering.
Definition vale.c:324
static void Event_EnterSoutheastHouse(void)
Opens the southeastern door and enters its interior.
Definition vale.c:359
static void Event_GiveBoneToDog(void)
Given a Bone, the dog runs to the hidden passage and jumps there three times.
Definition vault.c:706
static void Event_EnterNorthwestHouse(void)
Opens and enters the northwestern house.
Definition vault.c:635
static void Event_TalkToDog(void)
The dog stops and barks.
Definition vault.c:281
static void Event_RingBell(void)
Isaac rings the bell; the first time, the Venus Djinni hiding nearby jumps out and comes to the bell.
Definition vault.c:685
static void Event_EnterNortheastHouse(void)
Enters the northeastern doorway behind its foreground tiles.
Definition vault.c:609
static void Event_PeerIntoWell(void)
Isaac peers into the well and hears water rumbling down there.
Definition vault.c:189
static void Event_EnterNorthHouse(void)
Enters the northern doorway behind its foreground tiles.
Definition vault.c:622
static void Event_EnterCentralEastHouse(void)
Opens and enters the house east of the town's center.
Definition vault.c:595
static void Event_EnterJail(void)
The jail door opens and the party walks in, drawn behind the doorway.
Definition vault.c:644
@ ACTOR_VAULT_VENUS_DJINNI
Definition vault.c:69
@ ACTOR_WATCHMAN
Keeps watch. "Nobody's stealing anything on my watch!".
Definition vault.c:61
@ ACTOR_SECOND_WALKER
Definition vault.c:59
@ VAULT_VENUS_DJINNI_INDEX
Definition vault.c:70
@ ACTOR_VAULT_DOG
Definition vault.c:65
@ ACTOR_FIRST_WALKER
The two who walk in circles.
Definition vault.c:58
Vault, before and after the thieves are caught: the two villagers who walk about together (actors 14 ...
static s32 Vault_UpdateWalkingVillager(union FieldObject *fieldObject)
static void Event_ReadMindAndPraisePartyStrength(void)
Mind Read before the villager has spoken: he turns and praises the party.
s32 gVaultRevisit_Actor1[]
static void Event_AskAboutJailbreak(void)
Asks about the jail.
struct ScenePlacement gVaultRevisit_Placements[]
u16 gVaultRevisit_Scene5Cells[]
static void Event_ReadMindOnFeelingBrave(void)
Mind Read on the first walker: watching the party makes one feel brave, or, before the walker has spo...
static void Event_ReadMindAndRecognizeThiefCatchers(void)
Mind Read on the greeter before he has spoken: he turns and recognizes the party.
static void Event_GreetWarriorGuy(void)
The first walker stops circling.
@ ACTOR_LUNPA_GOSSIP
rumors of thieves from Lunpa running wild
@ VAULT_PROXIMITY_REACTION_PAUSED
@ ACTOR_MAYORS_VISITOR
Has talked with the mayor. "I was just talking about you with our mayor".
@ ACTOR_VOLCANO_WATCHER
if the volcano stays calm...
u16 gVaultRevisit_Scene6Cells[]
static void Event_ReadMindOnWinter(void)
Mind Read: it would have been great to have everything solved before winter.
static void Event_ReadMindOnScaredGrownUps(void)
Mind Read on the second walker: grown-ups always get so scared.
@ FLAG_WALKER_SPOKE
@ FLAG_WARRIOR_GUY_GREETED
@ FLAG_PARTY_PRAISED
@ FLAG_GREETER_RECOGNIZED_PARTY
@ FLAG_ASKED_ABOUT_JAIL
static void Event_RevealPassage(void)
Restores the passage's visible tiles and collision cell during Reveal.
s32 gVaultRevisit_Actor0[]
u16 gVaultRevisit_Scene12Cells[]
static void VaultRevisit_JumpActorToAndWait(int actor, int x, int z, int velocityY)
Gives the actor vertical velocity, moves it, and waits briefly for it to settle.
static void Event_ReadMindOnJailKey(void)
Mind Read on the watchman: before he has asked about the jail he asks now; afterwards,...
static void Event_TalkToVenusDjinni(void)
The Venus Djinni the bell called out joins the party when spoken to.
u16 gVaultRevisit_Scene9Cells[]
static void Event_PraisePartyStrength(void)
The villager was just talking about the party with the mayor: they are so strong, let those thieves a...
static void Event_ReadMindOnDodonpa(void)
Mind Read: since Dodonpa took over, Lunpa's outlaws are no better than thieves.
u16 gVaultRevisit_Scene10Cells[]
static s32 VaultRevisit_ShouldKeepBellDjinniPosition(void)
Patched editions keep the bell's Djinni position when preserving the party.
static void Event_RecognizeThiefCatchers(void)
The party is recognized.
static void Event_WishEldersWereBrave(void)
The second walker stops. "I wish Vault's elders were as brave as you!".
static void Event_HidePassage(void)
Covers the hidden passage when Reveal ends.
u16 gVaultRevisit_Scene8Cells[]
static void Event_HopeVolcanoStaysCalm(void)
If the volcano stays calm and the southern bridge stays fixed, there is nothing to worry about.
static void Vault_WalkThroughExit(s32 x, s32 z, s32 exitId)
Walks the leader into a doorway during the sixteen-frame exit delay.
static void Event_TalkOfLunpaThieves(void)
There are rumors of thieves from Lunpa running wild, yet they have been quiet.
struct SceneEntrance gVaultRevisit_Entrances[]
static void VaultRevisit_ShowStandingActorMessage(s32 actor)
Stands the actor still while showing the message already selected.
u16 gVaultRevisit_Scene7Cells[]
u32 gVaultRevisit_Exits[]
static void VaultRevisit_DogJumpAtPassage(void)
Jumps at the hidden passage, then pauses so the party can see the clue.
struct SceneEvent gVaultRevisit_Events[]
Vault, before and after the thieves are caught: the doorway of exit 11, which opens in two frames as ...
static void Vault_OpenDoorwayAndEnter(void)
Walking north into cell code 11 opens the doorway to the Sanctum.
Vault, before and after the thieves are caught: touch triggers 1 and 2 swap the collision of the 4x2 ...
static void Vault_RestorePassageCells(void)
Cell code 2 restores the passage's usual collision and clears FLAG_SCENE_TEMP_00.
static void Vault_EnableAlternatePassageCells(void)
Cell code 1 selects the passage's alternate collision and sets FLAG_SCENE_TEMP_00,...
The window renderer's work.