Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/cpp11_v2/src/modules/jump/Jump.cc @ 10998

Last change on this file since 10998 was 10920, checked in by landauf, 10 years ago

no static functions anymore in ObjectList. you need to instantiate an ObjectList to use it.
this allows for prettier for-loop syntax when iterating over an ObjectList of a specific context: for (T* object : ObjectList<T>(context)) { … }

  • Property svn:eol-style set to native
File size: 46.7 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 *      Fabien Vultier
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file Jump.cc
31    @brief This is the gametype for the awesome minigame. Here the level is randomly created, the camera is shifted, ...
32*/
33
34#include "Jump.h"
35#include "core/CoreIncludes.h"
36
37#include "JumpCenterpoint.h"
38#include "JumpPlatform.h"
39#include "JumpPlatformStatic.h"
40#include "JumpPlatformHMove.h"
41#include "JumpPlatformVMove.h"
42#include "JumpPlatformDisappear.h"
43#include "JumpPlatformTimer.h"
44#include "JumpPlatformFake.h"
45#include "JumpProjectile.h"
46#include "JumpEnemy.h"
47#include "JumpFigure.h"
48#include "JumpItem.h"
49#include "JumpSpring.h"
50#include "JumpRocket.h"
51#include "JumpPropeller.h"
52#include "JumpBoots.h"
53#include "JumpShield.h"
54
55#include "gamestates/GSLevel.h"
56#include "infos/PlayerInfo.h"
57#include "graphics/Camera.h"
58
59namespace orxonox
60{
61    RegisterUnloadableClass(Jump);
62
63    Jump::Jump(Context* context) : Deathmatch(context)
64    {
65        RegisterObject(Jump);
66
67        center_ = nullptr;
68        figure_ = nullptr;
69        camera = nullptr;
70        setHUDTemplate("JumpHUD");
71    }
72
73    Jump::~Jump()
74    {
75        if (isInitialized())
76        {
77            cleanup();
78        }
79    }
80
81    void Jump::tick(float dt)
82    {
83        SUPER(Jump, tick, dt);
84
85        if (figure_ != nullptr)
86        {
87            Vector3 figurePosition = figure_->getPosition();
88            Vector3 figureVelocity = figure_->getVelocity();
89
90            float boundary = totalScreenShift_+center_->getCameraOffset();
91
92            if (figurePosition.z > boundary)
93            {
94                screenShiftSinceLastUpdate_ += figurePosition.z - boundary;
95                totalScreenShift_ = figurePosition.z - center_->getCameraOffset();
96
97                // Create new platforms if needed
98                if (screenShiftSinceLastUpdate_ > center_->getSectionLength())
99                {
100                    if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == nullptr && figure_->rocketActive_ == nullptr && addAdventure(adventureNumber_) == true)
101                    {
102                        screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength();
103                        ++ adventureNumber_;
104                    }
105                    else
106                    {
107                        screenShiftSinceLastUpdate_ -= center_->getSectionLength();
108                        addSection();
109                    }
110                }
111            }
112
113            if (figurePosition.z < totalScreenShift_ - center_->getFieldDimension().y + platformHeight_ && figureVelocity.z < 0)
114            {
115                figure_->dead_ = true;
116            }
117
118            if (figure_->fireSignal_ == true)
119            {
120                if (figure_->dead_ == true)
121                {
122                    end();
123                }
124                else
125                {
126                    figure_->fireSignal_ = false;
127                    addProjectile(figurePosition.x, figurePosition.z + figure_->getPropellerPos());
128                }
129            }
130
131
132            if (camera != nullptr)
133            {
134                Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0);
135                camera->setPosition(cameraPosition);
136            }
137            else
138            {
139                orxout() << "No camera found." << endl;
140            }
141        }
142
143        ObjectList<JumpPlatform> listPlatform;
144        ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin();
145        Vector3 platformPosition;
146
147        while (itPlatform != listPlatform.end())
148        {
149            platformPosition = itPlatform->getPosition();
150            if (platformPosition.z < totalScreenShift_ - center_->getFieldDimension().y)
151            {
152                ObjectList<JumpPlatform>::iterator temp = itPlatform;
153                ++ itPlatform;
154                center_->detach(*temp);
155                temp->destroy();
156            }
157            else
158            {
159                ++ itPlatform;
160            }
161        }
162
163        // Deleted deactivated platforms
164        ObjectList<JumpPlatformDisappear> listDisappear;
165        ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin();
166
167        while (itDisappear != listDisappear.end())
168        {
169            if (!itDisappear->isActive())
170            {
171                ObjectList<JumpPlatformDisappear>::iterator temp = itDisappear;
172                ++ itDisappear;
173                center_->detach(*temp);
174                temp->destroy();
175            }
176            else
177            {
178                ++ itDisappear;
179            }
180        }
181
182        ObjectList<JumpPlatformTimer> listTimer;
183        ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin();
184
185        while (itTimer != listTimer.end())
186        {
187            if (!itTimer->isActive())
188            {
189                ObjectList<JumpPlatformTimer>::iterator temp = itTimer;
190                ++ itTimer;
191                center_->detach(*temp);
192                temp->destroy();
193            }
194            else
195            {
196                ++ itTimer;
197            }
198        }
199
200        ObjectList<JumpProjectile> listProjectile;
201        ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin();
202        Vector3 projectilePosition;
203
204        while (itProjectile != listProjectile.end())
205        {
206            projectilePosition = itProjectile->getPosition();
207            if (projectilePosition.z > totalScreenShift_ + 5*center_->getFieldDimension().y)
208            {
209                ObjectList<JumpProjectile>::iterator temp = itProjectile;
210                ++ itProjectile;
211                center_->detach(*temp);
212                temp->destroy();
213            }
214            else
215            {
216                ++ itProjectile;
217            }
218        }
219
220        ObjectList<JumpEnemy> listEnemy;
221        ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin();
222        Vector3 enemyPosition;
223
224        while (itEnemy != listEnemy.end())
225        {
226            enemyPosition = itEnemy->getPosition();
227            if (enemyPosition.z < totalScreenShift_ - center_->getFieldDimension().y || itEnemy->dead_ == true)
228            {
229                ObjectList<JumpEnemy>::iterator temp = itEnemy;
230                ++ itEnemy;
231                center_->detach(*temp);
232                temp->destroy();
233            }
234            else
235            {
236                ++ itEnemy;
237            }
238        }
239
240        ObjectList<JumpItem> listItem;
241        ObjectList<JumpItem>::iterator itItem = listItem.begin();
242        Vector3 itemPosition;
243
244        while (itItem != listItem.end())
245        {
246            itemPosition = itItem->getPosition();
247
248            WorldEntity* parent = itItem->getParent();
249
250            if (itItem->attachedToFigure_ == false && itemPosition.z < totalScreenShift_ - center_->getFieldDimension().y && parent == center_)
251            {
252                ObjectList<JumpItem>::iterator temp = itItem;
253                ++ itItem;
254                center_->detach(*temp);
255                temp->destroy();
256            }
257            else
258            {
259                ++ itItem;
260            }
261        }
262    }
263
264    void Jump::cleanup()
265    {
266        camera = nullptr;
267    }
268
269    void Jump::start()
270    {
271        if (center_ != nullptr) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
272        {
273            if (figure_ == nullptr)
274            {
275                figure_ = new JumpFigure(center_->getContext());
276                figure_->addTemplate(center_->getFigureTemplate());
277                figure_->InitializeAnimation(center_->getContext());
278            }
279
280            center_->attach(figure_);
281            figure_->setPosition(0, 0, 0);
282            figure_->setFieldDimension(center_->getFieldDimension());
283        }
284        else // If no centerpoint was specified, an error is thrown and the level is exited.
285        {
286            orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
287            GSLevel::startMainMenu();
288            return;
289        }
290
291        // Call start for the parent class.
292        Deathmatch::start();
293
294        if (figure_ != nullptr)
295        {
296            camera = figure_->getCamera();
297        }
298
299        totalScreenShift_ = 0.0;
300        screenShiftSinceLastUpdate_ = 0.0;
301        sectionNumber_ = 0;
302        adventureNumber_ = 0;
303
304        addStartSection();
305        addSection();
306        addSection();
307    }
308
309    void Jump::end()
310    {
311        cleanup();
312        GSLevel::startMainMenu();
313
314        Deathmatch::end();
315    }
316
317    void Jump::spawnPlayer(PlayerInfo* player)
318    {
319        assert(player);
320
321        if (figure_->getPlayer() == nullptr)
322        {
323            player->startControl(figure_);
324            players_[player].state_ = PlayerState::Alive;
325        }
326    }
327
328    PlayerInfo* Jump::getPlayer() const
329    {
330        if (this->figure_ != nullptr)
331        {
332            return this->figure_->getPlayer();
333        }
334        else
335        {
336            return nullptr;
337        }
338    }
339
340    void Jump::addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition)
341    {
342        if (newPlatform != nullptr && center_ != nullptr)
343        {
344            newPlatform->addTemplate(platformTemplate);
345            newPlatform->setPosition(Vector3(xPosition, 0.0, zPosition));
346            newPlatform->setFigure(this->figure_);
347            center_->attach(newPlatform);
348        }
349    }
350
351    JumpPlatformStatic* Jump::addPlatformStatic(float xPosition, float zPosition)
352    {
353        JumpPlatformStatic* newPlatform = new JumpPlatformStatic(center_->getContext());
354        addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, zPosition);
355
356        return newPlatform;
357    }
358
359    JumpPlatformHMove* Jump::addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed)
360    {
361        JumpPlatformHMove* newPlatform = new JumpPlatformHMove(center_->getContext());
362        newPlatform->setProperties(leftBoundary, rightBoundary, speed);
363        addPlatform(newPlatform, center_->getPlatformHMoveTemplate(), xPosition, zPosition);
364
365        return newPlatform;
366    }
367
368    JumpPlatformVMove* Jump::addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed)
369    {
370        JumpPlatformVMove* newPlatform = new JumpPlatformVMove(center_->getContext());
371        newPlatform->setProperties(lowerBoundary, upperBoundary, speed);
372        addPlatform(newPlatform, center_->getPlatformVMoveTemplate(), xPosition, zPosition);
373
374        return newPlatform;
375    }
376
377    JumpPlatformDisappear* Jump::addPlatformDisappear(float xPosition, float zPosition)
378    {
379        JumpPlatformDisappear* newPlatform = new JumpPlatformDisappear(center_->getContext());
380        newPlatform->setProperties(true);
381        addPlatform(newPlatform, center_->getPlatformDisappearTemplate(), xPosition, zPosition);
382
383        return newPlatform;
384    }
385
386    JumpPlatformTimer* Jump::addPlatformTimer(float xPosition, float zPosition, float time, float variance)
387    {
388        float additionalTime = (float)(rand()%100)/100.0f*variance - variance/2.0f;
389
390        JumpPlatformTimer* newPlatform = new JumpPlatformTimer(center_->getContext());
391        newPlatform->setProperties(time + additionalTime);
392        addPlatform(newPlatform, center_->getPlatformTimerTemplate(), xPosition, zPosition);
393
394        return newPlatform;
395    }
396
397    JumpPlatformFake* Jump::addPlatformFake(float xPosition, float zPosition)
398    {
399        JumpPlatformFake* newPlatform = new JumpPlatformFake(center_->getContext());
400        addPlatform(newPlatform, center_->getPlatformFakeTemplate(), xPosition, zPosition);
401        newPlatform->setAngularVelocity(Vector3(0, 0, 2.0));
402
403        return newPlatform;
404    }
405
406
407    void Jump::addProjectile(float xPosition, float zPosition)
408    {
409        JumpProjectile* newProjectile = new JumpProjectile(center_->getContext());
410        if (newProjectile != nullptr && center_ != nullptr)
411        {
412            newProjectile->addTemplate(center_->getProjectileTemplate());
413            newProjectile->setPosition(Vector3(xPosition, 0.0, zPosition));
414            newProjectile->setFieldDimension(center_->getFieldDimension());
415            newProjectile->setFigure(this->figure_);
416            center_->attach(newProjectile);
417        }
418    }
419
420    void Jump::addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
421    {
422        JumpSpring* newSpring = new JumpSpring(center_->getContext());
423        if (newSpring != nullptr && center_ != nullptr)
424        {
425            newSpring->addTemplate(center_->getSpringTemplate());
426            newSpring->setPosition(Vector3(xPosition, 0.0, zPosition));
427            newSpring->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
428            newSpring->setFigure(figure_);
429            center_->attach(newSpring);
430        }
431    }
432
433    void Jump::addSpring(JumpPlatform* platform)
434    {
435        JumpSpring* newSpring = new JumpSpring(center_->getContext());
436        if (newSpring != nullptr && center_ != nullptr)
437        {
438            newSpring->addTemplate(center_->getSpringTemplate());
439            newSpring->setPosition(Vector3(0.0, 0.0, 0.0));
440            newSpring->setProperties(-10.0, 10.0, -10.0, 10.0, 0.0, 0.0);
441            newSpring->setFigure(figure_);
442            platform->attach(newSpring);
443        }
444    }
445
446    void Jump::addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
447    {
448        JumpRocket* newRocket = new JumpRocket(center_->getContext());
449        if (newRocket != nullptr && center_ != nullptr)
450        {
451            newRocket->addTemplate(center_->getRocketTemplate());
452            newRocket->setPosition(Vector3(xPosition, 0.0, zPosition));
453            newRocket->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
454            newRocket->setFigure(figure_);
455            center_->attach(newRocket);
456        }
457    }
458
459    void Jump::addRocket(JumpPlatform* platform)
460    {
461        JumpRocket* newRocket = new JumpRocket(center_->getContext());
462        if (newRocket != nullptr && center_ != nullptr)
463        {
464            newRocket->addTemplate(center_->getRocketTemplate());
465            newRocket->setPosition(Vector3(0.0, 0.0, 0.0));
466            newRocket->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
467            newRocket->setFigure(figure_);
468            platform->attach(newRocket);
469        }
470    }
471
472    void Jump::addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
473    {
474        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
475        if (newPropeller != nullptr && center_ != nullptr)
476        {
477            newPropeller->addTemplate(center_->getPropellerTemplate());
478            newPropeller->setPosition(Vector3(xPosition, 0.0, zPosition));
479            newPropeller->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
480            newPropeller->setFigure(figure_);
481            center_->attach(newPropeller);
482        }
483    }
484
485    void Jump::addPropeller(JumpPlatform* platform)
486    {
487        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
488        if (newPropeller != nullptr && center_ != nullptr)
489        {
490            newPropeller->addTemplate(center_->getPropellerTemplate());
491            newPropeller->setPosition(Vector3(0.0, 0.0, 0.0));
492            newPropeller->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
493            newPropeller->setFigure(figure_);
494            platform->attach(newPropeller);
495        }
496    }
497
498    void Jump::addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
499    {
500        JumpBoots* newBoots = new JumpBoots(center_->getContext());
501        if (newBoots != nullptr && center_ != nullptr)
502        {
503            newBoots->addTemplate(center_->getBootsTemplate());
504            newBoots->setPosition(Vector3(xPosition, 0.0, zPosition));
505            newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
506            newBoots->setFigure(figure_);
507            center_->attach(newBoots);
508        }
509    }
510
511    void Jump::addBoots(JumpPlatform* platform)
512    {
513        JumpBoots* newBoots = new JumpBoots(center_->getContext());
514        if (newBoots != nullptr && center_ != nullptr)
515        {
516            newBoots->addTemplate(center_->getBootsTemplate());
517            newBoots->setPosition(Vector3(0.0, 0.0, 0.0));
518            newBoots->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
519            newBoots->setFigure(figure_);
520            platform->attach(newBoots);
521        }
522    }
523
524    void Jump::addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
525    {
526        JumpShield* newShield = new JumpShield(center_->getContext());
527        if (newShield != nullptr && center_ != nullptr)
528        {
529            newShield->addTemplate(center_->getShieldTemplate());
530            newShield->setPosition(Vector3(xPosition, 0.0, zPosition));
531            newShield->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
532            newShield->setFigure(figure_);
533            center_->attach(newShield);
534        }
535    }
536
537    void Jump::addShield(JumpPlatform* platform)
538    {
539        JumpShield* newShield = new JumpShield(center_->getContext());
540        if (newShield != nullptr && center_ != nullptr)
541        {
542            newShield->addTemplate(center_->getShieldTemplate());
543            newShield->setPosition(Vector3(0.0, 0.0, 0.0));
544            newShield->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
545            newShield->setFigure(figure_);
546            platform->attach(newShield);
547        }
548    }
549
550    void Jump::addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
551    {
552        JumpEnemy* newEnemy = new JumpEnemy(center_->getContext());
553        if (newEnemy != nullptr && center_ != nullptr)
554        {
555            switch (type)
556            {
557            case 1:
558                newEnemy->addTemplate(center_->getEnemy1Template());
559                break;
560            case 2:
561                newEnemy->addTemplate(center_->getEnemy2Template());
562                break;
563            case 3:
564                newEnemy->addTemplate(center_->getEnemy3Template());
565                break;
566            case 4:
567                newEnemy->addTemplate(center_->getEnemy4Template());
568                break;
569            default:
570                return;
571            }
572
573            newEnemy->setPosition(Vector3(xPosition, 0.0, zPosition));
574            newEnemy->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
575            newEnemy->setFieldDimension(center_->getFieldDimension());
576            newEnemy->setFigure(this->figure_);
577            center_->attach(newEnemy);
578        }
579    }
580
581    void Jump::addStartSection()
582    {
583        JumpPlatform* newPlatform;
584
585        float sectionLength = center_->getSectionLength();
586
587        newPlatform = new JumpPlatformStatic(center_->getContext());
588        addPlatform(newPlatform, center_->getPlatformStaticTemplate(), 0.0, -0.05f*sectionLength);
589
590        platformWidth_ = newPlatform->getWidth();
591        platformHeight_ = newPlatform->getHeight();
592
593        for (float xPosition = platformWidth_; xPosition <= center_->getFieldDimension().x; xPosition += platformWidth_)
594        {
595            newPlatform = new JumpPlatformStatic(center_->getContext());
596            addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, -0.05f*sectionLength);
597            newPlatform = new JumpPlatformStatic(center_->getContext());
598            addPlatform(newPlatform, center_->getPlatformStaticTemplate(), -xPosition, -0.05f*sectionLength);
599        }
600    }
601
602    void Jump::addSection()
603    {
604        float fieldWidth = center_->getFieldDimension().x;
605        float sectionLength = center_->getSectionLength();
606        float sectionBegin = sectionNumber_ * sectionLength;
607        float sectionEnd = (1 + sectionNumber_) * sectionLength;
608
609        const int numI = 6;
610        const int numJ = 4;
611
612        enum PlatformType
613        {
614            PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE
615        };
616
617        enum ItemType
618        {
619            ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
620        };
621
622        struct PlatformMatrix
623        {
624            PlatformType type;
625            bool done;
626        } matrix[numI][numJ];
627
628
629        for (int i = 0; i < numI; ++i)
630        {
631            for (int j = 0; j < numJ; ++j)
632            {
633                matrix[i][j].type = PLATFORM_EMPTY;
634                matrix[i][j].done = false;
635            }
636        }
637        PlatformType platformtype1;
638        PlatformType platformtype2;
639        ItemType itemType = ITEM_NOTHING;
640
641        if (rand()%2 == 0)
642        {
643            itemType = ITEM_SPRING;
644        }
645        else if (rand()%2 == 0 && sectionNumber_ > 3)
646        {
647            switch(rand()%4)
648            {
649            case 0:
650                itemType = ITEM_PROPELLER;
651                break;
652            case 1:
653                itemType = ITEM_ROCKET;
654                break;
655            case 2:
656                itemType = ITEM_BOOTS;
657                break;
658            case 3:
659                itemType = ITEM_SHIELD;
660                break;
661            default:
662                break;
663            }
664        }
665
666        switch((sectionNumber_ > 28) ? rand()%29 : rand()%(sectionNumber_+1))
667        {
668        case 0:
669            platformtype1 = PLATFORM_STATIC;
670            platformtype2 = PLATFORM_STATIC;
671            break;
672        case 1:
673            platformtype1 = PLATFORM_STATIC;
674            platformtype2 = PLATFORM_STATIC;
675            break;
676        case 2:
677            platformtype1 = PLATFORM_STATIC;
678            platformtype2 = PLATFORM_HMOVE;
679            break;
680        case 3:
681            platformtype1 = PLATFORM_STATIC;
682            platformtype2 = PLATFORM_DISAPPEAR;
683            break;
684        case 4:
685            platformtype1 = PLATFORM_STATIC;
686            platformtype2 = PLATFORM_VMOVE;
687            break;
688        case 5:
689            platformtype1 = PLATFORM_STATIC;
690            platformtype2 = PLATFORM_TIMER;
691            break;
692        case 6:
693            platformtype1 = PLATFORM_HMOVE;
694            platformtype2 = PLATFORM_STATIC;
695            break;
696        case 7:
697            platformtype1 = PLATFORM_HMOVE;
698            platformtype2 = PLATFORM_HMOVE;
699            break;
700        case 8:
701            platformtype1 = PLATFORM_HMOVE;
702            platformtype2 = PLATFORM_HMOVE;
703            break;
704        case 9:
705            platformtype1 = PLATFORM_HMOVE;
706            platformtype2 = PLATFORM_DISAPPEAR;
707            break;
708        case 10:
709            platformtype1 = PLATFORM_HMOVE;
710            platformtype2 = PLATFORM_VMOVE;
711            break;
712        case 11:
713            platformtype1 = PLATFORM_HMOVE;
714            platformtype2 = PLATFORM_TIMER;
715            break;
716        case 12:
717            platformtype1 = PLATFORM_DISAPPEAR;
718            platformtype2 = PLATFORM_STATIC;
719            break;
720        case 13:
721            platformtype1 = PLATFORM_DISAPPEAR;
722            platformtype2 = PLATFORM_HMOVE;
723            break;
724        case 14:
725            platformtype1 = PLATFORM_DISAPPEAR;
726            platformtype2 = PLATFORM_DISAPPEAR;
727            break;
728        case 15:
729            platformtype1 = PLATFORM_DISAPPEAR;
730            platformtype2 = PLATFORM_DISAPPEAR;
731            break;
732        case 16:
733            platformtype1 = PLATFORM_DISAPPEAR;
734            platformtype2 = PLATFORM_VMOVE;
735            break;
736        case 17:
737            platformtype1 = PLATFORM_DISAPPEAR;
738            platformtype2 = PLATFORM_TIMER;
739            break;
740        case 18:
741            platformtype1 = PLATFORM_VMOVE;
742            platformtype2 = PLATFORM_STATIC;
743            break;
744        case 19:
745            platformtype1 = PLATFORM_VMOVE;
746            platformtype2 = PLATFORM_HMOVE;
747            break;
748        case 20:
749            platformtype1 = PLATFORM_VMOVE;
750            platformtype2 = PLATFORM_DISAPPEAR;
751            break;
752        case 21:
753            platformtype1 = PLATFORM_VMOVE;
754            platformtype2 = PLATFORM_VMOVE;
755            break;
756        case 22:
757            platformtype1 = PLATFORM_VMOVE;
758            platformtype2 = PLATFORM_VMOVE;
759            break;
760        case 23:
761            platformtype1 = PLATFORM_VMOVE;
762            platformtype2 = PLATFORM_TIMER;
763            break;
764        case 24:
765            platformtype1 = PLATFORM_TIMER;
766            platformtype2 = PLATFORM_STATIC;
767            break;
768        case 25:
769            platformtype1 = PLATFORM_TIMER;
770            platformtype2 = PLATFORM_HMOVE;
771            break;
772        case 26:
773            platformtype1 = PLATFORM_TIMER;
774            platformtype2 = PLATFORM_DISAPPEAR;
775            break;
776        case 27:
777            platformtype1 = PLATFORM_TIMER;
778            platformtype2 = PLATFORM_VMOVE;
779            break;
780        case 28:
781            platformtype1 = PLATFORM_TIMER;
782            platformtype2 = PLATFORM_TIMER;
783            break;
784        default:
785            platformtype1 = PLATFORM_TIMER;
786            platformtype2 = PLATFORM_TIMER;
787            break;
788        }
789
790        // Fill matrix with selected platform types
791        for (int i = 0; i < numI; ++ i)
792        {
793            for (int j = 0; j < numJ; ++ j)
794            {
795                if (rand()%3 == 0)
796                {
797                    matrix[i][j].type = platformtype1;
798                }
799                else
800                {
801                    matrix[i][j].type = platformtype2;
802                }
803                matrix[i][j].done = false;
804            }
805        }
806
807        if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0)
808        {
809            matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
810            matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
811        }
812
813        // Delete some planned platforms or replace them with fake platforms
814        if (sectionNumber_ > 5)
815        {
816            if (rand()%2 == 0)
817            {
818                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
819            }
820            else
821            {
822                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
823            }
824        }
825        else if (sectionNumber_ > 10)
826        {
827            if (rand()%2 == 0)
828            {
829                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
830            }
831            else
832            {
833                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
834            }
835            if (rand()%2 == 0)
836            {
837                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
838            }
839            else
840            {
841                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
842            }
843        }
844        else if (sectionNumber_ > 15)
845        {
846            if (rand()%2 == 0)
847            {
848                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
849            }
850            else
851            {
852                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
853            }
854            if (rand()%2 == 0)
855            {
856                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
857            }
858            else
859            {
860                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
861            }
862            if (rand()%2 == 0)
863            {
864                matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
865            }
866            else
867            {
868                matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
869            }
870        }
871
872        std::vector<JumpPlatform*> platformList;
873
874        for (int i = 0; i < numI; ++ i)
875        {
876            for (int j = 0; j < numJ; ++ j)
877            {
878                if (matrix[i][j].done == false)
879                {
880                    float xPosition = 0.0;
881                    float zPosition = 0.0;
882                    float leftBoundary = 0.0;
883                    float rightBoundary = 0.0;
884                    float lowerBoundary = 0.0;
885                    float upperBoundary = 0.0;
886                    float xVelocity = 0.0;
887                    float zVelocity = 0.0;
888
889                    switch(matrix[i][j].type)
890                    {
891                    case PLATFORM_EMPTY:
892                        matrix[i][j].done = true;
893                        break;
894                    case PLATFORM_STATIC:
895                        xPosition = randomXPosition(numJ, j);
896                        zPosition = sectionBegin + i*sectionLength/numI;
897                        platformList.push_back(addPlatformStatic(xPosition, zPosition));
898                        matrix[i][j].done = true;
899                        break;
900                    case PLATFORM_FAKE:
901                        xPosition = randomXPosition(numJ, j);
902                        zPosition = sectionBegin + i*sectionLength/numI;
903                        platformList.push_back(addPlatformFake(xPosition, zPosition));
904                        matrix[i][j].done = true;
905                        break;
906                    case PLATFORM_TIMER:
907                        xPosition = randomXPosition(numJ, j);
908                        zPosition = sectionBegin + i*sectionLength/numI;
909                        platformList.push_back(addPlatformTimer(xPosition, zPosition, 12.0, 1.5));
910                        matrix[i][j].done = true;
911                        break;
912                    case PLATFORM_DISAPPEAR:
913                        xPosition = randomXPosition(numJ, j);
914                        zPosition = sectionBegin + i*sectionLength/numI;
915                        platformList.push_back(addPlatformDisappear(xPosition, zPosition));
916                        matrix[i][j].done = true;
917                        break;
918                    case PLATFORM_HMOVE:
919                        xVelocity = randomSpeed();
920                        if (j <= numJ-3 && matrix[i][j+1].type == PLATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)
921                        {
922                            leftBoundary = randomXPositionLeft(numJ, j);
923                            rightBoundary = randomXPositionRight(numJ, j+2);
924                            xPosition = randomPosition(leftBoundary, rightBoundary);
925                            zPosition = sectionBegin + i*sectionLength/numI;
926                            platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
927                            matrix[i][j].done = true;
928                            matrix[i][j+1].done = true;
929                            matrix[i][j+2].done = true;
930                        }
931                        else if (j <= numJ-2 && matrix[i][j+1].type == PLATFORM_HMOVE && rand()%2 == 0)
932                        {
933                            leftBoundary = randomXPositionLeft(numJ, j);
934                            rightBoundary = randomXPositionRight(numJ, j+1);
935                            xPosition = randomPosition(leftBoundary, rightBoundary);
936                            zPosition = sectionBegin + i*sectionLength/numI;
937                            platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
938                            matrix[i][j].done = true;
939                            matrix[i][j+1].done = true;
940                        }
941                        else
942                        {
943                            leftBoundary = randomXPositionLeft(numJ, j);
944                            rightBoundary = randomXPositionRight(numJ, j);
945                            xPosition = randomPosition(leftBoundary, rightBoundary);
946                            zPosition = sectionBegin + i*sectionLength/numI;
947                            platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
948                            matrix[i][j].done = true;
949                        }
950                        break;
951                    case PLATFORM_VMOVE:
952                        zVelocity = randomSpeed();
953                        if (i <= numI-3 && matrix[i+1][j].type == PLATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)
954                        {
955                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
956                            upperBoundary = randomZPositionUpper(numI, i+2, sectionBegin, sectionEnd);
957                            zPosition = randomPosition(lowerBoundary, upperBoundary);
958                            xPosition = randomXPosition(numJ, j);
959                            platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
960                            matrix[i][j].done = true;
961                            matrix[i+1][j].done = true;
962                            matrix[i+2][j].done = true;
963                        }
964                        else if (i <= numI-2 && matrix[i+1][j].type == PLATFORM_VMOVE && rand()%2 == 0)
965                        {
966                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
967                            upperBoundary = randomZPositionUpper(numI, i+1, sectionBegin, sectionEnd);
968                            zPosition = randomPosition(lowerBoundary, upperBoundary);
969                            xPosition = randomXPosition(numJ, j);
970                            platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
971                            matrix[i][j].done = true;
972                            matrix[i+1][j].done = true;
973                        }
974                        else
975                        {
976                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
977                            upperBoundary = randomZPositionUpper(numI, i, sectionBegin, sectionEnd);
978                            zPosition = randomPosition(lowerBoundary, upperBoundary);
979                            xPosition = randomXPosition(numJ, j);
980                            platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
981                            matrix[i][j].done = true;
982                        }
983                        break;
984                    default:
985                        //ERROR
986                        break;
987
988                    }
989                }
990            }
991        }
992
993        //Add items
994        int numNewPlatforms = platformList.size();
995
996        if (rand()%4 == 0)
997        {
998            if (rand()%2 == 0)
999            {
1000                switch (itemType)
1001                {
1002                case ITEM_ROCKET:
1003                    addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
1004                    break;
1005                case ITEM_PROPELLER:
1006                    addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
1007                    break;
1008                case ITEM_BOOTS:
1009                    addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
1010                    break;
1011                case ITEM_SHIELD:
1012                    addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
1013                    break;
1014                default:
1015                    break;
1016                }
1017            }
1018            else
1019            {
1020                switch (itemType)
1021                {
1022                case ITEM_ROCKET:
1023                    addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
1024                    break;
1025                case ITEM_PROPELLER:
1026                    addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
1027                    break;
1028                case ITEM_BOOTS:
1029                    addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
1030                    break;
1031                case ITEM_SHIELD:
1032                    addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
1033                    break;
1034                default:
1035                    break;
1036                }
1037            }
1038        }
1039        else
1040        {
1041            if (numNewPlatforms > 0)
1042            {
1043                JumpPlatform* itemPlatform = platformList[rand()%numNewPlatforms];
1044
1045                switch (itemType)
1046                {
1047                case ITEM_SPRING:
1048                    addSpring(itemPlatform);
1049                    break;
1050                case ITEM_ROCKET:
1051                    addRocket(itemPlatform);
1052                    break;
1053                case ITEM_PROPELLER:
1054                    addPropeller(itemPlatform);
1055                    break;
1056                case ITEM_BOOTS:
1057                    addBoots(itemPlatform);
1058                    break;
1059                case ITEM_SHIELD:
1060                    addShield(itemPlatform);
1061                    break;
1062                default:
1063                    break;
1064                }
1065            }
1066        }
1067
1068        if (sectionNumber_ >= 5 && rand()%3 == 0)
1069        {
1070            switch(rand()%4)
1071            {
1072            case 0:
1073                addEnemy(1, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
1074                break;
1075            case 1:
1076                addEnemy(2, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
1077                break;
1078            case 2:
1079                addEnemy(3, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
1080                break;
1081            case 3:
1082                addEnemy(4, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
1083                break;
1084            }
1085        }
1086        ++ sectionNumber_;
1087    }
1088
1089    bool Jump::addAdventure(int number)
1090    {
1091        float fieldWidth = center_->getFieldDimension().x;
1092        float sectionLength = center_->getSectionLength();
1093        float sectionBegin = sectionNumber_ * sectionLength;
1094        sectionLength *= 2;
1095
1096        switch(number)
1097        {
1098        case 0:
1099        {
1100            int numI = 10;
1101            if (rand()%2 == 0)
1102            {
1103                for (int i = 0; i < numI; ++ i)
1104                {
1105                    addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+i*sectionLength/numI);
1106                }
1107            }
1108            else
1109            {
1110                for (int i = 0; i < numI; ++ i)
1111                {
1112                    addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+(numI-i)*sectionLength/numI);
1113                }
1114            }
1115            break;
1116        }
1117        case 1:
1118        {
1119            int numI = 7;
1120
1121            addPlatformStatic(0.0, sectionBegin);
1122            if (rand()%2 == 0)
1123            {
1124                for (int i = 1; i < numI; ++ i)
1125                {
1126                    addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
1127                    addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
1128                }
1129            }
1130            else
1131            {
1132                for (int i = 1; i < numI; ++ i)
1133                {
1134                    addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI);
1135                    addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI);
1136                }
1137            }
1138            break;
1139        }
1140        case 2:
1141        {
1142            int numI = 5;
1143            for (int i = 0; i <= numI; ++ i)
1144            {
1145                addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin);
1146                addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength/5);
1147                addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*2/5);
1148                addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*3/5);
1149                addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*4/5);
1150                addEnemy(4, (2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength/2, -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 0.0, 0.0);
1151            }
1152            break;
1153        }
1154        case 3:
1155        {
1156            addRocket(addPlatformStatic(0.0, sectionBegin));
1157            addEnemy(2, 0.0, sectionBegin+sectionLength/5, 0.0,0.0, 0.0, 0.0, 0.0, 0.0);
1158            break;
1159        }
1160        case 4:
1161        {
1162            addPropeller(addPlatformStatic(0.0, sectionBegin));
1163            addPropeller(addPlatformStatic(-fieldWidth/2, sectionBegin));
1164            addPropeller(addPlatformStatic(fieldWidth/2, sectionBegin));
1165            break;
1166        }
1167        default:
1168            return false;
1169        }
1170        sectionNumber_ +=2;
1171        return true;
1172    }
1173
1174    float Jump::randomXPosition()
1175    {
1176        float fieldWidth = center_->getFieldDimension().x;
1177
1178        return (float)(rand()%(2*(int)fieldWidth)) - fieldWidth;
1179    }
1180
1181    float Jump::randomXPosition(int totalColumns, int culomn)
1182    {
1183        float fieldWidth = center_->getFieldDimension().x;
1184
1185        float halfWidth = fieldWidth/totalColumns;
1186        float leftBound = culomn*halfWidth*2-fieldWidth;
1187        float rightBound = leftBound + 2*halfWidth;
1188
1189        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
1190    }
1191
1192    float Jump::randomXPositionLeft(int totalColumns, int culomn)
1193    {
1194        float fieldWidth = center_->getFieldDimension().x;
1195
1196        float halfWidth = fieldWidth/totalColumns;
1197        float leftBound = culomn*halfWidth*2-fieldWidth;
1198        float rightBound = leftBound + 2*halfWidth/3;
1199
1200        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
1201    }
1202
1203    float Jump::randomXPositionRight(int totalColumns, int culomn)
1204    {
1205        float fieldWidth = center_->getFieldDimension().x;
1206
1207        float halfWidth = fieldWidth/totalColumns;
1208        float rightBound = (culomn+1)*halfWidth*2-fieldWidth;
1209        float leftBound = rightBound - 2*halfWidth/3;
1210        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
1211    }
1212
1213    float Jump::randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd)
1214    {
1215        float fieldHeight = SectionEnd - sectionBegin;
1216        float halfHeight = fieldHeight/totalRows;
1217        float lowerBound = row*halfHeight*2+sectionBegin;
1218        float upperBound = lowerBound + 2*halfHeight;
1219
1220        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
1221    }
1222
1223    float Jump::randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd)
1224    {
1225        float fieldHeight = SectionEnd - sectionBegin;
1226        float rowHeight = fieldHeight/totalRows;
1227        float lowerBound = row*rowHeight+sectionBegin;
1228        float upperBound = lowerBound + rowHeight/3;
1229
1230        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
1231    }
1232
1233    float Jump::randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd)
1234    {
1235        float fieldHeight = SectionEnd - sectionBegin;
1236        float rowHeight = fieldHeight/totalRows;
1237        float lowerBound = (row+1)*rowHeight+sectionBegin;
1238        float upperBound = lowerBound - rowHeight/3;
1239
1240        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
1241    }
1242
1243    float Jump::randomPosition(float lowerBoundary, float upperBoundary)
1244    {
1245        if (lowerBoundary >= upperBoundary)
1246        {
1247            return (lowerBoundary + upperBoundary)/2;
1248        }
1249
1250        return (float)(rand()%(int)(100*(upperBoundary - lowerBoundary)))/100 + lowerBoundary;
1251    }
1252
1253    float Jump::randomSpeed()
1254    {
1255        float platformSpeed = center_->getPlatformSpeed();
1256        return randomPosition(0.5f*platformSpeed, 1.5f*platformSpeed);
1257    }
1258
1259    int Jump::getScore(PlayerInfo* player) const
1260    {
1261        return sectionNumber_ - 2;
1262    }
1263
1264    float Jump::getFuel() const
1265    {
1266        if (this->figure_ != nullptr)
1267        {
1268            if (this->figure_->rocketActive_ != nullptr)
1269            {
1270                return this->figure_->rocketActive_->getFuelState();
1271            }
1272            else if (this->figure_->propellerActive_ != nullptr)
1273            {
1274                return this->figure_->propellerActive_->getFuelState();
1275            }
1276            else if (this->figure_->shieldActive_ != nullptr)
1277            {
1278                return this->figure_->shieldActive_->getFuelState();
1279            }
1280            else if (this->figure_->bootsActive_ != nullptr)
1281            {
1282                return this->figure_->bootsActive_->getFuelState();
1283            }
1284        }
1285
1286        return 0.0;
1287    }
1288
1289    bool Jump::getDead(PlayerInfo* player) const
1290    {
1291        return figure_->dead_;
1292    }
1293
1294    void Jump::setCenterpoint(JumpCenterpoint* center)
1295    {
1296        center_ = center;
1297    }
1298
1299}
Note: See TracBrowser for help on using the repository browser.