]> git.jsancho.org Git - lugaru.git/blob - Source/Weapons.h
Refactor of weapon throwing in Weapon class. (named it thrown as throw is reserved...
[lugaru.git] / Source / Weapons.h
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
4
5 This file is part of Lugaru.
6
7 Lugaru 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 2 of the License, or
10 (at your option) any later version.
11
12 Lugaru 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 Lugaru.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _WEAPONS_H_
22 #define _WEAPONS_H_
23
24 /**> HEADER FILES <**/
25
26 #include "gamegl.h"
27 #include "Quaternions.h"
28 #include "Skeleton.h"
29 #include "Models.h"
30 #include "Terrain.h"
31 #include "Sprite.h"
32 #include "Person.h"
33 #include "Texture.h"
34 #include <cmath>
35
36 #define max_weapons 30
37 #define max_weaponinstances 20
38
39 #define knife 1
40 #define sword 2
41 #define staff 3
42
43 class Weapon
44 {
45 public:
46     Weapon(int type, int owner);
47
48     static Model throwingknifemodel;
49     static Texture knifetextureptr;
50     static Texture lightbloodknifetextureptr;
51     static Texture bloodknifetextureptr;
52
53     static Model swordmodel;
54     static Texture swordtextureptr;
55     static Texture lightbloodswordtextureptr;
56     static Texture bloodswordtextureptr;
57
58     static Model staffmodel;
59     static Texture stafftextureptr;
60
61     void Draw();
62     void DoStuff(int);
63
64     int getType() {
65         return type;
66     }
67     void setType(int);
68
69     void drop(XYZ velocity, XYZ tipvelocity, bool sethitsomething = true);
70     void thrown(XYZ velocity, bool sethitsomething = true);
71
72     int owner;
73     XYZ position;
74     XYZ tippoint;
75     XYZ velocity;
76     XYZ tipvelocity;
77     bool missed;
78     bool hitsomething;
79     float freetime;
80     bool firstfree;
81     bool physics;
82
83     float damage;
84     int bloody;
85     float blooddrip;
86     float blooddripdelay;
87
88     float rotation1;
89     float rotation2;
90     float rotation3;
91     float bigrotation;
92     float bigtilt;
93     float bigtilt2;
94     float smallrotation;
95     float smallrotation2;
96 private:
97     int type;
98
99     XYZ oldtippoint;
100     float lastmult;
101     XYZ oldposition;
102     int oldowner;
103     bool onfire;
104     float flamedelay;
105     float mass;
106     float tipmass;
107     float length;
108     float drawhowmany;
109
110     XYZ lastdrawnposition;
111     XYZ lastdrawntippoint;
112     float lastdrawnrotation1;
113     float lastdrawnrotation2;
114     float lastdrawnrotation3;
115     float lastdrawnbigrotation;
116     float lastdrawnbigtilt;
117     float lastdrawnbigtilt2;
118     float lastdrawnsmallrotation;
119     float lastdrawnsmallrotation2;
120     int lastdrawnanim;
121 };
122
123 class Weapons : public std::vector<Weapon>
124 {
125 public:
126     Weapons();
127     ~Weapons();
128
129     int Draw();
130     void DoStuff();
131 };
132
133 extern Weapons weapons;
134 #endif