Skip to Content
The Alchemy Project

include/field/field_engine.h

What the field_engine object defines for the code outside it.

Included by psynergy_test.c, shop_test.c, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, lucky_wheels.c, script_commands_actor_commands.c, script_commands_messages.c, super_lucky_dice.c, main_routine.c, menu_item.c, airs_rock.c, airs_rock_inside.c, alhafra.c, alhafra_manor.c, alhafra_rooms.c, alhafran_cave.c, ancient_lemuria.c, anemos_inner_sanctum.c, anemos_inner_sanctum_dullahan.c, ankohl_ruins.c, apojii_islands.c, apojii_islands_cave.c, aqua_rock.c, aqua_rock_inside.c, atteka_inlet.c, caverns.c, champa_cliff_caves.c, champa_rooms.c, champa_sanctum.c, clear.c, contigo.c, daila_rooms.c, dehkan_plateau.c, eastern_alhafra_ship.c, epilogue.c, gabomba_catacombs.c, gabomba_statue.c, gabomba_statue_chamber.c, gaia_rock.c, gaia_rock_inside.c, garoh.c, gondowan_cliffs.c, gondowan_cliffs_hideout.c, islets.c, izumo.c, izumo_rooms.c, izumo_ruins.c, jupiter_lighthouse_aerie.c, jupiter_lighthouse_aerie_beacon.c and 57 more.

Structures

NameDescription
structMAP_MUSIC_RULEA rule choosing a scene's field music, ended by id -1: a scene or an area (byScene), an entrance (-1 for any), a flag that must be set (-1 for none) and the music.
structAREA_NAME_RULEA rule naming the area a scene is in, ended by id -1: a scene or an area (useSceneId), an entrance (-1 for any) and the area name's index.
structACTION_DESCRIPTORACTOR_PLACE (scene_tables.h), a row of a scene's actor placement table, as fdFindActorPlacement reads it: its sprite unsigned and its spot in plain words.

Macros

NameDescription
#defineBEYOND_REACH 9999A distance beyond any field Psynergy's reach, where the search for its nearest target starts.
#defineACT_ID_MASK 0x3ffA field Psynergy or item use, packed into one value, as FIELD_STATE.psynergy and FIELD_STATE.item hold it. bits: 13..10 the user (13 is ACT_PACKED) | 9..0 the Psynergy or item.
#defineACT_UNIT_SHIFT 10bits 13..10
#defineABILITY_ID (c) ((c) & ACT_ID_MASK)the Psynergy
#defineACT_ITEM_ID (c) ((c) & ACT_ID_MASK)
#defineACT_UNIT (c) (((c) >> ACT_UNIT_SHIFT) & 15)who uses it
#defineACT_PACKED 0x2000use it without paying PP

Enumerations

NameDescription
enumLEADER_MOVEMENT_MODE { LEADER_MOVEMENT_WALK, LEADER_MOVEMENT_WORLD_MAP, LEADER_MOVE … }How the leader moves (MAIN_ROUTINE_STATE.movementMode): which actor script fdActorStartMovementModeScript runs for it.
enumWINDOW_TRANSITION_MODE { WINDOW_TRANSITION_BARS, WINDOW_TRANSITION_SHAPE, WINDOW_TRAN … }A window transition's shape: SCENE_TRANSITION(TRANSITION_WINDOW, mode)'s low byte, which fdScreenTransitionUpdateScanlineTable draws.
enumMAP_SCREEN_MODE { MAP_SCREEN_LOOK, MAP_SCREEN_TELEPORT }What the map screen is shown for (fdMapScreenShow).
enumITEM_DISPLAY_FLAG { ITEM_DISPLAY_SPARKLES, ITEM_DISPLAY_RAISED }How fdItemDisplayShowItem and fdItemDisplayShowPicture show a found item.

Functions

