Compare commits

...

5 Commits

Author SHA1 Message Date
an 0870dfba2e make progs not a pointer 2019-12-03 02:31:56 -05:00
an c47de412bd fix standards violations 2019-12-03 02:02:24 -05:00
an da538dc69f remove IS_NAN (isnan exists) 2019-12-03 01:51:23 -05:00
an 7b2975f5ba remove E_ functions 2019-12-02 10:37:05 -05:00
an 39ceff0005 remove redundant code and a fair amount of references to quake 2019-12-02 10:20:59 -05:00
38 changed files with 394 additions and 409 deletions

View File

@ -145,7 +145,7 @@ bool BGM_Init(void)
switch(wanted_handlers[i].player) switch(wanted_handlers[i].player)
{ {
case BGM_MIDIDRV: case BGM_MIDIDRV:
/* not supported in quake */ /* not supported */
break; break;
case BGM_STREAMER: case BGM_STREAMER:
wanted_handlers[i].is_available = wanted_handlers[i].is_available =
@ -205,7 +205,7 @@ static void BGM_Play_noext(const char *filename, uint32_t allowed_types)
switch(handler->player) switch(handler->player)
{ {
case BGM_MIDIDRV: case BGM_MIDIDRV:
/* not supported in quake */ /* not supported */
break; break;
case BGM_STREAMER: case BGM_STREAMER:
bgmstream = S_CodecOpenStreamType(tmp, handler->type); bgmstream = S_CodecOpenStreamType(tmp, handler->type);
@ -263,7 +263,7 @@ void BGM_Play(const char *filename)
switch(handler->player) switch(handler->player)
{ {
case BGM_MIDIDRV: case BGM_MIDIDRV:
/* not supported in quake */ /* not supported */
break; break;
case BGM_STREAMER: case BGM_STREAMER:
bgmstream = S_CodecOpenStreamType(tmp, handler->type); bgmstream = S_CodecOpenStreamType(tmp, handler->type);

View File

@ -216,8 +216,8 @@ Cmd_StuffCmds_f -- johnfitz -- rewritten to read the "cmdline" cvar, for use wit
Adds command line parameters as script statements Adds command line parameters as script statements
Commands lead with a +, and continue until a - or another + Commands lead with a +, and continue until a - or another +
quake +prog jctest.qp +cmd amlev1 <program name> +prog jctest.qp +cmd amlev1
quake -nosound +cmd amlev1 <program name> -nosound +cmd amlev1
=============== ===============
*/ */
void Cmd_StuffCmds_f(void) void Cmd_StuffCmds_f(void)

View File

@ -47,26 +47,26 @@ bool standard_quake = true, rogue, hipnotic;
/* /*
All of Quake's data access is through a hierchal file system, but the contents All of our data access is through a hierchal file system, but the contents of
of the file system can be transparently merged from several sources. the file system can be transparently merged from several sources.
The "base directory" is the path to the directory holding the quake.exe and all The "base directory" is the path to the directory holding the executable and
game directories. The sys_* files pass this to host_init in quakeparms_t->basedir. all game directories. The sys_* files pass this to host_init in
This can be overridden with the "-basedir" command line parm to allow code quakeparms_t->basedir. This can be overridden with the "-basedir" command line
debugging in a different directory. The base directory is only used during parm to allow code debugging in a different directory. The base directory is
filesystem initialization. only used during filesystem initialization.
The "game directory" is the first tree on the search path and directory that all The "game directory" is the first tree on the search path and directory that
generated files (savegames, screenshots, demos, config files) will be saved to. all generated files (savegames, screenshots, demos, config files) will be saved
This can be overridden with the "-game" command line parameter. The game to. This can be overridden with the "-game" command line parameter. The game
directory can never be changed while quake is executing. This is a precacution directory can never be changed while the game is executing. This is a
against having a malicious server instruct clients to write files over areas they precacution against having a malicious server instruct clients to write files
shouldn't. over areas they shouldn't.
The "cache directory" is only used during development to save network bandwidth, The "cache directory" is only used during development to save network
especially over ISDN / T1 lines. If there is a cache directory specified, when bandwidth, especially over ISDN / T1 lines. If there is a cache directory
a file is found by the normal search path, it will be mirrored into the cache specified, when a file is found by the normal search path, it will be mirrored
directory, then opened there. into the cache directory, then opened there.
*/ */
@ -516,67 +516,115 @@ float Q_atof(const char *str)
============================================================================ ============================================================================
*/ */
bool host_bigendian; bool host_bigendian;
int16_t (*BigShort)(int16_t l); int16_t (*BigShort)(int16_t l);
int16_t (*LittleShort)(int16_t l);
int32_t (*BigLong)(int32_t l); int32_t (*BigLong)(int32_t l);
float (*BigFloat)(float l);
int16_t (*LittleShort)(int16_t l);
int32_t (*LittleLong)(int32_t l); int32_t (*LittleLong)(int32_t l);
float (*BigFloat)(float l); float (*LittleFloat)(float l);
float (*LittleFloat)(float l);
int16_t ShortSwap(int16_t l) static int16_t ShortSwap(int16_t l)
{ {
byte b1, b2; int32_t copy;
((byte *)&copy)[0] = ((byte *)&l)[1];
b1 = l & 255; ((byte *)&copy)[1] = ((byte *)&l)[0];
b2 = (l >> 8) & 255; return copy;
return (b1 << 8) + b2;
} }
int16_t ShortNoSwap(int16_t l) static int16_t ShortNoSwap(int16_t l)
{ {
return l; return l;
} }
int32_t LongSwap(int32_t l) static int32_t LongSwap(int32_t l)
{ {
byte b1, b2, b3, b4; int32_t copy;
((byte *)&copy)[0] = ((byte *)&l)[3];
b1 = l & 255; ((byte *)&copy)[1] = ((byte *)&l)[2];
b2 = (l >> 8) & 255; ((byte *)&copy)[2] = ((byte *)&l)[1];
b3 = (l >> 16) & 255; ((byte *)&copy)[3] = ((byte *)&l)[0];
b4 = (l >> 24) & 255; return copy;
return ((int32_t)b1 << 24) + ((int32_t)b2 << 16) + ((int32_t)b3 << 8) + b4;
} }
int32_t LongNoSwap(int32_t l) static int32_t LongNoSwap(int32_t l)
{ {
return l; return l;
} }
float FloatSwap(float f) static float FloatSwap(float f)
{
float copy;
((byte *)&copy)[0] = ((byte *)&f)[3];
((byte *)&copy)[1] = ((byte *)&f)[2];
((byte *)&copy)[2] = ((byte *)&f)[1];
((byte *)&copy)[3] = ((byte *)&f)[0];
return copy;
}
static float FloatNoSwap(float f)
{
return f;
}
int16_t ReadBigShort(byte *bytes)
{
int16_t v;
v = bytes[1];
v |= bytes[0] << 8;
return v;
}
int32_t ReadBigLong(byte *bytes)
{
int32_t v;
v = bytes[3];
v |= bytes[2] << 8;
v |= bytes[1] << 16;
v |= bytes[0] << 24;
return v;
}
float ReadBigFloat(byte *bytes)
{ {
union union
{ {
float f; float f;
byte b[4]; uint32_t i;
} dat1, dat2; } data;
data.i = ReadBigLong(bytes);
return data.f;
dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];
dat2.b[2] = dat1.b[1];
dat2.b[3] = dat1.b[0];
return dat2.f;
} }
float FloatNoSwap(float f) int16_t ReadLittleShort(byte *bytes)
{ {
return f; int16_t v;
v = bytes[0];
v |= bytes[1] << 8;
return v;
}
int32_t ReadLittleLong(byte *bytes)
{
int32_t v;
v = bytes[0];
v |= bytes[1] << 8;
v |= bytes[2] << 16;
v |= bytes[3] << 24;
return v;
}
float ReadLittleFloat(byte *bytes)
{
union
{
float f;
uint32_t i;
} data;
data.i = ReadLittleLong(bytes);
return data.f;
} }
/* /*
@ -1294,41 +1342,30 @@ COM_Init
void COM_Init(void) void COM_Init(void)
{ {
int32_t i = 0x12345678; int32_t i = 0x12345678;
/* U N I X */
/* if(*(byte *)&i == 0x12)
BE_ORDER: 12 34 56 78
U N I X
LE_ORDER: 78 56 34 12
X I N U
PDP_ORDER: 34 12 78 56
N U X I
*/
if(*(char *)&i == 0x12)
host_bigendian = true; host_bigendian = true;
else if(*(char *)&i == 0x78) else if(*(byte *)&i == 0x78)
host_bigendian = false; host_bigendian = false;
else /* if ( *(char *)&i == 0x34 ) */ else
Sys_Error("Unsupported endianism."); Sys_Error("Unsupported endianness");
if(host_bigendian) if(host_bigendian)
{ {
BigShort = ShortNoSwap; BigShort = ShortNoSwap;
BigLong = LongNoSwap;
BigFloat = FloatNoSwap;
LittleShort = ShortSwap; LittleShort = ShortSwap;
BigLong = LongNoSwap; LittleLong = LongSwap;
LittleLong = LongSwap;
BigFloat = FloatNoSwap;
LittleFloat = FloatSwap; LittleFloat = FloatSwap;
} }
else /* assumed LITTLE_ENDIAN. */ else
{ {
BigShort = ShortSwap; BigShort = ShortSwap;
BigLong = LongSwap;
BigFloat = FloatSwap;
LittleShort = ShortNoSwap; LittleShort = ShortNoSwap;
BigLong = LongSwap; LittleLong = LongNoSwap;
LittleLong = LongNoSwap;
BigFloat = FloatSwap;
LittleFloat = FloatNoSwap; LittleFloat = FloatNoSwap;
} }
} }
@ -1369,7 +1406,7 @@ char *va(const char *format, ...)
/* /*
============================================================================= =============================================================================
QUAKE FILESYSTEM FILESYSTEM
============================================================================= =============================================================================
*/ */
@ -1598,7 +1635,7 @@ static int32_t COM_FindFile(const char *filename, int32_t *handle, FILE **file,
=========== ===========
COM_FileExists COM_FileExists
Returns whether the file is found in the quake filesystem. Returns whether the file is found in the filesystem.
=========== ===========
*/ */
bool COM_FileExists(const char *filename, uint32_t *path_id) bool COM_FileExists(const char *filename, uint32_t *path_id)
@ -1657,7 +1694,7 @@ void COM_CloseFile(int32_t h)
============ ============
COM_LoadFile COM_LoadFile
Filename are reletive to the quake directory. Filename are reletive to the executable directory.
Allways appends a 0 byte. Allways appends a 0 byte.
============ ============
*/ */
@ -2206,7 +2243,7 @@ size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh)
int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence) int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence)
{ {
/* I don't care about 64 bit off_t or fseeko() here. /* I don't care about 64 bit off_t or fseeko() here.
* the quake/hexen2 file system is 32 bits, anyway. */ * the file system is 32 bits, anyway. */
int32_t ret; int32_t ret;
if(!fh) if(!fh)

View File

@ -66,12 +66,21 @@ void InsertLinkAfter(link_t *l, link_t *after);
extern bool host_bigendian; extern bool host_bigendian;
extern int16_t (*BigShort)(int16_t l); extern int16_t (*BigShort)(int16_t l);
extern int16_t (*LittleShort)(int16_t l); extern int32_t (*BigLong)(int32_t l);
extern int32_t (*BigLong)(int32_t l); extern float (*BigFloat)(float l);
extern int32_t (*LittleLong)(int32_t l);
extern float (*BigFloat)(float l); extern int16_t (*LittleShort)(int16_t l);
extern float (*LittleFloat)(float l); extern int32_t (*LittleLong)(int32_t l);
extern float (*LittleFloat)(float l);
int16_t ReadBigShort(byte *bytes);
int32_t ReadBigLong(byte *bytes);
float ReadBigFloat(byte *bytes);
int16_t ReadLittleShort(byte *bytes);
int32_t ReadLittleLong(byte *bytes);
float ReadLittleFloat(byte *bytes);
//============================================================================ //============================================================================
@ -279,9 +288,7 @@ int32_t FS_fgetc(fshandle_t *fh);
char *FS_fgets(char *s, int32_t size, fshandle_t *fh); char *FS_fgets(char *s, int32_t size, fshandle_t *fh);
long FS_filelength(fshandle_t *fh); long FS_filelength(fshandle_t *fh);
extern bool standard_quake, rogue, hipnotic;
extern bool standard_quake, rogue, hipnotic;
/* if true, run in fitzquake mode disabling custom quakespasm hacks */
struct cvar_s; struct cvar_s;

View File

@ -146,7 +146,7 @@ static void Con_Clear_f(void)
/* /*
================ ================
Con_Dump_f -- johnfitz -- adapted from quake2 source Con_Dump_f -- johnfitz -- adapted from Q2 source
================ ================
*/ */
static void Con_Dump_f(void) static void Con_Dump_f(void)

View File

@ -378,8 +378,6 @@ void Fog_NewMap(void)
/* /*
============= =============
Fog_Init Fog_Init
called when quake initializes
============= =============
*/ */
void Fog_Init(void) void Fog_Init(void)

View File

@ -1049,7 +1049,7 @@ void CalcSurfaceExtents(msurface_t *s)
s->texturemins[i] = bmins[i] * 16; s->texturemins[i] = bmins[i] * 16;
s->extents[i] = (bmaxs[i] - bmins[i]) * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
if(!(tex->flags & TEX_SPECIAL) && s->extents[i] > 2000) //johnfitz -- was 512 in glquake, 256 in winquake if(!(tex->flags & TEX_SPECIAL) && s->extents[i] > 2000) //johnfitz -- was 512 in glq, 256 in winq
Sys_Error("Bad surface extents"); Sys_Error("Bad surface extents");
} }
} }

