Alchemy
Loading...
Searching...
No Matches

kolima_forest_bend.c File Reference

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

Go to the source code of this file.

Enumerations

enum  { SHORT_LOG = 8 , FLOODGATE_SWITCH = 9 , SIGN = 10 }

Functions

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.
static void KolimaForestBend_CreateLogs (struct BendLog *entry)
 Makes each log at the middle of its four cells, standing on the ground.
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.
const struct SceneEntrance * KolimaForestBend_GetEntrances (void)
 Where the party enters from the river and from Tret's tree.
const struct SceneRegion * KolimaForestBend_GetRegions (void)
const u32 * KolimaForestBend_GetExits (void)
 The paths back to the river and on to Tret's tree.
const struct ScenePlacement * KolimaForestBend_GetPlacements (void)
 The short log, the switch and the sign.
const struct SceneEvent * KolimaForestBend_GetEvents (void)
 The logs, the switch, the sign, the jump and the chest.
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.
static void KolimaForestBend_JumpSouth (void)
 Walking south into the gap: the leader jumps across.
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.
static void KolimaForestBend_ShakeLines (void)
 HBlank callback: selects the captured shake scroll above the split line.
static void KolimaForestBend_CaptureShakeScroll (void)
 Captures three background scroll pairs and adds the vertical shake offset.
static void KolimaForestBend_FlipFloodgateSwitch (void)
 Searching the floodgate switch flips it.
static void KolimaForestBend_PushShortLogWest (void)
 Walking west into the short log: the leader shoves it west to x 72.
static void KolimaForestBend_PushShortLogEast (void)
 Walking east into the short log: the leader shoves it east to x 104.
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.
void State_StampRecordCells (const struct BendLog *records, s32 value)
 Writes a collision code into the four cells of each log.
static struct BendLog * KolimaForestBend_FindLogAt (struct BendLog *run, s32 x, s32 y)
 The log lying across the cell, or none.
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.

Variables

struct BendLog gKolimaForestBend_DefaultRecords []
 The logs on a first visit, as struct BendLog: sprite 0xcd runs north to south and 0xcf west to east.
u8 gKolimaForestBend_PushAnimations [] = {2, 2, 3, 3}
s8 gKolimaForestBend_PushStepX [] = {8, 0, -8, 0}
s8 gKolimaForestBend_PushStepZ [] = {0, 8, 0, -8}
struct SceneEntrance gKolimaForestBendEntrances []
u32 gKolimaForestBendExits []
 Exit 1 to the river (scene 42), exit 2 to Tret's tree (scene 44).
struct ScenePlacement gKolimaForestBendPlacements []
struct SceneEvent gKolimaForestBendEvents []

Detailed Description

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.

Definition in file kolima_forest_bend.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SHORT_LOG 

slides between x 72 and x 104

FLOODGATE_SWITCH 
SIGN 

reads a warning. "Do not touch Floodgate Switch!"

Definition at line 49 of file kolima_forest_bend.c.

Function Documentation

◆ KolimaForestBend_MarkShortLogCells()

void KolimaForestBend_MarkShortLogCells ( void )
static

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

Definition at line 95 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_DrawWaterLevel(), KolimaForestBend_MarkShortLogCells(), and KolimaForestBend_PushLog().

◆ KolimaForestBend_CreateLogs()

void KolimaForestBend_CreateLogs ( struct BendLog * log)
static

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

Definition at line 393 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_CreateLogs(), and KolimaForestBend_Initialize().

◆ KolimaForestBend_RollLog()

void KolimaForestBend_RollLog ( struct BendLog * logs)
static

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.

Definition at line 493 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_PushLog(), and KolimaForestBend_RollLog().

◆ KolimaForestBend_GetEntrances()

const struct SceneEntrance * KolimaForestBend_GetEntrances ( void )

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

Definition at line 60 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetEntrances(), and STATIC_ASSERT().

◆ KolimaForestBend_GetRegions()

const struct SceneRegion * KolimaForestBend_GetRegions ( void )

Definition at line 64 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetRegions(), and STATIC_ASSERT().

◆ KolimaForestBend_GetExits()

const u32 * KolimaForestBend_GetExits ( void )

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

Definition at line 67 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetExits(), and STATIC_ASSERT().

◆ KolimaForestBend_GetPlacements()

const struct ScenePlacement * KolimaForestBend_GetPlacements ( void )

The short log, the switch and the sign.

Definition at line 70 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetPlacements(), and STATIC_ASSERT().

◆ KolimaForestBend_GetEvents()

const struct SceneEvent * KolimaForestBend_GetEvents ( void )

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

Definition at line 75 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetEvents(), and STATIC_ASSERT().

◆ KolimaForestBend_PushLog()

void KolimaForestBend_PushLog ( void )
static

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

Definition at line 81 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_PushLog().

◆ KolimaForestBend_JumpSouth()

void KolimaForestBend_JumpSouth ( void )
static

Walking south into the gap: the leader jumps across.

Definition at line 89 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_JumpSouth().

◆ KolimaForestBend_DrawWaterLevel()

void KolimaForestBend_DrawWaterLevel ( void )
static

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.

Definition at line 106 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_DrawWaterLevel(), KolimaForestBend_FlipFloodgateSwitch(), and KolimaForestBend_Initialize().

◆ KolimaForestBend_ShakeLines()

