removed _windowed_mouse hell

This commit is contained in:
eukos 2015-08-01 21:08:49 +02:00
parent 82f47c0d0d
commit b4639d533f
7 changed files with 112 additions and 401 deletions

View file

@ -850,8 +850,6 @@ void CL_RelinkEntities (void)
dl->origin[2] += 16;
dl->radius = 400 + (rand()&31);
dl->die = cl.time + 0.001;
// if (r_flares->value > 1)
// R_FlareInstant2(ent->origin, 4, 135, 135, 65); // we moved it to dynamic lights now
}
if (ent->effects & EF_FLAME)
@ -867,8 +865,6 @@ void CL_RelinkEntities (void)
R_RocketTrail (oldorg, ent->origin, 1);
dl->radius = 200;
dl->die = cl.time + 0.01;
// if (r_flares->value > 1)
// R_FlareInstant2(ent->origin, 4, 145, 65, 22); // we moved it to dynamic lights now
}
if (ent->effects & EF_DIMLIGHT)
{

View file

@ -319,9 +319,6 @@ void R_LoadRTLights(void)
}
}
/*
=================
Mod_LoadTextures

View file

@ -1704,6 +1704,7 @@ void R_FlareTest (vec3_t org, int decframe, int colr, int colg, int colb, float
int gonnadie = 0;
float initialalpha;
trace_t tarce;
if (!r_flares->value)
return; // don't draw flares if we don't want flares.
decframe = 12;
@ -1714,44 +1715,18 @@ void R_FlareTest (vec3_t org, int decframe, int colr, int colg, int colb, float
else
ownin = 1;
if (ownin)
if (ownme->ourparticle)
if (ownin && ownme->ourparticle)
return; //we got one.
// determine if we've spawned in a wall like an idiot would do.
mleaf_t *o;
o = Mod_PointInLeaf (org, cl.worldmodel);
if (o->contents != CONTENTS_EMPTY )
return;
{
mleaf_t *o;
o = Mod_PointInLeaf (org, cl.worldmodel);
if (o->contents != CONTENTS_EMPTY )
return;
}
// else
{
// tarce = Particle_TraceLine(org, r_refdef.vieworg);
// if(tarce.fraction < 1)
/* if(p->amiseen)
initialalpha = 0;
else{
if (gonnjardie)
initialalpha = gonnjardie;
else
initialalpha = 1;
}
*/
}
//if (){
// place each flare with their personal values!
for (i=0 ; i<count ; i++)
{
if (!free_flares)
@ -1764,8 +1739,8 @@ void R_FlareTest (vec3_t org, int decframe, int colr, int colg, int colb, float
p->frame = decframe;
p->blend = 5;
// if (gonnjardie)
D_TestOurFlare(p);
if(!p->amiseen)
initialalpha = 0;
else{
@ -1777,36 +1752,30 @@ void R_FlareTest (vec3_t org, int decframe, int colr, int colg, int colb, float
// determine color. we are going to use gelmaps for flares.
gmcol = BestColor(colr, colg, colb, 12, 222); // determine color from bestcoloring
// gmcol = 27;
p->polor = gmcol;
p->color = gmcol;
// if (ownme != NULL)
if (ownin){
p->owner = ownme;
// p->oldmodel = ownme->model;
p->owner = ownme;
}
// determine initial visibility first so we don't see exploded flares on spawn
{
if((Traceline(p->org, r_refdef.vieworg, NULL, NULL)))
p->alpha = 1.0f;
p->alpha = 1.0f;
else
p->alpha = 0.02f;
p->alpha = 0.02f;
}
// p->splatter = 0;
//
p->blend = 5;
p->sprtype = 5;
p->angles[2] = 0; // will random these.
p->alpha = initialalpha;
if (ownin){
p->owner = ownme;
ownme->ourparticle = p;
p->owned = 1; // OWNED.
p->owner = ownme;
ownme->ourparticle = p;
p->owned = 1; // OWNED.
}
p->alphavel = 0;
p->scalexvel = 0;
p->scaleyvel = 0;
@ -1817,115 +1786,16 @@ void R_FlareTest (vec3_t org, int decframe, int colr, int colg, int colb, float
p->type = pt_flare;
p->scale = 0;
p->scaley = p->scale;
{
p->die = cl.time + 7500; // for EVER!
p->die = cl.time + 7500; // for EVER!
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j];
p->vel[j] = 0;
}
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j];
p->vel[j] = 0;
}
//Con_Printf("FAT!!! %f %f %f\n", p->org[0], p->org[1], p->org[2] );
}
}
void R_FlareInstant2 (vec3_t org, int decframe, int colr, int colg, int colb, float alpfer)
{
int i, j;
flare_t *p;
int nexte = 1;
int count = 1;
int gmcol;
int ownin;
int gonnadie = 0;
float initialalpha;
trace_t tarce;
#ifndef GLQUAKE
if (!r_flares->value && reflectpass)
return; // don't draw flares if we don't want flares.
#endif
decframe = 12;
{
trace_t tarce;
tarce = Particle_TraceLine(org, r_refdef.vieworg);
if(tarce.fraction < 1)
return;
}
// return;
/*
// determine if we've spawned in a wall like an idiot would do.
{
mleaf_t *o;
o = Mod_PointInLeaf (org, cl.worldmodel);
if (o->contents != CONTENTS_EMPTY )
return;
}
*/
if (!free_flares)
return;
p = free_flares;
free_flares = p->next;
p->next = active_flares;
p->owner = NULL;
active_flares = p;
p->frame = 12;
p->blend = 5;
gmcol = BestColor(colr, colg, colb, 12, 222); // determine color from bestcoloring
p->polor = gmcol;
p->color = gmcol;
p->sprtype = 5;
p->angles[2] = 0; // will random these.
if (alpfer)
p->alpha = alpfer;
else
p->alpha = 1.0f;
p->alphavel = 0;
p->owned = 0;
p->scalexvel = 0;
p->scaleyvel = 0;
p->anglevel[0] = 0;
p->anglevel[1] = 0;
p->anglevel[2] = 0;
p->scale = 0.1;
p->type = pt_flare_will_die;
p->scaley = p->scale;
{
p->die = cl.time + 0.001; // for now
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j];
p->vel[j] = 0;
}
}
//Con_Printf("FAT!!! %f %f %f\n", p->org[0], p->org[1], p->org[2] );
}
// --------------------
// Used for the engine splash calls (by r_particle_splash)
// --------------------
@ -2030,8 +1900,6 @@ void R_LavaSplash (vec3_t org)
}
}
/*
===============
R_Blood
@ -3164,12 +3032,8 @@ vec3_t move;
dec = 0.75;
VectorScale (vec, dec, vec);
VectorCopy (start, move);
}
void R_SpiralBloodTrail (vec3_t start, vec3_t end)
{
vec3_t move;
@ -3240,10 +3104,8 @@ vec3_t move;
// dec = 8;
VectorScale (vec, dec, vec);
VectorCopy (start, move);
}
/*
===============
R_DrawParticles
@ -4438,18 +4300,10 @@ void R_TestFlares (void)
// turn your back towards it, move to next room, then turn back to see it
// fade away late
D_TestOurFlare(p); // lets do it
}
}
}
void R_DrawFlares (void)
{
flare_t *p, *kill;
@ -4463,17 +4317,15 @@ void R_DrawFlares (void)
int amiseen;
#ifndef GLQUAKE
VectorScale (vright, xscaleshrink, r_pright);
VectorScale (vup, yscaleshrink, r_pup);
VectorCopy (vpn, r_ppn);
#endif
frametime = cl.time - cl.oldtime;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;
grav = frametime * sv_gravity->value * 0.05;
// dvel = 4*frametime;
for ( ;; )
{
@ -4505,79 +4357,59 @@ void R_DrawFlares (void)
}
break;
}
#ifndef GLQUAKE
if (!reflectpass)
#endif
{
p->org[0] += p->vel[0] * frametime;
p->org[1] += p->vel[1] * frametime;
p->org[2] += p->vel[2] * frametime;
p->alpha += frametime*p->alphavel;
p->scale += frametime*p->scalexvel;
p->scaley += frametime*p->scaleyvel;
p->angles[2] += frametime*p->anglevel[2];
p->org[0] += p->vel[0] * frametime;
p->org[1] += p->vel[1] * frametime;
p->org[2] += p->vel[2] * frametime;
p->alpha += frametime*p->alphavel;
p->scale += frametime*p->scalexvel;
p->scaley += frametime*p->scaleyvel;
p->angles[2] += frametime*p->anglevel[2];
if (p->alpha < 0.06 && p->alphavel && !(p->type==pt_flare))
p->die = -1;
else if (p->alpha < 0.06 && p->alphavel && (p->type==pt_flare))
p->alpha = 0.06;
if (p->alpha > 1.1)
p->alpha = 1.1;
if (p->scale < 0)
p->die = -1;
if (p->scaley < 0)
p->die = -1;
}
{
int there;
int u1, v1, z1;
int eh;
int u2, v2, z2 = 88;
vec3_t hi;
trace_t yourface;
vec3_t forward, left, up;
AngleVectors(r_refdef.viewangles, forward, left, up);
VectorCompare(yourface.endpos,r_refdef.vieworg);
// Removing an entity's flare
if (p->owned){
if (p->owner) // stops a crash
if (p->alpha < 0.06 && p->alphavel && !(p->type==pt_flare))
p->die = -1;
else if (p->alpha < 0.06 && p->alphavel && (p->type==pt_flare))
p->alpha = 0.06;
if (p->alpha > 1.1)
p->alpha = 1.1;
if (p->scale < 0)
p->die = -1;
if (p->scaley < 0)
p->die = -1;
int there;
int u1, v1, z1;
int eh;
int u2, v2, z2 = 88;
vec3_t hi;
trace_t yourface;
vec3_t forward, left, up;
AngleVectors(r_refdef.viewangles, forward, left, up);
VectorCompare(yourface.endpos,r_refdef.vieworg);
// Removing an entity's flare
if (p->owned && p->owner){
if (p->oldmodel != p->owner->model){
p->owner->gotaflare = 0;
p->owner->ourparticle = NULL;
p->owner = NULL;
// Con_Printf("old model isnt the same.\n");
p->die = -1; // oh.....noooooooooo
}
if (p->owner){
p->org[0] = p->owner->origin[0];
p->org[1] = p->owner->origin[1];
p->org[2] = p->owner->origin[2];
}
}
for(eh=0; eh<3; eh++){
forward[eh] *= 350;
left[eh] *= -380; // 380
up[eh] *= 135;
}
p->org[0] = p->owner->origin[0];
p->org[1] = p->owner->origin[1];
p->org[2] = p->owner->origin[2];
}
// scale the (glquake particle code repurposed :) )
#ifndef GLQUAKE
if (reflectpass)
{
for(eh=0; eh<3; eh++){
forward[eh] *= 350;
left[eh] *= -380; // 380
up[eh] *= 135;
}
if (reflectpass)
{
p->scale = (p->org[0] - r_refdef.vieworg[0])*vpn[0] + (p->org[1] - r_refdef.vieworg[1])*vpn[1]
+ (p->org[2] - r_refdef.vieworg[2])*vpn[2];
if (p->scale < 50)
@ -4587,11 +4419,9 @@ void R_DrawFlares (void)
p->scaley = p->scale * 5;
p->sprtype = SPR_VP_PARALLEL_UPRIGHT;
}
}
else
#endif
{
{
p->scale = (p->org[0] - r_refdef.vieworg[0])*vpn[0] + (p->org[1] - r_refdef.vieworg[1])*vpn[1]
+ (p->org[2] - r_refdef.vieworg[2])*vpn[2];
if (p->scale < 50)
@ -4601,68 +4431,36 @@ void R_DrawFlares (void)
p->scaley = p->scale;
p->sprtype = 5;
}
// traceline to player to check visibility of flare!
#ifndef GLQUAKE
if (!reflectpass)
#endif
{
// old traceline method:
/* {
trace_t tarce;
tarce = Particle_TraceLine(p->org, r_refdef.vieworg);
if(tarce.fraction < 1)
amiseen = 0;
else
amiseen = 1;
}
*/
// new z check
//amiseen = 0;
//D_TestOurFlare(p);
if (p->amiseen)
{
int sweetch;
//p->alphavel = 1.8;
// lightstyles hack - to check if our light is 'off' we'll use
// lightpoint.
sweetch = R_LightPoint (p->org);
if (sweetch < 16)
p->alphavel = -1.74;
else
p->alphavel = 1.8;
}
else
{
p->alphavel = -1.74;
}
}
// leilei - particle sprites
// if (p->frame && r_particlesprite->value && !particletypeonly)
// new z check
if (p->amiseen)
{
int sweetch;
sweetch = R_LightPoint (p->org);
if (sweetch < 16)
p->alphavel = -1.74;
else
p->alphavel = 1.8;
}
else
{
p->alphavel = -1.74;
}
model_t *hello;
if ((p->model = Mod_ForName("particle.spr", false)))
{
model_t *hello;
if ((p->model = Mod_ForName("particle.spr", false)))
{
currentflare = p;
VectorCopy(p->org, r_entorigin);
VectorSubtract(r_origin, r_entorigin, modelorg);
R_DrawSprite3();
}
}
}
}
}
// Stupid function for entities with instant flares to try and fade them out like normal flares!!
void R_FlareEntityAlphaMakeCheckDoStuff (vec3_t checkhere, float fe, float fi)
void R_FlareEntityAlphaMakeCheckDoStuff (vec3_t checkhere, float fe, float fi)
{
trace_t tarce;
@ -4673,29 +4471,26 @@ void R_FlareEntityAlphaMakeCheckDoStuff (vec3_t checkhere, float fe, float fi)
time1 = frametime * 5;
if (!fe)
fe = 1.0f;
//if (currententity->flalpha < 0.06 && currententity->flalphavel)
// currententity->flalpha = 0.01;
if (fe < 0.06)
fe = 0.06;
fe = 0.06;
if (fe > 1.1)
fe = 1.1;
fe = 1.1;
tarce = Particle_TraceLine(checkhere, r_refdef.vieworg);
if(tarce.fraction < 1)
fi = -1.74;
else{
fi = 1.8;
}
if(tarce.fraction < 1)
fi = -1.74;
else{
fi = 1.8;
}
fe += frametime*fi;
fe += frametime*fi;
};
}

