Skip to content

Commit

Permalink
Add mp_legacy_bombtarget_touch cvar (#243)
Browse files Browse the repository at this point in the history
* Add mp_legacy_bombtarget_touch cvar
* Enable mp_legacy_bombtarget_touch by default, typo fix
* Update README.md
  • Loading branch information
In-line committed Jan 21, 2018
1 parent 69c274f commit 7a429ea
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 14 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -42,16 +42,17 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.<br/>`0` disabled<br/>`>0.00001` time delay to respawn |
| mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take damage.<br/>`0` disabled<br/>`1` from any team<br/>`2` only from `CT`<br/>`3` only from `T` |
| mp_show_radioicon | 1 | 0 | 1 | Show radio icon.<br/>`0` disabled<br/>`1` enabled |
| mp_old_bomb_defused_sound | 0 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
| mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| sv_alltalk | 0 | 0 | 4 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.
| 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_quota_mode | normal | - | - | Determines the type of quota.<br/>`normal` default behaviour<br/>`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota |
| mp_item_staytime | 300 | - | - | Time to remove item that have been dropped from the players. |
| mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict. <br/>`0` New behavior<br/>`1` Legacy behavior|

## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)
* Enter '-bots' option at the command line HLDS
* Enter `-bots` option at the command line HLDS

## Build instructions
There are several software requirements for building Regamedll_CS:
Expand Down
13 changes: 11 additions & 2 deletions dist/game.cfg
Expand Up @@ -137,8 +137,10 @@ mp_hostage_hurtable 1
mp_show_radioicon 1
// Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused
// 0 - disabled
// 1 - enabled (default hehavior)
// 0 - disabled (default behavior)
// 1 - enabled
//
// Default value: "1"
mp_old_bomb_defused_sound 1
// Set's the mode for the zBot
Expand Down Expand Up @@ -177,3 +179,10 @@ sv_alltalk 0
//
// Default value: "300"
mp_item_staytime 300
// Legacy func_bomb_target touch. New one is more strict.
// 0 - New behavior
// 1 - Legacy behavior
//
// Default value: "1"
mp_legacy_bombtarget_touch "1"
15 changes: 8 additions & 7 deletions regamedll/dlls/game.cpp
Expand Up @@ -109,13 +109,13 @@ cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullpt
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
// TODO: Maybe it's better to register in the engine?

cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", FCVAR_SERVER, 1.0f, nullptr };

void GameDLL_Version_f()
{
Expand Down Expand Up @@ -269,6 +269,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&show_radioicon);
CVAR_REGISTER(&old_bomb_defused_sound);
CVAR_REGISTER(&item_staytime);
CVAR_REGISTER(&legacy_bombtarget_touch);

// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Expand Up @@ -152,6 +152,7 @@ extern cvar_t forcerespawn;
extern cvar_t show_radioicon;
extern cvar_t old_bomb_defused_sound;
extern cvar_t item_staytime;
extern cvar_t legacy_bombtarget_touch;

#endif

Expand Down
28 changes: 27 additions & 1 deletion regamedll/dlls/triggers.cpp
Expand Up @@ -1833,14 +1833,40 @@ void CBombTarget::Spawn()
SetUse(&CBombTarget::BombTargetUse);
}

bool CBombTarget::IsPlayerInBombSite(CBasePlayer *pPlayer)
{
// Player should at least intersect with func_bomb_target.
if (!Intersects(pPlayer->pev->origin, pPlayer->pev->origin))
return false;

const Vector &absmin = pPlayer->pev->absmin;
const Vector &absmax = pPlayer->pev->absmax;

// Ensure that player's body is inside func_bomb_target's X,Y axes.
if (pev->absmin.x > absmin.x || pev->absmin.y > absmin.y)
{
return false;
}
if (pev->absmax.x < absmax.x || pev->absmax.y < absmax.y)
{
return false;
}

return true;
}

void CBombTarget::BombTargetTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())
return;

CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pOther);

if (pPlayer->m_bHasC4)
if (pPlayer->m_bHasC4
#ifdef REGAMEDLL_FIXES
&& (legacy_bombtarget_touch.value || IsPlayerInBombSite(pPlayer))
#endif
)
{
pPlayer->m_signals.Signal(SIGNAL_BOMB);
pPlayer->m_pentCurBombTarget = ENT(pev);
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/triggers.h
Expand Up @@ -406,10 +406,10 @@ class CBuyZone: public CBaseTrigger

class CBombTarget: public CBaseTrigger
{
private:
bool IsPlayerInBombSite(CBasePlayer *pPlayer);
public:
virtual void Spawn();

public:
void EXPORT BombTargetTouch(CBaseEntity *pOther);
void EXPORT BombTargetUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
};
Expand Down

0 comments on commit 7a429ea

Please sign in to comment.