aboutsummaryrefslogtreecommitdiff
path: root/src/parsec_server/include/e_colldet.h
blob: 9a9bf4ebc6a8178f0f6a5b7f691524d045d50248 (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
/*
* PARSEC HEADER: G_CollDet.h
*/
#include "g_emp.h"
#ifndef _G_COLLDET_H_
#define _G_COLLDET_H_

// class handling the collision detection -------------------------------------
//
class G_CollDet
{
protected:

	ShipObject*	cur_ship;
	Vertex3		obj_pos;
	Vertex3		test_pos;
	Vertex3		prev_pos;
	geomv_t		bd_sphere;
	geomv_t		bd_sphere2;
	int			test_shield;

protected:

	// collision detection helper function
	int _CheckShipProjectileDisjoint();

  
	// ship collided with laser
	void _CollisionResponse_LaserShip( LaserObject *curlaser );

	// check whether any ship is hit by laser beam
	void _CheckShipLaserCollision();

	// check if ship collected extra
	void _CheckShipExtraCollision();

	// check if ship hit by emp
	void _CheckShipEmpCollision();

	// ship collided with EMP
	void _CollisionResponse_EmpShip( Emp *curemp );

    //Ship collided with missile
    void _CheckShipMissileCollision();
    //response definitions
    void _CollisionResponse_MissileShip( MissileObject *curmissile );
    void _CollisionResponse_MineShip( Mine1Obj *curmine );
    void OBJ_ShipHelixDamage( ShipObject *shippo, int owner );
    void OBJ_ShipLightningDamage( ShipObject *shippo, int owner );
    void OBJ_ShipPhotonDamage( ShipObject *shippo, int owner );
    
	G_CollDet()	{}
	~G_CollDet()	{}

public:
	// SINGLETON pattern
	static G_CollDet* GetGameCollDet()
	{
		static G_CollDet _TheGameCollDet;
		return &_TheGameCollDet;
	}

	// perform collision detection tests
	void OBJ_CheckCollisions();
    void LinearParticleCollision( linear_pcluster_s *cluster, int pid );
    void CheckEnergyField( pcluster_s *cluster );
    void OBJ_ShipSwarmDamage( ShipObject *shippo, int owner );
    int CheckLightningParticleShipCollision( Vertex3& particlepos, int owner );
    //Particle Collisions
    int PRT_ParticleInBoundingSphere( ShipObject *shippo, Vertex3& point );

};

#endif // _G_COLLDET_H_