[Orxonox-commit 2347] r7062 - in code/branches/presentation3: data/levels src/modules/overlays/hud src/orxonox/gametypes src/orxonox/infos src/orxonox/interfaces
jo at orxonox.net
jo at orxonox.net
Mon May 31 16:55:05 CEST 2010
Author: jo
Date: 2010-05-31 16:55:05 +0200 (Mon, 31 May 2010)
New Revision: 7062
Modified:
code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h
Log:
coloured messages, different spaceships in one level, with bug
Modified: code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw
===================================================================
--- code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw 2010-05-31 14:55:05 UTC (rev 7062)
@@ -2,8 +2,9 @@
include("hudtemplates3.oxo")
include("stats.oxo")
include("templates/spaceship_assff.oxt")
- include("templates/spaceship_H2.oxt")
+ include("templates/spaceship_ghost.oxt")
include("dynamicmatchhud.oxo")
+ include("templates/lodinformation.oxt")
?>
<Level
@@ -11,6 +12,10 @@
description = "In progress -level for dynamicmatch"
gametype = "Dynamicmatch"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/Starbox"
@@ -51,9 +56,9 @@
<?lua
createSpaceStationPar(0,2,1,2,1,4,1,50)
?>
- <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
- <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
- <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+ <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/>
+ <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/>
+ <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/>
</attached>
</StaticEntity>
</attached>
Modified: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc 2010-05-31 14:55:05 UTC (rev 7062)
@@ -48,11 +48,14 @@
{
}
- void GametypeStaticMessage::staticmessage(const GametypeInfo* gtinfo, const std::string& message)
+ void GametypeStaticMessage::staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour)
{
if (this->owner_ && this->owner_->getGametypeInfo() == gtinfo)
+ {
+ this->setColour(colour);
this->setCaption(message);
}
+ }
void GametypeStaticMessage::changedOwner()
{
Modified: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h 2010-05-31 14:55:05 UTC (rev 7062)
@@ -47,7 +47,7 @@
virtual void changedOwner();
- void staticmessage(const GametypeInfo* gtinfo, const std::string& message);
+ void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour);
private:
PlayerInfo* owner_;
Modified: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc 2010-05-31 14:55:05 UTC (rev 7062)
@@ -81,7 +81,8 @@
this->tutorial=true;
this->pointsPerTime=0.0f;
this->setHUDTemplate("DynamicmatchHUD");
-
+ this->allowDeath=false;
+ this->notYet=true;
}
void Dynamicmatch::setConfigValues()
@@ -118,13 +119,20 @@
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[piggy]++; //party switch: number of players is not affected (decrease and increase)
+
+ if (target == killer)
+ {
+ allowDeath=true;
+ victim->kill(); //new ship
+ }
+
if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer());
if (it2 != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID(), partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
}
}
@@ -134,12 +142,14 @@
playerParty_[originator->getPlayer()]=killer; //originator's new party: killer
setPlayerColour(originator->getPlayer()); //originator's new colour
numberOf[killer]++;
+ allowDeath=true;
+ originator->kill(); //new ship for killer
if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
if (it3 != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(), partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
}
}
@@ -159,16 +169,19 @@
//Case: notEnoughKillers: party change
else if (notEnoughKillers)
{
- numberOf[target]--; //decrease numberof victims's party
- playerParty_[victim->getPlayer()]=killer; //victim's new party: killer
- setPlayerColour(victim->getPlayer()); //victim colour
+ 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)
+
+ allowDeath=true;
+ originator->kill(); //new ship
if(tutorial) //announce party switch
{
std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer());
if (it3 != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(),partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
}
}
@@ -181,16 +194,20 @@
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)
+
+ allowDeath=true;
+ victim->kill(); //new ship
+
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());
+ 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());
+ 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());
}
}
@@ -230,15 +247,15 @@
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());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(), partyColours_[piggy]);
else
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
}
std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer());
if (it2 != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID(),partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
}
}
@@ -260,19 +277,25 @@
setPlayerColour(victim->getPlayer()); //victim colour
setPlayerColour(originator->getPlayer()); //originator colour
-
+
+ notYet=false;
+ allowDeath=true;
+ victim->kill(); //new ship
+ originator->kill(); //new ship
+
+
if(tutorial) //Announce pary switch
{
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
if (it != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
}
std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer());
if (it2 != this->players_.end())
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID(),partyColours_[chaser]);
this->gtinfo_->sendFadingMessage("You're now a killer.",it2->first->getClientID());
}
}
@@ -294,6 +317,14 @@
bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
{
+ if (allowDeath)//Hack for Ghost-Spaceship
+ {
+ if (notYet)
+ {allowDeath=false;}
+ else
+ {notYet=true;}
+ return true;
+ }
//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 ))
@@ -410,7 +441,7 @@
}
}
}
- void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a players colour
+ void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a player's colour
{
std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player);
Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
@@ -444,7 +475,7 @@
continue;
if (it->first->getClientID() == CLIENTID_UNKNOWN)
continue;
- this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
}
}
}
@@ -462,19 +493,19 @@
else if (it->second==chaser)
{
if (numberOf[killer]>0)
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
else
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
//this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
}
else if (it->second==piggy)
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
//this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
}
else if (it->second==killer)
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
@@ -493,7 +524,7 @@
continue;
if (it->first->getClientID() == CLIENTID_UNKNOWN)
continue;
- this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
}
}
}
@@ -511,19 +542,19 @@
else if (it->second==chaser)
{
if (numberOf[killer]>0)
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
else
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
//this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
}
else if (it->second==piggy)
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[piggy]);
//this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
}
else if (it->second==killer)
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]);
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
@@ -543,7 +574,7 @@
continue;
if (it->first->getClientID() == CLIENTID_UNKNOWN)
continue;
- this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
}
}
}
@@ -561,19 +592,19 @@
else if (it->second==chaser)
{
if (numberOf[killer]>0)
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
else
- this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
//this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
}
else if (it->second==piggy)
{
- this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
//this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
}
else if (it->second==killer)
{
- this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
//this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
}
}
@@ -624,7 +655,7 @@
{
if (it->first->getClientID() == CLIENTID_UNKNOWN)
continue;
- this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
}
}
}
@@ -650,16 +681,6 @@
std::string message("Time out. Press F2 to see the points you scored.");
COUT(0) << message << std::endl;
Host::Broadcast(message);
- /*for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
- {
- if (it->first->getClientID() == CLIENTID_UNKNOWN)
- continue;
-
- if (it->second == 1)
- this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
- else
- this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
- }*/
}
SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const
{
Modified: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h 2010-05-31 14:55:05 UTC (rev 7062)
@@ -78,6 +78,8 @@
protected:
+ bool allowDeath;
+ bool notYet;
std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here
std::vector<ColourValue> partyColours_; //aus TeamDeathmatch
unsigned int numberOf[3]; //array to count number of chasers, pigs, killers
Modified: code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc 2010-05-31 14:55:05 UTC (rev 7062)
@@ -111,14 +111,14 @@
}
}
- void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID)
+ void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour)
{
if (GameMode::isMaster())
{
if (clientID == CLIENTID_SERVER)
- this->dispatchStaticMessage(message);
+ this->dispatchStaticMessage(message, colour);
else
- callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message);
+ callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
}
}
@@ -151,10 +151,10 @@
it->deathmessage(this, message);
}
- void GametypeInfo::dispatchStaticMessage(const std::string& message)
+ void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour)
{
for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
- it->staticmessage(this, message);
+ it->staticmessage(this, message, colour);
}
void GametypeInfo::dispatchFadingMessage(const std::string& message)
Modified: code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-05-31 14:55:05 UTC (rev 7062)
@@ -63,13 +63,13 @@
void sendAnnounceMessage(const std::string& message, unsigned int clientID);
void sendKillMessage(const std::string& message, unsigned int clientID);
void sendDeathMessage(const std::string& message, unsigned int clientID);
- void sendStaticMessage(const std::string& message, unsigned int clientID);
+ void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour);
void sendFadingMessage(const std::string& message, unsigned int clientID);
void dispatchAnnounceMessage(const std::string& message);
void dispatchKillMessage(const std::string& message);
void dispatchDeathMessage(const std::string& message);
- void dispatchStaticMessage(const std::string& message);
+ void dispatchStaticMessage(const std::string& message,const ColourValue& colour);
void dispatchFadingMessage(const std::string& message);
private:
Modified: code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h
===================================================================
--- code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h 2010-05-31 14:44:51 UTC (rev 7061)
+++ code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h 2010-05-31 14:55:05 UTC (rev 7062)
@@ -43,7 +43,7 @@
virtual void announcemessage(const GametypeInfo* gtinfo, const std::string& message) {}
virtual void killmessage(const GametypeInfo* gtinfo, const std::string& message) {}
virtual void deathmessage(const GametypeInfo* gtinfo, const std::string& message) {}
- virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message) {}
+ virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour) {}
virtual void fadingmessage(const GametypeInfo* gtinfo, const std::string& message) {}
};
}
More information about the Orxonox-commit
mailing list