void CL_CGVM_Init(void)
{
- cgvm_mempool = Mem_AllocPool("CGVM");
+ cgvm_mempool = Mem_AllocPool("CGVM", 0, NULL);
+}
+
+void CL_CGVM_Shutdown(void)
+{
+ Mem_FreePool (&cgvm_mempool);
}
void CL_CGVM_Clear(void)
short CGVM_MSG_ReadShort(void)
{
- int num;
+ short num;
num = CGVM_MSG_ReadByte() | (CGVM_MSG_ReadByte() << 8);
return num;
}
void CGVM_Draw_Light(const cgdrawlight_t *l)
{
- CL_AllocDlight(NULL, (float *) l->origin, 1, l->light[0], l->light[1], l->light[2], 0, 0);
+ matrix4x4_t matrix;
+ Matrix4x4_CreateTranslate(&matrix, l->origin[0], l->origin[1], l->origin[2]);
+ CL_AllocDlight(NULL, &matrix, l->radius, l->color[0], l->color[1], l->color[2], 0, 0, 0, -1, true, 1, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
void *CGVM_Malloc(const int size)
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)
{
- float frac;
- vec3_t start2, end2, middle;
+ trace_t trace;
// FIXME: do tracing agains network entities and physentities here
- // placeholder world only code assuming 0 size
- middle[0] = (worldmins[0] + worldmaxs[0]) * 0.5f;
- middle[1] = (worldmins[1] + worldmaxs[1]) * 0.5f;
- middle[2] = (worldmins[2] + worldmaxs[2]) * 0.5f;
- VectorAdd(start, middle, start2);
- VectorAdd(end, middle, end2);
- frac = CL_TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, 0, true, NULL);
- VectorSubtract(impactpos, middle, impactpos);
+ trace = CL_TraceBox(start, vec3_origin, vec3_origin, end, true, NULL, SUPERCONTENTS_SOLID, false);
+ VectorCopy(trace.endpos, impactpos);
+ VectorCopy(trace.plane.normal, impactnormal);
*impactentnum = -1;
- return frac;
+ return trace.fraction;
}
char *CGVM_GetCvarString(const char *name)