fix without Q2CLIENT/NQPROT build, software renderer with plugins fix, misc fixes

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2298 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-28 21:56:04 +00:00
parent 0127ad7039
commit b720455bb8
8 changed files with 80 additions and 66 deletions

View File

@ -813,6 +813,11 @@ void CLNQ_SendCmd(void)
memset(&independantphysics[0], 0, sizeof(independantphysics[0]));
cl.allowsendpacket = false;
}
#else
void Name_Callback(struct cvar_s *var, char *oldvalue)
{
}
#endif

View File

@ -2162,6 +2162,8 @@ void CL_ParseModellist (qboolean lots)
}
void CL_ProcessUserInfo (int slot, player_info_t *player);
#ifdef Q2CLIENT
void CLQ2_ParseClientinfo(int i, char *s)
{
char *model, *name;
@ -2314,7 +2316,7 @@ void CLQ2_ParseConfigString (void)
UI_StringChanged(i);
#endif
}
#endif
/*

View File

@ -128,11 +128,9 @@ int VARGS Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg)
pic = Draw_SafePicFromWad(name);
else
{
#ifdef RGLQUAKE //GL saves images persistantly (so don't bother with cachepic stuff)
if (qrenderer == QR_OPENGL && Draw_SafeCachePic)
if (Draw_SafeCachePic)
pic = Draw_SafeCachePic(name);
else
#endif
pic = NULL;
}
}
@ -157,12 +155,10 @@ void Plug_DrawReloadImages(void)
continue;
}
if (pluginimagearray[i].picfromwad)
if (Draw_SafePicFromWad)
pluginimagearray[i].pic = Draw_SafePicFromWad(pluginimagearray[i].name);
#ifdef RGLQUAKE
else if (qrenderer == QR_OPENGL)
else if (Draw_SafeCachePic)
pluginimagearray[i].pic = Draw_SafeCachePic(pluginimagearray[i].name);
#endif
else
pluginimagearray[i].pic = NULL;
}

View File

@ -165,6 +165,9 @@ typedef struct
explosion_t cl_explosions[MAX_EXPLOSIONS];
static int explosions_running;
static int beams_running;
sfx_t *cl_sfx_wizhit;
sfx_t *cl_sfx_knighthit;
sfx_t *cl_sfx_tink1;
@ -277,13 +280,24 @@ explosion_t *CL_AllocExplosion (void)
float time;
int index;
for (i=0 ; i<MAX_EXPLOSIONS ; i++)
for (i=0; i < explosions_running; i++)
{
if (!cl_explosions[i].model)
{
cl_explosions[i].firstframe = -1;
cl_explosions[i].framerate = 10;
return &cl_explosions[i];
}
}
if (i == explosions_running && i != MAX_EXPLOSIONS)
{
explosions_running++;
cl_explosions[i].firstframe = -1;
cl_explosions[i].framerate = 10;
return &cl_explosions[i];
}
// find the oldest explosion
time = cl.time;
index = 0;
@ -312,7 +326,7 @@ beam_t *CL_NewBeam (int entity, int tag)
// override any beam with the same entity (unless they used world)
if (entity)
{
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
for (i=0, b=cl_beams; i < beams_running; i++, b++)
if (b->entity == entity && b->tag == tag)
{
return b;
@ -320,13 +334,20 @@ beam_t *CL_NewBeam (int entity, int tag)
}
// find a free beam
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
for (i=0, b=cl_beams; i < beams_running; i++, b++)
{
if (!b->model)
{
return b;
}
}
if (i == beams_running && i != MAX_BEAMS)
{
beams_running++;
return &cl_beams[i];
}
return NULL;
}
#define STREAM_ATTACHED 16
@ -393,7 +414,7 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
// save end position for truelightning
if (ent)
{
for (i = 0; i < MAX_SPLITS; i++)
for (i = 0; i < cl.splitclients; i++)
{
if (ent == (autocam[i]?spec_track[i]:(cl.playernum[i]+1)))
{
@ -2424,11 +2445,12 @@ void CL_UpdateBeams (void)
entity_state_t *st;
float yaw, pitch;
float forward, offset;
int lastrunningbeam = -1;
extern cvar_t cl_truelightning, v_viewheight;
// update lightning
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
for (i=0, b=cl_beams; i < beams_running; i++, b++)
{
if (!b->model)
continue;
@ -2441,6 +2463,8 @@ void CL_UpdateBeams (void)
continue;
}
lastrunningbeam = i;
// if coming from the player, update the start position
if ((b->flags & 1) && b->entity > 0 && b->entity <= MAX_CLIENTS)
{
@ -2600,6 +2624,7 @@ void CL_UpdateBeams (void)
}
}
beams_running = lastrunningbeam+1;
}
/*
@ -2616,11 +2641,14 @@ void CL_UpdateExplosions (void)
int firstframe;
explosion_t *ex;
entity_t *ent;
int lastrunningexplosion = -1;
for (i=0, ex=cl_explosions ; i< MAX_EXPLOSIONS ; i++, ex++)
for (i=0, ex=cl_explosions; i < explosions_running; i++, ex++)
{
if (!ex->model)
continue;
lastrunningexplosion = i;
f = ex->framerate*(cl.time - ex->start);
if (ex->firstframe >= 0)
{
@ -2659,6 +2687,8 @@ void CL_UpdateExplosions (void)
ent->shaderRGBAf[3] = 1.0 - f/(numframes);
ent->flags = ex->flags;
}
explosions_running = lastrunningexplosion + 1;
}
entity_state_t *CL_FindPacketEntity(int num);

View File

@ -956,7 +956,7 @@ qboolean S_IsPlayingSomewhere(sfx_t *s)
int i;
for (si = sndcardinfo; si; si=si->next)
{
for (i = 0; i < MAX_CHANNELS; i++)
for (i = 0; i < si->total_chans; i++)
if (si->channel[i].sfx == s)
return true;
}
@ -999,9 +999,7 @@ void S_StopAllSounds(qboolean clear)
return;
sc->total_chans = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS + NUM_MUSICS; // no statics
for (i=0 ; i<MAX_CHANNELS ; i++)
for (i=0 ; i<sc->total_chans ; i++)
if (sc->channel[i].sfx)
{
s = sc->channel[i].sfx;
@ -1013,6 +1011,8 @@ void S_StopAllSounds(qboolean clear)
}
}
sc->total_chans = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS + NUM_MUSICS; // no statics
Q_memset(sc->channel, 0, MAX_CHANNELS * sizeof(channel_t));
if (clear)
@ -1627,7 +1627,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
prepadl = 0x7fffffff;
for (si = sndcardinfo; si; si=si->next) //make sure all cards are playing, and that we still get a prepad if just one is.
{
for (i = 0; i < MAX_CHANNELS; i++)
for (i = 0; i < si->total_chans; i++)
if (si->channel[i].sfx == &s->sfx)
{
if (prepadl > si->channel[i].pos)
@ -1661,21 +1661,6 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
}
}
/* else if (spare > snd_speed)
{
for (si = sndcardinfo; si; si=si->next)
{
for (i = 0; i < MAX_CHANNELS; i++)
if (si->channel[i].sfx == &s->sfx)
{
break;
}
if (i == MAX_CHANNELS) //this one wasn't playing.
S_StartSoundCard(si, -1, 0, &s->sfx, r_origin, 1, 32767, prepadl);
}
return; //let the slower sound cards catch up. (This shouldn't really happen, but it's possible two cards have slightly different timings but report the same speed)
}*/
newcache = BZ_Malloc(sizeof(sfxcache_t) + (spare+outsamples) * (s->sfxcache->numchannels) * s->sfxcache->width);
memcpy(newcache, s->sfxcache, sizeof(sfxcache_t));
memcpy(newcache->data, s->sfxcache->data + prepadl * (s->sfxcache->numchannels) * s->sfxcache->width, spare * (s->sfxcache->numchannels) * s->sfxcache->width);
@ -1785,7 +1770,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
for (si = sndcardinfo; si; si=si->next)
{
for (i = 0; i < MAX_CHANNELS; i++)
for (i = 0; i < si->total_chans; i++)
if (si->channel[i].sfx == &s->sfx)
{
si->channel[i].pos -= prepadl;
@ -1799,7 +1784,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
}
break;
}
if (i == MAX_CHANNELS) //this one wasn't playing.
if (i == si->total_chans) //this one wasn't playing.
{
S_StartSoundCard(si, -1, 0, &s->sfx, r_origin, 1, 32767, 500);
// Con_Printf("Restarted\n");

View File

@ -53,14 +53,12 @@ void PM_Init (void)
*/
static void PM_AddTouchedEnt (int num)
{
int i;
if (pmove.numtouch == sizeof(pmove.touchindex)/sizeof(pmove.touchindex[0]))
if (pmove.numtouch == MAX_PHYSENTS)
return;
for (i = 0; i < pmove.numtouch; i++)
if (pmove.touchindex[i] == num)
return; // already added
if (pmove.numtouch)
if (pmove.touchindex[pmove.numtouch - 1] == num)
return; // already added
pmove.touchindex[pmove.numtouch] = num;
pmove.numtouch++;
@ -271,9 +269,6 @@ int PM_StepSlideMove (qboolean in_air)
if (!(blocked & BLOCKED_STEP))
return blocked;
//FIXME: "pmove.velocity < 0" ???? :)
// Of course I meant pmove.velocity[2], but I'm afraid I don't understand
// the code's purpose any more, so let it stay just this way for now :) -- Tonik
org = (pmove.velocity < 0) ? pmove.origin : original; // cryptic, eh?
VectorCopy (org, dest);
dest[2] -= pm_stepheight;

View File

@ -77,22 +77,22 @@ typedef struct
} playermove_t;
typedef struct {
float gravity;
float stopspeed;
float maxspeed;
float spectatormaxspeed;
float accelerate;
float airaccelerate;
float wateraccelerate;
float friction;
float waterfriction;
float entgravity;
float bunnyspeedcap;
float ktjump;
qboolean slidefix;
qboolean airstep;
qboolean walljump;
qboolean slidyslopes;
float gravity;
float stopspeed;
float maxspeed;
float spectatormaxspeed;
float accelerate;
float airaccelerate;
float wateraccelerate;
float friction;
float waterfriction;
float entgravity;
float bunnyspeedcap;
float ktjump;
int walljump;
qboolean slidefix;
qboolean airstep;
qboolean slidyslopes;
} movevars_t;

View File

@ -473,19 +473,20 @@ void SWDraw_Init (void)
// add conchars into sw menu cache
swmenu_numcachepics = 0;
strcpy(swmenu_cachepics[swmenu_numcachepics].name, "conchars");
// lame hack but whatever works
strcpy(swmenu_cachepics[swmenu_numcachepics].name, "pics/conchars.pcx");
swmenu_cachepics[swmenu_numcachepics].cache.fake = true;
swmenu_cachepics[swmenu_numcachepics].cache.data = BZ_Malloc(sizeof(qpic_t) + 128*128);
swmenu_cachepics[swmenu_numcachepics].cache.data = BZ_Malloc(sizeof(mpic_t) + 128*128);
{
qpic_t *dat = (qpic_t *)swmenu_cachepics[swmenu_numcachepics].cache.data;
mpic_t *dat = (mpic_t *)swmenu_cachepics[swmenu_numcachepics].cache.data;
// reformat conchars for use in cache
int j;
for (j = 0; j < 128*128; j++)
dat->data[j] = (draw_chars[j] == 255 || !draw_chars[j]) ? draw_chars[j] ^ 255 : draw_chars[j];
((mpic_t*)dat)->width = ((mpic_t*)dat)->height = 128;
((mpic_t*)dat)->flags = 1;
dat->width = dat->height = 128;
dat->flags = 1;
}
swmenu_numcachepics++;