medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0ceca9e6a5c23e9fa8d13f9f640d15c83e1c8515
parent 10e75b1c7ff4156a9a21c3a7f2050ccaad64873d
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Feb  2 19:41:54 +0000

Some sizes/signs tweaks

Diffstat:
terrain_manager.cc | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -182,8 +182,8 @@ static void terrain_update_lods( } void terrain_update( TerrainManager * tm, glm::vec3 position ) { - u32 player_tile_x = position.x / TILE_SIZE; - u32 player_tile_y = position.y / TILE_SIZE; + s16 player_tile_x = position.x / TILE_SIZE; + s16 player_tile_y = position.y / TILE_SIZE; if( player_tile_x != tm->tile_x ) { if( player_tile_x > tm->tile_x ) { @@ -256,8 +256,8 @@ void terrain_render( const TerrainManager * tm, glm::mat4 VP, float sun_slope ) glUniformMatrix4fv( tm->un_vp, 1, GL_FALSE, glm::value_ptr( VP ) ); glUniform3fv( tm->un_sun, 1, glm::value_ptr( sun ) ); - for( u32 vy = 0; vy < VIEW_SIZE; vy++ ) { - for( u32 vx = 0; vx < VIEW_SIZE; vx++ ) { + for( u16 vy = 0; vy < VIEW_SIZE; vy++ ) { + for( u16 vx = 0; vx < VIEW_SIZE; vx++ ) { tm->tiles[ vx ][ vy ].render(); } } @@ -271,19 +271,19 @@ void terrain_render( const TerrainManager * tm, glm::mat4 VP, float sun_slope ) // also implement the bounded arithmetic class float terrain_height( const TerrainManager * tm, glm::vec3 position ) { // see doodles/tile_coords_to_view_coords.png for docs - u32 player_tile_x = position.x / TILE_SIZE; - u32 player_tile_y = position.y / TILE_SIZE; + s16 player_tile_x = position.x / TILE_SIZE; + s16 player_tile_y = position.y / TILE_SIZE; if( player_tile_x < tm->tile_x ) assert( tm->tile_x - player_tile_x <= VIEW_HALF ); else assert( player_tile_x - tm->tile_x <= VIEW_HALF ); if( player_tile_y < tm->tile_y ) assert( tm->tile_y - player_tile_y <= VIEW_HALF ); else assert( player_tile_y - tm->tile_y <= VIEW_HALF ); - u32 dx = player_tile_x - tm->tile_x; - u32 dy = player_tile_y - tm->tile_y; + s16 dx = player_tile_x - tm->tile_x; + s16 dy = player_tile_y - tm->tile_y; - u32 vx = view_add( tm->view_left, VIEW_HALF + dx ); - u32 vy = view_add( tm->view_top, VIEW_HALF + dy ); + s16 vx = view_add( tm->view_left, VIEW_HALF + dx ); + s16 vy = view_add( tm->view_top, VIEW_HALF + dy ); const Heightmap * hm = &tm->tiles[ vx ][ vy ];