refactor model things
[carveJwlIkooP6JGAAIwe30JlM.git] / player_walkgrid.h
index 937c30558cb7bb95dc742390f54d24d3bf189cae..b2fff828eecec12cdbebfdbf88632148704557ec 100644 (file)
@@ -1,3 +1,7 @@
+/*
+ * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ */
+
 #ifndef PLAYER_WALKGRID_H
 #define PLAYER_WALKGRID_H
 
@@ -585,7 +589,7 @@ static void player_walkgrid_stand_cell(struct walkgrid *wg)
 
    v3f world;
    world[0] = wg->region[0][0]+((float)wg->cell_id[0]+wg->pos[0])*k_gridscale;
-   world[1] = player.rb.co[1];
+   world[1] = player.phys.rb.co[1];
    world[2] = wg->region[0][2]+((float)wg->cell_id[1]+wg->pos[1])*k_gridscale;
 
    struct grid_sample *corners[4];
@@ -721,7 +725,7 @@ static void player_walkgrid_stand_cell(struct walkgrid *wg)
       }
    }
 
-   v3_copy( world, player.rb.co );
+   v3_copy( world, player.phys.rb.co );
 }
 
 static void player_walkgrid_getsurface(void)
@@ -734,7 +738,7 @@ static void player_walkgrid_getsurface(void)
    static struct walkgrid wg;
 
    v3f cell;
-   v3_copy( player.rb.co, cell );
+   v3_copy( player.phys.rb.co, cell );
    player_walkgrid_floor( cell );
 
    v3_muladds( cell, (v3f){-1.0f,-1.0f,-1.0f}, k_region_size, wg.region[0] );
@@ -751,14 +755,14 @@ static void player_walkgrid_getsurface(void)
    /* Temp */
    if( !vg_console_enabled() )
    {
-      if( glfwGetKey( vg_window, GLFW_KEY_W ) )
+      if( glfwGetKey( vg.window, GLFW_KEY_W ) )
          v3_muladds( delta, fwd,  ktimestep*k_walkspeed, delta );
-      if( glfwGetKey( vg_window, GLFW_KEY_S ) )
+      if( glfwGetKey( vg.window, GLFW_KEY_S ) )
          v3_muladds( delta, fwd, -ktimestep*k_walkspeed, delta );
 
-      if( glfwGetKey( vg_window, GLFW_KEY_A ) )
+      if( glfwGetKey( vg.window, GLFW_KEY_A ) )
          v3_muladds( delta, side, -ktimestep*k_walkspeed, delta );
-      if( glfwGetKey( vg_window, GLFW_KEY_D ) )
+      if( glfwGetKey( vg.window, GLFW_KEY_D ) )
          v3_muladds( delta, side,  ktimestep*k_walkspeed, delta );
 
       v3_muladds( delta, fwd, 
@@ -776,8 +780,8 @@ static void player_walkgrid_getsurface(void)
 
    v2f region_pos = 
    {
-      (player.rb.co[0] - wg.region[0][0]) * (1.0f/k_gridscale),
-      (player.rb.co[2] - wg.region[0][2]) * (1.0f/k_gridscale)
+      (player.phys.rb.co[0] - wg.region[0][0]) * (1.0f/k_gridscale),
+      (player.phys.rb.co[2] - wg.region[0][2]) * (1.0f/k_gridscale)
    };
    v2f region_cell_pos;
    v2_floor( region_pos, region_cell_pos );
@@ -955,9 +959,9 @@ static void player_walkgrid(void)
 {
    player_walkgrid_getsurface();
    
-   m4x3_mulv( player.rb.to_world, (v3f){0.0f,1.8f,0.0f}, player.camera_pos );
+   m4x3_mulv(player.phys.rb.to_world, (v3f){0.0f,1.8f,0.0f}, player.camera_pos);
    player_mouseview();
-   rb_update_transform( &player.rb );
+   rb_update_transform( &player.phys.rb );
 }
 
 #endif /* PLAYER_WALKGRID_H */