Alchemy

kolima_forest_bend.c

Kolima Forest's bend, between the river and Tret's tree.

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

Kolima Forest's bend, between the river and Tret's tree. A floodgate switch raises and lowers the river: with the water high the logs float (26 pixels up) and can be rolled along it; with it low they lie on the riverbed. A short log slides between two places, and a sign warns the party off the switch.

The water level, the short log's place and each log's cells are kept in gSceneState (gKolimaForestBendLayout, gKolimaForestBendReturned and gKolimaForestBendRecords), so they survive a battle.

Functions

KolimaForestBend_GetEntrances

const struct SceneEntrance *KolimaForestBend_GetEntrances(void)

Where the party enters from the river and from Tret's tree.

Line 60

KolimaForestBend_GetExits

const u32 *KolimaForestBend_GetExits(void)

The paths back to the river and on to Tret's tree.

Line 67

KolimaForestBend_GetPlacements

const struct ScenePlacement *KolimaForestBend_GetPlacements(void)

The short log, the switch and the sign.

Line 70

KolimaForestBend_GetEvents

const struct SceneEvent *KolimaForestBend_GetEvents(void)

The logs, the switch, the sign, the jump and the chest.

Line 75

KolimaForestBend_PushLog

static void KolimaForestBend_PushLog(void)

Walking into a log: it rolls ahead, and the cells of the logs are marked again where they now lie.

Used by gKolimaForestBendEvents.

Line 81

KolimaForestBend_JumpSouth

static void KolimaForestBend_JumpSouth(void)

Walking south into the gap: the leader jumps across.

Used by gKolimaForestBendEvents.

Line 89

KolimaForestBend_MarkShortLogCells

static void KolimaForestBend_MarkShortLogCells(void)

Gives the short log's column of cells its collision: column 4 at the west place, column 6 at the east.

Used by KolimaForestBend_DrawWaterLevel, KolimaForestBend_PushLog.

Line 95

KolimaForestBend_DrawWaterLevel

static void KolimaForestBend_DrawWaterLevel(void)

Draws the river at its level and sets each log to match: high water floats the logs 26 pixels up over their own cells, low water lays them on the riverbed.

Used by KolimaForestBend_FlipFloodgateSwitch, KolimaForestBend_Initialize.

Line 106

KolimaForestBend_ShakeLines

static void KolimaForestBend_ShakeLines(void)

HBlank callback: selects the captured shake scroll above the split line.

Used by KolimaForestBend_FlipFloodgateSwitch.

Line 165

KolimaForestBend_CaptureShakeScroll

static void KolimaForestBend_CaptureShakeScroll(void)

Captures three background scroll pairs and adds the vertical shake offset.

Used by KolimaForestBend_FlipFloodgateSwitch.

Line 188

KolimaForestBend_FlipFloodgateSwitch

static void KolimaForestBend_FlipFloodgateSwitch(void)

Searching the floodgate switch flips it. "Isaac flipped the switch." The camera turns to the floodgate, which opens or closes; the ground rumbles and the top of the screen shakes harder for 100 frames, and the river rises or falls.

Used by gKolimaForestBendEvents.

Line 208

KolimaForestBend_PushShortLogWest

static void KolimaForestBend_PushShortLogWest(void)

Walking west into the short log: the leader shoves it west to x 72.

Used by gKolimaForestBendEvents.

Line 306

KolimaForestBend_PushShortLogEast

static void KolimaForestBend_PushShortLogEast(void)

Walking east into the short log: the leader shoves it east to x 104.

Used by gKolimaForestBendEvents.

Line 332

KolimaForestBend_Initialize

s32 KolimaForestBend_Initialize(void)

On entry: the logs' records come back from gSceneState, or on a first visit from the defaults with the water high; the logs are made and the river is drawn at its level. The forest keeps its cursed colours until the curse is lifted.

Line 361

KolimaForestBend_CreateLogs

static void KolimaForestBend_CreateLogs(struct BendLog *entry)

Makes each log at the middle of its four cells, standing on the ground.

Used by KolimaForestBend_Initialize.

Line 393

State_StampRecordCells

void State_StampRecordCells(const struct BendLog *records, s32 value)

Writes a collision code into the four cells of each log.

Used by KolimaForestBend_DrawWaterLevel, KolimaForestBend_Initialize, KolimaForestBend_PushLog.

Line 425

KolimaForestBend_FindLogAt

static struct BendLog *KolimaForestBend_FindLogAt(struct BendLog *run, s32 x, s32 y)

The log lying across the cell, or none.

Used by KolimaForestBend_RollLog.

Line 449

KolimaForestBend_CheckLogFits

static s32 KolimaForestBend_CheckLogFits(s32 x, s32 z, s32 mode)

Whether four cells from the one given, across or down, are free for a log: none is marked 0xff or holds a wall.

Used by KolimaForestBend_RollLog.

Line 471

KolimaForestBend_RollLog

static void KolimaForestBend_RollLog(struct BendLog *runs)

Finds the log ahead of the leader and rolls it on, a cell at a time, up to eleven cells or until a cell is not free; the leader follows its shove.

Used by KolimaForestBend_PushLog.

Line 492

Also, functions without a comment: KolimaForestBend_GetRegions.

Globals

gKolimaForestBendExits

u32 gKolimaForestBendExits[]

Exit 1 to the river (scene 42), exit 2 to Tret's tree (scene 44).

Used by KolimaForestBend_GetExits.

Line 592

Also, globals without a comment: gKolimaForestBend_DefaultRecords, gKolimaForestBend_PushAnimations, gKolimaForestBend_PushStepX, gKolimaForestBend_PushStepZ, gKolimaForestBendEntrances, gKolimaForestBendPlacements, gKolimaForestBendEvents.

On this page