From: lordhavoc Date: Wed, 23 Aug 2000 11:26:56 +0000 (+0000) Subject: Too many fixes to mention. (sys_ticrate now controls packet rates, and other stuff) X-Git-Tag: RELEASE_0_2_0_RC1~1011 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=cc63b89849022ef37ef113a7dc9489c2e846bd1b Too many fixes to mention. (sys_ticrate now controls packet rates, and other stuff) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index aaca2704..13fbed5b 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -130,7 +130,7 @@ int CL_GetMessage (void) net_message.cursize = LittleLong (net_message.cursize); if (net_message.cursize > MAX_MSGLEN) - Sys_Error ("Demo message > MAX_MSGLEN"); + Host_Error ("Demo message > MAX_MSGLEN"); r = fread (net_message.data, net_message.cursize, 1, cls.demofile); if (r != 1) { diff --git a/cl_input.c b/cl_input.c index 9fa51fa7..305bc226 100644 --- a/cl_input.c +++ b/cl_input.c @@ -343,7 +343,24 @@ void CL_SendMove (usercmd_t *cmd) int bits; sizebuf_t buf; byte data[128]; - + static double lastmovetime; + static float forwardmove, sidemove, upmove, total; // accumulation + + forwardmove += cmd->forwardmove; + sidemove += cmd->sidemove; + upmove += cmd->upmove; + total++; + // LordHavoc: cap outgoing movement messages to sys_ticrate + if (realtime - lastmovetime < sys_ticrate.value) + return; + lastmovetime = realtime; + // average what has happened during this time + total = 1.0f / total; + forwardmove *= total; + sidemove *= total; + upmove *= total; + total = 0; + buf.maxsize = 128; buf.cursize = 0; buf.data = data; @@ -360,9 +377,9 @@ void CL_SendMove (usercmd_t *cmd) for (i=0 ; i<3 ; i++) MSG_WriteAngle (&buf, cl.viewangles[i]); - MSG_WriteShort (&buf, cmd->forwardmove); - MSG_WriteShort (&buf, cmd->sidemove); - MSG_WriteShort (&buf, cmd->upmove); + MSG_WriteShort (&buf, forwardmove); + MSG_WriteShort (&buf, sidemove); + MSG_WriteShort (&buf, upmove); // // send button bits @@ -401,7 +418,7 @@ void CL_SendMove (usercmd_t *cmd) // if (++cl.movemessages <= 2) return; - + if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1) { Con_Printf ("CL_SendMove: lost server connection\n"); diff --git a/cl_main.c b/cl_main.c index cb2ea330..bcd3e47c 100644 --- a/cl_main.c +++ b/cl_main.c @@ -31,8 +31,6 @@ cvar_t cl_color = {"_cl_color", "0", true}; cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2 cvar_t cl_nolerp = {"cl_nolerp","0"}; -cvar_t maxfps = {"maxfps", "100"}; - cvar_t lookspring = {"lookspring","0", true}; cvar_t lookstrafe = {"lookstrafe","0", true}; cvar_t sensitivity = {"sensitivity","3", true}; @@ -803,7 +801,6 @@ void CL_Init (void) Cvar_RegisterVariable (&cl_anglespeedkey); Cvar_RegisterVariable (&cl_shownet); Cvar_RegisterVariable (&cl_nolerp); - Cvar_RegisterVariable (&maxfps); Cvar_RegisterVariable (&lookspring); Cvar_RegisterVariable (&lookstrafe); Cvar_RegisterVariable (&sensitivity); diff --git a/cl_parse.c b/cl_parse.c index d7520d5f..38a5751e 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -520,7 +520,7 @@ void CL_ParseUpdate (int bits) else { if (i > cl.maxclients) - Sys_Error ("i >= cl.maxclients"); + Host_Error ("i >= cl.maxclients"); ent->colormap = cl.scores[i-1].translations; } @@ -752,7 +752,7 @@ void CL_NewTranslation (int slot) byte *dest, *source; if (slot > cl.maxclients) - Sys_Error ("CL_NewTranslation: slot > cl.maxclients"); + Host_Error ("CL_NewTranslation: slot > cl.maxclients"); dest = cl.scores[slot].translations; source = vid.colormap; memcpy (dest, vid.colormap, sizeof(cl.scores[slot].translations)); @@ -956,7 +956,7 @@ void CL_ParseServerMessage (void) case svc_lightstyle: i = MSG_ReadByte (); if (i >= MAX_LIGHTSTYLES) - Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); + Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); strcpy (cl_lightstyle[i].map, MSG_ReadString()); cl_lightstyle[i].length = strlen(cl_lightstyle[i].map); break; @@ -1051,7 +1051,7 @@ void CL_ParseServerMessage (void) case svc_updatestat: i = MSG_ReadByte (); if (i < 0 || i >= MAX_CL_STATS) - Sys_Error ("svc_updatestat: %i is invalid", i); + Host_Error ("svc_updatestat: %i is invalid", i); cl.stats[i] = MSG_ReadLong ();; break; diff --git a/cl_tent.c b/cl_tent.c index bbb48121..573dc593 100644 --- a/cl_tent.c +++ b/cl_tent.c @@ -470,7 +470,7 @@ void CL_ParseTEnt (void) break; default: - Sys_Error ("CL_ParseTEnt: bad type"); + Host_Error ("CL_ParseTEnt: bad type %d", type); } } diff --git a/common.c b/common.c index 11778fa6..533cf6cb 100644 --- a/common.c +++ b/common.c @@ -768,10 +768,10 @@ void *SZ_GetSpace (sizebuf_t *buf, int length) if (buf->cursize + length > buf->maxsize) { if (!buf->allowoverflow) - Sys_Error ("SZ_GetSpace: overflow without allowoverflow set - use -zone on the commandline for more zone memory, default: 512k (quake original default was 48k)"); + Host_Error ("SZ_GetSpace: overflow without allowoverflow set - use -zone on the commandline for more zone memory, default: 512k (quake original default was 48k)"); if (length > buf->maxsize) - Sys_Error ("SZ_GetSpace: %i is > full buffer size", length); + Host_Error ("SZ_GetSpace: %i is > full buffer size", length); buf->overflowed = true; Con_Printf ("SZ_GetSpace: overflow"); diff --git a/gl_draw.c b/gl_draw.c index 61aaf7a1..160ff686 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1100,6 +1100,18 @@ void GL_Upload32 (void *data, int width, int height, qboolean mipmap, qboolean if (scaled_height > gl_max_size.value) scaled_height = gl_max_size.value; + if (alpha) + { + alpha = false; + in = data; + for (i = 3;i < width*height*4;i += 4) + if (in[i] != 255) + { + alpha = true; + break; + } + } + samples = alpha ? gl_alpha_format : gl_solid_format; #if 0 diff --git a/gl_poly.c b/gl_poly.c index 08af798d..9dad35b3 100644 --- a/gl_poly.c +++ b/gl_poly.c @@ -286,7 +286,8 @@ void transpolyrender() //// offset by 16 depth units so decal sprites appear infront of walls //glPolygonOffset(1, -16); //glEnable(GL_POLYGON_OFFSET_FILL); - tpolytype = -1; + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + tpolytype = TPOLYTYPE_ALPHA; texnum = -1; /* if (gl_vertexarrays.value) diff --git a/gl_rmain.c b/gl_rmain.c index dd27928c..523e0920 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -446,7 +446,6 @@ void R_GetSpriteFrame (entity_t *currententity, mspriteframe_t **oldframe, mspri void GL_DrawSpriteImage (mspriteframe_t *frame, vec3_t origin, vec3_t up, vec3_t right, int red, int green, int blue, int alpha) { // LordHavoc: rewrote this to use the transparent poly system - // FIXME: need to use uncolored fog sprite transpolybegin(frame->gl_texturenum, 0, frame->gl_fogtexturenum, currententity->effects & EF_ADDITIVE ? TPOLYTYPE_ADD : TPOLYTYPE_ALPHA); transpolyvert(origin[0] + frame->down * up[0] + frame->left * right[0], origin[1] + frame->down * up[1] + frame->left * right[1], origin[2] + frame->down * up[2] + frame->left * right[2], 0, 1, red, green, blue, alpha); transpolyvert(origin[0] + frame->up * up[0] + frame->left * right[0], origin[1] + frame->up * up[1] + frame->left * right[1], origin[2] + frame->up * up[2] + frame->left * right[2], 0, 0, red, green, blue, alpha); diff --git a/gl_screen.c b/gl_screen.c index a7a03d4f..1c27259f 100644 --- a/gl_screen.c +++ b/gl_screen.c @@ -89,6 +89,7 @@ cvar_t scr_showturtle = {"showturtle","0"}; cvar_t scr_showpause = {"showpause","1"}; cvar_t scr_printspeed = {"scr_printspeed","8"}; cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", true }; +cvar_t showfps = {"showfps", "0", true}; extern cvar_t crosshair; @@ -390,6 +391,7 @@ void SCR_Init (void) Cvar_RegisterVariable (&scr_centertime); Cvar_RegisterVariable (&scr_printspeed); Cvar_RegisterVariable (&gl_triplebuffer); + Cvar_RegisterVariable (&showfps); // // register our commands @@ -967,6 +969,19 @@ void SCR_UpdateScreen (void) M_Draw (); } + if (showfps.value) + { + static double currtime; + double newtime; + char temp[32]; + int calc; + newtime = Sys_FloatTime(); + calc = (int) (100.0 / (newtime - currtime)); + sprintf(temp, "% 4i.%02i fps", calc / 100, calc % 100); + currtime = newtime; + Draw_String(vid.width - (12*8), 0, temp, 9999); + } + V_UpdatePalette (); GL_BrightenScreen(); @@ -976,7 +991,7 @@ void SCR_UpdateScreen (void) if (r_speeds.value) { time2 = Sys_FloatTime (); - Con_Printf ("%3i ms %4i wpoly %4i epoly %4i BSPnodes\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys, c_nodes); + Con_Printf ("%3i ms %4i wpoly %4i epoly %4i transpoly %4i BSPnodes\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys, currenttranspoly, c_nodes); } GL_EndRendering (); } diff --git a/host.c b/host.c index 292f5222..416d4be0 100644 --- a/host.c +++ b/host.c @@ -487,8 +487,6 @@ void Host_ClearMemory (void) //============================================================================ -extern cvar_t maxfps; - /* =================== Host_FilterTime @@ -500,12 +498,8 @@ qboolean Host_FilterTime (float time) { realtime += time; - if (maxfps.value < 5) // LordHavoc: sanity checking - maxfps.value = 5; - if (maxfps.value > 1000) // LordHavoc: sanity checking - maxfps.value = 1000; - if (!cls.timedemo && realtime - oldrealtime < (1.0 / maxfps.value)) - return false; // framerate is too high +// if (!cls.timedemo && realtime - oldrealtime < (1.0 / 72.0)) +// return false; // framerate is too high host_frametime = (realtime - oldrealtime) * slowmo.value; // LordHavoc: slowmo cvar oldrealtime = realtime; @@ -619,10 +613,17 @@ void Host_ServerFrame (void) #else +double frametimetotal = 0, lastservertime = 0; void Host_ServerFrame (void) { -// run the world state - pr_global_struct->frametime = host_frametime; + frametimetotal += host_frametime; + // LordHavoc: cap server at sys_ticrate in listen games + if (!isDedicated && ((realtime - lastservertime) < sys_ticrate.value)) + return; +// run the world state + pr_global_struct->frametime = frametimetotal; + frametimetotal = 0; +// pr_global_struct->frametime = host_frametime; // set the time and clear the general datagram SV_ClearDatagram (); diff --git a/image.c b/image.c index a32d58a4..f30487de 100644 --- a/image.c +++ b/image.c @@ -180,11 +180,11 @@ byte* LoadTGA (FILE *fin, int matchwidth, int matchheight) if (targa_header.image_type!=2 && targa_header.image_type!=10) - Sys_Error ("LoadTGA: Only type 2 and 10 targa RGB images supported\n"); + Host_Error ("LoadTGA: Only type 2 and 10 targa RGB images supported\n"); if (targa_header.colormap_type !=0 || (targa_header.pixel_size!=32 && targa_header.pixel_size!=24)) - Sys_Error ("Texture_LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); + Host_Error ("Texture_LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); columns = targa_header.width; rows = targa_header.height; diff --git a/model_alias.c b/model_alias.c index 05a61b08..4ea3403b 100644 --- a/model_alias.c +++ b/model_alias.c @@ -288,7 +288,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int bytesperp skin = (byte *)(pskintype + 1); if (numskins < 1 || numskins > MAX_SKINS) - Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins); + Host_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins); s = pheader->skinwidth * pheader->skinheight; @@ -656,9 +656,9 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer) tris->v[j] = pouttriangles->index_xyz[j] = LittleShort (pintriangles->index_xyz[j]); pouttriangles->index_st[j] = LittleShort (pintriangles->index_st[j]); if (pouttriangles->index_xyz[j] >= pheader->num_xyz) - Sys_Error ("%s has invalid vertex indices", mod->name); + Host_Error ("%s has invalid vertex indices", mod->name); if (pouttriangles->index_st[j] >= pheader->num_st) - Sys_Error ("%s has invalid vertex indices", mod->name); + Host_Error ("%s has invalid vertex indices", mod->name); } pintriangles++; pouttriangles++; diff --git a/model_brush.c b/model_brush.c index 4fa418f3..e62b5272 100644 --- a/model_brush.c +++ b/model_brush.c @@ -166,7 +166,7 @@ void Mod_LoadTextures (lump_t *l) mt->offsets[j] = LittleLong (mt->offsets[j]); if ( (mt->width & 15) || (mt->height & 15) ) - Sys_Error ("Texture %s is not 16 aligned", mt->name); + Host_Error ("Texture %s is not 16 aligned", mt->name); // LordHavoc: rewriting the map texture loader for GLQuake tx = Hunk_AllocName (sizeof(texture_t), loadname ); loadmodel->textures[i] = tx; @@ -179,11 +179,12 @@ void Mod_LoadTextures (lump_t *l) freeimage = TRUE; bytesperpixel = 4; fullbrights = FALSE; - transparent = FALSE; - data = loadimagepixels(mt->name, FALSE, tx->width, tx->height); + transparent = TRUE; + data = loadimagepixels(mt->name, FALSE, 0, 0); //tx->width, tx->height); if (!data) // no external texture found { freeimage = FALSE; + transparent = FALSE; bytesperpixel = 1; if (!hlbsp && mt->offsets[0]) // texture included { @@ -206,14 +207,10 @@ void Mod_LoadTextures (lump_t *l) } else { - for (j = 0;j < image_width*image_height;j++) - if (data[j*4+3] < 255) - { - transparent = TRUE; - break; - } + tx->width = image_width; + tx->height = image_height; } - if (!hlbsp && !strncmp(mt->name,"sky",3)) // LordHavoc: HL sky textures are entirely unrelated + if (!hlbsp && !strncmp(mt->name,"sky",3) && tx->width == 256 && tx->height == 128) // LordHavoc: HL sky textures are entirely unrelated { tx->transparent = FALSE; R_InitSky (data, bytesperpixel); @@ -328,7 +325,7 @@ void Mod_LoadTextures (lump_t *l) altmax = num+1; } else - Sys_Error ("Bad animating texture %s", tx->name); + Host_Error ("Bad animating texture %s", tx->name); } #define ANIM_CYCLE 2 @@ -337,7 +334,7 @@ void Mod_LoadTextures (lump_t *l) { tx2 = anims[j]; if (!tx2) - Sys_Error ("Missing frame %i of %s",j, tx->name); + Host_Error ("Missing frame %i of %s",j, tx->name); tx2->anim_total = max * ANIM_CYCLE; tx2->anim_min = j * ANIM_CYCLE; tx2->anim_max = (j+1) * ANIM_CYCLE; @@ -349,7 +346,7 @@ void Mod_LoadTextures (lump_t *l) { tx2 = altanims[j]; if (!tx2) - Sys_Error ("Missing frame %i of %s",j, tx->name); + Host_Error ("Missing frame %i of %s",j, tx->name); tx2->anim_total = altmax * ANIM_CYCLE; tx2->anim_min = j * ANIM_CYCLE; tx2->anim_max = (j+1) * ANIM_CYCLE; @@ -471,7 +468,7 @@ void Mod_LoadVertexes (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -499,7 +496,7 @@ void Mod_LoadSubmodels (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -535,7 +532,7 @@ void Mod_LoadEdges (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); @@ -564,7 +561,7 @@ void Mod_LoadTexinfo (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -604,7 +601,7 @@ void Mod_LoadTexinfo (lump_t *l) else { if (miptex >= loadmodel->numtextures) - Sys_Error ("miptex >= loadmodel->numtextures"); + Host_Error ("miptex >= loadmodel->numtextures"); out->texture = loadmodel->textures[miptex]; if (!out->texture) { @@ -666,7 +663,7 @@ void CalcSurfaceExtents (msurface_t *s) s->texturemins[i] = bmins[i] * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16; if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 /* 256 */ ) - Sys_Error ("Bad surface extents"); + Host_Error ("Bad surface extents"); } } @@ -688,7 +685,7 @@ void Mod_LoadFaces (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -787,7 +784,7 @@ void Mod_LoadNodes (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -834,7 +831,7 @@ void Mod_LoadLeafs (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -891,7 +888,7 @@ void Mod_LoadClipnodes (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -982,7 +979,7 @@ void Mod_LoadMarksurfaces (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -993,7 +990,7 @@ void Mod_LoadMarksurfaces (lump_t *l) { j = LittleShort(in[i]); if (j >= loadmodel->numsurfaces) - Sys_Error ("Mod_ParseMarksurfaces: bad surface number"); + Host_Error ("Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel->surfaces + j; } } @@ -1010,7 +1007,7 @@ void Mod_LoadSurfedges (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); @@ -1037,7 +1034,7 @@ void Mod_LoadPlanes (lump_t *l) in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); + Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*2*sizeof(*out), loadname); @@ -1078,7 +1075,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) i = LittleLong (header->version); if (i != BSPVERSION & i != 30) - Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i or 30 (HalfLife))", mod->name, i, BSPVERSION); + Host_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i or 30 (HalfLife))", mod->name, i, BSPVERSION); hlbsp = i == 30; halflifebsp.value = hlbsp; diff --git a/model_shared.c b/model_shared.c index 9d16ee22..ea85c589 100644 --- a/model_shared.c +++ b/model_shared.c @@ -71,7 +71,7 @@ void *Mod_Extradata (model_t *mod) Mod_LoadModel (mod, true); if (!mod->cache.data) - Sys_Error ("Mod_Extradata: caching failed"); + Host_Error ("Mod_Extradata: caching failed"); return mod->cache.data; } @@ -102,7 +102,7 @@ model_t *Mod_FindName (char *name) model_t *mod; if (!name[0]) - Sys_Error ("Mod_ForName: NULL name"); + Host_Error ("Mod_ForName: NULL name"); // // search the currently loaded models @@ -114,7 +114,7 @@ model_t *Mod_FindName (char *name) if (i == mod_numknown) { if (mod_numknown == MAX_MOD_KNOWN) - Sys_Error ("mod_numknown == MAX_MOD_KNOWN"); + Host_Error ("mod_numknown == MAX_MOD_KNOWN"); strcpy (mod->name, name); mod->needload = true; mod_numknown++; diff --git a/model_sprite.c b/model_sprite.c index 6e2d7840..430b18fb 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -226,7 +226,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) // load the frames // if (numframes < 1) - Sys_Error ("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes); + Host_Error ("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes); mod->numframes = numframes; diff --git a/pr_cmds.c b/pr_cmds.c index d8b63930..861054f6 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -652,13 +652,13 @@ void PF_sound (void) attenuation = G_FLOAT(OFS_PARM4); if (volume < 0 || volume > 255) - Sys_Error ("SV_StartSound: volume = %i", volume); + Host_Error ("SV_StartSound: volume = %i", volume); if (attenuation < 0 || attenuation > 4) - Sys_Error ("SV_StartSound: attenuation = %f", attenuation); + Host_Error ("SV_StartSound: attenuation = %f", attenuation); if (channel < 0 || channel > 7) - Sys_Error ("SV_StartSound: channel = %i", channel); + Host_Error ("SV_StartSound: channel = %i", channel); SV_StartSound (entity, channel, sample, volume, attenuation); } diff --git a/pr_edict.c b/pr_edict.c index d327821d..27c924c3 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -207,7 +207,7 @@ edict_t *ED_Alloc (void) } if (i == MAX_EDICTS) - Sys_Error ("ED_Alloc: no free edicts"); + Host_Error ("ED_Alloc: no free edicts"); sv.num_edicts++; e = EDICT_NUM(i); @@ -1033,7 +1033,7 @@ void ED_LoadFromFile (char *data) if (!data) break; if (com_token[0] != '{') - Sys_Error ("ED_LoadFromFile: found %s when expecting {",com_token); + Host_Error ("ED_LoadFromFile: found %s when expecting {",com_token); if (!ent) ent = EDICT_NUM(0); @@ -1323,7 +1323,7 @@ void PR_Init (void) // LordHavoc: turned EDICT_NUM into a #define for speed reasons edict_t *EDICT_NUM_ERROR(int n) { - Sys_Error ("EDICT_NUM: bad number %i", n); + Host_Error ("EDICT_NUM: bad number %i", n); return NULL; } /* @@ -1343,6 +1343,6 @@ int NUM_FOR_EDICT(edict_t *e) b = b / pr_edict_size; if (b < 0 || b >= sv.num_edicts) - Sys_Error ("NUM_FOR_EDICT: bad pointer"); + Host_Error ("NUM_FOR_EDICT: bad pointer"); return b; } diff --git a/pr_exec.c b/pr_exec.c index 4a319e69..64abde5a 100644 --- a/pr_exec.c +++ b/pr_exec.c @@ -335,7 +335,7 @@ int PR_LeaveFunction (void) int i, c; if (pr_depth <= 0) - Sys_Error ("prog stack underflow"); + Host_Error ("prog stack underflow"); // restore locals from the stack c = pr_xfunction->locals; diff --git a/snd_dma.c b/snd_dma.c index b04c1a30..e5f69677 100644 --- a/snd_dma.c +++ b/snd_dma.c @@ -286,10 +286,10 @@ sfx_t *S_FindName (char *name) sfx_t *sfx; if (!name) - Sys_Error ("S_FindName: NULL\n"); + Host_Error ("S_FindName: NULL\n"); if (strlen(name) >= MAX_QPATH) - Sys_Error ("Sound name too long: %s", name); + Host_Error ("Sound name too long: %s", name); // see if already loaded for (i=0 ; i < num_sfx ; i++) diff --git a/snd_mem.c b/snd_mem.c index 5ddef732..be03af6a 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -391,7 +391,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength) if (info.samples) { if (samples < info.samples) - Sys_Error ("Sound %s has a bad loop length", name); + Host_Error ("Sound %s has a bad loop length", name); } else info.samples = samples; diff --git a/sv_main.c b/sv_main.c index aa8d21ef..96c1f9ec 100644 --- a/sv_main.c +++ b/sv_main.c @@ -124,13 +124,13 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, int ent; if (volume < 0 || volume > 255) - Sys_Error ("SV_StartSound: volume = %i", volume); + Host_Error ("SV_StartSound: volume = %i", volume); if (attenuation < 0 || attenuation > 4) - Sys_Error ("SV_StartSound: attenuation = %f", attenuation); + Host_Error ("SV_StartSound: attenuation = %f", attenuation); if (channel < 0 || channel > 7) - Sys_Error ("SV_StartSound: channel = %i", channel); + Host_Error ("SV_StartSound: channel = %i", channel); if (sv.datagram.cursize > MAX_DATAGRAM-16) return; @@ -1055,7 +1055,7 @@ int SV_ModelIndex (char *name) if (!strcmp(sv.model_precache[i], name)) return i; if (i==MAX_MODELS || !sv.model_precache[i]) - Sys_Error ("SV_ModelIndex: model %s not precached", name); + Host_Error ("SV_ModelIndex: model %s not precached", name); return i; } diff --git a/sv_phys.c b/sv_phys.c index d6ad3d26..4b0d99b8 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -287,7 +287,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) break; // moved the entire distance if (!trace.ent) - Sys_Error ("SV_FlyMove: !trace.ent"); + Host_Error ("SV_FlyMove: !trace.ent"); if (trace.plane.normal[2] > 0.7) { @@ -1093,7 +1093,7 @@ void SV_Physics_Client (edict_t *ent, int num) break; default: - Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype); + Host_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype); } // @@ -1391,7 +1391,7 @@ void SV_Physics (void) || ent->v.movetype == MOVETYPE_FLYMISSILE) SV_Physics_Toss (ent); else - Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); + Host_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); } if (pr_global_struct->force_retouch) diff --git a/sys_win.c b/sys_win.c index 7a9d682e..d87240bd 100644 --- a/sys_win.c +++ b/sys_win.c @@ -176,7 +176,7 @@ int Sys_FileOpenWrite (char *path) f = fopen(path, "wb"); if (!f) - Sys_Error ("Error opening %s: %s", path,strerror(errno)); + Host_Error ("Error opening %s: %s", path,strerror(errno)); sys_handles[i] = f; VID_ForceLockState (t); @@ -270,7 +270,7 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) DWORD flOldProtect; if (!VirtualProtect((LPVOID)startaddr, length, PAGE_READWRITE, &flOldProtect)) - Sys_Error("Protection change failed\n"); + Sys_Error("Protection change failed\n"); } @@ -680,8 +680,6 @@ void SleepUntilInput (int time) } -extern cvar_t maxfps; - /* ================== WinMain @@ -697,7 +695,7 @@ HWND hwnd_dialog; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { quakeparms_t parms; - double time, oldtime, newtime, timediff; + double time, oldtime, newtime/*, timediff*/; MEMORYSTATUS lpBuffer; static char cwd[1024]; int t; @@ -874,10 +872,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin /* main window message loop */ while (1) { - if (maxfps.value < 5) // LordHavoc: sanity checking - maxfps.value = 5; - if (maxfps.value > 1000) // LordHavoc: sanity checking - maxfps.value = 1000; if (isDedicated) { newtime = Sys_FloatTime (); @@ -902,6 +896,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin { SleepUntilInput (NOT_FOCUS_SLEEP); } + /* else if (!cls.timedemo && time < (timediff = 1.0 / maxfps.value)) { newtime = Sys_FloatTime (); @@ -914,6 +909,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin time = newtime - oldtime; } } + */ newtime = Sys_FloatTime (); time = newtime - oldtime;