From 683861eb457b83e937fd52fd251a34c4ff100f6f Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 27 Nov 2012 23:23:32 +0100 Subject: [PATCH] Added initial CMake configuration. --- base/default.cfg | 77 +- doomclassic/doom/DoomLeaderboards.cpp | 147 --- doomclassic/doom/DoomLeaderboards.h | 45 - doomclassic/doom/Networking.cpp | 166 ---- doomclassic/doom/PlayerProfile.cpp | 649 ------------- doomclassic/doom/PlayerProfile.h | 267 ------ doomclassic/doom/i_net_ps3.cpp | 423 --------- doomclassic/doom/i_net_xbox.cpp | 365 ------- doomclassic/doom/i_video_xbox.cpp | 174 ---- doomclassic/doom/wi_stuff.cpp | 2 +- neo/CMakeLists.txt | 962 +++++++++++++++++++ neo/cmake-vs2010-32bit.bat | 6 + neo/cmake-vs2012-32bit.bat | 6 + neo/d3xp/menus/MenuWidget_DevList.cpp | 219 ----- neo/framework/File_SaveGame.h | 2 +- neo/framework/Session.cpp | 1256 ------------------------- neo/framework/Unzip.h | 2 +- neo/framework/Zip.cpp | 2 +- neo/framework/Zip.h | 2 +- neo/idlib/CMakeLists.txt | 20 + neo/libs/zlib/example.c | 565 ----------- neo/renderer/Image_files.cpp | 2 +- neo/swf/SWF_Image.cpp | 2 +- neo/swf/SWF_Zlib.cpp | 2 +- neo/sys/win32/rc/doom.rc | 4 + neo/sys/win32/win_gamma.cpp | 93 -- neo/sys/win32/win_stats.cpp | 29 - neo/sys/win32/win_stats.h | 32 - neo/ui/GameWindow.cpp | 52 - neo/ui/GameWindow.h | 38 - 30 files changed, 1082 insertions(+), 4529 deletions(-) delete mode 100644 doomclassic/doom/DoomLeaderboards.cpp delete mode 100644 doomclassic/doom/DoomLeaderboards.h delete mode 100644 doomclassic/doom/Networking.cpp delete mode 100644 doomclassic/doom/PlayerProfile.cpp delete mode 100644 doomclassic/doom/PlayerProfile.h delete mode 100644 doomclassic/doom/i_net_ps3.cpp delete mode 100644 doomclassic/doom/i_net_xbox.cpp delete mode 100644 doomclassic/doom/i_video_xbox.cpp create mode 100644 neo/CMakeLists.txt create mode 100644 neo/cmake-vs2010-32bit.bat create mode 100644 neo/cmake-vs2012-32bit.bat delete mode 100644 neo/d3xp/menus/MenuWidget_DevList.cpp delete mode 100644 neo/framework/Session.cpp create mode 100644 neo/idlib/CMakeLists.txt delete mode 100644 neo/libs/zlib/example.c delete mode 100644 neo/sys/win32/win_gamma.cpp delete mode 100644 neo/sys/win32/win_stats.cpp delete mode 100644 neo/sys/win32/win_stats.h delete mode 100644 neo/ui/GameWindow.cpp delete mode 100644 neo/ui/GameWindow.h diff --git a/base/default.cfg b/base/default.cfg index fa81adaf..75206784 100644 --- a/base/default.cfg +++ b/base/default.cfg @@ -1 +1,76 @@ -# empty file +// +// KEY BINDINGS +// + +unbindall + +// +// weapons +// +bind 1 "_impulse0" // weap +bind 2 "_impulse2" // weap +bind 3 "_impulse3" // weap +bind 4 "_impulse5" // weap +bind 5 "_impulse6" // weap +bind 6 "_impulse7" // weap +bind 7 "_impulse8" // weap +bind 8 "_impulse9" // weap +bind 9 "_impulse10" // weap +//bind 0 "_impulse11" // weap +bind q "_impulse12" // weap + +bind TAB "_impulse19" // PDA in SP, scoreboard in MP +bind r "_impulse13" // reload +bind f "_impulse16" // Flash Light + +bind [ "_impulse15" +bind ] "_impulse14" +bind / "_impulse14" +bind ENTER _button2 + +bind mwheelup "_impulse15" +bind mwheeldown "_impulse14" + +// +// CHARACTER CONTROLS +// + +bind CTRL _attack + +bind SHIFT _speed + +bind DEL _lookdown +bind PGDN _lookup + +bind c _movedown +bind SPACE _moveup + + +bind UPARROW _forward +bind DOWNARROW _back +bind LEFTARROW _left +bind RIGHTARROW _right +bind w _forward +bind a _moveleft +bind s _back +bind d _moveright +bind e _use + +// +// CLIENT ENVIRONMENT COMMANDS +// + +bind F5 "savegame quick" +bind F9 "loadgame quick" +bind F12 screenshot + +bind t clientMessageMode +bind y "clientMessageMode 1" + +// +// MOUSE BUTTONS +// + +bind MOUSE1 _attack +bind MOUSE2 _moveup + diff --git a/doomclassic/doom/DoomLeaderboards.cpp b/doomclassic/doom/DoomLeaderboards.cpp deleted file mode 100644 index 9134d4bb..00000000 --- a/doomclassic/doom/DoomLeaderboards.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "DoomLeaderboards.h" -#include "tech5/engine/framework/precompiled.h" -#include "tech5\engine\sys\sys_stats.h" -#include "../doomengine/source/doomdef.h" - -#include - -static columnDef_t columnDefTime[] = { - { "Time", 64, AGGREGATE_MIN, STATS_COLUMN_DISPLAY_TIME_MILLISECONDS } -}; - -const static int NUMLEVELS_ULTIMATE_DOOM = 36; -const static int NUMLEVELS_DOOM2_HELL_ON_EARTH = 32; -const static int NUMLEVELS_FINALDOOM_TNT = 32; -const static int NUMLEVELS_FINALDOOM_PLUTONIA = 32; -const static int NUMLEVELS_DOOM2_MASTER_LEVELS = 21; -const static int NUMLEVELS_DOOM2_NERVE = 9; - - -const static int NUM_LEVEL_LIST[] = { - NUMLEVELS_ULTIMATE_DOOM, - NUMLEVELS_DOOM2_HELL_ON_EARTH, - NUMLEVELS_FINALDOOM_TNT, - NUMLEVELS_FINALDOOM_PLUTONIA, - NUMLEVELS_DOOM2_MASTER_LEVELS, - NUMLEVELS_DOOM2_NERVE -}; - -/* -======================== -GenerateLeaderboard ID -Generates a Leaderboard ID based on current Expansion + episode + map + skill + Type - -Expansion is the base value that the leaderboard ID comes from - -======================== -*/ -const int GenerateLeaderboardID( int expansion, int episode, int map, int skill ) { - - int realMapNumber = ( episode * map - 1 ); - - if( common->GetGameSKU() == GAME_SKU_DOOM1_BFG ) { - - // Doom levels start at 620 .. yeah.. hack. - int block = 615; - int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ; - - return block + mapAndSkill; - } else if( common->GetGameSKU() == GAME_SKU_DOOM2_BFG ) { - - if( expansion == 1 ) { - // Doom 2 Levels start at 800.. Yep.. another hack. - int block = 795; - int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ; - - return block + mapAndSkill; - } else { - // Nerve Levels start at 960... another hack! - int block = 955; - int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ; - - return block + mapAndSkill; - } - - } else { - - // DCC Content - int block = 0; - if( expansion > 0 ){ - for( int expi = 0; expi < expansion; expi++ ) { - block += NUM_LEVEL_LIST[ expi ] * ( (int)sk_nightmare + 1); - } - } - int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ; - return block + mapAndSkill; - } -} - -/* -======================== -InitLeaderboards - -Generates all the possible leaderboard definitions -and stores into an STL Map, with leaderboard ID as the Hash/key value. - -======================== -*/ -void InitLeaderboards() { - - for( int expi = 0; expi < ARRAY_COUNT( NUM_LEVEL_LIST ); expi++ ) { - - for( int udi = 1; udi <= NUM_LEVEL_LIST[expi] ; udi++ ) { - - for( int skilli = 0; skilli <= sk_nightmare; skilli++ ) { - - // Create the Time Trial leaderboard for each level. - int timeTrial_leaderboardID = GenerateLeaderboardID( expi, 1, udi, skilli ); - leaderboardDefinition_t * timeTrial_Leaderboard = new leaderboardDefinition_t( timeTrial_leaderboardID, ARRAY_COUNT( columnDefTime ), columnDefTime, RANK_LEAST_FIRST, false, true ); - - } - } - } -} - -/* -======================== -GenerateLeaderboard -Generates a Leaderboard based on current Expansion + episode + map + skill + Type - -Expansion is the base value that the leaderboard ID comes from - -======================== -*/ -const leaderboardDefinition_t * GetLeaderboard( int expansion, int episode, int map, int skill ) { - - int leaderboardID = GenerateLeaderboardID( expansion, episode, map, skill ); - - return Sys_FindLeaderboardDef( leaderboardID );; -} \ No newline at end of file diff --git a/doomclassic/doom/DoomLeaderboards.h b/doomclassic/doom/DoomLeaderboards.h deleted file mode 100644 index cdb4b7c6..00000000 --- a/doomclassic/doom/DoomLeaderboards.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#ifndef __DOOM_LEADERBOARDS_H__ -#define __DOOM_LEADERBOARDS_H__ - - -#include "sys\sys_stats_misc.h" - -enum Leaderboard_type_t { - - LEADERBOARD_TYPE_TIME_TRIAL, - LEADERBOARD_TYPE_FRAGS, - - LEADERBOARD_MAX_TYPES -}; - -void InitLeaderboards(); -const leaderboardDefinition_t * GetLeaderboard( int expansion, int episode, int map, int skill ); - -#endif // __DOOM_LEADERBOARDS_H__ \ No newline at end of file diff --git a/doomclassic/doom/Networking.cpp b/doomclassic/doom/Networking.cpp deleted file mode 100644 index 55e3eba9..00000000 --- a/doomclassic/doom/Networking.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "Precompiled.h" -#include "../Main/Main.h" - -#include -#include - -#include "tech5/engine/sys/sys_lobby.h" - -bool useTech5Packets = true; - -#if 1 - -struct networkitem -{ - int source; - int size; - char buffer[256*64]; -}; - -std::queue< networkitem > networkstacks[4]; -//sockaddr_in sockaddrs[4]; - -int DoomLibRecv( char* buff, DWORD *numRecv ) -{ - //int player = DoomInterface::CurrentPlayer(); - int player = ::g->consoleplayer; - - if (networkstacks[player].empty()) - return -1; - - networkitem item = networkstacks[player].front(); - - memcpy( buff, item.buffer, item.size ); - *numRecv = item.size; - //*source = sockaddrs[item.source]; - - networkstacks[player].pop(); - - return 1; -} - -void I_Printf(char *error, ...); - -int DoomLibSend( const char* buff, DWORD size, sockaddr_in *target, int toNode ) -{ - int i; - - i = DoomLib::RemoteNodeToPlayerIndex( toNode ); - - //I_Printf( "DoomLibSend %d --> %d: %d\n", ::g->consoleplayer, i, size ); - - networkitem item; - item.source = DoomInterface::CurrentPlayer(); - item.size = size; - memcpy( item.buffer, buff, size ); - networkstacks[i].push( item ); - - return 1; -} - - -int DoomLibSendRemote() -{ - if ( gameLocal == NULL ) { - return 0; - } - - int curPlayer = DoomLib::GetPlayer(); - - for (int player = 0; player < gameLocal->Interface.GetNumPlayers(); ++player) - { - DoomLib::SetPlayer( player ); - - for( int i = 0; i < 4; i++ ) { - - //Check if it is remote - int node = DoomLib::PlayerIndexToRemoteNode( i ); - if ( ::g->sendaddress[node].sin_addr.s_addr == ::g->sendaddress[0].sin_addr.s_addr ) { - continue; - } - - while(!networkstacks[i].empty()) { - networkitem item = networkstacks[i].front(); - - int c; - //WSABUF buffer; - //DWORD num_sent; - - //buffer.buf = (char*)&item.buffer; - //buffer.len = item.size; - - if ( useTech5Packets ) { - idLobby & lobby = static_cast< idLobby & >( session->GetGameLobbyBase() ); - - lobbyUser_t * user = lobby.GetLobbyUser( i ); - - if ( user != NULL ) { - lobby.SendConnectionLess( user->address, idLobby::OOB_GENERIC_GAME_DATA, (const byte *)(&item.buffer[0] ), item.size ); - } - } else { - c = sendto( ::g->sendsocket, &item.buffer, item.size, MSG_DONTWAIT, (sockaddr*)&::g->sendaddress[node], sizeof(::g->sendaddress[node]) ); - - //c = WSASendTo(::g->sendsocket, &buffer, 1, &num_sent, 0, (sockaddr*)&::g->sendaddress[node], sizeof(::g->sendaddress[node]), 0, 0); - } - - networkstacks[i].pop(); - } - } - } - - DoomLib::SetPlayer(curPlayer); - - return 1; -} - -void DL_InitNetworking( DoomInterface *pdi ) -{ - // DHM - Nerve :: Clear out any old splitscreen packets that may be lingering. - for ( int i = 0; i<4; i++ ) { - while ( !networkstacks[i].empty() ) { - networkstacks[i].pop(); - } - } - - /*sockaddrs[0].sin_addr.s_addr = inet_addr("0.0.0.1" ); - sockaddrs[1].sin_addr.s_addr = inet_addr("0.0.0.2" ); - sockaddrs[2].sin_addr.s_addr = inet_addr("0.0.0.3" ); - sockaddrs[3].sin_addr.s_addr = inet_addr("0.0.0.4" );*/ - pdi->SetNetworking( DoomLibRecv, DoomLibSend, DoomLibSendRemote ); -} - -#else - -void DL_InitNetworking( DoomInterface *pdi ) { - -} - -#endif diff --git a/doomclassic/doom/PlayerProfile.cpp b/doomclassic/doom/PlayerProfile.cpp deleted file mode 100644 index 571ab582..00000000 --- a/doomclassic/doom/PlayerProfile.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#include "PlayerProfile.h" -#include "PS3_Includes.h" -#include "PSN/PS3_Session.h" - -const int32 FRAMEWORK_PROFILE_VER = 1; - - -// Store master volume settings in archived cvars, becausue we want them to apply -// even if a user isn't signed in. -// The range is from 0 to 15, which matches the setting in vanilla DOOM. -idCVar s_volume_sound( "s_volume_sound", "8", CVAR_ARCHIVE | CVAR_INTEGER, "sound volume", 0, 15 ); -idCVar s_volume_midi( "s_volume_midi", "8", CVAR_ARCHIVE | CVAR_INTEGER, "music volume", 0, 15 ); - - - -/* -================================================ -idProfileMgr -================================================ -*/ - -/* -======================== -idProfileMgr -======================== -*/ -idProfileMgr::idProfileMgr() : - profileSaveProcessor( new (TAG_SAVEGAMES) idSaveGameProcessorSaveProfile ), - profileLoadProcessor( new (TAG_SAVEGAMES) idSaveGameProcessorLoadProfile ), - profile( NULL ), - handle( 0 ) { -} - - -/* -================================================ -~idProfileMgr -================================================ -*/ -idProfileMgr::~idProfileMgr() { - delete profileSaveProcessor; - profileSaveProcessor = NULL; - - delete profileLoadProcessor; - profileLoadProcessor = NULL; -} - -/* -======================== -idProfileMgr::Init -======================== -*/ -void idProfileMgr::Init( idPlayerProfile * profile_ ) { - profile = profile_; - handle = 0; -} - -/* -======================== -idProfileMgr::Pump -======================== -*/ -void idProfileMgr::Pump() { - // profile can be NULL if we forced the user to register as in the case of map-ing into a level from the press start screen - if ( profile == NULL ) { - return; - } - - // See if we are done with saving/loading the profile - bool saving = profile->GetState() == idPlayerProfile::SAVING; - bool loading = profile->GetState() == idPlayerProfile::LOADING; - if ( ( saving || loading ) && psn_session->GetSaveGameManager()->IsSaveGameCompletedFromHandle( handle ) ) { - profile->SetState( idPlayerProfile::IDLE ); - - if ( saving ) { - // Done saving - } else if ( loading ) { - // Done loading - const idSaveLoadParms & parms = profileLoadProcessor->GetParms(); - if ( parms.GetError() == SAVEGAME_E_FOLDER_NOT_FOUND || parms.GetError() == SAVEGAME_E_FILE_NOT_FOUND ) { - profile->SaveSettings(); - } else if ( parms.GetError() != SAVEGAME_E_NONE ) { - profile->SetState( idPlayerProfile::ERR ); - } - } - } - - // See if we need to save/load the profile - if ( profile->GetRequestedState() == idPlayerProfile::SAVE_REQUESTED ) { - SaveSettings(); - profile->SetRequestedState( idPlayerProfile::IDLE ); - } else if ( profile->GetRequestedState() == idPlayerProfile::LOAD_REQUESTED ) { - LoadSettings(); - profile->SetRequestedState( idPlayerProfile::IDLE ); - } -} - -/* -======================== -idProfileMgr::GetProfile -======================== -*/ -idPlayerProfile * idProfileMgr::GetProfile() { - if ( profile == NULL ) { - return NULL; - } - - bool loading = ( profile->GetState() == idPlayerProfile::LOADING ) || ( profile->GetRequestedState() == idPlayerProfile::LOAD_REQUESTED ); - if ( loading ) { - return NULL; - } - - return profile; -} - -/* -======================== -idProfileMgr::SaveSettings -======================== -*/ -void idProfileMgr::SaveSettings() { - if ( profile != NULL && saveGame_enable.GetBool() ) { - // Issue the async save... - if ( profileSaveProcessor->InitSaveProfile( profile, "" ) ) { - handle = psn_session->GetSaveGameManager()->ExecuteProcessor( profileSaveProcessor ); - profile->SetState( idPlayerProfile::SAVING ); - } - } else { - // If not able to save the profile, just change the state and leave - if ( profile == NULL ) { - idLib::Warning( "Not saving profile, profile is NULL." ); - } - if ( !saveGame_enable.GetBool() ) { - idLib::Warning( "Skipping profile save because saveGame_enable = 0" ); - } - } -} - -/* -======================== -idProfileMgr::LoadSettings -======================== -*/ -void idProfileMgr::LoadSettings() { - if ( profile != NULL && saveGame_enable.GetBool() ) { - if ( profileLoadProcessor->InitLoadProfile( profile, "" ) ) { - // Skip the not found error because this might be the first time to play the game! - profileLoadProcessor->SetSkipSystemErrorDialogMask( SAVEGAME_E_FOLDER_NOT_FOUND | SAVEGAME_E_FILE_NOT_FOUND ); - - handle = psn_session->GetSaveGameManager()->ExecuteProcessor( profileLoadProcessor ); - profile->SetState( idPlayerProfile::LOADING ); - } - } else { - // If not able to save the profile, just change the state and leave - if ( profile == NULL ) { - idLib::Warning( "Not loading profile, profile is NULL." ); - } - if ( !saveGame_enable.GetBool() ) { - idLib::Warning( "Skipping profile load because saveGame_enable = 0" ); - } - } -} - -/* -================================================ -idSaveGameProcessorSaveProfile -================================================ -*/ - -/* -======================== -idSaveGameProcessorSaveProfile::idSaveGameProcessorSaveProfile -======================== -*/ -idSaveGameProcessorSaveProfile::idSaveGameProcessorSaveProfile() { - profileFile = NULL; - profile = NULL; -} - -/* -======================== -idSaveGameProcessorSaveProfile::InitSaveProfile -======================== -*/ -bool idSaveGameProcessorSaveProfile::InitSaveProfile( idPlayerProfile * profile_, const char * folder ) { - - // Serialize the profile and pass a file to the processor - profileFile = new (TAG_SAVEGAMES) idFile_Memory( SAVEGAME_PROFILE_FILENAME ); - profileFile->MakeWritable(); - profileFile->SetMaxLength( MAX_PROFILE_SIZE ); - - idTempArray< byte > buffer( MAX_PROFILE_SIZE ); - idBitMsg msg; - msg.InitWrite( buffer.Ptr(), MAX_PROFILE_SIZE ); - idSerializer ser( msg, true ); - profile_->SerializeSettings( ser ); - - profileFile->Write( msg.GetReadData(), msg.GetSize() ); - profileFile->MakeReadOnly(); - - idList< idSaveFileEntry > files; - files.Append( idSaveFileEntry( profileFile, SAVEGAMEFILE_BINARY | SAVEGAMEFILE_AUTO_DELETE, SAVEGAME_PROFILE_FILENAME ) ); - - idSaveGameDetails description; - if ( !idSaveGameProcessor::Init() ) { - return false; - } - - if ( files.Num() == 0 ) { - idLib::Warning( "No files to save." ); - return false; - } - - // Setup save system - parms.directory = AddSaveFolderPrefix( folder, idSaveGameManager::PACKAGE_PROFILE ); - parms.mode = SAVEGAME_MBF_SAVE | SAVEGAME_MBF_HIDDEN; // do NOT delete the existing files - parms.saveFileType = SAVEFILE_TYPE_AUTO; - for ( int i = 0; i < files.Num(); ++i ) { - parms.files.Append( files[i] ); - } - - - description.title = idLocalization::GetString( "#str_savegame_title" ); - description.subTitle = idLocalization::GetString( "#str_savegame_profile_heading" ); - description.summary = idLocalization::GetString( "#str_savegame_profile_desc" ); - - - // Add static image as the thumbnail - staticScreenshotFile = new (TAG_SAVEGAMES) idFile_Memory( "image" ); - - // Open up the Image file and Make it a memory file. - void* thumbImage = NULL; - int imagesize = fileSystem->ReadFile( "base/textures/PROFILE.PNG", &thumbImage ); // This file lives at USRData.. i think. - staticScreenshotFile->MakeWritable(); - staticScreenshotFile->Write( thumbImage, imagesize ); - staticScreenshotFile->MakeReadOnly(); - - parms.files.Append( idSaveFileEntry( staticScreenshotFile, SAVEGAMEFILE_THUMB, "image" ) ); - fileSystem->FreeFile( thumbImage ); - - - this->parms.description = description; - parms.description.slotName = folder; - - - - // TODO:KC - what was the purpose of this? - // JAF idKeyInput::SetUserDeviceNumForBind( profile_->GetDeviceNumForProfile() ); - - profile = profile_; - - return true; -} - -/* -======================== -idSaveGameProcessorSaveProfile::Process -======================== -*/ -bool idSaveGameProcessorSaveProfile::Process() { - // Files already setup for save, just execute as normal files - - // Platform-specific implementation - // This will start a worker thread for async operation. - // It will always signal when it's completed. - Sys_ExecuteSavegameCommandAsync( &parms ); - - return false; -} - -/* -================================================ -idSaveGameProcessorLoadProfile -================================================ -*/ - -/* -======================== -idSaveGameProcessorLoadProfile::idSaveGameProcessorLoadProfile -======================== -*/ -idSaveGameProcessorLoadProfile::idSaveGameProcessorLoadProfile() { - profileFile = NULL; - profile = NULL; -} - -/* -======================== -idSaveGameProcessorLoadProfile::~idSaveGameProcessorLoadProfile -======================== -*/ -idSaveGameProcessorLoadProfile::~idSaveGameProcessorLoadProfile() { -} - -/* -======================== -idSaveGameProcessorLoadProfile::InitLoadFiles -======================== -*/ -bool idSaveGameProcessorLoadProfile::InitLoadProfile( idPlayerProfile * profile_, const char * folder_ ) { - if ( !idSaveGameProcessor::Init() ) { - return false; - } - - parms.directory = AddSaveFolderPrefix( folder_, idSaveGameManager::PACKAGE_PROFILE ); - parms.description.slotName = folder_; - parms.mode = SAVEGAME_MBF_LOAD | SAVEGAME_MBF_HIDDEN; - parms.saveFileType = SAVEFILE_TYPE_AUTO; - - profileFile = new (TAG_SAVEGAMES) idFile_Memory( SAVEGAME_PROFILE_FILENAME ); - parms.files.Append( idSaveFileEntry( profileFile, SAVEGAMEFILE_BINARY, SAVEGAME_PROFILE_FILENAME ) ); - - profile = profile_; - - return true; -} - -/* -======================== -idSaveGameProcessorLoadProfile::Process -======================== -*/ -bool idSaveGameProcessorLoadProfile::Process() { - Sys_ExecuteSavegameCommandAsync( &parms ); - - return false; -} - -/* -======================== -idSaveGameProcessorLoadProfile::PostProcess -======================== -*/ -void idSaveGameProcessorLoadProfile::PostProcess() { - // Serialize the loaded profile - bool foundProfile = profileFile->Length() > 0; - - if ( foundProfile ) { - idTempArray< byte> buffer( MAX_PROFILE_SIZE ); - - // Serialize settings from this buffer - profileFile->MakeReadOnly(); - profileFile->ReadBigArray( buffer.Ptr(), profileFile->Length() ); - - idBitMsg msg; - msg.InitRead( buffer.Ptr(), (int)buffer.Size() ); - idSerializer ser( msg, false ); - profile->SerializeSettings( ser ); - - // JAF idKeyInput::SetUserDeviceNumForBind( profile->GetDeviceNumForProfile() ); - - } else { - parms.errorCode = SAVEGAME_E_FILE_NOT_FOUND; - } - - delete profileFile; -} - -/* -======================== -Contains data that needs to be saved out on a per player profile basis, global for the lifetime of the player so -the data can be shared across computers. -- HUD tint colors -- key bindings -- etc... -======================== -*/ - -/* -======================== -idPlayerProfile::idPlayerProfile -======================== -*/ -idPlayerProfile::idPlayerProfile() { - SetDefaults(); - - // Don't have these in SetDefaults because they're used for state management and SetDefaults is called when - // loading the profile - state = IDLE; - requestedState = IDLE; -} - -/* -======================== -idPlayerProfile::SetDefaults -======================== -*/ -void idPlayerProfile::SetDefaults() { - - achievementBits = 0; - seenInstallMessage = false; - stats.SetNum( MAX_PLAYER_PROFILE_STATS ); - for ( int i = 0; i < MAX_PLAYER_PROFILE_STATS; ++i ) { - stats[i].i = 0; - } - - deviceNum = 0; - state = IDLE; - requestedState = IDLE; - frameScaleX = 0.85f; - frameScaleY = 0.85f; -} - -/* -======================== -idPlayerProfile::Init -======================== -*/ -void idPlayerProfile::Init() { - SetDefaults(); -} - -/* -======================== -idPlayerProfile::~idPlayerProfile -======================== -*/ -idPlayerProfile::~idPlayerProfile() { -} - -/* -======================== -idPlayerProfile::SerializeSettings -======================== -*/ -bool idPlayerProfile::SerializeSettings( idSerializer & ser ) { - int flags = cvarSystem->GetModifiedFlags(); - - // Default to current tag/version - int32 tag = GetProfileTag(); - int32 version = FRAMEWORK_PROFILE_VER; - - // Serialize tag/version - ser.SerializePacked( tag ); - if ( tag != GetProfileTag() ) { - idLib::Warning( "Profile tag did not match, profile will be re-initialized" ); - SetDefaults(); - SaveSettings(); // Flag the profile to save so we have the latest version stored - - return false; - } - ser.SerializePacked( version ); - if ( version != FRAMEWORK_PROFILE_VER ) { - // For now, don't allow profiles with invalid versions load - // We could easily support old version by doing a few version checks below to pick and choose what we load as well. - idLib::Warning( "Profile version did not match. Profile will be replaced" ); - SetDefaults(); - SaveSettings(); // Flag the profile to save so we have the latest version stored - - return false; - } - - // Serialize audio settings - SERIALIZE_BOOL( ser, seenInstallMessage ); - - // New setting to save to make sure that we have or haven't seen this achievement before used to pass TRC R149d - ser.Serialize( achievementBits ); - - ser.Serialize( frameScaleX ); - ser.Serialize( frameScaleY ); - SERIALIZE_BOOL( ser, alwaysRun ); - - - // we save all the cvar-based settings in the profile even though some cvars are archived - // so that we are consistent and don't miss any or get affected when the archive flag is changed - SERIALIZE_CVAR_INT( ser, s_volume_sound ); - SERIALIZE_CVAR_INT( ser, s_volume_midi ); - - // Don't trigger profile save due to modified archived cvars during profile load - cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE ); // must clear because set() is an OR operation, not assignment... - cvarSystem->SetModifiedFlags( flags ); - - return true; -} -/* -======================== -idPlayerProfile::GetLevel -======================== -*/ -int idPlayerProfile::GetLevel() const { - return 1; -} - -/* -======================== -idPlayerProfile::StatSetInt -======================== -*/ -void idPlayerProfile::StatSetInt( int s, int v ) { - stats[s].i = v; -} - -/* -======================== -idPlayerProfile::StatSetFloat -======================== -*/ -void idPlayerProfile::StatSetFloat( int s, float v ) { - stats[s].f = v; -} - -/* -======================== -idPlayerProfile::StatGetInt -======================== -*/ -int idPlayerProfile::StatGetInt( int s ) const { - return stats[s].i; -} - -/* -======================== -idPlayerProfile::StatGetFloat -======================== -*/ -float idPlayerProfile::StatGetFloat( int s ) const { - return stats[s].f; -} - -/* -======================== -idPlayerProfile::SaveSettings -======================== -*/ -void idPlayerProfile::SaveSettings() { - if ( state != SAVING ) { - if ( GetRequestedState() == IDLE ) { - SetRequestedState( SAVE_REQUESTED ); - } - } -} - -/* -======================== -idPlayerProfile::SaveSettings -======================== -*/ -void idPlayerProfile::LoadSettings() { - if ( state != LOADING ) { - if ( verify( GetRequestedState() == IDLE ) ) { - SetRequestedState( LOAD_REQUESTED ); - } - } -} - -/* -======================== -idPlayerProfile::SetAchievementBit -======================== -*/ -void idPlayerProfile::SetAchievementBit( const int id ) { - if ( id > 63 ) { - assert( false ); // FIXME: add another set of achievement bit flags - return; - } - - achievementBits |= (int64)1 << id; -} - -/* -======================== -idPlayerProfile::ClearAchievementBit -======================== -*/ -void idPlayerProfile::ClearAchievementBit( const int id ) { - if ( id > 63 ) { - assert( false ); // FIXME: add another set of achievement bit flags - return; - } - - achievementBits &= ~( (int64)1 << id ); -} - -/* -======================== -idPlayerProfile::GetAchievementBit -======================== -*/ -bool idPlayerProfile::GetAchievementBit( const int id ) const { - if ( id > 63 ) { - assert( false ); // FIXME: add another set of achievement bit flags - return false; - } - - return ( achievementBits & (int64)1 << id ) != 0; -} - -/* -======================== -Returns the value stored in the music volume cvar. -======================== -*/ -int idPlayerProfile::GetMusicVolume() const { - return s_volume_midi.GetInteger(); -} - -/* -======================== -Returns the value stored in the sound volume cvar. -======================== -*/ -int idPlayerProfile::GetSoundVolume() const { - return s_volume_sound.GetInteger(); -} - -/* -======================== -Sets the music volume cvar. -======================== -*/ -void idPlayerProfile::SetMusicVolume( int volume ) { - s_volume_midi.SetInteger( volume ); -} - -/* -======================== -Sets the sound volume cvar. -======================== -*/ -void idPlayerProfile::SetSoundVolume( int volume ) { - s_volume_sound.SetInteger( volume ); -} diff --git a/doomclassic/doom/PlayerProfile.h b/doomclassic/doom/PlayerProfile.h deleted file mode 100644 index 0946d98a..00000000 --- a/doomclassic/doom/PlayerProfile.h +++ /dev/null @@ -1,267 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#ifndef __PLAYERPROFILE_H__ -#define __PLAYERPROFILE_H__ - -#include "Precompiled.h" -#include "Serializer.h" -//#include "SaveGameManager.h" - -#define MAX_PROFILE_SIZE ( 1024 * 1000 ) // High number for the key bindings - -#define SAVEGAME_PROFILE_FILENAME "_PROF" - - -extern idCVar s_volume_sound; -extern idCVar s_volume_midi; - - -class idSaveGameProcessorSaveProfile; -class idSaveGameProcessorLoadProfile; -class idPlayerProfile; - -/* -================================================ -idProfileMgr -================================================ -*/ -class idProfileMgr { -public: - idProfileMgr(); - ~idProfileMgr(); - - // Called the first time it's asked to load - void Init( idPlayerProfile * profile ); - - void Pump(); - idPlayerProfile * GetProfile(); - -private: - void LoadSettings(); - void SaveSettings(); - -private: - idSaveGameProcessorSaveProfile * profileSaveProcessor; - idSaveGameProcessorLoadProfile * profileLoadProcessor; - idPlayerProfile * profile; - saveGameHandle_t handle; -}; - -/* -================================================ -idSaveGameProcessorSaveProfile -================================================ -*/ -class idSaveGameProcessorSaveProfile : public idSaveGameProcessor { -public: - DEFINE_CLASS( idSaveGameProcessorSaveProfile ); - - idSaveGameProcessorSaveProfile(); - - bool InitSaveProfile( idPlayerProfile * profile, const char * folder ); - virtual bool Process(); - -private: - idFile_Memory * profileFile; - idFile_Memory * staticScreenshotFile; - idPlayerProfile * profile; -}; - -/* -================================================ -idSaveGameProcessorLoadProfile -================================================ -*/ -class idSaveGameProcessorLoadProfile: public idSaveGameProcessor { -public: - DEFINE_CLASS( idSaveGameProcessorLoadProfile ); - - idSaveGameProcessorLoadProfile(); - ~idSaveGameProcessorLoadProfile(); - - bool InitLoadProfile( idPlayerProfile * profile, const char * folder ); - virtual bool Process(); - virtual void PostProcess(); - -private: - idFile_Memory * profileFile; - idPlayerProfile * profile; -}; - -/* -================================================ -profileStatValue_t -================================================ -*/ -union profileStatValue_t { - int i; - float f; -}; - -/* -================================================ -idPlayerProfile - -The general rule for using cvars for settings is that if you want the player's profile settings to affect the startup -of the game before there is a player associated with the game, use cvars. Example: video & volume settings. -================================================ -*/ -class idPlayerProfile { -public: - static const int MAX_PLAYER_PROFILE_STATS = 500; - - enum state_t { - IDLE = 0, - SAVING, - LOADING, - SAVE_REQUESTED, - LOAD_REQUESTED, - ERR - }; - - enum displayMode_t { - DISPLAY_INVALID = -1, - DISPLAY_WINDOWED, - DISPLAY_FULLSCREEN, - MAX_DISPLAY_MODES - }; - - enum syncTypes_t { - SYNC_INVALID = -1, - SYNC_TEAR, - SYNC_ON, - SYNC_SMART, - MAX_SYNC_COUNT, - }; - -public: - idPlayerProfile(); // don't instantiate. we static_cast the child all over the place - virtual ~idPlayerProfile(); - - //------------------------ - // each game can override but call the parent serialize first - //------------------------ - virtual void SetDefaults(); - virtual void Init(); - virtual bool SerializeSettings( idSerializer & ser ); - - //------------------------ - // each game must override, not an abstract method because we have a static object as a hack... ugh. - //------------------------ - virtual int32 GetProfileTag() { return -1; } - - int GetDeviceNumForProfile() { return deviceNum; } - void SetDeviceNumForProfile( int num ) { deviceNum = num; } - - //------------------------ - void SaveSettings(); - void LoadSettings(); - - state_t GetState() const { return state; } - state_t GetRequestedState() const { return requestedState; } - - //------------------------ - // settings - //------------------------ - float GetFrameScaleX() const { return frameScaleX; } - float GetFrameScaleY() const { return frameScaleY; } - void SetFrameScaleX( float scale ) { frameScaleX = scale; } - void SetFrameScaleY( float scale ) { frameScaleY = scale; } - - int GetMusicVolume() const; - int GetSoundVolume() const; - void SetMusicVolume( int volume ); - void SetSoundVolume( int volume ); - - bool GetAlwaysRun() const { return alwaysRun; } - void SetAlwaysRun( bool set ) { alwaysRun = set; } - - //------------------------ - // misc - //------------------------ - virtual int GetLevel() const; - - void ClearAchievementBit( const int id ); // Should only be called by idLocalUser - bool GetAchievementBit( const int id ) const; - void SetAchievementBit( const int id ); // Should only be called by idLocalUser - - bool GetSeenInstallMessage() const { return seenInstallMessage; } - void SetSeenInstallMessage( bool seen ) { seenInstallMessage = seen; } - - bool HasSavedGame() const { return hasSavedGame; } - void SetHasSavedGame() { hasSavedGame = true; } - -protected: - friend class idLocalUser; - friend class idProfileMgr; - - // used by idLocalUser and internally - void StatSetInt( int s, int v ); - void StatSetFloat( int s, float v ); - int StatGetInt( int s ) const; - float StatGetFloat( int s ) const; - -private: - void SetState( state_t value ) { state = value; } - void SetRequestedState( state_t value ) { requestedState = value; } - -protected: - //------------------------ - // settings - //------------------------ - bool alwaysRun; - int musicVolume; - int soundVolume; - - //------------------------ - // video settings - //------------------------ - float frameScaleX; - float frameScaleY; - - //------------------------ - // state management - //------------------------ - state_t state; - state_t requestedState; - - //------------------------ - // stats are stored in the profile - //------------------------ - idStaticList< profileStatValue_t, MAX_PLAYER_PROFILE_STATS > stats; - - //------------------------ - // misc - //------------------------ - int deviceNum; - bool seenInstallMessage; - uint64 achievementBits; - bool hasSavedGame; -}; - -#endif diff --git a/doomclassic/doom/i_net_ps3.cpp b/doomclassic/doom/i_net_ps3.cpp deleted file mode 100644 index c4a8303c..00000000 --- a/doomclassic/doom/i_net_ps3.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "Precompiled.h" -#include "globaldata.h" - - -#include -#include -#include -#include - -#include - -// Sockets -#include -#include -#include -#include -#include - -#include "i_system.h" -#include "d_event.h" -#include "d_net.h" -#include "m_argv.h" - -#include "doomstat.h" - -#include "i_net.h" - -#include "doomlib.h" -#include "../Main/Main.h" - -void NetSend (void); -qboolean NetListen (void); - -namespace { - bool IsValidSocket( int socketDescriptor ); - int GetLastSocketError(); - - - - /* - ======================== - Returns true if the socket is valid. I made this function to help abstract the differences - between WinSock (used on Xbox) and BSD sockets, which the PS3 follows more closely. - ======================== - */ - bool IsValidSocket( int socketDescriptor ) { - return socketDescriptor >= 0; - } - - /* - ======================== - Returns the last error reported by the platform's socket library. - ======================== - */ - int GetLastSocketError() { - return sys_net_errno; - } -} - -// -// NETWORKING -// -int DOOMPORT = 1002; // DHM - Nerve :: On original XBox, ports 1000 - 1255 saved you a byte on every packet. 360 too? - - -unsigned long GetServerIP() { - return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr; -} - -void (*netget) (void); -void (*netsend) (void); - - -// -// UDPsocket -// -int UDPsocket (void) -{ - int s; - - // allocate a socket - s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if ( !IsValidSocket( s ) ) { - int err = GetLastSocketError(); - I_Error( "can't create socket, error %d", err ); - } - - return s; -} - -// -// BindToLocalPort -// -void BindToLocalPort( int s, int port ) -{ - int v; - struct sockaddr_in address; - - memset (&address, 0, sizeof(address)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = INADDR_ANY; - address.sin_port = port; - - v = bind (s, (sockaddr*)&address, sizeof(address)); - //if (v == -1) - //I_Error ("BindToPort: bind: %s", strerror(errno)); -} - - -// -// PacketSend -// -void PacketSend (void) -{ - int c; - doomdata_t sw; - - // byte swap - sw.checksum = htonl(::g->netbuffer->checksum); - sw.sourceDest = DoomLib::BuildSourceDest(::g->doomcom.remotenode); - sw.player = ::g->netbuffer->player; - sw.retransmitfrom = ::g->netbuffer->retransmitfrom; - sw.starttic = ::g->netbuffer->starttic; - sw.numtics = ::g->netbuffer->numtics; - for (c=0 ; c< ::g->netbuffer->numtics ; c++) - { - sw.cmds[c].forwardmove = ::g->netbuffer->cmds[c].forwardmove; - sw.cmds[c].sidemove = ::g->netbuffer->cmds[c].sidemove; - sw.cmds[c].angleturn = htons(::g->netbuffer->cmds[c].angleturn); - sw.cmds[c].consistancy = htons(::g->netbuffer->cmds[c].consistancy); - sw.cmds[c].buttons = ::g->netbuffer->cmds[c].buttons; - } - - // Send Socket - { - //DWORD num_sent; - - //if ( globalNetworking ) { - // c = WSASendTo(::g->sendsocket, &buffer, 1, &num_sent, 0, (sockaddr*)&::g->sendaddress[::g->doomcom.remotenode], - // sizeof(::g->sendaddress[::g->doomcom.remotenode]), 0, 0); - //} else { - c = DoomLib::Send( (char*)&sw, ::g->doomcom.datalength, (sockaddr_in*)&::g->sendaddress[::g->doomcom.remotenode], ::g->doomcom.remotenode ); - //} - } -} - - -// -// PacketGet -// -void PacketGet (void) -{ - int i; - int c; - struct sockaddr_in fromaddress; - int fromlen; - doomdata_t sw; - DWORD num_recieved; //, flags = 0; - - // Try and read a socket - //buffer.buf = (char*)&sw; - //buffer.len = sizeof(sw); - fromlen = sizeof(fromaddress); - - //if ( globalNetworking ) { - // c = WSARecvFrom(::g->insocket, &buffer, 1, &num_recieved, &flags, (struct sockaddr*)&fromaddress, &fromlen, 0, 0); - //} else { - c = DoomLib::Recv( (char*)&sw, &num_recieved ); - //} - if ( c < 0 ) - { - /*if ( globalNetworking ) { - int err = WSAGetLastError(); - if (err != WSAEWOULDBLOCK) - I_Error ("GetPacket: %s",strerror(errno)); - }*/ - - ::g->doomcom.remotenode = -1; // no packet - return; - } - - - - // find remote node number - /*for (i=0 ; i<::g->doomcom.numnodes ; i++) - if ( fromaddress.sin_addr.s_addr == ::g->sendaddress[i].sin_addr.s_addr ) - break; - - if (i == ::g->doomcom.numnodes) - { - // packet is not from one of the ::g->players (new game broadcast) - ::g->doomcom.remotenode = -1; // no packet - return; - }*/ - - //if ( ::g->consoleplayer == 1 ) { - //int x = 0; - //} - - int source; - int dest; - DoomLib::GetSourceDest( sw.sourceDest, &source, &dest ); - - i = source; - - //if ( ::g->consoleplayer == 1 ) { - //if ( i == 2 ) { - //int suck = 0; - //} - //} - - ::g->doomcom.remotenode = i; // good packet from a game player - ::g->doomcom.datalength = (short)num_recieved; - - // byte swap - ::g->netbuffer->checksum = ntohl(sw.checksum); - ::g->netbuffer->player = sw.player; - ::g->netbuffer->retransmitfrom = sw.retransmitfrom; - ::g->netbuffer->starttic = sw.starttic; - ::g->netbuffer->numtics = sw.numtics; - - for ( c = 0; c < ::g->netbuffer->numtics; c++ ) - { - ::g->netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove; - ::g->netbuffer->cmds[c].sidemove = sw.cmds[c].sidemove; - ::g->netbuffer->cmds[c].angleturn = ntohs(sw.cmds[c].angleturn); - ::g->netbuffer->cmds[c].consistancy = ntohs(sw.cmds[c].consistancy); - ::g->netbuffer->cmds[c].buttons = sw.cmds[c].buttons; - } -} - -static int I_TrySetupNetwork(void) -{ - // DHM - Moved to Session - return 1; -} - -// -// I_InitNetwork -// -void I_InitNetwork (void) -{ - - //qboolean trueval = true; - int i; - int p; - //int a = 0; - // struct hostent* hostentry; // host information entry - - memset (&::g->doomcom, 0, sizeof(::g->doomcom) ); - - // set up for network - i = M_CheckParm ("-dup"); - if (i && i< ::g->myargc-1) - { - ::g->doomcom.ticdup = ::g->myargv[i+1][0]-'0'; - if (::g->doomcom.ticdup < 1) - ::g->doomcom.ticdup = 1; - if (::g->doomcom.ticdup > 9) - ::g->doomcom.ticdup = 9; - } - else - ::g->doomcom.ticdup = 1; - - if (M_CheckParm ("-extratic")) - ::g->doomcom.extratics = 1; - else - ::g->doomcom.extratics = 0; - - p = M_CheckParm ("-port"); - if (p && p < ::g->myargc-1) - { - DOOMPORT = atoi (::g->myargv[p+1]); - I_Printf ("using alternate port %i\n",DOOMPORT); - } - - // parse network game options, - // -net <::g->consoleplayer> ... - i = M_CheckParm ("-net"); - if (!i || !I_TrySetupNetwork()) - { - // single player game - ::g->netgame = false; - ::g->doomcom.id = DOOMCOM_ID; - ::g->doomcom.numplayers = ::g->doomcom.numnodes = 1; - ::g->doomcom.deathmatch = false; - ::g->doomcom.consoleplayer = 0; - return; - } - - netsend = PacketSend; - netget = PacketGet; - - ::g->netgame = true; - - { - ++i; // skip the '-net' - ::g->doomcom.numnodes = 0; - ::g->doomcom.consoleplayer = atoi( ::g->myargv[i] ); - // skip the console number - ++i; - ::g->doomcom.numnodes = 0; - for (; i < ::g->myargc; ++i) - { - ::g->sendaddress[::g->doomcom.numnodes].sin_family = AF_INET; - ::g->sendaddress[::g->doomcom.numnodes].sin_port = htons(DOOMPORT); - - // Pull out the port number. - const std::string ipAddressWithPort( ::g->myargv[i] ); - const std::size_t colonPosition = ipAddressWithPort.find_last_of(':'); - std::string ipOnly; - - if( colonPosition != std::string::npos && colonPosition + 1 < ipAddressWithPort.size() ) { - const std::string portOnly( ipAddressWithPort.substr( colonPosition + 1 ) ); - - ::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( atoi( portOnly.c_str() ) ); - - ipOnly = ipAddressWithPort.substr( 0, colonPosition ); - } else { - // Assume the address doesn't include a port. - ipOnly = ipAddressWithPort; - } - - in_addr_t ipAddress = inet_addr( ipOnly.c_str() ); - - if ( ipAddress == INADDR_NONE ) { - I_Error( "Invalid IP Address: %s\n", ipOnly.c_str() ); - session->QuitMatch(); - common->AddDialog( GDM_OPPONENT_CONNECTION_LOST, DIALOG_ACCEPT, NULL, NULL, false ); - } - ::g->sendaddress[::g->doomcom.numnodes].sin_addr.s_addr = ipAddress; - ::g->doomcom.numnodes++; - } - - ::g->doomcom.id = DOOMCOM_ID; - ::g->doomcom.numplayers = ::g->doomcom.numnodes; - } - - if ( globalNetworking ) { - // Setup sockets - ::g->insocket = UDPsocket (); - BindToLocalPort (::g->insocket,htons(DOOMPORT)); - - // PS3 call to enable non-blocking mode - int nonblocking = 1; // Non-zero is nonblocking mode. - setsockopt( ::g->insocket, SOL_SOCKET, SO_NBIO, &nonblocking, sizeof(nonblocking)); - - ::g->sendsocket = UDPsocket (); - - I_Printf( "[+] Setting up sockets for player %d\n", DoomLib::GetPlayer() ); - } -} - -// DHM - Nerve -void I_ShutdownNetwork( void ) { - if ( globalNetworking && gameLocal != NULL ) { - - int curPlayer = DoomLib::GetPlayer(); - - for (int player = 0; player < gameLocal->Interface.GetNumPlayers(); ++player) - { - DoomLib::SetPlayer( player ); - - if ( IsValidSocket( ::g->insocket ) ) { - I_Printf( "[-] Shut down insocket for player %d\n", DoomLib::GetPlayer() ); - shutdown( ::g->insocket, SHUT_RDWR ); - socketclose( ::g->insocket ); - } - if ( IsValidSocket( ::g->sendsocket ) ) { - I_Printf( "[-] Shut down sendsocket for player %d\n", DoomLib::GetPlayer() ); - shutdown( ::g->sendsocket, SHUT_RDWR ); - socketclose( ::g->sendsocket ); - } - } - - DoomLib::SetPlayer(curPlayer); - - globalNetworking = false; - } -} - -void I_NetCmd (void) -{ - if (::g->doomcom.command == CMD_SEND) - { - netsend (); - } - else if (::g->doomcom.command == CMD_GET) - { - netget (); - } - else - I_Error ("Bad net cmd: %i\n",::g->doomcom.command); -} - diff --git a/doomclassic/doom/i_net_xbox.cpp b/doomclassic/doom/i_net_xbox.cpp deleted file mode 100644 index f554c032..00000000 --- a/doomclassic/doom/i_net_xbox.cpp +++ /dev/null @@ -1,365 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "Precompiled.h" -#include "globaldata.h" - - -#include -#include -#include - -#include - -#include "i_system.h" -#include "d_event.h" -#include "d_net.h" -#include "m_argv.h" - -#include "doomstat.h" - -#include "i_net.h" - -#include "doomlib.h" -#include "../Main/Main.h" - -void NetSend (void); -qboolean NetListen (void); - -// -// NETWORKING -// -int DOOMPORT = 1002; // DHM - Nerve :: On original XBox, ports 1000 - 1255 saved you a byte on every packet. 360 too? - - - -unsigned long GetServerIP() { return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr; } - -void (*netget) (void); -void (*netsend) (void); - - -// -// UDPsocket -// -int UDPsocket (void) -{ - int s; - - // allocate a socket - s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s == INVALID_SOCKET) { - int err = WSAGetLastError (); - I_Error ("can't create socket: %s",strerror(errno)); - } - - return s; -} - -// -// BindToLocalPort -// -void BindToLocalPort( int s, int port ) -{ - int v; - struct sockaddr_in address; - - memset (&address, 0, sizeof(address)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = INADDR_ANY; - address.sin_port = port; - - v = bind (s, (sockaddr*)&address, sizeof(address)); - //if (v == -1) - //I_Error ("BindToPort: bind: %s", strerror(errno)); -} - - -// -// PacketSend -// -void PacketSend (void) -{ - int c; - doomdata_t sw; - - // byte swap - sw.checksum = htonl(::g->netbuffer->checksum); - sw.sourceDest = DoomLib::BuildSourceDest(::g->doomcom.remotenode); - sw.player = ::g->netbuffer->player; - sw.retransmitfrom = ::g->netbuffer->retransmitfrom; - sw.starttic = ::g->netbuffer->starttic; - sw.numtics = ::g->netbuffer->numtics; - for (c=0 ; c< ::g->netbuffer->numtics ; c++) - { - sw.cmds[c].forwardmove = ::g->netbuffer->cmds[c].forwardmove; - sw.cmds[c].sidemove = ::g->netbuffer->cmds[c].sidemove; - sw.cmds[c].angleturn = htons(::g->netbuffer->cmds[c].angleturn); - //sw.cmds[c].consistancy = htons(::g->netbuffer->cmds[c].consistancy); - sw.cmds[c].buttons = ::g->netbuffer->cmds[c].buttons; - } - - // Send Socket - { - //DWORD num_sent; - WSABUF buffer; - - buffer.buf = (char*)&sw; - buffer.len = ::g->doomcom.datalength; - - //if ( globalNetworking ) { - // c = WSASendTo(::g->sendsocket, &buffer, 1, &num_sent, 0, (sockaddr*)&::g->sendaddress[::g->doomcom.remotenode], - // sizeof(::g->sendaddress[::g->doomcom.remotenode]), 0, 0); - //} else { - c = DoomLib::Send( buffer.buf, buffer.len, (sockaddr_in*)&::g->sendaddress[::g->doomcom.remotenode], ::g->doomcom.remotenode ); - //} - } -} - - -// -// PacketGet -// -void PacketGet (void) -{ - int i; - int c; - struct sockaddr_in fromaddress; - int fromlen; - doomdata_t sw; - WSABUF buffer; - DWORD num_recieved, flags = 0; - - // Try and read a socket - buffer.buf = (char*)&sw; - buffer.len = sizeof(sw); - fromlen = sizeof(fromaddress); - - //if ( globalNetworking ) { - // c = WSARecvFrom(::g->insocket, &buffer, 1, &num_recieved, &flags, (struct sockaddr*)&fromaddress, &fromlen, 0, 0); - //} else { - c = DoomLib::Recv( (char*)&sw, &num_recieved ); - //} - if (c == SOCKET_ERROR ) - { - /*if ( globalNetworking ) { - int err = WSAGetLastError(); - if (err != WSAEWOULDBLOCK) - I_Error ("GetPacket: %s",strerror(errno)); - }*/ - - ::g->doomcom.remotenode = -1; // no packet - return; - } - - - - // find remote node number - /*for (i=0 ; i<::g->doomcom.numnodes ; i++) - if ( fromaddress.sin_addr.s_addr == ::g->sendaddress[i].sin_addr.s_addr ) - break; - - if (i == ::g->doomcom.numnodes) - { - // packet is not from one of the ::g->players (new game broadcast) - ::g->doomcom.remotenode = -1; // no packet - return; - }*/ - - //if ( ::g->consoleplayer == 1 ) { - //int x = 0; - //} - - int source; - int dest; - DoomLib::GetSourceDest( sw.sourceDest, &source, &dest ); - - i = source; - - //if ( ::g->consoleplayer == 1 ) { - //if ( i == 2 ) { - //int suck = 0; - //} - //} - - ::g->doomcom.remotenode = i; // good packet from a game player - ::g->doomcom.datalength = (short)num_recieved; - - // byte swap - ::g->netbuffer->checksum = ntohl(sw.checksum); - ::g->netbuffer->player = sw.player; - ::g->netbuffer->retransmitfrom = sw.retransmitfrom; - ::g->netbuffer->starttic = sw.starttic; - ::g->netbuffer->numtics = sw.numtics; - - for (c=0 ; c< ::g->netbuffer->numtics ; c++) - { - ::g->netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove; - ::g->netbuffer->cmds[c].sidemove = sw.cmds[c].sidemove; - ::g->netbuffer->cmds[c].angleturn = ntohs(sw.cmds[c].angleturn); - //::g->netbuffer->cmds[c].consistancy = ntohs(sw.cmds[c].consistancy); - ::g->netbuffer->cmds[c].buttons = sw.cmds[c].buttons; - } -} - -static int I_TrySetupNetwork(void) -{ - // DHM - Moved to Session - return 1; -} - -// -// I_InitNetwork -// -void I_InitNetwork (void) -{ - qboolean trueval = true; - int i; - int p; - int a = 0; - // struct hostent* hostentry; // host information entry - - memset (&::g->doomcom, 0, sizeof(::g->doomcom) ); - - // set up for network - i = M_CheckParm ("-dup"); - if (i && i< ::g->myargc-1) - { - ::g->doomcom.ticdup = ::g->myargv[i+1][0]-'0'; - if (::g->doomcom.ticdup < 1) - ::g->doomcom.ticdup = 1; - if (::g->doomcom.ticdup > 9) - ::g->doomcom.ticdup = 9; - } - else - ::g->doomcom.ticdup = 1; - - if (M_CheckParm ("-extratic")) - ::g->doomcom.extratics = 1; - else - ::g->doomcom.extratics = 0; - - p = M_CheckParm ("-port"); - if (p && p<::g->myargc-1) - { - DOOMPORT = atoi (::g->myargv[p+1]); - I_Printf ("using alternate port %i\n",DOOMPORT); - } - - // parse network game options, - // -net <::g->consoleplayer> ... - i = M_CheckParm ("-net"); - if (!i || !I_TrySetupNetwork()) - { - // single player game - ::g->netgame = false; - ::g->doomcom.id = DOOMCOM_ID; - ::g->doomcom.numplayers = ::g->doomcom.numnodes = 1; - ::g->doomcom.deathmatch = false; - ::g->doomcom.consoleplayer = 0; - return; - } - - netsend = PacketSend; - netget = PacketGet; - - ::g->netgame = true; - - { - ++i; // skip the '-net' - ::g->doomcom.numnodes = 0; - ::g->doomcom.consoleplayer = atoi( ::g->myargv[i] ); - // skip the console number - ++i; - ::g->doomcom.numnodes = 0; - for (; i < ::g->myargc; ++i) - { - ::g->sendaddress[::g->doomcom.numnodes].sin_family = AF_INET; - ::g->sendaddress[::g->doomcom.numnodes].sin_port = htons(DOOMPORT); - ::g->sendaddress[::g->doomcom.numnodes].sin_addr.s_addr = inet_addr (::g->myargv[i]);//39, 17 - ::g->doomcom.numnodes++; - } - - ::g->doomcom.id = DOOMCOM_ID; - ::g->doomcom.numplayers = ::g->doomcom.numnodes; - } - - if ( globalNetworking ) { - // Setup sockets - ::g->insocket = UDPsocket (); - BindToLocalPort (::g->insocket,htons(DOOMPORT)); - ioctlsocket (::g->insocket, FIONBIO, (u_long*)&trueval); - - ::g->sendsocket = UDPsocket (); - - I_Printf( "[+] Setting up sockets for player %d\n", DoomLib::GetPlayer() ); - } -} - -// DHM - Nerve -void I_ShutdownNetwork( void ) { - if ( globalNetworking ) { - - int curPlayer = DoomLib::GetPlayer(); - - for (int player = 0; player < App->Game->Interface.GetNumPlayers(); ++player) - { - DoomLib::SetPlayer( player ); - - if ( ::g->insocket != INVALID_SOCKET ) { - I_Printf( "[-] Shut down insocket for player %d\n", DoomLib::GetPlayer() ); - shutdown( ::g->insocket, SD_BOTH ); - closesocket( ::g->insocket ); - } - if ( ::g->sendsocket != INVALID_SOCKET ) { - I_Printf( "[-] Shut down sendsocket for player %d\n", DoomLib::GetPlayer() ); - shutdown( ::g->sendsocket, SD_BOTH ); - closesocket( ::g->sendsocket ); - } - } - - DoomLib::SetPlayer(curPlayer); - - globalNetworking = false; - } -} - -void I_NetCmd (void) -{ - if (::g->doomcom.command == CMD_SEND) - { - netsend (); - } - else if (::g->doomcom.command == CMD_GET) - { - netget (); - } - else - I_Error ("Bad net cmd: %i\n",::g->doomcom.command); -} - diff --git a/doomclassic/doom/i_video_xbox.cpp b/doomclassic/doom/i_video_xbox.cpp deleted file mode 100644 index 45772f83..00000000 --- a/doomclassic/doom/i_video_xbox.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "Precompiled.h" -#include "globaldata.h" - -#include -#include -#include -#include - -#include "i_video.h" -#include "i_system.h" - -#include "doomstat.h" -#include "v_video.h" -#include "m_argv.h" -#include "d_main.h" - -#include "doomdef.h" - -//#include // SMF -//#include // SMF - - - - - -void I_ShutdownGraphics(void) -{ - // VVTODO: Shutdown Graphics -} - - - -// -// I_StartFrame -// -void I_StartFrame (void) -{ - // er? -} - -static void I_CombineMouseEvent(const event_t* in, event_t* out) -{ - if (fabs((float)in->data1) > fabs((float)out->data1)) - out->data1 = in->data1; - if (fabs((float)in->data2) > fabs((float)out->data2)) - out->data2 = in->data2; - if (fabs((float)in->data3) > fabs((float)out->data3)) - out->data3 = in->data3; -} - -void I_GetEvents( controller_t *controller ) -{ - event_t e_mouse, e_joystick; - int numEvents; - - e_mouse.type = ev_mouse; - e_mouse.data1 = e_mouse.data2 = e_mouse.data3 = 0; - e_joystick.type = ev_joystick; - e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0; - - numEvents = I_PollMouseInputEvents( controller ); - if (numEvents) - { - int i; - event_t e; - - // right thumb stick - for (i = 0; i < numEvents; ++i) - { - I_ReturnMouseInputEvent(i, &e); - if (e.type == ev_mouse) - I_CombineMouseEvent(&e, &e_mouse); - else if (e.type == ev_joystick) - I_CombineMouseEvent(&e, &e_joystick); - } - } - - numEvents = I_PollJoystickInputEvents( controller ); - if (numEvents) - { - int i; - event_t e; - for (i = 0; i < numEvents; ++i) - { - I_ReturnJoystickInputEvent(i, &e); - if (e.type == ev_keydown || e.type == ev_keyup) { - D_PostEvent(&e); - } else if (e.type == ev_joystick) { - I_CombineMouseEvent(&e, &e_joystick); - } else if (e.type == ev_mouse) { - I_CombineMouseEvent(&e, &e_mouse); - } - } - } - - D_PostEvent(&e_mouse); - D_PostEvent(&e_joystick); -} - -// -// I_UpdateNoBlit -// -void I_UpdateNoBlit (void) -{ - // what is this? -} - -// -// I_FinishUpdate -// -void I_FinishUpdate (void) -{ -// DHM - These buffers are not used -} - - -// -// I_ReadScreen -// -void I_ReadScreen (byte* scr) -{ - XMemCpy(scr, ::g->screens[0], SCREENWIDTH*SCREENHEIGHT); -} - -// -// I_SetPalette -// -void I_SetPalette (byte* palette) -{ - int i; - - // set the X colormap entries - for (i=0 ; i<256 ; i++) - { - int r,b,g; - r = gammatable[::g->usegamma][*palette++]; - g = gammatable[::g->usegamma][*palette++]; - b = gammatable[::g->usegamma][*palette++]; - ::g->XColorMap[i] = D3DCOLOR_ARGB(0xff, r, g, b); - } -} - -void I_InitGraphics() -{ -} - diff --git a/doomclassic/doom/wi_stuff.cpp b/doomclassic/doom/wi_stuff.cpp index f0c41444..660bb8e5 100644 --- a/doomclassic/doom/wi_stuff.cpp +++ b/doomclassic/doom/wi_stuff.cpp @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms #include "Main.h" #include "sys/sys_session.h" #include "sys/sys_signin.h" -#include "DoomLeaderboards.h" +//#include "DoomLeaderboards.h" #include "d3xp/Game_Local.h" diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt new file mode 100644 index 00000000..63c7dc25 --- /dev/null +++ b/neo/CMakeLists.txt @@ -0,0 +1,962 @@ +cmake_minimum_required(VERSION 2.8) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +project(RBDoom3) + +option(USE_MFC_TOOLS + "Compile the built-in MFC based tools" OFF) + +option(MONOLITH + "Embed game logic into main executable" ON) + +#option(STANDALONE +# "Skip Doom 3 base/ folder" ON) + + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_definitions(-pipe) + add_definitions(-Wall) + + #set(CMAKE_C_FLAGS_DEBUG "-D_DEBUG") + +elseif(MSVC) + + # Multiprocessor support for compiling + # /MP + + # Inline Function Expansion: Any Suitable (/Ob2) + # "/Ob2", + + # enable Intrinsic Functions + # "/Oi", + + # Omit Frame Pointers + # "/Oy", + + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /D _DEBUG /MP") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MP /Oi /Oy") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MP /Oi") + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MP /Oi /Oy") + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /Oi /Oy") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP /Oi /Oy") + + add_definitions(-DWIN32 + -D_WINDOWS + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_USE_32BIT_TIME_T + -D_MBCS + #-DUSE_OPENAL + -DUSE_EXCEPTIONS) + + if(USE_MFC_TOOLS) + add_definitions(-D_AFXDLL) + + # 0: Use Standard Windows Libraries + # 1: Use MFC in a Static Library + # 2: Use MFC in a Shared DLL + set(CMAKE_MFC_FLAG 2) + endif() +endif() + +#if(STANDALONE) +# add_definitions(-DSTANDALONE) +#endif() + +add_subdirectory(idlib) + +file(GLOB AAS_INCLUDES aas/*.h) +file(GLOB AAS_SOURCES aas/*.cpp) + +file(GLOB_RECURSE CM_INCLUDES cm/*.h) +file(GLOB_RECURSE CM_SOURCES cm/*.cpp) + +file(GLOB FRAMEWORK_INCLUDES framework/*.h) +file(GLOB FRAMEWORK_SOURCES framework/*.cpp) + +file(GLOB FRAMEWORK_ASYNC_INCLUDES framework/async/*.h) +file(GLOB FRAMEWORK_ASYNC_SOURCES framework/async/*.cpp) + +file(GLOB_RECURSE RENDERER_INCLUDES renderer/*.h) + # renderer/AutoRender.h + # renderer/AutoRenderBink.h + # renderer/BinaryImage.h + # renderer/BinaryImageData.h + # renderer/BoundsTrack.h + # renderer/BufferObject.h + # renderer/Cinematic.h + # renderer/Font.h + # renderer/GLMatrix.h + # renderer/GLState.h + # renderer/GuiModel.h + # renderer/Image.h + # renderer/ImageOpts.h + # renderer/Interaction.h + # renderer/Material.h + # renderer/Model.h + # renderer/ModelDecal.h + # renderer/ModelManager.h + # renderer/ModelOverlay.h + # renderer/Model_ase.h + # #renderer/Model_ColladaHelper.h + # #renderer/Model_ColladaParser.h + # renderer/Model_local.h + # renderer/Model_lwo.h + # renderer/Model_ma.h + # renderer/Model_md3.h + # renderer/RenderLog.h + # renderer/RenderProgs.h + # renderer/RenderSystem.h + # renderer/RenderTexture.h + # renderer/RenderWorld.h + # renderer/RenderWorld_local.h + # renderer/ResolutionScale.h + # renderer/ScreenRect.h + # renderer/simplex.h + # renderer/tr_local.h + # renderer/VertexCache.h) + + +file(GLOB_RECURSE RENDERER_SOURCES renderer/*.cpp) + # renderer/AutoRender.cpp + # renderer/Cinematic.cpp + # renderer/Framebuffer.cpp + # renderer/GLShader.cpp + # renderer/GuiModel.cpp + # renderer/Image_files.cpp + # renderer/Image_init.cpp + # renderer/Image_load.cpp + # renderer/Image_process.cpp + # renderer/Image_program.cpp + # renderer/Interaction.cpp + # renderer/Material.cpp + # renderer/Model.cpp + # renderer/ModelDecal.cpp + # renderer/ModelManager.cpp + # renderer/ModelOverlay.cpp + # renderer/Model_ase.cpp + # renderer/Model_beam.cpp + # #renderer/Model_ColladaParser.cpp + # renderer/Model_liquid.cpp + # renderer/Model_lwo.cpp + # renderer/Model_ma.cpp + # renderer/Model_md3.cpp + # renderer/Model_md5.cpp + # renderer/Model_prt.cpp + # renderer/Model_sprite.cpp + # renderer/RenderEntity.cpp + # renderer/RenderSystem.cpp + # renderer/RenderSystem_init.cpp + # renderer/RenderWorld.cpp + # renderer/RenderWorld_demo.cpp + # renderer/RenderWorld_load.cpp + # renderer/RenderWorld_portals.cpp + # renderer/VertexCache.cpp + # renderer/draw_arb.cpp + # renderer/draw_arb2.cpp + # renderer/draw_glsl.cpp + # renderer/draw_common.cpp + # renderer/draw_exp.cpp + # renderer/draw_nv10.cpp + # renderer/draw_nv20.cpp + # renderer/draw_r200.cpp + # renderer/tr_backend.cpp + # renderer/tr_deform.cpp + # renderer/tr_font.cpp + # renderer/tr_guisurf.cpp + # renderer/tr_light.cpp + # renderer/tr_lightrun.cpp + # renderer/tr_main.cpp + # renderer/tr_math.cpp + # renderer/tr_orderIndexes.cpp + # renderer/tr_polytope.cpp + # renderer/tr_render.cpp + # renderer/tr_rendertools.cpp + # renderer/tr_shadowbounds.cpp + # renderer/tr_stencilshadow.cpp + # renderer/tr_subview.cpp + # renderer/tr_trace.cpp + # renderer/tr_trisurf.cpp + # renderer/tr_turboshadow.cpp) + + +file(GLOB IRRXML_INCLUDES libs/irrxml/src/*.h) +file(GLOB IRRXML_SOURCES libs/irrxml/src/*.cpp) + +set(JPEG_INCLUDES + libs/jpeg-6/jchuff.h + libs/jpeg-6/jconfig.h + libs/jpeg-6/jdct.h + libs/jpeg-6/jdhuff.h + libs/jpeg-6/jerror.h + libs/jpeg-6/jinclude.h + libs/jpeg-6/jmemsys.h + libs/jpeg-6/jmorecfg.h + libs/jpeg-6/jpegint.h + libs/jpeg-6/jpeglib.h + libs/jpeg-6/jversion.h) + +set(JPEG_SOURCES + libs/jpeg-6/jcapimin.cpp + libs/jpeg-6/jcapistd.cpp + libs/jpeg-6/jccoefct.cpp + libs/jpeg-6/jccolor.cpp + libs/jpeg-6/jcdctmgr.cpp + libs/jpeg-6/jchuff.cpp + libs/jpeg-6/jcinit.cpp + libs/jpeg-6/jcmainct.cpp + libs/jpeg-6/jcmarker.cpp + libs/jpeg-6/jcmaster.cpp + libs/jpeg-6/jcomapi.cpp + libs/jpeg-6/jcparam.cpp + libs/jpeg-6/jcphuff.cpp + libs/jpeg-6/jcprepct.cpp + libs/jpeg-6/jcsample.cpp + libs/jpeg-6/jctrans.cpp + libs/jpeg-6/jdapimin.cpp + libs/jpeg-6/jdapistd.cpp + libs/jpeg-6/jdatadst.cpp + libs/jpeg-6/jdatasrc.cpp + libs/jpeg-6/jdcoefct.cpp + libs/jpeg-6/jdcolor.cpp + libs/jpeg-6/jddctmgr.cpp + libs/jpeg-6/jdhuff.cpp + libs/jpeg-6/jdinput.cpp + libs/jpeg-6/jdmainct.cpp + libs/jpeg-6/jdmarker.cpp + libs/jpeg-6/jdmaster.cpp + libs/jpeg-6/jdmerge.cpp + libs/jpeg-6/jdphuff.cpp + libs/jpeg-6/jdpostct.cpp + libs/jpeg-6/jdsample.cpp + libs/jpeg-6/jdtrans.cpp + libs/jpeg-6/jerror.cpp + libs/jpeg-6/jfdctflt.cpp + libs/jpeg-6/jfdctfst.cpp + libs/jpeg-6/jfdctint.cpp + libs/jpeg-6/jidctflt.cpp + libs/jpeg-6/jidctfst.cpp + libs/jpeg-6/jidctint.cpp + libs/jpeg-6/jidctred.cpp + #libs/jpeg-6/jload.cpp + libs/jpeg-6/jmemmgr.cpp + libs/jpeg-6/jmemnobs.cpp + #libs/jpeg-6/jpegtran.cpp + libs/jpeg-6/jquant1.cpp + libs/jpeg-6/jquant2.cpp + libs/jpeg-6/jutils.cpp) + +file(GLOB PNG_INCLUDES libs/png/*.h) +file(GLOB PNG_SOURCES libs/png/*.c) + +file(GLOB ZLIB_INCLUDES libs/zlib/*.h) +file(GLOB ZLIB_SOURCES libs/zlib/*.c) + +set(GLEW_INCLUDES + libs/glew/include/GL/glew.h) + +if(WIN32) + set(GLEW_INCLUDES ${GLEW_INCLUDES} libs/glew/include/GL/wglew.h) +else() + set(GLEW_INCLUDES ${GLEW_INCLUDES} libs/glew/include/GL/glxew.h) +endif() + +set(GLEW_SOURCES + libs/glew/src/glew.c) + +set(FREETYPE_SOURCES + libs/freetype/src/autofit/autofit.c + libs/freetype/src/bdf/bdf.c + libs/freetype/src/cff/cff.c + libs/freetype/src/base/ftbase.c + libs/freetype/src/base/ftbitmap.c + libs/freetype/src/cache/ftcache.c + libs/freetype/src/base/ftdebug.c + libs/freetype/src/base/ftgasp.c + libs/freetype/src/base/ftglyph.c + libs/freetype/src/gzip/ftgzip.c + libs/freetype/src/base/ftinit.c + libs/freetype/src/lzw/ftlzw.c + libs/freetype/src/base/ftstroke.c + libs/freetype/src/base/ftsystem.c + libs/freetype/src/smooth/smooth.c + libs/freetype/src/base/ftbbox.c + libs/freetype/src/base/ftmm.c + libs/freetype/src/base/ftpfr.c + libs/freetype/src/base/ftsynth.c + libs/freetype/src/base/fttype1.c + libs/freetype/src/base/ftwinfnt.c + libs/freetype/src/pcf/pcf.c + libs/freetype/src/pfr/pfr.c + libs/freetype/src/psaux/psaux.c + libs/freetype/src/pshinter/pshinter.c + libs/freetype/src/psnames/psmodule.c + libs/freetype/src/raster/raster.c + libs/freetype/src/sfnt/sfnt.c + libs/freetype/src/truetype/truetype.c + libs/freetype/src/type1/type1.c + libs/freetype/src/cid/type1cid.c + libs/freetype/src/type42/type42.c + libs/freetype/src/winfonts/winfnt.c) + + +set(SOUND_INCLUDES + sound/snd_local.h + sound/sound.h + sound/SoundVoice.h + sound/WaveFile.h) + +set(SOUND_SOURCES + #sound/snd_cache.cpp + #sound/snd_decoder.cpp + #sound/snd_efxfile.cpp + sound/snd_emitter.cpp + sound/snd_shader.cpp + sound/snd_system.cpp + sound/snd_world.cpp + sound/SoundVoice.cpp + sound/WaveFile.cpp + ) + +set(XAUDIO2_INCLUDES + sound/XAudio2/XA2_SoundHardware.h + sound/XAudio2/XA2_SoundSample.h + sound/XAudio2/XA2_SoundVoice.h) + +set(XAUDIO2_SOURCES + sound/XAudio2/XA2_SoundHardware.cpp + sound/XAudio2/XA2_SoundSample.cpp + sound/XAudio2/XA2_SoundVoice.cpp) + +set(OGGVORBIS_INCLUDES + libs/oggvorbis/ogg/ogg.h + libs/oggvorbis/ogg/os_types.h) + +set(OGGVORBIS_SOURCES + libs/oggvorbis/oggsrc/bitwise.c + libs/oggvorbis/oggsrc/framing.c + + libs/oggvorbis/vorbissrc/mdct.c + libs/oggvorbis/vorbissrc/smallft.c + libs/oggvorbis/vorbissrc/block.c + libs/oggvorbis/vorbissrc/envelope.c + libs/oggvorbis/vorbissrc/windowvb.c + libs/oggvorbis/vorbissrc/lsp.c + libs/oggvorbis/vorbissrc/lpc.c + libs/oggvorbis/vorbissrc/analysis.c + libs/oggvorbis/vorbissrc/synthesis.c + libs/oggvorbis/vorbissrc/psy.c + libs/oggvorbis/vorbissrc/info.c + libs/oggvorbis/vorbissrc/floor1.c + libs/oggvorbis/vorbissrc/floor0.c + libs/oggvorbis/vorbissrc/res0.c + libs/oggvorbis/vorbissrc/mapping0.c + libs/oggvorbis/vorbissrc/registry.c + libs/oggvorbis/vorbissrc/codebook.c + libs/oggvorbis/vorbissrc/sharedbook.c + libs/oggvorbis/vorbissrc/lookup.c + libs/oggvorbis/vorbissrc/bitrate.c + libs/oggvorbis/vorbissrc/vorbisfile.c) + +file(GLOB SYS_INCLUDES sys/*.h) +file(GLOB SYS_SOURCES sys/*.cpp) + +file(GLOB UI_INCLUDES ui/*.h) +file(GLOB UI_SOURCES ui/*.cpp) + +file(GLOB SWF_INCLUDES swf/*.h) +file(GLOB SWF_SOURCES swf/*.cpp) + + +set(GAMED3XP_INCLUDES + d3xp/Achievements.h + d3xp/Actor.h + d3xp/AF.h + d3xp/AFEntity.h + d3xp/AimAssist.h + d3xp/BrittleFracture.h + d3xp/Camera.h + #d3xp/EndLevel.h + d3xp/Entity.h + d3xp/Fx.h + d3xp/Game.h + d3xp/GameEdit.h + d3xp/Game_local.h + d3xp/Grabber.h + d3xp/IK.h + d3xp/Item.h + d3xp/Leaderboards.h + d3xp/Light.h + d3xp/Misc.h + d3xp/Moveable.h + d3xp/Mover.h + d3xp/MultiplayerGame.h + d3xp/Player.h + d3xp/PlayerIcon.h + d3xp/PlayerView.h + d3xp/PredictedValue.h + d3xp/Projectile.h + d3xp/Pvs.h + d3xp/SecurityCamera.h + d3xp/SmokeParticles.h + d3xp/Sound.h + d3xp/Target.h + d3xp/Trigger.h + d3xp/Weapon.h + d3xp/WorldSpawn.h) + +set(GAMED3XP_SOURCES + d3xp/Achievements.cpp + d3xp/Actor.cpp + d3xp/AF.cpp + d3xp/AFEntity.cpp + d3xp/AimAssist.cpp + d3xp/BrittleFracture.cpp + d3xp/Camera.cpp + #d3xp/EndLevel.cpp + d3xp/Entity.cpp + d3xp/Fx.cpp + d3xp/GameEdit.cpp + d3xp/Game_local.cpp + d3xp/Game_network.cpp + d3xp/Grabber.cpp + d3xp/IK.cpp + d3xp/Item.cpp + d3xp/Leaderboards.cpp + d3xp/Light.cpp + d3xp/Misc.cpp + d3xp/Moveable.cpp + d3xp/Mover.cpp + d3xp/MultiplayerGame.cpp + d3xp/Player.cpp + d3xp/PlayerIcon.cpp + d3xp/PlayerView.cpp + d3xp/precompiled.cpp + d3xp/Projectile.cpp + d3xp/Pvs.cpp + d3xp/SecurityCamera.cpp + d3xp/SmokeParticles.cpp + d3xp/Sound.cpp + d3xp/Target.cpp + d3xp/Trigger.cpp + d3xp/Weapon.cpp + d3xp/WorldSpawn.cpp) + +file(GLOB GAMED3XP_AI_INCLUDES d3xp/ai/*.h) +file(GLOB GAMED3XP_AI_SOURCES d3xp/ai/*.cpp) + +file(GLOB GAMED3XP_ANIM_INCLUDES d3xp/anim/*.h) +file(GLOB GAMED3XP_ANIM_SOURCES d3xp/anim/*.cpp) + +file(GLOB GAMED3XP_GAMESYS_INCLUDES d3xp/gamesys/*.h) +set(GAMED3XP_GAMESYS_SOURCES + #d3xp/gamesys/Callbacks.cpp + d3xp/gamesys/Class.cpp + #d3xp/gamesys/DebugGraph.cpp + d3xp/gamesys/Event.cpp + d3xp/gamesys/SaveGame.cpp + d3xp/gamesys/SysCmds.cpp + d3xp/gamesys/SysCvar.cpp + #d3xp/gamesys/TypeInfo.cpp + ) + +file(GLOB GAMED3XP_MENUS_INCLUDES d3xp/menus/*.h) +file(GLOB GAMED3XP_MENUS_SOURCES d3xp/menus/*.cpp) + +file(GLOB GAMED3XP_PHYSICS_INCLUDES d3xp/physics/*.h) +file(GLOB GAMED3XP_PHYSICS_SOURCES d3xp/physics/*.cpp) + +file(GLOB GAMED3XP_SCRIPT_INCLUDES d3xp/script/*.h) +file(GLOB GAMED3XP_SCRIPT_SOURCES d3xp/script/*.cpp) + + +file(GLOB COMPILER_INCLUDES tools/compilers/*.h) + +file(GLOB COMPILER_AAS_INCLUDES tools/compilers/aas/*.h) +file(GLOB COMPILER_AAS_SOURCES tools/compilers/aas/*.cpp) + +file(GLOB COMPILER_DMAP_INCLUDES tools/compilers/dmap/*.h) +file(GLOB COMPILER_DMAP_SOURCES tools/compilers/dmap/*.cpp) + +file(GLOB COMPILER_RENDERBUMP_INCLUDES tools/compilers/renderbump/*.h) +file(GLOB COMPILER_RENDERBUMP_SOURCES tools/compilers/renderbump/*.cpp) + +file(GLOB COMPILER_ROQVQ_INCLUDES tools/compilers/roqvq/*.h) +file(GLOB COMPILER_ROQVQ_SOURCES tools/compilers/roqvq/*.cpp) + +set(TOOLS_INCLUDES tools/edit_public.h) + +file(GLOB TOOLS_COMAFX_INCLUDES tools/comafx/*.h) +file(GLOB TOOLS_COMAFX_SOURCES tools/comafx/*.cpp) + +set(TOOLS_COMMON_INCLUDES + tools/common/ColorButton.h + tools/common/DialogHelpers.h + tools/common/MaskEdit.h + tools/common/OpenFileDialog.h + tools/common/PropertyGrid.h + tools/common/RegistryOptions.h + #tools/common/RenderBumpFlatDialog.h + tools/common/RollupPanel.h + tools/common/SpinButton.h) + +set(TOOLS_COMMON_SOURCES + tools/common/AlphaPopup.cpp + tools/common/ColorButton.cpp + tools/common/MaskEdit.cpp + tools/common/OpenFileDialog.cpp + tools/common/PropertyGrid.cpp + tools/common/RegistryOptions.cpp + #tools/common/RenderBumpFlatDialog.cpp + tools/common/RollupPanel.cpp + tools/common/SpinButton.cpp) + +file(GLOB TOOLS_COMMON_PROPTREE_INCLUDES tools/common/PropTree/*.h) +file(GLOB TOOLS_COMMON_PROPTREE_SOURCES tools/common/PropTree/*.cpp) + +file(GLOB EDITOR_AF_INCLUDES tools/af/*.h) +file(GLOB EDITOR_AF_SOURCES tools/af/*.cpp) + +set(EDITOR_DECL_INCLUDES + tools/decl/DialogDeclBrowser.h + tools/decl/DialogDeclEditor.h + tools/decl/DialogDeclNew.h) + +set(EDITOR_DECL_SOURCES + tools/decl/DialogDeclBrowser.cpp + tools/decl/DialogDeclEditor.cpp + tools/decl/DialogDeclNew.cpp) + +file(GLOB EDITOR_DEBUGGER_INCLUDES tools/debugger/*.h) +file(GLOB EDITOR_DEBUGGER_SOURCES tools/debugger/*.cpp) + +file(GLOB EDITOR_GUIED_INCLUDES tools/guied/*.h) +set(EDITOR_GUIED_SOURCES + tools/guied/GEApp.cpp + tools/guied/GECheckInDlg.cpp + tools/guied/GEDeleteModifier.cpp + tools/guied/GEHideModifier.cpp + tools/guied/GEInsertModifier.cpp + tools/guied/GEItemPropsDlg.cpp + tools/guied/GEItemScriptsDlg.cpp + tools/guied/GEKeyValueModifier.cpp + tools/guied/GEModifier.cpp + tools/guied/GEModifierGroup.cpp + tools/guied/GEModifierStack.cpp + tools/guied/GEMoveModifier.cpp + tools/guied/GENavigator.cpp + tools/guied/GEOptions.cpp + tools/guied/GEOptionsDlg.cpp + tools/guied/GEProperties.cpp + tools/guied/GEPropertyPage.cpp + tools/guied/GESelectionMgr.cpp + tools/guied/GESizeModifier.cpp + tools/guied/GEStateModifier.cpp + tools/guied/GEStatusBar.cpp + tools/guied/GETransformer.cpp + tools/guied/GEViewer.cpp + tools/guied/GEWindowWrapper.cpp + #tools/guied/GEWindowWrapper_stub.cpp + tools/guied/GEWorkspace.cpp + tools/guied/GEWorkspaceFile.cpp + tools/guied/GEZOrderModifier.cpp + tools/guied/guied.cpp) + +file(GLOB EDITOR_MATERIALEDITOR_INCLUDES tools/materialeditor/*.h) +file(GLOB EDITOR_MATERIALEDITOR_SOURCES tools/materialeditor/*.cpp) + +file(GLOB EDITOR_PARTICLE_INCLUDES tools/particle/*.h) +file(GLOB EDITOR_PARTICLE_SOURCES tools/particle/*.cpp) + +file(GLOB EDITOR_PDA_INCLUDES tools/pda/*.h) +file(GLOB EDITOR_PDA_SOURCES tools/pda/*.cpp) + +file(GLOB EDITOR_RADIANT_INCLUDES tools/radiant/*.h) +file(GLOB EDITOR_RADIANT_SOURCES tools/radiant/*.cpp) + +file(GLOB EDITOR_SCRIPT_INCLUDES tools/script/*.h) +file(GLOB EDITOR_SCRIPT_SOURCES tools/script/*.cpp) + +file(GLOB EDITOR_SOUND_INCLUDES tools/sound/*.h) +file(GLOB EDITOR_SOUND_SOURCES tools/sound/*.cpp) + + +file(GLOB DOOMCLASSIC_INCLUDES ../doomclassic/doom/*.h) +file(GLOB DOOMCLASSIC_SOURCES ../doomclassic/doom/*.cpp) + +list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_net_ps3.cpp) +list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_net_xbox.cpp) +list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_video_ps3.cpp) +list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_video_xbox.cpp) + +file(GLOB TIMIDITY_INCLUDES ../doomclassic/timidity/*.h) +file(GLOB TIMIDITY_SOURCES ../doomclassic/timidity/*.cpp) + +file(GLOB_RECURSE WIN32_INCLUDES sys/win32/*.h) +file(GLOB_RECURSE WIN32_SOURCES sys/win32/*.cpp) + +set(WIN32_RESOURCES + # sys/win32/rc/res/BEVEL.BMP + # sys/win32/rc/res/BITMAP2.BMP + # sys/win32/rc/res/BMP00001.BMP + # sys/win32/rc/res/BMP0002.BMP + # sys/win32/rc/res/DEFTEX.WAL + # sys/win32/rc/res/ENDCAP.BMP + # sys/win32/rc/res/GetString.htm + # sys/win32/rc/res/IBEVEL.BMP + # sys/win32/rc/res/IENDCAP.BMP + # sys/win32/rc/res/MEFileToolbar.bmp + # sys/win32/rc/res/MEtoolbar.bmp + # sys/win32/rc/res/MaterialEditor.ico + # sys/win32/rc/res/PropTree.rc2 + # sys/win32/rc/res/Q.BMP + # sys/win32/rc/res/RADIANT3.GIF + # sys/win32/rc/res/Radiant.ico + # sys/win32/rc/res/RadiantDoc.ico + # sys/win32/rc/res/TOOLBAR1.BMP + # sys/win32/rc/res/TOOLBAR2.BMP + # sys/win32/rc/res/Toolbar.bmp + # sys/win32/rc/res/VIEWDEFA.BMP + # sys/win32/rc/res/VIEWOPPO.BMP + # sys/win32/rc/res/bmp00002.bmp + # sys/win32/rc/res/bmp00003.bmp + # sys/win32/rc/res/bmp00004.bmp + # sys/win32/rc/res/bmp00005.bmp + # sys/win32/rc/res/cchsb.bmp + # sys/win32/rc/res/ccrgb.bmp + # sys/win32/rc/res/dbg_back.bmp + # sys/win32/rc/res/dbg_breakpoint.ico + # sys/win32/rc/res/dbg_current.ico + # sys/win32/rc/res/dbg_currentline.ico + # sys/win32/rc/res/dbg_empty.ico + # sys/win32/rc/res/dbg_open.bmp + # sys/win32/rc/res/dbg_toolbar.bmp + sys/win32/rc/res/doom.ico + # sys/win32/rc/res/fpoint.cur + # sys/win32/rc/res/fxed_link.ico + # sys/win32/rc/res/fxed_toolbar.bmp + # sys/win32/rc/res/fxeditor.ico + # sys/win32/rc/res/guied.ico + # sys/win32/rc/res/guied_collapse.ico + # sys/win32/rc/res/guied_expand.ico + # sys/win32/rc/res/guied_hand.cur + # sys/win32/rc/res/guied_nav_visible.ico + # sys/win32/rc/res/guied_nav_visibledisabled.ico + # sys/win32/rc/res/guied_scripts.ico + # sys/win32/rc/res/guied_scripts_white.ico + # sys/win32/rc/res/guied_viewer_toolbar.bmp + # sys/win32/rc/res/icon2.ico + # sys/win32/rc/res/logo_sm3dfx.bmp + # sys/win32/rc/res/matedtree.bmp + # sys/win32/rc/res/me_disabled_icon.ico + # sys/win32/rc/res/me_enabled.ico + # sys/win32/rc/res/me_off_icon.ico + # sys/win32/rc/res/me_on_icon.ico + # sys/win32/rc/res/qe3.ico + # sys/win32/rc/res/shaderbar.bmp + # sys/win32/rc/res/shaderdoc.ico + # sys/win32/rc/res/shaderframe.ico + # sys/win32/rc/res/spliter.cur + ) + + + +#if(USE_MFC_TOOLS) + list(APPEND WIN32_RESOURCES sys/win32/rc/doom.rc) +#else() +# list(APPEND WIN32_RESOURCES sys/win32/rc/doom_nomfc.rc) +#endif() + +source_group("aas" FILES ${AAS_INCLUDES}) +source_group("aas" FILES ${AAS_SOURCES}) + +source_group("cm" FILES ${CM_INCLUDES}) +source_group("cm" FILES ${CM_SOURCES}) + +source_group("framework" FILES ${FRAMEWORK_INCLUDES}) +source_group("framework" FILES ${FRAMEWORK_SOURCES}) + +source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_INCLUDES}) +source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_SOURCES}) + +source_group("renderer" FILES ${RENDERER_INCLUDES}) +source_group("renderer" FILES ${RENDERER_SOURCES}) + +source_group("libs\\irrxml" FILES ${IRRXML_INCLUDES}) +source_group("libs\\irrxml" FILES ${IRRXML_SOURCES}) + +source_group("libs\\jpeg-6" FILES ${JPEG_INCLUDES}) +source_group("libs\\jpeg-6" FILES ${JPEG_SOURCES}) + +source_group("libs\\png" FILES ${PNG_INCLUDES}) +source_group("libs\\png" FILES ${PNG_SOURCES}) + +source_group("libs\\zlib" FILES ${ZLIB_INCLUDES}) +source_group("libs\\zlib" FILES ${ZLIB_SOURCES}) + +source_group("libs\\glew" FILES ${GLEW_INCLUDES}) +source_group("libs\\glew" FILES ${GLEW_SOURCES}) + +source_group("libs\\freetype" FILES ${FREETYPE_SOURCES}) + +source_group("sound" FILES ${SOUND_INCLUDES}) +source_group("sound" FILES ${SOUND_SOURCES}) + +source_group("sound\\XAudio2" FILES ${XAUDIO2_INCLUDES}) +source_group("sound\\XAudio2" FILES ${XAUDIO2_SOURCES}) + +source_group("libs\\oggvorbis" FILES ${OGGVORBIS_INCLUDES}) +source_group("libs\\oggvorbis" FILES ${OGGVORBIS_SOURCES}) + +source_group("ui" FILES ${UI_INCLUDES}) +source_group("ui" FILES ${UI_SOURCES}) + +source_group("swf" FILES ${SWF_INCLUDES}) +source_group("swf" FILES ${SWF_SOURCES}) + +source_group("sys" FILES ${SYS_INCLUDES}) +source_group("sys" FILES ${SYS_SOURCES}) + +source_group("doomclassic" FILES ${DOOMCLASSIC_INCLUDES}) +source_group("doomclassic" FILES ${DOOMCLASSIC_SOURCES}) + +source_group("timidity" FILES ${TIMIDITY_INCLUDES}) +source_group("timidity" FILES ${TIMIDITY_SOURCES}) + + +source_group("game-d3xp" FILES ${GAMED3XP_INCLUDES}) +source_group("game-d3xp" FILES ${GAMED3XP_SOURCES}) + +source_group("game-d3xp\\ai" FILES ${GAMED3XP_AI_INCLUDES}) +source_group("game-d3xp\\ai" FILES ${GAMED3XP_AI_SOURCES}) + +source_group("game-d3xp\\anim" FILES ${GAMED3XP_ANIM_INCLUDES}) +source_group("game-d3xp\\anim" FILES ${GAMED3XP_ANIM_SOURCES}) + +source_group("game-d3xp\\gamesys" FILES ${GAMED3XP_GAMESYS_INCLUDES}) +source_group("game-d3xp\\gamesys" FILES ${GAMED3XP_GAMESYS_SOURCES}) + +source_group("game-d3xp\\menus" FILES ${GAMED3XP_MENUS_INCLUDES}) +source_group("game-d3xp\\menus" FILES ${GAMED3XP_MENUS_SOURCES}) + +source_group("game-d3xp\\physics" FILES ${GAMED3XP_PHYSICS_INCLUDES}) +source_group("game-d3xp\\physics" FILES ${GAMED3XP_PHYSICS_SOURCES}) + +source_group("game-d3xp\\script" FILES ${GAMED3XP_SCRIPT_INCLUDES}) +source_group("game-d3xp\\script" FILES ${GAMED3XP_SCRIPT_SOURCES}) + + + + +source_group("sys\\win32" FILES ${WIN32_INCLUDES}) +source_group("sys\\win32" FILES ${WIN32_SOURCES}) +source_group("sys\\win32\\Resources" FILES ${WIN32_RESOURCES}) + +source_group("tools\\compilers" FILES ${COMPILER_INCLUDES}) + +source_group("tools\\compilers\\aas" FILES ${COMPILER_AAS_INCLUDES}) +source_group("tools\\compilers\\aas" FILES ${COMPILER_AAS_SOURCES}) + +source_group("tools\\compilers\\dmap" FILES ${COMPILER_DMAP_INCLUDES}) +source_group("tools\\compilers\\dmap" FILES ${COMPILER_DMAP_SOURCES}) + +source_group("tools\\compilers\\renderbump" FILES ${COMPILER_RENDERBUMP_INCLUDES}) +source_group("tools\\compilers\\renderbump" FILES ${COMPILER_RENDERBUMP_SOURCES}) + +source_group("tools\\compilers\\roqvq" FILES ${COMPILER_ROQVQ_INCLUDES}) +source_group("tools\\compilers\\roqvq" FILES ${COMPILER_ROQVQ_SOURCES}) + +source_group("tools" FILES ${TOOLS_INCLUDES}) + +source_group("tools\\comafx" FILES ${TOOLS_COMAFX_INCLUDES}) +source_group("tools\\comafx" FILES ${TOOLS_COMAFX_SOURCES}) + +source_group("tools\\common" FILES ${TOOLS_COMMON_INCLUDES}) +source_group("tools\\common" FILES ${TOOLS_COMMON_SOURCES}) + +source_group("tools\\common\\proptree" FILES ${TOOLS_COMMON_PROPTREE_INCLUDES}) +source_group("tools\\common\\proptree" FILES ${TOOLS_COMMON_PROPTREE_SOURCES}) + +source_group("tools\\af" FILES ${EDITOR_AF_INCLUDES}) +source_group("tools\\af" FILES ${EDITOR_AF_SOURCES}) + +source_group("tools\\debugger" FILES ${EDITOR_DEBUGGER_INCLUDES}) +source_group("tools\\debugger" FILES ${EDITOR_DEBUGGER_SOURCES}) + +source_group("tools\\decl" FILES ${EDITOR_DECL_INCLUDES}) +source_group("tools\\decl" FILES ${EDITOR_DECL_SOURCES}) + +source_group("tools\\guied" FILES ${EDITOR_GUIED_INCLUDES}) +source_group("tools\\guied" FILES ${EDITOR_GUIED_SOURCES}) + +source_group("tools\\materialeditor" FILES ${EDITOR_MATERIALEDITOR_INCLUDES}) +source_group("tools\\materialeditor" FILES ${EDITOR_MATERIALEDITOR_SOURCES}) + +source_group("tools\\particle" FILES ${EDITOR_PARTICLE_INCLUDES}) +source_group("tools\\particle" FILES ${EDITOR_PARTICLE_SOURCES}) + +source_group("tools\\pda" FILES ${EDITOR_PDA_INCLUDES}) +source_group("tools\\pda" FILES ${EDITOR_PDA_SOURCES}) + +source_group("tools\\radiant" FILES ${EDITOR_RADIANT_INCLUDES}) +source_group("tools\\radiant" FILES ${EDITOR_RADIANT_SOURCES}) + +source_group("tools\\script" FILES ${EDITOR_SCRIPT_INCLUDES}) +source_group("tools\\script" FILES ${EDITOR_SCRIPT_SOURCES}) + +source_group("tools\\sound" FILES ${EDITOR_SOUND_INCLUDES}) +source_group("tools\\sound" FILES ${EDITOR_SOUND_SOURCES}) + + +set(RBDOOM3_SOURCES + ${AAS_INCLUDES} ${AAS_SOURCES} + ${CM_INCLUDES} ${CM_SOURCES} + ${FRAMEWORK_INCLUDES} ${FRAMEWORK_SOURCES} + ${FRAMEWORK_ASYNC_INCLUDES} ${FRAMEWORK_ASYNC_SOURCES} + ${RENDERER_INCLUDES} ${RENDERER_SOURCES} + #${IRRXML_INCLUDES} ${IRRXML_SOURCES} + ${JPEG_INCLUDES} ${JPEG_SOURCES} + #${PNG_INCLUDES} ${PNG_SOURCES} + ${ZLIB_INCLUDES} ${ZLIB_SOURCES} + #${GLEW_INCLUDES} ${GLEW_SOURCES} + #${FREETYPE_SOURCES} + ${SOUND_INCLUDES} ${SOUND_SOURCES} + #${OGGVORBIS_INCLUDES} ${OGGVORBIS_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} + #${COMPILER_RENDERBUMP_INCLUDES} ${COMPILER_RENDERBUMP_SOURCES} + #${COMPILER_ROQVQ_INCLUDES} ${COMPILER_ROQVQ_SOURCES} + ) + +add_definitions(-D__DOOM__ + #-DGLEW_STATIC + #-DBUILD_FREETYPE + #-DFT2_BUILD_LIBRARY + ) + +if(MONOLITH) + list(APPEND RBDOOM3_SOURCES + ${GAMED3XP_INCLUDES} ${GAMED3XP_SOURCES} + ${GAMED3XP_AI_INCLUDES} ${GAMED3XP_AI_SOURCES} + ${GAMED3XP_ANIM_INCLUDES} ${GAMED3XP_ANIM_SOURCES} + ${GAMED3XP_GAMESYS_INCLUDES} ${GAMED3XP_GAMESYS_SOURCES} + ${GAMED3XP_MENUS_INCLUDES} ${GAMED3XP_MENUS_SOURCES} + ${GAMED3XP_PHYSICS_INCLUDES} ${GAMED3XP_PHYSICS_SOURCES} + ${GAMED3XP_SCRIPT_INCLUDES} ${GAMED3XP_SCRIPT_SOURCES}) +else() + add_definitions(-D__DOOM_DLL__) +endif() + +include_directories( + . + #libs/curl/include + #libs/openal/include + #libs/glew/include + #libs/freetype/include + libs/zlib) + +#link_directories( +# ${CMAKE_CURRENT_SOURCE_DIR}/libs/curl/lib +# ${CMAKE_CURRENT_SOURCE_DIR}/libs/openal/lib) + +if(MSVC) + + if(MSVC_VERSION EQUAL 1700) + set(DirectX_LIBRARIES + dinput8 + dsound + dxguid + #dxerr + Xinput + ) + add_definitions(-DUSE_XINPUT) + else() + find_package(DirectX REQUIRED) + include_directories(${DirectX_INCLUDE_DIR}) + add_definitions(-DUSE_XINPUT) + endif() + + if(USE_MFC_TOOLS) + # find_package(MFC REQUIRED) + # if(MFC_FOUND) + # include_directories(${MFC_INCLUDE_DIR}) + # link_directories(${MFC_LIBRARY_DIR}) + # endif() + + # find_package(ATL REQUIRED) + # if(ATL_FOUND) + # include_directories(${ATL_INCLUDE_DIR}) + # link_directories(${ATL_LIBRARY_DIR}) + # add_definitions(-DUSE_MFC6_WITH_ATL7) + # endif() + + include_directories(libs/atlmfc/include) + if(CMAKE_CL_64) + link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/atlmfc/lib/amd64) + else(CMAKE_CL_64) + link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/atlmfc/lib) + endif(CMAKE_CL_64) + + add_definitions(-DUSE_MFC_TOOLS) + + list(APPEND RBDOOM3_SOURCES + ${TOOLS_INCLUDES} + ${TOOLS_COMAFX_INCLUDES} ${TOOLS_COMAFX_SOURCES} + ${TOOLS_COMMON_INCLUDES} ${TOOLS_COMMON_SOURCES} + ${TOOLS_COMMON_PROPTREE_INCLUDES} ${TOOLS_COMMON_PROPTREE_SOURCES} + + ${EDITOR_AF_INCLUDES} ${EDITOR_AF_SOURCES} + ${EDITOR_DEBUGGER_INCLUDES} ${EDITOR_DEBUGGER_SOURCES} + ${EDITOR_DECL_INCLUDES} ${EDITOR_DECL_SOURCES} + ${EDITOR_GUIED_INCLUDES} ${EDITOR_GUIED_SOURCES} + ${EDITOR_MATERIALEDITOR_INCLUDES} ${EDITOR_MATERIALEDITOR_SOURCES} + ${EDITOR_PARTICLE_INCLUDES} ${EDITOR_PARTICLE_SOURCES} + ${EDITOR_PDA_INCLUDES} ${EDITOR_PDA_SOURCES} + ${EDITOR_RADIANT_INCLUDES} ${EDITOR_RADIANT_SOURCES} + ${EDITOR_SCRIPT_INCLUDES} ${EDITOR_SCRIPT_SOURCES} + ${EDITOR_SOUND_INCLUDES} ${EDITOR_SOUND_SOURCES}) + endif() + + list(APPEND RBDOOM3_SOURCES + ${SYS_INCLUDES} ${SYS_SOURCES} + ${XAUDIO2_INCLUDES} ${XAUDIO2_SOURCES} + ${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES}) + + + list(REMOVE_DUPLICATES RBDOOM3_SOURCES) + + add_executable(RBDoom3 WIN32 ${RBDOOM3_SOURCES}) + + #add_custom_command(TARGET RBDoom3 + # PRE_BUILD + # COMMAND nmake ARGS /f Makefile.vc6 CFG=release + # WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl/lib + # COMMENT "Compiling libcURL") + + add_dependencies(RBDoom3 idlib) + target_link_libraries(RBDoom3 + idlib + ${DirectX_LIBRARIES} + #libcurl + #openal32 + opengl32 + glu32 + dbghelp + #eaxguid + iphlpapi + winmm + wsock32.lib + xaudio2.lib + ) +endif() diff --git a/neo/cmake-vs2010-32bit.bat b/neo/cmake-vs2010-32bit.bat new file mode 100644 index 00000000..ba2fbdd9 --- /dev/null +++ b/neo/cmake-vs2010-32bit.bat @@ -0,0 +1,6 @@ +cd .. +del /s /q build +mkdir build +cd build +cmake -G "Visual Studio 10" ../neo +pause \ No newline at end of file diff --git a/neo/cmake-vs2012-32bit.bat b/neo/cmake-vs2012-32bit.bat new file mode 100644 index 00000000..f2c04996 --- /dev/null +++ b/neo/cmake-vs2012-32bit.bat @@ -0,0 +1,6 @@ +cd .. +del /s /q build +mkdir build +cd build +cmake -G "Visual Studio 11" ../neo +pause \ No newline at end of file diff --git a/neo/d3xp/menus/MenuWidget_DevList.cpp b/neo/d3xp/menus/MenuWidget_DevList.cpp deleted file mode 100644 index 406afcff..00000000 --- a/neo/d3xp/menus/MenuWidget_DevList.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#pragma hdrstop -#include "../precompiled.h" -#include "../MainMenuLocal.h" - -/* -================================================================================================ -idMenuWidget_DevList - -Extends the standard list widget to support the developer menu. -================================================================================================ -*/ - -namespace { - /* - ================================================ - DevList_NavigateForward - ================================================ - */ - class DevList_NavigateForward : public idSWFScriptFunction_RefCounted { - public: - DevList_NavigateForward( idMenuWidget_DevList * devList_, const int optionIndex_ ) : - devList( devList_ ), - optionIndex( optionIndex_ ) { - - } - - idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) { - devList->NavigateForward( optionIndex ); - return idSWFScriptVar(); - } - - private: - idMenuWidget_DevList * devList; - int optionIndex; - }; -} - -/* -======================== -idMenuWidget_DevList::Initialize -======================== -*/ -void idMenuWidget_DevList::Initialize() { - AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, 1 ); - AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, -1 ); - AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); - AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); - - int optionIndex = 0; - while ( GetChildren().Num() < GetNumVisibleOptions() ) { - idMenuWidget_Button * const buttonWidget = new ( TAG_MENU ) idMenuWidget_Button(); - buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( new ( TAG_SWF ) DevList_NavigateForward( this, optionIndex++ ) ); - AddChild( buttonWidget ); - } -} - -/* -======================== -idMenuWidget_DevList::GetTotalNumberOfOptions -======================== -*/ -int idMenuWidget_DevList::GetTotalNumberOfOptions() const { - if ( devMenuList == NULL ) { - return 0; - } - - return devMenuList->devMenuList.Num(); -} - -/* -======================== -idMenuWidget_DevList::GoToFirstMenu -======================== -*/ -void idMenuWidget_DevList::GoToFirstMenu() { - devMapListInfos.Clear(); - indexInfo_t & info = devMapListInfos.Alloc(); - info.name = "devmenuoption/main"; - - devMenuList = NULL; - - RecalculateDevMenu(); -} - -/* -======================== -idMenuWidget_DevList::NavigateForward -======================== -*/ -void idMenuWidget_DevList::NavigateForward( const int optionIndex ) { - if ( devMenuList == NULL ) { - return; - } - - const int focusedIndex = GetViewOffset() + optionIndex; - - const idDeclDevMenuList::idDevMenuOption & devOption = devMenuList->devMenuList[ focusedIndex ]; - if ( ( devOption.devMenuDisplayName.Length() == 0 ) || ( devOption.devMenuDisplayName.Cmp( "..." ) == 0 ) ) { - return; - } - - if ( devOption.devMenuSubList != NULL ) { - indexInfo_t & indexes = devMapListInfos.Alloc(); - indexes.name = devOption.devMenuSubList->GetName(); - indexes.focusIndex = GetFocusIndex(); - indexes.viewIndex = GetViewIndex(); - indexes.viewOffset = GetViewOffset(); - - RecalculateDevMenu(); - - SetViewIndex( 0 ); - SetViewOffset( 0 ); - - Update(); - - // NOTE: This must be done after the Update() because it MAY change the sprites that - // children refer to - GetChildByIndex( 0 ).SetState( WIDGET_STATE_SELECTED ); - ForceFocusIndex( 0 ); - SetFocusIndex( 0 ); - - gameLocal->GetMainMenu()->ClearWidgetActionRepeater(); - } else { - cmdSystem->AppendCommandText( va( "loadDevMenuOption %s %d\n", devMapListInfos[ devMapListInfos.Num() - 1 ].name, focusedIndex ) ); - } -} - -/* -======================== -idMenuWidget_DevList::NavigateBack -======================== -*/ -void idMenuWidget_DevList::NavigateBack() { - assert( devMapListInfos.Num() != 0 ); - if ( devMapListInfos.Num() == 1 ) { - // Important that this goes through as a DIRECT event, since more than likely the list - // widget will have the parent's focus, so a standard ReceiveEvent() here would turn - // into an infinite recursion. - idWidgetEvent event( WIDGET_EVENT_BACK, 0, NULL, idSWFParmList() ); - - idWidgetAction action; - action.Set( WIDGET_ACTION_GO_BACK, MENU_ROOT ); - HandleAction( action, event ); - - return; - } - - // NOTE: we need a copy here, since it's about to be removed from the list - const indexInfo_t indexes = devMapListInfos[ devMapListInfos.Num() - 1 ]; - assert( indexes.focusIndex < GetChildren().Num() ); - assert( ( indexes.viewIndex - indexes.viewOffset ) < GetNumVisibleOptions() ); - devMapListInfos.RemoveIndex( devMapListInfos.Num() - 1 ); - - RecalculateDevMenu(); - - SetViewIndex( indexes.viewIndex ); - SetViewOffset( indexes.viewOffset ); - - Update(); - - // NOTE: This must be done AFTER Update() because so that it is sure to refer to the proper sprite - GetChildByIndex( indexes.focusIndex ).SetState( WIDGET_STATE_SELECTED ); - ForceFocusIndex( indexes.focusIndex ); - SetFocusIndex( indexes.focusIndex ); - - gameLocal->GetMainMenu()->ClearWidgetActionRepeater(); -} - - -/* -======================== -idMenuWidget_DevList::RecalculateDevMenu -======================== -*/ -void idMenuWidget_DevList::RecalculateDevMenu() { - if ( devMapListInfos.Num() > 0 ) { - const idDeclDevMenuList * const devMenuListDecl = idDeclDevMenuList::resourceList.Load( devMapListInfos[ devMapListInfos.Num() - 1 ].name, false ); - if ( devMenuListDecl != NULL ) { - devMenuList = devMenuListDecl; - } - } - - idSWFScriptObject & root = gameLocal->GetMainMenu()->GetSWF()->GetRootObject(); - for ( int i = 0; i < GetChildren().Num(); ++i ) { - idMenuWidget & child = GetChildByIndex( i ); - child.SetSpritePath( GetSpritePath(), va( "option%d", i ) ); - if ( child.BindSprite( root ) ) { - child.SetState( WIDGET_STATE_NORMAL ); - child.GetSprite()->StopFrame( 1 ); - } - } -} diff --git a/neo/framework/File_SaveGame.h b/neo/framework/File_SaveGame.h index 147b5272..81ef4b02 100644 --- a/neo/framework/File_SaveGame.h +++ b/neo/framework/File_SaveGame.h @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms #ifndef __FILE_SAVEGAME_H__ #define __FILE_SAVEGAME_H__ -#include "zlib/zlib.h" +#include "../libs/zlib/zlib.h" // Listing of the types of files within a savegame package enum saveGameType_t { diff --git a/neo/framework/Session.cpp b/neo/framework/Session.cpp deleted file mode 100644 index 274a50e3..00000000 --- a/neo/framework/Session.cpp +++ /dev/null @@ -1,1256 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "../idlib/precompiled.h" -#pragma hdrstop - -#include "Session_local.h" -#include "../sys/sys_session_savegames.h" -#include "../sys/sys_voicechat.h" - - -/* -======================== -SteamAPIDebugTextHook -======================== -*/ -extern "C" void __cdecl SteamAPIDebugTextHook( int nSeverity, const char * pchDebugText ) { - // if you're running in the debugger, only warnings (nSeverity >= 1) will be sent - // if you add -debug_steamapi to the command-line, a lot of extra informational messages will also be sent - idLib::Printf( "%s", pchDebugText ); - - if ( nSeverity >= 1 ) { - // place to set a breakpoint for catching API errors - int x = 3; - x; - } -} - -/* -=============================================================================== - -SESSION LOCAL - -=============================================================================== -*/ - -/* -=============== -idSessionLocal::idSessionLocal -=============== -*/ -idSessionLocal::idSessionLocal() { - - localState = STATE_PRESS_START; - - InitBaseState(); -} - -/* -=============== -idSessionLocal::~idSessionLocal -=============== -*/ -idSessionLocal::~idSessionLocal() { - if ( sessionCallbacks != NULL ) { - delete sessionCallbacks; - } -} - - - -/* -======================== -idSessionLocal::InitBaseState -======================== -*/ -void idSessionLocal::InitBaseState() { - - - localState = STATE_PRESS_START; - sessionOptions = 0; - currentID = 0; - - sessionCallbacks = new idSessionLocalCallbacks( this ); - - connectType = CONNECT_NONE; - - isSysUIShowing = false; - - pendingInviteDevice = 0; - pendingInviteMode = PENDING_INVITE_NONE; - - - flushedStats = false; - - enumerationHandle = 0; -} - -/* -=============== -idSessionLocal::Shutdown -=============== -*/ -void idSessionLocal::Shutdown() { - - delete signInManager; - - if ( achievementSystem != NULL ) { - achievementSystem->Shutdown(); - delete achievementSystem; - } - - DestroySteamObjects(); -} - -/* -=============== -idSessionLocal::Init - -Called in an orderly fashion at system startup, -so commands, cvars, files, etc are all available -=============== -*/ -void idSessionLocal::Init() { - - common->Printf( "-------- Initializing Session --------\n" ); - - InitSteam(); - ConstructSteamObjects(); - - signInManager = new idSignInManagerWin(); - achievementSystem = new idAchievementSystemWin(); - achievementSystem->Init(); - Initialize(); - - common->Printf( "session initialized\n" ); - common->Printf( "--------------------------------------\n" ); -} - -/* -======================== -idSessionLocal::InitSteam -======================== -*/ -void idSessionLocal::InitSteam() { - if ( steamInitialized || steamFailed ) { - if ( steamFailed ) { - net_usePlatformBackend.SetBool( false ); - } - return; - } - - steamInitialized = SteamAPI_Init(); - steamFailed = !steamInitialized; - - if ( steamFailed ) { - if ( net_usePlatformBackend.GetBool() ) { - idLib::Warning( "Steam failed to initialize. Usually this happens because the Steam client isn't running." ); - // Turn off the usage of steam if it fails to initialize - // FIXME: We'll want to bail (nicely) in the shipping product most likely - net_usePlatformBackend.SetBool( false ); - } - return; - } - - // from now on, all Steam API functions should return non-null interface pointers - - assert( SteamUtils() ); - SteamUtils()->SetWarningMessageHook( &SteamAPIDebugTextHook ); - - ConstructSteamObjects(); -} - -/* -======================== -idSessionLocal::ConstructSteamObjects -======================== -*/ -void idSessionLocal::ConstructSteamObjects() { -} - -/* -======================== -idSessionLocal::DestroySteamObjects -======================== -*/ -void idSessionLocal::DestroySteamObjects() { -} - -/* -======================== -idSessionLocal::MoveToPressStart -======================== -*/ -void idSessionLocal::MoveToPressStart( gameDialogMessages_t msg ) { - if ( localState != STATE_PRESS_START ) { - MoveToPressStart(); - - common->Dialog().ClearDialogs(); - common->Dialog().AddDialog( msg, DIALOG_ACCEPT, NULL, NULL, false, "", 0, true ); - } -} - -/* -======================== -idSessionLocal::MoveToPressStart -======================== -*/ -void idSessionLocal::MoveToPressStart() { - if ( localState != STATE_PRESS_START ) { - GetSignInManager().RemoveAllLocalUsers(); - SetState( STATE_PRESS_START ); - } -} - -/* -======================== -idSessionLocal::SetState -======================== -*/ -void idSessionLocal::SetState( idSessionLocal::state_t newState ) { - assert( newState < NUM_STATES ); - assert( localState < NUM_STATES ); - - if ( newState == localState ) { - return; - } - - localState = newState; -} - -/* -======================== -idSessionLocal::GetState -======================== -*/ -idSessionLocal::sessionState_t idSessionLocal::GetState() const { - // Convert our internal state to one of the external states - switch ( localState ) { - case STATE_PRESS_START: return PRESS_START; - case STATE_IDLE: return IDLE; - case STATE_PARTY_LOBBY_HOST: return PARTY_LOBBY; - case STATE_PARTY_LOBBY_PEER: return PARTY_LOBBY; - case STATE_GAME_LOBBY_HOST: return GAME_LOBBY; - case STATE_GAME_LOBBY_PEER: return GAME_LOBBY; - //case STATE_GAME_STATE_LOBBY_HOST: return GAME_LOBBY; - //case STATE_GAME_STATE_LOBBY_PEER: return GAME_LOBBY; - case STATE_LOADING: return LOADING; - case STATE_INGAME: return INGAME; - case STATE_CREATE_AND_MOVE_TO_PARTY_LOBBY: return CONNECTING; - case STATE_CREATE_AND_MOVE_TO_GAME_LOBBY: return CONNECTING; - //case STATE_CREATE_AND_MOVE_TO_GAME_STATE_LOBBY: return CONNECTING; - case STATE_FIND_OR_CREATE_MATCH: return SEARCHING; - case STATE_CONNECT_AND_MOVE_TO_PARTY: return CONNECTING; - case STATE_CONNECT_AND_MOVE_TO_GAME: return CONNECTING; - //case STATE_CONNECT_AND_MOVE_TO_GAME_STATE: return CONNECTING; - case STATE_BUSY: return BUSY; - default: { - idLib::Error( "GetState: Unknown state in idSessionLocal" ); - return IDLE; - } - }; -} - -/* -======================== -idSessionLocal::Pump -======================== -*/ -void idSessionLocal::Pump() { - - GetSignInManager().Pump(); - - idLocalUser * masterUser = GetSignInManager().GetMasterLocalUser(); - - if ( masterUser != NULL && localState == STATE_PRESS_START ) { - // If we have a master user, and we are at press start, move to the menu area - SetState( STATE_IDLE ); - - - } - - GetAchievementSystem().Pump(); -} - -/* -======================== -idSessionLocal::OnMasterLocalUserSignin -======================== -*/ -void idSessionLocal::OnMasterLocalUserSignin() { - enumerationHandle = EnumerateSaveGames( 0 ); -} - -/* -======================== -idSessionLocal::LoadGame -======================== -*/ -saveGameHandle_t idSessionLocal::LoadGame( const char * name, const idList< idSaveFileEntry > & files ) { - if ( processorLoadFiles.InitLoadFiles( name, files ) ) { - return saveGameManager.ExecuteProcessor( &processorLoadFiles ); - } else { - return 0; - } -} - -/* -======================== -idSessionLocal::SaveGame -======================== -*/ -saveGameHandle_t idSessionLocal::SaveGame( const char * name, const idList< idSaveFileEntry > & files, const idSaveGameDetails & description, uint64 skipErrorMask ) { - saveGameHandle_t ret = 0; - - // serialize the description file behind their back... - idList< idSaveFileEntry > filesWithDetails( files ); - idFile_Memory * gameDetailsFile = new idFile_Memory( SAVEGAME_DETAILS_FILENAME ); - //gameDetailsFile->MakeWritable(); - description.descriptors.WriteToIniFile( gameDetailsFile ); - filesWithDetails.Append( idSaveFileEntry( gameDetailsFile, SAVEGAMEFILE_TEXT | SAVEGAMEFILE_AUTO_DELETE, SAVEGAME_DETAILS_FILENAME ) ); - - if ( processorSave.InitSave( name, filesWithDetails, description ) ) { - processorSave.SetSkipSystemErrorDialogMask( skipErrorMask ); - ret = GetSaveGameManager().ExecuteProcessor( &processorSave ); - } - return ret; -} - -/* -======================== -idSessionLocal::EnumerateSaveGames -======================== -*/ -saveGameHandle_t idSessionLocal::EnumerateSaveGames( uint64 skipErrorMask ) { - saveGameHandle_t ret = 0; - - // flush the old enumerated list - GetSaveGameManager().GetEnumeratedSavegamesNonConst().Clear(); - - if ( processorEnumerate.Init() ) { - processorEnumerate.SetSkipSystemErrorDialogMask( skipErrorMask ); - ret = GetSaveGameManager().ExecuteProcessor( &processorEnumerate ); - } - return ret; -} - -/* -======================== -idSessionLocal::DeleteSaveGame -======================== -*/ -saveGameHandle_t idSessionLocal::DeleteSaveGame( const char * name, uint64 skipErrorMask ) { - saveGameHandle_t ret = 0; - if ( processorDelete.InitDelete( name ) ) { - processorDelete.SetSkipSystemErrorDialogMask( skipErrorMask ); - ret = GetSaveGameManager().ExecuteProcessor( & - processorDelete ); - } - return ret; -} - -/* -======================== -idSessionLocal::IsEnumerating -======================== -*/ -bool idSessionLocal::IsEnumerating() const { - return !session->IsSaveGameCompletedFromHandle( processorEnumerate.GetHandle() ); -} - -/* -======================== -idSessionLocal::GetEnumerationHandle -======================== -*/ -saveGameHandle_t idSessionLocal::GetEnumerationHandle() const { - return processorEnumerate.GetHandle(); -} - -/* -======================== -idSessionLocal::CancelSaveGameWithHandle -======================== -*/ -void idSessionLocal::CancelSaveGameWithHandle( const saveGameHandle_t & handle ) { - GetSaveGameManager().CancelWithHandle( handle ); -} - - -// FIXME: Move to sys_stats.cpp -leaderboardDefinition_t * registeredLeaderboards[MAX_LEADERBOARDS]; -int numRegisteredLeaderboards = 0; - -/* -======================== -Sys_FindLeaderboardDef -======================== -*/ -const leaderboardDefinition_t * Sys_FindLeaderboardDef( int id ) { - for ( int i = 0; i < numRegisteredLeaderboards; i++ ) { - if ( registeredLeaderboards[i]->id == id ) { - return registeredLeaderboards[i]; - } - } - - return NULL; -} - -/* -======================== -idSessionLocal::GetActiveLobby -======================== -*/ -idLobby * idSessionLocal::GetActiveLobby() { - sessionState_t state = GetState(); - - if ( ( state == GAME_LOBBY ) || ( state == BUSY ) || ( state == INGAME ) || ( state == LOADING ) ) { - return &GetGameLobby(); - } else if ( state == PARTY_LOBBY ) { - return &GetPartyLobby(); - } - - return NULL; -} - -/* -======================== -idSessionLocal::GetActiveLobby -======================== -*/ -const idLobby * idSessionLocal::GetActiveLobby() const { - sessionState_t state = GetState(); - - if ( ( state == GAME_LOBBY ) || ( state == BUSY ) || ( state == INGAME ) || ( state == LOADING ) ) { - return &GetGameLobby(); - } else if ( state == PARTY_LOBBY ) { - return &GetPartyLobby(); - } - - return NULL; -} - -/* -======================== -idSessionLocal::GetActiveLobbyBase -This returns the base version for the idSession version -======================== -*/ -idLobbyBase & idSessionLocal::GetActiveLobbyBase() { - idLobby * activeLobby = GetActiveLobby(); - - if ( activeLobby != NULL ) { - return *activeLobby; - } - - return stubLobby; // So we can return at least something -} - -/* -======================== -idSessionLocal::PrePickNewHost -This is called when we have determined that we need to pick a new host. -Call PickNewHostInternal to continue on with the host picking process. -======================== -*/ -void idSessionLocal::PrePickNewHost( idLobby & lobby, bool forceMe, bool inviteOldHost ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: (%s)\n", lobby.GetLobbyName() ); - - if ( GetActiveLobby() == NULL ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: GetActiveLobby() == NULL (%s)\n", lobby.GetLobbyName() ); - return; - } - - // Check to see if we can migrate AT ALL - // This is checking for coop, we should make this a specific option (MATCH_ALLOW_MIGRATION) - if ( GetPartyLobby().parms.GetSessionMatchFlags() & MATCH_PARTY_INVITE_PLACEHOLDER ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: MATCH_PARTY_INVITE_PLACEHOLDER (%s)\n", lobby.GetLobbyName() ); - - // Can't migrate, shut both lobbies down, and create a new match using the original parms - GetGameLobby().Shutdown(); - GetPartyLobby().Shutdown(); - - // Throw up the appropriate dialog message so the player knows what happeend - if ( localState >= STATE_LOADING ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: localState >= idSessionLocal::STATE_LOADING (%s)\n", lobby.GetLobbyName() ); - common->Dialog().AddDialog( GDM_BECAME_HOST_GAME_STATS_DROPPED, DIALOG_ACCEPT, NULL, NULL, false, __FUNCTION__, __LINE__, true ); - } else { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: localState < idSessionLocal::STATE_LOADING (%s)\n", lobby.GetLobbyName() ); - common->Dialog().AddDialog( GDM_LOBBY_BECAME_HOST_GAME, DIALOG_ACCEPT, NULL, NULL, false, __FUNCTION__, __LINE__, true ); - } - - CreateMatch( GetActiveLobby()->parms ); - - return; - } - - // Check to see if the match is searchable - if ( GetState() >= idSession::GAME_LOBBY && MatchTypeIsSearchable( GetGameLobby().parms.GetSessionMatchFlags() ) ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: MatchTypeIsSearchable (%s)\n", lobby.GetLobbyName() ); - // Searchable games migrate lobbies independently, and don't need to stay in sync - lobby.PickNewHostInternal( forceMe, inviteOldHost ); - return; - } - - // - // Beyond this point, game lobbies must be sync'd with party lobbies as far as host status - // So to enforce that, we pull you out of the game lobby if you are in one when migration occurs - // - - // Check to see if we should go back to a party lobby - if ( GetBackState() >= idSessionLocal::PARTY_LOBBY || GetState() == idSession::PARTY_LOBBY ) { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: GetBackState() >= idSessionLocal::PARTY_LOBBY || GetState() == idSession::PARTY_LOBBY (%s)\n", lobby.GetLobbyName() ); - // Force the party lobby to start picking a new host if we lost the game lobby host - GetPartyLobby().PickNewHostInternal( forceMe, inviteOldHost ); - - // End the game lobby, and go back to party lobby - GetGameLobby().Shutdown(); - SetState( GetPartyLobby().IsHost() ? STATE_PARTY_LOBBY_HOST : STATE_PARTY_LOBBY_PEER ); - } else { - NET_VERBOSE_PRINT("idSessionLocal::PrePickNewHost: GetBackState() < idSessionLocal::PARTY_LOBBY && GetState() != idSession::PARTY_LOBBY (%s)\n", lobby.GetLobbyName() ); - if ( localState >= STATE_LOADING ) { - common->Dialog().AddDialog( GDM_HOST_QUIT, DIALOG_ACCEPT, NULL, NULL, false, __FUNCTION__, __LINE__, true ); // The host has quit the session. Returning to the main menu. - } - - // Go back to main menu - GetGameLobby().Shutdown(); - GetPartyLobby().Shutdown(); - SetState( STATE_IDLE ); - } -} -/* -======================== -idSessionLocal::PreMigrateInvite -This is called just before we get invited to a migrated session -If we return false, the invite will be ignored -======================== -*/ -bool idSessionLocal::PreMigrateInvite( idLobby & lobby ) -{ - if ( GetActiveLobby() == NULL ) { - return false; - } - - // Check to see if we can migrate AT ALL - // This is checking for coop, we should make this a specific option (MATCH_ALLOW_MIGRATION) - if ( !verify( ( GetPartyLobby().parms.GetSessionMatchFlags() & MATCH_PARTY_INVITE_PLACEHOLDER ) == 0 ) ) { - return false; // Shouldn't get invites for coop (we should make this a specific option (MATCH_ALLOW_MIGRATION)) - } - - // Check to see if the match is searchable - if ( MatchTypeIsSearchable( GetGameLobby().parms.GetSessionMatchFlags() ) ) { - // Searchable games migrate lobbies independently, and don't need to stay in sync - return true; - } - - // - // Beyond this point, game lobbies must be sync'd with party lobbies as far as host status - // So to enforce that, we pull you out of the game lobby if you are in one when migration occurs - // - - if ( lobby.lobbyType != idLobby::TYPE_PARTY ) { - return false; // We shouldn't be getting invites from non party lobbies when in a non searchable game - } - - // Non placeholder Party lobbies can always migrate - if ( GetBackState() >= idSessionLocal::PARTY_LOBBY ) { - // Non searchable games go back to the party lobby - GetGameLobby().Shutdown(); - SetState( GetPartyLobby().IsHost() ? STATE_PARTY_LOBBY_HOST : STATE_PARTY_LOBBY_PEER ); - } - - return true; // Non placeholder Party lobby invites joinable -} - -/* -======================== -idSessionLocal::HandleDedicatedServerQueryRequest -======================== -*/ -void idSessionLocal::HandleDedicatedServerQueryRequest( lobbyAddress_t & remoteAddr, idBitMsg & msg, int msgType ) { - NET_VERBOSE_PRINT( "HandleDedicatedServerQueryRequest from %s\n", remoteAddr.ToString() ); - - bool canJoin = true; - - const unsigned long localChecksum = 0; - const unsigned long remoteChecksum = msg.ReadLong(); - - if ( remoteChecksum != localChecksum ) { - NET_VERBOSE_PRINT( "HandleServerQueryRequest: Invalid version from %s\n", remoteAddr.ToString() ); - canJoin = false; - } - - // Make sure we are the host of this party session - if ( !GetPartyLobby().IsHost() ) { - NET_VERBOSE_PRINT( "HandleServerQueryRequest: Not host of party\n" ); - canJoin = false; - } - - // Make sure there is a session active - if ( GetActiveLobby() == NULL ) { - canJoin = false; - } - - // Make sure we have enough free slots - if ( GetPartyLobby().NumFreeSlots() == 0 || GetGameLobby().NumFreeSlots() == 0 ) { - NET_VERBOSE_PRINT( "No free slots\n" ); - canJoin = false; - } - - if ( MatchTypeInviteOnly( GetPartyLobby().parms.GetSessionMatchFlags() ) ) { - canJoin = false; - } - - // Buffer to hold reply msg - byte buffer[ idPacketProcessor::MAX_PACKET_SIZE - 2 ]; - idBitMsg retmsg; - retmsg.InitWrite( buffer, sizeof( buffer ) ); - - idLocalUser * masterUser = GetSignInManager().GetMasterLocalUser(); - - if ( masterUser == NULL ) { - canJoin = false; - } - - // Send the info about this game session to the caller - retmsg.WriteBool( canJoin ); - - if ( canJoin ) { - retmsg.WriteBool( session->GetState() >= idSession::LOADING ); - - retmsg.WriteString( masterUser->GetGamerTag() ); - retmsg.WriteLong( GetActiveLobby()->parms.GetGameType() ); // We need to write out the game type whether we are in a game or not - - if ( GetGameLobby().IsSessionActive() ) { - retmsg.WriteLong( GetGameLobby().parms.GetGameMap() ); - retmsg.WriteLong( GetGameLobby().parms.GetGameMode() ); - } else { - retmsg.WriteLong( -1 ); - retmsg.WriteLong( -1 ); - } - - retmsg.WriteLong( GetActiveLobby()->GetNumLobbyUsers() ); - retmsg.WriteLong( GetActiveLobby()->parms.GetNumSlots() ); - for ( int i = 0; i < GetActiveLobby()->GetNumLobbyUsers(); i++ ) { - retmsg.WriteString( GetActiveLobby()->GetLobbyUserName( i ) ); - } - } - - // Send it - GetPartyLobby().SendConnectionLess( remoteAddr, idLobby::OOB_MATCH_QUERY_ACK, retmsg.GetWriteData(), retmsg.GetSize() ); -} - -/* -======================== -idSessionLocal::HandleDedicatedServerQueryAck -======================== -*/ -void idSessionLocal::HandleDedicatedServerQueryAck( lobbyAddress_t & remoteAddr, idBitMsg & msg ) { - NET_VERBOSE_PRINT( "HandleDedicatedServerQueryAck from %s\n", remoteAddr.ToString() ); -} - -/* -======================== -idSessionLocal::StartSessions -======================== -*/ -void idSessionLocal::StartSessions() { - if ( GetPartyLobby().lobbyBackend != NULL ) { - GetPartyLobby().lobbyBackend->StartSession(); - } - - if ( GetGameLobby().lobbyBackend != NULL ) { - GetGameLobby().lobbyBackend->StartSession(); - } - - SetLobbiesAreJoinable( false ); -} - -/* -======================== -idSessionLocal::EndSessions -======================== -*/ -void idSessionLocal::EndSessions() { - if ( GetPartyLobby().lobbyBackend != NULL ) { - GetPartyLobby().lobbyBackend->EndSession(); - } - - if ( GetGameLobby().lobbyBackend != NULL ) { - GetGameLobby().lobbyBackend->EndSession(); - } - - SetLobbiesAreJoinable( true ); -} - -/* -======================== -idSessionLocal::SetLobbiesAreJoinable -======================== -*/ -void idSessionLocal::SetLobbiesAreJoinable( bool joinable ) { - // NOTE - We don't manipulate the joinable state when we are supporting join in progress - // Lobbies will naturally be non searchable when there are no free slots - if ( GetPartyLobby().lobbyBackend != NULL && !MatchTypeIsJoinInProgress( GetPartyLobby().parms.GetSessionMatchFlags() ) ) { - NET_VERBOSE_PRINT( "Party lobbyBackend SetIsJoinable: %d\n", joinable ); - GetPartyLobby().lobbyBackend->SetIsJoinable( joinable ); - } - - if ( GetGameLobby().lobbyBackend != NULL && !MatchTypeIsJoinInProgress( GetGameLobby().parms.GetSessionMatchFlags() ) ) { - GetGameLobby().lobbyBackend->SetIsJoinable( joinable ); - NET_VERBOSE_PRINT( "Game lobbyBackend SetIsJoinable: %d\n", joinable ); - - } -} - -/* -======================== -idSessionLocal::EndMatchForMigration -======================== -*/ -void idSessionLocal::EndMatchForMigration() { - ClearVoiceGroups(); -} - -/* -======================== -idSessionLocal::ClearVoiceGroups -======================== -*/ -void idSessionLocal::ClearVoiceGroups() { - /* - for ( int i = 0; i < GetGameLobby().GetNumLobbyUsers(); ++i ) { - SetGameSessionUserChatGroup( i, 0 ); - } - SetActiveChatGroup( 0 ); - */ -} - -/* -======================== -idSessionLocal::GoodbyeFromHost -======================== -*/ -void idSessionLocal::GoodbyeFromHost( idLobby & lobby, int peerNum, const lobbyAddress_t & remoteAddress, int msgType ) { - if ( !verify( localState > STATE_IDLE ) ) { - idLib::Printf( "NET: Got disconnected from host %s on session %s when we were not in a lobby or game.\n", remoteAddress.ToString(), lobby.GetLobbyName() ); - MoveToMainMenu(); - return; // Ignore if we are not past the main menu - } - - // Goodbye from host. See if we were connecting vs connected - if ( ( localState == STATE_CONNECT_AND_MOVE_TO_PARTY || localState == STATE_CONNECT_AND_MOVE_TO_GAME ) && lobby.peers[peerNum].GetConnectionState() == idLobby::CONNECTION_CONNECTING ) { - // We were denied a connection attempt - idLib::Printf( "NET: Denied connection attempt from host %s on session %s. MsgType %i.\n", remoteAddress.ToString(), lobby.GetLobbyName(), msgType ); - // This will try to move to the next connection if one exists, otherwise will create a match - HandleConnectionFailed( lobby, msgType == idLobby::OOB_GOODBYE_FULL ); - } else { - // We were disconnected from a server we were previously connected to - idLib::Printf( "NET: Disconnected from host %s on session %s. MsgType %i.\n", remoteAddress.ToString(), lobby.GetLobbyName(), msgType ); - - const bool leaveGameWithParty = ( msgType == idLobby::OOB_GOODBYE_W_PARTY ); - - if ( leaveGameWithParty && lobby.lobbyType == idLobby::TYPE_GAME && lobby.IsPeer() && GetState() == idSession::GAME_LOBBY && GetPartyLobby().host >= 0 && - lobby.peers[peerNum].address.Compare( GetPartyLobby().peers[GetPartyLobby().host].address, true ) ) { - // If a host is telling us goodbye from a game lobby, and the game host is the same as our party host, - // and we aren't in a game, and the host wants us to leave with him, then do so now - GetGameLobby().Shutdown(); - SetState( STATE_PARTY_LOBBY_PEER ); - } else { - // Host left, so pick a new host (possibly even us) for this lobby - lobby.PickNewHost(); - } - } -} - -/* -======================== -idSessionLocal::HandlePackets -======================== -*/ -bool idSessionLocal::HandlePackets() { - byte packetBuffer[ idPacketProcessor::MAX_FINAL_PACKET_SIZE ]; - lobbyAddress_t remoteAddress; - int recvSize = 0; - - while ( ReadRawPacket( remoteAddress, packetBuffer, recvSize, sizeof( packetBuffer ) ) && recvSize > 0 ) { - // fragMsg will hold the raw packet - idBitMsg fragMsg; - fragMsg.InitRead( packetBuffer, recvSize ); - - // Peek at the session ID - idPacketProcessor::sessionId_t sessionID = idPacketProcessor::GetSessionID( fragMsg ); - - // idLib::Printf( "NET: HandlePackets - session %d, size %d \n", sessionID, recvSize ); - - // Make sure it's valid - if ( sessionID == idPacketProcessor::SESSION_ID_INVALID ) { - idLib::Printf( "NET: Invalid sessionID %s.\n", remoteAddress.ToString() ); - continue; - } - - // Distribute the packet to the proper lobby - if ( sessionID & 1 ) { - GetGameLobby().HandlePacket( remoteAddress, fragMsg, sessionID ); - } else { - GetPartyLobby().HandlePacket( remoteAddress, fragMsg, sessionID ); - } - } - - return false; -} - -idCVar net_connectTimeoutInSeconds( "net_connectTimeoutInSeconds", "15", CVAR_INTEGER, "timeout (in seconds) while connecting" ); -idCVar net_testPartyMemberConnectFail( "net_testPartyMemberConnectFail", "-1", CVAR_INTEGER, "Force this party member index to fail to connect to games." ); - -/* -======================== -idSessionLocal::HandleConnectAndMoveToLobby -Called from State_Connect_And_Move_To_Party/State_Connect_And_Move_To_Game -======================== -*/ -bool idSessionLocal::HandleConnectAndMoveToLobby( idLobby & lobby ) { - assert( localState == STATE_CONNECT_AND_MOVE_TO_PARTY || localState == STATE_CONNECT_AND_MOVE_TO_GAME ); - assert( connectType == CONNECT_FIND_OR_CREATE || connectType == CONNECT_DIRECT ); - - if ( lobby.GetState() == idLobby::STATE_FAILED ) { - // If we get here, we were trying to connect to a lobby (from state State_Connect_And_Move_To_Party/State_Connect_And_Move_To_Game) - HandleConnectionFailed( lobby, false ); - return true; - } - - if ( lobby.GetState() != idLobby::STATE_IDLE ) { - return HandlePackets(); // Valid but busy - } - - assert( !GetPartyLobby().waitForPartyOk ); - - // - // Past this point, we've connected to the lobby - // - - // If we are connecting to a game lobby, see if we need to keep waiting as either a host or peer while we're confirming all party members made it - if ( lobby.lobbyType == idLobby::TYPE_GAME ) { - if ( GetPartyLobby().IsHost() ) { - // As a host, wait until all party members make it - assert( !GetGameLobby().waitForPartyOk ); - - const int timeoutMs = net_connectTimeoutInSeconds.GetInteger() * 1000; - - if ( timeoutMs != 0 && Sys_Milliseconds() - lobby.helloStartTime > timeoutMs ) { - // Took too long, move to next result, or create a game instead - HandleConnectionFailed( lobby, false ); - return true; - } - - int numUsersIn = 0; - - for ( int i = 0; i < GetPartyLobby().GetNumLobbyUsers(); i++ ) { - - if ( net_testPartyMemberConnectFail.GetInteger() == i ) { - continue; - } - - bool foundUser = false; - - lobbyUser_t * partyUser = GetPartyLobby().GetLobbyUser( i ); - - for ( int j = 0; j < GetGameLobby().GetNumLobbyUsers(); j++ ) { - lobbyUser_t * gameUser = GetGameLobby().GetLobbyUser( j ); - - if ( GetGameLobby().IsSessionUserLocal( gameUser ) || gameUser->address.Compare( partyUser->address, true ) ) { - numUsersIn++; - foundUser = true; - break; - } - } - - assert( !GetPartyLobby().IsSessionUserIndexLocal( i ) || foundUser ); - } - - if ( numUsersIn != GetPartyLobby().GetNumLobbyUsers() ) { - return HandlePackets(); // All users not in, keep waiting until all user make it, or we time out - } - - NET_VERBOSE_PRINT( "NET: All party members made it into the game lobby.\n" ); - - // Let all the party members know everyone made it, and it's ok to stay at this server - for ( int i = 0; i < GetPartyLobby().peers.Num(); i++ ) { - if ( GetPartyLobby().peers[ i ].IsConnected() ) { - GetPartyLobby().QueueReliableMessage( i, idLobby::RELIABLE_PARTY_CONNECT_OK ); - } - } - } else { - if ( !verify ( lobby.host != -1 ) ) { - MoveToMainMenu(); - connectType = CONNECT_NONE; - return false; - } - - // As a peer, wait for server to tell us everyone made it - if ( GetGameLobby().waitForPartyOk ) { - const int timeoutMs = net_connectTimeoutInSeconds.GetInteger() * 1000; - - if ( timeoutMs != 0 && Sys_Milliseconds() - lobby.helloStartTime > timeoutMs ) { - GetGameLobby().waitForPartyOk = false; // Just connect to this game lobby if we haven't heard from the party host for the entire timeout duration - } - } - - if ( GetGameLobby().waitForPartyOk ) { - return HandlePackets(); // Waiting on party host to tell us everyone made it - } - } - } - - // Success - SetState( lobby.lobbyType == idLobby::TYPE_PARTY ? STATE_PARTY_LOBBY_PEER : STATE_GAME_LOBBY_PEER ); - connectType = CONNECT_NONE; - - return false; -} - -/* -======================== -idSessionLocal::MoveToMainMenu -======================== -*/ -void idSessionLocal::MoveToMainMenu() { - GetPartyLobby().Shutdown(); - GetGameLobby().Shutdown(); - SetState( STATE_IDLE ); -} - - -/* -======================== -idSessionLocal::HandleConnectionFailed -Called anytime a connection fails, and does the right thing. -======================== -*/ -void idSessionLocal::HandleConnectionFailed( idLobby & lobby, bool wasFull ) { - assert( localState == STATE_CONNECT_AND_MOVE_TO_PARTY || localState == STATE_CONNECT_AND_MOVE_TO_GAME ); - assert( connectType == CONNECT_FIND_OR_CREATE || connectType == CONNECT_DIRECT ); - bool canPlayOnline = true; - - // Check for online status (this is only a problem on the PS3 at the moment. The 360 LIVE system handles this for us - if ( GetSignInManager().GetMasterLocalUser() != NULL ) { - canPlayOnline = GetSignInManager().GetMasterLocalUser()->CanPlayOnline(); - } - - if ( connectType == CONNECT_FIND_OR_CREATE ) { - // Clear the "Lobby was Full" dialog in case it's up - // We only want to see this msg when doing a direct connect (CONNECT_DIRECT) - common->Dialog().ClearDialog( GDM_LOBBY_FULL ); - - assert( localState == STATE_CONNECT_AND_MOVE_TO_GAME ); - assert( lobby.lobbyType == idLobby::TYPE_GAME ); - if ( !lobby.ConnectToNextSearchResult() ) { - CreateMatch( GetGameLobby().parms ); // Assume any time we are connecting to a game lobby, it is from a FindOrCreateMatch call, so create a match - } - } else if ( connectType == CONNECT_DIRECT ) { - if ( localState == STATE_CONNECT_AND_MOVE_TO_GAME && GetPartyLobby().IsPeer() ) { - - int flags = GetPartyLobby().parms.GetSessionMatchFlags(); - - if ( MatchTypeIsOnline( flags ) && ( flags & MATCH_REQUIRE_PARTY_LOBBY ) && ( ( flags & MATCH_PARTY_INVITE_PLACEHOLDER ) == 0 ) ) { - // We get here when our party host told us to connect to a game, but the game didn't exist. - // Just drop back to the party lobby and wait for further orders. - SetState( STATE_PARTY_LOBBY_PEER ); - return; - } - } - - if ( wasFull ) { - common->Dialog().AddDialog( GDM_LOBBY_FULL, DIALOG_ACCEPT, NULL, NULL, false ); - } else if ( !canPlayOnline ) { - common->Dialog().AddDialog( GDM_PLAY_ONLINE_NO_PROFILE, DIALOG_ACCEPT, NULL, NULL, false ); - } else { - // TEMP HACK: We detect the steam lobby is full in idLobbyBackendWin, and then STATE_FAILED, which brings us here. Need to find a way to notify - // session local that the game was full so we don't do this check here - // eeubanks: Pollard, how do you think we should handle this? - if ( !common->Dialog().HasDialogMsg( GDM_LOBBY_FULL, NULL ) ) { - common->Dialog().AddDialog( GDM_INVALID_INVITE, DIALOG_ACCEPT, NULL, NULL, false ); - } - } - MoveToMainMenu(); - } else { - // Shouldn't be possible, but just in case - MoveToMainMenu(); - } -} - -/* -======================== -idSessionLocal::SendRawPacket -======================== -*/ -void idSessionLocal::SendRawPacket( const lobbyAddress_t & to, const void * data, int size ) { - GetPort().SendRawPacket( to, data, size ); -} - -/* -======================== -idSessionLocal::ReadRawPacket -======================== -*/ -bool idSessionLocal::ReadRawPacket( lobbyAddress_t & from, void * data, int & size, int maxSize ) { - return GetPort().ReadRawPacket( from, data, size, maxSize ); -} - -/* -======================== -idSessionLocal::ConnectAndMoveToLobby -======================== -*/ -void idSessionLocal::ConnectAndMoveToLobby( idLobby & lobby, const lobbyConnectInfo_t & connectInfo, bool fromInvite ) { - - // Since we are connecting directly to a lobby, make sure no search results are left over from previous FindOrCreateMatch results - // If we don't do this, we might think we should attempt to connect to an old search result, and we don't want to in this case - lobby.searchResults.Clear(); - - // Attempt to connect to the lobby - lobby.ConnectTo( connectInfo, fromInvite ); - - connectType = CONNECT_DIRECT; - - // Wait for connection - SetState( lobby.lobbyType == idLobby::TYPE_PARTY ? STATE_CONNECT_AND_MOVE_TO_PARTY : STATE_CONNECT_AND_MOVE_TO_GAME ); -} - -/* -======================== -idSessionLocal::WriteLeaderboardToMsg -======================== -*/ -void idSessionLocal::WriteLeaderboardToMsg( idBitMsg & msg, const leaderboardDefinition_t * leaderboard, const column_t * stats ) { - assert( Sys_FindLeaderboardDef( leaderboard->id ) == leaderboard ); - - msg.WriteLong( leaderboard->id ); - - for ( int i = 0; i < leaderboard->numColumns; ++i ) { - uint64 value = stats[i].value; - - //idLib::Printf( "value = %i\n", (int32)value ); - - for ( int j = 0; j < leaderboard->columnDefs[i].bits; j++ ) { - msg.WriteBits( value & 1, 1 ); - value >>= 1; - } - //msg.WriteData( &stats[i].value, sizeof( stats[i].value ) ); - } -} - -/* -======================== -idSessionLocal::ReadLeaderboardFromMsg -======================== -*/ -const leaderboardDefinition_t * idSessionLocal::ReadLeaderboardFromMsg( idBitMsg & msg, column_t * stats ) { - int id = msg.ReadLong(); - - const leaderboardDefinition_t * leaderboard = Sys_FindLeaderboardDef( id ); - - if ( leaderboard == NULL ) { - idLib::Printf( "NET: Invalid leaderboard id: %i\n", id ); - return NULL; - } - - for ( int i = 0; i < leaderboard->numColumns; ++i ) { - uint64 value = 0; - - for ( int j = 0; j < leaderboard->columnDefs[i].bits; j++ ) { - value |= (uint64)( msg.ReadBits( 1 ) & 1 ) << j; - } - - stats[i].value = value; - - //idLib::Printf( "value = %i\n", (int32)value ); - //msg.ReadData( &stats[i].value, sizeof( stats[i].value ) ); - } - - return leaderboard; -} - -/* -======================== -idSessionLocal::EndMatchInternal -======================== -*/ -void idSessionLocal::EndMatchInternal( bool premature/*=false*/ ) { - ClearVoiceGroups(); - - - for ( int p = 0; p < GetGameLobby().peers.Num(); p++ ) { - // If we are the host, increment the session ID. The client will use a rolling check to catch it - if ( GetGameLobby().IsHost() ) { - if ( GetGameLobby().peers[p].IsConnected() ) { - if ( GetGameLobby().peers[p].packetProc != NULL ) { - GetGameLobby().peers[p].packetProc->VerifyEmptyReliableQueue( idLobby::RELIABLE_GAME_DATA, idLobby::RELIABLE_DUMMY_MSG ); - } - GetGameLobby().peers[p].sessionID = GetGameLobby().IncrementSessionID( GetGameLobby().peers[p].sessionID ); - } - } - GetGameLobby().peers[p].ResetMatchData(); - } - - - GetGameLobby().loaded = false; - //gameLobbyWasCoalesced = false; // Reset this back to false. We use this so the lobby code doesn't randomly choose a map when we coalesce - - ClearMigrationState(); - - if ( common->IsMultiplayer() ) { - if ( GetGameLobby().IsSessionActive() ) { - // All peers need to remove disconnected users to stay in sync - GetGameLobby().CompactDisconnectedUsers(); - - // Go back to the game lobby - if ( GetGameLobby().IsHost() ) { - SetState( STATE_GAME_LOBBY_HOST ); - } else { - SetState( STATE_GAME_LOBBY_PEER ); - } - } else { - // Oops, no game lobby? - assert( false ); // how is this possible? - MoveToMainMenu(); - } - } else { - SetState( STATE_IDLE ); - } - - if ( GetGameLobby().IsHost() ) { - // Send a reliable msg to all peers to also "EndMatch" - for ( int p = 0; p < GetGameLobby().peers.Num(); p++ ) { - GetGameLobby().QueueReliableMessage( p, premature ? idLobby::RELIABLE_ENDMATCH_PREMATURE : idLobby::RELIABLE_ENDMATCH ); - } - } else if( premature ) { - // Notify client that host left early and thats why we are back in the lobby - bool stats = MatchTypeHasStats( GetGameLobby().GetMatchParms().GetSessionMatchFlags() ) && ( GetFlushedStats() == false ); - common->Dialog().AddDialog( stats ? GDM_HOST_RETURNED_TO_LOBBY_STATS_DROPPED : GDM_HOST_RETURNED_TO_LOBBY, DIALOG_ACCEPT, NULL, NULL, false, __FUNCTION__, __LINE__, true ); - } -} - -/* -======================== -idSessionLocal::HandleOobVoiceAudio -======================== -*/ -void idSessionLocal::HandleOobVoiceAudio( const lobbyAddress_t & from, const idBitMsg & msg ) { - - idLobby * activeLobby = GetActiveLobby(); - - if ( activeLobby == NULL ) { - return; - } - - voiceChat->SetActiveLobby( activeLobby->lobbyType ); - - voiceChat->SubmitIncomingChatData( msg.GetReadData() + msg.GetReadCount(), msg.GetSize() - msg.GetReadCount() ); -} - -/* -======================== -idSessionLocal::ClearMigrationState -======================== -*/ -void idSessionLocal::ClearMigrationState() { - // We are ending the match without migration, so clear that state - GetPartyLobby().ResetAllMigrationState(); - GetGameLobby().ResetAllMigrationState(); -} - - -/* -======================== -idSessionLocal::SendLeaderboardStatsToPlayer -======================== -*/ -void idSessionLocal::SendLeaderboardStatsToPlayer( int sessionUserIndex, const leaderboardDefinition_t * leaderboard, const column_t * stats ) { - - if ( GetGameLobby().IsLobbyUserDisconnected( sessionUserIndex ) ) { - idLib::Warning( "Tried to tell disconnected user to report stats" ); - return; - } - - const int peerIndex = GetGameLobby().PeerIndexFromLobbyUserIndex( sessionUserIndex ); - - if ( peerIndex == -1 ) { - idLib::Warning( "Tried to tell invalid peer index to report stats" ); - return; - } - - if ( !verify( GetGameLobby().IsHost() ) || - !verify( peerIndex < GetGameLobby().peers.Num() ) || - !verify( GetGameLobby().peers[ peerIndex ].IsConnected() ) ) { - idLib::Warning( "Tried to tell invalid peer to report stats" ); - return; - } - - NET_VERBOSE_PRINT( "Telling sessionUserIndex %i (peer %i) to report stats\n", sessionUserIndex, peerIndex ); - - lobbyUser_t * gameUser = GetGameLobby().GetLobbyUser( sessionUserIndex ); - - if ( !verify( gameUser != NULL ) ) { - return; - } - - byte buffer[ idPacketProcessor::MAX_PACKET_SIZE ]; - idBitMsg msg; - msg.InitWrite( buffer, sizeof( buffer ) ); - - // Use the user ID - msg.WriteLong( gameUser->userID ); - - WriteLeaderboardToMsg( msg, leaderboard, stats ); - - GetGameLobby().QueueReliableMessage( peerIndex, idLobby::RELIABLE_POST_STATS, msg.GetWriteData(), msg.GetSize() ); -} - -/* -======================== -idSessionLocal::RecvLeaderboardStatsForPlayer -======================== -*/ -void idSessionLocal::RecvLeaderboardStatsForPlayer( idBitMsg & msg ) { - column_t stats[ MAX_LEADERBOARD_COLUMNS ]; - - int userID = msg.ReadLong(); - - int sessionUserIndex = GetGameLobby().FindSessionUserByUserId( userID ); - - const leaderboardDefinition_t * leaderboard = ReadLeaderboardFromMsg( msg, stats ); - - if ( leaderboard == NULL ) { - idLib::Printf( "RecvLeaderboardStatsForPlayer: Invalid lb.\n" ); - return; - } - - LeaderboardUpload( sessionUserIndex, leaderboard, stats ); -} \ No newline at end of file diff --git a/neo/framework/Unzip.h b/neo/framework/Unzip.h index d990ca20..d0f619fc 100644 --- a/neo/framework/Unzip.h +++ b/neo/framework/Unzip.h @@ -37,7 +37,7 @@ #ifndef __UNZIP_H__ #define __UNZIP_H__ -#include "zlib/zlib.h" +#include "../libs/zlib/zlib.h" #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted diff --git a/neo/framework/Zip.cpp b/neo/framework/Zip.cpp index 1c9a9fa1..479c2ea5 100644 --- a/neo/framework/Zip.cpp +++ b/neo/framework/Zip.cpp @@ -39,7 +39,7 @@ Contains external code for building ZipFiles. #include "Unzip.h" #undef STDC -#include "zlib/zutil.h" +#include "../libs/zlib/zutil.h" /* zip.c -- IO on .zip files using zlib Version 1.01e, February 12th, 2005 diff --git a/neo/framework/Zip.h b/neo/framework/Zip.h index cfffae51..a7242d60 100644 --- a/neo/framework/Zip.h +++ b/neo/framework/Zip.h @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms #ifndef __ZIP_H__ #define __ZIP_H__ -#include "zlib/zlib.h" +#include "../libs/zlib/zlib.h" /* ================================================================================================ diff --git a/neo/idlib/CMakeLists.txt b/neo/idlib/CMakeLists.txt new file mode 100644 index 00000000..f0307ce3 --- /dev/null +++ b/neo/idlib/CMakeLists.txt @@ -0,0 +1,20 @@ + +add_definitions(-D__IDLIB__ -D__DOOM_DLL__) + +file(GLOB_RECURSE ID_INCLUDES *.h) +file(GLOB_RECURSE ID_SOURCES *.cpp) + +if(MSVC) + list(REMOVE_ITEM ID_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/math/Simd_AltiVec.h) + list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/math/Simd_AltiVec.cpp) + list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/bv/Frustum_gcc.cpp) +elseif(NOT APPLE) + list(REMOVE_ITEM ID_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/math/Simd_AltiVec.h) + list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/math/Simd_AltiVec.cpp) +endif() + +#if(STANDALONE) +# add_definitions(-DSTANDALONE) +#endif() + +add_library(idlib ${ID_SOURCES} ${ID_INCLUDES}) diff --git a/neo/libs/zlib/example.c b/neo/libs/zlib/example.c deleted file mode 100644 index 6c8a0ee7..00000000 --- a/neo/libs/zlib/example.c +++ /dev/null @@ -1,565 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2004 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include -#include "zlib.h" - -#ifdef STDC -# include -# include -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -const char dictionary[] = "hello"; -uLong dictId; /* Adler32 value of the dictionary */ - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, - Byte *uncompr, uLong uncomprLen)); -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = (uLong)strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(fname, uncompr, uncomprLen) - const char *fname; /* compressed file name */ - Byte *uncompr; - uLong uncomprLen; -{ -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - int len = (int)strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - strcpy((char*)uncompr, "garbage"); - - if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - if (gzungetc(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - - gzclose(file); -#endif -} - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uLong len = (uLong)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uInt len = (uInt)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (Bytef*)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/neo/renderer/Image_files.cpp b/neo/renderer/Image_files.cpp index f76eabd1..706c9778 100644 --- a/neo/renderer/Image_files.cpp +++ b/neo/renderer/Image_files.cpp @@ -48,7 +48,7 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height, bool ma * You may also wish to include "jerror.h". */ -#include "jpeg-6/jpeglib.h" +#include "../libs/jpeg-6/jpeglib.h" // hooks from jpeg lib to our system diff --git a/neo/swf/SWF_Image.cpp b/neo/swf/SWF_Image.cpp index 0365b23b..920697d1 100644 --- a/neo/swf/SWF_Image.cpp +++ b/neo/swf/SWF_Image.cpp @@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms #include "../idlib/precompiled.h" #include "../renderer/Image.h" //#include "../../renderer/ImageTools/ImageProcess.h" -#include "../renderer/jpeg-6/jpeglib.h" +#include "../libs/jpeg-6/jpeglib.h" /* ======================== diff --git a/neo/swf/SWF_Zlib.cpp b/neo/swf/SWF_Zlib.cpp index 016490f7b..b0a9b592 100644 --- a/neo/swf/SWF_Zlib.cpp +++ b/neo/swf/SWF_Zlib.cpp @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #pragma hdrstop #include "../idlib/precompiled.h" -#include "../framework/zlib/zlib.h" +#include "../libs/zlib/zlib.h" /* ======================== diff --git a/neo/sys/win32/rc/doom.rc b/neo/sys/win32/rc/doom.rc index 57aba193..f650db56 100644 --- a/neo/sys/win32/rc/doom.rc +++ b/neo/sys/win32/rc/doom.rc @@ -7,7 +7,11 @@ // // Generated from the TEXTINCLUDE 2 resource. // +#if defined(USE_MFC_TOOLS) #include "afxres.h" +#else +#include +#endif ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/neo/sys/win32/win_gamma.cpp b/neo/sys/win32/win_gamma.cpp deleted file mode 100644 index 2d68f757..00000000 --- a/neo/sys/win32/win_gamma.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -/* -** WIN_GAMMA.C -*/ -#include -#include "win_local.h" -#include "../../renderer/tr_local.h" - -static unsigned short s_oldHardwareGamma[3][256]; - -/* -** WG_GetOldGammaRamp -** -*/ -void WG_GetOldGammaRamp( void ) -{ - HDC hDC; - - hDC = GetDC( GetDesktopWindow() ); - GetDeviceGammaRamp( hDC, s_oldHardwareGamma ); - ReleaseDC( GetDesktopWindow(), hDC ); - - -/* -** GLimp_SetGamma -** -*/ -void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] ) -{ - unsigned short table[3][256]; - int i; - - if ( !glw_state.hDC ) - { - return; - } - - for ( i = 0; i < 256; i++ ) - { - table[0][i] = ( ( ( unsigned short ) red[i] ) << 8 ) | red[i]; - table[1][i] = ( ( ( unsigned short ) green[i] ) << 8 ) | green[i]; - table[2][i] = ( ( ( unsigned short ) blue[i] ) << 8 ) | blue[i]; - } - - if ( !SetDeviceGammaRamp( glw_state.hDC, table ) ) { - common->Printf( "WARNING: SetDeviceGammaRamp failed.\n" ); - } -} - -/* -** WG_RestoreGamma -*/ -void WG_RestoreGamma( void ) -{ - HDC hDC; - - // if we never read in a reasonable looking - // table, don't write it out - if ( s_oldHardwareGamma[0][255] == 0 ) { - return; - } - - hDC = GetDC( GetDesktopWindow() ); - SetDeviceGammaRamp( hDC, s_oldHardwareGamma ); - ReleaseDC( GetDesktopWindow(), hDC ); -} - diff --git a/neo/sys/win32/win_stats.cpp b/neo/sys/win32/win_stats.cpp deleted file mode 100644 index 8bc6202a..00000000 --- a/neo/sys/win32/win_stats.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#pragma hdrstop -#include "../../framework/precompiled.h" diff --git a/neo/sys/win32/win_stats.h b/neo/sys/win32/win_stats.h deleted file mode 100644 index 95cec4b8..00000000 --- a/neo/sys/win32/win_stats.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ -#ifndef __WIN_STATS_H__ -#define __WIN_STATS_H__ - - -#endif // !__WIN_STATS_H__ diff --git a/neo/ui/GameWindow.cpp b/neo/ui/GameWindow.cpp deleted file mode 100644 index 820fbd5c..00000000 --- a/neo/ui/GameWindow.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "../idlib/precompiled.h" -#pragma hdrstop - -#include "DeviceContext.h" -#include "Window.h" -#include "UserInterfaceLocal.h" -#include "GameWindow.h" - -/* -================ -idGameWindowProxy::idGameWindowProxy -================ -*/ -idGameWindowProxy::idGameWindowProxy( idDeviceContext *d, idUserInterfaceLocal *g ) : idWindow( d, g ) { } - -/* -================ -idGameWindowProxy::Draw -================ -*/ -void idGameWindowProxy::Draw( int time, float x, float y ) { - common->Printf( "TODO: idGameWindowProxy::Draw\n" ); -} - diff --git a/neo/ui/GameWindow.h b/neo/ui/GameWindow.h deleted file mode 100644 index 782ec987..00000000 --- a/neo/ui/GameWindow.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#ifndef __GAMEWINDOW_H__ -#define __GAMEWINDOW_H__ - -class idGameWindowProxy : public idWindow { -public: - idGameWindowProxy( idDeviceContext *d, idUserInterfaceLocal *gui ); - void Draw( int time, float x, float y ); -}; - -#endif