tcpconnect fixes

lots of hexen2 fixes
fixed clipped decals again, still not using any...
fixed zips over 2g
rewrote bloom to use glsl. should be slightly more usable now.
lots more hexen2 fixes

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3957 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2012-01-17 07:57:46 +00:00
parent 5651e77c30
commit fb214142a3
91 changed files with 4584 additions and 1270 deletions

View file

@ -152,16 +152,6 @@ typedef struct
#define Q1CONTENTS_LAVA -5
#define Q1CONTENTS_SKY -6
#define FTECONTENTS_EMPTY 0
#define FTECONTENTS_SOLID 1
#define FTECONTENTS_WATER 2
#define FTECONTENTS_SLIME 4
#define FTECONTENTS_LAVA 8
#define FTECONTENTS_SKY 16
#define FTECONTENTS_LADDER 32
#define FTECONTENTS_FLUID (FTECONTENTS_WATER|FTECONTENTS_SLIME|FTECONTENTS_LAVA|FTECONTENTS_SKY) //sky is a fluid for q1 code.
#define FTECONTENTS_PLAYERCLIP 64
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
@ -507,15 +497,27 @@ typedef struct
// these definitions also need to be in q_shared.h!
#define FTECONTENTS_EMPTY 0
#define FTECONTENTS_SOLID 1
//2
//4
#define FTECONTENTS_LAVA 8
#define FTECONTENTS_SLIME 16
#define FTECONTENTS_WATER 32
//#define FTECONTENTS_LADDER 32
#define FTECONTENTS_FLUID (FTECONTENTS_WATER|FTECONTENTS_SLIME|FTECONTENTS_LAVA|FTECONTENTS_SKY) //sky is a fluid for q1 code.
#define FTECONTENTS_PLAYERCLIP 0x00010000
#define FTECONTENTS_BODY 0x02000000
#define FTECONTENTS_SKY 0x80000000
// lower bits are stronger, and will eat weaker brushes completely
#define Q2CONTENTS_SOLID 1 // an eye is never valid in a solid
#define Q2CONTENTS_SOLID FTECONTENTS_SOLID //1
#define Q2CONTENTS_WINDOW 2 // translucent, but not watery
#define Q2CONTENTS_AUX 4
#define Q2CONTENTS_LAVA 8
#define Q2CONTENTS_SLIME 16
#define Q2CONTENTS_WATER 32
#define Q2CONTENTS_LAVA FTECONTENTS_LAVA //8
#define Q2CONTENTS_SLIME FTECONTENTS_SLIME //16
#define Q2CONTENTS_WATER FTECONTENTS_WATER //32
#define Q2CONTENTS_MIST 64
#define Q2LAST_VISIBLE_CONTENTS 64
// remaining contents are non-visible, and don't eat brushes
@ -534,15 +536,45 @@ typedef struct
#define Q2CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
#define Q2CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
#define Q2CONTENTS_MONSTER FTECONTENTS_BODY //0x2000000 // should never be on a brush, only in game
#define Q2CONTENTS_DEADMONSTER 0x4000000
#define Q2CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
#define Q2CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
#define Q2CONTENTS_LADDER 0x20000000
#define Q3CONTENTS_SOLID Q2CONTENTS_SOLID // should never be on a brush, only in game
#define Q3CONTENTS_BODY 0x2000000 // should never be on a brush, only in game
#define Q3CONTENTS_TRANSLUCENT 0x20000000
#define Q3CONTENTS_SOLID FTECONTENTS_SOLID //1 // should never be on a brush, only in game
//2
//4
#define Q3CONTENTS_LAVA FTECONTENTS_LAVA //8
#define Q3CONTENTS_SLIME FTECONTENTS_SLIME //16
#define Q3CONTENTS_WATER FTECONTENTS_WATER //32
//64
#define Q3CONTENTS_NOTTEAM1 0x00000080
#define Q3CONTENTS_NOTTEAM2 0x00000100
#define Q3CONTENTS_NOBOTCLIP 0x00000200
//0x00000400
//0x00000800
//0x00001000
//0x00002000
//0x00004000
#define Q3CONTENTS_AREAPORTAL 0x00008000
#define Q3CONTENTS_PLAYERCLIP Q2CONTENTS_PLAYERCLIP //0x00010000
#define Q3CONTENTS_MONSTERCLIP Q2CONTENTS_MONSTERCLIP //0x00020000
#define Q3CONTENTS_TELEPORTER 0x00040000
#define Q3CONTENTS_JUMPPAD 0x00080000
#define Q3CONTENTS_CLUSTERPORTAL 0x00100000
#define Q3CONTENTS_DONOTENTER 0x00200000
#define Q3CONTENTS_BOTCLIP 0x00400000
#define Q3CONTENTS_MOVER 0x00800000
#define Q3CONTENTS_ORIGIN Q2CONTENTS_ORIGIN //0x01000000
#define Q3CONTENTS_BODY 0x02000000
#define Q3CONTENTS_CORPSE Q2CONTENTS_DEADMONSTER //0x04000000
#define Q3CONTENTS_DETAIL Q2CONTENTS_DETAIL //0x08000000
#define Q3CONTENTS_STRUCTURAL 0x10000000
#define Q3CONTENTS_TRANSLUCENT 0x20000000
#define Q3CONTENTS_TRIGGER 0x40000000
#define Q3CONTENTS_NODROP FTECONTENTS_SKY //0x80000000
//Texinfo flags - warning: these mix with q3 surface flags
@ -562,16 +594,18 @@ typedef struct
//Surface flags
#define Q3SURF_LADDER 0x8 //wee
// content masks
#define MASK_ALL (-1)
#define MASK_SOLID (Q2CONTENTS_SOLID|Q2CONTENTS_WINDOW)
#define MASK_PLAYERSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW|Q2CONTENTS_MONSTER)
#define MASK_DEADSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW)
#define MASK_MONSTERSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTERCLIP|Q2CONTENTS_WINDOW|Q2CONTENTS_MONSTER)
#define MASK_WATER (Q2CONTENTS_WATER|Q2CONTENTS_LAVA|Q2CONTENTS_SLIME)
#define MASK_OPAQUE (Q2CONTENTS_SOLID|Q2CONTENTS_SLIME|Q2CONTENTS_LAVA)
#define MASK_SHOT (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTER|Q2CONTENTS_WINDOW|Q2CONTENTS_DEADMONSTER)
#define MASK_CURRENT (Q2CONTENTS_CURRENT_0|Q2CONTENTS_CURRENT_90|Q2CONTENTS_CURRENT_180|Q2CONTENTS_CURRENT_270|Q2CONTENTS_CURRENT_UP|Q2CONTENTS_CURRENT_DOWN)
// content masks. Allow q2contents_window in here
//#define MASK_ALL (-1)
#define MASK_WORLDSOLID (FTECONTENTS_SOLID|Q2CONTENTS_WINDOW) /*default trace type for something simple that ignores non-bsp stuff*/
#define MASK_POINTSOLID (FTECONTENTS_SOLID|Q2CONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity of no size*/
#define MASK_BOXSOLID (FTECONTENTS_SOLID|FTECONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity that does have size*/
#define MASK_PLAYERSOLID MASK_BOXSOLID
//#define MASK_DEADSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW)
//#define MASK_MONSTERSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTERCLIP|Q2CONTENTS_WINDOW|Q2CONTENTS_MONSTER)
#define MASK_WATER (FTECONTENTS_WATER|FTECONTENTS_LAVA|FTECONTENTS_SLIME)
//#define MASK_OPAQUE (Q2CONTENTS_SOLID|Q2CONTENTS_SLIME|Q2CONTENTS_LAVA)
//#define MASK_SHOT (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTER|Q2CONTENTS_WINDOW|Q2CONTENTS_DEADMONSTER)
#define Q2MASK_CURRENT (Q2CONTENTS_CURRENT_0|Q2CONTENTS_CURRENT_90|Q2CONTENTS_CURRENT_180|Q2CONTENTS_CURRENT_270|Q2CONTENTS_CURRENT_UP|Q2CONTENTS_CURRENT_DOWN)

