Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/main_reto_vs05/src/weapon/base_weapon.h @ 198

Last change on this file since 198 was 198, checked in by rgrieder, 16 years ago
  • added a simple ammo dump
  • created BaseWeapon from WeaponManager
  • created the WeaponStation object
File size: 2.6 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software: you can redistribute it and/or modify
8 *   it under the terms of the GNU General Public License as published by
9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 *
20 *
21 *   Author:
22 *      Reto Grieder
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28
29#ifndef BASE_WEAPON_H
30#define BASE_WEAPON_H
31
32#include "OgrePrerequisites.h"
33
34#include "orxonox_prerequisites.h"
35
36
37namespace orxonox {
38namespace weapon {
39
40  class BaseWeapon
41  {
42  public:
43    enum Action {
44      NOTHING  = 0,
45      RELOAD   = 1,
46      CHANGE_AMMO  = 2,
47      SPECIAL  = 3
48    };
49
50  protected:
51    enum State {
52      IDLE = 0,
53      PRIMARY_FIRE = 1,
54      SECONDARY_FIRE = 2,
55      RELOADING = 3,
56      CHANGING_AMMO = 4,
57    };
58
59  public:
60    BaseWeapon(Ogre::SceneManager*, InertialNode*, BulletManager*,
61          AmmunitionDump*);
62          virtual ~BaseWeapon();
63
64    bool addAction(const Action);
65
66    void primaryFireRequest();
67
68    void secondaryFireRequest();
69
70    int getAmmoState();
71
72    bool tick(unsigned long, Ogre::Real);
73
74  protected:
75    void primaryFire();
76
77    void primaryFiring(unsigned int);
78
79    void secondaryFire();
80
81    void secondaryFiring(unsigned int);
82
83  public:
84
85  protected:
86    Ogre::SceneManager *sceneMgr_;
87    //Ogre::SceneNode *node_;
88    InertialNode* node_;
89
90    int bulletCounter_;
91    BulletManager *bulletManager_;
92
93    AmmunitionDump *ammoDump_;
94
95    bool primaryFireRequest_;
96    bool secondaryFireRequest_;
97
98    unsigned long actionStartTime_;
99
100    State currentState_;
101    bool secondaryFired_;
102
103    Action nextAction_;
104    bool actionAdded_;
105    unsigned long timeSinceNextActionAdded_;
106    static const unsigned long nextActionValidityPeriod_ = 500;
107
108    // weapon properties
109    int leftAmmo_;
110    Ogre::String name_;
111    int primaryFirePower_;
112    int secondaryFirePower_;
113    int primaryFiringRate_;
114    int secondaryFiringRate_;
115    Ogre::Real primaryBulletSpeed_;
116    Ogre::Real secondaryBulletSpeed_;
117
118    int magazineSize_;
119
120  };
121
122}
123}
124
125#endif /* BASE_WEAPON_H */
Note: See TracBrowser for help on using the repository browser.