Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc @ 6320

Last change on this file since 6320 was 6320, checked in by scheusso, 14 years ago

various fixes for client: NHC, sound, callback handling of Vector4 & Quaternion

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