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…
#include "types.h"#include "resource_ids.h"#include "window/window.h"#include "window/battle_status.h"#include "field/world_map.h"#include "system.h"#include "game/main_routine_state.h"#include "battle/battle.h"#include "debug/debug.h"#include "field/field.h"#include "game/game.h"#include "menu/menu.h"#include "sound/sound.h"#include "scene_ids.h"#include "field/scene_tables.h"#include "field/actor.h"#include "field/field_engine_script.h"#include "field/map_grid.h"#include "field/field_sprite.h"#include "game/stubs.h"#include "battle/battle_unit.h"#include "game/character.h"#include "fixed_math.h"#include "battle/range_falloff.h"#include "field/field_script.h"#include "macros.h"#include "game/item.h"#include "text/msg_ids.h"#include "edition.h"#include "graphics/display_transition.h"#include "graphics/palette_buffers.h"#include "field/sprite.h"#include "window/stubs.h"#include "field/field_engine.h"#include "field/stubs.h"#include "field/encounter_zone.h"#include "game/inventory.h"
Included by field_engine.c.
Structures
| Name | Description | |
|---|---|---|
struct | SPAWN_ACTOR | An actor's home, as an actor placement sets it (ACTOR.homeX and homeZ). |
struct | VIEWED_PLACEMENT | An actor placement as fdAssignViewFlags reads it: its sprite, its condition and its place. |
struct | SCENE_ENCOUNTER_RULE | A 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. |
union | POLAR_OFFSET_POS | A point that syVectorAddPolarOffset moves as three coordinates and the item display reads as a Vector3. |
struct | CONTAINER_ROW | A row of the scene's container table (fdSceneItemGetRows), numbered from actor 64. |
struct | MAP_REGION | A 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
| Name | Description | |
|---|---|---|
#define | UNIT_NONE 15 | No user named: fdUsePsynergy takes the first party member, and fdUseItem whoever holds the item in the most inventory slots. |
#define | SCENE_ENTRIES ((SCENE_ENTRY_TABLE *)OverlayArea) | The running scene's entry table, at the start of OverlayArea. |
#define | CONTAINER_COINS 0x8000 | CONTAINER_ROW.contents and FIELD_STATE.scoopedItem: coins rather than an item, their count in the bits under it. |
#define | TREASURE_SPOT_MAX 16 | The most treasure spots a scene places, each an actor from FIELD_TREASURE_ACTOR on. |
#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. |
#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. |
Typedefs
| Name | Description | |
|---|---|---|
typedef void (* | ITEM_CUE_CALLBACK )(Sint32 item, Sint32 actor, Sint32 slot); |
Enumerations
| Name | Description | |
|---|---|---|
enum | CONTAINER_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. |
enum | anonymous enum { TREASURE_SPOT_CHEST_OPEN, TREASURE_SPOT_CHEST_OPENING, TREAS … } | The chest sprite's animations, for the targets and treasure spot parts. |
Variables
| Name | Description | |
|---|---|---|
extern const SCENE_ENCOUNTER_RULE | SceneEncounterRules [] | Each scene's encounters by scene, entrance and flag, ended by scene -1 (encounter_rules.s). |
extern const ENCOUNTER_ZONE | EncounterZones [] | Each encounter zone's battles, a row a zone, the zone the ground under the party gives. |
extern const MAP_MUSIC_RULE | SceneMusicRules [] | Each scene's music by scene or group, entrance and flag (music_rules.s). |
extern const AREA_NAME_RULE | AreaNameRules [] | Each scene's area name by scene or group and entrance (area_name_rules.s). |
extern const Sint16 | SceneReturnRules [] | |
extern const Sint32 | SceneBattleBackgroundRules [] | 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 Sint16 | EncounterBattleMusic [] | 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 Sint16 | SceneItems [] | |
extern const Uint8 | FieldExamineCueMessageOffsets [] | 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.
| Enumerator | Value | Description |
|---|---|---|
CONTAINER_CHEST | 128 | "checked the chest..." |
CONTAINER_MIMIC | 129 | a chest that is "really a Mimic!" |
CONTAINER_PSYNERGY_STONE | 130 | restores the party's PP |
CONTAINER_GROUND | 131 | "There's something buried here!": the Scoop spot, actor 79 |
CONTAINER_STONE_TABLET | 132 | a summon tablet |
CONTAINER_POND | 133 | "...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.
| Enumerator | Value | Description |
|---|---|---|
TREASURE_SPOT_CHEST_OPEN | 2 | standing open |
TREASURE_SPOT_CHEST_OPENING | 4 | its lid lifting |
TREASURE_SPOT_CHEST_CLOSING | 5 | closing again on what nobody could carry |
TREASURE_SPOT_CHEST_OPENING_EMPTY | 6 | its lid lifting on nothing inside |
TREASURE_SPOT_CHEST_MIMIC | 7 | jumping 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.