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