climbing.c
Jumping and climbing on the field.
games/tbs/src/object/psynergy_effects/climbing.c on GitHub
Jumping and climbing on the field. Part of psynergy_effects.c, compiled only through it.
Functions
Field_TryJumpForward
s32 Field_TryJumpForward(void)
Makes the leader jump two tiles forward, over the tile in front, when the map allows it (Map_CheckObjectStep). On a platform object (sprite 207 or 205) the platform plays its animation 7 and the leader bobs down 2 pixels and back. Each jump adds two tiles to work->walkingDistance, as walking them would, and the leader keeps jumping while it lands on another jump spot (collision 0xf9). Returns 0 after a jump, -1 when the leader cannot jump; a chain that is blocked after its first jump also returns -1, with the leader standing on the jump spot it reached.
Called by Field_RunPushTileEvent when the leader has pushed against a jump spot (0xf9 or 0xfe) for more than 12 frames, and by the gap jumps of Goma Cave's pillar and Kolima Forest's bend, which import it. Moves the leader, and takes the field over between FieldEvent_Begin and FieldEvent_End.
Used by Event_JumpGapWest, Field_RunPushTileEvent, KolimaForestBend_JumpSouth.
Field_ClimbDown
s32 Field_ClimbDown(void)
Climbing down (the player presses down at a climbable wall). On the ground, when the cell south of the leader's is the same climbable cell, the leader turns round, grabs the wall and climbs down onto it (climbing pose 13). While climbing, the leader lets go and drops to the ground. Returns 0, or -1 when there is nothing to climb or the way is blocked by a wall cell.
Called by Field_RunPushTileEvent for a climbing spot (0xfd) with Down held, and imported by the scenes with ladders and climbable walls (Babi's Lighthouse, Crossbone Isle, Tolbi's ship and others). Sets gGameState.movementMode: 1 while the leader is on the wall, 0 off it.
Used by BabiLighthouse_ClimbDownOrAdvancePair, BabiLighthouse_ClimbOrAdvancePair, Event_PushOrClimbDown, Field_RunPushTileEvent, TolbiShipMast_ClimbDownLadder.
Field_ClimbUp
s32 Field_ClimbUp(void)
Climbing up (the player presses up at a climbable wall). On the ground, when the cell north of the leader's is the same climbable cell, the leader jumps onto the wall and holds on (climbing pose 12). While climbing, the leader climbs over the top onto the ground. Returns 0, or -1 when there is nothing to climb or the way is blocked by a wall cell.
Called by Field_RunPushTileEvent for a climbing spot (0xfd) with Up held, and imported by the scenes with ladders and climbable walls (Babi's Lighthouse, Colosso, Crossbone Isle and others). Sets gGameState.movementMode as Field_ClimbDown does.
Used by BabiLighthouse_ClimbOrAdvancePair, Event_ClimbUp, Event_TalkToFreeClimbAttendant, Event_TalkToWallAttendant, Field_RunPushTileEvent, TolbiShipMast_Initialize.
Macros, without a comment: TILE_CELLS, TILE_CELLS_SOUTH, TILE_CELLS_NORTH.