|
|
|
@ -43,17 +43,6 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
|
if (c.launchTime>0) { |
|
|
|
|
c.launchTime-=fElapsedTime; |
|
|
|
|
} else
|
|
|
|
|
if (c.landTime>0) { |
|
|
|
|
c.landTime-=fElapsedTime; |
|
|
|
|
if (c.landTime<=0) { |
|
|
|
|
c.landTime=0; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
if (c.getBlocks()[j].col==BlockColor::LAUNCHED) { |
|
|
|
|
gameBoard.assignRandomColor(c.getBlocks()[j]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
c.vspeed+=gameBoard.gravity; |
|
|
|
|
} |
|
|
|
@ -102,25 +91,34 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
nextClumpCollisionCheck:; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
Block&b=c.getBlocks()[j]; |
|
|
|
|
int col=b.pos.x/12; |
|
|
|
|
for (int k=0;k<gameBoard.getBlocks(col).size();k++){ |
|
|
|
|
Block&b2=gameBoard.getBlocks(col)[k]; |
|
|
|
|
if (c.getBlockPosition(b).y+12>=b2.pos.y&&c.getBlockPosition(b).y<=b2.pos.y+12){ |
|
|
|
|
c.y-=c.getBlockPosition(b).y+12-b2.pos.y; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
Block&b=c.getBlocks()[j]; |
|
|
|
|
int col=b.pos.x/12; |
|
|
|
|
for (int k=0;k<gameBoard.getBlocks(col).size();k++){ |
|
|
|
|
Block&b2=gameBoard.getBlocks(col)[k]; |
|
|
|
|
if (c.getBlockPosition(b).y+12>=b2.pos.y&&c.getBlockPosition(b).y<=b2.pos.y+12){ |
|
|
|
|
c.y-=c.getBlockPosition(b).y+12-b2.pos.y; |
|
|
|
|
c.vspeed=0; |
|
|
|
|
if (c.landTime>=gameBoard.landTime) { |
|
|
|
|
gameBoard.convertClump(i--); |
|
|
|
|
} else { |
|
|
|
|
c.landTime+=fElapsedTime; |
|
|
|
|
} |
|
|
|
|
goto nextClump; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (c.getBlockPosition(b).y>=gameBoard.yBottom) { |
|
|
|
|
c.y-=c.getBlockPosition(b).y-gameBoard.yBottom; |
|
|
|
|
c.vspeed=0; |
|
|
|
|
gameBoard.convertClump(i--); |
|
|
|
|
if (c.landTime>=gameBoard.landTime) { |
|
|
|
|
gameBoard.convertClump(i--); |
|
|
|
|
} else { |
|
|
|
|
c.landTime+=fElapsedTime; |
|
|
|
|
} |
|
|
|
|
goto nextClump; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (c.getBlockPosition(b).y>=gameBoard.yBottom) { |
|
|
|
|
c.y-=c.getBlockPosition(b).y-gameBoard.yBottom; |
|
|
|
|
c.vspeed=0; |
|
|
|
|
gameBoard.convertClump(i--); |
|
|
|
|
goto nextClump; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
c.landTime=0; |
|
|
|
|
nextClump:; |
|
|
|
|
} |
|
|
|
|
for (BlockClump&c:gameBoard.getBlockClumps()){ |
|
|
|
@ -397,30 +395,12 @@ void Meteos::drawGame(float fElapsedTime){ |
|
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
Block&b=c.getBlocks()[j]; |
|
|
|
|
if (b.resetTime>0) { |
|
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
|
if (b.resetTime<0) { |
|
|
|
|
b.resetTime=0; |
|
|
|
|
if (b.col==BlockColor::LAUNCHED) { |
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<gameBoard.boardSize.x;i++){ |
|
|
|
|
for (int y=0;y<gameBoard.getBlocks(i).size();y++){ |
|
|
|
|
Block&b=gameBoard.getBlocks(i)[y]; |
|
|
|
|
if (b.resetTime>0) { |
|
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
|
if (b.resetTime<0) { |
|
|
|
|
b.resetTime=0; |
|
|
|
|
if (b.col==BlockColor::LAUNCHED) { |
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|