Updated latest changes:

ValveSoftware/halflife#555
ValveSoftware/halflife#702
ValveSoftware/halflife#2228
ValveSoftware/halflife#1276 (was fixed earlier REGAMEDLL_FIXES)
This commit is contained in:
s1lent 2019-06-04 21:41:30 +07:00
parent 94f0fdb8a6
commit e1c8211d6b
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
14 changed files with 214 additions and 9 deletions

View File

@ -179,7 +179,7 @@ void setupToolchain(NativeBinarySpec b)
}
if (regamedllFixes) {
cfg.singleDefines 'REGAMEDLL_FIXES', 'REGAMEDLL_CHECKS', 'REGAMEDLL_ADD', 'UNICODE_FIXES', 'NDEBUG'
cfg.singleDefines 'REGAMEDLL_FIXES', 'BUILD_LATEST', 'BUILD_LATEST_FIXES', 'REGAMEDLL_CHECKS', 'REGAMEDLL_ADD', 'UNICODE_FIXES', 'NDEBUG'
} else {
cfg.singleDefines 'PLAY_GAMEDLL'
}

View File

@ -60,9 +60,10 @@ const int DEFAULT_FOV = 90; // the default field of view
#define ITEM_STATUS_NIGHTVISION BIT(0)
#define ITEM_STATUS_DEFUSER BIT(1)
#define SCORE_STATUS_DEAD BIT(0)
#define SCORE_STATUS_BOMB BIT(1)
#define SCORE_STATUS_VIP BIT(2)
#define SCORE_STATUS_DEAD BIT(0)
#define SCORE_STATUS_BOMB BIT(1)
#define SCORE_STATUS_VIP BIT(2)
#define SCORE_STATUS_DEFKIT BIT(3)
// player data iuser3
#define PLAYER_CAN_SHOOT BIT(0)

View File

@ -82,7 +82,8 @@ int gmsgBotProgress = 0;
int gmsgBrass = 0;
int gmsgFog = 0;
int gmsgShowTimer = 0;
int gmsgAccount = 0;
int gmsgHealthInfo = 0;
bool g_bClientPrintEnable = true;
char *sPlayerModelFiles[] =
@ -223,6 +224,11 @@ void LinkUserMessages()
gmsgFog = REG_USER_MSG("Fog", 7);
gmsgShowTimer = REG_USER_MSG("ShowTimer", 0);
gmsgHudTextArgs = REG_USER_MSG("HudTextArgs", -1);
#ifdef BUILD_LATEST
gmsgAccount = REG_USER_MSG("Account", 5);
gmsgHealthInfo = REG_USER_MSG("HealthInfo", 5);
#endif
}
void WriteSigonMessages()
@ -1426,6 +1432,10 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/kevlar.wav", VOL_NORM, ATTN_NORM);
#endif
pPlayer->SendItemStatus();
#ifdef BUILD_LATEST
pPlayer->SetScoreboardAttributes();
#endif
}
break;
}

View File

@ -289,3 +289,5 @@ extern int gmsgBotProgress;
extern int gmsgBrass;
extern int gmsgFog;
extern int gmsgShowTimer;
extern int gmsgAccount;
extern int gmsgHealthInfo;

View File

@ -239,8 +239,12 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController)
{
m_pController->m_pActiveItem->Holster();
m_pController->pev->weaponmodel = 0;
#ifdef REGAMEDLL_FIXES
#ifdef BUILD_LATEST_FIXES
m_pController->pev->viewmodel = 0;
#endif
#ifdef REGAMEDLL_FIXES
m_pController->m_iFOV = DEFAULT_FOV;
#endif
}

View File

@ -122,6 +122,9 @@ cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", FCVAR_SERVER, 0.
cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr };
cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr };
cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr };
cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr };
void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
@ -214,6 +217,11 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&timeleft);
CVAR_REGISTER(&humans_join_team);
#ifdef BUILD_LATEST
CVAR_REGISTER(&scoreboard_showhealth);
CVAR_REGISTER(&scoreboard_showmoney);
#endif
// Remove unused cvars
#ifndef REGAMEDLL_FIXES

View File

@ -160,4 +160,7 @@ extern cvar_t hullbounds_sets;
#endif
extern cvar_t scoreboard_showmoney;
extern cvar_t scoreboard_showhealth;
void GameDLLInit();

View File

