Port addfilelocal from saturn
Modified to turn off features we don't have / prevent resyncs
This commit is contained in:
parent
2a669a665e
commit
72596e8d03
7 changed files with 66 additions and 16 deletions
|
|
@ -184,6 +184,7 @@ static void Command_AcceptInvite_f(void);
|
|||
static void Command_RejectInvite_f(void);
|
||||
static void Command_LeaveParty_f(void);
|
||||
|
||||
static void Command_Addfilelocal(void);
|
||||
static void Command_Addfile(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
static void Command_ListDoomednums_f(void);
|
||||
|
|
@ -858,6 +859,7 @@ void D_RegisterServerCommands(void)
|
|||
COM_AddCommand("showmap", Command_Showmap_f);
|
||||
COM_AddCommand("maphash", Command_Maphash_f);
|
||||
|
||||
COM_AddCommand("addfilelocal", Command_Addfilelocal);
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
|
|
@ -4763,6 +4765,44 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
|||
G_SetGameModified(true, false);
|
||||
}
|
||||
|
||||
static void Command_Addfilelocal(void)
|
||||
{
|
||||
const char *fn;
|
||||
INT32 i;
|
||||
size_t docompat = COM_CheckPartialParm("-c");
|
||||
size_t nocompat = COM_CheckPartialParm("-n");
|
||||
wadcompat_t compat = WC_AUTO;
|
||||
|
||||
if (docompat && nocompat)
|
||||
{
|
||||
CONS_Printf(M_GetText("Please specify only one of -c or -n\n"));
|
||||
return;
|
||||
}
|
||||
else if (docompat)
|
||||
compat = WC_ON;
|
||||
else if (nocompat)
|
||||
compat = WC_OFF;
|
||||
|
||||
if (COM_Argc() != 2 + (docompat || nocompat))
|
||||
{
|
||||
CONS_Printf(M_GetText("addfilelocal [-c|-n] <filename.pk3/wad/lua/soc>: Load local add-on\n"
|
||||
"-c forces compatmode, -n disables it.\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
fn = COM_Argv(1);
|
||||
|
||||
// Disallow non-printing characters and semicolons.
|
||||
for (i = 0; fn[i] != '\0'; i++)
|
||||
if (!isprint(fn[i]) || fn[i] == ';')
|
||||
return;
|
||||
|
||||
// Add any wad file, ignoring checks for if it contains complex things like
|
||||
// lua. Great for complex but client-side customizations, like different
|
||||
// level cards or anything like that.
|
||||
P_AddWadFile(fn, compat, true);
|
||||
}
|
||||
|
||||
/** Adds a pwad at runtime.
|
||||
* Searches for sounds, maps, music, new images.
|
||||
*/
|
||||
|
|
@ -4856,7 +4896,7 @@ static void Command_Addfile(void)
|
|||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn, compat);
|
||||
P_AddWadFile(fn, compat, false);
|
||||
addedfiles[numfilesadded++] = fn;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -4996,7 +5036,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
|||
|
||||
ncs = findfile(filename, filehash, true);
|
||||
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, compat))
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, compat, false))
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
if (ncs == FS_FOUND)
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ INT32 CL_CheckFiles(void)
|
|||
// CONS_Printf("checking %d of %d / %d of %d?\n", i, fileneedednum, j, numwadfiles);
|
||||
// CONS_Printf("i: %s / j: %s \n", fileneeded[i].filename, wadfiles[j]->filename);
|
||||
|
||||
if (j < numwadfiles && !wadfiles[j]->important)
|
||||
if (j < numwadfiles && !wadfiles[j]->important && !wadfiles[j]->localfile)
|
||||
{
|
||||
// Unimportant on our side.
|
||||
++j;
|
||||
|
|
@ -656,7 +656,7 @@ boolean CL_LoadServerFiles(void)
|
|||
continue; // Already loaded
|
||||
else if (fileneeded[i].status == FS_FOUND)
|
||||
{
|
||||
P_PartialAddWadFile(fileneeded[i].filename, fileneeded[i].compatmode ? WC_ON : WC_OFF);
|
||||
P_PartialAddWadFile(fileneeded[i].filename, fileneeded[i].compatmode ? WC_ON : WC_OFF, false);
|
||||
G_SetGameModified(true, false);
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -3082,7 +3082,7 @@ static void G_LoadDemoExtraFiles(demoheader_t *header)
|
|||
}
|
||||
else
|
||||
{
|
||||
P_PartialAddWadFile(file->filename, file->compatmode ? WC_ON : WC_OFF);
|
||||
P_PartialAddWadFile(file->filename, file->compatmode ? WC_ON : WC_OFF, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9128,7 +9128,7 @@ boolean P_RunSOC(const char *socfilename)
|
|||
lumpnum_t lump;
|
||||
|
||||
if (strstr(socfilename, ".soc") != NULL)
|
||||
return P_AddWadFile(socfilename, WC_AUTO);
|
||||
return P_AddWadFile(socfilename, WC_AUTO, false);
|
||||
|
||||
lump = W_CheckNumForName(socfilename);
|
||||
if (lump == LUMPERROR)
|
||||
|
|
@ -9348,11 +9348,11 @@ UINT8 P_InitMapData(boolean existingmapheaders)
|
|||
// Add a wadfile to the active wad files,
|
||||
// replace sounds, musics, patches, textures, sprites and maps
|
||||
//
|
||||
boolean P_AddWadFile(const char *wadfilename, wadcompat_t compat)
|
||||
boolean P_AddWadFile(const char *wadfilename, wadcompat_t compat, boolean local)
|
||||
{
|
||||
UINT16 wadnum;
|
||||
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, compat)) == UINT16_MAX)
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, compat, local)) == UINT16_MAX)
|
||||
return false;
|
||||
|
||||
P_MultiSetupWadFiles(true);
|
||||
|
|
@ -9450,7 +9450,7 @@ static boolean P_CheckVoteReplacements(char *name)
|
|||
// Add a WAD file and do the per-WAD setup stages.
|
||||
// Call P_MultiSetupWadFiles as soon as possible after any number of these.
|
||||
//
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat)
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat, boolean local)
|
||||
{
|
||||
size_t i;
|
||||
UINT16 numlumps, wadnum;
|
||||
|
|
@ -9486,6 +9486,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat)
|
|||
{
|
||||
partadd_important = true;
|
||||
}
|
||||
|
||||
wadfiles[wadnum]->localfile = local;
|
||||
|
||||
if (partadd_stage != 0)
|
||||
{
|
||||
partadd_earliestfile = wadnum;
|
||||
|
|
@ -9573,14 +9576,20 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat)
|
|||
K_InitBrightmapsPwad(wadnum);
|
||||
|
||||
// Reload TERRAIN
|
||||
if (K_InitTerrainPwad(wadnum))
|
||||
partadd_terrainloaded = true;
|
||||
if (!local)
|
||||
{
|
||||
if (K_InitTerrainPwad(wadnum))
|
||||
partadd_terrainloaded = true;
|
||||
}
|
||||
|
||||
//
|
||||
// look for skins
|
||||
//
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_PatchSkins(wadnum); // toast: PATCH PATCH
|
||||
if (!local)
|
||||
{
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_PatchSkins(wadnum); // toast: PATCH PATCH
|
||||
}
|
||||
|
||||
//
|
||||
// edit music defs
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ void P_PostLoadLevel(void);
|
|||
void HWR_LoadLevel(void);
|
||||
#endif
|
||||
void P_UnloadLevel(void);
|
||||
boolean P_AddWadFile(const char *wadfilename, wadcompat_t compat);
|
||||
boolean P_AddWadFile(const char *wadfilename, wadcompat_t compat, boolean local);
|
||||
|
||||
#define MAPRET_ADDED (1)
|
||||
#define MAPRET_CURRENTREPLACED (1<<1)
|
||||
|
|
@ -100,7 +100,7 @@ extern INT16 wadnamemap;
|
|||
// WARNING: The following functions should be grouped as follows:
|
||||
// any amount of PartialAdds followed by MultiSetups until returned true,
|
||||
// as soon as possible.
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat);
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat, boolean local);
|
||||
// Run a single stage of multisetup, or all of them if fullsetup set.
|
||||
// fullsetup true: run everything
|
||||
// otherwise
|
||||
|
|
|
|||
|
|
@ -1142,7 +1142,7 @@ void I_GetEvent(void)
|
|||
break;
|
||||
case SDL_DROPFILE:
|
||||
dropped_filedir = evt.drop.file;
|
||||
P_AddWadFile(dropped_filedir, WC_AUTO);
|
||||
P_AddWadFile(dropped_filedir, WC_AUTO, false);
|
||||
SDL_free(dropped_filedir); // Free dropped_filedir memory
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ struct wadfile_t
|
|||
|
||||
boolean important; // also network - !W_VerifyNMUSlumps
|
||||
boolean compatmode;
|
||||
boolean localfile;
|
||||
};
|
||||
|
||||
typedef enum wadcompat
|
||||
|
|
|
|||
Loading…
Reference in a new issue