View File

@ -488,8 +488,6 @@ void R_SetupGL(void)
GL_SetFrustum(r_fovx, r_fovy); //johnfitz -- use r_fov* vars GL_SetFrustum(r_fovx, r_fovy); //johnfitz -- use r_fov* vars
// glCullFace(GL_BACK); //johnfitz -- glquake used CCW with backwards culling -- let's do it right
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();

View File

@ -812,7 +812,7 @@ void SCR_ScreenShot_f(void)
// find a file name to save it to // find a file name to save it to
for(i = 0; i < 10000; i++) for(i = 0; i < 10000; i++)
{ {
q_snprintf(imagename, sizeof(imagename), "quake%04" PRIi32 ".%s", i, ext); q_snprintf(imagename, sizeof(imagename), ENGINE_NAME "%04" PRIi32 ".%s", i, ext);
q_snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, imagename); q_snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, imagename);
if(Sys_FileTime(checkname) == -1) if(Sys_FileTime(checkname) == -1)
break; // file doesn't exist break; // file doesn't exist

View File

@ -264,13 +264,10 @@ void Sky_NewMap(void)
if(!strcmp("skyfog", key)) if(!strcmp("skyfog", key))
skyfog = atof(value); skyfog = atof(value);
else if(!strcmp("skyname", key))
#if 1 //also accept non-standard keys
else if(!strcmp("skyname", key)) //half-life
Sky_LoadSkyBox(value); Sky_LoadSkyBox(value);
else if(!strcmp("qlsky", key)) //quake lives else if(!strcmp("qlsky", key))
Sky_LoadSkyBox(value); Sky_LoadSkyBox(value);
#endif
} }
} }
@ -703,12 +700,11 @@ void Sky_DrawSkyBox(void)
GL_Bind(skybox_textures[skytexorder[i]]); GL_Bind(skybox_textures[skytexorder[i]]);
#if 1 //FIXME: this is to avoid tjunctions until i can do it the right way //FIXME: this is to avoid tjunctions until i can do it the right way
skymins[0][i] = -1; skymins[0][i] = -1;
skymins[1][i] = -1; skymins[1][i] = -1;
skymaxs[0][i] = 1; skymaxs[0][i] = 1;
skymaxs[1][i] = 1; skymaxs[1][i] = 1;
#endif
glBegin(GL_QUADS); glBegin(GL_QUADS);
Sky_EmitSkyBoxVertex(skymins[0][i], skymins[1][i], i); Sky_EmitSkyBoxVertex(skymins[0][i], skymins[1][i], i);
Sky_EmitSkyBoxVertex(skymins[0][i], skymaxs[1][i], i); Sky_EmitSkyBoxVertex(skymins[0][i], skymaxs[1][i], i);

View File

