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