include/field/field_engine_functions.h
The field-engine module's functions, declared once each in the order of its stub table, without the inlines field_engine.h brings in with field.h and its other headers. More…
Included by actor_scripts.c, field_effect_spawn_resident.c, cracked_tile_mask.c, field_effect_spawn.c, field_engine.h and script.h.
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdEngineRun (void) | The field engine: runs the current scene, which the party entered by entrance, until it leaves; returns the exit kind it left by, for gmTakeExit, or EXIT_KEEP_DESTINATION when the next scene is already in MainRoutineStateWork: a random battle, a party that fell outside battle, Retreat or a script's destination. |
void | gmMainRoutineRun (Sint32 start) | The main routine: runs one engine after another and never returns. start, a GAME_START, chooses the first scene. |
void | fdScriptWait (Sint32 ticks) | Waits the requested ticks through sySynch(), unless debug fast-forward (fdScriptUpdateDebugSkip) is on: the wait scripts use. |
void | fdScriptStart (void) | Begins a script: closes any area name window, stops the leader, ends the lasting Psynergy if a cue is running, resets the message and timing state, and starts the debug fast-forward event with the leader as the message speaker. |
void | fdScriptEnd (void) | Ends a script: stops the debug fast-forward event, gives the camera back to the leader (or to the first placed actor, the ship, while MainRoutineStateWork.ownerOverride is set) and refreshes the Lure Cap's flag (gmFlagRefreshLureCap). |
struct ACTOR * | fdScriptResetLeaderAndWait (Sint32 table) | Rebuilds the leader's actor from its placement row (fdActorResetForLeader), waits a tick and returns the leader's actor. |
void | fdScriptSpawnActorsAfterLast (Sint32 table) | Spawns the actors of an actor placement table after the last actor in use. |
void | fdAssignViewFlags (struct VIEWED_PLACEMENT *entry) | Gives each actor placement with condition 0 a condition saying whether it lies within the map's view bounds, so that only those inside appear. |
void | fdScriptSetSceneCues (Sint32 events) | Replaces the scene's cue table with scripts. |
void | fdScriptAddPartyMember (Sint32 unit, Sint32 announce) | Adds unit to the party. |
void | fdScriptAddTwoPartyMembers (Sint32 first, Sint32 second) | Adds two units to the party and announces them together ("<a> and <b> joined your party.", mnPartyShowPairJoinedMessage). |
void | fdPartyRemoveMemberRestored (Sint32 unit) | Takes unit out of the party, fully restoring its HP and PP and curing its poison. |
Sint32 | fdPartyInventoryGiveItem (Sint32 item, Sint32 unused) | The script command "give item": gives item to the first party member with room for it and says so; with no room, the player chooses what to drop. |
Sint32 | fdInventoryTryAddAndReturnMember (Sint32 item, Sint32 unused, Sint32 unit) | Gives item to one party member. |
Sint32 | fdScriptAskYesNoWithActorAnimation (Sint32 actor, Sint32 forceBottom) | The script command "choose yes or no": once the message on screen has been read, asks yes or no below it, or above it when the message windows reach past YES_NO_BELOW_LAST_ROW (unless forceBottom is set). |
Sint32 | fdScriptPickUpItem (Sint32 actor, Sint32 item, Sint32 flag) | Gives the party item from actor: with no room it shows the item, says it was found and left behind and returns -1; otherwise it adds the item, sets flag (unless -1) and returns 0. |
void | fdPartyLearnAbility (Sint32 unit, Sint32 ability) | Teaches unit the Psynergy ability and says so with its jingle, waiting for the player to read it. |
struct ACTOR * | fdActorGetById (Uint32 actorId) | Returns an actor, or NULL if it does not exist. |
void | fdActorReleaseById (Sint32 actorId) | The script command "release actor": releases the actor and empties its slot in the field state's actor table. |
void | fdActorSetSpeedParams (Sint32 actorId, FIXED speedLimit, FIXED acceleration) | The script command "set actor speed": its top speed and acceleration, 16.16 pixels per tick. |
void | fdActorSetMovementTypeById (Sint32 actorId, const void *script) | Gives an actor a movement type or actor script (fdActorSetMovementType) and makes it face where it moves (ACTOR_FACES_MOTION). |
void | fdActorWaitForScriptEndById (Uint32 actorId) | Waits, at most 300 ticks, for an actor's script to reach its end (SC_END). |
void | fdActorStop (Sint32 actorId) | The script command "stop actor": stops its movement type and puts it back under script control, on the idle script (a lone SC_END), and makes it face where it moves. |
void | fdActorSetMovementTypeAndWaitById (Sint32 actorId, const void *script) | Starts a movement type or supplied actor script, as fdActorSetMovementTypeById does, then waits up to 300 ticks for its script to end. |
void | fdActorSetDestinationById (Uint32 actorId, Sint32 x, Sint32 z) | The script command "set actor destination": the actor heads for (x, z), in pixels, keeping its current animation. |
void | fdActorMoveToAndWaitById (Uint32 actorId, Sint32 x, Sint32 z) | The script command "move actor and wait": as fdActorSetDestinationById, then waits (at most 600 ticks) for the actor to arrive. |
void | fdActorWalkToById (Sint32 actorId, Sint32 x, Sint32 z) | The script command "walk actor to": the actor walks toward (x, z), in pixels. |
void | fdActorWalkToAndWaitById (Sint32 actorId, Sint32 x, Sint32 z) | The script command "walk actor to and wait": walks the actor to (x, z), in pixels, waits for it to arrive and stands it still. |
void | fdActorCenterOnColumn (Uint32 actorId, Sint32 priority, Sint32 zOffset) | The script command "center actor and walk": walks the actor sideways to the middle of its 16-pixel column, sets its sprite priority to priority (fdActorSetSpritePriority), then sends it zOffset pixels along z. |
void | fdActorSetDestinationOffsetById (Sint32 actorId, Sint32 xOffset, Sint32 zOffset) | The script command "set actor destination offset": the actor heads (xOffset, zOffset) pixels from where it stands. |
void | fdActorWaitForMoveById (Sint32 actorId) | The script command "wait for actor": waits (at most 600 ticks) for the actor to arrive and stands it still. |
void | fdActorSetHorizontalPosWithTerrain (Uint32 actorId, FIXED x, FIXED z) | The script command "set actor position": puts the actor at (x, z), 16.16 pixels, at rest; an actor that follows the ground keeps its height above it. |
void | fdActorSetHorizontalPosAndAngleWithTerrain (Sint32 actorId, Sint32 x, Sint32 z, Sint32 angle) | As fdActorSetHorizontalPosWithTerrain, and turns the actor to angle. |
void | fdActorSetPosWithTerrain (Uint32 actorId, FIXED x, FIXED y, FIXED z) | Puts the actor at (x, y, z), 16.16 pixels, at rest, raised by the ground height there if it follows the ground. |
void | fdActorPlaceOnActor (Uint32 actorId, Uint32 otherId) | Puts the first actor where the second stands, at rest, on the same ground height. |
void | fdActorSetAnimationById (Uint32 actorId, Sint32 animation) | The script command "set actor animation" (an ACTOR_ANIMATION: ANIM_STAND, ANIM_WALK, ANIM_NOD, ANIM_SHAKE_HEAD and so on). |
void | fdActorSetAnimationSpeedById (Sint32 actorId, Sint32 steps) | Sets the animation timer steps of each of an actor's sprites. |
void | fdActorSetAnimationAndWait (Sint32 actorId, Sint32 animation) | The script command "set actor animation and wait": plays the animation and waits for it to end. |
void | fdActorWaitForAnimationChange (Uint32 actorId) | Waits, at most 90 ticks, for an actor's animation to change or for its first sprite animation's script to reach its hold command (ANIMCMD_HOLD). |
void | fdActorJump (Sint32 actorId, Sint32 speed, Sint32 ticks) | The script command "actor jump": throws the actor upward at speed pixels per tick with a jump sound (a higher one above 5), then waits ticks ticks. |
void | fdActorStartRepeatedMotion (Uint32 actorId, Sint32 count) | The script command "start repeated motion": the actor squashes and springs back count times (1 to REPEATED_MOTION_MAX), through RepeatedSquashScript. |
void | fdActorRunRepeatedMotion (Uint32 actorId, Sint32 count) | The script command "run repeated motion": as fdActorStartRepeatedMotion, then waits for it to end. |
void | fdActorJumpDownLedge (Sint32 actorId, Sint32 pose, Sint32 dust) | Makes an actor jump down off a ledge in front of it: it shows pose for 10 ticks, hops 12 pixels south from the middle of its 16-pixel column, turns toward FACING_SOUTH_SOUTHWEST while sinking 28 pixels with a dust puff every other tick in the colour mode dust (none when dust is -1), then jumps on to 16 pixels south of where it started and lands, waiting at most 180 ticks for it unless dust has LEDGE_JUMP_NO_LANDING_WAIT. |
void | fdActorFaceActorById (Sint32 firstId, Sint32 secondId, Sint32 ticks) | The script command "actor face actor": turns the first actor at once to face the second, then waits the given number of ticks. |
void | fdActorTurnToFaceEachOther (Sint32 firstId, Sint32 secondId, Sint32 ticks) | The script command "actors face each other": turns two actors toward each other, then waits the given number of ticks. |
void | fdActorConfigureSpriteColor (Sint32 actorId, Sint32 colorMode) | The script command "set actor sprite colour": gives every sprite animation of the actor the colour mode (fdActorSetSpriteColor); with SPRITE_COLOR_BLINK the actor blinks instead (fdActorUpdateBlink). |
void | fdActorSetSpriteColor (struct ACTOR *actor, Sint32 colorMode) | Sets the colour mode (SPR_COL_MODE) of every running sprite animation of an actor's sprite. |
void | fdActorWatchAndStartScript (Uint32 actorId, Sint32 targetId, const void *script) | Makes an actor follow the actor in targetId's ACTOR_WATCH_ACTOR_MASK bits and starts script on it. |
void | fdScriptSetMessageId (Sint32 msg) | The script command "set message": the number of the script's next message, written to the field state's message. |
Sint32 | fdMessageShowAtActor (Sint32 speaker, Sint32 unused) | The script command "open message": opens the script's current message in a speech window next to the speaking actor, with the speaker's portrait beside it when it has one, and moves on to the next message. |
void | fdMessageShowAtActorAndWait (Sint32 speaker, Sint32 flags) | Opens the script's current message at the speaker and waits for its window; after ten seconds, or with Select, R, L and A held, the text is finished at once. |
void | fdScriptShowMessageThenWait (Sint32 speaker, Sint32 flags, Sint32 ticks) | The script command "show message and wait": shows the message, then waits the given number of ticks. |
void | fdScriptShowMessageAndWait (Sint32 speaker, Sint32 flags) | The script command "show message": opens the current message at the speaker (fdMessageShowAtActor) and waits until it has been read and its window has closed; the speaker's portrait is closed once the text is typed out. |
Sint32 | fdScriptAskYesNoAndShowResponse (Sint32 speaker, Sint32 flags) | The script command "ask yes or no": opens the question at the speaker, lets the leader answer, then shows the next message for yes or the one after it for no. |
void | fdScriptNoOperationUpdate (void) | An empty hook; it does nothing in the released game. |
void | fdScriptShowSpeakerMessage (Sint32 speaker) | Unused: nothing calls it. |
void | fdScriptForwardShowMessageAtPos (Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y) | Unused: nothing calls it; forwards its arguments to fdScriptShowMessageAtPos. |
void | fdScriptShowMessageAtPos (Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y) | Unused: nothing calls it. |
void | fdActorFaceDirectionById (Sint32 actorId, Sint32 angle, Sint32 ticks) | The script command "actor face direction": the actor turns toward angle (TRIG_TURN a full turn; fdActorStepAngle), then the script waits the given number of ticks. |
void | fdActorFaceDirectionAndRefreshById (Sint32 actorId, Sint32 angle) | Turns an actor a step toward angle (ActorStepAngleScript) and waits for the script to end. |
void | fdActorClearDestinationAndStand (Uint32 actorId) | Clears an actor's destination, starts its idle script and stands it still. |
void | fdActorClosePortrait (Sint32 actorId) | Closes the portrait of an actor's sprite, if it has one. |
void | fdScriptShowTwoMessagesAndWait (Sint32 first, Sint32 firstX, Sint32 firstY, Sint32 firstPortraitX, Sint32 firstPortraitY, Sint32 second, Sint32 secondX, Sint32 secondY, Sint32 secondPortraitX, Sint32 secondPortraitY, Sint32 delay) | The script command "show two messages and wait": two actors speak at once, each message at its own (x, y) with its portrait at (portraitX, portraitY), all in tiles. |
void | fdMessageSetVoiceFromActor (Sint32 key) | A message's voice from its speaker, and a message shown at a place. |
void | fdActorSetSpritePriority (Uint32 actorId, Sint32 priority) | The script command "set actor sprite priority": fixes the priority of the actor's sprite and its shadow, which then no longer follow its depth: clears ACTOR_PRIORITY_AUTOMATIC. |
void | fdActorDisableById (Uint32 id) | Stops actor id moving and colliding and hides it. |
struct ACTOR * | fdActorShowEmoteById (Sint32 actorId, Sint32 emote, Sint32 ticks) | The script command "actor show emote": shows an emote bubble (SPRITE_EMOTE) over an actor, then waits the given number of ticks. |
void | fdEffectSetAttached (Sint32 actorId, Sint32 flags) | The script command "actor set attached effect", by ATTACHED_EFFECT_FLAG: removes the actor attached to an actor, attaches one (SPRITE_RAY_ARC, animation 1) unless one already is, or shows a one-off one (animation 2) that ends by itself (ActorWaitScript). |
void | fdActorCopyGraphics (Uint32 targetId, Uint32 srcId) | Makes the target actor's sprite show the source actor's graphics (its VRAM block and tile). |
void | fdCameraFollowActor (Sint32 actorId, Sint32 keepPos) | The script command "camera follow actor": the camera follows the actor, put on it at once unless keepPos leaves it where it is to set out from. |
void | fdCameraSetSpeedParams (FIXED speed, FIXED acceleration) | The script command "camera set speed": the camera's top speed and acceleration, 16.16 pixels per tick. |
void | fdCameraMoveWithinMapBounds (FIXED requestedX, FIXED requestedY, FIXED requestedZ, Sint32 pan) | The script command "camera move to": sends the camera to the requested axes, 16.16 pixels (-1 keeps that axis), kept far enough inside the map that the screen never shows past its edge. |
void | fdCameraWaitForArrival (void) | The script command "camera wait for move": waits (at most 600 ticks) for the camera to arrive, then 2 ticks more. |
void | fdCameraMoveToActorById (Sint32 actorId, Sint32 pan) | The script command "camera move to actor": fdCameraMoveWithinMapBounds to the actor's x and z. |
void | fdCameraMoveToActor (Sint32 actorId, Sint32 pan) | As fdCameraMoveToActorById, to the actor's height too. |
struct ACTOR * | fdCameraGetActor (void) | The script command "get camera": returns the camera's own actor, which the view centres on. |
void | fdMapGridSetCameraBounds (Sint32 minX, Sint32 minZ, Sint32 maxX, Sint32 maxZ) | Sets the map coordinates the camera keeps the screen inside. |
void | fdScriptSetDestination (Sint32 sceneId, Sint32 entrance) | Makes the script leave for the given entrance of the given scene: raises the exit request EXIT_KEEP_DESTINATION and writes MainRoutineStateWork.next and entrance. |
void | fdScriptSetRestartPoint (Sint32 sceneId, Sint32 entrance) | Makes the script leave and records sceneId and entrance as the restart point. |
void | fdScriptSetExitRequest (Uint16 exit) | The script command "request exit": sets the field's exit request (EXIT_KEEP_DESTINATION leaves for MainRoutineStateWork's next and entrance). |
void | fdRequestBattleFromEncounterTable (Sint32 row, Sint32 column) | Sets up a battle with the formation at row and column of the encounter table. |
void | fdRequestDjinnBattle (Uint32 flags, Uint32 djinn) | Sets up the battle with Djinni djinn, DJINN_PER_ELEMENT to an element; an element's last Djinni stands for the one of The Broken Seal's chosen for it (SCENE_STATE_CHOSEN_DJINN; none: nothing happens). |
void | fdScriptSetAfterBattleDestination (Sint32 sceneId, Sint32 entrance) | Sets the after-battle destination (MainRoutineStateWork.afterBattleScene and afterBattleEntrance), where the party goes once the coming battle is won. |
void | fdScriptSetDefeatDestination (Sint32 sceneId, Sint32 entrance) | Sets the defeat destination (MainRoutineStateWork.defeatScene and defeatEntrance), where the party goes if it loses the coming battle. |
void | fdScriptLeaveFor (Uint16 sceneId, Uint16 entrance) | Makes the script leave for entrance entrance of scene sceneId: sets MainRoutineStateWork.next and entrance and raises the exit request EXIT_KEEP_DESTINATION, so the field engine leaves on its next pass. |
Sint32 | fdActorGetScreenPos (Sint32 actorId, Sint32 *pos) | Writes the actor's position on screen, in pixels, to position[0] and position[1]; an actor with a sprite is raised by its tick box. |
Sint32 | fdActorGetCueMetatileAheadOfCurrent (void) | Returns the metatile behavior of the map metatile 16 pixels ahead of the party leader when there is something to search there: a fixed search spot (METATILE_BEHAVIOR_JAR to METATILE_BEHAVIOR_WELL) whose ground is level with the leader or up to 16 pixels above it, or a behavior the scene has an examine cue for; aboard the ship on the World Map, SHIP_SEA_EXAMINE_CODE before sea of collision 3. |
Sint32 | fdPartyGetCharacterSprite (Sint32 character) | Picks the sprite a scene placement's character id shows: the ship (PLACEMENT_SHIP) is SPRITE_WINGED_SHIP_SMALL on the world map and SPRITE_WINGED_SHIP elsewhere, each one's flying picture once FLAG_SHIP_FLIES is set. |
Sint32 | fdFindNearbyTalkTarget (Sint32 id) | Picks the actor nearest actor id, under 32 pixels away and 48 pixels in height. |
void | fdPsynergySteerPushedTarget (Sint32 unused) | When Move is cast on a target, the pushing hand appears beside it and pushes it 16 pixels the way the d-pad points, for as long as the player pushes; A, B, L or R end it. |
void | fdPsynergyStartCloak (void) | Cloak the caster: flicker it CLOAK_BLINKS times, leave it half transparent, then check the ground under it every tick. |
Sint32 | fdFindNearbyPsynergyTarget (Sint32 self, Sint32 kind) | Returns the actor nearest in front of actor self that field Psynergy kind can reach, or -1. |
Sint32 | fdTryJumpForward (void) | The leader jumps two metatiles forward, over the metatile in front, when it faces a quarter turn, the map allows it (fdMapGridBlocksJump and the step check) or a platform actor (ACTOR_PRIORITY_PLATFORM) waits 16 pixels below the landing, and no solid actor stands there. |
Sint32 | fdClimbDown (void) | Climbs down onto the wall below the leader, as The Broken Seal's fdClimbDown does, or lets go and falls when it cannot. |
Sint32 | fdClimbUp (void) | Climbs up the wall in front of the leader, as The Broken Seal's fdClimbUp does. |
void | fdLeaderStopMoving (void) | Stops the leader where it stands: no horizontal velocity, the normal walking speed (1.0) and acceleration (0.5), no destination, and the standing pose, or ANIM_LEADER_CLING while the leader is on a climbable wall. |
void | fdGroundParticlesStart (void) | Unused: nothing calls it or its stub. |
void | fdWeatherStartLightning (void) | Starts the storm's lightning (fdWeatherUpdateLightning): builds the dark (PALETTE_TINT_WARM) and lit (PALETTE_TINT_PALE) BG colours and their 12-step fade, and arms the first burst to end in 600 ticks, repeating. |
void | fdWeatherStopLightning (void) | Stops the lightning: no flash for 32767 ticks, and none after. |
void | fdWeatherLastLightning (void) | One last burst of lightning, its first flash two ticks from now (timer 12; fdWeatherUpdateLightning flashes at 11), then no more. |
void | fdWeatherResumeLightning (void) | Restarts the lightning: the next burst ends in 128 ticks, and bursts repeat. |
void | fdWeatherStartLightningFlash (Sint32 from, Sint32 to) | Flashes the palette with the storm's event: one burst of three flashes of palette to, each fading back to palette from (fdPaletteFadeBuild modes) on the BG colours, ending 120 ticks from now, and no more after. |
void | fdRisingParticlesStart (void) | Starts the rising particles, as the Northern Reaches does: allocates and clears heap slot HEAP_SLOT_WEATHER, decodes the particle tiles into VRAM, sets each of the 64 particles' sprite words and places it on the ground at a random point of the strip (x 288 to 488 pixels, z 60 to 80), staggering their timers by 2 ticks, and schedules the update. |
void | fdEffectInitSparkles (void) | Unused: nothing calls it or its stub; Aqua Rock and the Apojii Islands keep their own copy (shared/ground_particles_start.c). |
void | fdScreenTransitionStartWindowHeld (Sint32 mode) | Starts window transition mode at value 0, with no duration: the caller moves it. |
void | fdScreenTransitionStartDissolveHeld (Sint32 mode) | Starts a dissolve of the given mode, its value held at 0, and waits two seconds. |
void | fdScreenTransitionStart (Sint32 mode, Sint32 ticks) | Fades the screen in over ticks ticks. mode is a SCENE_TRANSITION: its high byte an SCREEN_TRANSITION_STYLE (from black, from the backdrop colour, a window transition whose low byte is an WINDOW_TRANSITION_MODE, a dissolve, or opening from the centre line, which a non-zero low byte makes flicker). |
void | fdScreenTransitionFinish (Sint32 mode, Sint32 ticks) | Fades the screen out over ticks ticks, as fdScreenTransitionStart fades it in. |
void | fdScreenTransitionHideBackgrounds (Sint32 clearBg3, Sint32 clearBg2, Sint32 clearBg1) | Clears the map's display-control bits for backgrounds 3, 2 and 1 (DISPCNT_BG3_ON, DISPCNT_BG2_ON and DISPCNT_BG1_ON) for each argument that is set. |
Sint32 | fdTalkToActor (Sint32 id) | Talks to actor id. |
void | fdPaletteFadeInit (void) | The palette fades: their steps, their channels kept in range, and the backdrop colour. |
void | fdPaletteFadeSetTarget (Sint32 mode, Sint32 half) | Sets the colours the palette fade moves toward (see fdPaletteFadeBuild); does nothing without a palette fade. |
void | fdPaletteFadeSetSource (Sint32 mode, Sint32 half) | Sets the colours the palette fade shows now (see fdPaletteFadeBuild). |
void | fdPaletteFadeCalculateSteps (Sint16 *src, Sint16 *target, Sint16 *step, Sint32 ticks) | Sets each colour channel of step to the amount to add each tick for source to reach target in ticks ticks; with ticks 0 or less step is left as it was. |
void | fdPaletteFadeStartInterpolation (Sint32 ticks) | Starts the fade from the shown colours to the target colours, over ticks ticks. |
void | fdPaletteFadeRelease (void) | Stops the palette fade and frees it. |
void | fdPaletteFadeSetBackdrop (Uint32 color) | Sets the backdrop colour (BG colour 0) of the palette fade's copy of the palettes, from which it builds its colours. |
void | fdScriptStartScreenTransition (void) | The script command "open screen": starts the script's screen transition and sets transitionActive. |
void | fdScriptFinishScreenTransition (void) | The script command "close screen": finishes the script's screen transition and clears transitionActive. |
void | fdScriptWaitTransitionTicks (void) | The script command "wait for screen": waits as long as the transition runs (transitionFrame). |
void | fdLineScrollInitWave (Sint32 mode, Sint32 frequencyX, Sint32 stepX, Sint32 ampX, Sint32 frequencyY, Sint32 stepY, Sint32 ampY) | Starts the line scroll: its state (heap slot HEAP_SLOT_LINE_SCROLL) holds the mode and, for x and y, how fast the wave runs from tick to tick, its step from one scanline to the next and its amplitude; two events, one in the vertical blank pass and one in the tick pass, build and send each tick's line offsets. |
void | fdLineScrollStop (void) | Stops the line scroll: removes its two events and stops DMA 0. |
Sint32 | fdChestOpenAndShowItem (Sint32 actorId, Sint32 target, Sint32 itemId) | Unused: only the stub table refers to it. |
void | fdItemDisplayShowPicture (struct ACTOR *actor, Sint32 flags) | Shows a found item's picture as flags choose (ITEM_DISPLAY_FLAG), with waits of 60 and 80 ticks around its raising when both are set. |
void | fdItemDisplayShowItem (Sint32 item, Sint32 flags) | Shows the picture of item 36 pixels above the party leader for 80 ticks, as flags choose (ITEM_DISPLAY_FLAG). |
struct ACTOR * | fdTreasureSpotGetActor (Uint32 actorId) | Returns the actor, or NULL. |
void | fdTreasureSpotOpenChest (Uint32 actorId) | Opens the chest of the actor with SE_CHEST_OPEN, and waits 12 ticks. |
void | fdTreasureSpotCloseChest (Uint32 actorId) | Closes the chest of the actor again (its item could not be carried), with SE_CHEST_CLOSE, and waits 12 ticks. |
void | fdTreasureSpotShowOpened (Uint32 actorId) | Shows the chest of the actor open, with no sound. |
void | fdTreasureSpotSetActorPos (Uint32 actorId, FIXED x, FIXED z) | Moves the actor to (x, z) on the ground, 16.16 pixels; -1 keeps its home (homeX, homeZ) on that axis. |
void | fdTreasureSpotRemove (Uint32 actorId) | Releases the actor and empties its slot. |
void | fdTreasureSpotMoveLeaderAway (void) | Unused: only the stub table refers to it. |
void | fdActorSetWideSprite (Uint32 actorId, Sint32 mode) | TREASURE_SPOT_PUT_AWAY moves the actor to x and z 0 and marks it with sceneWord TREASURE_SPOT_ON_METATILE; any other mode draws its sprite wide, 16 by 8 pixels, 4 pixels lower. |
void | fdActorReturnHome (Sint32 mode, Uint32 actorId, Sint32 flag) | RETURN_HOME_CLEAR_Z moves the actor to z 0; RETURN_HOME_DUG_UP sets flag, draws a moved actor square again and drops it back home (homeX, homeZ) at Scoop's anchor. |
void | fdWorldMapFreeze (void) | On the World Map, with no area graphics already pending: marks them pending, pauses the camera's actor and, when a screen transition is running, ends it at once and waits 2 ticks; then shows the still image (fdWorldMapStartStillImageStub). |
void | fdWorldMapReloadPendingAreaGraphics (void) | On the World Map, loads the area graphics fdWorldMapFreeze left pending and lets the camera's actor move again. |
void | fdActorResetForLeader (Sint32 table) | Creates a scene's actors on entering it, as The Broken Seal's fdActorResetForLeader does: the party leader where the main routine's state puts it, the scene's placement table from actor slot 8, and the camera that follows the leader; it also chooses the leader's control mode. |
void | fdScriptSpawnActorTable (struct ACTOR_PLACE *entry, Sint32 slot) | Creates the actors of a scene's actor placement table (ended by sprite -1), and records the table among the scene's tables. |
void | fdActorReleaseAtIndex (Uint32 actorIndex) | Releases the actor in slot actorIndex of the field state's table, if there is one, and empties the slot. |
struct ACTOR * | fdActorLookup (Uint32 actorId) | Returns the actor in slot actorId (below LOOKUP_ID_COUNT), or NULL. |
Sint32 | fdScenePointGetPos (Sint32 id, FIXED *pos) | Looks point id up in the map's scene points (its points.tsv, ended by id 0xff) and writes its x and z, in 16.16 pixels, to position; returns 0, or -1 when the map has no such point. |
void | fdEffectStartFadeOverlay (void *actor) | Starts the fade overlay on an actor (the party leader when NULL): loads its solid tiles, sets the blending and draws it each tick. |
void | fdFadeOverlaySuspend (void) | Stops drawing the fade overlay, keeping its state. |
void | fdFadeOverlayResume (void) | Draws the fade overlay again after fdFadeOverlaySuspend. |
void | fdEffectStartBlankOverlay (Sint32 actor) | Like fdEffectStartFadeOverlay with blank tiles and no blending: loads 512 bytes of blank tiles into VRAM_CACHE_ENTRY_GROUND_MASK and starts fdBlankOverlayDrawMarks on an actor (the party leader when 0). |
void | fdBlankOverlaySuspend (void) | Suspends the fdBlankOverlayDrawMarks overlay event. |
void | fdBlankOverlayResume (void) | Resumes the fdBlankOverlayDrawMarks overlay event. |
void | fdPsynergyRunHandler (Sint32 kind) | Runs one step of the scene's field Psynergy: cast with no target, cast on the chosen target (secondActorId), Mind Read's end, or what a lasting Psynergy does when it ends. |
void | fdPsynergyLoadResources (Sint32 abilityId, Sint32 mode) | Prepares the state of the field Psynergy for ability (heap slot fieldEffectState): its kind, the free VRAM it starts with, the map's shake to restore, and whether the place is lit. |
void | fdPsynergySetupActorPair (Sint32 userId, Sint32 targetId) | Records the caster and the target of a field Psynergy. |
void | fdBattleEffectStopMainActor (void) | Takes the caster out of its casting update and waits a tick. |
void | fdPsynergyEnd (void) | Ends a field Psynergy: frees the field effect sprites still in use and, unless another is being resolved, waits for the swelling arcs to end, restores the map's shake and releases the state. |
void | fdPsynergyStartCast (void) | The field Psynergy, each cast as the script commands run it, with the functions that end a lasting one, act on a target or resume it. |
void | fdPsynergyFadeToCastColor (void) | Tints the field for a Psynergy animation: a tint chosen by the tick counter (so each cast looks a little different), fixed for some animations, and forced by the tint flags; then fades towards it over eight ticks. |
void | fdPsynergyFadeFromCastColor (void) | Fades the palettes back from a cast's colours to the saved ones over 8 ticks; while Reveal is active the BG half fades to Reveal's grey instead (PALETTE_TINT_GRAYSCALE). |
void | fdScriptEndAllLastingPsynergy (void) | Ends every lasting Psynergy (fdScriptEndLastingPsynergy with none skipped). |
void | fdScriptEndLastingPsynergy (Sint32 skip) | Ends the lasting Psynergy and runs their end scripts: Reveal, the ring of light and Sand (while the party is sand, MainRoutineStateWork.sandActive), each unless skip holds its bit (PSYNERGY_END_SKIP). |
void | fdPsynergyStartMindReadWave (Sint32 casterId, Sint32 targetId) | Starts Mind Read's wave between the caster and the one it reads (HEAP_SLOT_MIND_READ): a hue taken from the tick count, the field faded toward it, the message window greyed for thoughts, and fdPsynergyUpdateMindReadWave run each tick. |
void | fdPsynergyStopMindReadWave (void) | Stops the wave effect: restores the caster's colours and the palettes and releases the Psynergy's state. |
void | fdPsynergyGreyMindReadPalette (void) | Greys the message window's white and most of its other colours (MIND_READ_GREY), so messages read as thoughts, and starts the BG0 line scroll (fdMindReadStartRipple) at each VBlank. |
void | fdPsynergyRestoreMindReadPalette (void) | Stops the BG0 line scroll and restores WINDOW_PALETTE. |
Bool | fdHasPsynergyCue (Sint32 fieldPsynergy) | Returns whether the scene has a cue for the field Psynergy kind on what it would act on (fdSelectPsynergyTarget), at any stage. |
Uint32 | fdHasItemCue (Uint16 item) | Returns whether the scene has a script for item and what the leader faces. |
void * | fdSpriteShareVRAMCacheEntry (void *srcSprite, void *sharedSprite) | Makes srcSprite share sharedSprite's VRAM block, releasing its own; with no sharedSprite it keeps its block. |
Sint16 | fdBattleBackgroundGetSelected (void) | Returns the battle background chosen for the current scene. |
void * | fdEffectSpawnMoveHand (void *object) | Move's hand appears at a quarter size 16 pixels above the caster, with a crack and eight sparkles that scatter from it, and sets out 16 pixels the way the caster faces, to the nearest quarter turn. |
void | fdEffectGrowHandAndWait (struct ACTOR *actor) | Grows a hand to full size at once and waits for it to reach where it is going. |
void | fdEffectBurstHand (void *object) | The hand spins as it rises for BURST_RISE_TICKS, shrinks, and bursts into BURST_SPARKLES sparkles (SPRITE_SPARKLE). |
void | fdPartyAddPp (Sint32 amount, Sint32 unused) | Gives each character in the party amount PP (PP regenerates as the party walks). |
void | fdPartyAddHp (Sint32 amount, Sint32 scaled) | Changes each party member's HP by amount, or by that percentage of maximum HP when scaled is set; a loss flashes the screen orange. |
Sint32 | fdResourceTableCountFreeBlocks (void) | Counts the free blocks of the sprite VRAM cache. |
Sint32 | fdYesNoAsk (Sint32 atBottom) | Asks yes or no at the top of the screen, or at the bottom with atBottom set. |
Uint16 | fdEncounterGetFormationAtSlot (Sint32 zone, Sint32 slot) | Returns the formation in slot (0 to 7) of zone. |
Uint16 | fdEncounterGetDjinnFormation (Sint32 djinni) | Returns the formation of Djinni battle djinni, which the table gives as a zone and slot. |
void | gmPlayMusic (void) | Starts the current scene's field music, chosen by fdChooseMusic. |
void | fdChooseMusic (void) | Chooses the current scene's field music (MainRoutineStateWork.sound) from the first rule matching the scene or its area and the entrance; SOUND_KEEP_BGM when none does. |
void | fdDjinnJoinParty (Sint32 actor, Sint32 element, Sint32 djinni) | A Djinni joins. |
void | fdParticleUpdate (FIELD_PARTICLE *effect) | Updates one field effect sprite: counts its age, runs its callback (after any delay), moves it and draws it. |
Uint32 | fdParticleHasPendingTarget (FIELD_PARTICLE *effect) | Reports an unfinished target only for effects that stop on arrival. |
void | fdParticleSetPos (FIELD_PARTICLE *effect, Sint32 x, Sint32 z) | Places a field effect sprite at (x, z), at rest with no target. |
void | fdParticleSetAnimation (FIELD_PARTICLE *effect, Sint32 mode) | Sets the animation of a field effect sprite. |
void | fdParticleSetCallback (FIELD_PARTICLE *effect, EFFECT_CALLBACK callback) | Gives a field effect sprite its per-tick callback, starting at state 0. |
void | fdParticleInit (FIELD_PARTICLE *effect, Sint32 kind, Sint32 x, Sint32 z) | Starts a field particle with a sprite of the given kind at (x, z), at full size and in front of everything: it will fly to its target at up to 2 pixels a tick, turning a limited step at a time, and stop there. |
void | fdParticleFree (FIELD_PARTICLE *effect) | Frees a field effect sprite and its sprite, clearing it to zero (inactive). |
void | fdCameraWorldToScreen (struct VECTOR3 *pos) | Converts a world position (16.16 pixels) to the screen: x and z receive the screen's x and y and y becomes 0. |
Sint32 | fdSpeakerGetVoice (Sint32 id) | Returns the voice of sprite id's messages: the first of its four blip sounds, SE_VOICE_FIRST plus its definition's value, or 0 for none (SPEAKER_VOICE_NONE) or with the Speech option off (MainRoutineStateWork.speech). |
void | fdPartyClearUnusableShortcuts (void) | Clears each button shortcut whose Psynergy can no longer be cast: zeroes MainRoutineStateWork.firstShortcut or secondShortcut. |
void | fdEffectInitSlots (void) | Allocates and clears the field effect sprites (HEAP_SLOT_FIELD_EFFECT) and starts their update event. |
void | fdEffectReleaseSlots (void) | Stops the field effect sprites: removes their event, frees every slot still in use and releases their heap block, the field Psynergy's state with it. |
void | fdActorLaunchFromLeader (Sint32 actorId, Sint32 xOffset, Sint32 zOffset, Sint32 facing) | Places an actor on the leader, a pixel nearer the back, and sends it walking (xOffset, zOffset) pixels away at speed 0.8 and acceleration 0.4, through the launch script, which ends by turning it to facing (fdActorStepAngle). |
void | fdActorWalkByById (Uint32 actorId, Sint32 xOffset, Sint32 zOffset) | Walks the actor (xOffset, zOffset) pixels from where it stands, through the offset script. |
void | fdActorWalkByAndWaitById (Uint32 actorId, Sint32 xOffset, Sint32 zOffset) | Walks the actor (xOffset, zOffset) pixels, waits for it to arrive and stands it still. |
void | fdActorWatchAndSetScript (Sint32 actorId, Sint32 watchedActorId) | Makes an actor follow another (the watched actor script): writes its watchedActor. |
void | fdPsynergyHaltActor (Sint32 actorId) | Holds an actor still under Halt, keeping its per-tick update and its first animation's colour mode in MainRoutineStateWork for fdPsynergyResumeHaltedActor. |
void | fdPsynergyResumeHaltedActor (Sint32 actorId) | Lets a halted actor move again, with the update and colour mode kept by fdPsynergyHaltActor. |
Sint32 | fdActorFindBySprite (Sint32 spriteId) | Returns the first of the scene's placed actors (from ACTOR_FIRST_PLACED) showing spriteId, or -1. |
Sint32 | fdActorGetSpriteById (Sint32 key) | Returns the sprite (the first animation's id) of the actor whose id is key's under SPEAKER_ACTOR_MASK, or -1 if there is no such animated actor. |
void | fdActorTableSnapshot (void) | Saves up to 32 actors into SnapshotObjects, with each one's slot, animation, sprite flags and priority, so that they can be put back. |
void | fdActorRestore (void) | Puts back the actors the snapshot saved, and moves the camera to the party leader's height. |
void | fdWorldMapStartZoom (FIXED zoom, Sint32 ticks) | Starts a zoom to zoom (16.16) over ticks ticks, on the World Map only: fdWorldMapStepZoom takes the view's MAP_STATE.zoom to farPlane / zoom. |
void | fdScriptWaitForZoomTransition (void) | Waits for a zoom transition to end (on the World Map only, at most 300 ticks). |
Sint32 | fdAreaGetNameIndex (Sint32 sceneId, Sint32 entrance) | The area name number for scene entered at entrance, as the save files and the world map show it. |
Sint32 | fdPairTableFind (Sint32 key) | Unused: nothing calls it or its stub. |
Sint32 | fdPairTableFindAndIgnore (Sint32 key) | Unused: nothing calls it or its stub. |
Sint32 | fdPairTableFindCopy (Sint32 key) | Unused: nothing calls it or its stub. |
void | fdHeadingShow (Sint32 heading) | Unused: only the stub table refers to it. |
void | fdScriptWaitTwoSecondsOrPress (void) | Waits up to two seconds, stopping early when a button is pressed. |
void | fdHeadingClose (void) | Unused: only the stub table refers to it. |
void | fdActorSetMovementType (struct ACTOR *actor, Sint32 kind) | Starts an actor's movement type: an MOVEMENT_TYPE, or any other value as the actor script to run itself. |
void | fdQueueMusic (Sint32 soundId) | Plays SE_STOP_EXIT_SE, then soundId (SOUND_FADE_OUT_ACTION_SE for -1), and remembers soundId for fdPlayQueuedMusic in the field state's queuedSound; -1 is remembered as none, so it plays SOUND_FADE_OUT_ACTION_SE now and nothing later. |
void | fdScriptNoOperation (void) | A script that does nothing. |
void | fdPlayQueuedMusic (void) | Plays the sound fdQueueMusic remembered, if any. |
void | fdActorReservedNoOperation (void) | Does nothing; nothing calls it or its stub. |
void | fdRopeInit (void) | The ropes Lash ties between two posts, given by their actor ids: placing, tying, coiling and swinging them, laying their nodes and drawing them. |
void | fdRopeTie (Sint32 index, Sint32 id, Sint32 other) | Lays rope index tied between posts id and other, and shows both posts with the rope wound round them. |
void | fdRopeCoil (Sint32 index, Sint32 firstId, Sint32 secondId) | Coils rope index at post firstId, its length reaching post secondId: the rope as it waits to be lashed. |
void | fdRopeLash (Sint32 index, Sint32 fromId, Sint32 toId) | Lash: throws rope index from post fromId to post toId and winds it round both. |
void | fdRopeUntie (Sint32 index, Sint32 fromId, Sint32 toId) | Unties rope index between posts fromId and toId (fdRopeRecoil). |
void | fdTightropeInit (void) | Allocates the tightropes' state, loads their node picture and starts fdTightropeDraw and fdTightropeUpdate. |
Sint32 | fdTightropePlace (Sint32 slotNo, Sint32 firstId, Sint32 secondId) | Lays tightrope slotNo straight between posts firstId and secondId, and shows the rope wound round both. |
Sint32 | fdRopeGetState (Sint32 index) | Returns rope index's ROPE_SLOT_STATE, or -1 while the ropes have no state. |
void | fdRopePlace (Sint32 index, Sint32 flag, Sint32 firstId, Sint32 secondId) | Gives rope index its flag and places it between posts firstId and secondId: tied when the flag is set, else coiled at the first. |
const struct WORLD_MAP_PLACE * | fdWorldMapPlacesGetTable (void) | Returns the flag entry table, 20-byte entries ended by a zero flag. |
void | fdFlagBlockPlaceAll (struct ACTOR_FLAG *actors) | Sets up a scene's flag blocks, the puddles Frost turns into pillars of ice (actor and flag pairs, ended by ACTOR_LIST_END): each stops being solid and blocks its metatile; one whose flag is set shows the ice pillar and has the flag cleared, the others the puddle. |
void | fdFlagBlockPlaceAllMarkingEdges (struct ACTOR_FLAG *list) | Sets up Alhafra's and the Alhafran Cave's puddles as fdFlagBlockPlaceAll does, and marks the open metatiles on each puddle's four sides a gap to jump across (fdMapGridMarkJumpIfOpen), so the leader jumps onto a frozen one. |
void | fdFlagBlockApplyFlags (struct ACTOR_FLAG *list) | For each flag block whose animation disagrees with its flag, turns its metatile and flag over: with the flag set and the ice pillar not showing, the metatile is lowered 32 pixels to a wall and the flag cleared; with the flag clear and the puddle not showing (Frost freezing it), the metatile is raised 32 pixels, open and a gap to jump across, and the flag set. |
Sint32 | fdActorGetMetatileIndex (struct ACTOR *actor) | The rest of what the script commands share: actors, metatiles, sound and the party. |
void | fdActorPlaceBlocks (Uint16 *actors) | Makes each listed actor (ids, ended by ACTOR_LIST_END) a block in the map: its metatile's shape is tagged BLOCK_HEIGHT_STEPS above the ground, so the party can stand on it, its metatile is marked MAP_METATILE_JUMP, a gap to jump onto from another block (the old mark kept in the actor), and the overhead layer's metatile is a wall. |
void | fdActorLiftTargetBlock (Uint16 *actors) | Takes the block about to move out of the map: the field effect's target while one runs, else the actor ahead of the leader, if it is one of the listed actors. |
void | fdActorPlaceMovedBlock (void) | Puts the block fdActorLiftTargetBlock remembered back into the map at the metatile it has moved to, as fdActorPlaceBlocks places each. |
Sint32 | fdMapShapeFindOrAdd (Sint32 layer, Sint32 shape, Sint32 height) | Returns the index of the map's shape entry (MapGridShapes, MAP_SHAPE) of shape whose first height is height, in 8-pixel steps, writing it into the first free entry (MAP_SHAPE_FREE) when there is none: the entry a raised or lowered metatile's shape grid byte takes. |
struct ACTOR * | fdActorFindAtMetatile (Sint32 *pos, Sint32 checkY) | Returns the first of the placed actors (not the treasure spots) on position's metatile, at its height too when checkY is set, or NULL. |
Bool | fdLeaderCanPushObjectAhead (void) | Whether the actor 16 pixels in front of the leader, along its facing rounded to a quarter turn, can be pushed on by 16 pixels: 1 when nothing solid stands on the metatile beyond it or above it and its terrain test passes there, else 0. |
void | fdLeaderPushObjectAhead (void) | Pushes the actor ahead of the leader on by 16 pixels, as fdLeaderCanPushObjectAhead allowed. |
struct ACTOR * | fdLeaderFindActorAhead (void) | Returns the actor one metatile, or failing that two metatiles, ahead of the leader at the leader's height, or NULL. |
struct ACTOR * | fdActorSpawn (Sint32 kind, Sint32 x, Sint32 y, Sint32 z) | The pieces of the casts: their particles, hands and sparks, the tiles they leave, and the scripts and tables they run. |
void | fdTileCopiesCopyTouchedMetatiles (Sint32 srcX, Sint32 srcZ, Sint32 width, Sint32 height, Sint32 windowX, Sint16 windowZ, Sint32 layerIndex) | Clears what Cyclone blew away: each metatile of FIELD_STATE.psynergyMetatiles that falls in the width by height window at (windowX, windowZ) of layerIndex (counted from the layer's scroll and the leader's height) takes the metatile picture from the same place of the window at (srcX, srcZ), is opened on layer 2, and is recorded (up to 64) in TouchCopiesWork to be made again. |
Sint32 | fdMapGridIsSandMetatile (Sint32 x, Sint32 z, Sint32 layer) | Whether the leader can move as sand on the metatile at (x, z): the overhead layer's METATILE_BEHAVIOR_SAND, or on the world map collision WORLD_MAP_COLLISION_WALKABLE_FIRST or shallow water; FIELD_STATE.sceneAttributeHigh turns the answer round. |
Uint8 | fdMapGridIsClimbableMetatile (Sint32 x, Sint32 z, Sint32 layer) | Whether the metatile at (x, z) can be climbed (MAP_METATILE_CLIMBABLE): Sand starts up a wall face only there (fdActorMoveAsSand) and ends its climb off one. |
Sint32 | fdPartyGetLeaderActor (void) | Returns the leader's actor id, or ACTOR_FIRST_PLACED while MainRoutineStateWork.ownerOverride is set. |
void | fdHangingVinePlace (Sint32 id, Sint32 force) | Hangs a vine at once from high above actor id down to its feet (fdHangingVineHang): an actor that is not moving is lifted and moved 16 pixels north first, which fdHangingVineHang undoes; a moving one has its vine only when force is set. |
void | fdHangingVineHang (Sint32 objectId, Sint32 grow) | The hanging vines, each hung from an actor. |
void | fdHangingVineSwing (Sint32 id) | Whirlwind on the vine hanging from actor id: the vine swings out to the leader's side and the leader takes hold. |
void | fdExitPrepareActorAnimation (Sint32 actorId, Sint32 side) | fdExitPrepareAnimation for any actor: centres the actor on its metatile at the metatile's south edge, stops it, hides its shadow and plays ANIM_LEADER_LEAVE (side 1) or ANIM_LEADER_LEAVE_ALTERNATE over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part. |
void | fdActorAppearInSparks (Sint32 actorId) | An actor appears in a whirl of sparks, as Alex does on Venus Lighthouse: APPEAR_SPARK_COUNT sparkles (RESOURCE_SPARKLE_FADE) circle round where it stands, each rising and closing in for SPARK_LIFE ticks. |
void | fdActorSetSpriteRotationById (Sint32 id, Sint32 rotation) | Turns actor id's sprite to rotation (1/65536 turns). |
void | fdActorFallOverById (Uint32 id, Uint32 angle) | Lays actor id down along angle, a quarter turn rounded: shows its first tick turned, shifted by the side it falls to, and blocks its metatile and the metatile beyond it. |
void | fdActorFallOverWithAnimationById (Sint32 id, Uint32 angle, Sint32 animation) | fdActorFallOverById with an animation of the actor's sprite sheet (-1 for none) and the fall moving the actor itself half a metatile the way it falls. |
void | fdEffectSpriteInit (struct EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes, Sint32 tile) | Fills an effect sprite: OAM attributes 0 and 1 as given (no affine matrix, 256 colours), the tiles, unscaled and unrotated at depth 255, and the picture's size from its shape, pivoted at (pivotX, pivotY). |
void | fdEffectSpriteDraw (struct EFFECT_SPR *sprite) | Draws a field effect's sprite. |
void | fdEffectSpriteDrawAtWorldPos (struct EFFECT_SPR *sprite, Sint32 *pos) | Places sprite at the screen position of world position and draws it. |
void | fdBattleEffectStepVector2 (Sint32 *vector, Sint32 damping, Sint32 gravity) | Moves a 2D point by its velocity, damped and pulled by gravity (fdAdvanceWithGravity2D). |
void | fdBattleEffectStepVector3 (Sint32 *vector, Sint32 damping, Sint32 gravity) | Moves a 3D point by its velocity, damped and pulled by gravity (fdAdvanceWithGravity3D). |
Sint32 | fdActorGetSpritePriority (struct ACTOR *actor) | Returns the OBJ priority of the actor's sprite. |
Sint32 | fdActorGetSpriteDepth (struct ACTOR *actor) | Returns the depth slot the actor's sprite takes, so that a sprite drawn with it sorts with it: from its projected depth on the world map, otherwise from its screen row. |
void | fdStartColorTransition (Sint32 ticks, Sint32 color) | Fades the palettes to color over ticks ticks, keeping the field's colours for fdStartPaletteTransition; FLAG_PSYNERGY_TINTED is set while it holds. |
void | fdStartPaletteTransition (Sint32 ticks) | Fades the palettes back from fdStartColorTransition's colour over ticks ticks, the BG half to grey while Reveal is active; clears FLAG_PSYNERGY_TINTED. |
void | fdBattleEffectStartArcEffect (void) | Starts the swelling arcs over a caster: loads their tiles and starts fdBattleEffectUpdateArcEffect with no pair showing. |
void | fdBattleEffectEndArcEffect (void) | Ends the swelling arcs: frees their tiles and their state, and stops their event. |
void | fdBattleEffectWaitForArcGroups (void) | Waits, at most ARC_GROUPS_WAIT_TICKS, until both pairs of swelling arcs have run their 32 ticks. |
void | fdBattleEffectSetObjectUpdateMode (struct ACTOR *actor, Sint32 mode) | Gives the caster its look while it casts (CASTER_LOOK). |
Sint32 | fdActorCheckBlocked (struct ACTOR *actor) | Says whether an actor stands where it may not: 1 when, outside the World Map, fdMapGridCheckCollisionAtStub reports its metatile, ORed with 2 when it overlaps any other solid actor (each radius less 2 pixels). |
Uint8 | fdMapGridGetMetatileBehavior (Sint32 x, Sint32 z, Sint32 layer) | Returns the behaviour (collision code) of the map metatile at x, z in layer. |
Sint32 | fdMapGridGetMetatileAttributesAt (Sint32 x, Sint32 z, Sint32 layer) | The map's metatiles: their attributes and what sand, water and Cyclone make of them. |
Uint8 | fdMapGridSetMetatileBehavior (Sint32 x, Sint32 z, Sint32 layer, Sint32 value) | Sets the metatile behavior of the map metatile at x, z in layer, and returns it. |
Uint8 | fdMapGridSetMetatileAttributesAt (Sint32 x, Sint32 z, Sint32 layer, Sint32 value) | Sets the attribute byte of the map metatile at x, z in layer. |
Uint8 | fdMapGridSetMetatileAttributeBitsAt (Sint32 x, Sint32 z, Sint32 layer, Sint32 bits) | Sets bits in the attribute byte of the map metatile at x, z in layer. |
Uint8 | fdMapGridClearAttributeBBitsAt (Sint32 x, Sint32 z, Sint32 layer, Sint32 bits) | Clears bits in the attribute byte of the map metatile at x, z in layer. |
void | fdActorShowItemIconById (Sint32 id, Sint32 item) | Shows an actor as an item's icon, its sprite's only picture: the item, or for coins (SCOOPED_COINS) COIN_ICON_ITEM's. |
void | fdTightropeRelease (Sint32 index) | Frees tightrope index's nodes; it is no longer drawn. |
void | fdTightropeSettle (Sint32 index) | Stops tightrope index's wobble and marks its nodes not to be walked. |
Sint32 | fdActorTakeLeaderLayer (struct ACTOR *actor) | Gives an actor the leader's sprite priority, so it is drawn in front of and behind what he is, and keeps it there. |
void | fdActorDescendInWhirlwind (Sint32 actorId) | The actor arrives in a whirlwind (SPRITE_WHIRLWIND) that spins down from above, as Felix does on a Jupiter Lighthouse teleporter after Cyclone: as the screen transition starts it circles inside it for DESCEND_TICKS, from DESCEND_HEIGHT up and DESCEND_RADIUS out down to where it stands, then the whirlwind vanishes with a whoosh and the camera follows the actor again. |
void | fdActorAppearInWhirlwind (Sint32 actorId) | The actor appears in a whirlwind, as Felix does on the Jupiter Lighthouse teleporter he arrives at: once the screen transition is done, a whirlwind (SPRITE_WHIRLWIND) widens on the unseen, spinning actor for WHIRLWIND_RESIZE_TICKS, then vanishes with a whoosh as the actor grows back from half its size and shows again. |
void | fdScoopDropFromHand (Sint32 id) | Drops an actor from Scoop's hand (if there is one) to fall to the ground, waits 50 ticks, then asks for its talk, which opens it without its "checked the ..." message (FIELD_TALK_SILENT). |
void | fdScriptShowMessageAndOfferScoop (Sint32 msg) | Shows message in a script and clears FLAG_NOTHING_HAPPENS; when someone in the party has Scoop, the field menu then opens. |
void | fdFadeOverlayFillTiles (Sint32 solid) | Fills the overlay's 512 bytes of sprite tiles (VRAM_CACHE_ENTRY_GROUND_MASK) with PIXELS_8BPP(1) when solid is set, which in these 16-colour tiles is colour 1 in every other column (no caller sets it), else clears them. |
void | fdEffectSpriteInitWithFadeOverlay (struct EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes) | Sets up sprite through fdEffectSpriteInit with the overlay's tiles (VRAM_CACHE_ENTRY_GROUND_MASK), at priority 1 in palette 0. |
void | fdEffectSpriteDrawAtWorldXYZ (struct EFFECT_SPR *sprite, Sint32 x, Sint32 y, Sint32 z) | Projects the world position (x, y, z) to the screen, stores it as the effect sprite's position and draws the sprite. |
void | fdActorCycleSpriteColors (struct ACTOR *actor) | Per-tick update: sets every part of an actor's sprite to the next of the six orders of its colour channels (SPRITE_COLOR_NORMAL to SPRITE_COLOR_BRG). |
void | fdCycloneCopyTouchedMetatiles (Sint32 x, Sint32 z, Sint16 layerIndex, Sint16 width, Sint16 height, Sint32 toX, Sint32 toZ) | Clears the weeds the Cyclone blew away: for each metatile it touched (the field state's list from fdPsynergyGatherNearbyMetatiles) inside the width by height rectangle at (x, z) of the layer, copies the matching metatile tiles from the rectangle at (toX, toZ) over it, opens it on layer 2 and records the copy in TouchCopiesWork, up to 64. |
void | fdTeleportPlaySparksAndFade (void) | Runs fdTeleportPlaySparks, fades the palettes back to the saved ones and waits 10 ticks. |
void | fdActorWatchActor (struct ACTOR *actor, struct ACTOR *target) | Keeps an actor turning to face another. |
void | fdActorResetTargetsAndVelocity (Uint32 actorId) | As fdActorStop, and also clears the actor's target and velocity, so it stands where it is. |
void | fdExitStartStairsUp (void) | Leaves through a stairs-up exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival). |
void | fdExitStartStairsDown (void) | Leaves through a stairs-down exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN. |
void | fdMotesStart (void) | Unused: nothing calls it or its stub. |
void | fdWeatherStartRain (Sint32 withSound) | Starts fdWeatherUpdateRain's raindrops: allocates and clears HEAP_SLOT_WEATHER, decodes the streak tiles into VRAM, sets each of the 64 drops' sprite words and places it on the ground at the map's focus with its first fall staggered, turns on alpha blending of all layers at 16/16, schedules the update and, when asked, plays SE_KIRIN (fdQueueMusic). |
void | fdWeatherStopRain (void) | Stops fdWeatherStartRain's particles. |
void | fdSummonTabletPlayRunes (Sint32 targetId) | Plays a summon tablet's reading (a CONTAINER_STONE_TABLET treasure, "examined the stone tablet"): pebbles fly off the tablet as it is struck, and its runes light up and fly round the leader, with their sounds, before mnSummonShowLearnedMessage. |
void | fdScriptCountAnswer (void) | Counts one more weird answer Felix gives (MainRoutineStateWork.weirdAnswers). |
void | fdWorldMapSetReturnForScene (Sint32 scene, Sint32 entrance) | Where the party comes out on the world map after reaching scene and entrance (Teleport's choice calls it). |
void | fdWorldMapSetReturnLeavingScene (Sint32 scene, Sint32 entrance) | fdWorldMapSetReturnForScene's twin for the rule's return scene and entrance (its third and fourth values): with FLAG_SHIP_CAN_SAIL set, clears ownerOverride and copies the rule's position to the party's saved position. |
void | fdMadPlantLeapAtLeader (Sint32 sprite, Sint32 x, Sint32 z) | A Mad Plant (sprite) springs out of the bushes cleared at the metatile (x, z): it grows, turns to the leader, hops twice and leaps at the leader in an arc before the battle. |
Bool | fdScreenTransitionIsScanlineActive (void) | Returns 1 while fdScreenTransitionUpdateScanline is the HBlank handler, that is, while a centre-line transition runs. |
Sint32 | fdPartyCheckItemLimit (Sint32 item) | Checks whether the party can carry one more of item; when it cannot, says so and returns -1, else 0. |
struct CUE_VIEW * | fdFindCue (Sint32 kind, Sint32 target) | Returns the first of the scene's cues of kind for target whose condition holds and whose push (STEP_CUE_FLAG_WALKING) and facing (CUE_FLAG_FACING) requirements are met, or NULL. |
void | fdPaletteFadePackTarget (void) | Packs the target colours, three channels each, back into the palette copy as RGB555. |
void | fdPaletteFadeLoadPalette (const Uint16 *colors) | Takes colors as the BG colours of the palette copy and makes them, unchanged, the BG colours' target. |
Description
The field-engine module's functions, declared once each in the order of its
stub table, without the inlines field_engine.h brings in with field.h and its
other headers. It is for the units that must not see those inlines:
field_effect_advance_motion_priority.c, field_effect_advance_spin.c and the
scenes' shared scene_set_arrival_flags.c, which have it through script.h, and
actor_scripts.c, cracked_tile_mask.c, field_effect_spawn.c and
field_effect_spawn_resident.c. field_engine.h includes it for everyone else.