From ea7c24e1fb41f3b1df984ac0eed6881c9fde16f5 Mon Sep 17 00:00:00 2001 From: knghtbrd Date: Sun, 2 Jun 2002 19:52:39 +0000 Subject: [PATCH] A minor removal of a few pieces of dead code. Nothing major. This is stage two. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1891 d7cf8633-e32d-0410-b094-e92efae38249 --- builddate.c | 1 + cd_linux.c | 1 + cd_win.c | 1 + cgame.c | 2 - cgamevm.c | 12 +- cl_collision.c | 5 +- cl_demo.c | 5 +- cl_input.c | 28 ++-- cl_light.c | 2 +- cl_main.c | 94 +----------- cl_parse.c | 36 +---- cl_particles.c | 275 +--------------------------------- cl_screen.c | 58 +------- cl_tent.c | 22 --- cmd.c | 17 --- collision.c | 4 +- common.c | 396 +------------------------------------------------ console.c | 28 ---- crc.c | 1 + cvar.c | 1 + fractalnoise.c | 1 + gl_backend.c | 56 +------ gl_draw.c | 27 +--- gl_models.c | 77 +--------- gl_rmain.c | 65 +------- gl_rsurf.c | 71 +-------- gl_textures.c | 35 +---- host.c | 14 +- host_cmd.c | 19 +-- image.c | 1 + in_svgalib.c | 8 +- in_win.c | 8 +- keys.c | 2 +- mathlib.c | 255 +------------------------------ menu.c | 154 +------------------ model_alias.c | 7 +- model_brush.c | 156 +------------------ model_shared.c | 32 ---- model_sprite.c | 3 +- net_bsd.c | 1 + net_dgrm.c | 15 +- net_loop.c | 1 + net_main.c | 39 +---- net_udp.c | 1 - net_win.c | 2 +- net_wins.c | 1 - net_wipx.c | 1 - palette.c | 35 +---- portals.c | 16 +- pr_cmds.c | 98 +----------- pr_edict.c | 42 +----- pr_exec.c | 5 +- protocol.c | 47 +----- quakeio.c | 5 +- r_clip.c | 239 +++-------------------------- r_crosshairs.c | 1 + r_explosion.c | 197 +----------------------- r_lerpanim.c | 1 - r_light.c | 238 +++++++---------------------- r_modules.c | 1 + r_sky.c | 20 +-- r_sprites.c | 10 +- sbar.c | 2 +- screen.h | 1 - snd_alsa_0_5.c | 6 - snd_dma.c | 23 --- snd_mem.c | 18 +-- snd_mix.c | 6 - snd_oss.c | 2 - snd_win.c | 6 - sv_light.c | 10 +- sv_main.c | 22 +-- sv_move.c | 7 +- sv_phys.c | 103 +------------ sv_user.c | 33 ----- sys_linux.c | 6 +- sys_shared.c | 6 +- sys_win.c | 8 - transform.c | 1 + ui.c | 2 +- vid_3dfxsvga.c | 14 +- vid_glx.c | 49 ++---- vid_shared.c | 1 + vid_wgl.c | 205 +------------------------ view.c | 14 +- wad.c | 119 +-------------- world.c | 59 +------- zone.c | 5 - 88 files changed, 208 insertions(+), 3516 deletions(-) diff --git a/builddate.c b/builddate.c index c20120b0..dcf45be2 100644 --- a/builddate.c +++ b/builddate.c @@ -1,2 +1,3 @@ char *buildstring = __TIME__ " " __DATE__; + diff --git a/cd_linux.c b/cd_linux.c index d188b8e1..43a3891d 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -417,3 +417,4 @@ void CDAudio_Shutdown(void) close(cdfile); cdfile = -1; } + diff --git a/cd_win.c b/cd_win.c index 0fac1db2..d61f269a 100644 --- a/cd_win.c +++ b/cd_win.c @@ -474,3 +474,4 @@ void CDAudio_Shutdown(void) if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL)) Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n"); } + diff --git a/cgame.c b/cgame.c index 615fb7f4..00ca87c0 100644 --- a/cgame.c +++ b/cgame.c @@ -27,8 +27,6 @@ typedef struct localentity_s float airfrictionscale; float gravityscale; void (*framethink)(struct localentity_s *e); - //int solid; - //void (*touch)(struct localentity_s *self, struct localentity_s *other); void (*touchnetwork)(struct localentity_s *self); cgdrawentity_t draw; } diff --git a/cgamevm.c b/cgamevm.c index 57f53dc8..eb4f5e1f 100644 --- a/cgamevm.c +++ b/cgamevm.c @@ -143,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? @@ -205,8 +198,6 @@ float CGVM_TracePhysics(const float *start, const float *end, const float *world VectorAdd(end, middle, end2); frac = CL_TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, 0, true); VectorSubtract(impactpos, middle, impactpos); - //VectorCopy(end, impactpos); - //VectorClear(impactnormal); *impactentnum = -1; return frac; } @@ -273,3 +264,4 @@ void CGVM_Stain(const float *origin, float radius, int cr1, int cg1, int cb1, in { R_Stain((float *)origin, radius, cr1, cg1, cb1, ca1, cr2, cg2, cb2, ca2); } + diff --git a/cl_collision.c b/cl_collision.c index 22d846af..ea667b65 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -45,8 +45,6 @@ void CL_TraceLine_ScanForBModels(void) // look for embedded brush models only if (model && model->name[0] == '*') { - // this does nothing for * models currently... - //Mod_CheckLoaded(model); if (model->type == mod_brush) { traceline_entity[traceline_entities++] = ent; @@ -93,7 +91,7 @@ float CL_TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int { int n; entity_render_t *ent; - double /*start2[3], end2[3], */tracemins[3], tracemaxs[3]; + double tracemins[3], tracemaxs[3]; tracemins[0] = min(start[0], end[0]); tracemaxs[0] = max(start[0], end[0]); tracemins[1] = min(start[1], end[1]); @@ -125,3 +123,4 @@ float CL_TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int } return maxfrac; } + diff --git a/cl_demo.c b/cl_demo.c index 40ada2d1..551b7cda 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -143,7 +143,7 @@ int CL_GetMessage (void) if (host_framecount == cls.td_startframe + 1) cls.td_starttime = realtime; } - else if ( /* cl.time > 0 && */ cl.time <= cl.mtime[0]) + else if (cl.time <= cl.mtime[0]) { return 0; // don't need another message yet } @@ -350,9 +350,6 @@ void CL_PlayDemo_f (void) if (neg) cls.forcetrack = -cls.forcetrack; -// ZOID, fscanf is evil -// fscanf (cls.demofile, "%i\n", &cls.forcetrack); - } /* diff --git a/cl_input.c b/cl_input.c index e5f6e2e5..21d79bec 100644 --- a/cl_input.c +++ b/cl_input.c @@ -119,10 +119,11 @@ void KeyUp (kbutton_t *b) void IN_KLookDown (void) {KeyDown(&in_klook);} void IN_KLookUp (void) {KeyUp(&in_klook);} void IN_MLookDown (void) {KeyDown(&in_mlook);} -void IN_MLookUp (void) { -KeyUp(&in_mlook); -if ( !(in_mlook.state&1) && lookspring.value) - V_StartPitchDrift(); +void IN_MLookUp (void) +{ + KeyUp(&in_mlook); + if ( !(in_mlook.state&1) && lookspring.value) + V_StartPitchDrift(); } void IN_UpDown(void) {KeyDown(&in_up);} void IN_UpUp(void) {KeyUp(&in_up);} @@ -154,12 +155,18 @@ void IN_AttackDown(void) {KeyDown(&in_attack);} void IN_AttackUp(void) {KeyUp(&in_attack);} // LordHavoc: added 6 new buttons -void IN_Button3Down(void) {KeyDown(&in_button3);} void IN_Button3Up(void) {KeyUp(&in_button3);} -void IN_Button4Down(void) {KeyDown(&in_button4);} void IN_Button4Up(void) {KeyUp(&in_button4);} -void IN_Button5Down(void) {KeyDown(&in_button5);} void IN_Button5Up(void) {KeyUp(&in_button5);} -void IN_Button6Down(void) {KeyDown(&in_button6);} void IN_Button6Up(void) {KeyUp(&in_button6);} -void IN_Button7Down(void) {KeyDown(&in_button7);} void IN_Button7Up(void) {KeyUp(&in_button7);} -void IN_Button8Down(void) {KeyDown(&in_button8);} void IN_Button8Up(void) {KeyUp(&in_button8);} +void IN_Button3Down(void) {KeyDown(&in_button3);} +void IN_Button3Up(void) {KeyUp(&in_button3);} +void IN_Button4Down(void) {KeyDown(&in_button4);} +void IN_Button4Up(void) {KeyUp(&in_button4);} +void IN_Button5Down(void) {KeyDown(&in_button5);} +void IN_Button5Up(void) {KeyUp(&in_button5);} +void IN_Button6Down(void) {KeyDown(&in_button6);} +void IN_Button6Up(void) {KeyUp(&in_button6);} +void IN_Button7Down(void) {KeyDown(&in_button7);} +void IN_Button7Up(void) {KeyUp(&in_button7);} +void IN_Button8Down(void) {KeyDown(&in_button8);} +void IN_Button8Up(void) {KeyUp(&in_button8);} void IN_UseDown (void) {KeyDown(&in_use);} void IN_UseUp (void) {KeyUp(&in_use);} @@ -511,3 +518,4 @@ void CL_InitInput (void) Cmd_AddCommand ("+button8", IN_Button8Down); Cmd_AddCommand ("-button8", IN_Button8Up); } + diff --git a/cl_light.c b/cl_light.c index 68cb9e76..9ab6ea32 100644 --- a/cl_light.c +++ b/cl_light.c @@ -1,3 +1,4 @@ + #include "quakedef.h" dlight_t cl_dlights[MAX_DLIGHTS]; @@ -78,4 +79,3 @@ void CL_DecayLights (void) } } - diff --git a/cl_main.c b/cl_main.c index 73139f74..016cf26d 100644 --- a/cl_main.c +++ b/cl_main.c @@ -355,66 +355,9 @@ static void CL_RelinkNetworkEntities() VectorCopy (ent->state_current.origin, oldorg); // skip trails VectorCopy (ent->state_current.origin, neworg); VectorCopy (ent->state_current.angles, ent->render.angles); - - /* - // monster interpolation - ent->persistent.steplerptime = 0; - VectorCopy(ent->state_current.origin, ent->persistent.stepoldorigin); - VectorCopy(ent->state_current.angles, ent->persistent.stepoldangles); - VectorCopy(ent->state_current.origin, ent->persistent.steporigin); - VectorCopy(ent->state_current.angles, ent->persistent.stepangles); - */ - } - /* - else if ((ent->state_current.flags & ent->state_previous.flags) & ENTFLAG_STEP) - { - if (ent->state_current.origin[0] != ent->persistent.steporigin[0] - || ent->state_current.origin[1] != ent->persistent.steporigin[1] - || ent->state_current.origin[2] != ent->persistent.steporigin[2] - || ent->state_current.angles[0] != ent->persistent.stepangles[0] - || ent->state_current.angles[1] != ent->persistent.stepangles[1] - || ent->state_current.angles[2] != ent->persistent.stepangles[2]) - { - // update lerp positions - ent->clientpersistent.steplerptime = sv.time; - VectorCopy(ent->steporigin, ent->stepoldorigin); - VectorCopy(ent->stepangles, ent->stepoldangles); - VectorCopy(ent->v.origin, ent->steporigin); - VectorCopy(ent->v.angles, ent->stepangles); - } - lerp = (cl.time - ent->persistent.steplerptime) * 10.0; - if (lerp < 1) - { - // origin - VectorSubtract(ent->persistent.steporigin, ent->persistent.stepoldorigin, delta); - VectorMA(ent->persistent.stepoldorigin, lerp, delta, neworg); - - // angles - VectorSubtract(ent->persistent.stepangles, ent->persistent.stepoldangles, delta); - // choose shortest rotate (to avoid 'spin around' situations) - if (delta[0] < -180) delta[0] += 360;else if (delta[0] >= 180) delta[0] -= 360; - if (delta[1] < -180) delta[1] += 360;else if (delta[1] >= 180) delta[1] -= 360; - if (delta[2] < -180) delta[2] += 360;else if (delta[2] >= 180) delta[2] -= 360; - VectorMA(ent->stepoldangles, lerp, delta, ent->render.angles); - } - else - { - VectorCopy(ent->persistent.steporigin, neworg); - VectorCopy(ent->persistent.stepangles, ent->render.angles); - } } - */ else { - /* - // monster interpolation - ent->persistent.steplerptime = 0; - VectorCopy(ent->state_current.origin, ent->persistent.stepoldorigin); - VectorCopy(ent->state_current.angles, ent->persistent.stepoldangles); - VectorCopy(ent->state_current.origin, ent->persistent.steporigin); - VectorCopy(ent->state_current.angles, ent->persistent.stepangles); - */ - // if the delta is large, assume a teleport and don't lerp VectorSubtract(ent->state_current.origin, ent->state_previous.origin, delta); // LordHavoc: increased tolerance from 100 to 200, and now to 1000 @@ -509,23 +452,6 @@ static void CL_RelinkNetworkEntities() { vec3_t mins, maxs; int temp; - /* - if (ent->render.angles[0] || ent->render.angles[2]) - { - VectorMA(neworg, 0.25f, ent->render.model->rotatedmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->rotatedmaxs, maxs); - } - else if (ent->render.angles[1]) - { - VectorMA(neworg, 0.25f, ent->render.model->yawmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->yawmaxs, maxs); - } - else - { - VectorMA(neworg, 0.25f, ent->render.model->normalmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->normalmaxs, maxs); - } - */ mins[0] = neworg[0] - 16.0f; mins[1] = neworg[1] - 16.0f; mins[2] = neworg[2] - 16.0f; @@ -547,23 +473,6 @@ static void CL_RelinkNetworkEntities() { vec3_t mins, maxs; int temp; - /* - if (ent->render.angles[0] || ent->render.angles[2]) - { - VectorMA(neworg, 0.25f, ent->render.model->rotatedmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->rotatedmaxs, maxs); - } - else if (ent->render.angles[1]) - { - VectorMA(neworg, 0.25f, ent->render.model->yawmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->yawmaxs, maxs); - } - else - { - VectorMA(neworg, 0.25f, ent->render.model->normalmins, mins); - VectorMA(neworg, 0.25f, ent->render.model->normalmaxs, maxs); - } - */ mins[0] = neworg[0] - 16.0f; mins[1] = neworg[1] - 16.0f; mins[2] = neworg[2] - 16.0f; @@ -655,7 +564,7 @@ static void CL_RelinkNetworkEntities() // hack to make glowing player light shine on their gun if (i == cl.viewentity && !chase_active.integer) vec[2] += 30; - CL_AllocDlight (/*&ent->render*/ NULL, vec, 1, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0); + CL_AllocDlight (NULL, vec, 1, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0); } if (chase_active.integer) @@ -1052,3 +961,4 @@ void CL_Init (void) CL_Screen_Init(); CL_CGVM_Init(); } + diff --git a/cl_parse.c b/cl_parse.c index 8f4df288..ef85680c 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -116,19 +116,6 @@ This error checks and tracks the total number of entities */ entity_t *CL_EntityNum (int num) { - /* - if (num >= cl.num_entities) - { - if (num >= MAX_EDICTS) - Host_Error ("CL_EntityNum: %i is an invalid number",num); - cl.num_entities = num; -// while (cl.num_entities <= num) -// { -// cl_entities[cl.num_entities].colormap = -1; // no special coloring -// cl.num_entities++; -// } - } - */ if (num >= MAX_EDICTS) Host_Error ("CL_EntityNum: %i is an invalid number",num); @@ -341,7 +328,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); break; case 4: - SCR_EndLoadingPlaque (); // allow normal screen updates Con_ClearNotify(); break; } @@ -597,12 +583,8 @@ void CL_ParseUpdate (int bits) if (bits & U_EFFECTS2) new.effects = (new.effects & 0x00FF) | (MSG_ReadByte() << 8); if (bits & U_GLOWSIZE) new.glowsize = MSG_ReadByte(); if (bits & U_GLOWCOLOR) new.glowcolor = MSG_ReadByte(); -#if 0 - if (bits & U_COLORMOD) {int i = MSG_ReadByte();float r = (((int) i >> 5) & 7) * 1.0 / 7, g = (((int) i >> 2) & 7) * 1.0 / 7, b = ((int) i & 3) * 1.0 / 3;Con_Printf("warning: U_COLORMOD %i (%1.2f %1.2f %1.2f) ignored\n", i, r, g, b);} -#else // apparently the dpcrush demo uses this (unintended, and it uses white anyway) if (bits & U_COLORMOD) MSG_ReadByte(); -#endif if (bits & U_GLOWTRAIL) new.flags |= RENDER_GLOWTRAIL; if (bits & U_FRAME2) new.frame = (new.frame & 0x00FF) | (MSG_ReadByte() << 8); if (bits & U_MODEL2) new.modelindex = (new.modelindex & 0x00FF) | (MSG_ReadByte() << 8); @@ -722,8 +704,7 @@ void CL_BitProfile_f(void) Con_Printf("bitprofile: %i updates\n"); if (bitprofilecount) for (i = 0;i < 32;i++) -// if (bitprofile[i]) - Con_Printf("%s: %i %3.2f%%\n", bitprofilenames[i], bitprofile[i], bitprofile[i] * 100.0 / bitprofilecount); + Con_Printf("%s: %i %3.2f%%\n", bitprofilenames[i], bitprofile[i], bitprofile[i] * 100.0 / bitprofilecount); Con_Printf("\n"); for (i = 0;i < 32;i++) bitprofile[i] = 0; @@ -1058,7 +1039,6 @@ void CL_ParseServerMessage (void) break; case svc_nop: -// Con_Printf ("svc_nop\n"); break; case svc_time: @@ -1108,7 +1088,6 @@ void CL_ParseServerMessage (void) case svc_serverinfo: CL_ParseServerInfo (); -// vid.recalc_refdef = true; // leave intermission full screen break; case svc_setangle: @@ -1246,20 +1225,17 @@ void CL_ParseServerMessage (void) case svc_intermission: cl.intermission = 1; cl.completed_time = cl.time; -// vid.recalc_refdef = true; // go to full screen break; case svc_finale: cl.intermission = 2; cl.completed_time = cl.time; -// vid.recalc_refdef = true; // go to full screen SCR_CenterPrint (MSG_ReadString ()); break; case svc_cutscene: cl.intermission = 3; cl.completed_time = cl.time; -// vid.recalc_refdef = true; // go to full screen SCR_CenterPrint (MSG_ReadString ()); break; @@ -1279,15 +1255,6 @@ void CL_ParseServerMessage (void) { int length; length = (int) ((unsigned short) MSG_ReadShort()); - /* - if (cgamenetbuffersize < length) - { - cgamenetbuffersize = length; - if (cgamenetbuffer) - Mem_Free(cgamenetbuffer); - cgamenetbuffer = Mem_Alloc(cgamenetbuffersize); - } - */ for (i = 0;i < length;i++) cgamenetbuffer[i] = MSG_ReadByte(); if (!msg_badread) @@ -1308,3 +1275,4 @@ void CL_ParseServerMessage (void) if (entitiesupdated) CL_EntityUpdateEnd(); } + diff --git a/cl_particles.c b/cl_particles.c index 660ab4a4..cf0a0c82 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -95,7 +95,6 @@ static int particlepalette[256] = }; static int explosparkramp[8] = {0x4b0700, 0x6f0f00, 0x931f07, 0xb7330f, 0xcf632b, 0xe3974f, 0xffe7b5, 0xffffff}; -//static int explounderwatersparkramp[8] = {0x00074b, 0x000f6f, 0x071f93, 0x0f33b7, 0x2b63cf, 0x4f97e3, 0xb5e7ff, 0xffffff}; // these must match r_part.c's textures static const int tex_smoke[8] = {0, 1, 2, 3, 4, 5, 6, 7}; @@ -103,13 +102,11 @@ static const int tex_rainsplash[16] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, static const int tex_particle = 24; static const int tex_rain = 25; static const int tex_bubble = 26; -//static const int tex_rocketglow = 27; static int cl_maxparticles; static int cl_numparticles; static particle_t *particles; static particle_t **freeparticles; // list used only in compacting particles array -//static renderparticle_t *cl_renderparticles; static cvar_t cl_particles = {CVAR_SAVE, "cl_particles", "1"}; static cvar_t cl_particles_size = {CVAR_SAVE, "cl_particles_size", "1"}; @@ -169,9 +166,6 @@ void CL_Particles_Init (void) particles = (particle_t *) Mem_Alloc(cl_part_mempool, cl_maxparticles * sizeof(particle_t)); freeparticles = (void *) Mem_Alloc(cl_part_mempool, cl_maxparticles * sizeof(particle_t *)); cl_numparticles = 0; - - // FIXME: r_refdef stuff should be allocated somewhere else? - //r_refdef.particles = cl_renderparticles = Mem_Alloc(cl_refdef_mempool, cl_maxparticles * sizeof(renderparticle_t)); } #define particle(ptype, porientation, pcolor1, pcolor2, ptex, plight, padditive, pscalex, pscaley, palpha, ptime, pbounce, px, py, pz, pvx, pvy, pvz, ptime2, pvx2, pvy2, pvz2, pfriction, ppressure)\ @@ -209,10 +203,6 @@ void CL_Particles_Init (void) part->color[2] = cb2;\ part->color[3] = 0xFF;\ part->flags = partflags;\ - /*part->tex = (ptex);*/\ - /*part->orientation = (porientation);*/\ - /*part->dynlight = (plight);*/\ - /*part->additive = (padditive);*/\ part->scalex = (pscalex);\ part->scaley = (pscaley);\ part->alpha = (palpha);\ @@ -374,9 +364,6 @@ void CL_ParticleExplosion (vec3_t org, int smoke) i = Mod_PointInLeaf(org, cl.worldmodel)->contents; if (i == CONTENTS_SLIME || i == CONTENTS_WATER) { - //for (i = 0;i < 128;i++) - // particle(pt_bubble, PARTICLE_BILLBOARD, 0x808080, 0xFFFFFF, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, org[0] + lhrandom(-16, 16), org[1] + lhrandom(-16, 16), org[2] + lhrandom(-16, 16), lhrandom(-96, 96), lhrandom(-96, 96), lhrandom(-96, 96), 0, 0, 0, 0, 0, 0); - ang[2] = lhrandom(0, 360); fractalnoisequick(noise1, 32, 4); fractalnoisequick(noise2, 32, 8); @@ -422,32 +409,12 @@ void CL_ParticleExplosion (vec3_t org, int smoke) VectorScale(v, 0.75, v); k = explosparkramp[(noise2[j*32+i] >> 5)]; particle(pt_spark, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 10, 10, lhrandom(128, 255), 9999, 1.5, end[0], end[1], end[2], v[0], v[1], v[2] + 160.0f, 512.0f, 0, 0, 0, 2, 0); - // VectorRandom(v); - // VectorScale(v, 384, v); - // particle(pt_spark, PARTICLE_BILLBOARD, explosparkramp[rand()&7], tex_particle, false, true, 2, 2, lhrandom(16, 255), 9999, 1.5, end[0], end[1], end[2], v[0], v[1], v[2] + 160.0f, 512.0f, 0, 0, 0, 2, 0); } } } } else - { - /* - int i; - vec3_t v; - for (i = 0;i < 256;i++) - { - do - { - VectorRandom(v); - } - while(DotProduct(v,v) < 0.75); - VectorScale(v, 512, v); - k = explosparkramp[rand()&7]; - particle(pt_spark, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 4, 4, 255, 9999, 1.5, org[0], org[1], org[2], v[0], v[1], v[2] + 160.0f, 512.0f, 0, 0, 0, 2, 0); - } - */ R_NewExplosion(org); - } } /* @@ -476,18 +443,11 @@ CL_BlobExplosion */ void CL_BlobExplosion (vec3_t org) { - //int i; if (!cl_particles.integer) return; R_Stain(org, 96, 80, 80, 80, 128, 176, 176, 176, 128); - //R_Stain(org, 96, 96, 64, 96, 128, 160, 128, 160, 128); R_NewExplosion(org); - - //for (i = 0;i < 256;i++) - // particle(pt_blob , PARTICLE_BILLBOARD, particlepalette[ 66+(rand()%6)], tex_particle, false, true, 4, 4, 255, 9999, 0, org[0] + lhrandom(-16, 16), org[1] + lhrandom(-16, 16), org[2] + lhrandom(-16, 16), lhrandom(-4, 4), lhrandom(-4, 4), lhrandom(-128, 128), 0, 0, 0, 0, 0, 0); - //for (i = 0;i < 256;i++) - // particle(pt_blob2, PARTICLE_BILLBOARD, particlepalette[150+(rand()%6)], tex_particle, false, true, 4, 4, 255, 9999, 0, org[0] + lhrandom(-16, 16), org[1] + lhrandom(-16, 16), org[2] + lhrandom(-16, 16), lhrandom(-4, 4), lhrandom(-4, 4), lhrandom(-128, 128), 0, 0, 0, 0, 0, 0); } /* @@ -675,7 +635,6 @@ void CL_Stardust (vec3_t mins, vec3_t maxs, int count) int k; float t; vec3_t o, v, center; - //Con_Printf("CL_Stardust ('%f %f %f', '%f %f %f', %d);\n", mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2], count); if (!cl_particles.integer) return; if (maxs[0] <= mins[0]) {t = mins[0];mins[0] = maxs[0];maxs[0] = t;} @@ -727,8 +686,6 @@ void CL_Flames (vec3_t org, vec3_t vel, int count) { k = particlepalette[224 + (rand()&15)]; particle(pt_flame, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 4, 4, lhrandom(64, 128), 9999, 1.1, org[0], org[1], org[2], vel[0] + lhrandom(-128, 128), vel[1] + lhrandom(-128, 128), vel[2] + lhrandom(-128, 128), 0, 0, 0, 0, 1, 0); - //if (count & 1) - // particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, 6, 6, lhrandom(32, 64), 9999, 0, org[0], org[1], org[2], vel[0] + lhrandom(-64, 64), vel[1] + lhrandom(-64, 64), vel[2] + lhrandom(-64, 64), 64.0f, 0, 0, 0, 0, 0); } } @@ -778,7 +735,6 @@ void CL_TeleportSplash (vec3_t org) for (i=-16 ; i<16 ; i+=8) for (j=-16 ; j<16 ; j+=8) for (k=-24 ; k<32 ; k+=8) - //particle(pt_fade, PARTICLE_BILLBOARD, 0xA0A0A0, 0xFFFFFF, tex_particle, false, true, 1.5, 1.5, lhrandom(64, 128), 9999, 0, org[0] + i + lhrandom(0, 8), org[1] + j + lhrandom(0, 8), org[2] + k + lhrandom(0, 8), i*2 + lhrandom(-12.5, 12.5), j*2 + lhrandom(-12.5, 12.5), k*2 + lhrandom(27.5, 52.5), 384.0f, 0, 0, 0, 1, 0); particle(pt_fade, PARTICLE_BILLBOARD, 0xA0A0A0, 0xFFFFFF, tex_particle, false, true, 10, 10, lhrandom(64, 128), 9999, 0, org[0] + i + lhrandom(0, 8), org[1] + j + lhrandom(0, 8), org[2] + k + lhrandom(0, 8), lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-256, 256), 256.0f, 0, 0, 0, 1, 0); } @@ -792,9 +748,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) VectorSubtract(end, start, dir); VectorNormalize(dir); - //if (type == 0 && host_frametime != 0) // rocket glow - // particle(pt_oneframe, PARTICLE_BILLBOARD, 0xFFFFFF, 0xFFFFFF, tex_rocketglow, false, true, 24, 24, 255, 9999, 0, end[0] - 12 * dir[0], end[1] - 12 * dir[1], end[2] - 12 * dir[2], 0, 0, 0, 0, 0, 0, 0, 0, 0); - VectorSubtract (end, start, vec); len = VectorNormalizeLength (vec); dec = -ent->persistent.trail_time; @@ -826,26 +779,11 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) case 0: // rocket trail if (!cl_particles_smoke.integer) return; - //dec = 5; - //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_particle, true, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 256.0f, 0, 0, 0, 0, 0); dec = 6; particle(pt_fade, PARTICLE_BILLBOARD, 0x303030, 0x606060, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 64.0f, 0, 0, 0, 0, 0); - //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-10, 10), lhrandom(-10, 10), lhrandom(-10, 10), 128.0f, 0, 0, 0, 0, 0); - //dec = 10; - //particle(pt_smoke, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, 2, 2, 160, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0, 0, 0); if (bubbles && cl_particles_bubbles.integer) { particle(pt_bubble, PARTICLE_BILLBOARD, 0x404040, 0x808080, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0); - //particle(pt_bubble, PARTICLE_BILLBOARD, 0x404040, 0x808080, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0); - } - else - { - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 2, 2, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 512.0f, 0, 0, 0, 1, 0); - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 2, 2, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 512.0f, 0, 0, 0, 1, 0); - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 1, 1, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64) - vel[0] * 0.0625, lhrandom(-64, 64) - vel[1] * 0.0625, lhrandom(-64, 64) - vel[2] * 0.0625, 512.0f, 0, 0, 0, 1, 0); - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 1, 1, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64) - vel[0] * 0.0625, lhrandom(-64, 64) - vel[1] * 0.0625, lhrandom(-64, 64) - vel[2] * 0.0625, 512.0f, 0, 0, 0, 1, 0); - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 1, 1, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64) - vel[0] * 0.0625, lhrandom(-64, 64) - vel[1] * 0.0625, lhrandom(-64, 64) - vel[2] * 0.0625, 512.0f, 0, 0, 0, 1, 0); - //particle(pt_spark, PARTICLE_BILLBOARD, particlepalette[0x68 + (rand() & 7)], tex_particle, false, true, 1, 1, lhrandom(128, 255), 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-64, 64) - vel[0] * 0.0625, lhrandom(-64, 64) - vel[1] * 0.0625, lhrandom(-64, 64) - vel[2] * 0.0625, 512.0f, 0, 0, 0, 1, 0); } break; @@ -853,15 +791,11 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) // FIXME: make it gradually stop smoking if (!cl_particles_smoke.integer) return; - //dec = 5; - //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_particle, true, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 256.0f, 0, 0, 0, 0, 0); dec = 6; particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 128.0f, 0, 0, 0, 0, 0); - //particle(pt_smoke, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, 2, 2, 160, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0, 0, 0); if (bubbles && cl_particles_bubbles.integer) { particle(pt_bubble, PARTICLE_BILLBOARD, 0x404040, 0x808080, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0); - //particle(pt_bubble, PARTICLE_BILLBOARD, c * 2, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0); } break; @@ -871,8 +805,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) return; dec = lhrandom(cl_particles_blood_size_min.value, cl_particles_blood_size_max.value); particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); - //particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); - //particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_particle, true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); break; case 4: // slight blood @@ -880,25 +812,20 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) return; dec = lhrandom(cl_particles_blood_size_min.value, cl_particles_blood_size_max.value); particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); - //particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 128.0f, 9999, -1, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); - //particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_particle, true, false, dec, dec, cl_particles_blood_alpha.value * 128.0f, 9999, -1, pos[0], pos[1], pos[2], lhrandom(-64, 64), lhrandom(-64, 64), lhrandom(-64, 64), 0, 0, 0, 0, 1, 0); break; case 3: // green tracer dec = 6; - //particle(pt_fade, PARTICLE_BILLBOARD, 0x373707, 0x373707, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); particle(pt_fade, PARTICLE_BILLBOARD, 0x373707, 0x373707, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0); break; case 5: // flame tracer dec = 6; - //particle(pt_fade, PARTICLE_BILLBOARD, 0xCF632B, 0xCF632B, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); particle(pt_fade, PARTICLE_BILLBOARD, 0xCF632B, 0xCF632B, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0); break; case 6: // voor trail dec = 6; - //particle(pt_fade, PARTICLE_BILLBOARD, 0x47232B, 0x47232B, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); particle(pt_fade, PARTICLE_BILLBOARD, 0x47232B, 0x47232B, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0); break; @@ -945,16 +872,12 @@ CL_MoveParticles void CL_MoveParticles (void) { particle_t *p; - //renderparticle_t *r, *rend; int i, activeparticles, maxparticle, j, a, pressureused = false, content; float gravity, dvel, frametime, f, dist, normal[3], v[3], org[3]; // LordHavoc: early out condition if (!cl_numparticles) - { - //r_refdef.numparticles = 0; return; - } frametime = cl.time - cl.oldtime; if (!frametime) @@ -965,7 +888,7 @@ void CL_MoveParticles (void) activeparticles = 0; maxparticle = -1; j = 0; - for (i = 0, p = particles/*, r = r_refdef.particles, rend = r + cl_maxparticles*/;i < cl_numparticles;i++, p++) + for (i = 0, p = particles;i < cl_numparticles;i++, p++) { if (p->die < cl.time) { @@ -1049,45 +972,6 @@ void CL_MoveParticles (void) if (a != CONTENTS_EMPTY && a != CONTENTS_SKY) { p->die = -1; - /* - if (a == CONTENTS_SOLID && Mod_PointInLeaf(p->oldorg, cl.worldmodel)->contents == CONTENTS_SOLID) - break; // still in solid - p->die = cl.time + 1000; - p->vel[0] = p->vel[1] = p->vel[2] = 0; - switch (a) - { - case CONTENTS_LAVA: - case CONTENTS_SLIME: - p->tex = tex_smoke[rand()&7]; - p->orientation = PARTICLE_BILLBOARD; - p->type = pt_steam; - p->alpha = 96; - p->scalex = 5; - p->scaley = 5; - p->vel[2] = 96; - break; - case CONTENTS_WATER: - p->tex = tex_smoke[rand()&7]; - p->orientation = PARTICLE_BILLBOARD; - p->type = pt_splash; - p->alpha = 96; - p->scalex = 5; - p->scaley = 5; - p->vel[2] = 96; - break; - default: // CONTENTS_SOLID and any others - TraceLine(p->oldorg, p->org, v, normal, 0, true); - VectorCopy(v, p->org); - p->tex = tex_smoke[rand()&7]; - p->orientation = PARTICLE_BILLBOARD; - p->type = pt_fade; - p->time2 = 384.0f; - p->scalex = 5; - p->scaley = 5; - VectorClear(p->vel); - break; - } - */ } break; case pt_blood: @@ -1099,11 +983,9 @@ void CL_MoveParticles (void) { if (a == CONTENTS_WATER || a == CONTENTS_SLIME) { - //p->friction = 5; p->scalex += frametime * (cl_particles_blood_size_min.value + cl_particles_blood_size_max.value); p->scaley += frametime * (cl_particles_blood_size_min.value + cl_particles_blood_size_max.value); p->alpha -= frametime * max(cl_particles_blood_alpha.value, 0.01f) * 128.0f; - //p->vel[2] += gravity * 0.25f; if (p->alpha < 1) p->die = -1; } @@ -1149,15 +1031,6 @@ void CL_MoveParticles (void) { p->die = -1; break; - /* - p->tex = tex_smoke[rand()&7]; - p->orientation = PARTICLE_BILLBOARD; - p->type = pt_splashpuff; - p->scalex = 4; - p->scaley = 4; - p->vel[0] = p->vel[1] = p->vel[2] = 0; - break; - */ } p->vel[0] *= (1 - (frametime * 0.0625)); p->vel[1] *= (1 - (frametime * 0.0625)); @@ -1185,7 +1058,6 @@ void CL_MoveParticles (void) p->scalex += frametime * 16; p->scaley += frametime * 16; p->alpha -= frametime * 320; - //p->vel[2] += gravity * 0.2; if (p->alpha < 1) p->die = -1; break; @@ -1208,63 +1080,7 @@ void CL_MoveParticles (void) a = content; if (a != CONTENTS_EMPTY && a != CONTENTS_SKY) p->die = -1; - /* - f = 0; - b = Mod_PointInLeaf(p->oldorg, cl.worldmodel)->contents; - VectorCopy(p->oldorg, o); - while (f < 1) - { - a = b; - f = TraceLine(o, p->org, v, normal, a, true); - b = cl_traceline_endcontents; - if (f < 1 && b != CONTENTS_EMPTY && b != CONTENTS_SKY) - { - #if 1 - p->die = -1; - #else - p->die = cl.time + 1000; - p->vel[0] = p->vel[1] = p->vel[2] = 0; - VectorCopy(v, p->org); - switch (b) - { - case CONTENTS_LAVA: - case CONTENTS_SLIME: - p->tex = tex_smoke[rand()&7]; - p->orientation = PARTICLE_BILLBOARD; - p->type = pt_steam; - p->scalex = 3; - p->scaley = 3; - p->vel[2] = 96; - break; - default: // water, solid, and anything else - p->tex = tex_rainsplash[0]; - p->orientation = PARTICLE_ORIENTED_DOUBLESIDED; - p->time2 = 0; - VectorCopy(normal, p->vel2); - // VectorAdd(p->org, normal, p->org); - p->type = pt_raindropsplash; - p->scalex = 8; - p->scaley = 8; - break; - } - #endif - break; - } - } - */ - break; - /* - case pt_raindropsplash: - p->time2 += frametime * 64.0f; - if (p->time2 >= 16.0f) - { - p->die = -1; - break; - } - p->tex = tex_rainsplash[(int) p->time2]; - p->orientation = PARTICLE_ORIENTED_DOUBLESIDED; break; - */ case pt_flame: p->alpha -= frametime * 384; p->vel[2] += gravity; @@ -1297,30 +1113,8 @@ void CL_MoveParticles (void) activeparticles++; if (p->pressure) pressureused = true; - - /* - // build renderparticle for renderer to use - r->orientation = p->orientation; - r->additive = p->additive; - r->dir[0] = p->vel2[0]; - r->dir[1] = p->vel2[1]; - r->dir[2] = p->vel2[2]; - r->org[0] = p->org[0]; - r->org[1] = p->org[1]; - r->org[2] = p->org[2]; - r->tex = p->tex; - r->scalex = p->scalex * cl_particles_size.value; - r->scaley = p->scaley * cl_particles_size.value; - r->dynlight = p->dynlight; - r->color[0] = p->color[0] * (1.0f / 255.0f); - r->color[1] = p->color[1] * (1.0f / 255.0f); - r->color[2] = p->color[2] * (1.0f / 255.0f); - r->color[3] = p->alpha * (1.0f / 255.0f); - r++; - */ } } - //r_refdef.numparticles = r - r_refdef.particles; // fill in gaps to compact the array i = 0; while (maxparticle >= activeparticles) @@ -1353,8 +1147,6 @@ void CL_MoveParticles (void) { dist = freeparticles[j]->scalex * 4.0f * frametime / sqrt(dist); VectorMA(p->vel, dist, diff, p->vel); - //dist = freeparticles[j]->scalex * 4.0f * frametime / dist; - //VectorMA(p->vel, dist, freeparticles[j]->vel, p->vel); } } } @@ -1460,42 +1252,6 @@ static void R_InitParticleTexture (void) setuptex(i + 0, 0, i + 0, &data[0][0][0], particletexturedata); setuptex(i + 0, 1, i + 0, &data[0][0][0], particletexturedata); } - /* - for (i = 0;i < 8;i++) - { - do - { - fractalnoise(&noise1[0][0], 64, 4); - fractalnoise(&noise2[0][0], 64, 8); - m = 0; - for (y = 0;y < 32;y++) - { - dy = y - 16; - for (x = 0;x < 32;x++) - { - d = (noise1[y][x] - 128) * 2 + 128; - d = bound(0, d, 255); - data[y][x][0] = data[y][x][1] = data[y][x][2] = d; - dx = x - 16; - d = (noise2[y][x] - 128) * 3 + 192; - if (d > 0) - d = (d * (256 - (int) (dx*dx+dy*dy))) >> 8; - d = bound(0, d, 255); - data[y][x][3] = (qbyte) d; - if (m < d) - m = d; - } - } - } - while (m < 224); - - setuptex(i + 0, 0, i + 0, &data[0][0][0], particletexturedata); - for (y = 0;y < 32;y++) - for (x = 0;x < 32;x++) - data[y][x][0] = data[y][x][1] = data[y][x][2] = 255; - setuptex(i + 0, 1, i + 8, &data[0][0][0], particletexturedata); - } - */ // rain splash for (i = 0;i < 16;i++) @@ -1562,28 +1318,6 @@ static void R_InitParticleTexture (void) setuptex(26, 0, 34, &data[0][0][0], particletexturedata); setuptex(26, 1, 34, &data[0][0][0], particletexturedata); - // rocket flare - /* - for (y = 0;y < 32;y++) - { - dy = y - 16; - for (x = 0;x < 32;x++) - { - dx = x - 16; - d = (2048.0f / (dx*dx+dy*dy+1)) - 8.0f; - data[y][x][0] = bound(0, d * 1.0f, 255); - data[y][x][1] = bound(0, d * 0.8f, 255); - data[y][x][2] = bound(0, d * 0.5f, 255); - data[y][x][3] = bound(0, d * 1.0f, 255); - } - } - setuptex(27, 0, 35, &data[0][0][0], particletexturedata); - for (y = 0;y < 32;y++) - for (x = 0;x < 32;x++) - data[y][x][0] = data[y][x][1] = data[y][x][2] = 255; - setuptex(28, 1, 36, &data[0][0][0], particletexturedata); - */ - particlefonttexture = R_LoadTexture (particletexturepool, "particlefont", 256, 256, particletexturedata, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); } @@ -1613,7 +1347,6 @@ int partindexarray[6] = {0, 1, 2, 0, 2, 3}; void R_DrawParticles (void) { - //renderparticle_t *r; int i, lighting, dynlight, additive, texnum, orientation; float minparticledist, org[3], uprightangles[3], up2[3], right2[3], v[3], right[3], up[3], tvxyz[4][4], tvst[4][2], fog, ifog, fogvec[3]; mleaf_t *leaf; @@ -1622,7 +1355,6 @@ void R_DrawParticles (void) particle_t *p; // LordHavoc: early out conditions - //if ((!r_refdef.numparticles) || (!r_drawparticles.integer)) if ((!cl_numparticles) || (!r_drawparticles.integer)) return; @@ -1630,7 +1362,7 @@ void R_DrawParticles (void) if (!r_dynamic.integer) lighting = 0; - c_particles += cl_numparticles; //r_refdef.numparticles; + c_particles += cl_numparticles; uprightangles[0] = 0; uprightangles[1] = r_refdef.viewangles[1]; @@ -1654,7 +1386,7 @@ void R_DrawParticles (void) m.texcoords[0] = &tvst[0][0]; m.texcoordstep[0] = sizeof(float[2]); - for (i = 0/*, r = r_refdef.particles*/, p = particles;i < /*r_refdef.numparticles*/cl_numparticles;i++, p++) + for (i = 0, p = particles;i < cl_numparticles;i++, p++) { // LordHavoc: only render if not too close if (DotProduct(p->org, vpn) < minparticledist) @@ -1828,3 +1560,4 @@ void R_DrawParticles (void) } } } + diff --git a/cl_screen.c b/cl_screen.c index 74f00efc..17079c92 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -20,9 +20,7 @@ float scr_conlines; // lines of console to display int clearconsole; int clearnotify; -//qboolean scr_disabled_for_loading; qboolean scr_drawloading = false; -//float scr_disabled_time; static qbyte menuplyr_pixels[4096]; @@ -142,18 +140,6 @@ void SCR_CheckDrawCenterString (void) SCR_DrawCenterString (); } -/* -============== -SCR_DrawRam -============== -*/ -void SCR_DrawRam (void) -{ -// if (!scr_showram.integer) -// return; -// DrawQ_Pic (32, 0, "ram", 0, 0, 1, 1, 1, 1, 0); -} - /* ============== SCR_DrawTurtle @@ -232,9 +218,6 @@ void SCR_DrawLoading (void) { cachepic_t *pic; - //if (!scr_drawloading) - // return; - pic = Draw_CachePic ("gfx/loading.lmp"); DrawQ_Pic ((vid.conwidth - pic->width)/2, (vid.conheight - pic->height)/2, "gfx/loading.lmp", 0, 0, 1, 1, 1, 1, 0); } @@ -313,42 +296,10 @@ void SCR_BeginLoadingPlaque (void) S_StopAllSounds (true); -// if (cls.state != ca_connected) -// return; -// if (cls.signon != SIGNONS) -// return; - -// redraw with no console and the loading plaque -// Con_ClearNotify (); -// scr_centertime_off = 0; -// scr_con_current = 0; - scr_drawloading = true; CL_UpdateScreen (); scr_drawloading = true; CL_UpdateScreen (); - //scr_drawloading = false; - -// scr_disabled_for_loading = true; -// scr_disabled_time = realtime; -} - -/* -=============== -SCR_EndLoadingPlaque - -================ -*/ -void SCR_EndLoadingPlaque (void) -{ - /* - if (!scr_drawloading) - return; - -// scr_disabled_for_loading = false; - scr_drawloading = false; - Con_ClearNotify (); - */ } //============================================================================= @@ -401,10 +352,6 @@ void R_TimeReport_Start(void) { speedstringcount = 0; AngleVectors (r_refdef.viewangles, vpn, NULL, NULL); - //sprintf(r_speeds_string, "org:'%c%6.2f %c%6.2f %c%6.2f' ang:'%c%3.0f %c%3.0f %c%3.0f' dir:'%c%2.3f %c%2.3f %c%2.3f'\n%6i walls %6i dlitwalls %7i modeltris %7i meshtris\nBSP: %6i faces %6i nodes %6i leafs\n%4i models %4i bmodels %4i sprites %5i particles %3i dlights\n", - // r_refdef.vieworg[0] < 0 ? '-' : ' ', fabs(r_refdef.vieworg[0]), r_refdef.vieworg[1] < 0 ? '-' : ' ', fabs(r_refdef.vieworg[1]), r_refdef.vieworg[2] < 0 ? '-' : ' ', fabs(r_refdef.vieworg[2]), - // r_refdef.viewangles[0] < 0 ? '-' : ' ', fabs(r_refdef.viewangles[0]), r_refdef.viewangles[1] < 0 ? '-' : ' ', fabs(r_refdef.viewangles[1]), r_refdef.viewangles[2] < 0 ? '-' : ' ', fabs(r_refdef.viewangles[2]), - // vpn[0] < 0 ? '-' : ' ', fabs(vpn[0]), vpn[1] < 0 ? '-' : ' ', fabs(vpn[1]), vpn[2] < 0 ? '-' : ' ', fabs(vpn[2]), sprintf(r_speeds_string, "org:'%+8.2f %+8.2f %+8.2f' ang:'%+4.0f %+4.0f %+4.0f' dir:'%+2.3f %+2.3f %+2.3f'\n" "world:%6i faces%6i nodes%6i leafs%6i walls%6i dlitwalls\n" @@ -425,7 +372,6 @@ void R_TimeReport_Start(void) c_bmodels = 0; c_sprites = 0; c_particles = 0; - // c_dlights = 0; r_timereport_start = Sys_DoubleTime(); } @@ -443,7 +389,7 @@ void R_TimeReport_End(void) for (i = 0;r_speeds_string[i];i++) if (r_speeds_string[i] == '\n') lines++; - y = vid.conheight - sb_lines - lines * 8/* - 8*/; + y = vid.conheight - sb_lines - lines * 8; i = j = 0; DrawQ_Fill(0, y, vid.conwidth, lines * 8, 0, 0, 0, 0.5, 0); while (r_speeds_string[i]) @@ -1000,7 +946,6 @@ void CL_UpdateScreen(void) R_TimeReport("setup"); - SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); @@ -1038,3 +983,4 @@ void CL_Screen_NewMap(void) { SHOWLMP_clear(); } + diff --git a/cl_tent.c b/cl_tent.c index 971dc6ef..52cca6dd 100644 --- a/cl_tent.c +++ b/cl_tent.c @@ -138,7 +138,6 @@ void CL_ParseTEnt (void) Mod_FindNonSolidLocation(pos, cl.worldmodel); // LordHavoc: changed to spark shower CL_SparkShower(pos, vec3_origin, 15); - //CL_RunParticleEffect (pos, vec3_origin, 0, 10); if ( rand() % 5 ) S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); else @@ -157,7 +156,6 @@ void CL_ParseTEnt (void) Mod_FindNonSolidLocation(pos, cl.worldmodel); // LordHavoc: changed to spark shower CL_SparkShower(pos, vec3_origin, 15); - //CL_RunParticleEffect (pos, vec3_origin, 0, 10); CL_AllocDlight (NULL, pos, 200, 0.1f, 0.1f, 1.0f, 1000, 0.2); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); if ( rand() % 5 ) @@ -178,7 +176,6 @@ void CL_ParseTEnt (void) Mod_FindNonSolidLocation(pos, cl.worldmodel); // LordHavoc: changed to dust shower CL_SparkShower(pos, vec3_origin, 30); - //CL_RunParticleEffect (pos, vec3_origin, 0, 20); if ( rand() % 5 ) S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); else @@ -197,7 +194,6 @@ void CL_ParseTEnt (void) Mod_FindNonSolidLocation(pos, cl.worldmodel); // LordHavoc: changed to dust shower CL_SparkShower(pos, vec3_origin, 30); - //CL_RunParticleEffect (pos, vec3_origin, 0, 20); CL_AllocDlight (NULL, pos, 200, 0.1f, 0.1f, 1.0f, 1000, 0.2); if ( rand() % 5 ) S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); @@ -282,7 +278,6 @@ void CL_ParseTEnt (void) Mod_FindNonSolidLocation(pos, cl.worldmodel); // LordHavoc: changed to dust shower CL_SparkShower(pos, vec3_origin, 15); - //CL_RunParticleEffect (pos, vec3_origin, 0, 20); break; case TE_GUNSHOTQUAD: // quad bullet hitting wall @@ -296,7 +291,6 @@ void CL_ParseTEnt (void) MSG_ReadVector(pos); Mod_FindNonSolidLocation(pos, cl.worldmodel); CL_ParticleExplosion (pos, false); -// CL_BlastParticles (pos, 120, 120); // LordHavoc: boosted color from 1.0, 0.8, 0.4 to 1.25, 1.0, 0.5 CL_AllocDlight (NULL, pos, 350, 1.25f, 1.0f, 0.5f, 700, 0.5); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); @@ -306,26 +300,14 @@ void CL_ParseTEnt (void) MSG_ReadVector(pos); Mod_FindNonSolidLocation(pos, cl.worldmodel); CL_ParticleExplosion (pos, false); -// CL_BlastParticles (pos, 120, 480); CL_AllocDlight (NULL, pos, 600, 0.5f, 0.4f, 1.0f, 1200, 0.5); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; - /* - case TE_SMOKEEXPLOSION: // rocket explosion with a cloud of smoke - MSG_ReadVector(pos); - Mod_FindNonSolidLocation(pos, cl.worldmodel); - CL_ParticleExplosion (pos, true); - CL_AllocDlight (NULL, pos, 350, 1.0f, 0.8f, 0.4f, 700, 0.5); - S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); - break; - */ - case TE_EXPLOSION3: // Nehahra movie colored lighting explosion MSG_ReadVector(pos); Mod_FindNonSolidLocation(pos, cl.worldmodel); CL_ParticleExplosion (pos, false); -// CL_BlastParticles (pos, 120, 120); CL_AllocDlight (NULL, pos, 350, MSG_ReadCoord(), MSG_ReadCoord(), MSG_ReadCoord(), 700, 0.5); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; @@ -334,7 +316,6 @@ void CL_ParseTEnt (void) MSG_ReadVector(pos); Mod_FindNonSolidLocation(pos, cl.worldmodel); CL_ParticleExplosion (pos, false); -// CL_BlastParticles (pos, 120, 120); color[0] = MSG_ReadByte() * (1.0 / 255.0); color[1] = MSG_ReadByte() * (1.0 / 255.0); color[2] = MSG_ReadByte() * (1.0 / 255.0); @@ -346,7 +327,6 @@ void CL_ParseTEnt (void) MSG_ReadVector(pos); Mod_FindNonSolidLocation(pos, cl.worldmodel); CL_BlobExplosion (pos); -// CL_BlastParticles (pos, 120, 120); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); CL_AllocDlight (NULL, pos, 600, 0.8f, 0.4f, 1.0f, 1200, 0.5); @@ -428,7 +408,6 @@ void CL_ParseTEnt (void) colorStart = MSG_ReadByte (); colorLength = MSG_ReadByte (); CL_ParticleExplosion2 (pos, colorStart, colorLength); -// CL_BlastParticles (pos, 80, 80); tempcolor = (qbyte *)&d_8to24table[(rand()%colorLength) + colorStart]; CL_AllocDlight (NULL, pos, 350, tempcolor[0] * (1.0f / 255.0f), tempcolor[1] * (1.0f / 255.0f), tempcolor[2] * (1.0f / 255.0f), 700, 0.5); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); @@ -535,4 +514,3 @@ void CL_UpdateTEnts (void) } - diff --git a/cmd.c b/cmd.c index a9da1b0d..d46db844 100644 --- a/cmd.c +++ b/cmd.c @@ -510,10 +510,8 @@ char *Cmd_Args (void) } -#if 1 #define CMD_TOKENIZELENGTH 4096 char cmd_tokenizebuffer[CMD_TOKENIZELENGTH]; -#endif /* ============ @@ -525,15 +523,8 @@ Parses the given string into command line tokens. static void Cmd_TokenizeString (char *text) { int l; -#ifdef CMD_TOKENIZELENGTH int pos; pos = 0; -#else - int i; -// clear the args from the last string - for (i=0 ; i CMD_TOKENIZELENGTH) Sys_Error("Cmd_TokenizeString: ran out of %i character buffer space for command arguements\n", CMD_TOKENIZELENGTH); cmd_argv[cmd_argc] = cmd_tokenizebuffer + pos; pos += l; -#else - cmd_argv[cmd_argc] = Z_Malloc (l); -#endif strcpy (cmd_argv[cmd_argc], com_token); cmd_argc++; } @@ -590,9 +577,6 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function) { cmd_function_t *cmd; -// if (host_initialized) // because hunk allocation would get stomped -// Sys_Error ("Cmd_AddCommand after host_initialized"); - // fail if the command is a variable name if (Cvar_VariableString(cmd_name)[0]) { @@ -634,7 +618,6 @@ qboolean Cmd_Exists (char *cmd_name) } - /* ============ Cmd_CompleteCommand diff --git a/collision.c b/collision.c index 2511205e..de405720 100644 --- a/collision.c +++ b/collision.c @@ -33,8 +33,6 @@ static int RecursiveHullCheck (RecursiveHullCheckTraceInfo_t *t, int num, double int ret; mplane_t *plane; double t1, t2; - //double frac; - //double mid[3]; // variables that need to be stored on the stack when recursing dclipnode_t *node; @@ -170,6 +168,7 @@ loc0: // used if start and end are the same static void RecursiveHullCheckPoint (RecursiveHullCheckTraceInfo_t *t, int num) { + // If you can read this, you understand BSP trees while (num >= 0) num = t->hull->clipnodes[num].children[((t->hull->planes[t->hull->clipnodes[num].planenum].type < 3) ? (t->start[t->hull->planes[t->hull->clipnodes[num].planenum].type]) : (DotProduct(t->hull->planes[t->hull->clipnodes[num].planenum].normal, t->start))) < t->hull->planes[t->hull->clipnodes[num].planenum].dist]; @@ -435,3 +434,4 @@ void Collision_ClipTrace (trace_t *trace, const void *cent, const model_t *cmode rhc.trace->ent = (void *) cent; } } + diff --git a/common.c b/common.c index 80a7389f..3859d20b 100644 --- a/common.c +++ b/common.c @@ -44,10 +44,6 @@ mempool_t *pak_mempool; qboolean com_modified; // set true if using non-id files -//qboolean proghack; - -//int static_registered = 1; // only for startup check, then set - qboolean msg_suppress_1 = 0; void COM_InitFilesystem (void); @@ -95,126 +91,6 @@ The file "parms.txt" will be read out of the game directory and appended to the ============================================================================ */ -/* -void Q_memset (void *dest, int fill, int count) -{ - int i; - - if ( (((long)dest | count) & 3) == 0) - { - count >>= 2; - fill = fill | (fill<<8) | (fill<<16) | (fill<<24); - for (i=0 ; i>=2; - for (i=0 ; i= '0' && c <= '9') - val = (val<<4) + c - '0'; - else if (c >= 'a' && c <= 'f') - val = (val<<4) + c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - val = (val<<4) + c - 'A' + 10; - else - return val*sign; - } - } - -// -// check for character -// - if (str[0] == '\'') - { - return sign * str[1]; - } - -// -// assume decimal -// - while (1) - { - c = *str++; - if (c <'0' || c > '9') - return val*sign; - val = val*10 + c - '0'; - } - - return 0; -} - - -float Q_atof (char *str) -{ - double val; - int sign; - int c; - int decimal, total; - - if (*str == '-') - { - sign = -1; - str++; - } - else - sign = 1; - - val = 0; - -// -// check for hex -// - if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X') ) - { - str += 2; - while (1) - { - c = *str++; - if (c >= '0' && c <= '9') - val = (val*16) + c - '0'; - else if (c >= 'a' && c <= 'f') - val = (val*16) + c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - val = (val*16) + c - 'A' + 10; - else - return val*sign; - } - } - -// -// check for character -// - if (str[0] == '\'') - { - return sign * str[1]; - } - -// -// assume decimal -// - decimal = -1; - total = 0; - while (1) - { - c = *str++; - if (c == '.') - { - decimal = total; - continue; - } - if (c <'0' || c > '9') - break; - val = val*10 + c - '0'; - total++; - } - - if (decimal == -1) - return val*sign; - while (total > decimal) - { - val /= 10; - total--; - } - - return val*sign; -} -*/ /* ============================================================================ @@ -479,11 +218,6 @@ void MSG_WriteChar (sizebuf_t *sb, int c) { qbyte *buf; -//#ifdef PARANOID -// if (c < -128 || c > 127) -// Sys_Error ("MSG_WriteChar: range error"); -//#endif - buf = SZ_GetSpace (sb, 1); buf[0] = c; } @@ -492,11 +226,6 @@ void MSG_WriteByte (sizebuf_t *sb, int c) { qbyte *buf; -//#ifdef PARANOID -// if (c < 0 || c > 255) -// Sys_Error ("MSG_WriteByte: range error"); -//#endif - buf = SZ_GetSpace (sb, 1); buf[0] = c; } @@ -505,11 +234,6 @@ void MSG_WriteShort (sizebuf_t *sb, int c) { qbyte *buf; -//#ifdef PARANOID -// if (c < ((short)0x8000) || c > (short)0x7fff) -// Sys_Error ("MSG_WriteShort: range error"); -//#endif - buf = SZ_GetSpace (sb, 2); buf[0] = c&0xff; buf[1] = c>>8; @@ -587,45 +311,6 @@ void MSG_BeginReading (void) msg_badread = false; } -/* -// returns -1 and sets msg_badread if no more characters are available -int MSG_ReadChar (void) -{ - int c; - - // LordHavoc: minor optimization - if (msg_readcount >= net_message.cursize) -// if (msg_readcount+1 > net_message.cursize) - { - msg_badread = true; - return -1; - } - - c = (signed char)net_message.data[msg_readcount]; - msg_readcount++; - - return c; -} - -int MSG_ReadByte (void) -{ - int c; - - // LordHavoc: minor optimization - if (msg_readcount >= net_message.cursize) -// if (msg_readcount+1 > net_message.cursize) - { - msg_badread = true; - return -1; - } - - c = (unsigned char)net_message.data[msg_readcount]; - msg_readcount++; - - return c; -} -*/ - int MSG_ReadShort (void) { int c; @@ -721,23 +406,6 @@ float MSG_ReadCoord (void) return MSG_ReadShort() * (1.0f/8.0f); } -/* -float MSG_ReadCoord (void) -{ - return MSG_ReadShort() * (1.0f/8.0f); -} - -float MSG_ReadAngle (void) -{ - return MSG_ReadChar() * (360.0f/256.0f); -} - -float MSG_ReadPreciseAngle (void) -{ - return MSG_ReadShort() * (360.0f/65536); -} -*/ - //=========================================================================== @@ -1045,26 +713,16 @@ void COM_CheckRegistered (void) { Cvar_Set ("cmdline", com_cmdline); -// static_registered = 0; - if (!Sys_FileTime("gfx/pop.lmp")) { if (com_modified) Con_Printf ("Playing shareware version, with modification.\nwarning: most mods require full quake data.\n"); else Con_Printf ("Playing shareware version.\n"); -//#if WINDED -// Sys_Error ("This dedicated server requires a full registered copy of Quake"); -//#endif -// Con_Printf ("Playing shareware version.\n"); -// if (com_modified) -// Sys_Error ("You must have the registered version to use modified games"); return; } -// Cvar_Set ("cmdline", com_cmdline); Cvar_Set ("registered", "1"); -// static_registered = 1; Con_Printf ("Playing registered version.\n"); } @@ -1250,17 +908,6 @@ char *va(char *format, ...) } -/// just for debugging -int memsearch (qbyte *start, int count, int search) -{ - int i; - - for (i=0 ; inext; -// } for ( ; search ; search = search->next) { @@ -1545,13 +1187,6 @@ int COM_FindFile (char *filename, QFile **file, qboolean quiet, qboolean zip) } else { - // check a file in the directory tree -// if (!static_registered) -// { // if not a registered version, don't ever go beyond base -// if ( strchr (filename, '/') || strchr (filename,'\\')) -// continue; -// } - sprintf (netpath, "%s/%s",search->filename, filename); findtime = Sys_FileTime (netpath); @@ -1673,10 +1308,8 @@ pack_t *COM_LoadPackFile (char *packfile) dpackfile_t *info; if (Sys_FileOpenRead (packfile, &packhandle) == -1) - { - //Con_Printf ("Couldn't open %s\n", packfile); return NULL; - } + Sys_FileRead (packhandle, (void *)&header, sizeof(header)); if (memcmp(header.id, "PACK", 4)) Sys_Error ("%s is not a packfile", packfile); @@ -1729,7 +1362,6 @@ then loads and adds pak1.pak pak2.pak ... */ void COM_AddGameDirectory (char *dir) { - //int i; stringlist_t *list, *current; searchpath_t *search; pack_t *pak; @@ -1765,28 +1397,6 @@ void COM_AddGameDirectory (char *dir) } } freedirectory(list); - - /* -// -// add any pak files in the format pak0.pak pak1.pak, ... -// - for (i=0 ; ; i++) - { - sprintf (pakfile, "%s/pak%i.pak", dir, i); - pak = COM_LoadPackFile (pakfile); - if (!pak) - break; - search = Mem_Alloc(pak_mempool, sizeof(searchpath_t)); - search->pack = pak; - search->next = com_searchpaths; - com_searchpaths = search; - } - */ - -// -// add the contents of the parms.txt file to the end of the command line -// - } /* @@ -1906,9 +1516,6 @@ void COM_InitFilesystem (void) com_searchpaths = search; } } - -// if (COM_CheckParm ("-proghack")) -// proghack = true; } int COM_FileExists(char *filename) @@ -1965,3 +1572,4 @@ void COM_ToUpperString(char *in, char *out) *out++ = *in++; } } + diff --git a/console.c b/console.c index 5d424f66..14dcb7dc 100644 --- a/console.c +++ b/console.c @@ -83,18 +83,13 @@ void Con_ToggleConsole_f (void) if (key_dest == key_console) { if (cls.state == ca_connected) -// { key_dest = key_game; -// key_lines[edit_line][1] = 0; // clear any typing -// key_linepos = 1; -// } else M_Menu_Main_f (); } else key_dest = key_console; - SCR_EndLoadingPlaque (); memset (con_times, 0, sizeof(con_times)); } @@ -389,7 +384,6 @@ void Con_Printf (char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; -// static qboolean inupdate; va_start (argptr,fmt); vsprintf (msg,fmt,argptr); @@ -415,24 +409,6 @@ void Con_Printf (char *fmt, ...) // write it to the scrollable buffer Con_Print (msg); - -// update the screen if the console is displayed - // LordHavoc: I don't think there's a real need for this - /* - // LordHavoc: don't print text while loading scripts - if (cls.state != ca_disconnected) - if (cls.signon != SIGNONS && !scr_disabled_for_loading ) - { - // protect against infinite loop if something in SCR_UpdateScreen calls - // Con_Printf - if (!inupdate) - { - inupdate = true; - SCR_UpdateScreen (); - inupdate = false; - } - } - */ } /* @@ -469,16 +445,12 @@ void Con_SafePrintf (char *fmt, ...) { va_list argptr; char msg[1024]; - //int temp; va_start (argptr,fmt); vsprintf (msg,fmt,argptr); va_end (argptr); - //temp = scr_disabled_for_loading; - //scr_disabled_for_loading = true; Con_Printf ("%s", msg); - //scr_disabled_for_loading = temp; } diff --git a/crc.c b/crc.c index 9024e073..57f7d3af 100644 --- a/crc.c +++ b/crc.c @@ -98,3 +98,4 @@ unsigned short CRC_Block(qbyte *data, int size) crc = (crc << 8) ^ crctable[(crc >> 8) ^ (*data++)]; return crc ^ CRC_XOR_VALUE; } + diff --git a/cvar.c b/cvar.c index b51e87aa..152a86ae 100644 --- a/cvar.c +++ b/cvar.c @@ -348,3 +348,4 @@ void Cvar_List_f (void) Con_Printf ("\n"); } // 2000-01-09 CvarList command by Maddes + diff --git a/fractalnoise.c b/fractalnoise.c index 73f122ec..4574902f 100644 --- a/fractalnoise.c +++ b/fractalnoise.c @@ -110,3 +110,4 @@ void fractalnoisequick(qbyte *noise, int size, int startgrid) } #undef n } + diff --git a/gl_backend.c b/gl_backend.c index d25ca67d..7b272fd1 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1,9 +1,7 @@ #include "quakedef.h" -//cvar_t gl_mesh_maxtriangles = {0, "gl_mesh_maxtriangles", "21760"}; cvar_t gl_mesh_maxtriangles = {0, "gl_mesh_maxtriangles", "1024"}; -//cvar_t gl_mesh_batchtriangles = {0, "gl_mesh_batchtriangles", "1024"}; cvar_t gl_mesh_batchtriangles = {0, "gl_mesh_batchtriangles", "0"}; cvar_t gl_mesh_transtriangles = {0, "gl_mesh_transtriangles", "16384"}; cvar_t gl_mesh_floatcolors = {0, "gl_mesh_floatcolors", "0"}; @@ -318,8 +316,6 @@ void GL_UnlockArray(void) } } -//static float gldepthmin, gldepthmax; - /* ============= GL_SetupFrame @@ -336,13 +332,8 @@ static void GL_SetupFrame (void) if (!r_render.integer) return; -// qglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // LordHavoc: moved to SCR_UpdateScreen -// gldepthmin = 0; -// gldepthmax = 1; qglDepthFunc (GL_LEQUAL);CHECKGLERROR -// qglDepthRange (gldepthmin, gldepthmax);CHECKGLERROR - // set up viewpoint qglMatrixMode(GL_PROJECTION);CHECKGLERROR qglLoadIdentity ();CHECKGLERROR @@ -366,8 +357,6 @@ static void GL_SetupFrame (void) // set view pyramid qglFrustum(-xmax, xmax, -ymax, ymax, zNear, zFar);CHECKGLERROR -// qglCullFace(GL_FRONT);CHECKGLERROR - qglMatrixMode(GL_MODELVIEW);CHECKGLERROR qglLoadIdentity ();CHECKGLERROR @@ -380,24 +369,6 @@ static void GL_SetupFrame (void) qglRotatef (-r_refdef.viewangles[1], 0, 0, 1);CHECKGLERROR // camera location qglTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);CHECKGLERROR - -// qglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix); - - // - // set drawing parms - // -// if (gl_cull.integer) -// { -// qglEnable(GL_CULL_FACE);CHECKGLERROR -// } -// else -// { -// qglDisable(GL_CULL_FACE);CHECKGLERROR -// } - -// qglEnable(GL_BLEND);CHECKGLERROR -// qglEnable(GL_DEPTH_TEST);CHECKGLERROR -// qglDepthMask(1);CHECKGLERROR } static int mesh_blendfunc1; @@ -795,19 +766,6 @@ void GL_DrawRangeElements(int firstvert, int endvert, int indexcount, GLuint *in } qglEnd(); } - /* - if (qglDrawRangeElements) - qglDrawRangeElements(GL_TRIANGLES, firstvert, endvert, indexcount, index); - else - { - } - #ifdef WIN32 - // FIXME: dynamic link to GL so we can get DrawRangeElements on WIN32 - qglDrawElements(GL_TRIANGLES, indexcount, GL_UNSIGNED_INT, index);CHECKGLERROR - #else - qglDrawRangeElements(GL_TRIANGLES, firstvert, firstvert + mesh->verts, indexcount, GL_UNSIGNED_INT, index);CHECKGLERROR - #endif - */ } // renders mesh buffers, called to flush buffers when full @@ -833,8 +791,6 @@ void R_Mesh_Render(void) if (!gl_mesh_floatcolors.integer || gl_mesh_drawmode.integer == 0) GL_ConvertColorsFloatToByte(); - // lock the arrays now that they will have no further modifications - //GL_LockArray(0, currentvertex);CHECKGLERROR if (gl_backend_rebindtextures) { gl_backend_rebindtextures = false; @@ -1253,10 +1209,6 @@ void R_Mesh_Draw(const rmeshinfo_t *m) else memcpy(&texcoord[j][0].t[0], m->texcoords[j], m->numverts * sizeof(buf_texcoord_t)); } - #if 0 - for (;j < backendunits;j++) - memset(&texcoord[j][0].t[0], 0, m->numverts * sizeof(buf_texcoord_t)); - #endif if (currenttriangle >= max_batch) R_Mesh_Render(); @@ -1415,10 +1367,6 @@ void R_Mesh_Draw_NativeOnly(const rmeshinfo_t *m) memcpy(vert, m->vertex, m->numverts * sizeof(buf_vertex_t)); for (j = 0;j < MAX_TEXTUREUNITS && m->tex[j];j++) memcpy(&texcoord[j][0].t[0], m->texcoords[j], m->numverts * sizeof(buf_texcoord_t)); - #if 0 - for (;j < backendunits;j++) - memset(&texcoord[j][0].t[0], 0, m->numverts * sizeof(buf_texcoord_t)); - #endif memcpy(fcolor, m->color, m->numverts * sizeof(buf_fcolor_t)); @@ -1644,9 +1592,6 @@ text to the screen. */ void SCR_UpdateScreen (void) { - //Mem_CheckSentinelsGlobal(); - //R_TimeReport("memtest"); - VID_Finish (); R_TimeReport("finish"); @@ -1677,3 +1622,4 @@ void SCR_UpdateScreen (void) // (this doesn't wait for the commands themselves to complete) qglFlush(); } + diff --git a/gl_draw.c b/gl_draw.c index e73bbcd6..de361fb0 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -//#define GL_COLOR_INDEX8_EXT 0x80E5 - cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1"}; static rtexture_t *char_texture; @@ -215,9 +213,6 @@ cachepic_t *Draw_CachePic (char *path) for (pic = cachepichash[hashkey];pic;pic = pic->chain) if (!strcmp (path, pic->name)) return pic; - //for (pic = cachepics, i = 0;i < numcachepics;pic++, i++) - // if (!strcmp (path, pic->name)) - // return pic; if (numcachepics == MAX_CACHED_PICS) Sys_Error ("numcachepics == MAX_CACHED_PICS"); @@ -339,24 +334,6 @@ void R_DrawQueue(void) color = 0; qglColor4ub(0,0,0,0); - // LordHavoc: NEAREST mode on text if not scaling up - /* - if (vid.realwidth <= (int) vid.conwidth) - { - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - CHECKGLERROR - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - CHECKGLERROR - } - else - { - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - CHECKGLERROR - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - CHECKGLERROR - } - */ - overbright = v_overbrightbits.integer; batch = false; batchcount = 0; @@ -430,7 +407,6 @@ void R_DrawQueue(void) qglBegin(GL_TRIANGLES); batchcount = 0; } - //DrawQuad(dq->x, dq->y, w, h, 0, 0, 1, 1); qglTexCoord2f (0, 0);qglVertex2f (x , y ); qglTexCoord2f (1, 0);qglVertex2f (x+w, y ); qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h); @@ -457,7 +433,6 @@ void R_DrawQueue(void) qglBegin(GL_TRIANGLES); batchcount = 0; } - //DrawQuad(dq->x, dq->y, dq->scalex, dq->scaley, 0, 0, 1, 1); qglTexCoord2f (0, 0);qglVertex2f (x , y ); qglTexCoord2f (1, 0);qglVertex2f (x+w, y ); qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h); @@ -493,7 +468,6 @@ void R_DrawQueue(void) t = (num >> 4)*0.0625f + (0.5f / 256.0f); u = 0.0625f - (1.0f / 256.0f); v = 0.0625f - (1.0f / 256.0f); - //DrawQuad(x, y, w, h, (num & 15)*0.0625f + (0.5f / 256.0f), (num >> 4)*0.0625f + (0.5f / 256.0f), 0.0625f - (1.0f / 256.0f), 0.0625f - (1.0f / 256.0f)); qglTexCoord2f (s , t );qglVertex2f (x , y ); qglTexCoord2f (s+u, t );qglVertex2f (x+w, y ); qglTexCoord2f (s+u, t+v);qglVertex2f (x+w, y+h); @@ -577,3 +551,4 @@ void R_DrawQueue(void) qglColor4ub (255, 255, 255, 255); CHECKGLERROR } + diff --git a/gl_models.c b/gl_models.c index f8ca7646..02f9e349 100644 --- a/gl_models.c +++ b/gl_models.c @@ -1,7 +1,6 @@ #include "quakedef.h" -//cvar_t gl_transform = {0, "gl_transform", "1"}; cvar_t r_quickmodels = {0, "r_quickmodels", "1"}; typedef struct @@ -23,46 +22,6 @@ zymbonematrix *zymbonepose; rmeshinfo_t aliasmeshinfo; -/* -void GL_SetupModelTransform (vec3_t origin, vec3_t angles, vec_t scale) -{ - qglTranslatef (origin[0], origin[1], origin[2]); - - if (scale != 1) - qglScalef (scale, scale, scale); - if (angles[1]) - qglRotatef (angles[1], 0, 0, 1); - if (angles[0]) - qglRotatef (-angles[0], 0, 1, 0); - if (angles[2]) - qglRotatef (angles[2], 1, 0, 0); -} -*/ - -/* -rtexturepool_t *chrometexturepool; -rtexture_t *chrometexture; - -// currently unused reflection effect texture -void makechrometexture(void) -{ - int i; - qbyte noise[64*64]; - qbyte data[64*64][4]; - - fractalnoise(noise, 64, 8); - - // convert to RGBA data - for (i = 0;i < 64*64;i++) - { - data[i][0] = data[i][1] = data[i][2] = noise[i]; - data[i][3] = 255; - } - - chrometexture = R_LoadTexture (chrometexturepool, "chrometexture", 64, 64, &data[0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_PRECACHE); -} -*/ - mempool_t *gl_models_mempool; void gl_models_start(void) @@ -75,13 +34,10 @@ void gl_models_start(void) aliasvertcolor2 = Mem_Alloc(gl_models_mempool, sizeof(float[MD2MAX_VERTS][4])); // used temporarily for tinted coloring zymbonepose = Mem_Alloc(gl_models_mempool, sizeof(zymbonematrix[256])); aliasvertusage = Mem_Alloc(gl_models_mempool, sizeof(int[MD2MAX_VERTS])); - //chrometexturepool = R_AllocTexturePool(); - //makechrometexture(); } void gl_models_shutdown(void) { - //R_FreeTexturePool(&chrometexturepool); Mem_FreePool(&gl_models_mempool); } @@ -91,7 +47,6 @@ void gl_models_newmap(void) void GL_Models_Init(void) { -// Cvar_RegisterVariable(&gl_transform); Cvar_RegisterVariable(&r_quickmodels); R_RegisterModule("GL_Models", gl_models_start, gl_models_shutdown, gl_models_newmap); @@ -101,34 +56,27 @@ void R_AliasTransformVerts(int vertcount) { vec3_t point; float *av; -// float *avn; av = aliasvert; -// avn = aliasvertnorm; while (vertcount >= 4) { VectorCopy(av, point);softwaretransform(point, av);av += 4; VectorCopy(av, point);softwaretransform(point, av);av += 4; VectorCopy(av, point);softwaretransform(point, av);av += 4; VectorCopy(av, point);softwaretransform(point, av);av += 4; -// VectorCopy(avn, point);softwaretransformdirection(point, avn);avn += 3; -// VectorCopy(avn, point);softwaretransformdirection(point, avn);avn += 3; -// VectorCopy(avn, point);softwaretransformdirection(point, avn);avn += 3; -// VectorCopy(avn, point);softwaretransformdirection(point, avn);avn += 3; vertcount -= 4; } while(vertcount > 0) { VectorCopy(av, point);softwaretransform(point, av);av += 4; -// VectorCopy(avn, point);softwaretransformdirection(point, avn);avn += 3; vertcount--; } } void R_AliasLerpVerts(int vertcount, - float lerp1, trivertx_t *verts1, vec3_t fscale1, vec3_t translate1, - float lerp2, trivertx_t *verts2, vec3_t fscale2, vec3_t translate2, - float lerp3, trivertx_t *verts3, vec3_t fscale3, vec3_t translate3, - float lerp4, trivertx_t *verts4, vec3_t fscale4, vec3_t translate4) + float lerp1, trivertx_t *verts1, vec3_t fscale1, vec3_t translate1, + float lerp2, trivertx_t *verts2, vec3_t fscale2, vec3_t translate2, + float lerp3, trivertx_t *verts3, vec3_t fscale3, vec3_t translate3, + float lerp4, trivertx_t *verts4, vec3_t fscale4, vec3_t translate4) { int i; vec3_t scale1, scale2, scale3, scale4, translate; @@ -555,22 +503,6 @@ int ZymoticLerpBones(int count, zymbonematrix *bonebase, frameblend_t *blend, zy float lerp1, lerp2, lerp3, lerp4; zymbonematrix *out, rootmatrix, m, *bone1, *bone2, *bone3, *bone4; - /* - m.m[0][0] = 0; - m.m[0][1] = -1; - m.m[0][2] = 0; - m.m[0][3] = 0; - m.m[1][0] = 1; - m.m[1][1] = 0; - m.m[1][2] = 0; - m.m[1][3] = 0; - m.m[2][0] = 0; - m.m[2][1] = 0; - m.m[2][2] = 1; - m.m[2][3] = 0; - R_ConcatTransforms(&softwaretransform_matrix[0], &m.m[0][0], &rootmatrix.m[0][0]); - */ - // LordHavoc: combine transform from zym coordinate space to quake coordinate space with model to world transform matrix rootmatrix.m[0][0] = softwaretransform_matrix[0][1]; rootmatrix.m[0][1] = -softwaretransform_matrix[0][0]; @@ -951,3 +883,4 @@ void R_DrawAliasModel (void) else R_DrawQ1Q2AliasModel(fog); } + diff --git a/gl_rmain.c b/gl_rmain.c index cae6f82d..ca11e964 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -//static qboolean r_cache_thrash; // compatability - entity_render_t *currentrenderentity; int r_framecount; // used for dlight push checking @@ -33,10 +31,6 @@ int c_brush_polys, c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_ qboolean envmap; // true during envmap command capture -// LordHavoc: moved all code related to particles into r_part.c -//int particletexture; // little dot for particles -//int playertextures; // up to 16 color translated skins - // // view origin // @@ -45,9 +39,6 @@ vec3_t vpn; vec3_t vright; vec3_t r_origin; -//float r_world_matrix[16]; -//float r_base_world_matrix[16]; - // // screen size info // @@ -57,19 +48,15 @@ mleaf_t *r_viewleaf, *r_oldviewleaf; unsigned short d_lightstylevalue[256]; // 8.8 fraction of base light value -//cvar_t r_norefresh = {0, "r_norefresh","0"}; cvar_t r_drawentities = {0, "r_drawentities","1"}; cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"}; cvar_t r_speeds = {0, "r_speeds","0"}; cvar_t r_fullbright = {0, "r_fullbright","0"}; -//cvar_t r_lightmap = {0, "r_lightmap","0"}; cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","1"}; cvar_t r_dynamic = {CVAR_SAVE, "r_dynamic","1"}; cvar_t r_waterripple = {CVAR_SAVE, "r_waterripple","0"}; cvar_t r_fullbrights = {CVAR_SAVE, "r_fullbrights", "1"}; -//cvar_t r_dynamicbothsides = {CVAR_SAVE, "r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right... - cvar_t gl_fogenable = {0, "gl_fogenable", "0"}; cvar_t gl_fogdensity = {0, "gl_fogdensity", "0.25"}; cvar_t gl_fogred = {0, "gl_fogred","0.3"}; @@ -79,7 +66,6 @@ cvar_t gl_fogstart = {0, "gl_fogstart", "0"}; cvar_t gl_fogend = {0, "gl_fogend","0"}; cvar_t r_ser = {CVAR_SAVE, "r_ser", "1"}; -//cvar_t gl_viewmodeldepthhack = {0, "gl_viewmodeldepthhack", "1"}; cvar_t r_multitexture = {0, "r_multitexture", "1"}; @@ -98,16 +84,13 @@ static void R_TimeRefresh_f (void) intimerefresh = 1; start = Sys_DoubleTime (); - //qglDrawBuffer (GL_FRONT); for (i = 0;i < 128;i++) { r_refdef.viewangles[0] = 0; r_refdef.viewangles[1] = i/128.0*360.0; r_refdef.viewangles[2] = 0; CL_UpdateScreen(); - //R_RenderView(); } - //qglDrawBuffer (GL_BACK); stop = Sys_DoubleTime (); intimerefresh = 0; @@ -253,15 +236,12 @@ void GL_Main_Init(void) Cvar_RegisterVariable (&r_drawentities); Cvar_RegisterVariable (&r_drawviewmodel); Cvar_RegisterVariable (&r_speeds); -// Cvar_RegisterVariable (&r_dynamicwater); -// Cvar_RegisterVariable (&r_dynamicbothsides); Cvar_RegisterVariable (&r_fullbrights); Cvar_RegisterVariable (&r_wateralpha); Cvar_RegisterVariable (&r_dynamic); Cvar_RegisterVariable (&r_waterripple); Cvar_RegisterVariable (&r_fullbright); Cvar_RegisterVariable (&r_ser); -// Cvar_RegisterVariable (&gl_viewmodeldepthhack); Cvar_RegisterVariable (&r_multitexture); if (gamemode == GAME_NEHAHRA) Cvar_SetValue("r_fullbrights", 0); @@ -340,8 +320,6 @@ void GL_Init (void) gl_extensions = glGetString (GL_EXTENSIONS); Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions); -// Con_Printf ("%s %s\n", gl_renderer, gl_version); - VID_CheckExtensions(); // LordHavoc: report supported extensions @@ -349,8 +327,6 @@ void GL_Init (void) qglCullFace(GL_FRONT); qglEnable(GL_TEXTURE_2D); - -// qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL); } @@ -465,18 +441,7 @@ void R_DrawViewModel (void) R_LerpAnimation(currentrenderentity); - // hack the depth range to prevent view model from poking into walls -// if (gl_viewmodeldepthhack.integer) -// { -// R_Mesh_Render(); -// qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin)); -// } currentrenderentity->model->Draw(); -// if (gl_viewmodeldepthhack.integer) -// { -// R_Mesh_Render(); -// qglDepthRange (gldepthmin, gldepthmax); -// } } static void R_SetFrustum (void) @@ -533,8 +498,6 @@ static void R_SetupFrame (void) r_oldviewleaf = r_viewleaf; r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); -// r_cache_thrash = false; - R_AnimateLight (); } @@ -578,30 +541,6 @@ static void R_BlendView(void) tvxyz[2][1] = tvxyz[0][1] + vright[1] * r; tvxyz[2][2] = tvxyz[0][2] + vright[2] * r; R_Mesh_Draw(&m); - - /* - qglMatrixMode(GL_PROJECTION); - qglLoadIdentity (); - qglOrtho (0, 1, 1, 0, -99999, 99999); - qglMatrixMode(GL_MODELVIEW); - qglLoadIdentity (); - qglDisable (GL_DEPTH_TEST); - qglDisable (GL_CULL_FACE); - qglDisable(GL_TEXTURE_2D); - qglEnable(GL_BLEND); - qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - qglBegin (GL_TRIANGLES); - qglColor4f (r_refdef.viewblend[0] * overbrightscale, r_refdef.viewblend[1] * overbrightscale, r_refdef.viewblend[2] * overbrightscale, r_refdef.viewblend[3]); - qglVertex2f (-5, -5); - qglVertex2f (10, -5); - qglVertex2f (-5, 10); - qglEnd (); - - qglEnable (GL_CULL_FACE); - qglEnable (GL_DEPTH_TEST); - qglDisable(GL_BLEND); - qglEnable(GL_TEXTURE_2D); - */ } /* @@ -704,7 +643,5 @@ void R_RenderView (void) // render any queued meshs R_Mesh_Finish(); R_TimeReport("meshfinish"); - - //Mem_CheckSentinelsGlobal(); - //R_TimeReport("memtest"); } + diff --git a/gl_rsurf.c b/gl_rsurf.c index c810b022..d9b63381 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -88,18 +88,12 @@ static int R_AddDynamicLights (msurface_t *surf) continue; // not lit by this light softwareuntransform(r_dlight[lnum].origin, local); -// VectorSubtract (r_dlight[lnum].origin, currentrenderentity->origin, local); dist = DotProduct (local, surf->plane->normal) - surf->plane->dist; // for comparisons to minimum acceptable light // compensate for LIGHTOFFSET maxdist = (int) r_dlight[lnum].cullradius2 + LIGHTOFFSET; - // already clamped, skip this - // clamp radius to avoid exceeding 32768 entry division table - //if (maxdist > 4194304) - // maxdist = 4194304; - dist2 = dist * dist; dist2 += LIGHTOFFSET; if (dist2 >= maxdist) @@ -448,27 +442,6 @@ static void R_BuildLightMap (msurface_t *surf, int dlightchanged) R_UpdateTexture(surf->lightmaptexture, templight); } -/* -=============== -R_TextureAnimation - -Returns the proper texture for a given time and base texture -=============== -*/ -/* -// note: this was manually inlined in R_PrepareSurfaces -static texture_t *R_TextureAnimation (texture_t *base) -{ - if (currentrenderentity->frame && base->alternate_anims != NULL) - base = base->alternate_anims; - - if (base->anim_total < 2) - return base; - - return base->anim_frames[(int)(cl.time * 5.0f) % base->anim_total]; -} -*/ - /* ============================================================= @@ -531,10 +504,6 @@ static void RSurfShader_Sky(msurface_t *firstsurf) m.numtriangles = mesh->numtriangles; m.numverts = mesh->numverts; m.index = mesh->index; - //m.cr = 0; - //m.cg = 0; - //m.cb = 0; - //m.ca = 0; if (softwaretransform_complexity) { m.vertex = &svert[0].v[0]; @@ -904,8 +873,7 @@ static void RSurfShader_Water(msurface_t *firstsurf) RSurfShader_Water_Pass_Glow(surf); if (fogenabled) for (surf = firstsurf;surf;surf = surf->chain) - //if (currentrenderentity->alpha * (surf->flags & SURF_DRAWNOALPHA ? 1 : r_wateralpha.value) >= 1.0f) - RSurfShader_Water_Pass_Fog(surf); + RSurfShader_Water_Pass_Fog(surf); } static void RSurfShader_Wall_Pass_BaseMTex(msurface_t *surf) @@ -1972,8 +1940,6 @@ void R_PrepareSurfaces(void) { surf->insertframe = r_framecount; c_faces++; - // manually inlined R_TextureAnimation - //t = R_TextureAnimation(surf->texinfo->texture); t = surf->texinfo->texture; if (t->alternate_anims != NULL && currentrenderentity->frame) t = t->alternate_anims; @@ -2006,38 +1972,14 @@ static float portalpointbuffer[256][3]; void R_DrawPortals(void) { int drawportals, i; -// mleaf_t *leaf, *endleaf; mportal_t *portal, *endportal; - mvertex_t *point/*, *endpoint*/; + mvertex_t *point; rmeshinfo_t m; drawportals = r_drawportals.integer; + if (drawportals < 1) return; - /* - leaf = cl.worldmodel->leafs; - endleaf = leaf + cl.worldmodel->numleafs; - for (;leaf < endleaf;leaf++) - { - if (leaf->visframe == r_framecount && leaf->portals) - { - i = leaf - cl.worldmodel->leafs; - r = (i & 0x0007) << 5; - g = (i & 0x0038) << 2; - b = (i & 0x01C0) >> 1; - portal = leaf->portals; - while (portal) - { - transpolybegin(0, 0, 0, TPOLYTYPE_ALPHA); - point = portal->points + portal->numpoints - 1; - endpoint = portal->points; - for (;point >= endpoint;point--) - transpolyvertub(point->position[0], point->position[1], point->position[2], 0, 0, r, g, b, 32); - transpolyend(); - portal = portal->next; - } - } - } - */ + memset(&m, 0, sizeof(m)); m.transparent = true; m.blendfunc1 = GL_SRC_ALPHA; @@ -2135,10 +2077,6 @@ static void R_SurfMarkLights (void) || (surf->styles[1] != 255 && (d_lightstylevalue[surf->styles[1]] != surf->cached_light[1] || (surf->styles[2] != 255 && (d_lightstylevalue[surf->styles[2]] != surf->cached_light[2] || (surf->styles[3] != 255 && (d_lightstylevalue[surf->styles[3]] != surf->cached_light[3])))))))) - //if (surf->cached_light[0] != d_lightstylevalue[surf->styles[0]] - // || surf->cached_light[1] != d_lightstylevalue[surf->styles[1]] - // || surf->cached_light[2] != d_lightstylevalue[surf->styles[2]] - // || surf->cached_light[3] != d_lightstylevalue[surf->styles[3]]) R_BuildLightMap(surf, false); // base lighting changed else if (surf->dlightframe == r_framecount && r_dlightmap.integer) R_BuildLightMap(surf, true); // only dlights @@ -2199,3 +2137,4 @@ void R_DrawBrushModelNormal (void) R_DrawSurfaces(SHADERSTAGE_SKY); R_DrawSurfaces(SHADERSTAGE_NORMAL); } + diff --git a/gl_textures.c b/gl_textures.c index 81e51044..43bf88e8 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1,3 +1,4 @@ + #include "quakedef.h" cvar_t r_max_size = {CVAR_SAVE, "r_max_size", "2048"}; @@ -6,7 +7,7 @@ cvar_t r_picmip = {CVAR_SAVE, "r_picmip", "0"}; cvar_t r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1"}; cvar_t r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1"}; -int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; //NEAREST; +int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; int gl_filter_mag = GL_LINEAR; @@ -269,7 +270,6 @@ rtexturepool_t *R_AllocTexturePool(void) pool = Mem_Alloc(texturemempool, sizeof(gltexturepool_t)); if (pool == NULL) return NULL; - //memset(pool, 0, sizeof(gltexturepool_t)); pool->next = gltexturepoolchain; gltexturepoolchain = pool; pool->sentinel = TEXTUREPOOL_SENTINEL; @@ -472,7 +472,6 @@ static void r_textures_start(void) texturedatamempool = Mem_AllocPool("Texture Storage (not yet uploaded)"); textureprocessingmempool = Mem_AllocPool("Texture Processing Buffers"); gltexnuminuse = Mem_Alloc(texturemempool, MAX_GLTEXTURES); - //memset(gltexnuminuse, 0, MAX_GLTEXTURES); } static void r_textures_shutdown(void) @@ -484,12 +483,6 @@ static void r_textures_shutdown(void) R_FreeTexturePool(&temp); } - /* - if (resizebuffer) Mem_Free(resizebuffer);resizebuffer = NULL; - if (colorconvertbuffer) Mem_Free(colorconvertbuffer);colorconvertbuffer = NULL; - if (texturebuffer) Mem_Free(texturebuffer);texturebuffer = NULL; - if (gltexnuminuse) Mem_Free(gltexnuminuse);gltexnuminuse = NULL; - */ resizebuffersize = 0; texturebuffersize = 0; resizebuffer = NULL; @@ -719,7 +712,6 @@ static void R_FindImageForTexture(gltexture_t *glt) image = Mem_Alloc(texturemempool, sizeof(gltextureimage_t)); if (image == NULL) Sys_Error("R_FindImageForTexture: ran out of memory\n"); - //memset(image, 0, sizeof(*image)); image->type = GLIMAGETYPE_FRAGMENTS; image->width = block_size; image->height = block_size; @@ -738,7 +730,6 @@ static void R_FindImageForTexture(gltexture_t *glt) image = Mem_Alloc(texturemempool, sizeof(gltextureimage_t)); if (image == NULL) Sys_Error("R_FindImageForTexture: ran out of memory\n"); - //memset(image, 0, sizeof(*image)); image->type = GLIMAGETYPE_TILE; image->blockallocation = NULL; @@ -810,7 +801,6 @@ static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int { gltexture_t *glt; glt = Mem_Alloc(texturemempool, sizeof(gltexture_t)); - //memset(glt, 0, sizeof(gltexture_t)); if (identifier) { glt->identifier = Mem_Alloc(texturemempool, strlen(identifier)+1); @@ -872,10 +862,6 @@ rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int w texinfo = R_GetTexTypeInfo(textype, flags); - // data can be NULL -// if (data == NULL) -// Host_Error("R_LoadTexture: \"%s\" has no data\n", identifier); - if (flags & TEXF_FRAGMENT) { if (width > block_size || height > block_size) @@ -955,9 +941,6 @@ rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, texinfo = R_GetTexTypeInfo(textype, flags); - // no function is supported, for odd uses -// if (generate == NULL) -// Host_Error("R_ProceduralTexture: \"%s\" has no generate function\n", identifier); if (flags & TEXF_FRAGMENT) { if (width > block_size || height > block_size) @@ -1086,19 +1069,7 @@ void R_UpdateTexture(rtexture_t *rt, qbyte *data) if (data == NULL) Host_Error("R_UpdateTexture: no data supplied\n"); glt = (gltexture_t *)rt; - /* - if (!(glt->flags & GLTEXF_PROCEDURAL)) - { - if (glt->inputtexels == NULL) - { - glt->inputtexels = Mem_Alloc(texturedatamempool, glt->width * glt->height * glt->textype->inputbytesperpixel); - if (glt->inputtexels == NULL) - Host_Error("R_UpdateTexture: ran out of memory\n"); - } - memcpy(glt->inputtexels, data, glt->width * glt->height * glt->textype->inputbytesperpixel); - } - R_Upload(glt, data); - */ + // if it has not been uploaded yet, update the data that will be used when it is if (glt->inputtexels) memcpy(glt->inputtexels, data, glt->width * glt->height * glt->textype->inputbytesperpixel); diff --git a/host.c b/host.c index 28ff3f1d..33797065 100644 --- a/host.c +++ b/host.c @@ -143,8 +143,6 @@ void Host_Error (char *error, ...) } inerror = true; - SCR_EndLoadingPlaque (); // reenable screen updates - va_start (argptr,error); vsprintf (hosterrorstring,error,argptr); va_end (argptr); @@ -571,11 +569,7 @@ qboolean Host_FilterTime (double time) if (host_framerate.value > 0) host_frametime = host_framerate.value; else if (cl_avidemo.value >= 0.1f) - { - // don't allow really short frames - //if (host_frametime > (1.0 / cl_avidemo.value)) - host_frametime = (1.0 / cl_avidemo.value); - } + host_frametime = (1.0 / cl_avidemo.value); else { // don't allow really short frames @@ -630,7 +624,6 @@ void Host_ServerFrame (void) sv.frametime = 0; frametimetotal = 0; lastservertime = realtime; -// pr_global_struct->frametime = host_frametime; // set the time and clear the general datagram SV_ClearDatagram (); @@ -839,7 +832,7 @@ void Host_Init (void) NET_Init (); SV_Init (); - Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); + Con_Printf ("Builddate: %s\n", buildstring); if (cls.state != ca_dedicated) { @@ -891,9 +884,6 @@ void Host_Shutdown(void) } isdown = true; -// keep Con_Printf from trying to update the screen -// scr_disabled_for_loading = true; - Host_WriteConfiguration (); CDAudio_Shutdown (); diff --git a/host_cmd.c b/host_cmd.c index 3934de44..1dec6eca 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -30,19 +30,9 @@ Host_Quit_f ================== */ -// LordHavoc: didn't like it asking me if I wanted to quit -//extern void M_Menu_Quit_f (void); - extern qboolean host_shuttingdown; void Host_Quit_f (void) { - /* - if (key_dest != key_console && cls.state != ca_dedicated) - { - M_Menu_Quit_f (); - return; - } - */ host_shuttingdown = true; CL_Disconnect (); Host_ShutdownServer(false); @@ -680,11 +670,7 @@ void Host_Name_f (void) Con_Printf ("\"name\" is \"%s\"\n", cl_name.string); return; } - //if (Cmd_Argc () == 2) - // newName = Cmd_Argv(1); - //else - // newName = Cmd_Args(); - //newName[15] = 0; + if (Cmd_Argc () == 2) strncpy(newName, Cmd_Argv(1), 15); else @@ -895,7 +881,6 @@ void Host_Color_f(void) return; } - // void(float color) SV_ChangeTeam; if ((f = ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - pr_functions))) { Con_DPrintf("Calling SV_ChangeTeam\n"); @@ -1122,7 +1107,6 @@ void Host_Spawn_f (void) MSG_WriteByte (&host_client->message, STAT_MONSTERS); MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters); -// // send a fixangle // Never send a roll angle, because savegames can catch the server // in a state where it is expecting the client to correct the angle @@ -1662,3 +1646,4 @@ void Host_InitCommands (void) Cmd_AddCommand ("viewnext", Host_Viewnext_f); Cmd_AddCommand ("viewprev", Host_Viewprev_f); } + diff --git a/image.c b/image.c index 87c52748..2023b0ae 100644 --- a/image.c +++ b/image.c @@ -1185,3 +1185,4 @@ void Image_MipReduce(qbyte *in, qbyte *out, int *width, int *height, int destwid Sys_Error("Image_MipReduce: desired size already achieved\n"); } } + diff --git a/in_svgalib.c b/in_svgalib.c index fe0719db..be416871 100644 --- a/in_svgalib.c +++ b/in_svgalib.c @@ -68,9 +68,6 @@ static void keyhandler(int scancode, int state) int sc; sc = scancode & 0x7f; -#if 0 - Con_Printf("scancode=%x (%d%s)\n", scancode, sc, scancode&0x80?"+128":""); -#endif Key_Event(scantokey[sc], state == KEY_EVENTPRESS); } @@ -247,10 +244,6 @@ static void IN_init_mouse(void) mouserate = atoi(com_argv[COM_CheckParm("-mrate")+1]); } -#if 0 - printf("Mouse: dev=%s,type=%s,speed=%d\n", - mousedev, mice[mtype].name, mouserate); -#endif if (mouse_init(mousedev, mtype, mouserate)) { Con_Printf("No mouse found\n"); UseMouse = 0; @@ -338,3 +331,4 @@ void IN_Move(usercmd_t *cmd) void IN_HandlePause (qboolean pause) { } + diff --git a/in_win.c b/in_win.c index 04cdbcdc..37db2e0f 100644 --- a/in_win.c +++ b/in_win.c @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "winquake.h" -//#include "dosisms.h" #include @@ -472,7 +471,6 @@ IN_Shutdown */ void IN_Shutdown (void) { -// usingmouse = false; IN_DeactivateMouse (); IN_ShowMouse (); @@ -562,9 +560,7 @@ void IN_MouseMove (usercmd_t *cmd) /* Unable to read data or no data available */ if (FAILED(hr) || dwElements == 0) - { break; - } /* Look at the element to see what happened */ @@ -683,7 +679,6 @@ IN_ClearStates */ void IN_ClearStates (void) { - if (mouseactive) { mx_accum = 0; @@ -959,8 +954,6 @@ qboolean IN_ReadJoystick (void) // read error occurred // turning off the joystick seems too harsh for 1 read error, // but what should be done? - // Con_Printf ("IN_ReadJoystick: no response\n"); - // joy_avail = false; return false; } } @@ -1138,3 +1131,4 @@ void IN_JoyMove (usercmd_t *cmd) } } } + diff --git a/keys.c b/keys.c index 133da90c..f44a4681 100644 --- a/keys.c +++ b/keys.c @@ -161,7 +161,7 @@ void Key_Console (int key) { if (key == K_ENTER) { - Cbuf_AddText (key_lines[edit_line]+1); // skip the > + Cbuf_AddText (key_lines[edit_line]+1); // skip the ] Cbuf_AddText ("\n"); Con_Printf ("%s\n",key_lines[edit_line]); edit_line = (edit_line + 1) & 31; diff --git a/mathlib.c b/mathlib.c index fa5b8537..ae9ff634 100644 --- a/mathlib.c +++ b/mathlib.c @@ -153,70 +153,10 @@ float Q_RSqrt(float number) return y * (1.5f - (number * 0.5f * y * y)); } -#if 0 -// LordHavoc: no longer used at all -void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) -{ -#if 0 - // LordHavoc: the old way... - float d; - vec3_t n; - float inv_denom; - - inv_denom = 1.0F / DotProduct( normal, normal ); - - d = DotProduct( normal, p ) * inv_denom; - - n[0] = normal[0] * inv_denom; - n[1] = normal[1] * inv_denom; - n[2] = normal[2] * inv_denom; - - dst[0] = p[0] - d * n[0]; - dst[1] = p[1] - d * n[1]; - dst[2] = p[2] - d * n[2]; -#else - // LordHavoc: optimized to death and beyond - float d; - - // LordHavoc: the normal is a unit vector by definition, - // therefore inv_denom was pointless. - d = DotProduct(normal, p); - dst[0] = p[0] - d * normal[0]; - dst[1] = p[1] - d * normal[1]; - dst[2] = p[2] - d * normal[2]; -#endif -} -#endif // assumes "src" is normalized void PerpendicularVector( vec3_t dst, const vec3_t src ) { -#if 0 - // LordHavoc: the old way... - int pos; - int i; - float minelem, d; - vec3_t tempvec; - - // find the smallest magnitude axially aligned vector - minelem = 1.0F; - for ( pos = 0, i = 0; i < 3; i++ ) - { - if ( fabs( src[i] ) < minelem ) - { - pos = i; - minelem = fabs( src[i] ); - } - } - VectorClear(tempvec); - tempvec[pos] = 1.0F; - - // project the point onto the plane defined by src - ProjectPointOnPlane( dst, tempvec, src ); - - // normalize the result - VectorNormalize(dst); -#else // LordHavoc: optimized to death and beyond int pos; float minelem; @@ -263,7 +203,6 @@ void PerpendicularVector( vec3_t dst, const vec3_t src ) dst[1] = 0; dst[2] = 0; } -#endif } @@ -302,145 +241,6 @@ void VectorVectorsDouble(const double *forward, double *right, double *up) void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ) { -#if 0 - // LordHavoc: the old way, cryptic brute force... - float m[3][3]; - float im[3][3]; - float zrot[3][3]; - float tmpmat[3][3]; - float rot[3][3]; - int i; - vec3_t vr, vup, vf; - - vf[0] = dir[0]; - vf[1] = dir[1]; - vf[2] = dir[2]; - - PerpendicularVector( vr, dir ); - CrossProduct( vr, vf, vup ); - - m[0][0] = vr[0]; - m[1][0] = vr[1]; - m[2][0] = vr[2]; - - m[0][1] = vup[0]; - m[1][1] = vup[1]; - m[2][1] = vup[2]; - - m[0][2] = vf[0]; - m[1][2] = vf[1]; - m[2][2] = vf[2]; - - memcpy( im, m, sizeof( im ) ); - - im[0][1] = m[1][0]; - im[0][2] = m[2][0]; - im[1][0] = m[0][1]; - im[1][2] = m[2][1]; - im[2][0] = m[0][2]; - im[2][1] = m[1][2]; - - memset( zrot, 0, sizeof( zrot ) ); - zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F; - - zrot[0][0] = cos( DEG2RAD( degrees ) ); - zrot[0][1] = sin( DEG2RAD( degrees ) ); - zrot[1][0] = -sin( DEG2RAD( degrees ) ); - zrot[1][1] = cos( DEG2RAD( degrees ) ); - - R_ConcatRotations( m, zrot, tmpmat ); - R_ConcatRotations( tmpmat, im, rot ); - - for ( i = 0; i < 3; i++ ) - dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2]; -#elif 0 - // LordHavoc: on the path to unintelligible code... -// float m[3][3]; -// float im[3][3]; -// float zrot[3][3]; - float tmpmat[3][3]; -// float rot[3][3]; - float angle, c, s; -// int i; - vec3_t vr, vu, vf; - - angle = DEG2RAD(degrees); - - c = cos(angle); - s = sin(angle); - - vf[0] = dir[0]; - vf[1] = dir[1]; - vf[2] = dir[2]; - - PerpendicularVector(vr, dir); - CrossProduct(vr, vf, vu); - -// m [0][0] = vr[0];m [0][1] = vu[0];m [0][2] = vf[0]; -// m [1][0] = vr[1];m [1][1] = vu[1];m [1][2] = vf[1]; -// m [2][0] = vr[2];m [2][1] = vu[2];m [2][2] = vf[2]; -// im [0][0] = vr[0];im [0][1] = vr[1];im [0][2] = vr[2]; -// im [1][0] = vu[0];im [1][1] = vu[1];im [1][2] = vu[2]; -// im [2][0] = vf[0];im [2][1] = vf[1];im [2][2] = vf[2]; -// zrot[0][0] = c;zrot[0][1] = s;zrot[0][2] = 0; -// zrot[1][0] = -s;zrot[1][1] = c;zrot[1][2] = 0; -// zrot[2][0] = 0;zrot[2][1] = 0;zrot[2][2] = 1; - -// tmpmat[0][0] = m[0][0] * zrot[0][0] + m[0][1] * zrot[1][0] + m[0][2] * zrot[2][0]; -// tmpmat[0][1] = m[0][0] * zrot[0][1] + m[0][1] * zrot[1][1] + m[0][2] * zrot[2][1]; -// tmpmat[0][2] = m[0][0] * zrot[0][2] + m[0][1] * zrot[1][2] + m[0][2] * zrot[2][2]; -// tmpmat[1][0] = m[1][0] * zrot[0][0] + m[1][1] * zrot[1][0] + m[1][2] * zrot[2][0]; -// tmpmat[1][1] = m[1][0] * zrot[0][1] + m[1][1] * zrot[1][1] + m[1][2] * zrot[2][1]; -// tmpmat[1][2] = m[1][0] * zrot[0][2] + m[1][1] * zrot[1][2] + m[1][2] * zrot[2][2]; -// tmpmat[2][0] = m[2][0] * zrot[0][0] + m[2][1] * zrot[1][0] + m[2][2] * zrot[2][0]; -// tmpmat[2][1] = m[2][0] * zrot[0][1] + m[2][1] * zrot[1][1] + m[2][2] * zrot[2][1]; -// tmpmat[2][2] = m[2][0] * zrot[0][2] + m[2][1] * zrot[1][2] + m[2][2] * zrot[2][2]; - - tmpmat[0][0] = vr[0] * c + vu[0] * -s; - tmpmat[0][1] = vr[0] * s + vu[0] * c; -// tmpmat[0][2] = vf[0]; - tmpmat[1][0] = vr[1] * c + vu[1] * -s; - tmpmat[1][1] = vr[1] * s + vu[1] * c; -// tmpmat[1][2] = vf[1]; - tmpmat[2][0] = vr[2] * c + vu[2] * -s; - tmpmat[2][1] = vr[2] * s + vu[2] * c; -// tmpmat[2][2] = vf[2]; - -// rot[0][0] = tmpmat[0][0] * vr[0] + tmpmat[0][1] * vu[0] + tmpmat[0][2] * vf[0]; -// rot[0][1] = tmpmat[0][0] * vr[1] + tmpmat[0][1] * vu[1] + tmpmat[0][2] * vf[1]; -// rot[0][2] = tmpmat[0][0] * vr[2] + tmpmat[0][1] * vu[2] + tmpmat[0][2] * vf[2]; -// rot[1][0] = tmpmat[1][0] * vr[0] + tmpmat[1][1] * vu[0] + tmpmat[1][2] * vf[0]; -// rot[1][1] = tmpmat[1][0] * vr[1] + tmpmat[1][1] * vu[1] + tmpmat[1][2] * vf[1]; -// rot[1][2] = tmpmat[1][0] * vr[2] + tmpmat[1][1] * vu[2] + tmpmat[1][2] * vf[2]; -// rot[2][0] = tmpmat[2][0] * vr[0] + tmpmat[2][1] * vu[0] + tmpmat[2][2] * vf[0]; -// rot[2][1] = tmpmat[2][0] * vr[1] + tmpmat[2][1] * vu[1] + tmpmat[2][2] * vf[1]; -// rot[2][2] = tmpmat[2][0] * vr[2] + tmpmat[2][1] * vu[2] + tmpmat[2][2] * vf[2]; - -// rot[0][0] = tmpmat[0][0] * vr[0] + tmpmat[0][1] * vu[0] + vf[0] * vf[0]; -// rot[0][1] = tmpmat[0][0] * vr[1] + tmpmat[0][1] * vu[1] + vf[0] * vf[1]; -// rot[0][2] = tmpmat[0][0] * vr[2] + tmpmat[0][1] * vu[2] + vf[0] * vf[2]; -// rot[1][0] = tmpmat[1][0] * vr[0] + tmpmat[1][1] * vu[0] + vf[1] * vf[0]; -// rot[1][1] = tmpmat[1][0] * vr[1] + tmpmat[1][1] * vu[1] + vf[1] * vf[1]; -// rot[1][2] = tmpmat[1][0] * vr[2] + tmpmat[1][1] * vu[2] + vf[1] * vf[2]; -// rot[2][0] = tmpmat[2][0] * vr[0] + tmpmat[2][1] * vu[0] + vf[2] * vf[0]; -// rot[2][1] = tmpmat[2][0] * vr[1] + tmpmat[2][1] * vu[1] + vf[2] * vf[1]; -// rot[2][2] = tmpmat[2][0] * vr[2] + tmpmat[2][1] * vu[2] + vf[2] * vf[2]; - -// dst[0] = rot[0][0] * point[0] + rot[0][1] * point[1] + rot[0][2] * point[2]; -// dst[1] = rot[1][0] * point[0] + rot[1][1] * point[1] + rot[1][2] * point[2]; -// dst[2] = rot[2][0] * point[0] + rot[2][1] * point[1] + rot[2][2] * point[2]; - - dst[0] = (tmpmat[0][0] * vr[0] + tmpmat[0][1] * vu[0] + vf[0] * vf[0]) * point[0] - + (tmpmat[0][0] * vr[1] + tmpmat[0][1] * vu[1] + vf[0] * vf[1]) * point[1] - + (tmpmat[0][0] * vr[2] + tmpmat[0][1] * vu[2] + vf[0] * vf[2]) * point[2]; - dst[1] = (tmpmat[1][0] * vr[0] + tmpmat[1][1] * vu[0] + vf[1] * vf[0]) * point[0] - + (tmpmat[1][0] * vr[1] + tmpmat[1][1] * vu[1] + vf[1] * vf[1]) * point[1] - + (tmpmat[1][0] * vr[2] + tmpmat[1][1] * vu[2] + vf[1] * vf[2]) * point[2]; - dst[2] = (tmpmat[2][0] * vr[0] + tmpmat[2][1] * vu[0] + vf[2] * vf[0]) * point[0] - + (tmpmat[2][0] * vr[1] + tmpmat[2][1] * vu[1] + vf[2] * vf[1]) * point[1] - + (tmpmat[2][0] * vr[2] + tmpmat[2][1] * vu[2] + vf[2] * vf[2]) * point[2]; -#else - // LordHavoc: optimized to death and beyond, cryptic in an entirely new way float t0, t1; float angle, c, s; vec3_t vr, vu, vf; @@ -454,8 +254,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, vf[1] = dir[1]; vf[2] = dir[2]; -// PerpendicularVector(vr, dir); -// CrossProduct(vr, vf, vu); VectorVectors(vf, vr, vu); t0 = vr[0] * c + vu[0] * -s; @@ -475,7 +273,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, dst[2] = (t0 * vr[0] + t1 * vu[0] + vf[2] * vf[0]) * point[0] + (t0 * vr[1] + t1 * vu[1] + vf[2] * vf[1]) * point[1] + (t0 * vr[2] + t1 * vu[2] + vf[2] * vf[2]) * point[2]; -#endif } /*-----------------------------------------------------------------*/ @@ -668,36 +465,6 @@ void AngleMatrix (const vec3_t angles, const vec3_t translate, vec_t matrix[][4] matrix[2][3] = translate[2]; } -// LordHavoc: changed CrossProduct to a #define -/* -void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross) -{ - cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; - cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; - cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; -} -*/ - -/* -// LordHavoc: fixme: do more research on gcc assembly so that qftol_minushalf and result will not be considered unused -static double qftol_minushalf = -0.5; - -int qftol(double v) -{ - int result; -#ifdef _MSC_VER - __asm - { - fld v - fadd qftol_minushalf - fistp result - } -#else // gcc hopefully - asm("fldl v\n\tfaddl qftol_minushalf\n\tfistpl result"); -#endif - return result; -} -*/ // LordHavoc: renamed these to Length, and made the normal ones #define float VectorNormalizeLength (vec3_t v) @@ -719,27 +486,6 @@ float VectorNormalizeLength (vec3_t v) } -/* -float VectorNormalizeLength2 (vec3_t v, vec3_t dest) // LordHavoc: added to allow copying while doing the calculation... -{ - float length, ilength; - - length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = sqrt (length); // FIXME - - if (length) - { - ilength = 1/length; - dest[0] = v[0] * ilength; - dest[1] = v[1] * ilength; - dest[2] = v[2] * ilength; - } - else - dest[0] = dest[1] = dest[2] = 0; - - return length; -} -*/ /* ================ @@ -791,3 +537,4 @@ void Mathlib_Init(void) for (a = 1;a < 4096;a++) ixtable[a] = 1.0f / a; } + diff --git a/menu.c b/menu.c index dd307993..5c657a4e 100644 --- a/menu.c +++ b/menu.c @@ -153,7 +153,6 @@ void M_DrawBackground(void) menu_height = 200; menu_x = (vid.conwidth - menu_width) * 0.5; menu_y = (vid.conheight - menu_height) * 0.5; - //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0); DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0); } @@ -174,13 +173,6 @@ void M_DrawCharacter (float cx, float cy, int num) void M_Print (float cx, float cy, char *str) { - /* - while (*str) - { - M_DrawCharacter (cx, cy, (*str++)+128); - cx += 8; - } - */ DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0); } @@ -191,13 +183,6 @@ void M_PrintWhite (float cx, float cy, char *str) void M_ItemPrint (float cx, float cy, char *str, int unghosted) { - /* - while (*str) - { - M_DrawCharacter (cx, cy, (*str++)+128); - cx += 8; - } - */ if (unghosted) DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0); else @@ -325,50 +310,6 @@ void M_ToggleMenu_f (void) } } -// LordHavoc: FIXME: finish this menu stuff -#if 0 -#define MAXMENUITEMS 128 - -typedef struct menuitem_s -{ - char *string; // may be text, or an image to use, or a cvar name, depending on the functions used - char *description; - char *command; // used by command items mainly (when used, this command is executed) - cvar_t *cvar; // used for cvar items (sliders, number boxes), value is retrieved from the cvar itself - int selectable; // purely decorative if this is false - int selected; // true if this menu item is currently selected, used by funcs so they don't need to know anything but fields in the menuitem - float selecttime; // the time that this menu item was activated (copied from realtime), used for animating selection flashs and such - float color[4]; // current color for the item (may be different than base color, due to selection flash effects) - float basecolor[4]; // the base color - float x, y, width, height; // width and height are used for mouse selection - void(*drawfunc)(struct menuitem_s *item); - void(*activefunc)(struct menuitem_s *item); -// void(*selectfunc)(struct menuitem_s *item); -// void(*deselectfunc)(struct menuitem_s *item); - void(*usefunc)(struct menuitem_s *item); -} -menuitem_t; - -menuitem_t menuitem[MAXMENUITEMS]; -int menuitems; - -void menuitem_text_drawfunc(struct menuitem_s *item) -{ - // FIXME: handle color flashs and such when selected - M_Print (item->x, item->y, item->string); -} - -void menuitem_image_drawfunc(struct menuitem_s *item) -{ - // FIXME: handle color flashs and such when selected - M_DrawPic (item->x, item->y, item->string); -} - -void menuitem_command_usefunc(struct menuitem_s *item) -{ - Cbuf_AddText (item->command); -} -#endif int demo_cursor; void M_Demo_Draw (void) @@ -427,7 +368,6 @@ void M_Demo_Key (int k) /* MAIN MENU */ int m_main_cursor; -//#define MAIN_ITEMS 5 int MAIN_ITEMS = 4; // Nehahra: Menu Disable @@ -1385,70 +1325,12 @@ void M_DrawSlider (int x, int y, float range) void M_DrawCheckbox (int x, int y, int on) { -#if 0 - if (on) - M_DrawCharacter (x, y, 131); - else - M_DrawCharacter (x, y, 129); -#endif if (on) M_Print (x, y, "on"); else M_Print (x, y, "off"); } -/* -int m_2dres[] = -{ - 320, 200, - 320, 240, - 400, 300, - 512, 384, - 640, 480, - 800, 600, - 1024, 768, - 1280, 960, - 1600, 1200, - 2048, 1536 -}; - -int M_Num2DResolutions(void) -{ - return sizeof(m_2dres) / sizeof(int[2]); -}; - -float M_Classify2DResolution(void) -{ - int i, num, *res, best, bestdist, diff[3]; - num = M_Num2DResolutions(); - best = -1; - bestdist = 1000000000; - for (i = 0;i < num;i++) - { - res = m_2dres + i * 2; - diff[0] = res[0] - vid.conwidth; - diff[1] = res[1] - vid.conheight; - diff[2] = 0; - dist = DotProduct(diff, diff); - if (bestdist > dist) - { - bestdist = dist; - best = i; - } - } - return i; -} - -void M_Adjust2DResolution(int dir) -{ - int i, num; - i = M_Classify2DResolution() + dir; - num = M_Num2DResolutions() - 1; - i = bound(0, i, num); - Cvar_SetValue("v_2dwidth", m_2dres[i*2]); - Cvar_SetValue("v_2dheight", m_2dres[i*2+1]); -} -*/ void M_Options_Draw (void) { @@ -1909,7 +1791,6 @@ int msgNumber; int m_quit_prevstate; qboolean wasInMenus; -//#ifndef _WIN32 char *quitMessage [] = { /* .........1.........2.... */ @@ -1976,7 +1857,6 @@ char *quitMessage [] = " constructive? ", " ", }; -//#endif void M_Menu_Quit_f (void) { @@ -2025,38 +1905,11 @@ void M_Quit_Key (int key) void M_Quit_Draw (void) { -/* -#ifdef _WIN32 - M_DrawTextBox (0, 0, 38, 23); - M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n"); - M_PrintWhite (16, 28, "Programming Art \n"); - M_Print (16, 36, " John Carmack Adrian Carmack\n"); - M_Print (16, 44, " Michael Abrash Kevin Cloud\n"); - M_Print (16, 52, " John Cash Paul Steed\n"); - M_Print (16, 60, " Dave 'Zoid' Kirsch\n"); - M_PrintWhite (16, 68, "Design Biz\n"); - M_Print (16, 76, " John Romero Jay Wilbur\n"); - M_Print (16, 84, " Sandy Petersen Mike Wilson\n"); - M_Print (16, 92, " American McGee Donna Jackson\n"); - M_Print (16, 100, " Tim Willits Todd Hollenshead\n"); - M_PrintWhite (16, 108, "Support Projects\n"); - M_Print (16, 116, " Barrett Alexander Shawn Green\n"); - M_PrintWhite (16, 124, "Sound Effects\n"); - M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n"); - M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n"); - M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n"); - M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n"); - M_PrintWhite (16, 164, "registered trademark licensed to\n"); - M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n"); - M_PrintWhite (16, 180, "reserved. Press y to exit\n"); -#else -*/ M_DrawTextBox (56, 76, 24, 4); M_Print (64, 84, quitMessage[msgNumber*4+0]); M_Print (64, 92, quitMessage[msgNumber*4+1]); M_Print (64, 100, quitMessage[msgNumber*4+2]); M_Print (64, 108, quitMessage[msgNumber*4+3]); -//#endif } //============================================================================= @@ -2672,12 +2525,6 @@ void M_GameOptions_Draw (void) M_Print (x, 154, " First, question your "); M_Print (x, 162, " sanity, then email "); M_Print (x, 170, " havoc@gamevisions.com "); - /* - M_Print (x, 146, " More than 4 players "); - M_Print (x, 154, " requires using command "); - M_Print (x, 162, "line parameters; please "); - M_Print (x, 170, " see techinfo.txt. "); - */ } else { @@ -3241,3 +3088,4 @@ void M_ConfigureNetSubsystem(void) if (IPXConfig || TCPIPConfig) net_hostport = lanConfig_port; } + diff --git a/model_alias.c b/model_alias.c index e80ee4db..5bdf6f96 100644 --- a/model_alias.c +++ b/model_alias.c @@ -484,12 +484,8 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) Mod_MDL_LoadFrames (startframes, numverts, totalverts, scale, translate); - // LordHavoc: fixed model bbox - was //FIXME: do this right - //loadmodel->mins[0] = loadmodel->mins[1] = loadmodel->mins[2] = -16; - //loadmodel->maxs[0] = loadmodel->maxs[1] = loadmodel->maxs[2] = 16; modelyawradius = sqrt(modelyawradius); modelradius = sqrt(modelradius); -// loadmodel->modelradius = modelradius; for (j = 0;j < 3;j++) { loadmodel->normalmins[j] = aliasbboxmin[j]; @@ -749,7 +745,6 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer) // LordHavoc: model bbox modelyawradius = sqrt(modelyawradius); modelradius = sqrt(modelradius); -// loadmodel->modelradius = modelradius; for (j = 0;j < 3;j++) { loadmodel->normalmins[j] = aliasbboxmin[j]; @@ -948,7 +943,6 @@ void Mod_LoadZymoticModel(model_t *mod, void *buffer) // model bbox modelradius = pheader->radius; -// loadmodel->modelradius = pheader->radius; for (i = 0;i < 3;i++) { loadmodel->normalmins[i] = pheader->mins[i]; @@ -970,3 +964,4 @@ void Mod_LoadZymoticModel(model_t *mod, void *buffer) loadmodel->DrawSky = NULL; loadmodel->DrawShadow = NULL; } + diff --git a/model_brush.c b/model_brush.c index be7c3067..c4fae283 100644 --- a/model_brush.c +++ b/model_brush.c @@ -60,8 +60,6 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) mnode_t *node; Mod_CheckLoaded(model); -// if (!model || !model->nodes) -// Sys_Error ("Mod_PointInLeaf: bad model"); // LordHavoc: modified to start at first clip node, // in other words: first node of the (sub)model @@ -86,32 +84,6 @@ void Mod_FindNonSolidLocation(vec3_t pos, model_t *mod) pos[2]-=1; } -/* -mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) -{ - mnode_t *node; - float d; - mplane_t *plane; - - if (!model || !model->nodes) - Sys_Error ("Mod_PointInLeaf: bad model"); - - node = model->nodes; - while (1) - { - if (node->contents < 0) - return (mleaf_t *)node; - plane = node->plane; - d = DotProduct (p,plane->normal) - plane->dist; - if (d > 0) - node = node->children[0]; - else - node = node->children[1]; - } - - return NULL; // never reached -} -*/ /* =================== @@ -128,18 +100,6 @@ static qbyte *Mod_DecompressVis (qbyte *in, model_t *model) row = (model->numleafs+7)>>3; out = decompressed; - /* - if (!in) - { // no vis info, so make all visible - while (row) - { - *out++ = 0xff; - row--; - } - return decompressed; - } - */ - do { if (*in) @@ -1039,14 +999,8 @@ void Mod_GenerateWarpMesh (msurface_t *surf) memset(mesh->vertex, 0, mesh->numverts * sizeof(surfvertex_t)); for (i = 0;i < mesh->numtriangles;i++) - { for (j = 0;j < 3;j++) - { mesh->index[i*3+j] = subdivpolyindex[i][j]; - //if (mesh->index[i] < 0 || mesh->index[i] >= mesh->numverts) - // Host_Error("Mod_GenerateWarpMesh: invalid index generated\n"); - } - } for (i = 0, v = mesh->vertex;i < subdivpolyverts;i++, v++) { @@ -1063,7 +1017,6 @@ void Mod_GenerateVertexLitMesh (msurface_t *surf) surfvertex_t *out; surfmesh_t *mesh; - //surf->flags |= SURF_LIGHTMAP; smax = surf->extents[0] >> 4; tmax = surf->extents[1] >> 4; surf->lightmaptexturestride = 0; @@ -1130,8 +1083,6 @@ void Mod_GenerateLightmappedMesh (msurface_t *surf) surf->lightmaptexturestride = R_CompatibleFragmentWidth((surf->extents[0]>>4)+1, loadmodel->lightmaprgba ? TEXTYPE_RGBA : TEXTYPE_RGB, 0); surf->lightmaptexture = R_ProceduralTexture(loadmodel->texturepool, NULL, surf->lightmaptexturestride, (surf->extents[1]>>4)+1, loadmodel->lightmaprgba ? TEXTYPE_RGBA : TEXTYPE_RGB, TEXF_FRAGMENT | TEXF_PRECACHE, NULL, NULL, 0); } -// surf->lightmaptexture = R_LoadTexture(loadmodel->texturepool, va("lightmap%08x", lightmapnum), surf->lightmaptexturestride, (surf->extents[1]>>4)+1, NULL, loadmodel->lightmaprgba ? TEXTYPE_RGBA : TEXTYPE_RGB, TEXF_FRAGMENT | TEXF_PRECACHE); -// surf->lightmaptexture = R_LoadTexture(loadmodel->texturepool, va("lightmap%08x", lightmapnum), surf->lightmaptexturestride, (surf->extents[1]>>4)+1, NULL, loadmodel->lightmaprgba ? TEXTYPE_RGBA : TEXTYPE_RGB, TEXF_PRECACHE); R_FragmentLocation(surf->lightmaptexture, NULL, NULL, &xbase, &ybase, &xscale, &yscale); xscale = (xscale - xbase) * 16.0 / ((surf->extents[0] & ~15) + 16); yscale = (yscale - ybase) * 16.0 / ((surf->extents[1] & ~15) + 16); @@ -1352,13 +1303,6 @@ static void Mod_LoadFaces (lump_t *l) else if (out->texinfo->texture->flags & SURF_DRAWTURB) { out->shader = &Cshader_water; - /* - for (i=0 ; i<2 ; i++) - { - out->extents[i] = 16384*1024; - out->texturemins[i] = -8192*1024; - } - */ out->samples = NULL; Mod_GenerateWarpMesh (out); } @@ -1534,15 +1478,7 @@ static void Mod_LoadLeafs (lump_t *l) for (j=0 ; j<4 ; j++) out->ambient_sound_level[j] = in->ambient_level[j]; - // gl underwater warp - // LordHavoc: disabled underwater warping - /* - if (out->contents != CONTENTS_EMPTY) - { - for (j=0 ; jnummarksurfaces ; j++) - out->firstmarksurface[j]->flags |= SURF_UNDERWATER; - } - */ + // FIXME: Insert caustics here } } @@ -1749,8 +1685,6 @@ static void Mod_LoadPlanes (lump_t *l) out->normal[2] = LittleFloat (in->normal[2]); out->dist = LittleFloat (in->dist); - // LordHavoc: recalculated by PlaneClassify, FIXME: validate type and report error if type does not match normal? -// out->type = LittleLong (in->type); PlaneClassify(out); } } @@ -1928,9 +1862,6 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon) // free the original winding FreeWinding (in); - // debugging - //Mem_CheckSentinels(neww); - return neww; } @@ -2043,10 +1974,6 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi VectorCopy (mid, b->points[b->numpoints]); b->numpoints++; } - - // debugging - //Mem_CheckSentinels(f); - //Mem_CheckSentinels(b); } typedef struct portal_s @@ -2070,7 +1997,6 @@ static portal_t *AllocPortal (void) { portal_t *p; p = Mem_Alloc(loadmodel->mempool, sizeof(portal_t)); - //memset(p, 0, sizeof(portal_t)); p->chain = portalchain; portalchain = p; return p; @@ -2107,8 +2033,6 @@ static void Mod_FinalizePortals(void) mleaf_t *leaf, *endleaf; winding_t *w; - //Mem_CheckSentinelsGlobal(); - // recalculate bounding boxes for all leafs (because qbsp is very sloppy) leaf = loadmodel->leafs; endleaf = leaf + loadmodel->numleafs; @@ -2142,8 +2066,6 @@ static void Mod_FinalizePortals(void) Mod_RecursiveRecalcNodeBBox(loadmodel->nodes); - //Mem_CheckSentinelsGlobal(); - // tally up portal and point counts p = portalchain; numportals = 0; @@ -2234,8 +2156,6 @@ static void Mod_FinalizePortals(void) FreePortal(p); p = pnext; } - - //Mem_CheckSentinelsGlobal(); } /* @@ -2319,8 +2239,6 @@ static void Mod_RecursiveNodePortals (mnode_t *node) portal_t *portal, *nextportal, *nodeportal, *splitportal, *temp; winding_t *nodeportalwinding, *frontwinding, *backwinding; - // CheckLeafPortalConsistancy (node); - // if a leaf, we're done if (node->contents) return; @@ -2338,7 +2256,6 @@ static void Mod_RecursiveNodePortals (mnode_t *node) nodeportal->plane = *node->plane; nodeportalwinding = BaseWindingForPlane (node->plane); - //Mem_CheckSentinels(nodeportalwinding); side = 0; // shut up compiler warning for (portal = (portal_t *)node->portals;portal;portal = portal->next[side]) { @@ -2433,52 +2350,10 @@ static void Mod_RecursiveNodePortals (mnode_t *node) Mod_RecursiveNodePortals(back); } -/* -void Mod_MakeOutsidePortals(mnode_t *node) -{ - int i, j; - portal_t *p, *portals[6]; - mnode_t *outside_node; - - outside_node = Mem_Alloc(loadmodel->mempool, sizeof(mnode_t)); - outside_node->contents = CONTENTS_SOLID; - outside_node->portals = NULL; - - for (i = 0;i < 3;i++) - { - for (j = 0;j < 2;j++) - { - portals[j*3 + i] = p = AllocPortal (); - memset (&p->plane, 0, sizeof(mplane_t)); - p->plane.normal[i] = j ? -1 : 1; - p->plane.dist = -65536; - p->winding = BaseWindingForPlane (&p->plane); - if (j) - AddPortalToNodes (p, outside_node, node); - else - AddPortalToNodes (p, node, outside_node); - } - } - - // clip the basewindings by all the other planes - for (i = 0;i < 6;i++) - { - for (j = 0;j < 6;j++) - { - if (j == i) - continue; - portals[i]->winding = ClipWinding (portals[i]->winding, &portals[j]->plane, true); - } - } -} -*/ static void Mod_MakePortals(void) { -// Con_Printf("building portals for %s\n", loadmodel->name); - portalchain = NULL; -// Mod_MakeOutsidePortals (loadmodel->nodes); Mod_RecursiveNodePortals (loadmodel->nodes); Mod_FinalizePortals(); } @@ -2518,44 +2393,24 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) // store which lightmap format to use mod->lightmaprgba = r_lightmaprgba.integer; -// Mem_CheckSentinelsGlobal(); - // LordHavoc: had to move entity loading above everything to allow parsing various settings from worldspawn Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadEdges (&header->lumps[LUMP_EDGES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]); -// Mem_CheckSentinelsGlobal(); Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); -// Mem_CheckSentinelsGlobal(); Mod_LoadFaces (&header->lumps[LUMP_FACES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); -// Mem_CheckSentinelsGlobal(); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); -// Mem_CheckSentinelsGlobal(); Mod_LoadNodes (&header->lumps[LUMP_NODES]); -// Mem_CheckSentinelsGlobal(); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); -// Mem_CheckSentinelsGlobal(); -// Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); -// Mem_CheckSentinelsGlobal(); Mod_MakeHull0 (); -// Mem_CheckSentinelsGlobal(); Mod_MakePortals(); -// Mem_CheckSentinelsGlobal(); mod->numframes = 2; // regular and alternate animation @@ -2625,7 +2480,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->yawmaxs[2] = mod->normalmaxs[2]; mod->rotatedmins[0] = mod->rotatedmins[1] = mod->rotatedmins[2] = -modelradius; mod->rotatedmaxs[0] = mod->rotatedmaxs[1] = mod->rotatedmaxs[2] = modelradius; -// mod->modelradius = modelradius; // LordHavoc: check for empty submodels (lacrima.bsp has such a glitch) if (mod->normalmins[0] > mod->normalmaxs[0] || mod->normalmins[1] > mod->normalmaxs[1] || mod->normalmins[2] > mod->normalmaxs[2]) { @@ -2636,14 +2490,8 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) VectorClear(mod->yawmaxs); VectorClear(mod->rotatedmins); VectorClear(mod->rotatedmaxs); - //mod->modelradius = 0; } -// VectorCopy (bm->maxs, mod->maxs); -// VectorCopy (bm->mins, mod->mins); - -// mod->radius = RadiusFromBounds (mod->mins, mod->maxs); - mod->numleafs = bm->visleafs; mod->SERAddEntity = Mod_Brush_SERAddEntity; @@ -2668,5 +2516,5 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod = loadmodel; } } -// Mem_CheckSentinelsGlobal(); } + diff --git a/model_shared.c b/model_shared.c index f9fc38ae..0af7ff35 100644 --- a/model_shared.c +++ b/model_shared.c @@ -151,9 +151,6 @@ static model_t *Mod_LoadModel (model_t *mod, qboolean crash, qboolean checkdisk, crc = CRC_Block(buf, com_filesize); } - // make sure nothing got trashed - //Mem_CheckSentinelsGlobal(); - // allocate a new model loadmodel = mod; @@ -179,9 +176,6 @@ static model_t *Mod_LoadModel (model_t *mod, qboolean crash, qboolean checkdisk, Mem_Free(buf); - // make sure nothing got trashed - //Mem_CheckSentinelsGlobal(); - return mod; } @@ -208,15 +202,6 @@ Mod_ClearAll */ void Mod_ClearAll (void) { - /* - int i; - model_t *mod; - - for (i = 0, mod = mod_known;i < MAX_MOD_KNOWN;i++, mod++) - if (mod->name[0]) - if (mod->usesheap) - Mod_FreeModel(mod); - */ } void Mod_ClearUsed(void) @@ -311,23 +296,6 @@ model_t *Mod_ForName (char *name, qboolean crash, qboolean checkdisk, qboolean i qbyte *mod_base; -/* -================= -RadiusFromBounds -================= -*/ -/* -float RadiusFromBounds (vec3_t mins, vec3_t maxs) -{ - int i; - vec3_t corner; - - for (i=0 ; i<3 ; i++) - corner[i] = fabs(mins[i]) > fabs(maxs[i]) ? fabs(mins[i]) : fabs(maxs[i]); - - return Length (corner); -} -*/ //============================================================================= diff --git a/model_sprite.c b/model_sprite.c index 346fddb1..7af45a9a 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -225,7 +225,6 @@ void Mod_Sprite_SharedSetup(qbyte *datapointer, int version, int *palette) loadmodel->normalmins[i] = loadmodel->yawmins[i] = loadmodel->rotatedmins[i] = -modelradius; loadmodel->normalmaxs[i] = loadmodel->yawmaxs[i] = loadmodel->rotatedmaxs[i] = modelradius; } -// loadmodel->modelradius = modelradius; } void Mod_Sprite_SERAddEntity(void) @@ -303,7 +302,6 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) palette[i][2] = *in++; palette[i][3] = 255; } - // palette[255][0] = palette[255][1] = palette[255][2] = palette[255][3] = 0; loadmodel->flags |= EF_ADDITIVE; break; case SPRHL_INDEXALPHA: @@ -336,3 +334,4 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) else Host_Error ("Mod_LoadSpriteModel: %s has wrong version number (%i should be 1 (quake) or 32 (sprite32) or 2 (halflife)", loadmodel->name, version); } + diff --git a/net_bsd.c b/net_bsd.c index 79d62f85..17135155 100644 --- a/net_bsd.c +++ b/net_bsd.c @@ -91,3 +91,4 @@ net_landriver_t net_landrivers[MAX_NET_DRIVERS] = }; int net_numlandrivers = 1; + diff --git a/net_dgrm.c b/net_dgrm.c index e609b552..c8956e67 100644 --- a/net_dgrm.c +++ b/net_dgrm.c @@ -326,9 +326,6 @@ int Datagram_GetMessage (qsocket_t *sock) { length = sfunc.Read (sock->socket, (qbyte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr); -// if ((rand() & 255) > 220) -// continue; - if (length == 0) break; @@ -489,20 +486,12 @@ void NET_Stats_f (void) { for (s = net_activeSockets; s; s = s->next) PrintStats(s); - // LordHavoc: sockets are dynamically allocated now - //for (s = net_freeSockets; s; s = s->next) - // PrintStats(s); } else { for (s = net_activeSockets; s; s = s->next) if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0) break; - // LordHavoc: sockets are dynamically allocated now - //if (s == NULL) - // for (s = net_freeSockets; s; s = s->next) - // if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0) - // break; if (s == NULL) return; PrintStats(s); @@ -1086,7 +1075,6 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteByte(&net_message, CCREP_ACCEPT); dfunc.GetSocketAddr(newsock, &newaddr); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); -// MSG_WriteString(&net_message, dfunc.AddrToString(&newaddr)); *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); @@ -1274,12 +1262,10 @@ static qsocket_t *_Datagram_Connect (char *host) // is it from the right place? if (sfunc.AddrCompare(&readaddr, &sendaddr) != 0) { -//#ifdef DEBUG Con_DPrintf("wrong reply address\n"); Con_DPrintf("Expected: %s\n", StrAddr (&sendaddr)); Con_DPrintf("Received: %s\n", StrAddr (&readaddr)); CL_UpdateScreen (); -//#endif ret = 0; continue; } @@ -1397,3 +1383,4 @@ qsocket_t *Datagram_Connect (char *host) break; return ret; } + diff --git a/net_loop.c b/net_loop.c index 8424ca9c..bfb356b5 100644 --- a/net_loop.c +++ b/net_loop.c @@ -244,3 +244,4 @@ void Loop_Close (qsocket_t *sock) else loop_server = NULL; } + diff --git a/net_main.c b/net_main.c index 4450e235..4c6971d0 100644 --- a/net_main.c +++ b/net_main.c @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" qsocket_t *net_activeSockets = NULL; -//qsocket_t *net_freeSockets = NULL; -//int net_numsockets = 0; mempool_t *net_mempool; qboolean ipxAvailable = false; @@ -90,16 +88,9 @@ qsocket_t *NET_NewQSocket (void) { qsocket_t *sock; -// if (net_freeSockets == NULL) -// return NULL; - if (net_activeconnections >= svs.maxclients) return NULL; - // get one from free list -// sock = net_freeSockets; -// net_freeSockets = sock->next; - // LordHavoc: sockets are dynamically allocated now sock = Mem_Alloc(net_mempool, sizeof(qsocket_t)); // add it to active list @@ -146,11 +137,6 @@ void NET_FreeQSocket(qsocket_t *sock) Sys_Error ("NET_FreeQSocket: not active\n"); } - // add it to free list -// sock->next = net_freeSockets; -// net_freeSockets = sock; -// sock->disconnected = true; - // LordHavoc: sockets are dynamically allocated now Mem_Free(sock); } @@ -206,13 +192,6 @@ static void MaxPlayers_f (void) Cbuf_AddText ("listen 1\n"); svs.maxclients = n; - // LordHavoc: resetting deathmatch and coop was silly - /* - if (n == 1) - Cvar_Set ("deathmatch", "0"); - else - Cvar_Set ("deathmatch", "1"); - */ } @@ -700,8 +679,6 @@ void NET_Init (void) { int i; int controlSocket; - // LordHavoc: sockets are dynamically allocated now - //qsocket_t *s; i = COM_CheckParm ("-port"); if (!i) @@ -720,25 +697,10 @@ void NET_Init (void) if (COM_CheckParm("-listen") || cls.state == ca_dedicated || gamemode == GAME_BLOODBATH) listening = true; - // LordHavoc: sockets are dynamically allocated now - //net_numsockets = svs.maxclientslimit; - //if (cls.state != ca_dedicated) - // net_numsockets++; SetNetTime(); net_mempool = Mem_AllocPool("qsocket"); - // LordHavoc: sockets are dynamically allocated now - /* - s = Mem_Alloc(net_mempool, net_numsockets * sizeof(qsocket_t)); - for (i = 0; i < net_numsockets; i++) - { - s->next = net_freeSockets; - net_freeSockets = s; - s->disconnected = true; - s++; - } - */ // allocate space for network message buffer SZ_Alloc (&net_message, NET_MAXMESSAGE, "net_message"); @@ -843,3 +805,4 @@ void SchedulePollProcedure(PollProcedure *proc, double timeOffset) proc->next = pp; prev->next = proc; } + diff --git a/net_udp.c b/net_udp.c index 9b913306..18471851 100644 --- a/net_udp.c +++ b/net_udp.c @@ -414,4 +414,3 @@ int UDP_SetSocketPort (struct qsockaddr *addr, int port) return 0; } -//============================================================================= diff --git a/net_win.c b/net_win.c index 019a9c72..d34348cd 100644 --- a/net_win.c +++ b/net_win.c @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "net_loop.h" #include "net_dgrm.h" -//#include "net_ser.h" net_driver_t net_drivers[MAX_NET_DRIVERS] = { @@ -118,3 +117,4 @@ net_landriver_t net_landrivers[MAX_NET_DRIVERS] = }; int net_numlandrivers = 2; + diff --git a/net_wins.c b/net_wins.c index 236c3554..4deb5c7c 100644 --- a/net_wins.c +++ b/net_wins.c @@ -571,4 +571,3 @@ int WINS_SetSocketPort (struct qsockaddr *addr, int port) return 0; } -//============================================================================= diff --git a/net_wipx.c b/net_wipx.c index bf53adb5..12729785 100644 --- a/net_wipx.c +++ b/net_wipx.c @@ -428,4 +428,3 @@ int WIPX_SetSocketPort (struct qsockaddr *addr, int port) return 0; } -//============================================================================= diff --git a/palette.c b/palette.c index 82da3de2..c7dd2e85 100644 --- a/palette.c +++ b/palette.c @@ -2,7 +2,6 @@ #include "quakedef.h" unsigned int d_8to24table[256]; -//qbyte d_15to8table[32768]; qbyte host_basepal[768]; cvar_t v_gamma = {CVAR_SAVE, "v_gamma", "1"}; @@ -28,38 +27,6 @@ void Palette_Setup8to24(void) d_8to24table[255] = 0; // completely transparent black } -/* -void Palette_Setup15to8(void) -{ - qbyte *pal; - unsigned r,g,b; - unsigned v; - int r1,g1,b1; - int j,k,l; - unsigned short i; - - for (i = 0;i < 32768;i++) - { - r = ((i & 0x001F) << 3)+4; - g = ((i & 0x03E0) >> 2)+4; - b = ((i & 0x7C00) >> 7)+4; - pal = (unsigned char *)d_8to24table; - for (v = 0, k = 0, l = 1000000000;v < 256;v++, pal += 4) - { - r1 = r - pal[0]; - g1 = g - pal[1]; - b1 = b - pal[2]; - j = r1*r1+g1*g1+b1*b1; - if (j < l) - { - k = v; - l = j; - } - } - d_15to8table[i] = k; - } -} -*/ void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out) { @@ -205,5 +172,5 @@ void Palette_Init(void) host_basepal[i] = temp[host_basepal[i]]; Palette_Setup8to24(); -// Palette_Setup15to8(); } + diff --git a/portals.c b/portals.c index 1ad130c2..0343e9de 100644 --- a/portals.c +++ b/portals.c @@ -11,7 +11,6 @@ static int ranoutofportals; static float portaltemppoints[2][256][3]; static float portaltemppoints2[256][3]; static int portal_markid = 0; -//float viewportalpoints[16*3]; static float boxpoints[4*3]; int Portal_ClipPolygonToPlane(float *in, float *out, int inpoints, int maxoutpoints, tinyplane_t *p) @@ -66,18 +65,6 @@ begin: return outpoints; } -/* -void Portal_TriangleToPlane(vec3_t point1, vec3_t point2, vec3_t point3, tinyplane_t *p) -{ - vec3_t v1, v2; - VectorSubtract(point1, point2, v1); - VectorSubtract(point3, point2, v2); - CrossProduct(v1, v2, p->normal); -// VectorNormalize(p->normal); - VectorNormalizeFast(p->normal); - p->dist = DotProduct(point1, p->normal); -} -*/ int Portal_PortalThroughPortalPlanes(tinyplane_t *clipplanes, int clipnumplanes, float *targpoints, int targnumpoints, float *out, int maxpoints) { @@ -134,7 +121,6 @@ int Portal_RecursiveFlowSearch (mleaf_t *leaf, vec3_t eye, int firstclipplane, i newplanes = &portalplanes[firstclipplane + numclipplanes]; for (prev = newpoints - 1, i = 0;i < newpoints;prev = i, i++) { -// Portal_TriangleToPlane(eye, portaltemppoints2[i], portaltemppoints2[prev], newplanes + i); VectorSubtract(eye, portaltemppoints2[i], v1); VectorSubtract(portaltemppoints2[prev], portaltemppoints2[i], v2); CrossProduct(v1, v2, newplanes[i].normal); @@ -218,7 +204,6 @@ int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpo // calculate the planes, and make sure the polygon can see it's own center for (prev = numpoints - 1, i = 0;i < numpoints;prev = i, i++) { -// Portal_TriangleToPlane(eye, portaltemppoints2[i], portaltemppoints2[prev], newplanes + i); VectorSubtract(eye, (&polypoints[i * 3]), v1); VectorSubtract((&polypoints[prev * 3]), (&polypoints[i * 3]), v2); CrossProduct(v1, v2, portalplanes[i].normal); @@ -329,3 +314,4 @@ int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b) return false; } + diff --git a/pr_cmds.c b/pr_cmds.c index c1334934..6042f097 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -168,13 +168,9 @@ void PF_objerror (void) ed = PROG_TO_EDICT(pr_global_struct->self); ED_Print (ed); ED_Free (ed); - -// LordHavoc: bug fix - no longer kills server -// Host_Error ("Program error"); } - /* ============== PF_makevectors @@ -225,80 +221,12 @@ void PF_setorigin (void) void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate) { - /* - float *angles; - vec3_t rmin, rmax; - float bounds[2][3]; - float xvector[2], yvector[2]; - float a; - vec3_t base, transformed; - int i, j, k, l; - */ int i; for (i=0 ; i<3 ; i++) if (min[i] > max[i]) PR_RunError ("backwards mins/maxs"); - /* - rotate = false; // FIXME: implement rotation properly again - - if (!rotate) - { - VectorCopy (min, rmin); - VectorCopy (max, rmax); - } - else - { - // find min / max for rotations - angles = e->v.angles; - - a = angles[1]/180 * M_PI; - - xvector[0] = cos(a); - xvector[1] = sin(a); - yvector[0] = -sin(a); - yvector[1] = cos(a); - - VectorCopy (min, bounds[0]); - VectorCopy (max, bounds[1]); - - rmin[0] = rmin[1] = rmin[2] = 9999; - rmax[0] = rmax[1] = rmax[2] = -9999; - - for (i=0 ; i<= 1 ; i++) - { - base[0] = bounds[i][0]; - for (j=0 ; j<= 1 ; j++) - { - base[1] = bounds[j][1]; - for (k=0 ; k<= 1 ; k++) - { - base[2] = bounds[k][2]; - - // transform the point - transformed[0] = xvector[0]*base[0] + yvector[0]*base[1]; - transformed[1] = xvector[1]*base[0] + yvector[1]*base[1]; - transformed[2] = base[2]; - - for (l=0 ; l<3 ; l++) - { - if (transformed[l] < rmin[l]) - rmin[l] = transformed[l]; - if (transformed[l] > rmax[l]) - rmax[l] = transformed[l]; - } - } - } - } - } - -// set derived values - VectorCopy (rmin, e->v.mins); - VectorCopy (rmax, e->v.maxs); - VectorSubtract (max, min, e->v.size); - */ - // set derived values VectorCopy (min, e->v.mins); VectorCopy (max, e->v.maxs); @@ -356,24 +284,11 @@ void PF_setmodel (void) e->v.model = m - pr_strings; - e->v.modelindex = i; //SV_ModelIndex (m); + e->v.modelindex = i; - mod = sv.models[ (int)e->v.modelindex]; // Mod_ForName (m, true); + mod = sv.models[ (int)e->v.modelindex]; if (mod) - /* - { // LordHavoc: corrected model bounding box, but for compatibility that means I have to break it here - vec3_t min, max; - if (mod->type == ALIASTYPE_MDL) - { - min[0] = min[1] = min[2] = -16; - max[0] = max[1] = max[2] = 16; - SetMinMaxSize (e, min, max, true); - } - else - SetMinMaxSize (e, mod->mins, mod->maxs, true); - } - */ SetMinMaxSize (e, mod->normalmins, mod->normalmaxs, true); else SetMinMaxSize (e, vec3_origin, vec3_origin, true); @@ -727,8 +642,6 @@ break() */ void PF_break (void) { -// Con_Printf ("break statement\n"); -// *(int *)-4 = 0; // dump to debugger PR_RunError ("break statement"); } @@ -1123,12 +1036,6 @@ void PF_ftos (void) v = G_FLOAT(OFS_PARM0); s = PR_GetTempString(); - /* - if (v == (int)v) - sprintf (s, "%d",(int)v); - else - sprintf (s, "%5.1f",v); - */ // LordHavoc: ftos improvement sprintf (s, "%g", v); G_INT(OFS_RETURN) = s - pr_strings; @@ -2717,3 +2624,4 @@ PF_te_plasmaburn, // #433 builtin_t *pr_builtins = pr_builtin; int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]); + diff --git a/pr_edict.c b/pr_edict.c index 23a05d1f..c812c00a 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -350,39 +350,6 @@ dfunction_t *ED_FindFunction (char *name) } -/* -eval_t *GetEdictFieldValue(edict_t *ed, char *field) -{ - ddef_t *def = NULL; - int i; - static int rep = 0; - - for (i=0 ; iv + def->ofs*4); -} -*/ - /* ============ PR_ValueString @@ -1495,14 +1462,6 @@ edict_t *EDICT_NUM_ERROR(int n) Host_Error ("EDICT_NUM: bad number %i", n); return NULL; } -/* -edict_t *EDICT_NUM(int n) -{ - if (n < 0 || n >= sv.max_edicts) - Sys_Error ("EDICT_NUM: bad number %i", n); - return (edict_t *)((qbyte *)sv.edicts+ (n)*pr_edict_size); -} -*/ int NUM_FOR_EDICT(edict_t *e) { @@ -1524,3 +1483,4 @@ int NoCrash_NUM_FOR_EDICT(edict_t *e) b = b / pr_edict_size; return b; } + diff --git a/pr_exec.c b/pr_exec.c index 1db11281..113941a9 100644 --- a/pr_exec.c +++ b/pr_exec.c @@ -21,10 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -/* - -*/ - typedef struct { int s; @@ -425,3 +421,4 @@ chooseexecprogram: } } } + diff --git a/protocol.c b/protocol.c index 0c2d844e..4a66bfc6 100644 --- a/protocol.c +++ b/protocol.c @@ -44,7 +44,6 @@ void EntityFrame_AckFrame(entity_database_t *d, int frame) // (server) clears frame, to prepare for adding entities void EntityFrame_Clear(entity_frame_t *f, vec3_t eye) { - //memset(f, 0, sizeof(*f)); f->time = 0; f->framenum = 0; f->numentities = 0; @@ -481,51 +480,6 @@ void EntityFrame_Read(entity_database_t *d) EntityFrame_AddFrame(d, f); } -/* -// (client) reads (and interpolates) the eye location from the database, -// given a current time -int EntityFrame_FetchEye(entity_database_t *d, vec3_t eye, double time) -{ - float frac; - if (d->numframes == 0) - return false; -// Host_Error("EntityFrame_FetchEye: no frames\n"); - if (d->numframes > 1 && d->frames[d->numframes - 2].time != d->frames[d->numframes - 1].time) - { - frac = (time - d->frames[d->numframes - 2].time) / (d->frames[d->numframes - 1].time - d->frames[d->numframes - 2].time); - frac = bound(0, frac, 1); - VectorSubtract(d->frames[d->numframes - 2].eye, d->frames[d->numframes - 1].eye, eye); - VectorMA(d->frames[d->numframes - 2].eye, frac, eye, eye); - } - else - VectorCopy(d->frames[0].eye, eye); - return true; -} - -// (client) fetchs an entity from a frame, index is the index into the frame's entity list, returns false if index is out of bounds -int EntityFrame_FetchEntityByIndex(entity_frame_t *f, entity_state_t *e, int index) -{ - if (index < 0 || index >= f->numentities) - return false; - memcpy(e, f->entitydata + index, sizeof(*e)); - return true; -} - -int EntityFrame_FetchEntityByNumber(entity_frame_t *f, entity_state_t *e, int number) -{ - int i; - for (i = 0;i < f->numentities;i++) - { - if (f->entitydata[i].number == number) - { - memcpy(e, f->entitydata + i, sizeof(*e)); - return true; - } - } - ClearStateToDefault(e); - return false; -} -*/ // (client) returns the frame number of the most recent frame recieved int EntityFrame_MostRecentlyRecievedFrameNum(entity_database_t *d) @@ -535,3 +489,4 @@ int EntityFrame_MostRecentlyRecievedFrameNum(entity_database_t *d) else return -1; } + diff --git a/quakeio.c b/quakeio.c index f297e0e6..65535f93 100644 --- a/quakeio.c +++ b/quakeio.c @@ -39,10 +39,6 @@ # include #endif -//#ifdef _MSC_VER -//# define _POSIX_ -//#endif - #include #include #include @@ -402,3 +398,4 @@ void QuakeIO_Init(void) { quakeio_mempool = Mem_AllocPool("file management"); } + diff --git a/r_clip.c b/r_clip.c index db77a808..362268c4 100644 --- a/r_clip.c +++ b/r_clip.c @@ -16,10 +16,6 @@ typedef struct clipsurf_s // updated each time the surface is added to the stack, // for quicker comparisons. float wcurrent; - // this is a linked list of all edges belonging to this surface, - // used to remove them if this is a non-solid surface that is - // marked visible (it can not hide anything, so it is useless) -// struct clipedge_s *edgechain; } clipsurf_t; @@ -60,9 +56,6 @@ clippixel_t *clipbuffer; #endif float r_clip_viewmatrix[3][3], r_clip_viewmulx, r_clip_viewmuly, r_clip_viewcenterx, r_clip_viewcentery; -// REMOVELATER -//float xscale, yscale, xscaleinv, yscaleinv; -//float r_clip_nearclipdist, r_clip_nearclipdist2; tinyplane_t r_clip_viewplane[5]; mempool_t *r_clip_mempool; @@ -82,20 +75,12 @@ void R_Clip_MakeViewMatrix(void) VectorCopy (vright, r_clip_viewmatrix[0]); VectorNegate (vup, r_clip_viewmatrix[1]); VectorCopy (vpn, r_clip_viewmatrix[2]); -// r_clip_nearclipdist = DotProduct(r_origin, vpn) + 4.0f; -// r_clip_nearclipdist2 = r_clip_nearclipdist - 8.0f; VectorCopy (vpn, r_clip_viewplane[0].normal); r_clip_viewplane[0].dist = DotProduct(r_origin, vpn); memcpy(&r_clip_viewplane[1], &frustum[0], sizeof(tinyplane_t)); memcpy(&r_clip_viewplane[2], &frustum[1], sizeof(tinyplane_t)); memcpy(&r_clip_viewplane[3], &frustum[2], sizeof(tinyplane_t)); memcpy(&r_clip_viewplane[4], &frustum[3], sizeof(tinyplane_t)); -// REMOVELATER -// maxscreenscaleinv = (1.0f / max(clipwidth, clipheight)) * horizontalfieldofview * 0.5f; -// xscale = clipwidth / horizontalfieldofview; -// xscaleinv = 1.0 / xscale; -// yscale = xscale * pixelaspect; -// yscaleinv = 1.0 / yscale; } void R_Clip_StartFrame(void) @@ -221,26 +206,6 @@ int R_Clip_TriangleToPlane(vec3_t point1, vec3_t point2, vec3_t point3, tinyplan return false; } -/* -int R_Clip_TriangleToDoublePlane(double *point1, double *point2, double *point3, tinydoubleplane_t *p) -{ - double y, number; - double v1[3], v2[3]; - VectorSubtract(point1, point2, v1); - VectorSubtract(point3, point2, v2); - CrossProduct(v1, v2, p->normal); - number = DotProduct(p->normal, p->normal); - if (number >= 0.1) - { - y = 1.0 / sqrt(number); - VectorScale(p->normal, y, p->normal); - p->dist = DotProduct(point1, p->normal); - return true; - } - else - return false; -} -*/ int R_Clip_ClipPolygonToPlane(float *in, float *out, int inpoints, int stride, tinyplane_t *plane) { @@ -301,14 +266,9 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void float deltax, deltay, vx, vy, vz, fx; int i, j, k, nextvert, temp, topy, bottomy, height, addededges; clipedge_t *pedge; -// tinydoubleplane_t plane; tinyplane_t localplane; -// tinyplane_t testplane; float distinv; -// if (!solid) -// return; - if (polyplane == NULL) { polyplane = &localplane; @@ -328,29 +288,6 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void if (DotProduct(r_origin, polyplane->normal) < (polyplane->dist + 0.5f)) return; } -#if 0 // debugging (validates planes passed in) - else - { - // calculate the plane for the polygon - if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), &localplane)) - { - for (i = 0;i < numverts;i++) - for (j = i + 1;j < numverts;j++) - for (k = j + 1;k < numverts;k++) - if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), &localplane)) - goto valid4; - return; // gave up - valid4:; - } - -// if ((DotProduct(r_origin, polyplane->normal) < (polyplane->dist + 0.5f)) != (DotProduct(r_origin, localplane.normal) < (localplane.dist + 0.5f))) - if (DotProduct(polyplane->normal, localplane.normal) < 0.9f) - { - Con_Printf("*\n"); - return; - } - } -#endif // for adaptive limits needededges += numverts; @@ -375,7 +312,6 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void if (pavailedge + numverts > clipedgesend) return; -#if 1 for (i = 0;i < numverts;i++) { vx = tempverts2[i][0] - r_origin[0]; @@ -386,115 +322,25 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void screenverts[i][1] = (r_clip_viewmatrix[1][0] * vx + r_clip_viewmatrix[1][1] * vy + r_clip_viewmatrix[1][2] * vz) * r_clip_viewmuly * screenverts[i][2] + r_clip_viewcentery; } - /* - if (polyplane != NULL) - { - */ - /* - distinv = 1.0f / (polyplane->dist - DotProduct(r_origin, polyplane->normal)); - pavailsurf->wstepx = DotProduct(r_clip_viewmatrix[0], polyplane->normal) * xscaleinv * distinv; - pavailsurf->wstepy = DotProduct(r_clip_viewmatrix[1], polyplane->normal) * yscaleinv * distinv; - pavailsurf->w00 = DotProduct(r_clip_viewmatrix[2], polyplane->normal) * distinv - r_clip_viewcenterx * pavailsurf->wstepx - r_clip_viewcentery * pavailsurf->wstepy; - */ - /* - } - else - { - */ - // calculate the plane for the polygon - if (!R_Clip_TriangleToPlane(screenverts[0], screenverts[1], screenverts[2], &localplane)) - { - for (i = 0;i < numverts;i++) - for (j = i + 1;j < numverts;j++) - for (k = j + 1;k < numverts;k++) - if (R_Clip_TriangleToPlane(screenverts[i], screenverts[j], screenverts[k], &localplane)) - goto valid; - return; // gave up - valid:; - } - - // Set up the 1/z gradients from the polygon, calculating the - // base value at screen coordinate 0,0 so we can use screen - // coordinates directly when calculating 1/z from the gradients - distinv = 1.0f / localplane.normal[2]; - pavailsurf->wstepx = -(localplane.normal[0] * distinv); - pavailsurf->wstepy = -(localplane.normal[1] * distinv); - pavailsurf->w00 = localplane.dist * distinv; - /* - } - */ - // REMOVELATER - /* - prevdist = z1 * plane.normal[2] - plane.dist; - dist = z2 * plane.normal[2] - plane.dist; - d = prevdist / (prevdist - dist); - zc = z1 + d * (z2 - z1); - - prevdist = plane.normal[0] + z1 * plane.normal[2] - plane.dist; - dist = plane.normal[0] + z2 * plane.normal[2] - plane.dist; - d = prevdist / (prevdist - dist); - zx = (z1 + d * (z2 - z1)) - zc; - - prevdist = plane.normal[1] + z1 * plane.normal[2] - plane.dist; - dist = plane.normal[1] + z2 * plane.normal[2] - plane.dist; - d = prevdist / (prevdist - dist); - zy = (z1 + d * (z2 - z1)) - zc; - */ - - /* - zc = (-plane.dist) / ((-plane.dist) - (plane.normal[2] - plane.dist)); - zx = ((plane.normal[0] - plane.dist) / ((plane.normal[0] - plane.dist) - (plane.normal[0] + plane.normal[2] - plane.dist))) - zc; - zy = ((plane.normal[1] - plane.dist) / ((plane.normal[1] - plane.dist) - (plane.normal[1] + plane.normal[2] - plane.dist))) - zc; - */ - -// zc = (plane.dist / plane.normal[2]); -// zx = -(plane.normal[0] / plane.normal[2]); -// zy = -(plane.normal[1] / plane.normal[2]); -// zy = ((plane.normal[1] - plane.dist) / (-plane.normal[2])) + ((plane.dist) / (-plane.normal[2])); -#else // REMOVELATER - for (i = 0;i < numverts;i++) - { - vx = tempverts2[i][0] - r_origin[0]; - vy = tempverts2[i][1] - r_origin[1]; - vz = tempverts2[i][2] - r_origin[2]; - screenverts[i][0] = r_clip_viewmatrix[0][0] * vx + r_clip_viewmatrix[0][1] * vy + r_clip_viewmatrix[0][2] * vz; - screenverts[i][1] = r_clip_viewmatrix[1][0] * vx + r_clip_viewmatrix[1][1] * vy + r_clip_viewmatrix[1][2] * vz; - screenverts[i][2] = r_clip_viewmatrix[2][0] * vx + r_clip_viewmatrix[2][1] * vy + r_clip_viewmatrix[2][2] * vz; - } - - // REMOVELATER // calculate the plane for the polygon - for (i = 0;i < numverts;i++) - for (j = i + 1;j < numverts;j++) - for (k = j + 1;k < numverts;k++) - if (R_Clip_TriangleToDoublePlane(screenverts[i], screenverts[j], screenverts[k], &plane)) - goto valid2; - return; // gave up -valid2:; - - distinv = 1.0f / plane.dist; - pavailsurf->d_zistepx = plane.normal[0] * xscaleinv * distinv; - pavailsurf->d_zistepy = -plane.normal[1] * yscaleinv * distinv; - pavailsurf->d_ziorigin = plane.normal[2] * distinv - r_clip_viewcenterx * pavailsurf->wstepx - r_clip_viewcentery * pavailsurf->wstepy; - - for (i = 0;i < numverts;i++) + if (!R_Clip_TriangleToPlane(screenverts[0], screenverts[1], screenverts[2], &localplane)) { - screenverts[i][2] = 1.0f / (screenverts[i][2]); - screenverts[i][0] = screenverts[i][0] * r_clip_viewmulx * screenverts[i][2] + r_clip_viewcenterx; - screenverts[i][1] = screenverts[i][1] * r_clip_viewmuly * screenverts[i][2] + r_clip_viewcentery; - // REMOVELATER -// if (screenverts[i][0] < -0.5) -// screenverts[i][0] = -0.5; -// if (screenverts[i][0] > (clipwidth - 0.5)) -// screenverts[i][0] = clipwidth - 0.5; -// if (screenverts[i][1] < -0.5) -// screenverts[i][1] = -0.5; -// if (screenverts[i][1] > (clipheight - 0.5)) -// screenverts[i][1] = clipheight - 0.5; -// if (screenverts[i][2] <= 0.0) -// Con_Printf("R_Clip_AddPolygon: vertex z <= 0!\n"); + for (i = 0;i < numverts;i++) + for (j = i + 1;j < numverts;j++) + for (k = j + 1;k < numverts;k++) + if (R_Clip_TriangleToPlane(screenverts[i], screenverts[j], screenverts[k], &localplane)) + goto valid; + return; // gave up +valid:; } -#endif + + // Set up the 1/z gradients from the polygon, calculating the + // base value at screen coordinate 0,0 so we can use screen + // coordinates directly when calculating 1/z from the gradients + distinv = 1.0f / localplane.normal[2]; + pavailsurf->wstepx = -(localplane.normal[0] * distinv); + pavailsurf->wstepy = -(localplane.normal[1] * distinv); + pavailsurf->w00 = localplane.dist * distinv; addededges = false; @@ -586,9 +432,7 @@ valid2:; pavailsurf++; } -///////////////////////////////////////////////////////////////////// // Scan all the edges in the global edge table into spans. -///////////////////////////////////////////////////////////////////// void ScanEdges (void) { int y, rescan; @@ -707,14 +551,10 @@ void ScanEdges (void) fx = pedge->x; // Calculate the surface's 1/z value at this pixel, and cache the y depth for quick compares later w = (psurf->wcurrent = psurf->w00 + psurf->wstepy * fy) + psurf->wstepx * fx; -// if (w < 0) -// w = 0; // See if that makes it a new top surface psurf2 = surfstack.next; w2 = psurf2->wcurrent + psurf2->wstepx * fx; -// if (w2 < 0 && psurf2 != &surfstack) -// w2 = 0; if (w >= w2) { @@ -747,8 +587,6 @@ void ScanEdges (void) { psurf2 = psurf2->next; w2 = psurf2->wcurrent + psurf2->wstepx * fx; -// if (w2 < 0 && psurf2 != &surfstack) -// w2 = 0; } while (w < w2); @@ -871,50 +709,6 @@ void ScanEdges (void) void R_Clip_DisplayBuffer(void) { - /* -#if CLIPTEST - int i; - static int firstupload = true; - qbyte clipbuffertex[256*256], *b; - if (!r_render.integer) - return; - if (clipwidth > 256 || clipheight > 256) - return; - qglBlendFunc(GL_ONE, GL_ONE); - qglBindTexture(GL_TEXTURE_2D, 8000); - if (firstupload) - { - memset(clipbuffertex, 0, sizeof(clipbuffertex)); - qglTexImage2D(GL_TEXTURE_2D, 0, 1, 256, 256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, clipbuffertex); - } - qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if (lighthalf) - qglColor4ub(128, 128, 128, 255); - else - qglColor4ub(255, 255, 255, 255); - firstupload = false; - b = clipbuffertex; - for (i = 0;i < clipwidth*clipheight;i++) - { - if (clipbuffer[i].w > 0) - *b++ = bound(0, (int) (clipbuffer[i].w * 4096.0f), 255); - else - *b++ = 0; - } - qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, clipwidth, clipheight, GL_LUMINANCE, GL_UNSIGNED_BYTE, clipbuffertex); - qglBegin (GL_QUADS); - qglTexCoord2f (0 , 0 );qglVertex2f (0 , 0 ); - qglTexCoord2f (clipwidth / 256.0f, 0 );qglVertex2f (vid.conwidth, 0 ); - qglTexCoord2f (clipwidth / 256.0f, clipheight / 256.0f);qglVertex2f (vid.conwidth, vid.conheight); - qglTexCoord2f (0 , clipheight / 256.0f);qglVertex2f (0 , vid.conheight); - qglEnd (); - qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -// qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -// qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -#endif - */ } float boxpoints[4*3]; @@ -1023,3 +817,4 @@ void R_Clip_AddBox(float *a, float *b, void (*callback)(void *nativedata, void * callback, nativedata, nativedata2, &clipboxplane[5] ); } + diff --git a/r_crosshairs.c b/r_crosshairs.c index 83a45ecb..d1aaca3d 100644 --- a/r_crosshairs.c +++ b/r_crosshairs.c @@ -1,3 +1,4 @@ + #include "quakedef.h" cvar_t crosshair_brightness = {CVAR_SAVE, "crosshair_brightness", "1"}; diff --git a/r_explosion.c b/r_explosion.c index a3991d2c..d037ff17 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -26,29 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EXPLOSIONVERTS ((EXPLOSIONGRID+1)*(EXPLOSIONGRID+1)) #define EXPLOSIONTRIS (EXPLOSIONGRID*EXPLOSIONGRID*2) #define EXPLOSIONSTARTVELOCITY (256.0f) -//#define EXPLOSIONSTARTVELOCITY (384.0f) -//#define EXPLOSIONRANDOMVELOCITY (32.0f) #define EXPLOSIONFADESTART (1.5f) -//#define EXPLOSIONFADERATE (4.5f) #define EXPLOSIONFADERATE (3.0f) -/* -#define MAX_EXPLOSIONGAS (MAX_EXPLOSIONS * EXPLOSIONGAS) -#define EXPLOSIONGAS 8 -#define EXPLOSIONGASSTARTRADIUS (15.0f) -#define EXPLOSIONGASSTARTVELOCITY (50.0f) -#define GASDENSITY_SCALER (32768.0f / EXPLOSIONGAS) -#define GASFADERATE (GASDENSITY_SCALER * EXPLOSIONGAS * 2) - -typedef struct explosiongas_s -{ - float pressure; - vec3_t origin; - vec3_t velocity; -} -explosiongas_t; - -explosiongas_t explosiongas[MAX_EXPLOSIONGAS]; -*/ float explosiontexcoords[EXPLOSIONVERTS][2]; int explosiontris[EXPLOSIONTRIS][3]; @@ -117,7 +96,6 @@ void r_explosion_shutdown(void) void r_explosion_newmap(void) { memset(explosion, 0, sizeof(explosion)); -// memset(explosiongas, 0, sizeof(explosiongas)); } int R_ExplosionVert(int column, int row) @@ -189,53 +167,27 @@ void R_NewExplosion(vec3_t org) // calculate velocity dist = noise[explosionnoiseindex[j]] * (1.0f / 255.0f) + 0.5; VectorScale(explosionspherevertvel[j], dist, explosion[i].vertvel[j]); - //explosion[i].vertvel[j][0] = explosionspherevertvel[j][0] * dist; + (((float) noise[0][explosionnoiseindex[j]] - 128.0f) * (EXPLOSIONRANDOMVELOCITY / 128.0f)); - //explosion[i].vertvel[j][1] = explosionspherevertvel[j][1] * dist; + (((float) noise[1][explosionnoiseindex[j]] - 128.0f) * (EXPLOSIONRANDOMVELOCITY / 128.0f)); - //explosion[i].vertvel[j][2] = explosionspherevertvel[j][2] * dist; + (((float) noise[2][explosionnoiseindex[j]] - 128.0f) * (EXPLOSIONRANDOMVELOCITY / 128.0f)); } break; } } - - /* - i = 0; - j = EXPLOSIONGAS; - while (i < MAX_EXPLOSIONGAS && j > 0) - { - while (explosiongas[i].pressure > 0) - { - i++; - if (i >= MAX_EXPLOSIONGAS) - return; - } - VectorRandom(v); - VectorMA(org, EXPLOSIONGASSTARTRADIUS, v, v); - TraceLine(org, v, explosiongas[i].origin, NULL, 0, true); - VectorRandom(v); - VectorScale(v, EXPLOSIONGASSTARTVELOCITY, explosiongas[i].velocity); - explosiongas[i].pressure = j * GASDENSITY_SCALER; - j--; - } - */ } void R_DrawExplosion(explosion_t *e) { int i; - float c[EXPLOSIONVERTS][4], diff[3], centerdir[3], /*fog, */ifog, alpha, dist/*, centerdist, size, scale*/; + float c[EXPLOSIONVERTS][4], diff[3], centerdir[3], ifog, alpha, dist; rmeshinfo_t m; memset(&m, 0, sizeof(m)); m.transparent = true; m.blendfunc1 = GL_SRC_ALPHA; - m.blendfunc2 = GL_ONE; //_MINUS_SRC_ALPHA; + m.blendfunc2 = GL_ONE; m.numtriangles = EXPLOSIONTRIS; m.index = &explosiontris[0][0]; m.numverts = EXPLOSIONVERTS; m.vertex = &e->vert[0][0]; m.vertexstep = sizeof(float[3]); alpha = e->alpha; - //if (alpha > 1) - // alpha = 1; m.cr = 1; m.cg = 1; m.cb = 1; @@ -244,22 +196,10 @@ void R_DrawExplosion(explosion_t *e) m.colorstep = sizeof(float[4]); VectorSubtract(r_origin, e->origin, centerdir); VectorNormalizeFast(centerdir); - /* - centerdist = DotProduct(e->origin, centerdir); - size = 0; - for (i = 0;i < EXPLOSIONVERTS;i++) - { - dist = DotProduct(e->vert[i], centerdir) - centerdist; - if (size < dist) - size = dist; - } - scale = 4.0f / size; - */ if (fogenabled) { for (i = 0;i < EXPLOSIONVERTS;i++) { - //dist = (DotProduct(e->vert[i], centerdir) - centerdist) * scale - 2.0f; VectorSubtract(e->vert[i], e->origin, diff); VectorNormalizeFast(diff); dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha; @@ -282,7 +222,6 @@ void R_DrawExplosion(explosion_t *e) { for (i = 0;i < EXPLOSIONVERTS;i++) { - //dist = (DotProduct(e->vert[i], centerdir) - centerdist) * scale - 2.0f; VectorSubtract(e->vert[i], e->origin, diff); VectorNormalizeFast(diff); dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha; @@ -292,62 +231,18 @@ void R_DrawExplosion(explosion_t *e) c[i][3] = 1; } } - /* - if (fogenabled) - { - m.color = &c[0][0]; - m.colorstep = sizeof(float[4]); - for (i = 0;i < EXPLOSIONVERTS;i++) - { - // use inverse fog alpha as color - VectorSubtract(e->vert[i], r_origin, diff); - ifog = 1 - exp(fogdensity/DotProduct(diff,diff)); - if (ifog < 0) - ifog = 0; - c[i][0] = ifog; - c[i][1] = ifog; - c[i][2] = ifog; - c[i][3] = alpha; - } - } - */ m.tex[0] = R_GetTexture(explosiontexture); m.texcoords[0] = &explosiontexcoords[0][0]; m.texcoordstep[0] = sizeof(float[2]); R_Mesh_Draw(&m); - - /* - if (fogenabled) - { - m.blendfunc1 = GL_SRC_ALPHA; - m.blendfunc2 = GL_ONE; - for (i = 0;i < EXPLOSIONVERTS;i++) - { - VectorSubtract(e->vert[i], r_origin, diff); - fog = exp(fogdensity/DotProduct(diff,diff)); - c[i][0] = fogcolor[0]; - c[i][1] = fogcolor[1]; - c[i][2] = fogcolor[2]; - c[i][3] = alpha * fog; - } - //m.color = &c[0][0]; - //m.colorstep = sizeof(float[4]); - m.tex[0] = R_GetTexture(explosiontexturefog); - R_Mesh_Draw(&m); - } - */ } -void R_MoveExplosion(explosion_t *e/*, explosiongas_t **list, explosiongas_t **listend, */) +void R_MoveExplosion(explosion_t *e) { int i; float dot, frictionscale, end[3], impact[3], normal[3], frametime; - /* - vec3_t diff; - vec_t dist; - explosiongas_t **l; - */ + frametime = cl.time - e->time; e->time = cl.time; e->alpha = EXPLOSIONFADESTART - (cl.time - e->starttime) * EXPLOSIONFADERATE; @@ -362,7 +257,6 @@ void R_MoveExplosion(explosion_t *e/*, explosiongas_t **list, explosiongas_t **l { if (e->vertvel[i][0] || e->vertvel[i][1] || e->vertvel[i][2]) { - //e->vertvel[i][2] += sv_gravity.value * frametime * -0.25f; VectorScale(e->vertvel[i], frictionscale, e->vertvel[i]); VectorMA(e->vert[i], frametime, e->vertvel[i], end); if (r_explosionclip.integer) @@ -378,108 +272,33 @@ void R_MoveExplosion(explosion_t *e/*, explosiongas_t **list, explosiongas_t **l else VectorCopy(end, e->vert[i]); } - /* - for (l = list;l < listend;l++) - { - VectorSubtract(e->vert[i], (*l)->origin, diff); - dist = DotProduct(diff, diff); - if (dist < 4096 && dist >= 1) - { - dist = (*l)->pressure * frametime / dist; - VectorMA(e->vertvel[i], dist, diff, e->vertvel[i]); - } - } - */ } for (i = 0;i < EXPLOSIONGRID;i++) VectorCopy(e->vert[i * (EXPLOSIONGRID + 1)], e->vert[i * (EXPLOSIONGRID + 1) + EXPLOSIONGRID]); memcpy(e->vert[EXPLOSIONGRID * (EXPLOSIONGRID + 1)], e->vert[0], sizeof(float[3]) * (EXPLOSIONGRID + 1)); } -/* -void R_MoveExplosionGas(explosiongas_t *e, explosiongas_t **list, explosiongas_t **listend, float frametime) -{ - vec3_t end, diff; - vec_t dist, frictionscale; - explosiongas_t **l; - frictionscale = 1 - frametime; - frictionscale = bound(0, frictionscale, 1); - if (e->velocity[0] || e->velocity[1] || e->velocity[2]) - { - end[0] = e->origin[0] + frametime * e->velocity[0]; - end[1] = e->origin[1] + frametime * e->velocity[1]; - end[2] = e->origin[2] + frametime * e->velocity[2]; - if (r_explosionclip.integer) - { - float f, dot; - vec3_t impact, normal; - f = TraceLine(e->origin, end, impact, normal, 0, true); - VectorCopy(impact, e->origin); - if (f < 1) - { - // clip velocity against the wall - dot = DotProduct(e->velocity, normal) * -1.3f; - e->velocity[0] += normal[0] * dot; - e->velocity[1] += normal[1] * dot; - e->velocity[2] += normal[2] * dot; - } - } - else - { - VectorCopy(end, e->origin); - } - e->velocity[2] += sv_gravity.value * frametime; - VectorScale(e->velocity, frictionscale, e->velocity); - } - for (l = list;l < listend;l++) - { - if (*l != e) - { - VectorSubtract(e->origin, (*l)->origin, diff); - dist = DotProduct(diff, diff); - if (dist < 4096 && dist >= 1) - { - dist = (*l)->pressure * frametime / dist; - VectorMA(e->velocity, dist, diff, e->velocity); - } - } - } -} -*/ void R_MoveExplosions(void) { int i; float frametime; -// explosiongas_t *gaslist[MAX_EXPLOSIONGAS], **l, **end; + frametime = cl.time - cl.oldtime; - /* - l = &gaslist[0]; - for (i = 0;i < MAX_EXPLOSIONGAS;i++) - { - if (explosiongas[i].pressure > 0) - { - explosiongas[i].pressure -= frametime * GASFADERATE; - if (explosiongas[i].pressure > 0) - *l++ = &explosiongas[i]; - } - } - end = l; - for (l = gaslist;l < end;l++) - R_MoveExplosionGas(*l, gaslist, end, frametime); - */ for (i = 0;i < MAX_EXPLOSIONS;i++) if (explosion[i].alpha > 0.01f) - R_MoveExplosion(&explosion[i]/*, gaslist, end, */); + R_MoveExplosion(&explosion[i]); } void R_DrawExplosions(void) { int i; + if (!r_drawexplosions.integer) return; for (i = 0;i < MAX_EXPLOSIONS;i++) if (explosion[i].alpha > 0.01f) R_DrawExplosion(&explosion[i]); } + diff --git a/r_lerpanim.c b/r_lerpanim.c index 83c2b432..fe8f2495 100644 --- a/r_lerpanim.c +++ b/r_lerpanim.c @@ -155,6 +155,5 @@ void R_LerpAnimation(entity_render_t *r) FRAMEBLENDINSERT } } - //Con_Printf("Lerp: %i:%f %i:%f %i:%f %i:%f\n", blend[0].frame, blend[0].lerp, blend[1].frame, blend[1].lerp, blend[2].frame, blend[2].lerp, blend[3].frame, blend[3].lerp); } diff --git a/r_light.c b/r_light.c index c8984b7a..7dd90764 100644 --- a/r_light.c +++ b/r_light.c @@ -27,7 +27,6 @@ int r_numdlights = 0; cvar_t r_lightmodels = {CVAR_SAVE, "r_lightmodels", "1"}; cvar_t r_vismarklights = {0, "r_vismarklights", "1"}; -//cvar_t r_lightmodelhardness = {CVAR_SAVE, "r_lightmodelhardness", "1"}; static rtexture_t *lightcorona; static rtexturepool_t *lighttexturepool; @@ -68,7 +67,6 @@ void r_light_newmap(void) void R_Light_Init(void) { Cvar_RegisterVariable(&r_lightmodels); - //Cvar_RegisterVariable(&r_lightmodelhardness); Cvar_RegisterVariable(&r_vismarklights); R_RegisterModule("R_Light", r_light_start, r_light_shutdown, r_light_newmap); } @@ -174,7 +172,6 @@ void R_DrawCoronas(void) if (CL_TraceLine(r_origin, diff, NULL, NULL, 0, true) == 1) { scale = 1.0f / 262144.0f; - //scale = 64.0f / (DotProduct(diff,diff) + 1024.0f); m.cr = rd->light[0] * scale; m.cg = rd->light[1] * scale; m.cb = rd->light[2] * scale; @@ -295,65 +292,12 @@ loc0: if (dist2 > maxdist) continue; - - /* - d = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0]; - - if (d < 0) - { - dist2 += d * d; - if (dist2 >= maxdist) - continue; - } - else - { - d -= surf->extents[0] + 16; - if (d > 0) - { - dist2 += d * d; - if (dist2 >= maxdist) - continue; - } - } - - d = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1]; - - if (d < 0) - { - dist2 += d * d; - if (dist2 >= maxdist) - continue; - } - else - { - d -= surf->extents[1] + 16; - if (d > 0) - { - dist2 += d * d; - if (dist2 >= maxdist) - continue; - } - } - */ - if (surf->dlightframe != r_framecount) // not dynamic until now { surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = surf->dlightbits[4] = surf->dlightbits[5] = surf->dlightbits[6] = surf->dlightbits[7] = 0; surf->dlightframe = r_framecount; } surf->dlightbits[bitindex] |= bit; - - /* - if (((surf->flags & SURF_PLANEBACK) == 0) == ((PlaneDist(lightorigin, surf->plane)) >= surf->plane->dist)) - { - if (surf->dlightframe != r_framecount) // not dynamic until now - { - surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = surf->dlightbits[4] = surf->dlightbits[5] = surf->dlightbits[6] = surf->dlightbits[7] = 0; - surf->dlightframe = r_framecount; - } - surf->dlightbits[bitindex] |= bit; - } - */ } if (node->children[0]->contents >= 0) @@ -377,15 +321,6 @@ loc0: } } -/* -static void R_NoVisMarkLights (rdlight_t *rd, int bit, int bitindex) -{ - vec3_t lightorigin; - softwareuntransform(rd->origin, lightorigin); - - R_OldMarkLights(lightorigin, rd, bit, bitindex, currentrenderentity->model->nodes + currentrenderentity->model->hulls[0].firstclipnode); -} -*/ static void R_VisMarkLights (rdlight_t *rd, int bit, int bitindex) { @@ -494,45 +429,6 @@ static void R_VisMarkLights (rdlight_t *rd, int bit, int bitindex) impact[1] = rd->origin[1] - surf->plane->normal[1] * dist; impact[2] = rd->origin[2] - surf->plane->normal[2] * dist; -#if 0 - d = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0]; - if (d < 0) - { - dist2 += d * d; - if (dist2 > maxdist) - continue; - } - else - { - d -= surf->extents[0]; - if (d < 0) - { - dist2 += d * d; - if (dist2 > maxdist) - continue; - } - } - - d = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1]; - if (d < 0) - { - dist2 += d * d; - if (dist2 > maxdist) - continue; - } - else - { - d -= surf->extents[1]; - if (d < 0) - { - dist2 += d * d; - if (dist2 > maxdist) - continue; - } - } - -#else - impacts = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0]; d = bound(0, impacts, surf->extents[0] + 16) - impacts; dist2 += d * d; @@ -545,8 +441,6 @@ static void R_VisMarkLights (rdlight_t *rd, int bit, int bitindex) if (dist2 > maxdist) continue; -#endif - if (surf->dlightframe != r_framecount) // not dynamic until now { surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = surf->dlightbits[4] = surf->dlightbits[5] = surf->dlightbits[6] = surf->dlightbits[7] = 0; @@ -608,11 +502,6 @@ loc0: goto loc0; } // found an intersection -// mid = startz + (endz - startz) * (startz - node->plane->dist) / (startz - endz); -// mid = startz + distz * (startz - node->plane->dist) / (-distz); -// mid = startz + (-(startz - node->plane->dist)); -// mid = startz - (startz - node->plane->dist); -// mid = startz + node->plane->dist - startz; mid = node->plane->dist; break; default: @@ -626,8 +515,6 @@ loc0: goto loc0; } // found an intersection -// mid = startz + (endz - startz) * ((front - node->plane->dist) / ((front - node->plane->dist) - (back - node->plane->dist))); -// mid = startz + (endz - startz) * ((front - node->plane->dist) / (front - back)); mid = startz + distz * (front - node->plane->dist) / (front - back); break; } @@ -680,33 +567,38 @@ loc0: lightmap += size3; } - /* - // LordHavoc: here's the readable version of the interpolation - // code, not quite as easy for the compiler to optimize... - - // dsfrac is the X position in the lightmap pixel, * 16 - // dtfrac is the Y position in the lightmap pixel, * 16 - // r00 is top left corner, r01 is top right corner - // r10 is bottom left corner, r11 is bottom right corner - // g and b are the same layout. - // r0 and r1 are the top and bottom intermediate results - - // first we interpolate the top two points, to get the top - // edge sample - r0 = (((r01-r00) * dsfrac) >> 4) + r00; - g0 = (((g01-g00) * dsfrac) >> 4) + g00; - b0 = (((b01-b00) * dsfrac) >> 4) + b00; - // then we interpolate the bottom two points, to get the - // bottom edge sample - r1 = (((r11-r10) * dsfrac) >> 4) + r10; - g1 = (((g11-g10) * dsfrac) >> 4) + g10; - b1 = (((b11-b10) * dsfrac) >> 4) + b10; - // then we interpolate the top and bottom samples to get the - // middle sample (the one which was requested) - r = (((r1-r0) * dtfrac) >> 4) + r0; - g = (((g1-g0) * dtfrac) >> 4) + g0; - b = (((b1-b0) * dtfrac) >> 4) + b0; - */ +/* +LordHavoc: here's the readable version of the interpolation +code, not quite as easy for the compiler to optimize... + +dsfrac is the X position in the lightmap pixel, * 16 +dtfrac is the Y position in the lightmap pixel, * 16 +r00 is top left corner, r01 is top right corner +r10 is bottom left corner, r11 is bottom right corner +g and b are the same layout. +r0 and r1 are the top and bottom intermediate results + +first we interpolate the top two points, to get the top +edge sample + + r0 = (((r01-r00) * dsfrac) >> 4) + r00; + g0 = (((g01-g00) * dsfrac) >> 4) + g00; + b0 = (((b01-b00) * dsfrac) >> 4) + b00; + +then we interpolate the bottom two points, to get the +bottom edge sample + + r1 = (((r11-r10) * dsfrac) >> 4) + r10; + g1 = (((g11-g10) * dsfrac) >> 4) + g10; + b1 = (((b11-b10) * dsfrac) >> 4) + b10; + +then we interpolate the top and bottom samples to get the +middle sample (the one which was requested) + + r = (((r1-r0) * dtfrac) >> 4) + r0; + g = (((g1-g0) * dtfrac) >> 4) + g0; + b = (((b1-b0) * dtfrac) >> 4) + b0; +*/ color[0] += (float) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00)) * (1.0f / 32768.0f); color[1] += (float) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00)) * (1.0f / 32768.0f); @@ -721,7 +613,6 @@ loc0: startz = mid; distz = endz - startz; goto loc0; -// return RecursiveLightPoint (color, node->children[side ^ 1], x, y, mid, endz); } } @@ -833,7 +724,7 @@ void R_ModelLightPoint (vec3_t color, vec3_t p, int *dlightbits) void R_LightModel(int numverts, float colorr, float colorg, float colorb, int worldcoords) { int i, j, nearlights = 0; - float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, number, f/*, hardness, hardnessoffset*/, dist2; + float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, number, f, dist2; struct { vec3_t origin; @@ -845,7 +736,6 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo } nearlight[MAX_DLIGHTS], *nl; int modeldlightbits[8]; - //staticlight_t *sl; mlight_t *sl; a = currentrenderentity->alpha; if (currentrenderentity->effects & EF_FULLBRIGHT) @@ -861,29 +751,6 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo R_ModelLightPoint(basecolor, currentrenderentity->origin, modeldlightbits); nl = &nearlight[0]; - /* - // this code is unused for now - for (i = 0, sl = staticlight;i < staticlights && nearlights < MAX_DLIGHTS;i++, sl++) - { - if (TraceLine(currentrenderentity->origin, sl->origin, NULL, NULL, 0) == 1) - { - nl->fadetype = sl->fadetype; - nl->distancescale = sl->distancescale; - nl->radius = sl->radius; - // transform the light into the model's coordinate system - if (worldcoords) - VectorCopy(sl->origin, nl->origin); - else - softwareuntransform(sl->origin, nl->origin); - VectorCopy(sl->color, nl->light); - nl->cullradius2 = 99999999; - nl->lightsubtract = 0; - nl++; - nearlights++; - } - } - */ - // this code is unused for now for (i = 0, sl = cl.worldmodel->lights;i < cl.worldmodel->numlights && nearlights < MAX_DLIGHTS;i++, sl++) { if (CL_TraceLine(currentrenderentity->origin, sl->origin, NULL, NULL, 0, false) == 1) @@ -915,23 +782,19 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo } else { - // convert 0-255 radius coloring to 0-1, while also amplifying the brightness by 16 - //if (TraceLine(currentrenderentity->origin, r_dlight[i].origin, NULL, NULL, 0) == 1) - { - // transform the light into the model's coordinate system - if (worldcoords) - VectorCopy(r_dlight[i].origin, nl->origin); - else - softwareuntransform(r_dlight[i].origin, nl->origin); - nl->cullradius2 = r_dlight[i].cullradius2; - nl->light[0] = r_dlight[i].light[0] * colorr; - nl->light[1] = r_dlight[i].light[1] * colorg; - nl->light[2] = r_dlight[i].light[2] * colorb; - nl->lightsubtract = r_dlight[i].lightsubtract; - nl->offset = LIGHTOFFSET; - nl++; - nearlights++; - } + // transform the light into the model's coordinate system + if (worldcoords) + VectorCopy(r_dlight[i].origin, nl->origin); + else + softwareuntransform(r_dlight[i].origin, nl->origin); + nl->cullradius2 = r_dlight[i].cullradius2; + nl->light[0] = r_dlight[i].light[0] * colorr; + nl->light[1] = r_dlight[i].light[1] * colorg; + nl->light[2] = r_dlight[i].light[2] * colorb; + nl->lightsubtract = r_dlight[i].lightsubtract; + nl->offset = LIGHTOFFSET; + nl++; + nearlights++; } } } @@ -946,8 +809,6 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo { av = aliasvert; avn = aliasvertnorm; - //hardness = r_lightmodelhardness.value; - //hardnessoffset = (1.0f - hardness); for (i = 0;i < numverts;i++) { VectorCopy(basecolor, color); @@ -962,13 +823,13 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo if (f > 0) { // directional shading - #if SLOWMATH +#if SLOWMATH t = 1.0f / sqrt(dist2); - #else +#else number = DotProduct(v, v); *((int *)&t) = 0x5f3759df - ((* (int *) &number) >> 1); t = t * (1.5f - (number * 0.5f * t * t)); - #endif +#endif // DotProduct(avn,v) * t is dotproduct with a normalized v, // the hardness variables are for backlighting/shinyness f *= DotProduct(avn,v) * t;// * hardness + hardnessoffset; @@ -995,3 +856,4 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo } } } + diff --git a/r_modules.c b/r_modules.c index f9ce9508..a4e046eb 100644 --- a/r_modules.c +++ b/r_modules.c @@ -90,3 +90,4 @@ void R_Modules_NewMap(void) rendermodule[i].newmap(); } } + diff --git a/r_sky.c b/r_sky.c index 4d471133..deec3439 100644 --- a/r_sky.c +++ b/r_sky.c @@ -1,3 +1,4 @@ + #include "quakedef.h" void LoadSky_f(void); @@ -416,15 +417,6 @@ void R_InitSky (qbyte *src, int bytesperpixel) memcpy(skyupperlayerpixels, trans, 128*128*4); solidskytexture = R_LoadTexture (skytexturepool, "sky_solidtexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); - /* - for (i = 0;i < 128*128;i++) - { - ((qbyte *)&trans[i])[0] >>= 1; - ((qbyte *)&trans[i])[1] >>= 1; - ((qbyte *)&trans[i])[2] >>= 1; - } - solidskytexture_half = R_LoadTexture (skytexturepool, "sky_solidtexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); - */ if (bytesperpixel == 4) { @@ -450,13 +442,5 @@ void R_InitSky (qbyte *src, int bytesperpixel) memcpy(skylowerlayerpixels, trans, 128*128*4); alphaskytexture = R_LoadTexture (skytexturepool, "sky_alphatexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); - /* - for (i = 0;i < 128*128;i++) - { - ((qbyte *)&trans[i])[0] >>= 1; - ((qbyte *)&trans[i])[1] >>= 1; - ((qbyte *)&trans[i])[2] >>= 1; - } - alphaskytexture_half = R_LoadTexture (skytexturepool, "sky_alphatexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); - */ } + diff --git a/r_sprites.c b/r_sprites.c index 741a913d..37d870c2 100644 --- a/r_sprites.c +++ b/r_sprites.c @@ -1,6 +1,6 @@ + #include "quakedef.h" -// LordHavoc: disabled lerping #define LERPSPRITES #ifdef LERPSPRITES @@ -70,8 +70,6 @@ int R_SpriteSetup (int type, float org[3], float left[3], float up[3]) VectorNegate(vpn, matrix3[0]); matrix3[0][2] = 0; VectorNormalizeFast(matrix3[0]); - //VectorVectors(matrix3[0], matrix3[1], matrix3[2]); - //VectorNegate(matrix3[1], matrix3[1]); matrix3[1][0] = matrix3[0][1]; matrix3[1][1] = -matrix3[0][0]; matrix3[1][2] = 0; @@ -85,7 +83,6 @@ int R_SpriteSetup (int type, float org[3], float left[3], float up[3]) VectorSubtract(currentrenderentity->origin, r_origin, matrix3[0]); matrix3[0][2] = 0; VectorNormalizeFast(matrix3[0]); - //VectorVectors(matrix3[0], matrix3[1], matrix3[2]); matrix3[1][0] = matrix3[0][1]; matrix3[1][1] = -matrix3[0][0]; matrix3[1][2] = 0; @@ -122,10 +119,6 @@ int R_SpriteSetup (int type, float org[3], float left[3], float up[3]) break; } - // don't draw if view origin is behind it - //if (DotProduct(org, matrix3[0]) < (DotProduct(r_origin, matrix3[0]) - 1.0f)) - // return true; - if (currentrenderentity->scale != 1) { VectorScale(matrix3[1], currentrenderentity->scale, left); @@ -265,3 +258,4 @@ void R_DrawSpriteModel () GL_DrawSpriteImage(true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * currentrenderentity->alpha); #endif } + diff --git a/sbar.c b/sbar.c index 9e1deae4..2c988ed2 100644 --- a/sbar.c +++ b/sbar.c @@ -406,7 +406,6 @@ void Sbar_UpdateScoreboard (void) } - /* =============== Sbar_SoloScoreboard @@ -1061,3 +1060,4 @@ void Sbar_FinaleOverlay (void) pic = Draw_CachePic ("gfx/finale.lmp"); DrawQ_Pic((vid.conwidth - pic->width)/2, 16, "gfx/finale.lmp", 0, 0, 1, 1, 1, 1, 0); } + diff --git a/screen.h b/screen.h index 86b9e10b..33283a43 100644 --- a/screen.h +++ b/screen.h @@ -27,7 +27,6 @@ void CL_UpdateScreen (void); void SCR_CenterPrint (char *str); void SCR_BeginLoadingPlaque (void); -void SCR_EndLoadingPlaque (void); extern float scr_con_current; extern float scr_conlines; // lines of console to display diff --git a/snd_alsa_0_5.c b/snd_alsa_0_5.c index ba04b5b1..9f9c8506 100644 --- a/snd_alsa_0_5.c +++ b/snd_alsa_0_5.c @@ -214,9 +214,6 @@ qboolean SNDDMA_Init(void) frag_size/=2; } -// err_msg="audio flush"; -// if ((rc=snd_pcm_channel_flush(pcm_handle, SND_PCM_CHANNEL_PLAYBACK))<0) -// goto error; err_msg="audio munmap"; if ((rc=snd_pcm_munmap(pcm_handle, SND_PCM_CHANNEL_PLAYBACK))<0) goto error; @@ -233,9 +230,6 @@ qboolean SNDDMA_Init(void) params.buf.block.frag_size=frag_size; params.buf.block.frags_min=1; params.buf.block.frags_max=-1; -// err_msg="audio flush"; -// if ((rc=snd_pcm_channel_flush(pcm_handle, SND_PCM_CHANNEL_PLAYBACK))<0) -// goto error; err_msg="audio params"; if ((rc=snd_pcm_channel_params(pcm_handle, ¶ms))<0) goto error; diff --git a/snd_dma.c b/snd_dma.c index 3817ea4c..85e7f132 100644 --- a/snd_dma.c +++ b/snd_dma.c @@ -71,7 +71,6 @@ cvar_t volume = {CVAR_SAVE, "volume", "0.7"}; cvar_t nosound = {0, "nosound", "0"}; cvar_t precache = {0, "precache", "1"}; -//cvar_t loadas8bit = {0, "loadas8bit", "0"}; cvar_t bgmbuffer = {0, "bgmbuffer", "4096"}; cvar_t ambient_level = {0, "ambient_level", "0.3"}; cvar_t ambient_fade = {0, "ambient_fade", "100"}; @@ -189,7 +188,6 @@ void S_Init (void) Cvar_RegisterVariable(&nosound); Cvar_RegisterVariable(&precache); -// Cvar_RegisterVariable(&loadas8bit); Cvar_RegisterVariable(&bgmbuffer); Cvar_RegisterVariable(&ambient_level); Cvar_RegisterVariable(&ambient_fade); @@ -198,16 +196,6 @@ void S_Init (void) Cvar_RegisterVariable(&_snd_mixahead); Cvar_RegisterVariable(&snd_swapstereo); // LordHavoc: for people with backwards sound wiring - /* - if (host_parms.memsize < 0x800000) - { - Cvar_Set ("loadas8bit", "1"); - Con_Printf ("loading all sounds as 8bit\n"); - } - */ - - - snd_initialized = true; known_sfx = Mem_Alloc(snd_mempool, MAX_SFX*sizeof(sfx_t)); @@ -241,9 +229,6 @@ void S_Init (void) // provides a tick sound until washed clean -// if (shm->buffer) -// shm->buffer[4] = shm->buffer[5] = 0x7f; // force a pop for debugging - ambient_sfx[AMBIENT_WATER] = S_PrecacheSound ("ambience/water1.wav"); ambient_sfx[AMBIENT_SKY] = S_PrecacheSound ("ambience/wind2.wav"); @@ -798,8 +783,6 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) continue; } } - - } // @@ -811,10 +794,7 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) ch = channels; for (i=0 ; isfx && (ch->leftvol || ch->rightvol) ) - { - //Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name); total++; - } Con_Printf ("----(%i)----\n", total); } @@ -884,10 +864,7 @@ void S_Update_(void) // check to make sure that we haven't overshot if (paintedtime < soundtime) - { - //Con_Printf ("S_Update_ : overflow\n"); paintedtime = soundtime; - } // mix ahead of current position endtime = soundtime + _snd_mixahead.value * shm->speed; diff --git a/snd_mem.c b/snd_mem.c index a54e84c7..4e2a94ec 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -201,9 +201,7 @@ void ResampleSfx (sfxcache_t *sc, qbyte *data, char *name) } // LordHavoc: use this for testing if it ever becomes useful again -#if 0 - COM_WriteFile (va("sound/%s.pcm", name), sc->data, (sc->length << sc->stereo) * sc->width); -#endif +// COM_WriteFile (va("sound/%s.pcm", name), sc->data, (sc->length << sc->stereo) * sc->width); } //============================================================================= @@ -225,13 +223,10 @@ sfxcache_t *S_LoadSound (sfx_t *s) if (s->sfxcache) return s->sfxcache; -//Con_Printf ("S_LoadSound: %x\n", (int)stackbuf); // load it in strcpy(namebuffer, "sound/"); strcat(namebuffer, s->name); -// Con_Printf ("loading %s\n",namebuffer); - data = COM_LoadFile(namebuffer, false); if (!data) @@ -248,13 +243,6 @@ sfxcache_t *S_LoadSound (sfx_t *s) Mem_Free(data); return NULL; } - /* - if (info.channels != 1) - { - Con_Printf ("%s is a stereo sample\n",s->name); - return NULL; - } - */ // calculate resampled length len = (int) ((double) info.samples * (double) shm->speed / (double) info.rate); @@ -340,8 +328,6 @@ void FindNextChunk(char *name) data_p = NULL; return; } -// if (iff_chunk_len > 1024*1024) -// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); data_p -= 8; last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 ); if (!strncmp(data_p, name, 4)) @@ -429,7 +415,6 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) { data_p += 32; info.loopstart = GetLittleLong(); -// Con_Printf("loopstart=%d\n", sfx->loopstart); // if the next chunk is a LIST chunk, look for a cue length marker FindNextChunk ("LIST"); @@ -440,7 +425,6 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) data_p += 24; i = GetLittleLong (); // samples in loop info.samples = info.loopstart + i; -// Con_Printf("looped length: %i\n", i); } } } diff --git a/snd_mix.c b/snd_mix.c index 3b823166..a31b4ce5 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -311,9 +311,6 @@ void S_TransferPaintBuffer(int endtime) pDSBuf->lpVtbl->Unlock(pDSBuf, pbuf, dwSize, NULL, 0); pDSBuf->lpVtbl->GetCurrentPosition(pDSBuf, &dwNewpos, &dwWrite); - -// if ((dwNewpos >= il) && (dwNewpos <= ir)) -// Con_Printf("%d-%d p %d c\n", il, ir, dwNewpos); } #endif } @@ -418,7 +415,6 @@ void SND_InitScaletable (void) void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) { -// int data; int *lscale, *rscale; unsigned char *sfx; int i; @@ -458,8 +454,6 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count) { -// int data; -// int left, right; int leftvol, rightvol; signed short *sfx; int i; diff --git a/snd_oss.c b/snd_oss.c index a0afe75d..fb28f2e2 100644 --- a/snd_oss.c +++ b/snd_oss.c @@ -239,8 +239,6 @@ int SNDDMA_GetDMAPos(void) snd_inited = 0; return 0; } -// shm->samplepos = (count.bytes / (shm->samplebits / 8)) & (shm->samples-1); -// Qprintf(stderr, "%d \r", count.ptr); shm->samplepos = count.ptr / (shm->samplebits / 8); return shm->samplepos; diff --git a/snd_win.c b/snd_win.c index 2a6c088a..bd746151 100644 --- a/snd_win.c +++ b/snd_win.c @@ -389,7 +389,6 @@ sndinitstat SNDDMA_InitDirect (void) } memset(lpData, 0, dwSize); -// lpData[4] = lpData[5] = 0x7f; // force a pop for debugging pDSBuf->lpVtbl->Unlock(pDSBuf, lpData, dwSize, NULL, 0); @@ -619,12 +618,7 @@ qboolean SNDDMA_Init(void) snd_firsttime = false; if (!dsound_init && !wav_init) - { -// if (snd_firsttime) -// Con_SafePrintf ("No sound device initialized\n"); - return 0; - } return 1; } diff --git a/sv_light.c b/sv_light.c index c54dd552..41b4475f 100644 --- a/sv_light.c +++ b/sv_light.c @@ -17,7 +17,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// r_light.c #include "quakedef.h" @@ -47,11 +46,6 @@ loc0: goto loc0; } // found an intersection -// mid = startz + (endz - startz) * (startz - node->plane->dist) / (startz - endz); -// mid = startz + distz * (startz - node->plane->dist) / (-distz); -// mid = startz + (-(startz - node->plane->dist)); -// mid = startz - (startz - node->plane->dist); -// mid = startz + node->plane->dist - startz; mid = node->plane->dist; break; default: @@ -65,8 +59,6 @@ loc0: goto loc0; } // found an intersection -// mid = startz + (endz - startz) * ((front - node->plane->dist) / ((front - node->plane->dist) - (back - node->plane->dist))); -// mid = startz + (endz - startz) * ((front - node->plane->dist) / (front - back)); mid = startz + distz * (front - node->plane->dist) / (front - back); break; } @@ -132,7 +124,6 @@ loc0: startz = mid; distz = endz - startz; goto loc0; -// return RecursiveLightPoint (color, node->children[side ^ 1], x, y, mid, endz); } } @@ -149,3 +140,4 @@ void SV_LightPoint (vec3_t color, vec3_t p) color[0] = color[1] = color[2] = 0; SV_RecursiveLightPoint (color, sv.worldmodel->nodes, p[0], p[1], p[2], p[2] - 65536); } + diff --git a/sv_main.c b/sv_main.c index 00fb0581..fb24afd7 100644 --- a/sv_main.c +++ b/sv_main.c @@ -532,13 +532,6 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) // find the client's PVS VectorAdd (clent->v.origin, clent->v.view_ofs, testeye); pvs = SV_FatPVS (testeye); - /* - // dp protocol - MSG_WriteByte(msg, svc_playerposition); - MSG_WriteFloat(msg, testeye[0]); - MSG_WriteFloat(msg, testeye[1]); - MSG_WriteFloat(msg, testeye[2]); - */ culled_pvs = 0; culled_portal = 0; @@ -783,9 +776,6 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) bits |= U_STEP; // LordHavoc: old stuff, but rewritten to have more exact tolerances -// if ((int)(origin[0]*8.0) != (int)(baseline->origin[0]*8.0)) bits |= U_ORIGIN1; -// if ((int)(origin[1]*8.0) != (int)(baseline->origin[1]*8.0)) bits |= U_ORIGIN2; -// if ((int)(origin[2]*8.0) != (int)(baseline->origin[2]*8.0)) bits |= U_ORIGIN3; if (origin[0] != baseline->origin[0]) bits |= U_ORIGIN1; if (origin[1] != baseline->origin[1]) bits |= U_ORIGIN2; if (origin[2] != baseline->origin[2]) bits |= U_ORIGIN3; @@ -1177,8 +1167,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) bits = 0; - //if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT) - bits |= SU_VIEWHEIGHT; + bits |= SU_VIEWHEIGHT; if (ent->v.idealpitch) bits |= SU_IDEALPITCH; @@ -1235,8 +1224,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) if (ent->v.armorvalue) bits |= SU_ARMOR; -// if (ent->v.weapon) - bits |= SU_WEAPON; + bits |= SU_WEAPON; if (bits >= 65536) bits |= SU_EXTEND1; @@ -1467,10 +1455,7 @@ void SV_SendClientMessages (void) if (host_client->message.cursize || host_client->dropasap) { if (!NET_CanSendMessage (host_client->netconnection)) - { -// I_Printf ("can't write\n"); continue; - } if (host_client->dropasap) SV_DropClient (false); // went to another level @@ -1559,7 +1544,7 @@ void SV_CreateBaseline (void) else { svent->baseline.colormap = 0; - svent->baseline.modelindex = svent->v.modelindex; //SV_ModelIndex(pr_strings + svent->v.model); + svent->baseline.modelindex = svent->v.modelindex; } large = false; @@ -1806,3 +1791,4 @@ void SV_SpawnServer (char *server) Con_DPrintf ("Server spawned.\n"); } + diff --git a/sv_move.c b/sv_move.c index 4462519b..ffaa44a7 100644 --- a/sv_move.c +++ b/sv_move.c @@ -182,7 +182,6 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) if (relink) SV_LinkEdict (ent, true); ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; -// Con_Printf ("fall down\n"); return true; } @@ -206,10 +205,8 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) } if ( (int)ent->v.flags & FL_PARTIALGROUND ) - { -// Con_Printf ("back on ground\n"); ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND; - } + ent->v.groundentity = EDICT_TO_PROG(trace.ent); // the move is ok @@ -268,8 +265,6 @@ SV_FixCheckBottom */ void SV_FixCheckBottom (edict_t *ent) { -// Con_Printf ("SV_FixCheckBottom\n"); - ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND; } diff --git a/sv_phys.c b/sv_phys.c index c40f0072..5d8db602 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -107,13 +107,6 @@ void SV_CheckVelocity (edict_t *ent) Con_Printf ("Got a NaN origin on %s\n", pr_strings + ent->v.classname); ent->v.origin[i] = 0; } - // LordHavoc: maxvelocity fix, see below -/* - if (ent->v.velocity[i] > sv_maxvelocity.value) - ent->v.velocity[i] = sv_maxvelocity.value; - else if (ent->v.velocity[i] < -sv_maxvelocity.value) - ent->v.velocity[i] = -sv_maxvelocity.value; -*/ } // LordHavoc: max velocity fix, inspired by Maddes's source fixes, but this is faster @@ -311,11 +304,8 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) if (trace.plane.normal[2] > 0.7) { blocked |= 1; // floor - //if (trace.ent->v.solid == SOLID_BSP) - { - ent->v.flags = (int)ent->v.flags | FL_ONGROUND; - ent->v.groundentity = EDICT_TO_PROG(trace.ent); - } + ent->v.flags = (int)ent->v.flags | FL_ONGROUND; + ent->v.groundentity = EDICT_TO_PROG(trace.ent); } if (!trace.plane.normal[2]) { @@ -369,7 +359,6 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) { // go along the crease if (numplanes != 2) { -// Con_Printf ("clip velocity, numplanes == %i\n",numplanes); VectorClear(ent->v.velocity); return 7; } @@ -505,8 +494,7 @@ void SV_PushMove (edict_t *pusher, float movetime) Host_Error("SV_PushMove: invalid modelindex %f\n", pusher->v.modelindex); pushermodel = sv.models[index]; - // LordHavoc: round up by a small epsilon - movetime2 = movetime; // + (1.0 / 256.0); + movetime2 = movetime; VectorScale(pusher->v.velocity, movetime2, move1); VectorScale(pusher->v.avelocity, movetime2, moveangle); if (moveangle[0] || moveangle[2]) @@ -598,35 +586,9 @@ void SV_PushMove (edict_t *pusher, float movetime) || check->v.absmax[2] <= mins[2]) continue; - /* - if (forward[0] < 0.999f) // quick way to check if any rotation is used - { - VectorSubtract (check->v.origin, pusher->v.origin, org); - org2[0] = DotProduct (org, forward); - org2[1] = DotProduct (org, left); - org2[2] = DotProduct (org, up); - //VectorSubtract (org2, org, move); - //VectorAdd (move, move1, move); - //VectorSubtract(check->v.origin, move, a); - a[0] = check->v.origin[0] + (org[0] - org2[0]) - move1[0]; - a[1] = check->v.origin[1] + (org[1] - org2[1]) - move1[1]; - a[2] = check->v.origin[2] + (org[2] - org2[2]) - move1[2]; - } - else - VectorSubtract (check->v.origin, move1, a); - - trace = SV_ClipMoveToEntity (pusher, a, check->v.mins, check->v.maxs, check->v.origin); - if (trace.fraction == 1 && !trace.startsolid) - continue; - */ trace = SV_ClipMoveToEntity (pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin); if (!trace.startsolid) continue; - /* - // see if the ent's bbox is inside the pusher's final position - if (!SV_TestEntityPosition (check)) - continue; - */ } if (forward[0] < 0.999f) // quick way to check if any rotation is used @@ -641,16 +603,10 @@ void SV_PushMove (edict_t *pusher, float movetime) else VectorCopy (move1, move); - // LordHavoc: debugging - //VectorAdd(entorig, move, org2); - //CL_RocketTrail2 (entorig, org2, 238, NULL); - // remove the onground flag for non-players if (check->v.movetype != MOVETYPE_WALK) check->v.flags = (int)check->v.flags & ~FL_ONGROUND; - //VectorCopy (check->v.origin, entorig); - //VectorCopy (check->v.angles, entang); VectorCopy (check->v.origin, moved_from[num_moved]); VectorCopy (check->v.angles, moved_fromangles[num_moved]); moved_edict[num_moved++] = check; @@ -661,8 +617,7 @@ void SV_PushMove (edict_t *pusher, float movetime) pusher->v.solid = savesolid; // was SOLID_BSP // if it is still inside the pusher, block - // LordHavoc: cleanup - check trace.fraction and startsolid - if (/*trace.fraction != 1 || trace.startsolid || */SV_TestEntityPosition (check)) + if (SV_TestEntityPosition (check)) { // fail the move if (check->v.mins[0] == check->v.maxs[0]) @@ -675,19 +630,12 @@ void SV_PushMove (edict_t *pusher, float movetime) continue; } - /* - VectorCopy (entorig, check->v.origin); - VectorCopy (entang, check->v.angles); - SV_LinkEdict (check, true); - */ - VectorCopy (pushorig, pusher->v.origin); VectorCopy (pushang, pusher->v.angles); pusher->v.ltime = pushltime; SV_LinkEdict (pusher, false); // move back any entities we already moved - //num_moved--; // LordHavoc: pop off check, because it was already restored for (i=0 ; iv.origin); @@ -918,7 +866,6 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) if ( fabs(oldorg[1] - ent->v.origin[1]) > 4 || fabs(oldorg[0] - ent->v.origin[0]) > 4 ) { -//Con_DPrintf ("unstuck!\n"); return clip; } @@ -1109,22 +1056,6 @@ void SV_Physics_Client (edict_t *ent, int num) //============================================================================ -/* -============= -SV_Physics_None - -Non moving objects can only think -============= -*/ -// LordHavoc: inlined manually because it was a real time waster -/* -void SV_Physics_None (edict_t *ent) -{ -// regular thinking - SV_RunThink (ent); -} -*/ - /* ============= SV_Physics_Follow @@ -1162,14 +1093,8 @@ void SV_Physics_Follow (edict_t *ent) ent->v.origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + e->v.origin[0]; ent->v.origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + e->v.origin[1]; ent->v.origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[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); } @@ -1249,7 +1174,7 @@ void SV_Physics_Toss (edict_t *ent) trace_t trace; vec3_t move; edict_t *groundentity; - //edict_t *groundentity; + // regular thinking if (!SV_RunThink (ent)) return; @@ -1272,19 +1197,6 @@ void SV_Physics_Toss (edict_t *ent) } ent->suspendedinairflag = false; - /* - if ( ((int)ent->v.flags & FL_ONGROUND) ) - { - // LordHavoc: fall if the groundentity was removed - if (ent->v.groundentity) - { - groundentity = PROG_TO_EDICT(ent->v.groundentity); - if (groundentity && groundentity->v.solid != SOLID_NOT && groundentity->v.solid != SOLID_TRIGGER) - return; - } - } - */ - SV_CheckVelocity (ent); // add gravity @@ -1314,7 +1226,6 @@ void SV_Physics_Toss (edict_t *ent) ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity, 1.5); // LordHavoc: fixed grenades not bouncing when fired down a slope if (trace.plane.normal[2] > 0.7 && DotProduct(trace.plane.normal, ent->v.velocity) < 60) - //if (trace.plane.normal[2] > 0.7 && ent->v.velocity[2] < 60) { ent->v.flags = (int)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(trace.ent); @@ -1428,8 +1339,6 @@ void SV_Physics (void) pr_global_struct->time = sv.time; PR_ExecuteProgram (pr_global_struct->StartFrame, "QC function StartFrame is missing"); -//SV_CheckAllEnts (); - // // treat each object in turn // @@ -1454,7 +1363,6 @@ void SV_Physics (void) SV_Physics_Pusher (ent); break; case MOVETYPE_NONE: -// SV_Physics_None (ent); // LordHavoc: manually inlined the thinktime check here because MOVETYPE_NONE is used on so many objects if (ent->v.nextthink > 0 && ent->v.nextthink <= sv.time + sv.frametime) SV_RunThink (ent); @@ -1549,3 +1457,4 @@ trace_t SV_Trace_Toss (edict_t *tossent, edict_t *ignore) trace.fraction = 0; // not relevant return trace; } + diff --git a/sv_user.c b/sv_user.c index 2ed24ca1..30a654a7 100644 --- a/sv_user.c +++ b/sv_user.c @@ -166,27 +166,6 @@ void SV_UserFriction (void) SV_Accelerate ============== */ -#if 0 -void SV_Accelerate (vec3_t wishvel) -{ - int i; - float addspeed, accelspeed; - vec3_t pushvec; - - if (wishspeed == 0) - return; - - VectorSubtract (wishvel, velocity, pushvec); - addspeed = VectorNormalize (pushvec); - - accelspeed = sv_accelerate.value*sv.frametime*addspeed; - if (accelspeed > addspeed) - accelspeed = addspeed; - - for (i=0 ; i<3 ; i++) - velocity[i] += accelspeed*pushvec[i]; -} -#endif void SV_Accelerate (void) { int i; @@ -216,7 +195,6 @@ void SV_AirAccelerate (vec3_t wishveloc) addspeed = wishspd - currentspeed; if (addspeed <= 0) return; -// accelspeed = sv_accelerate.value * sv.frametime; accelspeed = sv_accelerate.value*wishspeed * sv.frametime; if (accelspeed > addspeed) accelspeed = addspeed; @@ -346,7 +324,6 @@ void SV_AirMove (void) wishvel[0] = wishvel[2] = 0; wishvel[1] = sv_player->v.angles[1]; AngleVectors (wishvel, forward, right, up); -// AngleVectors (sv_player->v.angles, forward, right, up); fmove = cmd.forwardmove; smove = cmd.sidemove; @@ -570,7 +547,6 @@ nextmsg: return false; case clc_nop: -// Sys_Printf ("clc_nop\n"); break; case clc_stringcmd: @@ -599,18 +575,9 @@ nextmsg: } else Con_DPrintf("%s tried to %s\n", host_client->name, s); - /* - if (ret == 2) - Cbuf_InsertText (s); - else if (ret == 1) - Cmd_ExecuteString (s, src_client); - else - Con_DPrintf("%s tried to %s\n", host_client->name, s); - */ break; case clc_disconnect: -// Sys_Printf ("SV_ReadClientMessage: client disconnected\n"); return false; case clc_move: diff --git a/sys_linux.c b/sys_linux.c index f8f0a15d..d98da25e 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -157,7 +157,6 @@ void Sys_DebugLog(char *file, char *fmt, ...) va_start(argptr, fmt); vsprintf(data, fmt, argptr); va_end(argptr); -// fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666); fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666); write(fd, data, strlen(data)); close(fd); @@ -203,7 +202,6 @@ void alarm_handler(int x) void floating_point_exception_handler(int whatever) { -// Sys_Warn("floating point exception\n"); signal(SIGFPE, floating_point_exception_handler); } @@ -242,9 +240,6 @@ int main (int c, char **v) double oldtime, newtime; -// static char cwd[1024]; - -// signal(SIGFPE, floating_point_exception_handler); signal(SIGFPE, SIG_IGN); memset(&host_parms, 0, sizeof(host_parms)); @@ -275,3 +270,4 @@ int main (int c, char **v) } return 0; } + diff --git a/sys_shared.c b/sys_shared.c index e7b4a810..307c400b 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -100,11 +100,6 @@ void Sys_Printf (char *fmt, ...) #else printf("%s", final); #endif -// for (p = (unsigned char *) final; *p; p++) -// putc (qfont_table[*p], stdout); -//#ifndef WIN32 -// fflush (stdout); -//#endif } char engineversion[40]; @@ -128,3 +123,4 @@ void Sys_Shared_EarlyInit(void) void Sys_Shared_LateInit(void) { } + diff --git a/sys_win.c b/sys_win.c index 10226f3a..8715a607 100644 --- a/sys_win.c +++ b/sys_win.c @@ -39,8 +39,6 @@ qboolean ActiveApp, Minimized; static qboolean sc_return_on_enter = false; HANDLE hinput, houtput; -//static char *tracking_tag = "Clams & Mooses"; - static HANDLE tevent; static HANDLE hFile; static HANDLE heventParent; @@ -478,14 +476,8 @@ void Sys_SendKeyEvents (void) */ -/* -================== -WinMain -================== -*/ void SleepUntilInput (int time) { - MsgWaitForMultipleObjects(1, &tevent, false, time, QS_ALLINPUT); } diff --git a/transform.c b/transform.c index 91bdd1a7..66628f6e 100644 --- a/transform.c +++ b/transform.c @@ -85,3 +85,4 @@ void softwaretransformforentity (entity_render_t *r) softwaretransformset(r->origin, angles, r->scale); } } + diff --git a/ui.c b/ui.c index 6a41d9b8..b2b91bc4 100644 --- a/ui.c +++ b/ui.c @@ -405,6 +405,6 @@ void ui_draw(void) DrawQ_String(it->draw_x, it->draw_y, it->draw_string, 0, 8, 8, 1, 1, 1, 1, DRAWFLAG_ADDITIVE); DrawQ_Pic(ui_mouse_x, ui_mouse_y, "ui/mousepointer.tga", 0, 0, 1, 1, 1, 1, 0); - //Draw_GenericPic(ui_mousepointertexture, 1, 1, 1, 1, ui_mouse_x, ui_mouse_y, 16, 16); } } + diff --git a/vid_3dfxsvga.c b/vid_3dfxsvga.c index 9cbb5819..72742490 100644 --- a/vid_3dfxsvga.c +++ b/vid_3dfxsvga.c @@ -84,7 +84,6 @@ void signal_handler(int sig) printf("Received signal %d, exiting...\n", sig); Host_Shutdown(); abort(); - //Sys_Quit(); exit(0); } @@ -95,9 +94,7 @@ void InitSig(void) signal(SIGQUIT, signal_handler); signal(SIGILL, signal_handler); signal(SIGTRAP, signal_handler); -// signal(SIGIOT, signal_handler); signal(SIGBUS, signal_handler); -// signal(SIGFPE, signal_handler); signal(SIGSEGV, signal_handler); signal(SIGTERM, signal_handler); } @@ -291,24 +288,14 @@ void VID_Init(void) VID_SetupDithering(); // 3DFX specific Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height); - -// vid.recalc_refdef = 1; // force a surface cache flush } void VID_ExtraOptionDraw(unsigned int options_draw_cursor) { -/* Port specific Options menu entrys */ } void VID_ExtraOptionCmd(int option_cursor) { -/* - switch(option_cursor) - { - case 12: // Always start with 12 - break; - } -*/ } void VID_SetCaption (char *text) @@ -318,3 +305,4 @@ void VID_SetCaption (char *text) void VID_HandlePause (qboolean pause) { } + diff --git a/vid_glx.c b/vid_glx.c index bb42edca..6445cbac 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -53,7 +53,6 @@ viddef_t vid; // global video state static qboolean mouse_avail = true; static qboolean mouse_active = false, usingmouse = false; -// static qboolean dga_active; static float mouse_x, mouse_y; static int p_mouse_x, p_mouse_y; @@ -67,7 +66,6 @@ static int win_x, win_y; static int scr_width, scr_height; static XF86VidModeModeInfo **vidmodes; -//static int default_dotclock_vidmode; static int num_vidmodes; static qboolean vidmode_active = false; @@ -83,9 +81,8 @@ const char *gl_extensions; /*-----------------------------------------------------------------------*/ static int -XLateKey(XKeyEvent *ev/*, qboolean modified*/) +XLateKey(XKeyEvent *ev) { -// char tmp[2]; int key = 0; KeySym keysym; @@ -179,7 +176,7 @@ XLateKey(XKeyEvent *ev/*, qboolean modified*/) { /* ASCII keys */ key = keysym; - if (/*!modified && */((key >= 'A') && (key <= 'Z'))) + if ((key >= 'A') && (key <= 'Z')) key = key + ('a' - 'A'); } break; @@ -196,7 +193,7 @@ static Cursor CreateNullCursor(Display *display, Window root) XColor dummycolour; Cursor cursor; - cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/); + cursormask = XCreatePixmap(display, root, 1, 1, 1); xgc.function = GXclear; gc = XCreateGC(display, cursormask, GCFunction, &xgc); XFillRectangle(display, cursormask, gc, 0, 0, 1, 1); @@ -247,8 +244,6 @@ static void install_grabs(void) mouse_active = true; mouse_x = mouse_y = 0; - -// XSync(vidx11_display, True); } static void uninstall_grabs(void) @@ -271,7 +266,6 @@ static void uninstall_grabs(void) static void HandleEvents(void) { XEvent event; -// KeySym ks; qboolean dowarp = false; if (!vidx11_display) @@ -298,30 +292,14 @@ static void HandleEvents(void) } else { - /* - if (!p_mouse_x && !p_mouse_y) - { - Con_Printf("event->xmotion.x: %d\n", event.xmotion.x); - Con_Printf("event->xmotion.y: %d\n", event.xmotion.y); - } - */ - //if (usingmouse) - { - if (!event.xmotion.send_event) - { - mouse_x += event.xmotion.x - p_mouse_x; - mouse_y += event.xmotion.y - p_mouse_y; - if (abs(scr_width/2 - event.xmotion.x) > scr_width / 4 || abs(scr_height/2 - event.xmotion.y) > scr_height / 4) - dowarp = true; - } - } - /* - else + + if (!event.xmotion.send_event) { - mouse_x += (event.xmotion.x - p_mouse_x); - mouse_y += (event.xmotion.y - p_mouse_y); + mouse_x += event.xmotion.x - p_mouse_x; + mouse_y += event.xmotion.y - p_mouse_y; + if (abs(scr_width/2 - event.xmotion.x) > scr_width / 4 || abs(scr_height/2 - event.xmotion.y) > scr_height / 4) + dowarp = true; } - */ p_mouse_x = event.xmotion.x; p_mouse_y = event.xmotion.y; } @@ -437,10 +415,6 @@ void VID_Shutdown(void) if (vidmode_active) XF86VidModeSwitchToMode(vidx11_display, scrnum, vidmodes[0]); -/* Disabled, causes a segfault during shutdown. - if (ctx) - glXDestroyContext(vidx11_display, ctx); -*/ if (win) XDestroyWindow(vidx11_display, win); XCloseDisplay(vidx11_display); @@ -620,7 +594,6 @@ void VID_Init(void) GLX_DEPTH_SIZE, 1, None }; -// char gldir[MAX_OSPATH]; int width = 640, height = 480; XSetWindowAttributes attr; unsigned long mask; @@ -796,9 +769,6 @@ void VID_Init(void) GL_Init(); Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height); - - // force a surface cache flush -// vid.recalc_refdef = 1; } void Sys_SendKeyEvents(void) @@ -833,4 +803,3 @@ void IN_Move (usercmd_t *cmd) mouse_y = 0; } - diff --git a/vid_shared.c b/vid_shared.c index 98cdb8fb..8cb5234d 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -493,3 +493,4 @@ void VID_InitCvars(void) Cvar_RegisterVariable(&m_filter); Cmd_AddCommand("force_centerview", Force_CenterView_f); } + diff --git a/vid_wgl.c b/vid_wgl.c index d8ca7651..18dc45c9 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -66,7 +66,6 @@ qboolean scr_skipupdate; static vmode_t modelist[MAX_MODE_LIST]; static int nummodes; -//static vmode_t *pcurrentmode; static vmode_t badmode; static DEVMODE gdevmode; @@ -110,11 +109,6 @@ void VID_UpdateWindowStatus (void); //==================================== -// Note that 0 is MODE_WINDOWED -//cvar_t _vid_default_mode = {"_vid_default_mode","0", true}; -// Note that 3 is MODE_FULLSCREEN_DEFAULT -//cvar_t _vid_default_mode_win = {"_vid_default_mode_win","3", true}; - int window_center_x, window_center_y, window_x, window_y, window_width, window_height; RECT window_rect; @@ -250,17 +244,12 @@ qboolean VID_SetFullDIBMode (int modenum) int VID_SetMode (int modenum) { int original_mode; - //int temp; qboolean stat = 0; MSG msg; if ((windowed && (modenum != 0)) || (!windowed && (modenum < 1)) || (!windowed && (modenum >= nummodes))) Sys_Error ("Bad video mode\n"); -// so Con_Printfs don't mess us up by forcing vid and snd updates -// temp = scr_disabled_for_loading; -// scr_disabled_for_loading = true; - CDAudio_Pause (); if (vid_modenum == NO_MODE) @@ -270,30 +259,9 @@ int VID_SetMode (int modenum) // Set either the fullscreen or windowed mode if (modelist[modenum].type == MS_WINDOWED) - { -// if (vid_mouse.integer && key_dest == key_game) -// { -// stat = VID_SetWindowedMode(modenum); -// usingmouse = true; -// IN_ActivateMouse (); -// IN_HideMouse (); -// } -// else -// { -// usingmouse = false; -// IN_DeactivateMouse (); -// IN_ShowMouse (); -// stat = VID_SetWindowedMode(modenum); -// } stat = VID_SetWindowedMode(modenum); - } else if (modelist[modenum].type == MS_FULLDIB) - { stat = VID_SetFullDIBMode(modenum); -// usingmouse = true; -// IN_ActivateMouse (); -// IN_HideMouse (); - } else Sys_Error ("VID_SetMode: Bad mode type in modelist"); @@ -302,7 +270,6 @@ int VID_SetMode (int modenum) VID_UpdateWindowStatus (); CDAudio_Resume (); -// scr_disabled_for_loading = temp; if (!stat) Sys_Error ("Couldn't set video mode"); @@ -335,8 +302,6 @@ int VID_SetMode (int modenum) if (!msg_suppress_1) Con_SafePrintf ("Video mode %s initialized.\n", VID_GetModeDescription (vid_modenum)); -// vid.recalc_refdef = 1; - return true; } @@ -515,20 +480,6 @@ qbyte scantokey[128] = 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 }; -/* -qbyte shiftscantokey[128] = -{ -// 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0 ,27 ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'_' ,'+' ,K_BACKSPACE,9 , // 0 - 'Q' ,'W' ,'E' ,'R' ,'T' ,'Y' ,'U' ,'I' ,'O' ,'P' ,'{' ,'}' ,13 ,K_CTRL ,'A' ,'S' , // 1 - 'D' ,'F' ,'G' ,'H' ,'J' ,'K' ,'L' ,':' ,'"' ,'~' ,K_SHIFT,'|' ,'Z' ,'X' ,'C' ,'V' , // 2 - 'B' ,'N' ,'M' ,'<' ,'>' ,'?' ,K_SHIFT,'*' ,K_ALT ,' ' ,0 ,K_F1 ,K_F2,K_F3 ,K_F4 ,K_F5 , // 3 - K_F6 ,K_F7 ,K_F8 ,K_F9 ,K_F10,K_PAUSE,0 ,K_HOME,K_UPARROW,K_PGUP,'_' ,K_LEFTARROW,'%' ,K_RIGHTARROW,'+' ,K_END, // 4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0 ,0 ,0 ,K_F11 ,K_F12 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 -}; -*/ /* ======= @@ -544,8 +495,6 @@ int MapKey (int key, int virtualkey) return 0; if (scantokey[key] == 0) Con_DPrintf("key 0x%02x has no translation\n", key); -// if (scantokey[key] >= 0x20 && scantokey[key] < 0x7F) -// return realchar; return scantokey[key]; } @@ -612,9 +561,6 @@ void AppActivate(BOOL fActive, BOOL minimize) { if (modestate == MS_FULLDIB) { -// usingmouse = true; -// IN_ActivateMouse (); -// IN_HideMouse (); if (vid_canalttab && vid_wassuspended) { vid_wassuspended = false; @@ -625,12 +571,6 @@ void AppActivate(BOOL fActive, BOOL minimize) // LordHavoc: from dabb, fix for alt-tab bug in NVidia drivers MoveWindow(mainwindow,0,0,gdevmode.dmPelsWidth,gdevmode.dmPelsHeight,false); } -// else if ((modestate == MS_WINDOWED) && vid_mouse.integer && key_dest == key_game) -// { -// usingmouse = true; -// IN_ActivateMouse (); -// IN_HideMouse (); -// } if (host_loopactive) VID_RestoreGameGamma(); } @@ -640,23 +580,11 @@ void AppActivate(BOOL fActive, BOOL minimize) usingmouse = false; IN_DeactivateMouse (); IN_ShowMouse (); - if (modestate == MS_FULLDIB) - { -// usingmouse = false; -// IN_DeactivateMouse (); -// IN_ShowMouse (); - if (vid_canalttab) - { - ChangeDisplaySettings (NULL, 0); - vid_wassuspended = true; - } + if (modestate == MS_FULLDIB && vid_canalttab) + { + ChangeDisplaySettings (NULL, 0); + vid_wassuspended = true; } -// else if ((modestate == MS_WINDOWED) && vid_mouse.integer) -// { -// usingmouse = false; -// IN_DeactivateMouse (); -// IN_ShowMouse (); -// } VID_RestoreSystemGamma(); } } @@ -886,7 +814,6 @@ VID_NumModes_f */ void VID_NumModes_f (void) { - if (nummodes == 1) Con_Printf ("%d video mode is available\n", nummodes); else @@ -985,35 +912,6 @@ void VID_InitDIB (HINSTANCE hInstance) if (!RegisterClass (&wc) ) Sys_Error ("Couldn't register window class"); - /* - modelist[0].type = MS_WINDOWED; - - if (COM_CheckParm("-width")) - modelist[0].width = atoi(com_argv[COM_CheckParm("-width")+1]); - else - modelist[0].width = 640; - - if (modelist[0].width < 320) - modelist[0].width = 320; - - if (COM_CheckParm("-height")) - modelist[0].height= atoi(com_argv[COM_CheckParm("-height")+1]); - else - modelist[0].height = modelist[0].width * 240/320; - - if (modelist[0].height < 240) - modelist[0].height = 240; - - sprintf (modelist[0].modedesc, "%dx%d", modelist[0].width, modelist[0].height); - - modelist[0].modenum = MODE_WINDOWED; - modelist[0].dib = 1; - modelist[0].fullscreen = 0; - modelist[0].halfscreen = 0; - modelist[0].bpp = 0; - - nummodes = 1; - */ if (COM_CheckParm("-width")) w = atoi(com_argv[COM_CheckParm("-width")+1]); else @@ -1042,10 +940,8 @@ VID_InitFullDIB void VID_InitFullDIB (HINSTANCE hInstance) { DEVMODE devmode; -// int i; int modenum; int originalnummodes; -// int existingmode; int numlowresmodes; int j; int bpp; @@ -1072,41 +968,6 @@ void VID_InitFullDIB (HINSTANCE hInstance) VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth >> 1, devmode.dmPelsHeight, 0, 1, 1, 1, devmode.dmBitsPerPel); else VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth, devmode.dmPelsHeight, 0, 0, 1, 1, devmode.dmBitsPerPel); - /* - modelist[nummodes].type = MS_FULLDIB; - modelist[nummodes].width = devmode.dmPelsWidth; - modelist[nummodes].height = devmode.dmPelsHeight; - modelist[nummodes].modenum = 0; - modelist[nummodes].halfscreen = 0; - modelist[nummodes].dib = 1; - modelist[nummodes].fullscreen = 1; - modelist[nummodes].bpp = devmode.dmBitsPerPel; - sprintf (modelist[nummodes].modedesc, "%dx%dx%d", devmode.dmPelsWidth, devmode.dmPelsHeight, devmode.dmBitsPerPel); - - // if the width is more than twice the height, reduce it by half because this - // is probably a dual-screen monitor - if (!COM_CheckParm("-noadjustaspect")) - { - if (modelist[nummodes].width > (modelist[nummodes].height << 1)) - { - modelist[nummodes].width >>= 1; - modelist[nummodes].halfscreen = 1; - sprintf (modelist[nummodes].modedesc, "%dx%dx%d", modelist[nummodes].width, modelist[nummodes].height, modelist[nummodes].bpp); - } - } - - for (i=originalnummodes, existingmode = 0 ; i 0) { if (move > delta) @@ -215,9 +207,6 @@ static void V_DriftPitch (void) } - - - /* ============================================================================== @@ -609,4 +598,3 @@ void V_Init (void) Cvar_RegisterVariable (&v_kickpitch); } - diff --git a/wad.c b/wad.c index 4414197f..b5000082 100644 --- a/wad.c +++ b/wad.c @@ -117,7 +117,6 @@ void *W_GetLumpName (char *name) if (!strcmp(clean, lump->name)) return (void *)(wad_base + lump->filepos); - //Sys_Error ("W_GetLumpinfo: %s not found", name); return NULL; } @@ -211,65 +210,12 @@ void W_LoadTextureWadFile (char *filename, int complain) // leaves the file open } -/* -qbyte hlpalette[768] = -{ - 0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B, - 0x4B,0x4B,0x5B,0x5B,0x5B,0x6B,0x6B,0x6B,0x7B,0x7B,0x7B,0x8B,0x8B,0x8B,0x9B,0x9B, - 0x9B,0xAB,0xAB,0xAB,0xBB,0xBB,0xBB,0xCB,0xCB,0xCB,0xDB,0xDB,0xDB,0xEB,0xEB,0xEB, - 0x0F,0x0B,0x07,0x17,0x0F,0x0B,0x1F,0x17,0x0B,0x27,0x1B,0x0F,0x2F,0x23,0x13,0x37, - 0x2B,0x17,0x3F,0x2F,0x17,0x4B,0x37,0x1B,0x53,0x3B,0x1B,0x5B,0x43,0x1F,0x63,0x4B, - 0x1F,0x6B,0x53,0x1F,0x73,0x57,0x1F,0x7B,0x5F,0x23,0x83,0x67,0x23,0x8F,0x6F,0x23, - 0x0B,0x0B,0x0F,0x13,0x13,0x1B,0x1B,0x1B,0x27,0x27,0x27,0x33,0x2F,0x2F,0x3F,0x37, - 0x37,0x4B,0x3F,0x3F,0x57,0x47,0x47,0x67,0x4F,0x4F,0x73,0x5B,0x5B,0x7F,0x63,0x63, - 0x8B,0x6B,0x6B,0x97,0x73,0x73,0xA3,0x7B,0x7B,0xAF,0x83,0x83,0xBB,0x8B,0x8B,0xCB, - 0x00,0x00,0x00,0x07,0x07,0x00,0x0B,0x0B,0x00,0x13,0x13,0x00,0x1B,0x1B,0x00,0x23, - 0x23,0x00,0x2B,0x2B,0x07,0x2F,0x2F,0x07,0x37,0x37,0x07,0x3F,0x3F,0x07,0x47,0x47, - 0x07,0x4B,0x4B,0x0B,0x53,0x53,0x0B,0x5B,0x5B,0x0B,0x63,0x63,0x0B,0x6B,0x6B,0x0F, - 0x07,0x00,0x00,0x0F,0x00,0x00,0x17,0x00,0x00,0x1F,0x00,0x00,0x27,0x00,0x00,0x2F, - 0x00,0x00,0x37,0x00,0x00,0x3F,0x00,0x00,0x47,0x00,0x00,0x4F,0x00,0x00,0x57,0x00, - 0x00,0x5F,0x00,0x00,0x67,0x00,0x00,0x6F,0x00,0x00,0x77,0x00,0x00,0x7F,0x00,0x00, - 0x13,0x13,0x00,0x1B,0x1B,0x00,0x23,0x23,0x00,0x2F,0x2B,0x00,0x37,0x2F,0x00,0x43, - 0x37,0x00,0x4B,0x3B,0x07,0x57,0x43,0x07,0x5F,0x47,0x07,0x6B,0x4B,0x0B,0x77,0x53, - 0x0F,0x83,0x57,0x13,0x8B,0x5B,0x13,0x97,0x5F,0x1B,0xA3,0x63,0x1F,0xAF,0x67,0x23, - 0x23,0x13,0x07,0x2F,0x17,0x0B,0x3B,0x1F,0x0F,0x4B,0x23,0x13,0x57,0x2B,0x17,0x63, - 0x2F,0x1F,0x73,0x37,0x23,0x7F,0x3B,0x2B,0x8F,0x43,0x33,0x9F,0x4F,0x33,0xAF,0x63, - 0x2F,0xBF,0x77,0x2F,0xCF,0x8F,0x2B,0xDF,0xAB,0x27,0xEF,0xCB,0x1F,0xFF,0xF3,0x1B, - 0x0B,0x07,0x00,0x1B,0x13,0x00,0x2B,0x23,0x0F,0x37,0x2B,0x13,0x47,0x33,0x1B,0x53, - 0x37,0x23,0x63,0x3F,0x2B,0x6F,0x47,0x33,0x7F,0x53,0x3F,0x8B,0x5F,0x47,0x9B,0x6B, - 0x53,0xA7,0x7B,0x5F,0xB7,0x87,0x6B,0xC3,0x93,0x7B,0xD3,0xA3,0x8B,0xE3,0xB3,0x97, - 0xAB,0x8B,0xA3,0x9F,0x7F,0x97,0x93,0x73,0x87,0x8B,0x67,0x7B,0x7F,0x5B,0x6F,0x77, - 0x53,0x63,0x6B,0x4B,0x57,0x5F,0x3F,0x4B,0x57,0x37,0x43,0x4B,0x2F,0x37,0x43,0x27, - 0x2F,0x37,0x1F,0x23,0x2B,0x17,0x1B,0x23,0x13,0x13,0x17,0x0B,0x0B,0x0F,0x07,0x07, - 0xBB,0x73,0x9F,0xAF,0x6B,0x8F,0xA3,0x5F,0x83,0x97,0x57,0x77,0x8B,0x4F,0x6B,0x7F, - 0x4B,0x5F,0x73,0x43,0x53,0x6B,0x3B,0x4B,0x5F,0x33,0x3F,0x53,0x2B,0x37,0x47,0x23, - 0x2B,0x3B,0x1F,0x23,0x2F,0x17,0x1B,0x23,0x13,0x13,0x17,0x0B,0x0B,0x0F,0x07,0x07, - 0xDB,0xC3,0xBB,0xCB,0xB3,0xA7,0xBF,0xA3,0x9B,0xAF,0x97,0x8B,0xA3,0x87,0x7B,0x97, - 0x7B,0x6F,0x87,0x6F,0x5F,0x7B,0x63,0x53,0x6B,0x57,0x47,0x5F,0x4B,0x3B,0x53,0x3F, - 0x33,0x43,0x33,0x27,0x37,0x2B,0x1F,0x27,0x1F,0x17,0x1B,0x13,0x0F,0x0F,0x0B,0x07, - 0x6F,0x83,0x7B,0x67,0x7B,0x6F,0x5F,0x73,0x67,0x57,0x6B,0x5F,0x4F,0x63,0x57,0x47, - 0x5B,0x4F,0x3F,0x53,0x47,0x37,0x4B,0x3F,0x2F,0x43,0x37,0x2B,0x3B,0x2F,0x23,0x33, - 0x27,0x1F,0x2B,0x1F,0x17,0x23,0x17,0x0F,0x1B,0x13,0x0B,0x13,0x0B,0x07,0x0B,0x07, - 0xFF,0xF3,0x1B,0xEF,0xDF,0x17,0xDB,0xCB,0x13,0xCB,0xB7,0x0F,0xBB,0xA7,0x0F,0xAB, - 0x97,0x0B,0x9B,0x83,0x07,0x8B,0x73,0x07,0x7B,0x63,0x07,0x6B,0x53,0x00,0x5B,0x47, - 0x00,0x4B,0x37,0x00,0x3B,0x2B,0x00,0x2B,0x1F,0x00,0x1B,0x0F,0x00,0x0B,0x07,0x00, - 0x00,0x00,0xFF,0x0B,0x0B,0xEF,0x13,0x13,0xDF,0x1B,0x1B,0xCF,0x23,0x23,0xBF,0x2B, - 0x2B,0xAF,0x2F,0x2F,0x9F,0x2F,0x2F,0x8F,0x2F,0x2F,0x7F,0x2F,0x2F,0x6F,0x2F,0x2F, - 0x5F,0x2B,0x2B,0x4F,0x23,0x23,0x3F,0x1B,0x1B,0x2F,0x13,0x13,0x1F,0x0B,0x0B,0x0F, - 0x2B,0x00,0x00,0x3B,0x00,0x00,0x4B,0x07,0x00,0x5F,0x07,0x00,0x6F,0x0F,0x00,0x7F, - 0x17,0x07,0x93,0x1F,0x07,0xA3,0x27,0x0B,0xB7,0x33,0x0F,0xC3,0x4B,0x1B,0xCF,0x63, - 0x2B,0xDB,0x7F,0x3B,0xE3,0x97,0x4F,0xE7,0xAB,0x5F,0xEF,0xBF,0x77,0xF7,0xD3,0x8B, - 0xA7,0x7B,0x3B,0xB7,0x9B,0x37,0xC7,0xC3,0x37,0xE7,0xE3,0x57,0x00,0xFF,0x00,0xAB, - 0xE7,0xFF,0xD7,0xFF,0xFF,0x67,0x00,0x00,0x8B,0x00,0x00,0xB3,0x00,0x00,0xD7,0x00, - 0x00,0xFF,0x00,0x00,0xFF,0xF3,0x93,0xFF,0xF7,0xC7,0xFF,0xFF,0xFF,0x9F,0x5B,0x53, -}; -*/ qbyte *W_ConvertWAD3Texture(miptex_t *tex) { qbyte *in, *data, *out, *pal; -// int palsize; int d, p; + in = (qbyte *)((int) tex + tex->offsets[0]); data = out = Mem_Alloc(tempmempool, tex->width * tex->height * 4); if (!data) @@ -277,9 +223,6 @@ qbyte *W_ConvertWAD3Texture(miptex_t *tex) image_width = tex->width; image_height = tex->height; pal = in + (((image_width * image_height) * 85) >> 6); -// palsize = pal[1] * 0x100 + pal[0]; -// if (palsize >= 256) -// palsize = 256; pal += 2; for (d = 0;d < image_width * image_height;d++) { @@ -301,14 +244,12 @@ qbyte *W_ConvertWAD3Texture(miptex_t *tex) qbyte *W_GetTexture(char *name) { -// int i, c, datasize; -// short colorcount; -// qbyte pal[256][3], *indata, *outdata, *data; char texname[17]; int i, j; QFile *file; miptex_t *tex; qbyte *data; + texname[16] = 0; W_CleanupName (name, texname); for (i = 0;i < TEXWAD_MAXIMAGES;i++) @@ -334,61 +275,6 @@ qbyte *W_GetTexture(char *name) data = W_ConvertWAD3Texture(tex); Mem_Free(tex); return data; - /* - image_width = LittleLong(t.width); - image_height = LittleLong(t.height); - if (matchwidth && image_width != matchwidth) - continue; - if (matchheight && image_height != matchheight) - continue; - if (image_width & 15 || image_height & 15) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - // allocate space for expanded image, - // and load incoming image into upper area (overwritten as it expands) - if (!(data = outdata = Mem_Alloc(tempmempool, image_width*image_height*4))) - {Con_Printf("W_GetTexture: out of memory");return NULL;} - indata = outdata + image_width*image_height*3; - datasize = image_width*image_height*85/64; - // read the image data - if (Qseek(file, texwadlump[i].position + sizeof(t), SEEK_SET)) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - if (Qread(file, indata, image_width*image_height) != image_width*image_height) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - // read the number of colors used (always 256) - if (Qseek(file, texwadlump[i].position + sizeof(t) + datasize, SEEK_SET)) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - if (Qread(file, &colorcount, 2) != 2) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - if (texwadlump[i].size > (datasize + sizeof(t))) - { - colorcount = LittleShort(colorcount); - // sanity checking - if (colorcount < 0) colorcount = 0; - if (colorcount > 256) colorcount = 256; - // read the palette - // Qseek(file, texwadlump[i].position + sizeof(t) + datasize + 2, SEEK_SET); - if (Qread(file, &pal, 3 * colorcount) != 3 * colorcount) - {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;} - } - else - memcpy(&pal, hlpalette, 768); - // expand the image to 32bit RGBA - for (i = 0;i < image_width*image_height;i++) - { - c = *indata++; - if (name[0] == '{' && c == 255) - outdata[0] = outdata[1] = outdata[2] = outdata[3] = 0; - else - { - outdata[0] = pal[c][0]; - outdata[1] = pal[c][1]; - outdata[2] = pal[c][2]; - outdata[3] = 255; - } - outdata += 4; - } - return data; - */ } } else @@ -397,3 +283,4 @@ qbyte *W_GetTexture(char *name) image_width = image_height = 0; return NULL; } + diff --git a/world.c b/world.c index f4e2436c..1ce1b73a 100644 --- a/world.c +++ b/world.c @@ -29,24 +29,12 @@ line of sight checks trace->crosscontent, but bullets don't */ -/* -typedef struct link_s -{ - struct link_s *prev, *next; -} link_t; -*/ - void ClearLink (link_t *l); void RemoveLink (link_t *l); void InsertLinkBefore (link_t *l, link_t *before); void InsertLinkAfter (link_t *l, link_t *after); -// (type *)STRUCT_FROM_LINK(link_t *link, type, member) -// ent = STRUCT_FROM_LINK(link,entity_t,order) -// FIXME: remove this mess! -//#define STRUCT_FROM_LINK(l,t,m) ((t *)((qbyte *)l - (int)&(((t *)0)->m))) - #define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area))) //============================================================================ @@ -252,9 +240,6 @@ loc0: if (node->axis == -1) return; - // LordHavoc: optimized recursion -// if (ent->v.absmax[node->axis] > node->dist) SV_TouchLinks (ent, node->children[0]); -// if (ent->v.absmin[node->axis] < node->dist) SV_TouchLinks (ent, node->children[1]); if (ent->v.absmax[node->axis] > node->dist) { if (ent->v.absmin[node->axis] < node->dist) @@ -295,46 +280,6 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) // set the abs box - /* -// LordHavoc: enabling rotating bmodels - if (ent->v.solid == SOLID_BSP && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2])) - { - // expand for rotation - float max, v; - int i; - - max = DotProduct(ent->v.mins, ent->v.mins); - v = DotProduct(ent->v.maxs, ent->v.maxs); - if (max < v) - max = v; - max = sqrt(max); - */ - /* - max = 0; - for (i=0 ; i<3 ; i++) - { - v = fabs(ent->v.mins[i]); - if (max < v) - max = v; - v = fabs(ent->v.maxs[i]); - if (max < v) - max = v; - } - */ - /* - for (i=0 ; i<3 ; i++) - { - ent->v.absmin[i] = ent->v.origin[i] - max; - ent->v.absmax[i] = ent->v.origin[i] + max; - } - } - else - { - VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); - VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax); - } - */ - if (ent->v.solid == SOLID_BSP) { if (ent->v.modelindex < 0 || ent->v.modelindex > MAX_MODELS) @@ -609,9 +554,6 @@ loc0: if (node->axis == -1) return; - // LordHavoc: optimized recursion -// if (clip->boxmaxs[node->axis] > node->dist) SV_ClipToLinks(node->children[0], clip); -// if (clip->boxmins[node->axis] < node->dist) SV_ClipToLinks(node->children[1], clip); if (clip->boxmaxs[node->axis] > node->dist) { if (clip->boxmins[node->axis] < node->dist) @@ -712,3 +654,4 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e return clip.trace; } + diff --git a/zone.c b/zone.c index fb485f84..57cedf6b 100644 --- a/zone.c +++ b/zone.c @@ -184,7 +184,6 @@ void _Mem_Free(void *data, char *filename, int fileline) mempool_t *_Mem_AllocPool(char *name, char *filename, int fileline) { -// int i; mempool_t *pool; pool = malloc(sizeof(mempool_t)); if (pool == NULL) @@ -194,10 +193,6 @@ mempool_t *_Mem_AllocPool(char *name, char *filename, int fileline) pool->totalsize = 0; pool->realsize = sizeof(mempool_t); strcpy(pool->name, name); -// for (i = 0;i < (POOLNAMESIZE - 1) && name[i];i++) -// pool->name[i] = name[i]; -// for (i = 0;i < POOLNAMESIZE;i++) -// pool->name[i] = 0; pool->next = poolchain; poolchain = pool; return pool; -- 2.39.2