[5596] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Manuel Leuenberger |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #include "ground_turret.h" |
---|
[5739] | 17 | #include "factory.h" |
---|
| 18 | #include "model.h" |
---|
[5596] | 19 | |
---|
[5739] | 20 | CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); |
---|
| 21 | |
---|
[5596] | 22 | using namespace std; |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * constructs and loads a GroundTurret from a XML-element |
---|
| 27 | * @param root the XML-element to load from |
---|
| 28 | */ |
---|
| 29 | GroundTurret::GroundTurret(const TiXmlElement* root) |
---|
| 30 | { |
---|
| 31 | this->init(); |
---|
| 32 | if (root != NULL) |
---|
| 33 | this->loadParams(root); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * standard deconstructor |
---|
| 39 | */ |
---|
| 40 | GroundTurret::~GroundTurret () |
---|
| 41 | { |
---|
| 42 | |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | /** |
---|
| 47 | * initializes the GroundTurret |
---|
| 48 | * @todo change this to what you wish |
---|
| 49 | */ |
---|
| 50 | void GroundTurret::init() |
---|
| 51 | { |
---|
[5679] | 52 | this->setClassID(CL_GROUND_TURRET, "GroundTurret"); |
---|
[5739] | 53 | this->loadModel("models/ground_turret.obj", 5); |
---|
[5596] | 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * loads a GroundTurret from a XML-element |
---|
| 60 | * @param root the XML-element to load from |
---|
| 61 | * @todo make the class Loadable |
---|
| 62 | */ |
---|
| 63 | void GroundTurret::loadParams(const TiXmlElement* root) |
---|
| 64 | { |
---|
| 65 | // all the clases this Entity is directly derived from must be called in this way, to load all settings. |
---|
[5739] | 66 | static_cast<NPC*>(this)->loadParams(root); |
---|
[5596] | 67 | |
---|
| 68 | |
---|
| 69 | /** |
---|
| 70 | * @todo: make the class Loadable |
---|
| 71 | */ |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * advances the GroundTurret about time seconds |
---|
| 77 | * @param time the Time to step |
---|
| 78 | */ |
---|
[5739] | 79 | void GroundTurret::tick(float time) |
---|
| 80 | { |
---|
[5596] | 81 | |
---|
[5739] | 82 | } |
---|
| 83 | |
---|
[5596] | 84 | /** |
---|
| 85 | * draws this worldEntity |
---|
| 86 | */ |
---|
| 87 | void GroundTurret::draw () const |
---|
| 88 | { |
---|
| 89 | glMatrixMode(GL_MODELVIEW); |
---|
| 90 | glPushMatrix(); |
---|
| 91 | float matrix[4][4]; |
---|
| 92 | |
---|
| 93 | /* translate */ |
---|
| 94 | glTranslatef (this->getAbsCoor ().x, |
---|
| 95 | this->getAbsCoor ().y, |
---|
| 96 | this->getAbsCoor ().z); |
---|
| 97 | /* rotate */ |
---|
| 98 | this->getAbsDir().matrix(matrix); |
---|
| 99 | glMultMatrixf((float*)matrix); |
---|
| 100 | |
---|
[5739] | 101 | if (model) |
---|
| 102 | model->draw(); |
---|
[5596] | 103 | glPopMatrix(); |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | /** |
---|
| 108 | * |
---|
| 109 | * |
---|
| 110 | */ |
---|
| 111 | void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location) |
---|
| 112 | { |
---|
| 113 | |
---|
| 114 | } |
---|
[5680] | 115 | |
---|
| 116 | /** |
---|
| 117 | * |
---|
| 118 | * |
---|
| 119 | */ |
---|
| 120 | void GroundTurret::postSpawn () |
---|
| 121 | { |
---|
| 122 | |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | /** |
---|
| 126 | * |
---|
| 127 | * |
---|
| 128 | */ |
---|
| 129 | void GroundTurret::leftWorld () |
---|
| 130 | { |
---|
| 131 | |
---|
| 132 | } |
---|