X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.h;h=2c6ee19ef51b94e21e9df556a6ce0bb6a51f2d4c;hb=a98ce96041b248580c0447bf87d4c6106483cade;hp=0a226afaffe04541c3315dfc602dd81f859c88f0;hpb=c2d67378dd5c82de50b8fbbbe222ec6be2da4eee;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.h b/player.h index 0a226af..2c6ee19 100644 --- a/player.h +++ b/player.h @@ -1,10 +1,5 @@ /* - * Copyright 2021-2022 (C) Mount0 Software, Harry Godden - All Rights Reserved - * ----------------------------------------------------------------------------- - * - * Player head module - * - * ----------------------------------------------------------------------------- + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved */ #ifndef PLAYER_H @@ -65,7 +60,8 @@ static struct gplayer float vswitch, slip, slip_last, reverse; - float grab, jump; + float grab, jump, pushing, push_time; + double start_push; int in_air, on_board, jump_charge, jump_dir; m3x3f vr,vr_pstep; @@ -73,7 +69,6 @@ static struct gplayer phys, phys_gate_frame; - float pushing, push_time; int is_dead; v3f land_target; @@ -177,7 +172,7 @@ static void player_restore_frame(void); * ----------------------------------------------------------------------------- */ -static int player_init(void) /* 1 */ +static void player_init(void) /* 1 */ { rb_init( &player.phys.rb ); rb_init( &player.collide_front ); @@ -228,17 +223,15 @@ static int player_init(void) /* 1 */ .function = reset_player }); - return player_model_init(); + /* other systems */ + vg_loader_highwater( player_model_init, player_model_free, NULL ); } -static void player_update(void) /* 2 */ +/* Deal with input etc */ +static void player_update_pre(void) { struct player_phys *phys = &player.phys; - for( int i=0; i0.0f) { player.is_dead = 0; @@ -260,18 +253,35 @@ static void player_update(void) /* 2 */ { phys->on_board ^= 0x1; } +} -#if 0 - if( (glfwGetKey( vg_window, GLFW_KEY_O ) )) +static void player_update_fixed(void) /* 2 */ +{ + struct player_phys *phys = &player.phys; + + if( player.is_dead ) { - player_ragdoll_copy_model( phys->rb.v ); - player.is_dead = 1; + player_ragdoll_iter(); } -#endif + else + { + player_do_motion(); + } + + player_audio(); /* FUTURE: can probably move this to post() + BUT, it uses deltas from fixed step physics, + AND this *might* be what we want for realtime + audio, anyway. */ +} + +static void player_update_post(void) +{ + for( int i=0; i