[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" |
---|
[5740] | 19 | #include "turret.h" |
---|
[5596] | 20 | |
---|
[5739] | 21 | CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); |
---|
| 22 | |
---|
[5596] | 23 | using namespace std; |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * constructs and loads a GroundTurret from a XML-element |
---|
| 28 | * @param root the XML-element to load from |
---|
| 29 | */ |
---|
| 30 | GroundTurret::GroundTurret(const TiXmlElement* root) |
---|
| 31 | { |
---|
| 32 | this->init(); |
---|
| 33 | if (root != NULL) |
---|
| 34 | this->loadParams(root); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * standard deconstructor |
---|
| 40 | */ |
---|
| 41 | GroundTurret::~GroundTurret () |
---|
| 42 | { |
---|
| 43 | |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * initializes the GroundTurret |
---|
| 49 | * @todo change this to what you wish |
---|
| 50 | */ |
---|
| 51 | void GroundTurret::init() |
---|
| 52 | { |
---|
[5679] | 53 | this->setClassID(CL_GROUND_TURRET, "GroundTurret"); |
---|
[5739] | 54 | this->loadModel("models/ground_turret.obj", 5); |
---|
[5740] | 55 | left = new Turret(); |
---|
| 56 | left->setParent(this); |
---|
| 57 | left->setRelCoor(0,10,0); |
---|
| 58 | right = new Turret(); |
---|
| 59 | right->setParent(this); |
---|
| 60 | right->setRelCoor(0,10,0); |
---|
[5596] | 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * loads a GroundTurret from a XML-element |
---|
| 66 | * @param root the XML-element to load from |
---|
| 67 | * @todo make the class Loadable |
---|
| 68 | */ |
---|
| 69 | void GroundTurret::loadParams(const TiXmlElement* root) |
---|
| 70 | { |
---|
| 71 | // all the clases this Entity is directly derived from must be called in this way, to load all settings. |
---|
[5739] | 72 | static_cast<NPC*>(this)->loadParams(root); |
---|
[5596] | 73 | |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * @todo: make the class Loadable |
---|
| 77 | */ |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | /** |
---|
| 82 | * advances the GroundTurret about time seconds |
---|
| 83 | * @param time the Time to step |
---|
| 84 | */ |
---|
[5739] | 85 | void GroundTurret::tick(float time) |
---|
| 86 | { |
---|
[5596] | 87 | |
---|
[5739] | 88 | } |
---|
| 89 | |
---|
[5596] | 90 | /** |
---|
| 91 | * draws this worldEntity |
---|
| 92 | */ |
---|
| 93 | void GroundTurret::draw () const |
---|
| 94 | { |
---|
| 95 | glMatrixMode(GL_MODELVIEW); |
---|
| 96 | glPushMatrix(); |
---|
| 97 | float matrix[4][4]; |
---|
| 98 | |
---|
| 99 | /* translate */ |
---|
| 100 | glTranslatef (this->getAbsCoor ().x, |
---|
| 101 | this->getAbsCoor ().y, |
---|
| 102 | this->getAbsCoor ().z); |
---|
| 103 | /* rotate */ |
---|
| 104 | this->getAbsDir().matrix(matrix); |
---|
| 105 | glMultMatrixf((float*)matrix); |
---|
| 106 | |
---|
[5739] | 107 | if (model) |
---|
| 108 | model->draw(); |
---|
[5740] | 109 | //left->draw(); |
---|
| 110 | //right->draw(); |
---|
[5596] | 111 | glPopMatrix(); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * |
---|
| 117 | * |
---|
| 118 | */ |
---|
| 119 | void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location) |
---|
| 120 | { |
---|
| 121 | |
---|
| 122 | } |
---|
[5680] | 123 | |
---|
| 124 | /** |
---|
| 125 | * |
---|
| 126 | * |
---|
| 127 | */ |
---|
| 128 | void GroundTurret::postSpawn () |
---|
| 129 | { |
---|
| 130 | |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | /** |
---|
| 134 | * |
---|
| 135 | * |
---|
| 136 | */ |
---|
| 137 | void GroundTurret::leftWorld () |
---|
| 138 | { |
---|
| 139 | |
---|
| 140 | } |
---|