Fix: Dummy stop hammering immediately when cl_dummy_hammer is toggled off

This commit is contained in:
def 2014-04-30 17:51:34 +02:00
parent 2b08464527
commit 873d17ceed
2 changed files with 19 additions and 15 deletions

View file

@ -464,16 +464,20 @@ void CClient::SendInput()
}
}
if(m_DummyConnected)
{
if(!g_Config.m_ClDummy)
m_LocalIDs[0] = ((CGameClient *)GameClient())->m_Snap.m_LocalClientID;
else
m_LocalIDs[1] = ((CGameClient *)GameClient())->m_Snap.m_LocalClientID;
if(m_DummyConnected)
{
if(!g_Config.m_ClDummyHammer)
{
if(m_Fire != 25)
{
DummyInput.m_Fire = HammerInput.m_Fire;
m_Fire = 25;
}
if(!Size && (!DummyInput.m_Direction && !DummyInput.m_Jump && !DummyInput.m_Hook))
return;
@ -499,27 +503,26 @@ void CClient::SendInput()
}
m_Fire++;
CNetObj_PlayerInput DummyData;
mem_zero(&DummyData, sizeof(DummyData));
mem_zero(&HammerInput, sizeof(HammerInput));
DummyData.m_Fire = (int) ((float) m_Fire / 12.5);
DummyData.m_WantedWeapon = 1;
HammerInput.m_Fire = (int) ((float) m_Fire / 12.5);
HammerInput.m_WantedWeapon = 1;
CNetObj_Character Main = ((CGameClient *)GameClient())->m_Snap.m_aCharacters[m_LocalIDs[g_Config.m_ClDummy]].m_Cur;
CNetObj_Character Dummy = ((CGameClient *)GameClient())->m_Snap.m_aCharacters[m_LocalIDs[!g_Config.m_ClDummy]].m_Cur;
vec2 Dir = vec2(Main.m_X - Dummy.m_X, Main.m_Y - Dummy.m_Y);
DummyData.m_TargetX = Dir.x;
DummyData.m_TargetY = Dir.y;
HammerInput.m_TargetX = Dir.x;
HammerInput.m_TargetY = Dir.y;
// pack input
CMsgPacker Msg(NETMSG_INPUT);
Msg.AddInt(m_AckGameTick[g_Config.m_ClDummy]);
Msg.AddInt(m_PredTick[g_Config.m_ClDummy]);
Msg.AddInt(sizeof(DummyData));
Msg.AddInt(sizeof(HammerInput));
// pack it
for(unsigned int i = 0; i < sizeof(DummyData)/4; i++)
Msg.AddInt(((int*) &DummyData)[i]);
for(unsigned int i = 0; i < sizeof(HammerInput)/4; i++)
Msg.AddInt(((int*) &HammerInput)[i]);
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
}

View file

@ -147,6 +147,7 @@ class CClient : public IClient, public CDemoPlayer::IListner
int m_CurrentInput;
bool m_LastDummy;
CNetObj_PlayerInput DummyInput;
CNetObj_PlayerInput HammerInput;
// graphs
CGraph m_InputtimeMarginGraph;