altEngine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
player.h
Go to the documentation of this file.
1 #include "include.h"
2 
3 #ifndef PLAYER_H
4 #define PLAYER_H
5 
6 #define WEAPON_NONE 0
7 #define WEAPON_GAUNTLET 1
8 #define WEAPON_MACHINEGUN 2
9 #define WEAPON_SHOTGUN 4
10 #define WEAPON_GRENADE 8
11 #define WEAPON_ROCKET 16
12 #define WEAPON_RAILGUN 32
13 #define WEAPON_LIGHTNING 64
14 #define WEAPON_PLASMA 128
15 
16 
17 //multiple types exist because I forgot above code existed D:
18 typedef enum {
28 } weapon_t;
29 
30 typedef enum {
32  BOT_ALERT, // 1
33  BOT_ATTACK, // 2
36  BOT_DEAD // 5
37 } bot_state_t;
38 
39 
40 
41 
42 // Seems like a good idea to handle animations
43 typedef enum {
51 
52 
53 typedef struct
54 {
55  int kills;
56  int deaths;
57  int hits;
58  int shots;
63 } stats_t;
64 
65 
66 typedef enum
67 {
70  BOT,
74 } playertype_t;
75 
76 class Player
77 {
78 public:
79  Player(Entity *entity, Graphics &gfx, Audio &audio, int model, team_t team, entity_type_t ent_type, vector<Model *> &model_table);
80  ~Player();
82 
83 
84  void respawn();
85  void reset();
86  void kill();
87  void render_weapon(Graphics &gfx);
88  void change_weapon_up();
89  void change_weapon_down();
90  void best_weapon();
91 
92  void handle_bot(vector<Entity *> &entity_list, int self);
93  int bot_search_for_items(vector<Entity *> &entity_list, int self);
94  void avoid_walls(Bsp &map);
95 
96 
97  int FindLookAt(vec3 &cameraOrigin, vec3 &cameraDir, vec3 *points, int numPoints);
98  float DistanceToLine(vec3 &direction, vec3 &origin, vec3 &point);
99 
100  char model_name[128];
102 
104 
105  int health;
106 
107  unsigned short int armor;
108  unsigned char weapon_flags;
109 
110  unsigned short int current_weapon;
111  unsigned short int last_weapon;
112  unsigned short int ammo_rockets;
113  unsigned short int ammo_grenades;
114  unsigned short int ammo_slugs;
115  unsigned short int ammo_shells;
116  unsigned short int ammo_bullets;
117  unsigned short int ammo_lightning;
118  unsigned short int ammo_plasma;
119  unsigned short int ammo_bfg;
124 
125  unsigned short int reload_timer;
126  unsigned short int fall_timer;
127  unsigned short int drown_timer;
128  unsigned short int flight_timer;
129  unsigned short int regen_timer;
130  unsigned short int haste_timer;
131  unsigned short int quad_timer;
132  unsigned short int click_timer;
133  unsigned short int invisibility_timer;
134  unsigned short int jumppad_timer;
135  unsigned short int teleport_timer; // prevent teleporting out and back rapidly
136  unsigned short int excellent_timer;
137  unsigned short int impressive_count;
138  unsigned short int impressive_award_timer;
139  unsigned short int excellent_award_timer;
140  unsigned short int gauntlet_award_timer;
141  unsigned short int pain_timer;
142  unsigned short int alert_timer;
143  unsigned short int idle_timer;
144  unsigned short int dead_timer;
145  unsigned short int alive_timer;
146 
147 
148 
149  unsigned int current_light; // debugging light sources, selected same as weapon
150  unsigned int current_face; // debugging light sources, selected same as weapon
151 
152  unsigned short int flash_gauntlet;
153  unsigned short int flash_machinegun;
154  unsigned short int flash_shotgun;
155  unsigned short int flash_grenade;
156  unsigned short int flash_rocket;
157  unsigned short int flash_railgun;
158  unsigned short int flash_lightning;
159  unsigned short int flash_plasma;
160 
161 
162  float accel;
163  float air_accel;
164  float max_speed;
166  float air_control;
167 
168 
171 
172 
173 
174  bool godmode;
175  bool local;
177  bool falling;
178 
179 
181 
182  char name[128];
184  bool spawned;
185 
189  int get_item;
190  char ignore[1024];
191 
192  float zoom_level;
194 
203 private:
204 };
205 
206 #endif