Alchemy
Loading...
Searching...
No Matches

field.h File Reference

The field engine's shared routines, globals and object scripts. More...

Go to the source code of this file.

Data Structures

struct  Flags35
 An actor seen only as its priority flags at 0x23 (enum ActorPriorityFlag). More...
struct  OverlayActorPosition
 An actor seen only as the coordinate at 0x08, which Goma Cave's stump reads in 16-pixel map cells. More...
struct  OverlayActorState
 An actor seen only as its priority flags at 0x23 (enum ActorPriorityFlag). More...
struct  PathRecorder
 The Colosso rival's path player in the scene state: its mode (1 playing, 2 recording, 9 finished), whether it mirrors the path, the actor, its place in the path and how long the actor has stood still. More...
struct  Slot
struct  SwitchCell
 A Venus Lighthouse switch or pillar socket's map cell. More...
struct  T
struct  TileRun
 A log in Kolima Forest lying across four map cells, from its first cell across or, when vertical, down. More...

Functions

s32 CalculateFacingAngle (s32, s32)
void Engine_ActorFollow (s32 actor, s32 leader)
void Engine_EventClearInvalidPackedValues (void)
s32 Engine_PartyRemoveItem (s32 item)
s32 FarCall_BlankLoadTable (s32 entrance)
s32 FarCall_BlankRunTable (s32 entrance)
void FieldScene_PrepareActors (struct ScenePlacement *entry)
s32 GameFlag_IsSet (s32 flag)
void WorldMap_BeginStillView (void)
 Freezes the world map's perspective view as a still picture on BG1: saves BG1's tiles, draws the current affine frame into pixels and hands the window and VBlank to it.
s32 Math_Atan2 (s32 dy, s32 dx)
void Object_Destroy (struct DispatchObject *work)
void ScenePlacement_ClipToView (struct ScenePlacement *placements)
void SceneTable_Prepare (struct ScenePlacement *placements)

Variables

s32 gIwram_Data1
s32 gIwram_Data2
const s32 gObjectDispatch_DefaultScript []
 The script FieldObject_Create gives every new object: it does nothing and returns to the idle script.
const u8 gWorldMap_TerrainBehaviorTable []
 World map terrain behaviour, indexed by the collision value plus 0x10 when the block word's top bit is set, or plus 0x20 (whatever that bit) for terrain kind 21.
u8 Render_DecodeFrameCodeSize []
u8 gRuntime_ByteRemapTable []
s16 gAltinPeak_PaletteHold
s16 gAltinPeak_PaletteStep
const u8 gBattleFx_BurstParticleScriptA []
const u8 gBattleFx_BurstParticleScriptB []
u32 gWorldMap_GraphicsResources [][6]
 Each set is a palette and five tile sets; WorldMap_LoadGraphics takes the second set when the cell it loads at has terrain kind 21, and keeps the set's row in the perspective work's resources.
const u8 gObjectMotion_WaitScript []
const u8 gFieldFx_SparkleTiles []
const u8 gField_TileMessageOffsets []
 The message of each searchable tile code from 242 to 247, as an offset from MsgTileChecked and MsgTileResult.
const u8 gFieldFx_MoteTiles []
s32 gFourObjectMotion_ResourceIds []
 The resource ids of the four sprites FourObjectMotion shows.
s32 gTolbiShipInteriors_ShakeTimer
 Frames left of the Kraken's current jolt; at 0 another may start.
