Skip to Content
The Alchemy Project

include/field/field.h

The field engine's shared functions, globals and actor scripts.

Included by battle_effect_internal.h, actor_script.c, actor_script_operands.c, actor_scripts.c, field_engine_tables.c, map_grid_data.c, sprite_color_tables.c, world_map_encounter_rules.c, world_map_resources.c, menu_internal.h, menu_tables.c, sound.c, map_grid.h, script.h, script_inline.h and import.h.

Structures

NameDescription
structPATH_RECORDERThe Colosso opponent's path player, at the start of SceneLocalState: the path in COLOSSO_RACE_STATE is played back or recorded by scColossoUpdatePathOpponent.
structSWITCH_METATILEA Venus Lighthouse switch or pillar socket's map metatile.
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.

Macros

NameDescription
#defineActorsWork (*(ACTOR **)&HeapSlots[HEAP_SLOT_ACTORS])The ACTOR_COUNT actors (HEAP_SLOT_ACTORS), 112 bytes each.
#defineACTOR_SPRITE_KIND_MASK 15ACTOR.spriteStorageKind's low four bits, its ACTOR_SPR_KIND.
#defineACTOR_CREATE_KIND (kind) ((kind) << 12)An fdActorCreate id of ACTOR_CREATE kind, above its sprite.
#defineACTOR_CREATE_SPRITE_MASK 0xfffThe sprite id in fdActorCreate's id, below its ACTOR_CREATE (id / 4096).
#defineSHAKE_KEEP (-1)A screen shake's component left as it is; any negative value does.
#defineLineScroll (*(LINE_SCROLL_STATE **)&HeapSlots[HEAP_SLOT_LINE_SCROLL])The line scroll's state, HEAP_SLOT_LINE_SCROLL under its own name, which scLineScrollInitWave takes for a scene's wave.
#defineLINE_SCROLL_WAVE_ENTRIES 256The entries of a wave's sine, one cycle.
#defineLINE_SCROLL_WAVE_SCALE 256A wave's offset is its sine entry times its 16.16 amplitude, over this: an amplitude of toFIXED(1) swings 16 pixels each way.
#defineLINE_SCROLL_WAVE_SINEThe entries of LineScrollWaveSine, which the Lemurian ship's ripple keeps again in its overlay.

Enumerations

NameDescription
enumWORLD_MAP_LIGHTHOUSE { WORLD_MAP_LIGHTHOUSE_MERCURY, WORLD_MAP_LIGHTHOUSE_VENUS }The lighthouse whose beacon the world map shows lit (scWorldMapPlayLighthouseTransition), as WorldMapPalettes orders their colours.
enumACTOR_SYSTEM_MODE { ACTOR_SYSTEM_MAP, ACTOR_SYSTEM_WORLD_MAP, ACTOR_SYSTEM_BATTL … }How the actor system runs (fdActorSystemInit): which camera follows the actors and which update moves them.
enumANIMATION_FACING_KIND { ANIM_FACING_NONE, ANIM_FACING_ONE_PICTURE, ANIM_FACING_FRONT … }SPR_ANIMATION.kind: the facing table a sprite animation's pictures follow (fdSpriteComposePicture, facing.c).
enumSPR_PICTURE_CODEC { SPRITE_PICTURE_RAW, SPRITE_PICTURE_TAGGED_LZ, SPRITE_PICTURE … }SPR_ANIMATION.mode, from the metadata's pictureCodec: how a sprite animation's pictures are stored.
enumSPR_FLAG { SPRITE_FLAG_SHADOW, SPRITE_FLAG_OUTLINED }SPR.flags.
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.
enumWORLD_MAP_COLLISION { WORLD_MAP_COLLISION_WALKABLE_FIRST, WORLD_MAP_COLLISION_SHAL … }The world map's collision values (fdWorldMapGetCollision), 1 to 15; each indexes a row of WorldMapBattleEnvironments.
enumBATTLE_ENVIRONMENT { BATTLE_ENVIRONMENT_NONE, BATTLE_ENVIRONMENT_GRASSLAND, BATTL … }A world map battle environment (WorldMapBattleEnvironments, fdWorldMapGetBattleEnvironment): what its ground means for battles, named by the battle background fdBattleBackgroundSelectForEnvironment gives it.
enumWORLD_MAP_ENCOUNTER_REGION { WORLD_MAP_ENCOUNTER_REGION_VALE_VAULT, WORLD_MAP_ENCOUNTER_R … }A world map metatile's encounter region (bits 30..24 of its block word), which picks its encounter zones (WorldMapEncounterRules), each named for the places whose entrances lie in it.
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 from MapGridTerrainHeightFunctions.
enumCOLLISION { COLLISION_TOO_LOW, COLLISION_NONE, COLLISION_TOO_HIGH, COLLI … }What fdMapGridCheckCollision says of a step to a position.