View file

@ -289,35 +289,6 @@ Con_Printf("\nSound Initialization\n");
ambient_sfx[AMBIENT_WATER] = S_PrecacheSound ("ambience/water1.wav");
ambient_sfx[AMBIENT_SKY] = S_PrecacheSound ("ambience/wind2.wav");
#ifdef DUMB
// FIXME: DUMB ISNT EVEN IMPLEMENTED PROPERLY!
dumb_register_stdfiles(); // eww! stds!
dumb_it_max_to_mix = 64;
/*
// you don't have testeng so this will crash. get your own damn mod files
//duh = dumb_load_mod("testeng/sound/cdtracks/track004.mod");
if(thesong)
duh = dumb_load_mod("testeng/sound/cdtracks/track004.mod");
if (!duh) {
Con_Printf("DUH OUCH! CAN NOT LOAD THE DUMB MOD!\n");
}
else
Con_Printf("YES..... I CAN\n");
sr = duh_start_sigrenderer(duh, 0, 2, 0);
if (!sr) {
unload_duh(duh);
Con_Printf("DUH OUCH! can't play into the dumb buffer! goh dumb it!\n");
}
else
Con_Printf("THE SIGRENDERER'S STARTED.\n");
//register_dumbfile_system(&duhfile);
*/
#endif
#ifdef ASS_MIDI
// It's 2010 and we're still using MIDI!?
@ -346,6 +317,8 @@ void S_Shutdown(void)
#ifdef ASS_MIDI
MUSIC_Shutdown();
#endif
Tracker_Shutdown();
shm = 0;
sound_started = 0;
@ -834,6 +807,7 @@ void S_StopAllSounds(qboolean clear)
#ifdef ASS_MIDI
MUSIC_StopSong();
Tracker_Stop();
#endif
total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS; // no statics

