]> git.jsancho.org Git - lugaru.git/blob - Source/Objects/Weapons.hpp
4b40eb6e6baf29fb964d00f2a0ab5348a531a72c
[lugaru.git] / Source / Objects / Weapons.hpp
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_HPP_
22 #define _WEAPONS_HPP_
23
24 #include "Animation/Skeleton.hpp"
25 #include "Environment/Terrain.hpp"
26 #include "Graphic/gamegl.hpp"
27 #include "Graphic/Models.hpp"
28 #include "Graphic/Sprite.hpp"
29 #include "Graphic/Texture.hpp"
30 #include "Math/XYZ.hpp"
31 #include "Objects/Person.hpp"
32
33 #include <cmath>
34
35 #define max_weapons 30
36 #define max_weaponinstances 20
37
38 #define knife 1
39 #define sword 2
40 #define staff 3
41
42 class Weapon
43 {
44 public:
45     Weapon(int type, int owner);
46
47     static void Load();
48
49     void Draw();
50     void DoStuff(int);
51
52     int getType() {
53         return type;
54     }
55     void setType(int);
56
57     void drop(XYZ velocity, XYZ tipvelocity, bool sethitsomething = true);
58     void thrown(XYZ velocity, bool sethitsomething = true);
59
60     int owner;
61     XYZ position;
62     XYZ tippoint;
63     XYZ velocity;
64     XYZ tipvelocity;
65     bool missed;
66     bool hitsomething;
67     float freetime;
68     bool firstfree;
69     bool physics;
70
71     float damage;
72     int bloody;
73     float blooddrip;
74     float blooddripdelay;
75
76     float rotation1;
77     float rotation2;
78     float rotation3;
79     float bigrotation;
80     float bigtilt;
81     float bigtilt2;
82     float smallrotation;
83     float smallrotation2;
84
85 private:
86     static Model throwingknifemodel;
87     static Texture knifetextureptr;
88     static Texture lightbloodknifetextureptr;
89     static Texture bloodknifetextureptr;
90
91     static Model swordmodel;
92     static Texture swordtextureptr;
93     static Texture lightbloodswordtextureptr;
94     static Texture bloodswordtextureptr;
95
96     static Model staffmodel;
97     static Texture stafftextureptr;
98
99     int type;
100
101     XYZ oldtippoint;
102     XYZ oldposition;
103     int oldowner;
104     bool onfire;
105     float flamedelay;
106     float mass;
107     float tipmass;
108     float length;
109     float drawhowmany;
110
111     XYZ lastdrawnposition;
112     XYZ lastdrawntippoint;
113     float lastdrawnrotation1;
114     float lastdrawnrotation2;
115     float lastdrawnrotation3;
116     float lastdrawnbigrotation;
117     float lastdrawnbigtilt;
118     float lastdrawnbigtilt2;
119     float lastdrawnsmallrotation;
120     float lastdrawnsmallrotation2;
121     int lastdrawnanim;
122 };
123
124 class Weapons : public std::vector<Weapon>
125 {
126 public:
127     Weapons();
128
129     int Draw();
130     void DoStuff();
131 };
132
133 extern Weapons weapons;
134 #endif