View file

@ -2121,6 +2121,19 @@ const char *retstring(const char *s)
strcpy(ret->str, s);
return ret->str;
}
const char *retint(int f)
{
char s[1024];
tempstack_t *ret;
if (!f)
return "";
sprintf(s, "%d", f);
ret = (tempstack_t*)Z_Malloc(sizeof(tempstack_t)+strlen(s));
ret->next = ifstack;
ifstack=ret;
strcpy(ret->str, s);
return ret->str;
}
const char *retfloat(float f)
{
char s[1024];
@ -2185,7 +2198,7 @@ const char *If_Token(const char *func, const char **end)
else if (!strcmp(com_token, "int"))
{
func = If_Token(s, end);
return retfloat(atof(func));
return retint(atoi(func));
}
else if (!strcmp(com_token, "strlen"))
{
@ -2627,7 +2640,7 @@ void Cmd_set_f(void)
return;
text = Cmd_Argv(2);
}
else if (dpcompat_set.ival)
else if (dpcompat_set.ival && !docalc)
{
text = Cmd_Argv(2);
/*desc = Cmd_Argv(3)*/

View file

@ -1662,7 +1662,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int surfnum, ent
//The whole reason why model loading is supported in the server.
qboolean Mod_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace)
qboolean Mod_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int contentsmask, trace_t *trace)
{
galiasinfo_t *mod = Mod_Extradata(model);
galiasgroup_t *group;
@ -2765,6 +2765,8 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
#endif
galias->nextsurf = 0;
loadmodel->numframes = pq1inmodel->numframes;
//skins
skinstart = (daliasskintype_t *)((char*)pq1inmodel+hdrsize);
@ -2977,7 +2979,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -3317,7 +3319,7 @@ qboolean Mod_LoadQ2Model (model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -4108,7 +4110,7 @@ qboolean Mod_LoadQ3Model(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -4438,7 +4440,7 @@ qboolean Mod_LoadZymoticModel(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -5124,7 +5126,7 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -5479,7 +5481,7 @@ qboolean Mod_LoadDarkPlacesModel(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -6609,7 +6611,7 @@ qboolean Mod_LoadMD5MeshModel(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}
@ -6816,7 +6818,7 @@ qboolean Mod_LoadCompositeAnim(model_t *mod, void *buffer)
Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = Mod_Trace;
mod->funcs.NativeTrace = Mod_Trace;
return true;
}

View file

@ -231,6 +231,8 @@ void COM_Path_f (void)
Con_Printf ("Pure paths:\n");
for (s=com_purepaths ; s ; s=s->nextpure)
{
if (s->referenced)
Con_Printf("*");
s->funcs->PrintPath(s->handle);
}
Con_Printf ("----------\n");
@ -243,6 +245,8 @@ void COM_Path_f (void)
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
if (s->referenced)
Con_Printf("*");
s->funcs->PrintPath(s->handle);
}
}
@ -529,9 +533,9 @@ int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation
{
if (search->funcs->FindFile(search->handle, loc, filename, pf))
{
search->referenced |= fs_referencetype;
if (loc)
{
search->referenced |= fs_referencetype;
loc->search = search;
len = loc->len;
}
@ -670,7 +674,7 @@ char *FS_GetPackNames(char *buffer, int buffersize, int referencedonly, qboolean
if (referencedonly == 0 && !search->referenced)
continue;
if (referencedonly == 2 && search->referenced)
Q_strncatz(buffer, "*", sizeof(buffer));
Q_strncatz(buffer, "*", buffersize);
if (!ext)
{
@ -1339,6 +1343,8 @@ static int FS_AddWildDataFiles (const char *descriptor, int size, void *vparam)
if (!search->funcs->FindFile(search->handle, &loc, descriptor, NULL))
return true; //not found..
vfs = search->funcs->OpenVFS(search->handle, &loc, "rb");
if (!vfs)
return true;
pak = funcs->OpenNew (vfs, pakfile);
if (!pak)
return true;
@ -1727,7 +1733,7 @@ void COM_Gamedir (const char *dir)
/*some modern non-compat settings*/
#define DMFCFG "set com_parseutf8 1\npm_airstep 1\nsv_demoExtensions 1\n"
/*set some stuff so our regular qw client appears more like hexen2*/
#define HEX2CFG "set r_particlesdesc \"spikeset tsshaft h2part\"\nset sv_maxspeed 640\nset watervis 1\nset r_wateralpha 0.5\nset sv_pupglow 1\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n"
#define HEX2CFG "set_calc cl_playerclass int (random * 5) + 1\nset r_particlesdesc \"spikeset tsshaft h2part\"\nset sv_maxspeed 640\nset watervis 1\nset r_wateralpha 0.5\nset sv_pupglow 1\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n"
/*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/
#define Q3CFG "gl_overbright 2\nseta model sarge\nseta headmodel sarge\nseta handicap 100\n"
@ -1771,6 +1777,8 @@ const gamemode_info_t gamemode_info[] = {
{"FTE-JK2", "jk2", "-jk2", {"base/assets0.pk3"}, NULL, {"base", "fte"}, "Jedi Knight II: Jedi Outcast"},
{"FTE-HalfLife", "hl", "-halflife", {"valve/liblist.gam"}, NULL, {"valve", "ftehl"}, "Half-Life"},
{"FTE-Doom", "doom", "-doom", {"doom.wad"}, NULL, { "ftedoom"}, "Doom"},
{"FTE-Doom2", "doom2", "-doom2", {"doom2.wad"}, NULL, { "ftedoom"}, "Doom2"},
{NULL}
};
@ -2013,6 +2021,24 @@ char *FSQ3_GenerateClientPacksList(char *buffer, int maxlen, int basechecksum)
return buffer;
}
#ifdef DOOMWADS
void FS_AddRootWads(void)
{
vfsfile_t *vfs;
char *fname = "doom.wad";
void *pak;
extern searchpathfuncs_t doomwadfilefuncs;
vfs = FS_OpenVFS(fname, "rb", FS_ROOT);
pak = doomwadfilefuncs.OpenNew(vfs, fname);
if (!pak)
return;
FS_AddPathHandle(fname, fname, &doomwadfilefuncs, pak, true, false, false, (unsigned int)-1);
}
#endif
/*
================
FS_ReloadPackFiles
@ -2056,6 +2082,10 @@ void FS_ReloadPackFilesFlags(unsigned int reloadflags)
com_base_searchpaths = NULL;
#ifdef DOOMWADS
FS_AddRootWads();
#endif
while(oldpaths)
{
next = oldpaths->nextpure;
@ -2369,6 +2399,10 @@ void FS_StartupWithGame(int gamenum)
Cvar_Set(&com_protocolname, gamemode_info[gamenum].protocolname);
Cvar_ForceSet(&fs_gamename, gamemode_info[gamenum].poshname);
#ifdef DOOMWADS
FS_AddRootWads();
#endif
//
// start up with id1 by default
//

View file

@ -389,7 +389,7 @@ searchpathfuncs_t packfilefuncs = {
#ifdef DOOMWADS
void *FSPAK_LoadDoomWadFile (vfsfile_t *packhandle, char *desc)
void *FSPAK_LoadDoomWadFile (vfsfile_t *packhandle, const char *desc)
{
dwadheader_t header;
int i;

View file

@ -57,6 +57,7 @@ static int VFSW32_WriteBytes (struct vfsfile_s *file, const void *buffer, int by
}
static qboolean VFSW32_Seek (struct vfsfile_s *file, unsigned long pos)
{
unsigned long upper, lower;
vfsw32file_t *intfile = (vfsw32file_t*)file;
if (intfile->mmap)
{
@ -64,7 +65,10 @@ static qboolean VFSW32_Seek (struct vfsfile_s *file, unsigned long pos)
return true;
}
return SetFilePointer(intfile->hand, pos, NULL, FILE_BEGIN) != INVALID_SET_FILE_POINTER;
lower = (pos & 0xffffffff);
upper = ((pos>>16)>>16);
return SetFilePointer(intfile->hand, lower, &upper, FILE_BEGIN) != INVALID_SET_FILE_POINTER;
}
static unsigned long VFSW32_Tell (struct vfsfile_s *file)
{

View file

@ -468,18 +468,31 @@ typedef struct {
int index;
int startpos;
} vfszip_t;
void VFSZIP_MakeActive(vfszip_t *vfsz)
qboolean VFSZIP_MakeActive(vfszip_t *vfsz)
{
int i;
char buffer[8192]; //must be power of two
if ((vfszip_t*)vfsz->parent->currentfile == vfsz)
return; //already us
return true; //already us
if (vfsz->parent->currentfile)
unzCloseCurrentFile(vfsz->parent->handle);
unzLocateFileMy(vfsz->parent->handle, vfsz->index, vfsz->startpos);
unzOpenCurrentFile(vfsz->parent->handle);
if (unzOpenCurrentFile(vfsz->parent->handle) == UNZ_BADZIPFILE)
{
unz_file_info file_info;
buffer[0] = '?';
buffer[1] = 0;
if (unzGetCurrentFileInfo (vfsz->parent->handle, &file_info, buffer, sizeof(buffer), NULL, 0, NULL, 0) != UNZ_OK)
Con_Printf("Zip Error\n");
if (file_info.compression_method && file_info.compression_method != Z_DEFLATED)
Con_Printf("unsupported compression method on %s/%s\n", vfsz->parent->filename, buffer);
else
Con_Printf("corrupt file within zip, %s/%s\n", vfsz->parent->filename, buffer);
vfsz->parent->currentfile = NULL;
return false;
}
if (vfsz->pos > 0)
@ -493,6 +506,7 @@ void VFSZIP_MakeActive(vfszip_t *vfsz)
}
vfsz->parent->currentfile = (vfsfile_t*)vfsz;
return true;
}
int VFSZIP_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestoread)
@ -505,7 +519,8 @@ int VFSZIP_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestoread)
if (vfsz->iscompressed)
{
VFSZIP_MakeActive(vfsz);
if (!VFSZIP_MakeActive(vfsz))
return 0;
read = unzReadCurrentFile(vfsz->parent->handle, buffer, bytestoread);
}
else
@ -535,37 +550,44 @@ qboolean VFSZIP_Seek (struct vfsfile_s *file, unsigned long pos)
return VFS_SEEK(vfsz->defer, pos);
//This is *really* inefficient
if (vfsz->parent->currentfile == file)
{
if (vfsz->iscompressed)
{ //if they're going to seek on a file in a zip, let's just copy it out
char buffer[8192];
unsigned int chunk;
unsigned int i;
unsigned int length;
if (vfsz->iscompressed)
{ //if they're going to seek on a file in a zip, let's just copy it out
char buffer[8192];
unsigned int chunk;
unsigned int i;
unsigned int length;
vfsz->defer = FS_OpenTemp();
if (vfsz->defer)
vfsz->defer = FS_OpenTemp();
if (vfsz->defer)
{
if (vfsz->pos)
{
unzCloseCurrentFile(vfsz->parent->handle);
vfsz->parent->currentfile = NULL; //make it not us
}
length = vfsz->length;
i = 0;
vfsz->pos = 0;
VFSZIP_MakeActive(vfsz);
while (1)
{
chunk = length - i;
if (chunk > sizeof(buffer))
chunk = sizeof(buffer);
if (chunk == 0)
break;
unzReadCurrentFile(vfsz->parent->handle, buffer, chunk);
VFS_WRITE(vfsz->defer, buffer, chunk);
length = vfsz->length;
i = 0;
vfsz->pos = 0;
if (!VFSZIP_MakeActive(vfsz))
{
/*shouldn't really happen*/
VFS_CLOSE(vfsz->defer);
vfsz->defer = NULL;
return false;
}
i += chunk;
}
while (1)
{
chunk = length - i;
if (chunk > sizeof(buffer))
chunk = sizeof(buffer);
if (chunk == 0)
break;
unzReadCurrentFile(vfsz->parent->handle, buffer, chunk);
VFS_WRITE(vfsz->defer, buffer, chunk);
i += chunk;
}
}
@ -574,10 +596,13 @@ qboolean VFSZIP_Seek (struct vfsfile_s *file, unsigned long pos)
if (vfsz->defer)
return VFS_SEEK(vfsz->defer, pos);
else
{
unzCloseCurrentFile(vfsz->parent->handle);
vfsz->parent->currentfile = NULL; //make it not us, so the next read starts at the right place
}
}
if (pos < 0 || pos > vfsz->length)
return false;
vfsz->pos = pos;
@ -653,6 +678,15 @@ vfsfile_t *FSZIP_OpenVFS(void *handle, flocation_t *loc, const char *mode)
Z_Free(vfsz);
return NULL;
}
else if (!VFSZIP_MakeActive(vfsz)) /*this is called purely as a test*/
{
/*
windows explorer tends to use deflate64 on large files, which zlib and thus we, do not support, thus this is a 'common' failure path
this might also trigger from other errors, of course.
*/
Z_Free(vfsz);
return NULL;
}
zip->references++;

View file

@ -3748,7 +3748,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
loadmodel->funcs.StainNode = GLR_Q2BSP_StainNode;
loadmodel->funcs.MarkLights = Q2BSP_MarkLights;
#endif
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
@ -3845,7 +3844,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
loadmodel->funcs.MarkLights = NULL;
loadmodel->funcs.LeafPVS = CM_LeafnumPVS;
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
@ -3896,7 +3894,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
loadmodel->funcs.MarkLights = Q2BSP_MarkLights;
loadmodel->funcs.LeafPVS = CM_LeafnumPVS;
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
@ -4079,7 +4076,6 @@ void CM_InitBoxHull (void)
#endif
box_model.funcs.LeafPVS = CM_LeafnumPVS;
box_model.funcs.LeafnumForPoint = CM_PointLeafnum;
box_model.funcs.Trace = CM_Trace;
box_model.funcs.NativeContents = CM_NativeContents;
box_model.funcs.NativeTrace = CM_NativeTrace;
@ -5180,14 +5176,6 @@ trace_t CM_BoxTrace (model_t *mod, vec3_t start, vec3_t end,
return trace_trace;
}
qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace)
{
if (maxs[0] - mins[0])
*trace = CM_BoxTrace(model, start, end, mins, maxs, MASK_PLAYERSOLID);
else
*trace = CM_BoxTrace(model, start, end, mins, maxs, MASK_SOLID);
return trace->fraction != 1;
}
qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int contents, trace_t *trace)
{
*trace = CM_BoxTrace(model, start, end, mins, maxs, contents);
@ -5707,18 +5695,7 @@ unsigned int Q2BSP_PointContents(model_t *mod, vec3_t axis[3], vec3_t p)
{
int pc, ret = FTECONTENTS_EMPTY;
pc = CM_PointContents (mod, p);
if (pc & (Q2CONTENTS_SOLID|Q2CONTENTS_WINDOW))
ret |= FTECONTENTS_SOLID;
if (pc & Q2CONTENTS_LAVA)
ret |= FTECONTENTS_LAVA;
if (pc & Q2CONTENTS_SLIME)
ret |= FTECONTENTS_SLIME;
if (pc & Q2CONTENTS_WATER)
ret |= FTECONTENTS_WATER;
if (pc & Q2CONTENTS_LADDER)
ret |= FTECONTENTS_LADDER;
return ret;
return pc;
}

View file

@ -83,7 +83,7 @@ void NET_SendPacket (netsrc_t socket, int length, void *data, netadr_t to);
int NET_LocalAddressForRemote(struct ftenet_connections_s *collection, netadr_t *remote, netadr_t *local, int idx);
void NET_PrintAddresses(struct ftenet_connections_s *collection);
qboolean NET_AddressSmellsFunny(netadr_t a);
void NET_EnsureRoute(struct ftenet_connections_s *collection, char *routename, char *host, qboolean islisten);
qboolean NET_EnsureRoute(struct ftenet_connections_s *collection, char *routename, char *host, qboolean islisten);
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);

