- moved bits of my own code to properly copyrighted files.

This commit is contained in:
Christoph Oelckers 2020-01-12 14:54:43 +01:00
parent 9ca2819ad1
commit 661431df87
3 changed files with 57 additions and 102 deletions

View file

@ -1,45 +1,16 @@
// SDL interface layer for the Build Engine // SDL interface layer for the Build Engine
// Use SDL 1.2 or 2.0 from http://www.libsdl.org // Use SDL 1.2 or 2.0 from http://www.libsdl.org
#ifdef _WIN32
#include <Windows.h>
#include <CommCtrl.h>
#endif
#include <signal.h>
#include <string>
#include <stdexcept>
# include "gl_load.h"
#include "a.h" #include "a.h"
#include "build.h" #include "build.h"
#include "common.h" #include "common.h"
#include "compat.h" #include "compat.h"
#include "engine_priv.h" #include "engine_priv.h"
#include "osd.h"
#include "palette.h" #include "palette.h"
#include "baselayer.h" #include "baselayer.h"
#include "m_argv.h"
#include "mmulti.h" #include "mmulti.h"
#include "scriptfile.h" #include "glsurface.h"
#include "zstring.h"
#include "gameconfigfile.h"
#include "gamecontrol.h"
#include "resourcefile.h"
#include "sc_man.h"
#include "i_specialpaths.h"
#include "inputstate.h"
#include "c_cvars.h"
#include "i_time.h"
#include "c_dispatch.h"
#include "d_gui.h"
#include "menu.h"
#include "utf8.h"
#include "imgui.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
# include "glsurface.h"
double g_beforeSwapTime; double g_beforeSwapTime;
@ -66,47 +37,6 @@ int32_t lockcount=0;
char modechange=1; char modechange=1;
char offscreenrendering=0; char offscreenrendering=0;
#define MAX_ERRORTEXT 4096
//==========================================================================
//
// 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);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
#ifdef _WIN32
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext);
}
void I_FatalError(const char* error, ...)
{
va_list argptr;
char errortext[MAX_ERRORTEXT];
va_start(argptr, error);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
#ifdef _WIN32
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext);
}
// Calculate ylookup[] and call setvlinebpl() // Calculate ylookup[] and call setvlinebpl()
void calc_ylookup(int32_t bpl, int32_t lastyidx) void calc_ylookup(int32_t bpl, int32_t lastyidx)
@ -223,35 +153,5 @@ void videoEndDrawing(void)
lockcount = 0; lockcount = 0;
} }
//
//
// ---------------------------------------
//
// Miscellany
//
// ---------------------------------------
//
//
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
//
// debugprintf() -- sends a debug string to the debugger
//
void debugprintf(const char* f, ...)
{
va_list va;
va_start(va, f);
#ifdef _WIN32
if (!IsDebuggerPresent()) return;
char buf[1024];
vsnprintf(buf, 1024, f, va);
va_end(va);
OutputDebugStringA(buf);
#else
vprintf(f, va);
#endif
}

View file

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include <stdexcept>
#include "gamecontrol.h" #include "gamecontrol.h"
#include "tarray.h" #include "tarray.h"
#include "zstring.h" #include "zstring.h"
@ -807,3 +808,57 @@ void S_SetSoundPaused(int state)
} }
#endif #endif
} }
#define MAX_ERRORTEXT 4096
//==========================================================================
//
// 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);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
#ifdef _WIN32
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext);
}
void I_FatalError(const char* error, ...)
{
va_list argptr;
char errortext[MAX_ERRORTEXT];
va_start(argptr, error);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
#ifdef _WIN32
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext);
}
//
// debugprintf() -- sends a debug string to the debugger
//
void debugprintf(const char* f, ...)
{
va_list va;
va_start(va, f);
FString out;
out.VFormat(f, va);
I_DebugPrint(out);
}

View file

@ -358,7 +358,7 @@ public:
{ {
return id == 0 ? "" : S_sfx[id].name.GetChars(); return id == 0 ? "" : S_sfx[id].name.GetChars();
} }
TArray<sfxinfo_t> &GetSounds() //Thio should only be used for constructing the sound list or for diagnostics code prinring information about the sound list. TArray<sfxinfo_t> &GetSounds() //Thio should only be used for constructing the sound list or for diagnostics code printing information about the sound list.
{ {
return S_sfx; return S_sfx;
} }