1
0
Fork 0
forked from fte/fteqw

*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@917 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-23 22:14:08 +00:00
parent dbf7aeb23c
commit 5926f9f4cf
28 changed files with 280 additions and 117 deletions

View file

@ -123,7 +123,7 @@ void Cam_Unlock(int pnum)
{
if (autocam[pnum])
{
CL_SendClientCommand("ptrack");
CL_SendClientCommand(true, "ptrack");
autocam[pnum] = CAM_NONE;
locked[pnum] = false;
Sbar_Changed();
@ -135,7 +135,7 @@ void Cam_Lock(int pnum, int playernum)
cam_lastviewtime[pnum] = -1000;
CL_SendClientCommand("ptrack %i", playernum);
CL_SendClientCommand(true, "ptrack %i", playernum);
spec_track[pnum] = playernum;
locked[pnum] = false;

View file

@ -750,7 +750,7 @@ void CLNQ_SendCmd(void)
if (name.modified)
{
name.modified = false;
CL_SendClientCommand("name \"%s\"\n", name.string);
CL_SendClientCommand(true, "name \"%s\"\n", name.string);
}
if (nq_dp_protocol > 0)
@ -840,10 +840,11 @@ qboolean allowindepphys;
typedef struct clcmdbuf_s {
struct clcmdbuf_s *next;
int len;
qboolean reliable;
char command[4]; //this is dynamically allocated, so this is variably sized.
} clcmdbuf_t;
clcmdbuf_t *clientcmdlist;
void VARGS CL_SendClientCommand(char *format, ...)
void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...)
{
qboolean oldallow;
va_list argptr;
@ -871,6 +872,7 @@ void VARGS CL_SendClientCommand(char *format, ...)
buf = Z_Malloc(sizeof(*buf)+strlen(string));
strcpy(buf->command, string);
buf->len = strlen(buf->command);
buf->reliable = reliable;
//add to end of the list so that the first of the list is the first to be sent.
if (!clientcmdlist)
@ -1032,19 +1034,6 @@ void CL_SendCmd (float frametime)
}
#endif
{
clcmdbuf_t *next;
while (clientcmdlist)
{
next = clientcmdlist->next;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, clientcmdlist->command);
// Con_Printf("Sending stringcmd %s\n", clientcmdlist->command);
Z_Free(clientcmdlist);
clientcmdlist = next;
}
}
if (cls.demoplayback != DPB_NONE)
{
if (cls.demoplayback == DPB_MVD)
@ -1078,6 +1067,31 @@ void CL_SendCmd (float frametime)
return; // sendcmds come from the demo
}
buf.maxsize = sizeof(data);
buf.cursize = 0;
buf.data = data;
CL_SendDownloadReq(&buf);
{
clcmdbuf_t *next;
while (clientcmdlist)
{
next = clientcmdlist->next;
if (clientcmdlist->reliable)
{
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, clientcmdlist->command);
}
else
{
MSG_WriteByte (&buf, clc_stringcmd);
MSG_WriteString (&buf, clientcmdlist->command);
}
// Con_Printf("Sending stringcmd %s\n", clientcmdlist->command);
Z_Free(clientcmdlist);
clientcmdlist = next;
}
}
#ifdef NQPROT
if (cls.netcon && !cls.netcon->qwprotocol)
{
@ -1154,13 +1168,8 @@ void CL_SendCmd (float frametime)
// send this and the previous cmds in the message, so
// if the last packet was dropped, it can be recovered
buf.maxsize = sizeof(data);
buf.cursize = 0;
buf.data = data;
clientcount = cl.splitclients;
CL_SendDownloadReq(&buf);
if (!clientcount)
clientcount = 1;
if (1) //wait for server data before sending clc_move stuff? nope, mvdsv doesn't like that.

View file

@ -1301,7 +1301,7 @@ void CL_FullServerinfo_f (void)
{
unsigned int chksum = strtoul(p, NULL, 0);
if (CSQC_Init(chksum))
CL_SendClientCommand("enablecsqc");
CL_SendClientCommand(true, "enablecsqc");
}
#endif
}
@ -1624,7 +1624,7 @@ void CL_Reconnect_f (void)
if (cls.state == ca_connected)
{
Con_TPrintf (TLC_RECONNECTING);
CL_SendClientCommand("new");
CL_SendClientCommand(true, "new");
return;
}
@ -1840,7 +1840,7 @@ client_connect: //fixme: make function
cls.netchan.qsocket = cls.netcon;
#endif
if (cls.q2server < 2)
CL_SendClientCommand("new");
CL_SendClientCommand(true, "new");
cls.state = ca_connected;
Con_TPrintf (TLC_CONNECTED);
allowremotecmd = false; // localid required now for remote cmds

