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