Skip to Content
The Alchemy Project

src/field/facing.c

Which picture a sprite shows for the way it faces, and the small tables and scripts the actors read as they move: the direction pad's headings, the World Map camera's lean, a floating actor's bob, how long a footprint lasts, the order a sprite dissolves in and the World Map's graphics sets.

Variables

NameDescription
const Uint8AnimationFacingOnePicture [16]ANIM_FACING_ONE_PICTURE's table: one picture, mirrored to the left.
const Uint8AnimationFacingFrontBackSwapped [8]ANIM_FACING_FRONT_BACK_SWAPPED's table: a front and a back picture, the front mirrored the other way.
const Uint8AnimationFacingFrontBack [8]ANIM_FACING_FRONT_BACK's table: a front and a back picture.
const Uint8AnimationFacingThreePictures [16]ANIM_FACING_THREE_PICTURES's table: front, side and back.
const Uint8AnimationFacingFivePicturesUnused [16]Unused: The Broken Seal's sixteen-sector table for five pictures, which nothing here reads.
const Uint8AnimationFacingFivePictures [64]ANIM_FACING_FIVE_PICTURES's table: five pictures over 64 sectors, where The Broken Seal's has 16.
const Uint8AnimationFacingEightPictures [8]ANIM_FACING_EIGHT_PICTURES's table: a picture for each compass direction.
const Uint8SpriteDissolvePixelOrder [64]The order the 64 pixels of a sprite's tile dissolve in (fdSpriteDissolveStep).
const Uint16SpriteDissolvePixelOrderTailTwo bytes after the dissolve order; no code names them, in either game.
const FIXEDActorSpriteFullScale [2]An actor sprite's scale at full size, across and down.
const FIXEDCameraFixedViewMatrix [12]The fixed camera's view matrix (16.16): identity with a -0.8 shear of y by x.
const Sint32ActorScriptCycleTable [32]A floating actor's bob up and down, one period of a triangle wave.
const Sint32ActorScriptIdleScript [1]The idle script an actor returns to when its own one ends (fdActorScriptEnd): a lone SC_END, which reloads it.
const Sint16ActorScriptIdleScriptTail [8]Halfwords that follow the idle script; no code names them, in either game.
const Uint16WorldMapKeyHeadings [16]The heading for each state of the direction pad (bits 4 to 7 of the keys: Right, Left, Up, Down), in 1/65536 turns: Right is 0, Down DEGtoANG(90), Left DEGtoANG(180) and Up TRIG_TURN * 3 / 4.
const Sint32ActorFootprintScript []A footprint's script: it lasts 120 ticks and is released.
const Sint32ActorSplashScript []A splash's script: it lasts 20 ticks and is released.
const Sint32ActorRippleScript []A ripple's script: it lasts 32 ticks and is released.
const Sint32WorldMapKeyYaws [16]The yaw the World Map camera leans to for each state of the direction pad: a 128th of a turn for Right or Left, three quarters of that with Up or Down but not both; none otherwise.
const Sint32ActorSandPuffScript []A puff of sand the leader leaves behind as he moves as Sand (SPRITE_SAND_PUFF): its sceneByte counts down from 15 by one every 5 ticks, thirteen times, then the puff shrinks to nothing and goes.
const Sint32SandGrainScript []A grain of sand the leader drops as he moves as Sand: it lasts 60 ticks and is released.
const Uint32WorldMapGraphicsResources [4][9]The World Map's graphics in four sets, by resource id: each a palette, its tile animation, its metatiles' tiles and attributes, and six tile sets; fdWorldMapPreloadCurrentTileBlock chooses one by the region the party is in.

Description

Which picture a sprite shows for the way it faces, and the small tables and scripts the actors read as they move: the direction pad's headings, the World Map camera's lean, a floating actor's bob, how long a footprint lasts, the order a sprite dissolves in and the World Map's graphics sets.

Variables in detail

AnimationFacingOnePicture

const Uint8 AnimationFacingOnePicture[16]

ANIM_FACING_ONE_PICTURE's table: one picture, mirrored to the left.

Referenced by fdSpriteComposePicture().

Definition at line 15 of file facing.c.

AnimationFacingFrontBackSwapped

const Uint8 AnimationFacingFrontBackSwapped[8]

ANIM_FACING_FRONT_BACK_SWAPPED's table: a front and a back picture, the front mirrored the other way.

Referenced by fdSpriteComposePicture().

Definition at line 22 of file facing.c.

AnimationFacingFrontBack

const Uint8 AnimationFacingFrontBack[8]

ANIM_FACING_FRONT_BACK's table: a front and a back picture.

Referenced by fdSpriteComposePicture().

Definition at line 27 of file facing.c.

AnimationFacingThreePictures

const Uint8 AnimationFacingThreePictures[16]

ANIM_FACING_THREE_PICTURES's table: front, side and back.

Referenced by fdSpriteComposePicture().

Definition at line 32 of file facing.c.

AnimationFacingFivePicturesUnused

const Uint8 AnimationFacingFivePicturesUnused[16]

Unused: The Broken Seal's sixteen-sector table for five pictures, which nothing here reads.

Definition at line 38 of file facing.c.

AnimationFacingFivePictures

const Uint8 AnimationFacingFivePictures[64]

ANIM_FACING_FIVE_PICTURES's table: five pictures over 64 sectors, where The Broken Seal's has 16.

