[10658] | 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 | * Florian Zinggeler |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | @file Hover.cc |
---|
| 31 | @brief Implementation of the Hover class. |
---|
| 32 | */ |
---|
| 33 | |
---|
[10660] | 34 | //#include "orxonox/worldentities/pawns/SpaceShip.h" |
---|
[10658] | 35 | #include "Hover.h" |
---|
[10708] | 36 | |
---|
| 37 | #include "HoverWall.h" |
---|
[10658] | 38 | #include "core/CoreIncludes.h" |
---|
| 39 | |
---|
| 40 | namespace orxonox |
---|
| 41 | { |
---|
[10751] | 42 | bool firstTick = true; |
---|
[10787] | 43 | int levelcode[10][10] = |
---|
| 44 | { |
---|
| 45 | { 0,0,0,0,0,0,0,0,0,0 }, // row 0 |
---|
| 46 | { 1,0,0,0,0,0,0,0,0,0 }, // row 0 |
---|
| 47 | { 1,0,0,0,0,0,0,0,0,0 }, // row 0 |
---|
| 48 | { 1,1,3,0,1,3,0,0,0,0 }, // row 0 |
---|
| 49 | { 1,0,3,2,3,2,0,0,0,0 }, // row 0 |
---|
| 50 | { 1,0,1,0,1,0,0,0,0,0 }, // row 0 |
---|
| 51 | { 1,2,2,0,0,0,0,0,0,0 }, // row 0 |
---|
| 52 | { 1,0,0,0,0,0,0,0,0,0 }, // row 0 |
---|
| 53 | { 1,0,0,0,0,0,0,0,1,0 },// row 1 |
---|
| 54 | { 1,0,0,0,0,0,0,1,2,0 } // row 2 |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | |
---|
[10658] | 58 | RegisterUnloadableClass(Hover); |
---|
| 59 | |
---|
[10664] | 60 | Hover::Hover(Context* context) : Gametype(context) |
---|
[10658] | 61 | { |
---|
[10708] | 62 | |
---|
[10658] | 63 | RegisterObject(Hover); |
---|
| 64 | //this->setHUDTemplate("HoverHUD"); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | void Hover::tick(float dt) |
---|
| 70 | { |
---|
| 71 | SUPER(Hover, tick, dt); |
---|
[10751] | 72 | |
---|
[10787] | 73 | |
---|
| 74 | |
---|
| 75 | |
---|
[10760] | 76 | if(firstTick) |
---|
| 77 | { |
---|
[10751] | 78 | firstTick = false; |
---|
[10787] | 79 | |
---|
| 80 | for(int y=0; y<10; y++){ |
---|
| 81 | for(int x=0; x<10; x++){ |
---|
| 82 | |
---|
| 83 | switch(levelcode[y][x]){ |
---|
| 84 | case 1: new HoverWall(origin_->getContext(), x+1, 10-y, 1); |
---|
| 85 | break; |
---|
| 86 | case 3: new HoverWall(origin_->getContext(), x+1, 10-y, 1); |
---|
| 87 | case 2: new HoverWall(origin_->getContext(), x+1, 10-y, 0); |
---|
| 88 | default: break; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | //new HoverWall(origin_->getContext(), 1, 1, 1); |
---|
| 99 | //new HoverWall(origin_->getContext(), 1, 1, 0); |
---|
[10751] | 100 | } |
---|
| 101 | |
---|
| 102 | |
---|
[10658] | 103 | } |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | void Hover::start() |
---|
| 108 | { |
---|
| 109 | |
---|
| 110 | // Call start for the parent class. |
---|
[10664] | 111 | Gametype::start(); |
---|
[10708] | 112 | |
---|
[10658] | 113 | } |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | void Hover::end() |
---|
| 117 | { |
---|
| 118 | // DON'T CALL THIS! |
---|
| 119 | // Deathmatch::end(); |
---|
| 120 | // It will misteriously crash the game! |
---|
| 121 | // Instead startMainMenu, this won't crash. |
---|
| 122 | GSLevel::startMainMenu(); |
---|
| 123 | } |
---|
| 124 | } |
---|