Alchemy
Loading...
Searching...
No Matches

field.h

Go to the documentation of this file.
1#ifndef ALCHEMY_UNIT_FIELD_FIELD_H
2#define ALCHEMY_UNIT_FIELD_FIELD_H
3
4#include "render_placement.h"
5
6#include "types.h"
7
8struct AnimationEntry;
9struct AnimationObject;
10struct DispatchObject;
11struct FieldPosition;
12struct MapAffinePair;
13struct MapScanline;
14struct ObjectRuntime;
18struct ScriptOperands;
19struct WorldPosition;
20
21u8 *Resource_DecompressLz(const u8 *source, u8 *destination);
23void Render_PlaceSpritePartPair(struct AnimationObject *sprite, s32 screenX,
24 s32 height, s32 screenY, s32 groundHeight,
25 s32 *scale);
27 const struct SpritePlacement *position,
28 const struct SpriteScale *scale,
29 s32 facing);
30void Render_PlaceProjectedSprite(struct AnimationObject *sprite, s32 *point,
31 s32 *scale, s32 facing, s32 depth);
32void ObjectGroup_SetChildValueUnlessFifteen(void *rawSprite, u32 value);
33s32 ResourceSlot_Load(u32 slot, u32 *buffer, s32 number, u32 variant);
38void ResourceMetadata_Unregister(struct AnimationObject *sprite, s32 layer);
39void ResourceMetadata_ReleaseSlot(struct AnimationObject *sprite, u32 index);
40void Animation_SetWorkEntry(struct AnimationEntry *layer, s32 animation);
42 s32 animation);
44 s32 frames);
46 s32 step);
51void ResourceObject_Release(struct AnimationObject *sprite);
52s32 ResourceMetadata_SumCommandLengths(s32 id, u32 animation, s32 frameCount);
53void Map_RenderAnimatedTileFrame(u8 *obj, u32 pos);
56void ObjectDispatch_SelectAnimation(void *raw, s32 no);
60void Script_SetOrCompareAddress(struct ScriptOperands *state, s32 operation,
61 s32 value);
63 s32 operation, s32 value);
64void Script_SetOrCompareX(struct ScriptOperands *state, s32 operation,
65 s32 value);
66void Script_SetOrCompareY(struct ScriptOperands *state, s32 operation,
67 s32 value);
68void Script_SetOrCompareZ(struct ScriptOperands *state, s32 operation,
69 s32 value);
70void Script_SetOrCompareScaleX(struct ScriptOperands *state, s32 operation,
71 s32 value);
72void Script_SetOrCompareScaleY(struct ScriptOperands *state, s32 operation,
73 s32 value);
74void Script_SetOrCompareVelocityX(struct ScriptOperands *state, s32 operation,
75 s32 value);
76void Script_SetOrCompareVelocityY(struct ScriptOperands *state, s32 operation,
77 s32 value);
78void Script_SetOrCompareVelocityZ(struct ScriptOperands *state, s32 operation,
79 s32 value);
80void Script_SetOrCompareSpeedLimit(struct ScriptOperands *state, s32 operation,
81 s32 value);
83 s32 operation, s32 value);
84void Script_SetOrCompareTargetX(struct ScriptOperands *state, s32 operation,
85 s32 value);
86void Script_SetOrCompareTargetY(struct ScriptOperands *state, s32 operation,
87 s32 value);
88void Script_SetOrCompareTargetZ(struct ScriptOperands *state, s32 operation,
89 s32 value);
91 s32 operation, s32 value);
92void Script_SetOrCompareGravity(struct ScriptOperands *state, s32 operation,
93 s32 value);
95 s32 operation, s32 value);
96void Script_SetOrCompareWord4c(struct ScriptOperands *state, s32 operation,
97 s32 value);
98void Script_SetOrCompareAddress50(struct ScriptOperands *state, s32 operation,
99 s32 value);
100void Script_SetOrCompareByte54(struct ScriptOperands *state, s32 operation,
101 s32 value);
102void Script_SetOrCompareMotionFlags(struct ScriptOperands *state, s32 operation,
103 s32 value);
104void Script_SetOrCompareArrivalAxis(struct ScriptOperands *state, s32 operation,
105 s32 value);
107 s32 operation, s32 value);
109 s32 operation, s32 value);
111 s32 operation, s32 value);
113 s32 operation, s32 value);
114void Script_SetOrComparePaused(struct ScriptOperands *state, s32 operation,
115 s32 value);
116void Script_SetOrCompareRepeatCount(struct ScriptOperands *work, s32 operation,
117 s32 value);
119 s32 operation, s32 value);
121 s32 operation, s32 value);
122void Script_SetOrCompareWord68(struct ScriptOperands *work, s32 operation,
123 s32 value);
125 s32 operation, s32 value);
126void Script_SetOrCompareByte62(struct ScriptOperands *work, s32 operation,
127 s32 value);
128void Script_SetOrCompareByte63(struct ScriptOperands *work, s32 operation,
129 s32 value);
132
134 s32 *screenPosition);
135void ObjectSystem_Initialize(s32 controlMode);
139void ObjectDispatch_Release(struct DispatchObject *object);
140struct ObjectRuntime *FieldObject_Create(s32 encodedSprite, s32 x, s32 y,
141 s32 z);
142void ObjectDispatch_Initialize(struct DispatchObject *object,
143 const s32 *script);
147 u32 rotation);
148void Animation_SetIndexAndInitObjects(void *rawDispatchObject, s32 animationId);
150 s32 animationId);
152 s32 linkedObjectHandle);
157void ObjectDispatch_StartIdle(struct DispatchObject *object);
159 s32 linkedObjectHandle);
160void ObjectDispatch_WaitForValue16(void *rawObject);
162 u32 flags);
163void ObjectDispatch_SetChildBlendMode(struct DispatchObject *object, u32 mode);
165 u32 fixedScale);
166void Animation_ApplyChildValues(struct DispatchObject *object, u32 param);
173
174s32 Script_SetBase(struct ScriptInterpreter *interpreter);
175s32 Script_ClearByte54(struct ScriptInterpreter *interpreter);
176s32 Script_SetByte54(struct ScriptInterpreter *interpreter);
177void FieldObject_WaitForMove(void *fieldObject);
179void Object_UpdateAllThumb(void);
181 s32 y, s32 z);
182void Object_SetMoveTarget(struct ObjectRuntime *object, s32 x, s32 y, s32 z);
184void Object_UpdateAllMotion(void);
185s32 Script_Wait(struct ScriptInterpreter *interpreter);
186s32 Script_WaitForArrival(struct ScriptInterpreter *interpreter);
187s32 Script_InvokeCallback(struct ScriptInterpreter *interpreter);
188s32 Script_FindLabel(struct ScriptInterpreter *interpreter, u32 labelKey);
189s32 Script_RepeatOrJump(struct ScriptInterpreter *interpreter);
190s32 Script_JumpToLabel(struct ScriptInterpreter *interpreter);
191s32 Script_JumpIfTrue(struct ScriptInterpreter *interpreter);
192s32 Script_JumpIfFalse(struct ScriptInterpreter *interpreter);
193s32 Script_End(struct ScriptInterpreter *interpreter);
194s32 Script_TestFlag(struct ScriptInterpreter *interpreter);
196s32 Script_SetAnimation(struct ScriptInterpreter *interpreter);
197s32 Script_FreeObject(struct ScriptInterpreter *interpreter);
198s32 Script_Nop(struct ScriptInterpreter *interpreter);
199s32 Script_PlaySound(struct ScriptInterpreter *interpreter);
200s32 ScriptObject_CheckOverlap(struct ScriptObjectEntry *object, s32 *values);
201struct ScriptObjectEntry *
203 s32 *values);
212s32 Object_Wander(struct ScriptInterpreter *interpreter);
214
215void Script_SetOrCompareCursor(struct ScriptOperands *operands, s32 operation,
216 s32 value);
217void Script_SetOrCompareRadius(struct ScriptOperands *state, s32 operation,
218 s32 value);
219void Script_SetOrCompareHalfword5e(struct ScriptOperands *work, s32 operation,
220 s32 value);
221s32 Script_ApplyOperandSet(struct ScriptInterpreter *interpreter);
222s32 Script_ApplyOperandAdd(struct ScriptInterpreter *interpreter);
224
225void ObjectDispatch_SetUpdateValue(void *rawObject, s32 value);
226u32 Field_RequestShortcut(u32 encodedAssignment);
228s32 Runtime_CheckRadiusOverlap(s32 *firstPosition, s32 radiusA,
229 s32 *secondPosition, s32 radiusB);
231s32 Object_MoveOnWorldMap(struct ScriptInterpreter *interpreter);
233s32 Object_MoveByKeys(struct ScriptInterpreter *interpreter);
234
235void Runtime_RemapBytesByTable(u8 *bytes, s32 byteCount);
238void Tilemap_ConvertBuffer(void);
241void Map_RenderMetatileRow(u32 layer, s32 tileX, s32 tileY);
242void Map_RenderMetatileColumn(u32 layer, s32 tileX, s32 tileY);
243void Map_UpdateLayerScroll(void);
244void Map_SetCameraCenter(s32 x, s32 y);
245void Map_CopyMetatileIndicesRect(s32 srcX, s32 srcY, u32 dstX, u32 dstY,
246 u32 width, u32 height);
247void Map_PlayMetatileCopySequence(u16 *sequence, s32 destinationX,
248 u32 destinationY);
249void Map_CopyMetatileCellsRect(s32 srcX, s32 srcY, s32 width, s32 height,
250 s32 dstX, s32 dstY);
251void Map_CopyCellAttributeRect(s32 srcX, s32 srcY, s32 width, s32 height,
252 s32 dstX, s32 dstY);
253void Map_CopyCellIndexRect(s32 srcX, s32 srcY, s32 width, s32 height, s32 dstX,
254 s32 dstY);
255void Map_SetShownLayers(u32 layerFlags);
256
257s32 Map_WriteLayerCellTile(s32 layer, s32 x, s32 y, s32 tile, s32 update);
258#ifdef UBFIX
260#else
262#endif
263void Map_SetWindowCellTile(s32 x, s32 y, s32 px, s32 py);
264void WorldMap_LoadGraphics(s32 x, s32 z);
266void Map_RenderPaletteMappedRow(u32 tileRow);
267void Map_RenderPaletteMappedColumn(u32 tileColumn);
268void WorldMap_UpdateView(void);
272void WorldMap_BeginStillView(void);
273void Map_ShowBg1FromBuffer(void);
274void Map_LoadAreaGraphics(void);
276void MapAnimation_Update(void);
277void Map_ClearLayerEntryFlag(u32 channelIndex);
278void Map_SetLayerEntryFlag(u32 channelIndex);
279void MapAnimation_StartChannels(const u16 *script);
280void MapAnimation_Suspend(void);
281void MapAnimation_Resume(void);
282void DisplayBlend_RunScript(void);
283void DisplayBlend_StartScript(u16 *script);
286
287void PaletteQueue_Initialize(void);
288s32 PaletteQueue_Add(s16 paletteBank, s16 firstColor, s16 delay,
289 s16 colorCount);
290void PaletteQueue_Stop(void);
291void PaletteQueue_Start(void);
292void PaletteQueue_StepCycles(void);
293
294s32 Curve_GetFirstSampleA(const u8 *heightBytes, s32 pixelX, s32 pixelY);
295s32 Curve_LerpTwoSamples(const u8 *heightBytes, s32 pixelX, s32 pixelY);
296s32 Curve_LerpTwoSamplesB(const u8 *heightBytes, s32 pixelX, s32 pixelY);
297s32 Curve_StepAtSummedPosition(const u8 *heightBytes, s32 x, s32 y);
298s32 Curve_StepAtDifferencePosition(const u8 *heightBytes, s32 x, s32 y);
299s32 Curve_LerpThreeSamplesByRatio(const u8 *heightBytes, s32 x, s32 y);
300s32 Curve_LerpThreeSamplesAtDifference(const u8 *heightBytes, s32 x, s32 y);
301s32 Curve_LerpTwoSamplesByTable(const u8 *heightBytes, s32 x, s32 y);
302s32 Curve_StepAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY);
303s32 Curve_StepAtHalfB(const u8 *heightBytes, s32 pixelX, s32 pixelY);
304s32 Curve_LerpThreeSamplesAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY);
305s32 Curve_LerpThreeSamplesAtHalfB(const u8 *heightBytes, s32 pixelX,
306 s32 pixelY);
307s32 Curve_LookupSampleByTable(const u8 *heightBytes, s32 pixelX, s32 pixelY);
308s32 Curve_LookupSampleByTableReversed(const u8 *heightBytes, s32 pixelX,
309 s32 pixelY);
310s32 Curve_GetFirstSampleB(const u8 *heightBytes, s32 pixelX, s32 pixelY);
311s32 Curve_GetFirstSampleC(const u8 *heightBytes, s32 pixelX, s32 pixelY);
312
313s32 Map_GetTerrainHeight(s32 layer, s32 x, s32 y);
315s32 GetMapCellCollision(s32 layer, s32 x, s32 y);
316void SetMapCellCollision(u32 layer, s32 x, s32 y, u32 collisionCode);
319 struct FieldPosition *position);
321s32 GetWorldMapCollision(struct WorldPosition *position);
322s32 CheckWorldMapWalkable(s32 unused, struct WorldPosition *position);
324 s32 *terrainKind);
325void Map_SetScreenShake(s32 shakeX, s32 shakeY, s32 shakeDecay);
326void Map_WaitForShakeToSettle(void);
327void TileMap_DrawRowsFromRam(const struct MapAffinePair *lines, u8 *pixels);
328void WorldMap_BuildScanlineTable(s32 depth, s32 *position,
329 struct MapScanline *scanline);
330
331void Ui_RunIconMonitor(void);
332s32 Ui_FindNextSpriteWithImage(s32 spriteId, s32 direction);
333void Map_BuildProbeRing(s32 centerX, s32 centerY,
334 struct SpritePlacement *positions);
335void Ui_FillGridColumnFromMetadata(s32 layerIndex, s32 animationIndex);
336void Ui_SetGridColumnNumber(s32 layerIndex, s32 spriteId);
338
339#endif
void AnimationObjects_SetActiveTimerSteps(struct AnimationObject *sprite, s32 step)
Sets the timer step, the animation speed, of each animated layer of a sprite (16 is normal speed).
Definition animation.c:392
s32 ResourceSlot_Load(u32 slot, u32 *buffer, s32 number, u32 variant)
Loads the frames of animation id number into resource slot slot's buffer: the resource listed for it ...
Definition animation.c:34
s32 ResourceMetadata_Register(struct AnimationObject *sprite, s32 id)
Adds a layer of animation id to a sprite, in its first free layer of four.
Definition animation.c:191
struct AnimationEntry * AnimationObject_Allocate(s32 id)
Takes a free animation layer record and starts it on animation id's first animation.
Definition animation.c:445
void ResourceMetadata_ClearRecord(struct AnimationEntry *record)
Zeroes one animation layer (struct AnimationEntry); does nothing for NULL.
Definition animation.c:499
void ResourceMetadata_ReleaseSlot(struct AnimationObject *sprite, u32 index)
Removes and clears a sprite's layer number no (0-3), trimming the sprite's layer count when no later ...
Definition animation.c:258
void ObjectSystem_Configure(s32 mode)
Allocates and zeroes the 64 sprites and 64 animation layers (from the fixed blocks in mode 3,...
Definition animation.c:411
s32 AnimationObjects_SelectAnimation(struct AnimationObject *sprite, s32 animation)
Starts animation flags & 0x7f on every layer of a sprite (bit 7 keeps each layer's place and timer),...
Definition animation.c:317
s32 AnimationObjects_SetActiveFrameTimers(struct AnimationObject *sprite, s32 frames)
Sets each animated layer's timer to the given duration in frames.
Definition animation.c:367
void ResourceMetadata_Unregister(struct AnimationObject *sprite, s32 layer)
Removes the layer handle from a sprite and clears it, trimming the sprite's layer count when no later...
Definition animation.c:231
s32 Animation_LookupValueByKey(s32 tag)
Returns the buffer loaded into the resource slot with this tag, or 0.
Definition animation.c:103
void ResourceObject_Release(struct AnimationObject *sprite)
Releases a sprite: its VRAM cache entry (unless retainCacheEntry is set), its four animation layers,...
Definition animation.c:624
s32 Animation_InitializeObjects(struct AnimationObject *sprite)
Resets each layer of a sprite from its animation's metadata: its facing kind, frames,...
Definition animation.c:118
s32 ResourceMetadata_SumCommandLengths(s32 id, u32 animation, s32 frameCount)
Returns how long the first frameCount frames of animation number animation of id last: the sum of the...
Definition animation.c:646
void Animation_SetWorkEntry(struct AnimationEntry *layer, s32 animation)
Starts the indexed animation on a layer when its metadata contains it.
Definition animation.c:289
void Animation_InitWorkFromMetadata(struct AnimationEntry *layer)
Resets one animation layer from its animation's metadata, as Animation_InitializeObjects does for eac...
Definition animation.c:160
struct AnimationObject * ResourceObject_Create(s32 id)
Creates a sprite for animation id, taking one of the 64 free sprites and a VRAM cache entry for its t...
Definition animation.c:512
u8 * Resource_DecompressLz(const u8 *source, u8 *destination)
Decompresses an LZ stream from source into destination and returns destination.
Definition decompress.c:17
void ObjectDispatch_StartMoveByKeys(struct DispatchObject *object)
Starts an object on the script that moves it by the keys (SC_KEYS).
Definition objects.c:454
void ObjectDispatch_SetChildRotation(struct DispatchObject *object, u32 rotation)
Sets the rotation of an object's sprite, when it has just one.
Definition objects.c:401
void ObjectDispatch_StartApproachLink(struct DispatchObject *object, s32 linkedObjectHandle)
Starts an object on the script that approaches its linked object (SC_APPROACH_LINK),...
Definition objects.c:438
void Animation_ApplyChildValues(struct DispatchObject *object, u32 param)
Sets the draw parameter of a one-sprite object's layers (see ObjectGroup_SetChildValueUnlessFifteen).
Definition objects.c:541
void ObjectDispatch_SetAnimationAndSpeed(struct DispatchObject *object, s32 animation, s32 step)
Both of the above: switches all of an object's sprites to animation and sets their timer step to step...
Definition objects.c:374
struct ObjectRuntime * FieldObject_Create(s32 encodedSprite, s32 x, s32 y, s32 z)
Creates a field object at (x, y, z), in 16.16 pixels, or returns 0 when none is free.
Definition objects.c:245
void Animation_SetIndexAndInitObjects(void *rawDispatchObject, s32 animationId)
Gives a one-sprite object's first layer animation id animationId and restarts its layers.
Definition objects.c:410
void Map_RenderAnimatedTileFramesForObject(u8 *sprite)
Dissolves a sprite pixel by pixel, four steps a frame, over 32 frames.
Definition objects.c:62
void ObjectDispatch_Initialize(struct DispatchObject *object, const s32 *script)
Gives an object a script and starts it from the top.
Definition objects.c:323
s32 Map_GetScreenRelativePosition(struct ObjectRuntime *object, s32 *screenPosition)
Writes the object's screen position, in pixels, to screenPosition[0..1] and returns 0 when it is on o...
Definition objects.c:114
void ObjectDispatch_RegisterChildMetadata(struct DispatchObject *object, s32 animationId)
Adds a layer of animation id animationId to a one-sprite object's sprite.
Definition objects.c:426
void ObjectDispatch_StartPlayerControl(struct DispatchObject *object)
Starts an object on the player control script (SC_PLAYER).
Definition objects.c:460
void ObjectDispatch_SetSingleChildFlags(struct DispatchObject *object, u32 flags)
Sets the flags of a one-sprite object's sprite (bit 0: draw its shadow).
Definition objects.c:511
UNUSED void ResourceTable_ReservedNoOpC0C4(void)
Definition objects.c:185
void ObjectDispatch_StartKeyCheck(struct DispatchObject *object)
Starts an object on the script that runs SC_KEY_COUNT every frame.
Definition objects.c:447
void ObjectDispatch_SetChildBlendMode(struct DispatchObject *object, u32 mode)
Sets the OAM blend mode of a one-sprite object's sprite.
Definition objects.c:522
void Map_RenderAllAnimatedTileFrames(u8 **sprites, s32 count)
Dissolves count sprites together, pixel by pixel, over 32 frames.
Definition objects.c:80
void ObjectDispatch_StartWorldMapControl(struct DispatchObject *object)
Starts an object on the world map control script (SC_WORLD).
Definition objects.c:466
UNUSED void ResourceTable_ReservedNoOp2(void)
Definition objects.c:187
void ObjectDispatch_Release(struct DispatchObject *object)
Releases an object's sprites and zeroes it, freeing it.
Definition objects.c:212
void * ObjectDispatch_FindFreeObject(void)
Returns the first of the 64 objects not in use (with no script), or 0.
Definition objects.c:191
UNUSED s32 ObjectDispatch_ReturnTrue(void)
Definition objects.c:573
void ObjectSystem_ResumeProjectionAndHideLayers(void)
Resumes the object camera updates and hides BG1-3 and the sprites.
Definition objects.c:566
void ObjectDispatch_SelectAnimation(void *rawObject, s32 value)
Switches all of an object's sprites to animation value.
Definition objects.c:365
void ObjectDispatch_StartCamera(struct DispatchObject *object, s32 linkedObjectHandle)
Starts an object on the camera script (SC_CAMERA).
Definition objects.c:480
void Map_RenderAnimatedTileFrame(u8 *obj, u32 pos)
One step of dissolving a sprite pixel by pixel.
Definition objects.c:14
void ObjectDispatch_SetAnimationSpeed(struct DispatchObject *rawObject, s32 value)
Sets the animation speed (timer step) of all of an object's sprites.
Definition objects.c:370
void ObjectSystem_Initialize(s32 controlMode)
Sets up the object system: allocates and zeroes the 64 objects and registers the per-frame updates.
Definition objects.c:157
void ObjectDispatch_StartIdle(struct DispatchObject *object)
Starts an object on the idle script (a lone SC_END).
Definition objects.c:471
void ObjectDispatch_WaitForValue16(void *rawObject)
Waits until the object's script reaches SC_END (0x10), at most 300 frames.
Definition objects.c:495
void ObjectDispatch_SetChildFixedScale(struct DispatchObject *object, u32 fixedScale)
Makes the fixed camera draw a one-sprite object at its own scale instead of scaling it by distance.
Definition objects.c:531
void ObjectSystem_SuspendProjectionAndShowSprites(void)
Suspends the object camera updates, starts the palette back to normal and, a frame later,...
Definition objects.c:552
void TileMap_DrawRowsFromRam(const struct MapAffinePair *lines, u8 *pixels)
Draws the current affine page into the world map's still-view pixels.
Definition view.c:64
void Map_WaitForShakeToSettle(void)
Waits until both shake amplitudes are below 1/256 pixel, with a 300-frame limit for a shake whose dec...
Definition view.c:36
void Map_SetScreenShake(s32 shakeX, s32 shakeY, s32 shakeDecay)
Changes the shake without restarting an axis whose argument is negative.
Definition view.c:15
void WorldMap_BuildScanlineTable(s32 pitchSlope, s32 *position, struct MapScanline *scanline)
Rebuilds the ground plane's scanline terms when the world map pitch changes.
Definition view.c:88
void Map_ShowBg1FromBuffer(void)
VBlank: shows BG1 and copies the area's tiles back into VRAM.
Definition world_map.c:722
void Map_RenderPaletteMappedColumn(u32 tileColumn)
Draws world map tileColumn into the BG map: 64 cells down.
Definition world_map.c:484
s32 Map_InitializePerspectiveScene(void)
Sets up the world map's perspective view: BG2 and BG3 in affine mode, the camera work,...
Definition world_map.c:114
void WorldMap_UpdateView(void)
Each frame on the world map: loads tiles as the view moves, shakes and follows the player,...
Definition world_map.c:508
void Map_LoadAreaGraphics(void)
Reloads the world map area's palette and tiles after the still view, puts the default cells back and ...
Definition world_map.c:737
void Map_SetWindowCellTile(s32 x, s32 y, s32 px, s32 py)
Puts world map tile (x / 16, y / 16) at cell (px / 16, py / 16) of the tile id grid,...
Definition world_map.c:271
void MapAnimation_ApplyAffineFrame(void)
HBlank setup each frame on the world map: copies the first scanline's BG2 and BG3 affine parameters,...
Definition world_map.c:386
void Map_UpdateCurrentTileBlock(void)
Loads and draws the 2x2 world map tiles around the player in both layers.
Definition world_map.c:607
void MapAnimation_PresentFrame(void)
VBlank: shows BG1 and copies the decoded frame's tiles into VRAM.
Definition world_map.c:684
void Map_RenderPaletteMappedRow(u32 tileRow)
Draws world map tileRow into the BG map: 32 cells, then 32 more a screen block on.
Definition world_map.c:456
void WorldMap_BeginStillView(void)
Freezes the world map's perspective view as a still picture on BG1: saves BG1's tiles,...
Definition world_map.c:701
void Map_LoadDefaultCellsAndUpdateBlock(void)
Puts the default world map cells back after the still view and returns to the perspective view,...
Definition world_map.c:780
void WorldMap_LoadGraphics(s32 x, s32 z)
Loads the world map's palette and tiles for the area at (x, z): the second set where the ground there...
Definition world_map.c:311
s32 Map_WriteLayerCellTile(s32 layer, s32 x, s32 y, s32 tile, s32 update)
Loads world map tile tile into quarter (x & 1, y & 1) of a layer's block buffer, decompressing it fro...
Definition world_map.c:38
void Map_PreloadCurrentTileBlock(void)
Loads the first of the 2x2 world map tiles around the player that is not shown yet (at most one a fra...
Definition world_map.c:648
void DisplayBlend_SuspendScript(void)
Suspends the blend script.
UNUSED void PaletteQueue_Initialize(void)
Allocates the palette cycling queue (heap slot 28) with its four entries cleared.
UNUSED s32 PaletteQueue_Add(s16 paletteBank, s16 firstColor, s16 delay, s16 colorCount)
Adds a palette cycle: colorCount colours of background palette paletteBank from firstColor,...
void Map_SetLayerEntryFlag(u32 channelIndex)
Pauses tile animation channel channelIndex by setting its paused byte.
void MapAnimation_Update(void)
Each frame: runs the 16 tile animation channels.
void DisplayBlend_StartScript(u16 *script)
Starts a map's blend script, unless it is empty.
UNUSED void PaletteQueue_Stop(void)
Stops the palette cycles and frees their queue (heap slot 28).
void MapAnimation_Resume(void)
Resumes the tile animations, unless the world map's still view is shown.
void Map_ClearLayerEntryFlag(u32 channelIndex)
Resumes tile animation channel channelIndex by clearing its paused byte.
void PaletteQueue_StepCycles(void)
Each frame: advances each palette cycle whose timer has run out by one colour, writing the rotated co...
void DisplayBlend_ResumeScript(void)
Resumes the blend script, through DisplayBlend_ResumeScriptFar.
UNUSED void PaletteQueue_Start(void)
Starts running the palette cycles each frame.
void DisplayBlend_RunScript(void)
Each frame: runs the map's blend script.
void MapAnimation_StartChannels(const u16 *script)
Starts the tile animation channels a map's animation script lists: each 0xfdNN marker starts channel ...
void MapAnimation_Suspend(void)
Suspends the tile animations, unless the world map's still view is shown.
void Map_SetCameraCenter(s32 x, s32 y)
Centres the view on (x, y) in 16.16 pixels, clamped to the map's bounds, and redraws every enabled la...
Definition map_layers.c:572
void Tilemap_DecodeStagedBuffer(s32 size)
Unpacks the staged block data into gMapBlocks.
Definition map_layers.c:39
void Map_CopyMetatileCellsRect(s32 srcX, s32 srcY, s32 width, s32 height, s32 dstX, s32 dstY)
Copies a rectangle of cells (16x16 pixels each) as they are, from (srcX, srcY) to (dstX,...
Definition map_layers.c:803
void Map_CopyCellIndexRect(s32 srcX, s32 srcY, s32 width, s32 height, s32 dstX, s32 dstY)
Copies only the block numbers of a rectangle of cells, from (srcX, srcY) to (dstX,...
Definition map_layers.c:950
void Tilemap_ConvertBuffer(void)
Converts the map's cells in place with Tile_ConvertMap, run from RAM, from a saved copy of the staged...
Definition map_layers.c:110
void Map_CopyMetatileIndicesRect(s32 srcX, s32 srcY, u32 dstX, u32 dstY, u32 width, u32 height)
Copies the block numbers of a rectangle of cells from (srcX, srcY) to (dstX, dstY),...
Definition map_layers.c:644
void Map_UpdateLayerScroll(void)
Each frame on a layered map: centres the view on the point the map follows (origin),...
Definition map_layers.c:474
void Map_RenderMetatileRow(u32 layer, s32 tileX, s32 tileY)
Draws a row of 16 blocks (32 tiles) of a layer's cells into its BG map (screen block 5 + layer),...
Definition map_layers.c:411
void Map_RenderMetatileColumn(u32 layer, s32 tileX, s32 tileY)
Draws a column of 11 blocks of a layer's cells, one tile wide, into its BG map, starting at tile (til...
Definition map_layers.c:443
void Map_PlayMetatileCopySequence(u16 *sequence, s32 destinationX, u32 destinationY)
Plays a map edit sequence (struct MapCopyCommand records, ended by a source of 0xffff): copies each r...
Definition map_layers.c:748
void Map_CenterOnFollowedPoint(void)
Centres the camera on the point the map follows (origin: x, height, z), or on (0, 0) when there is no...
Definition map_layers.c:387
void Map_SetShownLayers(u32 layerFlags)
Sets which of BG1-BG3 the map shows (bits 9-11 of its display flags, as in REG_DISPCNT) from layerFla...
s32 Map_LoadLayeredScene(s32 index)
Loads layered scene index from gMap_LayeredScenes: its blocks, collision, cells, tile animations,...
Definition map_layers.c:211
void Runtime_RemapBytesByTable(u8 *bytes, s32 byteCount)
Remaps byteCount bytes in place through gRuntime_ByteRemapTable.
Definition map_layers.c:10
void Map_CopyCellAttributeRect(s32 srcX, s32 srcY, s32 width, s32 height, s32 dstX, s32 dstY)
Copies only the attributes of a rectangle of cells, from (srcX, srcY) to (dstX, dstY),...
Definition map_layers.c:923
UNUSED void Tilemap_NumberPlaceholderBlocks(void)
Gives each map cell whose block number is 0xfff (a placeholder) a number of its own,...
Definition map_layers.c:84
UNUSED s32 ObjectCamera_ReturnTrue(void)
void ObjectSystem_UpdateCamera(void)
Each frame, with the scrolling camera: places every object's sprite on the screen.
void ObjectSystem_UpdateCameraFixed(void)
Each frame, with the fixed camera: places every object's sprite, from the 64th object down,...
void Object_SetMoveTarget(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
Sends an object towards (x, y, z), in 16.16 pixels.
UNUSED void Object_RunUpdateAllFromHeap(void)
Copies Object_UpdateAll (ARM code) to the heap, runs it once and frees it.
s32 Script_SetBase(struct ScriptInterpreter *interpreter)
SC_BASE: restarts the script at the next word, and returns 1 to run on.
s32 Script_ClearByte54(struct ScriptInterpreter *interpreter)
SC_B54_OFF: clears spriteStorageKind, hiding the sprites, and moves on to the next command.
s32 Object_IsTargetUnset(struct ObjectRuntime *object)
Returns 1 when the object has no movement target: none of its target coordinates set,...
s32 Script_SetByte54(struct ScriptInterpreter *interpreter)
SC_B54_ON: sets spriteStorageKind to 1, one sprite drawn, and moves on to the next command.
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
void Object_UpdateAllThumb(void)
Advances all 64 field objects by one frame, as Object_UpdateAll does for the eight script objects,...
void Object_UpdateAllMotion(void)
Advances the first 14 objects' motion by one frame, without running their scripts: steering towards a...
void Object_SetPositionAndResetMotion(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
Places the object at (x, y, z), in 16.16 pixels, clears its movement target and stops it.
s32 Runtime_CheckRadiusOverlap(s32 *firstPosition, s32 radiusA, s32 *secondPosition, s32 radiusB)
Returns 0 when two spheres overlap: at positions a and b (16.16 pixels) with radii radiusA and radius...
s32 Object_MoveByKeys(struct ScriptInterpreter *interpreter)
SC_KEYS: moves an object 8 pixels at a time by the direction pad, with up and down changing its heigh...
s32 Field_CheckConfiguredKeysAndCount(struct ScriptInterpreter *interpreter)
SC_KEY_COUNT: checks the configured keys (Field_CheckConfiguredKeys).
s32 Object_MoveOnWorldMap(struct ScriptInterpreter *interpreter)
SC_WORLD: moves the player on the world map by the direction pad, as SC_PLAYER does on the field,...
s32 FieldObject_UpdatePlayerControl(struct ScriptInterpreter *interpreter)
SC_PLAYER: moves the player on the field by the direction pad: walking or running,...
UNUSED void ObjectDispatch_SetUpdateValue(void *rawObject, s32 value)
Stores value as a word at the object's unk6c.
u32 Field_RequestShortcut(u32 encodedAssignment)
Handles a shortcut key's assignment: its top two bits choose what it requests (0 Psynergy,...
s32 Field_CheckConfiguredKeys(void)
Checks the keys the player has configured: Select, A and Start set their flag in the event work and r...
A sprite's screen position and scale.
void Script_SetOrCompareWord68(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareUnsignedHalfword(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Object_ApproachLinkedObject(struct ScriptInterpreter *interpreter)
SC_APPROACH_LINK: follows the linked object at its speed.
s32 Script_RepeatOrJump(struct ScriptInterpreter *interpreter)
SC_LOOP(n, to): jumps to label to until it has done so n - 1 times, then moves on; with n = SC_FOREVE...
void Script_SetOrCompareVerticalMotion(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_ApplyRelativePosition(struct ScriptInterpreter *interpreter)
SC_MOVE_BY(x, y, z): sends the object towards its position plus (x, y, z).
s32 Script_StoreAngleToLinkedObject(struct ScriptInterpreter *interpreter)
SC_FACE_LINK: stores the angle from the object to its linked object in scriptValue,...
s32 Script_SetFlagAndTest(struct ScriptInterpreter *interpreter)
SC_FLAG_ON(f) and SC_FLAG_OFF(f): test game flag f, then set or clear it.
s32 Script_JumpToLabel(struct ScriptInterpreter *interpreter)
SC_JUMP(to): jumps to label to.
s32 Script_Wait(struct ScriptInterpreter *interpreter)
SC_WAIT(n): waits n frames; this frame counts as the first.
s32 Script_ClearFlagAndTest(struct ScriptInterpreter *interpreter)
void Script_SetOrCompareGravity(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_PlaySound(struct ScriptInterpreter *interpreter)
SC_SE(n): sends sound command n (a sound effect).
s32 Camera_FollowLeaderInBounds(struct ScriptInterpreter *interpreter)
SC_CAMERA: keeps the camera object on its leader (linkedObject), clamped so the view stays on the map...
void Script_SetOrCompareRadius(struct ScriptOperands *state, s32 operation, s32 value)
Work value SW_RADIUS: sets, adds to or compares the object's radius.
struct ScriptObjectEntry * ScriptObject_FindOverlappingEntry(struct ScriptObjectEntry *object, s32 *values)
Returns the first solid object that an object at position values would overlap, as ScriptObject_Check...
s32 Script_ApplyOperandSet(struct ScriptInterpreter *interpreter)
SC_SET(w, v): sets work value w to v.
void Script_SetOrCompareSpeedLimit(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareSignedHalfword66(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrComparePaused(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_JumpIfTrue(struct ScriptInterpreter *interpreter)
SC_IF(to): jumps to label to when the last test was true.
void Script_SetOrCompareRepeatCount(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_ApplyOperandAdd(struct ScriptInterpreter *interpreter)
SC_ADD(w, v): adds v to work value w.
s32 Script_ToggleFlagAndTest(struct ScriptInterpreter *interpreter)
SC_FLAG_REV(f): tests game flag f, then flips it.
s32 Script_InvokeCallback(struct ScriptInterpreter *interpreter)
SC_CALL(fn): calls fn with the object.
s32 Script_ApplyLocalOffsetPosition(struct ScriptInterpreter *interpreter)
SC_MOVE_LOCAL(a, b): sends the object towards its position plus an offset that is never filled in; th...
s32 Script_Nop(struct ScriptInterpreter *interpreter)
SC_NOP(v): does nothing with its operand.
void Script_SetOrCompareCollisionFlags(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareComparisonResult(struct ScriptOperands *operands, s32 operation, s32 value)
s32 ScriptObject_CheckOverlap(struct ScriptObjectEntry *object, s32 *values)
Returns -1 when an object at position values would overlap a solid object (bit 0 of collisionFlags),...
s32 Script_FreeObject(struct ScriptInterpreter *interpreter)
SC_FREE: releases the object through ObjectDispatch_Release, which releases its sprites and zeroes it...
void Script_SetOrCompareCursor(struct ScriptOperands *operands, s32 operation, s32 value)
Work value SW_CURSOR: sets, adds to or compares the script cursor.
void Script_SetOrCompareByte63(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_End(struct ScriptInterpreter *interpreter)
SC_END: hands the object back to the idle script, gScript_MainScript, whose lone SC_END runs again ea...
s32 Script_ApplyAbsolutePosition(struct ScriptInterpreter *interpreter)
SC_MOVE(x, y, z): sends the object towards (x, y, z).
void Script_SetOrCompareScaleX(struct ScriptOperands *operands, s32 operation, s32 value)
s32 ScriptObject_WanderNearHome(struct ScriptInterpreter *interpreter)
SC_WANDER_HOME(base, range, limit): wanders as SC_WANDER does, testing more ground around the point,...
void Script_SetOrCompareAddress50(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareVelocityX(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareArrivalAxis(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareTargetY(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareZ(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_WaitForArrival(struct ScriptInterpreter *interpreter)
SC_SYNC: waits until the object arrives at its target, or until a solid object has blocked it for 60 ...
s32 Object_Wander(struct ScriptInterpreter *interpreter)
SC_WANDER(base, range, limit): walks to a random point base to base + range away, within 90 degrees e...
void Script_SetOrCompareSnapToTarget(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareX(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareScaleY(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_TestFlag(struct ScriptInterpreter *interpreter)
SC_FLAG_CHECK(f): tests game flag f.
void Script_SetOrCompareY(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareTargetX(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareHalfword5e(struct ScriptOperands *work, s32 operation, s32 value)
Work value SW_WAIT: sets, adds to or compares the wait counter.
s32 Script_ApplyOperandCompare(struct ScriptInterpreter *interpreter)
SC_CMP(w, v): tests whether work value w equals v.
void Script_SetOrCompareByte54(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareWord4c(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareMotionFlags(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareSignedHalfword64(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_SetPositionAndResetMotion(struct ScriptInterpreter *interpreter)
SC_POS(x, y, z): places the object at (x, y, z) and stops it.
s32 Script_SetAnimation(struct ScriptInterpreter *interpreter)
SC_ARG(v): switches the object's sprites to animation v.
void Script_SetOrCompareVelocityY(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_ApplyLinkedObjectPosition(struct ScriptInterpreter *interpreter)
SC_MOVE_LINK: sends the object towards its linked object.
void Script_SetOrCompareByte62(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_FindLabel(struct ScriptInterpreter *interpreter, u32 labelKey)
Returns the cursor just past the script's label key (SC_LABEL or SC_TO, matched without the bit that ...
void Script_SetOrCompareTerrainHeight(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareVelocityZ(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareTargetZ(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareAcceleration(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareSteeringFlags(struct ScriptOperands *operands, s32 operation, s32 value)
void Script_SetOrCompareAddress(struct ScriptOperands *operands, s32 operation, s32 value)
The work value handlers, one for each entry of enum ScriptWork (see gScript_OperandHandlerTable in op...
void Script_SetOrCompareUpdateAddress(struct ScriptOperands *operands, s32 operation, s32 value)
s32 Script_JumpIfFalse(struct ScriptInterpreter *interpreter)
SC_IFNOT(to): jumps to label to when the last test was false.
s32 Sprite_ComposeAnimationFrame(struct AnimationObject *obj, u16 dir)
Advances a sprite's animation layers by one frame, picks each layer's frame for the facing dir,...
Definition sprite_draw.c:25
void Render_ApplyProjectedPlacement(struct AnimationObject *sprite, const struct SpritePlacement *position, const struct SpriteScale *scale, s32 facing)
Places a sprite for the scrolling camera and queues it for drawing.
void Render_PlaceSpritePartPair(struct AnimationObject *sprite, s32 screenX, s32 height, s32 screenY, s32 groundHeight, s32 *scale)
Positions a sprite's image (part 0) and shadow (part 1) on the screen: the image centred on screenX a...
void Render_PlaceProjectedSprite(struct AnimationObject *sprite, s32 *point, s32 *scale, s32 facing, s32 depth)
Places a sprite at 3D point for the fixed camera and queues it for drawing: projected to the screen a...
void ObjectGroup_SetChildValueUnlessFifteen(void *rawSprite, u32 value)
Sets the draw parameter of each of a sprite's layers to value, except layers whose parameter is 15,...
s32 Ui_FindNextSpriteWithImage(s32 spriteId, s32 direction)
Returns the next sprite id after spriteId, stepping by direction (1 or -1) and wrapping within 0-511,...
void Ui_SetGridColumnPriority(s32 layerIndex, s32 value)
void Ui_RunIconMonitor(void)
A debug sprite viewer, which never returns.
void Ui_FillGridColumnFromMetadata(s32 layerIndex, s32 animationIndex)
Starts animationIndex on layerIndex of each of the viewer's ten sprites, each one a frame (16 timer u...
void Map_BuildProbeRing(s32 centerX, s32 centerY, struct SpritePlacement *positions)
Lays out the sprite viewer's ring around pixel (x, z): one position per facing of the first sprite's ...
void Battle_PlaceActorsByFormationKind(void)
Each frame in the sprite viewer: places each copy of the sprite at its ring position,...
void Ui_SetGridColumnParameter(s32 layerIndex, s32 value)
Sets the draw parameter or the priority of one layer of the viewer's ten sprites.
void Ui_SetGridColumnNumber(s32 layerIndex, s32 spriteId)
Sets spriteId on layerIndex of each of the viewer's ten sprites.
One animation layer of a sprite: its animation id, frames, running script and timer.
Definition animspr.h:37
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
u8 count
layers in use, up to the last one present
Definition animspr.h:129
A field object as the object dispatcher's far calls take it.
A position on the field.
One screen line's affine parameters for BG2 and BG3.
Definition mapframe.h:27
One screen line's ground-plane terms on the world map: its width scale and distance,...
Definition mapframe.h:13
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 z
16.16 fixed-point pixels
s32 * script
the object script it runs; null when the object is free
u8 flags
FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in...
void * animation
its sprite, or its list of four, by animationKind
s32 x
16.16 fixed-point pixels
s16 step
the script cursor, in words
s32 y
16.16 fixed-point pixels
The prefix that command handlers read from a field object's 0x70-byte slot.
Definition script.h:16
A field object as the script commands' overlap checks see it.
A field object as its object script commands see it: the script and its place, position,...
The whole 0x70-byte slot as SC_SET, SC_ADD and SC_CMP see it: each field is one work value (enum Scri...
Definition script.h:49
A sprite's screen position and its two vertical offsets, in 16.16 pixels.
Horizontal and vertical sprite scale; 0x10000 is the original size.
A position on the world map, as its walkability check reads it.
Definition map.h:74
s32 height
16.16 fixed-point pixels
Definition map.h:76
s32 Curve_LerpTwoSamplesByTable(const u8 *heightBytes, s32 x, s32 y)
A raised or sunken rounded square: sample 1 where gCurve_LerpWeightTable is 1, sample 0 in the corner...
Definition terrain.c:188
s32 Curve_LerpTwoSamplesB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along y: from sample 0 at y = 0 towards sample 1 at y = 16.
Definition terrain.c:44
s32 Curve_GetFirstSampleB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
Flat, as Curve_GetFirstSampleA. Kind 14.
Definition terrain.c:323
s32 Map_CheckObjectStep(struct ObjectRuntime *object, struct FieldPosition *position)
Returns whether an object can step to position: 2 when the cell there is a wall (collision code 0xff)...
Definition terrain.c:454
s32 Curve_LookupSampleByTableReversed(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The same, with the table mirrored left to right.
Definition terrain.c:311
s32 Map_GetCellAttributeLowNibble(s32 layer, s32 x, s32 y)
Returns the terrain kind (the low four bits of the first collision byte) of a layer's cell at (x,...
Definition terrain.c:376
s32 Curve_StepAtSummedPosition(const u8 *heightBytes, s32 x, s32 y)
A step across the diagonal x + y = 15: sample 0 before it, sample 1 after it and the higher of the tw...
Definition terrain.c:61
s32 CheckWorldMapWalkable(s32 unused, struct WorldPosition *position)
Returns 0 when the world map at position can be walked on (collision 5 to 12), else -1.
Definition terrain.c:586
s32 Curve_GetFirstSampleC(const u8 *heightBytes, s32 pixelX, s32 pixelY)
Flat, as Curve_GetFirstSampleA. Kind 15.
Definition terrain.c:329
s32 Curve_LerpTwoSamples(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along x: from sample 0 at x = 0 towards sample 1 at x = 16.
Definition terrain.c:28
UNUSED s32 Map_GetCellHighFlags(s32 x, s32 y)
Returns the top two bits of the block word of the cell at pixel (x, y).
Definition terrain.c:437
s32 GetWorldMapCollision(struct WorldPosition *position)
Returns the world map's collision value (1-15) at position: from the upper collision layer where it h...
Definition terrain.c:535
s32 Curve_StepAtHalfB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A step along y: sample 0 for y < 8, sample 1 from y = 8.
Definition terrain.c:214
s32 Curve_LookupSampleByTable(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The sample gCurve_SampleIndexTable picks for (x, y).
Definition terrain.c:300
s32 Curve_GetFirstSampleA(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The terrain height functions (gMap_TerrainHeightFunctions): each takes a cell's height samples after ...
Definition terrain.c:21
s32 GetWorldMapTerrainBehavior(struct WorldPosition *position, s32 *terrainKind)
Returns the world map's terrain behaviour at position from gWorldMap_TerrainBehaviorTable,...
Definition terrain.c:599
s32 Curve_LerpThreeSamplesAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along x that bends at the middle: sample 0 at x = 0, sample 1 at x = 8, towards sample 2 at x...
Definition terrain.c:228
s32 Curve_StepAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A step along x: sample 0 for x < 8, sample 1 from x = 8.
Definition terrain.c:201
s32 CheckMapPositionCellOccupied(struct WorldPosition *position)
Returns 0 when the cell under position (its x, and y less its height) in layer 2 is a wall (collision...
Definition terrain.c:506
s32 Curve_StepAtDifferencePosition(const u8 *heightBytes, s32 x, s32 y)
A step across the diagonal x = y: sample 0 where y < x, sample 1 where y > x and the higher of the tw...
Definition terrain.c:88
s32 GetMapCellCollision(s32 layer, s32 x, s32 y)
Returns the collision code of a layer's cell at (x, y) in 16.16 pixels.
Definition terrain.c:401
s32 Curve_LerpThreeSamplesAtDifference(const u8 *heightBytes, s32 x, s32 y)
A slope that bends on the diagonal x = y: from sample 0 at the top right corner to sample 1 on the di...
Definition terrain.c:149
s32 Curve_LerpThreeSamplesByRatio(const u8 *heightBytes, s32 x, s32 y)
A slope that bends on the diagonal x + y = 15: from sample 0 at the top left corner to sample 1 on th...
Definition terrain.c:118
void SetMapCellCollision(u32 layer, s32 x, s32 y, u32 collisionCode)
Sets the collision code of a layer's cell at (x, y) in 16.16 pixels.
Definition terrain.c:422
s32 Curve_LerpThreeSamplesAtHalfB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along y that bends at the middle, as kind 10 does along x.
Definition terrain.c:266
s32 Map_GetTerrainHeight(s32 layer, s32 x, s32 y)
Returns the ground height of a layer at (x, y) in 16.16 pixels: the height function of the cell's ter...
Definition terrain.c:343
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11