@@ -55,11 +55,11 @@ If you have questions concerning this license or the applicable additional terms
5555
5656#if SDL_BYTEORDER == SDL_BIG_ENDIAN
5757 #if D3_IS_BIG_ENDIAN != 1
58- #error "CMake (which sets D3_IS_BIG_ENDIAN) and SDL disagree about the endianess! CMake says little, SDL says big"
58+ #error "CMake (which sets D3_IS_BIG_ENDIAN) and SDL disagree about the endianess! CMake says little, SDL says big"
5959 #endif
6060#elif SDL_BYTEORDER == SDL_LIL_ENDIAN
6161 #if D3_IS_BIG_ENDIAN != 0
62- #error "CMake (which sets D3_IS_BIG_ENDIAN) and SDL disagree about the endianess! CMake says big, SDL says little"
62+ #error "CMake (which sets D3_IS_BIG_ENDIAN) and SDL disagree about the endianess! CMake says big, SDL says little"
6363 #endif
6464#else
6565 #error "According to SDL, endianess is neither Big nor Little - dhewm3 doesn't support other byteorders!"
@@ -245,6 +245,28 @@ void UnpackColor( const dword color, idVec3 &unpackedColor ) {
245245#endif
246246}
247247
248+ /*
249+ ===============
250+ idLib::FatalError
251+ ===============
252+ */
253+ void idLib::FatalError ( const char * fmt, ... )
254+ {
255+ va_list argptr;
256+ char text[MAX_STRING_CHARS];
257+
258+ va_start ( argptr, fmt );
259+ idStr::vsnPrintf ( text, sizeof ( text ), fmt, argptr );
260+ va_end ( argptr );
261+
262+ common->FatalError ( " %s" , text );
263+
264+ #if !defined( _WIN32 )
265+ // SRS - Added exit to silence build warning since FatalError has attribute noreturn
266+ exit ( EXIT_FAILURE );
267+ #endif
268+ }
269+
248270/*
249271===============
250272idLib::Error
@@ -282,6 +304,93 @@ void idLib::Warning( const char *fmt, ... ) {
282304 common->Warning ( " %s" , text );
283305}
284306
307+ /*
308+ ===============
309+ idLib::WarningIf
310+ ===============
311+ */
312+ void idLib::WarningIf ( const bool test, const char *fmt, ... ) {
313+ if ( !test ) {
314+ return ;
315+ }
316+
317+ va_list argptr;
318+ char text[MAX_STRING_CHARS];
319+
320+ va_start ( argptr, fmt );
321+ idStr::vsnPrintf ( text, sizeof ( text ), fmt, argptr );
322+ va_end ( argptr );
323+
324+ common->Warning ( " %s" , text );
325+ }
326+
327+ /*
328+ ===============
329+ idLib::DWarning
330+ ===============
331+ */
332+ void idLib::DWarning ( const char *fmt, ... ) {
333+ va_list argptr;
334+ char text[MAX_STRING_CHARS];
335+
336+ va_start ( argptr, fmt );
337+ idStr::vsnPrintf ( text, sizeof ( text ), fmt, argptr );
338+ va_end ( argptr );
339+
340+ common->DWarning ( " %s" , text );
341+ }
342+
343+ /*
344+ ===============
345+ idLib::DWarningIf
346+ ===============
347+ */
348+ void idLib::DWarningIf ( const bool test, const char *fmt, ... ) {
349+ if ( !test ) {
350+ return ;
351+ }
352+
353+ va_list argptr;
354+ char text[MAX_STRING_CHARS];
355+
356+ va_start ( argptr, fmt );
357+ idStr::vsnPrintf ( text, sizeof ( text ), fmt, argptr );
358+ va_end ( argptr );
359+
360+ common->DWarning ( " %s" , text );
361+ }
362+
363+
364+ /*
365+ ===============
366+ idLib::Printf
367+ ===============
368+ */
369+ void idLib::Printf ( const char *fmt, ... ) {
370+ va_list argptr;
371+ va_start ( argptr, fmt );
372+ if ( common ) {
373+ common->VPrintf ( fmt, argptr );
374+ }
375+ va_end ( argptr );
376+ }
377+
378+ /*
379+ ===============
380+ idLib::PrintfIf
381+ ===============
382+ */
383+ void idLib::PrintfIf ( const bool test, const char *fmt, ... ) {
384+ if ( !test ) {
385+ return ;
386+ }
387+
388+ va_list argptr;
389+ va_start ( argptr, fmt );
390+ common->VPrintf ( fmt, argptr );
391+ va_end ( argptr );
392+ }
393+
285394/*
286395===============================================================================
287396
0 commit comments