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