From 4deebba5eeb62c24a95d277cf469139e42a4fd40 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 14 Feb 2014 13:19:00 +0000 Subject: [PATCH] and fix dedicated servers again... git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4612 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_ents.c | 90 +++++++++++++++++++++++++++++++++++++++ engine/common/q1bsp.c | 94 ----------------------------------------- 2 files changed, 90 insertions(+), 94 deletions(-) diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index d694ed88d..90fcad0bf 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -2131,6 +2131,96 @@ void CLQ1_DrawLine(shader_t *shader, vec3_t v1, vec3_t v2, float r, float g, flo t->numidx = cl_numstrisidx - t->firstidx; cl_numstrisvert += 2; } +#include "shader.h" +void CL_AddOrientedCube(float *normal, float dist, float r, float g, float b, qboolean enqueue) +{ + scenetris_t *t; + if (!enqueue) + cl_numstris = 0; + + if (cl_numstris == cl_maxstris) + { + cl_maxstris+=8; + cl_stris = BZ_Realloc(cl_stris, sizeof(*cl_stris)*cl_maxstris); + } + t = &cl_stris[cl_numstris++]; + t->shader = R_RegisterShader("testplane", SUF_NONE, "{\n{\nmap $whiteimage\nrgbgen vertex\nalphagen vertex\nblendfunc add\nnodepth\n}\n}\n"); + t->firstidx = cl_numstrisidx; + t->firstvert = cl_numstrisvert; + t->numvert = 0; + t->numidx = 0; + + if (cl_numstrisidx+6 > cl_maxstrisidx) + { + cl_maxstrisidx=cl_numstrisidx+6 + 64; + cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx); + } + if (cl_numstrisvert+4 > cl_maxstrisvert) + { + cl_maxstrisvert+=64; + cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert); + cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert); + cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert); + } + + { + vec3_t tmp = {0,0.04,0.96}; + vec3_t right, forward; + CrossProduct(normal, tmp, right); + VectorNormalize(right); + CrossProduct(normal, right, forward); + VectorNormalize(forward); + + VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], 8192, right, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], 8192, forward, cl_strisvertv[cl_numstrisvert]); + Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); + cl_numstrisvert++; + + VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], 8192, right, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], -8192, forward, cl_strisvertv[cl_numstrisvert]); + Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); + cl_numstrisvert++; + + VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], -8192, right, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], -8192, forward, cl_strisvertv[cl_numstrisvert]); + Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); + cl_numstrisvert++; + + VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], -8192, right, cl_strisvertv[cl_numstrisvert]); + VectorMA(cl_strisvertv[cl_numstrisvert], 8192, forward, cl_strisvertv[cl_numstrisvert]); + Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); + cl_numstrisvert++; + } + + + + + /*build the triangles*/ + cl_strisidx[cl_numstrisidx++] = t->numvert + 0; + cl_strisidx[cl_numstrisidx++] = t->numvert + 1; + cl_strisidx[cl_numstrisidx++] = t->numvert + 2; + + cl_strisidx[cl_numstrisidx++] = t->numvert + 0; + cl_strisidx[cl_numstrisidx++] = t->numvert + 2; + cl_strisidx[cl_numstrisidx++] = t->numvert + 3; + + + t->numidx = cl_numstrisidx - t->firstidx; + t->numvert += 4; + + if (!enqueue) + { +// int oldents = cl_numvisedicts; +// cl_numvisedicts = 0; + BE_DrawWorld(false, NULL); + cl_numstris = 0; +// cl_numvisedicts = oldents; + } +} void CLQ1_AddOrientedCube(shader_t *shader, vec3_t mins, vec3_t maxs, float *matrix, float r, float g, float b, float a) { int v; diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 1e29f8c1b..bcd4a5f6d 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -386,100 +386,6 @@ struct traceinfo_s vec3_t end; }; -#if 1 -#include "shader.h" -void BE_GenPolyBatches(batch_t **batches); -void TestDrawPlane(float *normal, float dist, float r, float g, float b, qboolean enqueue) -{ - scenetris_t *t; - if (!enqueue) - cl_numstris = 0; - - if (cl_numstris == cl_maxstris) - { - cl_maxstris+=8; - cl_stris = BZ_Realloc(cl_stris, sizeof(*cl_stris)*cl_maxstris); - } - t = &cl_stris[cl_numstris++]; - t->shader = R_RegisterShader("testplane", SUF_NONE, "{\n{\nmap $whiteimage\nrgbgen vertex\nalphagen vertex\nblendfunc add\nnodepth\n}\n}\n"); - t->firstidx = cl_numstrisidx; - t->firstvert = cl_numstrisvert; - t->numvert = 0; - t->numidx = 0; - - if (cl_numstrisidx+6 > cl_maxstrisidx) - { - cl_maxstrisidx=cl_numstrisidx+6 + 64; - cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx); - } - if (cl_numstrisvert+4 > cl_maxstrisvert) - { - cl_maxstrisvert+=64; - cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert); - cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert); - cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert); - } - - { - vec3_t tmp = {0,0.04,0.96}; - vec3_t right, forward; - CrossProduct(normal, tmp, right); - VectorNormalize(right); - CrossProduct(normal, right, forward); - VectorNormalize(forward); - - VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], 8192, right, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], 8192, forward, cl_strisvertv[cl_numstrisvert]); - Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); - cl_numstrisvert++; - - VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], 8192, right, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], -8192, forward, cl_strisvertv[cl_numstrisvert]); - Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); - cl_numstrisvert++; - - VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], -8192, right, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], -8192, forward, cl_strisvertv[cl_numstrisvert]); - Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); - cl_numstrisvert++; - - VectorScale( normal, dist, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], -8192, right, cl_strisvertv[cl_numstrisvert]); - VectorMA(cl_strisvertv[cl_numstrisvert], 8192, forward, cl_strisvertv[cl_numstrisvert]); - Vector4Set(cl_strisvertc[cl_numstrisvert], r, g, b, 0.2); - cl_numstrisvert++; - } - - - - - /*build the triangles*/ - cl_strisidx[cl_numstrisidx++] = t->numvert + 0; - cl_strisidx[cl_numstrisidx++] = t->numvert + 1; - cl_strisidx[cl_numstrisidx++] = t->numvert + 2; - - cl_strisidx[cl_numstrisidx++] = t->numvert + 0; - cl_strisidx[cl_numstrisidx++] = t->numvert + 2; - cl_strisidx[cl_numstrisidx++] = t->numvert + 3; - - - t->numidx = cl_numstrisidx - t->firstidx; - t->numvert += 4; - - if (!enqueue) - { -// int oldents = cl_numvisedicts; -// cl_numvisedicts = 0; - BE_DrawWorld(false, NULL); - cl_numstris = 0; -// cl_numvisedicts = oldents; - } -} -#endif - static void Q1BSP_ClipToBrushes(struct traceinfo_s *traceinfo, mbrush_t *brush) { struct mbrushplane_s *plane;