mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-31 09:01:54 +00:00
Modular rendering system. Patch by use.less01
This might break MSVC builds. I'll take care of it later
This commit is contained in:
parent
8ab958fab9
commit
40dfcee06e
24 changed files with 335 additions and 186 deletions
|
@ -60,7 +60,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
|
|||
GetVersionEx( &vinfo );
|
||||
if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
|
||||
{
|
||||
Com_DPrintf( "performing gamma clamp.\n" );
|
||||
ri.Printf( PRINT_DEVELOPER, "performing gamma clamp.\n" );
|
||||
for( j = 0 ; j < 3 ; j++ )
|
||||
{
|
||||
for( i = 0 ; i < 128 ; i++ )
|
||||
|
|
|
@ -90,7 +90,7 @@ GLimp_Shutdown
|
|||
*/
|
||||
void GLimp_Shutdown( void )
|
||||
{
|
||||
IN_Shutdown();
|
||||
ri.IN_Shutdown();
|
||||
|
||||
SDL_QuitSubSystem( SDL_INIT_VIDEO );
|
||||
screen = NULL;
|
||||
|
@ -464,10 +464,10 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
|
|||
|
||||
SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 );
|
||||
ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName );
|
||||
Cvar_Set( "r_sdlDriver", driverName );
|
||||
ri.Cvar_Set( "r_sdlDriver", driverName );
|
||||
}
|
||||
|
||||
if (fullscreen && Cvar_VariableIntegerValue( "in_nograb" ) )
|
||||
if (fullscreen && ri.Cvar_VariableIntegerValue( "in_nograb" ) )
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n");
|
||||
ri.Cvar_Set( "r_fullscreen", "0" );
|
||||
|
@ -686,7 +686,7 @@ void GLimp_Init( void )
|
|||
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
|
||||
r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE );
|
||||
|
||||
if( Cvar_VariableIntegerValue( "com_abnormalExit" ) )
|
||||
if( ri.Cvar_VariableIntegerValue( "com_abnormalExit" ) )
|
||||
{
|
||||
ri.Cvar_Set( "r_mode", va( "%d", R_MODE_FALLBACK ) );
|
||||
ri.Cvar_Set( "r_fullscreen", "0" );
|
||||
|
@ -694,16 +694,16 @@ void GLimp_Init( void )
|
|||
ri.Cvar_Set( "com_abnormalExit", "0" );
|
||||
}
|
||||
|
||||
Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" );
|
||||
ri.Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" );
|
||||
|
||||
Sys_GLimpInit( );
|
||||
ri.Sys_GLimpInit( );
|
||||
|
||||
// Create the window and set up the context
|
||||
if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, r_noborder->integer))
|
||||
goto success;
|
||||
|
||||
// Try again, this time in a platform specific "safe mode"
|
||||
Sys_GLimpSafeInit( );
|
||||
ri.Sys_GLimpSafeInit( );
|
||||
|
||||
if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, qfalse))
|
||||
goto success;
|
||||
|
@ -747,7 +747,7 @@ success:
|
|||
ri.Cvar_Get( "r_availableModes", "", CVAR_ROM );
|
||||
|
||||
// This depends on SDL_INIT_VIDEO, hence having it here
|
||||
IN_Init( );
|
||||
ri.IN_Init( );
|
||||
}
|
||||
|
||||
|
||||
|
@ -778,7 +778,7 @@ void GLimp_EndFrame( void )
|
|||
// Find out the current state
|
||||
fullscreen = !!( s->flags & SDL_FULLSCREEN );
|
||||
|
||||
if( r_fullscreen->integer && Cvar_VariableIntegerValue( "in_nograb" ) )
|
||||
if( r_fullscreen->integer && ri.Cvar_VariableIntegerValue( "in_nograb" ) )
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n");
|
||||
ri.Cvar_Set( "r_fullscreen", "0" );
|
||||
|
@ -796,9 +796,9 @@ void GLimp_EndFrame( void )
|
|||
{
|
||||
// SDL_WM_ToggleFullScreen didn't work, so do it the slow way
|
||||
if( !sdlToggled )
|
||||
Cbuf_AddText( "vid_restart" );
|
||||
ri.Cmd_ExecuteText(EXEC_APPEND, "vid_restart");
|
||||
|
||||
IN_Restart( );
|
||||
ri.IN_Restart( );
|
||||
}
|
||||
|
||||
r_fullscreen->modified = qfalse;
|
||||
|
|
|
@ -464,7 +464,7 @@ static void IN_ActivateMouse( void )
|
|||
}
|
||||
|
||||
// in_nograb makes no sense in fullscreen mode
|
||||
if( !r_fullscreen->integer )
|
||||
if( !Cvar_VariableIntegerValue("r_fullscreen") )
|
||||
{
|
||||
if( in_nograb->modified || !mouseActive )
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ static void IN_DeactivateMouse( void )
|
|||
|
||||
// Always show the cursor when the mouse is disabled,
|
||||
// but not when fullscreen
|
||||
if( !r_fullscreen->integer )
|
||||
if( !Cvar_VariableIntegerValue("r_fullscreen") )
|
||||
SDL_ShowCursor( 1 );
|
||||
|
||||
if( !mouseAvailable )
|
||||
|
@ -525,7 +525,7 @@ static void IN_DeactivateMouse( void )
|
|||
|
||||
// Don't warp the mouse unless the cursor is within the window
|
||||
if( SDL_GetAppState( ) & SDL_APPMOUSEFOCUS )
|
||||
SDL_WarpMouse( glConfig.vidWidth / 2, glConfig.vidHeight / 2 );
|
||||
SDL_WarpMouse( cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2 );
|
||||
|
||||
mouseActive = qfalse;
|
||||
}
|
||||
|
@ -936,9 +936,9 @@ static void IN_ProcessEvents( void )
|
|||
char width[32], height[32];
|
||||
Com_sprintf( width, sizeof(width), "%d", e.resize.w );
|
||||
Com_sprintf( height, sizeof(height), "%d", e.resize.h );
|
||||
ri.Cvar_Set( "r_customwidth", width );
|
||||
ri.Cvar_Set( "r_customheight", height );
|
||||
ri.Cvar_Set( "r_mode", "-1" );
|
||||
Cvar_Set( "r_customwidth", width );
|
||||
Cvar_Set( "r_customheight", height );
|
||||
Cvar_Set( "r_mode", "-1" );
|
||||
/* wait until user stops dragging for 1 second, so
|
||||
we aren't constantly recreating the GL context while
|
||||
he tries to drag...*/
|
||||
|
@ -975,12 +975,12 @@ void IN_Frame( void )
|
|||
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
|
||||
loading = !!( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );
|
||||
|
||||
if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
|
||||
if( !Cvar_VariableIntegerValue("r_fullscreen") && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
|
||||
{
|
||||
// Console is down in windowed mode
|
||||
IN_DeactivateMouse( );
|
||||
}
|
||||
else if( !r_fullscreen->integer && loading )
|
||||
else if( !Cvar_VariableIntegerValue("r_fullscreen") && loading )
|
||||
{
|
||||
// Loading in windowed mode
|
||||
IN_DeactivateMouse( );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue