Skip to content

Commit

Permalink
Add new Cvar to control whether scoreboard_bug is enabled (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-up authored Jul 28, 2024
1 parent 576e967 commit 03c57a1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.<br/> `0` disabled<br/>`1` enabled |
| mp_defuser_allocation | 0 | 0 | 2 | Give defuser on player spawn.<br/> `0` disabled<br/>`1` Random players. <br/>`2` All players. |
| mp_location_area_info | 0 | 0 | 3 | Enable location area info.<br/> `0` disabled<br/>`1` show location below HUD radar.<br/>`2` show location in HUD chat. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")<br/>`3` both displayed. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")<br/><br/>`NOTE`: Navigation `maps/.nav` file required and should contain place names<br/>`NOTE`: If option `2` or `3` is enabled, be sure to enable `mp_chat_loc_fallback 1` |
| mp_scoreboard_fix | 0 | 0 | 1 | Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit).<br/> `0` disabled<br/>`1` enabled<br/>`NOTE`: Absolutely cannot fix it in "CNCS😂" |
</details>

## How to install zBot for CS 1.6?
Expand Down
9 changes: 9 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,12 @@ mp_defuser_allocation "0"
//
// Default value: "0"
mp_location_area_info "0"

// Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit)
// 0 - disable
// 1 - enabled
//
// NOTE: Absolutely cannot fix it in "CNCS😂"
//
// Default value "0"
mp_scoreboard_fix "0"
4 changes: 4 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ cvar_t defuser_allocation = { "mp_defuser_allocation", "0", 0, 0.0f, nullpt
cvar_t location_area_info = { "mp_location_area_info", "0", 0, 0.0f, nullptr };
cvar_t chat_loc_fallback = { "mp_chat_loc_fallback", "1", 1, 0.0f, nullptr };

cvar_t scoreboard_fix = { "mp_scoreboard_fix", "0", FCVAR_SERVER, 0.0f, nullptr };

void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
Expand Down Expand Up @@ -446,6 +448,8 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&location_area_info);
CVAR_REGISTER(&chat_loc_fallback);

CVAR_REGISTER(&scoreboard_fix);

// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ extern cvar_t defuser_allocation;
extern cvar_t location_area_info;
extern cvar_t chat_loc_fallback;

extern cvar_t scoreboard_fix;

#endif

extern cvar_t scoreboard_showmoney;
Expand Down
18 changes: 14 additions & 4 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5548,11 +5548,21 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
#endif

#ifdef REGAMEDLL_FIXES
// TODO: Remove these fixes when they are implemented on the client side
if (state & (SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT) && GetForceCamera(dest) != CAMERA_MODE_SPEC_ANYONE)

if (
#ifdef REGAMEDLL_ADD
scoreboard_fix.value
#else
false
#endif
)
{
if (CSGameRules()->PlayerRelationship(this, dest) != GR_TEAMMATE)
state &= ~(SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT);
// TODO: Remove these fixes when they are implemented on the client side
if (state & (SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT) && GetForceCamera(dest) != CAMERA_MODE_SPEC_ANYONE)
{
if (CSGameRules()->PlayerRelationship(this, dest) != GR_TEAMMATE)
state &= ~(SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT);
}
}
#endif

Expand Down

0 comments on commit 03c57a1

Please sign in to comment.