View file

@ -255,7 +255,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b)
if (a.type == NA_LOOPBACK)
return true;
if (a.type == NA_IP)
if (a.type == NA_IP || a.type == NA_TCP)
{
if ((memcmp(a.address.ip, b.address.ip, sizeof(a.address.ip)) == 0))
return true;
@ -507,6 +507,13 @@ char *NET_BaseAdrToString (char *s, int len, netadr_t a)
a.address.ip[2],
a.address.ip[3]);
break;
case NA_TCP:
snprintf (s, len, "tcp://%i.%i.%i.%i",
a.address.ip[0],
a.address.ip[1],
a.address.ip[2],
a.address.ip[3]);
break;
#ifdef IPPROTO_IPV6
case NA_BROADCAST_IP6:
case NA_IPV6:
@ -2081,6 +2088,7 @@ closesvstream:
if (con->generic.thesocket != INVALID_SOCKET && con->active < 256)
{
int newsock;
fromlen = sizeof(from);
newsock = accept(con->generic.thesocket, (struct sockaddr*)&from, &fromlen);
if (newsock != INVALID_SOCKET)
{
@ -2126,6 +2134,7 @@ qboolean FTENET_TCPConnect_SendPacket(ftenet_generic_connection_t *gcon, int len
if (NET_CompareAdr(to, st->remoteaddr))
{
unsigned short slen = BigShort((unsigned short)length);
#pragma warningmsg("TCPConnect: these calls can fail, corrupting the message stream")
send(st->socketnum, (char*)&slen, sizeof(slen), 0);
send(st->socketnum, data, length, 0);
@ -2168,11 +2177,15 @@ ftenet_generic_connection_t *FTENET_TCPConnect_EstablishConnection(int affamily,
netadr_t adr;
struct sockaddr_qstorage qs;
int family;
if (!strncmp(address, "tcp://", 6))
address += 6;
if (isserver)
{
if (!NET_PortToAdr(affamily, address, &adr))
return NULL; //couldn't resolve the name
if (adr.type == NA_IP)
adr.type = NA_TCP;
temp = NetadrToSockadr(&adr, &qs);
family = ((struct sockaddr_in*)&qs)->sin_family;
@ -2200,6 +2213,9 @@ ftenet_generic_connection_t *FTENET_TCPConnect_EstablishConnection(int affamily,
{
if (!NET_PortToAdr(affamily, address, &adr))
return NULL; //couldn't resolve the name
if (adr.type == NA_IP)
adr.type = NA_TCP;
newsocket = TCP_OpenStream(adr);
if (newsocket == INVALID_SOCKET)
return NULL;
@ -2218,7 +2234,7 @@ ftenet_generic_connection_t *FTENET_TCPConnect_EstablishConnection(int affamily,
newcon->generic.SendPacket = FTENET_TCPConnect_SendPacket;
newcon->generic.Close = FTENET_TCPConnect_Close;
newcon->generic.islisten = true;
newcon->generic.islisten = isserver;
newcon->generic.addrtype[0] = adr.type;
newcon->generic.addrtype[1] = NA_INVALID;
@ -2947,7 +2963,7 @@ void NET_SendPacket (netsrc_t netsrc, int length, void *data, netadr_t to)
Con_Printf("No route - open some ports\n");
}
void NET_EnsureRoute(ftenet_connections_t *collection, char *routename, char *host, qboolean islisten)
qboolean NET_EnsureRoute(ftenet_connections_t *collection, char *routename, char *host, qboolean islisten)
{
netadr_t adr;
NET_StringToAdr(host, &adr);
@ -2956,23 +2972,27 @@ void NET_EnsureRoute(ftenet_connections_t *collection, char *routename, char *ho
{
#ifdef TCPCONNECT
case NA_TCP:
FTENET_AddToCollection(collection, routename, host, FTENET_TCP4Connect_EstablishConnection, islisten);
if (!FTENET_AddToCollection(collection, routename, host, FTENET_TCP4Connect_EstablishConnection, islisten))
return false;
break;
#ifdef IPPROTO_IPV6
case NA_TCPV6:
FTENET_AddToCollection(collection, routename, host, FTENET_TCP6Connect_EstablishConnection, islisten);
if (!FTENET_AddToCollection(collection, routename, host, FTENET_TCP6Connect_EstablishConnection, islisten))
return false;
break;
#endif
#endif
#ifdef IRCCONNECT
case NA_IRC:
FTENET_AddToCollection(collection, routename, host, FTENET_IRCConnect_EstablishConnection, islisten);
if (!FTENET_AddToCollection(collection, routename, host, FTENET_IRCConnect_EstablishConnection, islisten))
return false;
break;
#endif
default:
//not recognised, or not needed
break;
}
return true;
}
void NET_PrintAddresses(ftenet_connections_t *collection)
@ -3009,12 +3029,17 @@ int TCP_OpenStream (netadr_t remoteaddr)
int newsocket;
int temp;
struct sockaddr_qstorage qs;
struct sockaddr_qstorage loc;
temp = NetadrToSockadr(&remoteaddr, &qs);
if ((newsocket = socket (((struct sockaddr_in*)&qs)->sin_family, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET)
return INVALID_SOCKET;
// memset(&loc, 0, sizeof(loc));
// ((struct sockaddr*)&loc)->sa_family = ((struct sockaddr*)&loc)->sa_family;
// bind(newsocket, (struct sockaddr *)&loc, ((struct sockaddr_in*)&qs)->sin_family == AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6));
if (connect(newsocket, (struct sockaddr *)&qs, temp) == INVALID_SOCKET)
{
closesocket(newsocket);

View file

@ -126,6 +126,7 @@ typedef struct {
int (*ParticleTypeForName) (char *name);
int (*FindParticleType) (char *name);
qboolean (*ParticleQuery) (int type, int body, char *outstr, int outstrlen);
int (*RunParticleEffectTypeString) (vec3_t org, vec3_t dir, float count, char *name);
int (*ParticleTrail) (vec3_t startpos, vec3_t end, int type, int dlkey, trailstate_t **tsk);

View file

@ -59,6 +59,7 @@ static void PM_AddTouchedEnt (int num)
return; // already added
pmove.touchindex[pmove.numtouch] = num;
VectorCopy(pmove.velocity, pmove.touchvel[pmove.numtouch]);
pmove.numtouch++;
}
@ -759,7 +760,7 @@ void PM_CategorizePosition (void)
}
}
if (cont & FTECONTENTS_LADDER)
if (cont & Q2CONTENTS_LADDER && pmove.physents[0].model->fromgame == fg_quake2)
pmove.onladder = true;
else
pmove.onladder = false;
@ -785,7 +786,7 @@ void PM_CategorizePosition (void)
pmove.onground = false; // too steep
}
}
if (cont & FTECONTENTS_LADDER && pmove.physents[0].model->fromgame == fg_quake2)
if (cont & Q2CONTENTS_LADDER && pmove.physents[0].model->fromgame == fg_quake2)
{
trace_t t;
vec3_t flatforward, fwd1;
@ -812,7 +813,7 @@ void PM_CategorizePosition (void)
//bsp objects marked as ladders mark regions to stand in to be classed as on a ladder.
cont = PM_ExtraBoxContents(pmove.origin);
if (cont & FTECONTENTS_LADDER)
if ((cont & Q2CONTENTS_LADDER) && (pmove.physents[0].model->fromgame == fg_quake2 || pmove.physents[0].model->fromgame == fg_halflife))
{
pmove.onladder = true;
pmove.onground = false; // too steep

View file

@ -74,6 +74,7 @@ typedef struct
// results
int numtouch;
int touchindex[MAX_PHYSENTS];
vec3_t touchvel[MAX_PHYSENTS];
qboolean onground;
int groundent; // index in physents array, only valid
// when onground is true

View file

@ -215,7 +215,7 @@ static qboolean PM_TransformedHullCheck (model_t *model, vec3_t start, vec3_t en
{
AngleVectors (angles, axis[0], axis[1], axis[2]);
VectorNegate(axis[1], axis[1]);
model->funcs.Trace(model, 0, 0, axis, start_l, end_l, player_mins, player_maxs, trace);
model->funcs.NativeTrace(model, 0, 0, axis, start_l, end_l, player_mins, player_maxs, MASK_PLAYERSOLID, trace);
}
else
{
@ -226,7 +226,7 @@ static qboolean PM_TransformedHullCheck (model_t *model, vec3_t start, vec3_t en
if (start_l[i]+player_maxs[i] < model->mins[i] && end_l[i] + player_maxs[i] < model->mins[i])
return false;
}
model->funcs.Trace(model, 0, 0, NULL, start_l, end_l, player_mins, player_maxs, trace);
model->funcs.NativeTrace(model, 0, 0, NULL, start_l, end_l, player_mins, player_maxs, MASK_PLAYERSOLID, trace);
}
}
else

View file

@ -458,4 +458,4 @@ enum lightfield_e
lfield_ambientscale=10,
lfield_diffusescale=11,
lfield_specularscale=12
};
};

View file

@ -375,7 +375,7 @@ unsigned int Q1BSP_PointContents(model_t *model, vec3_t axis[3], vec3_t point)
return Q1BSP_HullPointContents(&model->hulls[0], point);
}
qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace)
qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int hitcontentsmask, trace_t *trace)
{
hull_t *hull;
vec3_t size;
@ -1390,6 +1390,6 @@ void Q1BSP_SetModelFuncs(model_t *mod)
mod->funcs.LeafnumForPoint = Q1BSP_LeafnumForPoint;
mod->funcs.LeafPVS = Q1BSP_LeafnumPVS;
mod->funcs.Trace = Q1BSP_Trace;
mod->funcs.NativeTrace = Q1BSP_Trace;
mod->funcs.PointContents = Q1BSP_PointContents;
}

View file

@ -481,7 +481,7 @@ void PMQ2_AddCurrents (vec3_t wishvel)
// add water currents
//
if (q2pm->watertype & MASK_CURRENT)
if (q2pm->watertype & Q2MASK_CURRENT) /*FIXME: q3bsp*/
{
memset(v, 0, sizeof(vec3_t));

View file

@ -894,4 +894,5 @@ char *T_GetInfoString(int num)
return info_strings_table[num];
}
#endif
#endif

View file

@ -209,7 +209,8 @@ local unsigned long unzlocal_SearchCentralDir(vfsfile_t *fin) {
if (!VFS_SEEK(fin, uReadPos))
break;
if (VFS_READ(fin,buf,(unsigned int)uReadSize)!=uReadSize) break;
if (VFS_READ(fin,buf,uReadSize)!=uReadSize)
break;
for (i=(int)uReadSize-3; (i--)>0;)
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
@ -218,7 +219,8 @@ local unsigned long unzlocal_SearchCentralDir(vfsfile_t *fin) {
break;
}
if (uPosFound!=0) break;
if (uPosFound!=0)
break;
}
TRYFREE(buf);
return uPosFound;

View file

@ -103,11 +103,12 @@ typedef struct q2trace_s
//13
#define FL_FINDABLE_NONSOLID (1<<14) //a cpqwsv feature
#define FL_MOVECHAIN_ANGLE (1<<15) // hexen2 - when in a move chain, will update the angle
#define FL_LAGGEDMOVE (1<<16)
//17
#define FLQW_LAGGEDMOVE (1<<16)
#define FLH2_HUNTFACE (1<<16)
#define FLH2_NOZ (1<<17)
//18
//19
//20
#define FL_HUBSAVERESET (1<<20) //hexen2, ent is reverted to original state on map changes.
#define FL_CLASS_DEPENDENT (1<<21) //hexen2
@ -249,7 +250,7 @@ void VARGS WorldQ2_LinkEdict(world_t *w, q2edict_t *ent);
void VARGS WorldQ2_UnlinkEdict(world_t *w, q2edict_t *ent);
int VARGS WorldQ2_AreaEdicts (world_t *w, vec3_t mins, vec3_t maxs, q2edict_t **list,
int maxcount, int areatype);
trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, q2edict_t *passedict);
trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int hitcontentsmask, q2edict_t *passedict);
unsigned int Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *buffer, unsigned int buffersize, qboolean add);
qboolean Q2BSP_EdictInFatPVS(model_t *mod, struct pvscache_s *ent, qbyte *pvs);