Variables

NameDescription
extern Sint32CameraUnreadWordAAn IWRAM word the scrolling camera's setup clears; nothing in the tree reads it.
extern Sint32CameraUnreadWordBThe second IWRAM word the scrolling camera's setup clears; also unread.
extern const Sint32ActorDefaultScript []The script fdActorCreate gives every new actor: it does nothing and returns to the idle script.
extern const Uint8WorldMapBattleEnvironments []World map battle environments (BATTLE_ENVIRONMENT), indexed by the collision value plus 16 when the block word's top bit is set, or plus 32 (whatever that bit) for WORLD_MAP_ENCOUNTER_REGION_SNOWFIELD.
extern Uint8RenderDecodePictureCodeSize []The size of fdRenderDecodePicture, copied to HEAP_SLOT_TICK_SCRATCH; an address equal to the size (ld_script.ld).
extern const Uint8SpriteColorGreyTable []Four 256-byte colour tables (remap0 to remap3), indexed by pixel: the SPR_COL_MODE tables after SpriteColorTables' five, the first also remapping the command icons (fdSpriteColorRemapPixels).
extern const Sint32DustPuffLongScript []One of a ledge jump's dust puffs (fdEffectSpawnDustPuff): SC_WAIT(1) looped 38 times, then SC_RELEASE.
extern const Sint32DustPuffShortScript []The other dust puff: the same, looped 18 times.
extern Uint32WorldMapGraphicsResources [][6]Each set is a palette and five tilesets: fdWorldMapLoadGraphics decodes the palette into BG palettes 0 to 13, the next four into the two halves of char blocks 2 and 3, and the last into MapGridAnimationTiles, where the tileset animations copy their pictures from.
extern const Sint32ActorWaitScript []SC_WAIT(40), then SC_RELEASE: the one-off attached effect that ends by itself (fdEffectSetAttached, ATTACHED_EFFECT_ONCE).
extern const Uint8FieldEffectSparkleTiles []The sparkles' 16 by 16 tiles, packed (fdEffectInitSparkles).
extern const Uint8FieldExamineCueMessageOffsets []The message of each searchable metatile behavior from 242 to 247, as an offset from MsgTileChecked and MsgTileResult.
extern const Uint8FieldEffectMoteTiles []The motes of light's 16 by 16 tiles, packed (fdMotesStart).
extern Sint32DjinnFiguresSpriteIds []The sprites of the four Djinn DjinnFigures shows: a Venus, a Mercury, a Mars and a Jupiter Djinni.
extern Sint32ShipRoomsShakeTimerTicks left of the Kraken's current jolt.
extern const Uint8WorldMapPackedPictures []The lighthouse transition's pictures, packed (tagged LZ), decoded 4 KB after the tiles (scWorldMapPlayLighthouseTransition).
extern const Uint8WorldMapPackedTiles []The lighthouse transition's tiles, packed (tagged LZ).
extern const Uint8WorldMapPalettes []The lighthouse transitions' palettes, 32 bytes each, loaded as BG palette 14; indexed by WORLD_MAP_LIGHTHOUSE.
extern Uint16ColossoGaugePalette []The race gauge's 16 colours, loaded as OBJ palette 14 (scColossoDrawGauge).
extern Uint16LogRoomsACorneredTicksTicks in a row the chase has found a suspect cornered; at LOG_ROOMS_A_CORNERED_TICKS the chase raises its script.
extern Uint8fdActorUpdateAllCodeSize []The size of fdActorUpdateAll's code, an address equal to the size (ld_script.ld).
extern const Uint8ActorBlinkSpriteColors []A blinking actor's colour mode by tick ((TickCount >> 1) & 3, fdActorUpdateBlink): white for two ticks out of eight.
extern const Sint32MovementTypeStandScript []The actor motion scripts: movement types 1 to 7, which fdActorSetMovementType starts by number, and two turning scripts with no movement type number.
extern const Sint32MovementTypeWanderScript []Movement type 2: wanders within 16 pixels of home (SC_WANDER_HOME) at half a pixel a tick.
extern const Sint32MovementTypeWanderNearScript []Movement type 3: the same within 8 pixels of home.
extern const Sint32MovementTypeWanderCloseScript []Movement type 4: wanders within 6 pixels of home at 0.4 pixels a tick.
extern const Sint32ActorLaunchScript []Waits to arrive, then turns by fdActorStepAngle until it faces the kept angle (fdActorLaunchFromLeader).
extern const Sint32MovementTypeFollowWatchedScript []Movement type 5: fdActorMoveTowardTarget every tick, forever.
extern const Sint32MovementTypeResetActionScript []Movement type 7: fdActorClearSpriteAndCollisionFlags once, then SC_END.
extern const Sint32ActorStepAngleScript []Turns by fdActorStepAngle until it faces the kept angle, then SC_END.
extern const Sint32MovementTypeFaceLeaderScript []Movement type 6: turns toward the leader every tick, forever.
extern const Sint32RepeatedSquashScript []An actor squashes and springs back as many times as fdActorStartRepeatedMotion asks, 1 to 3: the motion is written three times, 32 words each, and a run of count motions starts (3 - count) * 32 words in and runs to the end.
extern Uint8HeatGaugeTiles []Lamakan Desert's heat gauge (scHeatGaugeStart and scHeatGaugeDraw).
extern const Uint16HeatGaugePalette [16]The gauge's 16 colours, loaded as OBJ palette 14.
extern Uint8fdRenderDecodePicture []The sprite picture decoder, ARM code run from a copy in HEAP_SLOT_TICK_SCRATCH.
extern Uint8SolSanctumStatueSpriteRowsGraphics []The statue scene's three scrolling strips, packed (syDecompressByteLZ).
extern Uint32PushedActorRectangleKinds []The six large things' sprite animations, which pick their rectangles in PushedActorRectangles; each scene with them defines its own.
extern const Uint8fdTileMapDrawRows []The tilemap row drawer, run from a copy in HEAP_SLOT_RAM_CODE_TEMP.
extern Uint8fdTileMapDrawRowsCodeSize []The size of fdTileMapDrawRows (picture_decode.s).
extern Uint8fdWorldMapUpdateAffineLinesCodeSizeThe size of fdWorldMapUpdateAffineLines, copied to HEAP_SLOT_RAM_CODE; an address equal to the size (ld_script.ld).
extern const Sint32WorldMapFootprintActions [6]Two scripts for the World Map's footprint and dust effects: wait 120 or 30 ticks, then release the actor.
extern const Sint16WorldMapKeyHeadings [16]The direction pad's headings, defined as Uint16 in facing.c.
extern const Uint16InputDpadAngles []The field effects' scripts and tables (field_engine_tables.c, actor_scripts.c, field_effect_tables.c and graphics/field_effects/field_effects.list.tsv).
extern const Sint8HaltFlickerColorModes []The colour modes a Halted actor flickers through at random (fdPsynergyUpdateHaltedActor, script_commands_halt.c): its own colours twice as often as each of the five channel swaps and grey.
extern const Uint8FieldEffectArcSparkTiles []The 32 by 16 spark of Avoid's falling arcs (arc_spark.png), 4 bits a pixel; fdPsynergyAvoid loads it.
extern const Sint32GrowthLeafScript []Growth's falling leaves: each waits 60 ticks and releases itself.
extern const Sint32ForceFistScript []Waits to arrive, sets off fdEffectSpawnHeavyImpact and releases the actor: Force's fist as it lands.
extern const Sint32EmoteBubbleScript []The emote bubble's script (fdActorShowEmoteById): eight 2-tick steps of squash and stretch (SC_ADD to SW_SCALE_X and SW_SCALE_Y), 30 ticks still, then SC_RELEASE.
extern const Sint32FieldEffectParticleScript []Sinks a quarter pixel a tick for 60 ticks, then disappears.
extern const Uint32FieldEffectPulseScales []Two scales that alternate ((FrameCount >> 2) & 1): full size and 0.97 of it (fdEffectPulseActorScale, script_commands_jupiter.c); nothing reads the third word.
extern const Sint32FieldEffectSourceHoldScript []Faces the watched actor every tick, forever: the caster holding its target while Move, Carry or Lift has it (each gives the caster its target first).
extern const Sint16FieldEffectTargetRangeByMode []{field Psynergy kind, range in pixels}, ended by -1; a kind not listed reaches 16 pixels.
extern const Sint32FieldEffectUntargetedActorScript []A lone SC_RELEASE: an actor that has arrived releases itself (fdMindReadUpdateCrescent).
extern const Uint8FieldEffectSparkTiles []The 32 by 16 spark a field Psynergy's particles draw (spark.png), 4 bits a pixel; fdPsynergyLoadResources loads it.
extern const Uint8FieldEffectQuadrantModes []Move's hand animation by the quarter turns from its side of the target to the push (script_commands_move.c): 3 toward its side, 2 away from it, 1 either way across.
extern const Sint32FieldPsynergyCastColors []The eight tints (PALETTE_TINT_CUSTOM and an RGB555 colour) a field Psynergy fades the palettes toward, picked by the tick counter or by the FLAG_PSYNERGY_TINT flags (fdPsynergyFadeToCastColor).
extern const Sint16WeatherRainSplashFrames []{dx, dy, tile, shape, size} for each of the 16 frames of a raindrop's splash (script_commands_weather.c): dx and dy in screen pixels from its spot, tile from its first tile.
extern const Uint8WeatherParticleTiles []The ground particles' 16 by 16 tiles, packed (syDecompressByteLZ).
extern const Uint8SpriteColorTables [][256]The first five 256-byte colour tables of SPR_COL_MODE, indexed by pixel.
extern const Uint8ActorShadowTiles []The sprites' shadow, 16 by 8 at 256 colours, loaded into VRAM cache entry 93.
extern const Sint32ActorKeyCheckScript []The built-in scripts an actor script can hand its actor to: key checks, the player, the world map and the camera (actor_script.c).
extern const Sint32ActorKeysScript []
extern const Sint32ActorPlayerScript []
extern const Sint32ActorWorldMapScript []
extern const Sint32ActorCameraScript []
extern const Sint32ActorApproachWatchedScript []
extern const Sint32ActorIdleScript []The idle script fdActorStartIdle gives an actor.
extern const Sint16LineScrollWaveSine []One cycle of sine in 256 entries, 4.12 fixed point (4096 at the peak).
extern Uint8PlayerActorId []Read as a halfword by fdActorSetOthersPaused: the actor id of the player's actor, which it leaves alone.

