mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Add support for the demo version of the game
This allows the demo version of the game to be used, both for playing on demo servers, or for hosting a demo server
This commit is contained in:
parent
b0a683c188
commit
ab84a6ea58
11 changed files with 198 additions and 35 deletions
|
@ -284,6 +284,28 @@ challenge_t* FindChallenge(netadr_t from, qboolean connecting) {
|
|||
return challenge;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_IsDemoClient
|
||||
|
||||
Returns whether or not the client is using the demo version of the game
|
||||
==================
|
||||
*/
|
||||
|
||||
qboolean SV_IsDemoClient(const char *userinfo)
|
||||
{
|
||||
int version;
|
||||
|
||||
if (protocol_version_demo == protocol_version_full) {
|
||||
// Older versions don't check for network demo
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
version = atoi(Info_ValueForKey(userinfo, "protocol"));
|
||||
|
||||
return version == protocol_version_demo;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_DirectConnect
|
||||
|
@ -334,9 +356,20 @@ void SV_DirectConnect( netadr_t from ) {
|
|||
Com_DPrintf(" rejected connect - only Breakthrough clients allowed.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
version = atoi(Info_ValueForKey(userinfo, "protocol"));
|
||||
version = atoi(Info_ValueForKey(userinfo, "protocol"));
|
||||
|
||||
if (!com_target_demo->integer && SV_IsDemoClient(userinfo)) {
|
||||
SV_NET_OutOfBandPrint(&svs.netprofile, from, "print\nThe Multiplayer Demo can not connect to full version games.\n");
|
||||
Com_DPrintf(" rejected connect from version %i\n", version);
|
||||
return;
|
||||
}
|
||||
|
||||
if (com_target_demo->integer && version == protocol_version_full) {
|
||||
// Make sure to make the full game compatible with the demo game protocol
|
||||
version = com_protocol->integer;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_PROTOCOL
|
||||
if(version > 0 && com_legacyprotocol->integer == version)
|
||||
|
|
|
@ -615,8 +615,15 @@ void SVC_Info( netadr_t from ) {
|
|||
Info_SetValueForKey( infostring, "game", gamedir );
|
||||
}
|
||||
|
||||
Info_SetValueForKey(infostring, "gamever", com_target_version->string);
|
||||
Info_SetValueForKey(infostring, "serverType", va("%i", com_target_game->integer));
|
||||
if (!com_target_demo->integer || com_target_game->integer <= TG_MOH) {
|
||||
Info_SetValueForKey(infostring, "gamever", com_target_version->string);
|
||||
} else {
|
||||
Info_SetValueForKey(infostring, "gamever", va("d%s", com_target_version->string));
|
||||
}
|
||||
|
||||
if (com_target_game->integer >= TG_MOHTT) {
|
||||
Info_SetValueForKey(infostring, "serverType", va("%i", com_target_game->integer));
|
||||
}
|
||||
|
||||
SV_NET_OutOfBandPrint( &svs.netprofile, from, "infoResponse\n%s", infostring );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue