Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2012, 5:44:29 PM (13 years ago)
Author:
jo
Message:

backup checkin - still the same bugs experiencable

Location:
code/branches/pCuts/src/modules/tetris
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pCuts/src/modules/tetris/Tetris.cc

    r9084 r9085  
    9999            {
    100100                this->activeBrick_->setVelocity(Vector3::ZERO);
     101                this->activeBrick_->releaseStones(this->center_);
     102                //delete this->activeBrick_; //releasing the memory
    101103                this->createBrick();
    102104                this->startBrick();
     
    120122
    121123            const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
     124            orxout()<< "position.x: " << position.x << endl;
     125            orxout()<< "currentStonePosition.x: " << currentStonePosition.x << endl;
     126            if(position.x == currentStonePosition.x)
     127                orxout()<< "NON Valid Move Candidate" <<endl;
    122128
    123129            if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
     
    145151                stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount());
    146152
    147             /*orxout()<< "stoneRelativePoistion: " << stonePosition << endl;
    148             orxout()<< "stoneTotalPoistion   : " << position + stonePosition << endl;*/
    149 
    150153            if(! this->isValidMove(stone, position + stonePosition )) // wrong position??
    151154            {
     
    168171            if(this->activeBrick_->contains(*it))
    169172                continue;
    170 //TODO: is this rotation correct ??
    171             Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
     173            //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
     174            const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
    172175            //!< Saves the position of the currentStone
     176            if(position.x == currentStonePosition.x)
     177            {
     178                orxout()<< "candidate found" << endl;
     179                orxout()<< "position.y: "<< position.y << endl;
     180                orxout()<< "urrentStonePosition.y: " << currentStonePosition.y << endl;
     181            }
    173182
    174183            if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize()))
    175184            {//TODO: Why are such events not detected ??
     185             // Because currentStonePosition.x isn't calculated globally, but locally
    176186                orxout()<< "YEAY !!"<<endl;
    177187                this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeBrick_->getPosition().z));
     
    207217    /**
    208218    @brief
    209         Nasty function that allocates memory!! it rolls a vector 90° * amount
     219        A Vector3 is rolled 90 * degrees * amount (anticlockwise rotation)
    210220    */
    211221    Vector3 Tetris::rotateVector(Vector3 position, unsigned int amount)
    212222    {
    213 
    214223        int temp = 0;
    215224        for(unsigned int i = 0; i < amount; i++)
     
    230239        if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.
    231240        {
    232             // Create the first stone.
     241            // Create the first brick.
    233242            this->createBrick();
    234243        }
  • code/branches/pCuts/src/modules/tetris/TetrisBrick.cc

    r9084 r9085  
    5353        RegisterObject(TetrisBrick);
    5454
    55         this->shapeIndex_ = 1; //<! TODO: random number between 0 and 7
     55        this->shapeIndex_ = 4; //<! TODO: random number between 0 and 7
    5656        this->stonesPerBrick_ = 4; //<! most tetris bricks is formed by 4 stones
    5757        this->delay_ = false;
     
    241241        this->setVelocity(0.0f, 0.0f, 0.0f);
    242242    }
     243    /**
     244    @brief
     245        Attaches stones to the Centerpoint.
     246    */
     247    void TetrisBrick::releaseStones(TetrisCenterpoint* center)
     248    {
     249        for(unsigned int i = 0; i < brickStones_.size(); i++)
     250        {
     251            //this->brickStones_[i]->detachFromParent();
     252
     253            //this->brickStones_[i]->detach(this);
     254            //this->brickStones_[i]->attach(center);
     255        }
     256
     257    }
    243258
    244259}
  • code/branches/pCuts/src/modules/tetris/TetrisBrick.h

    r9084 r9085  
    7272                { return this->rotationCount_;}
    7373
     74            void releaseStones(TetrisCenterpoint* center);
     75
    7476        protected:
    7577            void createBrick(void); //!< Create a cluster of TetrisStones
  • code/branches/pCuts/src/modules/tetris/TetrisStone.cc

    r9082 r9085  
    7272        else if(!this->lockRotation_) //rotate when key up is pressed
    7373        {
    74             orxout() << "The object should be rolled soon." << endl;
    7574            this->lockRotation_ = true; // multiple calls of this function have to be filtered out.
    7675            this->rotationTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&TetrisStone::unlockRotation, this)));
Note: See TracChangeset for help on using the changeset viewer.