[10078] | 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 JumpCenterpoint.cc |
---|
| 31 | @brief The JumpCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the JumpCenterpoint. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #include "JumpCenterpoint.h" |
---|
| 35 | #include "core/CoreIncludes.h" |
---|
| 36 | #include "core/XMLPort.h" |
---|
| 37 | #include "Jump.h" |
---|
| 38 | |
---|
| 39 | namespace orxonox |
---|
| 40 | { |
---|
| 41 | RegisterClass(JumpCenterpoint); |
---|
| 42 | |
---|
| 43 | JumpCenterpoint::JumpCenterpoint(Context* context) : StaticEntity(context) |
---|
| 44 | { |
---|
| 45 | RegisterObject(JumpCenterpoint); |
---|
| 46 | |
---|
| 47 | width_ = 0.0; |
---|
| 48 | height_ = 0.0; |
---|
| 49 | sectionLength_ = 0.0; |
---|
| 50 | platformSpeed_ = 0.0; |
---|
| 51 | |
---|
| 52 | checkGametype(); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | void JumpCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 56 | { |
---|
| 57 | SUPER(JumpCenterpoint, XMLPort, xmlelement, mode); |
---|
| 58 | |
---|
| 59 | XMLPortParam(JumpCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode); |
---|
| 60 | XMLPortParam(JumpCenterpoint, "sectionLength", setSectionLength, getSectionLength, xmlelement, mode); |
---|
| 61 | XMLPortParam(JumpCenterpoint, "platformSpeed", setPlatformSpeed, getPlatformSpeed, xmlelement, mode); |
---|
| 62 | XMLPortParam(JumpCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode); |
---|
| 63 | XMLPortParam(JumpCenterpoint, "platformStaticTemplate", setPlatformStaticTemplate, getPlatformStaticTemplate, xmlelement, mode); |
---|
| 64 | XMLPortParam(JumpCenterpoint, "platformHMoveTemplate", setPlatformHMoveTemplate, getPlatformHMoveTemplate, xmlelement, mode); |
---|
| 65 | XMLPortParam(JumpCenterpoint, "platformVMoveTemplate", setPlatformVMoveTemplate, getPlatformVMoveTemplate, xmlelement, mode); |
---|
| 66 | XMLPortParam(JumpCenterpoint, "platformDisappearTemplate", setPlatformDisappearTemplate, getPlatformDisappearTemplate, xmlelement, mode); |
---|
| 67 | XMLPortParam(JumpCenterpoint, "platformTimerTemplate", setPlatformTimerTemplate, getPlatformTimerTemplate, xmlelement, mode); |
---|
| 68 | XMLPortParam(JumpCenterpoint, "platformFakeTemplate", setPlatformFakeTemplate, getPlatformFakeTemplate, xmlelement, mode); |
---|
| 69 | XMLPortParam(JumpCenterpoint, "figureTemplate", setFigureTemplate, getFigureTemplate, xmlelement, mode); |
---|
| 70 | XMLPortParam(JumpCenterpoint, "projectileTemplate", setProjectileTemplate, getProjectileTemplate, xmlelement, mode); |
---|
| 71 | XMLPortParam(JumpCenterpoint, "springTemplate", setSpringTemplate, getSpringTemplate, xmlelement, mode); |
---|
| 72 | XMLPortParam(JumpCenterpoint, "rocketTemplate", setRocketTemplate, getRocketTemplate, xmlelement, mode); |
---|
| 73 | XMLPortParam(JumpCenterpoint, "propellerTemplate", setPropellerTemplate, getPropellerTemplate, xmlelement, mode); |
---|
| 74 | XMLPortParam(JumpCenterpoint, "bootsTemplate", setBootsTemplate, getBootsTemplate, xmlelement, mode); |
---|
| 75 | XMLPortParam(JumpCenterpoint, "shieldTemplate", setShieldTemplate, getShieldTemplate, xmlelement, mode); |
---|
| 76 | XMLPortParam(JumpCenterpoint, "enemy1Template", setEnemy1Template, getEnemy1Template, xmlelement, mode); |
---|
| 77 | XMLPortParam(JumpCenterpoint, "enemy2Template", setEnemy2Template, getEnemy2Template, xmlelement, mode); |
---|
| 78 | XMLPortParam(JumpCenterpoint, "enemy3Template", setEnemy3Template, getEnemy3Template, xmlelement, mode); |
---|
| 79 | XMLPortParam(JumpCenterpoint, "enemy4Template", setEnemy4Template, getEnemy4Template, xmlelement, mode); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | void JumpCenterpoint::changedGametype() |
---|
| 83 | { |
---|
| 84 | SUPER(JumpCenterpoint, changedGametype); |
---|
| 85 | |
---|
| 86 | checkGametype(); |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | void JumpCenterpoint::checkGametype() |
---|
| 90 | { |
---|
| 91 | if (getGametype() != NULL && this->getGametype()->isA(Class(Jump))) |
---|
| 92 | { |
---|
| 93 | Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype().get()); |
---|
| 94 | jumpGametype->setCenterpoint(this); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | } |
---|