Alchemy
Loading...
Searching...
No Matches

goma_cave_entrance.c

Go to the documentation of this file.
1/// @file
2/// Goma Cave's entrance: the stump caught in ivy, the two pillars, and Ivan,
3/// who rejoins the party and blows the ivy away with Whirlwind.
5#include "version.h"
9#include "unit/game/game.h"
10#include "battle.h"
11#include "field.h"
12#include "menu.h"
13#include "system.h"
14#include "field_obj.h"
15#include "types.h"
16#include "field_event.h"
17#include "field_scene.h"
19#include "debug.h"
20#include "game.h"
21#include "graphics.h"
22#include "minigame.h"
23#include "sound.h"
24#include "edition.h"
25#include "call.h"
26#include "battle_system.h"
27#include "battle_unit.h"
28#include "item.h"
29#include "inventory.h"
30#include "text/msg_ids.h"
31#include "objcmd.h"
32#include "global_cells.h"
33#include "ability_ids.h"
34#include "macros.h"
35#include "flags.h"
36#include "songs.h"
37#include "event.h"
38#include "item_ids.h"
39#include "vector3.h"
40
41// The room's actors: Garet and Ivan take their party slots, the rest follow
42// the placement table from 8.
43#define STUMP 8
44#define WEST_PILLAR 9
45#define EAST_PILLAR 10
46#define STUMP_IVY 15 ///< the ivy holding the stump
47#define IVY 16
48
49// Private scene actions used by the reunion sequence.
51static void GomaCaveEntrance_LeapStump(s32 id);
52static void GomaCaveEntrance_GiveShamansRod(void);
53
54// Shared effects stay at their native positions in the overlay.
56#include "common/effect_spawn.h"
57
58/// Shows the next message over the speaker, then pauses.
59static void GomaCaveEntrance_SayThenWait(s32 actorId, s32 frames) {
60 MESSAGE_PUT(actorId, 0);
61 WAIT(frames);
62}
63
64const struct SceneEntrance *Scene_GetEntrances(void) {
66}
67
68const struct SceneRegion *Scene_GetRegions(void) { return NULL; }
69
71
74}
75
76/// Move on the west pillar, and after each push: the pillar stands on one of
77/// three columns, and the map cells and flags follow it.
78static void Event_MoveWestPillar(void) {
79 struct FieldActor *pillar;
80 s32 column;
81
83 column = pillar->x.fixed / PIXELS(16);
86 if (column == 15) {
87 Map_CopyCellAttributes(47, 18, 1, 2, 16, 18);
88 } else if (column == 16) {
89 Map_CopyCellAttributes(48, 18, 1, 2, column, 18);
91 } else {
92 Map_CopyCellAttributes(47, 18, 1, 2, 16, 18);
94 }
95}
96
97/// Move on the east pillar: once it reaches column 23 it settles into the floor
98/// and can be walked over.
99static void Event_MoveEastPillar(void) {
100 struct FieldActor *pillar;
101 s32 column;
102
103 pillar = Object_GetById(EAST_PILLAR);
104 column = pillar->x.fixed / PIXELS(16);
105 if (column == 23) {
106 WAIT(10);
110 Map_CopyCellAttributes(54, 17, 1, 1, column, 17);
112 }
113}
114
115/// Walking into the west pillar from the west (trigger 5) or the east
116/// (trigger 6): the leader leans on it and pushes it one step.
117static void Event_PushWestPillar(void) {
118 struct EventWork *work;
119 s32 offsetX;
120
121 work = gEventWork;
122 EV_BEGIN();
124 WAIT(20);
125 OBJ_SPEED(ACTOR_PARTY_LEADER, PIXELS(1) / 5, PIXELS(1) / 10);
126 OBJ_SPEED(WEST_PILLAR, PIXELS(1) / 5, PIXELS(1) / 10);
127 SE(SE_185);
128 // 16 pixels east from trigger 5, west from trigger 6.
129 offsetX = (11 - (work->touchedTrigger << 1)) << 4;
134 WAIT(20);
138 EV_END();
139}
140
141/// Reserved overlay hook; no current scene calls it.
142UNUSED static void GomaCaveEntrance_NoOpA(void) {}
143
144/// A second reserved hook, also unused by the scene.
145UNUSED static void GomaCaveEntrance_NoOpB(void) {}
146
147/// Whirlwind on the other ivy: it is blown away for good.
148static void Event_BlowAwayIvy(void) {
149 EV_BEGIN();
151 EV_END();
152}
153
154const struct SceneEvent *Scene_GetEvents(void) {
156}
157
158/// Puts the stump and pillars where the party left them, and the stump's ivy
159/// away once Ivan has blown it off.
161 struct FieldActor *movedObject;
162 s32 v5;
163
165 WAIT(10);
167 OBJ_MODE(11, 2);
169 {
170 struct FieldActor *record = Object_GetById(STUMP);
171
172 record->collisionFlags = 16 | record->collisionFlags;
173 }
174 {
175 struct FieldActor *record = Object_GetById(STUMP_IVY);
176
177 record->collisionFlags = 8 | record->collisionFlags;
178 }
180 Map_CopyCellAttributes(74, 11, 1, 1, 73, 11);
181 }
185 v5 = 12;
186 OBJ_MODE(STUMP, 2);
187 Map_CopyCellAttributes(39, 12, 3, 1, 8, v5);
188 Map_CopyCellAttributes(43, 11, 3, 1, v5, 11);
189 }
191 OBJ_POS_SET(WEST_PILLAR, 264, 312);
192 Map_CopyCellAttributes(48, 18, 1, 2, 16, 18);
193 } else {
195 0) {
196 OBJ_POS_SET(WEST_PILLAR, 280, 312);
197 Map_CopyCellAttributes(47, 18, 1, 2, 16, 18);
198 }
199 }
203 v5 = 0;
205 movedObject = Object_GetById(EAST_PILLAR);
206 Engine_ActorSetSpriteFlags(movedObject, 0);
207 Map_CopyCellAttributes(54, 17, 1, 1, 23, 17);
208 }
209 return 0;
210}
211
212/// Move on the stump while the ivy holds it: Garet says their Psynergy is not
213/// strong enough. Once the thieves in Vault are jailed, Ivan turns up, blows
214/// the ivy away with Whirlwind and asks to join the party, and gets back the
215/// Shaman's Rod.
216static void Event_IvanRejoins(void) {
217 struct FieldActor *leader;
218
219#if TBS_PATCH_1
221#endif
222 EV_BEGIN();
223 WAIT(30);
224 MESSAGE_SET(MsgGomaNoUsePsynergy);
225 OBJ_SPEED(ACTOR_PARTY_LEADER, 4 * PIXELS(1) / 5, 2 * PIXELS(1) / 5);
226 OBJ_SPEED(GARET, 4 * PIXELS(1) / 5, 2 * PIXELS(1) / 5);
229 if (leader != 0) {
230 Actor_SetPosition(GARET, leader->x.fixed, leader->z.fixed);
231 }
232 Actor_WalkToAndWait(GARET, 264, 168);
234 WAIT(20);
236 WAIT(20);
239 WAIT(20);
241 // Garet falls back into line.
244 if (leader != 0) {
245 Actor_SetDestination(GARET, leader->x.part.pixel, leader->z.part.pixel);
246 }
248 OBJ_POS_SET(GARET, 0, 0);
249 EV_END();
250 } else {
251 // Ivan comes up from the south: "You want to move the stump, right?"
252 OBJ_POS_SET(IVAN, 360, 248);
253 OBJ_SPEED(IVAN, 4 * PIXELS(1) / 5, 2 * PIXELS(1) / 5);
254 Actor_WalkToAndWait(IVAN, 272, 248);
255 Actor_WalkToAndWait(IVAN, 272, 208);
258 WAIT(20);
262 WAIT(20);
266 Actor_WalkToAndWait(IVAN, 264, 200);
267 OBJ_WALK(ACTOR_PARTY_LEADER, 248, 168);
268 Actor_WalkToAndWait(IVAN, 248, 184);
272 Actor_WalkToAndWait(IVAN, 232, 184);
273 WAIT(20);
274 OBJ_EMOTE(IVAN, 0x105, 60);
277 WAIT(20);
281 WAIT(20);
284 OBJ_EMOTE(ACTOR_PARTY_LEADER, 0x105, 0);
285 OBJ_EMOTE(GARET, 0x105, 60);
287 WAIT(60);
290 WAIT(60);
291 OBJ_EMOTE(IVAN, 0x106, 0);
293 WAIT(30);
298 WAIT(20);
302 WAIT(20);
304 WAIT(20);
306 // "I have a great idea. Leave it to me!": Whirlwind.
309 WAIT(20);
310#if TBS_PATCH_1
312#endif
315 Engine_ActorJump(GARET, 2, 0);
316 WAIT(20);
318 Actor_WalkToAndWait(IVAN, 264, 184);
319 WAIT(10);
323 WAIT(20);
325 WAIT(20);
327 OBJ_EMOTE(ACTOR_PARTY_LEADER, 0x105, 0);
328 OBJ_EMOTE(GARET, 0x105, 60);
329 OBJ_EMOTE(ACTOR_PARTY_LEADER, 0x101, 0);
330 OBJ_EMOTE(GARET, 0x101, 0);
331 WAIT(60);
334 WAIT(60);
337 WAIT(10);
339 OBJ_EMOTE(IVAN, 0x105, 0);
340 WAIT(60);
342 WAIT(20);
346 OBJ_EMOTE(ACTOR_PARTY_LEADER, 0x102, 0);
347 OBJ_EMOTE(GARET, 0x102, 0);
348 WAIT(60);
350 WAIT(20);
352 OBJ_EMOTE(ACTOR_PARTY_LEADER, 0x101, 0);
353 OBJ_EMOTE(GARET, 0x101, 0);
354 WAIT(80);
356 WAIT(20);
362 WAIT(60);
364 WAIT(20);
368 WAIT(80);
371 WAIT(30);
373 WAIT(20);
376 WAIT(20);
380 WAIT(20);
382 WAIT(20);
386 WAIT(20);
387 // "Please, allow me to join your quest.": Ivan rejoins with his rod.
389 WAIT(60);
392 WAIT(20);
393 Actor_WalkToAndWait(IVAN, 248, 184);
394 WAIT(20);
398 WAIT(120);
403 WAIT(20);
407 WAIT(50);
408 OBJ_SPEED(GARET, 4 * PIXELS(1) / 5, 2 * PIXELS(1) / 5);
409 OBJ_SPEED(IVAN, 4 * PIXELS(1) / 5, 2 * PIXELS(1) / 5);
410 OBJ_WALK(GARET, 248, 168);
411 Actor_WalkToAndWait(IVAN, 248, 168);
412 OBJ_POS_SET(IVAN, 0, 0);
414 OBJ_POS_SET(GARET, 0, 0);
415 Map_CopyCellAttributes(74, 11, 1, 1, 73, 11);
417 EV_END();
418 }
419}
420
421/// Move on the freed stump: from column 11 it spins, leaps away and lies where
422/// it lands.
423static void Event_MoveStump(void) {
424 s32 column;
425 struct FieldActor *stump;
426
427 EV_BEGIN();
428 column = Object_GetById(STUMP)->x.fixed >> 20;
429 if (column == 11) {
431 stump = Object_GetById(STUMP);
433 Map_CopyCellAttributes(39, 12, 3, 1, 8, 12);
434 Map_CopyCellAttributes(43, 11, 3, 1, 12, column);
436 }
437 EV_END();
438}
439
440/// Ivan casts Whirlwind on the stump's ivy, and the scene waits for it.
442 u8 *effectWork;
443
444 effectWork = gEffectWork;
447 {
448 u8 *f = (u8 *)((s32)effectWork + 0x71c);
449 s32 t = 8;
450
451 t |= *f;
452 *f = t;
453 }
457}
458
459/// The leaping stump's update hook turns its sprite a fixed amount per frame.
460static void GomaCaveEntrance_SpinStump(union FieldObject *fieldObject) {
461 struct FieldActor *obj = &fieldObject->actor;
462 struct AnimationObject *state = obj->sprite;
463 s32 v = state->rotation - 0x800;
464
465 state->rotation = v;
466}
467
468// Shared height-wait code stays at its native position in the overlay.
470
471/// The stump spins in place, leaps and lands with a shake and a ring of dust,
472/// then comes to rest a little further on.
474 struct Vector3 dir;
475 struct EffectOptions params;
476 struct Vector3 *v;
477 struct EffectOptions *p;
478 struct FieldActor *actor;
479 u32 i;
480
481 actor = Object_GetById(id);
482 actor->motionFlags = 0;
483 for (i = 0; i <= 17; i++) {
485 // The corresponding signed halfword view retains the negative literal.
486 *(s16 *)&actor->sprite->rotation += -256;
487 actor->x.fixed -= Engine_MathCos(actor->sprite->rotation) / 2;
488 actor->targetX = ACTOR_NO_TARGET;
489 }
491 OBJ_SPEED(id, PIXELS(3), 3 * PIXELS(1) / 2);
492 Engine_ActorSetDestination(id, 160, 192);
493 actor->gravity = 0xcccc;
494 actor->motionFlags = 3;
495 actor->terrainId = 0;
497 SceneActor_WaitObjectBelowHeight(actor, 0x200000);
499 Map_SetShake(0x50000, 0x50000, 0x10000);
501 Map_SetShake(-1, -1, 0xe666);
502 for (i = 0; i <= 16; i++) {
503 v = &dir;
504 SET_POSITION(v, Engine_MathCos(i << 12), 0, Engine_MathSin(i << 12));
505 v->x -= v->x / 4;
506 v->z -= v->z / 2;
507 Effect_Spawn(actor->x.fixed, actor->y.fixed, actor->z.fixed, v->x, v->y,
508 v->z, 0, NULL);
509 }
510 actor->velocityY = 0x50000;
511 Engine_ActorSetDestination(id, 139, 196);
513 SceneActor_WaitObjectBelowHeight(actor, 0x200000);
514 // UB: the native integer store aliases the update pointer. A typed clear
515 // swaps this store with the following sprite-pointer load.
516#ifdef UBFIX
517 actor->update = NULL;
518#else
519 *(s32 *)&actor->update = 0;
520#endif
521 actor->sprite->rotation = 0x1000;
522 p = &params;
523 p->type = 214;
524 p->startScaleX = 0x8000;
525 p->startScaleY = 0xcccc;
526 p->targetScaleX = 0x18000;
527 p->targetScaleY = 0x13333;
528 Effect_Spawn(actor->x.fixed, actor->y.fixed, actor->z.fixed, 0, 0, 0,
529 0x1c0000, p);
531 OBJ_MODE(id, 3);
533}
534
535// Shared inventory equipment code stays at its native overlay position.
536#include "common/item_equip.h"
537
538/// Gives Ivan the Shaman's Rod and equips it. With his items full, he drops
539/// another to make room; later patches skip items marked only indispensable.
541 struct BattleUnit *member;
542 struct ItemDefinition *item;
543 s32 tries;
544 s32 i;
545 s32 id;
546
547 id = ITEM_SHAMANS_ROD;
548 member = UnitGet(IVAN);
549 tries = 0;
550retry:
551 if (++tries > 1000) {
552#if TBS_PATCH_3
553 for (i = 0; i <= INVENTORY_SLOTS - 1; i++) {
554 item = Item_Get(member->inventory[i]);
555 if (item->flags != ITEM_INDISPENSABLE) {
557 break;
558 }
559 }
560 if (i == INVENTORY_SLOTS)
561#endif
562 member->inventory[INVENTORY_SLOTS - 1] = 0;
563 }
564 if (Inventory_AddItem(IVAN, id) == -1) {
565 for (i = 0; i <= INVENTORY_SLOTS - 1; i++) {
566 item = Item_Get(member->inventory[i]);
567 if (item->type == ITEM_TYPE_WEAPON) {
569 goto retry;
570 }
571 }
572 for (i = 0; i <= INVENTORY_SLOTS - 1; i++) {
573 item = Item_Get(member->inventory[i]);
574 if (item->type == ITEM_TYPE_NONE &&
575 (item->flags & ITEM_INDISPENSABLE) == 0 &&
576 item->useType == ITEM_USE_CONSUMED) {
578 goto retry;
579 }
580 }
581 goto retry;
582 }
583 for (i = 0; i <= INVENTORY_SLOTS - 1; i++) {
584 if (member->inventory[i] == id)
586 }
587}
588
590 SC_WAIT(1), SC_LOOP(22, SC_TOP), SC_WAIT(1),
591 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
592};
593
595 SC_WAIT(1), SC_LOOP(44, SC_TOP), SC_WAIT(1),
596 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
597};
598
600 SC_WAIT(1), SC_LOOP(126, SC_TOP), SC_WAIT(1),
601 SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
602};
603
604const s32 *gEffectScripts[] = {
608};
609
611 SC_SET(SW_SCALE_Y, 0x19999),
612 SC_END,
613};
614
616 {0, CONDITION_ALWAYS, 192, 0, 197, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
617 {1, CONDITION_ALWAYS, 96, 0, 440, FACING_NORTH, 0, -1, -1, -1, -1, 0},
618 {2, CONDITION_ALWAYS, 200, 0, 184, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
620};
621
623 SCENE_EXITS(25),
624 SCENE_EXIT(1, 28, 1),
625 SCENE_EXIT(2, 2, 4),
627};
628
629// clang-format off
632 PIXELS(8), 0, PIXELS(8), FACING_NORTH, TALK_FACE_PARTY, 0 },
634 PIXELS(8), 0, PIXELS(8), FACING_NORTH, TALK_FACE_PARTY, 0 },
636 PIXELS(192), 0, PIXELS(184), FACING_SOUTH, TALK_KEEP_FACING, 0 },
638 PIXELS(248), 0, PIXELS(312), FACING_SOUTH, TALK_KEEP_FACING, 0 },
640 PIXELS(392), 0, PIXELS(280), FACING_SOUTH, TALK_KEEP_FACING, 0 },
641 { 0xd4, CONDITION_ALWAYS, 7,
642 PIXELS(136), 0, PIXELS(280), FACING_SOUTH, TALK_KEEP_FACING, 0 },
643 { 0xd7, CONDITION_ALWAYS, 7,
644 0, 0, 0, FACING_WEST, TALK_KEEP_FACING, 0 },
645 { 0xd7, CONDITION_ALWAYS, 7,
648 0, 0, 0, FACING_SOUTH, TALK_KEEP_FACING, 0 },
650 PIXELS(191), 0, PIXELS(194), FACING_NORTH, TALK_FACE_PARTY, 0 },
652 PIXELS(200), 0, PIXELS(168), FACING_NORTH, TALK_FACE_PARTY, 0 },
653 { SCENE_TABLE_END },
654};
655
657 { EVENT_EXIT, 1, CONDITION_ALWAYS, 1 },
658 { EVENT_EXIT, 2, CONDITION_ALWAYS, 2 },
667};
668// clang-format on
Ability numbers, named from the English release.
@ ABILITY_MOVE
Definition ability_ids.h:15
@ ABILITY_WHIRLWIND
Definition ability_ids.h:13
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
const struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
const u32 * Scene_GetExits(void)
Both scenes share one exit table.
const struct SceneRegion * Scene_GetRegions(void)
s32 Scene_Initialize(void)
Sets up whichever scene is being entered and runs its arrival events.
s32 gEffectScript0[]
const s32 * gEffectScripts[]
s32 gEffectScript1[]
s32 gEffectScript2[]
#define ITEM_USE_CONSUMED
one is used up
BattleUnit_Recalculate, which recalculates a unit's stats.
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it use...
Calls through a function pointer, by argument count.
#define GARET
Jerald.
#define IVAN
Ivan.
The engine calls a scene uses to create an overlay object and set its sprite flags.
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine calls the debug menus import, and their palette swatch tiles.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
Scene commands: the all-caps macros the scene scripts are written in.
#define EV_BEGIN()
Definition event.h:30
#define OBJ_DIR(no, d, t)
Definition event.h:16
#define OBJ_POS_SET(no, x, z)
Definition event.h:13
#define EV_END()
Definition event.h:31
#define WAIT(n)
Definition event.h:7
#define OBJ_MODE(no, m)
Definition event.h:18
#define OBJ_WALK(no, x, z)
Definition event.h:14
#define MESSAGE_PUT(no, f)
Definition event.h:10
#define MESSAGE_SET(m)
Definition event.h:9
#define SE(n)
Definition event.h:28
#define FLAG_SET(f)
Definition event.h:26
#define FLAG_CHECK(f)
Definition event.h:25
#define OBJ_EMOTE(no, e, t)
Definition event.h:19
#define OBJ_SPEED(no, s, a)
Definition event.h:15
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
@ ANIM_WALK
Definition field_event.h:44
@ ANIM_STAND
Definition field_event.h:43
@ ANIM_NOD
Definition field_event.h:45
@ ANIM_SHAKE_HEAD
Definition field_event.h:46
static void Actor_SetDestination(s32 actor, s32 x, s32 z)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
#define EMOTE_IN_FRONT
Definition field_event.h:49
s32 Engine_MathSin(s32 angle)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
#define GameFlag_Clear
void Engine_MapWaitWorkValuesBelow256(void)
void Engine_GameFlagSet(s32 flag)
void Engine_ActorWaitForMove(s32 actor)
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 Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
s32 Engine_MathCos(s32 angle)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
Field objects and actors, and the scene transition styles.
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
Definition field_obj.h:155
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
Definition field_obj.h:145
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
@ EVENT_EXIT
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#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
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
@ ACTOR_STAND
#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_SOUTHWEST
Definition field_scene.h:29
@ FACING_NORTHWEST
Definition field_scene.h:31
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
Game flags, named where their meaning is shown.
#define FLAG_GOMA_CAVE_ENTRANCE_EAST_PILLAR_IN_PLACE
Definition flags.h:596
#define FLAG_GOMA_CAVE_ENTRANCE_WEST_PILLAR_TWO_STEPS
Definition flags.h:595
#define FLAG_VAULT_THIEVES_JAILED
Definition flags.h:106
#define FLAG_GOMA_CAVE_ENTRANCE_IVY_BLOWN_AWAY
Definition flags.h:600
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
Definition flags.h:55
#define FLAG_GOMA_CAVE_IVAN_REJOINED
Ivan has blown the ivy off the stump and rejoined the party.
Definition flags.h:599
#define FLAG_GOMA_CAVE_ENTRANCE_STUMP_MOVED
Definition flags.h:593
#define FLAG_GOMA_CAVE_ENTRANCE_WEST_PILLAR_ONE_STEP
Definition flags.h:594
The work slots of gWorkSlot, read through their own names.
void * gEffectWork
Slot 56: points to a scene-specific structure.
static UNUSED void GomaCaveEntrance_NoOpB(void)
A second reserved hook, also unused by the scene.
static void Event_MoveStump(void)
Move on the freed stump: from column 11 it spins, leaps away and lies where it lands.
static void GomaCaveEntrance_SayThenWait(s32 actorId, s32 frames)
Shows the next message over the speaker, then pauses.
static void Event_BlowAwayIvy(void)
Whirlwind on the other ivy: it is blown away for good.
static void GomaCaveEntrance_SpinStump(union FieldObject *fieldObject)
The leaping stump's update hook turns its sprite a fixed amount per frame.
#define STUMP
static void GomaCaveEntrance_WhirlwindOnStumpIvy(void)
Ivan casts Whirlwind on the stump's ivy, and the scene waits for it.
static void Event_PushWestPillar(void)
Walking into the west pillar from the west (trigger 5) or the east (trigger 6): the leader leans on i...
#define STUMP_IVY
the ivy holding the stump
#define IVY
#define WEST_PILLAR
s32 gGomaCaveEntranceTallIvyScript[]
struct SceneEvent gGomaCaveEntranceEvents[]
static void Event_MoveWestPillar(void)
Move on the west pillar, and after each push: the pillar stands on one of three columns,...
static UNUSED void GomaCaveEntrance_NoOpA(void)
Reserved overlay hook; no current scene calls it.
static void GomaCaveEntrance_GiveShamansRod(void)
Gives Ivan the Shaman's Rod and equips it.
#define EAST_PILLAR
struct SceneEntrance gGomaCaveEntranceEntrances[]
static void Event_MoveEastPillar(void)
Move on the east pillar: once it reaches column 23 it settles into the floor and can be walked over.
static void GomaCaveEntrance_LeapStump(s32 id)
The stump spins in place, leaps and lands with a shake and a ring of dust, then comes to rest a littl...
static void Event_IvanRejoins(void)
Move on the stump while the ivy holds it: Garet says their Psynergy is not strong enough.
u32 gGomaCaveEntranceExits[]
struct ScenePlacement gGomaCaveEntrancePlacements[]
The screen blend's globals and the graphics routines.
s32 Inventory_AddItem(s32 owner, s32 itemId)
Gives a unit one item, joining its first matching stack (up to 30) or taking the first free slot.
Definition inventory.c:144
s32 Inventory_Equip(s32 owner, s32 slot)
Equips the item in slot, clearing the equipped bit of the item of the same type it replaces.
Definition inventory.c:257
s32 Inventory_Discard(s32 owner, s32 slot)
Removes one item as Inventory_Remove does, and puts a rare item back into circulation (its counter go...
Definition inventory.c:375
gOverflowItem, an item slot the spoils code uses when items are handed out.
Items: their definitions, types, flags and effects.
@ ITEM_TYPE_NONE
not equipment: Herb, Game Ticket, the keys, unused rows
Definition item.h:44
@ ITEM_TYPE_WEAPON
swords, axes, maces, rods and staffs
Definition item.h:46
struct ItemDefinition * Item_Get(s32 item)
@ INVENTORY_SLOTS
Definition item.h:23
@ ITEM_INDISPENSABLE
Definition item.h:30
Colosso Log, River and Wall, and Goma Cave's entrance: giving a character an item and putting it on.
Item numbers, named from the English release.
@ ITEM_SHAMANS_ROD
Definition item_ids.h:20
Small statement macros both games use for positions, velocities and bounds.
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
Definition macros.h:16
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#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_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_SCALE_Y
Definition objcmd.h:63
void Field_DispatchTypeHandler(s32 kind)
Runs one step of the current Psynergy effect: 0 casts it with no target, 1 casts it on its target (se...
Definition dispatch.c:15
void Event_PrepareObjectAndApplyValue(s32 unit, s32 announce)
Adds unit to the party.
Definition events.c:165
void BattleFx_SetupObjectPair(s32 userId, s32 targetId)
Records the caster and the target of an effect.
Definition setup.c:56
void EffectRuntime_StopCurrentObject(void)
Stops the caster's per-frame hook and restores its colours.
Definition setup.c:94
void EventObject_Initialize(void)
Starts casting: the caster takes its casting pose (animation 20) and stops.
Definition setup.c:186
void BattleFx_LoadActionEffectResources(s32 abilityId, s32 mode)
Prepares the work of the Psynergy effect for ability (heap slot 56) and loads its spark tiles.
Definition setup.c:13
static void SceneActor_WaitObjectBelowHeight(struct FieldActor *object, s32 height)
Waits until the object has come down to height (16.16), a second at most.
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
Definition requests.c:102
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
Definition requests.c:90
Song and sound effect ids, indices into gSound_SongTable.
#define SE_170
Definition songs.h:165
#define SE_185
Definition songs.h:180
#define SE_CAST
Definition songs.h:149
#define SE_188
Definition songs.h:183
#define SE_141
Definition songs.h:134
struct EventWork * gEventWork
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_AudioPlayCue()
void Engine_TaskWait()
#define NULL
Definition bilibin.h:6
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
u16 rotation
1/65536 turns
Definition animspr.h:118
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s16 type
the object type to create; 222 without the flag
s32 targetScaleY
16.16 fixed point, 0x10000 full size
s32 targetScaleX
16.16 fixed point, 0x10000 full size
s32 startScaleY
16.16 fixed point, 0x10000 full size
s32 startScaleX
16.16 fixed point, 0x10000 full size
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
Definition event_work.h:20
s16 touchedTrigger
the step event a touch or exit event answers
Definition event_work.h:26
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:59
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
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
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Definition field_obj.h:116
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
An item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the...
Definition item.h:104
u8 useType
what using it costs (ITEM_USE_), or 0 for nothing
Definition item.h:113
u8 type
enum ItemType; 0 for an item that is not equipment
Definition item.h:106
u8 flags
enum ItemFlags
Definition item.h:107
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...
Three coordinates, x, y and z: a position, a velocity or a direction.
Definition vector3.h:11
s32 z
Definition vector3.h:24
s32 x
Definition vector3.h:22
s32 y
Definition vector3.h:23
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12
#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
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
Definition units.c:73
Vector3, a three-coordinate vector.
The patch levels: our groups of the measured changes from the Japanese release.