mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-14 01:01:05 +02:00
Quake 4 integrated with DoomRTX
This commit is contained in:
@@ -1,27 +1,12 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
This file is part of the Doom 3 GPL Source Code.
|
||||
|
||||
IceTech 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.
|
||||
|
||||
IceTech 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 IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the IceTech 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 IceTech 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 Justin Marshall, justinmarshall20@gmail.com
|
||||
Quake 4 compatibility additions guarded with QUAKE4.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
@@ -34,24 +19,84 @@ If you have questions concerning this license or the applicable additional terms
|
||||
idNetworkSystem networkSystemLocal;
|
||||
idNetworkSystem * networkSystem = &networkSystemLocal;
|
||||
|
||||
#ifdef QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::Shutdown
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::Shutdown( void ) {
|
||||
sortFunctions.Clear();
|
||||
activeSortFunctions.Clear();
|
||||
clientServerInfo.Clear();
|
||||
repeaterInfo.Clear();
|
||||
httpEnabled = false;
|
||||
memset( &scannedServer, 0, sizeof( scannedServer ) );
|
||||
memset( &scannedClient, 0, sizeof( scannedClient ) );
|
||||
}
|
||||
|
||||
#endif // QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerSendReliableMessage
|
||||
==================
|
||||
*/
|
||||
#ifdef QUAKE4
|
||||
void idNetworkSystem::ServerSendReliableMessage( int clientNum, const idBitMsg &msg, bool inhibitRepeater ) {
|
||||
// Doom 3 has no repeater path; keep the Q4 argument for interface compatibility.
|
||||
(void)inhibitRepeater;
|
||||
#else
|
||||
void idNetworkSystem::ServerSendReliableMessage( int clientNum, const idBitMsg &msg ) {
|
||||
#endif
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessage( clientNum, msg );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RepeaterSendReliableMessage
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::RepeaterSendReliableMessage( int clientNum, const idBitMsg &msg, bool inhibitHeader, int including ) {
|
||||
// Repeater networking is a Quake 4 runtime feature. Doom 3 does not have this path.
|
||||
(void)clientNum;
|
||||
(void)msg;
|
||||
(void)inhibitHeader;
|
||||
(void)including;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RepeaterSendReliableMessageExcluding
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::RepeaterSendReliableMessageExcluding( int excluding, const idBitMsg &msg, bool inhibitHeader, int clientNum ) {
|
||||
// Repeater networking is a Quake 4 runtime feature. Doom 3 does not have this path.
|
||||
(void)excluding;
|
||||
(void)msg;
|
||||
(void)inhibitHeader;
|
||||
(void)clientNum;
|
||||
}
|
||||
|
||||
#endif // QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerSendReliableMessageExcluding
|
||||
==================
|
||||
*/
|
||||
#ifdef QUAKE4
|
||||
void idNetworkSystem::ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg, bool inhibitRepeater ) {
|
||||
// Doom 3 has no repeater path; keep the Q4 argument for interface compatibility.
|
||||
(void)inhibitRepeater;
|
||||
#else
|
||||
void idNetworkSystem::ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg ) {
|
||||
#endif
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessageExcluding( clientNum, msg );
|
||||
}
|
||||
@@ -141,6 +186,48 @@ float idNetworkSystem::ServerGetClientIncomingPacketLoss( int clientNum ) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#ifdef QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerGetClientNum
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::ServerGetClientNum( int clientId ) {
|
||||
// Doom 3 does not maintain Q4 clientId mappings here.
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerGetServerTime
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::ServerGetServerTime( void ) {
|
||||
return Sys_Milliseconds();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerConnectBot
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::ServerConnectBot( void ) {
|
||||
// Bot connection is game/runtime specific. Return failure unless your Q4 server layer wires this in.
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RepeaterGetClientNum
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::RepeaterGetClientNum( int clientId ) {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
#endif // QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ClientSendReliableMessage
|
||||
@@ -213,3 +300,229 @@ float idNetworkSystem::ClientGetIncomingPacketLoss( void ) {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#ifdef QUAKE4
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetServerAddress
|
||||
==================
|
||||
*/
|
||||
const char *idNetworkSystem::GetServerAddress( void ) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetClientAddress
|
||||
==================
|
||||
*/
|
||||
const char *idNetworkSystem::GetClientAddress( int clientNum ) {
|
||||
(void)clientNum;
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::AddFriend
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::AddFriend( int clientNum ) {
|
||||
(void)clientNum;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RemoveFriend
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::RemoveFriend( int clientNum ) {
|
||||
(void)clientNum;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::SetLoadingText
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::SetLoadingText( const char *loadingText ) {
|
||||
(void)loadingText;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::AddLoadingIcon
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::AddLoadingIcon( const char *icon ) {
|
||||
(void)icon;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetClientGUID
|
||||
==================
|
||||
*/
|
||||
const char *idNetworkSystem::GetClientGUID( int clientNum ) {
|
||||
(void)clientNum;
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetTrafficStats
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::GetTrafficStats( int &bytesSent, int &packetsSent, int &bytesReceived, int &packetsReceived ) const {
|
||||
bytesSent = 0;
|
||||
packetsSent = 0;
|
||||
bytesReceived = 0;
|
||||
packetsReceived = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetNumScannedServers
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::GetNumScannedServers( void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetScannedServerInfo
|
||||
==================
|
||||
*/
|
||||
const scannedServer_t *idNetworkSystem::GetScannedServerInfo( int serverNum ) {
|
||||
(void)serverNum;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetScannedServerClientInfo
|
||||
==================
|
||||
*/
|
||||
const scannedClient_t *idNetworkSystem::GetScannedServerClientInfo( int serverNum, int clientNum ) {
|
||||
(void)serverNum;
|
||||
(void)clientNum;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool SortInfoMatches( const sortInfo_t &a, const sortInfo_t &b ) {
|
||||
return a.column == b.column && a.compareFn == b.compareFn && a.filterFn == b.filterFn && idStr::Icmp( a.description ? a.description : "", b.description ? b.description : "" ) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::AddSortFunction
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::AddSortFunction( const sortInfo_t &sortInfo ) {
|
||||
for ( int i = 0; i < sortFunctions.Num(); i++ ) {
|
||||
if ( SortInfoMatches( sortFunctions[i], sortInfo ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sortFunctions.Append( sortInfo );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RemoveSortFunction
|
||||
==================
|
||||
*/
|
||||
bool idNetworkSystem::RemoveSortFunction( const sortInfo_t &sortInfo ) {
|
||||
bool removed = false;
|
||||
for ( int i = sortFunctions.Num() - 1; i >= 0; i-- ) {
|
||||
if ( SortInfoMatches( sortFunctions[i], sortInfo ) ) {
|
||||
sortFunctions.RemoveIndex( i );
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
for ( int i = activeSortFunctions.Num() - 1; i >= 0; i-- ) {
|
||||
if ( SortInfoMatches( activeSortFunctions[i], sortInfo ) ) {
|
||||
activeSortFunctions.RemoveIndex( i );
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::UseSortFunction
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::UseSortFunction( const sortInfo_t &sortInfo, bool use ) {
|
||||
if ( use ) {
|
||||
AddSortFunction( sortInfo );
|
||||
for ( int i = 0; i < activeSortFunctions.Num(); i++ ) {
|
||||
if ( SortInfoMatches( activeSortFunctions[i], sortInfo ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
activeSortFunctions.Append( sortInfo );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( int i = activeSortFunctions.Num() - 1; i >= 0; i-- ) {
|
||||
if ( SortInfoMatches( activeSortFunctions[i], sortInfo ) ) {
|
||||
activeSortFunctions.RemoveIndex( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::SortFunctionIsActive
|
||||
==================
|
||||
*/
|
||||
bool idNetworkSystem::SortFunctionIsActive( const sortInfo_t &sortInfo ) {
|
||||
for ( int i = 0; i < activeSortFunctions.Num(); i++ ) {
|
||||
if ( SortInfoMatches( activeSortFunctions[i], sortInfo ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::HTTPEnable
|
||||
==================
|
||||
*/
|
||||
bool idNetworkSystem::HTTPEnable( bool enable ) {
|
||||
httpEnabled = enable;
|
||||
return httpEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ClientSetServerInfo
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::ClientSetServerInfo( const idDict &serverSI ) {
|
||||
clientServerInfo = serverSI;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RepeaterSetInfo
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::RepeaterSetInfo( const idDict &info ) {
|
||||
repeaterInfo = info;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::GetViewerGUID
|
||||
==================
|
||||
*/
|
||||
const char *idNetworkSystem::GetViewerGUID( int clientNum ) {
|
||||
(void)clientNum;
|
||||
return "";
|
||||
}
|
||||
|
||||
#endif // QUAKE4
|
||||
|
||||
Reference in New Issue
Block a user