s16 * gKolimaForestBendLayout
struct BendLog * gKolimaForestBendRecords
u16 * gKolimaForestBendReturned
struct ObjectRuntime * gObjectSlots
u32 gScanlineAngle
u32 gScanlinePitch
struct SceneEvent gBabiPalace_Events2AfterColosso []
const u8 gWorldMapPackedFrames []
const u8 gWorldMapPackedTiles []
const u8 gWorldMapPalettes []
s32 gKalay_DanceStep
u32 gKolimaForestBend_ShakeChance
u32 gKolimaForestBend_ShakeScroll []
u8 gKolimaPalette_First []
u8 gKolimaPalette_Second []
s32 gColosso_CompetitorStartAngle
s32 gColosso_CompetitorStartX
s32 gColosso_CompetitorStartZ
u16 gColosso_GaugePalette []
s32 gColosso_MarkerOam [3]
s16 gColosso_ModeBlendDuration
s16 gColosso_ModeBlendStart
s16 gColosso_ModeBlendStep
s16 gColosso_ModeBlendTarget
s16 gColosso_ModeMoveStart
s16 gColosso_ModeMoveStep
s16 gColosso_ModeScaleDuration
s16 gColosso_ModeScaleStart
s16 gColosso_ModeScaleStep
s16 gColosso_ModeScaleTarget
u32 gColosso_LetteringSprites []
u16 gVaultInteriors_StopTimer
u8 Object_UpdateAllCodeSize []
u8 gObjectGroup_BlinkChildValues []
 A child value by frame ((gFrameCount >> 1) & 3).
const u8 gObjectMotion_ActionKind1Script []
const u8 gObjectMotion_ActionKind2Script []
const u8 gObjectMotion_ActionKind3Script []
const u8 gObjectMotion_ActionKind4Script []
u8 gObjectMotion_LaunchScript
const u8 gObjectMotion_MoveTowardTargetScript []
const u8 gObjectMotion_ResetActionScript []
const u8 gObjectMotion_StepAngleScript []
const u8 gObjectMotion_TurnTowardLinkedScript []
const u8 gObjectMotion_VariantScripts []
 Squashes as many times as the variant (1 to 3): variant v starts at word (3 - v) * 32 and runs to the end.
u8 gLamakanDesert_SandEffectTiles []
const u16 gLamakanDesert_SandPalette [16]
u16 gLamakanDesert_SandPhase
u8 gLamakanDesert_SandTileBuffer []
u16 gLamakanDesert_SandVramSlot
struct MenuSprite gLamakanDesert_SandWork []
u8 Render_DecodeFrame []
u8 gSolSanctumStatue_SpriteRowsGfx []
u32 gStagedActor_FootprintKinds []
const u8 TileMap_DrawRows []
u8 TileMap_DrawRowsCodeSize []
u8 Transform_UpdateVerticesSize
const s32 gWorldMap_FootprintActions [6]
 Two scripts for the world map's footprint and dust effects: wait 120 or 30 frames, then release the object.
const s16 gWorldMap_KeyHeadings [16]
 The heading for each state of the direction pad (bits 4-7 of the keys); 0xffff means no direction is held, or only an opposite pair.

Detailed Description

The field engine's shared routines, globals and object scripts.

Definition in file field.h.

Function Documentation

◆ CalculateFacingAngle()

s32 CalculateFacingAngle ( s32 ,
s32  )

◆ Engine_ActorFollow()

void Engine_ActorFollow ( s32 actor,
s32 leader )

◆ Engine_EventClearInvalidPackedValues()

void Engine_EventClearInvalidPackedValues ( void )

◆ Engine_PartyRemoveItem()

s32 Engine_PartyRemoveItem ( s32 item)

◆ FarCall_BlankLoadTable()

s32 FarCall_BlankLoadTable ( s32 entrance)

Referenced by FarCall_BlankLoadTable().

◆ FarCall_BlankRunTable()

s32 FarCall_BlankRunTable ( s32 entrance)

Referenced by FarCall_BlankRunTable().

◆ FieldScene_PrepareActors()

◆ GameFlag_IsSet()

s32 GameFlag_IsSet ( s32 flag)

◆ WorldMap_BeginStillView()

void WorldMap_BeginStillView ( void )

Freezes the world map's perspective view as a still picture on BG1: saves BG1's tiles, draws the current affine frame into pixels and hands the window and VBlank to it.

