Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/weapon.cc @ 3577

Last change on this file since 3577 was 3577, checked in by patrick, 19 years ago

orxonox/trunk: enabling disabling of weapons

File size: 4.6 KB
Line 
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
26using namespace std;
27
28
29/**
30   \brief standard constructor
31
32   creates a new weapon
33*/
34Weapon::Weapon () : WorldEntity()
35{
36  this->model = new OBJModel("");
37}
38
39
40/**
41   \brief standard deconstructor
42*/
43Weapon::~Weapon () 
44{
45  delete this->model;
46}
47
48
49/**
50    \brief enables the weapon
51
52    a weapon can be enabled/disabled because of various reasons. if a weapon is
53    been enabled, it can interact in a world. elswhere it wont react to any
54    action.
55*/
56void Weapon::enable()
57{}
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*/
67void Weapon::disable()
68{}
69
70
71/**
72    \brief checks if the weapon is enabled
73    \returns true if enabled
74
75    a weapon can be ebabled/disabled because of various reasons. if a weapon is
76    been enabled, it can interact in a world. elswhere it wont react to any
77    action.
78*/
79bool Weapon::isEnabled()
80{}
81
82
83/**
84   \brief sets a new projectile to the weapon
85   \param new projectile for this weapon
86
87   weapon an projectile are independent, so you can combine them as you want
88*/
89void Weapon::setProjectile(Projectile* projectile)
90{
91  this->projectile = projectile;
92}
93
94
95/**
96   \brief sets a new projectile to the weapon
97   \returns the current projectile of this weapon
98
99   weapon an projectile are independent, so you can combine them as you want
100*/
101Projectile* Weapon::getProjectile()
102{
103  return this->projectile;
104}
105
106
107/**
108   \brief this activates the weapon
109
110   This is needed, since there can be more than one weapon on a ship. the
111   activation can be connected with an animation. for example the weapon is
112   been armed out.
113*/
114void Weapon::activate()
115{}
116
117
118/**
119   \brief this deactivates the weapon
120
121   This is needed, since there can be more than one weapon on a ship. the
122   activation can be connected with an animation. for example the weapon is
123   been armed out.
124*/
125void Weapon::deactivate()
126{}
127
128/**
129   \brief asks if the current weapon is active
130   \returns true if it the weapon is active
131*/
132bool Weapon::isActive()
133{}
134
135
136/**
137   \brief this sets the energy of a weapon
138   \param amount of energy
139
140   a weapon has a limited amount of energy, this means a limited amount of shoots
141*/
142void Weapon::setWeaponEnergy(int energy)
143{}
144
145/**
146   \brief adds weapon energy
147   \param amount of energy
148   \returns amount of energy, that is over the energy limit
149
150   this can be used for energy-power up for example. There is a limited amount of energy
151   a weapon can have. so if you want to add more, than it supports, the rest will
152   be returned from this weapon.
153*/
154int Weapon::addWeaponEnergy(int addEnergy)
155{}
156
157/**
158   \brief removes weapon energy
159   \param amount of enery
160
161   this is the case, when ther should be some sort of energy loss in the weapon
162   system. propably wont be the case but usefull to have
163*/
164void Weapon::substractWeaponEnergy(int subEnergy)
165{}
166
167/**
168   \brief gets the amount of energy of a weapon (= ammo)
169*/
170int Weapon::getWeaponEnergy()
171{}
172
173
174/**
175   \brief fires the weapon
176   
177   this is called from the player.cc, when fire-button is been pushed
178*/
179void Weapon::fire()
180{}
181
182
183/**
184   \brief is called, when the weapon gets hit (=collide with something)
185   \param from which entity it is been hit
186   \param where it is been hit
187
188   this may not be used, since it would make the game relay complicated when one
189   can destroy the weapons of enemies or vice versa.
190*/
191void Weapon::hit (WorldEntity* entity, Vector position) 
192{}
193
194
195/**
196   \brief is called, when the weapon is destroyed
197
198   this is in conjunction with the hit function, so when a weapon is able to get
199   hit, it can also be destoryed.
200*/
201void Weapon::destroy () 
202{}
203
204
205/**
206   \brief tick signal for time dependent/driven stuff
207*/
208void Weapon::tick (float time) 
209{}
210
211
212/**
213   \brief this will draw the weapon
214*/
215void Weapon::draw () 
216{
217  glMatrixMode(GL_MODELVIEW);
218  glPushMatrix();
219
220  float matrix[4][4];
221  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
222  this->getAbsDir().matrix (matrix);
223  glMultMatrixf((float*)matrix);
224  this->model->draw();
225
226  glPopMatrix();
227}
228
Note: See TracBrowser for help on using the repository browser.