-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
136 lines (116 loc) · 3.39 KB
/
player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// -----------------------------------------------------------------
// Learning Team B
// Members:
// Adam LeMmon
// Faith Satterthwaite
// Tom Fletcher
// Justin Ball
// CS 4280 – 11:30 am
// Final Project
// Dr. Rague
// Due: 12/06/12
// Version: 2.4
// -----------------------------------------------------------------
// We made five major improvements to this game
// 1) New controls
// 2) Enemy attack
// 3) HUD (heads up display)
// 4) Enemy health bars
// 5) New Weapon
// -----------------------------------------------------------------
#ifndef __PLAYER_H
#define __PLAYER_H
/*
PLAYER.H
The CPlayer class
OpenGL Game Programming
Author: Kevin Hawkins
Date: 3/30/2001
Description:
*/
#include <typeinfo.h>
// Phase 19 - Uncomment the following
#include "DirectXAudio.h"
// Phase 15 - Begin
// Uncomment following
#include "sod.h"
#include "ogro.h"
// Phase 15 - End
// Phase 16 - Uncomment
#include "rocket.h"
#include "camera.h"
#include "object.h"
#include "terrain.h"
///// -- Adam
#define MAX_ENEMIES 10
///// -- Adam
class CPlayer : public CObject
{
private:
CCamera *camera;
CTerrain *terrain;
// Phase 19 - Uncomment the following
CDirectXAudio *audioSys;
protected:
// Phase 14 - Take out until enemies are introduced
// Phase 15 - Uncomment because enemies exist now
void OnPrepare()
{
if (camera)
{
position = camera->position; // the player stays with the camera
direction = camera->yaw;
pitch = camera->pitch;
}
}
public:
float direction; // direction player is facing (same as camera)
float pitch; // pitch of player's lookAt vector
///// -- Adam
int hp;
float timer; // used for the rate of fire for the secondary weapon
bool fireWeapon;// used for the rate of fire for the secondary weapon
CEnemy *sod[MAX_ENEMIES], *ogro[MAX_ENEMIES];
int sodIndex, ogroIndex, ammo;
float recoveryTime;
///// -- Adam
float stamina;//TOM
int maxStam;//TOM
/*****************************Faith Satterthwaite 11/27/2012***************************/
void OnCollision(CObject *collisionObject);
/**************************************************************************************/
CPlayer()
{
size = 7.0f; camera = NULL; terrain = NULL;
// Phase 14 - Take these out for now
// Phase 19 - Uncomment the following
audioSys = NULL;
///// -- Adam
hp = 100;
timer = 0;
fireWeapon = false;//start off not shooting
sodIndex = ogroIndex = ammo = 0;
recoveryTime = 0.0;
///// -- Adam
stamina=100;//TOM
maxStam=100;//TOM
}
~CPlayer() {}
void SetCamera(CCamera *c) { camera = c; }
void DetachCamera() { camera = NULL; }
void SetTerrain(CTerrain *t) { terrain = t; }
// Phase 14 - Take out until Rocket is introduced
// Phase 16 - Uncomment
void FireWeapon();
///// -- Adam
void FireWeapon2();
void setSod(CEnemy* s);
void setOgro(CEnemy* o);
void killSod(CEnemy* s);
void killOgro(CEnemy* o);
///// -- Adam
// Phase 14 - Take out until AudioSystem in introduced
// Phase 19 - Uncomment the following
void SetAudioSystem(CDirectXAudio *aSys) { audioSys = aSys; }
};
#endif