View file

@ -315,7 +315,7 @@ void CL_SendDownloadRequest(char *filename)
COM_StripExtension (cls.downloadname, cls.downloadtempname);
strcat (cls.downloadtempname, ".tmp");
CL_SendClientCommand("download %s", cls.downloadname);
CL_SendClientCommand(true, "download %s", cls.downloadname);
//prevent ftp/http from changing stuff
cls.downloadmethod = DL_QWPENDING;
@ -596,7 +596,7 @@ void Model_NextDownload (void)
{
// done with modellist, request first of static signon messages
// CL_SendClientCommand("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(prespawn_name, cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(true, prespawn_name, cl.servercount, cl.worldmodel->checksum2);
}
}
@ -661,7 +661,7 @@ void Sound_NextDownload (void)
#endif
{
// CL_SendClientCommand ("modellist %i 0", cl.servercount);
CL_SendClientCommand (modellist_name, cl.servercount, 0);
CL_SendClientCommand (true, modellist_name, cl.servercount, 0);
}
}
@ -723,7 +723,7 @@ void CL_SendDownloadReq(sizebuf_t *msg)
}
else
{
CL_SendClientCommand("nextdl %i\n", i);
CL_SendClientCommand(false, "nextdl %i\n", i);
}
return;
}
@ -1048,7 +1048,7 @@ void CL_ParseDownload (void)
// request next block
cls.downloadpercent = percent;
CL_SendClientCommand("nextdl");
CL_SendClientCommand(true, "nextdl");
}
else
{
@ -1321,7 +1321,7 @@ void CL_ParseServerData (void)
{
// ask for the sound list next
// CL_SendClientCommand ("soundlist %i 0", cl.servercount);
CL_SendClientCommand (soundlist_name, cl.servercount, 0);
CL_SendClientCommand (true, soundlist_name, cl.servercount, 0);
}
// now waiting for downloads, etc
@ -1568,20 +1568,20 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon)
{
case 1:
CL_SendClientCommand("prespawn");
CL_SendClientCommand(true, "prespawn");
break;
case 2:
CL_SendClientCommand("name \"%s\"\n", name.string);
CL_SendClientCommand(true, "name \"%s\"\n", name.string);
name.modified = false;
CL_SendClientCommand("color %i %i\n", (int)topcolor.value, (int)bottomcolor.value);
CL_SendClientCommand(true, "color %i %i\n", (int)topcolor.value, (int)bottomcolor.value);
CL_SendClientCommand("spawn %s", "");
CL_SendClientCommand(true, "spawn %s", "");
break;
case 3:
CL_SendClientCommand("begin");
CL_SendClientCommand(true, "begin");
Cache_Report (); // print remaining memory
#ifdef VM_CG
CG_Start();
@ -1774,7 +1774,7 @@ void CL_ParseSoundlist (void)
if (n)
{
// CL_SendClientCommand("soundlist %i %i", cl.servercount, n);
CL_SendClientCommand(soundlist_name, cl.servercount, n);
CL_SendClientCommand(true, soundlist_name, cl.servercount, n);
return;
}
@ -1845,7 +1845,7 @@ void CL_ParseModellist (qboolean lots)
if (n)
{
// CL_SendClientCommand("modellist %i %i", cl.servercount, n);
CL_SendClientCommand(modellist_name, cl.servercount, (nummodels&0xff00) + n);
CL_SendClientCommand(true, modellist_name, cl.servercount, (nummodels&0xff00) + n);
return;
}
@ -3588,7 +3588,7 @@ void CLQ2_ParseServerMessage (void)
return;
case svcq2_reconnect: //8
Con_TPrintf (TLC_RECONNECTING);
CL_SendClientCommand("new");
CL_SendClientCommand(true, "new");
break;
case svcq2_sound: //9 // <see code>
CLQ2_ParseStartSoundPacket();

View file

@ -656,7 +656,7 @@ float CL_KeyState (kbutton_t *key, int pnum);
char *Key_KeynumToString (int keynum);
int Key_StringToKeynum (char *str, int *modifier);
void VARGS CL_SendClientCommand(char *format, ...);
void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...);
void CL_AllowIndependantSendCmd(qboolean allow);
//