@ -3344,7 +3344,11 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)
if (plr->pev->flags == FL_DORMANT)
continue;
#endif
if (plr->pev->deadflag == DEAD_NO)
if (plr->pev->deadflag == DEAD_NO
#ifdef BUILD_LATEST_FIXES
&& plr->m_iTeam == pl->m_iTeam
#endif
)
{
MESSAGE_BEGIN(MSG_ONE, gmsgRadar, nullptr, pl->edict());
WRITE_BYTE(plr->entindex());
@ -3354,6 +3358,18 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)
MESSAGE_END();
}
}
#ifdef BUILD_LATEST
MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pl->edict());
WRITE_BYTE(plr->entindex());
WRITE_LONG(plr->ShouldToShowHealthInfo(pl) ? plr->m_iClientHealth : -1 /* means that 'HP' field will be hidden */);
MESSAGE_END();
MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pl->edict());
WRITE_BYTE(plr->entindex());
WRITE_LONG(plr->ShouldToShowAccount(pl) ? plr->m_iAccount : -1 /* means that this 'Money' will be hidden */);
MESSAGE_END();
#endif // BUILD_LATEST
}
auto SendMsgBombDrop = [&pl](const int flag, const Vector& pos)

View File

@ -5069,6 +5069,11 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
if (m_bIsVIP)
state |= SCORE_STATUS_VIP;
#ifdef BUILD_LATEST
if (m_bHasDefuser)
state |= SCORE_STATUS_DEFKIT;
#endif
if (gmsgScoreAttrib)
{
MESSAGE_BEGIN(MSG_ONE, gmsgScoreAttrib, nullptr, dest->pev);
@ -5165,6 +5170,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)()
m_iChaseTarget = 1;
m_bEscaped = false;
m_tmNextRadarUpdate = gpGlobals->time;
#ifdef BUILD_LATEST
m_tmNextAccountHealthUpdate = gpGlobals->time;
#endif
m_vLastOrigin = Vector(0, 0, 0);
m_iCurrentKickVote = 0;
m_flNextVoteTime = 0;
@ -5529,6 +5539,10 @@ int CBasePlayer::Restore(CRestore &restore)
else
UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX);
#ifdef BUILD_LATEST_FIXES
TabulateAmmo();
#endif
m_flDisplayHistory &= ~DHM_CONNECT_CLEAR;
SetScoreboardAttributes();
@ -6996,6 +7010,106 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)()
m_vLastOrigin = pev->origin;
}
#ifdef BUILD_LATEST
if ((m_iTeam == CT || m_iTeam == TERRORIST) &&
(m_iLastAccount != m_iAccount || m_iLastClientHealth != m_iClientHealth || m_tmNextAccountHealthUpdate < gpGlobals->time))
{
m_tmNextAccountHealthUpdate = gpGlobals->time + 5.0f;
for (int playerIndex = 1; playerIndex <= gpGlobals->maxClients; playerIndex++)
{
CBaseEntity *pEntity = UTIL_PlayerByIndex(playerIndex);
if (!pEntity)
continue;
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
#ifdef REGAMEDLL_FIXES
if (pPlayer->IsDormant())
continue;
#endif // REGAMEDLL_FIXES
MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pPlayer->edict());
WRITE_BYTE(entindex());
WRITE_LONG(ShouldToShowHealthInfo(pPlayer) ? m_iClientHealth : -1 /* means that 'HP' field will be hidden */);
MESSAGE_END();
MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pPlayer->edict());
WRITE_BYTE(entindex());
WRITE_LONG(ShouldToShowAccount(pPlayer) ? m_iAccount : -1 /* means that this 'Money' will be hidden */);
MESSAGE_END();
}
m_iLastAccount = m_iAccount;
m_iLastClientHealth = m_iClientHealth;
}
#endif // #ifdef BUILD_LATEST
}
bool CBasePlayer::ShouldToShowAccount(CBasePlayer *pReceiver) const
{
#ifdef BUILD_LATEST
int iShowAccount = static_cast<int>(scoreboard_showmoney.value);
#ifdef REGAMEDLL_FIXES
if (iShowAccount == 0)
return false; // don't send any update for this field to any clients
#endif
// show only Terrorist or CT 'Money' field to all clients
if (m_iTeam == iShowAccount)
return true;
switch (iShowAccount)
{
// show field to teammates
case 3: return pReceiver->m_iTeam == m_iTeam;
// show field to all clients
case 4: return true;
// show field to teammates and spectators
case 5: return (pReceiver->m_iTeam == m_iTeam || pReceiver->m_iTeam == SPECTATOR);
default:
break;
}
#endif // #ifdef BUILD_LATEST
return false;
}
bool CBasePlayer::ShouldToShowHealthInfo(CBasePlayer *pReceiver) const
{
#ifdef BUILD_LATEST
int iShowHealth = static_cast<int>(scoreboard_showhealth.value);
#ifdef REGAMEDLL_FIXES
if (iShowHealth == 0)
return false; // don't send any update for this field to any clients
#endif
// show only Terrorist or CT 'HP' fields to all clients
if (m_iTeam == iShowHealth)
return true;
switch (iShowHealth)
{
// show field to teammates
case 3: return pReceiver->m_iTeam == m_iTeam;
// show field to all clients
case 4: return true;
// show field to teammates and spectators
case 5: return (pReceiver->m_iTeam == m_iTeam || pReceiver->m_iTeam == SPECTATOR);
default:
break;
}
#endif // #ifdef BUILD_LATEST
return false;
}
BOOL CBasePlayer::FBecomeProne()

