mirror of
https://github.com/jmarshall23/Quake_4_Alpha.git
synced 2026-08-15 15:50:52 +02:00
Fixed broken UI transitions.
Fixed collision manager code that wasn't properly reverse engineered. Fixed session code. Fixed numerous crashes.
This commit is contained in:
@@ -190,11 +190,7 @@ public:
|
||||
static idCVar gui_configServerRate;
|
||||
|
||||
int timeHitch;
|
||||
idRenderWorld * rw;
|
||||
int sw;
|
||||
idDemoFile * readDemo;
|
||||
idDemoFile * writeDemo;
|
||||
int renderdemoVersion;
|
||||
|
||||
bool menuActive;
|
||||
int menuSoundWorld; // SOUNDWORLD_MENU in Quake 4's id-based sound API
|
||||
@@ -310,14 +306,14 @@ public:
|
||||
void RunGameTic();
|
||||
|
||||
void FinishCmdLoad();
|
||||
void LoadLoadingGui(const char *mapName);
|
||||
void LoadLoadingGui( const char *mapName, const char *entityFilter );
|
||||
|
||||
void DemoShot( const char *name );
|
||||
|
||||
void TestGUI( const char *name );
|
||||
|
||||
int GetBytesNeededForMapLoad( const char *mapName );
|
||||
void SetBytesNeededForMapLoad( const char *mapName, int bytesNeeded );
|
||||
int GetBytesNeededForMapLoad( const char *mapName, const char *entityFilter );
|
||||
void SetBytesNeededForMapLoad( const char *mapName, const char *entityFilter, int bytesNeeded );
|
||||
|
||||
void ExecuteMapChange( bool noFadeWipe = false );
|
||||
void UnloadMap();
|
||||
|
||||
@@ -89,32 +89,6 @@ class idNetworkSystem {
|
||||
public:
|
||||
virtual ~idNetworkSystem( void ) {}
|
||||
|
||||
#ifdef Q4_RECON_ENGINE_PRIVATE
|
||||
// Interface and ordering recovered from quake4.exe's 24-slot vtable.
|
||||
virtual void ServerSendReliableMessage( int clientNum, const idBitMsg &msg );
|
||||
virtual void ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg );
|
||||
virtual int ServerGetClientPing( int clientNum );
|
||||
virtual int ServerGetClientPrediction( int clientNum );
|
||||
virtual int ServerGetClientTimeSinceLastPacket( int clientNum );
|
||||
virtual int ServerGetClientTimeSinceLastInput( int clientNum );
|
||||
virtual int ServerGetClientOutgoingRate( int clientNum );
|
||||
virtual int ServerGetClientIncomingRate( int clientNum );
|
||||
virtual float ServerGetClientIncomingPacketLoss( int clientNum );
|
||||
virtual void ClientSendReliableMessage( const idBitMsg &msg );
|
||||
virtual int ClientGetPrediction( void );
|
||||
virtual int ClientGetTimeSinceLastPacket( void );
|
||||
virtual int ClientGetOutgoingRate( void );
|
||||
virtual int ClientGetIncomingRate( void );
|
||||
virtual float ClientGetIncomingPacketLoss( void );
|
||||
virtual const char * GetServerAddress( void );
|
||||
virtual const char * GetClientAddress( int clientNum );
|
||||
virtual void AddFriend( int clientNum );
|
||||
virtual void RemoveFriend( int clientNum );
|
||||
virtual void SetLoadingText( const char *loadingText );
|
||||
virtual void AddLoadingIcon( const char *icon );
|
||||
virtual const char * GetClientGUID( int clientNum );
|
||||
virtual void GetTrafficStats( int &bytesSent, int &packetsSent, int &bytesReceived, int &packetsReceived ) const;
|
||||
#else
|
||||
virtual void Shutdown( void );
|
||||
|
||||
virtual void ServerSendReliableMessage( int clientNum, const idBitMsg &msg, bool inhibitRepeater = false );
|
||||
@@ -176,7 +150,6 @@ public:
|
||||
private:
|
||||
scannedServer_t scannedServer;
|
||||
scannedClient_t scannedClient;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern idNetworkSystem * networkSystem;
|
||||
|
||||
@@ -33,6 +33,30 @@ idNetworkSystem * networkSystem = &networkSystemLocal;
|
||||
// The retail implementation stores this state in Raven's server-scan object.
|
||||
// Keep the ABI-neutral state here until that UI scanner is reconstructed.
|
||||
static bool networkFriendClients[MAX_ASYNC_CLIENTS];
|
||||
static idList<sortInfo_t> networkSortFunctions;
|
||||
static idList<sortInfo_t> networkActiveSortFunctions;
|
||||
|
||||
static int FindSortFunction( const idList<sortInfo_t> &list, const sortInfo_t &sortInfo ) {
|
||||
for ( int i = 0; i < list.Num(); i++ ) {
|
||||
if ( list[i].column == sortInfo.column &&
|
||||
list[i].compareFn == sortInfo.compareFn &&
|
||||
list[i].filterFn == sortInfo.filterFn ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::Shutdown
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::Shutdown( void ) {
|
||||
networkSortFunctions.Clear();
|
||||
networkActiveSortFunctions.Clear();
|
||||
memset( networkFriendClients, 0, sizeof( networkFriendClients ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -40,18 +64,42 @@ static bool networkFriendClients[MAX_ASYNC_CLIENTS];
|
||||
idNetworkSystem::ServerSendReliableMessage
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::ServerSendReliableMessage( int clientNum, const idBitMsg &msg ) {
|
||||
void idNetworkSystem::ServerSendReliableMessage( int clientNum, const idBitMsg &msg, bool inhibitRepeater ) {
|
||||
(void)inhibitRepeater;
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessage( clientNum, msg );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::RepeaterSendReliableMessage
|
||||
idNetworkSystem::RepeaterSendReliableMessageExcluding
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::RepeaterSendReliableMessage( int clientNum, const idBitMsg &msg, bool inhibitHeader, int including ) {
|
||||
(void)inhibitHeader;
|
||||
(void)including;
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessage( clientNum, msg );
|
||||
}
|
||||
}
|
||||
|
||||
void idNetworkSystem::RepeaterSendReliableMessageExcluding( int excluding, const idBitMsg &msg, bool inhibitHeader, int clientNum ) {
|
||||
(void)inhibitHeader;
|
||||
(void)clientNum;
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessageExcluding( excluding, msg );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerSendReliableMessageExcluding
|
||||
==================
|
||||
*/
|
||||
void idNetworkSystem::ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg ) {
|
||||
void idNetworkSystem::ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg, bool inhibitRepeater ) {
|
||||
(void)inhibitRepeater;
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
idAsyncNetwork::server.SendReliableGameMessageExcluding( clientNum, msg );
|
||||
}
|
||||
@@ -69,18 +117,6 @@ int idNetworkSystem::ServerGetClientPing( int clientNum ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerGetClientPrediction
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::ServerGetClientPrediction( int clientNum ) {
|
||||
if ( idAsyncNetwork::server.IsActive() ) {
|
||||
return idAsyncNetwork::server.GetClientPrediction( clientNum );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerGetClientTimeSinceLastPacket
|
||||
@@ -141,6 +177,32 @@ float idNetworkSystem::ServerGetClientIncomingPacketLoss( int clientNum ) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ServerGetClientNum
|
||||
idNetworkSystem::ServerGetServerTime
|
||||
idNetworkSystem::ServerConnectBot
|
||||
idNetworkSystem::RepeaterGetClientNum
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::ServerGetClientNum( int clientId ) {
|
||||
// The reconstructed asynchronous server does not expose its private clientId
|
||||
// table. Local callers pass an already resolved client number.
|
||||
return ( clientId >= 0 && clientId < MAX_ASYNC_CLIENTS ) ? clientId : -1;
|
||||
}
|
||||
|
||||
int idNetworkSystem::ServerGetServerTime( void ) {
|
||||
return common->GetFrameTime();
|
||||
}
|
||||
|
||||
int idNetworkSystem::ServerConnectBot( void ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int idNetworkSystem::RepeaterGetClientNum( int clientId ) {
|
||||
return ServerGetClientNum( clientId );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem::ClientSendReliableMessage
|
||||
@@ -301,3 +363,100 @@ void idNetworkSystem::GetTrafficStats( int &bytesSent, int &packetsSent, int &by
|
||||
idAsyncNetwork::client.GetTrafficStats( bytesSent, packetsSent, bytesReceived, packetsReceived );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idNetworkSystem server browser API
|
||||
==================
|
||||
*/
|
||||
int idNetworkSystem::GetNumScannedServers( void ) {
|
||||
return idAsyncNetwork::client.serverList.Num();
|
||||
}
|
||||
|
||||
const scannedServer_t *idNetworkSystem::GetScannedServerInfo( int serverNum ) {
|
||||
if ( serverNum < 0 || serverNum >= idAsyncNetwork::client.serverList.Num() ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const networkServer_t &source = idAsyncNetwork::client.serverList[serverNum];
|
||||
scannedServer.adr = source.adr;
|
||||
scannedServer.serverInfo = source.serverInfo;
|
||||
scannedServer.ping = source.ping;
|
||||
scannedServer.clients = source.clients;
|
||||
scannedServer.OSMask = source.OSMask;
|
||||
scannedServer.favorite = false;
|
||||
scannedServer.dedicated = source.serverInfo.GetBool( "si_dedicated" );
|
||||
scannedServer.performanceFiltered = false;
|
||||
return &scannedServer;
|
||||
}
|
||||
|
||||
const scannedClient_t *idNetworkSystem::GetScannedServerClientInfo( int serverNum, int clientNum ) {
|
||||
if ( serverNum < 0 || serverNum >= idAsyncNetwork::client.serverList.Num() ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const networkServer_t &source = idAsyncNetwork::client.serverList[serverNum];
|
||||
if ( clientNum < 0 || clientNum >= source.clients || clientNum >= MAX_ASYNC_CLIENTS ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scannedClient.nickname = source.nickname[clientNum];
|
||||
scannedClient.clan.Clear();
|
||||
scannedClient.ping = source.pings[clientNum];
|
||||
scannedClient.rate = source.rate[clientNum];
|
||||
return &scannedClient;
|
||||
}
|
||||
|
||||
void idNetworkSystem::AddSortFunction( const sortInfo_t &sortInfo ) {
|
||||
if ( FindSortFunction( networkSortFunctions, sortInfo ) < 0 ) {
|
||||
networkSortFunctions.Append( sortInfo );
|
||||
}
|
||||
}
|
||||
|
||||
bool idNetworkSystem::RemoveSortFunction( const sortInfo_t &sortInfo ) {
|
||||
const int activeIndex = FindSortFunction( networkActiveSortFunctions, sortInfo );
|
||||
if ( activeIndex >= 0 ) {
|
||||
networkActiveSortFunctions.RemoveIndex( activeIndex );
|
||||
}
|
||||
const int index = FindSortFunction( networkSortFunctions, sortInfo );
|
||||
if ( index < 0 ) {
|
||||
return false;
|
||||
}
|
||||
networkSortFunctions.RemoveIndex( index );
|
||||
return true;
|
||||
}
|
||||
|
||||
void idNetworkSystem::UseSortFunction( const sortInfo_t &sortInfo, bool use ) {
|
||||
const int index = FindSortFunction( networkActiveSortFunctions, sortInfo );
|
||||
if ( use ) {
|
||||
AddSortFunction( sortInfo );
|
||||
if ( index < 0 ) {
|
||||
networkActiveSortFunctions.Append( sortInfo );
|
||||
}
|
||||
} else if ( index >= 0 ) {
|
||||
networkActiveSortFunctions.RemoveIndex( index );
|
||||
}
|
||||
}
|
||||
|
||||
bool idNetworkSystem::SortFunctionIsActive( const sortInfo_t &sortInfo ) {
|
||||
return FindSortFunction( networkActiveSortFunctions, sortInfo ) >= 0;
|
||||
}
|
||||
|
||||
bool idNetworkSystem::HTTPEnable( bool enable ) {
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
void idNetworkSystem::ClientSetServerInfo( const idDict &serverSI ) {
|
||||
if ( game != NULL ) {
|
||||
game->SetServerInfo( serverSI );
|
||||
}
|
||||
}
|
||||
|
||||
void idNetworkSystem::RepeaterSetInfo( const idDict &info ) {
|
||||
(void)info;
|
||||
}
|
||||
|
||||
const char *idNetworkSystem::GetViewerGUID( int clientNum ) {
|
||||
return GetClientGUID( clientNum );
|
||||
}
|
||||
|
||||
@@ -2815,6 +2815,7 @@ void idCommonLocal::LoadGameDLL( void ) {
|
||||
gameImport.declManager = ::declManager;
|
||||
gameImport.AASFileManager = ::AASFileManager;
|
||||
gameImport.collisionModelManager = ::collisionModelManager;
|
||||
gameImport.bse = ::bse;
|
||||
|
||||
gameExport = *GetGameAPI( &gameImport );
|
||||
|
||||
|
||||
+12
-10
@@ -439,7 +439,7 @@ void idConsoleLocal::Clear() {
|
||||
int i;
|
||||
|
||||
for ( i = 0 ; i < CON_TEXTSIZE ; i++ ) {
|
||||
text[i] = (idStr::ColorIndex(C_COLOR_CYAN)<<8) | ' ';
|
||||
text[i] = (idStr::ColorIndex(C_COLOR_CONSOLE)<<8) | ' ';
|
||||
}
|
||||
|
||||
Bottom(); // go to end
|
||||
@@ -830,7 +830,7 @@ void idConsoleLocal::Linefeed() {
|
||||
}
|
||||
current++;
|
||||
for ( i = 0; i < LINE_WIDTH; i++ ) {
|
||||
text[(current%TOTAL_LINES)*LINE_WIDTH+i] = (idStr::ColorIndex(C_COLOR_CYAN)<<8) | ' ';
|
||||
text[(current%TOTAL_LINES)*LINE_WIDTH+i] = (idStr::ColorIndex(C_COLOR_CONSOLE)<<8) | ' ';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +855,7 @@ void idConsoleLocal::Print( const char *txt ) {
|
||||
}
|
||||
#endif
|
||||
|
||||
color = idStr::ColorIndex( C_COLOR_CYAN );
|
||||
color = idStr::ColorIndex( C_COLOR_CONSOLE );
|
||||
|
||||
while ( (c = *(const unsigned char*)txt) != 0 ) {
|
||||
int escapeType;
|
||||
@@ -866,7 +866,7 @@ void idConsoleLocal::Print( const char *txt ) {
|
||||
continue;
|
||||
}
|
||||
if ( *( txt + 1 ) == C_COLOR_DEFAULT ) {
|
||||
color = idStr::ColorIndex( C_COLOR_CYAN );
|
||||
color = idStr::ColorIndex( C_COLOR_CONSOLE );
|
||||
} else {
|
||||
color = idStr::ColorIndex( *( txt + 1 ) );
|
||||
}
|
||||
@@ -963,7 +963,7 @@ void idConsoleLocal::DrawInput() {
|
||||
}
|
||||
}
|
||||
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CYAN ) );
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CONSOLE ) );
|
||||
|
||||
renderSystem->DrawSmallChar( 1 * SMALLCHAR_WIDTH, y, ']', localConsole.charSetShader );
|
||||
|
||||
@@ -1021,7 +1021,7 @@ void idConsoleLocal::DrawNotify() {
|
||||
v += SMALLCHAR_HEIGHT;
|
||||
}
|
||||
|
||||
renderSystem->SetColor( colorCyan );
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CONSOLE ) );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1057,13 +1057,15 @@ void idConsoleLocal::DrawSolidConsole( float frac ) {
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, y, 0, 1.0f - displayFrac, 1, 1, consoleShader );
|
||||
}
|
||||
|
||||
renderSystem->SetColor( colorCyan );
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CONSOLE ) );
|
||||
renderSystem->DrawStretchPic( 0, y, SCREEN_WIDTH, 2, 0, 0, 0, 0, whiteShader );
|
||||
renderSystem->SetColor( colorWhite );
|
||||
|
||||
// draw the version number
|
||||
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CYAN ) );
|
||||
idVec4 versionColor = colorWhite;
|
||||
versionColor.w = 0.5f;
|
||||
renderSystem->SetColor( versionColor );
|
||||
|
||||
idStr version = va( "%s %s %s V%s Build %u", "GSS_TEXT_NAME", "Quake4", "Release", "0.13.0.7", 1834u );
|
||||
i = version.Length();
|
||||
@@ -1084,7 +1086,7 @@ void idConsoleLocal::DrawSolidConsole( float frac ) {
|
||||
// draw from the bottom up
|
||||
if ( display != current ) {
|
||||
// draw arrows to show the buffer is backscrolled
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CYAN ) );
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CONSOLE ) );
|
||||
for ( x = 0; x < LINE_WIDTH; x += 4 ) {
|
||||
renderSystem->DrawSmallChar( (x+1)*SMALLCHAR_WIDTH, idMath::FtoiFast( y ), '^', localConsole.charSetShader );
|
||||
}
|
||||
@@ -1128,7 +1130,7 @@ void idConsoleLocal::DrawSolidConsole( float frac ) {
|
||||
// draw the input prompt, user text, and cursor if desired
|
||||
DrawInput();
|
||||
|
||||
renderSystem->SetColor( colorCyan );
|
||||
renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CONSOLE ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+21
-18
@@ -63,37 +63,40 @@ along with Quake 4 Reconstructed Source Code. If not, see <http://www.gnu.org/l
|
||||
|
||||
typedef enum {
|
||||
DECL_TABLE = 0,
|
||||
DECL_MATERIAL,
|
||||
DECL_SKIN,
|
||||
DECL_SOUND,
|
||||
DECL_ENTITYDEF,
|
||||
DECL_MODELDEF,
|
||||
DECL_MATERIAL = 1,
|
||||
DECL_SKIN = 2,
|
||||
DECL_SOUND = 3,
|
||||
DECL_ENTITYDEF = 4,
|
||||
DECL_MODELDEF = 5,
|
||||
// RAVEN BEGIN
|
||||
// jscott: added new decls
|
||||
DECL_MATERIALTYPE,
|
||||
DECL_LIPSYNC,
|
||||
DECL_PLAYBACK,
|
||||
DECL_EFFECT,
|
||||
DECL_MATERIALTYPE = 6,
|
||||
DECL_LIPSYNC = 7,
|
||||
DECL_PLAYBACK = 8,
|
||||
DECL_EFFECT = 9,
|
||||
// rjohnson: camera is now contained in a def for frame commands
|
||||
DECL_CAMERADEF,
|
||||
DECL_CAMERADEF = 10,
|
||||
// jscott: don't use these
|
||||
// DECL_FX,
|
||||
// DECL_PARTICLE,
|
||||
// RAVEN END
|
||||
DECL_AF,
|
||||
DECL_PDA,
|
||||
DECL_VIDEO,
|
||||
DECL_AUDIO,
|
||||
DECL_EMAIL,
|
||||
DECL_MODELEXPORT,
|
||||
DECL_MAPDEF,
|
||||
DECL_AF = 11,
|
||||
DECL_PDA = 12,
|
||||
DECL_VIDEO = 13,
|
||||
DECL_AUDIO = 14,
|
||||
DECL_EMAIL = 15,
|
||||
DECL_MODELEXPORT = 16,
|
||||
DECL_MAPDEF = 17,
|
||||
|
||||
// new decl types can be added here
|
||||
DECL_PLAYER_MODEL,
|
||||
DECL_PLAYER_MODEL = 18,
|
||||
|
||||
DECL_MAX_TYPES = 32
|
||||
} declType_t;
|
||||
|
||||
static_assert( DECL_EFFECT == 9 && DECL_PLAYER_MODEL == 18 && DECL_MAX_TYPES == 32,
|
||||
"Quake 4 declType_t ABI drift" );
|
||||
|
||||
typedef enum {
|
||||
DS_UNPARSED,
|
||||
DS_DEFAULTED, // set if a parse failed due to an error, or the lack of any source
|
||||
|
||||
@@ -25,6 +25,8 @@ along with Quake 4 Reconstructed Source Code. If not, see <http://www.gnu.org/l
|
||||
#include "../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../bse/BSE.h"
|
||||
|
||||
/*
|
||||
|
||||
GUIs and script remain separately parsed
|
||||
@@ -894,15 +896,20 @@ void idDeclManagerLocal::Init( void ) {
|
||||
RegisterDeclType( "materialType", DECL_MATERIALTYPE, idDeclAllocator<rvDeclMatType> );
|
||||
RegisterDeclType( "lipSync", DECL_LIPSYNC, idDeclAllocator<rvDeclLipSync> );
|
||||
RegisterDeclType( "playback", DECL_PLAYBACK, idDeclAllocator<rvDeclPlayback> );
|
||||
RegisterDeclType( "effect", DECL_EFFECT, idDeclAllocator<rvDeclEffect> );
|
||||
RegisterDeclType( "articulatedFigure", DECL_AF, idDeclAllocator<idDeclAF> );
|
||||
RegisterDeclType( "pda", DECL_PDA, idDeclAllocator<idDeclPDA> );
|
||||
RegisterDeclType( "email", DECL_EMAIL, idDeclAllocator<idDeclEmail> );
|
||||
RegisterDeclType( "video", DECL_VIDEO, idDeclAllocator<idDeclVideo> );
|
||||
RegisterDeclType( "audio", DECL_AUDIO, idDeclAllocator<idDeclAudio> );
|
||||
|
||||
RegisterDeclFolder( "materials", ".mtr", DECL_MATERIAL );
|
||||
RegisterDeclFolder( "skins", ".skin", DECL_SKIN );
|
||||
RegisterDeclFolder( "sound", ".sndshd", DECL_SOUND );
|
||||
RegisterDeclFolderWrapper( "materials", ".mtr", DECL_MATERIAL );
|
||||
RegisterDeclFolderWrapper( "skins", ".skin", DECL_SKIN );
|
||||
RegisterDeclFolderWrapper( "sound", ".sndshd", DECL_SOUND, false, true );
|
||||
RegisterDeclFolderWrapper( "materials/types", ".mtt", DECL_MATERIALTYPE );
|
||||
RegisterDeclFolderWrapper( "lipsync", ".lipsync", DECL_LIPSYNC );
|
||||
RegisterDeclFolderWrapper( "playbacks", ".playback", DECL_PLAYBACK, true );
|
||||
RegisterDeclFolderWrapper( "effects", ".fx", DECL_EFFECT, true );
|
||||
|
||||
// add console commands
|
||||
cmdSystem->AddCommand( "listDecls", ListDecls_f, CMD_FL_SYSTEM, "lists all decls" );
|
||||
|
||||
+57
-23
@@ -1440,26 +1440,49 @@ void idSessionLocal::UnloadMap() {
|
||||
idSessionLocal::LoadLoadingGui
|
||||
===============
|
||||
*/
|
||||
void idSessionLocal::LoadLoadingGui( const char *mapName ) {
|
||||
// load / program a gui to stay up on the screen while loading
|
||||
idStr stripped = mapName;
|
||||
stripped.StripFileExtension();
|
||||
stripped.StripPath();
|
||||
|
||||
char guiMap[ MAX_STRING_CHARS ];
|
||||
strncpy( guiMap, va( "guis/map/%s.gui", stripped.c_str() ), MAX_STRING_CHARS );
|
||||
// give the gamecode a chance to override
|
||||
const char *gameLoadingGui = game->GetLoadingGui( mapName );
|
||||
if ( gameLoadingGui != NULL && gameLoadingGui[0] != '\0' ) {
|
||||
idStr::Copynz( guiMap, gameLoadingGui, sizeof( guiMap ) );
|
||||
void idSessionLocal::LoadLoadingGui( const char *mapName, const char *entityFilter ) {
|
||||
idStr mapDeclName = mapName;
|
||||
if ( entityFilter && entityFilter[0] && !idAsyncNetwork::IsActive() ) {
|
||||
mapDeclName += "_";
|
||||
mapDeclName += entityFilter;
|
||||
}
|
||||
|
||||
if ( uiManager->CheckGui( guiMap ) ) {
|
||||
guiLoading = uiManager->FindGui( guiMap, true, false, true );
|
||||
const idDecl *decl = declManager->FindType( DECL_MAPDEF, mapDeclName.c_str(), false );
|
||||
const idDeclEntityDef *mapDef = static_cast<const idDeclEntityDef *>( decl );
|
||||
|
||||
const char *levelName = mapDeclName.c_str();
|
||||
const char *objectives = "";
|
||||
const char *loadImage = "gfx/guis/loadscreens/generic";
|
||||
|
||||
if ( mapDef ) {
|
||||
levelName = mapDef->dict.GetString( "name", mapDeclName.c_str() );
|
||||
objectives = mapDef->dict.GetString( "objectives", "" );
|
||||
loadImage = mapDef->dict.GetString( "loadimage", "gfx/guis/loadscreens/generic" );
|
||||
|
||||
const char *loadGui = mapDef->dict.GetString( "loadgui", "" );
|
||||
if ( loadGui[0] ) {
|
||||
guiLoading = uiManager->FindGui( loadGui, true, false, true );
|
||||
} else if ( objectives[0] ) {
|
||||
guiLoading = uiManager->FindGui( "guis/loading/splevel.gui", true, false, true );
|
||||
} else if ( idAsyncNetwork::IsActive() ) {
|
||||
guiLoading = uiManager->FindGui( "guis/loading/mplevel.gui", true, false, true );
|
||||
} else {
|
||||
guiLoading = uiManager->FindGui( "guis/loading/generic.gui", true, false, true );
|
||||
}
|
||||
} else if ( idAsyncNetwork::IsActive() ) {
|
||||
guiLoading = uiManager->FindGui( "guis/loading/mplevel.gui", true, false, true );
|
||||
} else {
|
||||
guiLoading = uiManager->FindGui( "guis/map/loading.gui", true, false, true );
|
||||
guiLoading = uiManager->FindGui( "guis/loading/generic.gui", true, false, true );
|
||||
}
|
||||
|
||||
if ( guiLoading ) {
|
||||
guiLoading->SetStateFloat( "map_loading", 0.0f );
|
||||
guiLoading->SetStateString( "loading_bkgnd", loadImage );
|
||||
guiLoading->SetStateString( "loading_levelname", common->GetLocalizedString( levelName ) );
|
||||
guiLoading->SetStateString( "loading_objectives", common->GetLocalizedString( objectives ) );
|
||||
declManager->FindMaterial( loadImage )->SetSort( SS_GUI );
|
||||
guiLoading->StateChanged( com_frameTime, false );
|
||||
}
|
||||
guiLoading->SetStateFloat( "map_loading", 0.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1467,8 +1490,13 @@ void idSessionLocal::LoadLoadingGui( const char *mapName ) {
|
||||
idSessionLocal::GetBytesNeededForMapLoad
|
||||
===============
|
||||
*/
|
||||
int idSessionLocal::GetBytesNeededForMapLoad( const char *mapName ) {
|
||||
const idDecl *mapDecl = declManager->FindType( DECL_MAPDEF, mapName, false );
|
||||
int idSessionLocal::GetBytesNeededForMapLoad( const char *mapName, const char *entityFilter ) {
|
||||
idStr mapDeclName = mapName;
|
||||
if ( entityFilter && entityFilter[0] ) {
|
||||
mapDeclName += "_";
|
||||
mapDeclName += entityFilter;
|
||||
}
|
||||
const idDecl *mapDecl = declManager->FindType( DECL_MAPDEF, mapDeclName.c_str(), false );
|
||||
const idDeclEntityDef *mapDef = static_cast<const idDeclEntityDef *>( mapDecl );
|
||||
if ( mapDef ) {
|
||||
return mapDef->dict.GetInt( va("size%d", Max( 0, com_machineSpec.GetInteger() ) ) );
|
||||
@@ -1486,8 +1514,13 @@ int idSessionLocal::GetBytesNeededForMapLoad( const char *mapName ) {
|
||||
idSessionLocal::SetBytesNeededForMapLoad
|
||||
===============
|
||||
*/
|
||||
void idSessionLocal::SetBytesNeededForMapLoad( const char *mapName, int bytesNeeded ) {
|
||||
idDecl *mapDecl = const_cast<idDecl *>(declManager->FindType( DECL_MAPDEF, mapName, false ));
|
||||
void idSessionLocal::SetBytesNeededForMapLoad( const char *mapName, const char *entityFilter, int bytesNeeded ) {
|
||||
idStr mapDeclName = mapName;
|
||||
if ( entityFilter && entityFilter[0] ) {
|
||||
mapDeclName += "_";
|
||||
mapDeclName += entityFilter;
|
||||
}
|
||||
idDecl *mapDecl = const_cast<idDecl *>(declManager->FindType( DECL_MAPDEF, mapDeclName.c_str(), false ));
|
||||
idDeclEntityDef *mapDef = static_cast<idDeclEntityDef *>( mapDecl );
|
||||
|
||||
if ( com_updateLoadSize.GetBool() && mapDef ) {
|
||||
@@ -1554,6 +1587,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
|
||||
// extract the map name from serverinfo
|
||||
idStr mapString = mapSpawnData.serverInfo.GetString( "si_map" );
|
||||
idStr filterString = mapSpawnData.serverInfo.GetString( "si_entityFilter" );
|
||||
|
||||
idStr fullMapName = "maps/";
|
||||
fullMapName += mapString;
|
||||
@@ -1581,7 +1615,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
uiManager->Reload( true );
|
||||
|
||||
// set the loading gui that we will wipe to
|
||||
LoadLoadingGui( mapString );
|
||||
LoadLoadingGui( mapString.c_str(), filterString.c_str() );
|
||||
|
||||
// cause prints to force screen updates as a pacifier,
|
||||
// and draw the loading gui instead of game draws
|
||||
@@ -1591,7 +1625,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
// work for new maps etc. after the first load. we can also drop the sizes into the default.cfg
|
||||
fileSystem->ResetReadCount();
|
||||
if ( !reloadingSameMap ) {
|
||||
bytesNeededForMapLoad = GetBytesNeededForMapLoad( mapString.c_str() );
|
||||
bytesNeededForMapLoad = GetBytesNeededForMapLoad( mapString.c_str(), filterString.c_str() );
|
||||
} else {
|
||||
bytesNeededForMapLoad = 30 * 1024 * 1024;
|
||||
}
|
||||
@@ -1662,7 +1696,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
renderSystem->EndLevelLoad();
|
||||
soundSystem->EndLevelLoad( mapString.c_str() );
|
||||
declManager->EndLevelLoad();
|
||||
SetBytesNeededForMapLoad( mapString.c_str(), fileSystem->GetReadCount() );
|
||||
SetBytesNeededForMapLoad( mapString.c_str(), filterString.c_str(), fileSystem->GetReadCount() );
|
||||
}
|
||||
uiManager->EndLevelLoad();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user