d4900dd8d24fa476109236aa224192428cf9046b
[carveJwlIkooP6JGAAIwe30JlM.git] / player_skate.h
1 #ifndef PLAYER_SKATE_H
2 #define PLAYER_SKATE_H
3
4 #include "player_api.h"
5
6 #define SKATE_CCD
7
8 typedef struct jump_info jump_info;
9
10 struct player_skate
11 {
12 struct
13 {
14 enum skate_activity
15 {
16 k_skate_activity_air,
17 k_skate_activity_ground,
18 k_skate_activity_undefined,
19 k_skate_activity_grind_any,
20 k_skate_activity_grind_boardslide,
21 k_skate_activity_grind_noseslide,
22 k_skate_activity_grind_tailslide,
23 k_skate_activity_grind_back50,
24 k_skate_activity_grind_front50,
25 k_skate_activity_grind_5050
26 }
27 activity,
28 activity_prev;
29
30 float /* steery,
31 steerx,
32 steery_s,
33 steerx_s, */
34 reverse,
35 slip;
36
37 int manual_direction;
38
39 /* tricks */
40 v3f flip_axis;
41 float flip_time,
42 flip_rate;
43
44 v3f trick_vel, /* measured in units of TAU/s */
45 trick_euler; /* measured in units of TAU */
46 float trick_time;
47 float gravity_bias;
48
49 v3f up_dir;
50 v3f head_position;
51
52 int lift_frames;
53
54 v3f throw_v;
55 v3f cog_v, cog;
56
57 float grabbing;
58 v2f grab_mouse_delta;
59
60 int charging_jump, jump_dir;
61 float jump_charge;
62
63 double jump_time;
64 double start_push,
65 cur_push;
66
67 v3f prev_pos;
68
69 /* initial launch conditions */
70 double air_start;
71 v3f air_init_v,
72 air_init_co;
73 }
74 state,
75 state_gate_storage;
76
77
78 /* animation */
79 struct skeleton_anim *anim_stand, *anim_highg, *anim_slide,
80 *anim_air,
81 *anim_push, *anim_push_reverse,
82 *anim_ollie, *anim_ollie_reverse,
83 *anim_grabs, *anim_stop;
84 v3f
85 board_trick_residualv,
86 board_trick_residuald;
87
88 float blend_slide,
89 blend_z,
90 blend_x,
91 blend_fly,
92 blend_stand,
93 blend_push,
94 blend_jump,
95 blend_airdir,
96 blend_weight;
97
98 float slap;
99
100 /* vectors representing the direction of the axels in localspace */
101 v3f truckv0[2];
102 v2f wobble;
103
104 audio_channel *aud_main, *aud_slide, *aud_air;
105 enum mdl_surface_prop surface, audio_surface;
106
107 /*
108 * Physics
109 * ----------------------------------------------------
110 */
111
112 float substep,
113 substep_delta;
114
115 struct jump_info
116 {
117 v3f log[50];
118 v3f n;
119 v3f apex;
120 v3f v;
121
122 float gravity;
123
124 int log_length;
125 float score,
126 land_dist;
127
128 enum prediction_type
129 {
130 k_prediction_none,
131 k_prediction_unset,
132 k_prediction_land,
133 k_prediction_grind
134 }
135 type;
136
137 u32 colour;
138 }
139 possible_jumps[36];
140 u32 possible_jump_count;
141
142 float land_dist;
143 v3f land_normal;
144
145 v3f surface_picture,
146 weight_distribution,
147 grind_vec,
148 grind_dir;
149
150 u32 frames_since_activity_change;
151
152 float grind_strength;
153
154 struct grind_limit
155 {
156 v3f ra, n;
157 float p;
158 }
159 limits[3];
160 u32 limit_count;
161 };
162
163 VG_STATIC void player__skate_bind ( player_instance *player );
164 VG_STATIC void player__skate_pre_update ( player_instance *player );
165 VG_STATIC void player__skate_update ( player_instance *player );
166 VG_STATIC void player__skate_post_update ( player_instance *player );
167 VG_STATIC void player__skate_im_gui ( player_instance *player );
168 VG_STATIC void player__skate_animate ( player_instance *player,
169 player_animation *anim );
170 VG_STATIC void player__skate_post_animate ( player_instance *player );
171 VG_STATIC void player__skate_reset ( player_instance *player,
172 ent_spawn *rp );
173
174 VG_STATIC void player__skate_clear_mechanics( player_instance *player );
175 VG_STATIC void player__skate_reset_animator( player_instance *player );
176 VG_STATIC void player__approximate_best_trajectory( player_instance *player );
177 #endif /* PLAYER_SKATE_H */