]> git.jsancho.org Git - lugaru.git/blob - Source/Person.h
Removed unused members of Person class
[lugaru.git] / Source / Person.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 _PERSON_H_
22 #define _PERSON_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 <cmath>
33 #include <memory>
34 #include "Weapons.h"
35 #include "Animation.h"
36
37 #define passivetype 0
38 #define guardtype 1
39 #define searchtype 2
40 #define attacktype 3
41 #define attacktypecutoff 4
42 #define playercontrolled 5
43 #define gethelptype 6
44 #define getweapontype 7
45 #define pathfindtype 8
46
47 #define rabbittype 0
48 #define wolftype 1
49
50 class Person : public enable_shared_from_this<Person>
51 {
52 public:
53     static std::vector<std::shared_ptr<Person>> players;
54
55     int whichpatchx;
56     int whichpatchz;
57
58     // animCurrent and animTarget are used to interpolate between different animations
59     // (and for a bunch of other things).
60     // animations interpolate with one another at various speeds.
61     // animTarget seems to determine the combat state?
62     int animCurrent;
63     int animTarget;
64
65     // frameCurrent and frameTarget are used to interpolate between the frames of an animation
66     // (e.g. the crouched animation has only two frames, lerped back and forth slowly).
67     // animations advance at various speeds.
68     int frameCurrent;
69     int frameTarget;
70
71     int oldanimCurrent;
72     int oldanimTarget;
73     int oldframeCurrent;
74     int oldframeTarget;
75
76     int howactive;
77
78     float parriedrecently;
79
80     bool superruntoggle;
81
82     int lastattack, lastattack2, lastattack3;
83
84     XYZ currentoffset, targetoffset, offset;
85     float target;
86     float transspeed;
87
88     XYZ realoldcoords;
89     XYZ oldcoords;
90     XYZ coords;
91     XYZ velocity;
92
93     XYZ proportionhead;
94     XYZ proportionlegs;
95     XYZ proportionarms;
96     XYZ proportionbody;
97
98     float unconscioustime;
99
100     bool immobile;
101
102     float velspeed;
103     float targetyaw;
104     float targetrot;
105     float rot;
106     float oldrot;
107     float lookyaw;
108     float lookpitch;
109     float yaw;
110     float pitch;
111     float lowyaw;
112     float tilt;
113     float targettilt;
114     float tilt2;
115     float targettilt2;
116     bool rabbitkickenabled;
117
118     float bloodloss;
119     float bleeddelay;
120     float skiddelay;
121     float skiddingdelay;
122     float deathbleeding;
123     float tempdeltav;
124
125     float damagetolerance;
126     float damage;
127     float permanentdamage;
128     float superpermanentdamage;
129     float lastcollide;
130     /* Seems to be 0 = alive, 1 = unconscious, 2 = dead */
131     int dead;
132
133     float jumppower;
134     bool onground;
135
136     int wentforweapon;
137
138     bool calcrot;
139
140     XYZ facing;
141
142     float bleeding;
143     float bleedx, bleedy;
144     int direction;
145     float texupdatedelay;
146
147     float headyaw, headpitch;
148     float targetheadyaw, targetheadpitch;
149
150     bool onterrain;
151     bool pause;
152
153     float grabdelay;
154
155     std::shared_ptr<Person> victim;
156     bool hasvictim;
157
158     float updatedelay;
159     float normalsupdatedelay;
160
161     bool jumpstart;
162
163     bool forwardkeydown;
164     bool forwardstogglekeydown;
165     bool rightkeydown;
166     bool leftkeydown;
167     bool backkeydown;
168     bool jumpkeydown;
169     bool jumptogglekeydown;
170     bool crouchkeydown;
171     bool crouchtogglekeydown;
172     bool drawkeydown;
173     bool drawtogglekeydown;
174     bool throwkeydown;
175     bool throwtogglekeydown;
176     bool attackkeydown;
177     bool feint;
178     bool lastfeint;
179     bool headless;
180
181     float crouchkeydowntime;
182     float jumpkeydowntime;
183     bool freefall;
184
185
186     float turnspeed;
187
188     int aitype;
189     float aiupdatedelay;
190     float losupdatedelay;
191     int ally;
192     float collide;
193     float collided;
194     float avoidcollided;
195     bool loaded;
196     bool whichdirection;
197     float whichdirectiondelay;
198     bool avoidsomething;
199     XYZ avoidwhere;
200     float blooddimamount;
201
202     float staggerdelay;
203     float blinkdelay;
204     float twitchdelay;
205     float twitchdelay2;
206     float twitchdelay3;
207     float lefthandmorphness;
208     float righthandmorphness;
209     float headmorphness;
210     float chestmorphness;
211     float tailmorphness;
212     float targetlefthandmorphness;
213     float targetrighthandmorphness;
214     float targetheadmorphness;
215     float targetchestmorphness;
216     float targettailmorphness;
217     int lefthandmorphstart, lefthandmorphend;
218     int righthandmorphstart, righthandmorphend;
219     int headmorphstart, headmorphend;
220     int chestmorphstart, chestmorphend;
221     int tailmorphstart, tailmorphend;
222
223     float weaponmissdelay;
224     float highreversaldelay;
225     float lowreversaldelay;
226
227     int creature;
228
229     unsigned id;
230
231     Skeleton skeleton;
232
233     float speed;
234     float scale;
235     float power;
236     float speedmult;
237
238     float protectionhead;
239     float protectionhigh;
240     float protectionlow;
241     float armorhead;
242     float armorhigh;
243     float armorlow;
244     bool metalhead;
245     bool metalhigh;
246     bool metallow;
247
248     int numclothes;
249     char clothes[10][256];
250     float clothestintr[10];
251     float clothestintg[10];
252     float clothestintb[10];
253
254     bool landhard;
255     bool bled;
256     bool spurt;
257     bool onfire;
258     float onfiredelay;
259     float burnt;
260
261     float flamedelay;
262
263     int playerdetail;
264
265     int num_weapons;
266     int weaponids[4];
267     /* Key of weaponids which is the weapon in hand, if any. -1 otherwise.
268      * Always 0 or -1 as activeweapon is moved to position 0 when taken */
269     int weaponactive;
270     int weaponstuck;
271     /* 0 or 1 to say if weapon is stuck in the front or the back  */
272     int weaponstuckwhere;
273
274     int numwaypoints;
275     XYZ waypoints[90];
276     int waypointtype[90];
277     float pausetime;
278
279     XYZ headtarget;
280     float interestdelay;
281
282     XYZ finalfinaltarget;
283     XYZ finaltarget;
284     int finalpathfindpoint;
285     int targetpathfindpoint;
286     int lastpathfindpoint;
287     int lastpathfindpoint2;
288     int lastpathfindpoint3;
289     int lastpathfindpoint4;
290
291     int waypoint;
292
293     XYZ lastseen;
294     float lastseentime;
295     float lastchecktime;
296     float stunned;
297     float surprised;
298     float runninghowlong;
299     int lastoccluded;
300     int laststanding;
301     int escapednum;
302
303     float speechdelay;
304     float neckspurtdelay;
305     float neckspurtparticledelay;
306     float neckspurtamount;
307
308     int whichskin;
309     bool rabbitkickragdoll;
310
311     Animation tempanimation;
312
313     float occluded;
314
315     bool jumpclimb;
316
317     Person();
318
319     // convenience functions
320     inline Joint& joint(int bodypart) { return skeleton.joints[skeleton.jointlabels[bodypart]]; }
321     inline XYZ& jointPos(int bodypart) { return joint(bodypart).position; }
322     inline XYZ& jointVel(int bodypart) { return joint(bodypart).velocity; }
323
324
325     void CheckKick();
326     void CatchFire();
327     void DoBlood(float howmuch, int which);
328     void DoBloodBig(float howmuch, int which);
329     bool DoBloodBigWhere(float howmuch, int which, XYZ where);
330
331     bool wasIdle() { return animation_bits[animCurrent] & ab_idle; }
332     bool isIdle() { return animation_bits[animTarget] & ab_idle; }
333     int getIdle();
334
335     bool isSitting() { return animation_bits[animTarget] & ab_sit; }
336
337     bool isSleeping() { return animation_bits[animTarget] & ab_sleep; }
338
339     bool wasCrouch() { return animation_bits[animCurrent] & ab_crouch; }
340     bool isCrouch() { return animation_bits[animTarget] & ab_crouch; }
341     int getCrouch();
342
343     bool wasStop() { return animation_bits[animCurrent] & ab_stop; }
344     bool isStop() { return animation_bits[animTarget] & ab_stop; }
345     int getStop();
346
347     bool wasSneak();
348     bool isSneak();
349     int getSneak();
350
351     bool wasRun() { return animation_bits[animCurrent] & ab_run; }
352     bool isRun() { return animation_bits[animTarget] & ab_run; }
353     int getRun();
354
355     bool wasLanding() { return animation_bits[animCurrent] & ab_land; }
356     bool isLanding() { return animation_bits[animTarget] & ab_land; }
357     int getLanding();
358
359     bool wasLandhard() { return animation_bits[animCurrent] & ab_landhard; }
360     bool isLandhard() { return animation_bits[animTarget] & ab_landhard; }
361     int getLandhard();
362
363     bool wasFlip() { return animation_bits[animCurrent] & ab_flip; }
364     bool isFlip() { return animation_bits[animTarget] & ab_flip; }
365
366     bool isWallJump() { return animation_bits[animTarget] & ab_walljump; }
367     void Reverse();
368     void DoDamage(float howmuch);
369     void DoHead();
370     void DoMipmaps() {
371         skeleton.drawmodel.textureptr.bind();
372         glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
373         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, skeleton.skinsize, skeleton.skinsize, 0, GL_RGB, GL_UNSIGNED_BYTE, &skeleton.skinText[0]);
374     }
375
376     int SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate, Model *model);
377     int DrawSkeleton();
378     void Puff(int whichlabel);
379     void FootLand(int which, float opacity);
380     void DoStuff();
381     void setAnimation(int);
382     void DoAnimations();
383     void RagDoll(bool checkcollision);
384
385     void takeWeapon (int weaponId);
386
387     bool addClothes(const int& clothesId);
388     void addClothes();
389 };
390
391 const int maxplayers = 10;
392
393 #endif