include/field/field.h
The field engine's routines, tables and types that other files share: the actors and their scripts, the sprites, the map grid and the World Map, entering and leaving a scene, field Psynergy and its effects, the ropes and tightropes, and the other modules' routines the field calls.
#include "fixed_math.h"#include "types.h"#include "edition.h"#include "field/actor.h"#include "system.h"#include "resource_ids.h"#include "field/particle.h"#include "field/sprite.h"#include "field/script_commands.h"#include "edition_values.h"#include "field/field_functions.h"
Included by battle_internal.h, battle_effect_internal.h, level.c, psynergy_test.c, psynergy_test_2.c, test_scenes.c, field_effect_data.c, field_effect_tables.c, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, lucky_dice.c, map_grid_data.c, psynergy_reach.c, script_commands_internal.h, script_commands_scripts.c, script_commands_tables.c, game_internal.h, main_routine.c, credits.c, menu_internal.h, atteka_inlet.c, champa.c, daila.c, eastern_alhafra.c, epilogue.c, garoh_rooms.c, idejima.c, islet_cave.c, izumo.c, lemuria_dock.c, lemuria_palace.c, lemurian_ship.c, madra_catacombs.c, madra_drawbridge.c, madra_rooms.c, mikasalla.c, naribwe.c, northern_reaches.c, osenia_cliffs.c, actor_create_silhouette.c, actor_set_sprite_priority.c, emote_pop_tilted.c, field_effect_set_sprite_priority.c, staff_credit.c, suhalla_gate.c, title.c, venus_lighthouse_entrance.c, yallam.c, shop_internal.h and 2 more.
Structures
| Name | Description | |
|---|---|---|
struct | WORLD_MAP_METATILE | One 32-pixel metatile of the World Map: its tile and its encounter region; RamMapBlocks holds WORLD_MAP_VIEW_METATILES by WORLD_MAP_VIEW_METATILES of them. |
struct | FIELD_UNIT | A party member's unit as the field reads it: its gauges and its HP and PP. |
struct | FIELD_PSYNERGY_REACH | How far a field Psynergy reaches from its caster, one row a kind in FieldPsynergyReach, ended by -1: fdMeasurePsynergyHeight and fdMeasurePsynergyReach read it. |
struct | RISING_PARTICLE | One rising particle: its sprite, world position, drift and ticks left. |
struct | RISING_PARTICLE_STATE | HEAP_SLOT_WEATHER while the rising particles run: their tiles' VRAM cache entry and first tile, and the particles. |
struct | EFFECT_OWNER | An actor (ACTOR) as the Mars Djinni's sparks read the leader: its position and its sprite, typed. |
struct | LINE_SCROLL_STATE | The line scroll's state: two pages of BG1 to BG3 scroll offsets for each of the 160 scanlines, and the sine wave that bends them on each axis. |
struct | TIGHTROPE_NODE | One node of a tightrope (fdTightropeInit's state): a point on the rope, and the sprite fdTightropeDraw puts between it and the next node. |
struct | TIGHTROPE_SLOT | One of the eight tightropes: the two posts it runs between and its wobble. |
struct | TIGHTROPE_WORK | The tightropes' state (HEAP_SLOT_TIGHTROPE). |
struct | ROPE_NODE | One node of a rope Lash throws and ties (fdRopeInit's state): a point on the rope, and the sprite fdRopeDraw puts between it and the next node. |
struct | ROPE_SLOT | One of the eight ropes: the two posts it runs between and its swing. |
struct | ROPE_WORK | The ropes' state (HEAP_SLOT_ROPE). |
Macros
| Name | Description | |
|---|---|---|
#define | ACTOR_SPRITE_KIND_MASK 15 | ACTOR.spriteStorageKind's low four bits, its ACTOR_SPR_KIND. |
#define | ACTOR_CREATE_SPRITE_MASK 0xfff | The sprite id in fdActorCreate's id, below its ACTOR_CREATE (id / 4096). |
#define | ACTOR_CREATE_KIND (kind) ((kind) << 12) | An fdActorCreate id of ACTOR_CREATE kind, above its sprite. |
#define | PLACEMENT_IMAGE_DEPTH 62 | The depth slot fdRenderApplyProjectedPlacement gives an actor's sprite on a scrolling map: its screen row on from this slot, so a sprite lower on the screen draws in front and those up to this many rows above it keep their order; its shadow takes two slots behind. |
#define | OBJ_AFFINE_MATRIX (n) ((n) << 25) | An affine sprite's matrix, of the 32, in its attr01 word. |
#define | DISSOLVE_TILE_PIXELS 64 | fdSpriteDissolveStep clears one pixel of each 8-bit tile a step, in SpriteDissolvePixelOrder's order, so a tile is gone after this many. |
#define | DISSOLVE_FIRST_STEP 64 | The step the first tile starts to dissolve at; each tile after it starts a step sooner. |
#define | DISSOLVE_STEPS (DISSOLVE_FIRST_STEP + DISSOLVE_TILE_PIXELS) | The steps a dissolve takes, four a tick: in the field, fdSpriteDissolveRun and fdSpriteDissolveRunMany's, and in battle a felled enemy's (PLAY_FELLED). |
#define | WORLD_MAP_VIEW_METATILES 32 | The World Map's metatiles in view (RamMapBlocks, and the blocks in MetatileTiles): 32 by 32 metatiles of 32 pixels, found by a position's metatile modulo 32 each way. |
#define | WORLD_MAP_METATILE_PIXELS 32 | |
#define | PARTY_PP_REPLENISH 999 | fdPartyAddPp's amount that fills every member's PP: "Everyone's PP was replenished!" |
#define | REACH_SHAKEN_OBJECTS 256 | Added to a field Psynergy's kind, the FieldPsynergyReach row for the actors its shaking reaches (Tremor's, REACH_SHAKEN_OBJECTS + FIELD_PSYNERGY_TREMOR). |
#define | ROPE_SLOT_COUNT 8 | The ropes', tightropes' and hanging vines' states each keep eight slots, each a chain of nodes from one pool of 128. |
#define | ROPE_NODE_COUNT 128 | |
#define | ROPE_NODE_DISTANCE_NONE (1 << 28) | A squared distance in pixels beyond any rope node, to start a search for the nearest. |
#define | TIGHTROPE_STATE ((TIGHTROPE_WORK *)RamHeapSlots->tightrope) | |
#define | ROPE_STATE ((ROPE_WORK *)RamHeapSlots->rope) |
Typedefs
| Name | Description | |
|---|---|---|
typedef Sint32 (* | SCRIPT_COMMAND_FN )(); | An actor script command's handler: it takes the actor and returns nonzero to go on with the script this tick, zero to stop. |
typedef void (* | DRAW_FN )(const void *src, void *dest, Sint32 param); | The routines a field sprite's picture is drawn through: the sprite animation's picture decoder (src, the packed picture, into dest at param, its colour mode), the uploader copying the w by h pixel picture to its VRAM tiles (HEAP_SLOT_PICTURE_UPLOADER), and the outliner ringing the opaque pixels with colour edge (fdGridDrawOutlineCode). |
typedef void (* | UPLOAD_FN )(const void *src, Uint32 w, Uint32 h, void *vram); | |
typedef void (* | OUTLINE_FN )( Uint32 w, Uint32 h, void *pixels, Uint32 edge, Uint32 fill); | |
typedef void (* | TARGET_HOOK )(ACTOR *post, Sint32 *x, Sint32 *z); | The hook a rope post marked ROPE_POST_HOOKED keeps in its watchedActor: given the post, it moves the x and z Lash throws the rope to. |
Enumerations
| Name | Description | |
|---|---|---|
enum | ACTOR_SPR_KIND { ACTOR_SPRITE_NONE, ACTOR_SPRITE_ONE, ACTOR_SPRITE_GROUP } | ACTOR.spriteStorageKind, its low four bits: what the actor's sprite pointer holds. |
enum | ACTOR_CREATE { ACTOR_CREATE_ONE_SPRITE, ACTOR_CREATE_GROUP, ACTOR_CREATE_NO … } | fdActorCreate's id / 4096: what sprites the actor is made with. |
enum | TERRAIN_KIND { TERRAIN_FLAT, TERRAIN_SLOPE_X, TERRAIN_SLOPE_Y, TERRAIN_STEP … } | A map metatile's terrain kind: the low four bits of its shape's first byte, which pick its height function. |
enum | COLLISION { COLLISION_TOO_LOW, COLLISION_NONE, COLLISION_TOO_HIGH, COLLI … } | What fdMapGridCheckCollision says of a step to a position. |
enum | ENTRANCE_ARRIVAL { ARRIVAL_NONE, ARRIVAL_STAIRS_UP, ARRIVAL_STAIRS_DOWN, ARRIVA … } | The arrival fdEntrancePlayArrival played, for the way the last scene was left. |
enum | ROPE_NODE_KIND { ROPE_NODE_FREE, ROPE_NODE_CROSSABLE, ROPE_NODE_UNCROSSABLE } | ROPE_NODE.kind and TIGHTROPE_NODE.kind. |
enum | ROPE_SLOT_STATE { ROPE_COILED, ROPE_THROWN } | A rope's state (ROPE_SLOT.state), which fdRopeGetState returns. |
Functions
| Name | Description | |
|---|---|---|
void | fdActorUpdateAllMotion (void) | The actor system: each tick's motion and sprites, the actor table, and what the scenes ask of an actor through the field's stubs. |
void | fdActorUpdateAllOnField (void) | Advances every actor by one tick: their scripts and their motion, with free flight in 3D, following the ground, floating, and solid actors that refuse to overlap. |
void | fdActorMoveWithCarriers (void) | Each tick: an actor that walks on platforms (ACTOR_PRIORITY_WALKS_ON_PLATFORMS) and rides one, its carrier, moves with the carrier's last step; one standing on it as it rises or sinks is set on its top, 16 pixels up. |
void | fdActorSystemProjectSprites (void) | Each tick, with the fixed camera: places every actor in use, from the 64th down. |
void | fdActorSystemPlaceSprites (void) | Each tick, with the scrolling camera: places every actor's sprite on the screen. |
Sint32 | fdActorFindLastActiveId (void) | Returns the slot after the last placed actor (8 when there is none), or -1 when the last slot is occupied. |
void | fdActorTableClear (void) | Empties all the actor slots, without releasing the actors. |
Bool | fdActorIsTargetUnset (ACTOR *actor) | TRUE when the actor has no movement target: none of its target coordinates set, or for an actor moved by the ground (any motion flag) neither its target x nor z. |
void | fdActorTurnPairToFaceEachOther (ACTOR *first, ACTOR *second) | Turns two actors to face each other, at most 1/16 turn a tick each, until both do (at most 60 ticks). |
void | fdActorUpdateBlink (ACTOR *actor) | Per-tick update function of a blinking actor: sets its sprite animations' colour mode from ActorBlinkSpriteColors, each entry lasting two ticks. |
void | fdActorStartCameraStub (void *actor, void *effect) | |
Sint32 | fdActorPlaySoundInViewStub (ACTOR *actor, Sint32 sound) | |
void | fdActorSpawnWaterSplashStub (ACTOR *actor, Sint32 kind) | |
void | fdActorSetSquareSprite (Uint32 objectId) | Draws the actor's sprite square, 16 by 16 pixels, 8 pixels down. |
Sint32 | fdActorGetSpriteShape (Uint32 objectId) | Returns the OAM shape of the actor's sprite (0 square, 1 wide, 2 tall), or 0 without one. |
void | fdSpriteAnimationClearStub (void *record) | |
void | scSetActorSpritePriority (ACTOR *actor, Sint32 priority) | Fixes the priority of the actor's sprite and its shadow, which then no longer follows the map metatile under it (clears ACTOR_PRIORITY_AUTOMATIC). |
Uint8 * | fdDecompressLZ (const Uint8 *src, Uint8 *dest) | Decompresses an LZ stream from source into destination and returns destination. |
FIXED | fdMapGridGetTerrainHeightStub (Sint32 layer, FIXED x, FIXED z) | The map grid: the ground under a point, collisions, the camera and screen shake, and the map's tiles, scroll and flag edits. |
Uint32 | fdMapGridGetTerrainKindStub (Sint32 terrain, Sint32 x, Sint32 z) | |
Sint32 | fdMapGridGetTerrainKindAtStub (Sint32 layer, Sint32 x, Sint32 z) | |
Sint32 | fdMapGridGetMetatileBehaviorAtStub (Sint32 layer, Sint32 x, Sint32 z) | |
void | fdMapGridSetMetatileBehaviorAtStub (Sint32 terrain, Sint32 x, Sint32 z, Sint32 value) | |
Sint32 | fdMapGridIsWallAtStub (Sint32 *pos) | |
Sint32 | fdMapGridCheckCollisionStub (ACTOR *actor, Sint32 *pos) | |
Sint32 | fdCheckSpheresOverlapStub (Sint32 *a, Sint32 radiusA, Sint32 *b, Sint32 radiusB) | |
void | fdMapGridCenterOnFollowedPointStub (void) | |
void | fdMapGridSetScreenShakeStub (Sint32 x, Sint32 y, Sint32 decay) | |
void | fdMapGridUpdateLayerScroll (void) | Each tick on a layered map: centres the view on the point the map follows (origin), clamped to the map's bounds and shaken by any decaying screen shake; then scrolls each of the three layers by its parallax scale and automatic scroll (wrapping at its period), draws the metatile tiles column or row that scrolls into view, and sets its BG scroll. |
void | fdTileMapDecodeStagedBuffer (Sint32 size) | Unpacks a map's metatile tiles, decoded into the map metatile buffer from its second byte, into MetatileTiles. |
void | fdTileMapConvertBuffer (void) | Joins a decoded map's planes in place into its metatile words, with the ARM function copied to RAM, which reads the byte planes from a copy. |
void | fdTilesetAnimationStartAll (const Uint16 *script) | Starts the tileset animations a map's animation script lists: each TILESET_ANIM_MARKER starts the tileset animation its low four bits name there (paused with TILESET_ANIM_MARKER_PAUSED). |
Uint32 | fdMapReadEditU16 (Uint8 **cursor) | Reads the little-endian halfword at *cursor, which may be unaligned, and moves the cursor past it. |
void | fdMapApplyFlagEdits (Sint32 flag, Sint32 attributes) | Plays the map's edits for flag: each copies a rectangle of metatiles (their pictures, or with attributes their attributes and shapes) from one place of the map to another. |
Sint32 | fdWorldMapGetCollisionStub (Sint32 *pos) | The World Map's collisions, its affine page, its places visited and its metatile tiles. |
void | fdWorldMapApplyAffinePage (void) | HBlank setup each VBlank on the world map: copies the first scanline's BG2 and BG3 affine parameters, starts the HBlank DMA for the rest, and picks the BG mode from the window's top and bottom. |
void | fdWorldMapMarkPlaceVisited (Sint32 id, Sint32 variant) | Marks the world map place the party has just entered as visited: sets FLAG_PLACE_VISITED of the first place whose visitScene is id and whose visitEntrance is variant (or any, for -1). |
Sint32 | fdWorldMapWriteLayerMetatileTile ( Sint32 layer, Sint32 x, Sint32 y, Sint32 tile, Sint32 update) | Loads world map tile tile into quarter (x & 1, y & 1) of a layer's metatiles in view, decompressing it from the area's graphics, and with update set also draws it into the layer's tile map. |
Sint32 | fdEntrancePlayArrival (void) | Arriving in a scene, and the band over the leader's sprite as it leaves through a hidden layer (EXIT_STYLE_HIDDEN_LAYER). |
void | fdExitAddHiddenLeaderLayer (void) | An EXIT_STYLE_HIDDEN_LAYER exit: gives the leader's sprite a second part, SPRITE_HIDDEN_LAYER, a band over the top 8 rows of its 32 by 32 picture, drawn in SPRITE_COLOR_HIDDEN. |
Uint32 | fdStreamReadU16 (Uint8 **cursor) | Reads a little-endian halfword at *cursor and moves the cursor past it. |
Sint16 | fdStreamReadS16 (Uint8 **cursor) | Reads a signed little-endian halfword at *cursor and moves the cursor past it. |
void | fdApplyEntrance (void) | Places the party where it enters: by the scene's entrance row for MainRoutineStateWork.entrance, else on a map by the map's own entrance stream (fdPlaceAtEntrance), else by the scene's first entrance row. |
void | fdEntranceEndArrivalAnimation (Sint32 effect) | Plays the leader's arrival animation through an exit: centred on its metatile at the metatile's north edge, the leader plays animation for 30 ticks, loses the doorway (SPRITE_DOORWAY) and walks 8 pixels south. |
void | fdExitPrepareAnimation (Sint32 effect) | Starts the leader's animation for leaving through an exit: centres it on its metatile, at the metatile's south edge, stops it and plays animation over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part. |
void | scSetArrivalFlags (Sint32 unused) | Marks the party as inside Jupiter Lighthouse; once Alex has healed the party there, also ends the area's random encounters and blocks Retreat. |
Sint32 | fdRunRaisedCue (Sint32 id) | Runs the scene's raised cue (CUE_RAISED) for id: its message or its function. |
Sint32 | fdRunStepCueOrExit (Sint32 value) | Runs the step cue of what the leader touched, or else takes its exit: plays the exit's sound (and effect) and records where it leads. |
Sint32 | fdRunPushMetatile (Sint32 keys) | Runs the push metatile the leader pushes against (attributes, its metatile's attribute bits) once it has pushed for more than FIELD_PUSH_TICKS, idle while MainRoutineStateWork.sandActive is set: a MAP_METATILE_LEDGE with KEY_DOWN held jumps down it, a MAP_METATILE_JUMP jumps forward, a MAP_METATILE_CLIMBABLE climbs down or up by the key held, and a MAP_METATILE_PUSH pushes the actor ahead, running the scene's CUE_PUSH cue for it and CUE_PUSHED for the metatile. |
Sint32 | fdExamineMetatile (Sint32 id) | The search command. |
Sint32 | fdCheckConfiguredKeys (void) | Checks the keys the player has configured: the menu, examine and start keys set their request and return 1, the two shortcut keys pass on their assignment (fdRequestShortcut). |
Sint32 | fdPartyCheckShortcut (Uint32 shortcut) | Checks an L or R button shortcut, packed as the party member in bits 10 to 13 and the Psynergy in bits 0 to 9. |
ACTOR * | fdGetPartyActor (void) | The party on the field: the leader's actor, poison as it walks, and its battles' backdrop and music. |
Sint32 | fdPartyApplyPoisonDamage (void) | Hurts each poisoned character in the party: poison takes a twentieth of their maximum HP and deadly poison a tenth, rounded to the nearest and at least 1. |
void | fdBattleBackgroundSelectForMap (void) | Chooses the battle background for the current scene. |
void | fdEncounterSelectBattleMusic (Sint32 row, Sint32 column) | Chooses the battle music for slot of zone (MainRoutineStateWork.battleMusic): a key takes the song listed last before it in EncounterBattleMusic, and a link battle (FLAG_LINK_BATTLE) keeps the music playing. |
void | fdSuperLuckyDiceRun (void) | Runs Super Lucky Dice until the player quits or cannot afford a throw (DICE_BET). |
void | fdCameraResetViewDefaults (void) | Puts the 3D camera back at its starting view: at the origin, unturned, pitched to 152/256 of a turn and 510 pixels away, following nothing. |
Sint32 | fdLuckyDiceScaleRGB555Buffer (Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count) | Copies count RGB555 colours from source to destination with each channel multiplied by scale (16.16: 0 is black, toFIXED(1) unchanged), for fades. |
Sint32 | fdSuperLuckyDiceScaleRGB555Buffer (Uint16 *src, Uint16 *dest, Sint32 scale, Sint32 count) | Copies count RGB555 colours from source to destination with each channel multiplied by scale (16.16: 0 is black, toFIXED(1) unchanged), for fades. |
void | fdSuperLuckyDiceBrightenColors (Uint16 *src, Uint16 *dest, Uint32 count, Sint32 angle) | Copies count RGB555 colours from source to destination with each channel raised by GLOW_LEVELS * (1 - cos(angle)) and clamped at the brightest: unchanged at angle 0 and brightest at a half turn, so a picture glows and fades as angle turns. |
Sint32 | fdSuperLuckyDiceScoreDice (Sint32 *dice) | Scores the four dice's faces: SUPER_LUCKY_DICE_RESULT_PERFECT when all four match, otherwise by the matching pairs among them, one pair, two pair or three (three alike), or SUPER_LUCKY_DICE_RESULT_LOSE for none. |
Sint32 | fdSuperLuckyDiceDrawNumber (Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits) | Draws value as digits small digit sprites, from PINK_DIGIT_TILES in palette, ending at x, 10 pixels apart, leading zeros skipped but for the last. |
Sint32 | fdSuperLuckyDiceDrawLargeNumber (Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits) | Draws value as digits large digit sprites, from GREEN_DIGIT_TILES in palette, starting at x, 22 pixels apart, leading zeros skipped. |
Sint32 | fdUsePsynergy (Uint32 code) | Field Psynergy: casting one, running it, and what it does as it ends. |
void | fdPsynergyDispatch (void) | Runs the field Psynergy animation the scene names on the target the player chose (FIELD_EFFECT_STATE.targetId). |
void | fdPsynergyRun (void) | Runs the field Psynergy animation the scene names, with no target chosen yet: each kind runs its effect to the end. |
void | fdPsynergyRunEnd (void) | Ends the current field Psynergy when it is Reveal, Cloak, Avoid, Sand, Hover or the Ring: what each does as it ends. |
void | fdPsynergyFinishMindRead (void) | Finishes the current field Psynergy when it is Mind Read: ends it and lets its target move again, unless the target is the actor kept stopped. |
Sint32 | fdMeasurePsynergyHeight (Sint32 id, ACTOR *actor, Sint32 *pos) | Returns how far the ground at position lies above or below the actor's, made positive, when that is within the kind's reach in height, else -1. |
Sint16 * | fdSceneItemGetRows (void) | The scene's items: the treasure spots placed on its map, and the chests and Mimics they open into. |
Sint32 | fdSceneItemFindPos (Sint32 value, Sint32 *out) | Clears out, then fills it with the position of scene point value; returns 0 when the point was found, else -1. |
void | fdPlaceTreasureSpots (void) | Places an actor at each of the map's treasure spots (ids 100 to 239) that the scene has a script for, up to sixteen: a chest for a chest script, shown open once its flag is set and gone once its mimic was beaten, and a Psynergy Stone for an examine cue giving one, until it is taken. |
void | fdTreasureSpotLaunchMimic (Uint32 objectId) | Makes the chest of the actor jump up as a mimic: after 18 ticks it takes TREASURE_SPOT_CHEST_MIMIC, plays SE_ENEMY_CRY and gets an upward velocity of 8 pixels a tick, its shadow shown. |
void | fdTreasureSpotOpenEmptyChest (Uint32 objectId) | Opens the empty chest of the actor with SE_CHEST_OPEN, and waits 12 ticks. |
Sint32 | fdPaletteFadeSetTargetStub (Sint32 mode, Sint32 half) | The palette fade and the debug palette editor. |
Sint32 | fdPaletteFadeStartInterpolationStub (Sint32 ticks) | |
void | fdPaletteFadeLoadPaletteStub (void *palette) | |
void | fdPaletteEditorRun (void) | The debug palette editor (L on the Pause menu in debug mode). |
Sint32 | fdPaletteFadeClampComponent (Sint32 value) | A colour channel clamped to RGB_LEVEL_MAX, held as it is or where blue is. |
Sint32 | fdPaletteFadeClampShiftedComponent (Sint32 value) | Clamps a colour channel held where blue is to at most RGB_LEVEL_MAX there. |
Sint32 | fdPsynergyCheckOverlap (Sint32 *a, Sint32 radiusA, Sint32 *b, Sint32 radiusB) | The field effects the Psynergy and the found items show. |
void | fdPsynergyGrowFromCaster (struct ACTOR *actor, Sint32 x, Sint32 y, Sint32 z) | Moves the actor from 16 pixels above the caster to (x, y, z), growing it from a quarter to full size. |
void | fdPsynergyDrawCanvasSprite (void) | Draws the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite) each tick. |
void | fdPsynergyReleaseSceneSprite (void) | If the scene's sprite is active, stops its update callback (fdPsynergyDrawCanvasSprite) and frees its VRAM cache entry. |
struct ACTOR * | fdBattleEffectSpawnScatterParticle (Sint32 x, Sint32 y, Sint32 z) | Spawns a sparkle at x, y, z that hops off in a random direction 8 to 32 pixels away at 1 to 2 pixels a tick. |
void | fdEffectSpawnRevealMarkers (void) | Places Reveal's markers from the scene's item rows (a type, a script id, a flag and a pad): for each of the treasure spots' rows whose flag is clear and whose script has not run, a sparkle marker goes at its actor, or at the map metatile of a tile script, when that point is on screen. |
void | fdEffectShrinkActorAndDestroyFast (void *object) | Spins an actor 1/8 turn and shrinks it by 1/64 a tick, releasing it once its scale falls below 3/16: 53 ticks from full size. |
void | fdEffectShrinkActorAndDestroySlow (void *object) | Per-tick update: spins an actor 1/8 turn and shrinks it by 7/1024 a tick, releasing it once its scale falls below 3/16, 119 ticks from full size. |
void | fdEffectUpdateRadialSpread (struct FIELD_PARTICLE *effect) | Field effect sprite callback of a Venus Djinni's particles: each starts on screen at a random point 10 to 20 pixels round the leader and flies 120 pixels up the screen, over and over, until it is set to VENUS_PARTICLE_LAST_RISE and freed once it arrives. |
void | fdEffectPulseActorScale (struct ACTOR *actor) | Per-tick update: makes an actor pulse, switching its scale between the two values of FieldEffectPulseScales every 4 ticks. |
void | fdEffectAdvanceAngleWithRamp (struct ACTOR *actor) | Per-tick update: spins an actor ever faster, from 1/16 turn a tick up to just over 1/8 (DEGtoANG(45) + 64), 80 more each tick for 52 ticks. |
void | fdEffectUpdateMarsSpark (struct FIELD_PARTICLE *effect) | Field effect sprite callback of a Mars Djinni's sparks (enum MARS_SPARK_STATE): the spark flies 120 pixels up the screen (give or take 3/32 turn) from its origin at up to 5 pixels a tick and starts over, until it stops where it arrives, hidden; 40 ticks later it swarms to points within 4 pixels of one 20 pixels over the leader, until it is freed once it arrives. |
void | fdItemDisplayEmitSparkles (struct ACTOR *emitter) | Each tick of a found item's picture: one time in ten, a sparkle appears within 16 pixels of it. |
void | fdDjinnRunBattleStartHop (Sint32 djinniId) | A Djinni's hop as its battle starts, and its spin as it joins. |
void | fdDjinnAdvanceSpinAngle (struct ACTOR *djinni) | Per-tick update of a joining Venus or Jupiter Djinni: spins it an eighth of a turn, as fdEffectAdvanceSpinAngle does. |
Sint32 | fdRopeFindById (Sint32 id, Sint32 *otherPost, Sint32 *index) | The ropes Lash throws and ties between two posts. |
void | fdRopeSwingBetween (Sint32 index, Sint32 fromId, Sint32 toId, FIXED height) | Lays rope index again between posts from and to, its middle bowed height pixels (16.16) aside. |
Bool | fdRopeIsLeaderAtEnd (Sint32 firstId, Sint32 secondId) | Returns 1 when the leader stands on the metatile of post firstId or secondId, or a metatile beside it along an axis, at the same height. |
Sint32 | fdRopeLayTied (Sint32 index, Sint32 x1, Sint32 y1, Sint32 z1, Sint32 x2, Sint32 y2, Sint32 z2) | Builds rope index's nodes on the line between two points, one for each 6 pixels, waved a pixel either way by one whole sine; marks it tied and swinging and sets its flag. |
Sint32 | fdRopeLayCoil (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ) | Builds rope index's nodes, one for each 6 pixels between two points, as a flat spiral around the first point: the rope coiled at its post. |
Sint32 | fdRopeLayBowed (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ, FIXED height) | Lays a rope's nodes along the line between two points again, bowed by half a sine height pixels (16.16) high. |
void | fdRopeDraw (void) | The ropes' drawing event: a sprite at the midpoint of each pair of neighbouring nodes, 4 pixels up, turned along the pair and given its rope's priority, for the pairs on screen; a rope's first node keeps the last turn. |
void | fdRopeUpdate (void) | The ropes' event: unless the field is handling a request, raises FIELD_RAISED_CUE_ROPE_ON when the leader has pushed at one end of a tied rope, or FIELD_RAISED_CUE_ROPE_OFF while on one; then swings each swinging rope, its swing losing a twentieth a tick until under a tenth of a pixel. |
void | fdTightropeWobbleBetween (Sint32 index, Sint32 fromId, Sint32 toId, FIXED height) | The tightropes the party walks across, laid between two points or two posts as the ropes are. |
Sint32 | fdTightropeLay (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ) | Builds tightrope index's nodes on the straight line between two points, one for each 6 pixels. |
Sint32 | fdTightropeLayBowed (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ, FIXED height) | fdRopeLayBowed for a tightrope: lays its nodes along the line between two points again, raised by half a sine height pixels (16.16) high. |
Sint32 | fdTightropeLayCoil (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ) | fdRopeLayCoil for a tightrope. |
Sint32 | fdTightropeRecoil (Sint32 slot, Sint32 x1, Sint32 y1, Sint32 z1, Sint32 x2, Sint32 y2, Sint32 z2, Sint32 wave) | fdRopeRecoil for a tightrope. |
void | fdTightropeDraw (void) | The tightropes' drawing event: as fdRopeDraw, a sprite at the midpoint of each pair of neighbouring nodes, 4 pixels up, for the pairs on screen, all of a tightrope turned along it. |
void | fdTightropeUpdate (void) | The tightropes' event: fdRopeUpdate for the tightropes, raising FIELD_RAISED_CUE_TIGHTROPE_ON and FIELD_RAISED_CUE_TIGHTROPE_OFF; the middle of a wobbling tightrope bobs up and down. |
Sint32 | btUnitProjectToScreen (Sint32 unit, Sint32 *screen) | The battle module's routines the field calls: projecting a unit or battle object onto the screen, the Flurry effect, and the blitter. |
void | btMotionProjectPosStub (Sint32 id, Sint32 *projected) | |
Sint32 | btMotionProjectScaledPosStub (Sint32 unitId, Sint32 *screen) | |
void | btEffectRunFlurry (struct BATTLE_EFFECT_PARM *effect, Sint32 variant) | The user closes on the first target and strikes it again and again, each strike an arc or a wave with a flash and a spray of motes; the last knocks the target back. |
Sint32 | btEffectBuildBlitterStub (Sint32 slot, Sint32 widthShift, Sint32 heightShift, Sint32 flags, Uint32 mode) | |
Sint32 | gmPartyAddMemberStub (Sint32 unitId) | The game module's routines the field calls through their stubs: the party's members, their Psynergy, and the Lure Cap's flag. |
void | gmPartyRemoveMemberStub (Sint32 owner) | |
Sint32 | gmUnitKnowsPsynergyStub (Sint32 group, Sint32 entry) | |
void | gmFlagRefreshLureCapStub (void) | |
Sint32 | mnMessageOpenWindowStub (Sint32 msg, Sint32 x, Sint32 y, Sint32 packed) | The window module's routines the field calls through their stubs: messages, the area name, portraits, item icons, and the messages as someone joins the party. |
Sint32 | mnWindowIsClosedStub (Sint32 window) | |
void | mnAreaNameWindowHideStub (void) | |
void | mnPortraitCloseWindowStub (Sint32 sprite) | |
void | mnIconDrawItemStub (Sint32 item) | |
Sint32 | mnPartyShowJoinedMessageStub (Sint32 member, Sint32 value) | |
Sint32 | mnPartyShowPairJoinedMessageStub (Sint32 first, Sint32 second) | |
void | mnDjinnShowJoinedMessageStub (Sint32 owner, Sint32 element, Sint32 djinni) |
Variables
| Name | Description | |
|---|---|---|
extern ACTOR | SnapshotObjects [] | The actors fdActorTableSnapshot saved, up to 32, after their slot numbers. |
extern const Uint8 | ActorBlinkSpriteColors [4] | |
extern Uint16 | ActorScriptIdleScript [] | The actor scripts the field starts: the idle script, the camera, and one for each way the leader moves, each looping on one of the leader's controls (SC_PLAYER and those after it). |
extern const Sint32 | ActorScriptEndScript [] | A script that ends at once. |
extern const Sint32 | ActorCameraScript [] | The camera following the leader within the map's bounds. |
extern const Uint8 | ActorStepAngleScript [] | Turns the actor a step toward the facing in its timer. |
extern const Sint32 | ActorApproachWatchedScript [] | Following the watched actor (fdActorApproachWatchedActor). |
extern const Sint32 | ActorKeyCheckScript [] | Each runs one control command every tick: the command, SC_WAIT(1), SC_LOOP(SC_FOREVER, SC_TOP). |
extern const Sint32 | ActorPlayerScript [] | The leader on foot (fdActorUpdatePlayerControl). |
extern const Sint32 | ActorWalkingScript [] | Walking (fdActorUpdateWalkingControl). |
extern const Sint32 | ActorKeysScript [] | Climbing by the keys (fdActorMoveByKeys). |
extern const Sint32 | ActorRopeScript [] | Crossing a tied rope (fdActorCrossRope). |
extern const Sint32 | ActorTightropeScript [] | Crossing a tightrope (fdActorCrossTightrope). |
extern const Sint32 | ActorSandScript [] | Moving as sand (fdActorMoveAsSand). |
extern const Sint32 | ActorHoverScript [] | Hovering (fdActorUpdateHoverControl). |
extern const Sint32 | ActorSailOnMapScript [] | Sailing on a map (fdActorSailOnMap). |
extern const Sint32 | ActorWorldMapScript [] | The leader on the World Map (fdActorMoveOnWorldMap). |
extern const Sint32 | ActorSailScript [] | Sailing on the World Map (fdActorSailOnWorldMap). |
extern const Sint32 | ActorFlyScript [] | Flying on the World Map (fdActorFlyOnWorldMap). |
extern const Sint32 | ActorSandOnWorldMapScript [] | Moving as sand on the World Map (fdActorMoveAsSandOnWorldMap). |
extern Uint32 | EmotePopTiltedScript [] | An emote bubble popping up tilted; each scene that shows one keeps its own copy. |
extern Uint8 | fdRenderDecodePictureCode [] | fdRenderDecodePicture's Thumb entry and ARM code (picture_decode.s), which RENDER_LOAD_DECODER copies into the tick scratch slot. |
extern Uint8 | fdRenderDecodePictureCopyEnd [] | The end of the colour tables kept after fdRenderDecodePicture's code, where its copy stops (picture_decode.s). |
extern Uint8 | RenderDecodePictureBlockSize [] | The size of the tick scratch block for fdRenderDecodePicture and its tables, an address equal to the size (ld_script.ld). |
extern const Uint8 | fdGridDrawOutlineCode [] | The grid outliner's Thumb entry and ARM code (field_arm_entries.s), which RAM_CODE_LOAD copies to RAM. |
extern Uint8 | GridDrawOutlineCodeSize [] | The size of fdGridDrawOutlineCode, an address equal to the size (ld_script.ld). |
extern Uint8 | SpriteDissolvePixelOrder [] | The sprites' colour tables: the order a dissolve clears each tile's pixels in, the grey a sprite turns, and the tint of a shaded sprite's foot. |
extern Uint8 | SpriteColorGreyTable [] | Greyscale: each colour to the grey of its brightness. |
extern const Uint8 | SpriteColorTintTables [] | The three tints, SPRITE_COLOR_BLUE_TINT to SPRITE_COLOR_GREEN_TINT, each raising one channel to full, then the negative SPRITE_COLOR_DARK draws through, which turns light footprints dark. |
extern ANIMATION_METADATA | SpriteAnimationMetadata [] | Every sprite animation's metadata, by number (graphics/sprite/sprites.s). |
extern Uint8 | WorldMapPackedTiles [] | The world map's still image (story.list.tsv): its tiles, packed (tagged LZ). |
extern Uint8 | WorldMapPackedPictures [] | The still image's tile map, packed (tagged LZ), decoded after its tiles. |
extern Uint8 | WorldMapPalettes [] | The still image's palettes, one for each of its modes. |
extern const Uint8 | WorldMapTerrainBehaviorTable [] | The terrain each World Map metatile fights on (fdWorldMapGetBattleEnvironment). |
extern Uint32 | SceneExits [] | Entering a scene and what happens in it: the party's place, the cues the leader raises, steps on, pushes and examines, the exits, and the keys the player has set. |
extern const Uint8 | SuperLuckyDiceFaceTiles [] | The Lucky Dice and Super Lucky Dice games, and the Lucky Wheels' sparks. |
extern const Uint16 | LuckyWheelsSparkPictureOffsets [] | Where each spark picture (a square 2 to 20 pixels on a side) starts: size s (1 to 10) is a square 2s pixels a side, after the smaller squares' pixels. |
extern Uint8 | LinkLobbySlotColumns [] | The link lobby's slots: the column each one's word is kept in, and the words. |
extern Sint32 | LinkLobbySlotValues [] | The words the lobby publishes in its link payload, by LOBBY_SLOT; the partner compares them with its own (scLinkLobbyPeerSlotMatches). |
extern const FIELD_PSYNERGY_REACH | FieldPsynergyReach [] | One row a field Psynergy, with one more for the things Tremor's shaking reaches; the last row, ended by -1, is the reach of a kind not listed. |
extern const Sint32 | GrowthLeafScript [] | The field effects' scripts, pictures and tables. |
extern const Sint32 | FieldEffectShortEffectScript [] | The three scripts of FieldEffectDurationScripts: an effect that goes after 24, 46 or 128 ticks. |
extern const Sint32 | FieldEffectMediumEffectScript [] | |
extern const Sint32 | FieldEffectLongEffectScript [] | |
extern const Uint32 | FieldEffectPulseScales [] | The two scales fdEffectPulseActorScale switches between every 4 ticks, full size and 0.97 of it: the leader pulsing as a Mars Djinni joins. |
extern const Sint16 | LineScrollWaveSine [] | A sine wave of 256 steps and amplitude 4096 that the line scrolls ride (script_commands_line_scroll.c), as The Broken Seal's. |
extern const Sint16 | WeatherRainSplashFrames [] | The Broken Seal's raindrop (fdGroundParticlesUpdate), {dx, dy, tile, shape, size} by the ticks it has left: a 32 by 16 streak falling from up to the right onto its spot, then its splash's four 16 by 16 pictures. dx and dy are screen pixels from the spot, tile counts from its first tile. |
extern const Sint16 | WeatherRainStreakOffsets [] | {x, y} screen offsets in pixels of a falling rain streak by the ticks it has left (fdWeatherUpdateRain); The Broken Seal has no such table. |
extern const SPARKLE_PICTURE | FieldEffectSparklePictures [] | {dy, tile} of a sparkle (script_commands_motes.c): dy in screen pixels from its spot, a row every two ticks. |
extern const Uint8 | WeatherParticleTiles [] | The ground particles' tiles, byte LZ (field_effect_particles.list.tsv). |
extern const Uint8 | FieldEffectMoteTiles [] | The motes' tiles, byte LZ (field_effect_particles.list.tsv). |
extern const Uint8 | FieldEffectStreakTiles [] | The streaks' tiles, byte LZ (field_effect_particles.list.tsv). |
extern const Uint8 | FieldEffectSparkleTiles [] | The sparkles' tiles, byte LZ (field_effect_particles.list.tsv). |
extern const Uint8 | RopeTiles [] | The ropes' and tightropes' pictures, and the headings the +Control Pad steps off them toward. |
extern const Uint8 | HangingVineChainBottomPicture [] | The bottom link of a hanging vine's chain, tagged LZ (rope_vine_pictures.list.tsv). |
extern const Uint16 | RopeKeyHeadings [] | The heading the +Control Pad points, by its right, left, up and down bits (DPAD_INDEX), where fdLeaderStepOffRope and fdLeaderStepOffTightrope step; DPAD_ANGLE_NONE for none or opposed keys. |
extern const Uint16 | InputDpadAngles [] | An angle for each value of the right, left, up and down bits of the +Control Pad; DPAD_ANGLE_NONE for none (fdInputGetDpadAngle, script_commands_mind_read.c). |
Description
The field engine's routines, tables and types that other files share: the actors and their scripts, the sprites, the map grid and the World Map, entering and leaving a scene, field Psynergy and its effects, the ropes and tightropes, and the other modules' routines the field calls.
Macros in detail
ACTOR_SPRITE_KIND_MASK
#define ACTOR_SPRITE_KIND_MASK 15
ACTOR.spriteStorageKind's low four bits, its ACTOR_SPR_KIND.
Referenced by btActorDetachSpriteScripts(), btActorGetSprite(), btHighlightSetSpriteMode(), btMotionPlayHitFlash(), btObjectUpdateSpritePriorities(), fdActorAddSpriteAnimation(), fdActorGetScreenPos(), fdActorPlaceSprites(), fdActorRelease(), fdActorSelectAnimation(), fdActorSetAnimationAndSpeed(), fdActorSetAnimationSpeed(), fdActorSetFirstSpriteAnimation(), fdActorSetSpriteColor(), fdActorSetSpriteFlags(), fdActorSetSpritePriority(), fdActorSetSpriteRotation(), fdActorSystemPlaceSprites(), fdActorUpdateBlink(), fdPsynergyPound(), fdPsynergyScoop(), scAquaRockKeepLeaderPriority(), scEffectSetSpritePriority() and scSetActorSpritePriority().
Definition at line 42 of file field.h.
ACTOR_CREATE_SPRITE_MASK
#define ACTOR_CREATE_SPRITE_MASK 0xfff
The sprite id in fdActorCreate's id, below its ACTOR_CREATE (id / 4096).
Referenced by fdActorCreate() and fdResourceGetMetadataRecordStub().
Definition at line 56 of file field.h.
ACTOR_CREATE_KIND
#define ACTOR_CREATE_KIND(kind) ((kind) << 12)
An fdActorCreate id of ACTOR_CREATE kind, above its sprite.
Referenced by btObjectMake(), btObjectReset(), fdActorResetForLeader(), scGeyserAdd() and scTrialRoadAddFountain().
Definition at line 58 of file field.h.
PLACEMENT_IMAGE_DEPTH
#define PLACEMENT_IMAGE_DEPTH 62
The depth slot fdRenderApplyProjectedPlacement gives an actor's sprite on a
scrolling map: its screen row on from this slot, so a sprite lower on the
screen draws in front and those up to this many rows above it keep their
order; its shadow takes two slots behind.
Referenced by fdActorGetSpriteDepth() and fdRenderApplyProjectedPlacement().
Definition at line 120 of file field.h.
OBJ_AFFINE_MATRIX
#define OBJ_AFFINE_MATRIX(n) ((n) << 25)
An affine sprite's matrix, of the 32, in its attr01 word.
Referenced by fdLuckyDiceRun(), fdRenderPlaceProjectedSprite(), fdSuperLuckyDiceRun(), mnIconMenuDrawIcons() and scShamanVillageUpdateLettering().
Definition at line 133 of file field.h.
DISSOLVE_TILE_PIXELS
#define DISSOLVE_TILE_PIXELS 64
fdSpriteDissolveStep clears one pixel of each 8-bit tile a step, in
SpriteDissolvePixelOrder's order, so a tile is gone after this many.
Referenced by fdSpriteDissolveStep().
Definition at line 159 of file field.h.
DISSOLVE_FIRST_STEP
#define DISSOLVE_FIRST_STEP 64
The step the first tile starts to dissolve at; each tile after it starts a step sooner.
Referenced by fdSpriteDissolveStep().
Definition at line 162 of file field.h.
DISSOLVE_STEPS
#define DISSOLVE_STEPS (DISSOLVE_FIRST_STEP + DISSOLVE_TILE_PIXELS)
The steps a dissolve takes, four a tick: in the field, fdSpriteDissolveRun
and fdSpriteDissolveRunMany's, and in battle a felled enemy's (PLAY_FELLED).
Referenced by btPlaybackRun(), fdSpriteDissolveRun() and fdSpriteDissolveRunMany().
Definition at line 165 of file field.h.
WORLD_MAP_VIEW_METATILES
#define WORLD_MAP_VIEW_METATILES 32
The World Map's metatiles in view (RamMapBlocks, and the blocks in
MetatileTiles): 32 by 32 metatiles of 32 pixels, found by a position's
metatile modulo 32 each way.
Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdGetCollisionAheadOfLeader(), fdGetCollisionUnderLeader(), fdMapGridGetMetatileAt(), fdUpdateWalking(), fdWorldMapDrawMetatileColumn(), fdWorldMapDrawMetatileRow(), fdWorldMapGetBattleEnvironment(), fdWorldMapGetBlockMetatileBehavior(), fdWorldMapLoadGraphics(), fdWorldMapPreloadCurrentTileBlock(), fdWorldMapWriteLayerMetatileTile() and scWorldMapLeaveShip().
Definition at line 248 of file field.h.
WORLD_MAP_METATILE_PIXELS
#define WORLD_MAP_METATILE_PIXELS 32
Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdGetCollisionAheadOfLeader(), fdGetCollisionUnderLeader(), fdMapGridGetMetatileAt(), fdUpdateWalking(), fdWorldMapGetBlockMetatileBehavior(), fdWorldMapLoadGraphics(), fdWorldMapPreloadCurrentTileBlock() and scWorldMapLeaveShip().
Definition at line 249 of file field.h.
PARTY_PP_REPLENISH
#define PARTY_PP_REPLENISH 999
fdPartyAddPp's amount that fills every member's PP: "Everyone's PP was
replenished!"
Referenced by scAirsRockInsideCheckPsynergyStone() and scAquaRockInsideCheckPsynergyStone().
Definition at line 336 of file field.h.
REACH_SHAKEN_OBJECTS
#define REACH_SHAKEN_OBJECTS 256
Added to a field Psynergy's kind, the FieldPsynergyReach row for the actors
its shaking reaches (Tremor's, REACH_SHAKEN_OBJECTS + FIELD_PSYNERGY_TREMOR).
Referenced by fdViewMoveSaveNearbySprites() and FieldPsynergyReach.
Definition at line 387 of file field.h.
ROPE_SLOT_COUNT
#define ROPE_SLOT_COUNT 8
The ropes', tightropes' and hanging vines' states each keep eight slots, each a chain of nodes from one pool of 128.
Referenced by fdHangingVineDraw(), fdHangingVineFindFreeSlot(), fdHangingVineFindSlot(), fdHangingVineUpdate(), fdRopeDraw(), fdRopeFindById(), fdRopeUpdate(), fdTightropeDraw(), fdTightropeUpdate() and scGaiaRockFindVineSlot().
Definition at line 570 of file field.h.
ROPE_NODE_COUNT
#define ROPE_NODE_COUNT 128
Referenced by fdActorCrossRope(), fdActorCrossTightrope(), fdHangingVineAllocateLink(), fdRopeAllocateNode(), fdRopeFindNodeNear(), fdTightropeAllocateNode() and fdTightropeFindNodeNear().
Definition at line 571 of file field.h.
ROPE_NODE_DISTANCE_NONE
#define ROPE_NODE_DISTANCE_NONE (1 << 28)
A squared distance in pixels beyond any rope node, to start a search for the nearest.
Referenced by fdActorCrossRope(), fdActorCrossTightrope(), fdRopeFindNodeNear() and fdTightropeFindNodeNear().
Definition at line 574 of file field.h.
TIGHTROPE_STATE
#define TIGHTROPE_STATE ((TIGHTROPE_WORK *)RamHeapSlots->tightrope)
Referenced by fdTightropeAllocateNode(), fdTightropeCoil(), fdTightropeDraw(), fdTightropeFindNodeNear(), fdTightropeLay(), fdTightropeLayBowed(), fdTightropeLayCoil(), fdTightropePlace(), fdTightropeRecoil(), fdTightropeRelease(), fdTightropeSettle(), fdTightropeThrow(), fdTightropeUntie() and fdTightropeUpdate().
Definition at line 587 of file field.h.
ROPE_STATE
#define ROPE_STATE ((ROPE_WORK *)RamHeapSlots->rope)
Referenced by fdRopeAllocateNode(), fdRopeCoil(), fdRopeDraw(), fdRopeFindById(), fdRopeFindNodeNear(), fdRopeGetEndNodePos(), fdRopeGetState(), fdRopeLash(), fdRopeLayBowed(), fdRopeLayCoil(), fdRopeLayTied(), fdRopePlace(), fdRopeRecoil(), fdRopeThrow(), fdRopeTie(), fdRopeUntie() and fdRopeUpdate().
Definition at line 643 of file field.h.
Typedefs in detail
SCRIPT_COMMAND_FN
typedef Sint32 (*SCRIPT_COMMAND_FN)();
An actor script command's handler: it takes the actor and returns nonzero to go on with the script this tick, zero to stop. The handlers take different views of the actor, so the type leaves the parameters unspecified.
Referenced by ActorScriptCommandTable.
Definition at line 87 of file field.h.
DRAW_FN
typedef void (*DRAW_FN)(const void *src, void *dest, Sint32 param);
The routines a field sprite's picture is drawn through: the sprite
animation's picture decoder (src, the packed picture, into dest at param, its
colour mode), the uploader copying the w by h pixel picture to its VRAM tiles
(HEAP_SLOT_PICTURE_UPLOADER), and the outliner ringing the opaque pixels with
colour edge (fdGridDrawOutlineCode).
Referenced by fdSpriteComposePicture().
Definition at line 127 of file field.h.
UPLOAD_FN
typedef void (*UPLOAD_FN)(const void *src, Uint32 w, Uint32 h, void *vram);
Referenced by fdSpriteComposePicture().
Definition at line 128 of file field.h.
OUTLINE_FN
typedef void (*OUTLINE_FN)( Uint32 w, Uint32 h, void *pixels, Uint32 edge, Uint32 fill);
Referenced by fdSpriteComposePicture().
Definition at line 129 of file field.h.
TARGET_HOOK
typedef void (*TARGET_HOOK)(ACTOR *post, Sint32 *x, Sint32 *z);
The hook a rope post marked ROPE_POST_HOOKED keeps in its watchedActor: given
the post, it moves the x and z Lash throws the rope to.
Referenced by fdRopeLash().
Definition at line 641 of file field.h.
Enumerations in detail
ACTOR_SPR_KIND
enum ACTOR_SPR_KIND
ACTOR.spriteStorageKind, its low four bits: what the actor's sprite pointer
holds.
| Enumerator | Value | Description |
|---|---|---|
ACTOR_SPRITE_NONE | 0 | nothing drawn |
ACTOR_SPRITE_ONE | 1 | |
ACTOR_SPRITE_GROUP | 2 | a list of up to four sprites, empty ones null |
Definition at line 34 of file field.h.
ACTOR_CREATE
enum ACTOR_CREATE
fdActorCreate's id / 4096: what sprites the actor is made with.
| Enumerator | Value | Description |
|---|---|---|
ACTOR_CREATE_ONE_SPRITE | 0 | the id's sprite (ACTOR_SPRITE_ONE) |
ACTOR_CREATE_GROUP | 2 | The sprites of the id and id + 1 (ACTOR_SPRITE_GROUP). |
ACTOR_CREATE_NO_SPRITE | 8 | No sprite: any kind but the two above, and the one the camera actor takes. |
Definition at line 45 of file field.h.
TERRAIN_KIND
enum TERRAIN_KIND
A map metatile's terrain kind: the low four bits of its shape's first byte, which pick its height function.
| Enumerator | Value | Description |
|---|---|---|
TERRAIN_FLAT | 0 | |
TERRAIN_SLOPE_X | 1 | |
TERRAIN_SLOPE_Y | 2 | |
TERRAIN_STEP_SUM_DIAGONAL | 3 | |
TERRAIN_STEP_DIFFERENCE_DIAGONAL | 4 | |
TERRAIN_BEND_SUM_DIAGONAL | 5 | |
TERRAIN_BEND_DIFFERENCE_DIAGONAL | 6 | |
TERRAIN_ROUNDED_SQUARE | 7 | |
TERRAIN_STEP_X | 8 | |
TERRAIN_STEP_Y | 9 | |
TERRAIN_SAMPLE_TABLE_TRANSPOSED | 10 | As TERRAIN_SAMPLE_TABLE |
TERRAIN_SAMPLE_TABLE_TRANSPOSED_MIRRORED | 11 | with x and y swapped. As TERRAIN_SAMPLE_TABLE_MIRRORED with x and y swapped. |
TERRAIN_SAMPLE_TABLE | 12 | The sample TerrainSampleIndexTable picks for each pixel. |
TERRAIN_SAMPLE_TABLE_MIRRORED | 13 | As TERRAIN_SAMPLE_TABLE, mirrored left to right. |
TERRAIN_SPLIT_TOP_STEP | 14 | Above y 8, the first sample left of x 8 and the second right of it; below, the third. |
TERRAIN_SPLIT_BOTTOM_STEP | 15 | Above y 8, the first |
TERRAIN_KIND_COUNT | 16 | sample; below, the second left of x 8 and the third right of it. |
TERRAIN_BUMP | 99 | Not a shape's kind: what fdMapGridGetTerrainKindOrBumpAt gives for a TERRAIN_ROUNDED_SQUARE whose two samples differ, a bump or a hollow. |
Definition at line 178 of file field.h.
COLLISION
enum COLLISION
What fdMapGridCheckCollision says of a step to a position.
| Enumerator | Value | Description |
|---|---|---|
COLLISION_TOO_LOW | -1 | the ground there is more than 12 pixels lower |
COLLISION_NONE | 0 | the actor can step there |
COLLISION_TOO_HIGH | 1 | the ground there is more than 8 pixels higher |
COLLISION_IMPASSABLE | 2 | the metatile there is a wall (METATILE_BEHAVIOR_WALL) |
Definition at line 213 of file field.h.
ENTRANCE_ARRIVAL
enum ENTRANCE_ARRIVAL
The arrival fdEntrancePlayArrival played, for the way the last scene was
left.
| Enumerator | Value | Description |
|---|---|---|
ARRIVAL_NONE | 0 | none: the scene plays its own |
ARRIVAL_STAIRS_UP | 1 | up stairs, ANIM_LEADER_ARRIVE |
ARRIVAL_STAIRS_DOWN | 2 | down stairs, ANIM_LEADER_ARRIVE_ALTERNATE |
ARRIVAL_FALLING | 3 | falling in from above |
Definition at line 284 of file field.h.
ROPE_NODE_KIND
enum ROPE_NODE_KIND
ROPE_NODE.kind and TIGHTROPE_NODE.kind.
| Enumerator | Value | Description |
|---|---|---|
ROPE_NODE_FREE | in the pool, on no rope | |
ROPE_NODE_CROSSABLE | laid along a rope, for the leader to step onto | |
ROPE_NODE_UNCROSSABLE | laid, uncrossable: coil, tied rope's far-post end, settled tightrope |
Definition at line 590 of file field.h.
ROPE_SLOT_STATE
enum ROPE_SLOT_STATE
A rope's state (ROPE_SLOT.state), which fdRopeGetState returns.
| Enumerator | Value | Description |
|---|---|---|
ROPE_COILED | at its first post, or pulled back there | |
ROPE_THROWN | thrown or laid tied from post to post |
Definition at line 655 of file field.h.
Functions in detail
fdActorStartCameraStub
void fdActorStartCameraStub(void *actor, void *effect)
Referenced by fdActorResetForLeader(), fdCameraFollow() and fdCameraFollowActor().
Definition at line 72 of file field.h.
fdActorPlaySoundInViewStub
Sint32 fdActorPlaySoundInViewStub(ACTOR *actor, Sint32 sound)
Referenced by fdActorScriptPlaySoundInView().
Definition at line 73 of file field.h.
fdActorSpawnWaterSplashStub
void fdActorSpawnWaterSplashStub(ACTOR *actor, Sint32 kind)
Referenced by fdTryJumpForward().
Definition at line 74 of file field.h.
fdSpriteAnimationClearStub
void fdSpriteAnimationClearStub(void *record)
Referenced by fdActorShowItemIconById() and fdEntranceEndArrivalAnimation().
Definition at line 77 of file field.h.
fdMapGridGetTerrainHeightStub
FIXED fdMapGridGetTerrainHeightStub(Sint32 layer, FIXED x, FIXED z)
The map grid: the ground under a point, collisions, the camera and screen shake, and the map's tiles, scroll and flag edits.
Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdActorLiftTargetBlock(), fdActorPlaceBlocks(), fdActorPlaceMovedBlock(), fdActorResetForLeader(), fdActorSetHorizontalPosAndAngleWithTerrain(), fdActorSetHorizontalPosWithTerrain(), fdActorSetPosWithTerrain(), fdActorSnapToTerrain(), fdClimbDown(), fdClimbUp(), fdEffectInitSparkles(), fdEffectSpawnRevealMarkers(), fdEffectUpdateSparkles(), fdFadeOverlayDrawMarks(), fdFlagBlockApplyFlags(), fdFlagBlockPlaceAll(), fdFlagBlockPlaceAllMarkingEdges(), fdGroundParticlesStart(), fdGroundParticlesUpdate(), fdMotesStart(), fdMotesUpdate(), fdPlaceAtEntrance(), fdPlaceTreasureSpots(), fdRisingParticlesStart(), fdRisingParticlesUpdate(), fdScriptSpawnActorTable(), fdTreasureSpotSetActorPos(), fdWeatherStartRain() and fdWeatherUpdateRain().
Definition at line 224 of file field.h.
fdMapGridGetTerrainKindStub
Uint32 fdMapGridGetTerrainKindStub(Sint32 terrain, Sint32 x, Sint32 z)
Referenced by fdActorLiftTargetBlock(), fdActorPlaceBlocks(), fdActorPlaceMovedBlock(), fdFlagBlockApplyFlags(), fdMapGridBlocksJump() and fdPsynergySteerPushedTarget().
Definition at line 225 of file field.h.
fdMapGridGetTerrainKindAtStub
Sint32 fdMapGridGetTerrainKindAtStub(Sint32 layer, Sint32 x, Sint32 z)
Referenced by fdLeaderStepOffRope(), fdLeaderStepOffTightrope() and fdMapGridCanScoop().
Definition at line 226 of file field.h.
fdMapGridGetMetatileBehaviorAtStub
Sint32 fdMapGridGetMetatileBehaviorAtStub(Sint32 layer, Sint32 x, Sint32 z)
Referenced by fdTryJumpForward().
Definition at line 227 of file field.h.
fdMapGridSetMetatileBehaviorAtStub
void fdMapGridSetMetatileBehaviorAtStub(Sint32 terrain, Sint32 x, Sint32 z, Sint32 value)
Referenced by fdActorFallOverById() and fdActorFallOverWithAnimationById().
Definition at line 228 of file field.h.
fdMapGridIsWallAtStub
Sint32 fdMapGridIsWallAtStub(Sint32 *pos)
Referenced by fdClimbDown() and fdClimbUp().
Definition at line 232 of file field.h.
fdMapGridCheckCollisionStub
Sint32 fdMapGridCheckCollisionStub(ACTOR *actor, Sint32 *pos)
Referenced by fdActorProbeRaised(), fdBlazeUpdateSpray(), fdLeaderCanPushObjectAhead(), fdLeaderPushObjectAhead(), fdLeaderStepOffRope(), fdLeaderStepOffTightrope(), fdPsynergyForce(), fdPsynergySteerPushedTarget(), fdPsynergyUpdateArrow() and fdTryJumpForward().
Definition at line 233 of file field.h.
fdCheckSpheresOverlapStub
Sint32 fdCheckSpheresOverlapStub(Sint32 *a, Sint32 radiusA, Sint32 *b, Sint32 radiusB)
Referenced by fdActorCheckBlocked(), fdClimbDown() and fdClimbUp().
Definition at line 234 of file field.h.
fdMapGridCenterOnFollowedPointStub
void fdMapGridCenterOnFollowedPointStub(void)
Referenced by fdCameraFollowActor(), fdCameraMoveWithinMapBounds() and fdEngineRun().
Definition at line 236 of file field.h.
fdMapGridSetScreenShakeStub
void fdMapGridSetScreenShakeStub(Sint32 x, Sint32 y, Sint32 decay)
Referenced by fdDjinnRunVenusJoinEffect(), fdPsynergyUpdateBurst(), fdPsynergyUpdatePound(), fdViewMoveEnd() and fdViewMoveStart().
Definition at line 237 of file field.h.
fdWorldMapGetCollisionStub
Sint32 fdWorldMapGetCollisionStub(Sint32 *pos)
The World Map's collisions, its affine page, its places visited and its metatile tiles.
Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdMapGridIsSandMetatile() and fdMapGridIsWaterMetatile().
Definition at line 276 of file field.h.
fdPaletteFadeSetTargetStub
Sint32 fdPaletteFadeSetTargetStub(Sint32 mode, Sint32 half)
The palette fade and the debug palette editor.
Referenced by fdActorSystemSuspendProjectionAndShowSprites(), mnShopRestoreFieldPalette() and mnShopSaveAndTintFieldPalette().
Definition at line 406 of file field.h.
fdPaletteFadeStartInterpolationStub
Sint32 fdPaletteFadeStartInterpolationStub(Sint32 ticks)
Referenced by fdActorSystemSuspendProjectionAndShowSprites(), mnShopRestoreFieldPalette() and mnShopSaveAndTintFieldPalette().
Definition at line 407 of file field.h.
fdPaletteFadeLoadPaletteStub
void fdPaletteFadeLoadPaletteStub(void *palette)
Referenced by fdWorldMapLoadGraphics() and fdWorldMapPreloadCurrentTileBlock().
Definition at line 408 of file field.h.
btMotionProjectPosStub
void btMotionProjectPosStub(Sint32 id, Sint32 *projected)
Referenced by btEffectPosProjectBattler().
Definition at line 732 of file field.h.
btMotionProjectScaledPosStub
Sint32 btMotionProjectScaledPosStub(Sint32 unitId, Sint32 *screen)
Referenced by btEffectPosProjectScaledBattler() and mnSelectionMenuDraw().
Definition at line 733 of file field.h.
btEffectBuildBlitterStub
Sint32 btEffectBuildBlitterStub(Sint32 slot, Sint32 widthShift, Sint32 heightShift, Sint32 flags, Uint32 mode)
Referenced by btElementGlowInitStarField() and fdLuckyWheelsRun().
Definition at line 735 of file field.h.
gmPartyAddMemberStub
Sint32 gmPartyAddMemberStub(Sint32 unitId)
The game module's routines the field calls through their stubs: the party's members, their Psynergy, and the Lure Cap's flag.
Referenced by btDebugParamSetLoad(), fdScriptAddPartyMember(), fdScriptAddTwoPartyMembers() and mnStatusScreenMovePartyMember().
Definition at line 743 of file field.h.
gmPartyRemoveMemberStub
void gmPartyRemoveMemberStub(Sint32 owner)
Referenced by btDebugParamSetLoad(), fdPartyRemoveMemberRestored() and mnStatusScreenMovePartyMember().
Definition at line 744 of file field.h.
gmUnitKnowsPsynergyStub
Sint32 gmUnitKnowsPsynergyStub(Sint32 group, Sint32 entry)
Referenced by fdPartyCheckShortcut().
Definition at line 745 of file field.h.
gmFlagRefreshLureCapStub
void gmFlagRefreshLureCapStub(void)
Referenced by fdEngineRun(), fdScriptEnd() and gmArrive().
Definition at line 746 of file field.h.
mnMessageOpenWindowStub
Sint32 mnMessageOpenWindowStub(Sint32 msg, Sint32 x, Sint32 y, Sint32 packed)
The window module's routines the field calls through their stubs: messages, the area name, portraits, item icons, and the messages as someone joins the party.
Referenced by btRun(), fdMessageShowAtActor(), fdScriptShowMessageAtPos(), fdScriptShowSpeakerMessage(), fdScriptShowTwoMessagesAndWait(), mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnItemPickerSelectItem(), mnSanctumShowKeeperMessage(), mnSanctumShowKeeperMessageHidingCursor(), mnShopConfirmEquip(), mnShopShowKeeperMessage() and mnShopShowKeeperMessageHidingCursor().
Definition at line 751 of file field.h.
mnWindowIsClosedStub
Sint32 mnWindowIsClosedStub(Sint32 window)
Referenced by fdMessageShowAtActorAndWait(), fdScriptShowMessageAtPos(), fdScriptShowSpeakerMessage() and fdScriptShowTwoMessagesAndWait().
Definition at line 752 of file field.h.
mnAreaNameWindowHideStub
void mnAreaNameWindowHideStub(void)
Referenced by fdEngineRun() and fdScriptStart().
Definition at line 753 of file field.h.
mnPortraitCloseWindowStub
void mnPortraitCloseWindowStub(Sint32 sprite)
Referenced by fdActorClosePortrait(), fdMessageShowAtActorAndWait(), fdScriptAskYesNoWithActorAnimation() and fdScriptShowTwoMessagesAndWait().
Definition at line 754 of file field.h.
mnIconDrawItemStub
void mnIconDrawItemStub(Sint32 item)
Referenced by fdActorSetItemIcon(), fdActorShowItemIconById(), fdItemDisplayShowItem() and fdItemDisplayShowItemInFront().
Definition at line 755 of file field.h.
mnPartyShowJoinedMessageStub
Sint32 mnPartyShowJoinedMessageStub(Sint32 member, Sint32 value)
Referenced by fdScriptAddPartyMember().
Definition at line 756 of file field.h.
mnPartyShowPairJoinedMessageStub
Sint32 mnPartyShowPairJoinedMessageStub(Sint32 first, Sint32 second)
Referenced by fdScriptAddTwoPartyMembers().
Definition at line 757 of file field.h.
mnDjinnShowJoinedMessageStub
void mnDjinnShowJoinedMessageStub(Sint32 owner, Sint32 element, Sint32 djinni)
Referenced by fdDjinnJoinParty().
Definition at line 758 of file field.h.
Variables in detail
SnapshotObjects
extern ACTOR SnapshotObjects[]
The actors fdActorTableSnapshot saved, up to 32, after their slot numbers.
Referenced by fdActorRestore() and fdActorTableSnapshot().
Definition at line 81 of file field.h.
ActorBlinkSpriteColors
extern const Uint8 ActorBlinkSpriteColors[4]
Referenced by fdActorUpdateBlink().
Definition at line 82 of file field.h.
fdRenderDecodePictureCode
extern Uint8 fdRenderDecodePictureCode[]
fdRenderDecodePicture's Thumb entry and ARM code (picture_decode.s), which
RENDER_LOAD_DECODER copies into the tick scratch slot.
Definition at line 137 of file field.h.
fdRenderDecodePictureCopyEnd
extern Uint8 fdRenderDecodePictureCopyEnd[]
The end of the colour tables kept after fdRenderDecodePicture's code, where
its copy stops (picture_decode.s).
Definition at line 141 of file field.h.
RenderDecodePictureBlockSize
extern Uint8 RenderDecodePictureBlockSize[]
The size of the tick scratch block for fdRenderDecodePicture and its tables,
an address equal to the size (ld_script.ld).
Definition at line 145 of file field.h.
fdGridDrawOutlineCode
extern const Uint8 fdGridDrawOutlineCode[]
The grid outliner's Thumb entry and ARM code (field_arm_entries.s), which
RAM_CODE_LOAD copies to RAM.
Referenced by fdSpriteComposePicture().
Definition at line 149 of file field.h.
GridDrawOutlineCodeSize
extern Uint8 GridDrawOutlineCodeSize[]
The size of fdGridDrawOutlineCode, an address equal to the size
(ld_script.ld).
Referenced by fdSpriteComposePicture().
Definition at line 153 of file field.h.
SpriteAnimationMetadata
extern ANIMATION_METADATA SpriteAnimationMetadata[]
Every sprite animation's metadata, by number (graphics/sprite/sprites.s).
Referenced by fdResourceGetMetadataRecordStub() and fdSpriteViewerRun().
Definition at line 174 of file field.h.
WorldMapPackedTiles
extern Uint8 WorldMapPackedTiles[]
The world map's still image (story.list.tsv): its tiles, packed (tagged LZ).
Referenced by scStaffCreditPlayLighthouseTransition() and scWorldMapPlayLighthouseTransition().
Definition at line 265 of file field.h.
WorldMapPackedPictures
extern Uint8 WorldMapPackedPictures[]
The still image's tile map, packed (tagged LZ), decoded after its tiles.
Referenced by scStaffCreditPlayLighthouseTransition() and scWorldMapPlayLighthouseTransition().
Definition at line 267 of file field.h.
WorldMapPalettes
extern Uint8 WorldMapPalettes[]
The still image's palettes, one for each of its modes.
Referenced by scStaffCreditPlayLighthouseTransition() and scWorldMapPlayLighthouseTransition().
Definition at line 269 of file field.h.
WeatherParticleTiles
extern const Uint8 WeatherParticleTiles[]
The ground particles' tiles, byte LZ (field_effect_particles.list.tsv).
Referenced by fdGroundParticlesStart().
Definition at line 470 of file field.h.
FieldEffectMoteTiles
extern const Uint8 FieldEffectMoteTiles[]
The motes' tiles, byte LZ (field_effect_particles.list.tsv).
Referenced by fdMotesStart() and fdRisingParticlesStart().
Definition at line 472 of file field.h.
FieldEffectStreakTiles
extern const Uint8 FieldEffectStreakTiles[]
The streaks' tiles, byte LZ (field_effect_particles.list.tsv).
Referenced by fdWeatherStartRain().
Definition at line 474 of file field.h.
FieldEffectSparkleTiles
extern const Uint8 FieldEffectSparkleTiles[]
The sparkles' tiles, byte LZ (field_effect_particles.list.tsv).
Referenced by fdEffectInitSparkles().
Definition at line 476 of file field.h.
RopeTiles
extern const Uint8 RopeTiles[]
The ropes' and tightropes' pictures, and the headings the +Control Pad steps
off them toward. The rope's tiles, tagged LZ (rope_vine_pictures.list.tsv).
Referenced by fdRopeInit() and fdTightropeInit().
Definition at line 647 of file field.h.
HangingVineChainBottomPicture
extern const Uint8 HangingVineChainBottomPicture[]
The bottom link of a hanging vine's chain, tagged LZ
(rope_vine_pictures.list.tsv).
Referenced by fdHangingVineInit().
Definition at line 650 of file field.h.