[Orxonox-commit 2876] r7579 - in code/branches/lastmanstanding: data/levels data/overlays src/orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Fri Oct 22 16:19:40 CEST 2010
Author: jo
Date: 2010-10-22 16:19:40 +0200 (Fri, 22 Oct 2010)
New Revision: 7579
Modified:
code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
Log:
Jetzt auch mit einfachem HUD.
Modified: code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
===================================================================
--- code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw 2010-10-21 21:45:26 UTC (rev 7578)
+++ code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw 2010-10-22 14:19:40 UTC (rev 7579)
@@ -2,6 +2,7 @@
include("stats.oxo")
include("hudtemplates3.oxo")
include("templates/lodinformation.oxt")
+ include("lastmanstandinghud.oxo")
?>
<?lua
@@ -102,6 +103,11 @@
<Model position="0,0,0" scale=25 mesh="ast6.mesh" shadow=true />
<!--ParticleEmitter position="0,0,0" source="Orxonox/Steam" /-->
</attached>
+
+ <!--collisionShapes>
+ <BoxCollisionShape position="<?lua print(y) ?>,0,<?lua print(z) ?>" halfExtents="50, 200, 50" />
+ </collisionShapes-->
+
</MovableEntity>
<?lua
Modified: code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo
===================================================================
--- code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo 2010-10-21 21:45:26 UTC (rev 7578)
+++ code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo 2010-10-22 14:19:40 UTC (rev 7579)
@@ -15,9 +15,10 @@
name = "fadingmessage"
position = "0.5, 0.05"
font = "VeraMono"
- textsize = 0.04
+ textsize = 0.033
colour = "1.0, 1.0, 0.5, 1.0"
align = "center"
/>
+
</OverlayGroup>
</Template>
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-21 21:45:26 UTC (rev 7578)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-22 14:19:40 UTC (rev 7579)
@@ -33,6 +33,7 @@
#include "infos/PlayerInfo.h"
#include "worldentities/pawns/Pawn.h"
#include "core/ConfigValueIncludes.h"
+#include "util/Convert.h"
namespace orxonox
{
@@ -45,6 +46,7 @@
this->lives=4;
this->playersAlive=0;
this->timeRemaining=20.0f;
+ this->setHUDTemplate("LastmanstandingHUD");
}
void LastManStanding::spawnDeadPlayersIfRequested()
@@ -127,6 +129,15 @@
const std::string& message = player->getName() + " entered the game";
COUT(0) << message << std::endl;
Host::Broadcast(message);
+ //Update: EachPlayer's "Players in Game"-HUD
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ {
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive);
+ this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
+ }
+
}
bool LastManStanding::playerLeft(PlayerInfo* player)
@@ -141,6 +152,14 @@
const std::string& message = player->getName() + " left the game";
COUT(0) << message << std::endl;
Host::Broadcast(message);
+ //Update: EachPlayer's "Players in Game"-HUD
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ {
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive);
+ this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
+ }
}
return valid_player;
@@ -160,6 +179,33 @@
return valid_player;
}
+ void LastManStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
+ {
+ if (!player)
+ return;
+ //Update: Individual Players "lifes"-HUD
+ std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(player);
+ if (it2 != this->players_.end())
+ {
+ const std::string& message = "Your Lives: " +multi_cast<std::string>(playerLives_[player]);
+ this->gtinfo_->sendFadingMessage(message,it2->first->getClientID());
+
+ }
+ }
+
+ void LastManStanding::playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn)
+ {
+ //Update: EachPlayer's "Players in Game"-HUD
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ {
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ const std::string& message1 = "Remaining Players : "+ multi_cast<std::string>(playersAlive);
+ this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
+ }
+
+ }
+
void LastManStanding::pawnKilled(Pawn* victim, Pawn* killer)
{
if (victim && victim->getPlayer())
@@ -223,10 +269,10 @@
this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
}
+
}
}
-
void LastManStanding::tick(float dt)
{
SUPER(LastManStanding, tick, dt);
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h 2010-10-21 21:45:26 UTC (rev 7578)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h 2010-10-22 14:19:40 UTC (rev 7579)
@@ -29,12 +29,7 @@
@file LastManStanding.h
@brief Declaration of the Gametype "Last Man Standing".
*/
-/* BY THE WAY
-//!You have to ADD BOTS (or any other further players) BEFORE actually starting a match!
-//Maybe a warning should be added in the menu, if a player starts a Last Man Standing match alone.
-//Whenever there is only on player in the game, this player will be declared as winner.
-//How "death" is managed: dead players cannot respawn.
-*/
+
#ifndef _LastManStanding_H__
#define _LastManStanding_H__
@@ -71,13 +66,14 @@
virtual void start(); //!< Sends a start message.
virtual void end(); //!< Sends an end message.
- virtual void playerEntered(PlayerInfo* player);
- virtual bool playerLeft(PlayerInfo* player);
+ virtual void playerEntered(PlayerInfo* player); //!< Initializes values. Manages the gametype's HUD. #Players alive via StaticMessage.
+ virtual bool playerLeft(PlayerInfo* player); //!< Manages the gametype's HUD. #Players alive via StaticMessage.
virtual bool playerChangedName(PlayerInfo* player);
-
+ virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Manages the gametype's HUD. player's lives via FadingMessage.
+ virtual void playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Manages the gametype's HUD. #Players alive via StaticMessage.
virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
- const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_"
+ const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
void tick (float dt); //!< used to end the game
};
More information about the Orxonox-commit
mailing list