aboutsummaryrefslogtreecommitdiff
path: root/src/parsec_server/include/g_player.h
blob: 870ce80adcd8beee4620872fc691c6e84272c8ba (plain)
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
137
138
139
140
141
142
143
144
145
146
147
148
// class holding all GAME specific player information -------------------------
// 
// helix energy properties
#define HELIX_LIFETIME                          1500
#define HELIX_SPEED                             0x10000
#define MIN_HELIX_ENERGY                        10
#define HELIX_ENERGY_CONSUMPTION			2
// properties of spreadfire particles       Also move this someday
#define SPREADFIRE_PARTICLE_COLOR	              174
#define SPREADFIRE_BM_INDX	                     BM_FIREBALL1
#define SPREADFIRE_REF_Z                         20.0f //400.0f
// lightning energy properties
#define MIN_LIGHTNING_ENERGY				10
#define LIGHTNING_ENERGY_CONSUMPTION		7000          // 65536 = 1.0

class G_Player
{
	//NOTE: this class mirrors all information/actions of a single client ( in the client code )

protected:

	int			m_nKills;				// # of ships this player killed
	int			m_nDeaths;				// # of deaths for this player
	int			m_nPoints;				// # of points for this player
	int			m_nLastUnjoinFlag;		// the last unjoin flag
	int			m_nLastKiller;			// the playerid of last killer

	refframe_t	m_FireDisableFrames;	// refframes gun-fire is disabled                  ( = G_GLOBAL::FireDisable	in old CLIENT code )
	refframe_t  m_MissileDisableFrames;	// refframes missile-fire is disabled              ( = G_GLOBAL::MissileDisable	in old CLIENT code )
    refframe_t	helix_refframes_delta;
	int 		m_CurGun;				// currently selected gun outlet
	int 		m_CurLauncher;			// currently selected missile outlet

	int			m_nClientID;

	E_SimPlayerInfo* m_pSimPlayerInfo;
protected:

	// create laser originating from player ship
	void _OBJ_ShootLaser();

    //Activate Helix Cannon
    void _WFX_ActivateHelix();
    	
    //Activate lightning gun
    void _WFX_ActivateLightning();
    
    //Activate Photon cannon
    void _WFX_ActivatePhoton();
    
    // create a dumb missle originating from player ship
	void _OBJ_LaunchMissile();
	
	// create a homing missle originating from player ship
	void _OBJ_LaunchHomingMissile( dword launcher, dword targetid );

	void _OBJ_LaunchMine();

	void _OBJ_LaunchSwarm( dword targetid );


public:
	G_Player()
	{
		Reset();
	}

	// reset all fields to defaults ( not connected )
	void Reset();

	// set the player status to connected
	void Connect( int nClientID );

	// set the player status to disconnected
	void Disconnect();

	// user fired laser 
	void FireLaser();
    
    // user fired Helix cannon
    void FireHelix();
    int  _WFX_MaintainHelix( ShipObject *shippo, int playerid );
    
    //Deactivate Helix Cannon
    void _WFX_DeactivateHelix();
    
    // user fired Lightning cannon
    void FireLightning();
    void WFX_MaintainLightning( ShipObject *shippo);
    
    //Deactivate lightning gun
    void _WFX_DeactivateLightning();
    
    // user fired Photon cannon
    void FirePhoton();
    
    //Deactivate Photon Cannon
    void _WFX_DeactivatePhoton();

	// user launched a dumb missle
	void LaunchMissile();
	
	// user launched a homping missle
	void LaunchHomingMissile(dword launcher, dword targetid);

	// user launched a mine
	void LaunchMine();

	// user launched a swarm
	void LaunchSwarm(dword targetid);

	// user fired emp
	void FireEMP(byte Upgradelevel);

	// record a kill
	void RecordKill();

	// record a death
	void RecordDeath( int nClientID_Killer );

	// reset any death info
	void ResetDeathInfo();

	// reset all game variables
	void ResetGameVars();

	// maintain weapon firing delays
	void MaintainWeaponDelays();

	// return the ship object assigned to the player
	ShipObject* GetShipObject();

	// return # of kills for the player
	int GetKills() { return m_nKills; }

	// return the last unjoin flag
	int GetLastUnjoinFlag() { return m_nLastUnjoinFlag; }

	// return the player id that last killed this player
	int GetLastKiller() { return m_nLastKiller; }
    
    //weapons cleanup
    void WFX_EnsurePhotonInactive( ShipObject *shippo );
    void WFX_EnsureHelixInactive( ShipObject *shippo );
    void WFX_EnsureLightningInactive( ShipObject *shippo );
    void WFX_EnsureParticleWeaponsInactive( ShipObject *shippo );
};