[Orxonox-commit 249] r2905 - in branches/gametypes/src/orxonox/objects: gametypes worldentities/triggers
Aurelian at orxonox.net
Aurelian at orxonox.net
Mon Apr 6 17:25:22 CEST 2009
Author: Aurelian
Date: 2009-04-06 17:25:22 +0200 (Mon, 06 Apr 2009)
New Revision: 2905
Added:
branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h
branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
Modified:
branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.cc
branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h
Log:
My first version with working triggers in a row...
Added: branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc (rev 0)
+++ branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc 2009-04-06 15:25:22 UTC (rev 2905)
@@ -0,0 +1,64 @@
+/*
+ * 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:
+ * Aurelian
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Asteroids.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+#include "network/Host.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(Asteroids);
+
+ Asteroids::Asteroids(BaseObject* creator) : Gametype(creator)
+ {
+ RegisterObject(Asteroids);
+ }
+
+ void Asteroids::start()
+ {
+ Gametype::start();
+
+ std::string message = "The match has started! Reach the first chekpoint within 60 seconds! But be aware, there may be pirates around...";
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ }
+
+ void Deathmatch::end()
+ {
+ Gametype::end();
+
+ std::string message = "The match has ended.";
+ COUT(0) << message << std::endl;
+ Host::Broadcast(message);
+ }
+}
Added: branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h (rev 0)
+++ branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h 2009-04-06 15:25:22 UTC (rev 2905)
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ * Aurelian
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Asteroids_H__
+#define _Asteroids_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Gametype.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Asteroids : public Gametype
+ {
+ public:
+ Asteroids(BaseObject* creator);
+ virtual ~Asteroids() {}
+
+ virtual void start();
+ virtual void end();
+ };
+}
+
+#endif /* _Asteroids_H__ */
Added: branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc (rev 0)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc 2009-04-06 15:25:22 UTC (rev 2905)
@@ -0,0 +1,64 @@
+/*
+ * 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:
+ * Aurelian
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CheckPoint.h"
+
+#include <OgreNode.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "orxonox/objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+ CreateFactory(CheckPoint);
+
+ CheckPoint::CheckPoint(BaseObject* creator) : DistanceTrigger(creator)
+ {
+ RegisterObject(CheckPoint);
+
+ isForPlayer_ = true;
+ bStayActive_ = true;
+ }
+
+ CheckPoint::~CheckPoint()
+ {
+ }
+
+ void Checkpoint::triggered(bool bIsTriggered)
+ {
+ DistanceTrigger::triggered(bIsTriggered);
+
+ if (bIsTriggered)
+ {
+ //...
+ }
+ }
+}
Added: branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h (rev 0)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h 2009-04-06 15:25:22 UTC (rev 2905)
@@ -0,0 +1,61 @@
+/*
+ * 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:
+ * Aurelian
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief
+ Definition of the PlayerTrigger class.
+*/
+
+#ifndef _CheckPoint_H__
+#define _CheckPoint_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Trigger.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport CheckPoint : public DistanceTrigger
+ {
+ public:
+ CheckPoint(BaseObject* creator);
+ virtual ~CheckPoint();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
+
+
+ private:
+ virtual void triggered(bool bIsTriggered);
+
+ bool bIsDestination_;
+ };
+
+}
+
+#endif /* _CheckPoint_H__ */
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.cc 2009-04-06 14:50:31 UTC (rev 2904)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.cc 2009-04-06 15:25:22 UTC (rev 2905)
@@ -101,7 +101,7 @@
if (this->bFirstTick_)
{
this->bFirstTick_ = false;
- this->fireEvent(false);
+ this->triggered(false);
}
// Check if the object is active (this is NOT Trigger::isActive()!)
@@ -143,7 +143,7 @@
char newState = this->stateChanges_.front().second;
this->bTriggered_ = (newState & 0x1);
this->bActive_ = newState & 2;
- this->fireEvent(this->bActive_);
+ this->triggered(this->bActive_);
this->stateChanges_.pop();
if (this->stateChanges_.size() != 0)
this->remainingTime_ = this->stateChanges_.front().first;
@@ -161,6 +161,11 @@
this->setBillboardColour(ColourValue(1.0, 0.0, 0.0));
}
+ void Trigger::triggered(bool bIsTriggered)
+ {
+ this->fireEvent(bIsTriggered);
+ }
+
bool Trigger::isTriggered(TriggerMode mode)
{
// if (this->bUpdating_)
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h 2009-04-06 14:50:31 UTC (rev 2904)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h 2009-04-06 15:25:22 UTC (rev 2905)
@@ -100,6 +100,7 @@
protected:
inline bool isTriggered() { return this->isTriggered(this->mode_); }
virtual bool isTriggered(TriggerMode mode);
+ virtual void triggered(bool bIsTriggered);
private:
bool checkAnd();
More information about the Orxonox-commit
mailing list