From b309fd41eb281f594e15bcf02453e603b5b59575 Mon Sep 17 00:00:00 2001 From: Tobii Date: Mon, 16 Feb 2015 11:19:42 +0100 Subject: [PATCH] Added copy moves function for dummy --- src/engine/client.h | 3 +++ src/engine/client/client.h | 1 - src/game/client/components/controls.cpp | 21 +++++++++++++++++++++ src/game/variables.h | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/engine/client.h b/src/engine/client.h index 723e0a29a..0c301e878 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -7,6 +7,7 @@ #include "message.h" #include #include +#include enum { @@ -40,6 +41,8 @@ public: int m_LocalIDs[2]; char m_aNews[NEWS_SIZE]; + CNetObj_PlayerInput DummyInput; + class CSnapItem { public: diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 12d69ef7d..a2c80d932 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -154,7 +154,6 @@ class CClient : public IClient, public CDemoPlayer::IListner int m_CurrentInput[2]; bool m_LastDummy; bool m_LastDummy2; - CNetObj_PlayerInput DummyInput; CNetObj_PlayerInput HammerInput; // graphs diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 477b21efd..d06515d1f 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -273,6 +273,27 @@ int CControls::SnapInput(int *pData) if(!m_InputDirectionLeft[g_Config.m_ClDummy] && m_InputDirectionRight[g_Config.m_ClDummy]) m_InputData[g_Config.m_ClDummy].m_Direction = 1; + // dummy copy moves + if(g_Config.m_ClDummyCopyMoves) + { + CNetObj_PlayerInput *DummyInput = &Client()->DummyInput; + DummyInput->m_Direction = m_InputData[g_Config.m_ClDummy].m_Direction; + DummyInput->m_Hook = m_InputData[g_Config.m_ClDummy].m_Hook; + DummyInput->m_Jump = m_InputData[g_Config.m_ClDummy].m_Jump; + DummyInput->m_PlayerFlags = m_InputData[g_Config.m_ClDummy].m_PlayerFlags; + DummyInput->m_TargetX = m_InputData[g_Config.m_ClDummy].m_TargetX; + DummyInput->m_TargetY = m_InputData[g_Config.m_ClDummy].m_TargetY; + DummyInput->m_WantedWeapon = m_InputData[g_Config.m_ClDummy].m_WantedWeapon; + + + + DummyInput->m_Fire += m_InputData[g_Config.m_ClDummy].m_Fire - m_LastData[g_Config.m_ClDummy].m_Fire; + DummyInput->m_NextWeapon += m_InputData[g_Config.m_ClDummy].m_NextWeapon - m_LastData[g_Config.m_ClDummy].m_NextWeapon; + DummyInput->m_PrevWeapon += m_InputData[g_Config.m_ClDummy].m_PrevWeapon - m_LastData[g_Config.m_ClDummy].m_PrevWeapon; + + m_InputData[!g_Config.m_ClDummy] = *DummyInput; + } + // stress testing if(g_Config.m_DbgStress) { diff --git a/src/game/variables.h b/src/game/variables.h index 9d98e74cb..22421f8e3 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -101,6 +101,7 @@ MACRO_CONFIG_STR(DummySkin, dummy_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_SA MACRO_CONFIG_INT(ClDummy, cl_dummy, 0, 0, 1, CFGFLAG_CLIENT, "0 - player / 1 - dummy") MACRO_CONFIG_INT(ClDummyHammer, cl_dummy_hammer, 0, 0, 1, CFGFLAG_CLIENT, "Whether dummy is hammering for a hammerfly") MACRO_CONFIG_INT(ClDummyResetOnSwitch, cl_dummy_resetonswitch, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Whether dummy should stop pressing keys when you switch") +MACRO_CONFIG_INT(ClDummyCopyMoves, cl_dummy_copy_moves, 0, 0, 1, CFGFLAG_CLIENT, "Wether dummy should copy your moves") // server MACRO_CONFIG_INT(SvWarmup, sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of seconds to do warmup before round starts")