Alchemy
Loading...
Searching...
No Matches

altin.c

Go to the documentation of this file.
1/// @file
2/// Altin, the mining village flooded by the water the hydros statues in the
3/// mine spew. Two scenes share this overlay:
4///
5/// - the village itself, where the water drops in three stages as the party
6/// drains the mine, a water beast spits water at the houses until the
7/// party drives it off, and the shopkeepers wait for their shops to dry;
8/// - the houses and the inn, where families sheltering from the flood go
9/// home as the water recedes.
10///
11/// A third, empty set of tables serves any other scene number.
12
13#include "game_state.h"
14#include "version.h"
15#include "scene_ids.h"
16#include "unit/scene/altin.h"
17#include "unit/object/object.h"
19#include "battle.h"
20#include "debug.h"
21#include "field.h"
22#include "game.h"
23#include "graphics.h"
24#include "menu.h"
25#include "minigame.h"
26#include "sound.h"
27#include "system.h"
28#include "types.h"
29#include "field_event.h"
30#include "engine_call.h"
31#include "field_scene.h"
32#include "field_effect.h"
33#include "text/msg_ids.h"
34#include "ability_ids.h"
35#include "flags.h"
36#include "item_ids.h"
37#include "songs.h"
38#include "objcmd.h"
39
40#if !TBS_PATCH_3
41#define ALTIN_COOK_LAST_POT_X 384
42#else
43#define ALTIN_COOK_LAST_POT_X 380
44#endif
45
46#define SCENE_ALTIN_VILLAGE ((s32)&SceneId_Altin1)
47#define SCENE_ALTIN_HOUSES ((s32)&SceneId_Altin2)
48
49/// The village's actors.
54 /// Villagers who come back as the water recedes.
60 /// The armor and item sellers, waiting outside while their shops are
61 /// under water.
64 /// Three ground sprites drawn under the party.
68};
69
70/// The houses' actors.
72 /// The family sheltering in the inn's Room One until the first drop.
75 /// The family in Room Two, until the second drop.
85};
86
87/// The village's water level, set on entry from the mine's drain flags.
88enum {
92};
93
94enum {
99};
100
101enum {
103 /// The door triggers are numbered from 2 in the village's event table.
108};
109
110enum { SPRITE_SPRAY = 222, ANIM_BEAST_SPIT = 3 };
111
112#define WATER_BEAST_HOP_PERIOD 60
113#define WATER_SPRAY_LIFETIME 20
114#define WATER_SPRAY_START_SCALE 0x4ccc
115
116// UB: the native facing test overflows a signed left shift for many headings.
117#ifdef UBFIX
118#define ALTIN_FACES_COUNTER(facing) FACING_IS_NORTH(facing)
119#else
120#define ALTIN_FACES_COUNTER(facing) \
121 ((u32)(((facing) + 0x5fff) << 16) <= 0x3ffe0000)
122#endif
123
124// UB: the random wobble can be negative. Both factors fit in signed32 bits
125// for the actor's signed16-bit timer and wobble values.
126#ifdef UBFIX
127#define WATER_SPRAY_LATERAL_STEP(timer, wobble) \
128 ((timer) * 0x1000 + (wobble) * 0x8000)
129#else
130#define WATER_SPRAY_LATERAL_STEP(timer, wobble) \
131 (((timer) << 12) + ((wobble) << 15))
132#endif
133
134enum { TRIGGER_NEAR_BEAST = 20 };
135
136/// The highest actor slot.
137enum { ACTOR_LAST_PLACED = 65 };
138
139static void Village_ApplyWaterLevel(void);
140static void Houses_PlaceSheltering(void);
141static void Beast_SpawnSpray(void);
142
144 s16 scene = gGameState.scene;
145
146 if (scene == SCENE_ALTIN_VILLAGE) {
148 }
149 if (scene == SCENE_ALTIN_HOUSES) {
151 }
153}
154
155const struct SceneRegion *Scene_GetRegions(void) { return 0; }
156
157/// Both scenes share one exit table.
158const u32 *Scene_GetExits(void) { return gAltin_Exits; }
159
160/// Some villagers only turn back after talking once the flood is over or
161/// their family has gone home.
163 s32 scene = gGameState.scene;
164 if (scene == SCENE_ALTIN_VILLAGE) {
168 }
170 }
171 if (scene == SCENE_ALTIN_HOUSES) {
179 }
181}
182
183const struct SceneEvent *Scene_GetEvents(void) {
184 s16 scene = gGameState.scene;
185
186 if (scene == SCENE_ALTIN_VILLAGE) {
188 }
189 if (scene == SCENE_ALTIN_HOUSES) {
190 return gAltinHouses_Events;
191 }
192 return gAltinOther_Events;
193}
194
195/// A villager asks whether this is the party's first visit; either way, the
196/// flood has changed Altin.
197static void Village_AskAboutFirstVisit(void) {
199 Engine_EventSetMessage(MsgAltinYourFirstTimeVisitAltin);
200
202
203 if (Engine_EventChooseYesNo(0, 0) == 1) {
205 } else {
208 }
209
211}
212
213/// A villager asks whether the slain hydros creatures gushed water.
214static void Village_AskAboutHydros(void) {
216 Engine_EventSetMessage(MsgAltinDidSeeWaterGushingOut);
219}
220
221/// While the beasts live, this villager complains that their water cannot be
222/// drunk, and the first time the camera pans to the water beast spitting at
223/// the houses. Once the statues are gone, he asks for help rebuilding.
225
226 struct FieldActor *beast;
227 struct FieldActor *leader;
228
231 Engine_EventSetMessage(MsgAltinOnesWhoDefeatedWaterBeasts);
233 } else {
235 Engine_EventSetMessage(MsgAltinWeCantDrinkWaterMonsters);
239
241 Camera_SetSpeed(0x10000, 0x2000);
242 Camera_MoveTo(beast->x.fixed, beast->y.fixed, beast->z.fixed, 1);
243 // 0x4000 is south as a facing, but this call takes an actor number.
246 0);
248 Engine_EventWait(120);
250 Camera_MoveTo(leader->x.fixed, leader->y.fixed, leader->z.fixed, 1);
252 }
254 }
256}
257
258/// A villager asks whether the party really found ruins deep in the mine.
259static void Village_AskAboutRuins(void) {
260
262 Engine_EventSetMessage(MsgAltinTrueFoundAncientRuinsIn);
265}
266
267/// A guest asks whether the party is who the girl from Xian was looking for.
268static void Houses_AskAboutXianGirl(void) {
269
271 Engine_EventSetMessage(MsgAltinGirlFromXianWasAsking);
274}
275
276/// A guest asks whether the party seeks the way west, and points to the
277/// bottom of the mine.
278static void Houses_AskAboutWayWest(void) {
279
281 Engine_EventSetMessage(MsgAltinTryingFindYourWayWest);
284}
285
286/// The grateful villager asks whether the party defeated the monsters.
287static void Houses_AskAboutMonsters(void) {
288
290 Engine_EventSetMessage(MsgAltinDefeatedThoseMonstersDidnt);
293}
294
295/// A miner asks whether the remaining beasts are deep below.
296static void Houses_AskAboutMineBeasts(void) {
297
299 Engine_EventSetMessage(MsgAltinThereFewBeastsInMine);
302}
303
304/// Returns whether the party leader faces north, toward a shop counter: its
305/// facing lies strictly between northwest and northeast, measured in 16 bits.
308
309 if (ALTIN_FACES_COUNTER(leader->facing)) {
310 return 1;
311 }
312 return 0;
313}
314
315/// The weapon seller: until the water drains he cannot sell; afterwards he
316/// opens his shop when spoken to across the counter.
317static void Houses_TalkToWeaponSeller(void) {
318
321 Engine_EventSetMessage(MsgAltinDoWantWeapons);
322
325 return;
326 }
327
328 if (Leader_FacesCounter() != 0) {
330 return;
331 }
332
334 Engine_EventSetMessage(MsgAltinThankGoodnessWaterHasReceded);
336 Engine_EventSetMessage(MsgAltinYoullHaveFindPassageIn);
337 }
340}
341
342/// The armor seller, in either scene: outside, while his shop is under water,
343/// he laments; once it has dried after the second drop, he sells across his
344/// counter in the houses.
345static void Altin_TalkToArmorSeller(void) {
346
349 Engine_EventSetMessage(MsgAltinMyStoreSubmergedWantSell);
352 return;
353 }
354
355 if (Leader_FacesCounter() != 0) {
357 return;
358 }
359
361 Engine_EventSetMessage(MsgAltinItsGreatCanSellArmor);
363 Engine_EventSetMessage(MsgAltinHowAboutArentImpressedBy);
364 }
367}
368
369/// The item seller, the same way: she reopens after the first drop.
370static void Altin_TalkToItemSeller(void) {
373 Engine_EventSetMessage(MsgAltinWillDoIfMyMerchandise);
376 return;
377 }
378
379 if (Leader_FacesCounter() != 0) {
381 return;
382 }
383
385 Engine_EventSetMessage(MsgAltinNoneMyGoodsWereDamaged);
387 Engine_EventSetMessage(MsgAltinGirlFromXianBoughtLot);
388 }
391}
392
393/// The innkeeper opens the inn across the counter, and otherwise talks about
394/// the flood or, once it is over, the temple west of the mine.
395static void Houses_TalkToInnkeeper(void) {
396 struct FieldActor *leader;
397
399
400 if (ALTIN_FACES_COUNTER(leader->facing)) {
402 return;
403 }
404
406
408 Engine_EventSetMessage(MsgAltinThereSmallTempleWestAltin);
410 } else {
411 Engine_EventSetMessage(MsgAltinWeGotLittleDampBut);
413 }
414
416}
417
418/// Walking north into one of the village's doors: everyone stops, the door
419/// opens and the party leader walks in. The mine's wide door is redrawn in
420/// two halves by hand; the others play their opening pictures.
421static void Village_EnterDoor(void) {
422 u32 actorId;
423 struct EventWork *event;
424 struct FieldActor *actor;
425 s32 doorIndex;
426 u8 *doorBytes;
427 s32 doorByteOffset;
428 s32 coordinatesByteOffset;
429 s32 column;
430 s32 row;
431 s32 rightColumn;
432
433 event = gEventWork;
435 for (actorId = ACTOR_FIRST_PLACED; actorId <= ACTOR_LAST_PLACED; actorId++) {
436 actor = Object_GetById(actorId);
437 if (actor != 0) {
438 actor->motionFlags = 0;
439 }
440 }
441
442 // The bytes read the entry through byte offsets and sign-extend the door
443 // number by shifts; indexing the structs loads the fields differently.
444 doorBytes = (u8 *)gAltinVillage_Doors;
445 doorIndex =
446 ((*(u16 *)&event->touchedTrigger - FIRST_DOOR_TRIGGER) << 16) >> 16;
447 doorByteOffset = doorIndex << 3;
448 coordinatesByteOffset = doorByteOffset + 4;
449 column = *(s16 *)(doorBytes + coordinatesByteOffset);
450 row = *(s16 *)(doorBytes + coordinatesByteOffset + 2);
451 if (doorIndex == DOOR_MINE) {
452 // The mine's door slides open with SE_188, as Lama Temple's does.
454 Map_CopyCellsTo(42, 33, column, row, 2, 2);
455 rightColumn = column + 2;
456 Map_CopyCellsTo(42, 35, rightColumn, row, 2, 2);
458 Map_CopyCellsTo(40, 33, column, row, 2, 2);
459 Map_CopyCellsTo(40, 35, rightColumn, row, 2, 2);
461 } else {
463 if (doorIndex == DOOR_WITH_WINDOW) {
464 Map_CopyCellsTo(33, 42, 8, 17, 1, 2);
465 }
466 Map_AnimateCells(gAltinVillage_Doors[doorIndex].steps, column, row);
467 }
468
469 // Walk the leader through.
470 Actor_SetSpeed(ACTOR_PARTY_LEADER, 0x8000, 0x4000);
474 if (doorIndex == DOOR_STRAIGHT_IN) {
476 } else {
477 if (doorIndex != DOOR_MINE) {
479 } else {
482 }
483 }
489}
490
491/// Walking north into a doorway without a door: the leader walks out.
492static void Village_WalkThroughDoorway(void) {
493 struct EventWork *work;
494
495 work = gEventWork;
504}
505
506/// Update callback of the hopping water beast: once a second it leaps up,
507/// falls back with a splash that shakes the screen briefly, and stands while
508/// on the ground.
509static void Beast_Hop(union FieldObject *fieldObject) {
510 struct FieldActor *beast = &fieldObject->actor;
511 s16 *shakeFrames = (s16 *)&beast->work;
512
513 // While this hook owns the beast, timer is its hop phase, work counts down
514 // the landing shake, and the effect's countdown is a landing-sound latch.
515 // Read work through its corresponding signed type for the countdown test.
516 if (*shakeFrames != 0) {
517 if (--*shakeFrames == 1)
518 Map_SetShake(-1, -1, 0xe666);
519 }
520 if (beast->velocityY == 0) {
521 Object_SetMode(beast, 1);
522 beast->y.fixed += -0x18000;
523 if (beast->y.fixed < beast->terrainHeight) {
524 if (fieldObject->effect.countdown != 0) {
526 fieldObject->effect.countdown = 0;
527 beast->work = 4;
528 Map_SetShake(0, 0x10000, 0x10000);
529 }
530 beast->y.fixed = beast->terrainHeight;
531 }
532 beast->paused = 1;
533 } else {
534 beast->paused = 0;
535 }
536 if (beast->timer == 0) {
538 fieldObject->effect.countdown = 1;
539 Object_SetMode(beast, 2);
540 beast->velocityY = 0x30000;
541 }
542 if (++beast->timer == WATER_BEAST_HOP_PERIOD)
543 beast->timer = 0;
544}
545
546/// The water beast hops away across the flood and dives in with a splash.
547static void Beast_HopAway(void) {
548 struct FieldActor *beast;
549
551 beast->timer = 0;
552 beast->work = 0;
553 beast->gravity = 0x6666;
554 beast->update = Beast_Hop;
555 Actor_SetSpeed(ACTOR_WATER_BEAST, 0x13333, 0x9999);
560 Map_SetShake(0, 0x10000, 0x10000);
562 Map_SetShake(-1, -1, 0xe666);
565}
566
567/// After Move: remembers whether the block now stands in map column 22, the
568/// spot it is pushed to.
569static void Village_CheckBlockMoved(void) {
571
572 if ((block->x.fixed >> 20) == 22) {
574 } else {
576 }
577}
578
579/// Works out the village's water level from the mine's drain flags, then sets
580/// up whichever scene is being entered. Returns 0.
582 s16 scene;
583
586 }
587
591 }
592
596 }
597
598 scene = gGameState.scene;
599 if (scene == SCENE_ALTIN_VILLAGE) {
601 } else if (scene == SCENE_ALTIN_HOUSES) {
603 }
604
605 return 0;
606}
607
608/// Sets up the village: the map half showing the current water level (the
609/// cells kept in four 32 by 32 blocks), the villagers and sellers present at
610/// that level, the water beast with its spray while it remains, and the
611/// pushed block. Then redraws the map around the leader.
612static void Village_ApplyWaterLevel(void) {
613 struct FieldActor *leader;
614
616 // Select the water-level map and remove villagers whose areas are flooded.
618 Map_CopyCellsTo(64, 32, 0, 32, 32, 32);
619 Map_CopyCellAttributes(64, 32, 32, 32, 0, 0);
622 } else if (GameFlag_IsSet(FLAG_WATER_DROPPED_TWICE) != 0) {
623 Map_CopyCellsTo(64, 0, 0, 32, 32, 32);
624 Map_CopyCellAttributes(64, 0, 32, 32, 0, 0);
628 } else if (GameFlag_IsSet(FLAG_WATER_DROPPED_ONCE) != 0) {
629 Map_CopyCellsTo(0, 64, 0, 32, 32, 32);
630 Map_CopyCellAttributes(0, 64, 32, 32, 0, 0);
634 } else {
635 Map_CopyCellAttributes(0, 32, 32, 32, 0, 0);
639 }
640 // Restore the remaining beast spitting water, with its sound (SE_170) and
641 // its spray.
644 } else {
649 }
652 }
653 Map_CopyCellAttributes(0, 33, 4, 3, 20, 41);
656 }
658 // Keep the three ground sprites below the party before redrawing.
674 // Redraw at the leader after the map and object state are ready.
677 Camera_MoveTo(leader->x.fixed, leader->y.fixed, leader->z.fixed, 0);
681}
682
683/// Sets up the houses: the families still sheltering in the inn's rooms, the
684/// weapon seller waiting there until the water drains, and the shopkeepers
685/// kept from wandering.
686static void Houses_PlaceSheltering(void) {
687 struct FieldActor *actor;
688
693 }
698 }
703 } else {
705 actor->collisionFlags |= 4;
706 }
708 if (actor != 0) {
709 actor->collisionFlags |= 4;
710 }
712 if (actor != 0) {
713 actor->collisionFlags |= 4;
714 }
715}
716
717/// Gives a new spray particle its look: standing still, drawn on sprite
718/// priority 1 and at 0.3 scale.
719static void Spray_Initialize(struct FieldActor *spray) {
720 spray->motionFlags = 0;
721 spray->sprite->image.priority = 1;
726}
727
728/// Update callback of a spray particle: it drifts and grows with a random
729/// wobble, then curls upward and flattens as its movement timer runs down.
730/// The separate lifetime releases it after 20 updates.
731static void Spray_Drift(union FieldObject *fieldObject) {
732 struct FieldActor *spray = &fieldObject->actor;
734 spray->timer, (s16)((s32)(((u32)Engine_RandomNext() * 2) >> 16) - 1));
735 if (spray->timer <= 3) {
736 spray->z.fixed += -(((u32)Engine_RandomNext() * 0x8000) >> 16) - 0x10000;
737 spray->scaleX += 0x2666;
738 spray->scaleY += -0xa3d;
739 } else {
740 spray->z.fixed += 0x20000;
741 spray->scaleX += 0x7ae;
742 spray->scaleY += 0x7ae;
743 }
744 if (((u32)Engine_RandomNext() * spray->timer) >> 16 == 0)
746 if (spray->timer != 0)
747 spray->timer--;
748 else
749 spray->timer = (((u32)Engine_RandomNext() * 5) >> 16) * 2 + 2;
750 if (--fieldObject->effect.countdown == 0) {
751 spray->update = 0;
753 }
754}
755
756/// Scheduler task while the water beast spits: every fourth frame a spray
757/// particle starts from its spout, living 20 frames.
758static void Beast_SpawnSpray(void) {
759 union FieldObject *spray;
760 if ((gFrameCount & 3) == 0) {
761 spray = ((union FieldObject *)Object_Create(SPRITE_SPRAY, PIXELS(64), 0,
762 PIXELS(400)));
763 if (spray != 0) {
765 spray->actor.work = 0;
767 Spray_Initialize(&spray->actor);
768 spray->actor.update = Spray_Drift;
769 Object_SetMode(&spray->actor, 1);
770 }
771 }
772}
773
774/// Stepping near the water beast: the camera pans to it, it stops spitting,
775/// turns to the party, cries out and hops away into the flood.
776static void Village_ScareOffBeast(void) {
778 Camera_SetSpeed(0x6666, 0xccc);
779 Camera_MoveTo(PIXELS(63), -1, PIXELS(450), 1);
783 // The spitting stops: its sound and its spray end.
801}
802
803/// The cook from Xian paces between his pots, nodding over each.
805 SC_ADD(SW_COLLISION, 128),
806 SC_SET(SW_SPEED, 0x26666),
807 SC_SET(SW_ACCEL, 0x13333),
808 SC_LABEL(1),
810 SC_MOVE(PIXELS(342), 0, PIXELS(746)),
811 SC_SYNC,
814 SC_WAIT(30),
816 SC_MOVE(PIXELS(356), 0, PIXELS(746)),
817 SC_SYNC,
820 SC_WAIT(50),
822 SC_MOVE(PIXELS(342), 0, PIXELS(746)),
823 SC_SYNC,
826 SC_WAIT(20),
829 SC_SYNC,
832 SC_WAIT(30),
834 SC_WAIT(90),
836};
837
839 {0, CONDITION_ALWAYS, 380, 0, 433, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
841};
842
844 {0, CONDITION_ALWAYS, 380, 0, 433, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
845 {1, CONDITION_ALWAYS, 488, 0, 184, FACING_WEST, 0, -1, -1, -1, -1, 0},
846 {2, CONDITION_ALWAYS, 168, 0, 216, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
847 {3, CONDITION_ALWAYS, 336, 0, 200, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
848 {4, CONDITION_ALWAYS, 424, 0, 344, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
849 {5, CONDITION_ALWAYS, 136, 0, 312, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
850 {6, CONDITION_ALWAYS, 280, 0, 408, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
851 {7, CONDITION_ALWAYS, 456, 0, 224, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
852 {8, CONDITION_ALWAYS, 184, 0, 408, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
853 {9, CONDITION_ALWAYS, 168, 0, 440, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
854 {10, CONDITION_ALWAYS, 24, 0, 456, FACING_SOUTHEAST, 0, -1, -1, -1, -1, 0},
855 {11, CONDITION_ALWAYS, 264, 0, 224, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
856 {12, CONDITION_ALWAYS, 328, 0, 264, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
857 {13, CONDITION_ALWAYS, 343, 0, 177, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
859};
860
862 {0, CONDITION_ALWAYS, 200, 0, 200, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
863 {1, CONDITION_ALWAYS, 159, 0, 258, FACING_NORTH, 0, 25, 16, 255, 300, 0},
864 {2, CONDITION_ALWAYS, 336, 0, 213, FACING_NORTH, 0, 268, 40, 500, 250, 0},
865 {3, CONDITION_ALWAYS, 688, 0, 204, FACING_NORTH, 0, 542, 40, 768, 250, 0},
866 {4, CONDITION_ALWAYS, 240, 0, 500, FACING_NORTH, 0, 110, 336, 350, 540, 0},
867 {5, CONDITION_ALWAYS, 496, 0, 504, FACING_NORTH, 0, 360, 336, 600, 540, 0},
868 {6, CONDITION_ALWAYS, 752, 0, 516, FACING_NORTH, 0, 635, 280, 845, 556, 0},
869 {7, CONDITION_ALWAYS, 80, 0, 864, FACING_NORTH, 0, 16, 638, 432, 912, 0},
870 {8, CONDITION_ALWAYS, 68, 0, 728, FACING_SOUTH, 0, 16, 638, 432, 912, 0},
871 {9, CONDITION_ALWAYS, 690, 0, 732, FACING_SOUTH, 0, 480, 626, 896, 882, 0},
873};
874
876 SCENE_EXITS(75), SCENE_EXIT(1, 2, 16), SCENE_EXIT(2, 76, 7),
877 SCENE_EXIT(3, 9, 29), SCENE_EXIT(4, 76, 1), SCENE_EXIT(5, 76, 2),
878 SCENE_EXIT(6, 76, 3), SCENE_EXIT(7, 76, 5), SCENE_EXIT(8, 76, 6),
879 SCENE_EXIT(9, 76, 4), SCENE_EXIT(10, 77, 1), SCENE_EXIT(11, 80, 1),
880 SCENE_EXIT(12, 84, 4), SCENE_EXIT(13, 83, 3), SCENE_EXIT(0, 76, 0),
881 SCENE_EXIT(1, 75, 4), SCENE_EXIT(2, 75, 5), SCENE_EXIT(3, 75, 6),
882 SCENE_EXIT(4, 75, 9), SCENE_EXIT(5, 75, 7), SCENE_EXIT(6, 75, 8),
883 SCENE_EXIT(7, 75, 2), SCENE_EXIT(8, 76, 9), SCENE_EXIT(9, 76, 8),
885};
886
889};
890
892 {0x72, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(440), 0, PIXELS(200),
894 {0x74, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(408), 0, PIXELS(216),
896 {0x6a, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(310), 0, PIXELS(217),
898 {0x65, CONDITION_ALWAYS, ACTOR_WANDER, PIXELS(246), 0, PIXELS(186),
900 {0x67, CONDITION_ALWAYS, 3, PIXELS(58), 0, PIXELS(206),
902 {0x73, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(104), 0, PIXELS(286),
904 {0x6f, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(41), 0, PIXELS(441),
906 {0x6c, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(176), 0, PIXELS(296),
908 {0x72, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(136), 0, PIXELS(461),
910 {0x67, CONDITION_ALWAYS, ACTOR_WANDER, PIXELS(350), 0, PIXELS(286),
912 {0xbe, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(60), 0, PIXELS(474),
914 {0xcb, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(344), 0, PIXELS(168),
916 {0x7d, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(88), 0, PIXELS(397),
918 {0x76, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(422), 0, PIXELS(208),
920 {0xdf, CONDITION_ALWAYS, 7, PIXELS(452), 0, PIXELS(216), FACING_SOUTH,
922 {0xdf, CONDITION_ALWAYS, 7, PIXELS(332), 0, PIXELS(360), FACING_SOUTH,
924 {0xdf, CONDITION_ALWAYS, 7, PIXELS(332), 0, PIXELS(396), FACING_SOUTH,
927};
928
929// clang-format off
932 TALK_FACE_PARTY, 0},
934 TALK_FACE_PARTY, 0},
936 0},
937 {0x6f, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(376), 0, PIXELS(120),
939 {0x6c, 0x0, ACTOR_STAND, PIXELS(690), 0, PIXELS(128), FACING_SOUTHWEST + FACING_STEP,
941 {0x6a, 0x0, ACTOR_STAND, PIXELS(669), 0, PIXELS(128), FACING_EAST + FACING_STEP,
943 {0x66, 0x0, ACTOR_STAND, PIXELS(604), 0, PIXELS(145), FACING_SOUTHEAST + FACING_STEP, 3, 0},
945 TALK_FACE_PARTY, 0},
946 {0x76, 0x0, ACTOR_STAND, PIXELS(520), 0, PIXELS(454), FACING_SOUTH + FACING_STEP,
947 TALK_FACE_PARTY, 0},
948 {0x7d, 0x0, ACTOR_STAND, PIXELS(743), 0, PIXELS(454), FACING_SOUTHEAST + FACING_STEP,
949 TALK_FACE_PARTY, 0},
950 {0x77, 0x0, ACTOR_STAND, PIXELS(103), 0, PIXELS(744), FACING_SOUTHEAST + FACING_STEP,
951 TALK_FACE_PARTY, 0},
952 {0x80, 0x0, 3, PIXELS(228), 0, PIXELS(756), FACING_SOUTHWEST + FACING_STEP, TALK_FACE_PARTY, 0},
953 {0x7b, 0x0, (s32)gAltinHouses_CookScript, PIXELS(350), 0, PIXELS(746),
955 {0x6c, 0x0, ACTOR_STAND, PIXELS(646), 0, PIXELS(734), FACING_SOUTHEAST + FACING_STEP,
956 TALK_FACE_PARTY, 0},
958};
959
962};
963
968 {EVENT_EXIT, 13, CONDITION_ALWAYS, 13},
987 {EVENT_TALK, ACTOR_GREETING_VILLAGER, CONDITION_ALWAYS, MSGNO(MsgAltinThankYouSoMuchForDefeating)},
988 {EVENT_TALK, ACTOR_CURIOUS_VILLAGER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinHowCanThoseCreaturesSpitUp)},
990 {EVENT_TALK, 10, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinHowHorribleMyHouseIsTotally)},
991 {EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgAltinOnceTheMineOpensAgainWell)},
992 {EVENT_TALK, 11, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinEvenTheMineIsSubmergedNo)},
993 {EVENT_TALK, 11, CONDITION_ALWAYS, MSGNO(MsgAltinTheyAlreadyStartedMiningTheUpper)},
994 {EVENT_TALK, 12, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIfWeCouldJustDestroyThe)},
995 {EVENT_TALK, 12, CONDITION_ALWAYS, MSGNO(MsgAltinTheWaterDrainedOutOfThe)},
996 {EVENT_TALK, 13, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinAltinAlwaysUsedToRunShort)},
997 {EVENT_TALK, 13, CONDITION_ALWAYS, MSGNO(MsgAltinThankGoodnessTheVillageIsFree)},
999 {EVENT_TALK, ACTOR_RETURNING_VILLAGER_A, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinTheWatersAroundHereHaveSubsided)},
1000 {EVENT_TALK, ACTOR_RETURNING_VILLAGER_A, CONDITION_ALWAYS, MSGNO(MsgAltinTheVillageWentRightBackTo)},
1001 {EVENT_TALK, ACTOR_RETURNING_VILLAGER_B, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinTheWaterBeastsLookedExactlyLike)},
1002 {EVENT_TALK, ACTOR_RETURNING_VILLAGER_B, CONDITION_ALWAYS, MSGNO(MsgAltinSoThoseHydrosCreaturesReallyWere)},
1003 {EVENT_TALK, ACTOR_RETURNING_VILLAGER_C, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinTheWatersHaveFlushedOutTons)},
1009 MSGNO(MsgAltinWeCanGoBackToWork)},
1011 MSGNO(MsgAltinItsAlmostLikeTheyreTurningThe)},
1013 MSGNO(MsgAltinIWasAfraidMoreWaterWould)},
1014 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinImGladISavedMyVery)},
1016 MSGNO(MsgAltinIHopeAltinMineWillThrive)},
1018 MSGNO(MsgAltinEvenTheToughestOfMinersCant)},
1020 MSGNO(MsgAltinTheWaterSeepedIntoTheMine)},
1022 MSGNO(MsgAltinIfTheWaterBeastsContinueTo)},
1024 MSGNO(MsgAltinItsSoHumidInsideThatCave)},
1025 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 13, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinWaterIsNiceButNotWhen)},
1027 MSGNO(MsgAltinThatStrangeChamberInTheMines)},
1029 MSGNO(MsgAltinUghTheMonstersSpewedOutAll)},
1031 MSGNO(MsgAltinYouFoughtPrettyWellDespiteAll)},
1034 MSGNO(MsgAltinThatMineIsFullOfHoles)},
1037 MSGNO(MsgAltinTheOldGuardianStatuesAlwaysCreeped)},
1039 MSGNO(MsgAltinItllBeBetterThanDiggingUp)},
1041 MSGNO(MsgAltinIUsedToFindAllSorts)},
1043 MSGNO(MsgAltinAllMyArmorInventoryIsRusting)},
1045 MSGNO(MsgAltinIfMyGoodsAreWetIll)},
1049};
1050
1061 {EVENT_TALK, ACTOR_ROOM_ONE_GUEST, FLAG_WATER_DROPPED_ONCE, MSGNO(MsgAltinNoMatterWhatHappensIdNever)},
1062 {EVENT_TALK, ACTOR_ROOM_ONE_GUEST, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinOhNoTheWholeHouseIs)},
1063 {EVENT_TALK, ACTOR_ROOM_ONE_GUEST, CONDITION_ALWAYS, MSGNO(MsgAltinIHearThatSilkRoadIs)},
1064 {EVENT_TALK, ACTOR_ROOM_ONE_SECOND_GUEST, FLAG_WATER_DROPPED_ONCE, MSGNO(MsgAltinOfCourseOurHouseWillBe)},
1065 {EVENT_TALK, ACTOR_ROOM_ONE_SECOND_GUEST, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIfTheMonsterThatDidThis)},
1067 {EVENT_TALK, ACTOR_ROOM_TWO_GUEST, FLAG_WATER_DROPPED_TWICE, MSGNO(MsgAltinNotManyPeopleComeUpSilk)},
1069 {EVENT_TALK, ACTOR_ROOM_TWO_GUEST, CONDITION_ALWAYS, MSGNO(MsgAltinAncientRuinsAndTreasureDefinitelyGo)},
1070 {EVENT_TALK, ACTOR_ROOM_TWO_SECOND_GUEST, FLAG_WATER_DROPPED_TWICE, MSGNO(MsgAltinItsBeenALongTimeSince)},
1071 {EVENT_TALK, ACTOR_ROOM_TWO_SECOND_GUEST, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinDontBeTooHarshOnThose)},
1072 {EVENT_TALK, ACTOR_ROOM_TWO_SECOND_GUEST, CONDITION_ALWAYS, MSGNO(MsgAltinIfOnlyTheyHadLeftA)},
1073 {EVENT_TALK, 12, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIDidntWantToLeaveMy)},
1074 {EVENT_TALK, 12, CONDITION_ALWAYS, MSGNO(MsgAltinReallyAncientRuinsAtTheBottom)},
1075 {EVENT_TALK, 13, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIHeardSomeoneKilledTheWater)},
1076 {EVENT_TALK, 13, CONDITION_ALWAYS, MSGNO(MsgAltinThereProbablyIsntMuchTreasureIn)},
1078 {EVENT_TALK, ACTOR_KISSING_VILLAGER, CONDITION_ALWAYS, MSGNO(MsgAltinSomethingsWrongWithMomAndPop)},
1083 {EVENT_TALK, 19, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIdGiveAnythingForSomeoneTo)},
1084 {EVENT_TALK, 19, CONDITION_ALWAYS, MSGNO(MsgAltinThereIsAnEndlessDesertWest)},
1085 {EVENT_TALK, ACTOR_COOK, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinICameFromXianICook)},
1086 {EVENT_TALK, ACTOR_COOK, CONDITION_ALWAYS, MSGNO(MsgAltinWestOfTheMountainsIsVery)},
1087 {EVENT_TALK, ACTOR_MINE_WORKER, FLAG_WATER_DROPPED_ONCE, MSGNO(MsgAltinNoneOfUsCanGoHome)},
1088 {EVENT_TALK, ACTOR_MINE_WORKER, FLAG_WATER_DROPPED_TWICE, MSGNO(MsgAltinTheGuestsInRoomOneMoved)},
1089 {EVENT_TALK, ACTOR_MINE_WORKER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinTheGuestsInRoomTwoAlso)},
1092 MSGNO(MsgAltinLeavingAltinForTolbiWellThats)},
1095 MSGNO(MsgAltinTheMerchantsMustBeHavingA)},
1099 MSGNO(MsgAltinIWonderWhatBusinessThatGirl)},
1100 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_ROOM_TWO_GUEST, FLAG_WATER_DROPPED_TWICE, MSGNO(MsgAltinOfCourseYouCantGoWest)},
1102 MSGNO(MsgAltinIThoughtTheVillageWasDone)},
1104 MSGNO(MsgAltinTheySayYouCanStillFind)},
1106 MSGNO(MsgAltinIHateSittingAroundLikeThis)},
1109 MSGNO(MsgAltinHowCanITrulyBeHappy)},
1110 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 12, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinTheBottomOfTheMineThe)},
1112 MSGNO(MsgAltinCripesAncientRuinsDownInThe)},
1114 MSGNO(MsgAltinMyHusbandsSenseForFindingTreasure)},
1116 MSGNO(MsgAltinIHadNoIdeaThereWere)},
1118 MSGNO(MsgAltinMomAndPopKnowSomethingAbout)},
1120 MSGNO(MsgAltinIWonderIfMomAndPop)},
1121 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_WEAPON_SELLER, FLAG_WATER_DRAINED, MSGNO(MsgAltinCripesIsThisHowMyWeapon)},
1122 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_WEAPON_SELLER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinOnlyAMerchantKnowsTheJoy)},
1124 MSGNO(MsgAltinIveHeardOfAPassageIn)},
1125 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_ARMOR_SELLER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinWeDriedOffAllThatArmor)},
1127 MSGNO(MsgAltinWellIfYouAreImpressedThen)},
1130 MSGNO(MsgAltinTheGirlFromXianBoughtAll)},
1132 MSGNO(MsgAltinWellComeThroughThisAllRight)},
1134 MSGNO(MsgAltinIThinkThatTempleWasCalled)},
1135 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 19, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIKnowTheyDontLookSo)},
1137 MSGNO(MsgAltinYouWontBeAbleToGo)},
1138 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_COOK, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinIBecameACookAfterI)},
1140 MSGNO(MsgAltinNoOneCanGoWestOf)},
1141 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_MINE_WORKER, FLAG_WATER_DROPPED_ONCE, MSGNO(MsgAltinMostOfTheVillageIsStill)},
1142 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_MINE_WORKER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgAltinItLooksLikeTheWaterHas)},
1144 MSGNO(MsgAltinItWillTakeSomeTimeBefore)},
1149 FIND_MESSAGE(MSGNO(MsgAltinThePotsAndPansAreRusted))},
1151 FIND_MESSAGE(MSGNO(MsgAltinHeIsMakingRoastBeefEven))},
1153 FIND_MESSAGE(MSGNO(MsgAltinHeIsMakingShrimpInA))},
1155 FIND_MESSAGE(MSGNO(MsgAltinThereIsABookTitledAltin))},
1157};
1158// clang-format on
1159
1160/// The opening pictures of the village's doors, two cells square. The mine's
1161/// door (the second) is wider and redrawn by hand instead.
1163 MAP_CELL_STEP(42, 33, 2, 2, 0),
1164 MAP_CELL_STEP(42, 35, 2, 2, 5),
1165 MAP_CELL_STEP(40, 33, 2, 2, 0),
1166 MAP_CELL_STEP(40, 35, 2, 2, 5),
1168};
1169
1171 MAP_CELL_STEP(35, 48, 2, 2, 5),
1172 MAP_CELL_STEP(33, 48, 2, 2, 5),
1174};
1175
1177 MAP_CELL_STEP(35, 35, 2, 2, 5),
1178 MAP_CELL_STEP(33, 35, 2, 2, 5),
1180};
1181
1183 MAP_CELL_STEP(35, 46, 2, 2, 5),
1184 MAP_CELL_STEP(33, 46, 2, 2, 5),
1186};
1187
1189 MAP_CELL_STEP(35, 50, 2, 2, 5),
1190 MAP_CELL_STEP(33, 50, 2, 2, 5),
1192};
1193
1195 MAP_CELL_STEP(35, 33, 2, 2, 5),
1196 MAP_CELL_STEP(33, 33, 2, 2, 5),
1198};
1199
1201 MAP_CELL_STEP(35, 52, 2, 2, 5),
1202 MAP_CELL_STEP(33, 52, 2, 2, 5),
1204};
1205
1206/// Each door trigger's opening picture and cell, from trigger 2.
1212};
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_MOVE
Definition ability_ids.h:15
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
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.
struct ScenePlacement gAltinHouses_Placements[]
Definition altin.c:930
static void Village_ApplyWaterLevel(void)
Sets up the village: the map half showing the current water level (the cells kept in four 32 by 32 bl...
Definition altin.c:612
static void Village_EnterDoor(void)
Walking north into one of the village's doors: everyone stops, the door opens and the party leader wa...
Definition altin.c:421
struct ScenePlacement gAltinOther_Placements[]
Definition altin.c:887
@ FLAG_WATER_DRAINED
Definition altin.c:91
@ FLAG_WATER_DROPPED_TWICE
Definition altin.c:90
@ FLAG_WATER_DROPPED_ONCE
Definition altin.c:89
@ TRIGGER_NEAR_BEAST
Definition altin.c:134
u16 gAltinVillage_MineDoorCells[]
The opening pictures of the village's doors, two cells square.
Definition altin.c:1162
#define SCENE_ALTIN_VILLAGE
Definition altin.c:46
static void Houses_AskAboutMonsters(void)
The grateful villager asks whether the party defeated the monsters.
Definition altin.c:287
static void Houses_TalkToInnkeeper(void)
The innkeeper opens the inn across the counter, and otherwise talks about the flood or,...
Definition altin.c:395
static void Spray_Drift(union FieldObject *fieldObject)
Update callback of a spray particle: it drifts and grows with a random wobble, then curls upward and ...
Definition altin.c:731
#define WATER_SPRAY_LATERAL_STEP(timer, wobble)
Definition altin.c:130
struct DoorAnim gAltinVillage_Doors[]
Each door trigger's opening picture and cell, from trigger 2.
Definition altin.c:1207
@ SHOP_ALTIN_ITEMS
Definition altin.c:97
@ SHOP_ALTIN_ARMOR
Definition altin.c:96
@ SHOP_ALTIN_WEAPONS
Definition altin.c:95
@ INN_ALTIN
Definition altin.c:98
AltinVillageActor
The village's actors.
Definition altin.c:50
@ ACTOR_MOVABLE_BLOCK
Definition altin.c:59
@ ACTOR_SECOND_GROUND_SPRITE
Definition altin.c:66
@ ACTOR_THIRD_GROUND_SPRITE
Definition altin.c:67
@ ACTOR_FLOODED_ITEM_SELLER
Definition altin.c:63
@ ACTOR_THIRSTY_VILLAGER
Definition altin.c:53
@ ACTOR_FIRST_GROUND_SPRITE
Three ground sprites drawn under the party.
Definition altin.c:65
@ ACTOR_RETURNING_VILLAGER_B
Definition altin.c:56
@ ACTOR_GREETING_VILLAGER
Definition altin.c:51
@ ACTOR_CURIOUS_VILLAGER
Definition altin.c:52
@ ACTOR_FLOODED_ARMOR_SELLER
The armor and item sellers, waiting outside while their shops are under water.
Definition altin.c:62
@ ACTOR_RETURNING_VILLAGER_A
Villagers who come back as the water recedes.
Definition altin.c:55
@ ACTOR_RETURNING_VILLAGER_C
Definition altin.c:57
@ ACTOR_WATER_BEAST
Definition altin.c:58
AltinHouseActor
The houses' actors.
Definition altin.c:71
@ ACTOR_ROOM_TWO_SECOND_GUEST
Definition altin.c:77
@ ACTOR_ITEM_SELLER
Definition altin.c:80
@ ACTOR_KISSING_VILLAGER
Definition altin.c:78
@ ACTOR_MINE_WORKER
Definition altin.c:84
@ ACTOR_COOK
Definition altin.c:83
@ ACTOR_ARMOR_SELLER
Definition altin.c:81
@ ACTOR_ROOM_TWO_GUEST
The family in Room Two, until the second drop.
Definition altin.c:76
@ ACTOR_ROOM_ONE_GUEST
The family sheltering in the inn's Room One until the first drop.
Definition altin.c:73
@ ACTOR_ROOM_ONE_SECOND_GUEST
Definition altin.c:74
@ ACTOR_INNKEEPER
Definition altin.c:82
@ ACTOR_WEAPON_SELLER
Definition altin.c:79
static void Village_AskAboutHydros(void)
A villager asks whether the slain hydros creatures gushed water.
Definition altin.c:214
static void Beast_SpawnSpray(void)
Scheduler task while the water beast spits: every fourth frame a spray particle starts from its spout...
Definition altin.c:758
static void Beast_Hop(union FieldObject *fieldObject)
Update callback of the hopping water beast: once a second it leaps up, falls back with a splash that ...
Definition altin.c:509
@ ACTOR_LAST_PLACED
Definition altin.c:137
static void Houses_AskAboutMineBeasts(void)
A miner asks whether the remaining beasts are deep below.
Definition altin.c:296
#define ALTIN_COOK_LAST_POT_X
Definition altin.c:41
static void Village_AskAboutFirstVisit(void)
A villager asks whether this is the party's first visit; either way, the flood has changed Altin.
Definition altin.c:197
#define ALTIN_FACES_COUNTER(facing)
Definition altin.c:120
static void Altin_TalkToItemSeller(void)
The item seller, the same way: she reopens after the first drop.
Definition altin.c:370
static void Beast_HopAway(void)
The water beast hops away across the flood and dives in with a splash.
Definition altin.c:547
u16 gAltinVillage_DoorCellsD[]
Definition altin.c:1194
static void Village_AskAboutRuins(void)
A villager asks whether the party really found ruins deep in the mine.
Definition altin.c:259
struct SceneEntrance gAltinOther_Entrances[]
Definition altin.c:838
static s32 Leader_FacesCounter(void)
Returns whether the party leader faces north, toward a shop counter: its facing lies strictly between...
Definition altin.c:306
static void Village_ScareOffBeast(void)
Stepping near the water beast: the camera pans to it, it stops spitting, turns to the party,...
Definition altin.c:776
u16 gAltinVillage_DoorCellsG[]
Definition altin.c:1182
static void Village_CheckBlockMoved(void)
After Move: remembers whether the block now stands in map column 22, the spot it is pushed to.
Definition altin.c:569
u16 gAltinVillage_DoorCellsE[]
Definition altin.c:1200
static void Houses_TalkToWeaponSeller(void)
The weapon seller: until the water drains he cannot sell; afterwards he opens his shop when spoken to...
Definition altin.c:317
struct SceneEvent gAltinHouses_Events[]
Definition altin.c:1051
#define SCENE_ALTIN_HOUSES
Definition altin.c:47
struct SceneEntrance gAltinHouses_Entrances[]
Definition altin.c:861
@ SPRITE_SPRAY
Definition altin.c:110
@ ANIM_BEAST_SPIT
Definition altin.c:110
#define WATER_SPRAY_LIFETIME
Definition altin.c:113
#define WATER_BEAST_HOP_PERIOD
Definition altin.c:112
static void Altin_TalkToArmorSeller(void)
The armor seller, in either scene: outside, while his shop is under water, he laments; once it has dr...
Definition altin.c:345
static void Houses_AskAboutWayWest(void)
A guest asks whether the party seeks the way west, and points to the bottom of the mine.
Definition altin.c:278
@ ENTRANCE_FROM_MINE
Definition altin.c:102
@ FIRST_DOOR_TRIGGER
The door triggers are numbered from 2 in the village's event table.
Definition altin.c:104
@ DOOR_MINE
Definition altin.c:105
@ DOOR_STRAIGHT_IN
Definition altin.c:107
@ DOOR_WITH_WINDOW
Definition altin.c:106
static void Village_WalkThroughDoorway(void)
Walking north into a doorway without a door: the leader walks out.
Definition altin.c:492
static void Village_TalkToThirstyVillager(void)
While the beasts live, this villager complains that their water cannot be drunk, and the first time t...
Definition altin.c:224
u16 gAltinVillage_DoorCellsF[]
Definition altin.c:1176
static void Spray_Initialize(struct FieldActor *spray)
Gives a new spray particle its look: standing still, drawn on sprite priority 1 and at 0....
Definition altin.c:719
u16 gAltinVillage_DoorCellsA[]
Definition altin.c:1170
u32 gAltin_Exits[]
Definition altin.c:875
#define WATER_SPRAY_START_SCALE
Definition altin.c:114
static void Houses_AskAboutXianGirl(void)
A guest asks whether the party is who the girl from Xian was looking for.
Definition altin.c:268
static void Houses_PlaceSheltering(void)
Sets up the houses: the families still sheltering in the inn's rooms, the weapon seller waiting there...
Definition altin.c:686
s32 gAltinHouses_CookScript[]
The cook from Xian paces between his pots, nodding over each.
Definition altin.c:804
u16 gAltinVillage_DoorCellsC[]
Definition altin.c:1188
struct SceneEvent gAltinVillage_Events[]
Definition altin.c:964
struct SceneEvent gAltinOther_Events[]
Definition altin.c:960
struct ScenePlacement gAltinVillage_Placements[]
Definition altin.c:891
struct SceneEntrance gAltinVillage_Entrances[]
Definition altin.c:843
struct FieldActor * Camera_GetEventObject(void)
The event command "get view centre": returns the camera object.
Definition camera.c:133
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine calls the debug menus import, and their palette swatch tiles.
The engine call layer: one typed inline for each of the thirteen main-image routines below that the s...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
Definition engine_call.h:36
void FieldScene_PrepareActors(struct ScenePlacement *entry)
Field effects, their scripts and the flags that spawn them.
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
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Object_SetMode(struct FieldActor *object, s32 animation)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
#define GameFlag_IsSet
static void Camera_SetSpeed(s32 speed, s32 acceleration)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_InnOpen(s32 inn, s32 keeper)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void Event_SkipMessages(s32 count)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
#define GameFlag_Clear
void Engine_EventWaitForScreen(void)
#define GameFlag_Set
void Engine_ActorDestroy(s32 actor)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
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_ActorRunRepeatedMotion(s32 actor, s32 repeats)
s32 Engine_RandomNext()
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
#define MAP_CELL_STEPS_END
Definition field_event.h:61
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
static s32 Event_AskYesNo(s32 speaker, s32 flags)
static void Actor_CenterAndWalk(s32 actor, s32 priority, s32 dz)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
@ TASK_PRIORITY_SCENE
Definition field_event.h:40
void Engine_MapRedraw(void)
void Engine_ShopOpen(s32 shop, s32 keeper)
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_EventWait(s32 frames)
@ TRANSITION_BACKDROP_FADE
Definition field_obj.h:16
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
Definition field_obj.h:155
#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 FIND_MESSAGE(message)
#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_KEEP_FACING
@ 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)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
#define TOUCH_FACING(facing)
@ FACING_EAST
Definition field_scene.h:26
@ FACING_SOUTHEAST
Definition field_scene.h:27
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_SOUTHWEST
Definition field_scene.h:29
@ 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_BOOKCASE
@ SEARCH_BED
@ SEARCH_BARREL
#define FIND_COINS(coins)
Game flags, named where their meaning is shown.
#define FLAG_ALTIN_BLOCK_MOVED
pushed to its place by Move
Definition flags.h:145
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_ALTIN_NUT
a barrel in the houses
Definition flags.h:146
#define FLAG_SCENE_TEMP_40
Definition flags.h:777
#define FLAG_ALTIN_WATER_BEAST_LEFT
jumped back into the flood
Definition flags.h:144
#define FLAG_ALTIN_MINE_SECOND_DRAIN
Definition flags.h:116
#define FLAG_HYDROS_STATUES_DEFEATED
Definition flags.h:118
#define FLAG_ALTIN_SLEEP_BOMB
a bed in the houses
Definition flags.h:148
#define FLAG_ALTIN_MINE_THIRD_DRAIN
Definition flags.h:117
#define FLAG_SCENE_TEMP_41
Definition flags.h:778
#define FLAG_ALTIN_COINS
a barrel in the houses
Definition flags.h:147
#define FLAG_SCENE_TEMP_42
Definition flags.h:779
#define FLAG_ALTIN_MINE_FIRST_DRAIN
Definition flags.h:115
volatile u32 gFrameCount
Frames WaitFrames has finished.
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_NUT
Definition item_ids.h:41
@ ITEM_SLEEP_BOMB
Definition item_ids.h:68
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_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_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
@ SW_ACCEL
Definition objcmd.h:68
@ SW_COLLISION
Definition objcmd.h:79
@ SW_SPEED
Definition objcmd.h:67
@ SW_FACING
Definition objcmd.h:57
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
Definition requests.c:90
Scene numbers, named after their places.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_170
Definition songs.h:165
#define SE_DOOR_OPEN
Definition songs.h:153
#define SE_MAP_EXIT
Definition songs.h:116
#define SE_147
Definition songs.h:140
#define SE_188
Definition songs.h:183
#define SE_229
Definition songs.h:224
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
Definition songs.h:147
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_EventEnd(void)
void Engine_EventBegin(void)
void Engine_TaskWait()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
Each village door the party can walk through: its opening picture and the cell it is drawn at.
Definition altin.h:14
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
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
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
Definition field_obj.h:83
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
union FieldCoordinate y
16.16 fixed-point pixels
Definition field_obj.h:36
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
Definition field_obj.h:51
s32 terrainHeight
16.16 fixed-point pixels
Definition field_obj.h:38
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
s32 scaleX
16.16 fixed point, 0x10000 full size
Definition field_obj.h:39
s32 scaleY
16.16 fixed point, 0x10000 full size
Definition field_obj.h:40
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Definition field_obj.h:116
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
Definition field_obj.h:112
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
s32 countdown
Frames until a scene's update hook releases the effect: 20 for Altin Peak's spray,...
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
u8 talkFacing
enum ActorTalkFacing; 3 follows the leader afterwards
Definition field_scene.h:95
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
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct FieldActor actor
struct FieldEffect effect
The patch levels: our groups of the measured changes from the Japanese release.