[5979] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
[5981] | 23 | * Michael Wirth |
---|
[5979] | 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "NewHumanController.h" |
---|
| 30 | |
---|
[5981] | 31 | #include "core/input/InputManager.h" |
---|
| 32 | #include "core/input/InputState.h" |
---|
| 33 | |
---|
[5979] | 34 | #include "core/CoreIncludes.h" |
---|
| 35 | #include "core/ConsoleCommand.h" |
---|
| 36 | #include "worldentities/ControllableEntity.h" |
---|
| 37 | #include "worldentities/pawns/Pawn.h" |
---|
| 38 | #include "gametypes/Gametype.h" |
---|
| 39 | #include "infos/PlayerInfo.h" |
---|
| 40 | #include "overlays/Map.h" |
---|
| 41 | #include "graphics/Camera.h" |
---|
| 42 | #include "sound/SoundManager.h" |
---|
| 43 | #include "Radar.h" |
---|
| 44 | #include "Scene.h" |
---|
| 45 | |
---|
| 46 | namespace orxonox |
---|
| 47 | { |
---|
| 48 | |
---|
| 49 | CreateUnloadableFactory(NewHumanController); |
---|
| 50 | |
---|
| 51 | NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator) |
---|
| 52 | { |
---|
| 53 | RegisterObject(NewHumanController); |
---|
[6001] | 54 | |
---|
| 55 | CrossHairOverlay = new OrxonoxOverlay(this); |
---|
| 56 | CrossHairOverlay->setBackgroundMaterial("Orxonox/Crosshair3"); |
---|
| 57 | CrossHairOverlay->setSize(Vector2(0.08,0.08)); |
---|
| 58 | CrossHairOverlay->show(); |
---|
[5979] | 59 | } |
---|
| 60 | |
---|
| 61 | NewHumanController::~NewHumanController() |
---|
| 62 | { |
---|
[5981] | 63 | if( this->isInitialized() ) |
---|
| 64 | { |
---|
| 65 | } |
---|
[5979] | 66 | } |
---|
| 67 | |
---|
[6001] | 68 | void NewHumanController::tick(float dt) { |
---|
| 69 | CrossHairOverlay->setPosition(Vector2(static_cast<float>(this->currentYaw_), static_cast<float>(this->currentPitch_))); |
---|
| 70 | |
---|
| 71 | HumanController::tick(dt); |
---|
| 72 | } |
---|
| 73 | |
---|
[5993] | 74 | /*void NewHumanController::tick(float dt) |
---|
[5979] | 75 | { |
---|
| 76 | if (GameMode::playsSound() && NewHumanController::localController_s && NewHumanController::localController_s->controllableEntity_) |
---|
| 77 | { |
---|
| 78 | // Update sound listener |
---|
| 79 | Camera* camera = NewHumanController::localController_s->controllableEntity_->getCamera(); |
---|
| 80 | if (camera) |
---|
| 81 | { |
---|
| 82 | SoundManager::getInstance().setListenerPosition(camera->getWorldPosition()); |
---|
| 83 | SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation()); |
---|
| 84 | } |
---|
| 85 | else |
---|
| 86 | COUT(3) << "NewHumanController, Warning: Using a ControllableEntity without Camera" << std::endl; |
---|
| 87 | } |
---|
[5993] | 88 | }*/ |
---|
| 89 | |
---|
| 90 | void NewHumanController::yaw(const Vector2& value) |
---|
| 91 | { |
---|
| 92 | // SUPER(NewHumanController, yaw, value); |
---|
| 93 | HumanController::yaw(value); |
---|
| 94 | |
---|
| 95 | this->currentYaw_ = value.x; |
---|
[6001] | 96 | std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl; |
---|
[5979] | 97 | } |
---|
[5993] | 98 | void NewHumanController::pitch(const Vector2& value) |
---|
[5981] | 99 | { |
---|
[5993] | 100 | // SUPER(NewHumanController, pitch, value); |
---|
| 101 | HumanController::pitch(value); |
---|
| 102 | |
---|
| 103 | this->currentPitch_ = value.x; |
---|
[6001] | 104 | std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl; |
---|
[5981] | 105 | } |
---|
| 106 | |
---|
[5979] | 107 | } |
---|