Alchemy
Loading...
Searching...
No Matches

goma_cave_pillar.c File Reference

Goma Cave: the room with two pillars, a stump and the Djinni Forge. More...

Go to the source code of this file.

Macros

#define FLAG_GOMA_CAVE_STUMP_FELL   0x300
 pushed over into the room below
#define FLAG_GOMA_CAVE_EAST_PILLAR_IN_PLACE   0x301
 sunk into its place
#define FLAG_GOMA_CAVE_WEST_PILLAR_MOVED   0x302
 one step east of its start
#define WEST_PILLAR   8
#define STUMP   9
#define EAST_PILLAR   10
#define FORGE   12
#define WITNESS   13
 the man who fought Forge and lost it
#define DIRECTION_STEP(dx, dz)
 One step per facing: X pixels in the high halfword, Z pixels in the low half.

Enumerations

enum  GomaCavePillarFragmentPlane { PLANE_XY = 0 , PLANE_XZ = 1 , PLANE_YZ = 2 }

Functions

static void Event_FightForge (void)
 Talking to Forge: the man beside it jumps in surprise, and the battle with the Djinni begins.
static void GomaCavePillar_UpdateFragment (union FieldObject *fieldObject)
 Advances the fragment's selected coordinate plane and keeps its targets in step.
static s32 GomaCavePillar_FinishFragment (struct ScriptInterpreter *interpreter)
 Applies child value 15 at the end of a fragment's lifetime.
static void GomaCavePillar_SpawnFragment (s32 x, s32 y, s32 z, s32 firstRate, s32 secondRate, s32 scriptAndChildValue, s32 planeAndPriority)
 Creates a fragment with two axis rates, a script and packed plane/priority.
const struct SceneEntrance * Scene_GetEntrances (void)
const struct SceneRegion * Scene_GetRegions (void)
const u32 * Scene_GetExits (void)
 Both scenes share one exit table.
const struct ScenePlacement * Scene_GetPlacements (void)
static void GomaCavePillar_CopyWestPillarCells (s32 sourceColumn)
 Copies the map cells for the west pillar on either side of its track.
static void Event_MoveWestPillar (void)
 Move on the west pillar: it slides between its two places, and the map cells follow it.
static void GomaCavePillar_SpawnStumpDust (void)
 While the stump teeters, dust falls from it: one fragment every eighth frame, two on every sixteenth.
static void Event_PushStumpOver (void)
 Move on the stump: once it is pushed to the edge (column 25), it teeters shedding dust, tips over and falls into the room below with a crash that shakes the screen.
static void GomaCavePillar_SettleEastPillar (void)
 Once the east pillar reaches its place (cell 38, 14), it sinks two pixels into the floor and six fragments fly out around it.
static void Event_MoveEastPillar (void)
 Move on the east pillar.
static void Event_PushEastPillar (void)
 Walking into the east pillar pushes it a step.
static void Event_JumpGapWest (void)
 Walking west at the gap: the leader jumps across it.
const struct SceneEvent * Scene_GetEvents (void)
static void GomaCavePillar_FidgetWhileForgeFights (void)
 While the battle with Forge runs, the man reacts on a timer; once the Djinni event is over, it raises event 99.
static void Event_WitnessCheersForgeCaught (void)
 Raised once Forge is caught: the man is amazed, then walks off.
s32 Scene_Initialize (void)
 Puts the pillars and the stump where the party left them.

Variables

s32 gGomaCavePillar_WitnessFrames
s32 gStagedActor_DirectionSteps []
 Pixel step by direction: X in the upper halfword, Z in the lower.
u32 gStagedActor_FootprintKinds []
s32 gStagedActor_FootprintBounds []
struct GomaCavePillarFragmentScripts gGomaCavePillar_FragmentScripts
s32 gGomaCavePillar_FragmentScript0 []
s32 gGomaCavePillar_FragmentScript1 []
s32 gGomaCavePillar_FragmentScript2 []
struct SceneEntrance gGomaCavePillar_Entrances []
u32 gGomaCavePillar_Exits []
struct ScenePlacement gGomaCavePillar_Placements []
struct SceneEvent gGomaCavePillar_Events []

