dungeon_crawler

diff prototype/src/level.cc @ 7:8fb37db44fd8

first person motion
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 17 Aug 2012 14:29:37 +0300
parents 252a00508411
children 22562582c82d
line diff
     1.1 --- a/prototype/src/level.cc	Tue Aug 14 08:49:38 2012 +0300
     1.2 +++ b/prototype/src/level.cc	Fri Aug 17 14:29:37 2012 +0300
     1.3 @@ -114,18 +114,18 @@
     1.4  				glTranslatef(pos.x, pos.y, pos.z);
     1.5  				glScalef(cell_size, cell_size, cell_size);
     1.6  
     1.7 -				unsigned int dmask = 0;
     1.8 -				if(i <= 0 || get_cell(j, i - 1) == 0) {
     1.9 -					dmask |= TILE_NORTH;
    1.10 +				unsigned int dmask = TILE_ALL;
    1.11 +				if(i > 0 && get_cell(j, i - 1)) {
    1.12 +					dmask &= ~TILE_NORTH;
    1.13  				}
    1.14 -				if(i > ysz || get_cell(j, i + 1) == 0) {
    1.15 -					dmask |= TILE_SOUTH;
    1.16 +				if(i < ysz - 1 && get_cell(j, i + 1)) {
    1.17 +					dmask &= ~TILE_SOUTH;
    1.18  				}
    1.19 -				if(j <= 0 || get_cell(j - 1, i) == 0) {
    1.20 -					dmask |= TILE_WEST;
    1.21 +				if(j > 0 && get_cell(j - 1, i)) {
    1.22 +					dmask &= ~TILE_WEST;
    1.23  				}
    1.24 -				if(j > xsz || get_cell(j + 1, i) == 0) {
    1.25 -					dmask |= TILE_EAST;
    1.26 +				if(j < xsz - 1 && get_cell(j + 1, i)) {
    1.27 +					dmask &= ~TILE_EAST;
    1.28  				}
    1.29  
    1.30  				cell->draw(dmask);