Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5813, r=asherkin).

This commit is contained in:
Nicholas Hastings
2013-07-21 11:53:56 -04:00
parent 636c100b6b
commit a36c266e7d
32 changed files with 298 additions and 142 deletions
+3 -3
View File
@@ -51,13 +51,13 @@ new g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{
new Handle:g_Cvar_Chatmode = INVALID_HANDLE;
new g_GameEngine = SOURCE_SDK_UNKNOWN;
new EngineVersion:g_GameEngine = Engine_Unknown;
public OnPluginStart()
{
LoadTranslations("common.phrases");
g_GameEngine = GuessSDKVersion();
g_GameEngine = GetEngineVersion();
g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0);
@@ -67,7 +67,7 @@ public OnPluginStart()
RegAdminCmd("sm_csay", Command_SmCsay, ADMFLAG_CHAT, "sm_csay <message> - sends centered message to all players");
/* HintText does not work on Dark Messiah */
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH)
if (g_GameEngine != Engine_DarkMessiah)
{
RegAdminCmd("sm_hsay", Command_SmHsay, ADMFLAG_CHAT, "sm_hsay <message> - sends hint message to all players");
}
+8 -7
View File
@@ -78,7 +78,7 @@ new UserMsg:g_FadeUserMsgId;
// Serial Generator for Timer Safety
new g_Serial_Gen = 0;
new g_GameEngine = SOURCE_SDK_UNKNOWN;
new EngineVersion:g_GameEngine = Engine_Unknown;
// Flags used in various timers
#define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE
@@ -102,7 +102,7 @@ public OnPluginStart()
LoadTranslations("common.phrases");
LoadTranslations("funcommands.phrases");
g_GameEngine = GuessSDKVersion();
g_GameEngine = GetEngineVersion();
g_FadeUserMsgId = GetUserMessageId("Fade");
RegisterCvars( );
@@ -185,25 +185,26 @@ public OnMapStart()
PrecacheSound(SOUND_BOOM, true);
PrecacheSound(SOUND_FREEZE, true);
new sdkversion = GuessSDKVersion();
if (sdkversion >= SOURCE_SDK_LEFT4DEAD)
new EngineVersion:sdkversion = GetEngineVersion();
if (sdkversion == Engine_Left4Dead || sdkversion == Engine_Left4Dead2
|| sdkversion == Engine_AlienSwarm || sdkversion == Engine_CSGO)
{
g_BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
g_HaloSprite = PrecacheModel("materials/sprites/glow01.vmt");
// l4d, l4d2, and csgo have this. swarm does not.
if (sdkversion != SOURCE_SDK_ALIENSWARM)
if (sdkversion != Engine_AlienSwarm)
{
g_BeamSprite2 = PrecacheModel("materials/sprites/physbeam.vmt");
}
g_GlowSprite = PrecacheModel("materials/sprites/blueflare1.vmt");
if (sdkversion == SOURCE_SDK_LEFT4DEAD || sdkversion == SOURCE_SDK_LEFT4DEAD2)
if (sdkversion == Engine_Left4Dead || sdkversion == Engine_Left4Dead2)
{
g_ExplosionSprite = PrecacheModel("sprites/floorfire4_.vmt");
}
else if (sdkversion == SOURCE_SDK_ALIENSWARM)
else if (sdkversion == Engine_AlienSwarm)
{
g_ExplosionSprite = PrecacheModel("sprites/flamelet1.vmt");
}
+2 -2
View File
@@ -157,7 +157,7 @@ public Action:Timer_Freeze(Handle:timer, any:value)
UnfreezeClient(client);
/* HintText doesn't work on Dark Messiah */
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH)
if (g_GameEngine != Engine_DarkMessiah)
{
PrintHintText(client, "%t", "Unfrozen");
}
@@ -169,7 +169,7 @@ public Action:Timer_Freeze(Handle:timer, any:value)
return Plugin_Stop;
}
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH)
if (g_GameEngine != Engine_DarkMessiah)
{
PrintHintText(client, "%t", "You will be unfrozen", g_FreezeTime[client]);
}
+33
View File
@@ -64,6 +64,28 @@ enum DialogType
DialogType_AskConnect /**< ask the client to connect to a specified IP */
};
enum EngineVersion
{
Engine_Unknown, /**< Could not determine the engine version */
Engine_Original, /**< Original Source Engine (used by The Ship) */
Engine_SourceSDK2006, /**< Episode 1 Source Engine (second major SDK) */
Engine_SourceSDK2007, /**< Orange Box Source Engine (third major SDK) */
Engine_Left4Dead, /**< Left 4 Dead */
Engine_DarkMessiah, /**< Dark Messiah Multiplayer (based on original engine) */
Engine_Left4Dead2 = 7, /**< Left 4 Dead 2 */
Engine_AlienSwarm, /**< Alien Swarm (and Alien Swarm SDK) */
Engine_BloodyGoodTime, /**< Bloody Good Time */
Engine_EYE, /**< E.Y.E Divine Cybermancy */
Engine_Portal2, /**< Portal 2 */
Engine_CSGO, /**< Counter-Strike: Global Offensive */
Engine_CSS, /**< Counter-Strike: Source */
Engine_DOTA, /**< Dota 2 */
Engine_HL2DM, /**< Half-Life 2 Deathmatch */
Engine_DODS, /**< Day of Defeat: Source */
Engine_TF2, /**< Team Fortress 2 */
Engine_NuclearDawn /**< Nuclear Dawn */
};
#define INVALID_ENT_REFERENCE 0xFFFFFFFF
/**
@@ -264,8 +286,19 @@ native CreateDialog(client, Handle:kv, DialogType:type);
*
* @return SOURCE_SDK version code.
*/
#pragma deprecated See GetEngineVersion()
native GuessSDKVersion();
/**
* Gets the engine version that the currently-loaded SM core was compiled against.
*
* The engine version values are not guaranteed to be in any particular order,
* and should only be compared by (in)equality.
*
* @return An EngineVersion value.
*/
native EngineVersion:GetEngineVersion();
/**
* Prints a message to a specific client in the chat area.
*
+2 -2
View File
@@ -51,7 +51,7 @@ new Handle:hTopMenu = INVALID_HANDLE;
/* Used to get the SDK / Engine version. */
/* This is used in sm_rename and sm_changeteam */
new g_ModVersion = 0;
new EngineVersion:g_ModVersion = Engine_Unknown;
#include "playercommands/slay.sp"
#include "playercommands/slap.sp"
@@ -66,7 +66,7 @@ public OnPluginStart()
RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
RegAdminCmd("sm_rename", Command_Rename, ADMFLAG_SLAY, "sm_rename <#userid|name>");
g_ModVersion = GuessSDKVersion();
g_ModVersion = GetEngineVersion();
/* Account for late loading */
new Handle:topmenu;
+1 -1
View File
@@ -38,7 +38,7 @@ PerformRename(client, target)
LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
/* Used on OB / L4D engine */
if (g_ModVersion > SOURCE_SDK_EPISODE1)
if (g_ModVersion != Engine_SourceSDK2006)
{
SetClientInfo(target, "name", g_NewName[target]);
}
+7 -6
View File
@@ -55,7 +55,7 @@ new Handle:sm_reserve_type;
new Handle:sm_reserve_maxadmins;
new Handle:sm_reserve_kicktype;
new g_SDKVersion;
new bool:g_BotsSubtractFromMax;
new g_SourceTV = -1;
new g_Replay = -1;
@@ -80,9 +80,10 @@ public OnPluginStart()
HookConVarChange(sm_reserved_slots, SlotCountChanged);
HookConVarChange(sm_hide_slots, SlotHideChanged);
g_SDKVersion = GuessSDKVersion();
new EngineVersion:engineVersion = GetEngineVersion();
g_BotsSubtractFromMax = engineVersion == Engine_TF2 || engineVersion == Engine_CSS || engineVersion == Engine_DODS || engineVersion == Engine_HL2DM;
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE)
if (g_BotsSubtractFromMax)
{
for (new i = 1; i <= MaxClients; i++)
{
@@ -142,7 +143,7 @@ public Action:OnTimedKick(Handle:timer, any:client)
public OnClientPostAdminCheck(client)
{
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE)
if (g_BotsSubtractFromMax)
{
if (IsClientSourceTV(client))
{
@@ -234,7 +235,7 @@ public OnClientPostAdminCheck(client)
public OnClientDisconnect_Post(client)
{
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE)
if (g_BotsSubtractFromMax)
{
if (client == g_SourceTV)
{
@@ -296,7 +297,7 @@ SetVisibleMaxSlots(clients, limit)
num = limit;
}
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE)
if (g_BotsSubtractFromMax)
{
if (g_SourceTV > -1)
{
+4 -4
View File
@@ -37,7 +37,7 @@ public Action:set_mvps( client, argc )
public Action:get_score( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
if( GetEngineVersion() != Engine_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
@@ -50,7 +50,7 @@ public Action:get_score( client, argc )
public Action:set_score( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
if( GetEngineVersion() != Engine_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
@@ -66,7 +66,7 @@ public Action:set_score( client, argc )
public Action:get_assists( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
if( GetEngineVersion() != Engine_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
@@ -79,7 +79,7 @@ public Action:get_assists( client, argc )
public Action:set_assists( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
if( GetEngineVersion() != Engine_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;