mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-06 16:31:47 +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
|
// load wad, including the main wad file
|
||||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||||
if (!W_InitMultipleFiles(startupwadfiles, mainwads))
|
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
|
|
||||||
D_CleanFile();
|
D_CleanFile();
|
||||||
|
|
||||||
#ifndef DEVELOP // md5s last updated 16/02/20 (ddmmyy)
|
#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?
|
// Lactozilla: Does the render mode need to change?
|
||||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||||
{
|
{
|
||||||
|
CONS_Printf("Switching the renderer...\n");
|
||||||
needpatchflush = true;
|
needpatchflush = true;
|
||||||
needpatchrecache = true;
|
needpatchrecache = true;
|
||||||
VID_CheckRenderer();
|
VID_CheckRenderer();
|
||||||
SCR_ChangeRendererCVars(setrenderneeded);
|
SCR_ChangeRendererCVars(setrenderneeded);
|
||||||
|
D_CheckRendererState();
|
||||||
|
setrenderneeded = 0;
|
||||||
}
|
}
|
||||||
D_CheckRendererState();
|
|
||||||
|
|
||||||
wipegamestate = gamestate;
|
wipegamestate = gamestate;
|
||||||
|
|
||||||
|
|
|
@ -1594,7 +1594,7 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
||||||
hook_p hookp;
|
hook_p hookp;
|
||||||
boolean hasSeenPlayer = true;
|
boolean hasSeenPlayer = true;
|
||||||
if (!gL || !(hooksAvailable[hook_SeenPlayer/8] & (1<<(hook_SeenPlayer%8))))
|
if (!gL || !(hooksAvailable[hook_SeenPlayer/8] & (1<<(hook_SeenPlayer%8))))
|
||||||
return 0;
|
return true;
|
||||||
|
|
||||||
lua_settop(gL, 0);
|
lua_settop(gL, 0);
|
||||||
hud_running = true; // local hook
|
hud_running = true; // local hook
|
||||||
|
|
|
@ -3826,10 +3826,9 @@ boolean P_AddWadFile(const char *wadfilename)
|
||||||
// UINT16 mapPos, mapNum = 0;
|
// UINT16 mapPos, mapNum = 0;
|
||||||
|
|
||||||
// Init file.
|
// Init file.
|
||||||
if ((numlumps = W_InitFile(wadfilename, false)) == INT16_MAX)
|
if ((numlumps = W_InitFile(wadfilename, false, false)) == INT16_MAX)
|
||||||
{
|
{
|
||||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1212,14 +1212,23 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
||||||
INT32 width, height, leftoffset;
|
INT32 width, height, leftoffset;
|
||||||
fixed_t ca, sa;
|
fixed_t ca, sa;
|
||||||
lumpnum_t lump = sprframe->lumppat[rot];
|
lumpnum_t lump = sprframe->lumppat[rot];
|
||||||
|
size_t lumplength;
|
||||||
|
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
return;
|
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
|
// Because there's something wrong with SPR_DFLM, I guess
|
||||||
if (!R_CheckIfPatch(lump))
|
if (!R_CheckIfPatch(lump))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC);
|
|
||||||
width = patch->width;
|
width = patch->width;
|
||||||
height = patch->height;
|
height = patch->height;
|
||||||
leftoffset = patch->leftoffset;
|
leftoffset = patch->leftoffset;
|
||||||
|
|
|
@ -1499,7 +1499,6 @@ void VID_CheckRenderer(void)
|
||||||
{
|
{
|
||||||
I_StartupHardwareGraphics();
|
I_StartupHardwareGraphics();
|
||||||
R_InitHardwareMode();
|
R_InitHardwareMode();
|
||||||
HWR_Switch();
|
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
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
|
// Allocate a wadfile, setup the lumpinfo (directory) and
|
||||||
// lumpcache, add the wadfile to the current active wadfiles
|
// 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)
|
// 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;
|
FILE *handle;
|
||||||
lumpinfo_t *lumpinfo = NULL;
|
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"));
|
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
|
||||||
refreshdirmenu |= REFRESHDIR_MAX;
|
refreshdirmenu |= REFRESHDIR_MAX;
|
||||||
return INT16_MAX;
|
return W_InitFileError(filename, startup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open wad file
|
// open wad file
|
||||||
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
|
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
|
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
||||||
// is send in the packet; cf.
|
// is send in the packet; cf.
|
||||||
|
@ -701,7 +716,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
||||||
refreshdirmenu |= REFRESHDIR_MAX;
|
refreshdirmenu |= REFRESHDIR_MAX;
|
||||||
if (handle)
|
if (handle)
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return W_InitFileError(filename, startup);
|
||||||
}
|
}
|
||||||
|
|
||||||
packetsizetally = packetsize;
|
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);
|
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||||
if (handle)
|
if (handle)
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return W_InitFileError(filename, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -750,7 +765,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
||||||
if (lumpinfo == NULL)
|
if (lumpinfo == NULL)
|
||||||
{
|
{
|
||||||
fclose(handle);
|
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.
|
* backwards, so a later file overrides all earlier ones.
|
||||||
*
|
*
|
||||||
* \param filenames A null-terminated list of files to use.
|
* \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
|
// open all the files, load headers, and count lumps
|
||||||
numwadfiles = 0;
|
numwadfiles = 0;
|
||||||
|
@ -834,15 +847,8 @@ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
||||||
for (; *filenames; filenames++)
|
for (; *filenames; filenames++)
|
||||||
{
|
{
|
||||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||||
if (W_InitFile(*filenames, numwadfiles < mainfiles) == INT16_MAX)
|
W_InitFile(*filenames, numwadfiles < mainfiles, true);
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
|
||||||
if (numwadfiles < mainfiles)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make sure a lump number is valid.
|
/** 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
|
// 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);
|
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
|
// 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,
|
// W_InitMultipleFiles exits if a file was not found, but not if all is okay.
|
||||||
// so that it stops with a message if a file was not found, but not if all is okay.
|
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles);
|
||||||
INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles);
|
|
||||||
|
|
||||||
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||||
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
||||||
|
|
Loading…
Reference in a new issue