From 95cfa0cfac55a065c1a4ce67e5b1cded0de4d5fe Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 8 Dec 2014 21:18:32 +0000 Subject: [PATCH] fix ffov, for now. fix server crash(es). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4798 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/pr_csqc.c | 34 ++++++++++++++++++++++++++++++---- engine/common/world.h | 2 +- engine/gl/gl_rmain.c | 17 +++++++++-------- engine/server/pr_cmds.c | 11 ++++++----- engine/server/sv_move.c | 8 ++++---- engine/server/sv_sql.c | 4 ++-- engine/server/sv_user.c | 2 +- 7 files changed, 53 insertions(+), 25 deletions(-) diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 163127315..a26dd2941 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -1079,6 +1079,13 @@ static void QCBUILTIN PF_R_AddEntityMask(pubprogfuncs_t *prinst, struct globalva } } +//enum {vb_vertexcoord, vb_texcoord, vb_rgba, vb_normal, vb_sdir, vb_tdir, vb_indexes, vb_rgb, vb_alpha}; +//vboidx = vbuff_create(numverts, numidx, flags) +//vbuff_updateptr(vboidx, datatype, ptr, firstvert, numverts) +//vbuff_updateone(vboidx, datatype, index, __variant data) +//vbuff_render(vboidx, shaderid, uniforms, uniformssize) +//vbuff_delete(vboidx), vboidx=0 + static shader_t *csqc_poly_shader; static int csqc_poly_startvert; static int csqc_poly_startidx; @@ -1780,8 +1787,27 @@ static void QCBUILTIN PF_cs_SetSize (pubprogfuncs_t *prinst, struct globalvars_s World_LinkEdict (w, (wedict_t*)e, false); } -static void cs_settracevars(trace_t *tr, struct globalvars_s *pr_globals) +static void cs_settracevars(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, trace_t *tr) { +/* + world_t *w = prinst->parms->user; + *w->g.trace_allsolid = tr->allsolid; + *w->g.trace_startsolid = tr->startsolid; + *w->g.trace_fraction = tr->fraction; + *w->g.trace_inwater = tr->inwater; + *w->g.trace_inopen = tr->inopen; + VectorCopy (tr->endpos, w->g.trace_endpos); + VectorCopy (tr->plane.normal, w->g.trace_plane_normal); + *w->g.trace_plane_dist = tr->plane.dist; + if (w->g.trace_surfaceflags) + *w->g.trace_surfaceflags = tr->surface?tr->surface->flags:0; + if (w->g.trace_endcontents) + *w->g.trace_endcontents = tr->contents; + if (tr->ent) + *w->g.trace_ent = EDICT_TO_PROG(prinst, (void*)tr->ent); + else + *w->g.trace_ent = EDICT_TO_PROG(prinst, (void*)w->edicts); +*/ *csqcg.trace_allsolid = tr->allsolid; *csqcg.trace_startsolid = tr->startsolid; *csqcg.trace_fraction = tr->fraction; @@ -1829,7 +1855,7 @@ static void QCBUILTIN PF_cs_traceline(pubprogfuncs_t *prinst, struct globalvars_ trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - cs_settracevars(&trace, pr_globals); + cs_settracevars(prinst, pr_globals, &trace); } static void QCBUILTIN PF_cs_tracebox(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -1851,7 +1877,7 @@ static void QCBUILTIN PF_cs_tracebox(pubprogfuncs_t *prinst, struct globalvars_s trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - cs_settracevars(&trace, pr_globals); + cs_settracevars(prinst, pr_globals, &trace); } static trace_t CS_Trace_Toss (csqcedict_t *tossent, csqcedict_t *ignore) @@ -1909,7 +1935,7 @@ static void QCBUILTIN PF_cs_tracetoss (pubprogfuncs_t *prinst, struct globalvars trace = CS_Trace_Toss (ent, ignore); - cs_settracevars(&trace, pr_globals); + cs_settracevars(prinst, pr_globals, &trace); } static void QCBUILTIN PF_cs_pointcontents(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) diff --git a/engine/common/world.h b/engine/common/world.h index fe79254b1..850a39b8a 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -285,7 +285,7 @@ void Q2BSP_FindTouchedLeafs(model_t *mod, struct pvscache_s *ent, float *mins, f /*sv_move.c*/ qboolean World_CheckBottom (world_t *world, wedict_t *ent, vec3_t up); -qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis[3], qboolean relink, qboolean noenemy, void (*set_move_trace)(trace_t *trace, struct globalvars_s *pr_globals), struct globalvars_s *set_trace_globs); +qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis[3], qboolean relink, qboolean noenemy, void (*set_move_trace)(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, trace_t *trace), struct globalvars_s *set_trace_globs); qboolean World_MoveToGoal (world_t *world, wedict_t *ent, float dist); qboolean World_GetEntGravityAxis(wedict_t *ent, vec3_t axis[3]); diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 870ec5ff1..9b2ec5b79 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -1358,7 +1358,8 @@ static void R_RenderMotionBlur(void) #endif } -#if 0 +#if 1 +#include "shader.h" /*FIXME: we could use geometry shaders to draw to all 6 faces at once*/ qboolean R_RenderScene_Cubemap(void) { @@ -1431,7 +1432,7 @@ qboolean R_RenderScene_Cubemap(void) // prect.y = (vrect.y * vid.pixelheight)/vid.height; // prect.height = (vrect.height * vid.pixelheight)/vid.height; - if (r_config.texture_non_power_of_two_limited) + if (sh_config.texture_non_power_of_two_pic) { if (prect.width < prect.height) cmapsize = prect.width; @@ -1453,7 +1454,7 @@ qboolean R_RenderScene_Cubemap(void) { if (!TEXVALID(scenepp_postproc_cube)) { - scenepp_postproc_cube = Image_CreateTexture("***fish***", IF_CUBEMAP); + scenepp_postproc_cube = Image_CreateTexture("***fish***", NULL, IF_CUBEMAP|IF_RENDERTARGET|IF_CLAMP|IF_LINEAR); qglGenTextures(1, &scenepp_postproc_cube->num); } @@ -1725,11 +1726,11 @@ void GLR_RenderView (void) time1 = Sys_DoubleTime (); } -// if (!dofbo && !(r_refdef.flags & RDF_NOWORLDMODEL) && R_RenderScene_Cubemap()) -// { -// -// } -// else + if (!dofbo && !(r_refdef.flags & RDF_NOWORLDMODEL) && R_RenderScene_Cubemap()) + { + + } + else { GL_SetShaderState2D(false); diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 772973bc2..8c2b1247f 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -3086,7 +3086,7 @@ static void QCBUILTIN PF_LocalSound(pubprogfuncs_t *prinst, struct globalvars_s #endif }; -static void set_trace_globals(trace_t *trace, struct globalvars_s *pr_globals) +static void set_trace_globals(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, trace_t *trace) { pr_global_struct->trace_allsolid = trace->allsolid; pr_global_struct->trace_startsolid = trace->startsolid; @@ -3157,7 +3157,7 @@ void QCBUILTIN PF_svtraceline (pubprogfuncs_t *prinst, struct globalvars_s *pr_g trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - set_trace_globals(&trace, pr_globals); + set_trace_globals(prinst, pr_globals, &trace); } #ifdef HEXEN2 @@ -3181,7 +3181,7 @@ static void QCBUILTIN PF_traceboxh2 (pubprogfuncs_t *prinst, struct globalvars_s trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - set_trace_globals(&trace, pr_globals); + set_trace_globals(prinst, pr_globals, &trace); } #endif @@ -3205,7 +3205,7 @@ static void QCBUILTIN PF_traceboxdp (pubprogfuncs_t *prinst, struct globalvars_s trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - set_trace_globals(&trace, pr_globals); + set_trace_globals(prinst, pr_globals, &trace); } static void QCBUILTIN PF_TraceToss (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -3221,7 +3221,7 @@ static void QCBUILTIN PF_TraceToss (pubprogfuncs_t *prinst, struct globalvars_s trace = WPhys_Trace_Toss (&sv.world, (wedict_t*)ent, (wedict_t*)ignore); - set_trace_globals(&trace, pr_globals); + set_trace_globals(prinst, pr_globals, &trace); } //============================================================================ @@ -5732,6 +5732,7 @@ void QCBUILTIN PF_sqlreadfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_ else { Con_Printf("Invalid sql request/row\n"); + PR_StackTrace(prinst, false); } } } diff --git a/engine/server/sv_move.c b/engine/server/sv_move.c index ac90512ed..a31aed301 100644 --- a/engine/server/sv_move.c +++ b/engine/server/sv_move.c @@ -149,7 +149,7 @@ possible, no move is done, false is returned, and pr_global_struct->trace_normal is set to the normal of the blocking wall ============= */ -qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis[3], qboolean relink, qboolean noenemy, void (*set_move_trace)(trace_t *trace, struct globalvars_s *pr_globals), struct globalvars_s *set_trace_globs) +qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis[3], qboolean relink, qboolean noenemy, void (*set_move_trace)(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, trace_t *trace), struct globalvars_s *set_trace_globs) { float dz; vec3_t oldorg, neworg, end; @@ -199,7 +199,7 @@ qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis } trace = World_Move (world, ent->v->origin, ent->v->mins, ent->v->maxs, neworg, false, ent); if (set_move_trace) - set_move_trace(&trace, set_trace_globs); + set_move_trace(world->progs, set_trace_globs, &trace); if (trace.fraction == 1) { @@ -225,7 +225,7 @@ qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis trace = World_Move (world, neworg, ent->v->mins, ent->v->maxs, end, false, ent); if (set_move_trace) - set_move_trace(&trace, set_trace_globs); + set_move_trace(world->progs, set_trace_globs, &trace); if (trace.allsolid) return false; @@ -236,7 +236,7 @@ qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, vec3_t axis VectorMA(neworg, -movevars.stepheight, axis[2], neworg); trace = World_Move (world, neworg, ent->v->mins, ent->v->maxs, end, false, ent); if (set_move_trace) - set_move_trace(&trace, set_trace_globs); + set_move_trace(world->progs, set_trace_globs, &trace); if (trace.allsolid || trace.startsolid) return false; } diff --git a/engine/server/sv_sql.c b/engine/server/sv_sql.c index c0ed37442..a09a6a08f 100644 --- a/engine/server/sv_sql.c +++ b/engine/server/sv_sql.c @@ -558,10 +558,10 @@ static void SQL_DeallocResult(sqlserver_t *server, queryresult_t *qres) case SQLDRV_SQLITE: if (qres->result) { - char **mat = qres->result; + sqliteresult_t *mat = qres->result; int i; for (i = 0; i < qres->columns * (qres->rows+1); i++) - free(mat[i]); + free(mat[i].ptr); } break; #endif diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 7337989cf..85c4816ca 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -1120,7 +1120,7 @@ void SV_SendClientPrespawnInfo(client_t *client) if (client->prespawn_idx >= client->maxmodels || !sv.strings.model_precache[client->prespawn_idx]) { - if (*sv.strings.model_precache[client->prespawn_idx] && !(client->plimitwarned & PLIMIT_MODELS)) + if (sv.strings.model_precache[client->prespawn_idx] && !(client->plimitwarned & PLIMIT_MODELS)) { client->plimitwarned |= PLIMIT_MODELS; SV_ClientPrintf(client, PRINT_HIGH, "WARNING: Your client's network protocol only supports %i models. Please upgrade or enable extensions.\n", client->prespawn_idx);