[Orxonox-commit 1261] r5979 - in code/branches/steering/src/orxonox: controllers infos
wirthmi at orxonox.net
wirthmi at orxonox.net
Wed Oct 21 15:41:56 CEST 2009
Author: wirthmi
Date: 2009-10-21 15:41:56 +0200 (Wed, 21 Oct 2009)
New Revision: 5979
Added:
code/branches/steering/src/orxonox/controllers/NewHumanController.cc
code/branches/steering/src/orxonox/controllers/NewHumanController.h
Modified:
code/branches/steering/src/orxonox/controllers/CMakeLists.txt
code/branches/steering/src/orxonox/infos/HumanPlayer.cc
Log:
Added and activated new controller called NewHumanController.
Modified: code/branches/steering/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/steering/src/orxonox/controllers/CMakeLists.txt 2009-10-21 11:47:12 UTC (rev 5978)
+++ code/branches/steering/src/orxonox/controllers/CMakeLists.txt 2009-10-21 13:41:56 UTC (rev 5979)
@@ -1,6 +1,7 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
Controller.cc
HumanController.cc
+ NewHumanController.cc
ArtificialController.cc
AIController.cc
ScriptController.cc
Added: code/branches/steering/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/steering/src/orxonox/controllers/NewHumanController.cc (rev 0)
+++ code/branches/steering/src/orxonox/controllers/NewHumanController.cc 2009-10-21 13:41:56 UTC (rev 5979)
@@ -0,0 +1,97 @@
+/*
+ * 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 "NewHumanController.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConsoleCommand.h"
+#include "worldentities/ControllableEntity.h"
+#include "worldentities/pawns/Pawn.h"
+#include "gametypes/Gametype.h"
+#include "infos/PlayerInfo.h"
+#include "overlays/Map.h"
+#include "graphics/Camera.h"
+#include "sound/SoundManager.h"
+#include "Radar.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ SetConsoleCommand(NewHumanController, moveFrontBack, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, moveRightLeft, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, moveUpDown, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, rotateYaw, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, rotatePitch, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, rotateRoll, true).setAsInputCommand();
+ SetConsoleCommand(NewHumanController, fire, true).keybindMode(KeybindMode::OnHold);
+ SetConsoleCommand(NewHumanController, reload, true);
+ SetConsoleCommand(NewHumanController, boost, true).keybindMode(KeybindMode::OnHold);
+ SetConsoleCommand(NewHumanController, greet, true);
+ SetConsoleCommand(NewHumanController, switchCamera, true);
+ SetConsoleCommand(NewHumanController, mouseLook, true);
+ SetConsoleCommand(NewHumanController, suicide, true);
+ SetConsoleCommand(NewHumanController, addBots, true).defaultValues(1);
+ SetConsoleCommand(NewHumanController, killBots, true).defaultValues(0);
+ SetConsoleCommand(NewHumanController, dropItems, true);
+ SetConsoleCommand(NewHumanController, useItem, true);
+ SetConsoleCommand(NewHumanController, cycleNavigationFocus, true);
+ SetConsoleCommand(NewHumanController, releaseNavigationFocus, true);
+
+ CreateUnloadableFactory(NewHumanController);
+
+ NewHumanController* NewHumanController::localController_s = 0;
+
+ NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator)
+ {
+ RegisterObject(NewHumanController);
+
+ NewHumanController::localController_s = this;
+ }
+
+ NewHumanController::~NewHumanController()
+ {
+ NewHumanController::localController_s = 0;
+ }
+
+ void NewHumanController::tick(float dt)
+ {
+ if (GameMode::playsSound() && NewHumanController::localController_s && NewHumanController::localController_s->controllableEntity_)
+ {
+ // Update sound listener
+ Camera* camera = NewHumanController::localController_s->controllableEntity_->getCamera();
+ if (camera)
+ {
+ SoundManager::getInstance().setListenerPosition(camera->getWorldPosition());
+ SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation());
+ }
+ else
+ COUT(3) << "NewHumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
+ }
+ }
+
+}
Added: code/branches/steering/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/branches/steering/src/orxonox/controllers/NewHumanController.h (rev 0)
+++ code/branches/steering/src/orxonox/controllers/NewHumanController.h 2009-10-21 13:41:56 UTC (rev 5979)
@@ -0,0 +1,52 @@
+/*
+ * 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 _NewNewHumanController_H__
+#define _NewNewHumanController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "HumanController.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport NewHumanController : public HumanController
+ {
+ public:
+ NewHumanController(BaseObject* creator);
+ virtual ~NewHumanController();
+
+ virtual void tick(float dt);
+
+ private:
+ static NewHumanController* localController_s;
+ };
+}
+
+#endif /* _NewHumanController_H__ */
Modified: code/branches/steering/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- code/branches/steering/src/orxonox/infos/HumanPlayer.cc 2009-10-21 11:47:12 UTC (rev 5978)
+++ code/branches/steering/src/orxonox/infos/HumanPlayer.cc 2009-10-21 13:41:56 UTC (rev 5979)
@@ -34,6 +34,7 @@
#include "network/ClientInformation.h"
#include "network/Host.h"
#include "controllers/HumanController.h"
+#include "controllers/NewHumanController.h"
#include "gametypes/Gametype.h"
#include "overlays/OverlayGroup.h"
@@ -49,7 +50,7 @@
this->client_initialized_ = false;
this->bHumanPlayer_ = true;
- this->defaultController_ = Class(HumanController);
+ this->defaultController_ = Class(NewHumanController);
this->humanHud_ = 0;
this->gametypeHud_ = 0;
More information about the Orxonox-commit
mailing list