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.
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.
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.
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.
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.
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.
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.
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.
MogallForest_GetExits
const u32 *MogallForest_GetExits(void)
The exits, shared by the three areas.
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.
MogallForest_FirstArea_JumpNorth
static void MogallForest_FirstArea_JumpNorth(void)
Walking north into trigger 25: the leader jumps north across the log.
Used by gMogallForestEvents1.
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.
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.
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.
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.
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.
MogallForest_CatchNut
static void MogallForest_CatchNut(void)
Catch on the Nut floating over the river: it is caught and found.
Used by gMogallForestEvents1.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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_LOG | ACTOR_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_NUT | a Nut floating over the river, caught with Catch |
MogallForest2Actor
enum MogallForest2Actor
The second area.
| Value | = | |
|---|---|---|
ACTOR_SECOND_AREA_LOG | ACTOR_FIRST_PLACED | |
ACTOR_SECOND_AREA_RIVER_LOG | ACTOR_FIRST_PLACED + 2 | |
ACTOR_SECOND_AREA_OBSTACLE | sprite 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_QUARTZ | Venus Djinni 2 |
MogallForest3Actor
enum MogallForest3Actor
The third area.
| Value | = | |
|---|---|---|
ACTOR_THIRD_AREA_LOG | ACTOR_FIRST_PLACED | |
ACTOR_THIRD_AREA_RIVER_LOG_1 | ||
ACTOR_THIRD_AREA_RIVER_LOG_2 | ACTOR_FIRST_PLACED + 3 | |
ACTOR_THIRD_AREA_NORTH_OBSTACLE | ACTOR_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_APE | later the Killer Ape | |
ACTOR_THIRD_AREA_HOSTILE_HIDEOUT | ||
ACTOR_THIRD_AREA_CENTRAL_HIDEOUT | ||
ACTOR_THIRD_AREA_WEST_HIDEOUT | ||
ACTOR_THIRD_AREA_EAST_HIDEOUT |
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.
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.