summaryrefslogtreecommitdiff
path: root/platformer/src/player.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--platformer/src/player.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/platformer/src/player.h b/platformer/src/player.h
index 035a344..b39f4c5 100644
--- a/platformer/src/player.h
+++ b/platformer/src/player.h
@@ -36,7 +36,8 @@
* float forward_speed; ground speed along facing_yaw, m/s (>= 0)
* PlayerState state;
* bool heightened_movement; on for PLAYER_SECOND_JUMP_WINDOW s after
- * landing a normal or retreat jump, and for the
+ * any landing except the second jump's (normal
+ * or retreat jump, or a plain fall), and for the
* whole second jump, retreat jump, wall hang and
* every wall jump (NOT a plain first jump). On the ground, A gives the second
* jump; in the air, it lets the player wall hang.
@@ -51,6 +52,9 @@
* float skid_speed; forward_speed when the skid began
* float skid_yaw; direction the skid slides (the old run
* direction; the player already faces the stick)
+ * float visual_offset; m the drawn height is off the body's feet after a
+ * stair step (physics steps instantly; this eases
+ * back to 0 at STEP_SMOOTH_RATE so it looks smooth)
* float jump_buffer; s left on the last A press: while > 0, the first
* moment a jump is possible, it happens
* float wall_time; s since the current wall hang began
@@ -67,6 +71,9 @@
* void player_init(Player *p, Vec3 spawn);
* void player_reset(Player *p, Vec3 spawn);
* void player_update(Player *p, const Input *in, float camera_yaw, float dt);
+ * Vec3 player_visual_pos(const Player *p);
+ * Where to DRAW the player and point the camera: body.pos,
+ * but with stair steps smoothed out (see visual_offset).
* camera_yaw is a plain float so player.c doesn't depend on camera.h.
* const char *player_state_name(PlayerState s); "IDLE", "RUN", ... for debug
*
@@ -122,6 +129,7 @@ typedef struct Player {
float skid_time; /* s since the current skid began */
float skid_speed; /* forward_speed when the skid began */
float skid_yaw; /* direction the skid slides; facing_yaw already points at the stick */
+ float visual_offset; /* m the drawn/followed height lags the body after stair steps; eases to 0 */
float jump_buffer; /* s left on the last A press; a jump fires as soon as one is possible */
float wall_time; /* s since the current wall hang began */
float wall_jump_yaw; /* a wall jump's launch direction: the approach mirrored off the wall */
@@ -133,6 +141,7 @@ typedef struct Player {
void player_init(Player *p, Vec3 spawn);
void player_reset(Player *p, Vec3 spawn);
void player_update(Player *p, const Input *in, float camera_yaw, float dt);
+Vec3 player_visual_pos(const Player *p);
const char *player_state_name(PlayerState s);
#endif /* PLAYER_H */