X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cgamevm.c;h=721c339212d61246b8258e6f4c2ffceca0bea580;hb=fbdc996453e162bf65f888b8b0accf4e531589fb;hp=d6caeb9a1b6a20ce8c62c93b872114e512922b36;hpb=54c9d0986ce2000adcf80d200b18d22db4f1fd93;p=xonotic%2Fdarkplaces.git diff --git a/cgamevm.c b/cgamevm.c index d6caeb9a..721c3392 100644 --- a/cgamevm.c +++ b/cgamevm.c @@ -1,6 +1,7 @@ #include "quakedef.h" #include "cgame_api.h" +#include "cl_collision.h" #define CGVM_RENDERENTITIES 1024 @@ -11,7 +12,7 @@ static mempool_t *cgvm_mempool; static void (*cgvm_networkcode[256])(unsigned char num); -static byte *cgvm_netbuffer; +static qbyte *cgvm_netbuffer; static int cgvm_netbufferlength; static int cgvm_netbufferpos; @@ -46,7 +47,7 @@ void CL_CGVM_Start(void) CG_Init(); // API call } -void CL_CGVM_ParseNetwork(byte *netbuffer, int length) +void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length) { int num; cgvm_netbuffer = netbuffer; @@ -56,7 +57,7 @@ void CL_CGVM_ParseNetwork(byte *netbuffer, int length) { num = CGVM_MSG_ReadByte(); if (cgvm_networkcode[num]) - cgvm_networkcode[num]((byte)num); + cgvm_networkcode[num]((qbyte)num); else Host_Error("CL_CGVM_ParseNetwork: unregistered network code %i", num); } @@ -129,7 +130,7 @@ void CGVM_Draw_Entity(const cgdrawentity_t *e) return; if (cgvm_renderentity >= CGVM_RENDERENTITIES - || r_refdef.numentities >= MAX_VISEDICTS) + || r_refdef.numentities >= r_refdef.maxentities) return; r = cgvm_renderentities + cgvm_renderentity; @@ -142,14 +143,7 @@ void CGVM_Draw_Entity(const cgdrawentity_t *e) Con_Printf("CGVM_Draw_Entity: invalid model index %i\n", e->model); return; } - r->model = cgvm_model[e->model]; //Mod_ForName(e->model, false, false, false); - /* - if (!r->model) - { - Con_Printf("CGVM_Draw_Entity: unable to find model \"%s\""); - return; - } - */ + r->model = cgvm_model[e->model]; r->frame = e->frame2; // FIXME: support colormapping? @@ -173,7 +167,9 @@ void CGVM_Draw_Entity(const cgdrawentity_t *e) 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, 0, true, 1); } void *CGVM_Malloc(const int size) @@ -202,10 +198,8 @@ float CGVM_TracePhysics(const float *start, const float *end, const float *world middle[2] = (worldmins[2] + worldmaxs[2]) * 0.5f; VectorAdd(start, middle, start2); VectorAdd(end, middle, end2); - frac = TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, 0, true); + frac = CL_TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, true, NULL, SUPERCONTENTS_SOLID); VectorSubtract(impactpos, middle, impactpos); - //VectorCopy(end, impactpos); - //VectorClear(impactnormal); *impactentnum = -1; return frac; } @@ -267,3 +261,10 @@ int CGVM_Model(const char *name) cgvm_model[i] = model; return i; } + +void CGVM_Stain(const float *origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2) +{ + if (cl_stainmaps.integer) + R_Stain((float *)origin, radius, cr1, cg1, cb1, ca1, cr2, cg2, cb2, ca2); +} +