Referenced by fdSpriteComposePicture().

Definition at line 44 of file facing.c.

AnimationFacingEightPictures

const Uint8 AnimationFacingEightPictures[8]

ANIM_FACING_EIGHT_PICTURES's table: a picture for each compass direction.

Referenced by fdSpriteComposePicture().

Definition at line 58 of file facing.c.

SpriteDissolvePixelOrder

const Uint8 SpriteDissolvePixelOrder[64]

The order the 64 pixels of a sprite's tile dissolve in (fdSpriteDissolveStep).

Referenced by fdSpriteDissolveStep().

Definition at line 63 of file facing.c.

SpriteDissolvePixelOrderTail

const Uint16 SpriteDissolvePixelOrderTail

Two bytes after the dissolve order; no code names them, in either game.

Definition at line 71 of file facing.c.

ActorSpriteFullScale

const FIXED ActorSpriteFullScale[2]

An actor sprite's scale at full size, across and down.

Referenced by fdActorPlaceSprites().

Definition at line 74 of file facing.c.

CameraFixedViewMatrix

const FIXED CameraFixedViewMatrix[12]

The fixed camera's view matrix (16.16): identity with a -0.8 shear of y by x.

Referenced by fdActorSystemProjectSprites().

Definition at line 79 of file facing.c.

ActorScriptCycleTable

const Sint32 ActorScriptCycleTable[32]

A floating actor's bob up and down, one period of a triangle wave.

References Sint32.

Referenced by fdActorUpdateAllOnField().

Definition at line 87 of file facing.c.

ActorScriptIdleScript

const Sint32 ActorScriptIdleScript[1]

The idle script an actor returns to when its own one ends (fdActorScriptEnd): a lone SC_END, which reloads it.

References Sint32.

Referenced by fdActorScriptEnd().

Definition at line 96 of file facing.c.

ActorScriptIdleScriptTail

const Sint16 ActorScriptIdleScriptTail[8]

Halfwords that follow the idle script; no code names them, in either game.

Definition at line 101 of file facing.c.

WorldMapKeyHeadings

const Uint16 WorldMapKeyHeadings[16]

The heading for each state of the direction pad (bits 4 to 7 of the keys: Right, Left, Up, Down), in 1/65536 turns: Right is 0, Down DEGtoANG(90), Left DEGtoANG(180) and Up TRIG_TURN * 3 / 4. WORLD_MAP_KEY_HEADING_NONE means no direction is held, or only an opposite pair.

Referenced by fdActorCrossRope(), fdActorCrossTightrope(), fdActorFlyOnWorldMap(), fdActorMoveAsSand(), fdActorMoveAsSandOnWorldMap(), fdActorMoveByKeys(), fdActorMoveOnWorldMap(), fdActorSailOnMap(), fdActorSailOnWorldMap(), fdActorUpdateHoverControl(), fdActorUpdatePlayerControl() and fdActorUpdateWalkingControl().

Definition at line 108 of file facing.c.

ActorFootprintScript

const Sint32 ActorFootprintScript[]

A footprint's script: it lasts 120 ticks and is released.

References Sint32.

Referenced by fdActorUpdatePlayerControl().

Definition at line 116 of file facing.c.

ActorSplashScript

const Sint32 ActorSplashScript[]

A splash's script: it lasts 20 ticks and is released.

References Sint32.

Referenced by fdActorSpawnWaterSplash().

Definition at line 122 of file facing.c.

ActorRippleScript

const Sint32 ActorRippleScript[]

A ripple's script: it lasts 32 ticks and is released.

References Sint32.

Referenced by fdActorFlyOnWorldMap(), fdActorMoveOnWorldMap() and fdActorSailOnWorldMap().

Definition at line 128 of file facing.c.

WorldMapKeyYaws

const Sint32 WorldMapKeyYaws[16]

The yaw the World Map camera leans to for each state of the direction pad: a 128th of a turn for Right or Left, three quarters of that with Up or Down but not both; none otherwise.

References Sint32.

Referenced by fdActorFlyOnWorldMap(), fdActorMoveAsSandOnWorldMap(), fdActorMoveOnWorldMap() and fdActorSailOnWorldMap().

Definition at line 135 of file facing.c.

ActorSandPuffScript

const Sint32 ActorSandPuffScript[]

A puff of sand the leader leaves behind as he moves as Sand (SPRITE_SAND_PUFF): its sceneByte counts down from 15 by one every 5 ticks, thirteen times, then the puff shrinks to nothing and goes.

References Sint32.

Referenced by fdActorMoveAsSand() and fdActorMoveAsSandOnWorldMap().

Definition at line 146 of file facing.c.

SandGrainScript

const Sint32 SandGrainScript[]

A grain of sand the leader drops as he moves as Sand: it lasts 60 ticks and is released.

References Sint32.

Referenced by fdActorMoveAsSand().

Definition at line 159 of file facing.c.

WorldMapGraphicsResources

const Uint32 WorldMapGraphicsResources[4][9]

The World Map's graphics in four sets, by resource id: each a palette, its tile animation, its metatiles' tiles and attributes, and six tile sets; fdWorldMapPreloadCurrentTileBlock chooses one by the region the party is in.

Referenced by fdWorldMapLoadGraphics() and fdWorldMapPreloadCurrentTileBlock().

Definition at line 168 of file facing.c.