Attempted to add support for divVerent's varlen protocol extension info. This is more silencing warnings than anything else.
Also tweeked video code to remove 6 dead sw-only functions. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3556 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
1a54e541be
commit
244c08ad04
40 changed files with 975 additions and 550 deletions
|
@ -2187,6 +2187,14 @@ void CL_ConnectionlessPacket (void)
|
|||
pext = MSG_ReadLong ();
|
||||
else if (c == PROTOCOL_VERSION_FTE2)
|
||||
pext2 = MSG_ReadLong ();
|
||||
else if (c == PROTOCOL_VERSION_VARLENGTH)
|
||||
{
|
||||
int len = MSG_ReadLong();
|
||||
if (len < 0 || len > 8192)
|
||||
break;
|
||||
c = MSG_ReadLong();/*ident*/
|
||||
MSG_ReadSkip(len); /*payload*/
|
||||
}
|
||||
#ifdef HUFFNETWORK
|
||||
else if (c == (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)))
|
||||
huffcrc = MSG_ReadLong ();
|
||||
|
|
|
@ -2051,14 +2051,32 @@ void CL_ParseServerData (void)
|
|||
protover = MSG_ReadLong ();
|
||||
if (protover == PROTOCOL_VERSION_FTE)
|
||||
{
|
||||
cls.fteprotocolextensions = MSG_ReadLong();
|
||||
cls.fteprotocolextensions = MSG_ReadLong();
|
||||
continue;
|
||||
}
|
||||
if (protover == PROTOCOL_VERSION_FTE2)
|
||||
{
|
||||
cls.fteprotocolextensions2 = MSG_ReadLong();
|
||||
cls.fteprotocolextensions2 = MSG_ReadLong();
|
||||
continue;
|
||||
}
|
||||
if (protover == PROTOCOL_VERSION_VARLENGTH)
|
||||
{
|
||||
int ident;
|
||||
int len;
|
||||
char data[1024];
|
||||
ident = MSG_ReadLong();
|
||||
len = MSG_ReadLong();
|
||||
if (len <= sizeof(data))
|
||||
{
|
||||
MSG_ReadData(data, len);
|
||||
switch(ident)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (protover == PROTOCOL_VERSION_QW) //this ends the version info
|
||||
break;
|
||||
if (cls.demoplayback && (protover == 26 || protover == 27 || protover == 28)) //older versions, maintain demo compatability.
|
||||
|
|
|
@ -710,7 +710,7 @@ int Image_WritePNG (char *filename, int compression, qbyte *pixels, int width, i
|
|||
|
||||
if (!(fp = fopen (name, "wb")))
|
||||
{
|
||||
COM_CreatePath (name);
|
||||
FS_CreatePath (filename, FS_GAMEONLY);
|
||||
if (!(fp = fopen (name, "wb")))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -88,12 +88,6 @@ extern void (*R_LessenStains) (void);
|
|||
|
||||
extern qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
extern void (*VID_DeInit) (void);
|
||||
extern void (*VID_LockBuffer) (void);
|
||||
extern void (*VID_UnlockBuffer) (void);
|
||||
extern void (*D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height);
|
||||
extern void (*D_EndDirectRect) (int x, int y, int width, int height);
|
||||
extern void (*VID_ForceLockState) (int lk);
|
||||
extern int (*VID_ForceUnlockedAndReturnState) (void);
|
||||
extern void (*VID_SetPalette) (unsigned char *palette);
|
||||
extern void (*VID_ShiftPalette) (unsigned char *palette);
|
||||
extern char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
|
||||
|
@ -213,12 +207,6 @@ typedef struct rendererinfo_s {
|
|||
|
||||
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
void (*VID_DeInit) (void);
|
||||
void (*VID_LockBuffer) (void);
|
||||
void (*VID_UnlockBuffer) (void);
|
||||
void (*D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height);
|
||||
void (*D_EndDirectRect) (int x, int y, int width, int height);
|
||||
void (*VID_ForceLockState) (int lk);
|
||||
int (*VID_ForceUnlockedAndReturnState) (void);
|
||||
void (*VID_SetPalette) (unsigned char *palette);
|
||||
void (*VID_ShiftPalette) (unsigned char *palette);
|
||||
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -358,13 +358,7 @@ typedef struct csqcedict_s
|
|||
#endif
|
||||
/*the above is shared with qclib*/
|
||||
link_t area;
|
||||
int num_leafs;
|
||||
short leafnums[MAX_ENT_LEAFS];
|
||||
#ifdef Q2BSPS
|
||||
int areanum; //q2bsp
|
||||
int areanum2; //q2bsp
|
||||
int headnode; //q2bsp
|
||||
#endif
|
||||
pvscache_t pvsinfo;
|
||||
#ifdef USEODE
|
||||
entityode_t ode;
|
||||
#endif
|
||||
|
|
|
@ -736,12 +736,6 @@ float (*Mod_GetFrameDuration) (struct model_s *model, int framenum);
|
|||
|
||||
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
void (*VID_DeInit) (void);
|
||||
void (*VID_LockBuffer) (void);
|
||||
void (*VID_UnlockBuffer) (void);
|
||||
void (*D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height);
|
||||
void (*D_EndDirectRect) (int x, int y, int width, int height);
|
||||
void (*VID_ForceLockState) (int lk);
|
||||
int (*VID_ForceUnlockedAndReturnState) (void);
|
||||
void (*VID_SetPalette) (unsigned char *palette);
|
||||
void (*VID_ShiftPalette) (unsigned char *palette);
|
||||
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
|
||||
|
@ -821,12 +815,6 @@ rendererinfo_t dedicatedrendererinfo = {
|
|||
|
||||
NULL, //VID_Init,
|
||||
NULL, //VID_DeInit,
|
||||
NULL, //VID_LockBuffer,
|
||||
NULL, //VID_UnlockBuffer,
|
||||
NULL, //D_BeginDirectRect,
|
||||
NULL, //D_EndDirectRect,
|
||||
NULL, //VID_ForceLockState,
|
||||
NULL, //VID_ForceUnlockedAndReturnState,
|
||||
NULL, //VID_SetPalette,
|
||||
NULL, //VID_ShiftPalette,
|
||||
NULL, //VID_GetRGBInfo,
|
||||
|
@ -1344,12 +1332,6 @@ void R_SetRenderer(rendererinfo_t *ri)
|
|||
|
||||
VID_Init = ri->VID_Init;
|
||||
VID_DeInit = ri->VID_DeInit;
|
||||
VID_LockBuffer = ri->VID_LockBuffer;
|
||||
VID_UnlockBuffer = ri->VID_UnlockBuffer;
|
||||
D_BeginDirectRect = ri->D_BeginDirectRect;
|
||||
D_EndDirectRect = ri->D_EndDirectRect;
|
||||
VID_ForceLockState = ri->VID_ForceLockState;
|
||||
VID_ForceUnlockedAndReturnState = ri->VID_ForceUnlockedAndReturnState;
|
||||
VID_SetPalette = ri->VID_SetPalette;
|
||||
VID_ShiftPalette = ri->VID_ShiftPalette;
|
||||
VID_GetRGBInfo = ri->VID_GetRGBInfo;
|
||||
|
|
|
@ -386,7 +386,8 @@ DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exception
|
|||
}
|
||||
}
|
||||
}
|
||||
MessageBox(NULL, "Kaboom! Sorry. Blame the nubs.", DISTRIBUTION " Sucks", 0);
|
||||
else
|
||||
MessageBox(NULL, "Kaboom! Sorry. No MiniDumpWriteDump function.", DISTRIBUTION " Sucks", 0);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
#endif
|
||||
|
@ -739,9 +740,6 @@ void VARGS Sys_Printf (char *fmt, ...)
|
|||
void Sys_Quit (void)
|
||||
{
|
||||
#ifndef SERVERONLY
|
||||
if (VID_ForceUnlockedAndReturnState)
|
||||
VID_ForceUnlockedAndReturnState ();
|
||||
|
||||
SetHookState(false);
|
||||
|
||||
Host_Shutdown ();
|
||||
|
|
|
@ -52,7 +52,6 @@ typedef struct
|
|||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
float aspect; // width / height -- < 0 is taller than wide
|
||||
int numpages;
|
||||
int recalc_refdef; // if true, recalc vid-based stuff
|
||||
|
||||
|
@ -88,16 +87,8 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette);
|
|||
// sets the mode; only used by the Quake engine for resetting to mode 0 (the
|
||||
// base mode) on memory allocation failures
|
||||
|
||||
void GLVID_LockBuffer (void);
|
||||
void GLVID_UnlockBuffer (void);
|
||||
|
||||
int GLVID_ForceUnlockedAndReturnState (void);
|
||||
void GLVID_ForceLockState (int lk);
|
||||
|
||||
qboolean GLVID_Is8bit();
|
||||
|
||||
void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
|
||||
void GLD_EndDirectRect (int x, int y, int width, int height);
|
||||
char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight);
|
||||
void GLVID_SetCaption(char *caption);
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
cvar_t com_fs_cache = SCVARF("fs_cache", IFMINIMAL("2","1"), CVAR_ARCHIVE);
|
||||
cvar_t rcon_level = SCVAR("rcon_level", "20");
|
||||
cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536");
|
||||
cvar_t dpcompat_set = SCVAR("dpcompat_set", "0");
|
||||
int Cmd_ExecLevel;
|
||||
|
||||
void Cmd_ForwardToServer (void);
|
||||
|
@ -2594,6 +2595,7 @@ void Cmd_set_f(void)
|
|||
const char *text;
|
||||
int forceflags = 0;
|
||||
qboolean docalc;
|
||||
char name[256];
|
||||
|
||||
if (Cmd_Argc()<3)
|
||||
{
|
||||
|
@ -2606,7 +2608,7 @@ void Cmd_set_f(void)
|
|||
else
|
||||
docalc = false;
|
||||
|
||||
var = Cvar_Get (Cmd_Argv(1), "", 0, "Custom variables");
|
||||
Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
|
||||
|
||||
if (Cmd_FromGamecode()) //AAHHHH!!! Q2 set command is different
|
||||
{
|
||||
|
@ -2619,6 +2621,11 @@ void Cmd_set_f(void)
|
|||
return;
|
||||
text = Cmd_Argv(2);
|
||||
}
|
||||
else if (dpcompat_set.ival)
|
||||
{
|
||||
text = Cmd_Argv(2);
|
||||
/*desc = Cmd_Argv(3)*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Cmd_ShiftArgs(1, false);
|
||||
|
@ -2646,6 +2653,8 @@ void Cmd_set_f(void)
|
|||
forceflags = 0;
|
||||
}
|
||||
|
||||
var = Cvar_Get (name, text, 0, "Custom variables");
|
||||
|
||||
mark = If_Token_GetMark();
|
||||
|
||||
if (var)
|
||||
|
|
|
@ -1103,6 +1103,31 @@ int MSG_ReadBits(int bits)
|
|||
return bitmask;
|
||||
}
|
||||
|
||||
void MSG_ReadSkip(int bytes)
|
||||
{
|
||||
if (net_message.packing!=SZ_RAWBYTES)
|
||||
{
|
||||
while (bytes > 4)
|
||||
{
|
||||
MSG_ReadBits(32);
|
||||
bytes-=4;
|
||||
}
|
||||
while (bytes > 0)
|
||||
{
|
||||
MSG_ReadBits(8);
|
||||
bytes--;
|
||||
}
|
||||
}
|
||||
if (msg_readcount+bytes > net_message.cursize)
|
||||
{
|
||||
msg_readcount = net_message.cursize;
|
||||
msg_badread = true;
|
||||
return;
|
||||
}
|
||||
msg_readcount += bytes;
|
||||
}
|
||||
|
||||
|
||||
// returns -1 and sets msg_badread if no more characters are available
|
||||
int MSG_ReadChar (void)
|
||||
{
|
||||
|
@ -2393,6 +2418,12 @@ skipwhite:
|
|||
return NULL; // end of file;
|
||||
data++;
|
||||
}
|
||||
if (c == '\n')
|
||||
{
|
||||
com_token[len++] = c;
|
||||
com_token[len] = 0;
|
||||
return (char*)data+1;
|
||||
}
|
||||
|
||||
// skip // comments
|
||||
if (c=='/')
|
||||
|
|
|
@ -168,6 +168,7 @@ float MSG_ReadAngle16 (void);
|
|||
void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd);
|
||||
void MSGQ2_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *move);
|
||||
void MSG_ReadData (void *data, int len);
|
||||
void MSG_ReadSkip (int len);
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
@ -372,7 +373,6 @@ qbyte *COM_LoadTempFile (const char *path);
|
|||
qbyte *COM_LoadTempFile2 (const char *path); //allocates a little bit more without freeing old temp
|
||||
qbyte *COM_LoadHunkFile (const char *path);
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
||||
void COM_CreatePath (char *path);
|
||||
void FS_ForceToPure(const char *str, const char *crcs, int seed);
|
||||
char *COM_GetPathInfo (int i, int *crc);
|
||||
char *COM_NextPath (char *prevpath);
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef struct cvar_group_s
|
|||
|
||||
//freestyle
|
||||
#define CVAR_POINTER (1<<5) // q2 style. May be converted to q1 if needed. These are often specified on the command line and then converted into q1 when registered properly.
|
||||
#define CVAR_FREEDEFAULT (1<<6) // q2 style. May be converted to q1 if needed. These are often specified on the command line and then converted into q1 when registered properly.
|
||||
#define CVAR_FREEDEFAULT (1<<6) //the default string was malloced/needs to be malloced, free on unregister
|
||||
#define CVAR_NOTFROMSERVER (1<<7) // the console will ignore changes to cvars if set at from the server or any gamecode. This is to protect against security flaws - like qterm
|
||||
#define CVAR_USERCREATED (1<<8) //write a 'set' or 'seta' in front of the var name.
|
||||
#define CVAR_CHEAT (1<<9) //latch to the default, unless cheats are enabled.
|
||||
|
|
|
@ -137,6 +137,7 @@ int fs_hash_files;
|
|||
|
||||
static const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen);
|
||||
void FS_RegisterDefaultFileSystems(void);
|
||||
static void COM_CreatePath (char *path);
|
||||
|
||||
#define ENFORCEFOPENMODE(mode) {if (strcmp(mode, "r") && strcmp(mode, "w")/* && strcmp(mode, "rw")*/)Sys_Error("fs mode %s is not permitted here\n");}
|
||||
|
||||
|
@ -351,7 +352,7 @@ COM_CreatePath
|
|||
Only used for CopyFile and download
|
||||
============
|
||||
*/
|
||||
void COM_CreatePath (char *path)
|
||||
static void COM_CreatePath (char *path)
|
||||
{
|
||||
char *ofs;
|
||||
|
||||
|
@ -1799,7 +1800,8 @@ void COM_Gamedir (const char *dir)
|
|||
#endif
|
||||
}
|
||||
|
||||
#define NEXCFG "set sv_maxairspeed \"400\"\nset sv_mintic \"0.01\"\ncl_nolerp 0\n"
|
||||
#define DPCOMPAT "set dpcompat_set 1\nset dpcompat_trailparticles 1\n"
|
||||
#define NEXCFG DPCOMPAT "set sv_maxairspeed \"400\"\nset sv_jumpvelocity 270\nset sv_mintic \"0.01\"\ncl_nolerp 0\nset r_particlesdesc effectinfo\n"
|
||||
#define DMFCFG "set com_parseutf8 1\npm_airstep 1\n"
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -3347,16 +3347,16 @@ void NET_InitServer(void)
|
|||
char *port;
|
||||
port = STRINGIFY(PORT_SERVER);
|
||||
|
||||
if (!svs.sockets)
|
||||
{
|
||||
svs.sockets = FTENET_CreateCollection(true);
|
||||
#ifndef SERVERONLY
|
||||
FTENET_AddToCollection(svs.sockets, "SVLoopback", port, FTENET_Loop_EstablishConnection, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sv_listen_nq.value || sv_listen_dp.value || sv_listen_qw.value || sv_listen_q3.value)
|
||||
{
|
||||
if (!svs.sockets)
|
||||
{
|
||||
svs.sockets = FTENET_CreateCollection(true);
|
||||
#ifndef SERVERONLY
|
||||
FTENET_AddToCollection(svs.sockets, "SVLoopback", port, FTENET_Loop_EstablishConnection, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
allowconnects = true;
|
||||
|
||||
Cvar_ForceCallback(&sv_port);
|
||||
|
@ -3374,8 +3374,15 @@ void NET_InitServer(void)
|
|||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
NET_CloseServer();
|
||||
|
||||
#ifndef SERVERONLY
|
||||
svs.sockets = FTENET_CreateCollection(true);
|
||||
FTENET_AddToCollection(svs.sockets, "SVLoopback", port, FTENET_Loop_EstablishConnection, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// init the message buffer
|
||||
|
|
|
@ -77,7 +77,7 @@ typedef struct trailstate_s {
|
|||
|
||||
#define PARTICLE_Z_CLIP 8.0
|
||||
|
||||
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
|
||||
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT, BM_INVMOD } blendmode_t;
|
||||
|
||||
#define frandom() (rand()*(1.0f/RAND_MAX))
|
||||
#define crandom() (rand()*(2.0f/RAND_MAX)-1.0f)
|
||||
|
|
|
@ -93,6 +93,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define PROTOCOL_VERSION_FTE (('F'<<0) + ('T'<<8) + ('E'<<16) + ('X' << 24)) //fte extensions.
|
||||
#define PROTOCOL_VERSION_FTE2 (('F'<<0) + ('T'<<8) + ('E'<<16) + ('2' << 24)) //fte extensions.
|
||||
#define PROTOCOL_VERSION_HUFFMAN (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)) //packet compression
|
||||
#define PROTOCOL_VERSION_VARLENGTH (('v'<<0) + ('l'<<8) + ('e'<<16) + ('n' << 24)) //packet compression
|
||||
|
||||
#define PROTOCOL_VERSION_QW 28
|
||||
#define PROTOCOL_VERSION_Q2_MIN 31
|
||||
|
|
|
@ -883,14 +883,11 @@ void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
|
|||
galiasinfo_t *inf;
|
||||
mesh_t mesh;
|
||||
texnums_t *skin;
|
||||
float entScale;
|
||||
|
||||
vec3_t saveorg;
|
||||
int surfnum;
|
||||
int bef;
|
||||
|
||||
float tmatrix[3][4];
|
||||
|
||||
qboolean needrecolour;
|
||||
qboolean nolightdir;
|
||||
|
||||
|
@ -946,7 +943,7 @@ void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
|
|||
bef = BEF_FORCEDEPTHTEST;
|
||||
if (e->flags & Q2RF_ADDITIVE)
|
||||
{
|
||||
bef |= BEF_FORCETRANSPARENT;
|
||||
bef |= BEF_FORCEADDITIVE;
|
||||
}
|
||||
else if (e->drawflags & DRF_TRANSLUCENT)
|
||||
{
|
||||
|
@ -973,113 +970,7 @@ void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
|
|||
|
||||
|
||||
qglPushMatrix();
|
||||
R_RotateForEntity(e);
|
||||
|
||||
if (e->scale != 1 && e->scale != 0) //hexen 2 stuff
|
||||
{
|
||||
vec3_t scale;
|
||||
vec3_t scale_origin;
|
||||
float xyfact, zfact;
|
||||
scale[0] = (clmodel->maxs[0]-clmodel->mins[0])/255;
|
||||
scale[1] = (clmodel->maxs[1]-clmodel->mins[1])/255;
|
||||
scale[2] = (clmodel->maxs[2]-clmodel->mins[2])/255;
|
||||
scale_origin[0] = clmodel->mins[0];
|
||||
scale_origin[1] = clmodel->mins[1];
|
||||
scale_origin[2] = clmodel->mins[2];
|
||||
|
||||
/* qglScalef( 1/scale[0],
|
||||
1/scale[1],
|
||||
1/scale[2]);
|
||||
qglTranslatef ( -scale_origin[0],
|
||||
-scale_origin[1],
|
||||
-scale_origin[2]);
|
||||
*/
|
||||
|
||||
if(e->scale != 0 && e->scale != 1)
|
||||
{
|
||||
entScale = (float)e->scale;
|
||||
switch(e->drawflags&SCALE_TYPE_MASKIN)
|
||||
{
|
||||
default:
|
||||
case SCALE_TYPE_UNIFORM:
|
||||
tmatrix[0][0] = scale[0]*entScale;
|
||||
tmatrix[1][1] = scale[1]*entScale;
|
||||
tmatrix[2][2] = scale[2]*entScale;
|
||||
xyfact = zfact = (entScale-1.0)*127.95;
|
||||
break;
|
||||
case SCALE_TYPE_XYONLY:
|
||||
tmatrix[0][0] = scale[0]*entScale;
|
||||
tmatrix[1][1] = scale[1]*entScale;
|
||||
tmatrix[2][2] = scale[2];
|
||||
xyfact = (entScale-1.0)*127.95;
|
||||
zfact = 1.0;
|
||||
break;
|
||||
case SCALE_TYPE_ZONLY:
|
||||
tmatrix[0][0] = scale[0];
|
||||
tmatrix[1][1] = scale[1];
|
||||
tmatrix[2][2] = scale[2]*entScale;
|
||||
xyfact = 1.0;
|
||||
zfact = (entScale-1.0)*127.95;
|
||||
break;
|
||||
}
|
||||
switch(currententity->drawflags&SCALE_ORIGIN_MASKIN)
|
||||
{
|
||||
default:
|
||||
case SCALE_ORIGIN_CENTER:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2]-scale[2]*zfact;
|
||||
break;
|
||||
case SCALE_ORIGIN_BOTTOM:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2];
|
||||
break;
|
||||
case SCALE_ORIGIN_TOP:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2]-scale[2]*zfact*2.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmatrix[0][0] = scale[0];
|
||||
tmatrix[1][1] = scale[1];
|
||||
tmatrix[2][2] = scale[2];
|
||||
tmatrix[0][3] = scale_origin[0];
|
||||
tmatrix[1][3] = scale_origin[1];
|
||||
tmatrix[2][3] = scale_origin[2];
|
||||
}
|
||||
|
||||
/* if(clmodel->flags&EF_ROTATE)
|
||||
{ // Floating motion
|
||||
tmatrix[2][3] += sin(currententity->origin[0]
|
||||
+currententity->origin[1]+(cl.time*3))*5.5;
|
||||
}*/
|
||||
|
||||
qglTranslatef (tmatrix[0][3],tmatrix[1][3],tmatrix[2][3]);
|
||||
qglScalef (tmatrix[0][0],tmatrix[1][1],tmatrix[2][2]);
|
||||
|
||||
qglScalef( 1/scale[0],
|
||||
1/scale[1],
|
||||
1/scale[2]);
|
||||
qglTranslatef ( -scale_origin[0],
|
||||
-scale_origin[1],
|
||||
-scale_origin[2]);
|
||||
}
|
||||
else if (!strcmp(clmodel->name, "progs/eyes.mdl"))
|
||||
{
|
||||
// double size of eyes, since they are really hard to see in gl
|
||||
qglTranslatef (0, 0, 0 - (22 + 8));
|
||||
qglScalef (2, 2, 2);
|
||||
}
|
||||
|
||||
if (!ruleset_allow_larger_models.ival && clmodel->clampscale != 1)
|
||||
{ //possibly this should be on a per-frame basis, but that's a real pain to do
|
||||
Con_DPrintf("Rescaling %s by %f\n", clmodel->name, clmodel->clampscale);
|
||||
qglScalef(clmodel->clampscale, clmodel->clampscale, clmodel->clampscale);
|
||||
}
|
||||
R_RotateForEntity(e, clmodel);
|
||||
|
||||
inf = RMod_Extradata (clmodel);
|
||||
if (qglPNTrianglesfATI && gl_ati_truform.ival)
|
||||
|
@ -1366,7 +1257,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
return;
|
||||
|
||||
qglPushMatrix();
|
||||
R_RotateForEntity(e);
|
||||
R_RotateForEntity(e, clmodel);
|
||||
|
||||
|
||||
inf = RMod_Extradata (clmodel);
|
||||
|
|
|
@ -185,7 +185,6 @@ void main (void)\n\
|
|||
vec3 halfdir = (normalize(eyevector) + normalize(lightvector))/2.0;\n\
|
||||
float dv = dot(halfdir, bumps);\n\
|
||||
diff += pow(dv, 8.0) * specs;\n\
|
||||
diff.g = pow(dv, 8.0);\n\
|
||||
#endif\n\
|
||||
""\n\
|
||||
#ifdef PCF\n\
|
||||
|
@ -942,7 +941,7 @@ static void tcgen_environment(float *st, unsigned int numverts, float *xyz, floa
|
|||
|
||||
RotateLightVector(shaderstate.curentity->axis, shaderstate.curentity->origin, r_origin, rorg);
|
||||
|
||||
for (i = 0 ; i < numverts ; i++, xyz += 3, normal += 3, st += 2 )
|
||||
for (i = 0 ; i < numverts ; i++, xyz += sizeof(vecV_t)/sizeof(vec_t), normal += 3, st += 2 )
|
||||
{
|
||||
VectorSubtract (rorg, xyz, viewer);
|
||||
VectorNormalizeFast (viewer);
|
||||
|
@ -1777,15 +1776,12 @@ static void BE_SendPassBlendAndDepth(unsigned int sbits)
|
|||
}
|
||||
if (shaderstate.flags & ~BEF_PUSHDEPTH)
|
||||
{
|
||||
if (!(sbits & SBITS_BLEND_BITS))
|
||||
{ /*only force blend bits if its not already blended*/
|
||||
if (shaderstate.flags & BEF_FORCEADDITIVE)
|
||||
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
||||
| (SBITS_SRCBLEND_ONE | SBITS_DSTBLEND_ONE);
|
||||
else if (shaderstate.flags & BEF_FORCETRANSPARENT) /*if transparency is forced, clear alpha test bits*/
|
||||
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
||||
| (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
if (shaderstate.flags & BEF_FORCEADDITIVE)
|
||||
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
||||
| (SBITS_SRCBLEND_ONE | SBITS_DSTBLEND_ONE);
|
||||
else if ((shaderstate.flags & BEF_FORCETRANSPARENT) && !(sbits & SBITS_BLEND_BITS)) /*if transparency is forced, clear alpha test bits*/
|
||||
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
||||
| (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (shaderstate.flags & BEF_FORCENODEPTH) /*EF_NODEPTHTEST dp extension*/
|
||||
sbits |= SBITS_MISC_NODEPTHTEST;
|
||||
|
@ -1908,10 +1904,25 @@ static void BE_SubmitMeshChain(void)
|
|||
int startv, starti, endv, endi;
|
||||
int m;
|
||||
mesh_t *mesh;
|
||||
extern cvar_t temp1;
|
||||
if (temp1.ival)
|
||||
{
|
||||
endv = 0;
|
||||
startv = 0x7fffffff;
|
||||
for (m = 0; m < shaderstate.meshcount; m++)
|
||||
{
|
||||
mesh = shaderstate.meshes[m];
|
||||
starti = mesh->vbofirstvert;
|
||||
if (starti < startv)
|
||||
startv = starti;
|
||||
endi = mesh->vbofirstvert+mesh->numvertexes;
|
||||
if (endi > endv)
|
||||
endv = endi;
|
||||
}
|
||||
qglLockArraysEXT(startv, endv);
|
||||
}
|
||||
|
||||
mesh = shaderstate.meshes[0];
|
||||
|
||||
for (m = 0; m < shaderstate.meshcount; )
|
||||
for (m = 0, mesh = shaderstate.meshes[0]; m < shaderstate.meshcount; )
|
||||
{
|
||||
startv = mesh->vbofirstvert;
|
||||
starti = mesh->vbofirstelement;
|
||||
|
@ -1936,6 +1947,8 @@ static void BE_SubmitMeshChain(void)
|
|||
|
||||
qglDrawRangeElements(GL_TRIANGLES, startv, endv, endi-starti, GL_INDEX_TYPE, shaderstate.sourcevbo->indicies + starti);
|
||||
}
|
||||
if (temp1.ival)
|
||||
qglUnlockArraysEXT();
|
||||
}
|
||||
|
||||
static void DrawPass(const shaderpass_t *pass)
|
||||
|
@ -2546,15 +2559,16 @@ static void BaseBrushTextures(entity_t *ent)
|
|||
batch_t batch;
|
||||
mesh_t *batchmeshes[64];
|
||||
|
||||
model = ent->model;
|
||||
|
||||
#ifdef RTLIGHTS
|
||||
if (BE_LightCullModel(ent->origin, ent->model))
|
||||
if (BE_LightCullModel(ent->origin, model))
|
||||
return;
|
||||
#endif
|
||||
|
||||
qglPushMatrix();
|
||||
R_RotateForEntity(ent);
|
||||
R_RotateForEntity(ent, model);
|
||||
|
||||
model = ent->model;
|
||||
chain = NULL;
|
||||
|
||||
// calculate dynamic lighting for bmodel if it's not an
|
||||
|
|
|
@ -613,7 +613,7 @@ void R_DrawHLModel(entity_t *curent)
|
|||
qglColor4f(difuse[0]/255+ambient[0]/255, difuse[1]/255+ambient[1]/255, difuse[2]/255+ambient[2]/255, curent->shaderRGBAf[3]);
|
||||
}
|
||||
|
||||
R_RotateForEntity (curent);
|
||||
R_RotateForEntity (curent, curent->model);
|
||||
|
||||
cbone = 0;
|
||||
for (bgroup = 0; bgroup < FS_COUNT; bgroup++)
|
||||
|
|
|
@ -491,7 +491,7 @@ void GL_SetupSceneProcessingTextures (void)
|
|||
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, PP_WARP_TEX_SIZE, PP_WARP_TEX_SIZE, 0, GL_RGB, GL_UNSIGNED_BYTE, pp_edge_tex);
|
||||
}
|
||||
|
||||
void R_RotateForEntity (entity_t *e)
|
||||
void R_RotateForEntity (entity_t *e, model_t *mod)
|
||||
{
|
||||
float m[16];
|
||||
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
|
||||
|
@ -540,6 +540,101 @@ void R_RotateForEntity (entity_t *e)
|
|||
m[15] = 1;
|
||||
|
||||
qglMultMatrixf(m);
|
||||
|
||||
if (!mod)
|
||||
return;
|
||||
|
||||
if (e->scale != 1 && e->scale != 0) //hexen 2 stuff
|
||||
{
|
||||
float tmatrix[3][4];
|
||||
vec3_t scale;
|
||||
vec3_t scale_origin;
|
||||
float xyfact, zfact, entScale;
|
||||
scale[0] = (mod->maxs[0]-mod->mins[0])/255;
|
||||
scale[1] = (mod->maxs[1]-mod->mins[1])/255;
|
||||
scale[2] = (mod->maxs[2]-mod->mins[2])/255;
|
||||
scale_origin[0] = mod->mins[0];
|
||||
scale_origin[1] = mod->mins[1];
|
||||
scale_origin[2] = mod->mins[2];
|
||||
|
||||
|
||||
entScale = (float)e->scale;
|
||||
switch(e->drawflags&SCALE_TYPE_MASKIN)
|
||||
{
|
||||
default:
|
||||
case SCALE_TYPE_UNIFORM:
|
||||
tmatrix[0][0] = scale[0]*entScale;
|
||||
tmatrix[1][1] = scale[1]*entScale;
|
||||
tmatrix[2][2] = scale[2]*entScale;
|
||||
xyfact = zfact = (entScale-1.0)*127.95;
|
||||
break;
|
||||
case SCALE_TYPE_XYONLY:
|
||||
tmatrix[0][0] = scale[0]*entScale;
|
||||
tmatrix[1][1] = scale[1]*entScale;
|
||||
tmatrix[2][2] = scale[2];
|
||||
xyfact = (entScale-1.0)*127.95;
|
||||
zfact = 1.0;
|
||||
break;
|
||||
case SCALE_TYPE_ZONLY:
|
||||
tmatrix[0][0] = scale[0];
|
||||
tmatrix[1][1] = scale[1];
|
||||
tmatrix[2][2] = scale[2]*entScale;
|
||||
xyfact = 1.0;
|
||||
zfact = (entScale-1.0)*127.95;
|
||||
break;
|
||||
}
|
||||
switch(currententity->drawflags&SCALE_ORIGIN_MASKIN)
|
||||
{
|
||||
default:
|
||||
case SCALE_ORIGIN_CENTER:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2]-scale[2]*zfact;
|
||||
break;
|
||||
case SCALE_ORIGIN_BOTTOM:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2];
|
||||
break;
|
||||
case SCALE_ORIGIN_TOP:
|
||||
tmatrix[0][3] = scale_origin[0]-scale[0]*xyfact;
|
||||
tmatrix[1][3] = scale_origin[1]-scale[1]*xyfact;
|
||||
tmatrix[2][3] = scale_origin[2]-scale[2]*zfact*2.0;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
{
|
||||
tmatrix[0][0] = scale[0];
|
||||
tmatrix[1][1] = scale[1];
|
||||
tmatrix[2][2] = scale[2];
|
||||
tmatrix[0][3] = scale_origin[0];
|
||||
tmatrix[1][3] = scale_origin[1];
|
||||
tmatrix[2][3] = scale_origin[2];
|
||||
}
|
||||
*/
|
||||
|
||||
qglTranslatef (tmatrix[0][3],tmatrix[1][3],tmatrix[2][3]);
|
||||
qglScalef (tmatrix[0][0],tmatrix[1][1],tmatrix[2][2]);
|
||||
|
||||
qglScalef( 1/scale[0],
|
||||
1/scale[1],
|
||||
1/scale[2]);
|
||||
qglTranslatef ( -scale_origin[0],
|
||||
-scale_origin[1],
|
||||
-scale_origin[2]);
|
||||
}
|
||||
else if (!strcmp(mod->name, "progs/eyes.mdl"))
|
||||
{
|
||||
// double size of eyes, since they are really hard to see in gl
|
||||
qglTranslatef (0, 0, 0 - (22 + 8));
|
||||
qglScalef (2, 2, 2);
|
||||
}
|
||||
|
||||
if (!ruleset_allow_larger_models.ival && mod->clampscale != 1)
|
||||
{ //possibly this should be on a per-frame basis, but that's a real pain to do
|
||||
Con_DPrintf("Rescaling %s by %f\n", mod->name, mod->clampscale);
|
||||
qglScalef(mod->clampscale, mod->clampscale, mod->clampscale);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1614,7 +1614,8 @@ void Shader_Free (shader_t *shader)
|
|||
int i;
|
||||
shaderpass_t *pass;
|
||||
|
||||
Hash_RemoveData(&shader_active_hash, shader->name, shader);
|
||||
if (shader->bucket.data == shader)
|
||||
Hash_RemoveData(&shader_active_hash, shader->name, shader);
|
||||
|
||||
#ifdef GLQUAKE
|
||||
if (qrenderer == QR_OPENGL)
|
||||
|
@ -2408,6 +2409,7 @@ void Shader_DefaultBSPLM(char *shortname, shader_t *s, const void *args)
|
|||
"{\n"
|
||||
"map $normalmap\n"
|
||||
"tcgen base\n"
|
||||
"depthwrite\n"
|
||||
"}\n"
|
||||
"{\n"
|
||||
"map $deluxmap\n"
|
||||
|
@ -2417,6 +2419,10 @@ void Shader_DefaultBSPLM(char *shortname, shader_t *s, const void *args)
|
|||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"tcgen base\n"
|
||||
"if $deluxmap\n"
|
||||
"[\n"
|
||||
"blendfunc gl_one gl_zero\n"
|
||||
"]\n"
|
||||
"}\n"
|
||||
"if $lightmap\n"
|
||||
"[\n"
|
||||
|
@ -2425,11 +2431,14 @@ void Shader_DefaultBSPLM(char *shortname, shader_t *s, const void *args)
|
|||
"blendfunc gl_dst_color gl_zero\n"
|
||||
"}\n"
|
||||
"]\n"
|
||||
"{\n"
|
||||
"map $fullbright\n"
|
||||
"blendfunc add\n"
|
||||
"depthfunc equal\n"
|
||||
"}\n"
|
||||
"if r_fb_bmodels\n"
|
||||
"[\n"
|
||||
"{\n"
|
||||
"map $fullbright\n"
|
||||
"blendfunc add\n"
|
||||
"depthfunc equal\n"
|
||||
"}\n"
|
||||
"]\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
|
|
|
@ -1698,11 +1698,6 @@ static void Sh_DrawEntLighting(dlight_t *light, vec3_t colour)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#pragma message "move to header"
|
||||
void BE_PushOffsetShadow(qboolean foobar);
|
||||
|
||||
|
||||
#define PROJECTION_DISTANCE (float)(dl->radius*2)//0x7fffffff
|
||||
/*Fixme: this is brute forced*/
|
||||
static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e)
|
||||
|
@ -1722,7 +1717,7 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e)
|
|||
RotateLightVector(e->axis, e->origin, dl->origin, lightorg);
|
||||
|
||||
qglPushMatrix();
|
||||
R_RotateForEntity(e);
|
||||
R_RotateForEntity(e, e->model);
|
||||
|
||||
GL_SelectVBO(0);
|
||||
GL_SelectEBO(0);
|
||||
|
|
|
@ -851,12 +851,6 @@ rendererinfo_t openglrendererinfo = {
|
|||
|
||||
GLVID_Init,
|
||||
GLVID_DeInit,
|
||||
GLVID_LockBuffer,
|
||||
GLVID_UnlockBuffer,
|
||||
GLD_BeginDirectRect,
|
||||
GLD_EndDirectRect,
|
||||
GLVID_ForceLockState,
|
||||
GLVID_ForceUnlockedAndReturnState,
|
||||
GLVID_SetPalette,
|
||||
GLVID_ShiftPalette,
|
||||
GLVID_GetRGBInfo,
|
||||
|
|
|
@ -183,15 +183,6 @@ void *GLX_GetSymbol(char *name)
|
|||
return symb;
|
||||
}
|
||||
|
||||
|
||||
void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void GLD_EndDirectRect (int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
static int XLateKey(XKeyEvent *ev, unsigned int *unicode)
|
||||
{
|
||||
|
||||
|
@ -951,7 +942,6 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
|||
if (vid.width > info->width)
|
||||
vid.width = info->width;
|
||||
|
||||
vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
|
||||
vid.numpages = 2;
|
||||
|
||||
InitSig(); // trap evil signals
|
||||
|
@ -1121,13 +1111,6 @@ void IN_Move (float *movements, int pnum)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
void GLVID_UnlockBuffer() {}
|
||||
void GLVID_LockBuffer() {}
|
||||
|
||||
int GLVID_ForceUnlockedAndReturnState (void) {return 0;}
|
||||
void GLVID_ForceLockState (int lk) {}
|
||||
|
||||
void GL_DoSwap(void) {}
|
||||
|
||||
void GLVID_SetCaption(char *text)
|
||||
|
|
|
@ -189,14 +189,6 @@ qboolean GLVID_IsLocked(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GLD_BeginDirectRect(int x, int y, qbyte *pbitmap, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void GLD_EndDirectRect(int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void GLVID_SetCaption(char *text)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -325,15 +325,6 @@ int GLVID_ForceUnlockedAndReturnState (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void GLD_EndDirectRect (int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify)
|
||||
{
|
||||
// RECT rect;
|
||||
|
|
|
@ -33,11 +33,8 @@ void GLD_EndDirectRect(int x, int y, int width, int height)
|
|||
{
|
||||
}
|
||||
|
||||
void GL_BeginRendering (int *x, int *y, int *width, int *height)
|
||||
void GL_BeginRendering (void)
|
||||
{
|
||||
*x = *y = 0;
|
||||
*width = 640;
|
||||
*height = 480;
|
||||
}
|
||||
|
||||
void GL_EndRendering (void)
|
||||
|
|
|
@ -102,7 +102,7 @@ void GLVID_DeInit (void)
|
|||
}
|
||||
|
||||
|
||||
void GL_BeginRendering ()
|
||||
void GL_BeginRendering (void)
|
||||
{
|
||||
vid.pixelwidth = glwidth;
|
||||
vid.pixelheight = glheight;
|
||||
|
@ -150,32 +150,6 @@ void GL_EndRendering (void)
|
|||
GL_DoSwap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLVID_LockBuffer (void)
|
||||
{
|
||||
}
|
||||
|
||||
void GLVID_UnlockBuffer (void)
|
||||
{
|
||||
}
|
||||
|
||||
int GLVID_ForceUnlockedAndReturnState (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void GLD_EndDirectRect (int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
void GLVID_ForceLockState (int lk)
|
||||
{
|
||||
}
|
||||
|
||||
void GLVID_SetPalette (unsigned char *palette)
|
||||
{
|
||||
qbyte *pal;
|
||||
|
|
|
@ -316,7 +316,7 @@ qboolean R_CullBox (vec3_t mins, vec3_t maxs);
|
|||
#ifdef GLQUAKE
|
||||
qboolean R_CullSphere (vec3_t origin, float radius);
|
||||
qboolean R_CullEntityBox(entity_t *e, vec3_t modmins, vec3_t modmaxs);
|
||||
void R_RotateForEntity (entity_t *e);
|
||||
void R_RotateForEntity (entity_t *e, model_t *mod);
|
||||
|
||||
void GL_InitSceneProcessingShaders (void);
|
||||
void GL_SetupSceneProcessingTextures (void);
|
||||
|
|
|
@ -404,6 +404,7 @@ void BE_ClearVBO(vbo_t *vbo);
|
|||
void BE_UploadAllLightmaps(void);
|
||||
|
||||
#ifdef RTLIGHTS
|
||||
void BE_PushOffsetShadow(qboolean foobar);
|
||||
//submits the world and ents... used only by gl_shadows.c
|
||||
void BE_SubmitMeshes (void);
|
||||
//sets up gl for depth-only FIXME
|
||||
|
|
|
@ -205,7 +205,7 @@ void QC_FlushProgsOffsets(progfuncs_t *progfuncs)
|
|||
//origionaloffs is used to track matching field offsets. fields with the same progs offset overlap
|
||||
|
||||
//note: we probably suffer from progs with renamed system globals.
|
||||
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, size_t engineofs, size_t progsofs)
|
||||
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, signed long engineofs, signed long progsofs)
|
||||
{
|
||||
// progstate_t *p;
|
||||
// int pnum;
|
||||
|
|
|
@ -101,7 +101,7 @@ void QC_InitShares(progfuncs_t *progfuncs);
|
|||
void QC_StartShares(progfuncs_t *progfuncs);
|
||||
void QC_AddSharedVar(progfuncs_t *progfuncs, int num, int type);
|
||||
void QC_AddSharedFieldVar(progfuncs_t *progfuncs, int num, char *stringtable);
|
||||
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, size_t requestedpos, size_t originalofs);
|
||||
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, signed long requestedpos, signed long originalofs);
|
||||
pbool Decompile(progfuncs_t *progfuncs, char *fname);
|
||||
int PR_ToggleBreakpoint(progfuncs_t *progfuncs, char *filename, int linenum, int flag);
|
||||
void StripExtension (char *path);
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
|
||||
#ifndef PROGSLIB_H
|
||||
#define PROGSLIB_H
|
||||
/*#define true 1
|
||||
#define false 0
|
||||
|
||||
#define PITCH 0
|
||||
#define YAW 1
|
||||
#define ROLL 2
|
||||
|
||||
typedef char bool;
|
||||
//typedef float vec3_t[3];
|
||||
typedef int progsnum_t;
|
||||
typedef int func_t;
|
||||
#ifndef COMPILER
|
||||
typedef char *string_t;
|
||||
#endif
|
||||
//typedef struct globalvars_s globalvars_t;
|
||||
//typedef struct edict_s edict_t;
|
||||
#define globalvars_t void
|
||||
#define edict_t void
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define VARGS __cdecl
|
||||
#endif
|
||||
|
@ -132,7 +112,7 @@ struct progfuncs_s {
|
|||
|
||||
int lastcalledbuiltinnumber; //useful with non-implemented opcodes.
|
||||
|
||||
int (*RegisterFieldVar) (progfuncs_t *prinst, unsigned int type, char *name, size_t requestedpos, size_t originalofs);
|
||||
int (*RegisterFieldVar) (progfuncs_t *prinst, unsigned int type, char *name, signed long requestedpos, signed long originalofs);
|
||||
|
||||
char *tempstringbase; //for engine's use. Store your base tempstring pointer here.
|
||||
int tempstringnum; //for engine's use.
|
||||
|
|
|
@ -9103,7 +9103,7 @@ void QCC_PR_ParseDefs (char *classname)
|
|||
def->constant = false;
|
||||
else
|
||||
def->constant = true;
|
||||
if (QCC_PR_CheckImmediate("0"))
|
||||
if (QCC_PR_CheckImmediate("0") || QCC_PR_CheckImmediate("0i"))
|
||||
{
|
||||
def->constant = 0;
|
||||
def->initialized = 1; //fake function
|
||||
|
|
|
@ -2385,14 +2385,6 @@ CompilerConstant_t *QCC_PR_CheckCompConstDefined(char *def)
|
|||
{
|
||||
CompilerConstant_t *c = pHash_Get(&compconstantstable, def);
|
||||
return c;
|
||||
/*int a;
|
||||
for (a = 0; a < numCompilerConstants; a++)
|
||||
{
|
||||
if (!strncmp(def, CompilerConstant[a].name, CompilerConstant[a].namelen+1))
|
||||
return &CompilerConstant[a];
|
||||
}
|
||||
return NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
void ED_Print (struct progfuncs_s *progfuncs, struct edict_s *ed);
|
||||
int PR_EnableEBFSBuiltin(char *name, int binum);
|
||||
|
||||
/*cvars for the gamecode only*/
|
||||
cvar_t nomonsters = SCVAR("nomonsters", "0");
|
||||
cvar_t gamecfg = SCVAR("gamecfg", "0");
|
||||
cvar_t scratch1 = SCVAR("scratch1", "0");
|
||||
|
@ -49,10 +50,16 @@ cvar_t saved4 = SCVARF("saved4", "0", CVAR_ARCHIVE);
|
|||
cvar_t temp1 = SCVARF("temp1", "0", CVAR_ARCHIVE);
|
||||
cvar_t noexit = SCVAR("noexit", "0");
|
||||
|
||||
cvar_t pr_maxedicts = SCVARF("pr_maxedicts", "2048", CVAR_LATCH);
|
||||
/*cvars purely for compat with others*/
|
||||
cvar_t dpcompat_trailparticles = SCVAR("dpcompat_trailparticles", "0");
|
||||
cvar_t pr_imitatemvdsv = SCVARF("pr_imitatemvdsv", "0", CVAR_LATCH);
|
||||
|
||||
/*compat with frikqcc's arrays (ensures that unknown fields are at the same offsets*/
|
||||
cvar_t pr_fixbrokenqccarrays = SCVARF("pr_fixbrokenqccarrays", "1", CVAR_LATCH);
|
||||
|
||||
/*other stuff*/
|
||||
cvar_t pr_maxedicts = SCVARF("pr_maxedicts", "2048", CVAR_LATCH);
|
||||
|
||||
cvar_t pr_no_playerphysics = SCVARF("pr_no_playerphysics", "0", CVAR_LATCH);
|
||||
|
||||
cvar_t progs = SCVARF("progs", "", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_NOTFROMSERVER);
|
||||
|
@ -1013,9 +1020,11 @@ void PR_Init(void)
|
|||
Cmd_AddCommand ("svtestprogs", QCLibTest);
|
||||
#endif
|
||||
*/
|
||||
Cvar_Register(&pr_maxedicts, cvargroup_progs);
|
||||
Cvar_Register(&dpcompat_trailparticles, "Darkplaces compatibility");
|
||||
Cvar_Register(&pr_imitatemvdsv, cvargroup_progs);
|
||||
Cvar_Register(&pr_fixbrokenqccarrays, cvargroup_progs);
|
||||
|
||||
Cvar_Register(&pr_maxedicts, cvargroup_progs);
|
||||
Cvar_Register(&pr_no_playerphysics, cvargroup_progs);
|
||||
|
||||
for (i = 0; i < MAXADDONS; i++)
|
||||
|
@ -7228,12 +7237,23 @@ void PF_sv_particleeffectnum(progfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
void PF_sv_trailparticles(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
#ifdef PEXT_CSQC
|
||||
#pragma message("PF_sv_trailparticles: first two parameters differ from dp, but comply with spec")
|
||||
int efnum = G_FLOAT(OFS_PARM0);
|
||||
int ednum = G_EDICTNUM(prinst, OFS_PARM1);
|
||||
int efnum;
|
||||
int ednum;
|
||||
float *start = G_VECTOR(OFS_PARM2);
|
||||
float *end = G_VECTOR(OFS_PARM3);
|
||||
|
||||
/*DP gets this wrong*/
|
||||
if (dpcompat_trailparticles.ival)
|
||||
{
|
||||
ednum = G_EDICTNUM(prinst, OFS_PARM0);
|
||||
efnum = G_FLOAT(OFS_PARM1);
|
||||
}
|
||||
else
|
||||
{
|
||||
efnum = G_FLOAT(OFS_PARM0);
|
||||
ednum = G_EDICTNUM(prinst, OFS_PARM1);
|
||||
}
|
||||
|
||||
MSG_WriteByte(&sv.multicast, svcfte_trailparticles);
|
||||
MSG_WriteShort(&sv.multicast, ednum);
|
||||
MSG_WriteShort(&sv.multicast, efnum);
|
||||
|
|
|
@ -2440,7 +2440,7 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, qbyte *pvs,
|
|||
if (ent->xv->customizeentityforclient)
|
||||
{
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent);
|
||||
pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, clent);
|
||||
pr_global_struct->other = (clent?EDICT_TO_PROG(svprogfuncs, clent):0);
|
||||
PR_ExecuteProgram(svprogfuncs, ent->xv->customizeentityforclient);
|
||||
if(!G_FLOAT(OFS_RETURN))
|
||||
continue;
|
||||
|
@ -2448,7 +2448,7 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, qbyte *pvs,
|
|||
|
||||
if (ent->xv->viewmodelforclient)
|
||||
{
|
||||
if (ent->xv->viewmodelforclient != EDICT_TO_PROG(svprogfuncs, host_client->edict))
|
||||
if (ent->xv->viewmodelforclient != (clent?EDICT_TO_PROG(svprogfuncs, clent):0))
|
||||
continue;
|
||||
pvsflags = PVSF_IGNOREPVS;
|
||||
}
|
||||
|
|
|
@ -1963,7 +1963,7 @@ void SV_MVD_Record_f (void)
|
|||
|
||||
COM_StripExtension(name, name, sizeof(name));
|
||||
COM_DefaultExtension(name, ".mvd", sizeof(name));
|
||||
COM_CreatePath(name);
|
||||
FS_CreatePath (name, FS_GAMEONLY);
|
||||
|
||||
//
|
||||
// open the demo file and start recording
|
||||
|
@ -2243,8 +2243,8 @@ void SV_MVDEasyRecord_f (void)
|
|||
Q_strncpyz(name, va("%s/%s", sv_demoDir.string, name), sizeof(name));
|
||||
// find a filename that doesn't exist yet
|
||||
Q_strncpyz(name2, name, sizeof(name2));
|
||||
FS_CreatePath (sv_demoDir.string, FS_GAMEONLY);
|
||||
// COM_StripExtension(name2, name2);
|
||||
FS_CreatePath (name2, FS_GAMEONLY);
|
||||
strcat (name2, ".mvd");
|
||||
if ((f = FS_OpenVFS(name2, "rb", FS_GAMEONLY)) == 0)
|
||||
f = FS_OpenVFS(va("%s.gz", name2), "rb", FS_GAMEONLY);
|
||||
|
|
|
@ -41,6 +41,93 @@ static HANDLE hconsoleout;
|
|||
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#if _MSC_VER >= 1300
|
||||
#define CATCHCRASH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CATCHCRASH
|
||||
#include "dbghelp.h"
|
||||
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP) (
|
||||
HANDLE hProcess,
|
||||
DWORD ProcessId,
|
||||
HANDLE hFile,
|
||||
MINIDUMP_TYPE DumpType,
|
||||
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
|
||||
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
PMINIDUMP_CALLBACK_INFORMATION CallbackParam
|
||||
);
|
||||
|
||||
DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exceptionInfo)
|
||||
{
|
||||
char dumpPath[1024];
|
||||
HANDLE hProc = GetCurrentProcess();
|
||||
DWORD procid = GetCurrentProcessId();
|
||||
HANDLE dumpfile;
|
||||
HMODULE hDbgHelp;
|
||||
MINIDUMPWRITEDUMP fnMiniDumpWriteDump;
|
||||
HMODULE hKernel;
|
||||
BOOL (WINAPI *pIsDebuggerPresent)(void);
|
||||
|
||||
hKernel = LoadLibrary ("kernel32");
|
||||
pIsDebuggerPresent = (void*)GetProcAddress(hKernel, "IsDebuggerPresent");
|
||||
|
||||
#ifdef GLQUAKE
|
||||
GLVID_Crashed();
|
||||
#endif
|
||||
|
||||
if (pIsDebuggerPresent ())
|
||||
{
|
||||
/*if we have a current window, minimize it to bring us out of fullscreen*/
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
hDbgHelp = LoadLibrary ("DBGHELP");
|
||||
if (hDbgHelp)
|
||||
fnMiniDumpWriteDump = (MINIDUMPWRITEDUMP)GetProcAddress (hDbgHelp, "MiniDumpWriteDump");
|
||||
else
|
||||
fnMiniDumpWriteDump = NULL;
|
||||
|
||||
if (fnMiniDumpWriteDump)
|
||||
{
|
||||
if (MessageBox(NULL, "KABOOM! We crashed!\nBlame the monkey in the corner.\nI hope you saved your work.\nWould you like to take a dump now?", DISTRIBUTION " Sucks", MB_ICONSTOP|MB_YESNO) != IDYES)
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
|
||||
/*take a dump*/
|
||||
GetTempPath (sizeof(dumpPath)-16, dumpPath);
|
||||
Q_strncatz(dumpPath, DISTRIBUTION"CrashDump.dmp", sizeof(dumpPath));
|
||||
dumpfile = CreateFile (dumpPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (dumpfile)
|
||||
{
|
||||
MINIDUMP_EXCEPTION_INFORMATION crashinfo;
|
||||
crashinfo.ClientPointers = TRUE;
|
||||
crashinfo.ExceptionPointers = exceptionInfo;
|
||||
crashinfo.ThreadId = GetCurrentThreadId ();
|
||||
if (fnMiniDumpWriteDump(hProc, procid, dumpfile, MiniDumpWithIndirectlyReferencedMemory|MiniDumpWithDataSegs, &crashinfo, NULL, NULL))
|
||||
{
|
||||
CloseHandle(dumpfile);
|
||||
MessageBox(NULL, va("You can find the crashdump at\n%s\nPlease send this file to someone.\n\nWarning: sensitive information (like your current user name) might be present in the dump.\nYou will probably want to compress it.", dumpPath), DISTRIBUTION " Sucks", 0);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
MessageBox(NULL, "Kaboom! Sorry. No MiniDumpWriteDump function.", DISTRIBUTION " Sucks", 0);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Sys_CloseLibrary(dllhandle_t *lib)
|
||||
{
|
||||
FreeLibrary((HMODULE)lib);
|
||||
|
@ -1191,32 +1278,43 @@ int main (int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
COM_InitArgv (argc, argv);
|
||||
#ifdef USESERVICE
|
||||
if (COM_CheckParm("-register"))
|
||||
#ifdef CATCHCRASH
|
||||
__try
|
||||
#endif
|
||||
{
|
||||
CreateSampleService(1);
|
||||
return true;
|
||||
COM_InitArgv (argc, argv);
|
||||
#ifdef USESERVICE
|
||||
if (COM_CheckParm("-register"))
|
||||
{
|
||||
CreateSampleService(1);
|
||||
return true;
|
||||
}
|
||||
if (COM_CheckParm("-unregister"))
|
||||
{
|
||||
CreateSampleService(0);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _DEBUG
|
||||
if (COM_CheckParm("-noreset"))
|
||||
{
|
||||
signal (SIGFPE, Signal_Error_Handler);
|
||||
signal (SIGILL, Signal_Error_Handler);
|
||||
signal (SIGSEGV, Signal_Error_Handler);
|
||||
}
|
||||
#endif
|
||||
StartQuakeServer();
|
||||
|
||||
ServerMainLoop();
|
||||
}
|
||||
if (COM_CheckParm("-unregister"))
|
||||
#ifdef CATCHCRASH
|
||||
__except (CrashExceptionHandler(GetExceptionCode(), GetExceptionInformation()))
|
||||
{
|
||||
CreateSampleService(0);
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _DEBUG
|
||||
if (COM_CheckParm("-noreset"))
|
||||
{
|
||||
signal (SIGFPE, Signal_Error_Handler);
|
||||
signal (SIGILL, Signal_Error_Handler);
|
||||
signal (SIGSEGV, Signal_Error_Handler);
|
||||
}
|
||||
#endif
|
||||
StartQuakeServer();
|
||||
|
||||
ServerMainLoop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue