cleanup, change TE_BLOB to TE_TAREXPLOSION in particle sets, change TE_BIGEXPLOSION to TE_TEI_BIGEXPLOSION, fix centerprints/stuffcmds not being written to mvds (maybe), misc fixes

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2310 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-06-02 17:42:36 +00:00
parent 4a38e63e43
commit a10f1f22a6
22 changed files with 360 additions and 289 deletions

View file

@ -2333,7 +2333,7 @@ void CL_ParsePlayerinfo (void)
player_state_t *state, *oldstate;
int num;
int i;
int new;
int newf;
vec3_t org;
lastplayerinfo = num = MSG_ReadByte ();
@ -2453,11 +2453,11 @@ void CL_ParsePlayerinfo (void)
VectorCopy(org, state->origin);
new = MSG_ReadByte ();
if (state->frame != new)
newf = MSG_ReadByte ();
if (state->frame != newf)
{
// state->lerpstarttime = realtime;
state->frame = new;
state->frame = newf;
}
// the other player's last move was likely some time

View file

@ -883,7 +883,7 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_bigexplosion"))
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_tei_bigexplosion"))
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111

View file

@ -974,7 +974,7 @@ Key_SetBinding
*/
void Key_SetBinding (int keynum, int modifier, char *binding, int level)
{
char *new;
char *newc;
int l;
if (modifier == ~0) //all of the possabilities.
@ -1002,10 +1002,10 @@ void Key_SetBinding (int keynum, int modifier, char *binding, int level)
}
// allocate memory for new binding
l = Q_strlen (binding);
new = Z_Malloc (l+1);
Q_strcpy (new, binding);
new[l] = 0;
keybindings[keynum][modifier] = new;
newc = Z_Malloc (l+1);
Q_strcpy (newc, binding);
newc[l] = 0;
keybindings[keynum][modifier] = newc;
bindcmdlevel[keynum][modifier] = level;
}

View file

@ -1405,7 +1405,7 @@ void P_InitParticles (void)
pt_explosion = P_AllocateParticleType("te_explosion");
pt_pointfile = P_AllocateParticleType("pe_pointfile");
pt_entityparticles = P_AllocateParticleType("ef_entityparticles");
pt_blob = P_AllocateParticleType("te_blob");
pt_blob = P_AllocateParticleType("te_tarexplosion");
pt_blood = P_AllocateParticleType("te_blood");
pt_lightningblood = P_AllocateParticleType("te_lightningblood");

View file

@ -611,7 +611,7 @@ char *particle_set_spikeset =
"assoc empcore\n"
"}\n"
"r_part te_blob\n"
"r_part te_tarexplosion\n"
"{\n"
"texture \"particles/emp\"\n"
"count 120\n"
@ -905,7 +905,7 @@ char *particle_set_faithful =
"randomvel 256\n"
"assoc blobexp1b\n"
"}\n"
"r_part te_blob\n"
"r_part te_tarexplosion\n"
"{\n"
"texture \"particles/quake\"\n"
"count 256\n"
@ -1103,7 +1103,7 @@ char *particle_set_highfps =
"}\n"
//the blob tempent is used quite a bit with teamfortress emp grenades.
"r_part te_blob\n"
"r_part te_tarexplosion\n"
"{\n"
"texture \"particles/blob\"\n"
"count 64\n"

View file

@ -277,6 +277,7 @@ void S_Startup (void)
S_Shutdown();
snd_blocked = 0;
snd_speed = 0;
if (!fakedma)
{
@ -345,7 +346,7 @@ void S_Startup (void)
if (sndcardinfo)
{ //if the sample speeds of multiple soundcards do not match, it'll fail.
if (sc->sn.speed != sc->sn.speed)
if (snd_speed != sc->sn.speed)
{
if (!warningmessage)
{

View file

@ -690,7 +690,7 @@ void GLV_UpdatePalette (qboolean force)
{
qboolean ogw;
int i, j;
qboolean new;
qboolean update;
// qbyte *basepal, *newpal;
// qbyte pal[768];
float r,g,b,a;
@ -710,24 +710,24 @@ void GLV_UpdatePalette (qboolean force)
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
cl.cshifts[CSHIFT_BONUS].percent = 0;
new = false;
update = false;
for (i=0 ; i<CSHIFT_SERVER ; i++)
{
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
{
new = true;
update = true;
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
}
for (j=0 ; j<3 ; j++)
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
{
new = true;
update = true;
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
}
}
if (new || force)
if (update || force)
{
GLV_CalcBlend ();
@ -774,14 +774,14 @@ V_UpdatePalette
void SWV_UpdatePalette (qboolean force)
{
int i, j;
qboolean new;
qboolean update;
qbyte *basepal, *newpal;
qbyte pal[768];
int r,g,b;
V_CalcPowerupCshift ();
new = false;
update = false;
for (i=0 ; i<NUM_CSHIFTS ; i++)
{
@ -789,13 +789,13 @@ void SWV_UpdatePalette (qboolean force)
{
if (i == CSHIFT_SERVER)
force = true; // don't let them cheat.
new = true;
update = true;
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
}
for (j=0 ; j<3 ; j++)
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
{
new = true;
update = true;
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
}
}
@ -813,7 +813,7 @@ void SWV_UpdatePalette (qboolean force)
if (r_pixbytes == 4) //doesn't support palette cycling. It messes up caches.
{
if (!new && !force)
if (!update && !force)
return;
basepal = host_basepal;
newpal = pal;
@ -835,7 +835,7 @@ void SWV_UpdatePalette (qboolean force)
D_FlushCaches();
return;
}
if (!new && !force)
if (!update && !force)
return;
basepal = host_basepal;

View file

@ -722,7 +722,7 @@ Z_CheckHeap (); // DEBUG
void *Z_TagMalloc (int size, int tag)
{
int extra;
memblock_t *start, *rover, *new, *base;
memblock_t *start, *rover, *newz, *base;
if (!tag)
Sys_Error ("Z_TagMalloc: tried to use a 0 tag");
@ -754,14 +754,14 @@ void *Z_TagMalloc (int size, int tag)
extra = base->size - size;
if (extra > MINFRAGMENT)
{ // there will be a free fragment after the allocated block
new = (memblock_t *) ((qbyte *)base + size );
new->size = extra;
new->tag = 0; // free block
new->prev = base;
new->id = ZONEID;
new->next = base->next;
new->next->prev = new;
base->next = new;
newz = (memblock_t *) ((qbyte *)base + size );
newz->size = extra;
newz->tag = 0; // free block
newz->prev = base;
newz->id = ZONEID;
newz->next = base->next;
newz->next->prev = newz;
base->next = newz;
base->size = size;
}
@ -1508,19 +1508,19 @@ Cache_Move
*/
void Cache_Move ( cache_system_t *c)
{
cache_system_t *new;
cache_system_t *newc;
// we are clearing up space at the bottom, so only allocate it late
new = Cache_TryAlloc (c->size, true);
if (new)
newc = Cache_TryAlloc (c->size, true);
if (newc)
{
// Con_Printf ("cache_move ok\n");
Q_memcpy ( new+1, c+1, c->size - sizeof(cache_system_t) );
new->user = c->user;
Q_memcpy (new->name, c->name, sizeof(new->name));
Q_memcpy ( newc+1, c+1, c->size - sizeof(cache_system_t) );
newc->user = c->user;
Q_memcpy (newc->name, c->name, sizeof(newc->name));
Cache_Free (c->user);
new->user->data = (void *)(new+1);
newc->user->data = (void *)(newc+1);
}
else
{
@ -1613,7 +1613,7 @@ Size should already include the header and padding
*/
cache_system_t *Cache_TryAlloc (int size, qboolean nobottom)
{
cache_system_t *cs, *new;
cache_system_t *cs, *newc;
// is the cache completely empty?
@ -1622,62 +1622,62 @@ cache_system_t *Cache_TryAlloc (int size, qboolean nobottom)
if (hunk_size - hunk_high_used - hunk_low_used < size)
Sys_Error ("Cache_TryAlloc: %i is greater then free hunk", size);
new = (cache_system_t *) (hunk_base + hunk_low_used);
memset (new, 0, sizeof(*new));
new->size = size;
newc = (cache_system_t *) (hunk_base + hunk_low_used);
memset (newc, 0, sizeof(*newc));
newc->size = size;
cache_head.prev = cache_head.next = new;
new->prev = new->next = &cache_head;
cache_head.prev = cache_head.next = newc;
newc->prev = newc->next = &cache_head;
Cache_MakeLRU (new);
return new;
Cache_MakeLRU (newc);
return newc;
}
// search from the bottom up for space
new = (cache_system_t *) (hunk_base + hunk_low_used);
newc = (cache_system_t *) (hunk_base + hunk_low_used);
cs = cache_head.next;
do
{
if (!nobottom || cs != cache_head.next)
{
if ( (qbyte *)cs - (qbyte *)new >= size)
if ( (qbyte *)cs - (qbyte *)newc >= size)
{ // found space
memset (new, 0, sizeof(*new));
new->size = size;
memset (newc, 0, sizeof(*newc));
newc->size = size;
new->next = cs;
new->prev = cs->prev;
cs->prev->next = new;
cs->prev = new;
newc->next = cs;
newc->prev = cs->prev;
cs->prev->next = newc;
cs->prev = newc;
Cache_MakeLRU (new);
Cache_MakeLRU (newc);
return new;
return newc;
}
}
// continue looking
new = (cache_system_t *)((qbyte *)cs + cs->size);
newc = (cache_system_t *)((qbyte *)cs + cs->size);
cs = cs->next;
} while (cs != &cache_head);
// try to allocate one at the very end
if ( hunk_base + hunk_size - hunk_high_used - (qbyte *)new >= size)
if ( hunk_base + hunk_size - hunk_high_used - (qbyte *)newc >= size)
{
memset (new, 0, sizeof(*new));
new->size = size;
memset (newc, 0, sizeof(*newc));
newc->size = size;
new->next = &cache_head;
new->prev = cache_head.prev;
cache_head.prev->next = new;
cache_head.prev = new;
newc->next = &cache_head;
newc->prev = cache_head.prev;
cache_head.prev->next = newc;
cache_head.prev = newc;
Cache_MakeLRU (new);
Cache_MakeLRU (newc);
return new;
return newc;
}
return NULL; // couldn't allocate

View file

@ -1714,6 +1714,62 @@ qglPolygonOffset(0, 0);
}
//#endif
#if 0
void GLR_SetupFog (void)
{
if (r_viewleaf)// && r_viewleaf->contents != CONTENTS_EMPTY)
{
// static fogcolour;
float fogcol[4]={0};
float fogperc;
float fogdist;
fogperc=0;
fogdist=512;
switch(r_viewleaf->contents)
{
case FTECONTENTS_WATER:
fogcol[0] = 64/255.0;
fogcol[1] = 128/255.0;
fogcol[2] = 192/255.0;
fogperc=0.2;
fogdist=512;
break;
case FTECONTENTS_SLIME:
fogcol[0] = 32/255.0;
fogcol[1] = 192/255.0;
fogcol[2] = 92/255.0;
fogperc=1;
fogdist=256;
break;
case FTECONTENTS_LAVA:
fogcol[0] = 192/255.0;
fogcol[1] = 32/255.0;
fogcol[2] = 64/255.0;
fogperc=1;
fogdist=128;
break;
default:
fogcol[0] = 192/255.0;
fogcol[1] = 192/255.0;
fogcol[2] = 192/255.0;
fogperc=1;
fogdist=1024;
break;
}
if (fogperc)
{
qglFogi(GL_FOG_MODE, GL_LINEAR);
qglFogfv(GL_FOG_COLOR, fogcol);
qglFogf(GL_FOG_DENSITY, fogperc);
qglFogf(GL_FOG_START, 1);
qglFogf(GL_FOG_END, fogdist);
qglEnable(GL_FOG);
}
}
}
#endif
/*
================
R_RenderView
@ -1777,59 +1833,9 @@ void GLR_RenderView (void)
mirror = false;
R_Clear ();
/*
if (r_viewleaf)// && r_viewleaf->contents != CONTENTS_EMPTY)
{
// static fogcolour;
float fogcol[4]={0};
float fogperc;
float fogdist;
#pragma comment (lib, "opengl32.lib") //temp only.
fogperc=0;
fogdist=512;
switch(r_viewleaf->contents)
{
case CONTENTS_WATER:
fogcol[0] = 64/255.0;
fogcol[1] = 128/255.0;
fogcol[2] = 192/255.0;
fogperc=0.2;
fogdist=512;
break;
case CONTENTS_SLIME:
fogcol[0] = 32/255.0;
fogcol[1] = 192/255.0;
fogcol[2] = 92/255.0;
fogperc=1;
fogdist=256;
break;
case CONTENTS_LAVA:
fogcol[0] = 192/255.0;
fogcol[1] = 32/255.0;
fogcol[2] = 64/255.0;
fogperc=1;
fogdist=128;
break;
default:
fogcol[0] = 192/255.0;
fogcol[1] = 192/255.0;
fogcol[2] = 192/255.0;
fogperc=1;
fogdist=1024;
break;
}
if (fogperc)
{
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogcol);
glFogf(GL_FOG_DENSITY, fogperc);
glFogf(GL_FOG_START, 1);
glFogf(GL_FOG_END, fogdist);
glEnable(GL_FOG);
}
}
*/
// GLR_SetupFog ();
r_alpha_surfaces = NULL;
GL_SetShaderState2D(false);
@ -1847,7 +1853,7 @@ void GLR_RenderView (void)
R_PolyBlend ();
// glDisable(GL_FOG);
// qglDisable(GL_FOG);
if (r_speeds.value)
{

View file

@ -90,6 +90,11 @@ void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass);
void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask);
void (APIENTRY *qglPushAttrib) (GLbitfield mask);
void (APIENTRY *qglPopAttrib) (void);
void (APIENTRY *qglFogf) (GLenum pname, GLfloat param);
void (APIENTRY *qglFogi) (GLenum pname, GLint param);
void (APIENTRY *qglFogfv) (GLenum pname, const GLfloat *params);
/*
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB;
PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
@ -566,6 +571,11 @@ void GL_Init(void *(*getglfunction) (char *name))
qglPopAttrib = (void *)getglcore("glPopAttrib");
qglScissor = (void *)getglcore("glScissor");
//does this need to be non-core as well?
qglFogi = (void *)getglcore("glFogi");
qglFogf = (void *)getglcore("glFogf");
qglFogfv = (void *)getglcore("glFogfv");
qglPolygonOffset = (void *)getglext("glPolygonOffset");
//used by heightmaps

View file

@ -92,15 +92,15 @@ FTPclientconn_t *FTP_CreateConnection(char *addy)
//duplicate a connection to get multiple data channels with a server.
FTPclientconn_t *FTP_DuplicateConnection(FTPclientconn_t *old)
{
FTPclientconn_t *new;
new = FTP_CreateConnection(old->server);
*new->server = '\0'; //mark it as non control
strcpy(new->name, old->name);
strcpy(new->pwd, old->pwd);
strcpy(new->path, old->path);
strcpy(new->pathprefix, old->pathprefix);
FTPclientconn_t *newf;
newf = FTP_CreateConnection(old->server);
*newf->server = '\0'; //mark it as non control
strcpy(newf->name, old->name);
strcpy(newf->pwd, old->pwd);
strcpy(newf->path, old->path);
strcpy(newf->pathprefix, old->pathprefix);
return new;
return newf;
}
int FTP_CL_makelistensocket(void)
@ -772,26 +772,26 @@ qboolean FTP_Client_Command (char *cmd, void (*NotifyFunction)(char *localfile,
}
else if (!stricmp(command, "list"))
{
FTPclientconn_t *new, *con = FTP_FindControl();
FTPclientconn_t *newf, *con = FTP_FindControl();
if (!con)
{
Con_Printf("Not connected\n");
return false;
}
new = FTP_DuplicateConnection(con);
if (!new)
newf = FTP_DuplicateConnection(con);
if (!newf)
{
Con_Printf("Failed duplicate connection\n");
return false;
}
new->type = ftp_listing;
new->NotifyFunction = NotifyFunction;
newf->type = ftp_listing;
newf->NotifyFunction = NotifyFunction;
return true;
}
else if (!stricmp(command, "get"))
{
FTPclientconn_t *new, *con = FTP_FindControl();
FTPclientconn_t *newf, *con = FTP_FindControl();
if (!con)
{
Con_Printf("Not connected\n");
@ -805,21 +805,21 @@ qboolean FTP_Client_Command (char *cmd, void (*NotifyFunction)(char *localfile,
return false;
}
new = FTP_DuplicateConnection(con);
if (!new)
newf = FTP_DuplicateConnection(con);
if (!newf)
{
Con_Printf("Failed duplicate connection\n");
return false;
}
new->NotifyFunction = NotifyFunction;
new->type = ftp_getting;
sprintf(new->file, command);
sprintf(new->localfile, "%s%s", new->path, command);
newf->NotifyFunction = NotifyFunction;
newf->type = ftp_getting;
sprintf(newf->file, command);
sprintf(newf->localfile, "%s%s", newf->path, command);
return true;
}
else if (!stricmp(command, "put"))
{
FTPclientconn_t *new, *con = FTP_FindControl();
FTPclientconn_t *newf, *con = FTP_FindControl();
if (!con)
{
Con_Printf("Not connected\n");
@ -833,16 +833,16 @@ qboolean FTP_Client_Command (char *cmd, void (*NotifyFunction)(char *localfile,
return false;
}
new = FTP_DuplicateConnection(con);
if (!new)
newf = FTP_DuplicateConnection(con);
if (!newf)
{
Con_Printf("Failed duplicate connection\n");
return false;
}
new->NotifyFunction = NotifyFunction;
new->type = ftp_putting;
sprintf(new->file, command);
sprintf(new->localfile, "%s%s", new->path, command);
newf->NotifyFunction = NotifyFunction;
newf->type = ftp_putting;
sprintf(newf->file, command);
sprintf(newf->localfile, "%s%s", newf->path, command);
return true;
}

View file

@ -226,7 +226,7 @@ r_part blobexp2
randomvel 256
assoc blobexp1b
}
r_part te_blob
r_part te_tarexplosion
{
texture "particles/quake"
count 256

View file

@ -128,7 +128,7 @@ r_part te_railtrail
}
//the blob tempent is used quite a bit with teamfortress emp grenades.
r_part te_blob
r_part te_tarexplosion
{
texture "particles/blob"
count 64

View file

@ -608,7 +608,7 @@ r_part empflash
assoc empcore
}
r_part te_blob
r_part te_tarexplosion
{
texture "particles/emp"
count 120

View file

@ -971,15 +971,15 @@ ED_NewString
*/
char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength)
{
char *new, *new_p;
char *newc, *new_p;
int i,l;
minlength++;
l = strlen(string) + 1;
new = PRAddressableAlloc (progfuncs, l<minlength?minlength:l);
new_p = new;
newc = PRAddressableAlloc (progfuncs, l<minlength?minlength:l);
new_p = newc;
for (i=0 ; i< l ; i++)
{
@ -995,7 +995,7 @@ char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength)
*new_p++ = string[i];
}
return new;
return newc;
}

View file

@ -785,7 +785,7 @@ strofs = (strofs+3)&~3;
printf("Writing %s\n", destfile);
h = SafeOpenWrite (destfile, 2*1024*1024);
SafeWrite (h, &progs, sizeof(progs));
SafeWrite (h, "\r\n\r\n", 2);
SafeWrite (h, "\r\n\r\n", 4);
SafeWrite (h, QCC_copyright, strlen(QCC_copyright)+1);
SafeWrite (h, "\r\n\r\n", 4);
while(SafeSeek (h, 0, SEEK_CUR) & 3)//this is a lame way to do it

View file

@ -2170,6 +2170,7 @@ void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
char *s;
int entnum;
client_t *cl, *sp;
int slen;
if (sv.demofile)
return;
@ -2184,6 +2185,7 @@ void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
cl = &svs.clients[entnum-1];
slen = strlen(s);
if (cl->controller)
{ //this is a slave client.
@ -2197,16 +2199,23 @@ void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
sp = cl->controller;
ClientReliableWrite_Begin (sp, svc_choosesplitclient, 4 + strlen(s));
ClientReliableWrite_Begin (sp, svc_choosesplitclient, 4 + slen);
ClientReliableWrite_Byte (sp, pnum);
ClientReliableWrite_Byte (sp, svc_centerprint);
ClientReliableWrite_String (sp, s);
}
else
{
ClientReliableWrite_Begin (cl, svc_centerprint, 2 + strlen(s));
ClientReliableWrite_Begin (cl, svc_centerprint, 2 + slen);
ClientReliableWrite_String (cl, s);
}
if (sv.mvdrecording)
{
MVDWrite_Begin (dem_single, entnum - 1, 2 + slen);
MSG_WriteByte ((sizebuf_t*)demo.dbuf, svc_centerprint);
MSG_WriteString ((sizebuf_t*)demo.dbuf, s);
}
}
@ -2221,21 +2230,21 @@ void PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
vec3_t newvalue;
float new;
float newf;
value1 = G_VECTOR(OFS_PARM0);
new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
new = sqrt(new);
newf = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
newf = sqrt(newf);
if (new == 0)
if (newf == 0)
newvalue[0] = newvalue[1] = newvalue[2] = 0;
else
{
new = 1/new;
newvalue[0] = value1[0] * new;
newvalue[1] = value1[1] * new;
newvalue[2] = value1[2] * new;
newf = 1/newf;
newvalue[0] = value1[0] * newf;
newvalue[1] = value1[1] * newf;
newvalue[2] = value1[2] * newf;
}
VectorCopy (newvalue, G_VECTOR(OFS_RETURN));
@ -2251,14 +2260,14 @@ scalar vlen(vector)
void PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
float new;
float newv;
value1 = G_VECTOR(OFS_PARM0);
new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
new = sqrt(new);
newv = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
newv = sqrt(newv);
G_FLOAT(OFS_RETURN) = new;
G_FLOAT(OFS_RETURN) = newv;
}
/*
@ -2271,14 +2280,14 @@ scalar vhlen(vector)
void PF_vhlen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
float new;
float newv;
value1 = G_VECTOR(OFS_PARM0);
new = value1[0] * value1[0] + value1[1] * value1[1];
new = sqrt(new);
newv = value1[0] * value1[0] + value1[1] * value1[1];
newv = sqrt(newv);
G_FLOAT(OFS_RETURN) = new;
G_FLOAT(OFS_RETURN) = newv;
}
/*
@ -3103,6 +3112,7 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
char *str;
client_t *cl;
static qboolean expectingcolour;
int slen;
entnum = G_EDICTNUM(prinst, OFS_PARM0);
if (entnum < 1 || entnum > sv.allocated_client_slots)
@ -3112,7 +3122,6 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
cl = &svs.clients[entnum-1];
if (strcmp(str, "disconnect\n") == 0)
{
// so long and thanks for all the fish
@ -3132,6 +3141,7 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
else
str += 6;
}
// FIXME: this seems broken and color->teamname needs a common functions
if (expectingcolour)
{
int team = atoi(str);
@ -3154,6 +3164,8 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
slen = strlen(str);
if (cl->controller)
{ //this is a slave client.
//find the right number and send.
@ -3167,16 +3179,23 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
sp = cl->controller;
ClientReliableWrite_Begin (sp, svc_choosesplitclient, 4 + strlen(str));
ClientReliableWrite_Begin (sp, svc_choosesplitclient, 4 + slen);
ClientReliableWrite_Byte (sp, pnum);
ClientReliableWrite_Byte (sp, svc_stufftext);
ClientReliableWrite_String (sp, str);
}
else
{
ClientReliableWrite_Begin (cl, svc_stufftext, 2+strlen(str));
ClientReliableWrite_Begin (cl, svc_stufftext, 2+slen);
ClientReliableWrite_String (cl, str);
}
if (sv.mvdrecording)
{
MVDWrite_Begin (dem_single, entnum - 1, 2 + slen);
MSG_WriteByte ((sizebuf_t*)demo.dbuf, svc_stufftext);
MSG_WriteString ((sizebuf_t*)demo.dbuf, str);
}
}
//DP_QC_DROPCLIENT

View file

@ -607,22 +607,22 @@ void PIN_DeleteOldestMessage(void)
void PIN_MakeMessage(char *from, char *msg)
{
pinnedmessages_t *p;
pinnedmessages_t *new;
pinnedmessages_t *newp;
new = BZ_Malloc(sizeof(pinnedmessages_t));
Q_strncpyz(new->setby, from, sizeof(new->setby));
Q_strncpyz(new->message, msg, sizeof(new->message));
new->next = NULL;
newp = BZ_Malloc(sizeof(pinnedmessages_t));
Q_strncpyz(newp->setby, from, sizeof(newp->setby));
Q_strncpyz(newp->message, msg, sizeof(newp->message));
newp->next = NULL;
if (!pinned)
pinned = new;
pinned = newp;
else
{
for (p = pinned; ; p = p->next)
{
if (!p->next)
{
p->next = new;
p->next = newp;
break;
}
}

View file

@ -254,7 +254,7 @@ void D_PolysetRecursiveTriangleTrans (int *lp1, int *lp2, int *lp3)
{
int *temp;
int d;
int new[6];
int newt[6];
int z;
short *zbuf;
@ -297,11 +297,11 @@ split2:
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
@ -310,28 +310,28 @@ split:
goto nodraw;
z = new[5]>>16;
zbuf = zspantable[new[1]] + new[0];
z = newt[5]>>16;
zbuf = zspantable[newt[1]] + newt[0];
if (z >= *zbuf)
{
int pix;
*zbuf = z;
pix = d_pcolormap[apalremap[skintable[new[3]>>16][new[2]>>16]]];
d_viewbuffer[d_scantable[new[1]] + new[0]] = Trans(d_viewbuffer[d_scantable[new[1]] + new[0]], (unsigned char)pix);
pix = d_pcolormap[apalremap[skintable[newt[3]>>16][newt[2]>>16]]];
d_viewbuffer[d_scantable[newt[1]] + newt[0]] = Trans(d_viewbuffer[d_scantable[newt[1]] + newt[0]], (unsigned char)pix);
}
nodraw:
// recursively continue
D_PolysetRecursiveTriangleTrans (lp3, lp1, new);
D_PolysetRecursiveTriangleTrans (lp3, new, lp2);
D_PolysetRecursiveTriangleTrans (lp3, lp1, newt);
D_PolysetRecursiveTriangleTrans (lp3, newt, lp2);
}
void D_PolysetRecursiveTriangle32Trans (int *lp1, int *lp2, int *lp3)
{
int *temp;
int d;
int new[6];
int newt[6];
int z;
short *zbuf;
@ -374,11 +374,11 @@ split2:
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
@ -387,32 +387,32 @@ split:
goto nodraw;
z = new[5]>>16;
if ((new[1]>=vid.height|| new[1] < 0 || new[0] >= vid.width || new[0]<0)) //fixme: temp
z = newt[5]>>16;
if ((newt[1]>=vid.height|| newt[1] < 0 || newt[0] >= vid.width || newt[0]<0)) //fixme: temp
return;
zbuf = zspantable[new[1]] + new[0];
zbuf = zspantable[newt[1]] + newt[0];
if (z >= *zbuf)
{
int pix;
*zbuf = z;
pix = ((unsigned int *)((unsigned int **)skintable)[new[3]>>16])[new[2]>>16];
pix = ((unsigned int *)((unsigned int **)skintable)[newt[3]>>16])[newt[2]>>16];
// pix = d_pcolormap[skintable[new[3]>>16][new[2]>>16]];
((unsigned int *)d_viewbuffer)[d_scantable[new[1]] + new[0]] = pix;//d_8to32table[pix];
((unsigned int *)d_viewbuffer)[d_scantable[newt[1]] + newt[0]] = pix;//d_8to32table[pix];
}
nodraw:
// recursively continue
D_PolysetRecursiveTriangle32Trans (lp3, lp1, new);
D_PolysetRecursiveTriangle32Trans (lp3, new, lp2);
D_PolysetRecursiveTriangle32Trans (lp3, lp1, newt);
D_PolysetRecursiveTriangle32Trans (lp3, newt, lp2);
}
void D_PolysetRecursiveTriangle16 (int *lp1, int *lp2, int *lp3)
{
int *temp;
int d;
int new[6];
int newt[6];
int z;
short *zbuf;
@ -455,11 +455,11 @@ split2:
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
@ -468,24 +468,24 @@ split:
goto nodraw;
z = new[5]>>16;
if ((new[1]>=vid.height|| new[1] < 0 || new[0] >= vid.width || new[0]<0)) //fixme: temp
z = newt[5]>>16;
if ((newt[1]>=vid.height|| newt[1] < 0 || newt[0] >= vid.width || newt[0]<0)) //fixme: temp
return;
zbuf = zspantable[new[1]] + new[0];
zbuf = zspantable[newt[1]] + newt[0];
if (z >= *zbuf)
{
int pix;
*zbuf = z;
pix = ((unsigned short *)d_pcolormap)[skintable[new[3]>>16][new[2]>>16]];
((unsigned short *)d_viewbuffer)[d_scantable[new[1]] + new[0]] = pix;//d_8to32table[pix];
pix = ((unsigned short *)d_pcolormap)[skintable[newt[3]>>16][newt[2]>>16]];
((unsigned short *)d_viewbuffer)[d_scantable[newt[1]] + newt[0]] = pix;//d_8to32table[pix];
}
nodraw:
// recursively continue
D_PolysetRecursiveTriangle16 (lp3, lp1, new);
D_PolysetRecursiveTriangle16 (lp3, new, lp2);
D_PolysetRecursiveTriangle16 (lp3, lp1, newt);
D_PolysetRecursiveTriangle16 (lp3, newt, lp2);
}
void D_PolysetDrawSpans8Trans (spanpackage_t *pspanpackage)
@ -1370,7 +1370,7 @@ void D_PolysetRecursiveTriangleC (int *lp1, int *lp2, int *lp3)
{
int *temp;
int d;
int new[6];
int newt[6];
int z;
short *zbuf;
@ -1413,11 +1413,11 @@ split2:
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
@ -1426,28 +1426,28 @@ split:
goto nodraw;
z = new[5]>>16;
zbuf = zspantable[new[1]] + new[0];
z = newt[5]>>16;
zbuf = zspantable[newt[1]] + newt[0];
if (z >= *zbuf)
{
int pix;
*zbuf = z;
pix = d_pcolormap[apalremap[skintable[new[3]>>16][new[2]>>16]]];
d_viewbuffer[d_scantable[new[1]] + new[0]] = pix;
pix = d_pcolormap[apalremap[skintable[newt[3]>>16][newt[2]>>16]]];
d_viewbuffer[d_scantable[newt[1]] + newt[0]] = pix;
}
nodraw:
// recursively continue
D_PolysetRecursiveTriangleC (lp3, lp1, new);
D_PolysetRecursiveTriangleC (lp3, new, lp2);
D_PolysetRecursiveTriangleC (lp3, lp1, newt);
D_PolysetRecursiveTriangleC (lp3, newt, lp2);
}
void D_PolysetRecursiveTriangle16C (int *lp1, int *lp2, int *lp3)
{
int *temp;
int d;
int new[6];
int newt[6];
int z;
short *zbuf;
@ -1490,11 +1490,11 @@ split2:
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
@ -1503,8 +1503,8 @@ split:
goto nodraw;
z = new[5]>>16;
zbuf = zspantable[new[1]] + new[0];
z = newt[5]>>16;
zbuf = zspantable[newt[1]] + newt[0];
if (z >= *zbuf)
{
int pix;
@ -1514,14 +1514,14 @@ split:
*zbuf = z;
pix = skintable[new[3]>>16][new[2]>>16];
((unsigned short *)d_viewbuffer)[d_scantable[new[1]] + new[0]] = pix;
pix = skintable[newt[3]>>16][newt[2]>>16];
((unsigned short *)d_viewbuffer)[d_scantable[newt[1]] + newt[0]] = pix;
}
nodraw:
// recursively continue
D_PolysetRecursiveTriangle16C (lp3, lp1, new);
D_PolysetRecursiveTriangle16C (lp3, new, lp2);
D_PolysetRecursiveTriangle16C (lp3, lp1, newt);
D_PolysetRecursiveTriangle16C (lp3, newt, lp2);
}
/*
@ -2562,7 +2562,7 @@ void D_PolysetSetEdgeTable (void)
void D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
{
int d;
int new[6];
int newt[6];
int ofs;
d = lp2[0] - lp1[0];
@ -2576,34 +2576,34 @@ void D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[4] = (lp1[4] + lp2[4]) >> 1;
// draw the point
ofs = d_scantable[new[1]] + new[0];
if (new[5] > d_pzbuffer[ofs])
ofs = d_scantable[newt[1]] + newt[0];
if (newt[5] > d_pzbuffer[ofs])
{
int pix;
d_pzbuffer[ofs] = new[5];
pix = apalremap[skintable[new[3]>>16][new[2]>>16]];
// pix = ((qbyte *)acolormap)[pix + (new[4] & 0xFF00)];
d_pzbuffer[ofs] = newt[5];
pix = apalremap[skintable[newt[3]>>16][newt[2]>>16]];
// pix = ((qbyte *)acolormap)[pix + (newt[4] & 0xFF00)];
d_viewbuffer[ofs] = pix;
}
// recursively continue
D_PolysetRecursiveDrawLine (lp1, new);
D_PolysetRecursiveDrawLine (new, lp2);
D_PolysetRecursiveDrawLine (lp1, newt);
D_PolysetRecursiveDrawLine (newt, lp2);
}
void D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
{
int d;
int new[4];
int newt[4];
d = lp2[0] - lp1[0];
if (d < -1 || d > 1)
@ -2615,18 +2615,18 @@ void D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1;
newt[0] = (lp1[0] + lp2[0]) >> 1;
newt[1] = (lp1[1] + lp2[1]) >> 1;
newt[5] = (lp1[5] + lp2[5]) >> 1;
newt[2] = (lp1[2] + lp2[2]) >> 1;
newt[3] = (lp1[3] + lp2[3]) >> 1;
newt[4] = (lp1[4] + lp2[4]) >> 1;
D_PolysetRecursiveDrawLine (new, lp3);
D_PolysetRecursiveDrawLine (newt, lp3);
// recursively continue
D_PolysetRecursiveTriangle (lp1, new, lp3);
D_PolysetRecursiveTriangle (new, lp2, lp3);
D_PolysetRecursiveTriangle (lp1, newt, lp3);
D_PolysetRecursiveTriangle (newt, lp2, lp3);
}
#endif

View file

@ -137,7 +137,7 @@ D_SCAlloc
*/
surfcache_t *D_SCAlloc (int width, int bpp, int size)
{
surfcache_t *new;
surfcache_t *newsc;
qboolean wrapped_this_time;
// if ((width < 0) || (width > 256))
@ -168,11 +168,11 @@ surfcache_t *D_SCAlloc (int width, int bpp, int size)
}
// colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover;
newsc = sc_rover;
if (sc_rover->owner)
*sc_rover->owner = NULL;
while (new->size < size)
while (newsc->size < size)
{
// free another
sc_rover = sc_rover->next;
@ -181,32 +181,32 @@ surfcache_t *D_SCAlloc (int width, int bpp, int size)
if (sc_rover->owner)
*sc_rover->owner = NULL;
new->size += sc_rover->size;
new->next = sc_rover->next;
newsc->size += sc_rover->size;
newsc->next = sc_rover->next;
}
// create a fragment out of any leftovers
if (new->size - size > 256)
if (newsc->size - size > 256)
{
sc_rover = (surfcache_t *)( (qbyte *)new + size);
sc_rover->size = new->size - size;
sc_rover->next = new->next;
sc_rover = (surfcache_t *)( (qbyte *)newsc + size);
sc_rover->size = newsc->size - size;
sc_rover->next = newsc->next;
sc_rover->width = 0;
sc_rover->owner = NULL;
new->next = sc_rover;
new->size = size;
newsc->next = sc_rover;
newsc->size = size;
}
else
sc_rover = new->next;
sc_rover = newsc->next;
new->width = width;
newsc->width = width;
// DEBUG
if (width > 0)
new->height = (size - sizeof(*new) + sizeof(new->data)) / (width*bpp);
newsc->height = (size - sizeof(*newsc) + sizeof(newsc->data)) / (width*bpp);
new->bytesperpix = bpp;
newsc->bytesperpix = bpp;
new->owner = NULL; // should be set properly after return
newsc->owner = NULL; // should be set properly after return
if (d_roverwrapped)
{
@ -219,7 +219,7 @@ surfcache_t *D_SCAlloc (int width, int bpp, int size)
}
D_CheckCacheGuard (); // DEBUG
return new;
return newsc;
}

View file

@ -1633,6 +1633,38 @@ static int R_SIRDZFunc(int sub)
return ((e<=R_SIRDmaxDiff)? e : R_SIRDmaxDiff );
}
#if 0
void R_ApplyFog(void)
{
// test code for fog, the real implementation should use a lookup table
qbyte *pbuf;
short *zbuf;
extern short *d_pzbuffer;
int y, x;
float v;
for (y=0 ; y<vid.height ; y++)
{
pbuf = (qbyte *)(vid.buffer + vid.rowbytes*y);
zbuf = d_pzbuffer + (vid.width*y);
for (x=0 ; x<vid.width ; x++)
{
if (!zbuf[x])
D_SetTransLevel(1.0f, BM_ADD);
else
{
v = 64.0f / zbuf[x];
v = bound(0, v, 1);
D_SetTransLevel(v, BM_ADD);
}
pbuf[x] = AddBlend(pbuf[x], 74);
}
}
}
#endif
void R_ApplySIRDAlgorithum(void)
{
unsigned short* curz, *oldz;

View file

@ -47,6 +47,9 @@ WARNING: be very careful calling this from elsewhere, because the refresh
needs almost the entire 256k of stack space!
==================
*/
extern void D_SetTransLevel(float level, blendmode_t blend);
extern qbyte Trans(qbyte p, qbyte p2);
void SWSCR_UpdateScreen (void)
{
qboolean nohud;