1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | co-programmer: |
---|
16 | */ |
---|
17 | |
---|
18 | |
---|
19 | #include "weapon.h" |
---|
20 | #include "stdincl.h" |
---|
21 | #include "world_entity.h" |
---|
22 | #include "vector.h" |
---|
23 | #include "objModel.h" |
---|
24 | #include "projectile.h" |
---|
25 | #include "list.h" |
---|
26 | #include "world.h" |
---|
27 | |
---|
28 | using namespace std; |
---|
29 | |
---|
30 | |
---|
31 | /** |
---|
32 | \brief standard constructor |
---|
33 | |
---|
34 | creates a new weapon |
---|
35 | */ |
---|
36 | Weapon::Weapon () : WorldEntity() |
---|
37 | { |
---|
38 | WorldInterface* wi = WorldInterface::getInstance(); |
---|
39 | this->worldEntities = wi->getEntityList(); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | \brief standard deconstructor |
---|
45 | */ |
---|
46 | Weapon::~Weapon () |
---|
47 | { |
---|
48 | // model will be deleted from WorldEntity-destructor |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | /** |
---|
53 | \brief enables the weapon |
---|
54 | |
---|
55 | a weapon can be enabled/disabled because of various reasons. if a weapon is |
---|
56 | been enabled, it can interact in a world. elswhere it wont react to any |
---|
57 | action. |
---|
58 | */ |
---|
59 | void Weapon::enable() |
---|
60 | { |
---|
61 | this->enabled = true; |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | /** |
---|
66 | \brief disables the weapon |
---|
67 | |
---|
68 | a weapon can be enabled/disabled because of various reasons. if a weapon is |
---|
69 | been enabled, it can interact in a world. elswhere it wont react to any |
---|
70 | action. |
---|
71 | */ |
---|
72 | void Weapon::disable() |
---|
73 | { |
---|
74 | this->enabled = false; |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | /** |
---|
79 | \brief checks if the weapon is enabled |
---|
80 | \returns true if enabled |
---|
81 | |
---|
82 | a weapon can be ebabled/disabled because of various reasons. if a weapon is |
---|
83 | been enabled, it can interact in a world. elswhere it wont react to any |
---|
84 | action. |
---|
85 | */ |
---|
86 | bool Weapon::isEnabled() |
---|
87 | { |
---|
88 | return this->enabled; |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | /** |
---|
93 | \brief sets a new projectile to the weapon |
---|
94 | \param new projectile for this weapon |
---|
95 | |
---|
96 | weapon an projectile are independent, so you can combine them as you want |
---|
97 | */ |
---|
98 | void Weapon::setProjectile(Projectile* projectile) |
---|
99 | { |
---|
100 | this->projectile = projectile; |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | /** |
---|
105 | \brief sets a new projectile to the weapon |
---|
106 | \returns the current projectile of this weapon |
---|
107 | |
---|
108 | weapon an projectile are independent, so you can combine them as you want |
---|
109 | */ |
---|
110 | Projectile* Weapon::getProjectile() |
---|
111 | { |
---|
112 | return this->projectile; |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | /** |
---|
117 | \brief this activates the weapon |
---|
118 | |
---|
119 | This is needed, since there can be more than one weapon on a ship. the |
---|
120 | activation can be connected with an animation. for example the weapon is |
---|
121 | been armed out. |
---|
122 | */ |
---|
123 | void Weapon::activate() |
---|
124 | {} |
---|
125 | |
---|
126 | |
---|
127 | /** |
---|
128 | \brief this deactivates the weapon |
---|
129 | |
---|
130 | This is needed, since there can be more than one weapon on a ship. the |
---|
131 | activation can be connected with an animation. for example the weapon is |
---|
132 | been armed out. |
---|
133 | */ |
---|
134 | void Weapon::deactivate() |
---|
135 | {} |
---|
136 | |
---|
137 | /** |
---|
138 | \brief asks if the current weapon is active |
---|
139 | \returns true if it the weapon is active |
---|
140 | */ |
---|
141 | bool Weapon::isActive() |
---|
142 | {} |
---|
143 | |
---|
144 | /** |
---|
145 | \brief sets a weapon idle time |
---|
146 | \param idle time in ms |
---|
147 | |
---|
148 | a weapon idle time is the time spend after a shoot until the weapon can |
---|
149 | shoot again |
---|
150 | */ |
---|
151 | void Weapon::setWeaponIdleTime(float time) |
---|
152 | {} |
---|
153 | |
---|
154 | /** |
---|
155 | \brief gets the weapon idle time |
---|
156 | \returns idle time in ms |
---|
157 | |
---|
158 | a weapon idle time is the time spend after a shoot until the weapon can |
---|
159 | shoot again |
---|
160 | */ |
---|
161 | float Weapon::getWeaponIdleTime(void) |
---|
162 | {} |
---|
163 | |
---|
164 | /** |
---|
165 | \brief checks if the idle time is elapsed |
---|
166 | \return true if time is elapsed |
---|
167 | |
---|
168 | a weapon idle time is the time spend after a shoot until the weapon can |
---|
169 | shoot again |
---|
170 | */ |
---|
171 | bool Weapon::hasWeaponIdleTimeElapsed(void) |
---|
172 | {} |
---|
173 | |
---|
174 | |
---|
175 | /** |
---|
176 | \brief fires the weapon |
---|
177 | |
---|
178 | this is called from the player.cc, when fire-button is been pushed |
---|
179 | */ |
---|
180 | void Weapon::fire() |
---|
181 | { |
---|
182 | |
---|
183 | } |
---|
184 | |
---|
185 | |
---|
186 | /** |
---|
187 | \brief is called, when the weapon gets hit (=collide with something) |
---|
188 | \param from which entity it is been hit |
---|
189 | \param where it is been hit |
---|
190 | |
---|
191 | this may not be used, since it would make the game relay complicated when one |
---|
192 | can destroy the weapons of enemies or vice versa. |
---|
193 | */ |
---|
194 | void Weapon::hit (WorldEntity* entity, Vector* position) |
---|
195 | {} |
---|
196 | |
---|
197 | |
---|
198 | /** |
---|
199 | \brief is called, when the weapon is destroyed |
---|
200 | |
---|
201 | this is in conjunction with the hit function, so when a weapon is able to get |
---|
202 | hit, it can also be destoryed. |
---|
203 | */ |
---|
204 | void Weapon::destroy () |
---|
205 | {} |
---|
206 | |
---|
207 | |
---|
208 | /** |
---|
209 | \brief tick signal for time dependent/driven stuff |
---|
210 | */ |
---|
211 | void Weapon::tick (float time) |
---|
212 | {} |
---|
213 | |
---|
214 | |
---|
215 | /** |
---|
216 | \brief is called, when there is no fire button pressed |
---|
217 | */ |
---|
218 | void Weapon::weaponIdle() |
---|
219 | {} |
---|
220 | |
---|
221 | |
---|
222 | /** |
---|
223 | \brief this will draw the weapon |
---|
224 | */ |
---|
225 | void Weapon::draw () |
---|
226 | {} |
---|
227 | |
---|