Changeset 9089 for code/branches/pCuts/src/modules/tetris/Tetris.cc
- Timestamp:
- Apr 14, 2012, 10:03:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pCuts/src/modules/tetris/Tetris.cc
r9087 r9089 25 25 * Johannes Ritz 26 26 * 27 * BUG a) double stone model (@ brick's location the stone's model is duplicated. Why does the brick have a model attached to it.)28 *BUG b) the brick is set the wrong way after a (brick-brick) collision, if thebrick was turned27 * 28 *BUG b) the falling brick is set the wrong way after a (brick-brick) collision, if the falling brick was turned 29 29 *BUG c) destroying the old stones causes segfault -> WeakPointer as solution ? 30 *BUG 30 *BUG d) wrong collision detection: sometimes stones "bounce off" 31 *BUG e) multiple rows are not cleared in one round 31 32 * 32 33 *TASK a) give points for winning … … 35 36 *TASK d) save the highscore 36 37 *TASK e) eye candy 38 *TASK f) increasing speed 37 39 */ 38 40 … … 181 183 for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it) 182 184 { 183 if(this->activeBrick_->contains(*it)) 185 if(this->activeBrick_->contains(*it))//skip the moving brick' stones 184 186 continue; 185 187 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); … … 187 189 //!< Saves the position of the currentStone 188 190 191 //filter out cases where the falling stone is already below a steady stone 192 if(position.y < currentStonePosition.y - this->center_->getStoneSize()/2.0f) 193 continue; 189 194 if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize())) 190 195 { … … 274 279 { 275 280 this->activeBrick_->setVelocity(Vector3::ZERO); 281 if(this->activeBrick_ != NULL) 282 { 283 this->player_->stopControl(); 284 } 285 276 286 this->cleanup(); 277 287 … … 343 353 344 354 // Apply the stone template to the stone. 345 brick->addTemplate(this->center_->get StoneTemplate()); // TODO: find error concerning the cameras355 brick->addTemplate(this->center_->getBrickTemplate()); 346 356 347 357 // Attach the brick to the Centerpoint and set the position of the brick to be at the top middle. … … 386 396 { 387 397 unsigned int correctPosition = 0; 388 orxout()<< "clear full rows ************ " <<endl;389 398 unsigned int stonesPerRow = 0; 390 399 for (unsigned int row = 0; row < this->center_->getHeight(); row++) … … 395 404 correctPosition = static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()); 396 405 if(correctPosition == row) 397 stonesPerRow++; 398 if(stonesPerRow == this->center_->getWidth()) 399 {orxout()<< "CANDIDATE FOUND in row " << row <<endl; clearRow(row);} 406 { 407 stonesPerRow++; 408 if(stonesPerRow == this->center_->getWidth()) 409 { 410 clearRow(row); 411 this->playerScored(this->player_); 412 } 413 } 414 400 415 } 401 416 … … 404 419 405 420 void Tetris::clearRow(unsigned int row) 406 {// std::vector<int>::iterator it = v.begin()421 {// clear the full row 407 422 for(std::vector<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 408 423 { 409 424 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row) 410 (*it)->setPosition(Vector3(- 10,-10,0));425 (*it)->setPosition(Vector3(-50,-50,100)); 411 426 //{(*it)->destroy(); this->stones_.erase(it); orxout()<< "destroy row "<<endl;}//experimental 412 427 } 413 for(std::vector<TetrisStone*>::const_reverse_iterator it2 = this->stones_.rbegin(); it2 != this->stones_.rend(); ++it2) 414 { 415 /*if(static_cast<unsigned int>(((*it2)->getPosition().y - 5)/this->center_->getStoneSize()) > row) 416 (*it2)->setPosition((*it2)->getPosition()-Vector3(0,1,0));//*/ 428 // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug. 429 for(std::vector<TetrisStone*>::iterator it2 = this->stones_.begin(); it2 != this->stones_.end(); ++it2) 430 { 431 if(static_cast<unsigned int>(((*it2)->getPosition().y - 5)/this->center_->getStoneSize()) > row) 432 (*it2)->setPosition((*it2)->getPosition()-Vector3(0,10,0)); 417 433 } 418 434
Note: See TracChangeset
for help on using the changeset viewer.