couple fixes
authorhgn <hgodden00@gmail.com>
Sun, 30 Oct 2022 16:43:45 +0000 (16:43 +0000)
committerhgn <hgodden00@gmail.com>
Sun, 30 Oct 2022 16:43:45 +0000 (16:43 +0000)
blender_export.py
highscores.h
menu.h
models_src/mp_dev.mdl
models_src/rs_menu.mdl
player.h
player_physics.h
textures_src/gradients.png
world_render.h
world_routes.h
world_sfd.h

index 81951235c49258de1574e7faa2ec73aebba24fef..b6ca3e7208c71d054a869d3b65eeae01902907af 100644 (file)
@@ -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),
       ])
 #}
 
index f2c5eabc855b0654a1d3c3d5b6eca3dcdedf8b56..b5079609e945a81efbf75225db944c614a196d86 100644 (file)
@@ -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 21fa313e5edc9e6613c23ca64ad39c595969bd80..b407f4a6477d50147ce9ddee2b73b74c6055b751 100644 (file)
--- 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 --;
index a1771a6886786b7c75a495740dd2e9e31bb211fd..60ed5ff4f58e4b9df6b49e115b2a27199add66cb 100644 (file)
Binary files a/models_src/mp_dev.mdl and b/models_src/mp_dev.mdl differ
index 9c77133f4514d7987a765930e3dfcba43030f1c2..069b224f98920206077a6a859389f2f9ab697641 100644 (file)
Binary files a/models_src/rs_menu.mdl and b/models_src/rs_menu.mdl differ
index 840858371c204165e0beea0c9834a50b06a05fd9..92667821e84363b2ffda5c4134e9a6cc637c31d0 100644 (file)
--- 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();
    }
 }
 
index 438441ec1aa264bb680c9935968c89c977496daf..bb79b850e84f8ac66e4af3ead166d54763a612bf 100644 (file)
@@ -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;
index 6c2015f6023c5b4534d25766d99b1af04d3df8e0..9ccdf0011c4d4cf197d0c4257f816dc0ee6e3201 100644 (file)
Binary files a/textures_src/gradients.png and b/textures_src/gradients.png differ
index 8398a60cd526b5dfb2369bf894e694cdf42d0cf5..ae9399bf8e02d711484159672c0384bd8aaabc9b 100644 (file)
@@ -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] );
index 5a7c07b36df0b154c921a3970fd050eaafb19d63..6f34c8c56de1a1e00f1316364ff871feeec4df02 100644 (file)
@@ -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; i<world.route_count; i++ )
+   {
+      struct route *route = &world.routes[i];
+      route->active = 0;
+   }
+   world.current_run_version += 4;
+   world.last_use = 0.0;
+}
+
 /*
  * When going through a gate this is called for bookkeeping purposes
  */
index 5b5bd9973e5bb907860fb77e9518b8d5b9d406ff..3f94c4ed86fae271a5948d20c521179ccf395c65 100644 (file)
@@ -60,16 +60,18 @@ VG_STATIC void sfd_encode( u32 row, const char *str )
 
    for( int i=0; i<world.sfd.w; i++ )
    {
+      u32 idx = (world.sfd.w*row_h + i) * 2;
+
       if( end )
       {
-         world.sfd.buffer[world.sfd.w*row_h + i] = 0.0f;
+         world.sfd.buffer[idx] = 0.0f;
       }
       else
       {
          if( !str[i] )
             end = 1;
 
-         world.sfd.buffer[world.sfd.w*row_h + i] = sfd_encode_glyph( str[i] );
+         world.sfd.buffer[idx] = sfd_encode_glyph( str[i] );
       }
    }
 }