View file

@ -91,7 +91,7 @@ void CIN_FinishCinematic (void)
// tell the server to advance to the next map / cinematic
if (cls.state == ca_active)
{
CL_SendClientCommand("nextserver %i", cl.servercount);
CL_SendClientCommand(true, "nextserver %i", cl.servercount);
}
}

View file

@ -1622,11 +1622,14 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
ent.fatness = 1;
#ifdef Q3SHADERS //fixme: do better.
//fixme: this is woefully gl specific. :(
ent.shaderRGBA[0] = (!!(renderfx & Q2RF_SHELL_RED)) * 255;
ent.shaderRGBA[1] = (!!(renderfx & Q2RF_SHELL_GREEN)) * 255;
ent.shaderRGBA[2] = (!!(renderfx & Q2RF_SHELL_BLUE)) * 255;
ent.shaderRGBA[3] = ent.alpha*255;
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell);
if (qrenderer == QR_OPENGL)
{
ent.shaderRGBA[0] = (!!(renderfx & Q2RF_SHELL_RED)) * 255;
ent.shaderRGBA[1] = (!!(renderfx & Q2RF_SHELL_GREEN)) * 255;
ent.shaderRGBA[2] = (!!(renderfx & Q2RF_SHELL_BLUE)) * 255;
ent.shaderRGBA[3] = ent.alpha*255;
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell);
}
#endif
V_AddLerpEntity (&ent);
}

View file

@ -1102,6 +1102,7 @@ void WritePCXfile (char *filename, qbyte *data, int width, int height,
LoadPCX
============
*/
//fixme: endian issues?
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height)
{
pcx_t *pcx;
@ -1175,6 +1176,72 @@ qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height)
return pcx_rgb;
}
//fixme: endian issues?
qbyte *ReadPCXData(qbyte *buf, int length, int width, int height, qbyte *result)
{
pcx_t *pcx;
// pcx_t pcxbuf;
qbyte *palette;
qbyte *pix;
int x, y;
int dataByte, runLength;
int count;
qbyte *data;
//
// parse the PCX file
//
pcx = (pcx_t *)buf;
if (pcx->manufacturer != 0x0a
|| pcx->version != 5
|| pcx->encoding != 1
|| pcx->bits_per_pixel != 8)
{
return NULL;
}
if (width != pcx->xmax-pcx->xmin+1 ||
height > pcx->ymax-pcx->ymin+1)
return NULL;
palette = buf + length-768;
data = (char *)(pcx+1);
count = (pcx->xmax+1) * (pcx->ymax+1);
for (y=0 ; y<height ; y++)
{
pix = result + y*(pcx->xmax+1);
for (x=0 ; x<=pcx->xmax ; )
{
dataByte = *data;
data++;
if((dataByte & 0xC0) == 0xC0)
{
runLength = dataByte & 0x3F;
dataByte = *data;
data++;
}
else
runLength = 1;
while(runLength-- > 0)
{
*pix++ = dataByte;
x++;
}
}
}
return result;
}
//fixme: endian issues?
qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out)
{
pcx_t *pcx;

View file

@ -192,7 +192,7 @@ typedef struct quakeparms_s
int argc;
char **argv;
void *membase;
int memsize;
unsigned int memsize;
} quakeparms_t;

View file

