Browse Source

engine: fix implicit declaration, remove dead MsgDev now, fix const modifier loss in host.c

pull/2/head
Alibek Omarov 6 years ago
parent
commit
25d8a94c1c
  1. 2
      engine/client/cl_parse.c
  2. 4
      engine/client/in_joy.c
  3. 1
      engine/client/in_touch.c
  4. 2
      engine/client/input.c
  5. 5
      engine/client/vgui/vgui_draw.c
  6. 4
      engine/common/filesystem.c
  7. 12
      engine/common/host.c
  8. 2
      engine/common/hpak.c
  9. 4
      engine/common/masterlist.c
  10. 2
      engine/common/sequence.c
  11. 35
      engine/common/system.c
  12. 2
      engine/platform/posix/lib_posix.c
  13. 6
      engine/platform/sdl/events.c
  14. 32
      engine/platform/sdl/in_sdl.c
  15. 10
      engine/platform/sdl/vid_sdl.c

2
engine/client/cl_parse.c

@ -1940,7 +1940,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num )
if( cl_trace_messages->value ) if( cl_trace_messages->value )
{ {
MsgDev( D_INFO, "^3USERMSG %s SIZE %i SVC_NUM %i\n", Con_Reportf( "^3USERMSG %s SIZE %i SVC_NUM %i\n",
clgame.msg[i].name, iSize, clgame.msg[i].number ); clgame.msg[i].name, iSize, clgame.msg[i].number );
} }

4
engine/client/in_joy.c

@ -259,7 +259,7 @@ void Joy_AxisMotionEvent( int id, byte axis, short value )
if( axis >= MAX_AXES ) if( axis >= MAX_AXES )
{ {
MsgDev( D_INFO, "Only 6 axes is supported\n" ); Con_Reportf( "Only 6 axes is supported\n" );
return; return;
} }
@ -308,7 +308,7 @@ void Joy_ButtonEvent( int id, byte button, byte down )
int origbutton = button; int origbutton = button;
button = ( button & 31 ) + K_AUX1; button = ( button & 31 ) + K_AUX1;
MsgDev( D_INFO, "Only 32 joybuttons is supported, converting %i button ID to %s\n", origbutton, Key_KeynumToString( button ) ); Con_Reportf( "Only 32 joybuttons is supported, converting %i button ID to %s\n", origbutton, Key_KeynumToString( button ) );
} }
else button += K_AUX1; else button += K_AUX1;

1
engine/client/in_touch.c

@ -24,6 +24,7 @@ GNU General Public License for more details.
#ifdef XASH_SDL #ifdef XASH_SDL
#include <SDL.h> #include <SDL.h>
#endif #endif
#include "platform/platform.h"
typedef enum typedef enum
{ {

2
engine/client/input.c

@ -27,6 +27,8 @@ GNU General Public License for more details.
#include "windows.h" #include "windows.h"
#endif #endif
#include "platform/platform.h"
void* in_mousecursor; void* in_mousecursor;
qboolean in_mouseactive; // false when not focus app qboolean in_mouseactive; // false when not focus app
qboolean in_mouseinitialized; qboolean in_mouseinitialized;

5
engine/client/vgui/vgui_draw.c

@ -28,6 +28,7 @@ GNU General Public License for more details.
#include <SDL_events.h> #include <SDL_events.h>
static SDL_Cursor* s_pDefaultCursor[20]; static SDL_Cursor* s_pDefaultCursor[20];
#endif #endif
#include "platform/platform.h"
int g_textures[VGUI_MAX_TEXTURES]; int g_textures[VGUI_MAX_TEXTURES];
int g_textureId = 0; int g_textureId = 0;
@ -246,7 +247,7 @@ void VGui_Startup( int width, int height )
F( &vgui ); F( &vgui );
vgui.initialized = true; vgui.initialized = true;
VGUI_InitCursors(); VGUI_InitCursors();
MsgDev( D_INFO, "vgui_support: found interal client support\n" ); Con_Reportf( "vgui_support: found interal client support\n" );
} }
} }
#endif // XASH_INTERNAL_GAMELIBS #endif // XASH_INTERNAL_GAMELIBS
@ -282,7 +283,7 @@ void VGui_Startup( int width, int height )
if( FS_FileExists( vguiloader, false ) ) if( FS_FileExists( vguiloader, false ) )
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s", COM_GetLibraryError() ); Con_Reportf( S_ERROR "Failed to load vgui_support library: %s", COM_GetLibraryError() );
else else
MsgDev( D_INFO, "vgui_support: not found\n" ); Con_Reportf( "vgui_support: not found\n" );
} }
else else
{ {

4
engine/common/filesystem.c

@ -626,7 +626,7 @@ static qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loade
search->flags |= flags; search->flags |= flags;
fs_searchpaths = search; fs_searchpaths = search;
MsgDev( D_REPORT, "Adding wadfile: %s (%i files)\n", wadfile, wad->numlumps ); Con_Reportf( "Adding wadfile: %s (%i files)\n", wadfile, wad->numlumps );
return true; return true;
} }
else else
@ -683,7 +683,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
search->flags |= flags; search->flags |= flags;
fs_searchpaths = search; fs_searchpaths = search;
MsgDev( D_REPORT, "Adding pakfile: %s (%i files)\n", pakfile, pak->numfiles ); Con_Reportf( "Adding pakfile: %s (%i files)\n", pakfile, pak->numfiles );
// time to add in search list all the wads that contains in current pakfile (if do) // time to add in search list all the wads that contains in current pakfile (if do)
for( i = 0; i < pak->numfiles; i++ ) for( i = 0; i < pak->numfiles; i++ )

