commit
[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_metallic,
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 reverse,
31 slip;
32
33 int manual_direction;
34
35 /* tricks */
36 v3f flip_axis;
37 float flip_time,
38 flip_rate;
39
40 v3f trick_vel, /* measured in units of TAU/s */
41 trick_euler; /* measured in units of TAU */
42 float trick_time;
43 float gravity_bias;
44
45 v3f up_dir;
46 v3f head_position;
47
48 v3f throw_v;
49 v3f cog_v, cog;
50
51 float grabbing;
52 v2f grab_mouse_delta;
53
54 int charging_jump, jump_dir;
55 float jump_charge,
56 slap;
57
58 double jump_time;
59 double start_push,
60 cur_push;
61
62 v3f prev_pos;
63
64 /* initial launch conditions */
65 double air_start;
66 v3f air_init_v,
67 air_init_co;
68
69 v4f smoothed_rotation;
70 }
71 state,
72 state_gate_storage;
73
74 /* animation /audio */
75 struct skeleton_anim *anim_stand, *anim_highg, *anim_slide,
76 *anim_air, *anim_grind, *anim_grind_jump,
77 *anim_push, *anim_push_reverse,
78 *anim_ollie, *anim_ollie_reverse,
79 *anim_grabs, *anim_stop;
80 v3f
81 board_trick_residualv,
82 board_trick_residuald;
83
84 float blend_slide,
85 blend_z,
86 blend_x,
87 blend_fly,
88 blend_grind,
89 blend_grind_balance,
90 blend_stand,
91 blend_push,
92 blend_jump,
93 blend_airdir,
94 blend_weight,
95 subslap;
96
97 /* vectors representing the direction of the axels in localspace */
98 v3f truckv0[2];
99 v2f wobble;
100
101 audio_channel *aud_main, *aud_slide, *aud_air;
102 enum mdl_surface_prop surface, audio_surface;
103
104 int wheel_contacts[2];
105 float sample_change_cooldown;
106
107 enum {
108 k_skate_sample_concrete,
109 k_skate_sample_wood,
110 k_skate_sample_concrete_scrape_metal,
111 k_skate_sample_concrete_scrape_wood,
112 k_skate_sample_metal_scrape_generic
113 }
114 main_sample_type;
115
116 player_pose holdout;
117
118 /*
119 * Physics
120 * ----------------------------------------------------
121 */
122
123 float substep,
124 substep_delta;
125
126 struct jump_info
127 {
128 v3f log[50];
129 v3f n;
130 v3f apex;
131 v3f v;
132
133 float gravity;
134
135 int log_length;
136 float score,
137 land_dist;
138
139 enum prediction_type
140 {
141 k_prediction_none,
142 k_prediction_unset,
143 k_prediction_land,
144 k_prediction_grind
145 }
146 type;
147
148 u32 colour;
149 }
150 possible_jumps[36];
151 u32 possible_jump_count;
152
153 float land_dist;
154 v3f land_normal;
155
156 v3f surface_picture,
157 weight_distribution,
158 grind_vec,
159 grind_dir;
160
161 u32 grind_cooldown,
162 surface_cooldown;
163
164 float grind_strength;
165
166 struct grind_limit
167 {
168 v3f ra, n;
169 float p;
170 }
171 limits[3];
172 u32 limit_count;
173 };
174
175 VG_STATIC void player__skate_bind ( player_instance *player );
176 VG_STATIC void player__skate_pre_update ( player_instance *player );
177 VG_STATIC void player__skate_update ( player_instance *player );
178 VG_STATIC void player__skate_post_update ( player_instance *player );
179 VG_STATIC void player__skate_im_gui ( player_instance *player );
180 VG_STATIC void player__skate_animate ( player_instance *player,
181 player_animation *anim );
182 VG_STATIC void player__skate_post_animate ( player_instance *player );
183 VG_STATIC void player__skate_reset ( player_instance *player,
184 ent_spawn *rp );
185
186 VG_STATIC void player__skate_clear_mechanics( player_instance *player );
187 VG_STATIC void player__skate_reset_animator( player_instance *player );
188 VG_STATIC void player__approximate_best_trajectory( player_instance *player );
189 #endif /* PLAYER_SKATE_H */