Skip to Content
The Alchemy Project

src/field

Guide: Field Engine

Files

FileDescription
actor_placement.cThe party leader's actor placement, which fdActorResetForLeader copies before a scene places its own actors, and the script it gives the leader.
actor_script.cActor scripts: the ones the field starts itself, and the command table.
actor_script_operands.cScript state values: the handler SC_SET, SC_ADD and SC_CMP call for each.
actor_scripts.cThe actor scripts the field's commands start: walking off and turning to face a set way, the dust puffs, the emote bubble's pop and the movement types fdActorSetMovementType starts by number; and, among them, the glyphs a message types before its speaker's first voice blip.
actor_update_arm.cUnused: an ARM copy of the actors' update, made to run from RAM.
battle_background_rules.cThe battle background of each scene (fdBattleBackgroundSelectForMap).
battle_music.cThe music a battle plays: the bosses, the guards of Crossbone Isle, the Colosso finals and the fights with Saturos have their own, and every other battle plays the usual battle music.
encounter_zones.cThe 104 encounter zones, by zone number.
facing.cWhich picture a sprite shows for the way it faces, and the small tables the actors read as they move: the direction pad's headings, the World Map camera's lean, a floating actor's bob, how long a footprint lasts and the order a sprite dissolves in.
field.cThe field object: the code that draws and moves everything in towns, dungeons and the world map.
field_actor_camera.cThe actor cameras, which place every actor's sprite each tick.
field_actor_motion.cActor motion, each tick, and the first actor script commands.
field_actors.cThe field's actors: the 64 slots and creating and releasing them, starting them on their scripts, setting their sprites' animations and looks, and dissolving sprites pixel by pixel.
field_decompress.cLZ decompression.
field_effect_tables.cA field Psynergy's cast colours, and two script tables of the field effects.
field_engine.cThe field engine's object: random encounters, a field scene's actors, the leader's walking and the requests they raise, fdEngineRun, the scene's cues, using items and Psynergy on the field, the map's treasure spots, and the screen transitions and palette fade that the field and battles share.
field_engine_actors.cThe party's sprites, placing a scene's actors, and the actor slots.
field_engine_cues.cFinding and running a scene's cues: talking, step cues, examine cues.
field_engine_encounter.cRandom encounters, and each scene's music, area name and battle background.
field_engine_ground_mask.cThe ground mask: raised ground in front of an actor hides the part of it behind, as a ledge in the Kalay Tunnel's treasure room hides Isaac's legs.
field_engine_internal.hWhat every part of field_engine.c shares: its includes and the macros and types more than one part uses.
field_engine_item_display.cShowing a found item, and Reveal's sparkles on hidden things.
field_engine_items.cUsing an item on the field.
field_engine_palette_editor.cThe debug palette editor.
field_engine_palette_fade.cThe palette fade: palettes moved toward target colours.
field_engine_psynergy.cUsing Psynergy on the field.
field_engine_run.cThe field engine: running a scene until the party leaves it, and its entrance.
field_engine_screen_transition.cHow a scene fades in and out: from or to black or the backdrop colour, through windows that open or close over the screen line by line, from or to the centre line, or by a dissolve, which no scene uses.
field_engine_speakers.cSpeaker definitions: voices and Halted lines by sprite.
field_engine_tables.cThe field engine's tables: the actor scripts its effects run, the colour curves of the palette tints, and the lookup tables of its transitions, speakers, weather and Psynergy.
field_engine_targets.cThe actor a field Psynergy or item aims at, and the helpers that follow it.
field_engine_treasure_spots.cThe map's treasure spots: chests and Psynergy Stones.
field_engine_walking.cField requests and each tick of the leader's walking: exits, encounters, damage.
field_internal.hWhat every part of the field object shares: its includes and the few names more than one part uses.
field_map_grid.cLayered maps: loading, drawing and scrolling, and copying metatiles.
field_player_control.cPlayer control: the configured keys and moving actors by the pad.
field_script_commands.cActor script commands: waits, jumps, flags, moves and state values.
field_sprite_animation.cSprites, their animations and the picture caches they draw from.
field_sprite_draw.cDrawing sprites: composing their animations and placing them on screen.
field_sprite_viewer.cThe debug sprite viewer: one sprite shown once for each way it can face, in a ring, with up to four sprite animations laid over it and the keys to change each one's sprite, animation, priority and colour mode.
field_terrain.cGround heights, and the collision of metatiles and the world map.
field_tile_animation.cTimed map changes: the tileset animations that redraw a map's tiles in turn, the blend script that changes over time how its layers blend, and the palette cycles, which nothing starts.
field_view.cThe screen shake, and two parts of the world map's view: its still image drawn from its tile maps, and its ground tilted away from the camera, worked out a screen line at a time.
field_world_map.cThe world map: its perspective view, its tiles, and the still image of the view BG1 shows while a menu or script runs.
lucky_dice.cLucky Dice, the dice game in Tolbi, drawn with the battles' 3D camera.
lucky_wheels.cLucky Wheels, Tolbi's game of chance: the player bets game tickets on paylines, pulls the lever up to five times and locks wheels between pulls to line up matching symbols.
map_grid_data.cMap ground: the height curve of each metatile kind and the world map's battle environments.
map_screen_markers.cThe map screen's markers (fdMapScreenShow).
palette_scale.cThe fade of the Lucky Dice and Lucky Wheels screens, which darken and brighten by scaling their palettes; each game's object includes it.
screen_transition_shapes.cThe window shapes of WINDOW_TRANSITION_SHAPE, one for each step of its progress (fdScreenTransitionUpdateScanlineTable): a clock wipe, a wedge from the screen's centre (120, 80) that sweeps round from twelve o'clock, over the right half in the first 16 steps and the left half in the next 16.
script_commands.cThe field Psynergy and script command object: the commands scripts run (waits, items, questions, destinations, actors, messages and the camera), moving on the field (views, jumps and climbing), the field's weather and line scrolls, Djinn joining the party, each field Psynergy, the field effect sprites its particles use, and the map screen.
script_commands_actor_commands.cScript commands on actors: placing, moving and animating them.
script_commands_arcs.cThe golden rings that swell around a caster and rise up its body: each ring is two arcs of SPRITE_GOLDEN_RINGS, its back half behind the caster and its front half, the same arc upside down, in front.
script_commands_avoid.cAvoid: the caster spins among falling arcs and flashes, and monsters attack less often until it wears off.
script_commands_camera.cThe camera a script moves: following an actor, panning to a point kept inside the map, and waiting for it to arrive.
script_commands_carry.cCarry: two hands lift the target, move it with the d-pad and drop it.
script_commands_catch.cCatch: a hand reaches out from the caster, grabs what is ahead and takes it off the map.
script_commands_climbing.cJumping and climbing on the field.
script_commands_cloak.cCloak: the leader blinks into a dark outline and stays hidden while it walks on metatiles that allow it (METATILE_BEHAVIOR_CLOAK).
script_commands_djinni.cA Djinni's hop before its battle, a Djinni joining the party, and the field effect sprites the joining lights are drawn with.
script_commands_douse.cDouse: a rain cloud floats out over the target and rains on it, then shrinks back into the caster.
script_commands_exit_animations.cAn actor's screen position, the encounter transition, and the leader leaving through an exit and arriving.
script_commands_field_particles.cField effect sprites: the particles field Psynergy moves and draws.
script_commands_field_psynergy.cRunning a field Psynergy by its kind, and helpers its kinds share.
script_commands_field_psynergy_state.cA field Psynergy's state: setting it up, its caster and target, cleaning up.
script_commands_force.cForce: a fist flies out from the caster and knocks what it hits back a metatile.
script_commands_frost.cFrost: snowflakes spiral in on the target, and a puddle freezes into an ice pillar.
script_commands_ground_particles.cThe ground particles (rain) start and the floating motes' update.
script_commands_growth.cGrowth: green sparks fly from the caster, and a sprout grows tall.
script_commands_halt.cHalt: a stopwatch flies out to the target, ticks and bursts into sparkles, and the target stands frozen, its colours flickering.
script_commands_internal.hWhat every part of script_commands.c shares: its includes and the macros and types more than one part uses.
script_commands_jupiter.cA Jupiter Djinni joining the party, and the first of the Mars Djinni's functions, linked after it: its shrinking and its sparks.
script_commands_lift.cLift: two hands grip the target and raise it, and Force's flashes and heavy impact, linked beside it.
script_commands_line_scroll.cThe line scroll: per-line scroll offsets fed by HBlank DMA.
script_commands_map_screen.cThe map screen R shows on the World Map: its area markers, the cursor and the name of the area nearest it.
script_commands_mars.cA Mars Djinni joining the party, and the first of the Venus Djinni's functions, linked after it: its shrinking, its falling motes and its rising particles.
script_commands_mercury.cA Mercury Djinni joining the party.
script_commands_messages.cThe scene scripts' speech: a message window opened beside the actor who speaks, with the speaker's portrait, a yes-or-no question, two speakers at once, and the speaker's voice.
script_commands_mind_read.cMind Read: scanline waves, shifting colours and flowing particles.
script_commands_motes.cWeather drawn in sprites on the field, and the storm's lightning: floating motes, rising sparkles, and the flashes of the palettes.
script_commands_move.cMove: a hand pushes the target, steered with the d-pad.
script_commands_movement_types.cActor scripts: moving, turning and the built-in movement types.
script_commands_ply.cPly cast in the field: eight winged figures spiral into one, which flashes, sheds sparks and flies off.
script_commands_requests.cBattles and destinations a script requests, and the queued sound.
script_commands_retreat.cRetreat, the caster spinning away in a spray of sparks, and the golden rings that fall round the caster of Avoid.
script_commands_reveal.cReveal: the world turns grey but for a rippling window round the leader, which ends when the leader walks out of it or its time runs out.
script_commands_scripts.cScript commands: waits, received items, questions and destinations.
script_commands_venus.cA Venus Djinni joining the party.
script_commands_view.cThe view bounds, zoom transitions and actors that ride another.
script_commands_weather.cThe weather on the field: the rain splashing round the leader and the lightning of the storm over Vale.
script_commands_whirlwind.cWhirlwind: an orb flies from the caster and spins up a ring of leaves that blows its target away.
sprite_color_tables.cThe colour tables of the sprite colour modes (SPR_COL_MODE) that remap a pixel's colour, 256 bytes each: five that swap a sprite's colour channels, SPRITE_COLOR_GRB to SPRITE_COLOR_BRG (also used by fdSpritePictureCacheLoad for variants 1 to 5), then the grey one and the blue, red and green tints.
sprite_viewer_scale.cUnused: the scale of the debug sprite viewer's ring of sprites, which nothing in the game opens (field_sprite_viewer.c).
terrain_tables.cThe ground's shape inside a metatile for two of its height kinds (enum TERRAIN_KIND): where a raised or sunken square rounds off at its corners, and which of three heights each pixel takes, split along two diagonals.
world_map_encounter_rules.cWhere the World Map's random battles come from: each region of the map, and its forests, take their own encounter zone.
world_map_lines.cThe World Map's tilt: each line of the screen draws the flat map at its own scale and turn, so the ground seems to stretch away to a horizon.
world_map_resources.cWorld map graphics: a palette and five tilesets for each of its two looks, the second the snowfield's (fdWorldMapLoadGraphics).

On this page