Skip to Content
The Alchemy Project

src/field/field_engine_internal.h

What every part of field_engine.c shares: its includes, and the declarations its parts call before their definitions or once declared differently. More…

Included by field_engine.c.

Structures

NameDescription
structSPAWN_ACTORAn actor's home, as an actor placement sets it (ACTOR.homeX and homeZ).
structVIEWED_PLACEMENTAn actor placement as fdAssignViewFlags reads it: its sprite, its condition and its place.
structSCENE_ENCOUNTER_RULEA row of the scenes' encounter rules (SceneEncounterRules): a scene and entrance and, while a flag is clear, the encounter zones of its two kinds of ground.
unionPOLAR_OFFSET_POSA point that syVectorAddPolarOffset moves as three coordinates and the item display reads as a Vector3.
structCONTAINER_ROWA row of the scene's container table (fdSceneItemGetRows), numbered from actor 64.
structMAP_REGIONA box of the map in whole metatiles (16.16 when compared) and the value it selects while its condition holds; a row with minX -1 ends the list.

Macros

NameDescription
#defineUNIT_NONE 15No user named: fdUsePsynergy takes the first party member, and fdUseItem whoever holds the item in the most inventory slots.
#defineSCENE_ENTRIES ((SCENE_ENTRY_TABLE *)OverlayArea)The running scene's entry table, at the start of OverlayArea.
#defineCONTAINER_COINS 0x8000CONTAINER_ROW.contents and FIELD_STATE.scoopedItem: coins rather than an item, their count in the bits under it.
#defineTREASURE_SPOT_MAX 16The most treasure spots a scene places, each an actor from FIELD_TREASURE_ACTOR on.
#defineTREASURE_SPOT_ON_METATILE 0x31415927ACTOR.sceneWord of a treasure spot that stands for a map metatile rather than an actor: its metatile is in timer and userValue, and it stands at x and z 0.
#defineSCENE_ITEMS_HEADER 0x4000SceneItems: bit 14 marks a scene's header word, its scene number in the bits under it; a flag word follows each header.

Typedefs

NameDescription
typedef void (*ITEM_CUE_CALLBACK )(Sint32 item, Sint32 actor, Sint32 slot);

Enumerations

NameDescription
enumCONTAINER_KIND { CONTAINER_CHEST, CONTAINER_MIMIC, CONTAINER_PSYNERGY_STONE, … }What a scene's container actor is, CONTAINER_ROW.type, named by what the leader checks when talking to it.
enumanonymous enum { TREASURE_SPOT_CHEST_OPEN, TREASURE_SPOT_CHEST_OPENING, TREAS … }The chest sprite's animations, for the targets and treasure spot parts.

Variables

NameDescription
extern const SCENE_ENCOUNTER_RULESceneEncounterRules []Each scene's encounters by scene, entrance and flag, ended by scene -1 (encounter_rules.s).
extern const ENCOUNTER_ZONEEncounterZones []Each encounter zone's battles, a row a zone, the zone the ground under the party gives.
extern const MAP_MUSIC_RULESceneMusicRules []Each scene's music by scene or group, entrance and flag (music_rules.s).
extern const AREA_NAME_RULEAreaNameRules []Each scene's area name by scene or group and entrance (area_name_rules.s).
extern const Sint16SceneReturnRules []
extern const Sint32SceneBattleBackgroundRules []The battle background by scene (fdBattleBackgroundSelectForMap): a scene takes the last backdrop listed before it, and one not listed the last backdrop of all; 0 ends the table.
extern const Sint16EncounterBattleMusic []The battle music table: each song as ENCOUNTER_BATTLE_MUSIC(song), followed by the encounters that use it as ENCOUNTER_KEY(zone, slot), ended by 0.
extern Sint16SceneItems []
extern const Uint8FieldExamineCueMessageOffsets []The message of each fixed search spot, METATILE_BEHAVIOR_JAR to METATILE_BEHAVIOR_WELL, as an offset from MsgTileChecked and MsgTileResult.

Description

What every part of field_engine.c shares: its includes, and the declarations its parts call before their definitions or once declared differently. field_engine.c includes it before the parts, and each part includes it too, so that a part read on its own resolves. It places no bytes.

Macros in detail

UNIT_NONE

#define UNIT_NONE 15

No user named: fdUsePsynergy takes the first party member, and fdUseItem whoever holds the item in the most inventory slots.

Referenced by fdUseItem() and fdUsePsynergy().

Definition at line 49 of file field_engine_internal.h.

SCENE_ENTRIES

#define SCENE_ENTRIES ((SCENE_ENTRY_TABLE *)OverlayArea)

