Alchemy
Loading...
Searching...
No Matches

kolima_forest_clearing.c

Go to the documentation of this file.
1/// @file
2/// Kolima Forest's clearing, between the bridge and the river. Three logs lie
3/// in the grass for the party to push, and a Nut circles out of reach until
4/// Catch pulls it in.
5
7#include "flags.h"
8#include "version.h"
9#include "global_cells.h"
10#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 "types.h"
26#include "field_event.h"
27#include "staged_actor.h"
28#include "io_reg.h"
29#include "ability_ids.h"
30#include "field_scene.h"
31#include "item_ids.h"
32
33/// Actors 8 to 10 are the logs; 11 is the Nut.
34enum { NUT = 11 };
35
37
38/// Where the party enters from the bridge and the river.
41}
42
43const struct SceneRegion *KolimaForestClearing_GetRegions(void) { return 0; }
44
45/// The paths to the river and back to the bridge.
48}
49
50/// The three logs and the Nut.
53}
54
55/// Walking into a log: it rolls ahead until something stops it.
57 struct StagedActorProbe result;
59 if (StagedActor_FindClearPosition(&result))
60 SceneActor_MoveAndRedraw(result);
62}
63
64/// Catch on the circling Nut: it vanishes and the party finds a Nut.
72}
73
74/// The logs, the Nut and the two paths.
77}
78
79/// On entry the Nut circles until it is caught, the logs mark the cells they
80/// cover, and the forest keeps its cursed colours until the curse is lifted.
82
86 }
87 FieldScene_RedrawActorFootprint(8);
88 FieldScene_RedrawActorFootprint(9);
89 FieldScene_RedrawActorFootprint(10);
92 }
93 return 0;
94}
95
97#include "common/object_orbit.h"
98
99/// Pixel step by direction: X in the upper halfword, Z in the lower.
100#define DIRECTION_STEP(dx, dz) (((dx) << 16) | ((dz) & 0xffff))
101
103 DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0), DIRECTION_STEP(16, 0),
104 DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16), DIRECTION_STEP(0, 16),
105 DIRECTION_STEP(0, 16), DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0),
106 DIRECTION_STEP(-16, 0), DIRECTION_STEP(-16, 0), DIRECTION_STEP(0, -16),
107 DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16), DIRECTION_STEP(0, -16),
108 DIRECTION_STEP(16, 0),
109};
110
111// clang-format off
113 207, 205, 228, 229, 298, 297,
114};
115
117 -32, -8, 32, 8,
118 -8, -32, 8, 32,
119 -32, -16, 32, 0,
120 -8, -32, 8, 32,
121 -32, -8, 32, 8,
122 -8, -32, 8, 32,
123};
124
126 { 0, CONDITION_ALWAYS, 209, 0, 279, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
127 { 1, CONDITION_ALWAYS, 480, 0, 376, FACING_WEST, 0, -1, -1, -1, -1, 0 },
128 { 2, CONDITION_ALWAYS, 312, 0, 40, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
129 { SCENE_TABLE_END },
130};
131
132/// Exit 1 to the river (scene 42), exit 2 to the bridge (scene 40).
134 SCENE_EXITS(41),
135 SCENE_EXIT(1, 42, 1),
136 SCENE_EXIT(2, 40, 2),
138};
139
140/// Until the third patch the Nut's placement tested flag 0xfd0, not the flag
141/// catching it sets.
143 { 0xcd, CONDITION_ALWAYS, 7,
144 PIXELS(360), 0, PIXELS(368), FACING_SOUTH, TALK_KEEP_FACING, 0 },
145 { 0xcf, CONDITION_ALWAYS, 7,
146 PIXELS(160), 0, PIXELS(392), FACING_SOUTH, TALK_KEEP_FACING, 0 },
147 { 0xcd, CONDITION_ALWAYS, 7,
148 PIXELS(136), 0, PIXELS(336), FACING_SOUTH, TALK_KEEP_FACING, 0 },
149#if !TBS_PATCH_3
150 { 0x16, 0xfd0, 7,
151 PIXELS(280), 0, PIXELS(280), FACING_SOUTH, TALK_KEEP_FACING, 0 },
152#else
154 PIXELS(280), 0, PIXELS(280), FACING_SOUTH, TALK_KEEP_FACING, 0 },
155#endif
156 { SCENE_TABLE_END },
157};
158// clang-format on
159
168};
169
170// The .bss order follows the first declarations (externs in field.h).
171u8 gKolimaPalette_First[1792] __attribute__((section(".bss")));
172u8 gKolimaPalette_Second[896] __attribute__((section(".bss")));
Ability numbers, named from the English release.
@ ABILITY_CATCH
Definition ability_ids.h:23
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.
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,...
s32 Engine_PartyGiveItem(s32 item, s32 flags)
void Engine_ItemShowFound(s32 item, s32 height)
void Engine_GameFlagSet(s32 flag)
s32 Engine_GameFlagIsSet(s32 flag)
@ 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 PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define SCENE_EXITS_END
Definition field_scene.h:77
@ 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_FOREST_NUT_CAUGHT
Catch took the clearing's Nut.
Definition flags.h:265
#define FLAG_KOLIMA_CURSE_LIFTED
Definition flags.h:103
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.
The hardware's I/O registers and their bits, as pret names them.
Item numbers, named from the English release.
@ ITEM_NUT
Definition item_ids.h:41
const struct ScenePlacement * KolimaForestClearing_GetPlacements(void)
The three logs and the Nut.
const struct SceneEvent * KolimaForestClearing_GetEvents(void)
The logs, the Nut and the two paths.
struct SceneEvent gKolimaForestClearing_Events[]
u8 gKolimaPalette_First[1792]
const u32 * KolimaForestClearing_GetExits(void)
The paths to the river and back to the bridge.
static void KolimaForestClearing_CatchNut(void)
Catch on the circling Nut: it vanishes and the party finds a Nut.
struct ScenePlacement gKolimaForestClearing_Placements[]
Until the third patch the Nut's placement tested flag 0xfd0, not the flag catching it sets.
const struct SceneEntrance * KolimaForestClearing_GetEntrances(void)
Where the party enters from the bridge and the river.
u8 gKolimaPalette_Second[896]
static void KolimaForestClearing_PushLog(void)
Walking into a log: it rolls ahead until something stops it.
struct SceneEntrance gKolimaForestClearing_Entrances[]
const struct SceneRegion * KolimaForestClearing_GetRegions(void)
s32 KolimaForestClearing_Initialize(void)
On entry the Nut circles until it is caught, the logs mark the cells they cover, and the forest keeps...
u32 gKolimaForestClearing_Exits[]
Exit 1 to the river (scene 42), exit 2 to the bridge (scene 40).
The reel game's title lettering.
struct EventWork * gEventWork
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
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 ...
void Scene_FloatNut(s32 id)
Draws actor id as the Nut's icon and starts it floating, 32 pixels up unless the party returns to whe...
The pushable actors' movement probes and footprint bounds.
s32 startTransition
SCENE_TRANSITION(style, variant).
Definition event_work.h:43
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,...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
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
The patch levels: our groups of the measured changes from the Japanese release.