Alchemy

mogall_forest.c

Mogall Forest's three areas.

games/tbs/src/scene/mogall_forest.c on GitHub

Mogall Forest's three areas. Apes (sprite 0xbf) hide in the undergrowth; Force on a hiding place (an invisible actor, sprite 0x16, on the same spot) brings one out. Most point the way on and leave; the hostile ones attack, fought as encounter table 53 slot 0, the "Ape", and the last is the Killer Ape of slot 1. Logs (sprites 0xcd and 0xcf) can be pushed into the river.

Functions

MogallForest_StartDjinnBattle

static void MogallForest_StartDjinnBattle(void)

Talking to Quartz in the second area: the Djinni battle (Djinni 2).

Used by gMogallForestEvents2.

Line 146

MogallForest_TryJumpLeaderTo

static s32 MogallForest_TryJumpLeaderTo(struct FieldPosition *position)

Jumps the leader to an unobstructed fixed-point position and restores motion.

Used by MogallForest_FirstArea_JumpNorth, MogallForest_FirstArea_JumpSouth, MogallForest_ThirdArea_JumpWest.

Line 152

MogallForest_CopyTimerToChild

static s32 MogallForest_CopyTimerToChild(struct ScriptInterpreter *interpreter)

Script command: the actor shows the part its timer names.

Used by gMogallForestPlacements2_0, gMogallForest_ActorScript.

Line 186

MogallForest_ClearActorSpriteFlags

static s32 MogallForest_ClearActorSpriteFlags(struct ScriptInterpreter *interpreter)

Clears the actor sprite flags when its script requests it.

Used by gMogallForestPlacements1_1, gMogallForest_ActorScript.

Line 194

MogallForest_HopActorTo

static void MogallForest_HopActorTo(s32 actorId, s32 targetX, s32 targetZ, s32 verticalSpeed)

Hops an actor to a pixel destination with the requested vertical speed.

Used by MogallForest_ApeLeadsToKillerApe, MogallForest_FirstArea_ApeAttacks, MogallForest_FirstArea_EastApeShowsWay, MogallForest_FirstArea_NorthApeShowsWay, MogallForest_Initialize, MogallForest_KillerApeAttacks, MogallForest_SecondArea_EastApeShowsWay, MogallForest_SecondArea_NorthApeShowsWay, MogallForest_SecondArea_SouthApeHidesAgain, MogallForest_SecondArea_SouthApeShowsWay, MogallForest_ThirdArea_ApeAttacks, MogallForest_ThirdArea_CentralApeShowsWay, MogallForest_ThirdArea_EastApeHidesAgain, MogallForest_ThirdArea_EastApeShowsWay, MogallForest_ThirdArea_WestApeShowsWay.

Line 202

MogallForest_SpawnPuffRing

static void MogallForest_SpawnPuffRing(s32 id)

Scatters a complete ring of rising puffs around an actor.

Used by MogallForest_ApeComesOut, MogallForest_Initialize, MogallForest_KillerApeAttacks, MogallForest_SecondArea_SouthApeHidesAgain, MogallForest_ThirdArea_EastApeHidesAgain.

Line 221

MogallForest_ApeComesOut

static void MogallForest_ApeComesOut(s32 actorId, s32 drawParameter)

The camera goes to the ape's hiding place, which bursts in a ring of puffs, and the ape shows itself.

Used by MogallForest_ApeLeadsToKillerApe, MogallForest_FirstArea_ApeAttacks, MogallForest_FirstArea_EastApeShowsWay, MogallForest_FirstArea_NorthApeShowsWay, MogallForest_SecondArea_EastApeShowsWay, MogallForest_SecondArea_NorthApeShowsWay, MogallForest_SecondArea_SouthApeHidesAgain, MogallForest_SecondArea_SouthApeShowsWay, MogallForest_ThirdArea_ApeAttacks, MogallForest_ThirdArea_CentralApeShowsWay, MogallForest_ThirdArea_EastApeHidesAgain, MogallForest_ThirdArea_EastApeShowsWay, MogallForest_ThirdArea_WestApeShowsWay.

