medfall

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

commit 71f5c24b76e115f0e9f84b6cde35cd3da4123d14
parent c868687d45f7d847e76fe2f3b3dfa6428e83bb1f
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Aug 29 12:58:23 +0200

Load/unload the correct tiles

Diffstat:
terrain_manager.cc | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -135,9 +135,9 @@ void terrain_update( TerrainManager * const tm, const glm::vec3 position ) { if( new_tx > tm->last_tx ) { printf( "boundary +x\n" ); for( u32 ty = 0; ty < VIEW_SIZE; ty++ ) { - tm->tiles[ tm->last_tx - VIEW_HALF ][ ty ].unload(); + tm->tiles[ tm->last_tx - VIEW_HALF ][ tm->last_ty + ty - VIEW_HALF ].unload(); - tm->tiles[ tm->last_tx + VIEW_HALF + 1 ][ ty ].load( + tm->tiles[ tm->last_tx + VIEW_HALF + 1 ][ tm->last_ty + ty - VIEW_HALF ].load( tp( tm, tm->last_tx + VIEW_HALF + 1, tm->last_ty + ty - VIEW_HALF ), ( tm->last_tx + VIEW_HALF + 1 ) * TILE_SIZE, ( tm->last_ty + ty - VIEW_HALF ) * TILE_SIZE, @@ -149,9 +149,9 @@ void terrain_update( TerrainManager * const tm, const glm::vec3 position ) { else { printf( "boundary -x\n" ); for( u32 ty = 0; ty < VIEW_SIZE; ty++ ) { - tm->tiles[ tm->last_tx + VIEW_HALF ][ ty ].unload(); + tm->tiles[ tm->last_tx + VIEW_HALF ][ tm->last_ty + ty - VIEW_HALF ].unload(); - tm->tiles[ tm->last_tx - VIEW_HALF - 1 ][ ty ].load( + tm->tiles[ tm->last_tx - VIEW_HALF - 1 ][ tm->last_ty + ty - VIEW_HALF ].load( tp( tm, tm->last_tx - VIEW_HALF - 1, tm->last_ty + ty - VIEW_HALF ), ( tm->last_tx - VIEW_HALF - 1 ) * TILE_SIZE, ( tm->last_ty + ty - VIEW_HALF ) * TILE_SIZE, @@ -166,9 +166,9 @@ void terrain_update( TerrainManager * const tm, const glm::vec3 position ) { if( new_ty > tm->last_ty ) { printf( "boundary +y\n" ); for( u32 tx = 0; tx < VIEW_SIZE; tx++ ) { - tm->tiles[ tx ][ tm->last_ty - VIEW_HALF ].unload(); + tm->tiles[ tm->last_tx + tx - VIEW_HALF ][ tm->last_ty - VIEW_HALF ].unload(); - tm->tiles[ tx ][ tm->last_ty + VIEW_HALF + 1 ].load( + tm->tiles[ tm->last_tx + tx - VIEW_HALF ][ tm->last_ty + VIEW_HALF + 1 ].load( tp( tm, tm->last_tx + tx - VIEW_HALF, tm->last_ty + VIEW_HALF + 1 ), ( tm->last_tx + tx - VIEW_HALF ) * TILE_SIZE, ( tm->last_ty + VIEW_HALF + 1 ) * TILE_SIZE, @@ -179,9 +179,9 @@ void terrain_update( TerrainManager * const tm, const glm::vec3 position ) { else { printf( "boundary -y\n" ); for( u32 tx = 0; tx < VIEW_SIZE; tx++ ) { - tm->tiles[ tx ][ tm->last_ty + VIEW_HALF ].unload(); + tm->tiles[ tm->last_tx + tx - VIEW_HALF ][ tm->last_ty + VIEW_HALF ].unload(); - tm->tiles[ tx ][ tm->last_ty - VIEW_HALF - 1 ].load( + tm->tiles[ tm->last_tx + tx - VIEW_HALF ][ tm->last_ty - VIEW_HALF - 1 ].load( tp( tm, tm->last_tx + tx - VIEW_HALF, tm->last_ty - VIEW_HALF - 1 ), ( tm->last_tx + tx - VIEW_HALF ) * TILE_SIZE, ( tm->last_ty - VIEW_HALF - 1 ) * TILE_SIZE,