Called through WorldMap_BeginStillViewFar by WorldMap_BeginEvent when a menu or event starts on the world map, and by the world map scene's lighthouse transition. Sets animationActive, suspends the tile animations (MapAnimation_Update), copies 8 KB of char block 1 to gDecodeBuffer, sets the window rows to 200 and 255 (BG mode 0) and sets gVBlankHook to MapAnimation_PresentFrame. Map_LoadAreaGraphics undoes it.

Definition at line 701 of file world_map.c.

◆ Math_Atan2()

s32 Math_Atan2 ( s32 dy,
s32 dx )

◆ Object_Destroy()

void Object_Destroy ( struct DispatchObject * work)

◆ ScenePlacement_ClipToView()

void ScenePlacement_ClipToView ( struct ScenePlacement * placements)

◆ SceneTable_Prepare()

void SceneTable_Prepare ( struct ScenePlacement * placements)

Variable Documentation

◆ gIwram_Data1

s32 gIwram_Data1
extern

Referenced by ObjectSystem_Initialize().

◆ gIwram_Data2

s32 gIwram_Data2
extern

Referenced by ObjectSystem_Initialize().

◆ gObjectDispatch_DefaultScript

const s32 gObjectDispatch_DefaultScript[]
extern

The script FieldObject_Create gives every new object: it does nothing and returns to the idle script.

Definition at line 14 of file object_script.c.

Referenced by FieldObject_Create().

◆ gWorldMap_TerrainBehaviorTable

const u8 gWorldMap_TerrainBehaviorTable[]
extern

World map terrain behaviour, indexed by the collision value plus 0x10 when the block word's top bit is set, or plus 0x20 (whatever that bit) for terrain kind 21.

Read only by GetWorldMapTerrainBehavior.

Definition at line 37 of file mapdata.c.

Referenced by GetWorldMapTerrainBehavior().

◆ Render_DecodeFrameCodeSize

u8 Render_DecodeFrameCodeSize[]
extern

◆ gRuntime_ByteRemapTable

u8 gRuntime_ByteRemapTable[]
extern

◆ gAltinPeak_PaletteHold

s16 gAltinPeak_PaletteHold
extern

◆ gAltinPeak_PaletteStep

s16 gAltinPeak_PaletteStep
extern

◆ gBattleFx_BurstParticleScriptA

const u8 gBattleFx_BurstParticleScriptA[]
extern

◆ gBattleFx_BurstParticleScriptB

const u8 gBattleFx_BurstParticleScriptB[]
extern

◆ gWorldMap_GraphicsResources

u32 gWorldMap_GraphicsResources[][6]
extern

Each set is a palette and five tile sets; WorldMap_LoadGraphics takes the second set when the cell it loads at has terrain kind 21, and keeps the set's row in the perspective work's resources.

Not const: the loader reads it through a u32 *.

Definition at line 12 of file world_map_resources.c.

Referenced by WorldMap_LoadGraphics().

◆ gObjectMotion_WaitScript

const u8 gObjectMotion_WaitScript[]
extern

◆ gFieldFx_SparkleTiles

const u8 gFieldFx_SparkleTiles[]
extern

◆ gField_TileMessageOffsets

const u8 gField_TileMessageOffsets[]
extern

The message of each searchable tile code from 242 to 247, as an offset from MsgTileChecked and MsgTileResult.

Definition at line 24 of file fxdata.c.

Referenced by Field_SearchTile().

◆ gFieldFx_MoteTiles

const u8 gFieldFx_MoteTiles[]
extern

Referenced by FieldMotes_Start().

◆ gFourObjectMotion_ResourceIds

s32 gFourObjectMotion_ResourceIds[]
extern

The resource ids of the four sprites FourObjectMotion shows.

Definition at line 55 of file menudata.c.

Referenced by FourObjectMotion_InitializeBottomRow(), FourObjectMotion_InitializeTopRow(), and FourObjectMotion_ReplaceSlot().

◆ gTolbiShipInteriors_ShakeTimer

s32 gTolbiShipInteriors_ShakeTimer
extern

Frames left of the Kraken's current jolt; at 0 another may start.

