Skip to content

Commit

Permalink
cmod: Build configuration tweaks and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomenor committed Jan 21, 2024
1 parent bc8d074 commit a3a5035
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
15 changes: 13 additions & 2 deletions code/eliteforce/stef_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
// Common
/* ******************************************************************************** */

// [FEATURE] Support for various debug logging functionality
// [FEATURE] Support for various debug logging functionality.
#define STEF_LOGGING_SYSTEM

// [FEATURE] Additional logging statements.
#if defined( STEF_LOGGING_SYSTEM )
#define STEF_LOGGING_DEFS
#endif

// [FEATURE] Lua scripting support
// [FEATURE] Core Lua scripting support.
#define STEF_LUA_SUPPORT

// [FEATURE] Additional Lua event calls.
#if defined( STEF_LUA_SUPPORT )
#define STEF_LUA_EVENTS
#endif

// [TWEAK] Default settings tweaks
// Used as a placeholder until the full settings system is ported.
Expand Down Expand Up @@ -173,6 +181,9 @@
// [COMMON] VM extensions system for sharing additional functions with VM modules.
#define STEF_VM_EXTENSIONS

// [COMMON] Support basic log print functions even if STEF_LOGGING_SYSTEM is disabled.
#define STEF_LOGGING_CORE

/* ******************************************************************************** */
// Misc
/* ******************************************************************************** */
Expand Down
2 changes: 1 addition & 1 deletion code/eliteforce/stef_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void Stef_CvarDefsInit(void);
#undef CVAR_DEF
#endif

#ifdef STEF_LOGGING_SYSTEM
#if defined( STEF_LOGGING_SYSTEM ) || defined( STEF_LOGGING_CORE )
#include "stef_logging.h"
#endif

Expand Down
6 changes: 4 additions & 2 deletions code/eliteforce/stef_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/

#ifdef STEF_LOGGING_SYSTEM
#if defined( STEF_LOGGING_SYSTEM ) || defined( STEF_LOGGING_CORE )
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"

#ifdef STEF_LOGGING_SYSTEM
#define MAX_LOGGING_FRAMES 64

/* ******************************************************************************** */
Expand Down Expand Up @@ -253,6 +254,7 @@ void Logging_GetLuaFrameInfo( int frameNum ) {
}
}
#endif
#endif

/* ******************************************************************************** */
// Event Logging
Expand All @@ -267,7 +269,7 @@ LP_DEVELOPER and LP_CONSOLE it must be included in the parameter.
==================
*/
void Logging_PrintExt( loggingPrintType_t printlevel, const char *conditions, int entity_num, const char *msg ) {
#ifdef STEF_LUA_EVENTS
#if defined( STEF_LUA_EVENTS ) && defined( STEF_LOGGING_SYSTEM )
if ( !stef_lua_suppress_print_event && Stef_Lua_InitEventCall( STEF_LUA_EVENT_LOG_PRINT ) ) {
Stef_Lua_PushString( "text", msg );
Stef_Lua_PushInteger( "printlevel", printlevel >= LP_CONSOLE ? 2 : printlevel >= LP_DEVELOPER ? 1 : 0 );
Expand Down
11 changes: 7 additions & 4 deletions code/eliteforce/stef_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/

#ifdef STEF_LOGGING_SYSTEM
#if defined( STEF_LOGGING_SYSTEM ) || defined( STEF_LOGGING_CORE )
typedef enum {
LP_INFO, // Only log if conditions are met. Don't print to console by default.
LP_DEVELOPER, // Print to console if developer is set to 1.
LP_CONSOLE, // Always print to console.
} loggingPrintType_t;

void Logging_PrintExt( loggingPrintType_t printlevel, const char *conditions, int entity_num, const char *msg );
void QDECL Logging_PrintfExt( loggingPrintType_t printType, const char *conditions, int entityNum, const char *fmt, ... );
void QDECL Logging_Printf( loggingPrintType_t printType, const char *conditions, const char *fmt, ... );
#endif

#ifdef STEF_LOGGING_SYSTEM
void Logging_FrameEntry( const char *log_conditions, const char *name, int entity_num, int info_value, qboolean reallocate_name );
void Logging_FrameExit( const char *name );
void QDECL Logging_RegisterCrash( const char *fmt, ... );
int Logging_FrameCount( void );
void Logging_FrameJump( int count, const char *reason );
void Logging_PrintExt( loggingPrintType_t printlevel, const char *conditions, int entity_num, const char *msg );
void QDECL Logging_PrintfExt( loggingPrintType_t printType, const char *conditions, int entityNum, const char *fmt, ... );
void QDECL Logging_Printf( loggingPrintType_t printType, const char *conditions, const char *fmt, ... );
void Logging_GetStack( char *buffer, unsigned int size );
void Logging_PrintStack( loggingPrintType_t printType, const char *conditions );

Expand Down

0 comments on commit a3a5035

Please sign in to comment.