Line 252

MogallForest_ApePointsTheWay

static inline void MogallForest_ApePointsTheWay(s32 guideId)

The ape turns to the leader, hops and gestures down the way to go.

Used by MogallForest_FirstArea_EastApeShowsWay, MogallForest_FirstArea_NorthApeShowsWay, MogallForest_SecondArea_EastApeShowsWay, MogallForest_SecondArea_NorthApeShowsWay, MogallForest_SecondArea_SouthApeShowsWay, MogallForest_ThirdArea_CentralApeShowsWay, MogallForest_ThirdArea_EastApeShowsWay, MogallForest_ThirdArea_WestApeShowsWay.

Line 265

MogallForest_GetExits

const u32 *MogallForest_GetExits(void)

The exits, shared by the three areas.

Line 292

MogallForest_FirstArea_PushLog

static void MogallForest_FirstArea_PushLog(void)

Pushing a log in the first area (walking into trigger 20): the river log pushed to row 26 rolls into the water and can be crossed.

Used by gMogallForestEvents1.

Line 311

MogallForest_FirstArea_JumpNorth

static void MogallForest_FirstArea_JumpNorth(void)

Walking north into trigger 25: the leader jumps north across the log.

Used by gMogallForestEvents1.

Line 336

MogallForest_FirstArea_JumpSouth

static void MogallForest_FirstArea_JumpSouth(void)

Walking south into trigger 26: the leader jumps onto the log, which bobs under the weight.

Used by gMogallForestEvents1.

Line 354

MogallForest_ReadBrokenSign

static void MogallForest_ReadBrokenSign(void)

Searching the sign (trigger 27). "The broken sign reads: North: Fuchin Temple / South: Mogall Prairie..."

Used by gMogallForestEvents1.

Line 391

MogallForest_FirstArea_NorthApeShowsWay

static void MogallForest_FirstArea_NorthApeShowsWay(void)

Force on the north hiding place in the first area: the ape comes out, points the way and hops off south.

Used by gMogallForestEvents1.

Line 400

MogallForest_FirstArea_ApeAttacks

static void MogallForest_FirstArea_ApeAttacks(void)

Force on the hostile ape's hiding place: it comes out angry, leaps at the leader and the battle with the Ape begins (encounter table 53, slot 0).

Used by gMogallForestEvents1.

Line 436

MogallForest_FirstArea_EastApeShowsWay

static void MogallForest_FirstArea_EastApeShowsWay(void)

Force on the east hiding place in the first area: the ape comes out, points the way and hops off east.

Used by gMogallForestEvents1.

Line 476

MogallForest_CatchNut

static void MogallForest_CatchNut(void)

Catch on the Nut floating over the river: it is caught and found.

Used by gMogallForestEvents1.

Line 510

MogallForest_SecondArea_PushLog

static void MogallForest_SecondArea_PushLog(void)

Pushing a log in the second area (walking into trigger 20): the log at row 23 changes the ground beside it; the river log pushed to column 35 rolls into the water.

Used by gMogallForestEvents2.

Line 522

MogallForest_UpdateObstacleFootprint

static inline void MogallForest_UpdateObstacleFootprint(s32 column, s32 row)

Marks the obstacle cell and clears the cells it could have moved from.

Used by MogallForest_SecondArea_UpdateMovableObstacle, MogallForest_ThirdArea_UpdateNorthObstacle, MogallForest_ThirdArea_UpdateSouthObstacle.

Line 566

MogallForest_SecondArea_UpdateMovableObstacle

static void MogallForest_SecondArea_UpdateMovableObstacle(void)

Move on the second area's obstacle: its footprint follows it, and at (36, 24) it sinks two pixels into place.

Used by gMogallForestEvents2.

Line 576

MogallForest_SecondArea_NorthApeShowsWay

static void MogallForest_SecondArea_NorthApeShowsWay(void)

Force on the north hiding place in the second area: the ape points the way and hops off south.

Used by gMogallForestEvents2.

Line 600

