1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/cssdm_config.cpp Sun Jun 24 21:58:09 2007 +0000
1.3 @@ -0,0 +1,132 @@
1.4 +/**
1.5 + * vim: set ts=4 :
1.6 + * ===============================================================
1.7 + * CS:S DM, Copyright (C) 2004-2007 AlliedModders LLC.
1.8 + * By David "BAILOPAN" Anderson
1.9 + * All rights reserved.
1.10 + * ===============================================================
1.11 + *
1.12 + * This program is free software; you can redistribute it and/or modify
1.13 + * it under the terms of the GNU General Public License as published by
1.14 + * the Free Software Foundation; either version 2 of the License, or (at
1.15 + * your option) any later version.
1.16 + *
1.17 + * This program is distributed in the hope that it will be useful, but
1.18 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.20 + * General Public License for more details.
1.21 + *
1.22 + * You should have received a copy of the GNU General Public License
1.23 + * along with this program; see the file COPYING; if not, write to the
1.24 + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
1.25 + * MA 02110-1301 USA
1.26 + *
1.27 + * Version: $Id$
1.28 + */
1.29 +
1.30 +#include "smsdk_ext.h"
1.31 +#include "cssdm_config.h"
1.32 +#include "cssdm_ctrl.h"
1.33 +#include "cssdm_ffa.h"
1.34 +#include "cssdm_callbacks.h"
1.35 +
1.36 +void ChangeStatus(ConVar *cvar, const char *value);
1.37 +void ChangeFFAStatus(ConVar *cvar, const char *value);
1.38 +void ChangeSpawnStatus(ConVar *cvar, const char *value);
1.39 +
1.40 +ConVar cssdm_ragdoll_time("cssdm_ragdoll_time", "2", 0, "Sets ragdoll stay time", true, 0.0, true, 20.0);
1.41 +ConVar cssdm_respawn_wait("cssdm_respawn_wait", "0.75", 0, "Sets respawn wait time");
1.42 +ConVar cssdm_allow_c4("cssdm_allow_c4", "0", 0, "Sets whether C4 is allowed");
1.43 +ConVar cssdm_version("cssdm_version", SMEXT_CONF_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "CS:S DM Version");
1.44 +ConVar cssdm_enabled("cssdm_enabled",
1.45 + "1",
1.46 + FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY,
1.47 + "Sets whether CS:S DM is enabled",
1.48 + false, 0.0f, false, 0.0f,
1.49 + ChangeStatus);
1.50 +ConVar cssdm_ffa_enabled("cssdm_ffa_enabled",
1.51 + "0",
1.52 + FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY,
1.53 + "Sets whether Free-For-All mode is enabled",
1.54 + false, 0.0f, false, 0.0f,
1.55 + ChangeFFAStatus);
1.56 +ConVar cssdm_spawn_method("cssdm_spawn_method",
1.57 + "preset",
1.58 + 0,
1.59 + "Sets how and where players are spawned",
1.60 + false, 0.0f, false, 0.0f,
1.61 + ChangeSpawnStatus);
1.62 +
1.63 +class LinkConVars : public IConCommandBaseAccessor
1.64 +{
1.65 +public:
1.66 + bool RegisterConCommandBase(ConCommandBase *pBase)
1.67 + {
1.68 + return META_REGCVAR(pBase);
1.69 + }
1.70 +} s_LinkConVars;
1.71 +
1.72 +void SM_InitConCommandBase()
1.73 +{
1.74 + ConCommandBaseMgr::OneTimeInit(&s_LinkConVars);
1.75 +}
1.76 +
1.77 +void ChangeStatus(ConVar *cvar, const char *value)
1.78 +{
1.79 + if (cssdm_enabled.GetInt())
1.80 + {
1.81 + DM_Enable();
1.82 + } else {
1.83 + DM_Disable();
1.84 + }
1.85 +}
1.86 +
1.87 +void ChangeFFAStatus(ConVar *cvar, const char *value)
1.88 +{
1.89 + if (cssdm_ffa_enabled.GetInt() && !DM_FFA_IsPatched() && DM_FFA_IsPrepared())
1.90 + {
1.91 + DM_Patch_FFA();
1.92 + } else if (!cssdm_ffa_enabled.GetInt() && DM_FFA_IsPatched()) {
1.93 + DM_Unpatch_FFA();
1.94 + }
1.95 +}
1.96 +
1.97 +void ChangeSpawnStatus(ConVar *cvar, const char *value)
1.98 +{
1.99 + if (strcmp(value, cssdm_spawn_method.GetString()) == 0)
1.100 + {
1.101 + return;
1.102 + }
1.103 +
1.104 + DM_OnSetSpawnMethod(cssdm_spawn_method.GetString());
1.105 +}
1.106 +
1.107 +const char *DM_GetSpawnMethod()
1.108 +{
1.109 + return cssdm_spawn_method.GetString();
1.110 +}
1.111 +
1.112 +unsigned int DM_GetBodyStayTime()
1.113 +{
1.114 + return cssdm_ragdoll_time.GetInt();
1.115 +}
1.116 +
1.117 +float DM_GetRespawnWait()
1.118 +{
1.119 + return cssdm_respawn_wait.GetFloat();
1.120 +}
1.121 +
1.122 +bool DM_AllowC4()
1.123 +{
1.124 + return (cssdm_allow_c4.GetInt() != 0);
1.125 +}
1.126 +
1.127 +bool DM_IsEnabled()
1.128 +{
1.129 + return (cssdm_enabled.GetInt() != 0);
1.130 +}
1.131 +
1.132 +bool DM_IsFFAEnabled()
1.133 +{
1.134 + return (cssdm_ffa_enabled.GetInt() != 0);
1.135 +}