Added cvar mp_team_maxkills

Changed enum AmmoType
This commit is contained in:
s1lentq 2016-07-27 21:08:42 +07:00
parent baac9cbad4
commit 07e861eb30
15 changed files with 118 additions and 43 deletions

View File

@ -31,6 +31,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max <br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on each weapon reload | | mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max <br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on each weapon reload |
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario | | bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
| mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team <br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) | | mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team <br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) |
| mp_max_teamkills | 3 | 0 | - | Maximum number of allowed teamkills before autokick. Used when enabled mp_autokick. |
## How to install zBot for CS 1.6? ## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true) * Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

View File

@ -52,10 +52,16 @@ class GitVersioner {
childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/'); childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/');
sb.append('https://'); sb.append('https://');
} else { } else {
childPath = url.substring(0, url.lastIndexOf('.git')); pos = url.lastIndexOf('.git');
childPath = (pos == -1) ? url : url.substring(0, pos);
} }
sb.append(childPath).append('/commit/'); // support for different links to history of commits
if (url.indexOf('bitbucket.org') != -1) {
sb.append(childPath).append('/commits/');
} else {
sb.append(childPath).append('/commit/');
}
return sb.toString(); return sb.toString();
} }
static GitInfo versionForDir(File dir) { static GitInfo versionForDir(File dir) {

7
dist/game.cfg vendored
View File

@ -77,3 +77,10 @@ bot_deathmatch 0
// //
// Default value: "0" // Default value: "0"
mp_auto_join_team 0 mp_auto_join_team 0
// Maximum number of allowed teamkills before autokick.
// Used when enabled mp_autokick.
// 0 - disabled
//
// Default value: "3"
mp_max_teamkills 3

View File

@ -89,7 +89,6 @@
#define MENU_KEY_9 (1<<8) #define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9) #define MENU_KEY_0 (1<<9)
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots #define MAX_AMMO_SLOTS 32 // not really slots
#define HUD_PRINTNOTIFY 1 #define HUD_PRINTNOTIFY 1

View File

@ -4517,7 +4517,7 @@ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struc
{ {
cd->m_iId = II.iId; cd->m_iId = II.iId;
if ((unsigned int)weapon->m_iPrimaryAmmoType < MAX_AMMO_TYPES) if ((unsigned int)weapon->m_iPrimaryAmmoType < MAX_AMMO_SLOTS)
{ {
cd->vuser4.x = weapon->m_iPrimaryAmmoType; cd->vuser4.x = weapon->m_iPrimaryAmmoType;
cd->vuser4.y = pPlayer->m_rgAmmo[ weapon->m_iPrimaryAmmoType ]; cd->vuser4.y = pPlayer->m_rgAmmo[ weapon->m_iPrimaryAmmoType ];

View File

@ -105,6 +105,7 @@ cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr }
cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc
cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr }; cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
cvar_t max_teamkills = { "mp_max_teamkills", "3", 0, 3.0f, nullptr };
void GameDLL_Version_f() void GameDLL_Version_f()
{ {
@ -236,6 +237,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&refill_bpammo_weapons); CVAR_REGISTER(&refill_bpammo_weapons);
CVAR_REGISTER(&freeforall); CVAR_REGISTER(&freeforall);
CVAR_REGISTER(&auto_join_team); CVAR_REGISTER(&auto_join_team);
CVAR_REGISTER(&max_teamkills);
// print version // print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n"); CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");

View File

@ -142,6 +142,7 @@ extern cvar_t auto_reload_weapons;
extern cvar_t refill_bpammo_weapons; extern cvar_t refill_bpammo_weapons;
extern cvar_t freeforall; extern cvar_t freeforall;
extern cvar_t auto_join_team; extern cvar_t auto_join_team;
extern cvar_t max_teamkills;
#endif #endif

View File

@ -3604,7 +3604,11 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
ClientPrint(killer->pev, HUD_PRINTCENTER, "#Killed_Teammate"); ClientPrint(killer->pev, HUD_PRINTCENTER, "#Killed_Teammate");
ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Game_teammate_kills", UTIL_dtos1(killer->m_iTeamKills)); ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Game_teammate_kills", UTIL_dtos1(killer->m_iTeamKills));
if (killer->m_iTeamKills == 3 && autokick.value != 0.0f) #ifdef REGAMEDLL_ADD
if (autokick.value && max_teamkills.value && killer->m_iTeamKills >= (int)max_teamkills.value)
#else
if (autokick.value && killer->m_iTeamKills == 3)
#endif
{ {
ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Banned_For_Killing_Teamates"); ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Banned_For_Killing_Teamates");

View File

@ -4290,7 +4290,7 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PreThink)()
//check if this player has been inactive for 2 rounds straight //check if this player has been inactive for 2 rounds straight
if (flLastMove > CSGameRules()->m_fMaxIdlePeriod) if (flLastMove > CSGameRules()->m_fMaxIdlePeriod)
{ {
if (!IsBot() && CVAR_GET_FLOAT("mp_autokick") != 0.0f) if (!IsBot() && autokick.value)
{ {
// Log the kick // Log the kick
UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam)); UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam));

View File

@ -204,6 +204,29 @@ NOXREF void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, floa
MESSAGE_END(); MESSAGE_END();
} }
#ifdef REGAMEDLL_ADD
struct {
AmmoType type;
const char *name;
} ammoIndex[] =
{
{ AMMO_338MAGNUM, "338Magnum" },
{ AMMO_762NATO, "762Nato" },
{ AMMO_556NATOBOX, "556NatoBox" },
{ AMMO_556NATO, "556Nato" },
{ AMMO_BUCKSHOT, "buckshot" },
{ AMMO_45ACP, "45acp" },
{ AMMO_57MM, "57mm" },
{ AMMO_50AE, "50AE" },
{ AMMO_357SIG, "357SIG" },
{ AMMO_9MM, "9mm" },
{ AMMO_FLASHBANG, "Flashbang" },
{ AMMO_HEGRENADE, "HEGrenade" },
{ AMMO_SMOKEGRENADE, "SmokeGrenade" },
{ AMMO_C4, "C4" },
};
#endif
// Precaches the ammo and queues the ammo info for sending to clients // Precaches the ammo and queues the ammo info for sending to clients
void AddAmmoNameToAmmoRegistry(const char *szAmmoname) void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
{ {
@ -224,9 +247,20 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
assert(giAmmoIndex < MAX_AMMO_SLOTS); assert(giAmmoIndex < MAX_AMMO_SLOTS);
if (giAmmoIndex >= MAX_AMMO_SLOTS) if (giAmmoIndex >= MAX_AMMO_SLOTS)
{
giAmmoIndex = 0; giAmmoIndex = 0;
#ifdef REGAMEDLL_ADD
for (auto& ammo : ammoIndex)
{
if (Q_stricmp(ammo.name, szAmmoname))
continue;
if (ammo.type != giAmmoIndex) {
CONSOLE_ECHO("Warning: ammo '%s' index mismatch; expected %i, real %i\n", szAmmoname, ammo.type, giAmmoIndex);
}
break;
} }
#endif
IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].pszName = szAmmoname; IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].pszName = szAmmoname;
@ -246,8 +280,7 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname)
} }
CBaseEntity *pEntity = CBaseEntity::Instance(VARS(pent)); CBaseEntity *pEntity = CBaseEntity::Instance(VARS(pent));
if (pEntity)
if (pEntity != NULL)
{ {
ItemInfo II; ItemInfo II;
Q_memset(&II, 0, sizeof(II)); Q_memset(&II, 0, sizeof(II));
@ -1794,7 +1827,6 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
// unlink this weapon from the box // unlink this weapon from the box
m_rgpPlayerItems[i] = pItem = pNext; m_rgpPlayerItems[i] = pItem = pNext;
continue; continue;
} }
#else #else
@ -1822,13 +1854,16 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{ {
// CRITICAL BUG: since gives a new entity using GiveNamedItem, // CRITICAL BUG: since gives a new entity using GiveNamedItem,
// but the entity is packaged in a weaponbox still exists and will never used or removed. It's leak! // but the entity is packaged in a weaponbox still exists and will never used or removed. It's leak!
// How reproduced: Drop your grenade on the ground, check output of command `entity_dump`,
// there we will see only get one grenade. Next step - pick it up, do check again `entity_dump`,
// but this time we'll see them x2.
bEmitSound = true; bEmitSound = true;
pPlayer->GiveNamedItem(grenadeName); pPlayer->GiveNamedItem(grenadeName);
// unlink this weapon from the box // unlink this weapon from the box
pItem = m_rgpPlayerItems[i]->m_pNext; pItem = m_rgpPlayerItems[i]->m_pNext;
m_rgpPlayerItems[i] = pItem; m_rgpPlayerItems[i] = pItem;
continue; continue;
} }
#endif #endif
@ -1850,7 +1885,6 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
// unlink this weapon from the box // unlink this weapon from the box
m_rgpPlayerItems[i] = pItem = pNext; m_rgpPlayerItems[i] = pItem = pNext;
continue; continue;
} }

