Alchemy
Loading...
Searching...
No Matches

sanctum.c

Go to the documentation of this file.
1/// @file
2/// A sanctum: Vale's, where the Great Healer asks Isaac to go to Sol Sanctum
3/// and a refusal ends the game, or another town's, with its healer.
4
6#include "flags.h"
7#include "game_state.h"
11#include "unit/field/field.h"
12#include "unit/window/window.h"
14#include "unit/sound/sound.h"
16#include "battle.h"
17#include "keystate.h"
18#include "debug.h"
19#include "field.h"
20#include "game.h"
21#include "graphics.h"
22#include "menu.h"
23#include "minigame.h"
24#include "sound.h"
25#include "system.h"
26#include "edition.h"
27#include "types.h"
28#include "field_event.h"
29#include "animspr.h"
30#include "field_effect.h"
31#include "field_scene.h"
32#include "facing_object.h"
33#include "text/msg_ids.h"
34#include "io_reg.h"
35#include "save_state.h"
36#include "field_service.h"
37#include "window.h"
38#include "uiflow.h"
39#include "resource.h"
40#include "mem.h"
41#include "object_dispatch.h"
42#include "ability_ids.h"
43#include "objcmd.h"
44#include "frame.h"
45#include "fixed_math.h"
46#include "songs.h"
47
48// Scene temporary flags: 00 is set once the Great Healer has warned Isaac
49// that leaving the village cannot be undone; 01 marks the visit after a
50// refusal, which skips the account of Sol Sanctum.
51
52/// The first placed actor is the sanctum's healer: the Great Healer in Vale,
53/// the town's healer elsewhere. At the quest (entrances 20 and 21) Dora says
54/// "Mother would never doubt your courage", the Wise One appears, and a copy
55/// of the healer draws its afterimage.
56enum {
61};
62
63static void Sanctum_RequestQuestAcceptance(void);
64static void Sanctum_ReceiveWiseOnesMission(void);
65static void Sanctum_ShowHealerAfterimage(void);
66static void Sanctum_HideHealerAfterimage(void);
67static void Sanctum_UpdateHealerAfterimage(union FieldObject *fieldObject);
68static void Sanctum_SpawnOrbitingEffect(s32 ownerId, s32 angleStep);
70static void Sanctum_ReenactSolSanctum(void);
71static void Sanctum_RaiseItemIcon(s32 item, s32 fixedX, s32 fixedY, s32 fixedZ);
72static void Sanctum_SpawnActorSpark(s32 id);
73static void Sanctum_RestoreCeremonyFloor(void);
74
75// UB: calling this s32 function through a void update hook is incompatible.
76// Plain void changes 44 to 42 bytes in tbs-en.
77#ifdef UBFIX
78/// Faces the actor whose ID this callback stores in the timer field.
79static void Sanctum_FaceActorNamedByTimer(union FieldObject *fieldObject) {
80#else
81/// Faces the actor whose ID this callback stores in the timer field.
82static s32 Sanctum_FaceActorNamedByTimer(union FieldObject *fieldObject) {
83#endif
84 struct FieldActor *actor = (struct FieldActor *)fieldObject;
85 struct FieldActor *target;
86
87 target = Object_GetById((s16)actor->timer);
88 actor->facing = CalculateFacingAngle(target->z.fixed - actor->z.fixed,
89 target->x.fixed - actor->x.fixed);
90#ifdef UBFIX
91 return;
92#else
93 return 0;
94#endif
95}
96
97/// Returns the entrances shared by all Sanctum visits.
99 return gSanctum_Entrances;
100}
101
102const struct SceneRegion *Sanctum_GetRegions(void) { return NULL; }
103
104const u32 *Sanctum_GetExits(void) { return gSanctum_Exits; }
105
106/// Chooses the actors for the current entrance.
108 switch (gGameState.entrance) {
109 case 1:
110 case 2:
111 return gSanctum_PlacementB;
112
113 case 10:
114 case 11:
115 case 12:
116 case 35:
117 return gSanctum_PlacementC;
118
119 case 20:
120 case 21:
121 return gSanctum_PlacementD;
122
123 case 29:
124 case 32:
125 return gSanctum_PlacementE;
126
127 default:
128 return gSanctum_PlacementA;
129 }
130}
131
132/// Chooses interactions for the entrance and current story flags.
133const struct SceneEvent *Sanctum_GetEvents(void) {
134 switch (gGameState.entrance) {
135 case 10:
136 case 12:
138 case 11:
140 case 20:
141 case 21:
142 case 50:
144 case 32:
146 case 29:
148 case 35:
150 default:
151 break;
152 }
153
156 }
159 }
161}
162
163/// Talking to the attendant (actor 9) in Vale's Sanctum: about the golden
164/// statue and the healer.
167
169 Engine_EventSetMessage(MsgSanctumWhenStrayFromYourWorldly);
170 } else {
171 Engine_EventSetMessage(MsgSanctumHealerMustWorriedAboutNever);
172 }
173
174 if (gGameState.entrance == 11) {
175 Engine_EventSetMessage(MsgSanctumPolishedGoldStatueReturnedUs);
176 }
177
183}
184
185/// Reading the attendant's mind (actor 9): about the statue and Psynergy.
187
189
191 Engine_EventSetMessage(MsgSanctumWonderIfEverSeeOur);
192 } else {
193 Engine_EventSetMessage(MsgSanctumChildHasAwakenedOurTeachings);
194 }
195
196 if (gGameState.entrance == 11) {
197 Engine_EventSetMessage(MsgSanctumDirtyGoldenStatueCleanedUp);
198 }
199
206}
207
208/// Talking to the Great Healer after refusing: changing his mind, Isaac
209/// accepts after all. "Are you sure?"
210static void Event_ReconsiderQuest(void) {
212 Engine_EventSetMessage(MsgSanctumAreYouSure);
214 if (Engine_EventChooseYesNo(0, 0) == 0) {
217 } else {
220 if (Engine_EventChooseYesNo(0, 0) == 0) {
223 if (Engine_EventChooseYesNo(0, 0) == 0) {
225 if (Object_GetById(ACTOR_HEALER)->facing >= 0xa000 &&
226 Object_GetById(ACTOR_HEALER)->facing <= 0xe000) {
227 Actor_SetSpeed(ACTOR_HEALER, PIXELS(1) / 2, PIXELS(1) / 4);
244 } else {
250 }
254 Engine_EventWait(120);
259 }
260 }
261 }
263}
264
265#if TBS_PATCH_1
266#define SANCTUM_NEW_FRIENDS_SPEAKER 2
267#else
268#define SANCTUM_NEW_FRIENDS_SPEAKER 1
269#endif
270
271/// Talking to actor 9 after the party grows: the actor asks about the new
272/// friends. "Isaac, are your new friends Adepts?"
273static void Event_AskAboutNewAdepts(void) {
275#if TBS_PATCH_1
278#endif
279 Engine_EventSetMessage(MsgSanctumIsaacYourNewFriendsAdepts);
281 if (Engine_EventChooseYesNo(0, 0) == 0) {
283 } else {
286 7, 16, 1, 14, 0);
288 }
290}
291
292/// Talking to actor 10 after the party has left Vale: does Isaac feel a change
293/// in his Psynergy?
295
299 Engine_EventSetMessage(MsgSanctumDoFeelAnyChangeIn);
301
302 if (Engine_EventChooseYesNo(0, 0) == 1) {
303 (gEventWork->message)++;
304 }
305
308}
309
310/// Prepares the current visit and starts its opening scene.
316 switch (gGameState.entrance) {
317 case 10:
318 case 11:
319 case 12:
321 Actor_SetPosition(10, PIXELS(200), PIXELS(80));
322 }
324 break;
325 case 20:
329 }
330 // Fall through.
331 case 29:
332 case 32:
333 case 35:
335 break;
336 case 21:
341 }
343 break;
344 }
345 return 0;
346}
347
348/// Walking toward the door after refusing: the Great Healer warns that the
349/// choice is final. "Once you step outside the village, you cannot take back
350/// your decision."
351static void Event_WarnBeforeLeaving(void) {
361 Engine_EventSetMessage(MsgSanctumOnceStepOutsideVillageCannot);
365}
366
367/// Leaving after refusing: the room turns sepia and the game offers to start
368/// again. "And so the world began drifting..."
369static void Event_LeaveAfterRefusing(void) {
370 struct BattleEffectBuffers *paletteWork;
371
382 Engine_EventWait(180);
383 paletteWork = gPaletteBufferWork;
384 // Set colors 13-15 of target palette 2.
385 paletteWork->target[45] = 0x7c00;
386 paletteWork->target[46] = 0x7c00;
387 paletteWork->target[47] = 0x7c00;
388 paletteWork->page = 0;
389 paletteWork->duration = 1;
390 paletteWork->step = 1;
391 paletteWork->padding2a03 = 1;
393 UiText_ShowCenteredMessage(MsgSanctumWorldBeganDrifting, 1, 0);
396 Engine_EventWait(120);
398 if (Sanctum_ChooseRestartOption() == 0) {
401 } else {
404 }
405}
406
407// UB: calling this s32 function through a void update hook is incompatible.
408// Plain void changes 66 to 64 bytes in tbs-en.
409#ifdef UBFIX
410/// Keeps this actor at the party leader's drawing priority.
411static void Sanctum_MatchLeaderPriority(union FieldObject *fieldObject) {
412#else
413/// Keeps this actor at the party leader's drawing priority.
414static s32 Sanctum_MatchLeaderPriority(union FieldObject *fieldObject) {
415#endif
416 struct FieldActor *actor = (struct FieldActor *)fieldObject;
417 actor->sprite->image.priority =
418 Object_GetById(ACTOR_PARTY_LEADER)->sprite->image.priority;
419 actor->sprite->shadow.priority =
420 Object_GetById(ACTOR_PARTY_LEADER)->sprite->image.priority;
421#ifdef UBFIX
422 return;
423#else
424 return 0;
425#endif
426}
427
428/// Has the party and four witnesses nod, waiting for the final witness.
429static inline void Sanctum_NodCeremonyGroup(void) {
436}
437
438/// Starts the six group motions and waits for the final witness.
439static inline void Sanctum_StartCeremonyGroupMotion(void) {
446}
447
448/// Shows the same foreground reaction on the party and four witnesses.
449static inline void Sanctum_ShowCeremonyGroupEmotes(void) {
456}
457
458/// Discusses Sol Sanctum and asks Isaac to accept the quest.
460 u32 effectIndex;
461
463 // A repeat visit skips the account of Sol Sanctum.
471 Camera_MoveTo(PIXELS(192), -1, PIXELS(160), 1);
477 Engine_EventWait(120);
478 } else {
482 Camera_MoveTo(PIXELS(192), -1, PIXELS(160), 1);
487 // Reenact the journey before explaining the quest.
491 Engine_EventWait(100);
496 Actor_FaceActor(GARET, 12, 0);
501 Actor_SetSpeed(GARET, PIXELS(4) / 5, PIXELS(2) / 5);
502 Actor_SetSpeed(ACTOR_DORA, PIXELS(4) / 5, PIXELS(2) / 5);
503 Actor_SetSpeed(12, PIXELS(4) / 5, PIXELS(2) / 5);
504 Actor_SetSpeed(9, PIXELS(4) / 5, PIXELS(2) / 5);
505 Actor_SetSpeed(10, PIXELS(4) / 5, PIXELS(2) / 5);
506 Actor_SetSpeed(ACTOR_HEALER, PIXELS(4) / 5, PIXELS(2) / 5);
509 Engine_EventSetMessage(MsgSanctumWeHadIdeaTrueSanctum);
510 Event_ShowMessage(12, 0);
523 if (Engine_EventChooseYesNo(0, 0) == 0) {
529 } else {
535 }
540 Actor_FaceActor(GARET, 9, 0);
543 Event_OpenMessage(9, 0);
544 if (Engine_EventChooseYesNo(0, 0) == 0) {
548 Event_ShowMessage(9, 0);
550 } else {
555 Event_ShowMessage(9, 0);
556 }
569 Actor_WalkToAndWait(12, 0xe0, 0x78);
571 Event_ShowMessage(12, 0);
598 Event_ShowMessage(12, 0);
657 Event_ShowMessage(12, 0);
675 for (effectIndex = 0; effectIndex < 6; effectIndex++) {
678 }
687 // Return to the witnesses and finish the departure conversation.
694 Actor_SetAttachedEffect(12, 0x102);
698 Actor_SetAttachedEffect(9, 0x102);
699 Actor_SetAttachedEffect(10, 0x102);
703 Event_ShowMessage(10, 0);
718 Engine_ActorFaceEachOther(9, 0xa, 0);
754 for (effectIndex = 0; effectIndex < 6; effectIndex++) {
757 }
762 Engine_EventWait(128);
771 Engine_ActorFaceEachOther(9, 0xa, 0);
775 Event_ShowMessage(12, 0);
786 Engine_ActorFaceEachOther(9, 0xa, 0);
787 Actor_SetAttachedEffect(12, 0x102);
823 Event_ShowMessage(12, 0);
862 Actor_SetAttachedEffect(12, 0x102);
863 Actor_SetAttachedEffect(9, 0x102);
864 Actor_SetAttachedEffect(10, 0x102);
868 Event_ShowMessage(12, 0);
877 Engine_ActorFaceEachOther(9, 0xa, 0);
918 Event_ShowMessage(12, 0);
948 }
949 // Ask Isaac to commit, or leave the group waiting for his answer.
950 Engine_EventSetMessage(MsgSanctumIsaacWillAcceptResponsibilityFor);
954 if (Engine_EventChooseYesNo(0, 0) == 0) {
958 Engine_EventWait(120);
963 } else {
968 Event_ShowMessage(12, 0);
971#ifdef UBFIX
973#else
975 (void (*)(union FieldObject *))Sanctum_MatchLeaderPriority;
976#endif
977 }
979}
980
981/// Brings in the Wise One and prepares the party for its mission.
983
984 u32 sparkIndex;
985 struct FieldActor *wiseOne;
986
991 Actor_SetSpeed(GARET, PIXELS(4) / 5, PIXELS(2) / 5);
992 Actor_SetSpeed(ACTOR_DORA, PIXELS(4) / 5, PIXELS(2) / 5);
993 Actor_SetSpeed(12, PIXELS(4) / 5, PIXELS(2) / 5);
994 Actor_SetSpeed(9, PIXELS(4) / 5, PIXELS(2) / 5);
995 Actor_SetSpeed(10, PIXELS(4) / 5, PIXELS(2) / 5);
996 Actor_SetSpeed(ACTOR_HEALER, PIXELS(4) / 5, PIXELS(2) / 5);
997 Camera_MoveTo(PIXELS(192), -1, PIXELS(160), 1);
1004 Engine_EventWait(10);
1007 Engine_EventWait(60);
1012 Engine_EventWait(50);
1018 Engine_EventWait(30);
1020 Engine_EventWait(20);
1021 // Garet and the witnesses react to Isaac accepting the burden.
1022 Engine_EventSetMessage(MsgSanctumAcceptIsaacCantMean);
1024 Engine_EventWait(20);
1025 Actor_FaceActor(12, GARET, 0);
1028 Engine_EventWait(60);
1029 Event_ShowMessage(12, 0);
1030 Engine_EventWait(20);
1032 Engine_EventWait(20);
1033 Actor_FaceActor(GARET, 12, 0);
1034 Engine_EventWait(20);
1036 Engine_EventWait(40);
1039 Engine_EventWait(20);
1041 Engine_EventWait(20);
1043 Engine_EventWait(30);
1045 Engine_EventWait(30);
1047 Engine_EventWait(80);
1051 Engine_EventWait(40);
1052 Camera_SetSpeed(PIXELS(2) / 5, PIXELS(1) / 20);
1053 Camera_MoveTo(PIXELS(192), -1, PIXELS(104), 1);
1054 Engine_EventWait(120);
1057 // The Wise One enters while the healer's afterimages appear.
1059 Actor_SetSpeed(ACTOR_WISE_ONE, PIXELS(2) / 5, PIXELS(1) / 5);
1062 Engine_EventWait(30);
1078 Engine_EventWait(40);
1080 Engine_EventWait(20);
1081 Engine_EventWait(40);
1083 Engine_EventWait(60);
1087 // Shrink the Wise One amid sparks before restoring the room.
1088 for (sparkIndex = 0; sparkIndex < 32; sparkIndex++) {
1091 wiseOne = Object_GetById(ACTOR_WISE_ONE);
1092 wiseOne->scaleX += -Q16_ONE / 100;
1093 wiseOne = Object_GetById(ACTOR_WISE_ONE);
1094 wiseOne->scaleY += -Q16_ONE / 100;
1095 }
1099 Engine_EventWait(40);
1100 Camera_MoveTo(PIXELS(192), -1, PIXELS(160), 1);
1104 Engine_EventWait(120);
1108 Engine_EventWait(60);
1110 Engine_EventWait(20);
1112 Engine_EventWait(30);
1114 Engine_EventWait(30);
1116 Engine_EventWait(30);
1118 Engine_EventWait(20);
1124 Engine_EventWait(20);
1125 Event_ShowMessage(12, 0);
1126 Engine_EventWait(20);
1128 Engine_EventWait(20);
1130 Engine_EventWait(20);
1133 Engine_EventWait(20);
1135 Engine_EventWait(20);
1137 Engine_EventWait(30);
1139 Engine_EventWait(20);
1141 Engine_EventWait(30);
1143 Engine_EventWait(30);
1145 Engine_EventWait(20);
1147 Engine_EventWait(20);
1149 Engine_EventWait(180);
1150 Actor_ShowEmote(12, EMOTE_IN_FRONT | 5, 0);
1151 Engine_EventWait(60);
1153 Engine_ActorFaceEachOther(9, 10, 0);
1154 Engine_EventWait(40);
1159 Engine_EventWait(40);
1161 Engine_EventWait(20);
1163 Engine_EventWait(30);
1165 Engine_EventWait(60);
1167 Engine_EventWait(30);
1169 Engine_EventWait(20);
1171 Engine_EventWait(80);
1172 Actor_ShowEmote(12, EMOTE_IN_FRONT | 2, 0);
1173 Engine_EventWait(60);
1174 Event_ShowMessage(12, 0);
1175 Engine_EventWait(30);
1177 Engine_EventWait(60);
1180 Engine_EventWait(20);
1182 Engine_EventWait(40);
1184 Engine_EventWait(20);
1186 Engine_EventWait(30);
1188 Engine_EventWait(30);
1190 Engine_EventWait(120);
1192 Engine_EventWait(20);
1194 Engine_EventWait(30);
1196 Engine_EventWait(20);
1198 Engine_EventWait(20);
1204 Actor_ShowEmote(10, EMOTE_IN_FRONT | 5, 0);
1205 Engine_EventWait(60);
1207 Event_ShowMessage(12, 0);
1208 Engine_EventWait(20);
1210 Engine_EventWait(20);
1212 Engine_EventWait(20);
1214 Engine_EventWait(20);
1221 Engine_EventWait(60);
1223 Engine_EventWait(20);
1226 Engine_EventWait(40);
1241 Actor_WalkTo(ACTOR_HEALER, 200, 0x110);
1242 Engine_EventWait(40);
1248 Engine_EventWait(60);
1250 Engine_EventWait(60);
1251 Engine_EventWait(120);
1253 Actor_FaceActor(GARET, 10, 0);
1255 Actor_FaceActor(12, 9, 0);
1256 Engine_EventWait(120);
1258 Engine_EventWait(60);
1260 Engine_EventWait(10);
1262 Engine_EventWait(10);
1264 Engine_EventWait(20);
1266 Engine_EventWait(80);
1267 Actor_FaceActor(9, 10, 0);
1269 Engine_EventWait(20);
1270 Event_ShowMessage(9, 0);
1271 Engine_EventWait(20);
1273 Engine_EventWait(20);
1275 Engine_EventWait(60);
1277 Engine_EventWait(20);
1279 Engine_EventWait(30);
1281 Engine_EventWait(30);
1283 Engine_EventWait(20);
1284 Event_ShowMessage(10, 0);
1285 Engine_EventWait(20);
1288 Engine_EventWait(20);
1289 Actor_WalkTo(9, 200, 0x110);
1290 Actor_WalkToAndWait(10, 200, 0x110);
1291 Actor_SetPosition(9, 0, 0);
1292 Actor_SetPosition(10, 0, 0);
1294 Engine_EventWait(60);
1295 Actor_WalkToAndWait(12, 200, 136);
1297 Actor_FaceActor(GARET, 12, 0);
1299 Engine_EventWait(30);
1301 Engine_EventWait(20);
1302 Event_ShowMessage(12, 0);
1303 Engine_EventWait(30);
1306 Engine_EventWait(20);
1308 Engine_EventWait(20);
1311 Engine_EventWait(20);
1314 Engine_EventWait(20);
1316 Engine_EventWait(20);
1318 Engine_EventWait(20);
1321 Engine_EventWait(60);
1323 Engine_EventWait(20);
1325 Actor_FaceActor(GARET, 12, 0);
1326 Engine_EventWait(20);
1327 Event_ShowMessage(12, 0);
1328 Engine_EventWait(20);
1330 Engine_EventWait(20);
1332 Engine_EventWait(20);
1335 Engine_EventWait(60);
1337 Engine_EventWait(60);
1338 Event_ShowMessage(12, 0);
1339 Engine_EventWait(20);
1344 Engine_EventWait(60);
1346 Engine_EventWait(20);
1348 Engine_EventWait(20);
1350 Engine_EventWait(30);
1352 Engine_EventWait(30);
1354}
1355
1356/// Copies the healer into the afterimage actor.
1358 u32 entryIndex;
1359 struct FieldActor *afterimage;
1360 struct FieldActor *actor;
1361 struct AnimationObject *sprite;
1362
1364 if (actor != 0) {
1366 actor->z.fixed);
1367 }
1371 afterimage->facing = actor->facing;
1375 sprite = actor->sprite;
1376 {
1377 for (entryIndex = 0; entryIndex < sprite->count; entryIndex++) {
1378 struct AnimationEntry *entry = sprite->entries[entryIndex];
1379
1380 if (entry != 0 && entry->script != 0) {
1381 entry->param = 10;
1382 }
1383 }
1384 }
1385 sprite->dirty = 1;
1388 sprite->image.priority = 2;
1389}
1390
1393 state->update = 0;
1395}
1396
1397/// Cycles the afterimage through four offsets from the healer.
1398static void Sanctum_UpdateHealerAfterimage(union FieldObject *fieldObject) {
1399 struct FieldActor *actor = (struct FieldActor *)fieldObject;
1400 struct FieldActor *healer;
1401
1402 healer = Object_GetById(ACTOR_HEALER);
1403 actor->targetX = actor->x.fixed = healer->x.fixed;
1404 actor->targetY = actor->y.fixed = healer->y.fixed;
1405 actor->targetZ = actor->z.fixed = healer->z.fixed - PIXELS(2);
1406 switch (gFrameCount & 3) {
1407 case 0:
1408 actor->targetX = actor->x.fixed = healer->x.fixed - PIXELS(7) / 2;
1409 break;
1410 case 1:
1411 actor->targetX = actor->x.fixed = healer->x.fixed + PIXELS(3);
1412 break;
1413 case 2:
1414 actor->targetY = actor->y.fixed = healer->y.fixed + PIXELS(2);
1415 break;
1416 case 3:
1417 actor->targetZ = actor->z.fixed = healer->z.fixed;
1418 break;
1419 }
1420}
1421
1422/// Advances an effect around its linked actor on an elliptical path.
1423static void Sanctum_UpdateOrbitingEffect(union FieldObject *fieldObject) {
1424 struct FieldActor *effect = (struct FieldActor *)fieldObject;
1425 struct FieldActor *anchor = effect->linkedObject;
1426 u16 *angle = &effect->timer;
1427 u16 orbitAngle = *angle;
1428 s32 x;
1429 s32 z;
1430 s32 currentX;
1431
1432 x = anchor->x.fixed + Engine_MathCos(orbitAngle) * 14;
1433 effect->x.fixed = x;
1434
1435 z = anchor->z.fixed + Engine_MathSin(orbitAngle) * 10;
1436 currentX = effect->x.fixed;
1437 effect->z.fixed = z;
1438 effect->targetZ = z;
1439 effect->targetX = currentX;
1440
1441 *angle = (*angle + effect->work);
1442}
1443
1444/// Creates an orbiting effect with the requested angular step.
1445static void Sanctum_SpawnOrbitingEffect(s32 ownerId, s32 angleStep) {
1446 s32 orbitStep;
1447 struct FieldActor *owner;
1448 struct FieldActor *effect;
1449 struct AnimationObject *sprite;
1450 struct AnimationObject *sourceSprite;
1451
1452 orbitStep = angleStep;
1453 owner = Object_GetById(ownerId);
1454 if (owner != 0) {
1455 effect = Object_Create(0x11d, owner->x.fixed, owner->y.fixed + PIXELS(45),
1456 owner->z.fixed);
1457 if (effect != 0) {
1458 sprite = effect->sprite;
1460 {
1461 s32 zero = 0;
1462
1463 effect->motionFlags = zero;
1464 effect->timer = zero;
1465 }
1466 effect->work = orbitStep;
1468 {
1469 u16 clearFlags = 0;
1470 sprite->flags = clearFlags;
1471 }
1472 sourceSprite = owner->sprite;
1473 effect->linkedObject = owner;
1474 sprite->image.priority = sourceSprite->image.priority;
1475 }
1476 }
1477}
1478
1479#if LANGUAGE != LANGUAGE_JAPANESE
1480#define QUESTION_X 2
1481#define QUESTION_WIDTH 25
1482#define CURSOR_X 24
1483#else
1484#define QUESTION_X 7
1485#define QUESTION_WIDTH 17
1486#define CURSOR_X 64
1487#endif
1488
1489/// Offers the refusal ending's restart choices and returns the selection.
1491 s32 slot;
1492 struct MenuSprite cursor;
1493 struct UiWindow *window;
1494 s32 text;
1495 s32 choice;
1496
1498 Engine_ActorSetPosition(9, 0, 0);
1499 Engine_ActorSetPosition(10, 0, 0);
1502 Engine_ActorSetPosition(12, 0, 0);
1507 window = UiWindow_Create(QUESTION_X, 7, QUESTION_WIDTH, 5, 1);
1508 text = MsgSanctumGreatHealer;
1509 UiText_DrawResource(text, window, 16, 0);
1511 UiText_DrawResource(text + 2, window, 16, 16);
1512 } else {
1513 UiText_DrawResource(text + 1, window, 16, 16);
1514 }
1515 FieldUiTextResource_Initialize(&cursor, &slot);
1516 FieldUiTextResource_SetPosition(&cursor, 72, 60);
1517 choice = 0;
1518 while ((gKeysPressed & KEY_A) == 0) {
1519 s32 x;
1520
1521 if (gKeysRepeat & KEYS_VERTICAL) {
1522 choice ^= 1;
1523 }
1524 x = gSanctum_CursorBob[(gFrameTick >> 1) & 15] + CURSOR_X;
1525 FieldUiTextResource_SetPosition(&cursor, x, (choice << 4) + 60);
1527 }
1529 UiWork_Finalize(window, 1);
1530 return choice;
1531}
1532
1533/// Has Isaac and Garet act out the events at Sol Sanctum.
1534static void Sanctum_ReenactSolSanctum(void) {
1535
1537 Actor_SetSpeed(GARET, PIXELS(3) / 2, PIXELS(3) / 4);
1539 Engine_EventWait(10);
1541 Engine_EventWait(10);
1543 Engine_EventWait(15);
1556 Engine_ActorJump(GARET, 2, 0);
1557 Engine_EventWait(15);
1560 Engine_ActorJump(GARET, 2, 0);
1561 Engine_EventWait(25);
1566 Engine_EventWait(10);
1570 Engine_EventWait(10);
1572 Engine_EventWait(10);
1574 Engine_EventWait(15);
1580 Engine_EventWait(20);
1583 Engine_EventWait(10);
1586 Engine_EventWait(20);
1589 Engine_EventWait(10);
1592 Engine_EventWait(20);
1594 Engine_EventWait(15);
1596 Engine_EventWait(10);
1597 // Illustrate the account with the floating item icon.
1598 Sanctum_RaiseItemIcon(222, PIXELS(184), PIXELS(27), PIXELS(168));
1600 Engine_EventWait(10);
1602 Engine_EventWait(10);
1603 Engine_ActorJump(GARET, 4, 0);
1605 Engine_EventWait(15);
1607 Engine_EventWait(10);
1609 Engine_EventWait(10);
1611 Engine_EventWait(10);
1613 Engine_EventWait(30);
1614 Engine_ActorJump(GARET, 4, 0);
1616 Engine_EventWait(15);
1618 Engine_EventWait(10);
1620 Engine_EventWait(10);
1622 Engine_EventWait(10);
1624 Engine_EventWait(30);
1627 Engine_EventWait(10);
1630 Engine_EventWait(60);
1632 Engine_EventWait(10);
1634 Engine_EventWait(10);
1636#ifdef UBFIX
1638#else
1640 (void (*)(union FieldObject *))Sanctum_FaceActorNamedByTimer;
1641#endif
1642 Object_GetById(12)->timer = 1;
1643#ifdef UBFIX
1645#else
1646 Object_GetById(12)->update =
1647 (void (*)(union FieldObject *))Sanctum_FaceActorNamedByTimer;
1648#endif
1654 Engine_ActorWalkTo(GARET, 200, 104);
1658 Engine_EventWait(30);
1660 Engine_EventWait(10);
1662 Engine_EventWait(15);
1663 Object_GetById(12)->update = NULL;
1667 Engine_EventWait(60);
1670 Engine_EventWait(60);
1672 Engine_EventWait(10);
1674 Engine_EventWait(10);
1676 Engine_EventWait(10);
1678 Engine_EventWait(10);
1680 Engine_EventWait(10);
1682 Engine_EventWait(20);
1684 Engine_EventWait(20);
1685 Engine_EventWait(15);
1687 Engine_EventWait(10);
1689 Engine_EventWait(10);
1691 Engine_EventWait(60);
1695 Engine_EventWait(10);
1698 Engine_EventWait(10);
1701 Engine_EventWait(10);
1703 Engine_EventWait(10);
1705 Engine_EventWait(10);
1707 Engine_EventWait(10);
1709 Engine_EventWait(10);
1712 Engine_EventWait(10);
1715 Engine_EventWait(10);
1716 // Repeat the synchronized eight-point paths around the room.
1722 Actor_SetSpeed(GARET, PIXELS(3) / 2, PIXELS(3) / 4);
1724 Engine_ActorJump(GARET, 6, 0);
1737 Engine_EventWait(10);
1740 Engine_EventWait(10);
1743 Engine_EventWait(10);
1746 Engine_EventWait(10);
1749 Engine_EventWait(20);
1752 Engine_EventWait(20);
1755 Engine_EventWait(10);
1758 Engine_EventWait(30);
1760 Engine_EventWait(20);
1763 Engine_EventWait(10);
1765 Engine_EventWait(10);
1768 Engine_EventWait(60);
1769}
1770
1771/// Shows an item icon rising from the supplied fixed-point position.
1772static void Sanctum_RaiseItemIcon(s32 item, s32 fixedX, s32 fixedY,
1773 s32 fixedZ) {
1774 struct FieldActor *icon;
1775 struct AnimationObject *sprite;
1776 u8 *transferBuffer;
1777 u32 frame;
1778 u8 zero;
1779
1780 icon = Engine_ObjectCreate(22, fixedX, fixedY, fixedZ);
1781 zero = 0;
1782 if (icon != 0) {
1784 sprite = icon->sprite;
1785 sprite->flags = zero;
1786 sprite->count = zero;
1787 sprite->image.fullColor = 0;
1788 sprite->image.palette = 0;
1789 icon->velocityY = PIXELS(2);
1790 icon->gravity = PIXELS(1) / 4;
1791 transferBuffer = Runtime_AllocateHeapBlock(17, 0x608);
1793 Engine_VramLoad(sprite->slot, 128, transferBuffer + 0x400);
1795 for (frame = 0; frame < 60; frame++) {
1796 if ((u32)(icon->velocityY + 255) <= 0x1fe)
1797 icon->motionFlags = 0;
1798 Engine_TaskWait(1);
1799 }
1801 }
1802}
1803
1804/// Moves a spark upward, cycles its scale, and expires its lifetime.
1805static void Sanctum_UpdateRisingSpark(union FieldObject *object) {
1806 struct FieldActor *spark = &object->actor;
1807 s32 scale;
1808 s32 timer;
1809
1810 // The timer stores the upward step in sixteenths of a pixel.
1811 spark->y.fixed += spark->timer << 12;
1812 spark->targetY = spark->y.fixed;
1813 scale = 0;
1814 switch (((s16)spark->work >> 2) & 3) {
1815 case 0:
1816 scale = Q16_ONE;
1817 break;
1818 case 1:
1819 case 3:
1820 scale = 4 * Q16_ONE / 5;
1821 break;
1822 case 2:
1823 scale = 3 * Q16_ONE / 5;
1824 break;
1825 }
1826 spark->scaleX = scale;
1827 spark->scaleY = scale;
1828 timer = spark->work - 1;
1829 spark->work = timer;
1830 if ((s16)timer <= 0)
1832}
1833
1834/// Creates a short-lived spark beside the specified actor.
1836 struct FieldActor *actor;
1837 struct FieldActor *spark;
1838 struct AnimationObject *sprite;
1839 s32 x;
1840 s32 randomOffset;
1841
1842 actor = Object_GetById(id);
1843 if (actor == 0)
1844 return;
1845 randomOffset = Math_RemainderUnsigned(Engine_RandomNext(), 20);
1846 x = actor->x.fixed;
1847 x += randomOffset << 16;
1848 x += -PIXELS(10);
1849 spark = Engine_ObjectCreate(
1850 0x11e, x,
1851 actor->y.fixed + ((Engine_RandomNext() & 15) << 16) + -PIXELS(8),
1852 actor->z.fixed);
1853 if (spark == 0)
1854 return;
1855 sprite = spark->sprite;
1856 spark->motionFlags = 0;
1858 spark->work = Math_RemainderUnsigned(Engine_RandomNext(), 60) + 30;
1860 sprite->flags = 0;
1861 sprite->image.priority = actor->sprite->image.priority;
1862}
1863
1864/// Restores the two floor rectangles changed during the ceremony.
1866 {
1867 Map_CopyCellsTo(0, 64, 11, 68, 3, 2);
1868 }
1869 {
1870 Map_CopyCellAttributes(11, 10, 3, 2, 11, 8);
1871 }
1872 Engine_TaskWait(1);
1873}
1874
1877
1878 if ((u32)((actor->facing + 0x5fff) << 16) <= 0x3ffe0000) {
1879 return 1;
1880 }
1881 return 0;
1882}
1883
1884/// Talking to the healer: healing from the front, otherwise words that follow
1885/// the story.
1886static void Event_TalkToHealer(void) {
1887 if (Sanctum_IsLeaderFacingHealer() != 0) {
1889 return;
1890 }
1891
1894 Engine_EventSetMessage(MsgSanctumPathSolSanctumStillClosed);
1896 Engine_EventSetMessage(MsgSanctumMyControlOverPsynergyHas);
1897 else
1898 Engine_EventSetMessage(MsgSanctumWieldersPsynergyCalledAdeptsAdepts);
1901}
1902
1903/// Talking to the healer on a later visit: healing from the front, otherwise
1904/// words for this visit.
1905static void Event_TalkToHealerOnVisit(void) {
1906 s32 entrance;
1907
1908 if (Sanctum_IsLeaderFacingHealer() != 0) {
1910 return;
1911 }
1912
1914
1915 entrance = gGameState.entrance;
1916
1917 switch (entrance) {
1918 case 10:
1919 case 12:
1921 Engine_EventSetMessage(MsgSanctumWasHandFateReturnedGold);
1922 } else {
1923 Engine_EventSetMessage(MsgSanctumWeWillHelpAnytimeAs);
1924 }
1925 break;
1926 case 11:
1927 Engine_EventSetMessage(MsgSanctumMayWrongButLatelyThere);
1928 break;
1929 case 20:
1930 case 21:
1931 case 50:
1934 return;
1935 default:
1936 break;
1937 }
1938
1941}
1942
1943/// Talking to this sanctum's healer: about the curse, lifted or not.
1944static void Event_TalkAboutCurse(void) {
1945 if (Sanctum_IsLeaderFacingHealer() != 0) {
1947 return;
1948 }
1949
1952 Engine_EventSetMessage(MsgSanctumCurseMayOverButWe);
1953 else
1954 Engine_EventSetMessage(MsgSanctumAmStartingFeelOnlyBeginning);
1957}
1958
1959/// Talking to this sanctum's healer: about the monsters, and the party's help
1960/// in Altin.
1962 if (Sanctum_IsLeaderFacingHealer() != 0) {
1964 return;
1965 }
1966
1968 Engine_EventSetMessage(MsgSanctumWasAfterEerieNightWhen);
1970 Engine_EventSetMessage(MsgSanctumSavedAltinFromMonstersClearly);
1973}
1974
1975/// Talking to this sanctum's healer, come from Xian.
1977 if (Sanctum_IsLeaderFacingHealer() != 0) {
1979 return;
1980 }
1981
1983 Engine_EventSetMessage(MsgSanctumCameXianFromVeryDistant);
1986}
1987
1988// clang-format off
1990 SC_ARG(2),
1991 SC_SET(SW_SPEED, PIXELS(5) / 2),
1992 SC_SET(SW_ACCEL, PIXELS(1) / 2),
1993 SC_LABEL(1),
1994 SC_MOVE(PIXELS(204), 0, PIXELS(188)),
1995 SC_SYNC,
1996 SC_MOVE(PIXELS(216), 0, PIXELS(192)),
1997 SC_SYNC,
1998 SC_MOVE(PIXELS(236), 0, PIXELS(188)),
1999 SC_SYNC,
2000 SC_MOVE(PIXELS(240), 0, PIXELS(168)),
2001 SC_SYNC,
2002 SC_MOVE(PIXELS(236), 0, PIXELS(156)),
2003 SC_SYNC,
2004 SC_MOVE(PIXELS(216), 0, PIXELS(144)),
2005 SC_SYNC,
2006 SC_MOVE(PIXELS(204), 0, PIXELS(156)),
2007 SC_SYNC,
2008 SC_MOVE(PIXELS(192), 0, PIXELS(168)),
2009 SC_SYNC,
2010 SC_LOOP(4, SC_LABEL(1)),
2011 SC_ARG(1),
2012 SC_END,
2013};
2014
2016 SC_ARG(2),
2017 SC_SET(SW_SPEED, PIXELS(5) / 2),
2018 SC_SET(SW_ACCEL, PIXELS(1) / 2),
2019 SC_LABEL(1),
2020 SC_MOVE(PIXELS(204), 0, PIXELS(156)),
2021 SC_SYNC,
2022 SC_MOVE(PIXELS(184), 0, PIXELS(144)),
2023 SC_SYNC,
2024 SC_MOVE(PIXELS(172), 0, PIXELS(156)),
2025 SC_SYNC,
2026 SC_MOVE(PIXELS(160), 0, PIXELS(168)),
2027 SC_SYNC,
2028 SC_MOVE(PIXELS(172), 0, PIXELS(188)),
2029 SC_SYNC,
2030 SC_MOVE(PIXELS(184), 0, PIXELS(192)),
2031 SC_SYNC,
2032 SC_MOVE(PIXELS(204), 0, PIXELS(188)),
2033 SC_SYNC,
2034 SC_MOVE(PIXELS(208), 0, PIXELS(168)),
2035 SC_SYNC,
2036 SC_LOOP(4, SC_LABEL(1)),
2037 SC_ARG(1),
2038 SC_END,
2039};
2040
2044 SC_WAIT(2),
2045 SC_SET(SW_SCALE_X, 3 * Q16_ONE / 4),
2046 SC_SET(SW_SCALE_Y, 3 * Q16_ONE / 4),
2047 SC_WAIT(2),
2048 SC_SET(SW_SCALE_X, 7 * Q16_ONE / 8),
2049 SC_SET(SW_SCALE_Y, 7 * Q16_ONE / 8),
2050 SC_WAIT(2),
2051 SC_SET(SW_SCALE_X, 15 * Q16_ONE / 16),
2052 SC_SET(SW_SCALE_Y, 15 * Q16_ONE / 16),
2053 SC_WAIT(2),
2056 SC_WAIT(16),
2057 SC_SET(SW_SCALE_X, 11 * Q16_ONE / 8),
2058 SC_SET(SW_SCALE_Y, 11 * Q16_ONE / 8),
2059 SC_WAIT(2),
2060 SC_SET(SW_SCALE_X, 3 * Q16_ONE / 2),
2061 SC_SET(SW_SCALE_Y, 3 * Q16_ONE / 2),
2062 SC_WAIT(2),
2063 SC_SET(SW_SCALE_X, 9 * Q16_ONE / 8),
2064 SC_SET(SW_SCALE_Y, 9 * Q16_ONE / 8),
2065 SC_WAIT(2),
2068 SC_WAIT(2),
2069 SC_SET(SW_SCALE_X, 11 * Q16_ONE / 8),
2070 SC_SET(SW_SCALE_Y, 11 * Q16_ONE / 8),
2071 SC_WAIT(2),
2072 SC_SET(SW_SCALE_X, 3 * Q16_ONE / 2),
2073 SC_SET(SW_SCALE_Y, 3 * Q16_ONE / 2),
2074 SC_WAIT(2),
2075 SC_SET(SW_SCALE_X, 9 * Q16_ONE / 8),
2076 SC_SET(SW_SCALE_Y, 9 * Q16_ONE / 8),
2077 SC_WAIT(2),
2080 SC_WAIT(2),
2081 SC_END,
2082};
2083
2085 SC_WAIT(60),
2086 SC_FREE,
2087};
2088
2090 { 0, CONDITION_ALWAYS, 120, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
2091 { 1, CONDITION_ALWAYS, 199, 0, 246, FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2092 { 2, CONDITION_ALWAYS, 199, 0, 164, FACING_SOUTH, 0, 64, 8, 336, 272, 0 },
2093 { 10, CONDITION_ALWAYS, 199, 0, 246, FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2094 { 11, CONDITION_ALWAYS, 199, 0, 246, FACING_NORTH, 0, 64, 8, 336, 272, 0 },
2095 { 12, CONDITION_ALWAYS, 199, 0, 164, FACING_SOUTH, 0, 64, 8, 336, 272, 0 },
2096 { 20, CONDITION_ALWAYS, 192, 0, 168, FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2097 { 21, CONDITION_ALWAYS, 192, 0, 168, FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2098 { 29, CONDITION_ALWAYS, 200, 0, 240, FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2099 { 32, CONDITION_ALWAYS, 200, 0, 240, FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2100 { 35, CONDITION_ALWAYS, 200, 0, 240, FACING_NORTH, 0, 128, 0, 320, 272, 0 },
2101 { SCENE_TABLE_END },
2102};
2103
2105 SCENE_EXITS(9),
2106 SCENE_EXIT(1, 4, 1),
2107 SCENE_EXIT(10, 20, 11),
2108 SCENE_EXIT(11, 23, 11),
2109 SCENE_EXIT(20, 9, 21),
2110 SCENE_EXIT(30, 5, 12),
2111 SCENE_EXIT(40, 75, 3),
2112 SCENE_EXIT(41, 30, 9),
2113 SCENE_EXIT(42, 72, 11),
2114 SCENE_EXIT(50, 1, 1),
2116};
2117
2119 { SCENE_TABLE_END },
2120};
2121
2124 0, 0, 0, FACING_SOUTH, TALK_FACE_PARTY, 0 },
2126 0, 0, 0, FACING_SOUTH, TALK_FACE_PARTY, 0 },
2128 PIXELS(200), 0, PIXELS(130), FACING_SOUTH, TALK_FACE_PARTY, 0 },
2132 PIXELS(248), 0, PIXELS(152), FACING_SOUTH + FACING_STEP, TALK_FACE_PARTY, 0 },
2133 { SCENE_TABLE_END },
2134};
2135
2136#if TBS_PATCH_1
2139 0, 0, 0, FACING_SOUTH, TALK_FACE_PARTY, 0 },
2140 { SCENE_TABLE_END },
2141};
2142#endif
2143
2148 PIXELS(200), 0, PIXELS(200), FACING_SOUTH + FACING_STEP, TALK_FACE_PARTY, 0 },
2149 { 0xdd, CONDITION_ALWAYS, 7,
2150 PIXELS(8), 0, PIXELS(8), FACING_SOUTH, TALK_FACE_PARTY, 0 },
2151 { SCENE_TABLE_END },
2152};
2153
2156 PIXELS(208), 0, PIXELS(168), FACING_NORTH + FACING_STEP, 3, 0 },
2164 PIXELS(168), 0, PIXELS(208), FACING_NORTH + FACING_STEP, 3, 0 },
2166 PIXELS(232), 0, PIXELS(120), FACING_SOUTH + FACING_STEP, 3, 0 },
2168 PIXELS(8), 0, PIXELS(8), FACING_SOUTH, TALK_FACE_PARTY, 0 },
2171 { SCENE_TABLE_END },
2172};
2173
2177 { SCENE_TABLE_END },
2178};
2179
2182 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgSanctumOurPsynergyWasGivenToUs) },
2183 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgSanctumPsynergyIsAPowerThatShould) },
2184 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
2185 { SCENE_EVENTS_END },
2186};
2187
2192 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumGoOnIfThatEasesThe) },
2194 { EVENT_EXIT, 1, CONDITION_ALWAYS, 10 },
2195 { SCENE_EVENTS_END },
2196};
2197
2199 { EVENT_EXIT, 1, CONDITION_ALWAYS, 11 },
2202 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumIHopeTheEarthquakesArentA) },
2204 { SCENE_EVENTS_END },
2205};
2206
2209 { EVENT_TALK, GARET, CONDITION_ALWAYS, MSGNO(MsgSanctumItIsATerribleBurdenTo) },
2210 { EVENT_TALK, ACTOR_DORA, CONDITION_ALWAYS, MSGNO(MsgSanctumMotherWouldNeverDoubtYourCourage) },
2211 { EVENT_TALK, 12, CONDITION_ALWAYS, MSGNO(MsgSanctumIDontBlameYouICouldnt) },
2212 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgSanctumWasItRightToRefuseWhen) },
2213 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgSanctumItsClearThatTheGreatHealer) },
2216 { SCENE_EVENTS_END },
2217};
2218
2220 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
2222 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgSanctumThePowerOfMtAlephStems) },
2224 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumThePowerOfMyPsynergyHas) },
2225 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgSanctumTheAngaranContinentWillCertainlySee) },
2226 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, CONDITION_ALWAYS, MSGNO(MsgSanctumMyPsynergyHasntChangedAtAll) },
2227 { SCENE_EVENTS_END },
2228};
2229
2231 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
2234 { EVENT_TALK, 10, CONDITION_ALWAYS, MSGNO(MsgSanctumWhyIsItThatDifferentAdepts) },
2235 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumItllBeDifficultToReachSol) },
2236 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgSanctumISeeABeautifulGirlHas) },
2237 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 10, CONDITION_ALWAYS, MSGNO(MsgSanctumItsNotFairIWantTo) },
2238 { SCENE_EVENTS_END },
2239};
2240
2242 { EVENT_EXIT, 1, CONDITION_ALWAYS, 40 },
2245 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, FLAG_HYDROS_STATUES_DEFEATED, MSGNO(MsgSanctumPleaseSaveTheHelplessInAltin) },
2246 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumAlmightyFateMustHaveHeardMe) },
2247 { SCENE_EVENTS_END },
2248};
2249
2252 { EVENT_TALK, 9, FLAG_KOLIMA_CURSE_LIFTED, MSGNO(MsgSanctumPleaseGiveMeStrengthAtTimes) },
2253 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, FLAG_KOLIMA_CURSE_LIFTED, MSGNO(MsgSanctumWillITurnIntoATree) },
2254 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, FLAG_KOLIMA_CURSE_LIFTED, MSGNO(MsgSanctumSomeoneWillSaveUsJustKeep) },
2255 { EVENT_TALK, 9, CONDITION_ALWAYS, MSGNO(MsgSanctumHowAboutThatOurWishesHave) },
2256 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumTheSignsOfDangerAreActually) },
2257 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), 9, CONDITION_ALWAYS, MSGNO(MsgSanctumPeaceWillBeKeptAsLong) },
2258 { EVENT_EXIT, 1, CONDITION_ALWAYS, 41 },
2259 { SCENE_EVENTS_END },
2260};
2261
2263 { EVENT_EXIT, 1, CONDITION_ALWAYS, 42 },
2265 { PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_HEALER, CONDITION_ALWAYS, MSGNO(MsgSanctumWhenYouStayInXianFor) },
2266 { SCENE_EVENTS_END },
2267};
2268// clang-format on
2269
2271 SC_WAIT(0),
2272 SC_WAIT(1),
2273 SC_SYNC,
2274 SC_SYNC,
2275 SC_POS(0x2, 0x3, 0x4),
2276 SC_MOVE(0x2, 0x2, 0x1),
2277 SC_SYNC,
2278 SC_SYNC,
2279};
2280
2282 SC_ADD(SW_Y, -0x8000),
2283 SC_ADD(SW_TARGET_Y, -0x8000),
2284 SC_WAIT(1),
2285 SC_LOOP(96, SC_TOP),
2286 SC_FREE,
2287};
2288
2290 SC_FREE,
2291};
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void ObjectMotion_WaitForAnimationChange(u32 objectId)
Waits, at most 90 frames, for an actor's animation to change.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
The battle animation state, render objects and effect entries, and the palette buffer work.
struct BattleEffectBuffers * gPaletteBufferWork
#define GARET
Jerald.
#define MIA
Mary.
#define IVAN
Ivan.
struct FieldActor * Engine_ObjectCreate(s32, s32, s32, s32)
The engine calls the debug menus import, and their palette swatch tiles.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
static void FieldUiTextResource_Initialize(struct MenuSprite *cursor, s32 *slot)
Definition engine_call.h:41
static void FieldUiTextResource_SetPosition(struct MenuSprite *cursor, s32 x, s32 y)
Definition engine_call.h:46
FacingObject, the view of an object that turns to face a target.
s32 CalculateFacingAngle(s32, s32)
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
u32 Math_RemainderUnsigned(u32 dividend, u32 divisor)
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)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_SanctumOpen(s32 priest)
static void Actor_SetBuiltinAction(s32 actor, s32 action)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
#define GameFlag_IsSet
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveToActor(s32 actor, s32 pan)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
#define EMOTE_IN_FRONT
Definition field_event.h:49
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
s32 Engine_VramLoad(s32 block, s32 size, const void *data)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
#define GameFlag_Set
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
static void Event_ShowTwoMessagesAndWait(s32 speaker, s32 x, s32 y, s32 arg, s32 extra, s32 otherSpeaker, s32 otherX, s32 otherY, s32 otherArg, s32 otherExtra, s32 flags)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_ActorWaitForMove(s32 actor)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
static void Event_ShowMessage(s32 speaker, s32 flags)
s32 Engine_RandomNext()
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
s32 Engine_MathCos(s32 angle)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ColorBufferInterpolate(s32 frames)
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_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
void Engine_ColorBufferApplyTarget(s32 value, s32 mode)
@ TRANSITION_WINDOW
Definition field_obj.h:17
@ TRANSITION_BACKDROP_FADE
Definition field_obj.h:16
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
Definition field_obj.h:153
#define SCENE_TRANSITION(style, variant)
Definition field_obj.h:20
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
Definition field_obj.h:166
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
@ EVENT_TOUCH
@ EVENT_EXIT
@ EVENT_TALK
@ FACING_STEP
Definition field_scene.h:36
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#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
@ FLAG_PARTY_LEFT_VALE
Definition field_scene.h:50
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
@ ACTOR_WANDER
@ ACTOR_STAND
#define SCENE_EXITS_END
Definition field_scene.h:77
@ 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)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
16.16 fixed-point constants, sine and cosine, and the library division.
#define Q16_ONE
One in the engine's signed 16.16 fixed-point format.
Definition fixed_math.h:10
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
Definition flags.h:94
#define FLAG_VAULT_THIEVES_JAILED
Definition flags.h:106
#define FLAG_REACHED_KALAY
Set whenever Kalay is entered; Vale's villagers then talk of the party's journey.
Definition flags.h:441
#define FLAG_SCENE_TEMP_00
Definition flags.h:713
#define FLAG_KEEP_PARTY_POSITION
Definition flags.h:93
#define FLAG_KOLIMA_CURSE_LIFTED
Definition flags.h:103
#define FLAG_HYDROS_STATUES_DEFEATED
Definition flags.h:118
#define FLAG_SCENE_TEMP_01
Definition flags.h:714
#define FLAG_SANCTUM_QUEST_ACCEPTED
Isaac accepted the Great Healer's request to go to Sol Sanctum.
Definition flags.h:692
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
u32 gFrameTick
Counted up by every VBlank.
volatile u32 gFrameCount
Frames WaitFrames has finished.
static void Event_TalkToHealer(void)
Talking to the healer: across the counter from the south, the Sanctum's services; from elsewhere,...
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.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
Definition heap.c:47
The hardware's I/O registers and their bits, as pret names them.
@ KEYS_VERTICAL
Definition io_reg.h:254
@ KEY_A
Definition io_reg.h:243
The keypad state the VBlank interrupt keeps.
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
The heaps: allocating and freeing blocks.
void Runtime_ReleaseHeapBlock(s32 slot)
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_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
#define SC_TOP
Script start.
Definition objcmd.h:13
#define SC_END
Return to the main script.
Definition objcmd.h:32
@ SW_TARGET_Y
Definition objcmd.h:70
@ SW_ACCEL
Definition objcmd.h:68
@ SW_SCALE_Y
Definition objcmd.h:63
@ SW_SPEED
Definition objcmd.h:67
@ SW_Y
Definition objcmd.h:59
@ SW_SCALE_X
Definition objcmd.h:62
void Event_CallWithLastActiveObjectId(struct ScenePlacement *table)
Spawns the actors of a placement table after the last actor in use.
Definition events.c:148
The object dispatcher's scripts: key checks, the player, the world map and the camera.
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
Definition palbuf.h:72
@ PALETTE_TRANSFORM_PALE
Definition palbuf.h:77
@ PALETTE_TRANSFORM_SEPIA
Definition palbuf.h:74
#define ACTOR_ACTION_IDLE
The save workspace: slot headers and summaries.
static void Sanctum_StartCeremonyGroupMotion(void)
Starts the six group motions and waits for the final witness.
Definition sanctum.c:439
static void Event_AskAboutPsynergyChanges(void)
Talking to actor 10 after the party has left Vale: does Isaac feel a change in his Psynergy?
Definition sanctum.c:294
static void Event_TalkAboutGoldenStatue(void)
Talking to the attendant (actor 9) in Vale's Sanctum: about the golden statue and the healer.
Definition sanctum.c:165
static void Event_AskAboutNewAdepts(void)
Talking to actor 9 after the party grows: the actor asks about the new friends.
Definition sanctum.c:273
s32 gSanctum_CursorBob[]
Definition sanctum.c:2270
struct ScenePlacement gSanctum_PlacementD[]
Definition sanctum.c:2154
struct ScenePlacement gSanctum_PlacementA[]
Definition sanctum.c:2118
static void Sanctum_RaiseItemIcon(s32 item, s32 fixedX, s32 fixedY, s32 fixedZ)
Shows an item icon rising from the supplied fixed-point position.
Definition sanctum.c:1772
s32 gSanctum_SparkEndScript[]
Definition sanctum.c:2289
static void Sanctum_SpawnOrbitingEffect(s32 ownerId, s32 angleStep)
Creates an orbiting effect with the requested angular step.
Definition sanctum.c:1445
s32 gSanctum_ItemIconEndScript[]
Definition sanctum.c:2084
struct SceneEvent gSanctum_SceneTableF[]
Definition sanctum.c:2230
static void Sanctum_SpawnActorSpark(s32 id)
Creates a short-lived spark beside the specified actor.
Definition sanctum.c:1835
static void Sanctum_ShowHealerAfterimage(void)
Copies the healer into the afterimage actor.
Definition sanctum.c:1357
static void Event_TalkToHealerOnVisit(void)
Talking to the healer on a later visit: healing from the front, otherwise words for this visit.
Definition sanctum.c:1905
struct ScenePlacement gSanctum_PlacementSequenceB[]
Definition sanctum.c:2137
static void Sanctum_UpdateOrbitingEffect(union FieldObject *fieldObject)
Advances an effect around its linked actor on an elliptical path.
Definition sanctum.c:1423
struct ScenePlacement gSanctum_PlacementE[]
Definition sanctum.c:2174
static void Sanctum_HideHealerAfterimage(void)
Definition sanctum.c:1391
struct SceneEvent gSanctum_SceneTableH[]
Definition sanctum.c:2250
static void Event_TalkAboutCurse(void)
Talking to this sanctum's healer: about the curse, lifted or not.
Definition sanctum.c:1944
static void Sanctum_UpdateHealerAfterimage(union FieldObject *fieldObject)
Cycles the afterimage through four offsets from the healer.
Definition sanctum.c:1398
static void Sanctum_UpdateRisingSpark(union FieldObject *object)
Moves a spark upward, cycles its scale, and expires its lifetime.
Definition sanctum.c:1805
s32 Sanctum_Initialize(void)
Prepares the current visit and starts its opening scene.
Definition sanctum.c:311
#define QUESTION_X
Definition sanctum.c:1480
struct SceneEvent gSanctum_SceneTableA[]
Definition sanctum.c:2180
static void Sanctum_ReceiveWiseOnesMission(void)
Brings in the Wise One and prepares the party for its mission.
Definition sanctum.c:982
static void Sanctum_ReenactSolSanctum(void)
Has Isaac and Garet act out the events at Sol Sanctum.
Definition sanctum.c:1534
const struct ScenePlacement * Sanctum_GetPlacements(void)
Chooses the actors for the current entrance.
Definition sanctum.c:107
const struct SceneEntrance * Sanctum_GetEntrances(void)
Returns the entrances shared by all Sanctum visits.
Definition sanctum.c:98
static void Sanctum_NodCeremonyGroup(void)
Has the party and four witnesses nod, waiting for the final witness.
Definition sanctum.c:429
static s32 Sanctum_ChooseRestartOption(void)
Offers the refusal ending's restart choices and returns the selection.
Definition sanctum.c:1490
s32 gSanctum_OwnerEffectScript[]
Definition sanctum.c:2281
static void Sanctum_RestoreCeremonyFloor(void)
Restores the two floor rectangles changed during the ceremony.
Definition sanctum.c:1865
static void Event_ReconsiderQuest(void)
Talking to the Great Healer after refusing: changing his mind, Isaac accepts after all.
Definition sanctum.c:210
static s32 Sanctum_IsLeaderFacingHealer(void)
Definition sanctum.c:1875
struct SceneEvent gSanctum_SceneTableC[]
Definition sanctum.c:2198
static void Event_LeaveAfterRefusing(void)
Leaving after refusing: the room turns sepia and the game offers to start again.
Definition sanctum.c:369
#define QUESTION_WIDTH
Definition sanctum.c:1481
struct ScenePlacement gSanctum_PlacementC[]
Definition sanctum.c:2144
struct SceneEvent gSanctum_SceneTableB[]
Definition sanctum.c:2188
struct SceneEvent gSanctum_SceneTableD[]
Definition sanctum.c:2207
const u32 * Sanctum_GetExits(void)
Definition sanctum.c:104
static s32 Sanctum_FaceActorNamedByTimer(union FieldObject *fieldObject)
Faces the actor whose ID this callback stores in the timer field.
Definition sanctum.c:82
static void Sanctum_RequestQuestAcceptance(void)
Discusses Sol Sanctum and asks Isaac to accept the quest.
Definition sanctum.c:459
const struct SceneRegion * Sanctum_GetRegions(void)
Definition sanctum.c:102
#define SANCTUM_NEW_FRIENDS_SPEAKER
Definition sanctum.c:266
@ ACTOR_DORA
Definition sanctum.c:58
@ ACTOR_HEALER_AFTERIMAGE
Definition sanctum.c:60
@ ACTOR_HEALER
Definition sanctum.c:57
@ ACTOR_WISE_ONE
Definition sanctum.c:59
s32 gSanctum_ItemIconGrowScript[]
Definition sanctum.c:2041
struct SceneEntrance gSanctum_Entrances[]
Definition sanctum.c:2089
static void Event_TalkAboutAltinMonsters(void)
Talking to this sanctum's healer: about the monsters, and the party's help in Altin.
Definition sanctum.c:1961
static void Event_ReadMindAboutGoldenStatue(void)
Reading the attendant's mind (actor 9): about the statue and Psynergy.
Definition sanctum.c:186
struct SceneEvent gSanctum_SceneTableG[]
Definition sanctum.c:2241
u32 gSanctum_LeaderCircleScript[]
Definition sanctum.c:1989
struct SceneEvent gSanctum_SceneTableI[]
Definition sanctum.c:2262
#define CURSOR_X
Definition sanctum.c:1482
struct SceneEvent gSanctum_SceneTableE[]
Definition sanctum.c:2219
struct ScenePlacement gSanctum_PlacementB[]
Definition sanctum.c:2122
static void Sanctum_ShowCeremonyGroupEmotes(void)
Shows the same foreground reaction on the party and four witnesses.
Definition sanctum.c:449
static void Event_WarnBeforeLeaving(void)
Walking toward the door after refusing: the Great Healer warns that the choice is final.
Definition sanctum.c:351
u32 gSanctum_GaretCircleScript[]
Definition sanctum.c:2015
static s32 Sanctum_MatchLeaderPriority(union FieldObject *fieldObject)
Keeps this actor at the party leader's drawing priority.
Definition sanctum.c:414
u32 gSanctum_Exits[]
Definition sanctum.c:2104
const struct SceneEvent * Sanctum_GetEvents(void)
Chooses interactions for the entrance and current story flags.
Definition sanctum.c:133
static void Event_TalkAboutJourneyFromXian(void)
Talking to this sanctum's healer, come from Xian.
Definition sanctum.c:1976
void UiTextResource_Release(s32 value)
Frees an arrow sprite's tile slot.
Definition selection.c:1261
Song and sound effect ids, indices into gSound_SongTable.
#define SE_308
Definition songs.h:296
#define MUS_002
Definition songs.h:12
#define SE_196
Definition songs.h:191
#define MUS_086
Definition songs.h:85
#define SE_288
Definition songs.h:281
#define MUS_017
Definition songs.h:27
#define MUS_021
Definition songs.h:31
void AudioCommand_WaitForCompletion(void)
Waits a frame at a time for fanfare restoration, giving up after 300 frames.
Definition sound.c:286
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_ActorShowEmote()
void Engine_TaskWait()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
#define NULL
Definition bilibin.h:6
One animation layer of a sprite: its animation id, frames, running script and timer.
Definition animspr.h:37
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
Definition animspr.h:45
u8 * script
the running script; null when stopped (ANIM_CMD_END)
Definition animspr.h:50
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
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
Definition animspr.h:128
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
struct AnimationEntry * entries[4]
its layers; empty ones null
Definition animspr.h:130
u8 count
layers in use, up to the last one present
Definition animspr.h:129
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
Definition animspr.h:125
u16 fullColor
256 colours; set for both parts when created
Definition animspr.h:94
u16 priority
2 when created
Definition animspr.h:100
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
Definition palbuf.h:40
u16 target[0x540]
the colours current moves toward, as current
Definition palbuf.h:47
u8 padding2a03
never named
Definition palbuf.h:54
s8 step
frames
Definition palbuf.h:53
u8 page
the packed page queued this frame
Definition palbuf.h:51
s8 duration
frames; 0 when the colours are not moving
Definition palbuf.h:52
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
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
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:59
struct FieldActor * linkedObject
The object its action script follows or faces.
Definition field_obj.h:114
u8 steeringFlags
ActorSteeringFlag bits.
Definition field_obj.h:92
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
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:61
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 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 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:60
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
s16 entrance
Definition game_state.h:37
A menu sprite: a list link and its OAM attributes, as two words or as fields.
Definition menu_list.h:24
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...
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
u16 x
tiles
Definition uiwindow.h:15
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
void UiText_DrawResource(s32 message, struct UiWindow *window, s32 x, s32 y)
Decodes a message and draws it into a text canvas window at pixel (x, y).
Definition text_tiles.c:538
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
Declares nothing of its own: it only includes edition.h and uiwindow.h.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
s32 SaveState_CountRecordsExcludingFlagged(s32 excludeSent)
Returns how many save files there are, leaving out those whose summary has its send flag set when exc...
Definition save.c:80
void Ui_PrepareTransferForItem(s32 code)
Draws an item's icon from its inventory code into the glyph work buffer.
Definition icons.c:218
void UiText_ShowCenteredMessage(s32 message, s32 mode, s32 yOffset)
Shows a message centred on the screen (yOffset tiles lower) and waits until it is typed out,...
Definition messages.c:325
The window renderer's work.
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
Definition windows.c:349
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...
Definition windows.c:279