More compile fixes for Linux.

This commit is contained in:
Robert Beckebans 2012-12-07 00:09:53 +01:00
parent 9cc36a111e
commit 1feaa335df
8 changed files with 359 additions and 34 deletions

View file

@ -28,12 +28,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_definitions(-DUSE_XINPUT)
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O1 -Wno-unknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
#set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -Wno-unknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O1 -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
#set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
#set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer -Wunknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-unknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-unknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-unknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
#set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
@ -888,9 +888,6 @@ set(RBDOOM3_SOURCES
${UI_INCLUDES} ${UI_SOURCES}
${SWF_INCLUDES} ${SWF_SOURCES}
${DOOMCLASSIC_INCLUDES} ${DOOMCLASSIC_SOURCES}
${TIMIDITY_INCLUDES} ${TIMIDITY_SOURCES}
#${COMPILER_INCLUDES}
#${COMPILER_AAS_INCLUDES} ${COMPILER_AAS_SOURCES}
#${COMPILER_DMAP_INCLUDES} ${COMPILER_DMAP_SOURCES}
@ -931,6 +928,8 @@ include_directories(
if(MSVC)
add_definitions(-DUSE_DOOMCLASSIC)
if(MSVC_VERSION EQUAL 1700)
set(DirectX_LIBRARIES
dinput8
@ -977,6 +976,9 @@ if(MSVC)
endif()
list(APPEND RBDOOM3_SOURCES
${DOOMCLASSIC_INCLUDES} ${DOOMCLASSIC_SOURCES}
${TIMIDITY_INCLUDES} ${TIMIDITY_SOURCES}
${SYS_INCLUDES} ${SYS_SOURCES}
${XAUDIO2_INCLUDES} ${XAUDIO2_SOURCES}
${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES})
@ -1008,38 +1010,58 @@ if(MSVC)
)
else()
include_directories(libs/sdl2/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/sdl2/libmingw32)
list(APPEND RBDOOM3_SOURCES
${SYS_INCLUDES} ${SYS_SOURCES}
${STUBAUDIO_INCLUDES} ${STUBAUDIO_SOURCES})
# TODO: if WIN32
#list(REMOVE_ITEM WIN32_SOURCES sys/win32/win_cpu.cpp)
list(APPEND WIN32_SOURCES sys/sdl/sdl_cpu.cpp)
if(WIN32)
add_definitions(-DUSE_DOOMCLASSIC)
list(APPEND RBDOOM3_SOURCES
${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES})
list(APPEND RBDOOM3_SOURCES
${DOOMCLASSIC_INCLUDES} ${DOOMCLASSIC_SOURCES}
${TIMIDITY_INCLUDES} ${TIMIDITY_SOURCES}
${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES})
#list(REMOVE_ITEM WIN32_SOURCES sys/win32/win_cpu.cpp)
list(APPEND WIN32_SOURCES sys/sdl/sdl_cpu.cpp)
endif()
list(REMOVE_DUPLICATES RBDOOM3_SOURCES)
add_executable(RBDoom3 WIN32 ${RBDOOM3_SOURCES})
add_dependencies(RBDoom3 idlib)
target_link_libraries(RBDoom3
idlib
${DirectX_LIBRARIES}
#libcurl
#openal32
opengl32
glu32
dbghelp
#eaxguid
iphlpapi
winmm
wsock32.lib
SDL2
)
if(MINGW)
include_directories(libs/sdl2/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/sdl2/libmingw32)
endif()
if(WIN32)
target_link_libraries(RBDoom3
idlib
${DirectX_LIBRARIES}
#libcurl
#openal32
opengl32
glu32
dbghelp
#eaxguid
iphlpapi
winmm
wsock32.lib
SDL2
)
endif()
if(UNIX)
target_link_libraries(RBDoom3
idlib
GL
)
endif()
endif()

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2012 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -36,10 +37,13 @@ If you have questions concerning this license or the applicable additional terms
#include "../sound/sound.h"
// RB begin
#if defined(USE_DOOMCLASSIC)
#include "../../doomclassic/doom/doomlib.h"
#include "../../doomclassic/doom/d_event.h"
#include "../../doomclassic/doom/d_main.h"
#endif
// RB end
#include "../sys/sys_savegame.h"
@ -89,7 +93,11 @@ float com_engineHz_latched = 60.0f; // Latched version of cvar, updated between
int64 com_engineHz_numerator = 100LL * 1000LL;
int64 com_engineHz_denominator = 100LL * 60LL;
// RB begin
#if defined(_WIN32)
HWND com_hwndMsg = NULL;
#endif
// RB end
#ifdef __DOOM_DLL__
idGame* game = NULL;
@ -120,9 +128,13 @@ idCommonLocal::idCommonLocal() :
lastPacifierGuiTime( 0 ),
lastPacifierDialogState( false ),
showShellRequested( false ),
// RB begin
#if defined(USE_DOOMCLASSIC)
currentGame( DOOM3_BFG ),
idealCurrentGame( DOOM3_BFG ),
doomClassicMaterial( NULL )
#endif
/ // RB end
{
snapCurrent.localTime = -1;
@ -245,7 +257,14 @@ void idCommonLocal::ParseCommandLine( int argc, const char* const* argv )
if( idStr::Icmp( argv[ i ], "+connect_lobby" ) == 0 )
{
// Handle Steam bootable invites.
// RB begin
#if defined(_WIN32)
session->HandleBootableInvite( _atoi64( argv[ i + 1 ] ) );
#else
session->HandleBootableInvite( atol( argv[ i + 1 ] ) );
#endif
// RB end
}
else if( argv[ i ][ 0 ] == '+' )
{
@ -1293,6 +1312,8 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
fileSystem->EndLevelLoad();
// RB begin
#if defined(USE_DOOMCLASSIC)
// Initialize support for Doom classic.
doomClassicMaterial = declManager->FindMaterial( "_doomClassic" );
idImage* image = globalImages->GetImage( "_doomClassic" );
@ -1306,6 +1327,8 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
opts.numLevels = 1;
image->AllocImage( opts, TF_LINEAR, TR_REPEAT );
}
#endif
// RB end
com_fullyInitialized = true;
@ -1664,6 +1687,9 @@ bool idCommonLocal::ProcessEvent( const sysEvent_t* event )
return true;
}
// RB begin
#if defined(USE_DOOMCLASSIC)
// Let Doom classic run events.
if( IsPlayingDoomClassic() )
{
@ -1696,6 +1722,8 @@ bool idCommonLocal::ProcessEvent( const sysEvent_t* event )
// Let the classics eat all events.
return true;
}
#endif
// RB end
// menus / etc
if( MenuEvent( event ) )
@ -1730,6 +1758,9 @@ void idCommonLocal::ResetPlayerInput( int playerIndex )
userCmdMgr.ResetPlayer( playerIndex );
}
// RB begin
#if defined(USE_DOOMCLASSIC)
/*
========================
idCommonLocal::SwitchToGame
@ -1812,6 +1843,9 @@ void idCommonLocal::PerformGameSwitch()
currentGame = idealCurrentGame;
}
#endif // #if defined(USE_DOOMCLASSIC)
// RB end
/*
==================
Common_WritePrecache_f

View file

@ -178,12 +178,16 @@ struct mpMap_t
static const int MAX_LOGGED_STATS = 60 * 120; // log every half second
// RB begin
#if defined(USE_DOOMCLASSIC)
enum currentGame_t
{
DOOM_CLASSIC,
DOOM2_CLASSIC,
DOOM3_BFG
};
#endif
// RB end
class idCommon
{
@ -329,8 +333,12 @@ public:
virtual void QueueShowShell() = 0; // Will activate the shell on the next frame.
// RB begin
#if defined(USE_DOOMCLASSIC)
virtual currentGame_t GetCurrentGame() const = 0;
virtual void SwitchToGame( currentGame_t newGame ) = 0;
#endif
// RB end
};
extern idCommon* common;

View file

@ -1008,10 +1008,14 @@ bool idCommonLocal::LoadGame( const char* saveName )
return false;
}
// RB begin
#if defined(USE_DOOMCLASSIC)
if( GetCurrentGame() != DOOM3_BFG )
{
return false;
}
#endif
// RB end
if( session->GetSignInManager().GetMasterLocalUser() == NULL )
{

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2012 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -270,11 +271,15 @@ public:
showShellRequested = true;
}
// RB begin
#if defined(USE_DOOMCLASSIC)
virtual currentGame_t GetCurrentGame() const
{
return currentGame;
}
virtual void SwitchToGame( currentGame_t newGame );
#endif
// RB end
public:
void Draw(); // called by gameThread
@ -516,6 +521,8 @@ private:
bool showShellRequested;
// RB begin
#if defined(USE_DOOMCLASSIC)
currentGame_t currentGame;
currentGame_t idealCurrentGame; // Defer game switching so that bad things don't happen in the middle of the frame.
const idMaterial* doomClassicMaterial;
@ -526,6 +533,8 @@ private:
static const int DOOMCLASSIC_IMAGE_SIZE_IN_BYTES = DOOMCLASSIC_RENDERWIDTH* DOOMCLASSIC_RENDERHEIGHT* DOOMCLASSIC_BYTES_PER_PIXEL;
idArray< byte, DOOMCLASSIC_IMAGE_SIZE_IN_BYTES > doomClassicImageData;
#endif
// RB end
private:
void InitCommands();
@ -596,6 +605,8 @@ private:
void ScrubSaveGameFileName( idStr& saveFileName ) const;
// RB begin
#if defined(USE_DOOMCLASSIC)
// Doom classic support
void RunDoomClassicFrame();
void RenderDoomClassic();
@ -604,6 +615,8 @@ private:
return GetCurrentGame() != DOOM3_BFG;
}
void PerformGameSwitch();
#endif
// RB end
};
extern idCommonLocal commonLocal;
extern idCommonLocal commonLocal;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2012 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -1296,7 +1297,13 @@ idFile_Permanent::~idFile_Permanent()
{
if( o )
{
// RB begin
#if defined(_WIN32)
CloseHandle( o );
#else
fclose( o );
#endif
// RB end
}
}
@ -1332,12 +1339,20 @@ int idFile_Permanent::Read( void* buffer, int len )
while( remaining )
{
block = remaining;
// RB begin
#if defined(_WIN32)
DWORD bytesRead;
if( !ReadFile( o, buf, block, &bytesRead, NULL ) )
{
idLib::Warning( "idFile_Permanent::Read failed with %d from %s", GetLastError(), name.c_str() );
}
read = bytesRead;
#else
read = fread( buf, 1, block, o );
#endif
// RB end
if( read == 0 )
{
// we might have been trying to read from a CD, which
@ -1395,9 +1410,17 @@ int idFile_Permanent::Write( const void* buffer, int len )
while( remaining )
{
block = remaining;
// RB begin
#if defined(_WIN32)
DWORD bytesWritten;
WriteFile( o, buf, block, &bytesWritten, NULL );
written = bytesWritten;
#else
written = fwrite( buf, 1, block, o );
#endif
// RB end
if( written == 0 )
{
if( !tries )
@ -1435,7 +1458,13 @@ idFile_Permanent::ForceFlush
*/
void idFile_Permanent::ForceFlush()
{
// RB begin
#if defined(_WIN32)
FlushFileBuffers( o );
#else
setvbuf( o, NULL, _IONBF, 0 );
#endif
// RB end
}
/*
@ -1445,7 +1474,13 @@ idFile_Permanent::Flush
*/
void idFile_Permanent::Flush()
{
// RB begin
#if defined(_WIN32)
FlushFileBuffers( o );
#else
fflush( o );
#endif
// RB end
}
/*
@ -1455,7 +1490,13 @@ idFile_Permanent::Tell
*/
int idFile_Permanent::Tell() const
{
// RB begin
#if defined(_WIN32)
return SetFilePointer( o, 0, NULL, FILE_CURRENT );
#else
return ftell( o );
#endif
// RB end
}
/*
@ -1488,6 +1529,8 @@ idFile_Permanent::Seek
*/
int idFile_Permanent::Seek( long offset, fsOrigin_t origin )
{
// RB begin
#if defined(_WIN32)
int retVal = INVALID_SET_FILE_POINTER;
switch( origin )
{
@ -1502,6 +1545,37 @@ int idFile_Permanent::Seek( long offset, fsOrigin_t origin )
break;
}
return ( retVal == INVALID_SET_FILE_POINTER ) ? -1 : 0;
#else
int _origin;
switch( origin )
{
case FS_SEEK_CUR:
{
_origin = SEEK_CUR;
break;
}
case FS_SEEK_END:
{
_origin = SEEK_END;
break;
}
case FS_SEEK_SET:
{
_origin = SEEK_SET;
break;
}
default:
{
_origin = SEEK_CUR;
common->FatalError( "idFile_Permanent::Seek: bad origin for %s\n", name.c_str() );
break;
}
}
return fseek( o, offset, _origin );
#endif
// RB end
}
#if 1

View file

@ -456,7 +456,8 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
{
idFileHandle fp;
// RB begin
#if defined(_WIN32)
DWORD dwAccess = 0;
DWORD dwShare = 0;
DWORD dwCreate = 0;
@ -489,6 +490,84 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
{
return NULL;
}
#else
#ifndef __MWERKS__
#ifndef WIN32
// some systems will let you fopen a directory
struct stat buf;
if( stat( fileName, &buf ) != -1 && !S_ISREG( buf.st_mode ) )
{
return NULL;
}
#endif
#endif
if( mode == FS_WRITE )
{
fp = fopen( fileName, "wb" );
}
else if( mode == FS_READ )
{
fp = fopen( fileName, "rb" );
}
else if( mode == FS_APPEND )
{
fp = fopen( fileName, "ab" );
}
if( !fp )//&& fs_caseSensitiveOS.GetBool() )
{
// RB: really any proper OS other than Windows should have a case sensitive filesystem
idStr fpath, entry;
idStrList list;
fpath = fileName;
fpath.StripFilename();
fpath.StripTrailing( PATHSEPARATOR_CHAR );
if( ListOSFiles( fpath, NULL, list ) == -1 )
{
return NULL;
}
for( int i = 0; i < list.Num(); i++ )
{
entry = fpath + PATHSEPARATOR_CHAR + list[i];
if( !entry.Icmp( fileName ) )
{
if( mode == FS_WRITE )
{
fp = fopen( entry, "wb" );
}
else if( mode == FS_READ )
{
fp = fopen( entry, "rb" );
}
else if( mode == FS_APPEND )
{
fp = fopen( entry, "ab" );
}
if( fp )
{
if( fs_debug.GetInteger() )
{
common->Printf( "idFileSystemLocal::OpenFileRead: changed %s to %s\n", fileName, entry.c_str() );
}
break;
}
else
{
// not supposed to happen if ListOSFiles is doing it's job correctly
common->Warning( "idFileSystemLocal::OpenFileRead: fs_caseSensitiveOS 1 could not open %s", entry.c_str() );
}
}
}
}
#endif
// RB end
return fp;
}
@ -499,7 +578,13 @@ idFileSystemLocal::CloseOSFile
*/
void idFileSystemLocal::CloseOSFile( idFileHandle o )
{
// RB begin
#if defined(_WIN32)
::CloseHandle( o );
#else
fclose( o );
#endif
// RB end
}
/*
@ -509,7 +594,21 @@ idFileSystemLocal::DirectFileLength
*/
int idFileSystemLocal::DirectFileLength( idFileHandle o )
{
// RB begin
#if defined(_WIN32)
return GetFileSize( o, NULL );
#else
int pos;
int end;
pos = ftell( o );
fseek( o, 0, SEEK_END );
end = ftell( o );
fseek( o, pos, SEEK_SET );
return end;
#endif
// RB end
}
/*
@ -1774,11 +1873,25 @@ void idFileSystemLocal::RemoveFile( const char* relativePath )
if( fs_basepath.GetString()[0] )
{
OSPath = BuildOSPath( fs_basepath.GetString(), gameFolder, relativePath );
// RB begin
#if defined(_WIN32)
::DeleteFile( OSPath );
#else
remove( OSPath );
#endif
// RB end
}
OSPath = BuildOSPath( fs_savepath.GetString(), gameFolder, relativePath );
// RB begin
#if defined(_WIN32)
::DeleteFile( OSPath );
#else
remove( OSPath );
#endif
// RB end
}
/*
@ -2007,6 +2120,8 @@ bool idFileSystemLocal::RenameFile( const char* relativePath, const char* newNam
idStr oldOSPath = BuildOSPath( path, gameFolder, relativePath );
idStr newOSPath = BuildOSPath( path, gameFolder, newName );
// RB begin
#if defined(_WIN32)
// this gives atomic-delete-on-rename, like POSIX rename()
// There is a MoveFileTransacted() on vista and above, not sure if that means there
// is a race condition inside MoveFileEx...
@ -2017,6 +2132,17 @@ bool idFileSystemLocal::RenameFile( const char* relativePath, const char* newNam
const int err = GetLastError();
idLib::Warning( "RenameFile( %s, %s ) error %i", newOSPath.c_str(), oldOSPath.c_str(), err );
}
#else
const bool success = ( rename( oldOSPath.c_str(), newOSPath.c_str() ) == 0 );
if( !success )
{
const int err = errno;
idLib::Warning( "rename( %s, %s ) error %s", newOSPath.c_str(), oldOSPath.c_str(), strerror( errno ) );
}
#endif
// RB end
return success;
}

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2012 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -32,8 +33,13 @@ If you have questions concerning this license or the applicable additional terms
#include "Common_local.h"
#include "../renderer/Image.h"
#include "../renderer/ImageOpts.h"
// RB begin
#if defined(USE_DOOMCLASSIC)
#include "../../doomclassic/doom/doomlib.h"
#include "../../doomclassic/doom/globaldata.h"
#endif
// RB end
/*
@ -135,7 +141,13 @@ int idGameThread::Run()
// we should have consumed all of our usercmds
if( userCmdMgr )
{
// RB begin
#if defined(USE_DOOMCLASSIC)
if( userCmdMgr->HasUserCmdForPlayer( game->GetLocalClientNum() ) && common->GetCurrentGame() == DOOM3_BFG )
#else
if( userCmdMgr->HasUserCmdForPlayer( game->GetLocalClientNum() ) )
#endif
// RB end
{
idLib::Printf( "idGameThread::Run: didn't consume all usercmds\n" );
}
@ -241,6 +253,8 @@ void idCommonLocal::Draw()
{
loadGUI->Render( renderSystem, Sys_Milliseconds() );
}
// RB begin
#if defined(USE_DOOMCLASSIC)
else if( currentGame == DOOM_CLASSIC || currentGame == DOOM2_CLASSIC )
{
const float sysWidth = renderSystem->GetWidth() * renderSystem->GetPixelAspect();
@ -265,6 +279,8 @@ void idCommonLocal::Draw()
renderSystem->SetColor4( 1, 1, 1, 1 );
renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial );
}
#endif
// RB end
else if( game && game->Shell_IsActive() )
{
bool gameDraw = game->Draw( game->GetLocalClientNum() );
@ -440,9 +456,13 @@ void idCommonLocal::Frame()
com_forceGenericSIMD.ClearModified();
}
// RB begin
#if defined(USE_DOOMCLASSIC)
// Do the actual switch between Doom 3 and the classics here so
// that things don't get confused in the middle of the frame.
PerformGameSwitch();
#endif
// RB end
// pump all the events
Sys_GenerateEvents();
@ -461,7 +481,14 @@ void idCommonLocal::Frame()
// if the console or another gui is down, we don't need to hold the mouse cursor
bool chatting = false;
// RB begin
#if defined(USE_DOOMCLASSIC)
if( console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing() || ( game && game->InhibitControls() && !IsPlayingDoomClassic() ) )
#else
if( console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing() || ( game && game->InhibitControls() ) )
#endif
// RB end
{
Sys_GrabMouseCursor( false );
usercmdGen->InhibitUsercmd( INHIBIT_SESSION, true );
@ -473,7 +500,13 @@ void idCommonLocal::Frame()
usercmdGen->InhibitUsercmd( INHIBIT_SESSION, false );
}
// RB begin
#if defined(USE_DOOMCLASSIC)
const bool pauseGame = ( !mapSpawned || ( !IsMultiplayer() && ( Dialog().IsDialogPausing() || session->IsSystemUIShowing() || ( game && game->Shell_IsActive() ) ) ) ) && !IsPlayingDoomClassic();
#else
const bool pauseGame = ( !mapSpawned || ( !IsMultiplayer() && ( Dialog().IsDialogPausing() || session->IsSystemUIShowing() || ( game && game->Shell_IsActive() ) ) ) );
#endif
// RB end
// save the screenshot and audio from the last draw if needed
if( aviCaptureMode )
@ -705,11 +738,15 @@ void idCommonLocal::Frame()
userCmdMgr.PutUserCmdForPlayer( game->GetLocalClientNum(), newCmd );
}
// RB begin
#if defined(USE_DOOMCLASSIC)
// If we're in Doom or Doom 2, run tics and upload the new texture.
if( ( GetCurrentGame() == DOOM_CLASSIC || GetCurrentGame() == DOOM2_CLASSIC ) && !( Dialog().IsDialogPausing() || session->IsSystemUIShowing() ) )
{
RunDoomClassicFrame();
}
#endif
// RB end
// start the game / draw command generation thread going in the background
gameReturn_t ret = gameThread.RunGameAndDraw( numGameFrames, userCmdMgr, IsClient(), gameFrame - numGameFrames );
@ -805,6 +842,9 @@ void idCommonLocal::Frame()
}
}
// RB begin
#if defined(USE_DOOMCLASSIC)
/*
=================
idCommonLocal::RunDoomClassicFrame
@ -855,3 +895,7 @@ void idCommonLocal::RunDoomClassicFrame()
renderSystem->UploadImage( "_doomClassic", doomClassicImageData.Ptr(), DOOMCLASSIC_RENDERWIDTH, DOOMCLASSIC_RENDERHEIGHT );
doomTics++;
}
#endif
// RB end