1 /*
2  * Person.h
3  * Copyright (C) 2007 by Bryan Duff <duff0097@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20 #ifndef _PERSON_H_
21 #define _PERSON_H_
22 
23 #include <cmath>
24 #include <GL/gl.h>
25 #include <AL/al.h>
26 #include <AL/alut.h>
27 #include "Quaternions.h"
28 #include "Constants.h"
29 #include "Skeleton.h"
30 #include "Models.h"
31 #include "Camera.h"
32 #include "Sprites.h"
33 #include "Globals.h"
34 #include "Weapon.h"
35 
36 #define playertype 0
37 #define civiliantype 1
38 #define eviltype 2
39 #define viptype 3
40 #define evilsnipertype 4
41 #define evilassaultrifletype 5
42 #define zombietype 6
43 
44 class HitStruct {
45 public:
46   Joint * joint1;
47   Joint *joint2;
48   XYZ hitlocation;
49   bool collision;
50 };
51 
52 class Person {
53 public:
54   int eaten;
55   int currentframe;
56   int targetframe;
57   int currentanimation;
58   int targetanimation;
59   float target;
60   float playerhealth;
61   int modelnum;
62   XYZ oldplayercoords;
63   XYZ playercoords;
64   XYZ playervelocity;
65   float playerrotation;
66   float playerrotation2;
67   float playerlowrotation;
68   float pathcheckdelay;
69   bool onground;
70   bool backwardsanim;
71   XYZ facing;
72   XYZ velocity;
73 
74   bool existing;
75 
76   int type;
77 
78   int whichcostume;
79 
80   Skeleton skeleton;
81   Animation tempanimation;
82 
83   bool freshshootkey;
84   bool freshkickkey;
85   int bufferattack;
86   int jump_key;
87   int left_key;
88   int right_key;
89   int duck_key;
90   int shoot_key;
91   int kick_key;
92   int block_key;
93 
94   float speed;
95   bool aiming;
96   int grenphase;
97   float grenamount;
98   float aimamount;
99   float speedmult;
100   float pathsize;
101 
102   int pathnum;
103   int oldpathnum;
104   int oldoldpathnum;
105   int oldoldoldpathnum;
106   XYZ pathtarget;
107   int whichblockx;
108   int whichblocky;
109 
110   bool dead;
111 
112   XYZ averageloc;
113   XYZ oldaverageloc;
114 
115   float lastdistancevictim;
116 
117   bool firstlongdead;
118   float longdead;
119 
120   Joint *bjoint1, *bjoint2;
121   float bleeding;
122   float bleeddelay;
123 
124   float attacktarget;
125   int attackframe;
126   int killtarget;
127   bool killtargetvisible;
128 
129   float oldhealth;
130   float health;
131   float maxhealth;
132   int reloads[10];
133   bool running;
134   bool onpath;
135   bool litup;
136   Weapon weapon;
137 
138   void FindRotationGun(XYZ start, XYZ target);
139 
140   int DrawSkeleton(int who);
141   void DoStuff(int who);
142   void DoAnimations(int who);
143   void DoAnimationslite(int who);
144   HitStruct BulletCollideWithPlayer(int who, XYZ start, XYZ end);
145 };
146 
147 class Costume {
148 public:
149   float headcolor[3];
150   float handcolor[3];
151   float footcolor[3];
152   float upperarmcolor[3];
153   float lowerarmcolor[3];
154   float upperlegcolor[3];
155   float lowerlegcolor[3];
156   float abdomencolor[3];
157   float chestcolor[3];
158 };
159 
160 ///real human player
161 class Player : public Person {
162   void setTackle();
163 };
164 
165 #endif
166