mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix: Dummy stop hammering immediately when cl_dummy_hammer is toggled off
This commit is contained in:
parent
2b08464527
commit
873d17ceed
|
@ -464,16 +464,20 @@ void CClient::SendInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(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(!g_Config.m_ClDummyHammer)
|
if(!g_Config.m_ClDummyHammer)
|
||||||
{
|
{
|
||||||
m_Fire = 25;
|
if(m_Fire != 25)
|
||||||
|
{
|
||||||
|
DummyInput.m_Fire = HammerInput.m_Fire;
|
||||||
|
m_Fire = 25;
|
||||||
|
}
|
||||||
|
|
||||||
if(!Size && (!DummyInput.m_Direction && !DummyInput.m_Jump && !DummyInput.m_Hook))
|
if(!Size && (!DummyInput.m_Direction && !DummyInput.m_Jump && !DummyInput.m_Hook))
|
||||||
return;
|
return;
|
||||||
|
@ -499,27 +503,26 @@ void CClient::SendInput()
|
||||||
}
|
}
|
||||||
m_Fire++;
|
m_Fire++;
|
||||||
|
|
||||||
CNetObj_PlayerInput DummyData;
|
mem_zero(&HammerInput, sizeof(HammerInput));
|
||||||
mem_zero(&DummyData, sizeof(DummyData));
|
|
||||||
|
|
||||||
DummyData.m_Fire = (int) ((float) m_Fire / 12.5);
|
HammerInput.m_Fire = (int) ((float) m_Fire / 12.5);
|
||||||
DummyData.m_WantedWeapon = 1;
|
HammerInput.m_WantedWeapon = 1;
|
||||||
|
|
||||||
CNetObj_Character Main = ((CGameClient *)GameClient())->m_Snap.m_aCharacters[m_LocalIDs[g_Config.m_ClDummy]].m_Cur;
|
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;
|
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);
|
vec2 Dir = vec2(Main.m_X - Dummy.m_X, Main.m_Y - Dummy.m_Y);
|
||||||
DummyData.m_TargetX = Dir.x;
|
HammerInput.m_TargetX = Dir.x;
|
||||||
DummyData.m_TargetY = Dir.y;
|
HammerInput.m_TargetY = Dir.y;
|
||||||
|
|
||||||
// pack input
|
// pack input
|
||||||
CMsgPacker Msg(NETMSG_INPUT);
|
CMsgPacker Msg(NETMSG_INPUT);
|
||||||
Msg.AddInt(m_AckGameTick[g_Config.m_ClDummy]);
|
Msg.AddInt(m_AckGameTick[g_Config.m_ClDummy]);
|
||||||
Msg.AddInt(m_PredTick[g_Config.m_ClDummy]);
|
Msg.AddInt(m_PredTick[g_Config.m_ClDummy]);
|
||||||
Msg.AddInt(sizeof(DummyData));
|
Msg.AddInt(sizeof(HammerInput));
|
||||||
|
|
||||||
// pack it
|
// pack it
|
||||||
for(unsigned int i = 0; i < sizeof(DummyData)/4; i++)
|
for(unsigned int i = 0; i < sizeof(HammerInput)/4; i++)
|
||||||
Msg.AddInt(((int*) &DummyData)[i]);
|
Msg.AddInt(((int*) &HammerInput)[i]);
|
||||||
|
|
||||||
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ class CClient : public IClient, public CDemoPlayer::IListner
|
||||||
int m_CurrentInput;
|
int m_CurrentInput;
|
||||||
bool m_LastDummy;
|
bool m_LastDummy;
|
||||||
CNetObj_PlayerInput DummyInput;
|
CNetObj_PlayerInput DummyInput;
|
||||||
|
CNetObj_PlayerInput HammerInput;
|
||||||
|
|
||||||
// graphs
|
// graphs
|
||||||
CGraph m_InputtimeMarginGraph;
|
CGraph m_InputtimeMarginGraph;
|
||||||
|
|
Loading…
Reference in a new issue