From: lordhavoc Date: Mon, 22 Jan 2001 23:58:32 +0000 (+0000) Subject: clarifications about the format of svc_fog X-Git-Tag: RELEASE_0_2_0_RC1~890 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=2275e4d0cab079f4a0849ba55b8f92023d6f3eab clarifications about the format of svc_fog precache name overflow checks gl_screen.c - whitespace changes? sky name overflow checks "tell" buffer overflow improvement (not really a fix) edict parsing buffer increase (not really a fix) increased number of leafs per entity from 64 to 256 (mem hog... but fixes fall2.bsp note: quake used 16 and did not have a problem with fall2?) and added warning when it runs out removed rotating pusher hack and added solid checking non-working MOVETYPE_FOLLOW rotation support (in-progress) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@130 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index 7810cb5e..3a4cbe5e 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -81,7 +81,7 @@ char *svc_strings[] = "?", // 48 "?", // 49 "svc_farclip", // [coord] size - "svc_fog", // [byte] enable [short * 4096] density [byte] red [byte] green [byte] blue + "svc_fog", // [byte] enable [short] density*4096 [byte] red [byte] green [byte] blue "svc_playerposition" // [float] x [float] y [float] z }; @@ -384,6 +384,8 @@ void CL_ParseServerInfo (void) Con_Printf ("Server sent too many model precaches\n"); return; } + if (strlen(str) >= MAX_QPATH) + Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); strcpy (model_precache[nummodels], str); Mod_TouchModel (str); } @@ -400,6 +402,8 @@ void CL_ParseServerInfo (void) Con_Printf ("Server sent too many sound precaches\n"); return; } + if (strlen(str) >= MAX_QPATH) + Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); strcpy (sound_precache[numsounds], str); S_TouchSound (str); } diff --git a/gl_screen.c b/gl_screen.c index 624a9db6..722dfa60 100644 --- a/gl_screen.c +++ b/gl_screen.c @@ -583,11 +583,11 @@ void SCR_DrawConsole (void) ============================================================================== */ -/* +/* ================== SCR_ScreenShot_f ================== -*/ +*/ void SCR_ScreenShot_f (void) { byte *buffer; @@ -621,7 +621,7 @@ void SCR_ScreenShot_f (void) free (buffer); Con_Printf ("Wrote %s\n", filename); -} +} //============================================================================= diff --git a/gl_warp.c b/gl_warp.c index 9a1f70e7..d15a34be 100644 --- a/gl_warp.c +++ b/gl_warp.c @@ -191,9 +191,14 @@ char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; void R_LoadSkyBox (void) { int i; - char name[64]; + char name[1024]; byte* image_rgba; + if (strlen(skyname) >= 1000) + { + Con_Printf ("sky name too long (%i, max is 1000)\n", strlen(skyname)); + return; + } for (i=0 ; i<6 ; i++) { sprintf (name, "env/%s%s", skyname, suf[i]); diff --git a/host_cmd.c b/host_cmd.c index 1e18df99..44701986 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -795,7 +795,7 @@ void Host_Tell_f(void) client_t *save; int j; char *p; - char text[64]; + char text[1024]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64) if (cmd_source == src_command) { diff --git a/image.h b/image.h index c0d07ee7..20096ff8 100644 --- a/image.h +++ b/image.h @@ -9,3 +9,4 @@ extern int loadtextureimagemask (char* filename, int matchwidth, int matchheight extern int image_masktexnum; extern int loadtextureimagewithmask (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap); extern void Image_WriteTGARGB (char *filename, int width, int height, byte *data); +extern void Image_WriteTGARGBA (char *filename, int width, int height, byte *data); diff --git a/pr_edict.c b/pr_edict.c index 93d306b6..7f2bcf08 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -759,7 +759,7 @@ ED_ParseGlobals */ void ED_ParseGlobals (char *data) { - char keyname[64]; + char keyname[1024]; // LordHavoc: good idea? bad idea? was 64 ddef_t *key; while (1) diff --git a/progs.h b/progs.h index d38eb925..2d39385a 100644 --- a/progs.h +++ b/progs.h @@ -31,8 +31,8 @@ typedef union eval_s int edict; } eval_t; -// LordHavoc: increased number of leafs per entity limit from 16 to 64 -#define MAX_ENT_LEAFS 64 +// LordHavoc: increased number of leafs per entity limit from 16 to 256 +#define MAX_ENT_LEAFS 256 typedef struct edict_s { qboolean free; diff --git a/protocol.h b/protocol.h index 616f2487..6de7bcb7 100644 --- a/protocol.h +++ b/protocol.h @@ -181,7 +181,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define svc_skybox 37 // [string] skyname #define svc_farclip 50 // [coord] size (default is 6144) -#define svc_fog 51 // [byte] enable [float] density [byte] red [byte] green [byte] blue +#define svc_fog 51 // [byte] enable [short] density*4096 [byte] red [byte] green [byte] blue //#define svc_playerposition 52 // only used in dpprotocol mode // diff --git a/sv_phys.c b/sv_phys.c index ffe1ce9c..06e1f40e 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -598,6 +598,24 @@ void SV_PushRotate (edict_t *pusher, float movetime) vec3_t forward, right, up; float savesolid; + switch ((int) pusher->v.solid) + { + // LordHavoc: valid pusher types + case SOLID_BSP: + case SOLID_BBOX: + case SOLID_SLIDEBOX: + case SOLID_CORPSE: // LordHavoc: this would be weird... + break; + // LordHavoc: no collisions + case SOLID_NOT: + case SOLID_TRIGGER: + VectorMA (pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles); + pusher->v.ltime += movetime; + SV_LinkEdict (pusher, false); + return; + default: + Host_Error("SV_PushRotate: unrecognized solid type %f\n", pusher->v.solid); + } if (!pusher->v.avelocity[0] && !pusher->v.avelocity[1] && !pusher->v.avelocity[2]) { pusher->v.ltime += movetime; @@ -731,7 +749,6 @@ void SV_Physics_Pusher (edict_t *ent) oldltime = ent->v.ltime; - /* thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { @@ -749,23 +766,6 @@ void SV_Physics_Pusher (edict_t *ent) else SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } - */ - if (ent->v.avelocity[0] || ent->v.avelocity[1] || ent->v.avelocity[2]) - SV_PushRotate (ent, host_frametime); - else - { - thinktime = ent->v.nextthink; - if (thinktime < ent->v.ltime + host_frametime) - { - movetime = thinktime - ent->v.ltime; - if (movetime < 0) - movetime = 0; - } - else - movetime = host_frametime; - if (movetime) - SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked - } if (thinktime > oldltime && thinktime <= ent->v.ltime) { @@ -1163,19 +1163,33 @@ Entities that are "stuck" to another entity */ void SV_Physics_Follow (edict_t *ent) { - vec3_t vf, vu, vr, angles; + vec3_t vf, vr, vu, angles; edict_t *e; // regular thinking - SV_RunThink (ent); + if (!SV_RunThink (ent)) + return; // LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects e = PROG_TO_EDICT(ent->v.aiment); - angles[0] = -e->v.angles[0]; - angles[1] = e->v.angles[1]; - angles[2] = e->v.angles[2]; - AngleVectors (angles, vf, vr, vu); - VectorMA (e->v.origin, ent->v.view_ofs[0], vf, ent->v.origin); - VectorMA (ent->v.origin, ent->v.view_ofs[1], vr, ent->v.origin); - VectorMA (ent->v.origin, ent->v.view_ofs[2], vu, ent->v.origin); + if (e->v.angles[0] == ent->v.punchangle[0] && e->v.angles[1] == ent->v.punchangle[1] && e->v.angles[2] == ent->v.punchangle[2]) + { + // quick case for no rotation + VectorAdd(e->v.origin, ent->v.view_ofs, ent->v.origin); + } + else + { + angles[0] = -(e->v.angles[0] - ent->v.punchangle[0]); + angles[1] = e->v.angles[1] - ent->v.punchangle[1]; + angles[2] = e->v.angles[2] - ent->v.punchangle[2]; + AngleVectors (angles, vf, vr, vu); + ent->v.origin[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[2] * vu[0] + e->v.origin[0]; + ent->v.origin[1] = ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[2] * vu[1] + e->v.origin[1]; + ent->v.origin[2] = ent->v.view_ofs[0] * vf[2] + ent->v.view_ofs[1] * vr[2] + ent->v.view_ofs[2] * vu[2] + e->v.origin[2]; + /* + ent->v.origin[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[0] * vf[2] + e->v.origin[0]; + ent->v.origin[1] = ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[1] * vr[2] + e->v.origin[1]; + ent->v.origin[2] = ent->v.view_ofs[2] * vu[0] + ent->v.view_ofs[2] * vu[1] + ent->v.view_ofs[2] * vu[2] + e->v.origin[2]; + */ + } VectorAdd (e->v.angles, ent->v.v_angle, ent->v.angles); // VectorAdd (PROG_TO_EDICT(ent->v.aiment)->v.origin, ent->v.v_angle, ent->v.origin); SV_LinkEdict (ent, true); diff --git a/world.c b/world.c index 6be76178..a37612bf 100644 --- a/world.c +++ b/world.c @@ -378,7 +378,10 @@ loc0: if ( node->contents < 0) { if (ent->num_leafs == MAX_ENT_LEAFS) + { + Con_DPrintf("FindTouchedLeafs overflow\n"); return; + } leaf = (mleaf_t *)node; leafnum = leaf - sv.worldmodel->leafs - 1;