Windows libraries for getaddrinfo
[carveJwlIkooP6JGAAIwe30JlM.git] / control_overlay.c
1 #include "control_overlay.h"
2 #include "model.h"
3 #include "input.h"
4 #include "player.h"
5 #include "player_skate.h"
6 #include "player_walk.h"
7 #include "shaders/model_menu.h"
8 #include "vg/vg_engine.h"
9 #include "vg/vg_mem.h"
10 #include "vg/vg_m.h"
11
12 struct control_overlay control_overlay = { .enabled = 1 };
13
14 static void render_overlay_mesh( enum control_overlay_mesh index )
15 {
16 mdl_draw_submesh( mdl_arritm( &control_overlay.mdl.submeshs, index ) );
17 }
18
19 void control_overlay_init(void)
20 {
21 void *alloc = vg_mem.rtmemory;
22 mdl_context *mdl = &control_overlay.mdl;
23
24 mdl_open( mdl, "models/rs_overlay.mdl", alloc );
25 mdl_load_metadata_block( mdl, alloc );
26 mdl_async_full_load_std( mdl );
27 mdl_close( mdl );
28
29 vg_async_stall();
30
31 if( mdl_arrcount( &mdl->textures ) )
32 {
33 mdl_texture *tex = mdl_arritm( &mdl->textures, 0 );
34 control_overlay.tex = tex->glname;
35 }
36 else
37 {
38 control_overlay.tex = vg.tex_missing;
39 vg_error( "No texture in control overlay\n" );
40 }
41
42 vg_console_reg_var( "control_overlay", &control_overlay.enabled,
43 k_var_dtype_i32, VG_VAR_PERSISTENT );
44 }
45
46 static void draw_key( bool press, bool wide )
47 {
48 if( wide ) render_overlay_mesh( press? ov_shift_down: ov_shift );
49 else render_overlay_mesh( press? ov_key_down: ov_key );
50 }
51
52 static void colorize( bool press, bool condition )
53 {
54 v4f cnorm = { 1,1,1,0.76f },
55 cdis = { 1,1,1,0.35f },
56 chit = { 1,0.5f,0.2f,0.8f };
57
58 if( condition )
59 if( press )
60 shader_model_menu_uColour( chit );
61 else
62 shader_model_menu_uColour( cnorm );
63 else
64 shader_model_menu_uColour( cdis );
65 }
66
67 void control_overlay_render(void)
68 {
69 if( !control_overlay.enabled ) return;
70 if( skaterift.activity != k_skaterift_default ) return;
71
72 glEnable(GL_BLEND);
73 glDisable(GL_DEPTH_TEST);
74 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
75 glBlendEquation(GL_FUNC_ADD);
76
77 m4x4f ortho;
78 f32 r = (f32)vg.window_x / (f32)vg.window_y,
79 fl = -r,
80 fr = r,
81 fb = 1.0f,
82 ft = -1.0f,
83 rl = 1.0f / (fr-fl),
84 tb = 1.0f / (ft-fb);
85
86 m4x4_zero( ortho );
87 ortho[0][0] = 2.0f * rl;
88 ortho[2][1] = 2.0f * tb;
89 ortho[3][0] = (fr + fl) * -rl;
90 ortho[3][1] = (ft + fb) * -tb;
91 ortho[3][3] = 1.0f;
92
93 v4f cnorm = { 1,1,1,0.76f },
94 cdis = { 1,1,1,0.35f },
95 chit = { 1,0.5f,0.2f,0.8f };
96
97 shader_model_menu_use();
98 shader_model_menu_uTexMain( 1 );
99 shader_model_menu_uPv( ortho );
100 shader_model_menu_uColour( cnorm );
101
102 mdl_context *mdl = &control_overlay.mdl;
103 mesh_bind( &mdl->mesh );
104 glActiveTexture( GL_TEXTURE1 );
105 glBindTexture( GL_TEXTURE_2D, control_overlay.tex );
106
107 enum player_subsystem subsytem = localplayer.subsystem;
108
109 m4x3f mmdl;
110 m4x3_identity( mmdl );
111
112 bool in_air = 0, grinding = 0;
113
114 if( subsytem == k_player_subsystem_walk )
115 in_air = player_walk.state.activity == k_walk_activity_air;
116 else if( subsytem == k_player_subsystem_skate )
117 in_air = player_skate.state.activity < k_skate_activity_ground;
118
119 grinding = (subsytem == k_player_subsystem_skate) &&
120 (player_skate.state.activity >= k_skate_activity_grind_any);
121
122 if( vg_input.display_input_method == k_input_method_controller )
123 {
124 bool press_jump = player_skate.state.jump_charge > 0.2f;
125 u8 lb_down = 0, rb_down = 0;
126 vg_exec_input_program( k_vg_input_type_button_u8,
127 (vg_input_op[]){
128 vg_joy_button, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, vg_end
129 }, &rb_down );
130 vg_exec_input_program( k_vg_input_type_button_u8,
131 (vg_input_op[]){
132 vg_joy_button, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, vg_end
133 }, &lb_down );
134 f32 lt_amt = 0.0f, rt_amt = 0.0f;
135 vg_exec_input_program( k_vg_input_type_axis_f32,
136 (vg_input_op[]){ vg_joy_axis, SDL_CONTROLLER_AXIS_TRIGGERLEFT, vg_end },
137 &lt_amt );
138 vg_exec_input_program( k_vg_input_type_axis_f32,
139 (vg_input_op[]){ vg_joy_axis, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, vg_end },
140 &rt_amt );
141
142 /* joystick L */
143 v2f steer;
144 joystick_state( k_srjoystick_steer, steer );
145
146 mmdl[3][0] = -r + 0.375f;
147 mmdl[3][2] = 1.0f - 0.375f;
148 shader_model_menu_uMdl( mmdl );
149
150 if( subsytem == k_player_subsystem_skate )
151 {
152 colorize( 0, 1 );
153 render_overlay_mesh( ov_ls_circ_skate );
154
155 colorize( steer[1]>=0.5f, press_jump );
156 render_overlay_mesh( ov_ls_circ_backflip );
157 colorize( steer[1]<=-0.5f, press_jump );
158 render_overlay_mesh( ov_ls_circ_frontflip );
159
160 colorize( steer[1] > 0.7f, !press_jump && !in_air );
161 render_overlay_mesh( ov_ls_circ_manual );
162 }
163 else if( subsytem == k_player_subsystem_walk )
164 {
165 colorize( 0, 1 );
166 render_overlay_mesh( ov_ls_circ_walk );
167 }
168
169 mmdl[3][0] += steer[0]*0.125f*0.75f;
170 mmdl[3][2] += steer[1]*0.125f*0.75f;
171
172 colorize( 0, 1 );
173 shader_model_menu_uMdl( mmdl );
174 render_overlay_mesh( ov_ls );
175
176 /* joystick R */
177 mmdl[3][0] = r - 0.375f;
178 mmdl[3][2] = 1.0f - 0.375f;
179 shader_model_menu_uMdl( mmdl );
180
181 if( subsytem == k_player_subsystem_skate )
182 {
183 colorize( rt_amt > 0.5f, in_air );
184 render_overlay_mesh( ov_rs_circ_grab );
185 colorize( 0, in_air );
186 }
187 else if( subsytem == k_player_subsystem_walk )
188 {
189 colorize( 0, 1 );
190 render_overlay_mesh( ov_rs_circ_look );
191 }
192
193 v2f jlook;
194 joystick_state( k_srjoystick_look, jlook );
195
196 mmdl[3][0] += jlook[0]*0.125f*0.75f;
197 mmdl[3][2] += jlook[1]*0.125f*0.75f;
198 shader_model_menu_uMdl( mmdl );
199 render_overlay_mesh( ov_rs );
200
201
202
203 /* LEFT UPPERS */
204 mmdl[3][0] = -r;
205 mmdl[3][2] = -1.0f;
206 shader_model_menu_uMdl( mmdl );
207
208 /* LB -------------------------------------------------------------- */
209
210 if( subsytem == k_player_subsystem_skate )
211 {
212 colorize( lb_down, !in_air );
213 render_overlay_mesh( ov_carve_l );
214 }
215 else
216 colorize( 0, 0 );
217
218 render_overlay_mesh( lb_down? ov_lb_down: ov_lb );
219
220 /* LT ---------------------------------------------------------------- */
221
222 if( subsytem == k_player_subsystem_skate )
223 {
224 colorize( 0, 0 );
225 }
226 else if( subsytem == k_player_subsystem_walk )
227 {
228 colorize( lt_amt>0.2f, 1 );
229 render_overlay_mesh( ov_lt_run );
230 }
231
232 render_overlay_mesh( ov_lt );
233
234 mmdl[3][2] += lt_amt*0.125f*0.5f;
235 shader_model_menu_uMdl( mmdl );
236 render_overlay_mesh( ov_lt_act );
237
238 /* RIGHT UPPERS */
239 mmdl[3][0] = r;
240 mmdl[3][2] = -1.0f;
241 shader_model_menu_uMdl( mmdl );
242
243 if( subsytem == k_player_subsystem_skate )
244 {
245 colorize( rb_down, !in_air );
246 render_overlay_mesh( ov_carve_r );
247 }
248 else
249 colorize( 0, 0 );
250
251 render_overlay_mesh( rb_down? ov_rb_down: ov_rb );
252
253 /* RT ---------------------------------------------------------------- */
254
255 if( subsytem == k_player_subsystem_skate )
256 {
257 colorize( rt_amt>0.2f, in_air );
258 render_overlay_mesh( ov_rt_grab );
259 colorize( rt_amt>0.2f, !in_air );
260 render_overlay_mesh( ov_rt_crouch );
261 colorize( rt_amt>0.2f, 1 );
262 }
263 else if( subsytem == k_player_subsystem_walk )
264 {
265 colorize( 0, 0 );
266 }
267
268 render_overlay_mesh( ov_rt );
269
270 mmdl[3][2] += rt_amt*0.125f*0.5f;
271 shader_model_menu_uMdl( mmdl );
272 render_overlay_mesh( ov_rt_act );
273
274 /* RIGHT SIDE BUTTONS */
275 bool press_a = 0, press_b = 0, press_x = 0, press_y = 0,
276 press_dpad_w = 0, press_dpad_e = 0, press_dpad_n = 0, press_dpad_s = 0,
277 press_menu = 0, press_back = 0;
278
279 vg_exec_input_program( k_vg_input_type_button_u8,
280 (vg_input_op[]){
281 vg_joy_button, SDL_CONTROLLER_BUTTON_A, vg_end }, &press_a );
282 vg_exec_input_program( k_vg_input_type_button_u8,
283 (vg_input_op[]){
284 vg_joy_button, SDL_CONTROLLER_BUTTON_B, vg_end }, &press_b );
285 vg_exec_input_program( k_vg_input_type_button_u8,
286 (vg_input_op[]){
287 vg_joy_button, SDL_CONTROLLER_BUTTON_X, vg_end }, &press_x );
288 vg_exec_input_program( k_vg_input_type_button_u8,
289 (vg_input_op[]){
290 vg_joy_button, SDL_CONTROLLER_BUTTON_Y, vg_end }, &press_y );
291 vg_exec_input_program( k_vg_input_type_button_u8,
292 (vg_input_op[]){
293 vg_joy_button, SDL_CONTROLLER_BUTTON_DPAD_LEFT, vg_end }, &press_dpad_w );
294 vg_exec_input_program( k_vg_input_type_button_u8,
295 (vg_input_op[]){
296 vg_joy_button, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, vg_end }, &press_dpad_e );
297 vg_exec_input_program( k_vg_input_type_button_u8,
298 (vg_input_op[]){
299 vg_joy_button, SDL_CONTROLLER_BUTTON_DPAD_UP, vg_end }, &press_dpad_n );
300 vg_exec_input_program( k_vg_input_type_button_u8,
301 (vg_input_op[]){
302 vg_joy_button, SDL_CONTROLLER_BUTTON_DPAD_DOWN, vg_end }, &press_dpad_s );
303 vg_exec_input_program( k_vg_input_type_button_u8,
304 (vg_input_op[]){
305 vg_joy_button, SDL_CONTROLLER_BUTTON_BACK, vg_end }, &press_back );
306 vg_exec_input_program( k_vg_input_type_button_u8,
307 (vg_input_op[]){
308 vg_joy_button, SDL_CONTROLLER_BUTTON_START, vg_end }, &press_menu );
309
310 mmdl[3][0] = r;
311 mmdl[3][2] = 0.0f;
312 shader_model_menu_uMdl( mmdl );
313
314 /* B / KICKFLIP / PUSH */
315 if( subsytem == k_player_subsystem_skate )
316 {
317 colorize( press_b, !in_air );
318 render_overlay_mesh( ov_text_b_push );
319 colorize( press_b, in_air );
320 render_overlay_mesh( ov_text_b_kickflip );
321 colorize( press_b, 1 );
322 }
323 else
324 {
325 colorize( 0, 0 );
326 }
327 render_overlay_mesh( press_b? ov_b_down: ov_b );
328
329 /* Y / SKATE / WALK / GLIDE */
330
331 if( subsytem == k_player_subsystem_skate )
332 {
333 if( localplayer.have_glider )
334 {
335 colorize( press_y, !in_air );
336 render_overlay_mesh( ov_text_y_walk_lwr );
337 colorize( press_y, in_air );
338 render_overlay_mesh( ov_text_y_glide );
339 }
340 else
341 {
342 colorize( press_y, 1 );
343 render_overlay_mesh( ov_text_y_walk );
344 }
345 }
346 else if( subsytem == k_player_subsystem_walk )
347 {
348 colorize( press_y, player_walk.state.activity < k_walk_activity_inone );
349 render_overlay_mesh( ov_text_y_skate );
350 }
351 else if( subsytem == k_player_subsystem_glide )
352 {
353 colorize( press_y, 1 );
354 render_overlay_mesh( ov_text_y_skate );
355 }
356 else
357 colorize( 0, 0 );
358 render_overlay_mesh( press_y? ov_y_down: ov_y );
359
360 /* X / TREFLIP */
361 if( subsytem == k_player_subsystem_skate )
362 {
363 colorize( press_x, in_air );
364 render_overlay_mesh( ov_text_x_treflip );
365 }
366 else
367 colorize( press_x, 0 );
368 render_overlay_mesh( press_x? ov_x_down: ov_x );
369
370 /* A / JUMP / SHUVIT */
371 if( subsytem == k_player_subsystem_skate )
372 {
373 colorize( press_a, !in_air );
374 render_overlay_mesh( ov_text_a_jump );
375 colorize( press_a, in_air );
376 render_overlay_mesh( ov_text_a_shuvit );
377 colorize( press_a, 1 );
378 }
379 else if( subsytem == k_player_subsystem_walk )
380 {
381 colorize( press_a, !in_air );
382 render_overlay_mesh( ov_text_a_jump_mid );
383 }
384 render_overlay_mesh( press_a? ov_a_down: ov_a );
385
386 /* JUMP CHARGE */
387 if( subsytem == k_player_subsystem_skate )
388 {
389 if( player_skate.state.jump_charge > 0.01f )
390 {
391 mmdl[0][0] = player_skate.state.jump_charge * 0.465193f;
392 mmdl[3][0] += -0.4375f;
393 mmdl[3][2] += 0.09375f;
394 shader_model_menu_uMdl( mmdl );
395 render_overlay_mesh( ov_jump_ind );
396 mmdl[0][0] = 1.0f;
397 }
398 }
399
400
401 /* DPAD --------------------------------------------------- */
402
403 mmdl[3][0] = -r;
404 mmdl[3][2] = 0.0f;
405 shader_model_menu_uMdl( mmdl );
406 colorize( 0, 1 );
407 render_overlay_mesh( ov_dpad );
408
409 colorize( press_dpad_e, 1 );
410 render_overlay_mesh( ov_text_de_camera );
411 if( press_dpad_e )
412 render_overlay_mesh( ov_dpad_e );
413
414 colorize( press_dpad_w, 1 );
415 render_overlay_mesh( ov_text_dw_rewind );
416 if( press_dpad_w )
417 render_overlay_mesh( ov_dpad_w );
418
419 if( subsytem == k_player_subsystem_dead )
420 {
421 colorize( press_dpad_n, 1 );
422 render_overlay_mesh( ov_text_dn_respawn );
423 }
424 else colorize( press_dpad_n, 0 );
425 if( press_dpad_n )
426 render_overlay_mesh( ov_dpad_n );
427
428 colorize( press_dpad_s, 0 );
429 if( press_dpad_s )
430 render_overlay_mesh( ov_dpad_s );
431
432
433 /* WEIGHT */
434 if( subsytem == k_player_subsystem_skate )
435 {
436 /* stored indicator text */
437 mmdl[3][0] = r -0.842671f;
438 mmdl[3][2] = -1.0f + 0.435484f;
439 colorize( 0, !in_air );
440 shader_model_menu_uMdl( mmdl );
441 render_overlay_mesh( ov_text_stored );
442
443 mmdl[0][0] = v3_length( player_skate.state.throw_v ) / k_mmthrow_scale;
444 shader_model_menu_uMdl( mmdl );
445 colorize( 0, !in_air );
446 render_overlay_mesh( ov_stored_ind );
447
448 static f32 collect = 0.0f;
449 collect = vg_lerpf( collect, player_skate.collect_feedback,
450 vg.time_frame_delta * 15.0f );
451 collect = vg_clampf( collect, 0.0f, 1.0f );
452
453 mmdl[0][0] = collect;
454 mmdl[3][2] += 0.015625f;
455 shader_model_menu_uMdl( mmdl );
456 render_overlay_mesh( ov_stored_ind );
457 }
458
459 mmdl[0][0] = 1.0f;
460 mmdl[3][0] = 0.0f;
461 mmdl[3][2] = -1.0f;
462 shader_model_menu_uMdl( mmdl );
463 colorize( press_menu, 1 );
464 render_overlay_mesh( press_menu? ov_met_r_down: ov_met_r );
465 render_overlay_mesh( ov_text_met_menu );
466
467 colorize( press_back, 0 );
468 render_overlay_mesh( press_back? ov_met_l_down: ov_met_l );
469
470 colorize( 0, 0 );
471 render_overlay_mesh( ov_met );
472 }
473 else
474 {
475 static v2f gd;
476 v2_lerp( gd, player_skate.state.grab_mouse_delta, vg.time_frame_delta*20.0f, gd );
477
478 /* CTRL || CARVE */
479 if( subsytem == k_player_subsystem_skate )
480 {
481 bool press_ctrl = vg_getkey(SDLK_LCTRL);
482 mmdl[3][0] = -r + 0.25f;
483 mmdl[3][2] = 1.0f - 0.125f;
484 shader_model_menu_uMdl( mmdl );
485 colorize( press_ctrl, !in_air && !grinding );
486 draw_key( press_ctrl, 1 );
487 render_overlay_mesh( ov_text_carve );
488 }
489
490 /* SHIFT || CROUCH / GRAB / RUN */
491 bool press_shift = vg_getkey( SDLK_LSHIFT );
492 if( subsytem == k_player_subsystem_skate ||
493 subsytem == k_player_subsystem_walk )
494 {
495 mmdl[3][0] = -r + 0.25f;
496 mmdl[3][2] = 1.0f - 0.125f - 0.25f;
497 shader_model_menu_uMdl( mmdl );
498 colorize( press_shift, !grinding );
499 draw_key( press_shift, 1 );
500 render_overlay_mesh( ov_text_shift );
501
502 if( subsytem == k_player_subsystem_skate )
503 {
504 colorize( press_shift, !in_air && !grinding );
505 render_overlay_mesh( ov_text_crouch );
506 colorize( press_shift, in_air && !grinding );
507 render_overlay_mesh( ov_text_grab );
508 }
509 else if( subsytem == k_player_subsystem_walk )
510 {
511 render_overlay_mesh( ov_text_run );
512 }
513 }
514
515 if( subsytem == k_player_subsystem_skate )
516 {
517 /* stored indicator text */
518 mmdl[3][0] = -r + 0.25f + 0.203125f + 0.007812f;
519 colorize( 0, !in_air );
520 shader_model_menu_uMdl( mmdl );
521 render_overlay_mesh( ov_text_stored );
522
523 mmdl[0][0] = v3_length( player_skate.state.throw_v ) / k_mmthrow_scale;
524 shader_model_menu_uMdl( mmdl );
525 colorize( 0, !in_air );
526 render_overlay_mesh( ov_stored_ind );
527
528 static f32 collect = 0.0f;
529 collect = vg_lerpf( collect, player_skate.collect_feedback,
530 vg.time_frame_delta * 15.0f );
531 collect = vg_clampf( collect, 0.0f, 1.0f );
532
533 mmdl[0][0] = collect;
534 mmdl[3][2] += 0.015625f;
535 shader_model_menu_uMdl( mmdl );
536 render_overlay_mesh( ov_stored_ind );
537 }
538
539 /* -1 */
540 if( subsytem != k_player_subsystem_dead )
541 {
542 bool press_c = vg_getkey(SDLK_c);
543 mmdl[0][0] = 1.0f;
544 mmdl[3][0] = -r + 0.125f + 1.0f;
545 mmdl[3][2] = 1.0f - 0.125f - 0.25f;
546 shader_model_menu_uMdl( mmdl );
547 colorize( press_c, 1 );
548 draw_key( press_c, 0 );
549 render_overlay_mesh( ov_text_camera );
550 }
551
552 /* +0 */
553 mmdl[0][0] = 1.0f;
554 mmdl[3][2] = 1.0f - 0.125f - 0.25f - 0.25f;
555
556 /* A || LEFT */
557 if( subsytem != k_player_subsystem_dead )
558 {
559 bool press_a = vg_getkey(SDLK_a);
560 mmdl[3][0] = -r + 0.125f;
561 shader_model_menu_uMdl( mmdl );
562 colorize( press_a, 1 );
563 draw_key( press_a, 0 );
564 render_overlay_mesh( ov_text_left );
565 }
566
567 bool press_jump = player_skate.state.jump_charge < 0.2f;
568
569 /* S || MANUAL / BACKFLIP */
570 bool press_s = vg_getkey(SDLK_s);
571 mmdl[3][0] = -r + 0.125f + 0.25f;
572 shader_model_menu_uMdl( mmdl );
573
574 if( subsytem == k_player_subsystem_skate )
575 {
576 colorize( press_s, !in_air );
577 draw_key( press_s, 0 );
578 render_overlay_mesh( ov_text_s );
579 /* backflip/manual */
580 colorize( press_s, !in_air && !press_jump );
581 render_overlay_mesh( ov_text_back_flip );
582 colorize( press_s, !in_air && press_jump );
583 render_overlay_mesh( ov_text_manual );
584 }
585 else if( subsytem != k_player_subsystem_dead )
586 {
587 colorize( press_s, 1 );
588 draw_key( press_s, 0 );
589 render_overlay_mesh( ov_text_s );
590 render_overlay_mesh( ov_text_back );
591 }
592
593 /* D || RIGHT */
594 if( subsytem != k_player_subsystem_dead )
595 {
596 bool press_d = vg_getkey(SDLK_d);
597 mmdl[3][0] = -r + 0.125f + 0.25f + 0.25f;
598 shader_model_menu_uMdl( mmdl );
599 colorize( press_d, 1 );
600 draw_key( press_d, 0 );
601 render_overlay_mesh( ov_text_right );
602 }
603
604 /* +1 */
605 mmdl[3][2] = 1.0f - 0.125f - 0.25f - 0.25f - 0.25f;
606
607 /* Q */
608 if( subsytem == k_player_subsystem_dead )
609 {
610 bool press_q = vg_getkey(SDLK_q);
611 mmdl[3][0] = -r + 0.125f;
612 shader_model_menu_uMdl( mmdl );
613 colorize( press_q, 1 );
614 draw_key( press_q, 0 );
615 render_overlay_mesh( ov_text_respawn );
616 }
617
618 /* W || PUSH / FRONTFLIP */
619 bool press_w = vg_getkey(SDLK_w);
620 mmdl[3][0] = -r + 0.125f + 0.25f;
621 shader_model_menu_uMdl( mmdl );
622
623 if( subsytem == k_player_subsystem_skate )
624 {
625 colorize( press_w, !in_air );
626 draw_key( press_w, 0 );
627 render_overlay_mesh( ov_text_w );
628 /* frontflip/push */
629 colorize( press_w, !in_air && !press_jump );
630 render_overlay_mesh( ov_text_front_flip );
631 colorize( press_w, !in_air && press_jump );
632 render_overlay_mesh( ov_text_push );
633 }
634 else if( subsytem != k_player_subsystem_dead )
635 {
636 colorize( press_w, 1 );
637 draw_key( press_w, 0 );
638 render_overlay_mesh( ov_text_w );
639 render_overlay_mesh( ov_text_forward );
640 }
641
642 /* E */
643 bool press_e = vg_getkey(SDLK_e);
644 mmdl[3][0] = -r + 0.125f + 0.25f + 0.25f;
645
646 shader_model_menu_uMdl( mmdl );
647
648 if( subsytem == k_player_subsystem_skate )
649 {
650 if( localplayer.have_glider )
651 {
652 colorize( press_e, !in_air );
653 render_overlay_mesh( ov_text_walk_lwr );
654 colorize( press_e, in_air );
655 render_overlay_mesh( ov_text_glide );
656 }
657 else
658 {
659 colorize( press_e, 1 );
660 render_overlay_mesh( ov_text_walk );
661 }
662 }
663 else if( subsytem == k_player_subsystem_glide )
664 {
665 colorize( press_e, 1 );
666 render_overlay_mesh( ov_text_skate );
667 }
668 else if( subsytem == k_player_subsystem_walk )
669 {
670 colorize( press_e, player_walk.state.activity < k_walk_activity_inone );
671 render_overlay_mesh( ov_text_skate );
672 }
673
674 if( subsytem != k_player_subsystem_dead )
675 {
676 draw_key( press_e, 0 );
677 render_overlay_mesh( ov_text_e );
678 }
679
680 /* R */
681 bool press_r = vg_getkey(SDLK_r);
682 mmdl[3][0] = -r + 0.125f + 0.25f + 0.25f + 0.25f;
683 shader_model_menu_uColour( cnorm );
684 shader_model_menu_uMdl( mmdl );
685
686 colorize( press_r, 1 );
687 draw_key( press_r, 0 );
688 render_overlay_mesh( ov_text_rewind );
689
690 /* space */
691 bool press_space = vg_getkey(SDLK_SPACE);
692 mmdl[3][0] = 0.0f;
693 mmdl[3][2] = 1.0f - 0.125f;
694
695
696 if( subsytem == k_player_subsystem_skate ||
697 subsytem == k_player_subsystem_walk )
698 {
699 shader_model_menu_uMdl( mmdl );
700 colorize( press_space, !in_air );
701
702 render_overlay_mesh( press_space?
703 ov_space_down: ov_space );
704 render_overlay_mesh( ov_text_jump );
705 }
706
707 if( subsytem == k_player_subsystem_skate )
708 {
709 if( player_skate.state.jump_charge > 0.01f )
710 {
711 mmdl[0][0] = player_skate.state.jump_charge;
712 mmdl[3][0] = -0.4375f;
713 shader_model_menu_uMdl( mmdl );
714 render_overlay_mesh( ov_jump_ind );
715 }
716 }
717
718 bool press_esc = vg_getkey(SDLK_ESCAPE);
719 mmdl[0][0] = 1.0f;
720 mmdl[3][0] = -r + 0.125f;;
721 mmdl[3][2] = -1.0f + 0.125f;
722 shader_model_menu_uMdl( mmdl );
723 colorize( press_esc, 1 );
724 render_overlay_mesh( ov_text_menu );
725 render_overlay_mesh( press_esc? ov_key_menu_down: ov_key_menu );
726 mmdl[3][0] = r - 0.38f;
727 mmdl[3][2] = 0.0f;
728 shader_model_menu_uMdl( mmdl );
729 colorize( press_shift, in_air );
730
731 if( subsytem == k_player_subsystem_skate )
732 {
733 render_overlay_mesh( ov_mouse_grabs );
734
735 if( in_air && press_shift )
736 {
737 mmdl[3][0] += gd[0]*0.125f;
738 mmdl[3][2] += gd[1]*0.125f;
739 }
740 }
741
742 shader_model_menu_uMdl( mmdl );
743
744 bool lmb = button_press( k_srbind_trick0 ),
745 rmb = button_press( k_srbind_trick1 );
746
747 if( subsytem == k_player_subsystem_skate )
748 {
749 colorize( 0, press_space || in_air );
750 render_overlay_mesh( ov_mouse );
751
752 colorize( lmb&&!rmb, press_space || in_air );
753 render_overlay_mesh( ov_text_shuvit );
754
755 colorize( lmb, press_space || in_air );
756 render_overlay_mesh( lmb? ov_lmb_down: ov_lmb );
757
758 colorize( rmb&&!lmb, press_space || in_air );
759 render_overlay_mesh( ov_text_kickflip );
760
761 colorize( rmb, press_space || in_air );
762 render_overlay_mesh( rmb? ov_rmb_down: ov_rmb );
763
764 colorize( rmb&&lmb, press_space || in_air );
765 render_overlay_mesh( ov_text_treflip );
766 }
767 else if( subsytem == k_player_subsystem_walk )
768 {
769 colorize( 0, 1 );
770 render_overlay_mesh( ov_mouse );
771 render_overlay_mesh( ov_text_look );
772
773 render_overlay_mesh( lmb? ov_lmb_down: ov_lmb );
774 render_overlay_mesh( rmb? ov_rmb_down: ov_rmb );
775 }
776 }
777 }