void KolimaForestBend_ShakeLines ( void )
static

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

Definition at line 165 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_FlipFloodgateSwitch(), and KolimaForestBend_ShakeLines().

◆ KolimaForestBend_CaptureShakeScroll()

void KolimaForestBend_CaptureShakeScroll ( void )
static

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

Definition at line 188 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_CaptureShakeScroll(), and KolimaForestBend_FlipFloodgateSwitch().

◆ KolimaForestBend_FlipFloodgateSwitch()

void KolimaForestBend_FlipFloodgateSwitch ( void )
static

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.

Definition at line 208 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_FlipFloodgateSwitch().

◆ KolimaForestBend_PushShortLogWest()

void KolimaForestBend_PushShortLogWest ( void )
static

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

Definition at line 306 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_PushShortLogWest().

◆ KolimaForestBend_PushShortLogEast()

void KolimaForestBend_PushShortLogEast ( void )
static

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

Definition at line 332 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_PushShortLogEast().

◆ 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.

Definition at line 361 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_Initialize(), and STATIC_ASSERT().

◆ State_StampRecordCells()

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

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

Definition at line 426 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_DrawWaterLevel(), KolimaForestBend_Initialize(), KolimaForestBend_PushLog(), State_StampRecordCells(), and STATIC_ASSERT().

◆ KolimaForestBend_FindLogAt()

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

The log lying across the cell, or none.

Definition at line 450 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_FindLogAt(), and KolimaForestBend_RollLog().

◆ KolimaForestBend_CheckLogFits()

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

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

Definition at line 472 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_CheckLogFits(), and KolimaForestBend_RollLog().

Variable Documentation

◆ gKolimaForestBend_DefaultRecords

struct BendLog gKolimaForestBend_DefaultRecords[]
Initial value:
= {
{0xcd, 11, 9, 1, NULL},
{0xcf, 12, 12, 0, NULL},
{0xcf, 17, 12, 0, NULL},
{0xcd, 13, 13, 1, NULL},
{0xcf, 10, 18, 0, NULL},
{-1},
}
#define NULL
Definition bilibin.h:6

The logs on a first visit, as struct BendLog: sprite 0xcd runs north to south and 0xcf west to east.

Definition at line 570 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_Initialize(), and STATIC_ASSERT().

◆ gKolimaForestBend_PushAnimations

u8 gKolimaForestBend_PushAnimations[] = {2, 2, 3, 3}

Definition at line 579 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_RollLog(), and STATIC_ASSERT().

◆ gKolimaForestBend_PushStepX

s8 gKolimaForestBend_PushStepX[] = {8, 0, -8, 0}

Definition at line 581 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_RollLog(), and STATIC_ASSERT().

◆ gKolimaForestBend_PushStepZ

s8 gKolimaForestBend_PushStepZ[] = {0, 8, 0, -8}

Definition at line 583 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_RollLog(), and STATIC_ASSERT().

◆ gKolimaForestBendEntrances

struct SceneEntrance gKolimaForestBendEntrances[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 407, 0, 276, FACING_WEST, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 50, 32, 369, FACING_EAST, 0, -1, -1, -1, -1, 0 },
{ 2, CONDITION_ALWAYS, 162, 32, 84, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_EAST
Definition field_scene.h:26
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30

Definition at line 585 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetEntrances(), and STATIC_ASSERT().

◆ gKolimaForestBendExits

u32 gKolimaForestBendExits[]
Initial value:
= {
SCENE_EXIT(1, 42, 2),
SCENE_EXIT(2, 44, 1),
}
#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

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

Definition at line 593 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetExits(), and STATIC_ASSERT().

◆ gKolimaForestBendPlacements

struct ScenePlacement gKolimaForestBendPlacements[]
Initial value:
= {
{ 0xcd, CONDITION_ALWAYS, 7,
{ 0xd6, CONDITION_ALWAYS, 7,
}
@ TALK_KEEP_FACING
@ ACTOR_STAND
#define PIXELS(value)

Definition at line 600 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetPlacements(), and STATIC_ASSERT().

◆ gKolimaForestBendEvents

struct SceneEvent gKolimaForestBendEvents[]
Initial value:
= {
{EVENT_TALK, SIGN, CONDITION_ALWAYS, MSGNO(MsgKolimaDoNotTouchFloodgate)},
}
#define SCENE_EVENTS_END
#define FIND_ITEM(item)
@ EVENT_TOUCH
@ EVENT_EXIT
@ EVENT_TALK
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define SEARCH(target)
#define TOUCH_WALKING_INTO(facing)
@ SEARCH_UNNAMED
@ SEARCH_CHEST
@ ITEM_FUR_COAT
Definition item_ids.h:25
static void KolimaForestBend_PushShortLogWest(void)
Walking west into the short log: the leader shoves it west to x 72.
static void KolimaForestBend_PushShortLogEast(void)
Walking east into the short log: the leader shoves it east to x 104.
@ FLOODGATE_SWITCH
@ SIGN
reads a warning. "Do not touch Floodgate Switch!"
static void KolimaForestBend_JumpSouth(void)
Walking south into the gap: the leader jumps across.
static void KolimaForestBend_FlipFloodgateSwitch(void)
Searching the floodgate switch flips it.
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.

Definition at line 611 of file kolima_forest_bend.c.

Referenced by KolimaForestBend_GetEvents(), and STATIC_ASSERT().