a good point with grinds
[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_air_to_grind,
18 k_skate_activity_ground,
19 k_skate_activity_undefined,
20 k_skate_activity_grind_any,
21 k_skate_activity_grind_boardslide,
22 k_skate_activity_grind_back50,
23 k_skate_activity_grind_front50,
24 k_skate_activity_grind_5050
25 }
26 activity,
27 activity_prev;
28
29 float /* steery,
30 steerx,
31 steery_s,
32 steerx_s, */
33 reverse,
34 slip;
35
36 int manual_direction;
37
38 /* tricks */
39 v3f flip_axis;
40 float flip_time,
41 flip_rate;
42
43 v3f trick_vel, /* measured in units of TAU/s */
44 trick_euler; /* measured in units of TAU */
45 float trick_time;
46 float gravity_bias;
47
48 v3f up_dir;
49 v3f head_position;
50
51 v3f throw_v;
52 v3f cog_v, cog;
53
54 float grabbing;
55 v2f grab_mouse_delta;
56
57 int charging_jump, jump_dir;
58 float jump_charge,
59 slap;
60
61 double jump_time;
62 double start_push,
63 cur_push;
64
65 v3f prev_pos;
66
67 /* initial launch conditions */
68 double air_start;
69 v3f air_init_v,
70 air_init_co;
71
72 v4f smoothed_rotation;
73 }
74 state,
75 state_gate_storage;
76
77
78 /* animation /audio */
79 struct skeleton_anim *anim_stand, *anim_highg, *anim_slide,
80 *anim_air, *anim_grind, *anim_grind_jump,
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_grind,
93 blend_grind_balance,
94 blend_stand,
95 blend_push,
96 blend_jump,
97 blend_airdir,
98 blend_weight;
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 int wheel_contacts[2];
108 float sample_change_cooldown;
109
110 enum {
111 k_skate_sample_concrete,
112 k_skate_sample_wood,
113 k_skate_sample_concrete_scrape_metal,
114 k_skate_sample_concrete_scrape_wood,
115 k_skate_sample_metal_scrape_generic
116 }
117 main_sample_type;
118
119 /*
120 * Physics
121 * ----------------------------------------------------
122 */
123
124 float substep,
125 substep_delta;
126
127 struct jump_info
128 {
129 v3f log[50];
130 v3f n;
131 v3f apex;
132 v3f v;
133
134 float gravity;
135
136 int log_length;
137 float score,
138 land_dist;
139
140 enum prediction_type
141 {
142 k_prediction_none,
143 k_prediction_unset,
144 k_prediction_land,
145 k_prediction_grind
146 }
147 type;
148
149 u32 colour;
150 }
151 possible_jumps[36];
152 u32 possible_jump_count;
153
154 float land_dist;
155 v3f land_normal;
156
157 v3f surface_picture,
158 weight_distribution,
159 grind_vec,
160 grind_dir;
161
162 u32 grind_cooldown,
163 surface_cooldown;
164
165 float grind_strength;
166
167 struct grind_limit
168 {
169 v3f ra, n;
170 float p;
171 }
172 limits[3];
173 u32 limit_count;
174 };
175
176 VG_STATIC void player__skate_bind ( player_instance *player );
177 VG_STATIC void player__skate_pre_update ( player_instance *player );
178 VG_STATIC void player__skate_update ( player_instance *player );
179 VG_STATIC void player__skate_post_update ( player_instance *player );
180 VG_STATIC void player__skate_im_gui ( player_instance *player );
181 VG_STATIC void player__skate_animate ( player_instance *player,
182 player_animation *anim );
183 VG_STATIC void player__skate_post_animate ( player_instance *player );
184 VG_STATIC void player__skate_reset ( player_instance *player,
185 ent_spawn *rp );
186
187 VG_STATIC void player__skate_clear_mechanics( player_instance *player );
188 VG_STATIC void player__skate_reset_animator( player_instance *player );
189 VG_STATIC void player__approximate_best_trajectory( player_instance *player );
190 #endif /* PLAYER_SKATE_H */