Definition at line 4570 of file tolbi_ship_interiors.c.

Referenced by TolbiShipInteriors_ApplyEntryState(), TolbiShipInteriors_NoticeShipRocking(), and TolbiShipInteriors_ShakeWhileKrakenAboard().

◆ gKolimaForestBendLayout

◆ gKolimaForestBendRecords

struct BendLog* gKolimaForestBendRecords
extern

◆ gKolimaForestBendReturned

◆ gObjectSlots

struct ObjectRuntime* gObjectSlots
extern

◆ gScanlineAngle

u32 gScanlineAngle
extern

◆ gScanlinePitch

◆ gBabiPalace_Events2AfterColosso

struct SceneEvent gBabiPalace_Events2AfterColosso[]
extern

Definition at line 2846 of file babi_palace.c.

Referenced by Scene_GetEvents().

◆ gWorldMapPackedFrames

const u8 gWorldMapPackedFrames[]
extern

◆ gWorldMapPackedTiles

const u8 gWorldMapPackedTiles[]
extern

◆ gWorldMapPalettes

const u8 gWorldMapPalettes[]
extern

◆ gKalay_DanceStep

s32 gKalay_DanceStep
extern

◆ gKolimaForestBend_ShakeChance

u32 gKolimaForestBend_ShakeChance
extern

◆ gKolimaForestBend_ShakeScroll

u32 gKolimaForestBend_ShakeScroll[]
extern

◆ gKolimaPalette_First

u8 gKolimaPalette_First[]
extern

Definition at line 171 of file kolima_forest_clearing.c.

Referenced by KolimaPalette_Restore(), and KolimaPalette_SaveFirst().

◆ gKolimaPalette_Second

u8 gKolimaPalette_Second[]
extern

Definition at line 172 of file kolima_forest_clearing.c.

Referenced by KolimaPalette_Restore(), and KolimaPalette_SaveSecond().

◆ gColosso_CompetitorStartAngle

s32 gColosso_CompetitorStartAngle
extern

◆ gColosso_CompetitorStartX

s32 gColosso_CompetitorStartX
extern

◆ gColosso_CompetitorStartZ

s32 gColosso_CompetitorStartZ
extern

◆ gColosso_GaugePalette

u16 gColosso_GaugePalette[]
extern

Referenced by Colosso_DrawGauge().

◆ gColosso_MarkerOam

s32 gColosso_MarkerOam[3]
extern

Referenced by Colosso_UpdateMarker().

◆ gColosso_ModeBlendDuration

s16 gColosso_ModeBlendDuration
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeBlendStart

s16 gColosso_ModeBlendStart
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeBlendStep

s16 gColosso_ModeBlendStep
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeBlendTarget

s16 gColosso_ModeBlendTarget
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeMoveStart

s16 gColosso_ModeMoveStart
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeMoveStep

s16 gColosso_ModeMoveStep
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeScaleDuration

s16 gColosso_ModeScaleDuration
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeScaleStart

s16 gColosso_ModeScaleStart
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeScaleStep

s16 gColosso_ModeScaleStep
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_ModeScaleTarget

s16 gColosso_ModeScaleTarget
extern

Referenced by Colosso_UpdateLettering().

◆ gColosso_LetteringSprites

u32 gColosso_LetteringSprites[]
extern

Referenced by Colosso_UpdateLettering().

◆ gVaultInteriors_StopTimer

u16 gVaultInteriors_StopTimer
extern

◆ Object_UpdateAllCodeSize

u8 Object_UpdateAllCodeSize[]
extern

◆ gObjectGroup_BlinkChildValues

u8 gObjectGroup_BlinkChildValues[]
extern

A child value by frame ((gFrameCount >> 1) & 3).

Definition at line 344 of file fxdata.c.

Referenced by ObjectGroup_ApplyIndexedChildValue().

◆ gObjectMotion_ActionKind1Script

const u8 gObjectMotion_ActionKind1Script[]
extern

◆ gObjectMotion_ActionKind2Script

