Skip to content

Commit

Permalink
Added cvar mp_team_maxkills
Browse files Browse the repository at this point in the history
Changed enum AmmoType
  • Loading branch information
s1lentq committed Jul 27, 2016
1 parent baac9cb commit 0683eda
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 41 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| 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_team_maxkills | 3 | 0 | - | The max of value for team killers then server will automatically kick them. If enabled the auto kick feature (mp_autokick) |

## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)
Expand Down
10 changes: 8 additions & 2 deletions buildSrc/src/main/groovy/versioning/GitVersioner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ class GitVersioner {
childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/');
sb.append('https://');
} 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();
}
static GitInfo versionForDir(File dir) {
Expand Down
7 changes: 7 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ bot_deathmatch 0
//
// Default value: "0"
mp_auto_join_team 0

// The max of value for team killers then server will automatically kick them.
// If enabled the auto kick feature (mp_autokick)
// 0 - disabled
//
// Default value: "3"
mp_team_maxkills 3
1 change: 0 additions & 1 deletion regamedll/dlls/cdll_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)

#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots

#define HUD_PRINTNOTIFY 1
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4517,7 +4517,7 @@ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struc
{
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.y = pPlayer->m_rgAmmo[ weapon->m_iPrimaryAmmoType ];
Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 team_maxkills = { "mp_team_maxkills", "3", 0, 3.0f, nullptr };

This comment has been minimized.

Copy link
@WPMGPRoSToTeMa

WPMGPRoSToTeMa Jul 27, 2016

Contributor

May be better mp_maxteamkills or mp_max_teamkills?


void GameDLL_Version_f()
{
Expand Down Expand Up @@ -236,6 +237,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&refill_bpammo_weapons);
CVAR_REGISTER(&freeforall);
CVAR_REGISTER(&auto_join_team);
CVAR_REGISTER(&team_maxkills);

// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ extern cvar_t auto_reload_weapons;
extern cvar_t refill_bpammo_weapons;
extern cvar_t freeforall;
extern cvar_t auto_join_team;
extern cvar_t team_maxkills;

#endif

Expand Down
6 changes: 5 additions & 1 deletion regamedll/dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3604,7 +3604,11 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
ClientPrint(killer->pev, HUD_PRINTCENTER, "#Killed_Teammate");
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 && team_maxkills.value && killer->m_iTeamKills >= (int)team_maxkills.value)
#else
if (autokick.value && killer->m_iTeamKills == 3)
#endif
{
ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Banned_For_Killing_Teamates");

Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4290,7 +4290,7 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PreThink)()
//check if this player has been inactive for 2 rounds straight
if (flLastMove > CSGameRules()->m_fMaxIdlePeriod)
{
if (!IsBot() && CVAR_GET_FLOAT("mp_autokick") != 0.0f)
if (!IsBot() && autokick.value)
{
// 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));
Expand Down
44 changes: 38 additions & 6 deletions regamedll/dlls/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,27 @@ NOXREF void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, floa
MESSAGE_END();
}

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" },
};

// Precaches the ammo and queues the ammo info for sending to clients
void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
{
Expand All @@ -224,9 +245,20 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
assert(giAmmoIndex < MAX_AMMO_SLOTS);

if (giAmmoIndex >= MAX_AMMO_SLOTS)
{
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;

Expand All @@ -246,8 +278,7 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname)
}

CBaseEntity *pEntity = CBaseEntity::Instance(VARS(pent));

if (pEntity != NULL)
if (pEntity)
{
ItemInfo II;
Q_memset(&II, 0, sizeof(II));
Expand Down Expand Up @@ -1794,7 +1825,6 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)

// unlink this weapon from the box
m_rgpPlayerItems[i] = pItem = pNext;

continue;
}
#else
Expand Down Expand Up @@ -1822,13 +1852,16 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
// 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!
// 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;
pPlayer->GiveNamedItem(grenadeName);

// unlink this weapon from the box
pItem = m_rgpPlayerItems[i]->m_pNext;
m_rgpPlayerItems[i] = pItem;

continue;
}
#endif
Expand All @@ -1850,7 +1883,6 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)

// unlink this weapon from the box
m_rgpPlayerItems[i] = pItem = pNext;

continue;
}

Expand Down
8 changes: 4 additions & 4 deletions regamedll/dlls/weapontype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" },

#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_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_HEGRENADE, AMMO_NONE, "weapon_hegrenade", nullptr },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_SMOKEGRENADE, AMMO_NONE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_NONE, "weapon_flashbang", 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_SMOKEGRENADE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_FLASHBANG, "weapon_flashbang", nullptr },
#endif

{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },
Expand Down
21 changes: 13 additions & 8 deletions regamedll/dlls/weapontype.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,23 @@ enum MaxAmmoType

enum AmmoType
{
AMMO_NONE = -1,
AMMO_BUCKSHOT,
AMMO_9MM,
AMMO_556NATO,
AMMO_556NATOBOX,
AMMO_NONE,
AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_50AE,
AMMO_338MAGNUM,
AMMO_57MM,
AMMO_50AE,
AMMO_357SIG,
AMMO_MAX_TYPES,
AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,

AMMO_MAX_TYPES
};

enum WeaponClassType
Expand Down
1 change: 0 additions & 1 deletion regamedll/extra/cssdk/dlls/cdll_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)

#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots

#define HUD_PRINTNOTIFY 1
Expand Down
21 changes: 13 additions & 8 deletions regamedll/extra/cssdk/dlls/weapontype.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,23 @@ enum MaxAmmoType

enum AmmoType
{
AMMO_NONE = -1,
AMMO_BUCKSHOT,
AMMO_9MM,
AMMO_556NATO,
AMMO_556NATOBOX,
AMMO_NONE,
AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_50AE,
AMMO_338MAGNUM,
AMMO_57MM,
AMMO_50AE,
AMMO_357SIG,
AMMO_MAX_TYPES,
AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,

AMMO_MAX_TYPES
};

enum WeaponClassType
Expand Down
28 changes: 20 additions & 8 deletions regamedll/msvc/PreBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set version_major=0
set version_minor=0
set version_specialversion=
set url_commit=
set branch_name=master

::
:: Check for git.exe presence
Expand Down Expand Up @@ -75,7 +76,12 @@ IF EXIST "%srcdir%\version.h" (
:: Read revision and release date from it
::
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] == [] (
set version_revision=%%i
)
Expand All @@ -93,12 +99,7 @@ set new_version=%version_major%,%version_minor%,0,%version_revision%
::
IF NOT %errlvl% == "1" (

set branch_name=master
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
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
set branch_remote=%%i
Expand Down Expand Up @@ -127,17 +128,28 @@ IF NOT %errlvl% == "1" (
if "x!url_commit:~-4!"=="x.git" (
set url_commit=!url_commit:~0,-4!
)

:: 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 (
:: strip .git
if "x!url_commit:~-4!"=="x.git" (
set url_commit=!url_commit:~0,-4!
)
:: replace : to /
set url_commit=!url_commit::=/!

:: 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/
)
)
)

Expand Down

0 comments on commit 0683eda

Please sign in to comment.