12
engine/common/host.c

@ -684,7 +684,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
if( daemon > 0 ) if( daemon > 0 )
{ {
// parent // parent
MsgDev( D_INFO, "Child pid: %i\n", daemon ); Con_Reportf( "Child pid: %i\n", daemon );
exit( 0 ); exit( 0 );
} }
else else
@ -726,10 +726,12 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
const char *IOS_GetDocsDir(); const char *IOS_GetDocsDir();
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) ); Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
#elif defined(XASH_SDL) #elif defined(XASH_SDL)
if( !( baseDir = SDL_GetBasePath() ) ) char *szBasePath;
if( !( szBasePath = SDL_GetBasePath() ) )
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() ); Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
Q_strncpy( host.rootdir, baseDir, sizeof( host.rootdir ) ); Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ) );
SDL_free( (void*)baseDir ); SDL_free( szBasePath );
#else #else
if( !getcwd( host.rootdir, sizeof(host.rootdir) ) ) if( !getcwd( host.rootdir, sizeof(host.rootdir) ) )
{ {
@ -821,7 +823,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
#endif #endif
if ( !host.rootdir[0] || SetCurrentDirectory( host.rootdir ) != 0) if ( !host.rootdir[0] || SetCurrentDirectory( host.rootdir ) != 0)
MsgDev( D_INFO, "%s is working directory now\n", host.rootdir ); Con_Reportf( "%s is working directory now\n", host.rootdir );
else else
Sys_Error( "Changing working directory to %s failed.\n", host.rootdir ); Sys_Error( "Changing working directory to %s failed.\n", host.rootdir );

2
engine/common/hpak.c

@ -806,7 +806,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !HPAK_FindResource( &hpak_read, pResource->rgucMD5_hash, NULL )) if( !HPAK_FindResource( &hpak_read, pResource->rgucMD5_hash, NULL ))
{ {
Con_DPrintf( S_ERROR "HPAK doesn't contain specified lump: %s\n", pResource->szFileName, read_path ); Con_DPrintf( S_ERROR "HPAK %s doesn't contain specified lump: %s\n", read_path, pResource->szFileName );
Mem_Free( hpak_read.entries ); Mem_Free( hpak_read.entries );
Mem_Free( hpak_save.entries ); Mem_Free( hpak_save.entries );
FS_Close( file_src ); FS_Close( file_src );

4
engine/common/masterlist.c

@ -54,7 +54,7 @@ qboolean NET_SendToMasters( netsrc_t sock, size_t len, const void *data )
if( !res ) if( !res )
{ {
MsgDev( D_INFO, "Can't resolve adr: %s\n", list->address ); Con_Reportf( "Can't resolve adr: %s\n", list->address );
list->sent = true; list->sent = true;
continue; continue;
} }
@ -181,7 +181,7 @@ static void NET_LoadMasters( void )
if( !afile ) // file doesn't exist yet if( !afile ) // file doesn't exist yet
{ {
MsgDev( D_INFO, "Cannot load xashcomm.lst\n" ); Con_Reportf( "Cannot load xashcomm.lst\n" );
return; return;
} }

2
engine/common/sequence.c

@ -1564,7 +1564,7 @@ void Sequence_ParseFile( const char *fileName, qboolean isGlobal )
if( !buffer ) if( !buffer )
return; return;
MsgDev( D_INFO, "reading sequence file: %s\n", fileName ); Con_Reportf( "reading sequence file: %s\n", fileName );
Sequence_ParseBuffer( buffer, bufSize ); Sequence_ParseBuffer( buffer, bufSize );

35
engine/common/system.c

@ -731,38 +731,3 @@ void Sys_Print( const char *pMsg )
// Rcon_Print( pMsg ); // Rcon_Print( pMsg );
} }
/*
================
MsgDev
formatted developer message
================
*/
void MsgDev( int type, const char *pMsg, ... )
{
static char text[MAX_PRINT_MSG];
va_list argptr;
if( type >= D_REPORT && host_developer.value < DEV_EXTENDED )
return;
va_start( argptr, pMsg );
Q_vsnprintf( text, sizeof( text ) - 1, pMsg, argptr );
va_end( argptr );
switch( type )
{
case D_WARN:
Sys_Print( va( "^3Warning:^7 %s", text ));
break;
case D_ERROR:
Sys_Print( va( "^1Error:^7 %s", text ));
break;
case D_INFO:
case D_NOTE:
case D_REPORT:
Sys_Print( text );
break;
}
}

2
engine/platform/posix/lib_posix.c

@ -175,7 +175,7 @@ void *COM_FunctionFromName( void *hInstance, const char *pName )
void *function; void *function;
if( !( function = COM_GetProcAddress( hInstance, pName ) ) ) if( !( function = COM_GetProcAddress( hInstance, pName ) ) )
{ {
MsgDev(D_ERROR, "FunctionFromName: Can't get symbol %s: %s\n", pName, dlerror()); Con_Reportf( S_ERROR "FunctionFromName: Can't get symbol %s: %s\n", pName, dlerror());
} }
return function; return function;
} }

