[Orxonox-commit 2316] r7031 - in code/branches/presentation3: . data/levels data/overlays src/modules/overlays src/modules/overlays/hud src/orxonox src/orxonox/controllers src/orxonox/gametypes src/orxonox/infos src/orxonox/interfaces
landauf at orxonox.net
landauf at orxonox.net
Mon May 31 04:42:57 CEST 2010
Author: landauf
Date: 2010-05-31 04:42:57 +0200 (Mon, 31 May 2010)
New Revision: 7031
Added:
code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw
code/branches/presentation3/data/overlays/dynamicmatchhud.oxo
code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.cc
code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h
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
Modified:
code/branches/presentation3/
code/branches/presentation3/src/modules/overlays/OverlaysPrereqs.h
code/branches/presentation3/src/modules/overlays/hud/CMakeLists.txt
code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
code/branches/presentation3/src/orxonox/gametypes/CMakeLists.txt
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:
merged dynamicmatch to presentation3
Property changes on: code/branches/presentation3
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/dynamicmatch:6584-7030
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Copied: code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw (from rev 7030, code/branches/dynamicmatch/data/levels/gametype_dynamicmatch.oxw)
===================================================================
--- code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw (rev 0)
+++ code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,119 @@
+<?lua
+ include("hudtemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceship_assff.oxt")
+ include("templates/spaceship_H2.oxt")
+ include("dynamicmatchhud.oxo")
+?>
+
+<Level
+ name = "Dynamic Match"
+ description = "In progress -level for dynamicmatch"
+ gametype = "Dynamicmatch"
+>
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+ >
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+<!-- ------------------Planet needs gravity----------------- -->
+<Planet position="0,0,0" scale=500 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+<StaticEntity position="0,0,0" collisionType=static>
+ <collisionShapes>
+ <SphereCollisionShape radius="499" />
+ </collisionShapes>
+ </StaticEntity>
+
+<!-- -----------12-Spawnpoints around the planet------------- -->
+<TeamSpawnPoint team=0 position="1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="-1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,-1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,0,1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,0,-1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<!--outer Spawnpoints -->
+<TeamSpawnPoint team=0 position="2000,0,0" lookat="0,0,1" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="-2000,0,0" lookat="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,2000,0" lookat="0,1,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,-2000,0" lookat="0,-1,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,0,2000" lookat="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+<TeamSpawnPoint team=0 position="0,0,-2000" lookat="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
+
+<?lua
+ dofile("includes/CuboidSpaceStation.lua")
+ ?>
+<!-- ----------------Rotating satellite--------------- -->
+<MovableEntity position="1,1,1" rotationrate="-4.5" rotationaxis="0,0,1">
+ <attached>
+ <StaticEntity position="-2500,0,0" yaw=90 pitch=90>
+ <attached>
+ <?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/>
+ </attached>
+ </StaticEntity>
+ </attached>
+</MovableEntity>
+
+<!-- ---------------asteroid ellypse----------------- -->
+<?lua
+max = 20
+for i = 1, max, 1
+do
+ y = math.sin(i/max*6)*4000
+ z = math.cos(i/max*6)*5000
+ x = i*100
+ ?>
+<?lua
+for k = 1, 25, 1
+do
+j = math.random()
+?>
+
+ <StaticEntity position="<?lua print(x + math.random() * 1000-500) ?>,<?lua print(y + math.random() * 1000-500) ?>,<?lua print(z + math.random() * 5000-2500) ?>" scale=<?lua print(j * 5) ?> >
+ <attached>
+ <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+ <attached><!-- ---------asteroid fog----- -->
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached>
+ </Model>
+ </attached>
+ <?lua if i == 5 then ?><collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+ </collisionShapes> <?lua end ?>
+ </StaticEntity>
+<?lua
+end
+?>
+<?lua end ?>
+
+ <GlobalShader compositor="Bloom" visible=false>
+ <events>
+ <visibility>
+ <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+ </visibility>
+ </events>
+ </GlobalShader>
+<!-- ----------------random fog --- not in use
+<?lua
+for i = 1, 100, 1
+do
+j = math.random()
+?>
+
+ <StaticEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>">
+ <attached>
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached>
+ </StaticEntity>
+
+<?lua
+end
+?>
+-->
+ </Scene>
+</Level>
Property changes on: code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/presentation3/data/overlays/dynamicmatchhud.oxo (from rev 7030, code/branches/dynamicmatch/data/overlays/dynamicmatchhud.oxo)
===================================================================
--- code/branches/presentation3/data/overlays/dynamicmatchhud.oxo (rev 0)
+++ code/branches/presentation3/data/overlays/dynamicmatchhud.oxo 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,23 @@
+<Template name="DynamicmatchHUD">
+ <OverlayGroup name="DynamicmatcHUD" scale = "1, 1">
+
+ <GametypeStaticMessage
+ name = "staticmessage"
+ position = "0.5, 0.01"
+ font = "VeraMono"
+ caption = ""
+ textsize = 0.033
+ colour = "1.0, 1.0, 0.5, 1.0"
+ align = "center"
+ />
+
+<GametypeFadingMessage
+ name = "fadingmessage"
+ position = "0.5, 0.05"
+ font = "VeraMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 0.5, 1.0"
+ align = "center"
+ />
+ </OverlayGroup>
+</Template>
Property changes on: code/branches/presentation3/data/overlays/dynamicmatchhud.oxo
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/branches/presentation3/src/modules/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/presentation3/src/modules/overlays/OverlaysPrereqs.h 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/modules/overlays/OverlaysPrereqs.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -77,6 +77,8 @@
class BarColour;
class ChatOverlay;
class DeathMessage;
+ class GametypeFadingMessage;
+ class GametypeStaticMessage;
class GametypeStatus;
class HUDBar;
class HUDHealthBar;
Modified: code/branches/presentation3/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/CMakeLists.txt 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/modules/overlays/hud/CMakeLists.txt 2010-05-31 02:42:57 UTC (rev 7031)
@@ -12,4 +12,6 @@
DeathMessage.cc
UnderAttackHealthBar.cc
TeamBaseMatchScore.cc
+ GametypeStaticMessage.cc
+ GametypeFadingMessage.cc
)
Copied: code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.cc (from rev 7030, code/branches/dynamicmatch/src/modules/overlays/hud/GametypeFadingMessage.cc)
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.cc (rev 0)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.cc 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "GametypeFadingMessage.h"
+
+#include "core/CoreIncludes.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+ CreateFactory(GametypeFadingMessage);
+
+ GametypeFadingMessage::GametypeFadingMessage(BaseObject* creator) : FadeoutText(creator)
+ {
+ RegisterObject(GametypeFadingMessage);
+
+ this->owner_ = 0;
+ this->setDelay(2.0f);
+ this->setFadeouttime(0.5f);
+ }
+
+ GametypeFadingMessage::~GametypeFadingMessage()
+ {
+ }
+
+ void GametypeFadingMessage::fadingmessage(const GametypeInfo* gtinfo, const std::string& message)
+ {
+ if (this->owner_ && this->owner_->getGametypeInfo() == gtinfo)
+ this->setCaption(message);
+ }
+
+ void GametypeFadingMessage::changedOwner()
+ {
+ SUPER(GametypeFadingMessage, changedOwner);
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
+ }
+}
Property changes on: code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h (from rev 7030, code/branches/dynamicmatch/src/modules/overlays/hud/GametypeFadingMessage.h)
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h (rev 0)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _GametypeInfoMessage_H__
+#define _GametypeInfoMessage_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "interfaces/GametypeMessageListener.h"
+#include "overlays/FadeoutText.h"
+
+namespace orxonox
+{
+ class _OverlaysExport GametypeFadingMessage : public FadeoutText, GametypeMessageListener
+ {
+ public:
+ GametypeFadingMessage(BaseObject* creator);
+ virtual ~GametypeFadingMessage();
+
+ virtual void changedOwner();
+
+ void fadingmessage(const GametypeInfo* gtinfo, const std::string& message);
+
+ private:
+ PlayerInfo* owner_;
+ };
+}
+#endif /* _GametypeFadingMessage_H__ */
Property changes on: code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc (from rev 7030, code/branches/dynamicmatch/src/modules/overlays/hud/GametypeStaticMessage.cc)
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc (rev 0)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "GametypeStaticMessage.h"
+
+#include "core/CoreIncludes.h"
+#include "infos/GametypeInfo.h"
+#include "infos/PlayerInfo.h"
+
+
+namespace orxonox
+{
+ CreateFactory(GametypeStaticMessage);
+
+
+ GametypeStaticMessage::GametypeStaticMessage(BaseObject* creator) : OverlayText(creator)
+ {
+ RegisterObject(GametypeStaticMessage);
+ this->owner_ = 0;
+ }
+
+ GametypeStaticMessage::~GametypeStaticMessage()
+ {
+ }
+
+ void GametypeStaticMessage::staticmessage(const GametypeInfo* gtinfo, const std::string& message)
+ {
+ if (this->owner_ && this->owner_->getGametypeInfo() == gtinfo)
+ this->setCaption(message);
+ }
+
+ void GametypeStaticMessage::changedOwner()
+ {
+ SUPER(GametypeStaticMessage, changedOwner);
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
+ }
+
+}
Property changes on: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h (from rev 7030, code/branches/dynamicmatch/src/modules/overlays/hud/GametypeStaticMessage.h)
===================================================================
--- code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h (rev 0)
+++ code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _GametypeInfoMessage_H__
+#define _GametypeInfoMessage_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "interfaces/GametypeMessageListener.h"
+#include "overlays/OverlayText.h"
+/*Goal: Every Gametype could add a hud-element that displays text in the gametype. For example instructions for newbies.
+-> you have to add a "GametypeInfoMessage"-object that displays text. How the message change has to be defined in the gametype.
+*/
+
+namespace orxonox
+{
+ class _OverlaysExport GametypeStaticMessage : public OverlayText, GametypeMessageListener
+ {
+ public:
+ GametypeStaticMessage(BaseObject* creator);
+ virtual ~GametypeStaticMessage();
+
+ virtual void changedOwner();
+
+ void staticmessage(const GametypeInfo* gtinfo, const std::string& message);
+
+ private:
+ PlayerInfo* owner_;
+ };
+}
+#endif /* _GametypeInfoMessage_H__ */
Property changes on: code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -89,6 +89,7 @@
// gametypes
class Asteroids;
class Deathmatch;
+ class Dynamicmatch;
class Gametype;
class TeamBaseMatch;
class TeamDeathmatch;
Modified: code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc 2010-05-31 02:42:57 UTC (rev 7031)
@@ -33,6 +33,7 @@
#include "worldentities/pawns/Pawn.h"
#include "worldentities/pawns/TeamBaseMatchBase.h"
#include "gametypes/TeamDeathmatch.h"
+#include "gametypes/Dynamicmatch.h"
#include "controllers/WaypointPatrolController.h"
namespace orxonox
@@ -244,6 +245,24 @@
}
}
+ Dynamicmatch* dynamic = orxonox_cast<Dynamicmatch*>(gametype);
+ if (dynamic)
+ {
+ if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;}
+
+ if (entity1->getPlayer())
+ team1 = dynamic->getParty(entity1->getPlayer());
+
+ if (entity2->getPlayer())
+ team2 = dynamic->getParty(entity2->getPlayer());
+
+ if (team1 ==-1 ||team2 ==-1 ) {return false;}
+ else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;}
+ else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;}
+ else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;}
+ else return true;
+ }
+
return (team1 == team2 && team1 != -1);
}
}
Modified: code/branches/presentation3/src/orxonox/gametypes/CMakeLists.txt
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/CMakeLists.txt 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/gametypes/CMakeLists.txt 2010-05-31 02:42:57 UTC (rev 7031)
@@ -5,4 +5,5 @@
TeamBaseMatch.cc
UnderAttack.cc
Asteroids.cc
+ Dynamicmatch.cc
)
Copied: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc (from rev 7030, code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.cc)
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc (rev 0)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,704 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+//TODO:
+//pig punkte vergeben pro Zeit!
+//killerfarbe schwarz; evtl. eigenes Raumfahrzeug;
+//Low; Codeoptimierung und Dokumentation
+
+/*
+short gaming manual:
+There are three different parties a player can belong to: victim, chaser or killer
+Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them.
+In order to win you have to earn as much points as possible:
+- as victim by escaping the chasers
+- as chaser by shooting the victim
+- as killer by killing the chasers
+
+
+What you shouldn't do is shooting at players of your own party. By doing so your score will decrease.
+P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser.
+*/
+#include "Dynamicmatch.h"
+
+#include "util/Convert.h"
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "core/ConfigValueIncludes.h"
+#include "interfaces/TeamColourable.h"
+#include "items/Engine.h"
+#include "tools/Timer.h"
+#include "worldentities/TeamSpawnPoint.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(Dynamicmatch);
+
+ Dynamicmatch::Dynamicmatch(BaseObject* creator) : Gametype(creator)
+ {
+ RegisterObject(Dynamicmatch);
+ this->gameTime_ = 180;
+ this->setConfigValues();
+ this->chaser=0;
+ this->piggy=1;
+ this->killer=2;
+ this->notEnoughPigs=false;
+ this->notEnoughKillers=false;
+ this->notEnoughChasers=false;
+ this->gameEnded_ =false;
+ this->timesequence_ = static_cast<int>(this->gameTime_);
+ this->friendlyfire=true;
+ this->numberOf[chaser]=0;
+ this->numberOf[piggy]=0;
+ this->numberOf[killer]=0;
+ this->tutorial=true;
+ this->pointsPerTime=0.0f;
+ this->setHUDTemplate("DynamicmatchHUD");
+
+ }
+
+ void Dynamicmatch::setConfigValues()
+ {
+ SetConfigValue(gameTime_, 180);
+ SetConfigValue(friendlyfire, true);
+ 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
+
+ };
+ static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
+
+ SetConfigValue(partyColours_, defaultcolours);
+ }
+
+ bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
+ { //TODO: static and fading message for the "human" player's
+ if (!originator||!victim)
+ return false;
+ if (!originator->getPlayer()||!victim->getPlayer())
+ return false;
+ if (victim && victim->getPlayer()) //&& originator && originator->getPlayer() ??
+ {
+ int target= playerParty_[victim->getPlayer()];
+ int source= playerParty_[originator->getPlayer()];
+
+ //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)
+ 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_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
+ }
+ }
+ 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[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_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
+ }
+ }
+ }
+ 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())
+ {
+ spaceship->getEngine()->setSpeedFactor(5);
+ WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
+ new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true);
+ }
+ }
+
+ //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[killer]++; //party switch: number of players is not affected (decrease and increase)
+ 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_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
+ }
+ }
+ 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)
+ 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());
+
+ else
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID());
+ this->gtinfo_->sendFadingMessage("You're now a chaser.",it3->first->getClientID());
+ }
+ }
+ evaluatePlayerParties(); //check if the party change has to trigger futher party changes
+ }
+
+ //Case: chaser vs. killer
+ else if ((source == killer && target == chaser)||(target == killer && source == chaser ))
+ {
+ return true;
+ }
+
+ //Case: a chaser hits piggy
+ else if ((source==chaser)&&(target==piggy))
+ {
+ std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
+ if (it != this->players_.end())
+ {
+ it->second.frags_++;
+ }
+ }
+ //Case: piggy hits chaser
+ else if (source==piggy&&target==chaser)
+ {
+ //partyswitch: victim bcomes piggy and the originator(piggy) becomes chaser
+ playerParty_[victim->getPlayer()]=piggy;
+ playerParty_[originator->getPlayer()]=chaser;
+
+ //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());
+ else
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ 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_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
+ }
+ }
+ //Give new pig boost
+ SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
+ if (spaceship && spaceship->getEngine())
+ {
+ spaceship->getEngine()->setSpeedFactor(5);
+ WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
+ new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true);
+ }
+
+ }
+ // killer vs piggy
+ 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
+
+ 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_->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_->sendFadingMessage("You're now a killer.",it2->first->getClientID());
+ }
+ }
+ }
+ //Case: friendly fire
+ else if (friendlyfire && (source == target))
+ {
+ std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
+ if (it != this->players_.end())
+ {
+ it->second.frags_--;
+ }
+ }
+ }// from far far away not to be removed!
+ return false; //default: no damage
+ }
+
+
+
+ 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
+ {
+ std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
+ if (it != this->players_.end())
+ {
+ 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
+ evaluatePlayerParties();
+ }
+
+ void Dynamicmatch::playerEntered(PlayerInfo* player) //standardfunction
+ {
+ if (!player)// only for safety
+ return;
+ playerParty_[player]=chaser; //Set playerparty
+ numberOf[chaser]++;
+ Gametype::playerEntered(player);
+ const std::string& message6 = player->getName() + " entered the game";
+ COUT(0) << message6 << std::endl;
+ Host::Broadcast(message6);
+ }
+
+ bool Dynamicmatch::playerLeft(PlayerInfo* player) //standardfunction
+ {
+ bool valid_player = Gametype::playerLeft(player);
+ if (valid_player)
+ {
+ switch (playerParty_[player])
+ {
+ case 0: numberOf[chaser]--; break;
+ case 1: numberOf[piggy]--; break;
+ case 2: numberOf[killer]--; break;
+ }
+ const std::string& message = player->getName() + " left the game";
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ //remove player from map
+ playerParty_.erase (player);
+ //adjust player parties
+ evaluatePlayerParties();
+ }
+
+ return valid_player;
+ }
+
+
+ void Dynamicmatch::tick(float dt)
+ {
+ SUPER(Dynamicmatch, tick, dt);
+
+ if (this->hasStarted() && !gameEnded_)
+ { pointsPerTime =pointsPerTime + dt;
+ gameTime_ = gameTime_ - dt;
+ if (pointsPerTime > 3.0f)//hard coded!! should be changed
+ {
+ pointsPerTime=0.0f;
+ rewardPig();
+ }
+ if (gameTime_<= 0)
+ {
+ this->gameEnded_ = true;
+ this->end();
+ }
+ if ( gameTime_ <= timesequence_ && gameTime_ > 0)
+ {
+ const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
+
+ this->gtinfo_->sendAnnounceMessage(message);
+
+ if (timesequence_ >= 30 && timesequence_ <= 60)
+ {
+ timesequence_ = timesequence_ - 10;
+ }
+ else if (timesequence_ <= 30)
+ {
+ timesequence_ = timesequence_ - 5;
+ }
+ else
+ {
+ timesequence_ = timesequence_ - 30;
+ }
+ }
+ }
+ }
+
+ void Dynamicmatch::rewardPig()
+ {
+ for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden
+ {
+ if (it->second==piggy)
+ {
+ //Spieler mit der Pig-party frags++
+ std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(it->first);// still not sure if right syntax
+ if (it2 != this->players_.end())
+ {
+ it2->second.frags_++;
+ }
+ }
+ }
+ }
+ void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a players colour
+ {
+ std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player);
+ Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
+ if (pawn)
+ {
+ pawn->setRadarObjectColour(this->partyColours_[it_player->second]);
+
+ std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
+ for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
+ {
+ if ((*it)->isA(Class(TeamColourable)))
+ {
+ TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
+ tc->setTeamColour(this->partyColours_[it_player->second]);
+ }
+ }
+ }
+ }
+
+ void Dynamicmatch::evaluatePlayerParties() //manages the notEnough booleans (here the percentage of special players is implemented)
+ {
+ //pigs: 1 + every 6th player is a pig
+ if ( (1+this->getNumberOfPlayers()/6) > numberOf[piggy])
+ {
+ notEnoughPigs=true;
+ if (tutorial) // Announce selectionphase
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)//in order to catch nullpointer
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ }
+ }
+ }
+ else
+ {
+ notEnoughPigs=false;
+ if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)//in order to catch nullpointer
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ 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());
+ else
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ //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_->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_->sendFadingMessage("You're now a killer.",it->first->getClientID());
+ }
+ }
+
+ }
+ }
+ //killers: every 4th player is a killer
+ if (getNumberOfPlayers()/4 > numberOf[killer])
+ {
+ notEnoughKillers=true;
+ if (tutorial) // Announce selectionphase
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)//in order to catch nullpointer
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ }
+ }
+ }
+ else
+ {
+ notEnoughKillers=false;
+ if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ 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());
+ else
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ //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_->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_->sendFadingMessage("You're now a killer.",it->first->getClientID());
+ }
+ }
+
+ }
+
+ }
+ //chasers: there are more chasers than killers + pigs
+ if (numberOf[piggy]+numberOf[killer] > numberOf[chaser])
+ {
+ notEnoughChasers=true;
+ if (tutorial) // Announce selectionphase
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)//in order to catch nullpointer
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ }
+ }
+ }
+ else
+ {
+ notEnoughChasers=false;
+ if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (!it->first)
+ continue;
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ 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());
+ else
+ this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID());
+ //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_->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_->sendFadingMessage("You're now a killer.",it->first->getClientID());
+ }
+ }
+
+ }
+ }
+ }
+
+ int Dynamicmatch::getParty(PlayerInfo* player) // helper function for ArtificialController
+ {
+ return this->playerParty_[player];
+ }
+
+ void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)// helper function
+ {
+ if (*ptr)
+ {
+ (*ptr)->setSpeedFactor(1.0f);
+ }
+ delete ptr;
+ }
+
+ bool Dynamicmatch::playerChangedName(PlayerInfo* player) //standardfunction
+ {
+ bool valid_player = Gametype::playerChangedName(player);
+ if (valid_player)
+ {
+ const std::string& message = player->getOldName() + " changed name to " + player->getName();
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ }
+
+ return valid_player;
+ }
+
+ void Dynamicmatch::start()
+ {
+ Gametype::start();
+ if(!tutorial)
+ {
+ std::string message("Dynamicmatch started!");
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ }
+ else if(tutorial) // Announce selectionphase
+ {
+ for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
+ {
+ if (it->first->getClientID() == CLIENTID_UNKNOWN)
+ continue;
+ this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID());
+ }
+ }
+ }
+
+ /*void Dynamicmatch::instructions()
+ {
+ std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!");
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this)));
+ }
+
+ void Dynamicmatch::furtherInstructions()
+ {
+ std::string message("After 3 Minutes the game is over.");
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ }*/
+ void Dynamicmatch::end()
+ {
+ Gametype::end();
+
+ 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
+ {
+ int desiredTeamNr = -1;
+ std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player);
+ if (it_player != this->playerParty_.end())
+ desiredTeamNr = it_player->second;
+
+ // Only use spawnpoints of the own team (or non-team-spawnpoints)
+ std::set<SpawnPoint*> teamSpawnPoints = this->spawnpoints_;
+ for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
+ {
+ if ((*it)->isA(Class(TeamSpawnPoint)))
+ {
+ TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it);
+ if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr)//getTeamNumber!!
+ {
+ teamSpawnPoints.erase(it++);
+ continue;
+ }
+ }
+
+ ++it;
+ }
+
+ if (teamSpawnPoints.size() > 0)
+ {
+ unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
+ unsigned int index = 0;
+ for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
+ {
+ if (index == randomspawn)
+ return (*it);
+
+ ++index;
+ }
+ }
+
+ return 0;
+ }
+
+}
Copied: code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h (from rev 7030, code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.h)
===================================================================
--- code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h (rev 0)
+++ code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -0,0 +1,92 @@
+/*
+ * 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 _Dynamicmatch_H__
+#define _Dynamicmatch_H__
+
+#include <map>
+#include <vector>
+#include "OrxonoxPrereqs.h"
+#include "Gametype.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Dynamicmatch : public Gametype
+ {
+ public:
+ Dynamicmatch(BaseObject* creator);
+ virtual ~Dynamicmatch() {}
+
+ bool notEnoughPigs;
+ bool notEnoughKillers;
+ bool notEnoughChasers;
+
+ //three different parties
+ int chaser;
+ int piggy;
+ int killer;
+
+ virtual void evaluatePlayerParties();
+ 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();
+ virtual void end(); //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht?
+ virtual void playerEntered(PlayerInfo* player);
+ 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 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
+ std::vector<ColourValue> partyColours_; //aus TeamDeathmatch
+ unsigned int numberOf[3]; //array to count number of chasers, pigs, killers
+ float pointsPerTime;
+ float gameTime_; // from UnderAttack
+ bool gameEnded_; // true if game is over
+ int timesequence_; //used for countdown
+ //Timer callInstructions_;
+ };
+}
+
+#endif /* _Dynamicmatch_H__ */
Modified: code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc 2010-05-31 02:42:57 UTC (rev 7031)
@@ -41,6 +41,8 @@
registerMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage);
registerMemberNetworkFunction(GametypeInfo, dispatchKillMessage);
registerMemberNetworkFunction(GametypeInfo, dispatchDeathMessage);
+ registerMemberNetworkFunction(GametypeInfo, dispatchStaticMessage);
+ registerMemberNetworkFunction(GametypeInfo, dispatchFadingMessage);
GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator)
{
@@ -109,6 +111,28 @@
}
}
+ void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID)
+ {
+ if (GameMode::isMaster())
+ {
+ if (clientID == CLIENTID_SERVER)
+ this->dispatchStaticMessage(message);
+ else
+ callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message);
+ }
+ }
+
+ void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID)
+ {
+ if (GameMode::isMaster())
+ {
+ if (clientID == CLIENTID_SERVER)
+ this->dispatchFadingMessage(message);
+ else
+ callMemberNetworkFunction(GametypeInfo, dispatchFadingMessage, this->getObjectID(), clientID, message);
+ }
+ }
+
void GametypeInfo::dispatchAnnounceMessage(const std::string& message)
{
for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
@@ -126,4 +150,16 @@
for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
it->deathmessage(this, message);
}
+
+ void GametypeInfo::dispatchStaticMessage(const std::string& message)
+ {
+ for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
+ it->staticmessage(this, message);
+ }
+
+ void GametypeInfo::dispatchFadingMessage(const std::string& message)
+ {
+ for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
+ it->fadingmessage(this, message);
+ }
}
Modified: code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -63,10 +63,14 @@
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 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 dispatchFadingMessage(const std::string& message);
private:
bool bStarted_;
Modified: code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h
===================================================================
--- code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h 2010-05-31 02:22:29 UTC (rev 7030)
+++ code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h 2010-05-31 02:42:57 UTC (rev 7031)
@@ -43,6 +43,8 @@
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 fadingmessage(const GametypeInfo* gtinfo, const std::string& message) {}
};
}
More information about the Orxonox-commit
mailing list