Description

The field engine's shared functions, globals and actor scripts.

Macros in detail

ActorsWork

#define ActorsWork (*(ACTOR **)&HeapSlots[HEAP_SLOT_ACTORS])

The ACTOR_COUNT actors (HEAP_SLOT_ACTORS), 112 bytes each.

Referenced by fdActorFindFree(), fdActorFindNearestFacingTarget(), fdActorScriptCheckOverlap(), fdActorScriptFindOverlappingActor(), fdActorSetRevealSpriteColor(), fdActorSystemPlaceSprites(), fdActorSystemProjectSprites(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdActorUpdatePlayerControl(), fdEffectReleaseRevealSparkles(), fdItemDisplayShowItemInFront() and fdPsynergyEnd().

Definition at line 78 of file field.h.

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(), fdActorRelease(), fdActorSetAnimationAndSpeed(), fdActorSetFirstSpriteAnimation(), fdActorSetLayersColorMode(), fdActorSetSpriteColor(), fdActorSetSpriteFlags(), fdActorSetSpritePriority(), fdActorSetSpriteRotation(), fdActorSystemPlaceSprites(), fdActorSystemProjectSprites(), fdActorUpdateBlink() and scValePrologueSetActorColorMode().

Definition at line 284 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() and fdActorResetForLeader().

Definition at line 298 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().

Definition at line 301 of file field.h.

SHAKE_KEEP

#define SHAKE_KEEP (-1)

A screen shake's component left as it is; any negative value does.

Referenced by scAltinBeastHop(), scAltinBeastHopAway(), scAltinPeakFlickerWaterAway(), scAltinPeakForceLogOver(), scAltinPeakPlayLandingShake(), scAltinPeakReadFallingRockSign(), scAltinPeakRunBoulderChase(), scAltinPeakUpdateBeastHops(), scAltmillerCaveReleaseWallBurst(), scBabiLighthouseLandWithParticles(), scColosseumEntranceShowClearedTrial(), scCrossboneIsleKeysBaneSecondEscape(), scCrossboneIsleKeysOpenBlueDoor(), scCrossboneIsleKeysOpenRedDoor(), scGomaCavePillarPushStumpOver(), scGondowanCaveLeapStump(), scInit(), scKolimaLowerBridge(), scLeapStump(), scLemurianShipRaiseTheShip(), scLunpaFortressActivateLeverTrap(), scLunpaFortressMoveCrates(), scLunpaFortressUnlockCaveDoor(), scLunpaFortressUnlockGroundFloorDoor(), scLunpaFortressUnlockToadonpaDoor(), scLunpaFortressUnlockUpperFloorDoor(), scMercuryLighthouseAeriePartyArrives(), scMercuryLighthouseDrawNorthJetTiles(), scMercuryLighthouseExitWhenChannelsOpen(), scMercuryLighthousePlyOpensWaterfallPassage(), scMercuryLighthouseRestoreNorthJetTiles(), scMogallForestKillerApeAttacks(), scShipRoomsNoticeShipRocking(), scShipRoomsShakeWhileKrakenOnDeck(), scSolSanctumElementalStarRoomBagJupiterStar(), scSolSanctumElementalStarRoomBagMercuryStar(), scSolSanctumElementalStarRoomBagVenusStar(), scSolSanctumElementalStarRoomTakeMarsStar(), scSolSanctumEntranceReactToOpeningPassage(), scSolSanctumEntranceUpdateEruptionRumbles(), scSolSanctumEruptionPlayHostageScript(), scSolSanctumEruptionPlayWiseOneRescue(), scSolSanctumEruptionStepShards(), scSolSanctumLunaSolRoomsArriveAfterWiseOnesRescue(), scSolSanctumLunaSolRoomsUpdateFirstFallingLight(), scSolSanctumStatueCenterStatueMoved(), scTolbiShipDeckJumpIntoKrakenBattle(), scTreeRoomsLandFromFall(), scTunnelRuinsRaiseSteppingStone(), scValeEruptionReturnFromMtAleph() and 17 more.

Definition at line 423 of file field.h.

LineScroll

#define LineScroll (*(LINE_SCROLL_STATE **)&HeapSlots[HEAP_SLOT_LINE_SCROLL])

The line scroll's state, HEAP_SLOT_LINE_SCROLL under its own name, which scLineScrollInitWave takes for a scene's wave.

Referenced by fdLineScrollArmDMA() and fdLineScrollBuildPage().

Definition at line 467 of file field.h.

LINE_SCROLL_WAVE_ENTRIES

#define LINE_SCROLL_WAVE_ENTRIES 256

The entries of a wave's sine, one cycle.

Referenced by fdLineScrollBuildPage(), LemurianShipRippleSine and scLemurianShipWaveOffset().

Definition at line 473 of file field.h.

LINE_SCROLL_WAVE_SCALE

#define LINE_SCROLL_WAVE_SCALE 256

A wave's offset is its sine entry times its 16.16 amplitude, over this: an amplitude of toFIXED(1) swings 16 pixels each way.

Referenced by fdLineScrollBuildPage() and scLemurianShipWaveOffset().

Definition at line 477 of file field.h.

LINE_SCROLL_WAVE_SINE

#define LINE_SCROLL_WAVE_SINE

The entries of LineScrollWaveSine, which the Lemurian ship's ripple keeps again in its overlay.

Referenced by LemurianShipRippleSine and LineScrollWaveSine.

Definition at line 481 of file field.h.

Enumerations in detail

WORLD_MAP_LIGHTHOUSE

enum WORLD_MAP_LIGHTHOUSE

The lighthouse whose beacon the world map shows lit (scWorldMapPlayLighthouseTransition), as WorldMapPalettes orders their colours.

EnumeratorValueDescription
WORLD_MAP_LIGHTHOUSE_MERCURY
WORLD_MAP_LIGHTHOUSE_VENUS

Referenced by scWorldMapPlayLighthouseTransition().

Definition at line 91 of file field.h.

ACTOR_SYSTEM_MODE

enum ACTOR_SYSTEM_MODE

How the actor system runs (fdActorSystemInit): which camera follows the actors and which update moves them.

EnumeratorValueDescription
ACTOR_SYSTEM_MAP2A town, a dungeon or the sprite viewer: the scrolling camera.
ACTOR_SYSTEM_WORLD_MAP3The world map: the fixed camera, which projects 3D points onto the screen.
ACTOR_SYSTEM_BATTLE4A battle: the fixed camera, and the battle's own motion update.

Definition at line 208 of file field.h.

ANIMATION_FACING_KIND

enum ANIMATION_FACING_KIND

SPR_ANIMATION.kind: the facing table a sprite animation's pictures follow (fdSpriteComposePicture, facing.c).

EnumeratorValueDescription
ANIM_FACING_NONE0The animation script's own picture whatever the facing; zero also marks a free sprite animation.
ANIM_FACING_ONE_PICTURE18 sectors: one picture, mirrored to the left.
ANIM_FACING_FRONT_BACK28 sectors: a front and a back picture.
ANIM_FACING_THREE_PICTURES316 sectors: front, side and back.
ANIM_FACING_FOUR_PICTURES464 sectors, with four pictures.
ANIM_FACING_FIVE_PICTURES516 sectors, with five pictures.
ANIM_FACING_SIX_PICTURES664 sectors, with six pictures.
ANIM_FACING_EIGHT_PICTURES88 sectors centred on the compass directions, a picture for each.
ANIM_FACING_TWO_PART20ANIM_FACING_FRONT_BACK's table for a sprite drawn in two parts, the second the next sprite id (the sprite viewer).
ANIM_FACING_FRONT_BACK_SWAPPED22As ANIM_FACING_FRONT_BACK, with the front picture mirrored the other way.
ANIM_FACING_EIGHT_NO_TABLE44Unused: no sprite's metadata or animation takes this kind. Ringed as eight facings by the sprite viewer, but with no facing table: fdSpriteComposePicture draws it as ANIM_FACING_NONE.
ANIM_FACING_EIGHT_PICTURES_MIRRORED88As ANIM_FACING_EIGHT_PICTURES, with three of the pictures mirrored.

Definition at line 220 of file field.h.

SPR_PICTURE_CODEC

enum SPR_PICTURE_CODEC

SPR_ANIMATION.mode, from the metadata's pictureCodec: how a sprite animation's pictures are stored. Any other value is raw, for the picture decoder.

EnumeratorValueDescription
SPRITE_PICTURE_RAW0
SPRITE_PICTURE_TAGGED_LZ1syDecompressTaggedLZ's format
SPRITE_PICTURE_LZ3LZ-compressed

Definition at line 259 of file field.h.

SPR_FLAG

enum SPR_FLAG

SPR.flags.

EnumeratorValueDescription
SPRITE_FLAG_SHADOW1 << 0its shadow is drawn; set when created
SPRITE_FLAG_OUTLINED1 << 1Drawn as an outline, in ACTOR_SYSTEM_STATE's edge and fill colours.

Definition at line 267 of file field.h.

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 276 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 287 of file field.h.

WORLD_MAP_COLLISION

enum WORLD_MAP_COLLISION

The world map's collision values (fdWorldMapGetCollision), 1 to 15; each indexes a row of WorldMapBattleEnvironments.

EnumeratorValueDescription
WORLD_MAP_COLLISION_WALKABLE_FIRST5The party walks only on WORLD_MAP_COLLISION_WALKABLE_FIRST to WORLD_MAP_COLLISION_WALKABLE_LAST (fdWorldMapIsWalkable).
WORLD_MAP_COLLISION_SHALLOW_WATER6Shallow water: a ripple follows the leader as it walks.
WORLD_MAP_COLLISION_DEFAULT7Where neither collision layer has a value.
WORLD_MAP_COLLISION_FOREST9Forest: the leader's sprite shows
WORLD_MAP_COLLISION_WALKABLE_LAST12its second layer and no shadow, and encounters take a region's forest zone.

Definition at line 305 of file field.h.

BATTLE_ENVIRONMENT

enum BATTLE_ENVIRONMENT

A world map battle environment (WorldMapBattleEnvironments, fdWorldMapGetBattleEnvironment): what its ground means for battles, named by the battle background fdBattleBackgroundSelectForEnvironment gives it.

EnumeratorValueDescription
BATTLE_ENVIRONMENT_NONE0Sol Sanctum's background.
BATTLE_ENVIRONMENT_GRASSLAND1ResourceIdGrasslandBackdrop.
BATTLE_ENVIRONMENT_FOREST2ResourceIdForestBackdrop; encounters take a region's forest zone.
BATTLE_ENVIRONMENT_DESERT3ResourceIdDesertBackdrop.
BATTLE_ENVIRONMENT_BEACH4ResourceIdBeachBackdrop.
BATTLE_ENVIRONMENT_SNOWFIELD5ResourceIdSnowfieldBackdrop.
BATTLE_ENVIRONMENT_SNOW_FOREST6ResourceIdSnowfieldBackdrop, for the snowfield's forest.
BATTLE_ENVIRONMENT_SHALLOWS7ResourceIdBeachBackdrop, for shallow water (WORLD_MAP_COLLISION_SHALLOW_WATER).

Definition at line 327 of file field.h.

WORLD_MAP_ENCOUNTER_REGION

enum WORLD_MAP_ENCOUNTER_REGION

A world map metatile's encounter region (bits 30..24 of its block word), which picks its encounter zones (WorldMapEncounterRules), each named for the places whose entrances lie in it.

EnumeratorValueDescription
WORLD_MAP_ENCOUNTER_REGION_VALE_VAULT1also Lunpa and Goma Cave
WORLD_MAP_ENCOUNTER_REGION_BILIBIN_KOLIMA2Also Bilibin Cave and the bridge out of Goma Cave.
WORLD_MAP_ENCOUNTER_REGION_XIAN_ALTIN3Also Lama Temple and the Alpine Crossing.
WORLD_MAP_ENCOUNTER_REGION_KALAY4Also the Lamakan Desert's cave and Gondowan Cave's north end.
WORLD_MAP_ENCOUNTER_REGION_TOLBI5Also Kalay's docks, Altmiller Cave and the Gondowan Passage's north end.
WORLD_MAP_ENCOUNTER_REGION_SUHALLA6Also Lalivero, the Venus Lighthouse and the road to Babi Lighthouse.
WORLD_MAP_ENCOUNTER_REGION_SNOWFIELD21Takes the second world map graphics set
WORLD_MAP_ENCOUNTER_REGION_FUCHIN31(fdWorldMapLoadGraphics) and the snowfield's battle environments (fdWorldMapGetBattleEnvironment). Fuchin Temple, the sign before Mogall Forest and the north end of Kolima Bridge.

Definition at line 346 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 from MapGridTerrainHeightFunctions.

EnumeratorValueDescription
TERRAIN_FLAT0the first sample everywhere
TERRAIN_SLOPE_X1from the first sample at x 0 towards the second
TERRAIN_SLOPE_Y2from the first sample at y 0 towards the second
TERRAIN_STEP_SUM_DIAGONAL3step across diagonal x + y = 15, higher sample on it
TERRAIN_STEP_DIFFERENCE_DIAGONAL4step across diagonal x = y, higher sample on it
TERRAIN_BEND_SUM_DIAGONAL5three samples, bending on the diagonal x + y = 15
TERRAIN_BEND_DIFFERENCE_DIAGONAL6three samples, bending on the diagonal x = y
TERRAIN_ROUNDED_SQUARE7raised or sunken (TerrainRoundedSquareMask)
TERRAIN_STEP_X8the first sample for x below 8, then the second
TERRAIN_STEP_Y9the first sample for y below 8, then the second
TERRAIN_BEND_X10three samples along x, bending at the middle
TERRAIN_BEND_Y11three samples along y, read unsigned
TERRAIN_SAMPLE_TABLE12sample TerrainSampleIndexTable picks for each pixel
TERRAIN_SAMPLE_TABLE_MIRRORED13as TERRAIN_SAMPLE_TABLE, mirrored left to right
TERRAIN_FLAT_B14flat as TERRAIN_FLAT, by a copy of its function
TERRAIN_FLAT_C15flat as TERRAIN_FLAT, by another
TERRAIN_KIND_COUNT16copy

Definition at line 376 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 413 of file field.h.

Variables in detail

CameraUnreadWordA

extern Sint32 CameraUnreadWordA

An IWRAM word the scrolling camera's setup clears; nothing in the tree reads it.

Referenced by fdActorSystemInit().

Definition at line 20 of file field.h.

CameraUnreadWordB

extern Sint32 CameraUnreadWordB

The second IWRAM word the scrolling camera's setup clears; also unread. With no reader to give them a role, the two are numbered in IWRAM order.

Referenced by fdActorSystemInit().

Definition at line 23 of file field.h.

RenderDecodePictureCodeSize

extern Uint8 RenderDecodePictureCodeSize[]

The size of fdRenderDecodePicture, copied to HEAP_SLOT_TICK_SCRATCH; an address equal to the size (ld_script.ld).

Referenced by fdActorSystemPlaceSprites(), fdActorSystemProjectSprites() and fdSpriteComposePicture().

Definition at line 28 of file field.h.

FieldEffectSparkleTiles

extern const Uint8 FieldEffectSparkleTiles[]

The sparkles' 16 by 16 tiles, packed (fdEffectInitSparkles).

Referenced by fdEffectInitSparkles().

Definition at line 70 of file field.h.

FieldEffectMoteTiles

extern const Uint8 FieldEffectMoteTiles[]

The motes of light's 16 by 16 tiles, packed (fdMotesStart).

Referenced by fdMotesStart().

Definition at line 73 of file field.h.

WorldMapPackedPictures

extern const Uint8 WorldMapPackedPictures[]

The lighthouse transition's pictures, packed (tagged LZ), decoded 4 KB after the tiles (scWorldMapPlayLighthouseTransition).

Referenced by scWorldMapPlayLighthouseTransition().

Definition at line 81 of file field.h.

WorldMapPackedTiles

extern const Uint8 WorldMapPackedTiles[]

The lighthouse transition's tiles, packed (tagged LZ).

Referenced by scWorldMapPlayLighthouseTransition().

Definition at line 83 of file field.h.

WorldMapPalettes

extern const Uint8 WorldMapPalettes[]

The lighthouse transitions' palettes, 32 bytes each, loaded as BG palette 14; indexed by WORLD_MAP_LIGHTHOUSE.

Referenced by scWorldMapPlayLighthouseTransition().

Definition at line 86 of file field.h.

ColossoGaugePalette

extern Uint16 ColossoGaugePalette[]

The race gauge's 16 colours, loaded as OBJ palette 14 (scColossoDrawGauge).

Referenced by scColossoDrawGauge().

Definition at line 98 of file field.h.

fdActorUpdateAllCodeSize

extern Uint8 fdActorUpdateAllCodeSize[]

The size of fdActorUpdateAll's code, an address equal to the size (ld_script.ld).

Referenced by fdActorRunUpdateAllFromHeap().

Definition at line 104 of file field.h.

HeatGaugeTiles

extern Uint8 HeatGaugeTiles[]

Lamakan Desert's heat gauge (scHeatGaugeStart and scHeatGaugeDraw). The gauge's tiles, packed (tagged LZ).

Referenced by scHeatGaugeStart().

Definition at line 131 of file field.h.

HeatGaugePalette

extern const Uint16 HeatGaugePalette[16]

The gauge's 16 colours, loaded as OBJ palette 14.

Referenced by scHeatGaugeDraw().

Definition at line 133 of file field.h.

fdRenderDecodePicture

extern Uint8 fdRenderDecodePicture[]

The sprite picture decoder, ARM code run from a copy in HEAP_SLOT_TICK_SCRATCH.

Referenced by fdActorSystemPlaceSprites(), fdActorSystemProjectSprites() and fdSpriteComposePicture().

Definition at line 136 of file field.h.

SolSanctumStatueSpriteRowsGraphics

extern Uint8 SolSanctumStatueSpriteRowsGraphics[]

The statue scene's three scrolling strips, packed (syDecompressByteLZ).

Referenced by scSolSanctumStatueInitScrollingSprites().

Definition at line 138 of file field.h.

fdTileMapDrawRows

extern const Uint8 fdTileMapDrawRows[]

The tilemap row drawer, run from a copy in HEAP_SLOT_RAM_CODE_TEMP.

Referenced by fdTileMapDrawRowsFromRam().

Definition at line 143 of file field.h.

fdTileMapDrawRowsCodeSize

extern Uint8 fdTileMapDrawRowsCodeSize[]

The size of fdTileMapDrawRows (picture_decode.s).

Referenced by fdTileMapDrawRowsFromRam().

Definition at line 145 of file field.h.

fdWorldMapUpdateAffineLinesCodeSize

extern Uint8 fdWorldMapUpdateAffineLinesCodeSize

The size of fdWorldMapUpdateAffineLines, copied to HEAP_SLOT_RAM_CODE; an address equal to the size (ld_script.ld).

Referenced by fdWorldMapInitPerspective().

Definition at line 148 of file field.h.

FieldEffectArcSparkTiles

extern const Uint8 FieldEffectArcSparkTiles[]

The 32 by 16 spark of Avoid's falling arcs (arc_spark.png), 4 bits a pixel; fdPsynergyAvoid loads it.

Referenced by fdPsynergyAvoid().

Definition at line 162 of file field.h.

FieldEffectSparkTiles

extern const Uint8 FieldEffectSparkTiles[]

The 32 by 16 spark a field Psynergy's particles draw (spark.png), 4 bits a pixel; fdPsynergyLoadResources loads it.

Referenced by fdPsynergyLoadResources().

Definition at line 180 of file field.h.

WeatherParticleTiles

extern const Uint8 WeatherParticleTiles[]

The ground particles' 16 by 16 tiles, packed (syDecompressByteLZ).

Referenced by fdWeatherStartRain().

Definition at line 188 of file field.h.

ActorShadowTiles

extern const Uint8 ActorShadowTiles[]

The sprites' shadow, 16 by 8 at 256 colours, loaded into VRAM cache entry 93.

Referenced by fdActorSystemConfigure().

Definition at line 193 of file field.h.

PlayerActorId

extern Uint8 PlayerActorId[]

Read as a halfword by fdActorSetOthersPaused: the actor id of the player's actor, which it leaves alone.

Referenced by fdActorSetOthersPaused().

Definition at line 509 of file field.h.