ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.68k stars 623 forks source link

Missing resend code HideWeapon on ResetHUD #1567

Open WPMGPRoSToTeMa opened 9 years ago

WPMGPRoSToTeMa commented 9 years ago

When client receiving ResetHUD, HideWeapon value on client also resets, but gamedll don't resend HideWeapon. This bug can be tested on zm_gorod_new map. 1) Use stationary gun 2014-11-09 7 2) Send fullupdate command 2014-11-09 8 Fix plugin:

#include <amxmodx>
#include <fakemeta>
//#include <hamsandwich>

#define DeclarePdataVarOffset(%0,%1,%2) enum {%0=%1,%0_LinuxDiff=%2}
//#define GetPdataInt(%0,%1)            get_pdata_int(%0, %1, %1_LinuxDiff)
#define SetPdataInt(%0,%1,%2)           set_pdata_int(%0, %1, %1_LinuxDiff, %2)

//DeclarePdataVarOffset(m_fInitHUD, 348, 5);
DeclarePdataVarOffset(m_iClientHideHUD, 362, 5);

public plugin_init() {
    register_plugin("HideWeapon on ResetHUD Fix", "Alpha", "WPMG.PRoSToTeM@");

    register_event("ResetHUD", "EventResetHUD", "b");
    //RegisterHam(Ham_Player_UpdateClientData, "player", "Player_UpdateClientData_Pre", false);
}

// Sending from CBasePlayer::UpdateClientData when m_fInitHUD == TRUE
public EventResetHUD(const iClient) {
    SetPdataInt(iClient, m_iClientHideHUD, 0);
}
/*
void CBasePlayer::UpdateClientData(void)
{
    if (m_fInitHUD)
    {
        m_fInitHUD = FALSE;
        gInitHUD = FALSE;
        m_signals.Update();

        MESSAGE_BEGIN(MSG_ONE, gmsgResetHUD, NULL, pev);
        MESSAGE_END();
*/
/*
public Player_UpdateClientData_Pre(const pThis) {
    if (GetPdataInt(pThis, m_fInitHUD)) {
        SetPdataInt(pThis, m_iClientHideHUD, 0);
    }
}
*/

Also need resend Flashlight message.

rtxa commented 5 years ago

@mikela-valve check this out, seems like an easy fix. If you are using an stationary gun and you send fullupdate command, the ammo hud doesn't get hide.