@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//gl_texmgr.c -- fitzquake's texture manager. manages opengl texture images //gl_texmgr.c -- texture manager. manages opengl texture images
#include "q_defs.h" #include "q_defs.h"
@ -574,14 +574,7 @@ void TexMgr_RecalcWarpImageSize(void)
while(gl_warpimagesize > vid.height) while(gl_warpimagesize > vid.height)
gl_warpimagesize >>= 1; gl_warpimagesize >>= 1;
// ericw -- removed early exit if (gl_warpimagesize == oldsize).
// after vid_restart TexMgr_ReloadImage reloads textures
// to tx->source_width/source_height, which might not match oldsize.
// fixes: https://sourceforge.net/p/quakespasm/bugs/13/
//
// resize the textures in opengl // resize the textures in opengl
//
mark = Hunk_LowMark(); mark = Hunk_LowMark();
dummy = (byte *) Hunk_Alloc(gl_warpimagesize * gl_warpimagesize * 4); dummy = (byte *) Hunk_Alloc(gl_warpimagesize * gl_warpimagesize * 4);
@ -1147,10 +1140,8 @@ static void TexMgr_LoadImage8(gltexture_t *glt, byte *data)
uint32_t *usepal; uint32_t *usepal;
int32_t i; int32_t i;
// HACK HACK HACK -- taken from tomazquake // HACK
if(strstr(glt->name, "shot1sid") && if(strstr(glt->name, "shot1sid") && glt->width == 32 && glt->height == 32 && CRC_Block(data, 1024) == 65393)
glt->width == 32 && glt->height == 32 &&
CRC_Block(data, 1024) == 65393)
{ {
// This texture in b_shell1.bsp has some of the first 32 pixels painted white. // This texture in b_shell1.bsp has some of the first 32 pixels painted white.
// They are invisible in software, but look really ugly in GL. So we just copy // They are invisible in software, but look really ugly in GL. So we just copy
@ -1460,14 +1451,6 @@ void TexMgr_ReloadImages(void)
{ {
gltexture_t *glt; gltexture_t *glt;
// ericw -- tricky bug: if the hunk is almost full, an allocation in TexMgr_ReloadImage
// triggers cache items to be freed, which calls back into TexMgr to free the
// texture. If this frees 'glt' in the loop below, the active_gltextures
// list gets corrupted.
// A test case is jam3_tronyn.bsp with -heapsize 65536, and do several mode
// switches/fullscreen toggles
// 2015-09-04 -- Cache_Flush workaround was causing issues (http://sourceforge.net/p/quakespasm/bugs/10/)
// switching to a boolean flag.
in_reload_images = true; in_reload_images = true;
for(glt = active_gltextures; glt; glt = glt->next) for(glt = active_gltextures; glt; glt = glt->next)

View File

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef spingle__gl_texmgr_h #ifndef spingle__gl_texmgr_h
#define spingle__gl_texmgr_h #define spingle__gl_texmgr_h
//gl_texmgr.h -- fitzquake's texture manager. manages opengl texture images //gl_texmgr.h -- texture manager. manages opengl texture images
#define TEXPREF_NONE 0x0000 #define TEXPREF_NONE 0x0000
#define TEXPREF_MIPMAP 0x0001 // generate mipmaps #define TEXPREF_MIPMAP 0x0001 // generate mipmaps

View File

@ -1170,8 +1170,8 @@ does all the stuff from GL_Init that needs to be done every time a new GL render
static void GL_SetupState(void) static void GL_SetupState(void)
{ {
glClearColor(0.15, 0.15, 0.15, 0); //johnfitz -- originally 1,0,0,0 glClearColor(0.15, 0.15, 0.15, 0); //johnfitz -- originally 1,0,0,0
glCullFace(GL_BACK); //johnfitz -- glquake used CCW with backwards culling -- let's do it right glCullFace(GL_BACK); //johnfitz -- glq used CCW with backwards culling -- let's do it right
glFrontFace(GL_CW); //johnfitz -- glquake used CCW with backwards culling -- let's do it right glFrontFace(GL_CW); //johnfitz -- glq used CCW with backwards culling -- let's do it right
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.666); glAlphaFunc(GL_GREATER, 0.666);
@ -1553,8 +1553,6 @@ void VID_Init(void)
GL_SetupState(); GL_SetupState();
Cmd_AddCommand("gl_info", GL_Info_f); //johnfitz Cmd_AddCommand("gl_info", GL_Info_f); //johnfitz
//johnfitz -- removed code creating "glquake" subdirectory
vid_menucmdfn = VID_Menu_f; //johnfitz vid_menucmdfn = VID_Menu_f; //johnfitz
vid_menudrawfn = VID_MenuDraw; vid_menudrawfn = VID_MenuDraw;
vid_menukeyfn = VID_MenuKey; vid_menukeyfn = VID_MenuKey;

View File

@ -871,7 +871,6 @@ void Host_Init(void)
host_hunklevel = Hunk_LowMark(); host_hunklevel = Hunk_LowMark();
host_initialized = true; host_initialized = true;
Con_Printf("\n========= Quake Initialized =========\n\n");
if(cls.state != ca_dedicated) if(cls.state != ca_dedicated)
{ {

View File

@ -1241,7 +1241,7 @@ void Host_Loadgame_f(void)
if(entnum < sv.num_edicts) if(entnum < sv.num_edicts)
{ {
ent->free = false; ent->free = false;
memset(&ent->v, 0, progs->entityfields * 4); memset(&ent->v, 0, progs.entityfields * 4);
} }
else else
{ {
@ -1655,7 +1655,7 @@ void Host_Spawn_f(void)
// set up the edict // set up the edict
ent = host_client->edict; ent = host_client->edict;
memset(&ent->v, 0, progs->entityfields * 4); memset(&ent->v, 0, progs.entityfields * 4);
ent->v.colormap = NUM_FOR_EDICT(ent); ent->v.colormap = NUM_FOR_EDICT(ent);
ent->v.team = (host_client->colors & 15) + 1; ent->v.team = (host_client->colors & 15) + 1;
ent->v.netname = PR_SetEngineString(host_client->name); ent->v.netname = PR_SetEngineString(host_client->name);

View File

@ -35,23 +35,7 @@ struct mplane_s;
extern vec3_t vec3_origin; extern vec3_t vec3_origin;
#define nanmask (255 << 23) /* 7F800000 */ #define Q_rint(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5))
#if 0 /* macro is violating strict aliasing rules */
#define IS_NAN(x) (((*(int32_t *) (char *) &x) & nanmask) == nanmask)
#else
static inline int32_t IS_NAN(float x)
{
union
{
float f;
int32_t i;
} num;
num.f = x;
return ((num.i & nanmask) == nanmask);
}
#endif
#define Q_rint(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5)) //johnfitz -- from joequake
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2]) #define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2])
@ -60,17 +44,18 @@ static inline int32_t IS_NAN(float x)
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
//johnfitz -- courtesy of lordhavoc //johnfitz -- courtesy of lordhavoc
// QuakeSpasm: To avoid strict aliasing violations, use a float/int32_t union instead of type punning. // QS: To avoid strict aliasing violations, use a float/int32_t union instead of type punning.
#define VectorNormalizeFast(_v)\ // [agw] NO YOU FOOL THAT'S UNDEFINED BEHAVIOUR
{\ #define VectorNormalizeFast(_v) \
union { float f; int32_t i; } _y, _number;\ { \
_number.f = DotProduct(_v, _v);\ union { float f; uint32_t i; } _y, _number; \
if (_number.f != 0.0)\ _number.f = DotProduct(_v, _v); \
{\ if(_number.f != 0.0) \
_y.i = 0x5f3759df - (_number.i >> 1);\ { \
_y.f = _y.f * (1.5f - (_number.f * 0.5f * _y.f * _y.f));\ _y.i = 0x5f3759df - (_number.i >> 1); \
VectorScale(_v, _y.f, _v);\ _y.f = _y.f * (1.5f - (_number.f * 0.5f * _y.f * _y.f)); \
}\ VectorScale(_v, _y.f, _v); \
} \
} }
void TurnVector(vec3_t out, const vec3_t forward, const vec3_t side, float angle); //johnfitz void TurnVector(vec3_t out, const vec3_t forward, const vec3_t side, float angle); //johnfitz

View File

@ -280,7 +280,7 @@ static void PrintSlistTrailer(void)
if(hostCacheCount) if(hostCacheCount)
Con_Printf("== end list ==\n\n"); Con_Printf("== end list ==\n\n");
else else
Con_Printf("No Quake servers found.\n\n"); Con_Printf("No servers found.\n\n");
} }
@ -291,7 +291,7 @@ void NET_Slist_f(void)
if(! slistSilent) if(! slistSilent)
{ {
Con_Printf("Looking for Quake servers...\n"); Con_Printf("Looking for servers...\n");
PrintSlistHeader(); PrintSlistHeader();
} }

View File

@ -687,20 +687,20 @@ static void PF_traceline(void)
nomonsters = G_FLOAT(OFS_PARM2); nomonsters = G_FLOAT(OFS_PARM2);
ent = G_EDICT(OFS_PARM3); ent = G_EDICT(OFS_PARM3);
/* FIXME FIXME FIXME: Why do we hit this with certain progs.dat ?? */ /* FIXME FIXME FIXME: Why do we hit this?? */
if(developer.value) if(developer.value)
{ {
if(IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || if(isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]) ||
IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2])) isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
{ {
Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n", Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent)); v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent));
} }
} }
if(IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2])) if(isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]))
v1[0] = v1[1] = v1[2] = 0; v1[0] = v1[1] = v1[2] = 0;
if(IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2])) if(isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
v2[0] = v2[1] = v2[2] = 0; v2[0] = v2[1] = v2[2] = 0;
trace = SV_Move(v1, vec3_origin, vec3_origin, v2, nomonsters, ent); trace = SV_Move(v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
@ -1016,7 +1016,7 @@ static void PF_vtos(void)
G_INT(OFS_RETURN) = PR_SetEngineString(s); G_INT(OFS_RETURN) = PR_SetEngineString(s);
} }
static void PF_Spawn(void) static void PF_spawn(void)
{ {
edict_t *ed; edict_t *ed;
@ -1025,7 +1025,7 @@ static void PF_Spawn(void)
RETURN_EDICT(ed); RETURN_EDICT(ed);
} }
static void PF_Remove(void) static void PF_remove(void)
{ {
edict_t *ed; edict_t *ed;
@ -1035,7 +1035,7 @@ static void PF_Remove(void)
// entity (entity start, .string field, string match) find = #5; // entity (entity start, .string field, string match) find = #5;
static void PF_Find(void) static void PF_find(void)
{ {
int32_t e; int32_t e;
int32_t f; int32_t f;
@ -1046,14 +1046,14 @@ static void PF_Find(void)
f = G_INT(OFS_PARM1); f = G_INT(OFS_PARM1);
s = G_STRING(OFS_PARM2); s = G_STRING(OFS_PARM2);
if(!s) if(!s)
PR_RunError("PF_Find: bad search string"); PR_RunError("PF_find: bad search string");
for(e++ ; e < sv.num_edicts ; e++) for(e++ ; e < sv.num_edicts ; e++)
{ {
ed = EDICT_NUM(e); ed = EDICT_NUM(e);
if(ed->free) if(ed->free)
continue; continue;
t = E_STRING(ed, f); t = PR_GetString(((string_t *)&ed->v)[f]);
if(!t) if(!t)
continue; continue;
if(!strcmp(t, s)) if(!strcmp(t, s))
@ -1181,7 +1181,7 @@ static void PF_walkmove(void)
move[1] = sin(yaw) * dist; move[1] = sin(yaw) * dist;
move[2] = 0; move[2] = 0;
// save program state, because SV_movestep may call other progs // save program state, because SV_movestep may call other functions
oldf = pr_xfunction; oldf = pr_xfunction;
oldself = pr_global_struct->self; oldself = pr_global_struct->self;
@ -1431,7 +1431,7 @@ static void PF_aim(void)
============== ==============
PF_changeyaw PF_changeyaw
This was a major timewaster in progs, so it was converted to C This was a major timewaster so it was converted to C
============== ==============
*/ */
void PF_changeyaw(void) void PF_changeyaw(void)
@ -1668,20 +1668,20 @@ static void PF_changelevel(void)
Cbuf_AddText(va("changelevel %s\n", s)); Cbuf_AddText(va("changelevel %s\n", s));
} }
static void PF_Fixme(void) static void PF_fixme(void)
{ {
PR_RunError("unimplemented builtin"); PR_RunError("unimplemented builtin");
} }
static builtin_t pr_builtin[] = builtin_t pr_builtins[] =
{ {
PF_Fixme, PF_fixme,
PF_makevectors, // void(entity e) makevectors = #1 PF_makevectors, // void(entity e) makevectors = #1
PF_setorigin, // void(entity e, vector o) setorigin = #2 PF_setorigin, // void(entity e, vector o) setorigin = #2
PF_setmodel, // void(entity e, string m) setmodel = #3 PF_setmodel, // void(entity e, string m) setmodel = #3
PF_setsize, // void(entity e, vector min, vector max) setsize = #4 PF_setsize, // void(entity e, vector min, vector max) setsize = #4
PF_Fixme, // void(entity e, vector min, vector max) setabssize = #5 PF_fixme, // void(entity e, vector min, vector max) setabssize = #5
PF_break, // void() break = #6 PF_break, // void() break = #6
PF_random, // float() random = #7 PF_random, // float() random = #7
PF_sound, // void(entity e, float chan, string samp) sound = #8 PF_sound, // void(entity e, float chan, string samp) sound = #8
@ -1690,11 +1690,11 @@ static builtin_t pr_builtin[] =
PF_objerror, // void(string e) objerror = #11 PF_objerror, // void(string e) objerror = #11
PF_vlen, // float(vector v) vlen = #12 PF_vlen, // float(vector v) vlen = #12
PF_vectoyaw, // float(vector v) vectoyaw = #13 PF_vectoyaw, // float(vector v) vectoyaw = #13
PF_Spawn, // entity() spawn = #14 PF_spawn, // entity() spawn = #14
PF_Remove, // void(entity e) remove = #15 PF_remove, // void(entity e) remove = #15
PF_traceline, // float(vector v1, vector v2, float tryents) traceline = #16 PF_traceline, // float(vector v1, vector v2, float tryents) traceline = #16
PF_checkclient, // entity() clientlist = #17 PF_checkclient, // entity() clientlist = #17
PF_Find, // entity(entity start, .string fld, string match) find = #18 PF_find, // entity(entity start, .string fld, string match) find = #18
PF_precache_sound, // void(string s) precache_sound = #19 PF_precache_sound, // void(string s) precache_sound = #19
PF_precache_model, // void(string s) precache_model = #20 PF_precache_model, // void(string s) precache_model = #20
PF_stuffcmd, // void(entity client, string s)stuffcmd = #21 PF_stuffcmd, // void(entity client, string s)stuffcmd = #21
@ -1709,16 +1709,16 @@ static builtin_t pr_builtin[] =
PF_traceoff, PF_traceoff,
PF_eprint, // void(entity e) debug print an entire entity PF_eprint, // void(entity e) debug print an entire entity
PF_walkmove, // float(float yaw, float dist) walkmove PF_walkmove, // float(float yaw, float dist) walkmove
PF_Fixme, // float(float yaw, float dist) walkmove PF_fixme, // float(float yaw, float dist) walkmove
PF_droptofloor, PF_droptofloor,
PF_lightstyle, PF_lightstyle,
PF_rint, PF_rint,
PF_floor, PF_floor,
PF_ceil, PF_ceil,
PF_Fixme, PF_fixme,
PF_checkbottom, PF_checkbottom,
PF_pointcontents, PF_pointcontents,
PF_Fixme, PF_fixme,
PF_fabs, PF_fabs,
PF_aim, PF_aim,
PF_cvar, PF_cvar,
@ -1726,7 +1726,7 @@ static builtin_t pr_builtin[] =
PF_nextent, PF_nextent,
PF_particle, PF_particle,
PF_changeyaw, PF_changeyaw,
PF_Fixme, PF_fixme,
PF_vectoangles, PF_vectoangles,
PF_WriteByte, PF_WriteByte,
@ -1738,20 +1738,20 @@ static builtin_t pr_builtin[] =
PF_WriteString, PF_WriteString,
PF_WriteEntity, PF_WriteEntity,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
PF_Fixme, PF_fixme,
SV_MoveToGoal, SV_MoveToGoal,
PF_precache_file, PF_precache_file,
PF_makestatic, PF_makestatic,
PF_changelevel, PF_changelevel,
PF_Fixme, PF_fixme,
PF_cvar_set, PF_cvar_set,
PF_centerprint, PF_centerprint,
@ -1765,6 +1765,5 @@ static builtin_t pr_builtin[] =
PF_setspawnparms PF_setspawnparms
}; };
builtin_t *pr_builtins = pr_builtin; int32_t pr_numbuiltins = arraysizeof(pr_builtins);
int32_t pr_numbuiltins = arraysizeof(pr_builtin);

View File

@ -22,7 +22,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef spingle__pr_comp_h #ifndef spingle__pr_comp_h
#define spingle__pr_comp_h #define spingle__pr_comp_h
// this file is shared by quake and qcc #define OFS_NULL 0
#define OFS_RETURN 1
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
#define OFS_PARM1 7
#define OFS_PARM2 10
#define OFS_PARM3 13
#define OFS_PARM4 16
#define OFS_PARM5 19
#define OFS_PARM6 22
#define OFS_PARM7 25
#define DEF_SAVEGLOBAL (1 << 15)
#define MAX_PARMS 8
#define PROG_VERSION 6
typedef int32_t func_t; typedef int32_t func_t;
typedef int32_t string_t; typedef int32_t string_t;
@ -40,18 +55,6 @@ typedef enum
ev_pointer ev_pointer
} etype_t; } etype_t;
#define OFS_NULL 0
#define OFS_RETURN 1
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
#define OFS_PARM1 7
#define OFS_PARM2 10
#define OFS_PARM3 13
#define OFS_PARM4 16
#define OFS_PARM5 19
#define OFS_PARM6 22
#define OFS_PARM7 25
enum enum
{ {
OP_DONE, OP_DONE,
@ -133,63 +136,56 @@ enum
typedef struct statement_s typedef struct statement_s
{ {
uint16_t op; uint16_t op;
int16_t a, b, c; int16_t a, b, c;
} dstatement_t; } dstatement_t;
typedef struct typedef struct
{ {
uint16_t type; // if DEF_SAVEGLOBAL bit is set uint16_t type; /* if DEF_SAVEGLOBAL bit is set the variable needs to be saved in savegames */
// the variable needs to be saved in savegames uint16_t ofs;
uint16_t ofs; int32_t s_name;
int32_t s_name;
} ddef_t; } ddef_t;
#define DEF_SAVEGLOBAL (1<<15)
#define MAX_PARMS 8
typedef struct typedef struct
{ {
int32_t first_statement; // negative numbers are builtins int32_t first_statement; // negative numbers are builtins
int32_t parm_start; int32_t parm_start;
int32_t locals; // total ints of parms + locals int32_t locals; // total ints of parms + locals
int32_t profile; // runtime int32_t profile; // runtime
int32_t s_name; int32_t s_name;
int32_t s_file; // source file defined in int32_t s_file; // source file defined in
int32_t numparms; int32_t numparms;
byte parm_size[MAX_PARMS]; byte parm_size[MAX_PARMS];
} dfunction_t; } dfunction_t;
#define PROG_VERSION 6
typedef struct typedef struct
{ {
int32_t version; int32_t version;
int32_t crc; // check of header file int32_t crc; // check of header file
int32_t ofs_statements; int32_t ofs_statements;
int32_t numstatements; // statement 0 is an error int32_t numstatements; // statement 0 is an error
int32_t ofs_globaldefs; int32_t ofs_globaldefs;
int32_t numglobaldefs; int32_t numglobaldefs;
int32_t ofs_fielddefs; int32_t ofs_fielddefs;
int32_t numfielddefs; int32_t numfielddefs;
int32_t ofs_functions; int32_t ofs_functions;
int32_t numfunctions; // function 0 is an empty int32_t numfunctions; // function 0 is an empty
int32_t ofs_strings; int32_t ofs_strings;
int32_t numstrings; // first string is a null string int32_t numstrings; // first string is a null string
int32_t ofs_globals; int32_t ofs_globals;
int32_t numglobals; int32_t numglobals;
int32_t entityfields; int32_t entityfields;
} dprograms_t; } dprograms_t;
#endif #endif

View File

@ -23,43 +23,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "q_defs.h" #include "q_defs.h"
dprograms_t *progs; dprograms_t progs;
dfunction_t *pr_functions; dfunction_t *pr_functions;
static char *pr_strings; static char *pr_strings;
static int32_t pr_stringssize; static int32_t pr_stringssize;
static const char **pr_knownstrings; static const char **pr_knownstrings;
static int32_t pr_maxknownstrings; static int32_t pr_maxknownstrings;
static int32_t pr_numknownstrings; static int32_t pr_numknownstrings;
static ddef_t *pr_fielddefs; static ddef_t *pr_fielddefs;
static ddef_t *pr_globaldefs; static ddef_t *pr_globaldefs;
bool pr_alpha_supported; //johnfitz bool pr_alpha_supported; //johnfitz
dstatement_t *pr_statements; dstatement_t *pr_statements;
globalvars_t *pr_global_struct; globalvars_t *pr_global_struct;
float *pr_globals; // same as pr_global_struct float *pr_globals; // same as pr_global_struct
int32_t pr_edict_size; // in bytes int32_t pr_edict_size; // in bytes
uint16_t pr_crc; uint16_t pr_crc;
int32_t type_size[8] = static int32_t type_size[] =
{ {
1, // ev_void [ev_void] = 1,
1, // sizeof(string_t) / 4 // ev_string [ev_string] = 1,
1, // ev_float [ev_float] = 1,
3, // ev_vector [ev_vector] = 3,
1, // ev_entity [ev_entity] = 1,
1, // ev_field [ev_field] = 1,
1, // sizeof(func_t) / 4 // ev_function [ev_function] = 1,
1 // sizeof(void *) / 4 // ev_pointer [ev_pointer] = 1,
}; };
static ddef_t *ED_FieldAtOfs(int32_t ofs); static ddef_t *ED_FieldAtOfs(int32_t ofs);
static bool ED_ParseEpair(void *base, ddef_t *key, const char *s); static bool ED_ParseEpair(void *base, ddef_t *key, const char *s);
#define MAX_FIELD_LEN 64 #define MAX_FIELD_LEN 64
#define GEFV_CACHESIZE 2 #define GEFV_CACHESIZE 2
typedef struct typedef struct
{ {
@ -73,17 +73,17 @@ static gefv_cache gefvCache[GEFV_CACHESIZE] =
{ NULL, "" } { NULL, "" }
}; };
cvar_t nomonsters = {"nomonsters", "0", CVAR_NONE}; cvar_t nomonsters = {"nomonsters", "0", CVAR_NONE};
cvar_t gamecfg = {"gamecfg", "0", CVAR_NONE}; cvar_t gamecfg = {"gamecfg", "0", CVAR_NONE};
cvar_t scratch1 = {"scratch1", "0", CVAR_NONE}; cvar_t scratch1 = {"scratch1", "0", CVAR_NONE};
cvar_t scratch2 = {"scratch2", "0", CVAR_NONE}; cvar_t scratch2 = {"scratch2", "0", CVAR_NONE};
cvar_t scratch3 = {"scratch3", "0", CVAR_NONE}; cvar_t scratch3 = {"scratch3", "0", CVAR_NONE};
cvar_t scratch4 = {"scratch4", "0", CVAR_NONE}; cvar_t scratch4 = {"scratch4", "0", CVAR_NONE};
cvar_t savedgamecfg = {"savedgamecfg", "0", CVAR_ARCHIVE}; cvar_t savedgamecfg = {"savedgamecfg", "0", CVAR_ARCHIVE};
cvar_t saved1 = {"saved1", "0", CVAR_ARCHIVE}; cvar_t saved1 = {"saved1", "0", CVAR_ARCHIVE};
cvar_t saved2 = {"saved2", "0", CVAR_ARCHIVE}; cvar_t saved2 = {"saved2", "0", CVAR_ARCHIVE};
cvar_t saved3 = {"saved3", "0", CVAR_ARCHIVE}; cvar_t saved3 = {"saved3", "0", CVAR_ARCHIVE};
cvar_t saved4 = {"saved4", "0", CVAR_ARCHIVE}; cvar_t saved4 = {"saved4", "0", CVAR_ARCHIVE};
/* /*
================= =================
@ -94,7 +94,7 @@ Sets everything to NULL
*/ */
void ED_ClearEdict(edict_t *e) void ED_ClearEdict(edict_t *e)
{ {
memset(&e->v, 0, progs->entityfields * 4); memset(&e->v, 0, progs.entityfields * 4);
e->free = false; e->free = false;
} }
@ -176,7 +176,7 @@ static ddef_t *ED_GlobalAtOfs(int32_t ofs)
ddef_t *def; ddef_t *def;
int32_t i; int32_t i;
for(i = 0; i < progs->numglobaldefs; i++) for(i = 0; i < progs.numglobaldefs; i++)
{ {
def = &pr_globaldefs[i]; def = &pr_globaldefs[i];
if(def->ofs == ofs) if(def->ofs == ofs)
@ -195,7 +195,7 @@ static ddef_t *ED_FieldAtOfs(int32_t ofs)
ddef_t *def; ddef_t *def;
int32_t i; int32_t i;
for(i = 0; i < progs->numfielddefs; i++) for(i = 0; i < progs.numfielddefs; i++)
{ {
def = &pr_fielddefs[i]; def = &pr_fielddefs[i];
if(def->ofs == ofs) if(def->ofs == ofs)
@ -214,7 +214,7 @@ static ddef_t *ED_FindField(const char *name)
ddef_t *def; ddef_t *def;
int32_t i; int32_t i;
for(i = 0; i < progs->numfielddefs; i++) for(i = 0; i < progs.numfielddefs; i++)
{ {
def = &pr_fielddefs[i]; def = &pr_fielddefs[i];
if(!strcmp(PR_GetString(def->s_name), name)) if(!strcmp(PR_GetString(def->s_name), name))
@ -234,7 +234,7 @@ static ddef_t *ED_FindGlobal(const char *name)
ddef_t *def; ddef_t *def;
int32_t i; int32_t i;
for(i = 0; i < progs->numglobaldefs; i++) for(i = 0; i < progs.numglobaldefs; i++)
{ {
def = &pr_globaldefs[i]; def = &pr_globaldefs[i];
if(!strcmp(PR_GetString(def->s_name), name)) if(!strcmp(PR_GetString(def->s_name), name))
@ -254,7 +254,7 @@ static dfunction_t *ED_FindFunction(const char *fn_name)
dfunction_t *func; dfunction_t *func;
int32_t i; int32_t i;
for(i = 0; i < progs->numfunctions; i++) for(i = 0; i < progs.numfunctions; i++)
{ {
func = &pr_functions[i]; func = &pr_functions[i];
if(!strcmp(PR_GetString(func->s_name), fn_name)) if(!strcmp(PR_GetString(func->s_name), fn_name))
@ -479,7 +479,7 @@ void ED_Print(edict_t *ed)
} }
Con_SafePrintf("\nEDICT %" PRIi32 ":\n", NUM_FOR_EDICT(ed)); //johnfitz -- was Con_Printf Con_SafePrintf("\nEDICT %" PRIi32 ":\n", NUM_FOR_EDICT(ed)); //johnfitz -- was Con_Printf
for(i = 1; i < progs->numfielddefs; i++) for(i = 1; i < progs.numfielddefs; i++)
{ {
d = &pr_fielddefs[i]; d = &pr_fielddefs[i];
name = PR_GetString(d->s_name); name = PR_GetString(d->s_name);
@ -531,7 +531,7 @@ void ED_Write(FILE *f, edict_t *ed)
return; return;
} }
for(i = 1; i < progs->numfielddefs; i++) for(i = 1; i < progs.numfielddefs; i++)
{ {
d = &pr_fielddefs[i]; d = &pr_fielddefs[i];
name = PR_GetString(d->s_name); name = PR_GetString(d->s_name);
@ -555,7 +555,7 @@ void ED_Write(FILE *f, edict_t *ed)
fprintf(f, "\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v)); fprintf(f, "\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v));
} }
//johnfitz -- save entity alpha manually when progs.dat doesn't know about alpha //johnfitz -- save entity alpha manually when program doesn't know about alpha
if(!pr_alpha_supported && ed->alpha != ENTALPHA_DEFAULT) if(!pr_alpha_supported && ed->alpha != ENTALPHA_DEFAULT)
fprintf(f, "\"alpha\" \"%f\"\n", ENTALPHA_TOSAVE(ed->alpha)); fprintf(f, "\"alpha\" \"%f\"\n", ENTALPHA_TOSAVE(ed->alpha));
//johnfitz //johnfitz
@ -670,7 +670,7 @@ void ED_WriteGlobals(FILE *f)
int32_t type; int32_t type;
fprintf(f, "{\n"); fprintf(f, "{\n");
for(i = 0; i < progs->numglobaldefs; i++) for(i = 0; i < progs.numglobaldefs; i++)
{ {
def = &pr_globaldefs[i]; def = &pr_globaldefs[i];
type = def->type; type = def->type;
@ -872,7 +872,7 @@ const char *ED_ParseEdict(const char *data, edict_t *ent)
// clear it // clear it
if(ent != sv.edicts) // hack if(ent != sv.edicts) // hack
memset(&ent->v, 0, progs->entityfields * 4); memset(&ent->v, 0, progs.entityfields * 4);
// go through all the dictionary pairs // go through all the dictionary pairs
while(1) while(1)
@ -923,7 +923,7 @@ const char *ED_ParseEdict(const char *data, edict_t *ent)
if(keyname[0] == '_') if(keyname[0] == '_')
continue; continue;
//johnfitz -- hack to support .alpha even when progs.dat doesn't know about it //johnfitz -- hack to support .alpha even when program doesn't know about it
if(!strcmp(keyname, "alpha")) if(!strcmp(keyname, "alpha"))
ent->alpha = ENTALPHA_ENCODE(atof(com_token)); ent->alpha = ENTALPHA_ENCODE(atof(com_token));
//johnfitz //johnfitz
@ -1050,7 +1050,8 @@ PR_LoadProgs
*/ */
void PR_LoadProgs(void) void PR_LoadProgs(void)
{ {
int32_t i; byte *prog_data;
int32_t i;
// flush the non-C variable lookup cache // flush the non-C variable lookup cache
for(i = 0; i < GEFV_CACHESIZE; i++) for(i = 0; i < GEFV_CACHESIZE; i++)
@ -1058,54 +1059,74 @@ void PR_LoadProgs(void)
CRC_Init(&pr_crc); CRC_Init(&pr_crc);
progs = (dprograms_t *)COM_LoadHunkFile("progs.dat", NULL); prog_data = COM_LoadHunkFile("progs.dat", NULL);
if(!progs) if(!prog_data)
Host_Error("PR_LoadProgs: couldn't load progs.dat"); Host_Error("PR_LoadProgs: couldn't load progs.dat");
Con_DPrintf("Programs occupy %" PRIi32 "K.\n", com_filesize / 1024); Con_DPrintf("Programs occupy %" PRIi32 "K.\n", com_filesize / 1024);
for(i = 0; i < com_filesize; i++) for(i = 0; i < com_filesize; i++)
CRC_ProcessByte(&pr_crc, ((byte *)progs)[i]); CRC_ProcessByte(&pr_crc, prog_data[i]);
// byte swap the header // byte swap the header
for(i = 0; i < (int32_t) sizeof(*progs) / 4; i++) progs.version = ReadLittleLong(&prog_data[4 * 0]);
((int32_t *)progs)[i] = LittleLong(((int32_t *)progs)[i]); progs.crc = ReadLittleLong(&prog_data[4 * 1]);
if(progs->version != PROG_VERSION) progs.ofs_statements = ReadLittleLong(&prog_data[4 * 2]);
Host_Error("progs.dat has wrong version number (%" PRIi32 " should be %" PRIi32 ")", progs->version, PROG_VERSION); progs.numstatements = ReadLittleLong(&prog_data[4 * 3]);
if(progs->crc != PROGHEADER_CRC)
progs.ofs_globaldefs = ReadLittleLong(&prog_data[4 * 4]);
progs.numglobaldefs = ReadLittleLong(&prog_data[4 * 5]);
progs.ofs_fielddefs = ReadLittleLong(&prog_data[4 * 6]);
progs.numfielddefs = ReadLittleLong(&prog_data[4 * 7]);
progs.ofs_functions = ReadLittleLong(&prog_data[4 * 8]);
progs.numfunctions = ReadLittleLong(&prog_data[4 * 9]);
progs.ofs_strings = ReadLittleLong(&prog_data[4 * 10]);
progs.numstrings = ReadLittleLong(&prog_data[4 * 11]);
progs.ofs_globals = ReadLittleLong(&prog_data[4 * 12]);
progs.numglobals = ReadLittleLong(&prog_data[4 * 13]);
progs.entityfields = ReadLittleLong(&prog_data[4 * 14]);
if(progs.version != PROG_VERSION)
Host_Error("progs.dat has wrong version number (%" PRIi32 " should be %" PRIi32 ")", progs.version, PROG_VERSION);
if(progs.crc != PROGHEADER_CRC)
Host_Error("progs.dat system vars have been modified, progdefs.h is out of date"); Host_Error("progs.dat system vars have been modified, progdefs.h is out of date");
pr_functions = (dfunction_t *)((byte *)progs + progs->ofs_functions); pr_functions = (dfunction_t *)(prog_data + progs.ofs_functions);
pr_strings = (char *)progs + progs->ofs_strings; pr_strings = (char *)prog_data + progs.ofs_strings;
if(progs->ofs_strings + progs->numstrings >= com_filesize) if(progs.ofs_strings + progs.numstrings >= com_filesize)
Host_Error("progs.dat strings go past end of file\n"); Host_Error("progs.dat strings go past end of file\n");
// initialize the strings // initialize the strings
pr_numknownstrings = 0; pr_numknownstrings = 0;
pr_maxknownstrings = 0; pr_maxknownstrings = 0;
pr_stringssize = progs->numstrings; pr_stringssize = progs.numstrings;
if(pr_knownstrings) if(pr_knownstrings)
Z_Free((void *)pr_knownstrings); Z_Free((void *)pr_knownstrings);
pr_knownstrings = NULL; pr_knownstrings = NULL;
PR_SetEngineString(""); PR_SetEngineString("");
pr_globaldefs = (ddef_t *)((byte *)progs + progs->ofs_globaldefs); pr_globaldefs = (ddef_t *)(prog_data + progs.ofs_globaldefs);
pr_fielddefs = (ddef_t *)((byte *)progs + progs->ofs_fielddefs); pr_fielddefs = (ddef_t *)(prog_data + progs.ofs_fielddefs);
pr_statements = (dstatement_t *)((byte *)progs + progs->ofs_statements); pr_statements = (dstatement_t *)(prog_data + progs.ofs_statements);
pr_global_struct = (globalvars_t *)((byte *)progs + progs->ofs_globals); pr_global_struct = (globalvars_t *)(prog_data + progs.ofs_globals);
pr_globals = (float *)pr_global_struct; pr_globals = (float *)pr_global_struct;
// byte swap the lumps // byte swap the lumps
for(i = 0; i < progs->numstatements; i++) for(i = 0; i < progs.numstatements; i++)
{ {
pr_statements[i].op = LittleShort(pr_statements[i].op); pr_statements[i].op = LittleShort(pr_statements[i].op);
pr_statements[i].a = LittleShort(pr_statements[i].a); pr_statements[i].a = LittleShort(pr_statements[i].a);
pr_statements[i].b = LittleShort(pr_statements[i].b); pr_statements[i].b = LittleShort(pr_statements[i].b);
pr_statements[i].c = LittleShort(pr_statements[i].c); pr_statements[i].c = LittleShort(pr_statements[i].c);
} }
for(i = 0; i < progs->numfunctions; i++) for(i = 0; i < progs.numfunctions; i++)
{ {
pr_functions[i].first_statement = LittleLong(pr_functions[i].first_statement); pr_functions[i].first_statement = LittleLong(pr_functions[i].first_statement);
pr_functions[i].parm_start = LittleLong(pr_functions[i].parm_start); pr_functions[i].parm_start = LittleLong(pr_functions[i].parm_start);
@ -1115,7 +1136,7 @@ void PR_LoadProgs(void)
pr_functions[i].locals = LittleLong(pr_functions[i].locals); pr_functions[i].locals = LittleLong(pr_functions[i].locals);
} }
for(i = 0; i < progs->numglobaldefs; i++) for(i = 0; i < progs.numglobaldefs; i++)
{ {
pr_globaldefs[i].type = LittleShort(pr_globaldefs[i].type); pr_globaldefs[i].type = LittleShort(pr_globaldefs[i].type);
pr_globaldefs[i].ofs = LittleShort(pr_globaldefs[i].ofs); pr_globaldefs[i].ofs = LittleShort(pr_globaldefs[i].ofs);
@ -1124,7 +1145,7 @@ void PR_LoadProgs(void)
pr_alpha_supported = false; //johnfitz pr_alpha_supported = false; //johnfitz
for(i = 0; i < progs->numfielddefs; i++) for(i = 0; i < progs.numfielddefs; i++)
{ {
pr_fielddefs[i].type = LittleShort(pr_fielddefs[i].type); pr_fielddefs[i].type = LittleShort(pr_fielddefs[i].type);
if(pr_fielddefs[i].type & DEF_SAVEGLOBAL) if(pr_fielddefs[i].type & DEF_SAVEGLOBAL)
@ -1132,16 +1153,16 @@ void PR_LoadProgs(void)
pr_fielddefs[i].ofs = LittleShort(pr_fielddefs[i].ofs); pr_fielddefs[i].ofs = LittleShort(pr_fielddefs[i].ofs);
pr_fielddefs[i].s_name = LittleLong(pr_fielddefs[i].s_name); pr_fielddefs[i].s_name = LittleLong(pr_fielddefs[i].s_name);
//johnfitz -- detect alpha support in progs.dat //johnfitz -- detect alpha support
if(!strcmp(pr_strings + pr_fielddefs[i].s_name, "alpha")) if(!strcmp(pr_strings + pr_fielddefs[i].s_name, "alpha"))
pr_alpha_supported = true; pr_alpha_supported = true;
//johnfitz //johnfitz
} }
for(i = 0; i < progs->numglobals; i++) for(i = 0; i < progs.numglobals; i++)
((int32_t *)pr_globals)[i] = LittleLong(((int32_t *)pr_globals)[i]); ((int32_t *)pr_globals)[i] = LittleLong(((int32_t *)pr_globals)[i]);
pr_edict_size = progs->entityfields * 4 + sizeof(edict_t) - sizeof(entvars_t); pr_edict_size = progs.entityfields * 4 + sizeof(edict_t) - sizeof(entvars_t);
// round off to next highest whole word address (esp for Alpha) // round off to next highest whole word address (esp for Alpha)
// this ensures that pointers in the engine data area are always // this ensures that pointers in the engine data area are always
// properly aligned // properly aligned

View File

@ -227,7 +227,7 @@ void PR_Profile_f(void)
{ {
pmax = 0; pmax = 0;
best = NULL; best = NULL;
for(i = 0; i < progs->numfunctions; i++) for(i = 0; i < progs.numfunctions; i++)
{ {
f = &pr_functions[i]; f = &pr_functions[i];
if(f->profile > pmax) if(f->profile > pmax)
@ -363,7 +363,7 @@ void PR_ExecuteProgram(func_t fnum)
edict_t *ed; edict_t *ed;
int32_t exitdepth; int32_t exitdepth;
if(!fnum || fnum >= progs->numfunctions) if(!fnum || fnum >= progs.numfunctions)
{ {
if(pr_global_struct->self) if(pr_global_struct->self)
ED_Print(PROG_TO_EDICT(pr_global_struct->self)); ED_Print(PROG_TO_EDICT(pr_global_struct->self));

View File

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef spingle__progs_h #ifndef spingle__progs_h
#define spingle__progs_h #define spingle__progs_h
#include "pr_comp.h" /* defs shared with qcc */ #include "pr_comp.h" /* defs shared with qcc */
#include "progdefs.h" /* generated by program cdefs */ #include "progdefs.h" /* generated by program cdefs */
typedef union eval_s typedef union eval_s
{ {
@ -36,30 +36,30 @@ typedef union eval_s
int32_t edict; int32_t edict;
} eval_t; } eval_t;
#define MAX_ENT_LEAFS 32 #define MAX_ENT_LEAFS 32
typedef struct edict_s typedef struct edict_s
{ {
bool free; bool free;
link_t area; /* linked to a division node or leaf */ link_t area; /* linked to a division node or leaf */
int32_t num_leafs; int32_t num_leafs;
int32_t leafnums[MAX_ENT_LEAFS]; int32_t leafnums[MAX_ENT_LEAFS];
entity_state_t baseline; entity_state_t baseline;
uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */ uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
bool sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */ bool sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
float freetime; /* sv.time when the object was freed */ float freetime; /* sv.time when the object was freed */
entvars_t v; /* C exported fields from progs */ entvars_t v; /* C exported fields from progs */
/* other fields from progs come immediately after */ byte fields[];
} edict_t; } edict_t;
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)l - offsetof(edict_t, area)) #define EDICT_FROM_AREA(l) (edict_t *)((byte *)(l) - offsetof(edict_t, area))
//============================================================================ //============================================================================
extern dprograms_t *progs; extern dprograms_t progs;
extern dfunction_t *pr_functions; extern dfunction_t *pr_functions;
extern dstatement_t *pr_statements; extern dstatement_t *pr_statements;
extern globalvars_t *pr_global_struct; extern globalvars_t *pr_global_struct;
@ -91,44 +91,34 @@ const char *ED_ParseGlobals(const char *data);
void ED_LoadFromFile(const char *data); void ED_LoadFromFile(const char *data);
/*
#define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
#define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size)
*/
edict_t *EDICT_NUM(int32_t n); edict_t *EDICT_NUM(int32_t n);
int32_t NUM_FOR_EDICT(edict_t *e); int32_t NUM_FOR_EDICT(edict_t *e);
#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size)) #define NEXT_EDICT(e) ((edict_t *)((byte *)(e) + pr_edict_size))
#define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts) #define EDICT_TO_PROG(e) ((byte *)(e) - (byte *)sv.edicts)
#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + (e)))
#define G_FLOAT(o) (pr_globals[o]) #define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int32_t *)&pr_globals[o]) #define G_INT(o) (*(int32_t *)&pr_globals[o])
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o])) #define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o)) #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o]) #define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o])) #define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o]) #define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
#define E_FLOAT(e,o) (((float*)&e->v)[o])
#define E_INT(e,o) (*(int32_t *)&((float*)&e->v)[o])
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))
extern int32_t type_size[8];
typedef void (*builtin_t)(void); typedef void (*builtin_t)(void);
extern builtin_t *pr_builtins;
extern int32_t pr_numbuiltins;
extern int32_t pr_argc; extern builtin_t pr_builtins[];
extern int32_t pr_numbuiltins;
extern bool pr_trace; extern int32_t pr_argc;
extern dfunction_t *pr_xfunction;
extern int32_t pr_xstatement;
extern uint16_t pr_crc; extern bool pr_trace;
extern dfunction_t *pr_xfunction;
extern int32_t pr_xstatement;
extern uint16_t pr_crc;
noreturn void PR_RunError(const char *error, ...) FUNC_PRINTF(1, 2); noreturn void PR_RunError(const char *error, ...) FUNC_PRINTF(1, 2);

View File

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef spingle__protocol_h #ifndef spingle__protocol_h
#define spingle__protocol_h #define spingle__protocol_h
#define PROTOCOL_NETQUAKE 15 //johnfitz -- standard quake protocol #define PROTOCOL_NETQUAKE 15 //johnfitz -- standard protocol
#define PROTOCOL_FITZQUAKE 666 //johnfitz -- added new protocol for fitzquake 0.85 #define PROTOCOL_FITZQUAKE 666 //johnfitz -- added new protocol for fitz 0.85
#define PROTOCOL_RMQ 999 #define PROTOCOL_RMQ 999
// PROTOCOL_RMQ protocol flags // PROTOCOL_RMQ protocol flags

View File

@ -557,7 +557,7 @@ void R_DrawBrushModel(entity_t *e)
} }
glPushMatrix(); glPushMatrix();
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid bug
if(gl_zfix.value) if(gl_zfix.value)
{ {
e->origin[0] -= DIST_EPSILON; e->origin[0] -= DIST_EPSILON;
@ -571,7 +571,7 @@ void R_DrawBrushModel(entity_t *e)
e->origin[1] += DIST_EPSILON; e->origin[1] += DIST_EPSILON;
e->origin[2] += DIST_EPSILON; e->origin[2] += DIST_EPSILON;
} }
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid bug
R_ClearTextureChains(clmodel, chain_model); R_ClearTextureChains(clmodel, chain_model);
for(i = 0 ; i < clmodel->nummodelsurfaces ; i++, psurf++) for(i = 0 ; i < clmodel->nummodelsurfaces ; i++, psurf++)
@ -628,9 +628,9 @@ void R_DrawBrushModel_ShowTris(entity_t *e)
psurf = &clmodel->surfaces[clmodel->firstmodelsurface]; psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
glPushMatrix(); glPushMatrix();
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid bug
R_RotateForEntity(e->origin, e->angles); R_RotateForEntity(e->origin, e->angles);
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid bug
// //
// draw it // draw it

View File

@ -140,7 +140,6 @@ void R_MarkSurfaces(void)
// rebuild chains // rebuild chains
#if 1
//iterate through surfaces one node at a time to rebuild chains //iterate through surfaces one node at a time to rebuild chains
//need to do it this way if we want to work with tyrann's skip removal tool //need to do it this way if we want to work with tyrann's skip removal tool
//becuase his tool doesn't actually remove the surfaces from the bsp surfaces lump //becuase his tool doesn't actually remove the surfaces from the bsp surfaces lump
@ -151,17 +150,6 @@ void R_MarkSurfaces(void)
{ {
R_ChainSurface(surf, chain_world); R_ChainSurface(surf, chain_world);
} }
#else
//the old way
surf = &cl.worldmodel->surfaces[cl.worldmodel->firstmodelsurface];
for(i = 0 ; i < cl.worldmodel->nummodelsurfaces ; i++, surf++)
{
if(surf->visframe == r_visframecount)
{
R_ChainSurface(surf, chain_world);
}
}
#endif
} }
/* /*

View File

@ -72,7 +72,6 @@ typedef struct entity_s
int32_t dlightframe; // dynamic lighting int32_t dlightframe; // dynamic lighting
int32_t dlightbits; int32_t dlightbits;
// FIXME: could turn these into a union
int32_t trivial_accept; int32_t trivial_accept;
struct mnode_s *topnode; // for bmodels, first world node struct mnode_s *topnode; // for bmodels, first world node
// that splits bmodel, or NULL if // that splits bmodel, or NULL if

View File

@ -1,5 +1,5 @@
/* /*
* Audio Codecs: Adapted from ioquake3 with changes. * Audio Codecs: Adapted from ioq3 with changes.
* For now, only handles streaming music, not sound effects. * For now, only handles streaming music, not sound effects.
* *
* Copyright (C) 1999-2005 Id Software, Inc. * Copyright (C) 1999-2005 Id Software, Inc.

View File

@ -1,5 +1,5 @@
/* /*
* Audio Codecs: Adapted from ioquake3 with changes. * Audio Codecs: Adapted from ioq3 with changes.
* For now, only handles streaming music, not sound effects. * For now, only handles streaming music, not sound effects.
* *
* Copyright (C) 1999-2005 Id Software, Inc. * Copyright (C) 1999-2005 Id Software, Inc.

View File

@ -1,5 +1,5 @@
/* /*
* Audio Codecs: Adapted from ioquake3 with changes. * Audio Codecs: Adapted from ioq3 with changes.
* For now, only handles streaming music, not sound effects. * For now, only handles streaming music, not sound effects.
* *
* Copyright (C) 1999-2005 Id Software, Inc. * Copyright (C) 1999-2005 Id Software, Inc.

View File

@ -682,7 +682,7 @@ static void S_UpdateAmbientSounds(void)
/* /*
=================== ===================
S_RawSamples (from QuakeII) S_RawSamples (from q2)
Streaming music support. Byte swapping Streaming music support. Byte swapping
of data must be handled by the codec. of data must be handled by the codec.

View File

@ -322,7 +322,7 @@ static int32_t mp3_decode(snd_stream_t *stream, byte *buf, int32_t len)
*buf++ = (sample >> 8) & 0xFF; *buf++ = (sample >> 8) & 0xFF;
*buf++ = sample & 0xFF; *buf++ = sample & 0xFF;
} }
else /* assumed LITTLE_ENDIAN. */ else
{ {
*buf++ = sample & 0xFF; *buf++ = sample & 0xFF;
*buf++ = (sample >> 8) & 0xFF; *buf++ = (sample >> 8) & 0xFF;

View File

@ -1,6 +1,6 @@
/* /*
* snd_sdl.c - SDL audio driver for Hexen II: Hammer of Thyrion (uHexen2) * snd_sdl.c - SDL audio driver for Hexen II: Hammer of Thyrion (uHexen2)
* based on implementations found in the quakeforge and ioquake3 projects. * based on implementations found in the quakeforge and ioq3 projects.
* *
* Copyright (C) 1999-2005 Id Software, Inc. * Copyright (C) 1999-2005 Id Software, Inc.
* Copyright (C) 2005-2012 O.Sezer <sezero@users.sourceforge.net> * Copyright (C) 2005-2012 O.Sezer <sezero@users.sourceforge.net>

View File

@ -1438,7 +1438,7 @@ void SV_SpawnServer(const char *server)
// load the rest of the entities // load the rest of the entities
// //
ent = EDICT_NUM(0); ent = EDICT_NUM(0);
memset(&ent->v, 0, progs->entityfields * 4); memset(&ent->v, 0, progs.entityfields * 4);
ent->free = false; ent->free = false;
ent->v.model = PR_SetEngineString(sv.worldmodel->name); ent->v.model = PR_SetEngineString(sv.worldmodel->name);
ent->v.modelindex = 1; // world model ent->v.modelindex = 1; // world model

View File

@ -93,12 +93,12 @@ void SV_CheckVelocity(edict_t *ent)
// //
for(i = 0 ; i < 3 ; i++) for(i = 0 ; i < 3 ; i++)
{ {
if(IS_NAN(ent->v.velocity[i])) if(isnan(ent->v.velocity[i]))
{ {
Con_Printf("Got a NaN velocity on %s\n", PR_GetString(ent->v.classname)); Con_Printf("Got a NaN velocity on %s\n", PR_GetString(ent->v.classname));
ent->v.velocity[i] = 0; ent->v.velocity[i] = 0;
} }
if(IS_NAN(ent->v.origin[i])) if(isnan(ent->v.origin[i]))
{ {
Con_Printf("Got a NaN origin on %s\n", PR_GetString(ent->v.classname)); Con_Printf("Got a NaN origin on %s\n", PR_GetString(ent->v.classname));
ent->v.origin[i] = 0; ent->v.origin[i] = 0;

View File

@ -245,7 +245,7 @@ static char const *Sys_GetUserDir(void)
#if PLATFORM_IS(OSX) #if PLATFORM_IS(OSX)
static char *OSX_StripAppBundle(char *dir) static char *OSX_StripAppBundle(char *dir)
{ {
/* based on the ioquake3 project at icculus.org. */ /* based on the ioq3 project at icculus.org. */
static char osx_path[MAX_OSPATH]; static char osx_path[MAX_OSPATH];
q_strlcpy(osx_path, dir, sizeof(osx_path)); q_strlcpy(osx_path, dir, sizeof(osx_path));

View File

@ -146,12 +146,10 @@ cvar_t v_centerspeed = {"v_centerspeed", "500", CVAR_NONE};
void V_StartPitchDrift(void) void V_StartPitchDrift(void)
{ {
#if 1
if(cl.laststop == cl.time) if(cl.laststop == cl.time)
{ {
return; // something else is keeping it from drifting return; // something else is keeping it from drifting
} }
#endif
if(cl.nodrift || !cl.pitchvel) if(cl.nodrift || !cl.pitchvel)
{ {
cl.pitchvel = v_centerspeed.value; cl.pitchvel = v_centerspeed.value;

View File

@ -3,7 +3,7 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by winquake.rc // Used by the .rc file
#define IDS_STRING1 1 #define IDS_STRING1 1
#define IDI_ICON2 1 #define IDI_ICON2 1
#define IDD_DIALOG1 108 #define IDD_DIALOG1 108

View File

@ -653,17 +653,10 @@ bool SV_RecursiveHullCheck(hull_t *hull, int32_t num, float p1f, float p2f, vec3
t2 = DoublePrecisionDotProduct(plane->normal, p2) - plane->dist; t2 = DoublePrecisionDotProduct(plane->normal, p2) - plane->dist;
} }
#if 1
if(t1 >= 0 && t2 >= 0) if(t1 >= 0 && t2 >= 0)
return SV_RecursiveHullCheck(hull, node->children[0], p1f, p2f, p1, p2, trace); return SV_RecursiveHullCheck(hull, node->children[0], p1f, p2f, p1, p2, trace);
if(t1 < 0 && t2 < 0) if(t1 < 0 && t2 < 0)
return SV_RecursiveHullCheck(hull, node->children[1], p1f, p2f, p1, p2, trace); return SV_RecursiveHullCheck(hull, node->children[1], p1f, p2f, p1, p2, trace);
#else
if((t1 >= DIST_EPSILON && t2 >= DIST_EPSILON) || (t2 > t1 && t1 >= 0))
return SV_RecursiveHullCheck(hull, node->children[0], p1f, p2f, p1, p2, trace);
if((t1 <= -DIST_EPSILON && t2 <= -DIST_EPSILON) || (t2 < t1 && t1 <= 0))
return SV_RecursiveHullCheck(hull, node->children[1], p1f, p2f, p1, p2, trace);
#endif
// put the crosspoint DIST_EPSILON pixels on the near side // put the crosspoint DIST_EPSILON pixels on the near side
if(t1 < 0) if(t1 < 0)