Detailed Description

Goma Cave: the room with two pillars, a stump and the Djinni Forge.

Definition in file goma_cave_pillar.c.

Macro Definition Documentation

◆ FLAG_GOMA_CAVE_STUMP_FELL

#define FLAG_GOMA_CAVE_STUMP_FELL   0x300

pushed over into the room below

Definition at line 46 of file goma_cave_pillar.c.

Referenced by Event_PushStumpOver(), and Scene_Initialize().

◆ FLAG_GOMA_CAVE_EAST_PILLAR_IN_PLACE

#define FLAG_GOMA_CAVE_EAST_PILLAR_IN_PLACE   0x301

sunk into its place

Definition at line 47 of file goma_cave_pillar.c.

Referenced by GomaCavePillar_SettleEastPillar(), and Scene_Initialize().

◆ FLAG_GOMA_CAVE_WEST_PILLAR_MOVED

#define FLAG_GOMA_CAVE_WEST_PILLAR_MOVED   0x302

one step east of its start

Definition at line 48 of file goma_cave_pillar.c.

Referenced by Event_MoveWestPillar(), and Scene_Initialize().

◆ WEST_PILLAR

#define WEST_PILLAR   8

Definition at line 53 of file goma_cave_pillar.c.

◆ STUMP

#define STUMP   9

Definition at line 54 of file goma_cave_pillar.c.

◆ EAST_PILLAR

#define EAST_PILLAR   10

Definition at line 55 of file goma_cave_pillar.c.

◆ FORGE

#define FORGE   12

Definition at line 56 of file goma_cave_pillar.c.

Referenced by Event_FightForge().

◆ WITNESS

#define WITNESS   13

the man who fought Forge and lost it

Definition at line 57 of file goma_cave_pillar.c.

Referenced by Event_FightForge(), Event_WitnessCheersForgeCaught(), and GomaCavePillar_FidgetWhileForgeFights().

◆ DIRECTION_STEP

#define DIRECTION_STEP ( dx,
dz )
Value:
(((u32)(dx) << 16) | ((dz) & 0xffff))
unsigned int u32
Definition types.h:15

One step per facing: X pixels in the high halfword, Z pixels in the low half.

Definition at line 545 of file goma_cave_pillar.c.

Enumeration Type Documentation

◆ GomaCavePillarFragmentPlane

Enumerator
PLANE_XY 
PLANE_XZ 
PLANE_YZ 

Definition at line 50 of file goma_cave_pillar.c.

Function Documentation

◆ Event_FightForge()

void Event_FightForge ( void )
static

Talking to Forge: the man beside it jumps in surprise, and the battle with the Djinni begins.

Definition at line 64 of file goma_cave_pillar.c.

Referenced by Event_FightForge().

◆ GomaCavePillar_UpdateFragment()

void GomaCavePillar_UpdateFragment ( union FieldObject * fieldObject)
static

Advances the fragment's selected coordinate plane and keeps its targets in step.

Definition at line 72 of file goma_cave_pillar.c.

Referenced by GomaCavePillar_SpawnFragment(), and GomaCavePillar_UpdateFragment().

◆ GomaCavePillar_FinishFragment()

s32 GomaCavePillar_FinishFragment ( struct ScriptInterpreter * interpreter)
static

Applies child value 15 at the end of a fragment's lifetime.

Definition at line 101 of file goma_cave_pillar.c.

Referenced by GomaCavePillar_FinishFragment().

◆ GomaCavePillar_SpawnFragment()

void GomaCavePillar_SpawnFragment ( s32 x,
s32 y,
s32 z,
s32 firstRate,
s32 secondRate,
s32 scriptAndChildValue,
s32 planeAndPriority )
static

