adhere to filesystem priorities as specified by fmf files, and obey the order from pak.lst even when file extensions differ.

try to fix nacl builds.
added a 'mapper' positive penalty instead of using vip (which might be dangerous if modders are not aware of it).
fix menu.dat's graphics presets not loading configs properly.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5002 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2016-07-16 13:21:23 +00:00
parent 934a97c53e
commit 2d3b03ac48
8 changed files with 102 additions and 64 deletions

View file

@ -3014,7 +3014,7 @@ typedef struct qIApplicationAssociationRegistrationUI
} *lpVtbl; } *lpVtbl;
} qIApplicationAssociationRegistrationUI; } qIApplicationAssociationRegistrationUI;
void Sys_DoFileAssociations(qboolean elevated) void Sys_DoFileAssociations(int elevated)
{ {
char command[1024]; char command[1024];
qboolean ok = true; qboolean ok = true;

View file

@ -2266,27 +2266,32 @@ static void FS_AddManifestPackages(searchpath_t **oldpaths, const char *purepath
if (!oldp) if (!oldp)
{ {
handle = FS_GetOldPath(oldpaths, lname2, &keptflags); handle = FS_GetOldPath(oldpaths, lname2, &keptflags);
if (!handle) if (handle)
handle = FS_GetOldPath(oldpaths, lname, &keptflags); snprintf (lname, sizeof(lname), "%s", lname2);
if (!handle) else
{ {
vfs = NULL; handle = FS_GetOldPath(oldpaths, lname, &keptflags);
if (search)
{
if (search->handle->FindFile(search->handle, &loc, pname+ptlen+1, NULL))
vfs = search->handle->OpenVFS(search->handle, &loc, "r");
}
else
{
vfs = FS_OpenVFS(fs_manifest->package[i].path, "rb", FS_ROOT);
if (vfs)
snprintf (lname, sizeof(lname), "%s", lname2);
else
vfs = FS_OpenVFS(pname, "rb", FS_ROOT);
}
if (vfs) if (!handle)
handle = OpenNew (vfs, lname, fs_manifest->package[i].prefix?fs_manifest->package[i].prefix:""); {
vfs = NULL;
if (search)
{
if (search->handle->FindFile(search->handle, &loc, pname+ptlen+1, NULL))
vfs = search->handle->OpenVFS(search->handle, &loc, "r");
}
else
{
vfs = FS_OpenVFS(fs_manifest->package[i].path, "rb", FS_ROOT);
if (vfs)
snprintf (lname, sizeof(lname), "%s", lname2);
else
vfs = FS_OpenVFS(pname, "rb", FS_ROOT);
}
if (vfs)
handle = OpenNew (vfs, lname, fs_manifest->package[i].prefix?fs_manifest->package[i].prefix:"");
}
} }
if (handle && fs_manifest->package[i].crcknown) if (handle && fs_manifest->package[i].crcknown)
{ {
@ -2326,6 +2331,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
{ {
//search is the parent //search is the parent
int i, j; int i, j;
searchpath_t *existing;
searchpathfuncs_t *handle; searchpathfuncs_t *handle;
char pakfile[MAX_OSPATH]; char pakfile[MAX_OSPATH];
char logicalpaths[MAX_OSPATH]; //with a slash char logicalpaths[MAX_OSPATH]; //with a slash
@ -2342,40 +2348,6 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
wp.oldpaths = oldpaths; wp.oldpaths = oldpaths;
wp.inheritflags = pflags; wp.inheritflags = pflags;
for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++)
{
if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan)
continue;
if (loadstuff & (1<<j))
{
const char *extension = searchpathformats[j].extension;
//first load all the numbered pak files
for (i=0 ; ; i++)
{
snprintf (pakfile, sizeof(pakfile), "pak%i.%s", i, extension);
fs_finds++;
if (!search->handle->FindFile(search->handle, &loc, pakfile, NULL))
break; //not found..
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", logicalpaths, i, extension);
snprintf (purefile, sizeof(purefile), "%s/pak%i.%s", purepath, i, extension);
handle = FS_GetOldPath(oldpaths, pakfile, &keptflags);
if (!handle)
{
vfs = search->handle->OpenVFS(search->handle, &loc, "r");
if (!vfs)
break;
handle = searchpathformats[j].OpenNew (vfs, pakfile, "");
if (!handle)
break;
}
FS_AddPathHandle(oldpaths, purefile, pakfile, handle, "", SPF_COPYPROTECTED|pflags|keptflags, (unsigned int)-1);
}
}
}
//read pak.lst to get some sort of official ordering of pak files //read pak.lst to get some sort of official ordering of pak files
if (search->handle->FindFile(search->handle, &loc, "pak.lst", NULL) == FF_FOUND) if (search->handle->FindFile(search->handle, &loc, "pak.lst", NULL) == FF_FOUND)
{ {
@ -2413,6 +2385,62 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
BZ_Free(buffer); BZ_Free(buffer);
} }
for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++)
{
if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan)
continue;
if (loadstuff & (1<<j))
{
const char *extension = searchpathformats[j].extension;
//first load all the numbered pak files
for (i=0 ; ; i++)
{
snprintf (pakfile, sizeof(pakfile), "pak%i.%s", i, extension);
fs_finds++;
if (!search->handle->FindFile(search->handle, &loc, pakfile, NULL))
break; //not found..
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", logicalpaths, i, extension);
snprintf (purefile, sizeof(purefile), "%s/pak%i.%s", purepath, i, extension);
for (existing = com_searchpaths; existing; existing = existing->next)
{
if (!Q_strcasecmp(existing->logicalpath, pakfile)) //assumption: first member of structure is a char array
break; //already loaded (base paths?)
}
if (!existing)
{
handle = FS_GetOldPath(oldpaths, pakfile, &keptflags);
if (!handle)
{
vfs = search->handle->OpenVFS(search->handle, &loc, "r");
if (!vfs)
break;
handle = searchpathformats[j].OpenNew (vfs, pakfile, "");
if (!handle)
break;
}
FS_AddPathHandle(oldpaths, purefile, pakfile, handle, "", SPF_COPYPROTECTED|pflags|keptflags, (unsigned int)-1);
}
}
}
}
//now load ones from the manifest
for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++)
{
if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan)
continue;
if (loadstuff & (1<<j))
{
const char *extension = searchpathformats[j].extension;
wp.OpenNew = searchpathformats[j].OpenNew;
FS_AddManifestPackages(oldpaths, purepath, logicalpaths, search, extension, wp.OpenNew);
}
}
//now load the random ones //now load the random ones
for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++) for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++)
{ {
@ -2422,10 +2450,9 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
{ {
const char *extension = searchpathformats[j].extension; const char *extension = searchpathformats[j].extension;
wp.OpenNew = searchpathformats[j].OpenNew; wp.OpenNew = searchpathformats[j].OpenNew;
Q_snprintfz (pakfile, sizeof(pakfile), "*.%s", extension); Q_snprintfz (pakfile, sizeof(pakfile), "*.%s", extension);
search->handle->EnumerateFiles(search->handle, pakfile, FS_AddWildDataFiles, &wp); search->handle->EnumerateFiles(search->handle, pakfile, FS_AddWildDataFiles, &wp);
FS_AddManifestPackages(oldpaths, purepath, logicalpaths, search, extension, wp.OpenNew);
} }
} }
} }

