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