@ -1414,6 +1414,8 @@ qboolean R_ApplyRenderer (rendererstate_t *newr)
if (host_basepal)
BZ_Free(host_basepal);
if (host_colormap)
BZ_Free(host_colormap);
host_basepal = (qbyte *)COM_LoadMallocFile ("gfx/palette.lmp");
if (!host_basepal)
{
@ -1424,9 +1426,13 @@ qboolean R_ApplyRenderer (rendererstate_t *newr)
{
memcpy(host_basepal, default_quakepal, 768);
}
else
{
host_colormap = BZ_Malloc(256*VID_GRADES);
if (ReadPCXData(pcx, com_filesize, 256, VID_GRADES, host_colormap))
goto q2colormap; //skip the colormap.lmp file as we already read it
}
}
if (host_colormap)
BZ_Free(host_colormap);
host_colormap = (qbyte *)COM_LoadMallocFile ("gfx/colormap.lmp");
if (!host_colormap)
{
@ -1466,6 +1472,8 @@ qboolean R_ApplyRenderer (rendererstate_t *newr)
if (vid.fullbright < 2)
vid.fullbright = 0; //transparent colour doesn't count.
q2colormap:
TRACE(("dbg: R_ApplyRenderer: Palette loaded\n"));
if (!VID_Init(newr, host_basepal))
@ -1544,18 +1552,19 @@ TRACE(("dbg: R_ApplyRenderer: loaded\n"));
TRACE(("dbg: R_ApplyRenderer: doing that funky phs thang\n"));
SV_CalcPHS ();
for (i = 0; i < MAX_MODELS; i++)
{
if (*sv.model_precache[i] && (!strcmp(sv.model_precache[i] + strlen(sv.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels))
sv.models[i] = Mod_FindName(sv.model_precache[i]);
else
sv.models[i] = NULL;
}
TRACE(("dbg: R_ApplyRenderer: clearing world\n"));
SV_ClearWorld ();
if (svprogfuncs)
if (svs.gametype == GT_PROGS)
{
for (i = 0; i < MAX_MODELS; i++)
{
if (*sv.model_precache[i] && (!strcmp(sv.model_precache[i] + strlen(sv.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels))
sv.models[i] = Mod_FindName(sv.model_precache[i]);
else
sv.models[i] = NULL;
}
ent = sv.edicts;
ent->v.model = PR_SetString(svprogfuncs, sv.worldmodel->name); //FIXME: is this a problem for normal ents?
for (i=0 ; i<sv.num_edicts ; i++)
@ -1574,7 +1583,7 @@ TRACE(("dbg: R_ApplyRenderer: clearing world\n"));
}
}
#ifdef Q2SERVER
else if (ge && ge->edicts)
else if (svs.gametype == GT_QUAKE2)
{
q2ent = ge->edicts;
@ -1592,6 +1601,8 @@ TRACE(("dbg: R_ApplyRenderer: clearing world\n"));
}
}
}
else
SV_UnspawnServer();
#endif
}
#endif
@ -1609,7 +1620,10 @@ TRACE(("dbg: R_ApplyRenderer: starting on client state\n"));
staticmodelindex[i] = 0;
for (j = 1; j < MAX_MODELS; j++)
if (cl_static_entities[i].model == cl.model_precache[j])
{
staticmodelindex[i] = j;
break;
}
}
cl.worldmodel = NULL;
@ -1656,6 +1670,7 @@ TRACE(("dbg: R_ApplyRenderer: efrags\n"));
for (i = 0; i < cl.num_statics; i++) //make the static entities reappear.
{
cl_static_entities[i].model = cl.model_precache[staticmodelindex[i]];
cl_static_entities[i].colormap = vid.colormap;
if (staticmodelindex[i]) //make sure it's worthwhile.
{
R_AddEfrags(&cl_static_entities[i]);

View file

@ -1896,7 +1896,7 @@ void Sbar_DeathmatchOverlay (int start)
)
{
cl.last_ping_request = realtime;
CL_SendClientCommand("pings");
CL_SendClientCommand(false, "pings");
}
scr_copyeverything = 1;
@ -2055,7 +2055,7 @@ void Sbar_ChatModeOverlay(void)
)
{
cl.last_ping_request = realtime;
CL_SendClientCommand("pings");
CL_SendClientCommand(false, "pings");
}
scr_copyeverything = 1;

View file

