Alchemy
Loading...
Searching...
No Matches

babi_lighthouse.c

Go to the documentation of this file.
1/// @file
2/// Babi Lighthouse, the lighthouse Babi is building on old ruins near
3/// Lalivero. Four scenes share this overlay:
4///
5/// - room 1, the stone door Sheba's kidnappers went through, where Iodem and
6/// Faran ask the party to follow them; a switch only Reveal shows opens it;
7/// - room 2, inside, where the party drops between floors, with a Djinni;
8/// - room 3, where the kidnappers knocked down four men on their way, with two
9/// blocks on ledges and a sprout for Growth;
10/// - the building site outside, with its workers and a block to move.
11
12#include "game_state.h"
13#include "version.h"
14#include "global_cells.h"
15#include "scene_ids.h"
16#include "unit/import.h"
19#include "unit/object/object.h"
21#include "unit/field/field.h"
22#include "macros.h"
23
24#define FIELD_STAGED_ACTOR_IMPORTS
25#include "mapcopy.h"
26#include "types.h"
27#include "field_event.h"
28#include "field_scene.h"
29#include "djinn_ids.h"
30#include "field_effect.h"
31#include "staged_actor.h"
34#include "battle.h"
35#include "debug.h"
36#include "field.h"
37#include "game.h"
38#include "graphics.h"
39#include "menu.h"
40#include "minigame.h"
41#include "sound.h"
42#include "system.h"
43#include "fx_scene.h"
44#include "call.h"
45#include "field_service.h"
46#include "text/msg_ids.h"
47#include "ability_ids.h"
48#include "objcmd.h"
49#include "field_obj.h"
50#include "flags.h"
51#include "songs.h"
52#include "item_ids.h"
53
54/// Room 1, before the stone door: the door's two halves, Iodem, the man who
55/// saw the kidnappers go through, two more onlookers and Faran.
56enum {
64};
65
66/// Room 2's Djinni.
67enum { ACTOR_DJINNI = 8 };
68
69/// Room 3: the two blocks on the ledges, the sprout for Growth and the four
70/// men the kidnappers knocked down on their way in.
71enum {
76};
77
78/// The building site outside: four workers and the block for Move and Carry.
79enum { ACTOR_SITE_BLOCK = 12 };
80
81/// The lighthouse keeps two flags in the area flags from 0x300.
82enum {
83 /// Growth has grown room 3's sprout into a vine.
85 /// The party is on the far side of room 1's stone door.
87};
88
89/// A chest searched while facing the given way.
90#define SEARCH_CHEST_FACING(facing) \
91 (SEARCH(SEARCH_CHEST) | EVENT_TOUCH_FACING | (facing))
92
93static void BabiLighthouse_CloseTruthDoor(void);
95
96/// Unused: a signed division nothing calls.
97static __inline__ s32 UNUSED Entrance_Divide(s32 dividend, s32 divisor) {
98 return dividend / divisor;
99}
100
102
103#include "common/effect_create.h"
104#include "common/effect_spawn.h"
105
106/// Talking to the Djinni in room 2 starts the battle for Djinni 66.
109}
110
113
114/// Arriving by falling from the floor above: the leader drops in, lands with
115/// a thud that shakes the screen and throws up a ring of dust, and is startled.
117 u32 particle;
118 struct FieldActor *leader;
119 struct EffectOptions options;
120 s32 velocity[3];
121
122 // Start above the room with movement disabled until the fall begins.
124 Camera_MoveTo(-1, -1, -1, 0);
138 // Spread the landing particles around the leader before restoring bounce.
139 options.palette = 7;
140 options.update = (void (*)(union FieldObject *))Effect_AdvanceMotion;
141 options.startScaleX = 0xcccc;
142 options.startScaleY = 0xcccc;
143 for (particle = 0; particle < 17; particle++) {
144 SET_VECTOR(velocity, Engine_MathCos(particle << 12), 0,
145 Engine_MathSin(particle << 12));
146 velocity[0] += velocity[0] / 2;
147 Effect_Spawn(leader->x.fixed, leader->y.fixed, leader->z.fixed, velocity[0],
148 velocity[1], velocity[2],
151 &options);
152 }
156 Map_SetShake(0x50000, 0x50000, 0x10000);
157 Map_SetShake(-1, -1, 0xe666);
163}
164
165/// Arriving at one of room 2's drop entrances: the leader drops in and falls
166/// on, out through the given exit.
168 struct FieldActor *leader;
169
170 // Start above the room with movement disabled until the fall begins.
172 Camera_MoveTo(-1, -1, -1, 0);
176 leader->y.fixed = 0x820000;
178 leader->gravity = 0x4000;
180 leader->bounce = 0;
189 leader->velocityY = -0x50000;
190 OverlayObject_WaitUntilIdle(Actor_Get(ACTOR_PARTY_LEADER));
194}
195
197 s16 scene = gGameState.scene;
198
199 if (scene == (s32)&SceneId_BabiLighthouse3) {
201 }
202 if (scene == (s32)&SceneId_BabiLighthouse2) {
204 }
205 if (scene == (s32)&SceneId_BabiLighthouse1) {
207 }
209}
210
211/// Only room 3 has regions.
212const struct SceneRegion *Scene_GetRegions(void) {
215 }
216 return 0;
217}
218
219/// The four scenes share one exit table.
221
223 s16 scene = gGameState.scene;
224
225 if (scene == (s32)&SceneId_BabiLighthouse3) {
227 }
228 if (scene == (s32)&SceneId_BabiLighthouse2) {
230 }
231 if (scene == (s32)&SceneId_BabiLighthouse1) {
233 }
235}
236
237/// After Move on one of room 3's blocks, or a push: a leader left standing on
238/// a block's ledge cell jumps off it, and the blocks' cells are redrawn.
240 struct FieldActor *leader;
241
244 if (((leader->x.fixed >> 20) == 6 || (leader->x.fixed >> 20) == 18) &&
245 (leader->z.fixed >> 20) == 20) {
246 leader->targetX = ACTOR_NO_TARGET;
247 leader->targetZ = ACTOR_NO_TARGET;
249 Actor_SetSpeed(ACTOR_PARTY_LEADER, 0x20000, 0x10000);
251 {
252 u16 facing = leader->facing;
253 if ((u16)(facing + 0x4fff) <= 0x1fff ||
254 (u16)(facing - 0x3001) <= 0x1fff) {
258 } else {
262 }
263 }
264 }
267}
268
269/// Walking into one of room 3's blocks pushes it.
272 StagedActor_AdvancePair();
275}
276
277/// Walking south off room 3's ledge: pushes the block below on the leader's
278/// side if it stands at the ledge's foot, and otherwise climbs down.
281
282 if ((Object_GetById(ACTOR_PARTY_LEADER)->x.fixed >> 20) <= 12) {
284 if ((block->x.fixed >> 20) == 6) {
285 if ((block->z.fixed >> 20) == 20) {
287 return;
288 }
289 }
290 } else {
291 if ((block->x.fixed >> 20) == 18) {
292 if ((block->z.fixed >> 20) == 20) {
294 return;
295 }
296 }
297 }
299}
300
301/// Raises the leader, then closes the screen before a room transition.
303 Camera_MoveTo(-1, -1, -1, 0);
307}
308
309/// Raises the leader and takes exit 11 without preparing an extra effect.
310static void BabiLighthouse_RiseToExit(void) {
315}
316
317/// Prepares one effect, raises the leader, then takes exit 12.
320 OverlayObject_PrepareObject(PIXELS(464), 0, PIXELS(290), 223);
324}
325
326/// Prepares two effects, raises the leader, then takes exit 13.
329 OverlayObject_PrepareObject(PIXELS(143), 0, PIXELS(290), 223);
330 OverlayObject_PrepareObject(PIXELS(121), 0, PIXELS(286), 253);
334}
335
336/// Raises the leader and takes exit 15 without preparing an extra effect.
342}
343
344/// Searching room 2's door. "It seems to be locked."
348 Engine_MessageShowCentered(MsgBabiSeemsLocked, 1);
350}
351
352/// A companion walks back to the leader and rejoins the party.
353static inline void BabiLighthouse_RegroupPartyMember(s32 actorId) {
354 struct FieldActor *leader;
355
358 if (leader != 0) {
359 Actor_SetDestination(actorId, leader->x.part.pixel, leader->z.part.pixel);
360 }
362 Actor_SetPosition(actorId, 0, 0);
363}
364
365/// Walking up to room 1's stone door the first time: Faran asks whether the
366/// kidnappers really went through it; the onlookers argue, and Iodem,
367/// arriving with the party, tells who they are, and Faran, doubting them,
368/// asks them to prove they can follow by opening the door.
370 // Bring the party to the witnesses gathered around the sealed door.
375 Engine_EventSetMessage(MsgBabiYoureSureTheyWentThrough);
376 Actor_SetSpeed(ACTOR_PARTY_LEADER, 0x10000, 0x8000);
388 Camera_SetSpeed(0x30000, 0x6000);
389 Camera_MoveTo(PIXELS(280), -1, PIXELS(288), 1);
404 // The witnesses try the stone door and disagree about who passed through it.
448 Camera_MoveTo(PIXELS(280), -1, PIXELS(320), 1);
451 // The party learns where the kidnappers went and is asked to pursue them.
474 if (Engine_EventChooseYesNo(0, 0) == 0) {
482 } else {
490 }
493 Actor_SetSpeed(ACTOR_FARAN, 0x10000, 0x8000);
519 if (Engine_EventChooseYesNo(0, 0) == 0) {
525 } else {
531 }
538 Actor_SetSpeed(ACTOR_SECOND_ONLOOKER, 0x14ccc, 0xa666);
543 Actor_SetSpeed(ACTOR_FIRST_ONLOOKER, 0x14ccc, 0xa666);
560 if (Engine_EventChooseYesNo(0, 0) == 0) {
566 } else {
572 }
592 Actor_SetSpeed(ACTOR_FIRST_ONLOOKER, 0x10000, 0x8000);
593 Actor_SetSpeed(ACTOR_SECOND_ONLOOKER, 0x10000, 0x8000);
608 Actor_SetSpeed(ACTOR_FARAN, 0x10000, 0x8000);
612 Actor_SetSpeed(ACTOR_WITNESS, 0x10000, 0x8000);
616 // Regroup the travelling party after the conversation.
617 Actor_SetSpeed(GARET, 0x13333, 0x9999);
618 Actor_SetSpeed(IVAN, 0x13333, 0x9999);
619 Actor_SetSpeed(MIA, 0x13333, 0x9999);
625}
626
627/// The door opens before Iodem and Faran the first time: everyone marvels,
628/// the door closes again, and the party says those without Psynergy cannot
629/// follow; Iodem and Faran leave Sheba's rescue to them.
631 // Everyone reacts to the opened door before trying to follow the party.
635 Engine_EventSetMessage(MsgBabiTheDoor);
636 Actor_SetSpeed(ACTOR_PARTY_LEADER, 0x10000, 0x8000);
645 Camera_SetSpeed(0x30000, 0x6000);
646 Camera_MoveTo(PIXELS(280), -1, PIXELS(328), 1);
705 Actor_SetSpeed(ACTOR_IODEM, 0x10000, 0x8000);
727 // Demonstrate that the door closes again when someone without Psynergy
728 // enters.
731 Camera_MoveTo(-1, -1, -1, 0);
749 Camera_MoveTo(PIXELS(280), -1, PIXELS(312), 1);
781 // Explain the restriction and ask the onlookers to leave the pursuit to us.
789 if (Engine_EventChooseYesNo(0, 0) == 0) {
795 } else {
801 }
816 // Iodem and Faran agree to stay behind and leave the rescue to the party.
828 if (Engine_EventChooseYesNo(0, 0) == 0) {
836 } else {
844 }
880 // Regroup the travelling party after the conversation.
881 Actor_SetSpeed(GARET, 0x13333, 0x9999);
882 Actor_SetSpeed(IVAN, 0x13333, 0x9999);
883 Actor_SetSpeed(MIA, 0x13333, 0x9999);
896}
897
898/// Reveal shows the door's switch, flipped one way or the other as the door
899/// stands.
902 Map_CopyCellsLayered(36, 78, 1, 2, 17, 78);
903 } else {
904 Map_CopyCellsLayered(34, 78, 1, 2, 17, 78);
905 }
906}
907
908/// Reveal's light ends and the switch is hidden again.
910 Map_CopyCellsLayered(32, 78, 1, 2, 17, 78);
911}
912
913/// The stone door's halves slide open (SE_GATE_MOVE); the first time, Iodem
914/// and Faran see it.
924 Map_CopyCellAttributes(81, 14, 4, 1, 17, 14);
928 }
929 }
930}
931
932/// Walking through the open door: it slides shut behind the party, now on its
933/// other side.
943 Map_CopyCellAttributes(0, 14, 4, 1, 17, 14);
947 } else {
949 }
950 }
951}
952
953/// Searching the door's switch: under Reveal's light it is flipped and the
954/// door opens; otherwise it reads an inscription. "The truth of this door is
955/// open to those seeing with their true heart."
957 u8 *work = (u8 *)gEventWork;
958 s16 *revealActive;
959
961 revealActive = (s16 *)(work + 0xcb8);
962 if (revealActive[0] != 0) {
964
965 Engine_MessageShowCentered(MsgFieldFlippedSwitch, 1);
967 Map_CopyCellsLayered(35, 78, 1, 2, 17, 78);
969 Map_CopyCellsLayered(34, 78, 1, 2, 17, 78);
972 }
973 } else {
974 Engine_EventSetMessage(MsgBabiTruthDoorOpenThoseSeeing);
976 }
978}
979
980/// Finds the staged actor one direction-table step ahead, including terrain
981/// height.
982static struct FieldActor *
984 struct FieldPosition position;
985 struct FieldPosition *target = &position;
986 s32 directionStep = gStagedActor_DirectionSteps[actor->facing >> 12];
987
988 {
989 s32 x = actor->x.fixed;
990 s32 z = actor->z.fixed;
991
992 x += -0x10000 & directionStep;
993 z += directionStep << 16;
994 target->x = x;
995 target->z = z;
996 }
997 target->y = Map_GetTerrainHeight(actor->terrainId, target->x, target->z);
998 return StagedActor_FindAtTile(target, actor);
999}
1000
1001/// Carry's first phase on the building site's block sets the effect's
1002/// childOption; what that changes is not known.
1004 ((struct BattleFxScene *)gEffectWork)->childOption = 1;
1005}
1006
1007/// After Move or Carry on the building site's block: in its cell at (20, 12)
1008/// it settles at a height of 48 pixels.
1011 s32 column = block->x.fixed >> 20;
1012
1013 if (column == 20) {
1014 s32 row = block->z.fixed >> 20;
1015
1016 if (row == 12) {
1017 block->motionFlags = 2;
1018 block->terrainHeight = 0x300000;
1019 block->priorityFlags = 2;
1020 {
1021 s32 targetColumn = column, targetRow = row;
1022
1023 Map_CopyCellAttributes(38, 12, 1, 1, targetColumn, targetRow);
1024 }
1025 }
1026 }
1027}
1028
1029/// Advances the staged pair only when the actor ahead is less than eight pixels
1030/// away vertically.
1032 // Trial: inverting the empty success arm changes two branch instructions
1033 // (three text bytes in tbs-en); retain the existing branch order.
1034 struct FieldActor *leader =
1036 struct FieldActor *ahead = BabiLighthouse_FindActorAhead(leader);
1037 s32 heightDifference;
1038
1039 if (ahead == 0) {
1040 return;
1041 }
1042
1043 heightDifference = ahead->y.fixed - leader->y.fixed;
1044
1045 if (heightDifference >= 0) {
1046
1047 if (heightDifference < 0x80000) {
1048 } else {
1049 return;
1050 }
1051 } else if (leader->y.fixed - ahead->y.fixed >= 0x80000) {
1052 return;
1053 }
1054
1055 StagedActor_AdvancePair();
1056}
1057
1058/// Tries vertical climbing first, then advances the staged pair when
1059/// appropriate.
1061 struct FieldActor *leader =
1063 struct FieldActor *ahead = BabiLighthouse_FindActorAhead(leader);
1064 s32 climbDirection = (leader->facing + 0x2000) & 0xc000;
1065 s32 climbResult = -1;
1066
1067 if (gGameState.movementMode == 1 || ahead == 0) {
1068 if (climbDirection == FACING_NORTH) {
1069 climbResult = Field_ClimbUp();
1070 }
1071 if (climbDirection == FACING_SOUTH) {
1072 climbResult = Field_ClimbDown();
1073 }
1074 }
1075 if (climbResult != 0) {
1076 if (gGameState.movementMode != 1) {
1078 }
1079 }
1080}
1081
1082const struct SceneEvent *Scene_GetEvents(void) {
1083 s16 scene = gGameState.scene;
1084
1085 if (scene == (s32)&SceneId_BabiLighthouse3) {
1087 }
1088 if (scene == (s32)&SceneId_BabiLighthouse2) {
1090 }
1091 if (scene == (s32)&SceneId_BabiLighthouse1) {
1093 }
1095}
1096
1097/// Growth on room 3's sprout: it grows into a vine the party can climb.
1099
1100 Map_CopyCellAttributes(82, 7, 1, 2, 18, 7);
1101 Engine_TaskWait(1);
1103}
1104
1105/// Redraws room 3's ledge cells, then blocks the cells under its two blocks.
1107 struct FieldActor *leftBlock = Object_GetById(ACTOR_LEFT_BLOCK);
1108
1111 Map_CopyCellAttributes(69, 19, 3, 3, 5, 19);
1112 Map_CopyCellAttributes(69, 19, 3, 3, 17, 19);
1113 {
1114 s32 column = leftBlock->x.fixed >> 20, row = leftBlock->z.fixed >> 20;
1115
1116 Map_CopyCellAttributes(3, 3, 1, 1, column, row);
1117 }
1118 {
1119 struct FieldActor *rightBlock = Object_GetById(ACTOR_RIGHT_BLOCK);
1120 s32 column = rightBlock->x.fixed >> 20, row = rightBlock->z.fixed >> 20;
1121
1122 Map_CopyCellAttributes(3, 3, 1, 1, column, row);
1123 }
1124}
1125
1126#if TBS_PATCH_2
1127/// Update callback of room 3's blocks (TBS_PATCH_2 and later): each is drawn
1128/// in front of the leader when nearer the screen, and on its layer otherwise.
1129static void BabiLighthouse_MatchLeaderPriority(union FieldObject *fieldObject) {
1130 struct AnimationObject *sprite;
1131 struct FieldActor *actor;
1132 s32 priority;
1133
1134 sprite = Object_GetById(ACTOR_PARTY_LEADER)->sprite;
1138 } else {
1139 priority = sprite->image.priority;
1140 if (priority != 1)
1141 priority--;
1144 }
1148 } else {
1149 priority = sprite->image.priority;
1150 if (priority != 1)
1151 priority--;
1154 }
1155}
1156#endif
1157
1158/// Sets up the scene being entered: Retreat leads back to room 3; the site's
1159/// block, room 3's blocks, vine and fallen men, room 2's arrivals by falling,
1160/// and room 1's door and onlookers are restored. Returns 0.
1162 struct FieldActor *actor;
1163 struct FieldActor *placedActor;
1164 s32 scene;
1165 s32 sceneCopy;
1166 struct GameState *state;
1167 s32 x;
1168 s32 z;
1169 u8 zero;
1170
1171 Engine_TaskWait(1);
1173 state = &gGameState;
1174 scene = state->scene;
1176 state->retreatEntrance = 1;
1178 sceneCopy = state->scene;
1179 }
1180 // Restore the moved block's collision in the construction-area room.
1182 placedActor = Object_GetById(ACTOR_SITE_BLOCK);
1183 x = placedActor->x.fixed >> 20;
1184 if (x == 20) {
1185 z = placedActor->z.fixed >> 20;
1186 if (z == 12) {
1187 Map_CopyCellAttributes(38, 12, 1, 1, x, z);
1188 }
1189 }
1190 } else if (sceneCopy == (s32)&SceneId_BabiLighthouse3) {
1191 // Set up the movable ledge blocks and the staggered actor animations.
1194#if TBS_PATCH_2
1196 BabiLighthouse_MatchLeaderPriority;
1198 BabiLighthouse_MatchLeaderPriority;
1199#endif
1200 if (state->entrance == 5 && GameFlag_IsSet(FLAG_KEEP_PARTY_POSITION) == 0) {
1202 }
1210 }
1211 // Their script waits stagger the four fallen men's first animations.
1213 placedActor->collisionFlags = 0;
1214 placedActor->priorityFlags = 0;
1215 placedActor->wait = 0;
1216 placedActor->sprite->image.priority = 3;
1217 zero = 0;
1218 placedActor->sprite->flags = zero;
1219 placedActor->sprite->rotation = 0xc000;
1221 placedActor = Object_GetById(ACTOR_FIRST_FALLEN_MAN + 1);
1222 placedActor->collisionFlags = zero;
1223 placedActor->priorityFlags = zero;
1224 placedActor->wait = 30;
1225 placedActor->sprite->image.priority = 3;
1226 placedActor->sprite->flags = zero;
1227 placedActor->sprite->rotation = 0x4000;
1229 placedActor = Object_GetById(ACTOR_FIRST_FALLEN_MAN + 2);
1230 placedActor->collisionFlags = zero;
1231 placedActor->priorityFlags = zero;
1232 placedActor->wait = 60;
1233 placedActor->sprite->image.priority = 3;
1234 placedActor->sprite->flags = zero;
1235 placedActor->sprite->rotation = 0x8000;
1237 placedActor = Object_GetById(ACTOR_FIRST_FALLEN_MAN + 3);
1238 placedActor->collisionFlags = zero;
1239 placedActor->priorityFlags = zero;
1240 placedActor->wait = 90;
1241 placedActor->sprite->image.priority = 3;
1242 placedActor->sprite->flags = zero;
1243 placedActor->sprite->rotation = 0x8000;
1245 } else if (sceneCopy == (s32)&SceneId_BabiLighthouse2) {
1246 // Match the arrival effect and fall to the entrance used in this room.
1247 switch (state->entrance) {
1248 case 10:
1250 // Both entrances restore the same remembered tile changes.
1251 // fall through
1252 case 11:
1254 Map_CopyCellsTo(120, 7, 109, 7, 1, 3);
1255 Map_CopyCellAttributes(45, 8, 1, 1, 45, 9);
1256 }
1257 break;
1258 case 14:
1259 OverlayObject_PrepareObject(PIXELS(440), 0, PIXELS(290), 223);
1260 Map_CopyCellAttributes(22, 13, 1, 1, 27, 13);
1262 break;
1263 case 16:
1264 OverlayObject_PrepareObject(PIXELS(448), 0, PIXELS(290), 223);
1265 Map_CopyCellAttributes(22, 12, 1, 1, 28, 10);
1267 break;
1268 case 17:
1269 OverlayObject_PrepareObject(PIXELS(232), 0, PIXELS(594), 223);
1270 Map_CopyCellAttributes(22, 12, 1, 1, 14, 33);
1272 break;
1273 case 12:
1274 case 13:
1275 case 15:
1278 }
1279 break;
1280 }
1281 } else if (scene == (s32)&SceneId_BabiLighthouse1) {
1282 // Restore the truth door and the onlookers' positions after each
1283 // discussion.
1286 Actor_SetSpeed(ACTOR_LEFT_DOOR, 0x10000, 0x8000);
1287 Actor_SetSpeed(ACTOR_RIGHT_DOOR, 0x10000, 0x8000);
1289 if (state->entrance == 1) {
1291 } else {
1293 }
1294 }
1311 0);
1313 0);
1316 }
1322 Map_CopyCellAttributes(81, 14, 4, 1, 17, 14);
1323 }
1324 if (gGameState.entrance == 3) {
1327 }
1328 }
1329 } else {
1331 }
1332 return 0;
1333}
1334
1335/// Pixel step by direction: X in the upper halfword, Z in the lower.
1336#define DIRECTION_STEP(dx, dz) (((dx) << 16) | ((dz) & 0xffff))
1337
1339 DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0),
1340 DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16),
1341 DIRECTION_STEP(0, 16), DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0),
1342 DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0), DIRECTION_STEP(0, -16),
1343 DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16),
1344 DIRECTION_STEP(16, 0),
1345};
1346
1348 207, 205, 228, 229, 298, 297,
1349};
1350
1352 -32, -8, 32, 8, -8, -32, 8, 32, -32, -16, 32, 0,
1353 -8, -32, 8, 32, -32, -8, 32, 8, -8, -32, 8, 32,
1354};
1355
1357 SC_WAIT(1), SC_LOOP(22, SC_TOP), SC_WAIT(1),
1358 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
1359};
1360
1362 SC_WAIT(1), SC_LOOP(44, SC_TOP), SC_WAIT(1),
1363 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
1364};
1365
1367 SC_WAIT(1), SC_LOOP(126, SC_TOP), SC_WAIT(1),
1368 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
1369};
1370
1375};
1376
1378 SC_SET(SW_SCALE_X, 0x10000),
1379 SC_SET(SW_SCALE_Y, 0x10000),
1380 SC_LABEL(1),
1381 SC_ADD(SW_SCALE_X, -0x4000),
1382 SC_ADD(SW_SCALE_Y, 0x2000),
1383 SC_WAIT(2),
1384 SC_ADD(SW_SCALE_X, 0x2000),
1385 SC_ADD(SW_SCALE_Y, -0x1000),
1386 SC_WAIT(2),
1387 SC_ADD(SW_SCALE_X, 0x1000),
1388 SC_ADD(SW_SCALE_Y, -2048),
1389 SC_WAIT(2),
1390 SC_ADD(SW_SCALE_X, 0x1000),
1391 SC_ADD(SW_SCALE_Y, -2048),
1392 SC_WAIT(4),
1393 SC_ADD(SW_SCALE_X, -0x4000),
1394 SC_ADD(SW_SCALE_Y, 0x2000),
1395 SC_WAIT(2),
1396 SC_ADD(SW_SCALE_X, 0x2000),
1397 SC_ADD(SW_SCALE_Y, -0x1000),
1398 SC_WAIT(2),
1399 SC_ADD(SW_SCALE_X, 0x1000),
1400 SC_ADD(SW_SCALE_Y, -2048),
1401 SC_WAIT(2),
1402 SC_ADD(SW_SCALE_X, 0x1000),
1403 SC_ADD(SW_SCALE_Y, -2048),
1404 SC_WAIT(120),
1405 SC_WAIT(1),
1407};
1408
1410 {0, CONDITION_ALWAYS, 136, 0, 376, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1411 {1, CONDITION_ALWAYS, 200, 0, 424, FACING_NORTH, 0, 0, 0, 384, 448, 0},
1412 {2, CONDITION_ALWAYS, 200, 0, 200, FACING_SOUTH, 0, 0, 0, 384, 448, 0},
1413 {3, CONDITION_ALWAYS, 216, 0, 184, FACING_SOUTH, 0, 0, 0, 384, 448, 0},
1414 {4, CONDITION_ALWAYS, 104, 0, 312, FACING_SOUTH, 0, 0, 0, 384, 448, 0},
1415 {5, CONDITION_ALWAYS, 296, 0, 312, FACING_SOUTH, 0, 0, 0, 384, 448, 0},
1416 {6, CONDITION_ALWAYS, 312, 0, 88, FACING_SOUTH, 0, 0, 0, 384, 448, 0},
1418};
1419
1421 {0, CONDITION_ALWAYS, 136, 0, 376, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1422 {1, CONDITION_ALWAYS, 232, 0, 488, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1423 {2, CONDITION_ALWAYS, 280, 0, 488, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1424 {3, CONDITION_ALWAYS, 248, 0, 648, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1425 {4, CONDITION_ALWAYS, 424, 0, 120, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1426 {5, CONDITION_ALWAYS, 456, 0, 120, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1427 {6, CONDITION_ALWAYS, 504, 0, 120, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1428 {7, CONDITION_ALWAYS, 472, 0, 288, FACING_NORTH, 0, 352, 64, 592, 320, 0},
1429 {8, CONDITION_ALWAYS, 120, 0, 120, FACING_SOUTH, 0, 48, 64, 288, 320, 0},
1430 {9, CONDITION_ALWAYS, 184, 0, 288, FACING_NORTH, 0, 48, 64, 288, 320, 0},
1431 {10, CONDITION_ALWAYS, 728, 0, 168, FACING_SOUTH, 0, 624, 96, 864, 256, 0},
1432 {11, CONDITION_ALWAYS, 776, 0, 184, FACING_SOUTH, 0, 624, 96, 864, 256, 0},
1433 {12, CONDITION_ALWAYS, 488, 0, 184, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1434 {13, CONDITION_ALWAYS, 248, 0, 584, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1435 {14, CONDITION_ALWAYS, 440, 0, 216, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1436 {15, CONDITION_ALWAYS, 216, 0, 584, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1437 {16, CONDITION_ALWAYS, 456, 0, 168, FACING_SOUTH, 0, 352, 64, 592, 320, 0},
1438 {17, CONDITION_ALWAYS, 232, 0, 536, FACING_SOUTH, 0, 128, 432, 368, 672, 0},
1440};
1441
1443 {1, CONDITION_ALWAYS, 248, 0, 120, FACING_SOUTH, 0, 96, 48, 384, 432, 0},
1444 {2, CONDITION_ALWAYS, 136, 0, 368, FACING_NORTH, 0, 96, 48, 384, 432, 0},
1445 {3, CONDITION_ALWAYS, 168, 0, 344, FACING_SOUTH, 0, 96, 48, 384, 432, 0},
1447};
1448
1450 {0, CONDITION_ALWAYS, 328, 0, 240, FACING_NORTH, 0, 0, 0, 464, 400, 0},
1451 {1, CONDITION_ALWAYS, 112, 0, 360, FACING_NORTH, 0, 0, 0, 464, 400, 0},
1452 {2, CONDITION_ALWAYS, 136, 0, 32, FACING_SOUTH, 0, 0, 0, 464, 400, 0},
1454};
1455
1457 {96, -20, 320, 112, -4, 336, CONDITION_ALWAYS, 4},
1458 {288, -20, 320, 304, -4, 336, CONDITION_ALWAYS, 5},
1459 {304, -20, 96, 320, -4, 112, CONDITION_ALWAYS, 6},
1461};
1462
1464 SCENE_EXITS(176), SCENE_EXIT(1, 177, 2), SCENE_EXIT(2, 175, 7),
1465 SCENE_EXIT(3, 175, 9), SCENE_EXIT(4, 173, 1), SCENE_EXIT(5, 173, 3),
1466 SCENE_EXIT(6, 173, 2), SCENE_EXIT(0, 175, 0), SCENE_EXIT(1, 175, 4),
1467 SCENE_EXIT(2, 176, 3), SCENE_EXIT(3, 175, 8), SCENE_EXIT(4, 175, 1),
1468 SCENE_EXIT(5, 175, 2), SCENE_EXIT(6, 176, 2), SCENE_EXIT(7, 175, 5),
1469 SCENE_EXIT(8, 175, 6), SCENE_EXIT(9, 175, 11), SCENE_EXIT(10, 175, 3),
1470 SCENE_EXIT(11, 175, 12), SCENE_EXIT(12, 175, 13), SCENE_EXIT(13, 175, 14),
1471 SCENE_EXIT(14, 175, 15), SCENE_EXIT(15, 175, 16), SCENE_EXIT(16, 175, 17),
1472 SCENE_EXIT(17, 174, 3), SCENE_EXIT(18, 174, 2), SCENE_EXIT(0, 174, 0),
1473 SCENE_EXIT(1, 172, 1), SCENE_EXIT(2, 175, 10), SCENE_EXIT(0, 177, 0),
1474 SCENE_EXIT(1, 2, 31), SCENE_EXIT(2, 176, 1), SCENE_EXITS_END,
1475};
1476
1479};
1480
1482 {0xfd, CONDITION_ALWAYS, 7, PIXELS(88), 0, PIXELS(328), FACING_SOUTH,
1483 TALK_KEEP_FACING, 0},
1484 {0xfd, CONDITION_ALWAYS, 7, PIXELS(296), 0, PIXELS(328), FACING_SOUTH,
1486 {0xee, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(296), 0, PIXELS(130),
1497};
1498
1500 {0x5d, FLAG_DJINNI_0 + 66, ACTOR_STAND, PIXELS(472), 0, PIXELS(184),
1503};
1504
1505// clang-format off
1508 TALK_FACE_PARTY, 0},
1510 0},
1512 TALK_FACE_PARTY, 0},
1513 {0x128, CONDITION_ALWAYS, 7, PIXELS(296), 0, PIXELS(240), FACING_WEST, TALK_KEEP_FACING, 0},
1514 {0x128, CONDITION_ALWAYS, 7, PIXELS(312), 0, PIXELS(240), FACING_EAST, TALK_KEEP_FACING, 0},
1515 {0x39, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(312), 0, PIXELS(352), FACING_NORTH,
1517 {0x74, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(328), 0, PIXELS(328), FACING_WEST,
1519 {0x65, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(344), 0, PIXELS(336), FACING_WEST,
1521 {0x6c, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(344), 0, PIXELS(312), FACING_WEST,
1523 {0x46, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(328), 0, PIXELS(312), FACING_WEST,
1526};
1527
1529 {0x72, CONDITION_ALWAYS, ACTOR_WANDER, PIXELS(128), 0, PIXELS(264), FACING_WEST,
1530 TALK_FACE_PARTY, 0},
1532 0},
1534 0},
1535 {0x87, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(232), 0, PIXELS(184), FACING_SOUTH,
1536 TALK_FACE_PARTY, 0},
1537 {0x100, CONDITION_ALWAYS, ACTOR_STAND, PIXELS(376), 0, PIXELS(216), FACING_SOUTH,
1538 TALK_FACE_PARTY, 0},
1540};
1541
1548 {EVENT_TALK, ACTOR_FIRST_FALLEN_MAN, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseTheyWereTerribleWeWereAbsolutely)},
1549 {EVENT_TALK, ACTOR_FIRST_FALLEN_MAN + 1, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseOnlyTwoOfThoseSixEver)},
1550 {EVENT_TALK, ACTOR_FIRST_FALLEN_MAN + 2, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseTheyJustKickedUsOutOf)},
1551 {EVENT_TALK, ACTOR_FIRST_FALLEN_MAN + 3, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseTheySetFireToEverythingThats)},
1553 MSGNO(MsgBabiLighthouseWereTheOnesWhoAttackedBut)},
1555 MSGNO(MsgBabiLighthouseTheOtherFourDidntSeemTo)},
1557 MSGNO(MsgBabiLighthouseWhatCouldTheyBePlanningFor)},
1559 MSGNO(MsgBabiLighthouseNoneOfThemHadAnyTorches)},
1564};
1565
1567 {0x31, 5, CONDITION_ALWAYS, 1},
1569 {0x21, 1, CONDITION_ALWAYS, 3},
1570 {0x31, 2, CONDITION_ALWAYS, 4},
1571 {0x31, 3, CONDITION_ALWAYS, 5},
1573 {0x21, 7, CONDITION_ALWAYS, 7},
1574 {0x21, 8, CONDITION_ALWAYS, 8},
1575 {0x31, 9, CONDITION_ALWAYS, 9},
1576 {0x21, 10, CONDITION_ALWAYS, 10},
1577 {EVENT_EXIT, 11, CONDITION_ALWAYS, 18},
1585};
1586
1588 {0x31, 1, CONDITION_ALWAYS, 1},
1594 {EVENT_TALK, ACTOR_IODEM, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseIAmCountingOnYouIsaac)},
1595 {EVENT_TALK, ACTOR_WITNESS, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseWhenISawThemTheyHad)},
1596 {EVENT_TALK, ACTOR_FIRST_ONLOOKER, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseIAmSorryButNotEven)},
1597 {EVENT_TALK, ACTOR_SECOND_ONLOOKER, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseThisAllStartedWhenActorWas)},
1598 {EVENT_TALK, ACTOR_FARAN, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseIfYouCanOpenThisDoor)},
1599 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_IODEM, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseIDoNotMeanToDoubt)},
1601 MSGNO(MsgBabiLighthouseNobodyThinksTheDoorCanBe)},
1603 MSGNO(MsgBabiLighthouseIDontKnowWhatTheyreWaiting)},
1604 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_SECOND_ONLOOKER, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseThisIsAllAHugeWaste)},
1605 {PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), ACTOR_FARAN, FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN, MSGNO(MsgBabiLighthouseIHopeTheyCanOpenThe)},
1606 {EVENT_TALK, ACTOR_IODEM, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseIBegOfYouIsaacPlease)},
1607 {EVENT_TALK, ACTOR_WITNESS, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseICantBelieveThisDoorActually)},
1608 {EVENT_TALK, ACTOR_FIRST_ONLOOKER, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseItTakesGreatCourageToContinue)},
1609 {EVENT_TALK, ACTOR_SECOND_ONLOOKER, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseImVeryInterestedInWhatLies)},
1610 {EVENT_TALK, ACTOR_FARAN, CONDITION_ALWAYS, MSGNO(MsgBabiLighthouseIAmNotAfraidOfDanger)},
1612 MSGNO(MsgBabiLighthouseIfAnythingHappensToActorTolbi)},
1614 MSGNO(MsgBabiLighthouseIfThisDoorOpensMaybeWe)},
1616 MSGNO(MsgBabiLighthouseIBetTheMonstersAroundHere)},
1618 MSGNO(MsgBabiLighthouseThisIsABigWasteOf)},
1620 MSGNO(MsgBabiLighthouseIDontWantToHinderActors)},
1627};
1628// clang-format on
1629
1644 MSGNO(MsgBabiLighthouseWeHaventBeenOrderedToStart)},
1646 MSGNO(MsgBabiLighthouseThereWereStrangeFolkGoingTo)},
1648 MSGNO(MsgBabiLighthouseItsOddThatBabiWouldBuild)},
1650 MSGNO(MsgBabiLighthouseCuttingTheseStonesAndStackingThem)},
1652 MSGNO(MsgBabiLighthouseThereWasABigFightThat)},
1654 MSGNO(MsgBabiLighthouseIfFaranWentAfterThemThen)},
1656 MSGNO(MsgBabiLighthouseWhyWouldTheyWantToRush)},
1658 MSGNO(MsgBabiLighthouseNowThatIThinkOfIt)},
1662};
Ability numbers, named from the English release.
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_REVEAL
Definition ability_ids.h:19
@ ABILITY_MOVE
Definition ability_ids.h:15
@ ABILITY_GROWTH
Definition ability_ids.h:10
@ ABILITY_CARRY
Definition ability_ids.h:22
void Motion_LaunchFromFocusedObject(u32 objectId, s32 xOffset, s32 zOffset, s32 action)
Places an actor on the leader and sends it walking (xOffset, zOffset) pixels away at speed 0....
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 struct SceneRegion * Scene_GetRegions(void)
#define SEARCH_CHEST_FACING(facing)
A chest searched while facing the given way.
Definition altin_peak.c:150
@ ACTOR_DJINNI
Definition altin_peak.c:118
s32 gStagedActor_DirectionSteps[]
Pixel step by direction: X in the upper halfword, Z in the lower.
s32 gStagedActor_FootprintBounds[]
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.
u32 gStagedActor_FootprintKinds[]
static void BabiLighthouse_ExplainTruthDoor(void)
The door opens before Iodem and Faran the first time: everyone marvels, the door closes again,...
static void BabiLighthouse_HideTruthDoorSwitch(void)
Reveal's light ends and the switch is hidden again.
static void BabiLighthouse_RiseAndCloseScreen(void)
Raises the leader, then closes the screen before a room transition.
struct SceneEntrance gBabiLighthouse_EntrancesOther[]
static void BabiLighthouse_RiseToAlternateExit(void)
Raises the leader and takes exit 15 without preparing an extra effect.
static void BabiLighthouse_ClimbDownOrAdvancePair(void)
Walking south off room 3's ledge: pushes the block below on the leader's side if it stands at the led...
static void BabiLighthouse_RefreshTruthDoorTiles(void)
Reveal shows the door's switch, flipped one way or the other as the door stands.
const u32 * BabiLighthouse_GetExits(void)
The four scenes share one exit table.
struct SceneEvent gBabiLighthouse_Events1[]
static void BabiLighthouse_UpdateMovedBlock(void)
After Move or Carry on the building site's block: in its cell at (20, 12) it settles at a height of 4...
struct SceneEvent gBabiLighthouse_EventsOther[]
static void BabiLighthouse_InspectLockedDoor(void)
Searching room 2's door. "It seems to be locked.".
s32 gEffectScript0[]
u32 gBabiLighthouse_Exits[]
static void BabiLighthouse_RiseToExit(void)
Raises the leader and takes exit 11 without preparing an extra effect.
@ ACTOR_SITE_BLOCK
static void BabiLighthouse_StartDjinnBattle(void)
Talking to the Djinni in room 2 starts the battle for Djinni 66.
static void BabiLighthouse_RefreshMovableBlockTiles(void)
Redraws room 3's ledge cells, then blocks the cells under its two blocks.
static void BabiLighthouse_RisePastPairedEffects(void)
Prepares two effects, raises the leader, then takes exit 13.
static void BabiLighthouse_RegroupPartyMember(s32 actorId)
A companion walks back to the leader and rejoins the party.
static void BabiLighthouse_AdvancePairAndJump(void)
Walking into one of room 3's blocks pushes it.
static void BabiLighthouse_FallToExit(s32 exit)
Arriving at one of room 2's drop entrances: the leader drops in and falls on, out through the given e...
struct SceneRegion gBabiLighthouse_Regions3[]
static void BabiLighthouse_RisePastSingleEffect(void)
Prepares one effect, raises the leader, then takes exit 12.
s32 BabiLighthouse_SetupScene(void)
Sets up the scene being entered: Retreat leads back to room 3; the site's block, room 3's blocks,...
struct ScenePlacement gBabiLighthouse_PlacementsOther[]
const s32 * gEffectScripts[]
struct SceneEntrance gBabiLighthouse_Entrances3[]
struct SceneEvent gBabiLighthouse_Events2[]
struct ScenePlacement gBabiLighthouse_NoPlacements[]
static void BabiLighthouse_OpenGrowthPassage(void)
Growth on room 3's sprout: it grows into a vine the party can climb.
s32 gBabiLighthouse_TrembleScript[]
@ ACTOR_RIGHT_BLOCK
@ ACTOR_FIRST_FALLEN_MAN
@ ACTOR_LEFT_BLOCK
static void BabiLighthouse_EnableChildOption(void)
Carry's first phase on the building site's block sets the effect's childOption; what that changes is ...
static void BabiLighthouse_JumpFromLedge(void)
After Move on one of room 3's blocks, or a push: a leader left standing on a block's ledge cell jumps...
static void BabiLighthouse_ClimbOrAdvancePair(void)
Tries vertical climbing first, then advances the staged pair when appropriate.
struct ScenePlacement gBabiLighthouse_Placements2[]
static void BabiLighthouse_AdvanceNearbyPair(void)
Advances the staged pair only when the actor ahead is less than eight pixels away vertically.
@ ACTOR_FARAN
@ ACTOR_SECOND_ONLOOKER
@ ACTOR_WITNESS
@ ACTOR_RIGHT_DOOR
@ ACTOR_IODEM
@ ACTOR_FIRST_ONLOOKER
@ ACTOR_LEFT_DOOR
static void BabiLighthouse_DiscussPursuit(void)
Walking up to room 1's stone door the first time: Faran asks whether the kidnappers really went throu...
static void BabiLighthouse_OpenTruthDoor(void)
The stone door's halves slide open (SE_GATE_MOVE); the first time, Iodem and Faran see it.
s32 gEffectScript1[]
struct SceneEntrance gBabiLighthouse_Entrances2[]
@ FLAG_GROWTH_PASSAGE_OPEN
Growth has grown room 3's sprout into a vine.
@ FLAG_BEYOND_DOOR
The party is on the far side of room 1's stone door.
static void BabiLighthouse_CloseTruthDoor(void)
Walking through the open door: it slides shut behind the party, now on its other side.
static void BabiLighthouse_InspectTruthDoorSwitch(void)
Searching the door's switch: under Reveal's light it is flipped and the door opens; otherwise it read...
static __inline__ s32 UNUSED Entrance_Divide(s32 dividend, s32 divisor)
Unused: a signed division nothing calls.
struct ScenePlacement gBabiLighthouse_Placements1[]
struct SceneEntrance gBabiLighthouse_Entrances1[]
s32 gEffectScript2[]
static void BabiLighthouse_LandWithParticles(void)
Arriving by falling from the floor above: the leader drops in, lands with a thud that shakes the scre...
struct ScenePlacement gBabiLighthouse_Placements3[]
static struct FieldActor * BabiLighthouse_FindActorAhead(struct FieldActor *actor)
Finds the staged actor one direction-table step ahead, including terrain height.
struct SceneEvent gBabiLighthouse_Events3[]
Calls through a function pointer, by argument count.
#define GARET
Jerald.
#define MIA
Mary.
#define IVAN
Ivan.
s32 Field_ClimbUp(void)
Climbing up (the player presses up at a climbable wall).
Definition climbing.c:196
s32 Field_ClimbDown(void)
Climbing down (the player presses down at a climbable wall).
Definition climbing.c:119
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine calls the debug menus import, and their palette swatch tiles.
Djinn numbers, named from the English release.
@ DJINNI_LUFF
Definition djinn_ids.h:38
static void FieldBattleFx_RunRisingObjectSequence(s32 actor, s32 mode, s32 action)
Definition engine_call.h:60
Field effects, their scripts and the flags that spawn them.
@ EFFECT_USE_PALETTE
options.palette, as its group child value
@ EFFECT_USE_UPDATE
options.update
@ EFFECT_USE_START_SCALE
options.startScaleX and startScaleY
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 s32 Event_OpenMessage(s32 speaker, s32 flags)
static void Actor_SetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
#define GameFlag_IsSet
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
#define EMOTE_IN_FRONT
Definition field_event.h:49
s32 Engine_MathSin(s32 angle)
void Engine_EventCloseScreen(void)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
#define GameFlag_Clear
void Engine_EventWaitForScreen(void)
#define GameFlag_Set
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
static void Actor_WalkByAndWait(s32 actor, s32 dx, s32 dz)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
void Engine_MapRenderWaitForValues(void)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
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)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
s32 Engine_MathCos(s32 angle)
static void Actor_WalkBy(s32 actor, s32 dx, s32 dz)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
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)
static void Map_CopyCellsLayered(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
void Engine_ActorSetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
static struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ TRANSITION_WINDOW
Definition field_obj.h:17
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
Definition field_obj.h:145
#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
#define FIND_ITEM(item)
@ EVENT_TOUCH
@ EVENT_EXIT
@ EVENT_TALK
@ FACING_STEP
Definition field_scene.h:36
#define PSYNERGY_PHASE_ON_ACTOR(ability, phase)
A Psynergy event on an actor at one phase of the cast, as PSYNERGY_IN_AREA is for an area.
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define PSYNERGY_IN_AREA(ability, phase)
#define IF_FLAG_SET(flag)
Definition field_scene.h:48
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
@ ACTOR_PARTY_LEADER
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ TALK_KEEP_FACING
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
@ 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
@ FACING_NORTHEAST
Definition field_scene.h:33
@ FACING_EAST
Definition field_scene.h:26
@ FACING_SOUTHEAST
Definition field_scene.h:27
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_NORTHWEST
Definition field_scene.h:31
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
@ SEARCH_UNNAMED
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void FieldMotion_LaunchFromFocusedObject(s32 actor, s32 dx, s32 dz, s32 facing)
static void FieldObjectMotion_OffsetPositionAndResetMotion(s32 a0, s32 a1, s32 a2)
Game flags, named where their meaning is shown.
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
Definition flags.h:15
#define FLAG_BABI_LIGHTHOUSE_ROOM2_ENTRANCE_10_USED
Arrival through room 2's entrance 10 changes its tiles and collision; entrances 10 and 11 restore tho...
Definition flags.h:178
#define FLAG_KEEP_PARTY_POSITION
Definition flags.h:93
#define FLAG_BABI_LIGHTHOUSE_PURSUIT_ASKED
Iodem and Faran have asked the party to follow Sheba's kidnappers.
Definition flags.h:182
#define FLAG_BABI_LIGHTHOUSE_DOOR_SHOWN
The party has opened the door before Iodem and Faran, who stay behind.
Definition flags.h:187
#define FLAG_IODEM_AT_BABI_LIGHTHOUSE
Set with it: Iodem has come to Babi Lighthouse, and from then on he no longer leaves the party in Suh...
Definition flags.h:185
#define FLAG_BABI_LIGHTHOUSE_LUCKY_PEPPER
the building site's chest
Definition flags.h:188
#define FLAG_BABI_LIGHTHOUSE_DOOR_OPEN
The stone door that Reveal's switch opens stands open.
Definition flags.h:180
BattleFxScene, the work of a battle or field Psynergy effect scene, and its arc objects.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
void * gEffectWork
Slot 56: points to a scene-specific structure.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
Item numbers, named from the English release.
@ ITEM_LUCKY_PEPPER
Definition item_ids.h:55
Small statement macros both games use for positions, velocities and bounds.
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
Definition macros.h:12
Declares nothing of its own: it only includes edition.h and types.h.
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_FOREVER
Definition objcmd.h:14
#define SC_TO(n)
Definition objcmd.h:12
#define SC_ADD(w, v)
Definition objcmd.h:38
#define SC_WAIT(n)
Wait n frames.
Definition objcmd.h:16
#define SC_TOP
Script start.
Definition objcmd.h:13
@ SW_SCALE_Y
Definition objcmd.h:63
@ SW_SCALE_X
Definition objcmd.h:62
void Battle_ResetEffectCounter(void)
Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs i...
Definition targets.c:261
void Field_RequestDjinnBattle(s32 flag, s32 no)
Sets up the battle with Djinni number no.
Definition requests.c:35
Scene numbers, named after their places.
char SceneId_BabiLighthouse2
char SceneId_BabiLighthouse1
char SceneId_BabiLighthouse4
char SceneId_BabiLighthouse3
Declares nothing of its own: it only includes types.h.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_GATE_MOVE
Definition songs.h:152
#define SE_204
Definition songs.h:199
#define SE_155
Definition songs.h:150
#define SE_188
Definition songs.h:183
The sprite view a scene's configured effect spawner uses.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_TaskWait()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
The pushable actors' movement probes and footprint bounds.
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
struct AnimationSpritePart image
Definition animspr.h:109
u16 priority
2 when created
Definition animspr.h:100
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
Definition fx_scene.h:31
s8 childOption
Set by some scenes before an effect; Carry, Frost, Force and Reveal treat the target differently with...
Definition fx_scene.h:52
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s32 palette
passed to ObjectGroup_SetChildValue
s32 startScaleY
16.16 fixed point, 0x10000 full size
s32 startScaleX
16.16 fixed point, 0x10000 full size
void(*) update(union FieldObject *object)
replaces the update hook
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
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
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:59
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
s32 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
Definition field_obj.h:64
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
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Definition field_obj.h:116
u16 wait
the object script's wait, in frames (ScriptMotionObject)
Definition field_obj.h:98
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
u8 terrainId
The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the ce...
Definition field_obj.h:47
A position on the field.
s32 z
16.16 fixed-point pixels
The game's state: play time, coins, the scene and the leader's position, the active party and the opt...
Definition game_state.h:14
s32 z
16.16 fixed-point pixels
Definition game_state.h:52
s16 retreatEntrance
where Retreat goes; the group's first entrance
Definition game_state.h:109
s16 retreatScene
where Retreat goes; the group's first entrance
Definition game_state.h:108
s16 entrance
Definition game_state.h:37
s32 x
16.16 fixed-point pixels
Definition game_state.h:50
u8 movementMode
1 while the leader is climbing, 0 otherwise
Definition game_state.h:57
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
Definition field_scene.h:54
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
Definition field_scene.h:81
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
s32 Map_GetTerrainHeight(s32 layer, s32 x, s32 y)
Returns the ground height of a layer at (x, y) in 16.16 pixels: the height function of the cell's ter...
Definition terrain.c:343
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
#define UNUSED
Definition types.h:22
unsigned char u8
Definition types.h:11
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct FieldActor actor
The patch levels: our groups of the measured changes from the Japanese release.