Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/orxonox/objects/weapon/BaseWeapon.h @ 920

Last change on this file since 920 was 871, checked in by landauf, 17 years ago

merged core branch to trunk

File size: 2.7 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
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (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, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Reto Grieder
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28
29#ifndef _BaseWeapon_H__
30#define _BaseWeapon_H__
31
32#include <OgrePrerequisites.h>
33
34#include "../../OrxonoxPrereqs.h"
35
36#include "../Model.h"
37
38
39namespace orxonox {
40  class _OrxonoxExport BaseWeapon : public Model
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();
61          virtual ~BaseWeapon();
62
63    bool addAction(const Action);
64
65    void primaryFireRequest();
66
67    void secondaryFireRequest();
68
69    int getAmmoState();
70
71    void setAmmoDump(AmmunitionDump*);
72
73    inline virtual void loadParams(TiXmlElement* xmlElem) { Model::loadParams(xmlElem); };
74
75    virtual void tick(float dt);
76
77  protected:
78    virtual void primaryFire() = 0;
79
80    virtual void primaryFiring(float) = 0;
81
82    virtual void secondaryFire() = 0;
83
84    virtual void secondaryFiring(float) = 0;
85
86    virtual void registerAllVariables() { };
87
88  public:
89
90  protected:
91    Ogre::SceneManager *sceneMgr_;
92
93    int bulletCounter_;
94    BulletManager *bulletManager_;
95
96    AmmunitionDump *ammoDump_;
97
98    bool primaryFireRequest_;
99    bool secondaryFireRequest_;
100
101    float totalTime_;
102    float actionStartTime_;
103
104    State currentState_;
105    bool secondaryFired_;
106
107    Action nextAction_;
108    bool actionAdded_;
109    float timeSinceNextActionAdded_;
110    static float nextActionValidityPeriod_s;
111
112    // weapon properties
113    int leftAmmo_;
114    float primaryFirePower_;
115    float secondaryFirePower_;
116    float primaryFiringRate_;
117    float secondaryFiringRate_;
118    Real primaryBulletSpeed_;
119    Real secondaryBulletSpeed_;
120
121    int magazineSize_;
122
123  };
124}
125
126#endif /* _BaseWeapon_H__ */
Note: See TracBrowser for help on using the repository browser.