[Orxonox-commit 3004] r7700 - in code/branches/lastmanstanding: data/levels data/overlays src/modules/overlays/hud src/orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Thu Dec 2 23:33:41 CET 2010
Author: jo
Date: 2010-12-02 23:33:41 +0100 (Thu, 02 Dec 2010)
New Revision: 7700
Removed:
code/branches/lastmanstanding/data/levels/lastteamstanding.oxw
code/branches/lastmanstanding/data/overlays/lastteamstandinghud.oxo
code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.cc
code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.h
code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.cc
code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.h
Log:
Remve files that shouldn't have been added here. Now the old state should be reached.
Deleted: code/branches/lastmanstanding/data/levels/lastteamstanding.oxw
===================================================================
--- code/branches/lastmanstanding/data/levels/lastteamstanding.oxw 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/data/levels/lastteamstanding.oxw 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,137 +0,0 @@
-<?lua
- include("stats.oxo")
- include("hudtemplates3.oxo")
- include("templates/lodinformation.oxt")
- include("lastteamstandinghud.oxo")
- include("templates/spaceship_assff.oxt")
- include("templates/spaceship_pirate.oxt")
- include("templates/pickup_representation_templates.oxt")
-?>
-
-<Level
- name = "Last Team Standing"
- description = "testmap for gametype last team standing"
- gametype = "LastTeamStanding"
->
- <templates>
- <Template link=lodtemplate_default />
- </templates>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/skypanoramagen1"
- >
-
- <?lua
- include("includes/pickups.oxi")
- ?>
-
-<Bot />
-
-<!-- ------------ middle asteroid -------------- -->
- <StaticEntity position="0,20,0" collisionType=static>
- <attached>
- <Model position="0,0,0" scale=140 mesh="asteroid_UV.mesh" shadow=true />
- <!-- ParticleEmitter position="0,0,0" source="Orxonox/Steam" / -->
- </attached>
- <collisionShapes>
- <SphereCollisionShape radius="145" />
- </collisionShapes>
- </StaticEntity>
-
- <PickupSpawner position="-160,65,10" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg-->
- <pickup>
- <InvisiblePickup template=mediuminvisiblepickup />
- </pickup>
- </PickupSpawner>
- <PickupSpawner position="-160,60,17" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg-->
- <pickup>
- <InvisiblePickup template=hugeinvisiblepickup />
- </pickup>
- </PickupSpawner>
- <StaticEntity position="-160,60,28.4"><!--EasterEgg-Indicator-->
- <attached>
- <Model position="0,0,0" scale=1 mesh="sphere.mesh" />
- </attached>
- </StaticEntity>
-
-<!-- ---------------asteroid dome----------------- -->
-<?lua
-max = 16
-for i = 0, max, 1
-do
- y = math.sin(i/max*6)*750
- z = math.cos(i/max*6)*750
- j = 1
- ?>
-
- <TeamSpawnPoint team=<?lua print( math.mod(i,4)) ?> position="<?lua print(y*1.4+z*0.2) ?>,0,<?lua print(z*1.4-y*0.2) ?>" direction="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-
- <StaticEntity position="<?lua print(y) ?>,0,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static >
- <attached>
- <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="<?lua print(j * 2) ?>,100,<?lua print(j * 2) ?>" position = "0,0,0" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="<?lua print(y) ?>,100,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static >
- <attached>
- <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i+3,6) + 1) ?>.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="45,100,45" position = "0,0,0" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="<?lua print(y) ?>,200,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static >
- <attached>
- <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*5,6) + 1) ?>.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="45,100,45" position = "0,0,0" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="<?lua print(y) ?>,-100,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static >
- <attached>
- <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*13+1,6) + 1) ?>.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="45,100,45" position = "0,0,0" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="<?lua print(y) ?>,-200,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static >
- <attached>
- <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*17,6) + 1) ?>.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="45,100,45" position = "0,0,0" />
- </collisionShapes>
- </StaticEntity>
-
-<!-- ---------Top Asteroid----------- -->
- <StaticEntity position="<?lua print(y) ?>,300,<?lua print(z) ?>" scale=<?lua print(j * 2.1) ?> pitch="90" roll="180" yaw="<?lua print(-90+i*360/max) ?>" collisionType=static >
- <attached>
- <Model position="0,0,0" scale=25 mesh="ast6.mesh">
- </Model>
- </attached>
- <collisionShapes>
- <BoxCollisionShape halfExtents="50,140,30" position="0,0,0"/>
- </collisionShapes>
- </StaticEntity>
-
-
-<?lua end ?>
-
- </Scene>
-</Level>
-
-
Deleted: code/branches/lastmanstanding/data/overlays/lastteamstandinghud.oxo
===================================================================
--- code/branches/lastmanstanding/data/overlays/lastteamstandinghud.oxo 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/data/overlays/lastteamstandinghud.oxo 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,88 +0,0 @@
-<Template name="LastteamstandingHUD">
- <OverlayGroup name="DynamicmatcHUD" scale = "1, 1">
-
-<GametypeFadingMessage
- name = "fadingmessage"
- position = "0.5, 0.01"
- font = "VeraMono"
- textsize = 0.04
- colour = "1.0, 1.0, 0.5, 1.0"
- align = "center"
- />
-
- <OverlayText
- position = "0.02, 0.02"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
- caption = "Lives: "
- />
-
- <LastTeamStandingInfos
- position = "0.14, 0.02"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
-
- showlives = true
- showplayers = false
- />
-
- <OverlayText
- position = "0.02, 0.055"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
- caption = "Players: "
- />
-
- <LastTeamStandingInfos
- position = "0.14, 0.055"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
-
- showlives = false
- showplayers = true
- />
-
- <OverlayText
- position = "0.02, 0.07"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
- caption = "__________|"
- />
-
- <OverlayText
- position = "0.022, 0.07"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
- caption = "__________"
- />
-
- <OverlayText
- position = "0.1733, 0.038"
- pickpoint = "0.0, 0.0"
- font = "ShareTechMono"
- textsize = 0.04
- colour = "1.0, 1.0, 1.0, 1.0"
- align = "left"
- caption = "|"
- />
-
- </OverlayGroup>
-</Template>
Deleted: code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.cc
===================================================================
--- code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.cc 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.cc 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,97 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Johannes Ritz
- * Co-authors:
- *
- *
- */
-
-#include "LastTeamStandingInfos.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "util/Convert.h"
-#include "gametypes/LastTeamStanding.h"
-#include "infos/PlayerInfo.h"
-
-namespace orxonox
-{
- CreateFactory(LastTeamStandingInfos);
-
- LastTeamStandingInfos::LastTeamStandingInfos(BaseObject* creator) : OverlayText(creator)
- {
- RegisterObject(LastTeamStandingInfos);
-
- this->lts_ = 0;
- this->player_ = 0;
- this->bShowLives_ = false;
- this->bShowTeams_ = false;
- }
-
- LastTeamStandingInfos::~LastTeamStandingInfos()
- {
- }
-
- void LastTeamStandingInfos::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(LastTeamStandingInfos, XMLPort, xmlelement, mode);
-
- XMLPortParam(LastTeamStandingInfos, "showlives", setShowLives, getShowLives, xmlelement, mode).defaultValues(false);
- XMLPortParam(LastTeamStandingInfos, "showTeams", setShowTeams, getShowTeams, xmlelement, mode).defaultValues(false);
- }
-
- void LastTeamStandingInfos::tick(float dt)
- {
- SUPER(LastTeamStandingInfos, tick, dt);
-
- if (this->player_ && this->lts_)
- {
- if (this->bShowLives_)
- {
- const std::string& lives = multi_cast<std::string>(this->lts_->playerGetLives(this->player_));
- this->setCaption(lives);
- }
- else if(this->bShowTeams_)
- {
- const std::string& Teams = multi_cast<std::string>(this->lts_->getNumTeamsAlive());
- this->setCaption(Teams);
- }
- }
- }
-
- void LastTeamStandingInfos::changedOwner()
- {
- SUPER(LastTeamStandingInfos, changedOwner);
-
- if (this->getOwner() && this->getOwner()->getGametype())
- {
- this->player_ = orxonox_cast<PlayerInfo*>(this->getOwner());
- this->lts_ = orxonox_cast<LastTeamStanding*>(this->getOwner()->getGametype().get());
- }
- else
- {
- this->player_ = 0;
- this->lts_ = 0;
- }
- }
-}
Deleted: code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.h
===================================================================
--- code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.h 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/src/modules/overlays/hud/LastTeamStandingInfos.h 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,66 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Johannes Ritz
- * Co-authors:
- *
- *
- */
-
-#ifndef _LastTeamStandingInfos_H__
-#define _LastTeamStandingInfos_H__
-
-#include "overlays/OverlaysPrereqs.h"
-
-#include "tools/interfaces/Tickable.h"
-#include "overlays/OverlayText.h"
-
-namespace orxonox
-{
- class _OverlaysExport LastTeamStandingInfos : public OverlayText, public Tickable
- {
- public:
- LastTeamStandingInfos(BaseObject* creator);
- virtual ~LastTeamStandingInfos();
-
- virtual void tick(float dt);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void changedOwner();
-
- inline void setShowLives(bool value)
- { this->bShowLives_ = value; }
- inline bool getShowLives() const
- { return this->bShowLives_; }
-
- inline void setShowTeams(bool value)
- { this->bShowTeams_ = value; }
- inline bool getShowTeams() const
- { return this->bShowTeams_; }
-
- private:
- LastTeamStanding* lts_;
- PlayerInfo* player_;
- bool bShowLives_;
- bool bShowTeams_;
- };
-}
-#endif /* _LastTeamStandingInfos_H__ */
Deleted: code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.cc 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.cc 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,301 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Johannes Ritz
- * Co-authors:
- * ...
- *
- */
-
-#include "LastTeamStanding.h"
-
-#include "core/CoreIncludes.h"
-#include "network/Host.h"
-#include "infos/PlayerInfo.h"
-#include "worldentities/pawns/Pawn.h"
-#include "core/ConfigValueIncludes.h"
-#include "util/Convert.h"
-//TODO: teamsAlive instead of playersAlive
-
-namespace orxonox
-{
- CreateUnloadableFactory(LastTeamStanding);
-
- LastTeamStanding::LastTeamStanding(BaseObject* creator) : TeamDeathmatch(creator)
- {
- RegisterObject(LastTeamStanding);
- this->bForceSpawn_=true;
- this->lives=4;
- this->teamsAlive=0;
- this->timeRemaining=15.0f;
- this->respawnDelay=4.0f;
- this->bNoPunishment=false;
- this->bHardPunishment=false;
- this->punishDamageRate=0.4f;
- this->setHUDTemplate("LastTeamStandingHUD");
- this->eachTeamsPlayers = new int[teams_];
- }
-
- void LastTeamStanding::~LastTeamStanding()
- {
- delete[] this->eachTeamsPlayers;
- }
-
- void LastTeamStanding::spawnDeadPlayersIfRequested()
- {
- for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
- if (it->second.state_ == PlayerState::Dead)
- {
- bool alive = (0<playerLives_[it->first]&&(inGame_[it->first]));
- if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
- {
- this->spawnPlayer(it->first);
- }
- }
- }
-
-
- void LastTeamStanding::setConfigValues()
- {
- SetConfigValue(lives, 4);
- SetConfigValue(timeRemaining, 15.0f);
- SetConfigValue(respawnDelay, 4.0f);
- SetConfigValue(bNoPunishment, false);
- SetConfigValue(bHardPunishment, false);
- }
-
- bool LastTeamStanding::allowPawnDamage(Pawn* victim, Pawn* originator)
- {
- bool allow = TeamDeathmatch::allowPawnDamage(victim, originator);
- if(!allow) {return allow;}
- if (originator && originator->getPlayer())// only for safety
- {
- this->timeToAct_[originator->getPlayer()]=timeRemaining;
-
- std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
- if (it != this->players_.end())
- {
- if (it->first->getClientID()== CLIENTID_UNKNOWN)
- return true;
- const std::string& message = ""; // resets Camper-Warning-message
- this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
- }
- return allow;
- }
-
- bool LastTeamStanding::allowPawnDeath(Pawn* victim, Pawn* originator)
- {
- if (!victim||!victim->getPlayer())// only for safety
- return true;
- bool allow =TeamDeathmatch::allowPawnDeath(victim, originator);
- if(!allow) {return allow;}
- playerLives_[victim->getPlayer()]=playerLives_[victim->getPlayer()]-1;
- this->inGame_[victim->getPlayer()]=false;//if player dies he, isn't allowed to respawn immediately
- if (playerLives_[victim->getPlayer()]<=0)//if player lost all lives
- {
- this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
- if(eachTeamsPlayers[getTeam(victim->getPlayer())]==0)//last team member died
- this->teamsAlive--;
- const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
- COUT(0) << message << std::endl;
- Host::Broadcast(message);
- }
-
- return allow;
- }
-
- int LastTeamStanding::getMinLives()
- {
- int min=lives;
- for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
- {
- if (it->second<=0)
- continue;
- if (it->second<lives)
- min=it->second;
- }
- return min;
- }
-
- void LastTeamStanding::end()
- {
- Gametype::end();
-
- for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
- {
- if (it->first->getClientID() == CLIENTID_UNKNOWN)
- continue;
-
- if (it->second > 0)
- this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
- else
- this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
- }
- }
-
- int LastTeamStanding::playerGetLives(PlayerInfo* player)
- {
- if (player)
- return playerLives_[player];
- else
- return 0;
- }
-
- int LastTeamStanding::getNumTeamsAlive() const
- {
- return this->teamsAlive;
- }
-
- void LastTeamStanding::playerEntered(PlayerInfo* player)
- {
- if (!player)// only for safety
- return;
- Deathmatch::playerEntered(player);
- if (teamsAlive<=1)
- playerLives_[player]=lives;
- else
- playerLives_[player]=getMinLives();//new players only get minimum of lives
-
- if(this->eachTeamsPlayers[getTeam(player)]==0)
- this->teamsAlive++;
- this->eachTeamsPlayers[getTeam(player)]++;
-
- this->timeToAct_[player]=timeRemaining;
- this->playerDelayTime_[player]=respawnDelay;
- this->inGame_[player]=true;
- }
-
- bool LastTeamStanding::playerLeft(PlayerInfo* player)
- {
- bool valid_player = Deathmatch::playerLeft(player);
- if (valid_player)
- {
- this->eachTeamsPlayers[getTeam(player)]--;
- if(this->eachTeamsPlayers[getTeam(player)]==0)
- this->teamsAlive--;
- this->playerLives_.erase (player);
- this->playerDelayTime_.erase (player);
- this->inGame_.erase (player);
- this->timeToAct_.erase(player);
- }
-
- return valid_player;
- }
-
- void LastTeamStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
- {
- if (!player)
- return;
- TeamDeathmatch::playerStartsControllingPawn(player,pawn);
-
- this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
- this->playerDelayTime_[player]=respawnDelay;
-
- std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
- if (it != this->players_.end())
- {
- if (it->first->getClientID()== CLIENTID_UNKNOWN)
- return;
- const std::string& message = ""; // resets Camper-Warning-message
- this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
- }
-
- void LastTeamStanding::punishPlayer(PlayerInfo* player)
- {
- if(!player)
- return;
- if(bNoPunishment)
- return;
- std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
- if (it != this->players_.end())
- {
- if(!player->getControllableEntity())
- return;
- Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
- if(!pawn)
- return;
- if(bHardPunishment)
- {
- pawn->kill();
- this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
- }
- else
- {
- float damage=pawn->getMaxHealth()*punishDamageRate*0.5;//TODO: Factor 0.5 is hard coded. Where is the ratio between MaxHealth actually defined?
- pawn->removeHealth(damage);
- this->timeToAct_[player]=timeRemaining;//reset timer
- }
- }
- }
-
- void LastTeamStanding::tick(float dt)
- {
- SUPER(LastTeamStanding, tick, dt);
- if(this->hasStarted()&&(!this->hasEnded()))
- {
- if ((this->hasStarted()&&(teamsAlive<=1)))//last team remaining
- {
- this->end();
- }
- for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
- {
- if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
- continue;
- it->second-=dt;//Decreases punishment time.
- if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
- {
- playerDelayTime_[it->first]-=dt;
- if (playerDelayTime_[it->first]<=0)
- this->inGame_[it->first]=true;
-
- if (it->first->getClientID()== CLIENTID_UNKNOWN)
- continue;
- int output=1+playerDelayTime_[it->first];
- const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
- this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
- else if (it->second<0.0f)
- {
- it->second=timeRemaining+3.0f;//reset punishment-timer
- if (playerGetLives(it->first)>0)
- {
- this->punishPlayer(it->first);
- if (it->first->getClientID()== CLIENTID_UNKNOWN)
- return;
- const std::string& message = ""; // resets Camper-Warning-message
- this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
- }
- else if (it->second<timeRemaining/5)//Warning message
- {
- if (it->first->getClientID()== CLIENTID_UNKNOWN)
- continue;
- const std::string& message = "Camper Warning! Don't forget to shoot.";
- this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
- }
- }
- }
-
-}
Deleted: code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.h
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.h 2010-12-02 22:26:05 UTC (rev 7699)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastTeamStanding.h 2010-12-02 22:33:41 UTC (rev 7700)
@@ -1,87 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Johannes Ritz
- * Co-authors:
- * ...
- *
- */
-/**
- @file LastTeamStanding.h
- @brief Declaration of the Gametype "Last Team Standing".
-*/
-
-#ifndef _LastTeamStanding_H__
-#define _LastTeamStanding_H__
-
-#include "OrxonoxPrereqs.h"
-#include "Deathmatch.h"
-#include <map>
-#include <vector>
-
-namespace orxonox
-{
- class _OrxonoxExport LastTeamStanding : public TeamDeathmatch
- {
- /**
- @brief
- Last Team Standing is a gametype where each team fights against each other, until one team remains.
- @author
- Johannes Ritz
- */
- protected:
- int lives; //!< Standard amount of lives. Each player starts a game with so many lives.
- std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here.
- int teamsAlive; //!< Counter counting teams with more than one player remaining.
- float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
- std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
- float respawnDelay; //!<Time in seconds when a player will respawn after death.
- std::map<PlayerInfo*, float> playerDelayTime_; //!< Stores each Player's delay time.
- std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state.
- bool bNoPunishment; //!< Config value to switch off Punishment function if it is set to true.
- bool bHardPunishment; //!< Switches between damage and death as punishment.
- float punishDamageRate; //!< Makes Damage adjustable.
- virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
- virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
- unsigned int * eachTeamsPlayers; //!<Each teams player's alive.
-
- public:
- LastTeamStanding(BaseObject* creator); //!< Default Constructor.
- virtual ~LastTeamStanding(); //!< Default Destructor.
- void setConfigValues(); //!< Makes values configurable.
-
- virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
- virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
-
- virtual void end(); //!< Sends an end message.
- int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
- int getNumTeamsAlive() const; //!< Returns the number of players that are still alive.
- virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
- virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
- virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Resets punishment time and respawn delay.
-
- void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
- void tick (float dt); //!< used to end the game
- };
-}
-
-#endif /* _LastTeamStanding_H__ */
More information about the Orxonox-commit
mailing list