Skip to Content
The Alchemy Project

src/field/script_commands_climbing.c

Jumping, climbing and stepping onto and off ropes and tightropes. More…

Included by script_commands.c.

Macros

NameDescription
#defineMETATILE_MIDDLE (pixels)The middle pixel of the map metatile a whole pixel lies in.
#defineROPE_NODE_REACH 32How near a rope or tightrope node must be for the leader to hop onto it, in pixels.

Functions

NameDescription
BoolfdMapGridBlocksJump (ACTOR *actor, Sint32 *pos)Whether the ground at position stops a jump: anything but flat ground or a plain slope (TERRAIN_FLAT to TERRAIN_SLOPE_Y) on a field map; never on the world map or with no map.
Sint32fdTryJumpForward (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.
Sint32fdClimbDown (void)Climbs down onto the wall below the leader, as The Broken Seal's fdClimbDown does, or lets go and falls when it cannot.
Sint32fdClimbUp (void)Climbs up the wall in front of the leader, as The Broken Seal's fdClimbUp does.
ROPE_NODE *fdRopeFindNodeNear (Sint32 *position)Returns the nearest crossable rope node within reach of position, or NULL.
BoolfdLeaderStepOntoRope (void)Hops the leader onto the nearest crossable rope node, to cross the rope (LEADER_MOVEMENT_ROPE); returns 0 when none is in reach.
BoolfdLeaderStepOffRope (void)Hops the leader off a tied rope a metatile in the direction the pad holds, when that metatile is open; returns 0 otherwise.
TIGHTROPE_NODE *fdTightropeFindNodeNear (Sint32 *position)Returns the nearest crossable tightrope node within reach of position, or NULL.
BoolfdLeaderStepOntoTightrope (void)Hops the leader onto the nearest crossable tightrope node (LEADER_MOVEMENT_TIGHTROPE); returns 0 when none is in reach.
BoolfdLeaderStepOffTightrope (void)Hops the leader off a tightrope a metatile in the direction the pad holds, when that metatile is open; returns 0 otherwise.

Description

Jumping, climbing and stepping onto and off ropes and tightropes. Part of script_commands.c.

Macros in detail

METATILE_MIDDLE

#define METATILE_MIDDLE(pixels)

The middle pixel of the map metatile a whole pixel lies in.

Referenced by fdClimbDown() and fdClimbUp().

Definition at line 20 of file script_commands_climbing.c.

ROPE_NODE_REACH

#define ROPE_NODE_REACH 32

How near a rope or tightrope node must be for the leader to hop onto it, in pixels.

Referenced by fdRopeFindNodeNear() and fdTightropeFindNodeNear().

Definition at line 461 of file script_commands_climbing.c.

Functions in detail

fdMapGridBlocksJump

Bool fdMapGridBlocksJump(ACTOR *actor, Sint32 *pos)

Whether the ground at position stops a jump: anything but flat ground or a plain slope (TERRAIN_FLAT to TERRAIN_SLOPE_Y) on a field map; never on the world map or with no map.

References fdMapGridGetTerrainKindStub() and Sint32.

Referenced by fdTryJumpForward().

Definition at line 7 of file script_commands_climbing.c.

fdTryJumpForward

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. A log underfoot (a SPRITE_LOG_WEST_EAST or SPRITE_LOG_NORTH_SOUTH under the party) dips 2 pixels with the leader. Each jump adds to the walking distance, and the leader keeps jumping while it lands on METATILE_BEHAVIOR_JUMP_FORWARD. Returns 0 after a jump, -1 when the leader cannot jump.

References fdActorFindNearestFacingTarget(), fdActorGetById(), fdActorMoveToAndWaitById(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorSpawnWaterSplashStub(), fdMapGridBlocksJump(), fdMapGridCheckCollisionStub(), fdMapGridGetMetatileBehaviorAtStub(), fdScriptEnd(), fdScriptStart(), MainRoutineStateWork, MapGridMetatileBuffer, result, Sint32, sySoundPlayStub(), sySynch() and syVectorAddPolarOffset().

Referenced by fdRunPushMetatile(), scAncientLemuriaJumpForward(), scAncientLemuriaMeetTheLemurians(), scAnemosInnerSanctumDullahanStepWhilePushing(), scApojiiIslandsJumpForward(), scAquaRockInsideJumpForward(), scCrumblingPillarStep(), scCrumblingPillarStepWithStandIn(), scDailaJumpForward(), scDailaRoomsJumpForward(), scIsletsJumpForward(), scJupiterLighthouseJumpForward(), scJupiterLighthouseJumpOrPushBlock(), scKibomboJumpForward(), scKibomboMountainsJumpForward(), scLeaderCheckCrumblingStep(), scMagmaRockInsideStepOnTrap(), scMagmaRockStepOnCrumblingPillar(), scMagmaRockStepOnTrap(), scMarsLighthouseEntranceJumpOrSlide(), scMarsLighthouseTowersJumpGap(), scMarsLighthouseTowersJumpGapOrPushStone(), scMarsLighthouseTowersPushPipeOrJump(), scShamanVillageCaveJumpForward(), scTaopoSwampJumpForward(), scTreasureIsleJumpForward(), scTrialRoadJumpAcrossGap(), scTrialRoadJumpForward(), scTrialRoadJumpMeltedPuddle(), scTrialRoadLandOnPillar() and scTrialRoadStepOnTrap().

Definition at line 31 of file script_commands_climbing.c.

fdClimbDown

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.

References fdActorFaceDirectionById(), fdActorGetById(), fdActorMoveToAndWaitById(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorWaitForMoveById(), fdActorWaitForScriptEndById(), fdCheckSpheresOverlapStub(), fdMapGridGetTerrainHeightStub(), fdMapGridIsWallAtStub(), fdScriptEnd(), fdScriptStart(), fdScriptWait(), MainRoutineStateWork and Sint32.

Referenced by fdRunPushMetatile() and scTrialRoadPushEastLogSouthOrClimbDown().

Definition at line 228 of file script_commands_climbing.c.

fdClimbUp

Sint32 fdClimbUp(void)

Climbs up the wall in front of the leader, as The Broken Seal's fdClimbUp does.

References fdActorGetById(), fdActorMoveToAndWaitById(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorWaitForMoveById(), fdCheckSpheresOverlapStub(), fdMapGridGetTerrainHeightStub(), fdMapGridIsWallAtStub(), fdScriptEnd(), fdScriptStart(), fdScriptWait(), MainRoutineStateWork, result, Sint32 and sySynch().

Referenced by fdRunPushMetatile().

Definition at line 341 of file script_commands_climbing.c.

fdRopeFindNodeNear

ROPE_NODE *fdRopeFindNodeNear(Sint32 *position)

Returns the nearest crossable rope node within reach of position, or NULL.

References result and Sint32.

Referenced by fdLeaderStepOntoRope().

Definition at line 464 of file script_commands_climbing.c.

fdLeaderStepOntoRope

Bool fdLeaderStepOntoRope(void)

Hops the leader onto the nearest crossable rope node, to cross the rope (LEADER_MOVEMENT_ROPE); returns 0 when none is in reach.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorWaitForMoveStub(), fdRopeFindNodeNear(), MainRoutineStateWork and sySoundPlayStub().

Referenced by fdEngineRun().

Definition at line 509 of file script_commands_climbing.c.

fdLeaderStepOffRope

Bool fdLeaderStepOffRope(void)

Hops the leader off a tied rope a metatile in the direction the pad holds, when that metatile is open; returns 0 otherwise.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorWaitForMoveStub(), fdMapGridCheckCollisionStub(), fdMapGridGetTerrainKindAtStub(), MainRoutineStateWork, PerWork, RopeKeyHeadings, sySoundPlayStub() and syVectorAddPolarOffset().

Referenced by fdEngineRun().

Definition at line 540 of file script_commands_climbing.c.

fdTightropeFindNodeNear

TIGHTROPE_NODE *fdTightropeFindNodeNear(Sint32 *position)

Returns the nearest crossable tightrope node within reach of position, or NULL.

References result and Sint32.

Referenced by fdLeaderStepOntoTightrope().

Definition at line 581 of file script_commands_climbing.c.

fdLeaderStepOntoTightrope

Bool fdLeaderStepOntoTightrope(void)

Hops the leader onto the nearest crossable tightrope node (LEADER_MOVEMENT_TIGHTROPE); returns 0 when none is in reach.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorWaitForMoveStub(), fdTightropeFindNodeNear(), MainRoutineStateWork and sySoundPlayStub().

Referenced by fdEngineRun().

Definition at line 626 of file script_commands_climbing.c.

fdLeaderStepOffTightrope

Bool fdLeaderStepOffTightrope(void)

Hops the leader off a tightrope a metatile in the direction the pad holds, when that metatile is open; returns 0 otherwise.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorWaitForMoveStub(), fdMapGridCheckCollisionStub(), fdMapGridGetTerrainKindAtStub(), MainRoutineStateWork, PerWork, RopeKeyHeadings, sySoundPlayStub() and syVectorAddPolarOffset().

Referenced by fdEngineRun().

Definition at line 658 of file script_commands_climbing.c.