View File

@ -254,11 +254,11 @@ WeaponInfoStruct weaponInfo_default[] =
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" }, { WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" },
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD
{ WEAPON_C4, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_c4", nullptr }, { WEAPON_C4, 0, 0, 0, 0, 0, AMMO_C4, "weapon_c4", nullptr },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr }, { WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_HEGRENADE, AMMO_NONE, "weapon_hegrenade", nullptr }, { WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_HEGRENADE, AMMO_HEGRENADE, "weapon_hegrenade", nullptr },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_SMOKEGRENADE, AMMO_NONE, "weapon_smokegrenade", nullptr }, { WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_NONE, "weapon_flashbang", nullptr }, { WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_FLASHBANG, "weapon_flashbang", nullptr },
#endif #endif
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr }, { WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },

View File

@ -256,18 +256,23 @@ enum MaxAmmoType
enum AmmoType enum AmmoType
{ {
AMMO_NONE = -1, AMMO_NONE,
AMMO_BUCKSHOT,
AMMO_9MM,
AMMO_556NATO,
AMMO_556NATOBOX,
AMMO_762NATO,
AMMO_45ACP,
AMMO_50AE,
AMMO_338MAGNUM, AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_57MM, AMMO_57MM,
AMMO_50AE,
AMMO_357SIG, AMMO_357SIG,
AMMO_MAX_TYPES, AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,
AMMO_MAX_TYPES
}; };
enum WeaponClassType enum WeaponClassType