Creates a fragment with two axis rates, a script and packed plane/priority.

Definition at line 108 of file goma_cave_pillar.c.

Referenced by Event_PushStumpOver(), GomaCavePillar_SettleEastPillar(), GomaCavePillar_SpawnFragment(), and GomaCavePillar_SpawnStumpDust().

◆ Scene_GetEntrances()

const struct SceneEntrance * Scene_GetEntrances ( void )

Definition at line 147 of file goma_cave_pillar.c.

◆ Scene_GetRegions()

const struct SceneRegion * Scene_GetRegions ( void )

Definition at line 151 of file goma_cave_pillar.c.

◆ Scene_GetExits()

const u32 * Scene_GetExits ( void )

Both scenes share one exit table.

Definition at line 153 of file goma_cave_pillar.c.

◆ Scene_GetPlacements()

const struct ScenePlacement * Scene_GetPlacements ( void )

Definition at line 155 of file goma_cave_pillar.c.

◆ GomaCavePillar_CopyWestPillarCells()

void GomaCavePillar_CopyWestPillarCells ( s32 sourceColumn)
inlinestatic

Copies the map cells for the west pillar on either side of its track.

Definition at line 160 of file goma_cave_pillar.c.

Referenced by Event_MoveWestPillar(), GomaCavePillar_CopyWestPillarCells(), and Scene_Initialize().

◆ Event_MoveWestPillar()

void Event_MoveWestPillar ( void )
static

Move on the west pillar: it slides between its two places, and the map cells follow it.

Definition at line 166 of file goma_cave_pillar.c.

◆ GomaCavePillar_SpawnStumpDust()

void GomaCavePillar_SpawnStumpDust ( void )
static

While the stump teeters, dust falls from it: one fragment every eighth frame, two on every sixteenth.

Definition at line 188 of file goma_cave_pillar.c.

Referenced by Event_PushStumpOver(), and GomaCavePillar_SpawnStumpDust().

◆ Event_PushStumpOver()

void Event_PushStumpOver ( void )
static

Move on the stump: once it is pushed to the edge (column 25), it teeters shedding dust, tips over and falls into the room below with a crash that shakes the screen.

Definition at line 258 of file goma_cave_pillar.c.

Referenced by Event_PushStumpOver(), and Scene_Initialize().

◆ GomaCavePillar_SettleEastPillar()

void GomaCavePillar_SettleEastPillar ( void )
static

Once the east pillar reaches its place (cell 38, 14), it sinks two pixels into the floor and six fragments fly out around it.

Definition at line 347 of file goma_cave_pillar.c.

Referenced by Event_MoveEastPillar(), Event_PushEastPillar(), and GomaCavePillar_SettleEastPillar().

◆ Event_MoveEastPillar()

void Event_MoveEastPillar ( void )
static

Move on the east pillar.

Definition at line 386 of file goma_cave_pillar.c.

◆ Event_PushEastPillar()

void Event_PushEastPillar ( void )
static

Walking into the east pillar pushes it a step.

Definition at line 393 of file goma_cave_pillar.c.

Referenced by Event_PushEastPillar(), and Event_PushEastPillar().

◆ Event_JumpGapWest()

void Event_JumpGapWest ( void )
static

Walking west at the gap: the leader jumps across it.

Later patches use the shared forward jump.

Definition at line 402 of file goma_cave_pillar.c.

Referenced by Event_JumpGapWest().

◆ Scene_GetEvents()

const struct SceneEvent * Scene_GetEvents ( void )

Definition at line 440 of file goma_cave_pillar.c.

◆ GomaCavePillar_FidgetWhileForgeFights()

void GomaCavePillar_FidgetWhileForgeFights ( void )
static

While the battle with Forge runs, the man reacts on a timer; once the Djinni event is over, it raises event 99.

Definition at line 446 of file goma_cave_pillar.c.

