Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/Presentation_FS16/src/orxonox/controllers/NewHumanController.cc @ 11936

Last change on this file since 11936 was 11208, checked in by fvultier, 9 years ago

merged discharger, thats the last one

  • Property svn:eol-style set to native
File size: 24.4 KB
Line 
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:
23 *      Michael Wirth
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "NewHumanController.h"
30
31#include <cmath>
32#include <OgreRay.h>
33#include <OgreSceneQuery.h>
34#include <OgreCamera.h>
35#include <OgreSceneManager.h>
36#include <bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
37
38#include "core/CoreIncludes.h"
39#include "core/command/ConsoleCommandIncludes.h"
40#include "core/input/KeyBinder.h"
41#include "core/input/KeyBinderManager.h"
42#include "worldentities/ControllableEntity.h"
43#include "worldentities/pawns/Pawn.h"
44#include "infos/PlayerInfo.h"
45#include "overlays/OrxonoxOverlay.h"
46#include "graphics/Camera.h"
47#include "sound/SoundManager.h"
48#include "tools/BulletConversions.h"
49#include "Scene.h"
50
51namespace orxonox
52{
53    SetConsoleCommand("NewHumanController", "changeMode", &NewHumanController::changeMode).keybindMode(KeybindMode::OnPress);
54    SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress);
55    SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
56
57    RegisterUnloadableClass(NewHumanController);
58
59    NewHumanController* NewHumanController::localController_s = nullptr;
60
61    NewHumanController::NewHumanController(Context* context)
62        : HumanController(context)
63        , crossHairOverlay_(nullptr)
64        , centerOverlay_(nullptr)
65        , damageOverlayTop_(nullptr)
66        , damageOverlayRight_(nullptr)
67        , damageOverlayBottom_(nullptr)
68        , damageOverlayLeft_(nullptr)
69        , damageOverlayTT_(0)
70        , damageOverlayTR_(0)
71        , damageOverlayTB_(0)
72        , damageOverlayTL_(0)
73        , arrowsOverlay1_(nullptr)
74        , arrowsOverlay2_(nullptr)
75        , arrowsOverlay3_(nullptr)
76        , arrowsOverlay4_(nullptr)
77    {
78        RegisterObject(NewHumanController);
79
80        overlaySize_ = 0.08f;
81        arrowsSize_ = 0.4f;
82
83        damageOverlayTime_ = 0.6f;
84
85        controlMode_ = 0;
86        acceleration_ = 0;
87        accelerating_ = false;
88        firemode_ = -1;
89
90        showArrows_ = true;
91        showOverlays_ = false;
92        showDamageOverlay_ = true;
93
94        //currentPitch_ = 1;
95        //currentYaw_ = 1;
96
97        if (GameMode::showsGraphics())
98        {
99            crossHairOverlay_ = new OrxonoxOverlay(this->getContext());
100            crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
101            crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
102            crossHairOverlay_->hide();
103            //crossHairOverlay_->setAspectCorrection(true); not working
104
105            centerOverlay_ = new OrxonoxOverlay(this->getContext());
106            centerOverlay_->setBackgroundMaterial("Orxonox/CenterOverlay");
107            centerOverlay_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
108            centerOverlay_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
109            centerOverlay_->hide();
110
111            if (showDamageOverlay_)
112            {
113                damageOverlayTop_ = new OrxonoxOverlay(this->getContext());
114                damageOverlayTop_->setBackgroundMaterial("Orxonox/DamageOverlayTop");
115                damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
116                damageOverlayTop_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
117                damageOverlayTop_->hide();
118
119                damageOverlayRight_ = new OrxonoxOverlay(this->getContext());
120                damageOverlayRight_->setBackgroundMaterial("Orxonox/DamageOverlayRight");
121                damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
122                damageOverlayRight_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
123                damageOverlayRight_->hide();
124
125                damageOverlayBottom_ = new OrxonoxOverlay(this->getContext());
126                damageOverlayBottom_->setBackgroundMaterial("Orxonox/DamageOverlayBottom");
127                damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
128                damageOverlayBottom_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
129                damageOverlayBottom_->hide();
130
131                damageOverlayLeft_ = new OrxonoxOverlay(this->getContext());
132                damageOverlayLeft_->setBackgroundMaterial("Orxonox/DamageOverlayLeft");
133                damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
134                damageOverlayLeft_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
135                damageOverlayLeft_->hide();
136            }
137
138            if (showArrows_)
139            {
140                arrowsOverlay1_ = new OrxonoxOverlay(this->getContext());
141                arrowsOverlay1_->setBackgroundMaterial("Orxonox/DirectionArrows1");
142                arrowsOverlay1_->setSize(Vector2(0.02727f, 0.36f * arrowsSize_));
143                arrowsOverlay1_->setPickPoint(Vector2(0.5f, 0.5f));
144                arrowsOverlay1_->setPosition(Vector2(0.5f, 0.5f));
145                arrowsOverlay1_->hide();
146
147                arrowsOverlay2_ = new OrxonoxOverlay(this->getContext());
148                arrowsOverlay2_->setBackgroundMaterial("Orxonox/DirectionArrows2");
149                arrowsOverlay2_->setSize(Vector2(0.02727f, 0.59f * arrowsSize_));
150                arrowsOverlay2_->setPickPoint(Vector2(0.5f, 0.5f));
151                arrowsOverlay2_->setPosition(Vector2(0.5f, 0.5f));
152                arrowsOverlay2_->hide();
153
154                arrowsOverlay3_ = new OrxonoxOverlay(this->getContext());
155                arrowsOverlay3_->setBackgroundMaterial("Orxonox/DirectionArrows3");
156                arrowsOverlay3_->setSize(Vector2(0.02727f, 0.77f * arrowsSize_));
157                arrowsOverlay3_->setPickPoint(Vector2(0.5f, 0.5f));
158                arrowsOverlay3_->setPosition(Vector2(0.5f, 0.5f));
159                arrowsOverlay3_->hide();
160
161                arrowsOverlay4_ = new OrxonoxOverlay(this->getContext());
162                arrowsOverlay4_->setBackgroundMaterial("Orxonox/DirectionArrows4");
163                arrowsOverlay4_->setSize(Vector2(0.02727f, arrowsSize_));
164                arrowsOverlay4_->setPickPoint(Vector2(0.5f, 0.5f));
165                arrowsOverlay4_->setPosition(Vector2(0.5f, 0.5f));
166                arrowsOverlay4_->hide();
167            }
168        }
169
170        // HACK: Define which objects are targetable when considering the creator of an orxonox::Model
171        this->targetMask_.exclude(ClassByString("BaseObject"));
172        this->targetMask_.include(ClassByString("WorldEntity"));
173        this->targetMask_.exclude(ClassByString("Projectile"));
174
175        NewHumanController::localController_s = this;
176
177        controlPaused_ = false;
178
179        //HumanController::localController_s->getControllableEntity()->getCamera()->setDrag(true);
180    }
181
182    NewHumanController::~NewHumanController()
183    {
184        if (this->isInitialized())
185        {
186            if (this->crossHairOverlay_)
187                this->crossHairOverlay_->destroy();
188            if (this->centerOverlay_)
189                this->centerOverlay_->destroy();
190
191            if (this->arrowsOverlay1_)
192                this->arrowsOverlay1_->destroy();
193            if (this->arrowsOverlay2_)
194                this->arrowsOverlay2_->destroy();
195            if (this->arrowsOverlay3_)
196                this->arrowsOverlay3_->destroy();
197            if (this->arrowsOverlay4_)
198                this->arrowsOverlay4_->destroy();
199            if (this->damageOverlayTop_)
200                this->damageOverlayTop_->destroy();
201            if (this->damageOverlayLeft_)
202                this->damageOverlayLeft_->destroy();
203            if (this->damageOverlayRight_)
204                this->damageOverlayRight_->destroy();
205            if (this->damageOverlayBottom_)
206                this->damageOverlayBottom_->destroy();
207        }
208    }
209
210    void NewHumanController::tick(float dt)
211    {
212        if (GameMode::showsGraphics())
213        {
214
215            if (this->controllableEntity_ && !this->controllableEntity_->isInMouseLook())
216            {
217                this->updateTarget();
218
219                if (!controlPaused_ )
220                {
221                    if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
222                        this->showOverlays();
223                    else if (this->getControllableEntity() &&  this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
224                    {
225                        this->showOverlays();
226                        this->hideArrows();
227                    }
228
229                    this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5f-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5f-overlaySize_/2));
230
231                    if (this->controlMode_ == 0 || (this->controlMode_ == 1 && this->firemode_ == 1))
232                    {
233                        if (this->showOverlays_ && this->showArrows_)
234                            alignArrows();
235                    }
236                    else
237                        hideArrows();
238
239                    if (this->showDamageOverlay_ && (this->damageOverlayTT_ > 0 || this->damageOverlayTR_ > 0 || this->damageOverlayTB_ > 0 || this->damageOverlayTL_ > 0))
240                    {
241                        this->damageOverlayTT_ -= dt;
242                        this->damageOverlayTR_ -= dt;
243                        this->damageOverlayTB_ -= dt;
244                        this->damageOverlayTL_ -= dt;
245                        if (this->damageOverlayTT_ <= 0)
246                            this->damageOverlayTop_->hide();
247                        if (this->damageOverlayTR_ <= 0)
248                            this->damageOverlayRight_->hide();
249                        if (this->damageOverlayTB_ <= 0)
250                            this->damageOverlayBottom_->hide();
251                        if (this->damageOverlayTL_ <= 0)
252                            this->damageOverlayLeft_->hide();
253                    }
254                }
255            }
256            else
257                this->hideOverlays();
258
259            if (this->acceleration_ > 0)
260            {
261                if (this->accelerating_)
262                    HumanController::moveFrontBack(Vector2(1, 0));
263                else
264                    HumanController::moveFrontBack(Vector2(this->acceleration_, 0));
265                this->accelerating_ = false;
266                //HumanController::moveFrontBack(Vector2(clamp(this->acceleration_ + this->currentAcceleration_, 0.0f, 1.0f), 0));
267            }
268        }
269
270        // Reset pitch and yaw rates
271        // TODO: Reactivate this to fix the game pad problem with 0 input
272        //this->currentPitch_ = 0;
273        //this->currentYaw_ = 0;
274
275        HumanController::tick(dt);
276    }
277
278    void NewHumanController::doPush(unsigned int firemode)
279    {
280        if (!this->controllableEntity_)
281            return;
282
283        this->firemode_ = firemode;
284
285        if (firemode == 1 && this->controlMode_ == 1)
286        {
287            //unlocked steering, steer on right mouse click
288            HumanController::yaw(Vector2(this->currentYaw_, 0));
289            HumanController::pitch(Vector2(this->currentPitch_, 0));
290        }
291        else
292        {
293            HumanController::doPush(firemode); //call for formationflight
294        }
295    }
296
297    void NewHumanController::doRelease(unsigned int firemode)
298    {
299        if (!this->controllableEntity_)
300            return;
301
302        this->firemode_ = firemode;
303
304        HumanController::doRelease(firemode); //call for formationflight
305    }
306
307    void NewHumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
308    {
309        //Used in HumanController for formationFlight
310        HumanController::hit(originator,contactpoint,damage);
311
312        if (this->showDamageOverlay_ && !this->controlPaused_ && this->controllableEntity_ && !this->controllableEntity_->isInMouseLook())
313        {
314            Vector3 posA;
315            if (originator)
316                posA = originator->getWorldPosition();
317            else
318                posA = multi_cast<Vector3>(contactpoint.getPositionWorldOnA());
319            //Vector3 posB = multi_cast<Vector3>(contactpoint.getPositionWorldOnB());
320            //posA and posB are almost identical
321
322            Vector3 relativeHit = this->getControllableEntity()->getWorldOrientation().UnitInverse() * (this->getControllableEntity()->getWorldPosition() - posA);
323
324            //back is z positive
325            //x is left positive
326            //y is down positive
327            relativeHit.normalise();
328
329            float threshold = 0.3f;
330            if (relativeHit.x > threshold) // Left
331            {
332                this->damageOverlayLeft_->show();
333                this->damageOverlayTL_ = this->damageOverlayTime_;
334                //this->damageOverlayLeft_->setBackgroundAlpha(0.3);
335            }
336            if (relativeHit.x < -threshold) //Right
337            {
338                this->damageOverlayRight_->show();
339                this->damageOverlayTR_ = this->damageOverlayTime_;
340                //this->damageOverlayRight_->setBackgroundAlpha(0.3);
341            }
342            if (relativeHit.y > threshold) //Top
343            {
344                this->damageOverlayBottom_->show();
345                this->damageOverlayTB_ = this->damageOverlayTime_;
346                //this->damageOverlayTop_->setBackgroundAlpha(0.3);
347            }
348            if (relativeHit.y < -threshold) //Bottom
349            {
350                this->damageOverlayTop_->show();
351                this->damageOverlayTT_ = this->damageOverlayTime_;
352                //this->damageOverlayBottom_->setBackgroundAlpha(0.3);
353            }
354        }
355    }
356
357    void NewHumanController::centerCursor()
358    {
359        this->currentYaw_ = 0;
360        this->currentPitch_ = 0;
361
362        if( KeyBinderManager::exists() )
363            KeyBinderManager::getInstance().getCurrent()->resetMouseAxes();
364    }
365
366    void NewHumanController::updateTarget()
367    {
368        Ogre::RaySceneQuery * rsq = HumanController::localController_s->getControllableEntity()->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
369
370        Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5f, static_cast<float>(this->currentPitch_)/2*-1+.5f);
371
372        rsq->setRay(mouseRay);
373        rsq->setSortByDistance(true);
374
375        /*
376        Distance of objects:
377        ignore everything under 200 maybe even take 1000 as min distance to shoot at
378
379        shots are regularly traced and are entities!!!!!!!!! this is the biggest problem
380        they vanish only after a distance of 10'000
381        */
382
383
384        Ogre::RaySceneQueryResult& result = rsq->execute();
385        Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
386        WorldEntity* myWe = static_cast<WorldEntity*>(this->getControllableEntity());
387
388        Ogre::RaySceneQueryResult::iterator itr;
389        for (itr = result.begin(); itr != result.end(); ++itr)
390        {
391//             orxout() << "testing object as target" << endl;
392            if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 200)
393            {
394                // Try to cast the user pointer
395                WorldEntity* wePtr;
396                try
397                {
398                    wePtr = orxonox_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));
399                }
400                catch (...)
401                {
402                    continue;
403                }
404
405                // make sure we don't shoot ourselves
406                if( wePtr==myWe )
407                    continue;
408
409                if (wePtr)
410                {
411                    // go through all parents of object and look whether they are sightable or not
412                    bool isSightable = false;
413                    WorldEntity* parent = wePtr->getParent();
414                    while (parent)
415                    {
416                        if (this->targetMask_.isExcluded(parent->getIdentifier()) || parent==myWe)
417                        {
418                            parent = parent->getParent();
419                            continue;
420                        }
421                        else
422                        {
423                            isSightable = true;
424                            break;
425                        }
426                    }
427                    if (!isSightable)
428                        continue;
429                }
430
431                if (this->getControllableEntity() && this->getControllableEntity()->getTarget() != wePtr)
432                    this->getControllableEntity()->setTarget(wePtr);
433
434                if (pawn)
435                    pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance );
436
437                //itr->movable->getParentSceneNode()->showBoundingBox(true);
438                //return mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance; //or itr->movable->getParentSceneNode()->_getDerivedPosition()
439                return;
440            }
441        }
442
443        if (pawn)
444            pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 );
445
446        if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != nullptr )
447            this->getControllableEntity()->setTarget( nullptr );
448
449        //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 2000);
450        //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getCamera()->getOgreCamera()->getOrientation() * Vector3::NEGATIVE_UNIT_Z);
451    }
452
453    void NewHumanController::frontback(const Vector2& value)
454    {
455        this->accelerating_ = true;
456
457        //if (this->acceleration_ == 0)
458        HumanController::frontback(value);
459    }
460
461    void NewHumanController::yaw(const Vector2& value)
462    {
463        //SUPER(NewHumanController, yaw, value);
464        if (this->controlMode_ == 0 || (this->controllableEntity_ && this->controllableEntity_->isInMouseLook()))
465            HumanController::yaw(value);
466
467        if (this->getControllableEntity() && !this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
468            this->currentYaw_ = value.x;
469    }
470
471    void NewHumanController::pitch(const Vector2& value)
472    {
473        //SUPER(NewHumanController, pitch, value);
474        if (this->controlMode_ == 0 || (this->controllableEntity_ && this->controllableEntity_->isInMouseLook()))
475            HumanController::pitch(value);
476
477        if (this->getControllableEntity() && !this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
478            this->currentPitch_ = value.x;
479    }
480
481    void NewHumanController::changeMode()
482    {
483        if (NewHumanController::localController_s)
484        {
485            if (NewHumanController::localController_s->controlMode_ == 0)
486            {
487                NewHumanController::localController_s->controlMode_ = 1;
488                NewHumanController::localController_s->hideArrows();
489            }
490            else
491                NewHumanController::localController_s->controlMode_ = 0;
492        }
493    }
494
495    void NewHumanController::changedControllableEntity()
496    {
497        HumanController::changedControllableEntity(); // super
498
499        this->controlMode_ = 0;
500        this->centerCursor();
501        if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
502        {
503            this->showOverlays_ = true;
504            if (!this->controlPaused_)
505            {
506                this->showOverlays();
507                this->alignArrows();
508            }
509        }
510        else
511        {
512            this->showOverlays_ = false;
513            this->hideOverlays();
514        }
515    }
516
517    void NewHumanController::accelerate()
518    {
519        if (NewHumanController::localController_s)
520            NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ + 0.2f, 0.00f, 1.0f);
521    }
522
523    void NewHumanController::decelerate()
524    {
525        if (NewHumanController::localController_s)
526            NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ - 0.1f, 0.0f, 1.0f);
527    }
528
529    void NewHumanController::doResumeControl()
530    {
531        this->controlPaused_ = false;
532        if (this->showOverlays_)
533            this->showOverlays();
534    }
535
536    void NewHumanController::doPauseControl()
537    {
538        this->controlPaused_ = true;
539        this->hideOverlays();
540    }
541
542    void NewHumanController::alignArrows()
543    {
544        if (showArrows_)
545        {
546            hideArrows();
547
548            float distance = sqrt(pow(static_cast<float>(this->currentYaw_)/2*-1,2) + pow(static_cast<float>(this->currentPitch_)/2*-1,2));
549
550            if (distance > 0.04f && distance <= 0.59f * arrowsSize_ / 2.0f )
551            {
552                this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f));
553                this->arrowsOverlay1_->show();
554            }
555            else if (distance > 0.59f * arrowsSize_ / 2.0f && distance <= 0.77f * arrowsSize_ / 2.0f )
556            {
557                this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f));
558                this->arrowsOverlay2_->show();
559            }
560            else if (distance > 0.77f * arrowsSize_ / 2.0f && distance <= arrowsSize_ / 2.0f)
561            {
562                this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f));
563                this->arrowsOverlay3_->show();
564            }
565            else if (distance > arrowsSize_ / 2.0f)
566            {
567                this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f));
568                this->arrowsOverlay4_->show();
569            }
570        }
571    }
572
573    void NewHumanController::showOverlays()
574    {
575        if (!GameMode::showsGraphics())
576            return;
577        this->crossHairOverlay_->show();
578        this->centerOverlay_->show();
579
580        if (showArrows_)
581        {
582            this->arrowsOverlay1_->show();
583            this->arrowsOverlay2_->show();
584            this->arrowsOverlay3_->show();
585            this->arrowsOverlay4_->show();
586        }
587    }
588
589    void NewHumanController::hideOverlays()
590    {
591        if (!GameMode::showsGraphics())
592            return;
593        this->crossHairOverlay_->hide();
594        this->centerOverlay_->hide();
595
596        if (showDamageOverlay_)
597        {
598            this->damageOverlayTop_->hide();
599            this->damageOverlayRight_->hide();
600            this->damageOverlayBottom_->hide();
601            this->damageOverlayLeft_->hide();
602        }
603
604        this->hideArrows();
605    }
606
607    void NewHumanController::hideArrows()
608    {
609        if(!GameMode::showsGraphics())
610            return;
611        if (showArrows_)
612        {
613            this->arrowsOverlay1_->hide();
614            this->arrowsOverlay2_->hide();
615            this->arrowsOverlay3_->hide();
616            this->arrowsOverlay4_->hide();
617        }
618    }
619
620
621
622
623
624}
Note: See TracBrowser for help on using the repository browser.