Removed the dependency of the mode FFA from the cvar mp_friendlyfire 2

Added cvar mp_freeforall for FFA
Reworked cvar bot_deathmatch
This commit is contained in:
s1lentq 2016-06-14 22:00:27 +07:00
parent d6b59dc0c3
commit 7caa82b054
10 changed files with 28 additions and 17 deletions

View File

@ -21,7 +21,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
## Configuration (cvars)
| CVar | Default | Min | Max | Description |
| :---------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- |
| mp_friendlyfire | 0 | 0 | 2 | Allow inflict damage to teammates<br/>`0` disabled <br/>`1` enabled <br/>`2` FFA mode |
| mp_freeforall | 0 | 0 | 1 | The style of gameplay where there aren't any teams (FFA mode)<br/>`0` disabled <br/>`1` enabled |
| mp_maxmoney | 16000 | 0 | `0x7FFFFFFF` | The maximum allowable amount of money in the game
| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)<br/>`0` disabled<br/>`1` enabled<br/><br/>or flags<br/>`a` block round time round end check<br/>`b` block needed players round end check<br/>`c` block VIP assassination/success round end check<br/>`d` block prison escape round end check<br/>`e` block bomb round end check<br/>`f` block team extermination round end check<br/>`g` block hostage rescue round end check<br/><br/>`Example setting:` "ae" blocks round time and bomb round end checks |
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls<br/>`0` disabled<br/>`1` enabled |
@ -29,7 +29,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round |
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn<br/>`0` disabled<br/>`1` enabled |
| 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 | 2 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario<br/>`2` enable Deathmatch and FFA mode |
| 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 |
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

8
dist/game.cfg vendored
View File

@ -1,13 +1,12 @@
// ReGameDLL Configuration File
echo Executing ReGameDLL Configuration File
// Allow inflict damage to teammates
// 0 - disabled
// The style of gameplay where there aren't any teams (FFA mode)
// 0 - disabled (default behaviour)
// 1 - enabled
// 2 - FFA mode
//
// Default value: "0"
mp_friendlyfire 0
mp_freeforall 0
// The maximum allowable amount of money in the game
//
@ -68,7 +67,6 @@ mp_refill_bpammo_weapons 0
// Set's the mode for the zBot
// 0 - disabled
// 1 - enable mode Deathmatch and not allow to do the scenario
// 2 - enable Deathmatch and FFA mode (Free for all)
//
// Default value: "0"
bot_deathmatch 0

View File

@ -840,6 +840,9 @@ void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box)
// TODO: Check more rays for safety.
bool CCSBot::IsFriendInLineOfFire()
{
if (CSGameRules()->IsFreeForAll())
return false;
UTIL_MakeVectors(pev->punchangle + pev->v_angle);
// compute the unit vector along our view

View File

@ -103,6 +103,7 @@ cvar_t nadedrops = { "mp_nadedrops", "0", 0, 0.0f, nullptr };
cvar_t roundrespawn_time = { "mp_roundrespawn_time", "20", 0, 20.0f, nullptr };
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 };
void GameDLL_Version_f()
{
@ -232,6 +233,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&roundrespawn_time);
CVAR_REGISTER(&auto_reload_weapons);
CVAR_REGISTER(&refill_bpammo_weapons);
CVAR_REGISTER(&freeforall);
// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");

View File

@ -140,6 +140,7 @@ extern cvar_t nadedrops;
extern cvar_t roundrespawn_time;
extern cvar_t auto_reload_weapons;
extern cvar_t refill_bpammo_weapons;
extern cvar_t freeforall;
#endif

View File

@ -637,8 +637,8 @@ public:
void TerminateRound(float tmDelay, int iWinStatus);
float GetRoundRespawnTime() const;
// allow the mode of fire on a friendly player (FFA)
bool IsFriendlyFireAttack() const;
// has a style of gameplay when aren't any teams
bool IsFreeForAll() const;
bool HasRoundInfinite(bool time_expired = false) const;
private:
@ -813,11 +813,10 @@ inline float CHalfLifeMultiplay::GetRoundRespawnTime() const
#endif
}
// allow the mode of fire on a friendly player (FFA)
inline bool CHalfLifeMultiplay::IsFriendlyFireAttack() const
inline bool CHalfLifeMultiplay::IsFreeForAll() const
{
#ifdef REGAMEDLL_ADD
if (friendlyfire.string[0] == '2')
if (freeforall.value != 0.0f)
return true;
#endif
return false;

View File

@ -3680,7 +3680,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
{
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
CBasePlayer *killer = GetClassPtr<CCSPlayer>((CBasePlayer *)pKiller);
bool killedByFFA = CSGameRules()->IsFriendlyFireAttack();
bool killedByFFA = CSGameRules()->IsFreeForAll();
if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA)
{

View File

@ -1016,7 +1016,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
if (CVAR_GET_FLOAT("mp_friendlyfire"))
{
if (!CSGameRules()->IsFriendlyFireAttack() && pGrenade->m_iTeam == m_iTeam)
if (!CSGameRules()->IsFreeForAll() && pGrenade->m_iTeam == m_iTeam)
bTeamAttack = TRUE;
pAttack = CBasePlayer::Instance(pevAttacker);
@ -1174,7 +1174,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
{
pAttack = GetClassPtr<CCSPlayer>((CBasePlayer *)pevAttacker);
bool bAttackFFA = CSGameRules()->IsFriendlyFireAttack();
bool bAttackFFA = CSGameRules()->IsFreeForAll();
// warn about team attacks
if (pAttack != this && pAttack->m_iTeam == m_iTeam && !bAttackFFA)
@ -6928,7 +6928,7 @@ void EXT_ALIGN CBasePlayer::__API_VHOOK(UpdateClientData)()
m_tmNextRadarUpdate = gpGlobals->time + 1.0f;
#ifdef REGAMEDLL_ADD
if (CSGameRules()->IsFriendlyFireAttack())
if (CSGameRules()->IsFreeForAll())
vecOrigin = g_vecZero;
#endif

View File

@ -2354,6 +2354,12 @@ bool UTIL_AreBotsAllowed()
}
#ifdef REGAMEDLL_ADD
// let enables zBot by default from listen server?
if (!IS_DEDICATED_SERVER())
{
return true;
}
// allow the using of bots for CS 1.6
int bots = ENG_CHECK_PARM("-bots", NULL);
if (bots)

View File

@ -32,6 +32,8 @@
#pragma once
#endif
#include "gamerules.h"
class BotProfile;
template <class T, class TWrap>
@ -422,7 +424,7 @@ inline bool CBot::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other) const
inline CBot::BotRelationshipTeam CBot::BotRelationship(CBasePlayer *pTarget) const
{
#ifdef REGAMEDLL_ADD
if (cv_bot_deathmatch.value > 1.0f)
if (CSGameRules()->IsFreeForAll())
return BOT_ENEMY;
#endif