View File

@ -606,6 +606,8 @@ public:
void HideTimer();
bool MakeBomber();
bool GetIntoGame();
bool ShouldToShowAccount(CBasePlayer *pReceiver) const;
bool ShouldToShowHealthInfo(CBasePlayer *pReceiver) const;
CBasePlayerItem *GetItemByName(const char *itemName);
CBasePlayerItem *GetItemById(WeaponIdType weaponID);
@ -864,6 +866,12 @@ public:
float m_silentTimestamp;
MusicState m_musicState;
float m_flLastCommandTime[COMMANDS_TO_TRACK];
#ifdef BUILD_LATEST
int m_iLastAccount;
int m_iLastClientHealth;
float m_tmNextAccountHealthUpdate;
#endif
};
class CWShield: public CBaseEntity

View File

@ -805,6 +805,9 @@ bool CBasePlayerWeapon::HasSecondaryAttack()
case WEAPON_ELITE:
case WEAPON_FIVESEVEN:
case WEAPON_MP5N:
#ifdef BUILD_LATEST_FIXES
case WEAPON_UMP45:
#endif
case WEAPON_M249:
case WEAPON_M3:
case WEAPON_TMP:

View File

@ -75,6 +75,19 @@ void CM3::PrimaryAttack()
if (m_iClip <= 0)
{
#ifdef BUILD_LATEST_FIXES
if (!m_fInSpecialReload)
{
PlayEmptySound();
if (TheBots)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
}
Reload();
#else
Reload();
if (!m_iClip)
@ -88,6 +101,8 @@ void CM3::PrimaryAttack()
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
#endif // #ifdef BUILD_LATEST_FIXES
return;
}
@ -184,6 +199,9 @@ void CM3::Reload()
m_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.45f;
}
else
#ifdef BUILD_LATEST_FIXES
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
#endif
{
m_iClip++;

View File

@ -73,6 +73,19 @@ void CXM1014::PrimaryAttack()
if (m_iClip <= 0)
{
#ifdef BUILD_LATEST_FIXES
if (!m_fInSpecialReload)
{
PlayEmptySound();
if (TheBots)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
}
Reload();
#else
Reload();
if (!m_iClip)
@ -86,6 +99,8 @@ void CXM1014::PrimaryAttack()
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
#endif // #ifdef BUILD_LATEST_FIXES
return;
}
@ -187,6 +202,9 @@ void CXM1014::Reload()
m_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.3f;
}
else
#ifdef BUILD_LATEST_FIXES
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
#endif
{
m_iClip++;

View File

@ -909,7 +909,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REGAMEDLL_ADD;REGAMEDLL_API;REGAMEDLL_SSE;REGAMEDLL_FIXES;REGAMEDLL_SELF;UNICODE_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REGAMEDLL_ADD;REGAMEDLL_API;REGAMEDLL_SSE;REGAMEDLL_FIXES;REGAMEDLL_SELF;BUILD_LATEST;BUILD_LATEST_FIXES;UNICODE_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -945,7 +945,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REGAMEDLL_ADD;REGAMEDLL_SSE;REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SELF;REGAMEDLL_CHECKS;UNICODE_FIXES;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REGAMEDLL_ADD;REGAMEDLL_SSE;REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SELF;REGAMEDLL_CHECKS;BUILD_LATEST;BUILD_LATEST_FIXES;UNICODE_FIXES;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>