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" |
---|
17 | #include "factory.h" |
---|
18 | #include "model.h" |
---|
19 | #include "turret.h" |
---|
20 | |
---|
21 | CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); |
---|
22 | |
---|
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 | { |
---|
53 | this->setClassID(CL_GROUND_TURRET, "GroundTurret"); |
---|
54 | this->loadModel("models/ground_turret.obj", 5); |
---|
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); |
---|
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. |
---|
72 | static_cast<NPC*>(this)->loadParams(root); |
---|
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 | */ |
---|
85 | void GroundTurret::tick(float time) |
---|
86 | { |
---|
87 | |
---|
88 | } |
---|
89 | |
---|
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 | |
---|
107 | if (model) |
---|
108 | model->draw(); |
---|
109 | //left->draw(); |
---|
110 | //right->draw(); |
---|
111 | glPopMatrix(); |
---|
112 | } |
---|
113 | |
---|
114 | |
---|
115 | /** |
---|
116 | * |
---|
117 | * |
---|
118 | */ |
---|
119 | void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location) |
---|
120 | { |
---|
121 | |
---|
122 | } |
---|
123 | |
---|
124 | /** |
---|
125 | * |
---|
126 | * |
---|
127 | */ |
---|
128 | void GroundTurret::postSpawn () |
---|
129 | { |
---|
130 | |
---|
131 | } |
---|
132 | |
---|
133 | /** |
---|
134 | * |
---|
135 | * |
---|
136 | */ |
---|
137 | void GroundTurret::leftWorld () |
---|
138 | { |
---|
139 | |
---|
140 | } |
---|