Skip to content

Commit

Permalink
Merge branch 'FWGS:master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
Velaron authored Oct 27, 2023
2 parents ca279e7 + 5aac5d2 commit bc25a29
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 38 deletions.
5 changes: 4 additions & 1 deletion engine/client/cl_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,10 @@ void CL_FinishTimeDemo( void )
time = host.realtime - cls.td_starttime;
if( !time ) time = 1.0;

Con_Printf( "%i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
Con_Printf( "timedemo result: %i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );

if( Sys_CheckParm( "-timedemo" ))
CL_Quit_f();
}

/*
Expand Down
2 changes: 1 addition & 1 deletion engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GNU General Public License for more details.
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" );
CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" );
CVAR_DEFINE_AUTO( cl_allow_download, "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
CVAR_DEFINE( cl_allow_download, "cl_allowdownload", "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" );
CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" );
CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" );
Expand Down
6 changes: 3 additions & 3 deletions engine/client/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ void Con_DrawConsole( void )

if( cls.state == ca_connecting || cls.state == ca_connected )
{
if( !cl_allow_levelshots.value )
if( !cl_allow_levelshots.value && !cls.timedemo )
{
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console )
con.vislines = con.showlines = 0;
Expand All @@ -1993,7 +1993,7 @@ void Con_DrawConsole( void )
{
con.showlines = 0;

if( host_developer.value >= DEV_EXTENDED )
if( host_developer.value >= DEV_EXTENDED && !cls.timedemo )
Con_DrawNotify(); // draw notify lines
}
}
Expand Down Expand Up @@ -2025,7 +2025,7 @@ void Con_DrawConsole( void )
{
if( con.vislines )
Con_DrawSolidConsole( con.vislines );
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ))
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ) && !cls.timedemo )
Con_DrawNotify(); // draw notify lines
}
break;
Expand Down
5 changes: 5 additions & 0 deletions engine/common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void Sys_PrintUsage( void )
O("-noenginejoy ", "disable engine builtin joystick support")
O("-noenginemouse ", "disable engine builtin mouse support")
O("-nosound ", "disable sound output")
O("-timedemo ", "run timedemo and exit")
#endif

"\nPlatform-specific options:\n"
Expand Down Expand Up @@ -1157,6 +1158,7 @@ Host_Main
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
{
static double oldtime, newtime;
string demoname;

host.starttime = Sys_DoubleTime();

Expand Down Expand Up @@ -1253,6 +1255,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
SCR_CheckStartupVids(); // must be last

if( Sys_GetParmFromCmdLine( "-timedemo", demoname ))
Cbuf_AddTextf( "timedemo %s\n", demoname );

oldtime = Sys_DoubleTime() - 0.1;

if( Host_IsDedicated( ))
Expand Down
8 changes: 4 additions & 4 deletions engine/platform/sdl/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static qboolean SDLash_IsInstanceIDAGameController( SDL_JoystickID joyId )
return true;
return false;
#else
if( SDL_GameControllerFromInstanceID( joyId ) )
if( SDL_GameControllerFromInstanceID( joyId ) != NULL )
return true;
return false;
#endif
Expand All @@ -148,7 +148,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
#else
int keynum = key.keysym.sym;
#endif
qboolean numLock = SDL_GetModState() & KMOD_NUM;
qboolean numLock = FBitSet( SDL_GetModState(), KMOD_NUM );

#if XASH_ANDROID
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
Expand All @@ -159,7 +159,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )

if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
{
if( SDL_GetModState() & KMOD_CTRL )
if( FBitSet( SDL_GetModState(), KMOD_CTRL ))
{
if( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
{
Expand All @@ -176,7 +176,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )

if( isprint( keynum ) )
{
if( SDL_GetModState() & KMOD_SHIFT )
if( FBitSet( SDL_GetModState(), KMOD_SHIFT ))
{
keynum = Key_ToUpper( keynum );
}
Expand Down
31 changes: 21 additions & 10 deletions engine/platform/sdl/vid_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ void *SW_LockBuffer( void )
void *pixels;
int stride;

if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) )
Sys_Error("%s", SDL_GetError());
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) < 0 )
Sys_Error( "%s: %s", __func__, SDL_GetError( ));
return pixels;
}

Expand Down Expand Up @@ -272,7 +272,7 @@ static void R_InitVideoModes( void )
int j;
SDL_DisplayMode mode;

if( SDL_GetDisplayMode( displayIndex, i, &mode ) )
if( SDL_GetDisplayMode( displayIndex, i, &mode ) < 0 )
{
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() );
continue;
Expand Down Expand Up @@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico )
{
SDL_SysWMinfo wminfo;

if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ))
SDL_VERSION( &wminfo.version );

if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE )
{
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
return true;
}

Con_Reportf( S_ERROR "%s: %s", __func__, SDL_GetError( ));
return false;
}
#endif
Expand Down Expand Up @@ -492,8 +496,8 @@ void GL_UpdateSwapInterval( void )
{
ClearBits( gl_vsync.flags, FCVAR_CHANGED );

if( SDL_GL_SetSwapInterval( gl_vsync.value ) )
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
if( SDL_GL_SetSwapInterval( gl_vsync.value ) < 0 )
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ));
}
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
}
Expand Down Expand Up @@ -542,7 +546,7 @@ GL_UpdateContext
static qboolean GL_UpdateContext( void )
{
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ))
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) < 0 )
{
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError());
return GL_DeleteContext();
Expand Down Expand Up @@ -1040,7 +1044,7 @@ qboolean R_Init_Video( const int type )
// refdll can request some attributes
GL_SetupAttributes( );

if( SDL_GL_LoadLibrary( EGL_LIB ) )
if( SDL_GL_LoadLibrary( EGL_LIB ) < 0 )
{
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError());
return false;
Expand Down Expand Up @@ -1079,7 +1083,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_DisplayMode displayMode;

SDL_GetCurrentDisplayMode( 0, &displayMode );
if( SDL_GetCurrentDisplayMode( 0, &displayMode ) < 0 )
{
Con_Printf( S_ERROR "SDL_GetCurrentDisplayMode: %s", SDL_GetError( ));
return rserr_invalid_mode;
}

// check our desktop attributes
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );
Expand Down Expand Up @@ -1108,8 +1116,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
VID_RestoreScreenResolution();

#if SDL_VERSION_ATLEAST( 2, 0, 0 )
if( SDL_SetWindowFullscreen( host.hWnd, 0 ))
if( SDL_SetWindowFullscreen( host.hWnd, 0 ) < 0 )
{
Con_Printf( S_ERROR "SDL_SetWindowFullscreen: %s", SDL_GetError( ));
return rserr_invalid_fullscreen;
}
#if SDL_VERSION_ATLEAST( 2, 0, 5 )
SDL_SetWindowResizable( host.hWnd, SDL_TRUE );
#endif
Expand Down
4 changes: 3 additions & 1 deletion engine/server/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ CVAR_DEFINE_AUTO( sv_send_logos, "1", 0, "send custom decal logo to other player
CVAR_DEFINE_AUTO( sv_send_resources, "1", 0, "allow to download missed resources for players" );
CVAR_DEFINE_AUTO( sv_logbans, "0", 0, "print into the server log info about player bans" );
CVAR_DEFINE_AUTO( sv_allow_upload, "1", FCVAR_SERVER, "allow uploading custom resources on a server" );
CVAR_DEFINE_AUTO( sv_allow_download, "1", FCVAR_SERVER, "allow downloading custom resources to the client" );
CVAR_DEFINE( sv_allow_download, "sv_allowdownload", "1", FCVAR_SERVER, "allow downloading custom resources to the client" );
static CVAR_DEFINE_AUTO( sv_allow_dlfile, "1", 0, "compatibility cvar, does nothing" );
CVAR_DEFINE_AUTO( sv_uploadmax, "0.5", FCVAR_SERVER, "max size to upload custom resources (500 kB as default)" );
CVAR_DEFINE_AUTO( sv_downloadurl, "", FCVAR_PROTECTED, "location from which clients can download missing files" );
CVAR_DEFINE( sv_consistency, "mp_consistency", "1", FCVAR_SERVER, "enbale consistency check in multiplayer" );
Expand Down Expand Up @@ -925,6 +926,7 @@ void SV_Init( void )
Cvar_RegisterVariable( &sv_unlagsamples );
Cvar_RegisterVariable( &sv_allow_upload );
Cvar_RegisterVariable( &sv_allow_download );
Cvar_RegisterVariable( &sv_allow_dlfile );
Cvar_RegisterVariable( &sv_send_logos );
Cvar_RegisterVariable( &sv_send_resources );
Cvar_RegisterVariable( &sv_uploadmax );
Expand Down
5 changes: 4 additions & 1 deletion filesystem/VFileSystem009.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ class CXashFS : public IVFileSystem009

void RemoveFile( const char *path, const char *id ) override
{
FS_Delete( path ); // FS_Delete is aware of slashes
char dir[MAX_VA_STRING], fullpath[MAX_VA_STRING];

Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", IdToDir( dir, sizeof( dir ), id ), path );
FS_Delete( fullpath ); // FS_Delete is aware of slashes
}

void CreateDirHierarchy( const char *path, const char *id ) override
Expand Down
10 changes: 5 additions & 5 deletions filesystem/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,13 +776,13 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
else if( !Q_stricmp( token, "secure" ))
{
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->secure = Q_atoi( token );
GameInfo->secure = Q_atoi( token ) ? true : false;
}
// valid for both
else if( !Q_stricmp( token, "nomodels" ))
{
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->nomodels = Q_atoi( token );
GameInfo->nomodels = Q_atoi( token ) ? true : false;
}
else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" ))
{
Expand Down Expand Up @@ -850,17 +850,17 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
else if( !Q_stricmp( token, "noskills" ))
{
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->noskills = Q_atoi( token );
GameInfo->noskills = Q_atoi( token ) ? true : false;
}
else if( !Q_stricmp( token, "render_picbutton_text" ))
{
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->render_picbutton_text = Q_atoi( token );
GameInfo->render_picbutton_text = Q_atoi( token ) ? true : false;
}
else if( !Q_stricmp( token, "internal_vgui_support" ))
{
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->internal_vgui_support = Q_atoi( token );
GameInfo->internal_vgui_support = Q_atoi( token ) ? true : false;
}
else if( !Q_stricmp( token, "quicksave_aged_count" ))
{
Expand Down
2 changes: 1 addition & 1 deletion ref/gl/gl2_shim/gl2_shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ static void APIENTRY GL2_TexImage2D( GLenum target, GLint level, GLint internalf
}
internalformat = format;
}
if( internalformat == GL_LUMINANCE8_ALPHA8 || internalformat == GL_RGB )
if( internalformat == GL_LUMINANCE8_ALPHA8 || internalformat == GL_RGB || internalformat == GL_RGB8 || internalformat == GL_RGB5 )
internalformat = GL_RGBA;
rpglTexImage2D( target, level, internalformat, width, height, border, format, type, data );
if( data != pixels )
Expand Down
9 changes: 6 additions & 3 deletions ref/gl/gl_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CVAR_DEFINE_AUTO( r_novis, "0", 0, "ignore vis information (perfomance test)" );
CVAR_DEFINE_AUTO( r_nocull, "0", 0, "ignore frustrum culling (perfomance test)" );
CVAR_DEFINE_AUTO( r_lockpvs, "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" );
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
Expand Down Expand Up @@ -859,7 +859,9 @@ void GL_InitExtensionsGLES( void )
#endif
case GL_DEBUG_OUTPUT:
if( glw_state.extended )
GL_CheckExtension( "GL_KHR_debug", NULL, NULL, extid, 0 );
GL_CheckExtension( "GL_KHR_debug", debugoutputfuncs, "gl_debug_output", extid, 0 );
else
GL_SetExtension( extid, false );
break;
// case GL_TEXTURE_COMPRESSION_EXT: NOPE
// case GL_SHADER_GLSL100_EXT: NOPE
Expand Down Expand Up @@ -1123,6 +1125,7 @@ void GL_InitExtensions( void )

// force everything to happen in the main thread instead of in a separate driver thread
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );

}

// enable all the low priority messages
Expand Down Expand Up @@ -1375,7 +1378,7 @@ void GL_SetupAttributes( int safegl )
#ifdef XASH_NANOGL
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 1 );
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 1 );
#elif defined( XASH_WES ) || defined( XASH_REGAL )
#else
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 2 );
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 0 );
#endif
Expand Down
2 changes: 1 addition & 1 deletion ref/gl/gl_rmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static void R_ParseDetailTextures( const char *filename )
if( Q_stricmp( tex->name, texname ))
continue;

tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR );
tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR|TF_NOFLIP_TGA );

// texture is loaded
if( tex->dt_texturenum )
Expand Down
2 changes: 1 addition & 1 deletion ref/soft/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CVAR_DEFINE_AUTO( sw_surfcacheoverride, "0", 0, "");
static CVAR_DEFINE_AUTO( sw_waterwarp, "1", FCVAR_GLCONFIG, "nothing");
static CVAR_DEFINE_AUTO( sw_notransbrushes, "0", FCVAR_GLCONFIG, "do not apply transparency to water/glasses (faster)");
CVAR_DEFINE_AUTO( sw_noalphabrushes, "0", FCVAR_GLCONFIG, "do not draw brush holes (faster)");
CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" );
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
CVAR_DEFINE_AUTO( sw_texfilt, "0", FCVAR_GLCONFIG, "texture dither");
static CVAR_DEFINE_AUTO( r_novis, "0", 0, "" );

Expand Down
12 changes: 6 additions & 6 deletions waf

Large diffs are not rendered by default.

0 comments on commit bc25a29

Please sign in to comment.