rail targeting
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift.c
index e1056218848286f9cec80ad27cad9dc3b6f02de7..ba26edd6ed97c61d444c948f1ef7541279c43532 100644 (file)
@@ -9,22 +9,8 @@
  *            '        ' '--' [] '----- '----- '     ' '---'  SOFTWARE
  *
  * =============================================================================
- *
- * register: shader register & init scheduling
- * init:     initialization
- * update:   logic
- * render:   graphics
- * free:     resource free
- * 
  */
 
-#define VG_3D
-#define VG_STATIC static
-//#define VG_STATIC 
-
-//#define VG_MINIMAL_TEST
-#ifndef VG_MINIMAL_TEST
-
 #define SR_NETWORKED
 
 #include "common.h"
@@ -43,6 +29,8 @@ int main( int argc, char *argv[] )
    vg_mem.use_libc_malloc = 0;
    vg_set_mem_quota( 128*1024*1024 );
    vg_enter( argc, argv, "Voyager Game Engine" ); 
+
+   return 0;
 }
 
 VG_STATIC void highscores_save_at_exit(void*_)
@@ -50,9 +38,13 @@ VG_STATIC void highscores_save_at_exit(void*_)
    highscores_serialize_all();
 }
 
-VG_STATIC void vg_preload(void)
+VG_STATIC void vg_launch_opt(void)
 {
 
+}
+
+VG_STATIC void vg_preload(void)
+{
    vg_convar_push( (struct vg_convar){
       .name = "cl_ui",
       .data = &cl_ui,
@@ -61,6 +53,14 @@ VG_STATIC void vg_preload(void)
       .persistent = 1
    });
 
+   vg_convar_push( (struct vg_convar){
+      .name = "cl_fov",
+      .data = &g_fov_option,
+      .data_type = k_convar_dtype_f32,
+      .opt_f32 = { .clamp = 0 },
+      .persistent = 1
+   });
+
 vg_info(" Copyright  .        . .       -----, ,----- ,---.   .---.  \n" );
 vg_info(" 2021-2022  |\\      /| |           /  |      |    | |    /| \n" );
 vg_info("            | \\    / | +--        /   +----- +---'  |   / | \n" );
@@ -94,7 +94,8 @@ VG_STATIC void vg_load(void)
    world_audio_init();
 
    /* 'systems' are completely loaded now */
-   strcpy( world.world_name, "models/mp_dev.mdl" );
+   strcpy( world.world_name, "maps/mp_mtzero.mdl" );
+   strcpy( world.world_name, "maps/mp_gridmap.mdl" );
    world_load();
    vg_console_load_autos();
 }
@@ -153,11 +154,12 @@ VG_STATIC void render_main_game(void)
    m4x4f world_4x4;
    m4x3_expand( camera_mtx_inverse, world_4x4 );
 
-   static float fov = 97.0f;
+   static float fov = 60.0f;
+
+   float fov_target = vg_lerpf( 90.0f, 110.0f, g_fov_option );
 
-   float fov_target = 108.0f;
    if( player.phys.on_board )
-      fov_target = 125.0f;
+      fov_target = vg_lerpf( 97.0f, 135.0f, g_fov_option );
 
    if( cl_menu )
       fov_target = menu_fov_target;
@@ -177,8 +179,8 @@ VG_STATIC void render_main_game(void)
     */
 
    int draw_solid = player.is_dead | freecam;
-   
    render_world( vg.pv, camera_mtx );
+
    if( draw_solid )
       draw_player( camera_mtx );
 
