Skip to Content
The Alchemy Project

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.

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

NameDescription
structWORLD_MAP_METATILEOne 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.
structFIELD_UNITA party member's unit as the field reads it: its gauges and its HP and PP.
structFIELD_PSYNERGY_REACHHow far a field Psynergy reaches from its caster, one row a kind in FieldPsynergyReach, ended by -1: fdMeasurePsynergyHeight and fdMeasurePsynergyReach read it.
structRISING_PARTICLEOne rising particle: its sprite, world position, drift and ticks left.
structRISING_PARTICLE_STATEHEAP_SLOT_WEATHER while the rising particles run: their tiles' VRAM cache entry and first tile, and the particles.
structEFFECT_OWNERAn actor (ACTOR) as the Mars Djinni's sparks read the leader: its position and its sprite, typed.
structLINE_SCROLL_STATEThe 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.
structTIGHTROPE_NODEOne node of a tightrope (fdTightropeInit's state): a point on the rope, and the sprite fdTightropeDraw puts between it and the next node.
structTIGHTROPE_SLOTOne of the eight tightropes: the two posts it runs between and its wobble.
structTIGHTROPE_WORKThe tightropes' state (HEAP_SLOT_TIGHTROPE).
structROPE_NODEOne 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.
structROPE_SLOTOne of the eight ropes: the two posts it runs between and its swing.
structROPE_WORKThe ropes' state (HEAP_SLOT_ROPE).

Macros

NameDescription
#defineACTOR_SPRITE_KIND_MASK 15ACTOR.spriteStorageKind's low four bits, its ACTOR_SPR_KIND.
#defineACTOR_CREATE_SPRITE_MASK 0xfffThe sprite id in fdActorCreate's id, below its ACTOR_CREATE (id / 4096).
#defineACTOR_CREATE_KIND (kind) ((kind) << 12)An fdActorCreate id of ACTOR_CREATE kind, above its sprite.
#definePLACEMENT_IMAGE_DEPTH 62The 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.
#defineOBJ_AFFINE_MATRIX (n) ((n) << 25)An affine sprite's matrix, of the 32, in its attr01 word.
#defineDISSOLVE_TILE_PIXELS 64fdSpriteDissolveStep clears one pixel of each 8-bit tile a step, in SpriteDissolvePixelOrder's order, so a tile is gone after this many.
#defineDISSOLVE_FIRST_STEP 64The step the first tile starts to dissolve at; each tile after it starts a step sooner.
#defineDISSOLVE_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).
#defineWORLD_MAP_VIEW_METATILES 32The 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.
#defineWORLD_MAP_METATILE_PIXELS 32
#definePARTY_PP_REPLENISH 999fdPartyAddPp's amount that fills every member's PP: "Everyone's PP was replenished!"
#defineREACH_SHAKEN_OBJECTS 256Added to a field Psynergy's kind, the FieldPsynergyReach row for the actors its shaking reaches (Tremor's, REACH_SHAKEN_OBJECTS + FIELD_PSYNERGY_TREMOR).
#defineROPE_SLOT_COUNT 8The ropes', tightropes' and hanging vines' states each keep eight slots, each a chain of nodes from one pool of 128.
#defineROPE_NODE_COUNT 128
#defineROPE_NODE_DISTANCE_NONE (1 << 28)A squared distance in pixels beyond any rope node, to start a search for the nearest.
#defineTIGHTROPE_STATE ((TIGHTROPE_WORK *)RamHeapSlots->tightrope)
#defineROPE_STATE ((ROPE_WORK *)RamHeapSlots->rope)

Typedefs

NameDescription
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

NameDescription
enumACTOR_SPR_KIND { ACTOR_SPRITE_NONE, ACTOR_SPRITE_ONE, ACTOR_SPRITE_GROUP }ACTOR.spriteStorageKind, its low four bits: what the actor's sprite pointer holds.
enumACTOR_CREATE { ACTOR_CREATE_ONE_SPRITE, ACTOR_CREATE_GROUP, ACTOR_CREATE_NO … }fdActorCreate's id / 4096: what sprites the actor is made with.
enumTERRAIN_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.
enumCOLLISION { COLLISION_TOO_LOW, COLLISION_NONE, COLLISION_TOO_HIGH, COLLI … }What fdMapGridCheckCollision says of a step to a position.
enumENTRANCE_ARRIVAL { ARRIVAL_NONE, ARRIVAL_STAIRS_UP, ARRIVAL_STAIRS_DOWN, ARRIVA … }The arrival fdEntrancePlayArrival played, for the way the last scene was left.
enumROPE_NODE_KIND { ROPE_NODE_FREE, ROPE_NODE_CROSSABLE, ROPE_NODE_UNCROSSABLE }ROPE_NODE.kind and TIGHTROPE_NODE.kind.
enumROPE_SLOT_STATE { ROPE_COILED, ROPE_THROWN }A rope's state (ROPE_SLOT.state), which fdRopeGetState returns.

Functions

NameDescription
voidfdActorUpdateAllMotion (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.
voidfdActorUpdateAllOnField (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.
voidfdActorMoveWithCarriers (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.
voidfdActorSystemProjectSprites (void)Each tick, with the fixed camera: places every actor in use, from the 64th down.
voidfdActorSystemPlaceSprites (void)Each tick, with the scrolling camera: places every actor's sprite on the screen.
Sint32fdActorFindLastActiveId (void)Returns the slot after the last placed actor (8 when there is none), or -1 when the last slot is occupied.
voidfdActorTableClear (void)Empties all the actor slots, without releasing the actors.
BoolfdActorIsTargetUnset (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.
voidfdActorTurnPairToFaceEachOther (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).
voidfdActorUpdateBlink (ACTOR *actor)Per-tick update function of a blinking actor: sets its sprite animations' colour mode from ActorBlinkSpriteColors, each entry lasting two ticks.
voidfdActorStartCameraStub (void *actor, void *effect)
Sint32fdActorPlaySoundInViewStub (ACTOR *actor, Sint32 sound)
voidfdActorSpawnWaterSplashStub (ACTOR *actor, Sint32 kind)
voidfdActorSetSquareSprite (Uint32 objectId)Draws the actor's sprite square, 16 by 16 pixels, 8 pixels down.
Sint32fdActorGetSpriteShape (Uint32 objectId)Returns the OAM shape of the actor's sprite (0 square, 1 wide, 2 tall), or 0 without one.
voidfdSpriteAnimationClearStub (void *record)
voidscSetActorSpritePriority (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.
FIXEDfdMapGridGetTerrainHeightStub (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.
Uint32fdMapGridGetTerrainKindStub (Sint32 terrain, Sint32 x, Sint32 z)
Sint32fdMapGridGetTerrainKindAtStub (Sint32 layer, Sint32 x, Sint32 z)
Sint32fdMapGridGetMetatileBehaviorAtStub (Sint32 layer, Sint32 x, Sint32 z)
voidfdMapGridSetMetatileBehaviorAtStub (Sint32 terrain, Sint32 x, Sint32 z, Sint32 value)
Sint32fdMapGridIsWallAtStub (Sint32 *pos)
Sint32fdMapGridCheckCollisionStub (ACTOR *actor, Sint32 *pos)
Sint32fdCheckSpheresOverlapStub (Sint32 *a, Sint32 radiusA, Sint32 *b, Sint32 radiusB)
voidfdMapGridCenterOnFollowedPointStub (void)
voidfdMapGridSetScreenShakeStub (Sint32 x, Sint32 y, Sint32 decay)
voidfdMapGridUpdateLayerScroll (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.
voidfdTileMapDecodeStagedBuffer (Sint32 size)Unpacks a map's metatile tiles, decoded into the map metatile buffer from its second byte, into MetatileTiles.
voidfdTileMapConvertBuffer (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.
voidfdTilesetAnimationStartAll (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).
Uint32fdMapReadEditU16 (Uint8 **cursor)Reads the little-endian halfword at *cursor, which may be unaligned, and moves the cursor past it.
voidfdMapApplyFlagEdits (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.
Sint32fdWorldMapGetCollisionStub (Sint32 *pos)The World Map's collisions, its affine page, its places visited and its metatile tiles.
voidfdWorldMapApplyAffinePage (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.
voidfdWorldMapMarkPlaceVisited (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).
Sint32fdWorldMapWriteLayerMetatileTile ( 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.
Sint32fdEntrancePlayArrival (void)Arriving in a scene, and the band over the leader's sprite as it leaves through a hidden layer (EXIT_STYLE_HIDDEN_LAYER).
voidfdExitAddHiddenLeaderLayer (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.
Uint32fdStreamReadU16 (Uint8 **cursor)Reads a little-endian halfword at *cursor and moves the cursor past it.
Sint16fdStreamReadS16 (Uint8 **cursor)Reads a signed little-endian halfword at *cursor and moves the cursor past it.
voidfdApplyEntrance (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.
voidfdEntranceEndArrivalAnimation (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.
voidfdExitPrepareAnimation (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.
voidscSetArrivalFlags (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.
Sint32fdRunRaisedCue (Sint32 id)Runs the scene's raised cue (CUE_RAISED) for id: its message or its function.
Sint32fdRunStepCueOrExit (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.
Sint32fdRunPushMetatile (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.
Sint32fdExamineMetatile (Sint32 id)The search command.
Sint32fdCheckConfiguredKeys (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).
Sint32fdPartyCheckShortcut (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.
Sint32fdPartyApplyPoisonDamage (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.
voidfdBattleBackgroundSelectForMap (void)Chooses the battle background for the current scene.
voidfdEncounterSelectBattleMusic (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.
voidfdSuperLuckyDiceRun (void)Runs Super Lucky Dice until the player quits or cannot afford a throw (DICE_BET).
voidfdCameraResetViewDefaults (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.
Sint32fdLuckyDiceScaleRGB555Buffer (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.
Sint32fdSuperLuckyDiceScaleRGB555Buffer (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.
voidfdSuperLuckyDiceBrightenColors (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.
Sint32fdSuperLuckyDiceScoreDice (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.
Sint32fdSuperLuckyDiceDrawNumber (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.
Sint32fdSuperLuckyDiceDrawLargeNumber (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.
Sint32fdUsePsynergy (Uint32 code)Field Psynergy: casting one, running it, and what it does as it ends.
voidfdPsynergyDispatch (void)Runs the field Psynergy animation the scene names on the target the player chose (FIELD_EFFECT_STATE.targetId).
voidfdPsynergyRun (void)Runs the field Psynergy animation the scene names, with no target chosen yet: each kind runs its effect to the end.
voidfdPsynergyRunEnd (void)Ends the current field Psynergy when it is Reveal, Cloak, Avoid, Sand, Hover or the Ring: what each does as it ends.
voidfdPsynergyFinishMindRead (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.
Sint32fdMeasurePsynergyHeight (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.
Sint32fdSceneItemFindPos (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.
voidfdPlaceTreasureSpots (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.
voidfdTreasureSpotLaunchMimic (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.
voidfdTreasureSpotOpenEmptyChest (Uint32 objectId)Opens the empty chest of the actor with SE_CHEST_OPEN, and waits 12 ticks.
Sint32fdPaletteFadeSetTargetStub (Sint32 mode, Sint32 half)The palette fade and the debug palette editor.
Sint32fdPaletteFadeStartInterpolationStub (Sint32 ticks)
voidfdPaletteFadeLoadPaletteStub (void *palette)
voidfdPaletteEditorRun (void)The debug palette editor (L on the Pause menu in debug mode).
Sint32fdPaletteFadeClampComponent (Sint32 value)A colour channel clamped to RGB_LEVEL_MAX, held as it is or where blue is.
Sint32fdPaletteFadeClampShiftedComponent (Sint32 value)Clamps a colour channel held where blue is to at most RGB_LEVEL_MAX there.
Sint32fdPsynergyCheckOverlap (Sint32 *a, Sint32 radiusA, Sint32 *b, Sint32 radiusB)The field effects the Psynergy and the found items show.
voidfdPsynergyGrowFromCaster (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.
voidfdPsynergyDrawCanvasSprite (void)Draws the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite) each tick.
voidfdPsynergyReleaseSceneSprite (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.
voidfdEffectSpawnRevealMarkers (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.
voidfdEffectShrinkActorAndDestroyFast (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.
voidfdEffectShrinkActorAndDestroySlow (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.
voidfdEffectUpdateRadialSpread (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.
voidfdEffectPulseActorScale (struct ACTOR *actor)Per-tick update: makes an actor pulse, switching its scale between the two values of FieldEffectPulseScales every 4 ticks.
voidfdEffectAdvanceAngleWithRamp (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.
voidfdEffectUpdateMarsSpark (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.
voidfdItemDisplayEmitSparkles (struct ACTOR *emitter)Each tick of a found item's picture: one time in ten, a sparkle appears within 16 pixels of it.
voidfdDjinnRunBattleStartHop (Sint32 djinniId)A Djinni's hop as its battle starts, and its spin as it joins.
voidfdDjinnAdvanceSpinAngle (struct ACTOR *djinni)Per-tick update of a joining Venus or Jupiter Djinni: spins it an eighth of a turn, as fdEffectAdvanceSpinAngle does.
Sint32fdRopeFindById (Sint32 id, Sint32 *otherPost, Sint32 *index)The ropes Lash throws and ties between two posts.
voidfdRopeSwingBetween (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.
BoolfdRopeIsLeaderAtEnd (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.
Sint32fdRopeLayTied (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.
Sint32fdRopeLayCoil (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.
Sint32fdRopeLayBowed (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.
voidfdRopeDraw (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.
voidfdRopeUpdate (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.
voidfdTightropeWobbleBetween (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.
Sint32fdTightropeLay (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.
Sint32fdTightropeLayBowed (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.
Sint32fdTightropeLayCoil (Sint32 index, Sint32 x, Sint32 y, Sint32 z, Sint32 toX, Sint32 toY, Sint32 toZ)fdRopeLayCoil for a tightrope.
Sint32fdTightropeRecoil (Sint32 slot, Sint32 x1, Sint32 y1, Sint32 z1, Sint32 x2, Sint32 y2, Sint32 z2, Sint32 wave)fdRopeRecoil for a tightrope.
voidfdTightropeDraw (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.
voidfdTightropeUpdate (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.
Sint32btUnitProjectToScreen (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.
voidbtMotionProjectPosStub (Sint32 id, Sint32 *projected)
Sint32btMotionProjectScaledPosStub (Sint32 unitId, Sint32 *screen)
voidbtEffectRunFlurry (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.
Sint32btEffectBuildBlitterStub (Sint32 slot, Sint32 widthShift, Sint32 heightShift, Sint32 flags, Uint32 mode)
Sint32gmPartyAddMemberStub (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.
voidgmPartyRemoveMemberStub (Sint32 owner)
Sint32gmUnitKnowsPsynergyStub (Sint32 group, Sint32 entry)
voidgmFlagRefreshLureCapStub (void)
Sint32mnMessageOpenWindowStub (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.
Sint32mnWindowIsClosedStub (Sint32 window)
voidmnAreaNameWindowHideStub (void)
voidmnPortraitCloseWindowStub (Sint32 sprite)
voidmnIconDrawItemStub (Sint32 item)
Sint32mnPartyShowJoinedMessageStub (Sint32 member, Sint32 value)
Sint32mnPartyShowPairJoinedMessageStub (Sint32 first, Sint32 second)
voidmnDjinnShowJoinedMessageStub (Sint32 owner, Sint32 element, Sint32 djinni)

Variables

NameDescription
extern ACTORSnapshotObjects []The actors fdActorTableSnapshot saved, up to 32, after their slot numbers.
extern const Uint8ActorBlinkSpriteColors [4]
extern Uint16ActorScriptIdleScript []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 Sint32ActorScriptEndScript []A script that ends at once.
extern const Sint32ActorCameraScript []The camera following the leader within the map's bounds.
extern const Uint8ActorStepAngleScript []Turns the actor a step toward the facing in its timer.
extern const Sint32ActorApproachWatchedScript []Following the watched actor (fdActorApproachWatchedActor).
extern const Sint32ActorKeyCheckScript []Each runs one control command every tick: the command, SC_WAIT(1), SC_LOOP(SC_FOREVER, SC_TOP).
extern const Sint32ActorPlayerScript []The leader on foot (fdActorUpdatePlayerControl).
extern const Sint32ActorWalkingScript []Walking (fdActorUpdateWalkingControl).
extern const Sint32ActorKeysScript []Climbing by the keys (fdActorMoveByKeys).
extern const Sint32ActorRopeScript []Crossing a tied rope (fdActorCrossRope).
extern const Sint32ActorTightropeScript []Crossing a tightrope (fdActorCrossTightrope).
extern const Sint32ActorSandScript []Moving as sand (fdActorMoveAsSand).
extern const Sint32ActorHoverScript []Hovering (fdActorUpdateHoverControl).
extern const Sint32ActorSailOnMapScript []Sailing on a map (fdActorSailOnMap).
extern const Sint32ActorWorldMapScript []The leader on the World Map (fdActorMoveOnWorldMap).
extern const Sint32ActorSailScript []Sailing on the World Map (fdActorSailOnWorldMap).
extern const Sint32ActorFlyScript []Flying on the World Map (fdActorFlyOnWorldMap).
extern const Sint32ActorSandOnWorldMapScript []Moving as sand on the World Map (fdActorMoveAsSandOnWorldMap).
extern Uint32EmotePopTiltedScript []An emote bubble popping up tilted; each scene that shows one keeps its own copy.
extern Uint8fdRenderDecodePictureCode []fdRenderDecodePicture's Thumb entry and ARM code (picture_decode.s), which RENDER_LOAD_DECODER copies into the tick scratch slot.
extern Uint8fdRenderDecodePictureCopyEnd []The end of the colour tables kept after fdRenderDecodePicture's code, where its copy stops (picture_decode.s).
extern Uint8RenderDecodePictureBlockSize []The size of the tick scratch block for fdRenderDecodePicture and its tables, an address equal to the size (ld_script.ld).
extern const Uint8fdGridDrawOutlineCode []The grid outliner's Thumb entry and ARM code (field_arm_entries.s), which RAM_CODE_LOAD copies to RAM.
extern Uint8GridDrawOutlineCodeSize []The size of fdGridDrawOutlineCode, an address equal to the size (ld_script.ld).
extern Uint8SpriteDissolvePixelOrder []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 Uint8SpriteColorGreyTable []Greyscale: each colour to the grey of its brightness.
extern const Uint8SpriteColorTintTables []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_METADATASpriteAnimationMetadata []Every sprite animation's metadata, by number (graphics/sprite/sprites.s).
extern Uint8WorldMapPackedTiles []The world map's still image (story.list.tsv): its tiles, packed (tagged LZ).
extern Uint8WorldMapPackedPictures []The still image's tile map, packed (tagged LZ), decoded after its tiles.
extern Uint8WorldMapPalettes []The still image's palettes, one for each of its modes.
extern const Uint8WorldMapTerrainBehaviorTable []The terrain each World Map metatile fights on (fdWorldMapGetBattleEnvironment).
extern Uint32SceneExits []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 Uint8SuperLuckyDiceFaceTiles []The Lucky Dice and Super Lucky Dice games, and the Lucky Wheels' sparks.
extern const Uint16LuckyWheelsSparkPictureOffsets []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 Uint8LinkLobbySlotColumns []The link lobby's slots: the column each one's word is kept in, and the words.
extern Sint32LinkLobbySlotValues []The words the lobby publishes in its link payload, by LOBBY_SLOT; the partner compares them with its own (scLinkLobbyPeerSlotMatches).
extern const FIELD_PSYNERGY_REACHFieldPsynergyReach []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 Sint32GrowthLeafScript []The field effects' scripts, pictures and tables.
extern const Sint32FieldEffectShortEffectScript []The three scripts of FieldEffectDurationScripts: an effect that goes after 24, 46 or 128 ticks.
extern const Sint32FieldEffectMediumEffectScript []
extern const Sint32FieldEffectLongEffectScript []
extern const Uint32FieldEffectPulseScales []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 Sint16LineScrollWaveSine []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 Sint16WeatherRainSplashFrames []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 Sint16WeatherRainStreakOffsets []{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_PICTUREFieldEffectSparklePictures []{dy, tile} of a sparkle (script_commands_motes.c): dy in screen pixels from its spot, a row every two ticks.
extern const Uint8WeatherParticleTiles []The ground particles' tiles, byte LZ (field_effect_particles.list.tsv).
extern const Uint8FieldEffectMoteTiles []The motes' tiles, byte LZ (field_effect_particles.list.tsv).
extern const Uint8FieldEffectStreakTiles []The streaks' tiles, byte LZ (field_effect_particles.list.tsv).
extern const Uint8FieldEffectSparkleTiles []The sparkles' tiles, byte LZ (field_effect_particles.list.tsv).
extern const Uint8RopeTiles []The ropes' and tightropes' pictures, and the headings the +Control Pad steps off them toward.
extern const Uint8HangingVineChainBottomPicture []The bottom link of a hanging vine's chain, tagged LZ (rope_vine_pictures.list.tsv).
extern const Uint16RopeKeyHeadings []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 Uint16InputDpadAngles []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.

EnumeratorValueDescription
ACTOR_SPRITE_NONE0nothing drawn
ACTOR_SPRITE_ONE1
ACTOR_SPRITE_GROUP2a 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.

EnumeratorValueDescription
ACTOR_CREATE_ONE_SPRITE0the id's sprite (ACTOR_SPRITE_ONE)
ACTOR_CREATE_GROUP2The sprites of the id and id + 1 (ACTOR_SPRITE_GROUP).
ACTOR_CREATE_NO_SPRITE8No 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.

EnumeratorValueDescription
TERRAIN_FLAT0
TERRAIN_SLOPE_X1
TERRAIN_SLOPE_Y2
TERRAIN_STEP_SUM_DIAGONAL3
TERRAIN_STEP_DIFFERENCE_DIAGONAL4
TERRAIN_BEND_SUM_DIAGONAL5
TERRAIN_BEND_DIFFERENCE_DIAGONAL6
TERRAIN_ROUNDED_SQUARE7
TERRAIN_STEP_X8
TERRAIN_STEP_Y9
TERRAIN_SAMPLE_TABLE_TRANSPOSED10As TERRAIN_SAMPLE_TABLE
TERRAIN_SAMPLE_TABLE_TRANSPOSED_MIRRORED11with x and y swapped. As TERRAIN_SAMPLE_TABLE_MIRRORED with x and y swapped.
TERRAIN_SAMPLE_TABLE12The sample TerrainSampleIndexTable picks for each pixel.
TERRAIN_SAMPLE_TABLE_MIRRORED13As TERRAIN_SAMPLE_TABLE, mirrored left to right.
TERRAIN_SPLIT_TOP_STEP14Above y 8, the first sample left of x 8 and the second right of it; below, the third.
TERRAIN_SPLIT_BOTTOM_STEP15Above y 8, the first
TERRAIN_KIND_COUNT16sample; below, the second left of x 8 and the third right of it.
TERRAIN_BUMP99Not 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.

EnumeratorValueDescription
COLLISION_TOO_LOW-1the ground there is more than 12 pixels lower
COLLISION_NONE0the actor can step there
COLLISION_TOO_HIGH1the ground there is more than 8 pixels higher
COLLISION_IMPASSABLE2the 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.

EnumeratorValueDescription
ARRIVAL_NONE0none: the scene plays its own
ARRIVAL_STAIRS_UP1up stairs, ANIM_LEADER_ARRIVE
ARRIVAL_STAIRS_DOWN2down stairs, ANIM_LEADER_ARRIVE_ALTERNATE
ARRIVAL_FALLING3falling 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.

EnumeratorValueDescription
ROPE_NODE_FREEin the pool, on no rope
ROPE_NODE_CROSSABLElaid along a rope, for the leader to step onto
ROPE_NODE_UNCROSSABLElaid, 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.

EnumeratorValueDescription
ROPE_COILEDat its first post, or pulled back there
ROPE_THROWNthrown 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.

On this page

StructuresMacrosTypedefsEnumerationsFunctionsVariablesDescriptionMacros in detailACTOR_SPRITE_KIND_MASKACTOR_CREATE_SPRITE_MASKACTOR_CREATE_KINDPLACEMENT_IMAGE_DEPTHOBJ_AFFINE_MATRIXDISSOLVE_TILE_PIXELSDISSOLVE_FIRST_STEPDISSOLVE_STEPSWORLD_MAP_VIEW_METATILESWORLD_MAP_METATILE_PIXELSPARTY_PP_REPLENISHREACH_SHAKEN_OBJECTSROPE_SLOT_COUNTROPE_NODE_COUNTROPE_NODE_DISTANCE_NONETIGHTROPE_STATEROPE_STATETypedefs in detailSCRIPT_COMMAND_FNDRAW_FNUPLOAD_FNOUTLINE_FNTARGET_HOOKEnumerations in detailACTOR_SPR_KINDACTOR_CREATETERRAIN_KINDCOLLISIONENTRANCE_ARRIVALROPE_NODE_KINDROPE_SLOT_STATEFunctions in detailfdActorStartCameraStubfdActorPlaySoundInViewStubfdActorSpawnWaterSplashStubfdSpriteAnimationClearStubfdMapGridGetTerrainHeightStubfdMapGridGetTerrainKindStubfdMapGridGetTerrainKindAtStubfdMapGridGetMetatileBehaviorAtStubfdMapGridSetMetatileBehaviorAtStubfdMapGridIsWallAtStubfdMapGridCheckCollisionStubfdCheckSpheresOverlapStubfdMapGridCenterOnFollowedPointStubfdMapGridSetScreenShakeStubfdWorldMapGetCollisionStubfdPaletteFadeSetTargetStubfdPaletteFadeStartInterpolationStubfdPaletteFadeLoadPaletteStubbtMotionProjectPosStubbtMotionProjectScaledPosStubbtEffectBuildBlitterStubgmPartyAddMemberStubgmPartyRemoveMemberStubgmUnitKnowsPsynergyStubgmFlagRefreshLureCapStubmnMessageOpenWindowStubmnWindowIsClosedStubmnAreaNameWindowHideStubmnPortraitCloseWindowStubmnIconDrawItemStubmnPartyShowJoinedMessageStubmnPartyShowPairJoinedMessageStubmnDjinnShowJoinedMessageStubVariables in detailSnapshotObjectsActorBlinkSpriteColorsfdRenderDecodePictureCodefdRenderDecodePictureCopyEndRenderDecodePictureBlockSizefdGridDrawOutlineCodeGridDrawOutlineCodeSizeSpriteAnimationMetadataWorldMapPackedTilesWorldMapPackedPicturesWorldMapPalettesWeatherParticleTilesFieldEffectMoteTilesFieldEffectStreakTilesFieldEffectSparkleTilesRopeTilesHangingVineChainBottomPicture