MogallForest_SecondArea_EastApeShowsWay

static void MogallForest_SecondArea_EastApeShowsWay(void)

Force on the east hiding place in the second area: the ape points the way and hops off east.

Used by gMogallForestEvents2.

Line 631

MogallForest_SecondArea_SouthApeHidesAgain

static void MogallForest_SecondArea_SouthApeHidesAgain(void)

Force on the south hiding place the first time: the ape bolts to another hiding place nearby.

Used by gMogallForestEvents2.

Line 672

MogallForest_SecondArea_SouthApeShowsWay

static void MogallForest_SecondArea_SouthApeShowsWay(void)

Force on its new hiding place: the ape points the way and hops off west.

Used by gMogallForestEvents2.

Line 691

MogallForest_ThirdArea_PushLog

static void MogallForest_ThirdArea_PushLog(void)

Pushing a log in the third area (walking into trigger 20): each river log rolls into the water at its column (42 and 40) and can be crossed.

Used by gMogallForestEvents3.

Line 734

MogallForest_ThirdArea_JumpWest

static void MogallForest_ThirdArea_JumpWest(void)

Walking west into trigger 25: the leader jumps onto the second river log, which bobs under the weight.

Used by gMogallForestEvents3.

Line 780

MogallForest_ThirdArea_UpdateNorthObstacle

static void MogallForest_ThirdArea_UpdateNorthObstacle(void)

Move on the third area's north obstacle: at (45, 6) it sinks into place.

Used by gMogallForestEvents3.

Line 822

MogallForest_ThirdArea_UpdateSouthObstacle

static void MogallForest_ThirdArea_UpdateSouthObstacle(void)

Move on the south obstacle: on row 27 it sinks into place and stays.

Used by MogallForest_Initialize, gMogallForestEvents3.

Line 846

MogallForest_ThirdArea_ApeAttacks

static void MogallForest_ThirdArea_ApeAttacks(void)

Force on the third area's hostile hiding place: the ape leaps at the leader and the battle with the Ape begins.

Used by gMogallForestEvents3.

Line 874

MogallForest_ThirdArea_CentralApeShowsWay

static void MogallForest_ThirdArea_CentralApeShowsWay(void)

Force on the central hiding place: the ape points the way and hops off south.

Used by gMogallForestEvents3.

Line 912

MogallForest_ThirdArea_WestApeShowsWay

static void MogallForest_ThirdArea_WestApeShowsWay(void)

Force on the west hiding place: the ape points the way and hops off west.

Used by gMogallForestEvents3.

Line 950

MogallForest_ThirdArea_EastApeHidesAgain

static void MogallForest_ThirdArea_EastApeHidesAgain(void)

Force on the east hiding place the first time: the ape bolts to another hiding place to the south.

Used by gMogallForestEvents3.

Line 989

MogallForest_ThirdArea_EastApeShowsWay

static void MogallForest_ThirdArea_EastApeShowsWay(void)

Force on its new hiding place: the ape points the way and hops off south.

Used by gMogallForestEvents3.

Line 1007

MogallForest_ApeLeadsToKillerApe

static void MogallForest_ApeLeadsToKillerApe(void)

Touching trigger 22 in the third area, once: the ape appears again, turns to the party and leads it south to a hiding place.

Used by gMogallForestEvents3.

Line 1049

MogallForest_KillerApeAttacks

static void MogallForest_KillerApeAttacks(void)

Touching trigger 23 until it is beaten: the hiding place shakes twice and out comes the Killer Ape, a fifth again as big, to fight (encounter table 53, slot 1); the party returns to entrance 15.

Used by gMogallForestEvents3.

Line 1083

MogallForest_Initialize

s32 MogallForest_Initialize(void)

On entering an area: the first time, an ape peeks out and hides (the first area); apes already out stay gone, rolled logs and moved obstacles stay put; back from the Killer Ape (entrance 15) it is marked beaten.

Line 1172

Also, functions without a comment: MogallForest_GetEntrances, MogallForest_GetRegions, MogallForest_GetPlacements, MogallForest_GetEvents.

