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