[Orxonox-commit 2361] r7076 - in code/branches/presentation3/src: modules/designtools orxonox/gametypes
landauf at orxonox.net
landauf at orxonox.net
Wed Jun 2 00:39:47 CEST 2010
Author: landauf
Date: 2010-06-02 00:39:46 +0200 (Wed, 02 Jun 2010)
New Revision: 7076
Modified:
code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc
code/branches/presentation3/src/modules/designtools/ScreenshotManager.h
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
Log:
removed some tabs in Dynamicmatch and ScreenshotManager
Modified: code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc 2010-06-01 22:27:03 UTC (rev 7075)
+++ code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc 2010-06-01 22:39:46 UTC (rev 7076)
@@ -38,14 +38,14 @@
mWindowWidth = pRenderWindow->getWidth();
mWindowHeight = pRenderWindow->getHeight();
//create temporary texture
- mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex",
+ mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
- mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET);
-
+ mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET);
+
//get The current Render Target of the temp Texture
mRT = mTempTex->getBuffer()->getRenderTarget();
- //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture
+ //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture
mBuffer = mTempTex->getBuffer();
//create PixelBox
@@ -71,13 +71,13 @@
Ogre::Camera* camera = CameraManager::getInstance().getActiveCamera()->getOgreCamera();
std::string fileName = PathConfig::getInstance().getLogPathString() + "screenshot_" + this->getTimestamp();
- //Remove all viewports, so the added Viewport(camera) ist the only
+ //Remove all viewports, so the added Viewport(camera) ist the only
mRT->removeAllViewports();
mRT->addViewport(camera);
-
+
//set the viewport settings
Ogre::Viewport *vp = mRT->getViewport(0);
- vp->setClearEveryFrame(true);
+ vp->setClearEveryFrame(true);
vp->setOverlaysEnabled(false);
// remind current overlay flag
@@ -102,49 +102,49 @@
Ogre::Real originalFrustumLeft, originalFrustumRight, originalFrustumTop, originalFrustumBottom;
// set the original Frustum extents
camera->getFrustumExtents(originalFrustumLeft, originalFrustumRight, originalFrustumTop, originalFrustumBottom);
-
+
// compute the Stepsize for the drid
Ogre::Real frustumGridStepHorizontal = (originalFrustumRight * 2) / mGridSize;
Ogre::Real frustumGridStepVertical = (originalFrustumTop * 2) / mGridSize;
// process each grid
Ogre::Real frustumLeft, frustumRight, frustumTop, frustumBottom;
- for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++)
- {
- int y = nbScreenshots / mGridSize;
- int x = nbScreenshots - y * mGridSize;
-
+ for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++)
+ {
+ int y = nbScreenshots / mGridSize;
+ int x = nbScreenshots - y * mGridSize;
+
// Shoggoth frustum extents setting
// compute the new frustum extents
frustumLeft = originalFrustumLeft + frustumGridStepHorizontal * x;
frustumRight = frustumLeft + frustumGridStepHorizontal;
frustumTop = originalFrustumTop - frustumGridStepVertical * y;
frustumBottom = frustumTop - frustumGridStepVertical;
-
+
// set the frustum extents value to the camera
camera->setFrustumExtents(frustumLeft, frustumRight, frustumTop, frustumBottom);
// ignore time duration between frames
Ogre::Root::getSingletonPtr()->clearEventTimes();
mRT->update(); //render
-
- //define the current
+
+ //define the current
Ogre::Box subBox = Ogre::Box(x* mWindowWidth,y * mWindowHeight,x * mWindowWidth + mWindowWidth, y * mWindowHeight + mWindowHeight);
- //copy the content from the temp buffer into the final picture PixelBox
+ //copy the content from the temp buffer into the final picture PixelBox
//Place the tempBuffer content at the right position
mBuffer->blitToMemory(mFinalPicturePB.getSubVolume(subBox));
}
-
+
// set frustum extents to previous settings
camera->resetFrustumExtents();
-
+
Ogre::Image finalImage; //declare the final Image Object
//insert the PixelBox data into the Image Object
finalImage = finalImage.loadDynamicImage(static_cast<unsigned char*>(mFinalPicturePB.data), mFinalPicturePB.getWidth(),mFinalPicturePB.getHeight(),Ogre::PF_B8G8R8);
// Save the Final image to a file
finalImage.save(fileName + "." + mFileExtension);
-
+
}
// do we have to re-enable our overlays?
@@ -162,7 +162,7 @@
time_t ctTime; time(&ctTime);
pTime = localtime( &ctTime );
std::ostringstream oss;
- oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1)
+ oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1)
<< std::setw(2) << std::setfill('0') << pTime->tm_mday
<< std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900)
<< "_" << std::setw(2) << std::setfill('0') << pTime->tm_hour
Modified: code/branches/presentation3/src/modules/designtools/ScreenshotManager.h
===================================================================
--- code/branches/presentation3/src/modules/designtools/ScreenshotManager.h 2010-06-01 22:27:03 UTC (rev 7075)
+++ code/branches/presentation3/src/modules/designtools/ScreenshotManager.h 2010-06-01 22:39:46 UTC (rev 7076)
@@ -20,7 +20,7 @@
{
- /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
+ /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
* pRenderWindow: Pointer to the render window. This could be "mWindow" from the ExampleApplication,
* the window automatically created obtained when calling
* Ogre::Root::getSingletonPtr()->initialise(false) and retrieved by calling
@@ -47,7 +47,7 @@
static void makeScreenshot_s()
{ getInstance().makeScreenshot(); }
-
+
protected:
static std::string getTimestamp();
Modified: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc 2010-06-01 22:27:03 UTC (rev 7075)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc 2010-06-01 22:39:46 UTC (rev 7076)
@@ -79,7 +79,7 @@
this->numberOf[piggy]=0;
this->numberOf[killer]=0;
this->tutorial=true;
- this->pointsPerTime=0.0f;
+ this->pointsPerTime=0.0f;
this->setHUDTemplate("DynamicmatchHUD");
}
@@ -90,10 +90,10 @@
SetConfigValue(tutorial, true);
static ColourValue colours[] =
{
- ColourValue(1.0f, 0.3f, 0.3f), //chasercolour
- ColourValue(0.3f, 0.3f, 1.0f), //piggycolour
- ColourValue(0.3f, 1.0f, 0.3f) //killercolour what about black: 0.0f, 0.0f, 0.0f
-
+ ColourValue(1.0f, 0.3f, 0.3f), //chasercolour
+ ColourValue(0.3f, 0.3f, 1.0f), //piggycolour
+ ColourValue(0.3f, 1.0f, 0.3f) //killercolour what about black: 0.0f, 0.0f, 0.0f
+
};
static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
@@ -101,7 +101,7 @@
}
bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
- { //TODO: static and fading message for the "human" player's
+ { //TODO: static and fading message for the "human" player's
if (!originator||!victim)
return false;
if (!originator->getPlayer()||!victim->getPlayer())
@@ -114,12 +114,12 @@
//Case: Not Enough Pigs: party change (= party management)
if (notEnoughPigs)
{
- numberOf[target]--; //decrease numberof victims's party
- playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig
- setPlayerColour(victim->getPlayer()); //victim's new colour
- numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase)
+ numberOf[target]--; //decrease numberof victims's party
+ playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig
+ setPlayerColour(victim->getPlayer()); //victim's new colour
+ numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase)
- if(tutorial) //announce party switch
+ if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer());
if (it2 != this->players_.end())
@@ -128,14 +128,14 @@
this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
}
}
- if (notEnoughKillers) //reward the originator
+ if (notEnoughKillers) //reward the originator
{
- numberOf[source]--; //decrease numberof originator's party
- playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
- setPlayerColour(originator->getPlayer()); //originator's new colour
+ numberOf[source]--; //decrease numberof originator's party
+ playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
+ setPlayerColour(originator->getPlayer()); //originator's new colour
numberOf[killer]++;
- if(tutorial) //announce party switch
+ if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
if (it3 != this->players_.end())
@@ -145,8 +145,8 @@
}
}
}
- evaluatePlayerParties(); //check if the party change has to trigger futher party changes
-
+ evaluatePlayerParties(); //check if the party change has to trigger futher party changes
+
//Give new pig boost
SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
if (spaceship && spaceship->getEngine())
@@ -160,13 +160,13 @@
//Case: notEnoughKillers: party change
else if (notEnoughKillers)
{
- numberOf[source]--; //decrease numberof originator's party
- playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
- setPlayerColour(originator->getPlayer()); //originator colour
- numberOf[killer]++; //party switch: number of players is not affected (decrease and increase)
+ numberOf[source]--; //decrease numberof originator's party
+ playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
+ setPlayerColour(originator->getPlayer()); //originator colour
+ numberOf[killer]++; //party switch: number of players is not affected (decrease and increase)
- if(tutorial) //announce party switch
+ if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
if (it3 != this->players_.end())
@@ -175,30 +175,30 @@
this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
}
}
- evaluatePlayerParties(); //check if the party change has to trigger futher party changes
+ evaluatePlayerParties(); //check if the party change has to trigger futher party changes
}
//Case: notEnoughChasers: party change
else if (notEnoughChasers)
{
- numberOf[target]--; //decrease numberof victims's party
- playerParty_[victim->getPlayer()]=chaser; //victim's new party: chaser
- setPlayerColour(victim->getPlayer()); //victim colour
- numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase)
+ numberOf[target]--; //decrease numberof victims's party
+ playerParty_[victim->getPlayer()]=chaser; //victim's new party: chaser
+ setPlayerColour(victim->getPlayer()); //victim colour
+ numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase)
- if(tutorial) //announce party switch
+ if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
if (it3 != this->players_.end())
{
if (numberOf[killer]>0)
this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it3->first->getClientID(),partyColours_[piggy]);
-
+
else
this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID(),partyColours_[piggy]);
this->gtinfo_->sendFadingMessage("You're now a chaser.",it3->first->getClientID());
}
}
- evaluatePlayerParties(); //check if the party change has to trigger futher party changes
+ evaluatePlayerParties(); //check if the party change has to trigger futher party changes
}
//Case: chaser vs. killer
@@ -223,16 +223,16 @@
playerParty_[victim->getPlayer()]=piggy;
playerParty_[originator->getPlayer()]=chaser;
- //party switch -> colour switch
+ //party switch -> colour switch
setPlayerColour(victim->getPlayer()); //victim colour
setPlayerColour(originator->getPlayer());//originator colour
-
+
//Announce pary switch
if(tutorial)
{
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
if (it != this->players_.end())
- {
+ {
if (numberOf[killer]>0)
this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(), partyColours_[piggy]);
else
@@ -257,13 +257,13 @@
}
// killer vs piggy
- else if (source==killer &&target==piggy) //party and colour switch
+ else if (source==killer &&target==piggy) //party and colour switch
{
playerParty_[victim->getPlayer()]=killer;
playerParty_[originator->getPlayer()]=piggy;
- setPlayerColour(victim->getPlayer()); //victim colour
- setPlayerColour(originator->getPlayer()); //originator colour
+ setPlayerColour(victim->getPlayer()); //victim colour
+ setPlayerColour(originator->getPlayer()); //originator colour
if(tutorial) //Announce pary switch
{
@@ -297,30 +297,30 @@
bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
- {
+ {
//killers can kill chasers and killers can be killed by chasers
if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer &&
playerParty_[originator->getPlayer()] == chaser ))
{
- if (playerParty_[originator->getPlayer()] == killer) //reward the killer
+ if (playerParty_[originator->getPlayer()] == killer) //reward the killer
{
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
if (it != this->players_.end())
{
- it->second.frags_+=20; //value must be tested
+ it->second.frags_+=20; //value must be tested
}
}
return true;
}
else return false;
}
-
+
void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
{
if (!player)
return;
-
- Dynamicmatch::setPlayerColour(player); //Set playercolour
+
+ Dynamicmatch::setPlayerColour(player); //Set playercolour
evaluatePlayerParties();
}
@@ -328,7 +328,7 @@
{
if (!player)// only for safety
return;
- playerParty_[player]=chaser; //Set playerparty
+ playerParty_[player]=chaser; //Set playerparty
numberOf[chaser]++;
Gametype::playerEntered(player);
const std::string& message6 = player->getName() + " entered the game";
@@ -350,9 +350,9 @@
const std::string& message = player->getName() + " left the game";
COUT(0) << message << std::endl;
Host::Broadcast(message);
- //remove player from map
+ //remove player from map
playerParty_.erase (player);
- //adjust player parties
+ //adjust player parties
evaluatePlayerParties();
}
@@ -375,9 +375,9 @@
if (gameTime_<= 0)
{
this->gameEnded_ = true;
- this->end();
+ this->end();
}
- if ( gameTime_ <= timesequence_ && gameTime_ > 0)
+ if ( gameTime_ <= timesequence_ && gameTime_ > 0)
{
const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
@@ -396,7 +396,7 @@
timesequence_ = timesequence_ - 30;
}
}
- }
+ }
}
void Dynamicmatch::rewardPig()
@@ -432,7 +432,7 @@
}
}
}
- }
+ }
void Dynamicmatch::evaluatePlayerParties() //manages the notEnough booleans (here the percentage of special players is implemented)
{
@@ -482,7 +482,7 @@
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
-
+
}
}
//killers: every 4th player is a killer
@@ -531,9 +531,9 @@
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
-
+
}
-
+
}
//chasers: there are more chasers than killers + pigs
if (numberOf[piggy]+numberOf[killer] > numberOf[chaser])
@@ -581,9 +581,9 @@
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
-
+
}
- }
+ }
}
int Dynamicmatch::getParty(PlayerInfo* player) // helper function for ArtificialController
@@ -613,8 +613,8 @@
return valid_player;
}
- void Dynamicmatch::start()
- {
+ void Dynamicmatch::start()
+ {
Gametype::start();
if(!tutorial)
{
@@ -631,7 +631,7 @@
this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
}
}
- }
+ }
/*void Dynamicmatch::instructions()
{
Modified: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h 2010-06-01 22:27:03 UTC (rev 7075)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h 2010-06-01 22:39:46 UTC (rev 7076)
@@ -42,12 +42,12 @@
public:
Dynamicmatch(BaseObject* creator);
virtual ~Dynamicmatch() {}
-
+
bool notEnoughPigs;
bool notEnoughKillers;
bool notEnoughChasers;
- //three different parties
+ //three different parties
int chaser;
int piggy;
int killer;
@@ -56,10 +56,10 @@
int getParty(PlayerInfo* player);
void setPlayerColour(PlayerInfo* player);//own function
void setConfigValues();//done
-
+
bool friendlyfire; //goal: player can switch it on/off
bool tutorial; //goal: new players recieve messages how the new gametype works - later it can be switched off.
-
+
virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties
virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple
virtual void start();
@@ -68,14 +68,14 @@
virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);//is used to initialize the player's party and colour
virtual bool playerLeft(PlayerInfo* player);
virtual bool playerChangedName(PlayerInfo* player);//unchanged
-
+
/*virtual void instructions();
virtual void furtherInstructions();*/
virtual void rewardPig();
- void resetSpeedFactor(WeakPtr<Engine>* ptr);
+ void resetSpeedFactor(WeakPtr<Engine>* ptr);
void tick (float dt);// used to end the game
SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
-
+
protected:
std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here
More information about the Orxonox-commit
mailing list