diff --git a/README.md b/README.md
index 2654bcf7..e5b55c0c 100644
--- a/README.md
+++ b/README.md
@@ -116,7 +116,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_freezetime_duck | 1 | 0 | 1 | Allow players to duck during freezetime.
`0` disabled
`1` enabled |
| mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.
`0` disabled
`1` enabled |
| mp_defuser_allocation | 0 | 0 | 2 | Give defuser on player spawn.
`0` disabled
`1` Random players.
`2` All players. |
-| mp_location_area_info | 0 | 0 | 1 | Enable location area info.
`0` disabled
`1` enabled.
Usually displayed in HUDs below radar or in radio chat as a prefix.
`NOTE`: Navigation `maps/.nav` file required and should contain place names |
+| mp_location_area_info | 0 | 0 | 3 | Enable location area info.
`0` disabled
`1` show location below HUD radar.
`2` show location in HUD chat. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")
`3` both displayed. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")
`NOTE`: Navigation `maps/.nav` file required and should contain place names
`NOTE`: If option `2` or `3` is enabled, be sure to enable `mp_chat_loc_fallback 1` |
## How to install zBot for CS 1.6?
diff --git a/dist/game.cfg b/dist/game.cfg
index f426c00b..e6510f34 100644
--- a/dist/game.cfg
+++ b/dist/game.cfg
@@ -577,11 +577,13 @@ mp_freezetime_jump "1"
mp_defuser_allocation "0"
// Enable location area info
-// Usually displayed in HUDs below radar or in radio chat as a prefix
// 0 - disabled (default behavior)
-// 1 - enabled
+// 1 - show location below HUD radar
+// 2 - show location in HUD chat (NOT RECOMMENDED! Not all client builds are compatible)
+// 3 - both displayed (NOT RECOMMENDED! Not all client builds are compatible)
//
// NOTE: Navigation maps/.nav file required and should contain place names
+// NOTE: If option 2 or 3 is enabled, be sure to enable mp_chat_loc_fallback 1
//
// Default value: "0"
mp_location_area_info "0"
diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp
index 0564bedd..6b8fdf02 100644
--- a/regamedll/dlls/client.cpp
+++ b/regamedll/dlls/client.cpp
@@ -836,7 +836,11 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
// team only
if (teamonly)
{
- if (AreRunningCZero() && (pPlayer->m_iTeam == CT || pPlayer->m_iTeam == TERRORIST))
+ if ((
+#ifdef REGAMEDLL_ADD
+ location_area_info.value >= 2 ||
+#endif
+ AreRunningCZero()) && (pPlayer->m_iTeam == CT || pPlayer->m_iTeam == TERRORIST))
{
// search the place name where is located the player
Place playerPlace = TheNavAreaGrid.GetPlace(&pPlayer->pev->origin);
@@ -850,8 +854,17 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
break;
}
}
+
+ if (!placeName)
+ placeName = TheNavAreaGrid.IDToName(playerPlace);
}
+ bool bUseLocFallback = false;
+#ifdef REGAMEDLL_ADD
+ if (chat_loc_fallback.value)
+ bUseLocFallback = true;
+#endif
+
if (pPlayer->m_iTeam == CT)
{
if (bSenderDead)
@@ -861,7 +874,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
}
else if (placeName)
{
- pszFormat = "#Cstrike_Chat_CT_Loc";
+ pszFormat = bUseLocFallback ? "\x1(Counter-Terrorist) \x3%s1\x1 @ \x4%s3\x1 : %s2" : "#Cstrike_Chat_CT_Loc";
pszConsoleFormat = "*(Counter-Terrorist) %s @ %s : %s";
consoleUsesPlaceName = true;
}
@@ -880,7 +893,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
}
else if (placeName)
{
- pszFormat = "#Cstrike_Chat_T_Loc";
+ pszFormat = bUseLocFallback ? "\x1(Terrorist) \x3%s1\x1 @ \x4%s3\x1 : %s2" : "#Cstrike_Chat_T_Loc";
pszConsoleFormat = "(Terrorist) %s @ %s : %s";
consoleUsesPlaceName = true;
}
diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp
index d9d75677..8d781724 100644
--- a/regamedll/dlls/game.cpp
+++ b/regamedll/dlls/game.cpp
@@ -179,6 +179,7 @@ cvar_t legacy_vehicle_block = { "mp_legacy_vehicle_block", "1", 0,
cvar_t dying_time = { "mp_dying_time", "3.0", 0, 3.0f, nullptr };
cvar_t defuser_allocation = { "mp_defuser_allocation", "0", 0, 0.0f, nullptr };
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 };
void GameDLL_Version_f()
{
@@ -443,6 +444,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&freezetime_jump);
CVAR_REGISTER(&defuser_allocation);
CVAR_REGISTER(&location_area_info);
+ CVAR_REGISTER(&chat_loc_fallback);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h
index 73cb77dd..dcd712f5 100644
--- a/regamedll/dlls/game.h
+++ b/regamedll/dlls/game.h
@@ -202,6 +202,7 @@ extern cvar_t freezetime_duck;
extern cvar_t freezetime_jump;
extern cvar_t defuser_allocation;
extern cvar_t location_area_info;
+extern cvar_t chat_loc_fallback;
#endif
diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp
index d4da397d..63ea1d06 100644
--- a/regamedll/dlls/player.cpp
+++ b/regamedll/dlls/player.cpp
@@ -417,7 +417,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Radio)(const char *msg_id, const char *msg
const char *placeName = nullptr;
if ((
#ifdef REGAMEDLL_ADD
- location_area_info.value ||
+ location_area_info.value >= 2 ||
#endif
AreRunningCZero()) && TheBotPhrases)
{
@@ -432,14 +432,24 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Radio)(const char *msg_id, const char *msg
}
}
- if (!placeName[0])
+ if (!placeName)
placeName = TheNavAreaGrid.IDToName(playerPlace);
}
- if (placeName)
- ClientPrint(pEntity->pev, HUD_PRINTRADIO, NumAsString(entindex()), "#Game_radio_location", STRING(pev->netname), placeName, msg_verbose);
+ if (placeName && placeName[0])
+ {
+ bool bUseLocFallback = false;
+#ifdef REGAMEDLL_ADD
+ if (chat_loc_fallback.value)
+ bUseLocFallback = true;
+#endif
+
+ ClientPrint(pEntity->pev, HUD_PRINTRADIO, NumAsString(entindex()), bUseLocFallback ? "\x3%s1\x1 @ \x4%s2\x1 (RADIO): %s3" : "#Game_radio_location", STRING(pev->netname), placeName, msg_verbose);
+ }
else
+ {
ClientPrint(pEntity->pev, HUD_PRINTRADIO, NumAsString(entindex()), "#Game_radio", STRING(pev->netname), msg_verbose);
+ }
}
// icon over the head for teammates
@@ -10089,11 +10099,11 @@ void CBasePlayer::UpdateLocation(bool forceUpdate)
if (!forceUpdate && m_flLastUpdateTime >= gpGlobals->time + 2.0f)
return;
- const char *placeName = "";
+ const char *placeName = nullptr;
if (pev->deadflag == DEAD_NO && (
#ifdef REGAMEDLL_ADD
- location_area_info.value ||
+ (location_area_info.value == 1 || location_area_info.value == 3) ||
#endif
AreBotsAllowed()))
{
@@ -10109,7 +10119,7 @@ void CBasePlayer::UpdateLocation(bool forceUpdate)
}
}
- if (!placeName[0])
+ if (!placeName)
placeName = TheNavAreaGrid.IDToName(playerPlace);
}