[Orxonox-commit 4233] r8904 - in code/branches/gamecontent: data/levels data/levels/includes data/levels/templates src/modules/pong src/orxonox/controllers src/orxonox/gametypes src/orxonox/worldentities/pawns
jo at orxonox.net
jo at orxonox.net
Tue Oct 25 22:56:31 CEST 2011
Author: jo
Date: 2011-10-25 22:56:31 +0200 (Tue, 25 Oct 2011)
New Revision: 8904
Added:
code/branches/gamecontent/src/orxonox/gametypes/Mission.cc
code/branches/gamecontent/src/orxonox/gametypes/Mission.h
Modified:
code/branches/gamecontent/data/levels/includes/weaponSettingsSpacecruiser.oxi
code/branches/gamecontent/data/levels/missionOne.oxw
code/branches/gamecontent/data/levels/templates/spaceshipSpacecruiser.oxt
code/branches/gamecontent/src/modules/pong/Pong.cc
code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.cc
code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.h
code/branches/gamecontent/src/orxonox/gametypes/CMakeLists.txt
code/branches/gamecontent/src/orxonox/gametypes/Gametype.h
code/branches/gamecontent/src/orxonox/gametypes/TeamDeathmatch.h
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h
code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc
Log:
On the way to a multiplayer gametype basceclass.
Modified: code/branches/gamecontent/data/levels/includes/weaponSettingsSpacecruiser.oxi
===================================================================
--- code/branches/gamecontent/data/levels/includes/weaponSettingsSpacecruiser.oxi 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/data/levels/includes/weaponSettingsSpacecruiser.oxi 2011-10-25 20:56:31 UTC (rev 8904)
@@ -6,7 +6,6 @@
<WeaponSlot position=" 14,-31,-184" />
<WeaponSlot position="-34,-30,-169" />
<WeaponSlot position=" 34,-30,-169" />
-
</weaponslots>
<weaponsets>
<WeaponSet firemode=0 />
Modified: code/branches/gamecontent/data/levels/missionOne.oxw
===================================================================
--- code/branches/gamecontent/data/levels/missionOne.oxw 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/data/levels/missionOne.oxw 2011-10-25 20:56:31 UTC (rev 8904)
@@ -21,6 +21,7 @@
<Level
name = "Mission One"
description = "How to steer a spaceship."
+ gametype = "Mission"
>
<templates>
<Template link=lodtemplate_default />
@@ -395,7 +396,7 @@
<Template link=spaceshippirate />
</templates>
<controller>
- <WaypointController>
+ <WaypointController team=1>
<waypoints>
<Model mesh="cube.mesh" scale=8 position=" 0,1700,-200" />
<Model mesh="cube.mesh" scale=8 position=" 0,1700,-700" />
@@ -416,7 +417,7 @@
<Template link=spaceshippirate />
</templates>
<controller>
- <WaypointController>
+ <WaypointController team=1>
<waypoints>
<Model mesh="cube.mesh" scale=8 position=" 0,2400,1000" />
<Model mesh="cube.mesh" scale=8 position=" 0,2400, 500" />
Modified: code/branches/gamecontent/data/levels/templates/spaceshipSpacecruiser.oxt
===================================================================
--- code/branches/gamecontent/data/levels/templates/spaceshipSpacecruiser.oxt 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/data/levels/templates/spaceshipSpacecruiser.oxt 2011-10-25 20:56:31 UTC (rev 8904)
@@ -10,10 +10,10 @@
maxhealth = 400
initialhealth = 300
- shieldhealth = 60
- initialshieldhealth = 60
- maxshieldhealth = 80
- shieldabsorption = 0.8
+ shieldhealth = 75
+ initialshieldhealth = 75
+ maxshieldhealth = 90
+ shieldabsorption = 0.9
reloadrate = 1
reloadwaittime = 1
@@ -56,13 +56,13 @@
</attached>
<collisionShapes>
- <BoxCollisionShape position="0,-30,-108" halfExtents="38,6,62" />
- <BoxCollisionShape position="0,-20,-108" halfExtents="20,6,40" />
- <BoxCollisionShape position="-16,-35,-112" halfExtents="15,5,57" roll=-14 pitch=3.5/>
- <BoxCollisionShape position="16,-35,-112" halfExtents="15,5,57" roll=14 pitch=3.5/>
- <BoxCollisionShape position="19,-21.5,-108" halfExtents="18,5,52" roll=-21 />
- <BoxCollisionShape position="-19,-21.5,-108"halfExtents="18,5,52" roll=21 />
- <BoxCollisionShape position="0,-21,-169"halfExtents="18,1,16" pitch=-30x />
+ <BoxCollisionShape position="0,-30,-108" halfExtents="38,6,62" />
+ <BoxCollisionShape position="0,-20,-108" halfExtents="20,6,40" />
+ <BoxCollisionShape position="-16,-35,-112" halfExtents="15,5,57" roll=-14 pitch=3.5/>
+ <BoxCollisionShape position="16,-35,-112" halfExtents="15,5,57" roll=14 pitch=3.5/>
+ <BoxCollisionShape position="19,-21.5,-108" halfExtents="18,5,52" roll=-21 />
+ <BoxCollisionShape position="-19,-21.5,-108" halfExtents="18,5,52" roll=21 />
+ <BoxCollisionShape position="0,-21,-169" halfExtents="18,1,16" pitch=-30 />
</collisionShapes>
<?lua
@@ -74,16 +74,9 @@
<Template name=spaceshipcruisercameras defaults=0>
<SpaceShip>
<camerapositions>
- <CameraPosition position="0,10, 40" drag=true mouselook=true />
- <CameraPosition position="0,20, 80" drag=true mouselook=true />
+ <CameraPosition position="0,15, 60" drag=true mouselook=true />
<CameraPosition position="0,30, 120" drag=true mouselook=true />
- <CameraPosition position="0,20,-260" drag=true mouselook=true yaw=180/>
- <CameraPosition position="0,30,-350" drag=true mouselook=true yaw=180/>
- <!--CameraPosition position="0,150,-25" pitch=-90 drag=true />
- <CameraPosition position="0,0,-40" yaw=180 drag=true />
- <CameraPosition position="0,3,-14" yaw=0 />
- <CameraPosition position="-50,5,-8" yaw=-90 drag=true />
- <CameraPosition position="50,5,-8" yaw=90 drag=true /-->
+ <CameraPosition position="0,40, 350" drag=true mouselook=true />
</camerapositions>
</SpaceShip>
</Template>
@@ -92,10 +85,10 @@
<MultiStateEngine
boostfactor = 2
- speedfront = 150
- speedback = 50
- speedleftright = 50
- speedupdown = 50
+ speedfront = 200
+ speedback = 70
+ speedleftright = 70
+ speedupdown = 70
defEngineSndNormal = "sounds/Engine_low.ogg"
defEngineSndBoost = "sounds/Engine_high.ogg"
Modified: code/branches/gamecontent/src/modules/pong/Pong.cc
===================================================================
--- code/branches/gamecontent/src/modules/pong/Pong.cc 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/modules/pong/Pong.cc 2011-10-25 20:56:31 UTC (rev 8904)
@@ -292,7 +292,6 @@
std::string name1=player1->getName();
std::string message(name1 + " has won!");
ChatManager::message(message);
-this->tick(0);
this->end();
}
else if(this->getScore(player2) >= scoreLimit_)
@@ -300,7 +299,6 @@
std::string name2=player2->getName();
std::string message2(name2 + " has won!");
ChatManager::message(message2);
-this->tick(0);
this->end();
}
// Restart the timer to start the ball.
Modified: code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.cc 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.cc 2011-10-25 20:56:31 UTC (rev 8904)
@@ -41,7 +41,6 @@
{
RegisterObject(WaypointPatrolController);
- //this->team_ = 0;
this->alertnessradius_ = 500;
this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this)));
@@ -52,7 +51,6 @@
SUPER(WaypointPatrolController, XMLPort, xmlelement, mode);
XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f);
-// XMLPortParam(WaypointPatrolController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0);
}
void WaypointPatrolController::tick(float dt)
Modified: code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.h
===================================================================
--- code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.h 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/controllers/WaypointPatrolController.h 2011-10-25 20:56:31 UTC (rev 8904)
@@ -45,11 +45,6 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void tick(float dt);
- /* inline void setTeam(int team)
- { this->team_ = team; }
- inline int getTeam() const
- { return this->team_; } */
-
inline void setAlertnessRadius(float radius)
{ this->alertnessradius_ = radius; }
inline float getAlertnessRadius() const
@@ -58,7 +53,6 @@
protected:
void searchEnemy();
- //int team_;
float alertnessradius_;
Timer patrolTimer_;
};
Modified: code/branches/gamecontent/src/orxonox/gametypes/CMakeLists.txt
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/CMakeLists.txt 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/gametypes/CMakeLists.txt 2011-10-25 20:56:31 UTC (rev 8904)
@@ -9,4 +9,5 @@
LastManStanding.cc
LastTeamStanding.cc
TeamGametype.cc
+ Mission.cc
)
Modified: code/branches/gamecontent/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/Gametype.h 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/gametypes/Gametype.h 2011-10-25 20:56:31 UTC (rev 8904)
@@ -122,7 +122,7 @@
inline const std::string& getHUDTemplate() const
{ return this->gtinfo_->getHUDTemplate(); }
- void addBots(unsigned int amount);
+ virtual void addBots(unsigned int amount);
void killBots(unsigned int amount = 0);
inline unsigned int getNumberOfPlayers() const
Added: code/branches/gamecontent/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/Mission.cc (rev 0)
+++ code/branches/gamecontent/src/orxonox/gametypes/Mission.cc 2011-10-25 20:56:31 UTC (rev 8904)
@@ -0,0 +1,87 @@
+/*
+ * 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 "Mission.h"
+//#inclued "TeamGametype.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(Mission);
+
+ Mission::Mission(BaseObject* creator) : TeamGametype(creator)
+ {
+ RegisterObject(Mission);
+ this->missionAccomplished_ = false;
+ this->lives_ = 10; // should be 1 as default value
+ this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
+ }
+
+ void Mission::tick(float dt)
+ {
+ SUPER(Mission, tick, dt);
+
+ if (missionAccomplished_)
+ {
+ this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+ this->end();
+ }
+ }
+
+ void Mission::pawnKilled(Pawn* victim, Pawn* killer)
+ {
+ if (victim && victim->getPlayer() && this->lives_ == 1)
+ {
+ this->missionAccomplished_ = false;
+ this->end();
+ }
+ }
+
+ void Mission::start()
+ {
+ Gametype::start();
+
+
+ this->gtinfo_->sendAnnounceMessage("Your mission has started!");
+ }
+
+ //void Mission::addBots(unsigned int amount)
+
+ void Mission::end()
+ {
+ Gametype::end();
+ /*if (this->missionAccomplished_)
+ this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+ else
+ this->gtinfo_->sendAnnounceMessage("Mission failed!");
+ * */
+ }
+}
Added: code/branches/gamecontent/src/orxonox/gametypes/Mission.h
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/Mission.h (rev 0)
+++ code/branches/gamecontent/src/orxonox/gametypes/Mission.h 2011-10-25 20:56:31 UTC (rev 8904)
@@ -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:
+ * Johannes Ritz
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Mission_H__
+#define _Mission_H__
+
+#include "OrxonoxPrereqs.h"
+//#include "Gametype.h"
+#include "TeamGametype.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Mission : public TeamGametype
+ {
+ public:
+ Mission(BaseObject* creator);
+ virtual ~Mission() {}
+
+ virtual void tick(float dt);
+
+ virtual void start();
+ virtual void end();
+ virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
+ inline void setLives(unsigned int amount)
+ {this->lives_ = amount;}
+ inline unsigned int getLives()
+ {return this->lives_;}
+
+ protected:
+ virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
+ bool missionAccomplished_; //<! indicates if player successfully finsihed the mission;
+ int lives_; //<! amount of player's lives <-> nr. of retries
+
+ };
+}
+
+#endif /* _Mission_H__ */
+
Modified: code/branches/gamecontent/src/orxonox/gametypes/TeamDeathmatch.h
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/TeamDeathmatch.h 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/gametypes/TeamDeathmatch.h 2011-10-25 20:56:31 UTC (rev 8904)
@@ -55,7 +55,6 @@
virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
int getTeam(PlayerInfo* player);
-
inline const ColourValue& getTeamColour(int teamnr) const
{ return this->teamcolours_[teamnr]; }
Modified: code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc 2011-10-25 20:56:31 UTC (rev 8904)
@@ -66,8 +66,12 @@
void TeamGametype::playerEntered(PlayerInfo* player)
{
Gametype::playerEntered(player);
+ this->findAndSetTeam(player);
+ }
- std::vector<unsigned int> playersperteam(this->teams_, 0);
+ void TeamGametype::findAndSetTeam(PlayerInfo* player)
+ {
+ std::vector<unsigned int> playersperteam(this->teams_, 0);
for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
@@ -85,6 +89,7 @@
}
this->teamnumbers_[player] = minplayersteam;
+
}
bool TeamGametype::playerLeft(PlayerInfo* player)
Modified: code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h 2011-10-25 20:56:31 UTC (rev 8904)
@@ -46,6 +46,7 @@
void setConfigValues();
virtual void playerEntered(PlayerInfo* player);
+ virtual void findAndSetTeam(PlayerInfo* player);
virtual bool playerLeft(PlayerInfo* player);
virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
Modified: code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc 2011-10-22 13:28:35 UTC (rev 8903)
+++ code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc 2011-10-25 20:56:31 UTC (rev 8904)
@@ -454,7 +454,7 @@
{
SUPER(Pawn, changedActivity);
- this->setRadarVisibility(this->isActive());
+ this->setRadarVisibility(this->isVisible());
}
void Pawn::changedVisibility(void)
More information about the Orxonox-commit
mailing list