View file

@ -4841,19 +4841,17 @@ static neterr_t FTENET_NaClWebSocket_SendPacket(ftenet_generic_connection_t *gco
} }
/*nacl websockets implementation...*/ /*nacl websockets implementation...*/
static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address) static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address, netadr_t adr)
{ {
ftenet_websocket_connection_t *newcon; ftenet_websocket_connection_t *newcon;
netadr_t adr;
PP_Resource newsocket; PP_Resource newsocket;
if (isserver || !ppb_websocket_interface) if (isserver || !ppb_websocket_interface)
{ {
return NULL; return NULL;
} }
if (!NET_StringToAdr(address, 80, &adr))
return NULL; //couldn't resolve the name
newcon = Z_Malloc(sizeof(*newcon)); newcon = Z_Malloc(sizeof(*newcon));
if (newcon) if (newcon)
{ {

View file

@ -6145,7 +6145,7 @@ qboolean SV_Prespawn_Brushes(sizebuf_t *msg, unsigned int *modelindex, unsigned
} }
qboolean SV_Parse_BrushEdit(void) qboolean SV_Parse_BrushEdit(void)
{ {
qboolean authorise = SV_MayCheat() || (host_client->penalties & BAN_VIP); qboolean authorise = (host_client->penalties & BAN_MAPPER) || (host_client->netchan.remote_address.type == NA_LOOPBACK);
unsigned int modelindex = MSG_ReadShort(); unsigned int modelindex = MSG_ReadShort();
int cmd = MSG_ReadByte(); int cmd = MSG_ReadByte();
model_t *mod = (modelindex<countof(sv.models))?sv.models[modelindex]:NULL; model_t *mod = (modelindex<countof(sv.models))?sv.models[modelindex]:NULL;
@ -6154,7 +6154,10 @@ qboolean SV_Parse_BrushEdit(void)
{ {
unsigned int brushid = MSG_ReadLong(); unsigned int brushid = MSG_ReadLong();
if (!authorise) if (!authorise)
{
SV_PrintToClient(host_client, PRINT_MEDIUM, "Brush editing ignored: you are not a mapper\n");
return true; return true;
}
Terr_Brush_DeleteId(hm, brushid); Terr_Brush_DeleteId(hm, brushid);
MSG_WriteByte(&sv.multicast, svcfte_brushedit); MSG_WriteByte(&sv.multicast, svcfte_brushedit);
@ -6177,7 +6180,10 @@ qboolean SV_Parse_BrushEdit(void)
return false; return false;
} }
if (!authorise) if (!authorise)
{
SV_PrintToClient(host_client, PRINT_MEDIUM, "Brush editing ignored: you are not a mapper\n");
return true; return true;
}
Terr_Brush_DeleteId(hm, brush.id); Terr_Brush_DeleteId(hm, brush.id);
if (!Terr_Brush_Insert(mod, hm, &brush)) if (!Terr_Brush_Insert(mod, hm, &brush))

View file

@ -589,12 +589,12 @@ typedef struct client_s
qboolean csqcactive; qboolean csqcactive;
#ifdef PROTOCOL_VERSION_FTE #ifdef PROTOCOL_VERSION_FTE
qboolean pextknown; qboolean pextknown;
unsigned int fteprotocolextensions; unsigned int fteprotocolextensions;
unsigned int fteprotocolextensions2; unsigned int fteprotocolextensions2;
#endif #endif
unsigned int zquake_extensions; unsigned int zquake_extensions;
unsigned int max_net_ents; /*highest entity number the client can receive (limited by either protocol or client's buffer size)*/ unsigned int max_net_ents; /*highest entity number the client can receive (limited by either protocol or client's buffer size)*/
unsigned int max_net_clients; /*max number of player slots supported by the client */ unsigned int max_net_clients; /*max number of player slots supported by the client */
unsigned int maxmodels; /*max models supported by whatever the protocol is*/ unsigned int maxmodels; /*max models supported by whatever the protocol is*/
@ -1043,6 +1043,7 @@ void SV_AutoAddPenalty (client_t *cl, unsigned int banflag, int duration, char *
#define BAN_USER6 (1u<<16)//mod-specified #define BAN_USER6 (1u<<16)//mod-specified
#define BAN_USER7 (1u<<17)//mod-specified #define BAN_USER7 (1u<<17)//mod-specified
#define BAN_USER8 (1u<<18)//mod-specified #define BAN_USER8 (1u<<18)//mod-specified
#define BAN_MAPPER (1u<<19)//mod-specified
// //
// sv_main.c // sv_main.c

View file

@ -59,6 +59,7 @@ static const struct banflags_s
{BAN_BLIND, {"blind"}}, {BAN_BLIND, {"blind"}},
{BAN_SPECONLY, {"spec"}}, {BAN_SPECONLY, {"spec"}},
{BAN_STEALTH, {"stealth"}}, {BAN_STEALTH, {"stealth"}},
{BAN_MAPPER, {"mapper"}},
{BAN_USER1, {"user1"}}, {BAN_USER1, {"user1"}},
{BAN_USER2, {"user2"}}, {BAN_USER2, {"user2"}},

View file

@ -1021,6 +1021,7 @@ void SV_SendClientPrespawnInfo(client_t *client)
{ {
client->prespawn_stage++; client->prespawn_stage++;
client->prespawn_idx = 0; client->prespawn_idx = 0;
client->prespawn_idx2 = 0;
break; break;
} }
client->prespawn_idx++; client->prespawn_idx++;
@ -1530,6 +1531,8 @@ void SV_SendClientPrespawnInfo(client_t *client)
ClientReliableWrite_String(client, cmd); ClientReliableWrite_String(client, cmd);
} }
client->prespawn_stage++; client->prespawn_stage++;
client->prespawn_idx = 0;
client->prespawn_idx2 = 0;
} }
//this is extra stuff that will happen after we're on the server //this is extra stuff that will happen after we're on the server
@ -1538,7 +1541,9 @@ void SV_SendClientPrespawnInfo(client_t *client)
{ //when brush editing, connecting clients need a copy of all the brushes. { //when brush editing, connecting clients need a copy of all the brushes.
while (client->netchan.message.cursize < maxsize) while (client->netchan.message.cursize < maxsize)
{ {
#ifdef TERRAIN
if (!SV_Prespawn_Brushes(&client->netchan.message, &client->prespawn_idx, &client->prespawn_idx2)) if (!SV_Prespawn_Brushes(&client->netchan.message, &client->prespawn_idx, &client->prespawn_idx2))
#endif
{ {
client->prespawn_stage++; client->prespawn_stage++;
client->prespawn_idx = 0; client->prespawn_idx = 0;

View file

@ -71,7 +71,7 @@ nonstatic void(mitem_desktop desktop) M_Preset =
string fname = search_getfilename(fs, i); string fname = search_getfilename(fs, i);
string iname = substring(fname, 15, -5); string iname = substring(fname, 15, -5);
string dname = GetFirstLineComment(fname, iname); string dname = GetFirstLineComment(fname, iname);
iname = sprintf("exec \"%s\";vid_reload", iname); iname = sprintf("exec \"configs/preset_%s.cfg\";vid_reload", iname);
if (dname && !fr.findchildcmd(iname)) if (dname && !fr.findchildcmd(iname))
{ {
fr.add(spawn(mitem_text, item_text:dname, item_command:iname, item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, y], '100 16'); fr.add(spawn(mitem_text, item_text:dname, item_command:iname, item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, y], '100 16');