const u8 gObjectMotion_ActionKind2Script[]
extern

◆ gObjectMotion_ActionKind3Script

const u8 gObjectMotion_ActionKind3Script[]
extern

◆ gObjectMotion_ActionKind4Script

const u8 gObjectMotion_ActionKind4Script[]
extern

◆ gObjectMotion_LaunchScript

u8 gObjectMotion_LaunchScript
extern

◆ gObjectMotion_MoveTowardTargetScript

const u8 gObjectMotion_MoveTowardTargetScript[]
extern

◆ gObjectMotion_ResetActionScript

const u8 gObjectMotion_ResetActionScript[]
extern

◆ gObjectMotion_StepAngleScript

const u8 gObjectMotion_StepAngleScript[]
extern

◆ gObjectMotion_TurnTowardLinkedScript

const u8 gObjectMotion_TurnTowardLinkedScript[]
extern

◆ gObjectMotion_VariantScripts

const u8 gObjectMotion_VariantScripts[]
extern

Squashes as many times as the variant (1 to 3): variant v starts at word (3 - v) * 32 and runs to the end.

field.h declares it const u8[], and psynergy_effects.c adds (3 - v) << 7 bytes and reads it through an s32 *.

Definition at line 300 of file fxdata.c.

Referenced by ObjectMotion_SetVariantCallback().

◆ gLamakanDesert_SandEffectTiles

u8 gLamakanDesert_SandEffectTiles[]
extern

Referenced by HeatGauge_Start().

◆ gLamakanDesert_SandPalette

const u16 gLamakanDesert_SandPalette[16]
extern

Referenced by HeatGauge_Draw().

◆ gLamakanDesert_SandPhase

u16 gLamakanDesert_SandPhase
extern

◆ gLamakanDesert_SandTileBuffer

u8 gLamakanDesert_SandTileBuffer[]
extern

Referenced by HeatGauge_Draw(), and HeatGauge_Start().

◆ gLamakanDesert_SandVramSlot

u16 gLamakanDesert_SandVramSlot
extern

Referenced by HeatGauge_Draw(), and HeatGauge_Start().

◆ gLamakanDesert_SandWork

struct MenuSprite gLamakanDesert_SandWork[]
extern

Referenced by HeatGauge_Draw().

◆ Render_DecodeFrame

◆ gSolSanctumStatue_SpriteRowsGfx

u8 gSolSanctumStatue_SpriteRowsGfx[]
extern

◆ gStagedActor_FootprintKinds

u32 gStagedActor_FootprintKinds[]
extern

Definition at line 2140 of file altmiller_cave.c.

◆ TileMap_DrawRows

const u8 TileMap_DrawRows[]
extern

Referenced by TileMap_DrawRowsFromRam().

◆ TileMap_DrawRowsCodeSize

u8 TileMap_DrawRowsCodeSize[]
extern

Referenced by TileMap_DrawRowsFromRam().

◆ Transform_UpdateVerticesSize

u8 Transform_UpdateVerticesSize
extern

◆ gWorldMap_FootprintActions

const s32 gWorldMap_FootprintActions[6]
extern

Two scripts for the world map's footprint and dust effects: wait 120 or 30 frames, then release the object.

FieldObject_UpdatePlayerControl starts the first and Object_MoveOnWorldMap the second (three words in).

Definition at line 121 of file facing.c.

Referenced by FieldObject_UpdatePlayerControl(), and Object_MoveOnWorldMap().

◆ gWorldMap_KeyHeadings

const s16 gWorldMap_KeyHeadings[16]
extern

The heading for each state of the direction pad (bits 4-7 of the keys); 0xffff means no direction is held, or only an opposite pair.

Read by FieldObject_UpdatePlayerControl, Object_MoveOnWorldMap and Object_MoveByKeys.

Definition at line 113 of file facing.c.

Referenced by FieldObject_UpdatePlayerControl(), Object_MoveByKeys(), and Object_MoveOnWorldMap().