The running scene's entry table, at the start of OverlayArea.

Referenced by fdCheckExitRegions(), fdEngineRun(), fdOverlayCallInit() and fdPlaceAtEntranceRow().

Definition at line 52 of file field_engine_internal.h.

CONTAINER_COINS

#define CONTAINER_COINS 0x8000

CONTAINER_ROW.contents and FIELD_STATE.scoopedItem: coins rather than an item, their count in the bits under it.

Referenced by fdTalkToActor().

Definition at line 128 of file field_engine_internal.h.

TREASURE_SPOT_MAX

#define TREASURE_SPOT_MAX 16

The most treasure spots a scene places, each an actor from FIELD_TREASURE_ACTOR on.

Referenced by fdEffectSpawnRevealMarkers() and fdPlaceTreasureSpots().

Definition at line 131 of file field_engine_internal.h.

TREASURE_SPOT_ON_METATILE

#define TREASURE_SPOT_ON_METATILE 0x31415927

ACTOR.sceneWord of a treasure spot that stands for a map metatile rather than an actor: its metatile is in timer and userValue, and it stands at x and z 0.

Referenced by fdActorSetWideSprite() and fdEffectSpawnRevealMarkers().

Definition at line 134 of file field_engine_internal.h.

SCENE_ITEMS_HEADER

#define SCENE_ITEMS_HEADER 0x4000

SceneItems: bit 14 marks a scene's header word, its scene number in the bits under it; a flag word follows each header.

Referenced by fdEffectSpawnRevealMarkers(), fdPlaceTreasureSpots() and fdSceneItemGetRows().

Definition at line 137 of file field_engine_internal.h.

Typedefs in detail

ITEM_CUE_CALLBACK

typedef void (*ITEM_CUE_CALLBACK)(Sint32 item, Sint32 actor, Sint32 slot);

Referenced by fdUseItem().

Definition at line 57 of file field_engine_internal.h.

Enumerations in detail

CONTAINER_KIND

enum CONTAINER_KIND

What a scene's container actor is, CONTAINER_ROW.type, named by what the leader checks when talking to it.

EnumeratorValueDescription
CONTAINER_CHEST128"checked the chest..."
CONTAINER_MIMIC129a chest that is "really a Mimic!"
CONTAINER_PSYNERGY_STONE130restores the party's PP
CONTAINER_GROUND131"There's something buried here!": the Scoop spot, actor 79
CONTAINER_STONE_TABLET132a summon tablet
CONTAINER_POND133"...gazed into the pond..."

Definition at line 102 of file field_engine_internal.h.

anonymous enum

enum { TREASURE_SPOT_CHEST_OPEN, TREASURE_SPOT_CHEST_OPENING, TREASURE_SPOT_CHEST_CLOSING, TREASURE_SPOT_CHEST_OPENING_EMPTY, … }

The chest sprite's animations, for the targets and treasure spot parts.

EnumeratorValueDescription
TREASURE_SPOT_CHEST_OPEN2standing open
TREASURE_SPOT_CHEST_OPENING4its lid lifting
TREASURE_SPOT_CHEST_CLOSING5closing again on what nobody could carry
TREASURE_SPOT_CHEST_OPENING_EMPTY6its lid lifting on nothing inside
TREASURE_SPOT_CHEST_MIMIC7jumping up as a mimic

Definition at line 178 of file field_engine_internal.h.

Variables in detail

SceneEncounterRules

extern const SCENE_ENCOUNTER_RULE SceneEncounterRules[]

Each scene's encounters by scene, entrance and flag, ended by scene -1 (encounter_rules.s).

Referenced by fdEncounterSelectMapZones().

Definition at line 155 of file field_engine_internal.h.

SceneMusicRules

extern const MAP_MUSIC_RULE SceneMusicRules[]

Each scene's music by scene or group, entrance and flag (music_rules.s).

Referenced by fdChooseMusic().

Definition at line 160 of file field_engine_internal.h.

AreaNameRules

extern const AREA_NAME_RULE AreaNameRules[]

Each scene's area name by scene or group and entrance (area_name_rules.s).

Referenced by fdAreaGetNameIndex().

Definition at line 163 of file field_engine_internal.h.

SceneReturnRules

extern const Sint16 SceneReturnRules[]

Referenced by fdSetRestartPoint(), fdWorldMapSetReturnForScene() and fdWorldMapSetReturnLeavingScene().

Definition at line 165 of file field_engine_internal.h.

SceneItems

extern Sint16 SceneItems[]

Referenced by fdSceneItemGetRows().

Definition at line 173 of file field_engine_internal.h.