src/field/field_move_by_keys.c
Moving actors by the direction pad: the party's keys, crossing a rope or a tightrope, and moving as Sand, on a map and on the world map. More…
Included by field.c.
Macros
| Name | Description | |
|---|---|---|
#define | SAND_ANIMATION_MOVE 1 | SPRITE_SAND_RIPPLE's animations, the leader as Sand: the mound of sand shifting as it moves, and standing upright as it climbs a face. |
#define | SAND_ANIMATION_CLIMB 3 | |
#define | SAND_PUFF_ANIMATION_THIN 1 | The puff of sand the leader leaves behind, thinning away over 64 ticks (SPRITE_SAND_PUFF), and a grain dropping off as he climbs, a cloud that scatters into specks over 48 ticks (SPRITE_DUST_CLOUD). |
#define | DUST_CLOUD_ANIMATION_SCATTER 2 | |
#define | SAND_PUFF_INTERVAL 5 | Ticks between the puffs the leader leaves while he moves as Sand (actor->sandPuffTimer). |
#define | ROPE_STEP_REACH 32 | How near, in pixels, the node the leader steps to on a rope or tightrope lies to his step. |
#define | SET_CLIMB_STEP (probe, actor, angle) | Sets probe to the place 8 pixels toward angle from an actor climbing a wall, the step's depth turned into height. |
#define | CLIMB_STEP_IS_CLEAR (actor, probe, angle) | Whether an actor climbing a wall can step 8 pixels toward angle. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdActorMoveByKeys (ACTOR *actor) | SC_KEYS (LEADER_MOVEMENT_KEYS), the leader's control on a climbable wall: moves it 8 pixels at a time by the direction pad, up and down changing its height rather than its depth, reaching east or west as it goes and clinging while the pad is not held. |
Sint32 | fdActorCrossRope (ACTOR *actor) | SC_ROPE (LEADER_MOVEMENT_ROPE), the leader crossing a tied rope hand over hand: the pad moves him from node to node along it, a half metatile a step, and sets the rope swinging. |
Sint32 | fdActorCrossTightrope (ACTOR *actor) | SC_TIGHTROPE (LEADER_MOVEMENT_TIGHTROPE): fdActorCrossRope on a tightrope, which the leader walks, the rope wobbling under him. |
void | fdSandJitterGrain (ACTOR *actor) | Update of a grain the Sand leaves as the leader moves: it turns and jitters sideways at random. |
Bool | fdSandCheckEndKeys (ACTOR *actor) | Whether the player ends Sand: when the Select, A or Start keys are pressed, plays SE_MENU_CANCEL where the leader is blocked (fdActorCheckBlockedStub), and otherwise, while FLAG_SAND_CANNOT_END is clear, asks for Sand again (ABILITY_SAND, packed), which ends it, and returns TRUE. |
Sint32 | fdActorMoveAsSand (ACTOR *actor) | SC_SAND (LEADER_MOVEMENT_SAND): the leader turned to sand by the Sand Psynergy, moved by the direction pad on a field map, leaving puffs of sand; up against a face, or down at a drop, he climbs it as sand. |
Sint32 | fdActorMoveAsSandOnWorldMap (ACTOR *actor) | SC_WORLD_SAND (LEADER_MOVEMENT_WORLD_SAND): the leader as sand on the world map (the Sand Psynergy). |
Description
Moving actors by the direction pad: the party's keys, crossing a rope or a
tightrope, and moving as Sand, on a map and on the world map. Part of
field.c.
Macros in detail
SAND_ANIMATION_MOVE
#define SAND_ANIMATION_MOVE 1
SPRITE_SAND_RIPPLE's animations, the leader as Sand: the mound of sand
shifting as it moves, and standing upright as it climbs a face.
Referenced by fdActorMoveAsSand() and fdActorMoveAsSandOnWorldMap().
Definition at line 10 of file field_move_by_keys.c.
SAND_ANIMATION_CLIMB
#define SAND_ANIMATION_CLIMB 3
Referenced by fdActorMoveAsSand().
Definition at line 11 of file field_move_by_keys.c.
SAND_PUFF_ANIMATION_THIN
#define SAND_PUFF_ANIMATION_THIN 1
The puff of sand the leader leaves behind, thinning away over 64 ticks
(SPRITE_SAND_PUFF), and a grain dropping off as he climbs, a cloud that
scatters into specks over 48 ticks (SPRITE_DUST_CLOUD).
Referenced by fdActorMoveAsSand() and fdActorMoveAsSandOnWorldMap().
Definition at line 15 of file field_move_by_keys.c.
DUST_CLOUD_ANIMATION_SCATTER
#define DUST_CLOUD_ANIMATION_SCATTER 2
Referenced by fdActorMoveAsSand().
Definition at line 16 of file field_move_by_keys.c.
SAND_PUFF_INTERVAL
#define SAND_PUFF_INTERVAL 5
Ticks between the puffs the leader leaves while he moves as Sand (actor->sandPuffTimer).
Referenced by fdActorMoveAsSand() and fdActorMoveAsSandOnWorldMap().
Definition at line 19 of file field_move_by_keys.c.
ROPE_STEP_REACH
#define ROPE_STEP_REACH 32
How near, in pixels, the node the leader steps to on a rope or tightrope lies
to his step. The offsets are cut to 8.8 fixed point first, so syMulFX of one
with itself gives whole pixels squared.
Referenced by fdActorCrossRope() and fdActorCrossTightrope().
Definition at line 23 of file field_move_by_keys.c.
SET_CLIMB_STEP
#define SET_CLIMB_STEP(probe, actor, angle)
Sets probe to the place 8 pixels toward angle from an actor climbing a wall, the step's depth turned into height.
Referenced by fdActorMoveAsSand().
Definition at line 27 of file field_move_by_keys.c.
CLIMB_STEP_IS_CLEAR
#define CLIMB_STEP_IS_CLEAR(actor, probe, angle)
Whether an actor climbing a wall can step 8 pixels toward angle.
Referenced by fdActorMoveAsSand().
Definition at line 33 of file field_move_by_keys.c.
Functions in detail
fdActorMoveByKeys
Sint32 fdActorMoveByKeys(ACTOR *actor)
SC_KEYS (LEADER_MOVEMENT_KEYS), the leader's control on a climbable wall:
moves it 8 pixels at a time by the direction pad, up and down changing its
height rather than its depth, reaching east or west as it goes and clinging
while the pad is not held. Refuses a step into a wall, from or onto a
metatile that is not MAP_METATILE_CLIMBABLE, or onto ground too high (up) or
too low (down), and records the held keys in the field state. Returns 1.
References DebugMode, fdActorGetMetatileIndexStub(), fdActorSelectAnimation(), fdActorSetMoveTarget(), fdMapGridGetTerrainHeight(), fdMapGridIsWallAt(), PerWork, Sint32, syVectorAddPolarOffset() and WorldMapKeyHeadings.
Referenced by ActorScriptCommandTable.
Definition at line 43 of file field_move_by_keys.c.
fdActorCrossRope
Sint32 fdActorCrossRope(ACTOR *actor)
SC_ROPE (LEADER_MOVEMENT_ROPE), the leader crossing a tied rope hand over
hand: the pad moves him from node to node along it, a half metatile a step,
and sets the rope swinging.
References fdActorGetByIdStub(), fdActorSelectAnimation(), fdActorSetAnimationSpeed(), fdActorSetMoveTarget(), PerWork, Sint32, syVectorAddPolarOffset() and WorldMapKeyHeadings.
Referenced by ActorScriptCommandTable.
Definition at line 149 of file field_move_by_keys.c.
fdActorCrossTightrope
Sint32 fdActorCrossTightrope(ACTOR *actor)
SC_TIGHTROPE (LEADER_MOVEMENT_TIGHTROPE): fdActorCrossRope on a tightrope,
which the leader walks, the rope wobbling under him.
References fdActorSelectAnimation(), fdActorSetAnimationSpeed(), fdActorSetMoveTarget(), fdTurnToward(), PerWork, Sint32, syVectorAddPolarOffset() and WorldMapKeyHeadings.
Referenced by ActorScriptCommandTable.
Definition at line 291 of file field_move_by_keys.c.
fdSandJitterGrain
void fdSandJitterGrain(ACTOR *actor)
Update of a grain the Sand leaves as the leader moves: it turns and jitters sideways at random.
References syRandom().
Referenced by fdActorMoveAsSand().
Definition at line 420 of file field_move_by_keys.c.
fdSandCheckEndKeys
Bool fdSandCheckEndKeys(ACTOR *actor)
Whether the player ends Sand: when the Select, A or Start keys are pressed,
plays SE_MENU_CANCEL where the leader is blocked (fdActorCheckBlockedStub),
and otherwise, while FLAG_SAND_CANNOT_END is clear, asks for Sand again
(ABILITY_SAND, packed), which ends it, and returns TRUE.
References fdActorCheckBlockedStub(), MainRoutineStateWork, PerWork, syGameFlagGet() and sySoundPlayStub().
Referenced by fdActorMoveAsSand() and fdActorMoveAsSandOnWorldMap().
Definition at line 440 of file field_move_by_keys.c.
fdActorMoveAsSand
Sint32 fdActorMoveAsSand(ACTOR *actor)
SC_SAND (LEADER_MOVEMENT_SAND): the leader turned to sand by the Sand
Psynergy, moved by the direction pad on a field map, leaving puffs of sand;
up against a face, or down at a drop, he climbs it as sand.
References ActorSandPuffScript, DebugMode, fdActorCreate(), fdActorSelectAnimation(), fdActorSetMoveTarget(), fdActorStartScript(), fdMapGridCheckCollision(), fdMapGridCheckCollisionAt(), fdMapGridGetTerrainHeight(), fdMapGridIsClimbableMetatileStub(), fdSandCheckEndKeys(), fdSandJitterGrain(), fdSpriteStartAnimation(), fdTurnToward(), PerWork, SandGrainScript, Sint32, syRandom(), sySoundPlayStub(), sySquartFX(), syVectorAddPolarOffset(), TickCount and WorldMapKeyHeadings.
Referenced by ActorScriptCommandTable.
Definition at line 471 of file field_move_by_keys.c.
fdActorMoveAsSandOnWorldMap
Sint32 fdActorMoveAsSandOnWorldMap(ACTOR *actor)
SC_WORLD_SAND (LEADER_MOVEMENT_WORLD_SAND): the leader as sand on the world
map (the Sand Psynergy). Moves him on the world map by the direction pad at a
fixed pace (faster while L repeats), trying six turned headings when the way
is blocked, as fdActorMoveOnWorldMap does; records the held keys in the field
state and leaves a puff of sand (SPRITE_SAND_PUFF) behind it every fifth tick
it moves.
References ActorSandPuffScript, DebugMode, fdActorCreate(), fdActorSelectAnimation(), fdActorSetMoveTarget(), fdActorStartScript(), fdSandCheckEndKeys(), fdSpriteStartAnimation(), fdTurnToward(), fdWorldMapGetCollision(), fdWorldMapIsWalkable(), PerWork, Sint32, sySquartFX(), syVectorAddPolarOffset(), WorldMapKeyHeadings and WorldMapKeyYaws.
Referenced by ActorScriptCommandTable.
Definition at line 815 of file field_move_by_keys.c.