Referenced by Event_WitnessCheersForgeCaught(), GomaCavePillar_FidgetWhileForgeFights(), and Scene_Initialize().

◆ Event_WitnessCheersForgeCaught()

void Event_WitnessCheersForgeCaught ( void )
static

Raised once Forge is caught: the man is amazed, then walks off.

Definition at line 473 of file goma_cave_pillar.c.

Referenced by Event_WitnessCheersForgeCaught().

◆ Scene_Initialize()

s32 Scene_Initialize ( void )

Puts the pillars and the stump where the party left them.

Sets up whichever scene is being entered and runs its arrival events.

Entrance 99 shows the stump falling again; after a Djinni battle, the man's reaction starts.

Definition at line 496 of file goma_cave_pillar.c.

Variable Documentation

◆ gGomaCavePillar_WitnessFrames

s32 gGomaCavePillar_WitnessFrames

Definition at line 253 of file goma_cave_pillar.c.

Referenced by GomaCavePillar_FidgetWhileForgeFights(), and Scene_Initialize().

◆ gStagedActor_DirectionSteps

s32 gStagedActor_DirectionSteps[]
Initial value:
= {
DIRECTION_STEP(0, 16), DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0),
DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0), DIRECTION_STEP(0, -16),
DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16),
}
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.

Pixel step by direction: X in the upper halfword, Z in the lower.

Definition at line 547 of file goma_cave_pillar.c.

◆ gStagedActor_FootprintKinds

u32 gStagedActor_FootprintKinds[]
Initial value:
= {
207, 205, 228, 229, 298, 297,
}

Definition at line 557 of file goma_cave_pillar.c.

◆ gStagedActor_FootprintBounds

s32 gStagedActor_FootprintBounds[]
Initial value:
= {
-32, -8, 32, 8,
-8, -32, 8, 32,
-32, -16, 32, 0,
-8, -32, 8, 32,
-32, -8, 32, 8,
-8, -32, 8, 32,
}

Definition at line 561 of file goma_cave_pillar.c.

◆ gGomaCavePillar_FragmentScripts

struct GomaCavePillarFragmentScripts gGomaCavePillar_FragmentScripts
Initial value:

Definition at line 570 of file goma_cave_pillar.c.

Referenced by GomaCavePillar_SpawnFragment().

◆ gGomaCavePillar_FragmentScript0

s32 gGomaCavePillar_FragmentScript0[]
Initial value:
= {
SC_WAIT(1),
SC_WAIT(1),
}
static s32 GomaCavePillar_FinishFragment(struct ScriptInterpreter *interpreter)
Applies child value 15 at the end of a fragment's lifetime.
#define SC_LOOP(n, to)
Repeat up to n times.
Definition objcmd.h:28
#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_CALL(fn)
Definition objcmd.h:50

Definition at line 576 of file goma_cave_pillar.c.

◆ gGomaCavePillar_FragmentScript1

s32 gGomaCavePillar_FragmentScript1[]
Initial value:

Definition at line 584 of file goma_cave_pillar.c.

◆ gGomaCavePillar_FragmentScript2

s32 gGomaCavePillar_FragmentScript2[]
Initial value:

Definition at line 592 of file goma_cave_pillar.c.

◆ gGomaCavePillar_Entrances

