char *buildstring = __TIME__ " " __DATE__;
+
close(cdfile);
cdfile = -1;
}
+
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
}
+
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;
}
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?
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;
}
{
R_Stain((float *)origin, radius, cr1, cg1, cb1, ca1, cr2, cg2, cb2, ca2);
}
+
// 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;
{
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]);
}
return maxfrac;
}
+
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
}
if (neg)
cls.forcetrack = -cls.forcetrack;
-// ZOID, fscanf is evil
-// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
-
}
/*
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);}
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);}
Cmd_AddCommand ("+button8", IN_Button8Down);
Cmd_AddCommand ("-button8", IN_Button8Up);
}
+
+
#include "quakedef.h"
dlight_t cl_dlights[MAX_DLIGHTS];
}
}
-
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
{
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;
{
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;
// 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)
CL_Screen_Init();
CL_CGVM_Init();
}
+
*/
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);
break;
case 4:
- SCR_EndLoadingPlaque (); // allow normal screen updates
Con_ClearNotify();
break;
}
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);
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;
break;
case svc_nop:
-// Con_Printf ("svc_nop\n");
break;
case svc_time:
case svc_serverinfo:
CL_ParseServerInfo ();
-// vid.recalc_refdef = true; // leave intermission full screen
break;
case svc_setangle:
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;
{
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)
if (entitiesupdated)
CL_EntityUpdateEnd();
}
+
};
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};
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"};
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)\
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);\
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);
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);
- }
}
/*
*/
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);
}
/*
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;}
{
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);
}
}
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);
}
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;
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;
// 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;
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
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;
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)
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)
{
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:
{
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;
}
{
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));
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;
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;
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)
{
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);
}
}
}
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++)
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);
}
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;
particle_t *p;
// LordHavoc: early out conditions
- //if ((!r_refdef.numparticles) || (!r_drawparticles.integer))
if ((!cl_numparticles) || (!r_drawparticles.integer))
return;
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];
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)
}
}
}
+
int clearconsole;
int clearnotify;
-//qboolean scr_disabled_for_loading;
qboolean scr_drawloading = false;
-//float scr_disabled_time;
static qbyte menuplyr_pixels[4096];
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
{
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);
}
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 ();
- */
}
//=============================================================================
{
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"
c_bmodels = 0;
c_sprites = 0;
c_particles = 0;
- // c_dlights = 0;
r_timereport_start = Sys_DoubleTime();
}
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])
R_TimeReport("setup");
- SCR_DrawRam ();
SCR_DrawNet ();
SCR_DrawTurtle ();
SCR_DrawPause ();
{
SHOWLMP_clear();
}
+
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
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 )
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
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);
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
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);
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;
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);
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);
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);
}
-
}
-#if 1
#define CMD_TOKENIZELENGTH 4096
char cmd_tokenizebuffer[CMD_TOKENIZELENGTH];
-#endif
/*
============
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_argc ; i++)
- Z_Free (cmd_argv[i]);
-#endif
cmd_argc = 0;
cmd_args = NULL;
if (cmd_argc < MAX_ARGS)
{
l = strlen(com_token) + 1;
-#ifdef CMD_TOKENIZELENGTH
if (pos + l > 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++;
}
{
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])
{
}
-
/*
============
Cmd_CompleteCommand
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;
// 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];
rhc.trace->ent = (void *) cent;
}
}
+
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);
============================================================================
*/
-/*
-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<count ; i++)
- ((int *)dest)[i] = fill;
- }
- else
- for (i=0 ; i<count ; i++)
- ((qbyte *)dest)[i] = fill;
-}
-
-void Q_memcpy (void *dest, void *src, int count)
-{
- int i;
-
- if (( ( (long)dest | (long)src | count) & 3) == 0 )
- {
- count>>=2;
- for (i=0 ; i<count ; i++)
- ((int *)dest)[i] = ((int *)src)[i];
- }
- else
- for (i=0 ; i<count ; i++)
- ((qbyte *)dest)[i] = ((qbyte *)src)[i];
-}
-
-int Q_memcmp (void *m1, void *m2, int count)
-{
- while(count)
- {
- count--;
- if (((qbyte *)m1)[count] != ((qbyte *)m2)[count])
- return -1;
- }
- return 0;
-}
-
-void Q_strcpy (char *dest, char *src)
-{
- while (*src)
- {
- *dest++ = *src++;
- }
- *dest++ = 0;
-}
-
-void Q_strncpy (char *dest, char *src, int count)
-{
- while (*src && count--)
- {
- *dest++ = *src++;
- }
- if (count)
- *dest++ = 0;
-}
-
-int Q_strlen (char *str)
-{
- int count;
-
- count = 0;
- while (str[count])
- count++;
-
- return count;
-}
-
-char *Q_strrchr(char *s, char c)
-{
- int len = Q_strlen(s);
- s += len;
- while (len--)
- if (*--s == c) return s;
- return 0;
-}
-
-void Q_strcat (char *dest, char *src)
-{
- dest += Q_strlen(dest);
- Q_strcpy (dest, src);
-}
-
-int Q_strcmp (char *s1, char *s2)
-{
- while (1)
- {
- if (*s1 != *s2)
- return -1; // strings not equal
- if (!*s1)
- return 0; // strings are equal
- s1++;
- s2++;
- }
-
- return -1;
-}
-
-int Q_strncmp (char *s1, char *s2, int count)
-{
- while (1)
- {
- if (!count--)
- return 0;
- if (*s1 != *s2)
- return -1; // strings not equal
- if (!*s1)
- return 0; // strings are equal
- s1++;
- s2++;
- }
-
- return -1;
-}
-*/
int Q_strncasecmp (char *s1, char *s2, int n)
{
int c1, c2;
}
if (!c1)
return 0; // strings are equal
-// s1++;
-// s2++;
}
return -1;
{
return Q_strncasecmp (s1, s2, 99999);
}
-/*
-int Q_atoi (char *str)
-{
- int val;
- int sign;
- int c;
-
- 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<<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;
-}
-*/
/*
============================================================================
{
qbyte *buf;
-//#ifdef PARANOID
-// if (c < -128 || c > 127)
-// Sys_Error ("MSG_WriteChar: range error");
-//#endif
-
buf = SZ_GetSpace (sb, 1);
buf[0] = 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;
}
{
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;
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;
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);
-}
-*/
-
//===========================================================================
{
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");
}
}
-/// just for debugging
-int memsearch (qbyte *start, int count, int search)
-{
- int i;
-
- for (i=0 ; i<count ; i++)
- if (start[i] == search)
- return i;
- return -1;
-}
-
/*
=============================================================================
// search through the path, one element at a time
//
search = com_searchpaths;
-// if (proghack)
-// { // gross hack to use quake 1 progs with quake 2 maps
-// if (!strcmp(filename, "progs.dat"))
-// search = search->next;
-// }
for ( ; search ; search = search->next)
{
}
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);
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);
*/
void COM_AddGameDirectory (char *dir)
{
- //int i;
stringlist_t *list, *current;
searchpath_t *search;
pack_t *pak;
}
}
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
-//
-
}
/*
com_searchpaths = search;
}
}
-
-// if (COM_CheckParm ("-proghack"))
-// proghack = true;
}
int COM_FileExists(char *filename)
*out++ = *in++;
}
}
+
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));
}
{
va_list argptr;
char msg[MAXPRINTMSG];
-// static qboolean inupdate;
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
// 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;
- }
- }
- */
}
/*
{
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;
}
crc = (crc << 8) ^ crctable[(crc >> 8) ^ (*data++)];
return crc ^ CRC_XOR_VALUE;
}
+
Con_Printf ("\n");
}
// 2000-01-09 CvarList command by Maddes
+
#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"};
}
}
-//static float gldepthmin, gldepthmax;
-
/*
=============
GL_SetupFrame
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
// set view pyramid
qglFrustum(-xmax, xmax, -ymax, ymax, zNear, zFar);CHECKGLERROR
-// qglCullFace(GL_FRONT);CHECKGLERROR
-
qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
qglLoadIdentity ();CHECKGLERROR
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;
}
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
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;
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();
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));
*/
void SCR_UpdateScreen (void)
{
- //Mem_CheckSentinelsGlobal();
- //R_TimeReport("memtest");
-
VID_Finish ();
R_TimeReport("finish");
// (this doesn't wait for the commands themselves to complete)
qglFlush();
}
+
#include "quakedef.h"
-//#define GL_COLOR_INDEX8_EXT 0x80E5
-
cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1"};
static rtexture_t *char_texture;
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");
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;
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);
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);
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);
qglColor4ub (255, 255, 255, 255);
CHECKGLERROR
}
+
#include "quakedef.h"
-//cvar_t gl_transform = {0, "gl_transform", "1"};
cvar_t r_quickmodels = {0, "r_quickmodels", "1"};
typedef struct
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)
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);
}
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);
{
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;
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];
else
R_DrawQ1Q2AliasModel(fog);
}
+
#include "quakedef.h"
-//static qboolean r_cache_thrash; // compatability
-
entity_render_t *currentrenderentity;
int r_framecount; // used for dlight push checking
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
//
vec3_t vright;
vec3_t r_origin;
-//float r_world_matrix[16];
-//float r_base_world_matrix[16];
-
//
// screen size info
//
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"};
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"};
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;
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);
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
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
-
-// qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
}
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)
r_oldviewleaf = r_viewleaf;
r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel);
-// r_cache_thrash = false;
-
R_AnimateLight ();
}
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);
- */
}
/*
// render any queued meshs
R_Mesh_Finish();
R_TimeReport("meshfinish");
-
- //Mem_CheckSentinelsGlobal();
- //R_TimeReport("memtest");
}
+
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)
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];
-}
-*/
-
/*
=============================================================
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];
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)
{
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;
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;
|| (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
R_DrawSurfaces(SHADERSTAGE_SKY);
R_DrawSurfaces(SHADERSTAGE_NORMAL);
}
+
+
#include "quakedef.h"
cvar_t r_max_size = {CVAR_SAVE, "r_max_size", "2048"};
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;
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;
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)
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;
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;
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;
{
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);
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)
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)
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);
}
inerror = true;
- SCR_EndLoadingPlaque (); // reenable screen updates
-
va_start (argptr,error);
vsprintf (hosterrorstring,error,argptr);
va_end (argptr);
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
sv.frametime = 0;
frametimetotal = 0;
lastservertime = realtime;
-// pr_global_struct->frametime = host_frametime;
// set the time and clear the general datagram
SV_ClearDatagram ();
NET_Init ();
SV_Init ();
- Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
+ Con_Printf ("Builddate: %s\n", buildstring);
if (cls.state != ca_dedicated)
{
}
isdown = true;
-// keep Con_Printf from trying to update the screen
-// scr_disabled_for_loading = true;
-
Host_WriteConfiguration ();
CDAudio_Shutdown ();
==================
*/
-// 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);
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
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");
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
Cmd_AddCommand ("viewnext", Host_Viewnext_f);
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
}
+
Sys_Error("Image_MipReduce: desired size already achieved\n");
}
}
+
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);
}
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;
void IN_HandlePause (qboolean pause)
{
}
+
#include "quakedef.h"
#include "winquake.h"
-//#include "dosisms.h"
#include <dinput.h>
*/
void IN_Shutdown (void)
{
-// usingmouse = false;
IN_DeactivateMouse ();
IN_ShowMouse ();
/* Unable to read data or no data available */
if (FAILED(hr) || dwElements == 0)
- {
break;
- }
/* Look at the element to see what happened */
*/
void IN_ClearStates (void)
{
-
if (mouseactive)
{
mx_accum = 0;
// 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;
}
}
}
}
}
+
{
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;
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;
dst[1] = 0;
dst[2] = 0;
}
-#endif
}
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;
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;
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
}
/*-----------------------------------------------------------------*/
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)
}
-/*
-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;
-}
-*/
/*
================
for (a = 1;a < 4096;a++)
ixtable[a] = 1.0f / a;
}
+
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);
}
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);
}
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
}
}
-// 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)
/* MAIN MENU */
int m_main_cursor;
-//#define MAIN_ITEMS 5
int MAIN_ITEMS = 4; // Nehahra: Menu Disable
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)
{
int m_quit_prevstate;
qboolean wasInMenus;
-//#ifndef _WIN32
char *quitMessage [] =
{
/* .........1.........2.... */
" constructive? ",
" ",
};
-//#endif
void M_Menu_Quit_f (void)
{
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
}
//=============================================================================
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
{
if (IPXConfig || TCPIPConfig)
net_hostport = lanConfig_port;
}
+
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];
// LordHavoc: model bbox
modelyawradius = sqrt(modelyawradius);
modelradius = sqrt(modelradius);
-// loadmodel->modelradius = modelradius;
for (j = 0;j < 3;j++)
{
loadmodel->normalmins[j] = aliasbboxmin[j];
// model bbox
modelradius = pheader->radius;
-// loadmodel->modelradius = pheader->radius;
for (i = 0;i < 3;i++)
{
loadmodel->normalmins[i] = pheader->mins[i];
loadmodel->DrawSky = NULL;
loadmodel->DrawShadow = NULL;
}
+
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
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
-}
-*/
/*
===================
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)
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++)
{
surfvertex_t *out;
surfmesh_t *mesh;
- //surf->flags |= SURF_LIGHTMAP;
smax = surf->extents[0] >> 4;
tmax = surf->extents[1] >> 4;
surf->lightmaptexturestride = 0;
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);
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);
}
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 ; j<out->nummarksurfaces ; j++)
- out->firstmarksurface[j]->flags |= SURF_UNDERWATER;
- }
- */
+ // FIXME: Insert caustics here
}
}
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);
}
}
// free the original winding
FreeWinding (in);
- // debugging
- //Mem_CheckSentinels(neww);
-
return neww;
}
VectorCopy (mid, b->points[b->numpoints]);
b->numpoints++;
}
-
- // debugging
- //Mem_CheckSentinels(f);
- //Mem_CheckSentinels(b);
}
typedef struct portal_s
{
portal_t *p;
p = Mem_Alloc(loadmodel->mempool, sizeof(portal_t));
- //memset(p, 0, sizeof(portal_t));
p->chain = portalchain;
portalchain = p;
return p;
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;
Mod_RecursiveRecalcNodeBBox(loadmodel->nodes);
- //Mem_CheckSentinelsGlobal();
-
// tally up portal and point counts
p = portalchain;
numportals = 0;
FreePortal(p);
p = pnext;
}
-
- //Mem_CheckSentinelsGlobal();
}
/*
portal_t *portal, *nextportal, *nodeportal, *splitportal, *temp;
winding_t *nodeportalwinding, *frontwinding, *backwinding;
- // CheckLeafPortalConsistancy (node);
-
// if a leaf, we're done
if (node->contents)
return;
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])
{
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();
}
// 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
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])
{
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;
mod = loadmodel;
}
}
-// Mem_CheckSentinelsGlobal();
}
+
crc = CRC_Block(buf, com_filesize);
}
- // make sure nothing got trashed
- //Mem_CheckSentinelsGlobal();
-
// allocate a new model
loadmodel = mod;
Mem_Free(buf);
- // make sure nothing got trashed
- //Mem_CheckSentinelsGlobal();
-
return mod;
}
*/
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)
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);
-}
-*/
//=============================================================================
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)
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:
else
Host_Error ("Mod_LoadSpriteModel: %s has wrong version number (%i should be 1 (quake) or 32 (sprite32) or 2 (halflife)", loadmodel->name, version);
}
+
};
int net_numlandrivers = 1;
+
{
length = sfunc.Read (sock->socket, (qbyte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr);
-// if ((rand() & 255) > 220)
-// continue;
-
if (length == 0)
break;
{
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);
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);
// 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;
}
break;
return ret;
}
+
else
loop_server = NULL;
}
+
#include "quakedef.h"
qsocket_t *net_activeSockets = NULL;
-//qsocket_t *net_freeSockets = NULL;
-//int net_numsockets = 0;
mempool_t *net_mempool;
qboolean ipxAvailable = false;
{
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
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);
}
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");
- */
}
{
int i;
int controlSocket;
- // LordHavoc: sockets are dynamically allocated now
- //qsocket_t *s;
i = COM_CheckParm ("-port");
if (!i)
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");
proc->next = pp;
prev->next = proc;
}
+
return 0;
}
-//=============================================================================
#include "net_loop.h"
#include "net_dgrm.h"
-//#include "net_ser.h"
net_driver_t net_drivers[MAX_NET_DRIVERS] =
{
};
int net_numlandrivers = 2;
+
return 0;
}
-//=============================================================================
return 0;
}
-//=============================================================================
#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"};
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)
{
host_basepal[i] = temp[host_basepal[i]];
Palette_Setup8to24();
-// Palette_Setup15to8();
}
+
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)
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)
{
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);
// 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);
return false;
}
+
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
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);
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);
*/
void PF_break (void)
{
-// Con_Printf ("break statement\n");
-// *(int *)-4 = 0; // dump to debugger
PR_RunError ("break statement");
}
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;
builtin_t *pr_builtins = pr_builtin;
int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
+
}
-/*
-eval_t *GetEdictFieldValue(edict_t *ed, char *field)
-{
- ddef_t *def = NULL;
- int i;
- static int rep = 0;
-
- for (i=0 ; i<GEFV_CACHESIZE ; i++)
- {
- if (!strcmp(field, gefvCache[i].field))
- {
- def = gefvCache[i].pcache;
- goto Done;
- }
- }
-
- def = ED_FindField (field);
-
- if (strlen(field) < MAX_FIELD_LEN)
- {
- gefvCache[rep].pcache = def;
- strcpy (gefvCache[rep].field, field);
- rep ^= 1;
- }
-
-Done:
- if (!def)
- return NULL;
-
- return (eval_t *)((char *)&ed->v + def->ofs*4);
-}
-*/
-
/*
============
PR_ValueString
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)
{
b = b / pr_edict_size;
return b;
}
+
#include "quakedef.h"
-/*
-
-*/
-
typedef struct
{
int s;
}
}
}
+
// (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;
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)
else
return -1;
}
+
# include <unistd.h>
#endif
-//#ifdef _MSC_VER
-//# define _POSIX_
-//#endif
-
#include <stdarg.h>
#include <stdlib.h>
#include <limits.h>
{
quakeio_mempool = Mem_AllocPool("file management");
}
+
// 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;
#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;
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)
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)
{
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;
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;
if (pavailedge + numverts > clipedgesend)
return;
-#if 1
for (i = 0;i < numverts;i++)
{
vx = tempverts2[i][0] - r_origin[0];
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;
pavailsurf++;
}
-/////////////////////////////////////////////////////////////////////
// Scan all the edges in the global edge table into spans.
-/////////////////////////////////////////////////////////////////////
void ScanEdges (void)
{
int y, rescan;
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)
{
{
psurf2 = psurf2->next;
w2 = psurf2->wcurrent + psurf2->wstepx * fx;
-// if (w2 < 0 && psurf2 != &surfstack)
-// w2 = 0;
}
while (w < w2);
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];
callback, nativedata, nativedata2, &clipboxplane[5]
);
}
+
+
#include "quakedef.h"
cvar_t crosshair_brightness = {CVAR_SAVE, "crosshair_brightness", "1"};
#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];
void r_explosion_newmap(void)
{
memset(explosion, 0, sizeof(explosion));
-// memset(explosiongas, 0, sizeof(explosiongas));
}
int R_ExplosionVert(int column, int row)
// 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;
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;
{
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;
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;
{
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)
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]);
}
+
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);
}
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;
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);
}
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;
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)
}
}
-/*
-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)
{
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;
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;
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:
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;
}
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);
startz = mid;
distz = endz - startz;
goto loc0;
-// return RecursiveLightPoint (color, node->children[side ^ 1], x, y, mid, endz);
}
}
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;
}
nearlight[MAX_DLIGHTS], *nl;
int modeldlightbits[8];
- //staticlight_t *sl;
mlight_t *sl;
a = currentrenderentity->alpha;
if (currentrenderentity->effects & EF_FULLBRIGHT)
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)
}
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++;
}
}
}
{
av = aliasvert;
avn = aliasvertnorm;
- //hardness = r_lightmodelhardness.value;
- //hardnessoffset = (1.0f - hardness);
for (i = 0;i < numverts;i++)
{
VectorCopy(basecolor, color);
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;
}
}
}
+
rendermodule[i].newmap();
}
}
+
+
#include "quakedef.h"
void LoadSky_f(void);
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)
{
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);
- */
}
+
+
#include "quakedef.h"
-// LordHavoc: disabled lerping
#define LERPSPRITES
#ifdef LERPSPRITES
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;
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;
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);
GL_DrawSpriteImage(true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * currentrenderentity->alpha);
#endif
}
+
}
-
/*
===============
Sbar_SoloScoreboard
pic = Draw_CachePic ("gfx/finale.lmp");
DrawQ_Pic((vid.conwidth - pic->width)/2, 16, "gfx/finale.lmp", 0, 0, 1, 1, 1, 1, 0);
}
+
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
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;
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;
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"};
Cvar_RegisterVariable(&nosound);
Cvar_RegisterVariable(&precache);
-// Cvar_RegisterVariable(&loadas8bit);
Cvar_RegisterVariable(&bgmbuffer);
Cvar_RegisterVariable(&ambient_level);
Cvar_RegisterVariable(&ambient_fade);
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));
// 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");
continue;
}
}
-
-
}
//
ch = channels;
for (i=0 ; i<total_channels; i++, ch++)
if (ch->sfx && (ch->leftvol || ch->rightvol) )
- {
- //Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name);
total++;
- }
Con_Printf ("----(%i)----\n", total);
}
// 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;
}
// 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);
}
//=============================================================================
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)
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);
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))
{
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");
data_p += 24;
i = GetLittleLong (); // samples in loop
info.samples = info.loopstart + i;
-// Con_Printf("looped length: %i\n", i);
}
}
}
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
}
void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
{
-// int data;
int *lscale, *rscale;
unsigned char *sfx;
int i;
void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
{
-// int data;
-// int left, right;
int leftvol, rightvol;
signed short *sfx;
int i;
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;
}
memset(lpData, 0, dwSize);
-// lpData[4] = lpData[5] = 0x7f; // force a pop for debugging
pDSBuf->lpVtbl->Unlock(pDSBuf, lpData, dwSize, NULL, 0);
snd_firsttime = false;
if (!dsound_init && !wav_init)
- {
-// if (snd_firsttime)
-// Con_SafePrintf ("No sound device initialized\n");
-
return 0;
- }
return 1;
}
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-// r_light.c
#include "quakedef.h"
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:
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;
}
startz = mid;
distz = endz - startz;
goto loc0;
-// return RecursiveLightPoint (color, node->children[side ^ 1], x, y, mid, endz);
}
}
color[0] = color[1] = color[2] = 0;
SV_RecursiveLightPoint (color, sv.worldmodel->nodes, p[0], p[1], p[2], p[2] - 65536);
}
+
// 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;
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;
bits = 0;
- //if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT)
- bits |= SU_VIEWHEIGHT;
+ bits |= SU_VIEWHEIGHT;
if (ent->v.idealpitch)
bits |= SU_IDEALPITCH;
if (ent->v.armorvalue)
bits |= SU_ARMOR;
-// if (ent->v.weapon)
- bits |= SU_WEAPON;
+ bits |= SU_WEAPON;
if (bits >= 65536)
bits |= SU_EXTEND1;
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
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;
Con_DPrintf ("Server spawned.\n");
}
+
if (relink)
SV_LinkEdict (ent, true);
ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
-// Con_Printf ("fall down\n");
return true;
}
}
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
*/
void SV_FixCheckBottom (edict_t *ent)
{
-// Con_Printf ("SV_FixCheckBottom\n");
-
ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND;
}
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
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])
{
{ // go along the crease
if (numplanes != 2)
{
-// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorClear(ent->v.velocity);
return 7;
}
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])
|| 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
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;
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])
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 ; i<num_moved ; i++)
{
VectorCopy (moved_from[i], moved_edict[i]->v.origin);
if ( fabs(oldorg[1] - ent->v.origin[1]) > 4
|| fabs(oldorg[0] - ent->v.origin[0]) > 4 )
{
-//Con_DPrintf ("unstuck!\n");
return clip;
}
//============================================================================
-/*
-=============
-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
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);
}
trace_t trace;
vec3_t move;
edict_t *groundentity;
- //edict_t *groundentity;
+
// regular thinking
if (!SV_RunThink (ent))
return;
}
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
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);
pr_global_struct->time = sv.time;
PR_ExecuteProgram (pr_global_struct->StartFrame, "QC function StartFrame is missing");
-//SV_CheckAllEnts ();
-
//
// treat each object in turn
//
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);
trace.fraction = 0; // not relevant
return trace;
}
+
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;
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;
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;
return false;
case clc_nop:
-// Sys_Printf ("clc_nop\n");
break;
case clc_stringcmd:
}
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:
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);
void floating_point_exception_handler(int whatever)
{
-// Sys_Warn("floating point exception\n");
signal(SIGFPE, floating_point_exception_handler);
}
double oldtime, newtime;
-// static char cwd[1024];
-
-// signal(SIGFPE, floating_point_exception_handler);
signal(SIGFPE, SIG_IGN);
memset(&host_parms, 0, sizeof(host_parms));
}
return 0;
}
+
#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];
void Sys_Shared_LateInit(void)
{
}
+
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;
*/
-/*
-==================
-WinMain
-==================
-*/
void SleepUntilInput (int time)
{
-
MsgWaitForMultipleObjects(1, &tevent, false, time, QS_ALLINPUT);
}
softwaretransformset(r->origin, angles, r->scale);
}
}
+
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);
}
}
+
printf("Received signal %d, exiting...\n", sig);
Host_Shutdown();
abort();
- //Sys_Quit();
exit(0);
}
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);
}
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)
void VID_HandlePause (qboolean pause)
{
}
+
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;
static int scr_width, scr_height;
static XF86VidModeModeInfo **vidmodes;
-//static int default_dotclock_vidmode;
static int num_vidmodes;
static qboolean vidmode_active = false;
/*-----------------------------------------------------------------------*/
static int
-XLateKey(XKeyEvent *ev/*, qboolean modified*/)
+XLateKey(XKeyEvent *ev)
{
-// char tmp[2];
int key = 0;
KeySym keysym;
{
/* ASCII keys */
key = keysym;
- if (/*!modified && */((key >= 'A') && (key <= 'Z')))
+ if ((key >= 'A') && (key <= 'Z'))
key = key + ('a' - 'A');
}
break;
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);
mouse_active = true;
mouse_x = mouse_y = 0;
-
-// XSync(vidx11_display, True);
}
static void uninstall_grabs(void)
static void HandleEvents(void)
{
XEvent event;
-// KeySym ks;
qboolean dowarp = false;
if (!vidx11_display)
}
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;
}
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);
GLX_DEPTH_SIZE, 1,
None
};
-// char gldir[MAX_OSPATH];
int width = 640, height = 480;
XSetWindowAttributes attr;
unsigned long mask;
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)
mouse_y = 0;
}
-
Cvar_RegisterVariable(&m_filter);
Cmd_AddCommand("force_centerview", Force_CenterView_f);
}
+
static vmode_t modelist[MAX_MODE_LIST];
static int nummodes;
-//static vmode_t *pcurrentmode;
static vmode_t badmode;
static DEVMODE gdevmode;
//====================================
-// 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;
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)
// 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");
VID_UpdateWindowStatus ();
CDAudio_Resume ();
-// scr_disabled_for_loading = temp;
if (!stat)
Sys_Error ("Couldn't set video mode");
if (!msg_suppress_1)
Con_SafePrintf ("Video mode %s initialized.\n", VID_GetModeDescription (vid_modenum));
-// vid.recalc_refdef = 1;
-
return true;
}
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
-};
-*/
/*
=======
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];
}
{
if (modestate == MS_FULLDIB)
{
-// usingmouse = true;
-// IN_ActivateMouse ();
-// IN_HideMouse ();
if (vid_canalttab && vid_wassuspended)
{
vid_wassuspended = false;
// 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();
}
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();
}
}
*/
void VID_NumModes_f (void)
{
-
if (nummodes == 1)
Con_Printf ("%d video mode is available\n", nummodes);
else
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
void VID_InitFullDIB (HINSTANCE hInstance)
{
DEVMODE devmode;
-// int i;
int modenum;
int originalnummodes;
-// int existingmode;
int numlowresmodes;
int j;
int bpp;
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<nummodes ; i++)
- {
- if ((modelist[nummodes].width == modelist[i].width) && (modelist[nummodes].height == modelist[i].height) && (modelist[nummodes].bpp == modelist[i].bpp))
- {
- existingmode = 1;
- break;
- }
- }
-
- if (!existingmode)
- nummodes++;
- */
}
}
if (ChangeDisplaySettings (&devmode, CDS_TEST | CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
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);
-
- for (i=originalnummodes, existingmode = 0 ; i<nummodes ; i++)
- {
- if ((modelist[nummodes].width == modelist[i].width) && (modelist[nummodes].height == modelist[i].height) && (modelist[nummodes].bpp == modelist[i].bpp))
- {
- existingmode = 1;
- break;
- }
- }
-
- if (!existingmode)
- nummodes++;
- }
- */
}
switch (bpp)
{
void VID_Init (void)
{
int i;
-// int existingmode;
int basenummodes, width, height = 0, bpp, findbpp, done;
HDC hdc;
DEVMODE devmode;
memset(&devmode, 0, sizeof(devmode));
-// Cvar_RegisterVariable (&_vid_default_mode);
-// Cvar_RegisterVariable (&_vid_default_mode_win);
-
Cmd_AddCommand ("vid_nummodes", VID_NumModes_f);
Cmd_AddCommand ("vid_describecurrentmode", VID_DescribeCurrentMode_f);
Cmd_AddCommand ("vid_describemode", VID_DescribeMode_f);
// if they want to force it, add the specified mode to the list
if (COM_CheckParm("-force") && (nummodes < MAX_MODE_LIST))
VID_AddMode(MS_FULLDIB, width, height, 0, 0, 1, 1, bpp);
- /*
- {
- modelist[nummodes].type = MS_FULLDIB;
- modelist[nummodes].width = width;
- modelist[nummodes].height = height;
- modelist[nummodes].modenum = 0;
- modelist[nummodes].halfscreen = 0;
- modelist[nummodes].dib = 1;
- modelist[nummodes].fullscreen = 1;
- modelist[nummodes].bpp = bpp;
- sprintf (modelist[nummodes].modedesc, "%dx%dx%d", devmode.dmPelsWidth, devmode.dmPelsHeight, devmode.dmBitsPerPel);
-
- for (i=nummodes, existingmode = 0 ; i<nummodes ; i++)
- {
- if ((modelist[nummodes].width == modelist[i].width) && (modelist[nummodes].height == modelist[i].height) && (modelist[nummodes].bpp == modelist[i].bpp))
- {
- existingmode = 1;
- break;
- }
- }
-
- if (!existingmode)
- nummodes++;
- }
- */
done = 0;
if (strncasecmp(gl_renderer,"Matrox G200 Direct3D",20)==0) // a D3D driver for GL? sigh...
isG200 = true;
-// sprintf (gldir, "%s/glquake", com_gamedir);
-// Sys_mkdir (gldir);
-
vid_realmode = vid_modenum;
vid_menudrawfn = VID_MenuDraw;
break;
}
}
+
side = fabs(side);
value = cl_rollangle.value;
-// if (cl.inwater)
-// value *= 6;
if (side < cl_rollspeed.value)
side = side * value / cl_rollspeed.value;
// (don't count Z, or jumping messes it up)
bob = sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]) * cl_bob.value;
- //Con_Printf ("speed: %5.1f\n", VectorLength(cl.velocity));
bob = bob*0.3 + bob*0.7*sin(cycle);
bob = bound(-7, bob, 4);
return bob;
void V_StartPitchDrift (void)
{
-#if 1
if (cl.laststop == cl.time)
- {
return; // something else is keeping it from drifting
- }
-#endif
+
if (cl.nodrift || !cl.pitchvel)
{
cl.pitchvel = v_centerspeed.value;
move = cl.frametime * cl.pitchvel;
cl.pitchvel += cl.frametime * v_centerspeed.value;
-//Con_Printf ("move: %f (%f)\n", move, cl.frametime);
-
if (delta > 0)
{
if (move > delta)
}
-
-
-
/*
==============================================================================
Cvar_RegisterVariable (&v_kickpitch);
}
-
if (!strcmp(clean, lump->name))
return (void *)(wad_base + lump->filepos);
- //Sys_Error ("W_GetLumpinfo: %s not found", name);
return NULL;
}
// 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)
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++)
{
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++)
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
image_width = image_height = 0;
return NULL;
}
+
*/
-/*
-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)))
//============================================================================
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)
// 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)
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)
return clip.trace;
}
+
mempool_t *_Mem_AllocPool(char *name, char *filename, int fileline)
{
-// int i;
mempool_t *pool;
pool = malloc(sizeof(mempool_t));
if (pool == NULL)
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;