]> git.jsancho.org Git - lugaru.git/blob - Source/Person.h
Added GPL license and headers.
[lugaru.git] / Source / Person.h
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3
4 This file is part of Lugaru.
5
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
14
15 See the 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21
22 #ifndef _PERSON_H_
23 #define _PERSON_H_
24
25 /**> HEADER FILES <**/
26
27 #include "gamegl.h"
28 #include "Quaternions.h"
29 #include "fmod.h"
30 #include "Skeleton.h"
31 #include "Models.h"
32 #include "Constants.h"
33 #include "Terrain.h"
34 #include "Sprites.h"
35 #include <cmath>
36 #include "Weapons.h"
37
38 #define passivetype 0
39 #define guardtype 1
40 #define searchtype 2
41 #define attacktype 3
42 #define attacktypecutoff 4
43 #define playercontrolled 5
44 #define gethelptype 6
45 #define getweapontype 7
46 #define pathfindtype 8
47
48 #define rabbittype 0
49 #define wolftype 1
50
51 class HitStruct
52 {
53         public:
54                 Joint *joint1;
55                 Joint *joint2;
56                 XYZ hitlocation;
57                 bool collision;
58 };
59
60 class Person
61 {
62         public:
63                 Person();
64                 ~Person();
65
66                 int whichpatchx;
67                 int whichpatchz;
68                 
69                 int currentframe;
70                 int targetframe;
71                 int currentanimation;
72                 int targetanimation;
73                 int oldcurrentframe;
74                 int oldtargetframe;
75                 int oldcurrentanimation;
76                 int oldtargetanimation;
77                 
78                 int howactive;
79                 
80                 float parriedrecently;
81                 
82                 bool superruntoggle;
83                 
84                 int lastattack,lastattack2,lastattack3;
85                 
86                 XYZ currentoffset,targetoffset,offset;
87                 float target;
88                 float transspeed;
89                 
90                 XYZ realoldcoords;
91                 XYZ oldcoords;
92                 XYZ coords;
93                 XYZ originalcoords;
94                 XYZ velocity;
95                 
96                 XYZ proportionhead;
97                 XYZ proportionlegs;
98                 XYZ proportionarms;
99                 XYZ proportionbody;
100                 
101                 float heightleft;
102                 float heightright;
103                 
104                 float unconscioustime;
105                 
106                 bool immobile;
107                 
108                 float velspeed;
109                 float targetrotation;
110                 float targetrot;
111                 float rot;
112                 float oldrot;
113                 float lookrotation;
114                 float lookrotation2;
115                 float rotation;
116                 float rotation2;
117                 float lowrotation;
118                 float tilt;
119                 float targettilt;
120                 float tilt2;
121                 float targettilt2;
122                 bool rabbitkickenabled;
123                 
124                 float bloodloss;
125                 float bleeddelay;
126                 float skiddelay;
127                 float skiddingdelay;
128                 float deathbleeding;
129                 float tempdeltav;
130                 
131                 float damagetolerance;
132                 float damage;
133                 float permanentdamage;
134                 float superpermanentdamage;             float lastcollide;
135                 int dead;
136                 
137                 float jumppower;
138                 bool onground;
139                 int madskills;
140                 
141                 int wentforweapon;
142                 
143                 bool calcrot;
144                 
145                 bool backwardsanim;
146                 
147                 XYZ facing;
148                 
149                 float bleeding;
150                 float bleedx,bleedy;
151                 int direction;
152                 float texupdatedelay;
153                 
154                 float headrotation,headrotation2;
155                 float targetheadrotation,targetheadrotation2;
156                 
157                 bool onterrain;
158                 bool pause;
159                 
160                 float grabdelay;
161                 
162                 Person *victim;
163                 bool hasvictim;
164                 
165                 float updatedelay;
166                 float normalsupdatedelay;
167                 
168                 bool jumpstart;
169                 
170                 bool forwardkeydown;
171                 bool forwardstogglekeydown;
172                 bool rightkeydown;
173                 bool leftkeydown;
174                 bool backkeydown;
175                 bool jumpkeydown;
176                 bool jumptogglekeydown;
177                 bool crouchkeydown;
178                 bool crouchtogglekeydown;
179                 bool drawkeydown;
180                 bool drawtogglekeydown;
181                 bool throwkeydown;
182                 bool throwtogglekeydown;
183                 bool attackkeydown;
184                 bool feint;
185                 bool lastfeint;
186                 bool headless;
187                 
188                 float crouchkeydowntime;
189                 float jumpkeydowntime;
190                 bool freefall;
191                 
192                 
193                 float turnspeed;
194                 
195                 int aitype;
196                 int aitarget;
197                 float aiupdatedelay;
198                 float losupdatedelay;
199                 int ally;
200                 XYZ movetarget;
201                 float collide;
202                 float collided;
203                 float avoidcollided;
204                 bool loaded;
205                 bool whichdirection;
206                 float whichdirectiondelay;
207                 bool avoidsomething;            XYZ avoidwhere;         
208                 float blooddimamount;
209                 
210                 float staggerdelay;
211                 float blinkdelay;
212                 float twitchdelay;
213                 float twitchdelay2;
214                 float twitchdelay3;
215                 float lefthandmorphness;
216                 float righthandmorphness;
217                 float headmorphness;
218                 float chestmorphness;
219                 float tailmorphness;
220                 float targetlefthandmorphness;
221                 float targetrighthandmorphness;
222                 float targetheadmorphness;
223                 float targetchestmorphness;
224                 float targettailmorphness;
225                 int lefthandmorphstart,lefthandmorphend;
226                 int righthandmorphstart,righthandmorphend;
227                 int headmorphstart,headmorphend;
228                 int chestmorphstart,chestmorphend;
229                 int tailmorphstart,tailmorphend;
230                 
231                 float weaponmissdelay;
232                 float highreversaldelay;
233                 float lowreversaldelay;
234                 float nocollidedelay;
235                 
236                 int creature;
237                 
238                 int id;
239                 
240                 Skeleton skeleton;
241                 
242                 float speed;
243                 float scale;
244                 float power;
245                 float speedmult;
246                 
247                 float protectionhead;
248                 float protectionhigh;
249                 float protectionlow;
250                 float armorhead;
251                 float armorhigh;
252                 float armorlow;
253                 bool metalhead;
254                 bool metalhigh;
255                 bool metallow;
256                 
257                 int numclothes;
258                 char clothes[10][256];
259                 float clothestintr[10];
260                 float clothestintg[10];
261                 float clothestintb[10];
262                 
263                 bool landhard;
264                 bool bled;
265                 bool spurt;
266                 bool onfire;
267                 float onfiredelay;              float burnt;
268                 float fireduration;
269                 
270                 float flamedelay;
271                 float updatestuffdelay;
272                 
273                 int playerdetail;
274                 
275                 int num_weapons;
276                 int weaponids[4];
277                 int weaponactive;
278                 int weaponstuck;
279                 int weaponstuckwhere;
280                 int weaponwhere;
281                 
282                 int numwaypoints;
283                 XYZ waypoints[90];
284                 int waypointtype[90];
285                 float pausetime;
286                 bool hastempwaypoint;
287                 XYZ tempwaypoint;
288                 
289                 XYZ headtarget;
290                 float interestdelay;
291                 
292                 XYZ finalfinaltarget;
293                 XYZ finaltarget;
294                 int finalpathfindpoint;
295                 int targetpathfindpoint;
296                 int lastpathfindpoint;
297                 int lastpathfindpoint2;
298                 int lastpathfindpoint3;
299                 int lastpathfindpoint4;
300                 bool onpath;
301                 
302                 int waypoint;
303                 bool jumppath;
304                 
305                 XYZ lastseen;
306                 float lastseentime;
307                 float lastchecktime;
308                 float stunned;
309                 float surprised;
310                 float runninghowlong;           int lastoccluded;
311                 int laststanding;
312                 int escapednum;
313                 
314                 float speechdelay;
315                 float neckspurtdelay;
316                 float neckspurtparticledelay;
317                 float neckspurtamount;
318                 
319                 int whichskin;
320                 bool rabbitkickragdoll;
321                 
322                 XYZ averageloc;
323                 XYZ oldaverageloc;
324                 
325                 Animation tempanimation;
326                 
327                 float occluded;
328                 
329                 void CheckKick();
330                 void CatchFire();
331                 void DoBlood(float howmuch, int which);
332                 void DoBloodBig(float howmuch, int which);
333                 bool DoBloodBigWhere(float howmuch, int which, XYZ where);
334                 
335                 bool wasIdle();
336                 bool isIdle();
337                 int getIdle();
338                 
339                 bool isSitting();
340                 bool isSleeping();
341                 
342                 
343                 bool wasCrouch();
344                 bool isCrouch();
345                 int getCrouch();
346                 
347                 bool wasStop();
348                 bool isStop();
349                 int getStop();
350                 
351                 bool wasSneak();
352                 bool isSneak();
353                 int getSneak();
354                 
355                 bool wasRun();
356                 bool isRun();
357                 int getRun();
358                 
359                 bool wasLanding();
360                 bool isLanding();
361                 int getLanding();
362                 
363                 bool wasLandhard();
364                 bool isLandhard();
365                 int getLandhard();
366                 
367                 bool isFlip();
368                 bool wasFlip();
369                 
370                 bool jumpclimb;
371                 
372                 bool isWallJump();
373                 void Reverse();
374                 void DoDamage(float howmuch);
375                 void DoHead();
376                 void DoMipmaps(int howmanylevels, float startx, float endx, float starty, float endy);
377                 int SphereCheck(XYZ *p1,float radius, XYZ *p, XYZ *move, float *rotate, Model *model);
378                 int DrawSkeleton();
379                 void Puff(int whichlabel);
380                 void FootLand(int which, float opacity);
381                 void DoStuff();
382                 void DoAnimations();
383                 void RagDoll(bool checkcollision);
384                 HitStruct BulletCollideWithPlayer(XYZ start, XYZ end);
385 };
386
387 #endif