struct SceneEntrance gGomaCavePillar_Entrances[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 88, 0, 184, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
{ 2, CONDITION_ALWAYS, 584, 0, 184, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
{ 3, CONDITION_ALWAYS, 520, 0, 232, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
{ 4, CONDITION_ALWAYS, 232, 0, 184, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
{ 5, CONDITION_ALWAYS, 536, 0, 408, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
{ 99, CONDITION_ALWAYS, 376, 0, 200, FACING_SOUTH, 0, 8, 8, 728, 504, 0 },
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_SOUTH
Definition field_scene.h:28

Definition at line 600 of file goma_cave_pillar.c.

Referenced by Scene_GetEntrances().

◆ gGomaCavePillar_Exits

u32 gGomaCavePillar_Exits[]
Initial value:
= {
SCENE_EXIT(1, 28, 2),
SCENE_EXIT(2, 26, 1),
SCENE_EXIT(3, 26, 2),
SCENE_EXIT(4, 26, 3),
SCENE_EXIT(5, 28, 3),
}
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
#define SCENE_EXITS_END
Definition field_scene.h:77

Definition at line 611 of file goma_cave_pillar.c.

Referenced by Scene_GetExits().

◆ gGomaCavePillar_Placements

struct ScenePlacement gGomaCavePillar_Placements[]
Initial value:
= {
}
@ DJINNI_FORGE
Definition djinn_ids.h:25
@ TALK_KEEP_FACING
@ TALK_FACE_PARTY
@ TALK_FACE_PARTY_AND_BACK
@ ACTOR_STAND
@ FACING_SOUTHEAST
Definition field_scene.h:27
#define PIXELS(value)
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
Definition flags.h:15
#define FLAG_GOMA_CAVE_WITNESS_LEFT
after the party caught Forge
Definition flags.h:601

Definition at line 621 of file goma_cave_pillar.c.

Referenced by Scene_GetPlacements().

◆ gGomaCavePillar_Events

struct SceneEvent gGomaCavePillar_Events[]
Initial value:
= {
{ 0x21, 5, CONDITION_ALWAYS, 1 },
{ 0x31, 6, CONDITION_ALWAYS, 2 },
{ 0x31, 7, CONDITION_ALWAYS, 3 },
{ 0x31, 8, CONDITION_ALWAYS, 4 },
{ 0x21, 9, CONDITION_ALWAYS, 5 },
{ EVENT_TALK, WITNESS, 0xa8, MSGNO(MsgVaultDidYouSeeSomethingStrangeOver) },
{ EVENT_TALK, WITNESS, CONDITION_ALWAYS, MSGNO(MsgVaultHmmmItMustBeHidingSomewhere) },
{ PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), WITNESS, 0xa8, MSGNO(MsgVaultItJustWhackedMeInThe) },
{ PSYNERGY_ON_ACTOR(ABILITY_MIND_READ), WITNESS, CONDITION_ALWAYS, MSGNO(MsgVaultIKnowitsKindItllBeBack) },
}
@ ABILITY_MIND_READ
Definition ability_ids.h:16
@ ABILITY_MOVE
Definition ability_ids.h:15
#define SCENE_EVENTS_END
#define FIND_ITEM(item)
@ EVENT_TOUCH
@ EVENT_TALK
@ EVENT_RAISED
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define SEARCH(target)
#define TOUCH_WALKING_INTO(facing)
@ FACING_WEST
Definition field_scene.h:30
@ SEARCH_CHEST
#define STUMP
#define WEST_PILLAR
static void Event_MoveWestPillar(void)
Move on the west pillar, and after each push: the pillar stands on one of three columns,...
#define EAST_PILLAR
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.
#define FLAG_GOMA_CAVE_EAST_PILLAR_IN_PLACE
sunk into its place
static void Event_PushEastPillar(void)
Walking into the east pillar pushes it a step.
static void Event_WitnessCheersForgeCaught(void)
Raised once Forge is caught: the man is amazed, then walks off.
static void Event_PushStumpOver(void)
Move on the stump: once it is pushed to the edge (column 25), it teeters shedding dust,...
#define FLAG_GOMA_CAVE_STUMP_FELL
pushed over into the room below
#define WITNESS
the man who fought Forge and lost it
static void Event_FightForge(void)
Talking to Forge: the man beside it jumps in surprise, and the battle with the Djinni begins.
static void Event_JumpGapWest(void)
Walking west at the gap: the leader jumps across it.
#define FORGE
@ ITEM_LUCKY_MEDAL
Definition item_ids.h:70

Definition at line 631 of file goma_cave_pillar.c.

Referenced by Scene_GetEvents().