Browse Source

engine: simplify force version drawing logic

pull/2/head
Alibek Omarov 1 year ago
parent
commit
19582cdf11
  1. 13
      engine/client/console.c
  2. 5
      engine/common/common.h
  3. 6
      engine/platform/sdl/events.c

13
engine/client/console.c

@ -2056,16 +2056,13 @@ void Con_DrawVersion( void ) @@ -2056,16 +2056,13 @@ void Con_DrawVersion( void )
break;
}
if( !host.force_draw_version )
{
if(( cls.key_dest != key_menu && !draw_version ) || CL_IsDevOverviewMode() == 2 || net_graph->value )
return;
}
if( host.force_draw_version_time > host.realtime )
host.force_draw_version = false;
draw_version = true;
if(( cls.key_dest != key_menu && !draw_version ) || CL_IsDevOverviewMode() == 2 || net_graph->value )
return;
if( host.force_draw_version || draw_version )
if( draw_version )
Q_snprintf( curbuild, MAX_STRING, XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
else Q_snprintf( curbuild, MAX_STRING, "v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));

5
engine/common/common.h

@ -144,7 +144,7 @@ typedef enum @@ -144,7 +144,7 @@ typedef enum
#define GameState (&host.game)
#define FORCE_DRAW_VERSION_TIME 5.0f // draw version for 5 seconds
#define FORCE_DRAW_VERSION_TIME 5.0 // draw version for 5 seconds
#ifdef _DEBUG
void DBG_AssertFunction( qboolean fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage );
@ -360,8 +360,7 @@ typedef struct host_parm_s @@ -360,8 +360,7 @@ typedef struct host_parm_s
qboolean change_game; // initialize when game is changed
qboolean mouse_visible; // vgui override cursor control (never change outside Platform_SetCursorType!)
qboolean shutdown_issued; // engine is shutting down
qboolean force_draw_version; // used when fraps is loaded
float force_draw_version_time;
double force_draw_version_time;
qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands
qboolean apply_opengl_config;// when true apply only to opengl cvars and ignore all other commands
qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc

6
engine/platform/sdl/events.c

@ -248,7 +248,6 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key ) @@ -248,7 +248,6 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
case SDL_SCANCODE_COMMA: keynum = ','; break;
case SDL_SCANCODE_PRINTSCREEN:
{
host.force_draw_version = true;
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
break;
}
@ -374,7 +373,6 @@ static void SDLash_ActiveEvent( int gain ) @@ -374,7 +373,6 @@ static void SDLash_ActiveEvent( int gain )
{
SNDDMA_Activate( true );
}
host.force_draw_version = true;
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
if( vid_fullscreen->value )
VID_SetMode();
@ -398,8 +396,7 @@ static void SDLash_ActiveEvent( int gain ) @@ -398,8 +396,7 @@ static void SDLash_ActiveEvent( int gain )
{
SNDDMA_Activate( false );
}
host.force_draw_version = true;
host.force_draw_version_time = host.realtime + 2;
host.force_draw_version_time = host.realtime + 2.0;
VID_RestoreScreenResolution();
}
}
@ -626,7 +623,6 @@ static void SDLash_EventFilter( SDL_Event *event ) @@ -626,7 +623,6 @@ static void SDLash_EventFilter( SDL_Event *event )
break;
case SDL_WINDOWEVENT_RESTORED:
host.status = HOST_FRAME;
host.force_draw_version = true;
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
if( vid_fullscreen->value )
VID_SetMode();

Loading…
Cancel
Save