NameDescription
Sint32fdMapScreenShow (Sint32 mode)The map screen, over the map-metatile buffer, until A or B closes it, to look or to choose where to Teleport (MAP_SCREEN_MODE).
voidfdWorldMapZoomOutWhileLHeld (void)On the world map, zooms the view out to eight thirteenths while L is held, then back, six ticks each way (FIELD_RAISED_CUE_WORLD_MAP_ZOOM).
voidfdBattleBackgroundSelectForEnvironment (Sint32 terrain)Chooses the battle background for a World Map battle environment (enum BATTLE_ENVIRONMENT; any other gives the ship deck's) and sets MainRoutineStateWork.battleBg.
Sint32fdGameFlagIsConditionActive (Sint32 condition)Returns whether a script condition holds: -1 always holds; a condition with CONDITION_FLAG_SET holds while that flag is set, any other while its flag is clear.
void *fdFindActorTalkCue (Sint32 id)Returns the talk cue of actor id, or NULL: for the actor Halt has stopped (MainRoutineStateWork.haltedActor), its CUE_TALK_HALTED cue if it has one, the script for talking to it while it is stopped.
Sint32fdUseItem (Sint32 arg, Sint32 slot)Uses an item on the field. packedItem holds the item (bits 0 to 9) and the character using it (bits 10 to 13; UNIT_NONE for whoever holds it in the most inventory slots); slot is its inventory slot.
voidfdActorReleaseIfPresent (ACTOR *actor)Releases actor unless it is NULL.
voidfdItemDisplayRaiseAboveLeader (ACTOR *actor)Raises a found item's picture to 36 pixels above the party leader, who holds it up (ANIM_LEADER_ARMS_RAISED) facing the screen.
voidfdPsynergyLift (void)Lift cast with no target: two hands appear 32 pixels to either side of the spot, close 24 pixels in and meet with a crash that scatters ITEM_BREAK_SHARD_MAX sparkles, then vanish.

Description

What the field_engine object defines for the code outside it.

Macros in detail

BEYOND_REACH

#define BEYOND_REACH 9999

A distance beyond any field Psynergy's reach, where the search for its nearest target starts.

Referenced by fdFindNearbyPsynergyTarget(), fdPsynergyBlaze() and fdSelectPsynergyTarget().

Definition at line 85 of file field_engine.h.

ACT_ID_MASK

#define ACT_ID_MASK 0x3ff

A field Psynergy or item use, packed into one value, as FIELD_STATE.psynergy and FIELD_STATE.item hold it. bits: 13..10 the user (13 is ACT_PACKED) | 9..0 the Psynergy or item.

bits 9..0

Referenced by mnPsynergyMenuDrawShortcuts().

Definition at line 133 of file field_engine.h.

ACT_UNIT_SHIFT

#define ACT_UNIT_SHIFT 10

bits 13..10

Referenced by mnDebugShortcutRun(), mnItemMenuRun(), mnPsynergyMenuDrawShortcuts(), mnPsynergyMenuRun() and mnPsynergyMenuSetShortcut().

Definition at line 134 of file field_engine.h.

ABILITY_ID

#define ABILITY_ID(c) ((c) & ACT_ID_MASK)

the Psynergy

Referenced by fdPaletteCycleStep(), fdPartyCheckShortcut(), fdRunPsynergyEndScripts(), fdUsePsynergy(), scContigoPauseWhenFaced(), scLemuriaNoticeLeader() and scTrialRoadStepPaletteCycle().

Definition at line 135 of file field_engine.h.

ACT_ITEM_ID

#define ACT_ITEM_ID(c) ((c) & ACT_ID_MASK)

Referenced by fdUseItem().

Definition at line 136 of file field_engine.h.

ACT_UNIT

#define ACT_UNIT(c) (((c) >> ACT_UNIT_SHIFT) & 15)

who uses it

Referenced by fdPartyCheckShortcut(), fdRunPsynergyEndScripts(), fdUseItem() and fdUsePsynergy().

Definition at line 137 of file field_engine.h.

ACT_PACKED

#define ACT_PACKED 0x2000

use it without paying PP

Referenced by fdCheckConfiguredKeys(), fdEffectCheckCloakTile(), fdEngineRun(), fdPsynergyUpdateRing(), fdPsynergyWatchLeaderDistance(), fdPsynergyWatchSandGround(), fdSandCheckEndKeys(), fdScriptEndLastingPsynergy(), fdUpdateWalking(), fdUsePsynergy() and scWorldMapUpdatePlacedActors().

Definition at line 138 of file field_engine.h.

Enumerations in detail

LEADER_MOVEMENT_MODE

enum LEADER_MOVEMENT_MODE

How the leader moves (MAIN_ROUTINE_STATE.movementMode): which actor script fdActorStartMovementModeScript runs for it.

EnumeratorValueDescription
LEADER_MOVEMENT_WALK0walking: the pad moves the leader on a layered map
LEADER_MOVEMENT_WORLD_MAP1walking on the World Map
LEADER_MOVEMENT_KEYS2only configured keys checked; leader moved by others
LEADER_MOVEMENT_ROPE3crossing a tied rope
LEADER_MOVEMENT_TIGHTROPE4crossing a tightrope
LEADER_MOVEMENT_SAND5as sand, by Sand, on a layered map
LEADER_MOVEMENT_SHIP_ON_MAP6the ship on a layered map
LEADER_MOVEMENT_SHIP7the ship on the World Map
LEADER_MOVEMENT_FLYING_SHIP8the winged ship on the World Map
LEADER_MOVEMENT_WORLD_SAND9as sand on the World Map
LEADER_MOVEMENT_HOVER10hovering, by Hover
LEADER_MOVEMENT_WALKING11ActorWalkingScript's
LEADER_MOVEMENT_NONE12the idle script: it does not move

Definition at line 17 of file field_engine.h.

WINDOW_TRANSITION_MODE

enum WINDOW_TRANSITION_MODE

A window transition's shape: SCENE_TRANSITION(TRANSITION_WINDOW, mode)'s low byte, which fdScreenTransitionUpdateScanlineTable draws.

EnumeratorValueDescription
WINDOW_TRANSITION_BARS0A bar on each line, at random.
WINDOW_TRANSITION_SHAPE1A shape from ScreenTransitionShapes.
WINDOW_TRANSITION_NOISE2Ragged lines from the left edge.
WINDOW_TRANSITION_CIRCLE3A circle at the screen's centre.
WINDOW_TRANSITION_INTERLACED_WIPE4Alternate lines wiping in from the left and the right.
WINDOW_TRANSITION_LEADER_INVERSE7As WINDOW_TRANSITION_LEADER with inside and outside swapped and the progress run the other way; it flickers.
WINDOW_TRANSITION_RIPPLE8An ellipse around a point (the state's centre) whose outline ripples: Reveal's.
WINDOW_TRANSITION_LEADER9An ellipse wider than tall around the party leader, 16 pixels above its feet.
WINDOW_TRANSITION_LEADER_LOW77An ellipse a little taller than wide, 8 pixels above the leader's feet.

Definition at line 38 of file field_engine.h.

MAP_SCREEN_MODE

enum MAP_SCREEN_MODE

What the map screen is shown for (fdMapScreenShow).

EnumeratorValueDescription
MAP_SCREEN_LOOK0The player looks (FIELD_RAISED_CUE_MAP_SCREEN).
MAP_SCREEN_TELEPORT1Teleport (FIELD_RAISED_CUE_TELEPORT): A chooses the place whose name shows and B cancels.

Definition at line 104 of file field_engine.h.

ITEM_DISPLAY_FLAG

enum ITEM_DISPLAY_FLAG

How fdItemDisplayShowItem and fdItemDisplayShowPicture show a found item.

EnumeratorValueDescription
ITEM_DISPLAY_SPARKLES1sparkles rise from it
ITEM_DISPLAY_RAISED2the leader raises it overhead

Definition at line 121 of file field_engine.h.