- moved more code to 'common'.

This is all low level utilities with no dependencies on game logic. Having this in a separate directory makes sharing with Raze a lot easier.
This commit is contained in:
Christoph Oelckers 2020-04-11 12:56:55 +02:00
parent e230420f88
commit 6996d54a23
90 changed files with 224 additions and 327 deletions

View file

@ -1121,7 +1121,10 @@ set (PCH_SOURCES
rendering/swrenderer/textures/warptexture.cpp rendering/swrenderer/textures/warptexture.cpp
rendering/swrenderer/textures/swcanvastexture.cpp rendering/swrenderer/textures/swcanvastexture.cpp
events.cpp events.cpp
utility/i_module.cpp common/utility/engineerrors.cpp
common/utility/i_module.cpp
common/utility/m_alloc.cpp
common/utility/utf8.cpp
utility/palette.cpp utility/palette.cpp
utility/palettecontainer.cpp utility/palettecontainer.cpp
utility/files.cpp utility/files.cpp
@ -1140,13 +1143,11 @@ set (PCH_SOURCES
utility/cmdlib.cpp utility/cmdlib.cpp
utility/configfile.cpp utility/configfile.cpp
utility/i_time.cpp utility/i_time.cpp
utility/m_alloc.cpp
utility/m_argv.cpp utility/m_argv.cpp
utility/m_bbox.cpp utility/m_bbox.cpp
utility/name.cpp utility/name.cpp
utility/s_playlist.cpp utility/s_playlist.cpp
utility/v_collection.cpp utility/v_collection.cpp
utility/utf8.cpp
utility/zstrformat.cpp utility/zstrformat.cpp
common/thirdparty/md5.cpp common/thirdparty/md5.cpp
common/thirdparty/superfasthash.cpp common/thirdparty/superfasthash.cpp

View file

@ -0,0 +1,115 @@
/*
** engineerrors.cpp
** Contains error classes that can be thrown around
**
**---------------------------------------------------------------------------
** Copyright 1998-2016 Randy Heit
** Copyright 2005-2020 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
bool gameisdead;
#ifdef _WIN32
#include <windows.h>
#include "zstring.h"
void I_DebugPrint(const char *cp)
{
if (IsDebuggerPresent())
{
auto wstr = WideString(cp);
OutputDebugStringW(wstr.c_str());
}
}
#else
void I_DebugPrint(const char *cp)
{
}
#endif
#include "engineerrors.h"
#include "printf.h"
//==========================================================================
//
// I_Error
//
// Throw an error that will send us to the console if we are far enough
// along in the startup process.
//
//==========================================================================
void I_Error(const char *error, ...)
{
va_list argptr;
char errortext[MAX_ERRORTEXT];
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
throw CRecoverableError(errortext);
}
//==========================================================================
//
// I_FatalError
//
// Throw an error that will end the game.
//
//==========================================================================
extern FILE *Logfile;
void I_FatalError(const char *error, ...)
{
static bool alreadyThrown = false;
gameisdead = true;
if (!alreadyThrown) // ignore all but the first message -- killough
{
alreadyThrown = true;
char errortext[MAX_ERRORTEXT];
va_list argptr;
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
// Record error to log (if logging)
if (Logfile)
{
fprintf(Logfile, "\n**** DIED WITH FATAL ERROR:\n%s\n", errortext);
fflush(Logfile);
}
throw CFatalError(errortext);
}
std::terminate(); // recursive I_FatalErrors must immediately terminate.
}

View file

@ -39,18 +39,18 @@
#include <stdio.h> #include <stdio.h>
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
#include "doomtype.h" #include "basics.h"
#define MAX_ERRORTEXT 1024 #define MAX_ERRORTEXT 1024
class CDoomError : public std::exception class CEngineError : public std::exception
{ {
public: public:
CDoomError () CEngineError ()
{ {
m_Message[0] = '\0'; m_Message[0] = '\0';
} }
CDoomError (const char *message) CEngineError (const char *message)
{ {
SetMessage (message); SetMessage (message);
} }
@ -83,25 +83,18 @@ protected:
}; };
class CRecoverableError : public CDoomError class CRecoverableError : public CEngineError
{ {
public: public:
CRecoverableError() : CDoomError() {} CRecoverableError() : CEngineError() {}
CRecoverableError(const char *message) : CDoomError(message) {} CRecoverableError(const char *message) : CEngineError(message) {}
}; };
class CFatalError : public CDoomError class CFatalError : public CEngineError
{ {
public: public:
CFatalError() : CDoomError() {} CFatalError() : CEngineError() {}
CFatalError(const char *message) : CDoomError(message) {} CFatalError(const char *message) : CEngineError(message) {}
};
class CVulkanError : public CDoomError
{
public:
CVulkanError() : CDoomError() {}
CVulkanError(const char *message) : CDoomError(message) {}
}; };
class CExitEvent : public std::exception class CExitEvent : public std::exception

View file

@ -2,7 +2,8 @@
#define __M_FIXED__ #define __M_FIXED__
#include <stdlib.h> #include <stdlib.h>
#include "doomtype.h" #include <stdint.h>
#include "basics.h"
// Modern compilers are smart enough to do these multiplications intelligently. // Modern compilers are smart enough to do these multiplications intelligently.

View file

@ -314,6 +314,8 @@ struct TVector3
{ {
} }
TVector3(std::nullptr_t nul) = delete;
TVector3(const TVector3 &other) = default; TVector3(const TVector3 &other) = default;
TVector3 (const Vector2 &xy, vec_t z) TVector3 (const Vector2 &xy, vec_t z)

View file

@ -48,7 +48,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "i_system.h" #include "i_system.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "doomstat.h" #include "doomstat.h"
#include "gstrings.h" #include "gstrings.h"
#include "s_sound.h" #include "s_sound.h"

View file

@ -920,7 +920,7 @@ int PrintString (int iprintlevel, const char *outline)
return 0; // Don't waste time on calculating this if nothing at all was printed... return 0; // Don't waste time on calculating this if nothing at all was printed...
} }
bool gameisdead; extern bool gameisdead;
int VPrintf (int printlevel, const char *format, va_list parms) int VPrintf (int printlevel, const char *format, va_list parms)
{ {

View file

@ -45,7 +45,7 @@
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "resourcefiles/resourcefile.h" #include "resourcefiles/resourcefile.h"
#include "version.h" #include "version.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "v_text.h" #include "v_text.h"
CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);

View file

@ -42,7 +42,7 @@
#include <math.h> #include <math.h>
#include <assert.h> #include <assert.h>
#include "doomerrors.h" #include "engineerrors.h"
#include "i_time.h" #include "i_time.h"
#include "d_gui.h" #include "d_gui.h"
@ -166,7 +166,6 @@ EXTERN_CVAR (Bool, r_drawplayersprites)
EXTERN_CVAR (Bool, show_messages) EXTERN_CVAR (Bool, show_messages)
extern bool setmodeneeded; extern bool setmodeneeded;
extern bool gameisdead;
extern bool demorecording; extern bool demorecording;
extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop
extern bool insave; extern bool insave;
@ -2345,64 +2344,6 @@ static void CheckCmdLine()
} }
} }
//==========================================================================
//
// I_Error
//
// Throw an error that will send us to the console if we are far enough
// along in the startup process.
//
//==========================================================================
void I_Error(const char *error, ...)
{
va_list argptr;
char errortext[MAX_ERRORTEXT];
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
throw CRecoverableError(errortext);
}
//==========================================================================
//
// I_FatalError
//
// Throw an error that will end the game.
//
//==========================================================================
extern FILE *Logfile;
void I_FatalError(const char *error, ...)
{
static bool alreadyThrown = false;
gameisdead = true;
if (!alreadyThrown) // ignore all but the first message -- killough
{
alreadyThrown = true;
char errortext[MAX_ERRORTEXT];
va_list argptr;
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
// Record error to log (if logging)
if (Logfile)
{
fprintf(Logfile, "\n**** DIED WITH FATAL ERROR:\n%s\n", errortext);
fflush(Logfile);
}
throw CFatalError(errortext);
}
std::terminate(); // recursive I_FatalErrors must immediately terminate.
}
static void NewFailure () static void NewFailure ()
{ {
I_FatalError ("Failed to allocate memory from system heap"); I_FatalError ("Failed to allocate memory from system heap");
@ -2906,6 +2847,8 @@ static int D_DoomMain_Internal (void)
while (1); while (1);
} }
void I_ShowFatalError(const char* message);
int D_DoomMain() int D_DoomMain()
{ {
int ret = 0; int ret = 0;

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include "tarray.h"
class DObject; class DObject;
class FSerializer; class FSerializer;

View file

@ -58,14 +58,6 @@ typedef TMap<int, PClassActor *> FClassMap;
extern bool batchrun; extern bool batchrun;
// Bounding box coordinate storage. // Bounding box coordinate storage.
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
}; // bbox coordinates
#include "palentry.h" #include "palentry.h"
enum class ETextureType : uint8_t enum class ETextureType : uint8_t

View file

@ -40,7 +40,7 @@
#include "s_sound.h" #include "s_sound.h"
#include "d_event.h" #include "d_event.h"
#include "m_random.h" #include "m_random.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "doomstat.h" #include "doomstat.h"
#include "wi_stuff.h" #include "wi_stuff.h"
#include "w_wad.h" #include "w_wad.h"

View file

@ -57,7 +57,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "decallib.h" #include "decallib.h"
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "p_effect.h" #include "p_effect.h"
#include "serializer.h" #include "serializer.h"
#include "thingdef.h" #include "thingdef.h"

View file

@ -32,7 +32,7 @@
** **
*/ */
#include "doomerrors.h" #include "engineerrors.h"
#include "textures.h" #include "textures.h"
#include "image.h" #include "image.h"
#include "v_font.h" #include "v_font.h"

View file

@ -33,7 +33,7 @@
** **
*/ */
#include "doomerrors.h" #include "engineerrors.h"
#include "textures.h" #include "textures.h"
#include "image.h" #include "image.h"
#include "v_font.h" #include "v_font.h"

View file

@ -33,7 +33,7 @@
** **
*/ */
#include "doomerrors.h" #include "engineerrors.h"
#include "textures.h" #include "textures.h"
#include "v_font.h" #include "v_font.h"
#include "w_wad.h" #include "w_wad.h"

View file

@ -38,7 +38,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "v_text.h" #include "v_text.h"
#include "doomerrors.h" #include "engineerrors.h"
const char *SpecialMapthingNames[] = { const char *SpecialMapthingNames[] = {

View file

@ -1,5 +1,5 @@
#include "files.h" #include "files.h"
#include "doomerrors.h" #include "engineerrors.h"
class FZipExploder class FZipExploder
{ {

View file

@ -38,7 +38,7 @@
#include "v_text.h" #include "v_text.h"
#include "w_wad.h" #include "w_wad.h"
#include "gi.h" #include "gi.h"
#include "doomerrors.h" #include "engineerrors.h"
//========================================================================== //==========================================================================
// //

View file

@ -45,7 +45,7 @@
#include "d_net.h" #include "d_net.h"
#include "g_game.h" #include "g_game.h"
#include "m_png.h" #include "m_png.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "w_wad.h" #include "w_wad.h"
#include "p_local.h" #include "p_local.h"
#include "p_setup.h" #include "p_setup.h"

View file

@ -34,7 +34,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "r_sky.h" #include "r_sky.h"
#include "m_random.h" #include "m_random.h"
#include "d_player.h" #include "d_player.h"

View file

@ -42,7 +42,7 @@
#include "image.h" #include "image.h"
#include "imagehelpers.h" #include "imagehelpers.h"
#include "fontchars.h" #include "fontchars.h"
#include "doomerrors.h" #include "engineerrors.h"
//========================================================================== //==========================================================================
// //

View file

@ -53,7 +53,7 @@
#include "imagehelpers.h" #include "imagehelpers.h"
#include "image.h" #include "image.h"
#include "formats/multipatchtexture.h" #include "formats/multipatchtexture.h"
#include "doomerrors.h" #include "engineerrors.h"
// On the Alpha, accessing the shorts directly if they aren't aligned on a // On the Alpha, accessing the shorts directly if they aren't aligned on a
// 4-byte boundary causes unaligned access warnings. Why it does this at // 4-byte boundary causes unaligned access warnings. Why it does this at

View file

@ -61,7 +61,7 @@
#include "d_player.h" #include "d_player.h"
#include "st_start.h" #include "st_start.h"
#include "m_misc.h" #include "m_misc.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "i_net.h" #include "i_net.h"

View file

@ -51,7 +51,7 @@
#include "p_local.h" #include "p_local.h"
#include "nodebuild.h" #include "nodebuild.h"
#include "doomstat.h" #include "doomstat.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "p_setup.h" #include "p_setup.h"
#include "version.h" #include "version.h"
#include "md5.h" #include "md5.h"

View file

@ -68,7 +68,7 @@
#include "v_text.h" #include "v_text.h"
#include "p_setup.h" #include "p_setup.h"
#include "gi.h" #include "gi.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "types.h" #include "types.h"
#include "w_wad.h" #include "w_wad.h"
#include "p_conversation.h" #include "p_conversation.h"

View file

@ -36,7 +36,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_conversation.h" #include "p_conversation.h"
#include "udmf.h" #include "udmf.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "actor.h" #include "actor.h"
#include "a_pickups.h" #include "a_pickups.h"
#include "w_wad.h" #include "w_wad.h"

View file

@ -44,7 +44,7 @@
#include "p_acs.h" #include "p_acs.h"
#include "announcer.h" #include "announcer.h"
#include "wi_stuff.h" #include "wi_stuff.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "gi.h" #include "gi.h"
#include "p_conversation.h" #include "p_conversation.h"
#include "a_keys.h" #include "a_keys.h"

View file

@ -28,7 +28,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "actor.h" #include "actor.h"
#include "doomerrors.h" #include "engineerrors.h"
#ifdef _MSC_VER #ifdef _MSC_VER
// This pragma saves 8kb of wasted code. // This pragma saves 8kb of wasted code.
@ -38,11 +38,11 @@
class DFraggleThinker; class DFraggleThinker;
class CFraggleScriptError : public CDoomError class CFraggleScriptError : public CEngineError
{ {
public: public:
CFraggleScriptError() : CDoomError() {} CFraggleScriptError() : CEngineError() {}
CFraggleScriptError(const char *message) : CDoomError(message) {} CFraggleScriptError(const char *message) : CEngineError(message) {}
}; };

View file

@ -37,7 +37,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "dthinker.h" #include "dthinker.h"
#include "doomerrors.h" #include "engineerrors.h"
#define LOCAL_SIZE 20 #define LOCAL_SIZE 20
#define NUM_MAPVARS 128 #define NUM_MAPVARS 128

View file

@ -50,7 +50,7 @@
#include "decallib.h" #include "decallib.h"
#include "p_local.h" #include "p_local.h"
#include "c_console.h" #include "c_console.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "v_font.h" #include "v_font.h"
#include "doomstat.h" #include "doomstat.h"

View file

@ -44,7 +44,7 @@
#include "m_argv.h" #include "m_argv.h"
#include "st_console.h" #include "st_console.h"
#include "version.h" #include "version.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "s_music.h" #include "s_music.h"

View file

@ -66,12 +66,6 @@ void I_SetIWADInfo()
} }
void I_DebugPrint(const char *cp)
{
NSLog(@"%s", cp);
}
void I_PrintStr(const char* const message) void I_PrintStr(const char* const message)
{ {
FConsoleWindow::GetInstance().AddText(message); FConsoleWindow::GetInstance().AddText(message);

View file

@ -53,7 +53,7 @@
#include "st_console.h" #include "st_console.h"
#include "v_text.h" #include "v_text.h"
#include "version.h" #include "version.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"
#include "vulkan/system/vk_framebuffer.h" #include "vulkan/system/vk_framebuffer.h"

View file

@ -39,7 +39,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "st_console.h" #include "st_console.h"
#include "st_start.h" #include "st_start.h"
#include "doomerrors.h" #include "engineerrors.h"
FStartupScreen *StartScreen; FStartupScreen *StartScreen;

View file

@ -38,7 +38,7 @@
#include "m_misc.h" #include "m_misc.h"
#endif // __APPLE__ #endif // __APPLE__
#include "doomerrors.h" #include "engineerrors.h"
#include "d_main.h" #include "d_main.h"
#include "sc_man.h" #include "sc_man.h"
#include "cmdlib.h" #include "cmdlib.h"

View file

@ -83,8 +83,6 @@ ticcmd_t *I_BaseTiccmd (void);
void I_Tactile (int on, int off, int total); void I_Tactile (int on, int off, int total);
void I_DebugPrint (const char *cp);
// Print a console string // Print a console string
void I_PrintStr (const char *str); void I_PrintStr (const char *str);

View file

@ -40,7 +40,7 @@
#include "m_argv.h" #include "m_argv.h"
#include "m_misc.h" #include "m_misc.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "doomerrors.h" #include "engineerrors.h"
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include <wordexp.h> #include <wordexp.h>

View file

@ -41,7 +41,7 @@
#include "v_text.h" #include "v_text.h"
#include "doomstat.h" #include "doomstat.h"
#include "m_argv.h" #include "m_argv.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "swrenderer/r_swrenderer.h" #include "swrenderer/r_swrenderer.h"
IVideo *Video; IVideo *Video;

View file

@ -47,7 +47,7 @@
#include "g_game.h" #include "g_game.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "utf8.h" #include "utf8.h"
#include "doomerrors.h" #include "engineerrors.h"
static void I_CheckGUICapture (); static void I_CheckGUICapture ();

View file

@ -41,7 +41,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <locale.h> #include <locale.h>
#include "doomerrors.h" #include "engineerrors.h"
#include "m_argv.h" #include "m_argv.h"
#include "d_main.h" #include "d_main.h"
#include "c_console.h" #include "c_console.h"
@ -53,7 +53,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "doomstat.h" #include "doomstat.h"
#include "vm.h" #include "vm.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "i_system.h" #include "i_system.h"
#include "g_game.h" #include "g_game.h"

View file

@ -102,10 +102,6 @@ void CalculateCPUSpeed()
{ {
} }
void I_DebugPrint(const char *cp)
{
}
void I_PrintStr(const char *cp) void I_PrintStr(const char *cp)
{ {
// Strip out any color escape sequences before writing to debug output // Strip out any color escape sequences before writing to debug output

View file

@ -42,7 +42,7 @@
#include "doomdef.h" #include "doomdef.h"
#include "i_system.h" #include "i_system.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "doomerrors.h" #include "engineerrors.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -37,7 +37,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "i_system.h" #include "i_system.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "version.h" // for GAMENAME #include "version.h" // for GAMENAME

View file

@ -40,7 +40,7 @@
#include "g_game.h" #include "g_game.h"
#include "d_netinf.h" #include "d_netinf.h"
#include "sc_man.h" #include "sc_man.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "w_wad.h" #include "w_wad.h"
#include "serializer.h" #include "serializer.h"
#include "d_player.h" #include "d_player.h"

View file

@ -30,7 +30,7 @@
#include "c_cvars.h" #include "c_cvars.h"
#include "v_video.h" #include "v_video.h"
#include "w_wad.h" #include "w_wad.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "md5.h" #include "md5.h"
#include "m_misc.h" #include "m_misc.h"

View file

@ -27,7 +27,7 @@
*/ */
#include "gl_load/gl_system.h" #include "gl_load/gl_system.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "tarray.h" #include "tarray.h"
#include "doomtype.h" #include "doomtype.h"
#include "m_argv.h" #include "m_argv.h"

View file

@ -24,7 +24,7 @@
#include "poly_framebuffer.h" #include "poly_framebuffer.h"
#include "poly_renderstate.h" #include "poly_renderstate.h"
#include "rendering/polyrenderer/drawers/poly_thread.h" #include "rendering/polyrenderer/drawers/poly_thread.h"
#include "doomerrors.h" #include "engineerrors.h"
PolyBuffer *PolyBuffer::First = nullptr; PolyBuffer *PolyBuffer::First = nullptr;

View file

@ -51,7 +51,7 @@
#include "poly_buffers.h" #include "poly_buffers.h"
#include "poly_renderstate.h" #include "poly_renderstate.h"
#include "poly_hwtexture.h" #include "poly_hwtexture.h"
#include "doomerrors.h" #include "engineerrors.h"
void Draw2D(F2DDrawer *drawer, FRenderState &state); void Draw2D(F2DDrawer *drawer, FRenderState &state);
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown); void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);

View file

@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include "templates.h" #include "templates.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#include "doomdata.h" #include "doomdata.h"

View file

@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <float.h> #include <float.h>
#include "templates.h" #include "templates.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "w_wad.h" #include "w_wad.h"
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"

View file

@ -34,7 +34,7 @@
#include "textures/bitmap.h" #include "textures/bitmap.h"
#include "swrenderer/scene/r_light.h" #include "swrenderer/scene/r_light.h"
#include "image.h" #include "image.h"
#include "doomerrors.h" #include "engineerrors.h"
// [RH] Base blending values (for e.g. underwater) // [RH] Base blending values (for e.g. underwater)
int BaseBlendR, BaseBlendG, BaseBlendB; int BaseBlendR, BaseBlendG, BaseBlendB;

View file

@ -34,7 +34,7 @@
#include "m_bbox.h" #include "m_bbox.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_setup.h" #include "p_setup.h"

View file

@ -7,7 +7,7 @@
#include "r_defs.h" #include "r_defs.h"
#include "r_utility.h" #include "r_utility.h"
#include "actorinlines.h" #include "actorinlines.h"
#include "utility/matrix.h" #include "matrix.h"
#define MINZ double((2048*4) / double(1 << 20)) #define MINZ double((2048*4) / double(1 << 20))

View file

@ -24,7 +24,7 @@
#include "vulkan/system/vk_builders.h" #include "vulkan/system/vk_builders.h"
#include "hwrenderer/utility/hw_shaderpatcher.h" #include "hwrenderer/utility/hw_shaderpatcher.h"
#include "w_wad.h" #include "w_wad.h"
#include "doomerrors.h" #include "engineerrors.h"
#include <ShaderLang.h> #include <ShaderLang.h>
VkShaderManager::VkShaderManager(VulkanDevice *device) : device(device) VkShaderManager::VkShaderManager(VulkanDevice *device) : device(device)

View file

@ -3,7 +3,7 @@
#include <memory> #include <memory>
#include "utility/vectors.h" #include "vectors.h"
#include "matrix.h" #include "matrix.h"
#include "name.h" #include "name.h"
#include "hwrenderer/scene/hw_renderstate.h" #include "hwrenderer/scene/hw_renderstate.h"

View file

@ -25,7 +25,7 @@
#include "vk_framebuffer.h" #include "vk_framebuffer.h"
#include "vulkan/renderer/vk_renderstate.h" #include "vulkan/renderer/vk_renderstate.h"
#include "vulkan/renderer/vk_renderpass.h" #include "vulkan/renderer/vk_renderpass.h"
#include "doomerrors.h" #include "engineerrors.h"
VKBuffer *VKBuffer::First = nullptr; VKBuffer *VKBuffer::First = nullptr;

View file

@ -21,7 +21,7 @@
*/ */
#include "vk_builders.h" #include "vk_builders.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "r_data/renderstyle.h" #include "r_data/renderstyle.h"
#include <ShaderLang.h> #include <ShaderLang.h>
#include <GlslangToSpv.h> #include <GlslangToSpv.h>

View file

@ -40,7 +40,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "i_system.h" #include "i_system.h"
#include "version.h" #include "version.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "gamedata/fonts/v_text.h" #include "gamedata/fonts/v_text.h"
bool I_GetVulkanPlatformExtensions(unsigned int *count, const char **names); bool I_GetVulkanPlatformExtensions(unsigned int *count, const char **names);

View file

@ -2,11 +2,12 @@
#include "volk/volk.h" #include "volk/volk.h"
#include "vk_mem_alloc/vk_mem_alloc.h" #include "vk_mem_alloc/vk_mem_alloc.h"
#include "utility/doomerrors.h" #include "engineerrors.h"
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include "zstring.h"
class VulkanSwapChain; class VulkanSwapChain;
class VulkanSemaphore; class VulkanSemaphore;
@ -105,6 +106,14 @@ private:
FString VkResultToString(VkResult result); FString VkResultToString(VkResult result);
class CVulkanError : public CEngineError
{
public:
CVulkanError() : CEngineError() {}
CVulkanError(const char* message) : CEngineError(message) {}
};
inline void VulkanError(const char *text) inline void VulkanError(const char *text)
{ {
throw CVulkanError(text); throw CVulkanError(text);

View file

@ -58,7 +58,7 @@
#include "vulkan/textures/vk_hwtexture.h" #include "vulkan/textures/vk_hwtexture.h"
#include "vulkan/system/vk_builders.h" #include "vulkan/system/vk_builders.h"
#include "vulkan/system/vk_swapchain.h" #include "vulkan/system/vk_swapchain.h"
#include "doomerrors.h" #include "engineerrors.h"
void Draw2D(F2DDrawer *drawer, FRenderState &state); void Draw2D(F2DDrawer *drawer, FRenderState &state);
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown); void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "vk_device.h" #include "vk_device.h"
#include "doomerrors.h" #include "engineerrors.h"
class VulkanCommandPool; class VulkanCommandPool;
class VulkanDescriptorPool; class VulkanDescriptorPool;

View file

@ -40,7 +40,7 @@
#include "zstring.h" #include "zstring.h"
#include "vectors.h" #include "vectors.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "memarena.h" #include "memarena.h"
#include "scripting/backend/scopebarrier.h" #include "scripting/backend/scopebarrier.h"
@ -98,7 +98,7 @@ enum EVMAbortException
X_FORMAT_ERROR X_FORMAT_ERROR
}; };
class CVMAbortException : public CDoomError class CVMAbortException : public CEngineError
{ {
public: public:
static FString stacktrace; static FString stacktrace;

View file

@ -55,7 +55,7 @@
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "po_man.h" #include "po_man.h"
#include "v_font.h" #include "v_font.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "v_text.h" #include "v_text.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h" #include "g_levellocals.h"

View file

@ -1,146 +0,0 @@
/*
** lists.h
** Essentially, Amiga Exec lists and nodes
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#ifndef __LISTS_H__
#define __LISTS_H__
struct Node
{
Node *Succ, *Pred;
void Insert (Node *putAfter)
{
Succ = putAfter->Succ;
Pred = putAfter;
putAfter->Succ = this;
Succ->Pred = this;
}
void InsertBefore (Node *putBefore)
{
Succ = putBefore;
Pred = putBefore->Pred;
putBefore->Pred = this;
Pred->Succ = this;
}
void Remove ()
{
Pred->Succ = Succ;
Succ->Pred = Pred;
}
};
struct List
{
Node *Head;
const Node *const Tail;
Node *TailPred;
List () : Head ((Node *)&Tail), Tail (NULL), TailPred ((Node *)&Head)
{
}
bool IsEmpty () const
{
return TailPred == (Node *)this;
}
void MakeEmpty ()
{
Head = (Node *)&Tail;
TailPred = (Node *)&Head;
}
void AddHead (Node *node)
{
node->Succ = Head;
node->Pred = (Node *)&Head;
Head->Pred = node;
Head = node;
}
void AddTail (Node *node)
{
node->Pred = TailPred;
node->Succ = (Node *)&Tail;
TailPred->Succ = node;
TailPred = node;
}
Node *RemHead ()
{
Node *node = Head;
if (node->Succ == NULL)
{
return NULL;
}
Head = node->Succ;
Head->Pred = (Node *)&Head;
return node;
}
Node *RemHeadQ () // Only use if list is definitely not empty
{
Node *node = Head;
Head = node->Succ;
Head->Pred = (Node *)&Head;
return node;
}
Node *RemTail ()
{
Node *node = TailPred;
if (node->Pred == NULL)
{
return NULL;
}
TailPred = node->Pred;
TailPred->Succ = (Node *)&Tail;
return node;
}
Node *RemTailQ () // Only use if list is definitely not empty
{
Node *node = TailPred;
TailPred = node->Pred;
TailPred->Succ = (Node *)&Tail;
return node;
}
private:
List &operator= (const List&) { return *this; }
};
#endif //__LISTS_H__

View file

@ -34,6 +34,15 @@
struct line_t; struct line_t;
struct node_t; struct node_t;
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
}; // bbox coordinates
class FBoundingBox class FBoundingBox
{ {
public: public:

View file

@ -38,7 +38,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "doomtype.h" #include "doomtype.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "sc_man.h" #include "sc_man.h"
#include "w_wad.h" #include "w_wad.h"
#include "cmdlib.h" #include "cmdlib.h"

View file

@ -49,7 +49,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "v_text.h" #include "v_text.h"
#include "m_argv.h" #include "m_argv.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "base_sysfb.h" #include "base_sysfb.h"
#include "win32basevideo.h" #include "win32basevideo.h"
#include "c_dispatch.h" #include "c_dispatch.h"

View file

@ -49,7 +49,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "v_text.h" #include "v_text.h"
#include "m_argv.h" #include "m_argv.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "win32glvideo.h" #include "win32glvideo.h"
extern HWND Window; extern HWND Window;

View file

@ -47,7 +47,7 @@
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
#include "win32vulkanvideo.h" #include "win32vulkanvideo.h"
#endif #endif
#include "doomerrors.h" #include "engineerrors.h"
#include "i_system.h" #include "i_system.h"
#include "swrenderer/r_swrenderer.h" #include "swrenderer/r_swrenderer.h"

View file

@ -85,7 +85,7 @@
#include "v_text.h" #include "v_text.h"
#include "version.h" #include "version.h"
#include "events.h" #include "events.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "i_system.h" #include "i_system.h"
#include "g_levellocals.h" #include "g_levellocals.h"

View file

@ -55,7 +55,7 @@
#endif #endif
#include "resource.h" #include "resource.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "hardware.h" #include "hardware.h"
#include "m_argv.h" #include "m_argv.h"

View file

@ -61,7 +61,7 @@
#include <wincrypt.h> #include <wincrypt.h>
#include "hardware.h" #include "hardware.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "version.h" #include "version.h"
@ -481,15 +481,6 @@ static void DoPrintStr(const char *cpt, HWND edit, HANDLE StdOut)
static TArray<FString> bufferedConsoleStuff; static TArray<FString> bufferedConsoleStuff;
void I_DebugPrint(const char *cp)
{
if (IsDebuggerPresent())
{
auto wstr = WideString(cp);
OutputDebugStringW(wstr.c_str());
}
}
void I_PrintStr(const char *cp) void I_PrintStr(const char *cp)
{ {
if (ConWindowHidden) if (ConWindowHidden)

View file

@ -87,8 +87,6 @@ bool I_SetCursor(FTexture *cursor);
// Repaint the pre-game console // Repaint the pre-game console
void I_PaintConsole (void); void I_PaintConsole (void);
void I_DebugPrint (const char *cp);
// Print a console string // Print a console string
void I_PrintStr (const char *cp); void I_PrintStr (const char *cp);

View file

@ -50,7 +50,7 @@
#include "s_sound.h" #include "s_sound.h"
#include "m_argv.h" #include "m_argv.h"
#include "d_main.h" #include "d_main.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "s_music.h" #include "s_music.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -48,7 +48,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "v_text.h" #include "v_text.h"
#include "m_argv.h" #include "m_argv.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "win32basevideo.h" #include "win32basevideo.h"
#include "cmdlib.h" #include "cmdlib.h"

View file

@ -48,7 +48,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "v_text.h" #include "v_text.h"
#include "m_argv.h" #include "m_argv.h"
#include "doomerrors.h" #include "engineerrors.h"
#include "win32glvideo.h" #include "win32glvideo.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"

View file

@ -1,7 +1,7 @@
#include <assert.h> #include <assert.h>
#include "hardware.h" #include "hardware.h"
#include "doomerrors.h" #include "engineerrors.h"
#include <Windows.h> #include <Windows.h>
EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Bool, vid_vsync)