@ -504,7 +504,7 @@ void Skin_NextDownload (void)
if (cls.state != ca_active)
{ // get next signon phase
CL_SendClientCommand("begin %i", cl.servercount);
CL_SendClientCommand(true, "begin %i", cl.servercount);
Cache_Report (); // print remaining memory
}
}

View file

@ -47,7 +47,13 @@
*
*/
# include "../../mp3/libmad/mad.h"
# include "libmad/mad.h"
#define USE_MADLIB
#include "mymad.c"
#ifdef _MSC_VER
#pragma comment (lib, "../libs/libmad/msvc++/release/libmad.lib")
#endif
/*
@ -85,12 +91,12 @@ typedef struct {
int mymad_run(struct mad_decoder *decoder);
int mymad_reset(struct mad_decoder *decoder);
void mymad_finish(struct mad_decoder *decoder);
int startdecode(unsigned char *start, unsigned long length, decoderbuffer_t *buffer);
static int startdecode(unsigned char *start, unsigned long length, decoderbuffer_t *buffer);
#define BUFFERSIZEINC (2*1024*1024)
int DecodeSomeMP3(sfx_t *s, int minlength);
byte *COM_LoadFile (char *path, int usehunk);
qbyte *COM_LoadFile (char *path, int usehunk);
int MP3_decode(unsigned char *start, unsigned long length, decoderbuffer_t *buffer);
void CancelDecoder(sfx_t *s);
sfxcache_t *S_LoadMP3Sound (sfx_t *s)

View file

@ -146,7 +146,7 @@ void *Sys_GetGameAPI (void *parms)
#define MINIMUM_WIN_MEMORY 0x0800000
#define MAXIMUM_WIN_MEMORY 0x1000000
#define MAXIMUM_WIN_MEMORY 0x4000000
#define PAUSE_SLEEP 50 // sleep time on pause or minimization
#define NOT_FOCUS_SLEEP 20 // sleep time when not focus
@ -1053,8 +1053,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (parms.memsize < (lpBuffer.dwTotalPhys >> 1))
parms.memsize = lpBuffer.dwTotalPhys >> 1;
// if (parms.memsize > MAXIMUM_WIN_MEMORY)
// parms.memsize = MAXIMUM_WIN_MEMORY;
if (parms.memsize > MAXIMUM_WIN_MEMORY)
parms.memsize = MAXIMUM_WIN_MEMORY;
if (COM_CheckParm ("-heapsize"))
{

View file

@ -2662,7 +2662,7 @@ static void CL_Say (qboolean team, char *extra)
return;
}
#endif
CL_SendClientCommand("%s \"%s%s\"", team ? "say_team " : "say ", extra?extra:"", sendtext);
CL_SendClientCommand(true, "%s \"%s%s\"", team ? "say_team " : "say ", extra?extra:"", sendtext);
}

View file

@ -1563,9 +1563,9 @@ void Cmd_ForwardToServer (void)
#endif
if (Cmd_Argc() > 1)
CL_SendClientCommand("%s %s", Cmd_Argv(0), Cmd_Args());
CL_SendClientCommand(true, "%s %s", Cmd_Argv(0), Cmd_Args());
else
CL_SendClientCommand("%s", Cmd_Argv(0));
CL_SendClientCommand(true, "%s", Cmd_Argv(0));
}
// don't forward the first argument
@ -1586,7 +1586,7 @@ void Cmd_ForwardToServer_f (void)
return; // not really connected
if (Cmd_Argc() > 1)
CL_SendClientCommand("%s", Cmd_Args());
CL_SendClientCommand(true, "%s", Cmd_Args());
}
#else
void Cmd_ForwardToServer (void)

View file

@ -249,7 +249,7 @@ cvar_t *Cvar_SetCore (cvar_t *var, char *value, qboolean force)
else
#endif
{
CL_SendClientCommand("setinfo \"%s\" \"%s\"\n", var->name, value);
CL_SendClientCommand(true, "setinfo \"%s\" \"%s\"\n", var->name, value);
}
}
}
@ -581,7 +581,7 @@ qboolean Cvar_Command (int level)
#ifndef SERVERONLY
if (Cmd_ExecLevel > RESTRICT_SERVER)
{ //directed at a secondary player.
CL_SendClientCommand("%i setinfo %s \"%s\"", Cmd_ExecLevel - RESTRICT_SERVER-1, v->name, str);
CL_SendClientCommand(true, "%i setinfo %s \"%s\"", Cmd_ExecLevel - RESTRICT_SERVER-1, v->name, str);
return true;
}

View file

@ -2170,7 +2170,7 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
if (cls.state >= ca_connected)
{
CL_SendClientCommand("setinfo %s %d",
CL_SendClientCommand(true, "setinfo %s %d",
!strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name,
(int)crc);
}

View file

@ -113,7 +113,7 @@ void Mod_LoadHLModel (model_t *mod, void *buffer)
if (cls.state >= ca_connected)
{
CL_SendClientCommand("setinfo %s %d",
CL_SendClientCommand(true, "setinfo %s %d",
!strcmp(mod->name, "progs/player.mdl") ? pmodel_name : emodel_name,
(int)crc);
}

View file

@ -1969,10 +1969,6 @@ void PPL_BaseEntTextures(void)
}
else
{
#if 0
if (currententity->keynum == r_refdef.currentplayernum+1)
continue;
#else
j = currententity->keynum;
while(j)
{
@ -1984,7 +1980,7 @@ void PPL_BaseEntTextures(void)
}
if (j)
continue;
#endif
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))

View file

@ -27,6 +27,9 @@ static qboolean ignoreprotocol;
//I wanna knick thier mods.
#define svcdp_skybox 37
#define svcdp_showlmp 35 // [string] slotname [string] lmpfilename [short] x [short] y
#define svcdp_hidelmp 36 // [string] slotname
#define TE_EXPLOSION3_NEH 16 // [vector] origin [coord] red [coord] green [coord] blue (fixme: ignored)
#define TE_LIGHTNING4_NEH 17 // [string] model [entity] entity [vector] start [vector] end
@ -135,6 +138,12 @@ void NPP_Flush(void)
}
bufferlen = 0;
break;
case svcdp_showlmp:
case svcdp_hidelmp:
ignoreprotocol = true;
Con_Printf ("Ignoring svc_showlmp\n");
break;
case svc_temp_entity:
switch (buffer[1])
{
@ -259,6 +268,9 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
{
switch(data)
{
case svcdp_showlmp:
case svcdp_hidelmp:
break;
case svc_temp_entity:
break;
case svc_setangle:
@ -437,12 +449,22 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
{
switch(majortype)
{
case svcdp_hidelmp:
case svc_setname:
case svc_stufftext:
case svc_centerprint:
if (!data)
protocollen = bufferlen;
break;
case svcdp_showlmp: // [string] slotname [string] lmpfilename [short] x [short] y
if (!data)
{ //second string, plus 4 bytes.
int i;
for (i = 0; i < bufferlen; i++)
if (!buffer[i])
protocollen = bufferlen+4;
}
break;
}
}

View file

@ -169,7 +169,6 @@ PF_Configstring
*/
static void VARGS PFQ2_Configstring (int i, char *val)
{
int j;
if (i < 0 || i >= Q2MAX_CONFIGSTRINGS)
Sys_Error ("configstring: bad index %i\n", i);

View file

@ -270,6 +270,7 @@ qboolean R_AliasCheckBBox (void)
{
if (minz > (r_aliastransition + (pmdl->size * r_resfudge)))
{
Con_Printf("Trivial accept 2 on %s\n", currententity->model->name);
currententity->trivial_accept |= 2;
}
}
@ -612,7 +613,7 @@ void R_AliasPrepareUnclippedPoints (void)
if (r_pixbytes == 4)
D_PolysetDraw32 ();
#if id386
#if 0//id386
else if (t_state & TT_ONE)
D_PolysetDrawAsm ();
#endif
@ -790,7 +791,6 @@ void R_AliasSetupFrame (void)
r_abacklerp[i] = paliashdr->frames[oframe].scale[i]*bl;
r_afrntlerp[i] = paliashdr->frames[frame].scale[i]*fl;
r_amovelerp[i] = paliashdr->frames[frame].scale_origin[i]*fl + paliashdr->frames[oframe].scale_origin[i]*bl;
}
if (paliashdr->frames[frame].type == ALIAS_SINGLE)
@ -901,14 +901,6 @@ void R_AliasDrawModel (alight_t *plighting)
r_recursiveaffinetriangles;
r_affinetridesc.pstverts = (mstvert_t *)((qbyte *)paliashdr + paliashdr->stverts);
/* {
int i;
for (i = 0; i < pmdl->numstverts; i++)
{
r_affinetridesc.pstverts[i].s = rand()<<8;
r_affinetridesc.pstverts[i].t = rand()<<8;
}
}*/
if (r_affinetridesc.drawtype)
{

View file

@ -198,8 +198,6 @@ void R_InitSkyBox (void)
model_t *wm;
wm = cl.worldmodel;
Hunk_Check();
if (wm->numsurfaces+6 > MAX_MAP_FACES
|| wm->numvertexes+8 > MAX_MAP_VERTS
@ -214,12 +212,9 @@ void R_InitSkyBox (void)
// wm->numedges += 12;
r_skysurfedges = wm->surfedges + wm->numsurfedges;
// wm->numsurfedges += 24;
Hunk_Check();
memset (r_skyfaces, 0, 6*sizeof(*r_skyfaces));
Hunk_Check();
for (i=0 ; i<6 ; i++)
{
r_skyplanes[i].normal[skybox_planes[i*2]] = 1;
@ -238,15 +233,12 @@ void R_InitSkyBox (void)
r_skyfaces[i].extents[0] = 256;
r_skyfaces[i].extents[1] = 256;
}
Hunk_Check();
for (i=0 ; i<24 ; i++)
if (box_surfedges[i] > 0)
r_skysurfedges[i] = wm->numedges-12 + box_surfedges[i];
else
r_skysurfedges[i] = - (wm->numedges-12 + -box_surfedges[i]);
Hunk_Check();
for(i=0 ; i<12 ; i++)
{
@ -254,6 +246,7 @@ void R_InitSkyBox (void)
r_skyedges[i].v[1] = wm->numvertexes-8+box_edges[i*2+1];
r_skyedges[i].cachededgeoffset = 0;
}
Hunk_Check();
}

View file

@ -637,6 +637,25 @@ void SWR_MarkLeaves (void)
}
}
//temporary
void SWR_DrawBeam(entity_t *e)
{
particle_t p;
vec3_t o1, o2;
vec3_t dir;
int len;
VectorSubtract(e->origin, e->oldorigin, dir);
VectorCopy(e->oldorigin, o1);
len = VectorNormalize(dir);
p.alpha = 1;
p.color = 15;
for (; len>=0; len--)
{
VectorAdd(o1, dir, o2);
D_DrawSparkTrans (&p, o1, o2);
VectorCopy(o2, o1);
}
}
/*
=============
@ -660,14 +679,29 @@ void SWR_DrawEntitiesOnList (void)
for (i=0 ; i<cl_numvisedicts ; i++)
{
currententity = &cl_visedicts[i];
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
continue;
if (currententity->flags & 2)
continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
{
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}
if (currententity->flags & Q2RF_BEAM)
{
SWR_DrawBeam(currententity);
continue;
}
if (!currententity->model)
continue;
@ -1058,6 +1092,8 @@ void R_DrawBEntitiesOnList (void)
if (!currententity->model)
continue;
if (currententity->flags & Q2RF_BEAM)
continue;
switch (currententity->model->type)
{

View file

@ -96,9 +96,13 @@ mpic_t *SWDraw_SafeCachePic (char *extpath)
qbyte *file, *image;
int width;
int height;
_snprintf(alternatename, MAX_QPATH-1,"%s.pcx", path);
_snprintf(alternatename, MAX_QPATH-1,"pics/%s.pcx", path);
file = COM_LoadMallocFile(alternatename);
if (!file)
{
_snprintf(alternatename, MAX_QPATH-1,"%s.pcx", path);
file = COM_LoadMallocFile(alternatename);
}
if (file)
{
image = ReadPCXFile(file, com_filesize, &width, &height);

View file

@ -381,7 +381,7 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash)
case MD3_IDENT:
SWMod_LoadAlias3Model (mod, buf);
break;
case IDSPRITEHEADER:
SWMod_LoadSpriteModel (mod, buf);
break;
@ -2053,7 +2053,7 @@ void * SWMod_LoadAliasFrame (void * pin, int *pframeindex, int numv,
for (i=0 ; i<3 ; i++)
{
// these are qbyte values, so we don't have to worry about
// these are byte values, so we don't have to worry about
// endianness
pbboxmin->v[i] = pdaliasframe->bboxmin.v[i];
pbboxmax->v[i] = pdaliasframe->bboxmax.v[i];
@ -2068,7 +2068,7 @@ void * SWMod_LoadAliasFrame (void * pin, int *pframeindex, int numv,
{
int k;
// these are all qbyte values, so no need to deal with endianness
// these are all byte values, so no need to deal with endianness
pframe[j].lightnormalindex = pinframe[j].lightnormalindex;
for (k=0 ; k<3 ; k++)
@ -2109,7 +2109,7 @@ void * SWMod_LoadAliasGroup (void * pin, int *pframeindex, int numv,
for (i=0 ; i<3 ; i++)
{
// these are qbyte values, so we don't have to worry about endianness
// these are byte values, so we don't have to worry about endianness
pbboxmin->v[i] = pingroup->bboxmin.v[i];
pbboxmax->v[i] = pingroup->bboxmax.v[i];
}
@ -2290,7 +2290,7 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
if (cls.state >= ca_connected)
{
CL_SendClientCommand("setinfo %s %d",
CL_SendClientCommand(true, "setinfo %s %d",
!strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name,
(int)crc);
}
@ -2508,6 +2508,8 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
//
end = Hunk_LowMark ();
total = end - start;
Hunk_Check();
Cache_Alloc (&mod->cache, total, loadname);
if (!mod->cache.data)
@ -2567,7 +2569,7 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
if (cls.state >= ca_connected)
{
CL_SendClientCommand("setinfo %s %d",
CL_SendClientCommand(true, "setinfo %s %d",
!strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name,
(int)crc);
}
@ -2900,6 +2902,22 @@ typedef struct {
float ang[3][3];
} md3tag_t;
qbyte *LoadTextureFile(char *texturename)
{
qbyte *tex;
if ((tex = COM_LoadMallocFile(texturename)))
return tex;
if ((tex = COM_LoadMallocFile(va("textures/%s.tga", texturename))))
return tex;
if ((tex = COM_LoadMallocFile(va("textures/%s.jpg", texturename))))
return tex;
if ((tex = COM_LoadMallocFile(va("%s.tga", texturename))))
return tex;
if ((tex = COM_LoadMallocFile(va("%s.jpg", texturename))))
return tex;
return NULL;
}
void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
{
@ -2944,7 +2962,7 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
if (cls.state >= ca_connected)
{
CL_SendClientCommand("setinfo %s %d",
CL_SendClientCommand(true, "setinfo %s %d",
!strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name,
(int)crc);
}
@ -3041,13 +3059,13 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
for (i=0 ; i<numskins ; i++, pinskin++)
{
buffer = COM_LoadMallocFile(pinskin->name);
buffer = LoadTextureFile(pinskin->name);
if (!buffer)
{
char altname[256];
strcpy(altname, mod->name); //backup
strcpy(COM_SkipPath(altname), COM_SkipPath(pinskin->name));
buffer = COM_LoadMallocFile(altname);
buffer = LoadTextureFile(altname);
}
if (!buffer)

View file

@ -292,6 +292,9 @@ qboolean DDRAW_Init(rendererstate_t *info, unsigned char **ppbuffer, int *ppitch
ddsd.dwFlags = /*DDSD_CAPS |*/ DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddsd.dwRefreshRate = info->rate;
if (ddsd.dwRefreshRate)
ddsd.dwFlags |= DDSD_REFRESHRATE;
Con_SafePrintf( "...creating front buffer: ");
if ( ( ddrval = lpDirectDraw->lpVtbl->CreateSurface( lpDirectDraw, &ddsd, &lpddsFrontBuffer, NULL ) ) != DD_OK )