Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/weapon/BaseWeapon.h @ 1118

Last change on this file since 1118 was 1056, checked in by landauf, 17 years ago

don't panic, no codechanges!
added a link to www.orxonox.net

File size: 2.8 KB
RevLine 
[668]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
[1056]3 *                    > www.orxonox.net <
[668]4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29
[673]30#ifndef _BaseWeapon_H__
31#define _BaseWeapon_H__
[668]32
[1039]33#include "OrxonoxPrereqs.h"
34
[668]35#include <OgrePrerequisites.h>
36
37#include "../Model.h"
38
39
40namespace orxonox {
[729]41  class _OrxonoxExport BaseWeapon : public Model
[668]42  {
43  public:
44    enum Action {
45      NOTHING  = 0,
46      RELOAD   = 1,
47      CHANGE_AMMO  = 2,
48      SPECIAL  = 3
49    };
50
51  protected:
52    enum State {
53      IDLE = 0,
54      PRIMARY_FIRE = 1,
55      SECONDARY_FIRE = 2,
56      RELOADING = 3,
57      CHANGING_AMMO = 4,
58    };
59
60  public:
61    BaseWeapon();
62          virtual ~BaseWeapon();
63
64    bool addAction(const Action);
65
66    void primaryFireRequest();
67
68    void secondaryFireRequest();
69
70    int getAmmoState();
71
72    void setAmmoDump(AmmunitionDump*);
73
74    inline virtual void loadParams(TiXmlElement* xmlElem) { Model::loadParams(xmlElem); };
75
76    virtual void tick(float dt);
77
78  protected:
79    virtual void primaryFire() = 0;
80
81    virtual void primaryFiring(float) = 0;
82
83    virtual void secondaryFire() = 0;
84
85    virtual void secondaryFiring(float) = 0;
86
87    virtual void registerAllVariables() { };
88
89  public:
90
91  protected:
92    Ogre::SceneManager *sceneMgr_;
93
94    int bulletCounter_;
95    BulletManager *bulletManager_;
96
97    AmmunitionDump *ammoDump_;
98
99    bool primaryFireRequest_;
100    bool secondaryFireRequest_;
101
102    float totalTime_;
103    float actionStartTime_;
104
105    State currentState_;
106    bool secondaryFired_;
107
108    Action nextAction_;
109    bool actionAdded_;
110    float timeSinceNextActionAdded_;
[680]111    static float nextActionValidityPeriod_s;
[668]112
113    // weapon properties
114    int leftAmmo_;
115    float primaryFirePower_;
116    float secondaryFirePower_;
117    float primaryFiringRate_;
118    float secondaryFiringRate_;
[708]119    Real primaryBulletSpeed_;
120    Real secondaryBulletSpeed_;
[668]121
122    int magazineSize_;
123
124  };
125}
126
[673]127#endif /* _BaseWeapon_H__ */
Note: See TracBrowser for help on using the repository browser.