include/field/field_engine.h
What the field_engine object defines for the code outside it.
#include "types.h"#include "field/encounter_zone.h"#include "field/field.h"#include "field/scene_tables.h"#include "field/actor.h"#include "field/field_engine_functions.h"
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
| Name | Description | |
|---|---|---|
struct | MAP_MUSIC_RULE | A 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. |
struct | AREA_NAME_RULE | A 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. |
struct | ACTION_DESCRIPTOR | ACTOR_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
| Name | Description | |
|---|---|---|
#define | BEYOND_REACH 9999 | A distance beyond any field Psynergy's reach, where the search for its nearest target starts. |
#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. |
#define | ACT_UNIT_SHIFT 10 | bits 13..10 |
#define | ABILITY_ID (c) ((c) & ACT_ID_MASK) | the Psynergy |
#define | ACT_ITEM_ID (c) ((c) & ACT_ID_MASK) | |
#define | ACT_UNIT (c) (((c) >> ACT_UNIT_SHIFT) & 15) | who uses it |
#define | ACT_PACKED 0x2000 | use it without paying PP |
Enumerations
| Name | Description | |
|---|---|---|
enum | LEADER_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. |
enum | WINDOW_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. |
enum | MAP_SCREEN_MODE { MAP_SCREEN_LOOK, MAP_SCREEN_TELEPORT } | What the map screen is shown for (fdMapScreenShow). |
enum | ITEM_DISPLAY_FLAG { ITEM_DISPLAY_SPARKLES, ITEM_DISPLAY_RAISED } | How fdItemDisplayShowItem and fdItemDisplayShowPicture show a found item. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdMapScreenShow (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). |
void | fdWorldMapZoomOutWhileLHeld (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). |
void | fdBattleBackgroundSelectForEnvironment (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. |
Sint32 | fdGameFlagIsConditionActive (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. |
Sint32 | fdUseItem (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. |
void | fdActorReleaseIfPresent (ACTOR *actor) | Releases actor unless it is NULL. |
void | fdItemDisplayRaiseAboveLeader (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. |
void | fdPsynergyLift (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.
| Enumerator | Value | Description |
|---|---|---|
LEADER_MOVEMENT_WALK | 0 | walking: the pad moves the leader on a layered map |
LEADER_MOVEMENT_WORLD_MAP | 1 | walking on the World Map |
LEADER_MOVEMENT_KEYS | 2 | only configured keys checked; leader moved by others |
LEADER_MOVEMENT_ROPE | 3 | crossing a tied rope |
LEADER_MOVEMENT_TIGHTROPE | 4 | crossing a tightrope |
LEADER_MOVEMENT_SAND | 5 | as sand, by Sand, on a layered map |
LEADER_MOVEMENT_SHIP_ON_MAP | 6 | the ship on a layered map |
LEADER_MOVEMENT_SHIP | 7 | the ship on the World Map |
LEADER_MOVEMENT_FLYING_SHIP | 8 | the winged ship on the World Map |
LEADER_MOVEMENT_WORLD_SAND | 9 | as sand on the World Map |
LEADER_MOVEMENT_HOVER | 10 | hovering, by Hover |
LEADER_MOVEMENT_WALKING | 11 | ActorWalkingScript's |
LEADER_MOVEMENT_NONE | 12 | the 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.
| Enumerator | Value | Description |
|---|---|---|
WINDOW_TRANSITION_BARS | 0 | A bar on each line, at random. |
WINDOW_TRANSITION_SHAPE | 1 | A shape from ScreenTransitionShapes. |
WINDOW_TRANSITION_NOISE | 2 | Ragged lines from the left edge. |
WINDOW_TRANSITION_CIRCLE | 3 | A circle at the screen's centre. |
WINDOW_TRANSITION_INTERLACED_WIPE | 4 | Alternate lines wiping in from the left and the right. |
WINDOW_TRANSITION_LEADER_INVERSE | 7 | As WINDOW_TRANSITION_LEADER with inside and outside swapped and the progress run the other way; it flickers. |
WINDOW_TRANSITION_RIPPLE | 8 | An ellipse around a point (the state's centre) whose outline ripples: Reveal's. |
WINDOW_TRANSITION_LEADER | 9 | An ellipse wider than tall around the party leader, 16 pixels above its feet. |
WINDOW_TRANSITION_LEADER_LOW | 77 | An 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).
| Enumerator | Value | Description |
|---|---|---|
MAP_SCREEN_LOOK | 0 | The player looks (FIELD_RAISED_CUE_MAP_SCREEN). |
MAP_SCREEN_TELEPORT | 1 | Teleport (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.
| Enumerator | Value | Description |
|---|---|---|
ITEM_DISPLAY_SPARKLES | 1 | sparkles rise from it |
ITEM_DISPLAY_RAISED | 2 | the leader raises it overhead |
Definition at line 121 of file field_engine.h.