Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7076


Ignore:
Timestamp:
Jun 2, 2010, 12:39:46 AM (14 years ago)
Author:
landauf
Message:

removed some tabs in Dynamicmatch and ScreenshotManager

Location:
code/branches/presentation3/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc

    r7041 r7076  
    3939        mWindowHeight  = pRenderWindow->getHeight();
    4040        //create temporary texture
    41         mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", 
     41        mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex",
    4242                                                                  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
    43                                                                     mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET); 
    44        
     43                                                                    mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET);
     44
    4545        //get The current Render Target of the temp Texture
    4646        mRT = mTempTex->getBuffer()->getRenderTarget();
    4747
    48         //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture 
     48        //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture
    4949        mBuffer = mTempTex->getBuffer();
    5050
     
    7272        std::string fileName = PathConfig::getInstance().getLogPathString() + "screenshot_" + this->getTimestamp();
    7373
    74         //Remove all viewports, so the added Viewport(camera) ist the only 
     74        //Remove all viewports, so the added Viewport(camera) ist the only
    7575        mRT->removeAllViewports();
    7676        mRT->addViewport(camera);
    77                
     77
    7878        //set the viewport settings
    7979        Ogre::Viewport *vp = mRT->getViewport(0);
    80         vp->setClearEveryFrame(true); 
     80        vp->setClearEveryFrame(true);
    8181        vp->setOverlaysEnabled(false);
    8282
     
    103103            // set the original Frustum extents
    104104            camera->getFrustumExtents(originalFrustumLeft, originalFrustumRight, originalFrustumTop, originalFrustumBottom);
    105            
     105
    106106            // compute the Stepsize for the drid
    107107            Ogre::Real frustumGridStepHorizontal  = (originalFrustumRight * 2) / mGridSize;
     
    110110            // process each grid
    111111            Ogre::Real frustumLeft, frustumRight, frustumTop, frustumBottom;
    112             for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++) 
    113             { 
    114                 int y = nbScreenshots / mGridSize; 
    115                 int x = nbScreenshots - y * mGridSize; 
    116                
     112            for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++)
     113            {
     114                int y = nbScreenshots / mGridSize;
     115                int x = nbScreenshots - y * mGridSize;
     116
    117117                // Shoggoth frustum extents setting
    118118                // compute the new frustum extents
     
    121121                frustumTop    = originalFrustumTop - frustumGridStepVertical * y;
    122122                frustumBottom  = frustumTop - frustumGridStepVertical;
    123                
     123
    124124                // set the frustum extents value to the camera
    125125                camera->setFrustumExtents(frustumLeft, frustumRight, frustumTop, frustumBottom);
     
    128128                Ogre::Root::getSingletonPtr()->clearEventTimes();
    129129                mRT->update();    //render
    130                
    131                 //define the current 
     130
     131                //define the current
    132132                Ogre::Box subBox = Ogre::Box(x* mWindowWidth,y * mWindowHeight,x * mWindowWidth + mWindowWidth, y * mWindowHeight + mWindowHeight);
    133                 //copy the content from the temp buffer into the final picture PixelBox 
     133                //copy the content from the temp buffer into the final picture PixelBox
    134134                //Place the tempBuffer content at the right position
    135135                mBuffer->blitToMemory(mFinalPicturePB.getSubVolume(subBox));
    136136
    137137            }
    138            
     138
    139139            // set frustum extents to previous settings
    140140            camera->resetFrustumExtents();
    141            
     141
    142142            Ogre::Image finalImage; //declare the final Image Object
    143143            //insert the PixelBox data into the Image Object
     
    145145            // Save the Final image to a file
    146146            finalImage.save(fileName + "." + mFileExtension);
    147            
     147
    148148        }
    149149
     
    163163        pTime = localtime( &ctTime );
    164164        std::ostringstream oss;
    165         oss     << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1)
     165        oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1)
    166166            << std::setw(2) << std::setfill('0') << pTime->tm_mday
    167167            << std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900)
  • code/branches/presentation3/src/modules/designtools/ScreenshotManager.h

    r7044 r7076  
    2121
    2222
    23     /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.     
     23    /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
    2424    *  pRenderWindow:    Pointer to the render window.  This could be "mWindow" from the ExampleApplication,
    2525    *              the window automatically created obtained when calling
     
    4848        static void makeScreenshot_s()
    4949            { getInstance().makeScreenshot(); }
    50      
     50
    5151    protected:
    5252        static std::string getTimestamp();
  • code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc

    r7063 r7076  
    8080        this->numberOf[killer]=0;
    8181        this->tutorial=true;
    82         this->pointsPerTime=0.0f;
     82        this->pointsPerTime=0.0f;
    8383        this->setHUDTemplate("DynamicmatchHUD");
    8484    }
     
    9191        static ColourValue colours[] =
    9292        {
    93             ColourValue(1.0f, 0.3f, 0.3f),      //chasercolour
    94             ColourValue(0.3f, 0.3f, 1.0f),      //piggycolour
    95             ColourValue(0.3f, 1.0f, 0.3f)       //killercolour  what about black: 0.0f, 0.0f, 0.0f
    96            
     93            ColourValue(1.0f, 0.3f, 0.3f),  //chasercolour
     94            ColourValue(0.3f, 0.3f, 1.0f),  //piggycolour
     95            ColourValue(0.3f, 1.0f, 0.3f)   //killercolour  what about black: 0.0f, 0.0f, 0.0f
     96
    9797        };
    9898        static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
     
    102102
    103103    bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
    104     {   //TODO: static and fading message for the "human" player's
     104    { //TODO: static and fading message for the "human" player's
    105105        if (!originator||!victim)
    106106            return false;
     
    115115            if (notEnoughPigs)
    116116            {
    117                 numberOf[target]--;                             //decrease numberof victims's party
    118                 playerParty_[victim->getPlayer()]=piggy;        //victim's new party: pig
    119                 setPlayerColour(victim->getPlayer());           //victim's new colour
    120                 numberOf[piggy]++;                              //party switch: number of players is not affected (decrease and increase)
    121 
    122                     if(tutorial)                                //announce party switch
     117                numberOf[target]--; //decrease numberof victims's party
     118                playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig
     119                setPlayerColour(victim->getPlayer()); //victim's new colour
     120                numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase)
     121
     122                    if(tutorial) //announce party switch
    123123                    {
    124124                         std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer());
     
    129129                         }
    130130                    }
    131                     if (notEnoughKillers)                       //reward the originator
     131                    if (notEnoughKillers) //reward the originator
    132132                    {
    133                         numberOf[source]--;                     //decrease numberof originator's party
    134                         playerParty_[originator->getPlayer()]=killer;           //originator's new party: killer
    135                         setPlayerColour(originator->getPlayer());               //originator's new colour
     133                        numberOf[source]--; //decrease numberof originator's party
     134                        playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
     135                        setPlayerColour(originator->getPlayer()); //originator's new colour
    136136                        numberOf[killer]++;
    137137
    138                         if(tutorial)                            //announce party switch
     138                        if(tutorial) //announce party switch
    139139                        {
    140140                             std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
     
    146146                        }
    147147                    }
    148                 evaluatePlayerParties();                        //check if the party change has to trigger futher party changes
    149                        
     148                evaluatePlayerParties(); //check if the party change has to trigger futher party changes
     149
    150150                //Give new pig boost
    151151                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
     
    161161            else if (notEnoughKillers)
    162162            {
    163                 numberOf[source]--;     //decrease numberof originator's party
    164                 playerParty_[originator->getPlayer()]=killer;   //originator's new party: killer
    165                 setPlayerColour(originator->getPlayer());       //originator colour
    166                 numberOf[killer]++;                             //party switch: number of players is not affected (decrease and increase)
    167 
    168 
    169                 if(tutorial)                            //announce party switch
     163                numberOf[source]--; //decrease numberof originator's party
     164                playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
     165                setPlayerColour(originator->getPlayer()); //originator colour
     166                numberOf[killer]++; //party switch: number of players is not affected (decrease and increase)
     167
     168
     169                if(tutorial) //announce party switch
    170170                {
    171171                     std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
     
    176176                     }
    177177                }
    178                 evaluatePlayerParties();                        //check if the party change has to trigger futher party changes
     178                evaluatePlayerParties(); //check if the party change has to trigger futher party changes
    179179            }
    180180            //Case: notEnoughChasers: party change
    181181            else if (notEnoughChasers)
    182182            {
    183                 numberOf[target]--;     //decrease numberof victims's party
    184                 playerParty_[victim->getPlayer()]=chaser;       //victim's new party: chaser
    185                 setPlayerColour(victim->getPlayer());           //victim colour
    186                 numberOf[chaser]++;                             //party switch: number of players is not affected (decrease and increase)
    187 
    188                 if(tutorial)                                    //announce party switch
     183                numberOf[target]--; //decrease numberof victims's party
     184                playerParty_[victim->getPlayer()]=chaser; //victim's new party: chaser
     185                setPlayerColour(victim->getPlayer()); //victim colour
     186                numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase)
     187
     188                if(tutorial) //announce party switch
    189189                {
    190190                     std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
     
    193193                          if (numberOf[killer]>0)
    194194                              this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it3->first->getClientID(),partyColours_[piggy]);
    195                              
     195
    196196                          else
    197197                              this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID(),partyColours_[piggy]);
     
    199199                     }
    200200                }
    201                 evaluatePlayerParties();                        //check if the party change has to trigger futher party changes
     201                evaluatePlayerParties(); //check if the party change has to trigger futher party changes
    202202            }
    203203
     
    224224                playerParty_[originator->getPlayer()]=chaser;
    225225
    226                 //party switch -> colour switch         
     226                //party switch -> colour switch
    227227                setPlayerColour(victim->getPlayer()); //victim colour
    228228                setPlayerColour(originator->getPlayer());//originator colour
    229                
     229
    230230                //Announce pary switch
    231231                if(tutorial)
     
    233233                     std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
    234234                     if (it != this->players_.end())
    235                      {   
     235                     {
    236236                          if (numberOf[killer]>0)
    237237                              this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(), partyColours_[piggy]);
     
    258258            }
    259259            // killer vs piggy
    260             else if (source==killer &&target==piggy)            //party and colour switch       
     260            else if (source==killer &&target==piggy) //party and colour switch
    261261            {
    262262            playerParty_[victim->getPlayer()]=killer;
    263263            playerParty_[originator->getPlayer()]=piggy;
    264264
    265             setPlayerColour(victim->getPlayer());               //victim colour
    266             setPlayerColour(originator->getPlayer());           //originator colour
     265            setPlayerColour(victim->getPlayer()); //victim colour
     266            setPlayerColour(originator->getPlayer()); //originator colour
    267267
    268268            if(tutorial) //Announce pary switch
     
    298298
    299299    bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
    300     {   
     300    {
    301301        //killers can kill chasers and killers can be killed by chasers
    302302        if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer &&
    303303        playerParty_[originator->getPlayer()] == chaser ))
    304304        {
    305             if (playerParty_[originator->getPlayer()] == killer)        //reward the killer
     305            if (playerParty_[originator->getPlayer()] == killer) //reward the killer
    306306            {
    307307                std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
    308308                if (it != this->players_.end())
    309309                {
    310                     it->second.frags_+=20;      //value must be tested
     310                    it->second.frags_+=20; //value must be tested
    311311                }
    312312            }
     
    315315        else return false;
    316316    }
    317    
     317
    318318    void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
    319319    {
    320320        if (!player)
    321321            return;
    322        
    323         Dynamicmatch::setPlayerColour(player);  //Set playercolour
     322
     323        Dynamicmatch::setPlayerColour(player); //Set playercolour
    324324        evaluatePlayerParties();
    325325    }
     
    329329        if (!player)// only for safety
    330330            return;
    331         playerParty_[player]=chaser;            //Set playerparty
     331        playerParty_[player]=chaser; //Set playerparty
    332332        numberOf[chaser]++;
    333333        Gametype::playerEntered(player);
     
    351351            COUT(0) << message << std::endl;
    352352            Host::Broadcast(message);
    353                 //remove player from map
     353            //remove player from map
    354354            playerParty_.erase (player);
    355                 //adjust player parties
     355            //adjust player parties
    356356            evaluatePlayerParties();
    357357        }
     
    376376            {
    377377                this->gameEnded_ = true;
    378                 this->end();       
    379             }
    380             if ( gameTime_ <= timesequence_ && gameTime_ > 0)
     378                this->end();
     379            }
     380            if ( gameTime_ <= timesequence_ && gameTime_ > 0)
    381381            {
    382382                const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
     
    397397                }
    398398            }
    399         }
     399        }
    400400    }
    401401
     
    433433                }
    434434            }
    435         }
     435    }
    436436
    437437    void Dynamicmatch::evaluatePlayerParties() //manages the notEnough booleans (here the percentage of special players is implemented)
     
    483483                       }
    484484                  }
    485                  
     485
    486486             }
    487487        }
     
    532532                       }
    533533                  }
    534                  
     534
    535535             }
    536            
     536
    537537        }
    538538        //chasers: there are more chasers than killers + pigs
     
    582582                       }
    583583                  }
    584                  
     584
    585585             }
    586         }       
     586        }
    587587    }
    588588
     
    614614    }
    615615
    616     void Dynamicmatch::start() 
    617     {   
     616    void Dynamicmatch::start()
     617    {
    618618        Gametype::start();
    619619        if(!tutorial)
     
    632632            }
    633633        }
    634     }   
     634    }
    635635
    636636    /*void Dynamicmatch::instructions()
  • code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h

    r7063 r7076  
    4343            Dynamicmatch(BaseObject* creator);
    4444            virtual ~Dynamicmatch() {}
    45                
     45
    4646            bool notEnoughPigs;
    4747            bool notEnoughKillers;
    4848            bool notEnoughChasers;
    4949
    50             //three different parties   
     50            //three different parties
    5151            int chaser;
    5252            int piggy;
     
    5757            void setPlayerColour(PlayerInfo* player);//own function
    5858            void setConfigValues();//done
    59            
     59
    6060            bool friendlyfire; //goal: player can switch it on/off
    6161            bool tutorial; //goal: new players recieve messages how the new gametype works - later it can be switched off.
    62            
     62
    6363            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties
    6464            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple
     
    6969            virtual bool playerLeft(PlayerInfo* player);
    7070            virtual bool playerChangedName(PlayerInfo* player);//unchanged
    71            
     71
    7272            /*virtual void instructions();
    7373            virtual void furtherInstructions();*/
    7474            virtual void rewardPig();
    75             void resetSpeedFactor(WeakPtr<Engine>* ptr); 
     75            void resetSpeedFactor(WeakPtr<Engine>* ptr);
    7676            void tick (float dt);// used to end the game
    7777            SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
    78            
     78
    7979        protected:
    8080
Note: See TracChangeset for help on using the changeset viewer.