Enumerations

MogallForest1Actor

enum MogallForest1Actor

The first area.

Value=
ACTOR_FIRST_AREA_RIVER_LOGACTOR_FIRST_PLACED + 1
ACTOR_FIRST_AREA_NORTH_APE
ACTOR_FIRST_AREA_HOSTILE_APE
ACTOR_FIRST_AREA_EAST_APE
ACTOR_FIRST_AREA_NORTH_HIDEOUT
ACTOR_FIRST_AREA_HOSTILE_HIDEOUT
ACTOR_FIRST_AREA_EAST_HIDEOUT
ACTOR_NUTa Nut floating over the river, caught with Catch

Line 52

MogallForest2Actor

enum MogallForest2Actor

The second area.

Value=
ACTOR_SECOND_AREA_LOGACTOR_FIRST_PLACED
ACTOR_SECOND_AREA_RIVER_LOGACTOR_FIRST_PLACED + 2
ACTOR_SECOND_AREA_OBSTACLEsprite 0x125, moved with Move
ACTOR_SECOND_AREA_NORTH_APE
ACTOR_SECOND_AREA_EAST_APE
ACTOR_SECOND_AREA_SOUTH_APE
ACTOR_SECOND_AREA_NORTH_HIDEOUT
ACTOR_SECOND_AREA_EAST_HIDEOUT
ACTOR_SECOND_AREA_SOUTH_HIDEOUT
ACTOR_QUARTZVenus Djinni 2

Line 64

MogallForest3Actor

enum MogallForest3Actor

The third area.

Value=
ACTOR_THIRD_AREA_LOGACTOR_FIRST_PLACED
ACTOR_THIRD_AREA_RIVER_LOG_1
ACTOR_THIRD_AREA_RIVER_LOG_2ACTOR_FIRST_PLACED + 3
ACTOR_THIRD_AREA_NORTH_OBSTACLEACTOR_FIRST_PLACED + 5
ACTOR_THIRD_AREA_SOUTH_OBSTACLE
ACTOR_THIRD_AREA_HOSTILE_APE
ACTOR_THIRD_AREA_CENTRAL_APE
ACTOR_THIRD_AREA_WEST_APE
ACTOR_THIRD_AREA_EAST_APElater the Killer Ape
ACTOR_THIRD_AREA_HOSTILE_HIDEOUT
ACTOR_THIRD_AREA_CENTRAL_HIDEOUT
ACTOR_THIRD_AREA_WEST_HIDEOUT
ACTOR_THIRD_AREA_EAST_HIDEOUT

Line 78

Macros

DIRECTION_STEP

#define DIRECTION_STEP(dx, dz) (((u32)(dx) << 16) | ((dz) & 0xffff))

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

Used by gBilibinCave_PushSteps, gBilibin_FacingCellSteps, gColossoRiver_DirectionSteps, gColossoWall_DirectionSteps, gStagedActor_DirectionSteps.

Line 1458

Also, macros without a comment: FIELD_STAGED_ACTOR_IMPORTS, MOGALL_FOREST_EAST_ACTOR_CONDITION, MOGALL_FOREST_EAST_ACTOR_CONDITION, MOGALL_FOREST_EAST_SHARED_SPRITE_CONDITION, MOGALL_FOREST_EAST_SHARED_SPRITE_CONDITION.

Globals, without a comment: gStagedActor_DirectionSteps, gStagedActor_FootprintKinds, gStagedActor_FootprintBounds, gEffectScript0, gEffectScript1, gEffectScript2, gEffectScripts, gMogallForestPlacements2_0, gMogallForest_ActorScript, gMogallForestPlacements1_1, gMogallForestEntrances1, gMogallForestEntrances2, gMogallForestEntrances3, gMogallForestEntrancesOther, gMogallForest_Exits, gMogallForestPlacements1, gMogallForestPlacements2, gMogallForestPlacements3, gMogallForestPlacementsOther, gMogallForestEvents1, gMogallForestEvents2, gMogallForestEvents3, gMogallForestEventsOther.

On this page