View File

@ -84,7 +84,6 @@
#define MENU_KEY_9 (1<<8) #define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9) #define MENU_KEY_0 (1<<9)
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots #define MAX_AMMO_SLOTS 32 // not really slots
#define HUD_PRINTNOTIFY 1 #define HUD_PRINTNOTIFY 1

View File

@ -251,18 +251,23 @@ enum MaxAmmoType
enum AmmoType enum AmmoType
{ {
AMMO_NONE = -1, AMMO_NONE,
AMMO_BUCKSHOT,
AMMO_9MM,
AMMO_556NATO,
AMMO_556NATOBOX,
AMMO_762NATO,
AMMO_45ACP,
AMMO_50AE,
AMMO_338MAGNUM, AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_57MM, AMMO_57MM,
AMMO_50AE,
AMMO_357SIG, AMMO_357SIG,
AMMO_MAX_TYPES, AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,
AMMO_MAX_TYPES
}; };
enum WeaponClassType enum WeaponClassType

View File

@ -22,6 +22,7 @@ set version_major=0
set version_minor=0 set version_minor=0
set version_specialversion= set version_specialversion=
set url_commit= set url_commit=
set branch_name=master
:: ::
:: Check for git.exe presence :: Check for git.exe presence
@ -75,7 +76,12 @@ IF EXIST "%srcdir%\version.h" (
:: Read revision and release date from it :: Read revision and release date from it
:: ::
IF NOT %errlvl% == "1" ( IF NOT %errlvl% == "1" (
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --all | wc -l"') DO ( :: Get current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
set branch_name=%%i
)
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO (
IF NOT [%%i] == [] ( IF NOT [%%i] == [] (
set version_revision=%%i set version_revision=%%i
) )
@ -93,12 +99,7 @@ set new_version=%version_major%,%version_minor%,0,%version_revision%
:: ::
IF NOT %errlvl% == "1" ( IF NOT %errlvl% == "1" (
set branch_name=master
set branch_remote=origin set branch_remote=origin
:: Get current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
set branch_name=%%i
)
:: Get remote name by current branch :: Get remote name by current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
set branch_remote=%%i set branch_remote=%%i
@ -127,8 +128,14 @@ IF NOT %errlvl% == "1" (
if "x!url_commit:~-4!"=="x.git" ( if "x!url_commit:~-4!"=="x.git" (
set url_commit=!url_commit:~0,-4! set url_commit=!url_commit:~0,-4!
) )
:: append extra string :: append extra string
set url_commit=!url_commit!/commit/ If NOT "%url_commit%"=="%url_commit:bitbucket.org=%" (
set url_commit=!url_commit!/commits/
) ELSE (
set url_commit=!url_commit!/commit/
)
) ELSE ( ) ELSE (
:: strip .git :: strip .git
if "x!url_commit:~-4!"=="x.git" ( if "x!url_commit:~-4!"=="x.git" (
@ -136,8 +143,13 @@ IF NOT %errlvl% == "1" (
) )
:: replace : to / :: replace : to /
set url_commit=!url_commit::=/! set url_commit=!url_commit::=/!
:: append extra string :: append extra string
set url_commit=https://!url_commit!/commit/ If NOT "%url_commit%"=="%url_commit:bitbucket.org=%" (
set url_commit=https://!url_commit!/commits/
) ELSE (
set url_commit=https://!url_commit!/commit/
)
) )
) )