View file

@ -592,50 +592,3 @@ void SND_PaintChannelFrom16_II(channel_t *ch, sfxcache_t *sc, int count)
if ((ch->pos >> 8) >= sc->length) break;
}
}
union {
short s16[8192];
char s8[16384];
} suffer;
void SND_PaintDumb(int count)
{
int data;
int left, right;
int leftvol, rightvol;
signed short *sfx;
//DUH *sptr [2048];
int i;
int verb, arb; // leilei
// leftvol = ch->leftvol;
// rightvol = ch->rightvol;
// put the dumb thing in
// duh_render(sr,16,0,1 ,0, 2048, sptr);
// duh_start_sigrenderer(duh, 0, 1, 0);
// duh_sigrenderer_generate_samples(sr, 0, 1, ltime, 0);
// duh_render(44100,16,0,1 ,0, 16384, suffer);
// duh_start_sigrenderer(duh, 0, 1, 0);
// duh_sigrenderer_generate_samples(sr, 0, 1, count, 0);
Con_Printf("painting dumb\n");
for (i = 0; i < count; i++)
{
// data = sfx[ch->pos >> 8]; //@@@
// left = (data * leftvol) >> 8;
// right = (data * rightvol) >> 8;
//
// paintbuffer[i].left += left;
// paintbuffer[i].right += right;
//@@@
// ch->pos += ch->step;
// if ((ch->pos >> 8) >= sc->length) break;
}
}

