Skip to Content
The Alchemy Project

src/scene/shared/pushed_actor.c

Seventeen scenes with things the leader pushes (Altmiller Cave, Babi Lighthouse, Crossbone Isle and its rooms, Goma Cave's pillar room, Gondowan Cave, Kolima Forest (SceneIdKolimaForestEntrance to SceneIdKolimaForestCliff), Lunpa's fortress, Mercury Lighthouse and its entrance, Mogall Forest, the Tunnel Ruins, Vale and its cave): things pushed a metatile at a time, such as stone pillars, and logs and other large things that roll until they meet something, redrawn into the map grid where they stop. More…

Included by altmiller_cave.c, babi_lighthouse.c, crossbone_isle.c, crossbone_isle_keys.c, crossbone_isle_stepping_stones.c, goma_cave_pillar.c, gondowan_cave.c, kolima_forest_cliff.c, kolima_forest_entrance.c, kolima_forest_glade.c, lunpa_fortress.c, mercury_lighthouse.c, mercury_lighthouse_entrance.c, mogall_forest.c, tunnel_ruins.c, vale.c and vale_cave.c.

Functions

NameDescription
static ACTOR *scPushedActorFindAtTile (const FIELD_POS *pos, const ACTOR *origin)Returns the placed actor on the metatile of the 16.16 position and at its height (in whole pixels), or 0. origin is not read.
static voidscPushedActorAdvancePair (void)The leader pushes what stands in front of them a metatile on, unless something solid is beyond it or on top of it, the ground beyond refuses it or it is still moving: after a quarter second's push it and the leader slide one metatile together, with SE_PUSH.
static UNREAD_RESULTscPushedActorStopBlockedMotion (ACTOR *actor)The leader's update function while pushing a large thing: stop the leader when another actor that is not a large thing, or a wall, is in the way.
static ACTOR *scPushedActorFindLargeThingAhead (Sint32 *direction, Sint32 *slot, Sint32 *rectangle)Returns the large thing whose rectangle covers the metatile ahead of the leader (the leader not standing in line with its first column or row), with the leader's direction, its actor id and its rectangle; or NULL.
static Sint32scPushedActorFindClearPos (PUSHED_ACTOR_PROBE *probe)Finds where the large thing ahead of the leader would roll to: step its rectangle on, a metatile at a time the way the leader faces, until a metatile of it meets something (a collision result of 2).
static voidscPushedActorRoll (PUSHED_ACTOR_PROBE probe)Rolls the large thing to the position probe found: the leader pushes, the thing rolls (its sheet's animation 3 or 2, by the direction) with SE_HEAVY_MOVE while the leader follows half a metatile, and it stops with SE_STOP_ACTION_SE and SE_HEAVY_STOP.
static Sint32scPushedActorBlockFootprint (Sint32 id)Blocks large thing id's metatiles (METATILE_BEHAVIOR_WALL) where it stands, through the map grid's layer 1 offset; returns 0 when its sprite is no large thing.

Variables

NameDescription
extern PUSHED_ACTOR_RECTANGLEPushedActorRectangles []

Description

Seventeen scenes with things the leader pushes (Altmiller Cave, Babi Lighthouse, Crossbone Isle and its rooms, Goma Cave's pillar room, Gondowan Cave, Kolima Forest (SceneIdKolimaForestEntrance to SceneIdKolimaForestCliff), Lunpa's fortress, Mercury Lighthouse and its entrance, Mogall Forest, the Tunnel Ruins, Vale and its cave): things pushed a metatile at a time, such as stone pillars, and logs and other large things that roll until they meet something, redrawn into the map grid where they stop.

A large thing is a log, a pipe or a fallen column, lying west to east or north to south: one of six rectangles, by its sprite (PushedActorRectangleKinds), with its edges in PushedActorRectangles (pushed_actor_tables.c).

Functions in detail

scPushedActorFindAtTile

static ACTOR *scPushedActorFindAtTile(const FIELD_POS *pos, const ACTOR *origin)

Returns the placed actor on the metatile of the 16.16 position and at its height (in whole pixels), or 0. origin is not read.

References state.

Referenced by scBabiLighthouseFindActorAhead(), scCrossboneIsleSteppingStonesPushOrClimbDown(), scCrossboneIsleSteppingStonesTryJumpAcrossPillar(), scPushedActorAdvancePair() and scPushedActorStopBlockedMotion().

Definition at line 26 of file pushed_actor.c.

scPushedActorAdvancePair

static void scPushedActorAdvancePair(void)

The leader pushes what stands in front of them a metatile on, unless something solid is beyond it or on top of it, the ground beyond refuses it or it is still moving: after a quarter second's push it and the leader slide one metatile together, with SE_PUSH.

References fdActorGetById(), fdActorSelectAnimation(), fdActorStepFrom(), fdActorWaitForMove(), fdPlayQueuedMusic(), PushedActorDirectionSteps, scFieldActorCheckMovementCollision(), scFieldActorSetMoveTargetFX(), scPushedActorFindAtTile(), Sint32, sySoundPlay() and sySynch().

Referenced by scAltmillerCavePushPillar(), scBabiLighthousePushEntryPillar(), scBabiLighthousePushRoadPillar(), scCrossboneIsleKeysPushFifthPillar(), scCrossboneIsleKeysPushFirstPillar(), scCrossboneIsleKeysPushFourthOrFifthPillar(), scCrossboneIsleKeysPushSecondPillar(), scCrossboneIsleKeysPushThirdPillar(), scCrossboneIslePushPillar(), scCrossboneIsleSteppingStonesJumpOrPushPillar(), scCrossboneIsleSteppingStonesJumpOrPushStackedPillar(), scCrossboneIsleSteppingStonesPushSinkingBoulder(), scGomaCavePillarPushEastPillar(), scGondowanCavePushPillar(), scLunpaFortressPushCrates(), scMercuryLighthousePushGateSwitchStatue(), scMercuryLighthousePushRowStatue(), scMercuryLighthousePushUpperGateSwitchStatue(), scTunnelRuinsPushCarvedStone(), scTunnelRuinsPushDousePillar(), scTunnelRuinsPushEastPillar(), scTunnelRuinsPushFirstPillars(), scTunnelRuinsPushLadyStatue(), scTunnelRuinsPushNorthwestSinkingPillar(), scTunnelRuinsPushSecondPillars(), scTunnelRuinsPushSmallPillars(), scTunnelRuinsPushSoutheastSinkingPillar(), scValeCavePushEastCratesIntoWater() and scValePushPillar().

Definition at line 57 of file pushed_actor.c.

scPushedActorStopBlockedMotion

static UNREAD_RESULT scPushedActorStopBlockedMotion(ACTOR *actor)

The leader's update function while pushing a large thing: stop the leader when another actor that is not a large thing, or a wall, is in the way.

References fdActorStepFrom(), PushedActorDirectionSteps, PushedActorRectangleKinds, scFieldActorCheckMovementCollision(), scPushedActorFindAtTile() and Sint32.

Referenced by scPushedActorRoll().

Definition at line 122 of file pushed_actor.c.

scPushedActorFindLargeThingAhead

static ACTOR *scPushedActorFindLargeThingAhead(Sint32 *direction, Sint32 *slot, Sint32 *rectangle)

Returns the large thing whose rectangle covers the metatile ahead of the leader (the leader not standing in line with its first column or row), with the leader's direction, its actor id and its rectangle; or NULL.

References fdActorGetById(), PushedActorDirectionSteps, PushedActorRectangleKinds, PushedActorRectangles, Sint32 and state.

Referenced by scPushedActorFindClearPos().

Definition at line 166 of file pushed_actor.c.

scPushedActorFindClearPos

static Sint32 scPushedActorFindClearPos(PUSHED_ACTOR_PROBE *probe)

Finds where the large thing ahead of the leader would roll to: step its rectangle on, a metatile at a time the way the leader faces, until a metatile of it meets something (a collision result of 2). Fills probe with the thing, its rectangle and that position; returns 0 when there is no thing or it cannot move.

References PushedActorDirectionSteps, PushedActorRectangles, scFieldActorCheckMovementCollision(), scPushedActorFindLargeThingAhead(), Sint32 and width.

Referenced by scCrossboneIsleSteppingStonesPushSinkingBoulder(), scCrossboneIsleSteppingStonesRollColumnOrLog(), scKolimaForestCliffPushLog(), scKolimaForestEntrancePushLog(), scKolimaForestGladePushLog(), scMercuryLighthousePushChannelPipes(), scMercuryLighthousePushJetRoomPipes(), scMercuryLighthousePushSpoutAndNorthJetPipes(), scMogallForestFirstAreaPushLog(), scMogallForestSecondAreaPushLog(), scMogallForestThirdAreaPushLog(), scPushedActorPushIfClear(), scValeCavePushLogNorth() and scValeCavePushLogOverEdge().

Definition at line 236 of file pushed_actor.c.

scPushedActorRoll

static void scPushedActorRoll(PUSHED_ACTOR_PROBE probe)

Rolls the large thing to the position probe found: the leader pushes, the thing rolls (its sheet's animation 3 or 2, by the direction) with SE_HEAVY_MOVE while the leader follows half a metatile, and it stops with SE_STOP_ACTION_SE and SE_HEAVY_STOP. Its metatiles are blocked (METATILE_BEHAVIOR_WALL) at its new place, through the map grid's layer 1 offset, and its old place is given back what was under it.

References fdActorGetById(), fdActorSelectAnimation(), fdActorSetAnimation(), fdActorSetDestinationOffsetById(), fdActorWaitForMove(), fdActorWaitForMoveById(), fdMapGridCopyMetatileAttributeRect(), fdMapGridCopyMetatileAttributes(), fdPlayQueuedMusic(), fdScriptWait(), PushedActorDirectionSteps, PushedActorRectangles, scFieldActorSetMoveTargetFX(), scMapGridFillCollisionRectangle(), scPushedActorStopBlockedMotion(), Sint32, state and sySoundPlay().

Referenced by scCrossboneIsleSteppingStonesPushSinkingBoulder(), scCrossboneIsleSteppingStonesRollColumnOrLog(), scKolimaForestCliffPushLog(), scKolimaForestEntrancePushLog(), scKolimaForestGladePushLog(), scMercuryLighthousePushChannelPipes(), scMercuryLighthousePushJetRoomPipes(), scMercuryLighthousePushSpoutAndNorthJetPipes(), scMogallForestFirstAreaPushLog(), scMogallForestSecondAreaPushLog(), scMogallForestThirdAreaPushLog(), scPushedActorPushIfClear(), scValeCavePushLogNorth() and scValeCavePushLogOverEdge().

Definition at line 340 of file pushed_actor.c.

scPushedActorBlockFootprint

static Sint32 scPushedActorBlockFootprint(Sint32 id)

Blocks large thing id's metatiles (METATILE_BEHAVIOR_WALL) where it stands, through the map grid's layer 1 offset; returns 0 when its sprite is no large thing.

References fdActorGetById(), fdMapGridCopyMetatileAttributeRect(), PushedActorRectangleKinds, PushedActorRectangles, scMapGridFillCollisionRectangle(), Sint32 and width.

Referenced by scAltmillerCaveBlockFallenColumnMetatiles(), scInit() and scValeCaveApplyEntryState().

Definition at line 505 of file pushed_actor.c.

Variables in detail

PushedActorRectangles

extern PUSHED_ACTOR_RECTANGLE PushedActorRectangles[]

Referenced by PUSHED_ACTOR_TABLE_SECTION, scCrossboneIsleSteppingStonesQueryCoveredMetatiles(), scPushedActorBlockFootprint(), scPushedActorFindClearPos(), scPushedActorFindLargeThingAhead() and scPushedActorRoll().

Definition at line 20 of file pushed_actor.c.