@@ -241,6 +243,7 @@ VG_STATIC void render_main_game(void)
 VG_STATIC void vg_render(void)
 {
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
+
    glViewport( 0,0, vg.window_x, vg.window_y );
    glDisable( GL_DEPTH_TEST );
 
@@ -249,7 +252,6 @@ VG_STATIC void vg_render(void)
 
    render_main_game();
    
-   
    /* Other shite */
    glDisable(GL_BLEND);
    glDisable( GL_DEPTH_TEST );
@@ -259,40 +261,9 @@ VG_STATIC void vg_render(void)
 
 VG_STATIC void vg_ui(void)
 {
+   menu_crap_ui();
+
 #if 0
-   if( cl_menu )
-   {
-      ui_rect menu =
-      {
-         vg.window_x / 2 - 150,
-         vg.window_y / 2 - 50,
-         300,
-         130
-      };
-
-      ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 );
-
-      ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1]+6, 0, 0 },
-                               steam_username_at_startup, 
-                               1, k_text_align_center );
-      menu[1] += 24;
-      menu[3] -= 30;
-
-      ui_rect_pad( menu, 8 );
-      ui_fill_rect( &ui_global_ctx, menu, 0x90ffffff );
-      ui_rect_pad( menu, 2 );
-      ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 );
-
-      menu[1] += 32;
-      ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1], 0, 0 },
-                               "Exit", 2, k_text_align_center );
-
-      if( vg_get_button_down( "jump" ) )
-      {
-         glfwSetWindowShouldClose( vg.window, 1 );
-      }
-   }
-   
    if( lightedit )
    {
       ui_global_ctx.cursor[0] = 10;
@@ -374,11 +345,11 @@ VG_STATIC void run_debug_info(void)
          player.phys.rb.co[0], player.phys.rb.co[1], player.phys.rb.co[2] );
    ui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left );
 
-   if( vg.gamepad_ready )
+   if( vg_input.controller_handle )
    {
-      for( int i=0; i<6; i++ )
+      for( int i=0; i<vg_list_size(vg_input.controller_axises); i++ )
       {
-         snprintf( buf, 40, "%.2f", vg.gamepad.axes[i] );
+         snprintf( buf, 40, "%.2f", vg_input.controller_axises[i] );
          ui_text( (ui_px [2]){ 0, (i+3)*20 }, buf, 1, k_text_align_left );
       }
    }
@@ -388,75 +359,3 @@ VG_STATIC void run_debug_info(void)
             "Gamepad not ready", 1, k_text_align_left );
    }
 }
-
-#else
-
-#define VG_TIMESTEP_FIXED (1.0/60.0)
-#define VG_3D
-#define VG_FRAMEBUFFER_RESIZE 1
-#include "vg/vg.h"
-
-int main( int argc, char *argv[] )
-{
-   vg_prealloc_quota( 512*1024*1024 );
-   vg_enter( argc, argv, "Voyager Game Engine" ); 
-}
-
-VG_STATIC void vg_preload(void)
-{
-vg_info(" Copyright  .        . .       -----, ,----- ,---.   .---.  \n" );
-vg_info(" 2021-2022  |\\      /| |           /  |      |    | |    /| \n" );
-vg_info("            | \\    / | +--        /   +----- +---'  |   / | \n" );
-vg_info("            |  \\  /  | |         /    |      |   \\  |  /  | \n" );
-vg_info("            |   \\/   | |        /     |      |    \\ | /   | \n" );
-vg_info("            '        ' '--' [] '----- '----- '     ' '---'  " 
-        "SOFTWARE\n" );
-}
-
-VG_STATIC void vg_load(void)
-{
-   vg_bake_shaders();
-   vg_console_load_autos();
-}
-
-VG_STATIC void vg_start(void)
-{
-}
-
-VG_STATIC void vg_update( int loaded )
-{
-}
-
-VG_STATIC void vg_update_fixed( int loaded )
-{
-}
-
-VG_STATIC void vg_update_post( int loaded )
-{
-}
-
-VG_STATIC void vg_framebuffer_resize( int w, int h )
-{
-}
-
-VG_STATIC void vg_render(void)
-{
-   glBindFramebuffer( GL_FRAMEBUFFER, 0 );
-   glViewport( 0,0, vg.window_x, vg.window_y );
-   glDisable( GL_DEPTH_TEST );
-
-   glClearColor( 0.11f, 0.35f, 0.37f, 1.0f );
-   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
-   
-   /* Other shite */
-   glDisable(GL_BLEND);
-   glDisable( GL_DEPTH_TEST );
-   vg_lines_drawall( (float *)vg.pv );
-   glViewport( 0,0, vg.window_x, vg.window_y );
-}
-
-VG_STATIC void vg_ui(void)
-{
-}
-
-#endif