mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 05:00:46 +00:00
Merge branch 'master' into next
This commit is contained in:
commit
281d40d6d2
7 changed files with 42 additions and 33 deletions
11
src/d_main.c
11
src/d_main.c
|
@ -1212,12 +1212,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// load wad, including the main wad file
|
||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||
if (!W_InitMultipleFiles(startupwadfiles, mainwads))
|
||||
#ifdef _DEBUG
|
||||
CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#else
|
||||
I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#endif
|
||||
W_InitMultipleFiles(startupwadfiles, mainwads);
|
||||
D_CleanFile();
|
||||
|
||||
#ifndef DEVELOP // md5s last updated 16/02/20 (ddmmyy)
|
||||
|
@ -1297,12 +1292,14 @@ void D_SRB2Main(void)
|
|||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
CONS_Printf("Switching the renderer...\n");
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(setrenderneeded);
|
||||
D_CheckRendererState();
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
D_CheckRendererState();
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
|
|
|
@ -1594,7 +1594,7 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
|||
hook_p hookp;
|
||||
boolean hasSeenPlayer = true;
|
||||
if (!gL || !(hooksAvailable[hook_SeenPlayer/8] & (1<<(hook_SeenPlayer%8))))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = true; // local hook
|
||||
|
|
|
@ -3826,10 +3826,9 @@ boolean P_AddWadFile(const char *wadfilename)
|
|||
// UINT16 mapPos, mapNum = 0;
|
||||
|
||||
// Init file.
|
||||
if ((numlumps = W_InitFile(wadfilename, false)) == INT16_MAX)
|
||||
if ((numlumps = W_InitFile(wadfilename, false, false)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1212,14 +1212,23 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
INT32 width, height, leftoffset;
|
||||
fixed_t ca, sa;
|
||||
lumpnum_t lump = sprframe->lumppat[rot];
|
||||
size_t lumplength;
|
||||
|
||||
if (lump == LUMPERROR)
|
||||
return;
|
||||
|
||||
patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC);
|
||||
lumplength = W_LumpLength(lump);
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (R_IsLumpPNG((UINT8 *)patch, lumplength))
|
||||
patch = R_PNGToPatch((UINT8 *)patch, lumplength, NULL);
|
||||
else
|
||||
#endif
|
||||
// Because there's something wrong with SPR_DFLM, I guess
|
||||
if (!R_CheckIfPatch(lump))
|
||||
return;
|
||||
|
||||
patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC);
|
||||
width = patch->width;
|
||||
height = patch->height;
|
||||
leftoffset = patch->leftoffset;
|
||||
|
|
|
@ -1499,7 +1499,6 @@ void VID_CheckRenderer(void)
|
|||
{
|
||||
I_StartupHardwareGraphics();
|
||||
R_InitHardwareMode();
|
||||
HWR_Switch();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
40
src/w_wad.c
40
src/w_wad.c
|
@ -637,6 +637,21 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||
return lumpinfo;
|
||||
}
|
||||
|
||||
static UINT16 W_InitFileError (const char *filename, boolean exitworthy)
|
||||
{
|
||||
if (exitworthy)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#else
|
||||
I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename);
|
||||
return INT16_MAX;
|
||||
}
|
||||
|
||||
// Allocate a wadfile, setup the lumpinfo (directory) and
|
||||
// lumpcache, add the wadfile to the current active wadfiles
|
||||
//
|
||||
|
@ -648,7 +663,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||
//
|
||||
// Can now load dehacked files (.soc)
|
||||
//
|
||||
UINT16 W_InitFile(const char *filename, boolean mainfile)
|
||||
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
|
||||
{
|
||||
FILE *handle;
|
||||
lumpinfo_t *lumpinfo = NULL;
|
||||
|
@ -681,12 +696,12 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
|||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
|
||||
refreshdirmenu |= REFRESHDIR_MAX;
|
||||
return INT16_MAX;
|
||||
return W_InitFileError(filename, startup);
|
||||
}
|
||||
|
||||
// open wad file
|
||||
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
|
||||
return INT16_MAX;
|
||||
return W_InitFileError(filename, startup);
|
||||
|
||||
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
||||
// is send in the packet; cf.
|
||||
|
@ -701,7 +716,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
|||
refreshdirmenu |= REFRESHDIR_MAX;
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
return W_InitFileError(filename, startup);
|
||||
}
|
||||
|
||||
packetsizetally = packetsize;
|
||||
|
@ -722,7 +737,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
|||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
return W_InitFileError(filename, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -750,7 +765,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
|||
if (lumpinfo == NULL)
|
||||
{
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
return W_InitFileError(filename, startup);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -822,10 +837,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
|||
* backwards, so a later file overrides all earlier ones.
|
||||
*
|
||||
* \param filenames A null-terminated list of files to use.
|
||||
* \return 1 if base files were loaded, 0 if at least one was missing or
|
||||
* invalid.
|
||||
*/
|
||||
INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
||||
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
||||
{
|
||||
// open all the files, load headers, and count lumps
|
||||
numwadfiles = 0;
|
||||
|
@ -834,15 +847,8 @@ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
|||
for (; *filenames; filenames++)
|
||||
{
|
||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||
if (W_InitFile(*filenames, numwadfiles < mainfiles) == INT16_MAX)
|
||||
{
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
||||
if (numwadfiles < mainfiles)
|
||||
return 0;
|
||||
}
|
||||
W_InitFile(*filenames, numwadfiles < mainfiles, true);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Make sure a lump number is valid.
|
||||
|
|
|
@ -146,11 +146,10 @@ void W_Shutdown(void);
|
|||
// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened
|
||||
FILE *W_OpenWadFile(const char **filename, boolean useerrors);
|
||||
// Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error
|
||||
UINT16 W_InitFile(const char *filename, boolean mainfile);
|
||||
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup);
|
||||
|
||||
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise,
|
||||
// so that it stops with a message if a file was not found, but not if all is okay.
|
||||
INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles);
|
||||
// W_InitMultipleFiles exits if a file was not found, but not if all is okay.
|
||||
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles);
|
||||
|
||||
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
||||
|
|
Loading…
Reference in a new issue