View file

@ -53,7 +53,7 @@ extern cvar_t *midivolume;
union {
short s16[2048]; // was 8192
char s8[4096]; // was twice as the thing above
} buffer;
} tracker_buffer;
void Tracker_Play(byte track, qboolean looping)
{
@ -175,17 +175,17 @@ void Tracker_Update(void)
trackervolume = midivolume->value;
// Render the song
int l = duh_render(sr, depth, unsign, trackervolume, delta, bufsize, &buffer);
int l = duh_render(sr, depth, unsign, trackervolume, delta, bufsize, &tracker_buffer);
if (depth == 16) { // On 16 bit, fill the buffer accordingly
for (i = 0; i < l * n_channels; i++) {
short val = buffer.s16[i];
buffer.s8[i*2] = (char)val;
buffer.s8[i*2+1] = (char)(val >> 8);
short val = tracker_buffer.s16[i];
tracker_buffer.s8[i*2] = (char)val;
tracker_buffer.s8[i*2+1] = (char)(val >> 8);
}
}
// TODO: Write this into the engine's soundbuffer instead for speed!
write (oss_device, &buffer, 4096);
write (oss_device, &tracker_buffer, 4096);
}
int Tracker_Init(void)

View file

@ -43,7 +43,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
cvar_t *_windowed_mouse;
cvar_t *m_filter;
float old_windowed_mouse;
@ -923,7 +922,7 @@ void GetEvent(void)
break;
case MotionNotify:
if (_windowed_mouse->value) {
//if (_windowed_mouse->value) {
mouse_x = (float) ((int)x_event.xmotion.x - (int)(vid.width/2));
mouse_y = (float) ((int)x_event.xmotion.y - (int)(vid.height/2));
//printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n",
@ -940,12 +939,12 @@ void GetEvent(void)
|KeyReleaseMask|ExposureMask
|PointerMotionMask|ButtonPressMask
|ButtonReleaseMask);
} else {
/* } else {
mouse_x = (float) (x_event.xmotion.x-p_mouse_x);
mouse_y = (float) (x_event.xmotion.y-p_mouse_y);
p_mouse_x=x_event.xmotion.x;
p_mouse_y=x_event.xmotion.y;
}
}*/
break;
case ButtonPress:
@ -984,18 +983,17 @@ void GetEvent(void)
oktodraw = true;
}
if (old_windowed_mouse != _windowed_mouse->value) {
/*if (old_windowed_mouse != _windowed_mouse->value) {
old_windowed_mouse = _windowed_mouse->value;
if (!_windowed_mouse->value) {
/* ungrab the pointer */
XUngrabPointer(x_disp,CurrentTime);
} else {
} else {*/
/* grab the pointer */
XGrabPointer(x_disp,x_win,True,0,GrabModeAsync,
GrabModeAsync,x_win,None,CurrentTime);
}
}
// }
//}
}
// flushes the given rectangles from the view buffer to the screen
@ -1221,7 +1219,6 @@ IN_Init_Cvars
*/
void IN_Init_Cvars (void)
{
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE|CVAR_ORIGINAL);
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE|CVAR_ORIGINAL);
}
// 2001-09-18 New cvar system by Maddes (Init) end
@ -1230,7 +1227,6 @@ void IN_Init (void)
{
// 2001-09-18 New cvar system by Maddes (Init) start
/*
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE|CVAR_ORIGINAL);
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE|CVAR_ORIGINAL);
*/
// 2001-09-18 New cvar system by Maddes (Init) end