]> icculus.org git repositories - divverent/darkplaces.git/blob - cgame_api.h
now checks if worldmodel is NULL again, some comment cleanups and clarifications
[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 light[3];
28 }
29 cgdrawlight_t;
30
31 typedef struct cgphysentity_s
32 {
33         int entnum; // reported by tracing, for use by cgame code
34         int padding; // unused
35         float mins[3];
36         float maxs[3];
37 }
38 cgphysentity_t;
39
40 // engine functions the CG code can call
41 void CGVM_RegisterNetworkCode(const unsigned char num, void (*netcode)(unsigned char num));
42 unsigned char CGVM_MSG_ReadByte(void);
43 short CGVM_MSG_ReadShort(void);
44 int CGVM_MSG_ReadLong(void);
45 float CGVM_MSG_ReadFloat(void);
46 float CGVM_MSG_ReadCoord(void);
47 float CGVM_MSG_ReadAngle(void);
48 float CGVM_MSG_ReadPreciseAngle(void);
49 void CGVM_Draw_Entity(const cgdrawentity_t *e);
50 void CGVM_Draw_Light(const cgdrawlight_t *l);
51 void *CGVM_Malloc(const int size);
52 void CGVM_Free(void *mem);
53 float CGVM_RandomRange(const float r1, const float r2);
54 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);
55 float CGVM_GetCvarFloat(const char *name);
56 int CGVM_GetCvarInt(const char *name);
57 char *CGVM_GetCvarString(const char *name);
58 double CGVM_Time(void);
59 int CGVM_Model(const char *name);
60 void CGVM_Stain(const float *origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
61 // more will be added
62
63 // engine called functions
64 void CG_Init(void);
65 void CG_Frame(double time);
66 // more might be added
67
68 #endif
69