From: hgn Date: Sun, 30 Oct 2022 16:43:45 +0000 (+0000) Subject: couple fixes X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=0ae443b3f6b4b753f9a2eba58da597ae8cb14b4f;hp=23a1be081ab9e378cba49a23b8ed4d4082b580c1;p=carveJwlIkooP6JGAAIwe30JlM.git couple fixes --- diff --git a/blender_export.py b/blender_export.py index 8195123..b6ca3e7 100644 --- a/blender_export.py +++ b/blender_export.py @@ -294,6 +294,8 @@ class classtype_spawn(Structure): cv_view_verts += [(v1[0],v1[1],v1[2])] cv_view_colours += [(0,1,1,1),(0,1,1,1)] #} + + cv_draw_sphere( obj.location, 20.0, [0.1,0,0.9,0.4] ) #} @staticmethod @@ -759,6 +761,49 @@ class classtype_audio(Structure): #} #} +class classtype_spawn_link(Structure): +#{ + _pack_ = 1 + _fields_ = [("connections",c_uint32*4)] + + def encode_obj(_, node,node_def ): + #{ + node.classtype = 0 + #} + + @staticmethod + def editor_interface( layout, obj ): + #{ + pass + #} + + @staticmethod + def draw_scene_helpers( obj ): + #{ + global cv_view_verts, cv_view_colours + + count = 0 + + for obj1 in bpy.context.collection.objects: + #{ + if (obj1.cv_data.classtype != 'classtype_spawn_link') and \ + (obj1.cv_data.classtype != 'classtype_spawn') : + continue + + if (obj1.location - obj.location).length < 40.0: + #{ + cv_draw_line( obj.location, obj1.location, [1,1,1,1] ) + count +=1 + #} + + if count == 4: + break + #} + + cv_draw_sphere( obj.location, 20.0, [0.5,0,0.2,0.4] ) + #} +#} + # ---------------------------------------------------------------------------- # # # # Compiler section # @@ -2348,6 +2393,7 @@ class CV_OBJ_SETTINGS(bpy.types.PropertyGroup): ('classtype_trigger',"classtype_trigger","",100), ('classtype_logic_achievement',"classtype_logic_achievement","",101), ('classtype_logic_relay',"classtype_logic_relay","",102), + ('classtype_spawn_link',"classtype_spawn_link","",150), ]) #} diff --git a/highscores.h b/highscores.h index f2c5eab..b507960 100644 --- a/highscores.h +++ b/highscores.h @@ -218,6 +218,10 @@ VG_STATIC void highscores_init( u32 pool_size, u32 playerinfo_pool_size ) vg_linear_alloc( vg_mem.rtmemory, playerinfo_pool_size * sizeof(highscore_playerinfo) ); + memset( sys->data, 0, pool_size*sizeof(highscore_record) ); + memset( sys->playerinfo_data, 0, + playerinfo_pool_size*sizeof(highscore_playerinfo) ); + /* This is ugly.. too bad! */ sys->aainfo.base = highscore_system.data; diff --git a/menu.h b/menu.h index 21fa313..b407f4a 100644 --- a/menu.h +++ b/menu.h @@ -16,7 +16,7 @@ VG_STATIC float menu_input_cooldown = 0.0f; VG_STATIC float menu_fov_target = 97.0f; VG_STATIC v2f menu_extra_angles; -VG_STATIC int menu_loc = 1, +VG_STATIC int menu_loc = 0xb, menu_loc_last = 1; VG_STATIC u32 menu_page = 0; @@ -35,6 +35,7 @@ VG_STATIC void menu_btn_map_a( int event ); VG_STATIC void menu_btn_map_b( int event ); VG_STATIC void menu_btn_map_c( int event ); VG_STATIC void menu_btn_fuckoff( int event ); +VG_STATIC void menu_btn_reset( int event ); struct menu_button { @@ -50,19 +51,17 @@ struct menu_button VG_STATIC menu_buttons[] = { /*0*/{"text_paused", 1, menu_btn_paused }, -/*1*/{"text_quit", 9, menu_btn_quit, {3,-1,4,2}}, -/*2*/{"text_skater", 3, menu_btn_skater, {3,1,4,-1}}, -/*3*/{"text_map", 5, menu_btn_map, {-1,-1,2,-1}}, +/*1*/{"text_quit", 9, menu_btn_quit, {3,-1,4,0xb}}, +/*2*/{"text_skater", 3, menu_btn_skater, {3,0xb,4,-1}}, +/*3*/{"text_map", 5, NULL, {-1,-1,2,-1}}, /*4*/{"text_about_game", 1, NULL, {2,-1,-1,-1}}, /*5*/{"skater_left", 2, NULL, {-1,-1,-1,-1}}, /*6*/{"skater_right", 2, NULL, {-1,-1,-1,-1}}, -/*7*/{"map_a", 4, menu_btn_map_a,{8, -1, 9, 9 }}, -/*8*/{"map_b", 4, menu_btn_map_b,{-1,7,7,-1}}, -/*9*/{"map_c", 4, menu_btn_map_c,{7,7,-1,8}}, -/*a*/{"g_map", 5, NULL }, -/*b*/{"g_controls", 1, NULL }, -/*c*/{"text_quitty", 8, NULL }, -/*d*/{"text_yes", 8, menu_btn_fuckoff,{-1,-1,-1,-1} }, +/*7*/{"g_map", 5, NULL }, +/*8*/{"g_controls", 1, NULL }, +/*9*/{"text_quitty", 8, NULL }, +/*a*/{"text_yes", 8, menu_btn_fuckoff,{-1,-1,-1,-1} }, +/*b*/{"text_reset", 1, menu_btn_reset,{3,1,4,2} }, }; VG_STATIC void menu_btn_map_a( int event ){} @@ -74,6 +73,15 @@ VG_STATIC void menu_btn_paused( int event ) } +VG_STATIC void menu_btn_reset( int event ) +{ + reset_player(0,NULL); + world_routes_clear(); + + cl_menu_go_away = 1; + menu_page = 0; +} + VG_STATIC void menu_btn_fuckoff( int event ) { glfwSetWindowShouldClose( vg.window, 1 ); @@ -82,7 +90,7 @@ VG_STATIC void menu_btn_fuckoff( int event ) VG_STATIC void menu_btn_quit( int event ) { menu_page = 0x8; - menu_loc = 0xd; + menu_loc = 0xa; } VG_STATIC void menu_btn_map( int event ) @@ -233,6 +241,10 @@ VG_STATIC void menu_page_skater(void) if( (fabsf(h) > 0.7f) && (menu_input_cooldown <= 0.0f) ) { + audio_lock(); + audio_play_oneshot( &audio_rewind[4], 1.0f ); + audio_unlock(); + if( h < 0.0f ) { cl_playermdl_id --; diff --git a/models_src/mp_dev.mdl b/models_src/mp_dev.mdl index a1771a6..60ed5ff 100644 Binary files a/models_src/mp_dev.mdl and b/models_src/mp_dev.mdl differ diff --git a/models_src/rs_menu.mdl b/models_src/rs_menu.mdl index 9c77133..069b224 100644 Binary files a/models_src/rs_menu.mdl and b/models_src/rs_menu.mdl differ diff --git a/player.h b/player.h index 8408583..9266782 100644 --- a/player.h +++ b/player.h @@ -301,48 +301,65 @@ VG_STATIC void player_update_pre(void) if( vg_get_button_down( "reset" ) ) { - double delta = world.time - world.last_use; - - if( (delta <= RESET_MAX_TIME) && (world.last_use != 0.0) ) + if( player.is_dead ) { - player.rewinding = 1; - player.rewind_sound_wait = 1; - player.rewind_time = (float)player.rewind_length - 0.0001f; - player_save_rewind_frame(); + reset_player( 0, NULL ); audio_lock(); - audio_play_oneshot( &audio_rewind[0], 1.0f ); + audio_play_oneshot( &audio_ui[0], 1.0f ); audio_unlock(); + } + else + { + double delta = world.time - world.last_use; - /* based on analytical testing. DONT CHANGE! - * - * time taken: y = (x^(4/5)) * 74.5 - * inverse : x = (2/149)^(4/5) * y^(4/5) - */ - - float constant = powf( 2.0f/149.0f, 4.0f/5.0f ), - curve = powf( player.rewind_total_length, 4.0f/5.0f ); - - player.rewind_predicted_time = constant * curve; - player.diag_rewind_start = vg.time; - player.diag_rewind_time = player.rewind_time; + if( (delta <= RESET_MAX_TIME) && (world.last_use != 0.0) ) + { + player.rewinding = 1; + player.rewind_sound_wait = 1; + player.rewind_time = (float)player.rewind_length - 0.0001f; + player_save_rewind_frame(); + audio_lock(); + audio_play_oneshot( &audio_rewind[0], 1.0f ); + audio_unlock(); + + /* based on analytical testing. DONT CHANGE! + * + * time taken: y = (x^(4/5)) * 74.5 + * inverse : x = (2/149)^(4/5) * y^(4/5) + */ + + float constant = powf( 2.0f/149.0f, 4.0f/5.0f ), + curve = powf( player.rewind_total_length, 4.0f/5.0f ); + + player.rewind_predicted_time = constant * curve; + player.diag_rewind_start = vg.time; + player.diag_rewind_time = player.rewind_time; - player.is_dead = 0; - player.death_tick_allowance = 30; - player_restore_frame(); + player.is_dead = 0; + player.death_tick_allowance = 30; + player_restore_frame(); - if( !phys->on_board ) - { - player.angles[0] = atan2f( -phys->rb.forward[2], - -phys->rb.forward[0] ); - } + if( !phys->on_board ) + { + player.angles[0] = atan2f( -phys->rb.forward[2], + -phys->rb.forward[0] ); + } - player.mdl.shoes[0] = 1; - player.mdl.shoes[1] = 1; + player.mdl.shoes[0] = 1; + player.mdl.shoes[1] = 1; - world_routes_notify_reset(); + world_routes_notify_reset(); - /* apply 1 frame of movement */ - player_do_motion(); + /* apply 1 frame of movement */ + player_do_motion(); + } + else + { + /* cant do that */ + audio_lock(); + audio_play_oneshot( &audio_rewind[4], 1.0f ); + audio_unlock(); + } } } @@ -577,6 +594,7 @@ VG_STATIC void player_kill(void) { player.is_dead = 1; player_ragdoll_copy_model( player.phys.rb.v ); + world_routes_clear(); } } diff --git a/player_physics.h b/player_physics.h index 438441e..bb79b85 100644 --- a/player_physics.h +++ b/player_physics.h @@ -169,7 +169,7 @@ VG_STATIC void player_physics_control(void) push_thresh_last = push_thresh; - if( !vg_get_button("break") && push_thresh ) + if( !vg_get_button("jump") && push_thresh ) { player.phys.pushing = 1.0f; player.phys.push_time = vg.time - player.phys.start_push; @@ -843,10 +843,20 @@ VG_STATIC int reset_player( int argc, char const *argv[] ) player.is_dead = 0; + m3x3f the_long_way; + q_m3x3( rp->q, the_long_way ); + + v3f delta = {1.0f,0.0f,0.0f}; + m3x3_mulv( the_long_way, delta, delta ); + + player.angles[0] = atan2f( delta[0], -delta[2] ); + player.angles[1] = -asinf( delta[1] ); + + v4_copy( rp->q, phys->rb.q ); v3_copy( rp->co, phys->rb.co ); v3_zero( phys->rb.v ); - + phys->vswitch = 1.0f; phys->slip_last = 0.0f; phys->in_air = 1; diff --git a/textures_src/gradients.png b/textures_src/gradients.png index 6c2015f..9ccdf00 100644 Binary files a/textures_src/gradients.png and b/textures_src/gradients.png differ diff --git a/world_render.h b/world_render.h index 8398a60..ae9399b 100644 --- a/world_render.h +++ b/world_render.h @@ -249,6 +249,7 @@ VG_STATIC void render_world( m4x4f projection, m4x3f camera ) { render_sky( camera ); render_world_routes( projection, camera[3] ); + render_world_standard( projection, camera[3] ); render_world_vb( projection, camera[3] ); render_world_alphatest( projection, camera[3] ); render_terrain( projection, camera[3] ); diff --git a/world_routes.h b/world_routes.h index 5a7c07b..6f34c8c 100644 --- a/world_routes.h +++ b/world_routes.h @@ -530,6 +530,17 @@ VG_STATIC void world_routes_verify_run( u32 route ) world.routes[route].latest_pass = world.time; } +VG_STATIC void world_routes_clear(void) +{ + for( u32 i=0; iactive = 0; + } + world.current_run_version += 4; + world.last_use = 0.0; +} + /* * When going through a gate this is called for bookkeeping purposes */ diff --git a/world_sfd.h b/world_sfd.h index 5b5bd99..3f94c4e 100644 --- a/world_sfd.h +++ b/world_sfd.h @@ -60,16 +60,18 @@ VG_STATIC void sfd_encode( u32 row, const char *str ) for( int i=0; i