]> icculus.org git repositories - divverent/darkplaces.git/blob - cgame_api.h
made some things static
[divverent/darkplaces.git] / cgame_api.h
1
2 #ifndef CGAME_API_H
3 #define CGAME_API_H
4
5 // the CG state is reset quite harshly each time the client
6 // connects/disconnects (to enforce the idea of cgame dying between levels),
7 // and the Pre/PostNetworkFrame functions are only called while connected
8 // (this does mean that all memory is freed, Init will be called again, etc)
9
10 typedef struct cgdrawentity_s
11 {
12         float origin[3];
13         float angles[3];
14         float alpha;
15         float scale;
16         int model; // index gotten from engine using CGVM_Model
17         int frame1;
18         int frame2;
19         float framelerp;
20         int skinnum;
21 }
22 cgdrawentity_t;
23
24 typedef struct cgdrawlight_s
25 {
26         float origin[3];
27         float color[3];
28         float radius;
29 }
30 cgdrawlight_t;
31
32 typedef struct cgphysentity_s
33 {
34         int entnum; // reported by tracing, for use by cgame code
35         int padding; // unused
36         float mins[3];
37         float maxs[3];
38 }
39 cgphysentity_t;
40
41 // engine functions the CG code can call
42 void CGVM_RegisterNetworkCode(const unsigned char num, void (*netcode)(unsigned char num));
43 unsigned char CGVM_MSG_ReadByte(void);
44 short CGVM_MSG_ReadShort(void);
45 int CGVM_MSG_ReadLong(void);
46 float CGVM_MSG_ReadFloat(void);
47 float CGVM_MSG_ReadCoord(void);
48 float CGVM_MSG_ReadAngle(void);
49 float CGVM_MSG_ReadPreciseAngle(void);
50 void CGVM_Draw_Entity(const cgdrawentity_t *e);
51 void CGVM_Draw_Light(const cgdrawlight_t *l);
52 void *CGVM_Malloc(const int size);
53 void CGVM_Free(void *mem);
54 float CGVM_RandomRange(const float r1, const float r2);
55 float CGVM_TracePhysics(const float *start, const float *end, const float *worldmins, const float *worldmaxs, const float *entitymins, const float *entitymaxs, const cgphysentity_t *physentities, const int numphysentities, float *impactpos, float *impactnormal, int *impactentnum);
56 float CGVM_GetCvarFloat(const char *name);
57 int CGVM_GetCvarInt(const char *name);
58 char *CGVM_GetCvarString(const char *name);
59 double CGVM_Time(void);
60 int CGVM_Model(const char *name);
61 void CGVM_Stain(const float *origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
62 // more will be added
63
64 // engine called functions
65 void CG_Init(void);
66 void CG_Frame(double time);
67 // more might be added
68
69 #endif
70