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