Alchemy
Loading...
Searching...
No Matches

kolima_forest_river.c

Go to the documentation of this file.
1/// @file
2/// Kolima Forest's river, between the clearing and the bend. Of its three logs,
3/// the one pushed west to the bank tips into the river and floats there, a
4/// bridge to the far side.
5///
6/// FLAG_SCENE_TEMP_01: the log is in the river.
7
9#include "flags.h"
10#include "global_cells.h"
11#include "unit/import.h"
14#include "unit/object/object.h"
16#include "battle.h"
17#include "debug.h"
18#include "field.h"
19#include "game.h"
20#include "graphics.h"
21#include "menu.h"
22#include "minigame.h"
23#include "sound.h"
24#include "system.h"
25#include "mapcopy.h"
26#include "types.h"
27#include "tbs_edition.h"
28
29#include "staged_actor.h"
30#include "staged_actor_effect.h"
31#include "field_obj.h"
32#include "game_state.h"
33#include "field_event.h"
34#include "field_scene.h"
35#include "songs.h"
36
37/// Actors 8 to 10 are the logs; 10 is the one that can reach the river.
38enum { RIVER_LOG = 10 };
39
41
44}
45
46const struct SceneRegion *KolimaForestRiver_GetRegions(void) { return 0; }
47
49
50/// The three logs.
53}
54
55/// Walking into a log: it rolls ahead until something stops it. The river
56/// log, stopped at the bank (cell column 12), tips over with a splash and
57/// floats in the water; its cells become ground the party can cross.
58static void KolimaForestRiver_PushLog(void) {
59 struct StagedActorProbe result;
61 if (StagedActor_FindClearPosition(&result)) {
62 SceneActor_MoveAndRedraw(result);
63 if (result.actorSlot == RIVER_LOG && (result.position.x >> 20) == 12) {
64 struct FieldActor *actor;
71 Map_CopyCellAttributes(32, 20, 2, 4, 11, 16);
76 }
77 }
79}
80
81#include "common/kolima_jump.h"
82
83/// The logs, the two paths and the jump east from the bank.
86}
87
88/// On entry a log already in the river floats there again, the logs mark the
89/// cells they cover, and the forest keeps its cursed colours until the curse
90/// is lifted.
92 struct EventWork *work = gEventWork;
93
95 FieldScene_RedrawActorFootprint(RIVER_LOG);
96
99 Map_CopyCellAttributes(32, 20, 2, 4, 11, 16);
100 StagedActor_FillGridAttributeRectangle(2, 12, 16, 1, 4, 0);
102 }
103
104 FieldScene_RedrawActorFootprint(8);
105 FieldScene_RedrawActorFootprint(9);
106
109 }
110 return 0;
111}
112
114
115/// Pixel step by direction: X in the upper halfword, Z in the lower.
116#define DIRECTION_STEP(dx, dz) (((dx) << 16) | ((dz) & 0xffff))
117
119 DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0),
120 DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16),
121 DIRECTION_STEP(0, 16), DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0),
122 DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0), DIRECTION_STEP(0, -16),
123 DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16),
124 DIRECTION_STEP(16, 0),
125};
126
127// clang-format off
129 207, 205, 228, 229, 298, 297,
130};
131
133 -32, -8, 32, 8,
134 -8, -32, 8, 32,
135 -32, -16, 32, 0,
136 -8, -32, 8, 32,
137 -32, -8, 32, 8,
138 -8, -32, 8, 32,
139};
140
142 { 0, CONDITION_ALWAYS, 209, 0, 279, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
143 { 1, CONDITION_ALWAYS, 320, 0, 488, FACING_NORTH, 0, -1, -1, -1, -1, 0 },
144 { 2, CONDITION_ALWAYS, 480, 0, 104, FACING_WEST, 0, -1, -1, -1, -1, 0 },
145 { SCENE_TABLE_END },
146};
147
148/// Exit 1 to the bend (scene 43), exit 2 to the clearing (scene 41).
150 SCENE_EXITS(42),
151 SCENE_EXIT(1, 43, 1),
152 SCENE_EXIT(2, 41, 2),
154};
155
157 { 0xcf, CONDITION_ALWAYS, 7,
158 PIXELS(256), 0, PIXELS(344), FACING_SOUTH, TALK_KEEP_FACING, 0 },
159 { 0xcf, CONDITION_ALWAYS, 7,
160 PIXELS(224), 0, PIXELS(280), FACING_SOUTH, TALK_KEEP_FACING, 0 },
161 { 0xcd, CONDITION_ALWAYS, 7,
162 PIXELS(312), 0, PIXELS(288), FACING_SOUTH, TALK_KEEP_FACING, 0 },
163 { SCENE_TABLE_END },
164};
165// clang-format on
166
175};
176
177// The .bss order follows the first declarations (externs in field.h).
178u8 gKolimaPalette_First[1792] __attribute__((section(".bss")));
179u8 gKolimaPalette_Second[896] __attribute__((section(".bss")));
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
s32 gStagedActor_DirectionSteps[]
Pixel step by direction: X in the upper halfword, Z in the lower.
s32 gStagedActor_FootprintBounds[]
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.
u32 gStagedActor_FootprintKinds[]
The battle animation state, render objects and effect entries, and the palette buffer work.
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine calls the debug menus import, and their palette swatch tiles.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_GameFlagSet(s32 flag)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorSetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_EventWait(s32 frames)
Field objects and actors, and the scene transition styles.
@ TRANSITION_WINDOW
Definition field_obj.h:17
#define SCENE_TRANSITION(style, variant)
Definition field_obj.h:20
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EVENTS_END
@ EVENT_TOUCH
@ EVENT_EXIT
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ TALK_KEEP_FACING
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define SCENE_EXITS_END
Definition field_scene.h:77
#define TOUCH_WALKING_INTO(facing)
@ FACING_EAST
Definition field_scene.h:26
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30
#define PIXELS(value)
Game flags, named where their meaning is shown.
#define FLAG_KOLIMA_CURSE_LIFTED
Definition flags.h:103
#define FLAG_SCENE_TEMP_01
Definition flags.h:714
GameState, the game's state: play time, coins, the scene and the leader's position,...
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
@ RIVER_LOG
actors 8 to 10 are the logs
u8 gKolimaPalette_First[1792]
u8 gKolimaPalette_Second[896]
s32 KolimaForestRiver_Initialize(void)
On entry a log already in the river floats there again, the logs mark the cells they cover,...
struct SceneEntrance gKolimaForestRiverEntrances[]
const struct SceneRegion * KolimaForestRiver_GetRegions(void)
static void KolimaForestRiver_PushLog(void)
Walking into a log: it rolls ahead until something stops it.
struct ScenePlacement gKolimaForestRiverPlacements[]
struct SceneEvent gKolimaForestRiverEvents[]
u32 gKolimaForestRiverExits[]
Exit 1 to the bend (scene 43), exit 2 to the clearing (scene 41).
const struct SceneEvent * KolimaForestRiver_GetEvents(void)
The logs, the two paths and the jump east from the bank.
const u32 * KolimaForestRiver_GetExits(void)
const struct ScenePlacement * KolimaForestRiver_GetPlacements(void)
The three logs.
const struct SceneEntrance * KolimaForestRiver_GetEntrances(void)
Kolima's forest bridge and river: the hop east onto actor 10 (the third placement).
static void KolimaForest_HopEast(void)
Touch trigger 11, walking east: hop 30 pixels east of the leader.
Definition kolima_jump.h:60
Declares nothing of its own: it only includes edition.h and types.h.
The reel game's title lettering.
static s32 StagedActor_FillGridAttributeRectangle(u32 layer, s32 x, s32 z, u32 width, u32 height, s32 value)
Sets the collision code of a width by height rectangle of cells, from cell (x, z),...
Song and sound effect ids, indices into gSound_SongTable.
#define SE_240
Definition songs.h:235
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void KolimaPalette_Curse(s32 strength)
Keeps the healthy colours, curses the background palettes 0 to 13 (all but colours 1 to 7 of palette ...
The pushable actors' movement probes and footprint bounds.
A staged actor's effect and its request.
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
Definition event_work.h:20
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
Definition field_obj.h:51
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
Definition field_scene.h:54
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
Definition field_scene.h:81
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
Where a large thing ahead of the leader would roll to: its footprint, its actor, that position,...
struct FieldPosition position
16.16 pixels while moving; converted to cells by footprint redraws.
s32 actorSlot
the large thing's actor number, 8 to 65
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
Values that differ by patch level or language, chosen once for their code.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned char u8
Definition types.h:11