6
engine/platform/sdl/events.c

@ -137,11 +137,11 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
return; return;
case SDL_SCANCODE_UNKNOWN: case SDL_SCANCODE_UNKNOWN:
{ {
if( down ) MsgDev( D_INFO, "SDLash_KeyEvent: Unknown scancode\n" ); if( down ) Con_Reportf( "SDLash_KeyEvent: Unknown scancode\n" );
return; return;
} }
default: default:
if( down ) MsgDev( D_INFO, "SDLash_KeyEvent: Unknown key: %s = %i\n", SDL_GetScancodeName( keynum ), keynum ); if( down ) Con_Reportf( "SDLash_KeyEvent: Unknown key: %s = %i\n", SDL_GetScancodeName( keynum ), keynum );
return; return;
} }
} }
@ -272,7 +272,7 @@ static void SDLash_EventFilter( SDL_Event *event )
if( ( event->tfinger.x > 2 ) && ( event->tfinger.y > 2 ) ) if( ( event->tfinger.x > 2 ) && ( event->tfinger.y > 2 ) )
{ {
scale = 2; scale = 2;
MsgDev( D_INFO, "SDL reports screen coordinates, workaround enabled!\n"); Con_Reportf( "SDL reports screen coordinates, workaround enabled!\n");
} }
else else
{ {

32
engine/platform/sdl/in_sdl.c

@ -111,12 +111,12 @@ static int SDLash_JoyInit_Old( int numjoy )
int num; int num;
int i; int i;
MsgDev( D_INFO, "Joystick: SDL\n" ); Con_Reportf( "Joystick: SDL\n" );
if( SDL_WasInit( SDL_INIT_JOYSTICK ) != SDL_INIT_JOYSTICK && if( SDL_WasInit( SDL_INIT_JOYSTICK ) != SDL_INIT_JOYSTICK &&
SDL_InitSubSystem( SDL_INIT_JOYSTICK ) ) SDL_InitSubSystem( SDL_INIT_JOYSTICK ) )
{ {
MsgDev( D_INFO, "Failed to initialize SDL Joysitck: %s\n", SDL_GetError() ); Con_Reportf( "Failed to initialize SDL Joysitck: %s\n", SDL_GetError() );
return 0; return 0;
} }
@ -128,27 +128,27 @@ static int SDLash_JoyInit_Old( int numjoy )
num = SDL_NumJoysticks(); num = SDL_NumJoysticks();
if( num > 0 ) if( num > 0 )
MsgDev( D_INFO, "%i joysticks found:\n", num ); Con_Reportf( "%i joysticks found:\n", num );
else else
{ {
MsgDev( D_INFO, "No joystick found.\n" ); Con_Reportf( "No joystick found.\n" );
return 0; return 0;
} }
for( i = 0; i < num; i++ ) for( i = 0; i < num; i++ )
MsgDev( D_INFO, "%i\t: %s\n", i, SDL_JoystickNameForIndex( i ) ); Con_Reportf( "%i\t: %s\n", i, SDL_JoystickNameForIndex( i ) );
MsgDev( D_INFO, "Pass +set joy_index N to command line, where N is number, to select active joystick\n" ); Con_Reportf( "Pass +set joy_index N to command line, where N is number, to select active joystick\n" );
joy = SDL_JoystickOpen( numjoy ); joy = SDL_JoystickOpen( numjoy );
if( !joy ) if( !joy )
{ {
MsgDev( D_INFO, "Failed to select joystick: %s\n", SDL_GetError( ) ); Con_Reportf( "Failed to select joystick: %s\n", SDL_GetError( ) );
return 0; return 0;
} }
MsgDev( D_INFO, "Selected joystick: %s\n" Con_Reportf( "Selected joystick: %s\n"
"\tAxes: %i\n" "\tAxes: %i\n"
"\tHats: %i\n" "\tHats: %i\n"
"\tButtons: %i\n" "\tButtons: %i\n"
@ -173,12 +173,12 @@ static int SDLash_JoyInit_New( int numjoy )
int temp, num; int temp, num;
int i; int i;
MsgDev( D_INFO, "Joystick: SDL GameController API\n" ); Con_Reportf( "Joystick: SDL GameController API\n" );
if( SDL_WasInit( SDL_INIT_GAMECONTROLLER ) != SDL_INIT_GAMECONTROLLER && if( SDL_WasInit( SDL_INIT_GAMECONTROLLER ) != SDL_INIT_GAMECONTROLLER &&
SDL_InitSubSystem( SDL_INIT_GAMECONTROLLER ) ) SDL_InitSubSystem( SDL_INIT_GAMECONTROLLER ) )
{ {
MsgDev( D_INFO, "Failed to initialize SDL GameController API: %s\n", SDL_GetError() ); Con_Reportf( "Failed to initialize SDL GameController API: %s\n", SDL_GetError() );
return 0; return 0;
} }
@ -200,28 +200,28 @@ static int SDLash_JoyInit_New( int numjoy )
} }
if( num > 0 ) if( num > 0 )
MsgDev( D_INFO, "%i joysticks found:\n", num ); Con_Reportf( "%i joysticks found:\n", num );
else else
{ {
MsgDev( D_INFO, "No joystick found.\n" ); Con_Reportf( "No joystick found.\n" );
return 0; return 0;
} }
for( i = 0; i < num; i++ ) for( i = 0; i < num; i++ )
MsgDev( D_INFO, "%i\t: %s\n", i, SDL_GameControllerNameForIndex( i ) ); Con_Reportf( "%i\t: %s\n", i, SDL_GameControllerNameForIndex( i ) );
MsgDev( D_INFO, "Pass +set joy_index N to command line, where N is number, to select active joystick\n" ); Con_Reportf( "Pass +set joy_index N to command line, where N is number, to select active joystick\n" );
gamecontroller = SDL_GameControllerOpen( numjoy ); gamecontroller = SDL_GameControllerOpen( numjoy );
if( !gamecontroller ) if( !gamecontroller )
{ {
MsgDev( D_INFO, "Failed to select joystick: %s\n", SDL_GetError( ) ); Con_Reportf( "Failed to select joystick: %s\n", SDL_GetError( ) );
return 0; return 0;
} }
// was added in SDL2-2.0.6, allow build with earlier versions just in case // was added in SDL2-2.0.6, allow build with earlier versions just in case
#if SDL_MAJOR_VERSION > 2 || SDL_MINOR_VERSION > 0 || SDL_PATCHLEVEL >= 6 #if SDL_MAJOR_VERSION > 2 || SDL_MINOR_VERSION > 0 || SDL_PATCHLEVEL >= 6
MsgDev( D_INFO, "Selected joystick: %s (%i:%i:%i)\n", Con_Reportf( "Selected joystick: %s (%i:%i:%i)\n",
SDL_GameControllerName( gamecontroller ), SDL_GameControllerName( gamecontroller ),
SDL_GameControllerGetVendor( gamecontroller ), SDL_GameControllerGetVendor( gamecontroller ),
SDL_GameControllerGetProduct( gamecontroller ), SDL_GameControllerGetProduct( gamecontroller ),

10
engine/platform/sdl/vid_sdl.c

@ -445,7 +445,7 @@ qboolean GL_CreateContext( void )
if( ( glw_state.context = SDL_GL_CreateContext( host.hWnd ) ) == NULL) if( ( glw_state.context = SDL_GL_CreateContext( host.hWnd ) ) == NULL)
{ {
MsgDev(D_ERROR, "GL_CreateContext: %s\n", SDL_GetError()); Con_Reportf( S_ERROR "GL_CreateContext: %s\n", SDL_GetError());
return GL_DeleteContext(); return GL_DeleteContext();
} }
@ -478,7 +478,7 @@ qboolean GL_UpdateContext( void )
{ {
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context )) if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ))
{ {
MsgDev(D_ERROR, "GL_UpdateContext: %s\n", SDL_GetError()); Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError());
return GL_DeleteContext(); return GL_DeleteContext();
} }
@ -502,7 +502,7 @@ qboolean VID_SetScreenResolution( int width, int height )
if( !SDL_GetClosestDisplayMode(0, &want, &got) ) if( !SDL_GetClosestDisplayMode(0, &want, &got) )
return false; return false;
MsgDev(D_NOTE, "Got closest display mode: %ix%i@%i\n", got.w, got.h, got.refresh_rate); Con_Reportf( "Got closest display mode: %ix%i@%i\n", got.w, got.h, got.refresh_rate);
if( SDL_SetWindowDisplayMode( host.hWnd, &got) == -1 ) if( SDL_SetWindowDisplayMode( host.hWnd, &got) == -1 )
return false; return false;
@ -1099,7 +1099,7 @@ void GL_InitExtensions( void )
glConfig.renderer_string = pglGetString( GL_RENDERER ); glConfig.renderer_string = pglGetString( GL_RENDERER );
glConfig.version_string = pglGetString( GL_VERSION ); glConfig.version_string = pglGetString( GL_VERSION );
glConfig.extensions_string = pglGetString( GL_EXTENSIONS ); glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
MsgDev( D_INFO, "^3Video^7: %s\n", glConfig.renderer_string ); Con_Reportf( "^3Video^7: %s\n", glConfig.renderer_string );
#ifdef XASH_GLES #ifdef XASH_GLES
GL_InitExtensionsGLES(); GL_InitExtensionsGLES();
@ -1146,7 +1146,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen )
SDL_GetCurrentDisplayMode( 0, &displayMode ); SDL_GetCurrentDisplayMode( 0, &displayMode );
MsgDev( D_INFO, "R_ChangeDisplaySettings: Setting video mode to %dx%d %s\n", width, height, fullscreen ? "fullscreen" : "windowed" ); Con_Reportf( "R_ChangeDisplaySettings: Setting video mode to %dx%d %s\n", width, height, fullscreen ? "fullscreen" : "windowed" );
// check our desktop attributes // check our desktop attributes
glw_state.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format ); glw_state.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );

Loading…
Cancel
Save