aboutsummaryrefslogtreecommitdiff
path: root/src/parsec/include/obj_ctrl.h
blob: 42879796435f3696cd0384f48eff918dae98d43e (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
/*
 * PARSEC HEADER: obj_ctrl.h
 */

#ifndef _OBJ_CTRL_H_
#define _OBJ_CTRL_H_

#ifdef PARSEC_SERVER

	#undef CreateObject		
	#undef FreeObjList			
	#undef KillAllObjects		
	#undef FetchObject			
	#undef FetchFirstShip		
	#undef FetchFirstLaser		
	#undef FetchFirstMissile	
	#undef FetchFirstExtra		
	#undef FetchFirstCustom	
	#undef KillClassInstances

#endif // PARSEC_SERVER


// external functions

void			InitObjCtrl();

void			FreeObjectMem( GenObject *objectpo );
int 			FreeObjList( GenObject *listpo );
int 			FreeObjects();

GenObject*		CreateObject( int objclass, const Xmatrx startmatrx );
GenObject*		SummonObject( int objclass, const Xmatrx startmatrx );
GenObject*		SummonObjectFromType( int objtype, const Xmatrx startmatrx );
CustomObject*	CreateVirtualObject( dword objtypeid );

GenObject*		FetchSpecificObject( dword objno, GenObject *listpo );
GenObject*		FetchSpecificHostObject( dword hostobjno, GenObject *listpo );
GenObject*		FetchObject( dword objno );
GenObject*		FetchHostObject( dword hostobjno );

int 			KillSpecificObject( dword objno, GenObject *listpo );
int 			KillSpecificHostObject( dword hostobjno, GenObject *listpo );
int 			KillObject( dword objno );
int				KillHostObject( dword hostobjno );
int 			KillClassInstances( int objclass );

void			OBJ_CorrectObjectInstance( GenObject *dstobj, GenObject *srcobj );
void			OBJ_SwitchObjectLod( GenObject *obj, dword lod );
void			OBJ_AutoSelectObjectLod( GenObject *obj );

void			ScanActiveObjects( const Camera camera );


// return pointer to first ship in ship-objects list --------------------------
//
inline ShipObject *FetchShipListHead()
{
	// fetch head of ship-objects list
	ShipObject *head = (ShipObject *) PShipObjects->NextObj;

	return head;
}


// return pointer to first "real" ship in ship-objects list -------------------
//
inline ShipObject *FetchFirstShip()
{
	// fetch head of ship-objects list
	ShipObject *head = (ShipObject *) PShipObjects->NextObj;

#ifdef PARSEC_CLIENT

	// if local ship is head of list return next object
	if ( head == MyShip ) {
		head = (ShipObject *) head->NextObj;
	}

#endif // PARSEC_CLIENT

	return head;
}


// return pointer to first laser in laser-objects list ------------------------
//
inline LaserObject *FetchFirstLaser()
{
	// fetch head of laser-objects list
	LaserObject *head = (LaserObject *) LaserObjects->NextObj;

	return head;
}


// return pointer to first missile in missile-objects list --------------------
//
inline MissileObject *FetchFirstMissile()
{
	// fetch head of missile-objects list
	MissileObject *head = (MissileObject *) MisslObjects->NextObj;

	return head;
}


// return pointer to first extra in extra-objects list ------------------------
//
inline ExtraObject *FetchFirstExtra()
{
	// fetch head of extra-objects list
	ExtraObject *head = (ExtraObject *) ExtraObjects->NextObj;

	return head;
}


// return pointer to first custom object in custom-objects list ---------------
//
inline CustomObject *FetchFirstCustom()
{
	// fetch head of custom-objects list
	CustomObject *head = (CustomObject *) CustmObjects->NextObj;

	return head;
}


#endif // _OBJ_CTRL_H_