Add cl_dummy_resetonswitch

This commit is contained in:
def 2014-07-08 01:41:45 +02:00
parent c384098ee7
commit bbe597ef04
7 changed files with 37 additions and 0 deletions

View file

@ -178,6 +178,7 @@ public:
virtual int OnSnapInput(int *pData) = 0;
virtual void SendDummyInfo(bool Start) = 0;
virtual void ResetDummyInput() = 0;
virtual const char *GetItemName(int Type) = 0;
virtual const char *Version() = 0;

View file

@ -472,6 +472,16 @@ void CClient::SendInput()
{
mem_copy(&DummyInput, &m_aInputs[!g_Config.m_ClDummy][(m_CurrentInput[!g_Config.m_ClDummy]+200-1)%200], sizeof(DummyInput));
m_LastDummy = g_Config.m_ClDummy;
if (g_Config.m_ClDummyResetOnSwitch)
{
DummyInput.m_Jump = 0;
DummyInput.m_Hook = 0;
if(DummyInput.m_Fire & 1)
DummyInput.m_Fire++;
DummyInput.m_Direction = 0;
GameClient()->ResetDummyInput();
}
}
if(!g_Config.m_ClDummy)

View file

@ -69,6 +69,24 @@ void CControls::OnReset()
m_OldMouseX = m_OldMouseY = 0.0f;
}
void CControls::ResetDummyInput()
{
m_LastData[!g_Config.m_ClDummy].m_Direction = 0;
if(m_LastData[!g_Config.m_ClDummy].m_Fire & 1)
m_LastData[!g_Config.m_ClDummy].m_Fire++;
m_LastData[!g_Config.m_ClDummy].m_Hook = 0;
m_LastData[!g_Config.m_ClDummy].m_Jump = 0;
m_InputData[!g_Config.m_ClDummy].m_Direction = 0;
if(m_InputData[!g_Config.m_ClDummy].m_Fire & 1)
m_InputData[!g_Config.m_ClDummy].m_Fire++;
m_InputData[!g_Config.m_ClDummy].m_Hook = 0;
m_InputData[!g_Config.m_ClDummy].m_Jump = 0;
m_InputDirectionLeft[!g_Config.m_ClDummy] = 0;
m_InputDirectionRight[!g_Config.m_ClDummy] = 0;
}
void CControls::OnRelease()
{
//OnReset();

View file

@ -44,5 +44,6 @@ public:
int SnapInput(int *pData);
void ClampMousePos();
void ResetDummyInput();
};
#endif

View file

@ -104,6 +104,11 @@ const char *CGameClient::Version() { return GAME_VERSION; }
const char *CGameClient::NetVersion() { return GAME_NETVERSION; }
const char *CGameClient::GetItemName(int Type) { return m_NetObjHandler.GetObjName(Type); }
void CGameClient::ResetDummyInput()
{
m_pControls->ResetDummyInput();
}
void CGameClient::OnConsoleInit()
{
m_pEngine = Kernel()->RequestInterface<IEngine>();

View file

@ -240,6 +240,7 @@ public:
virtual void OnGameOver();
virtual void OnStartGame();
virtual void ResetDummyInput();
virtual const char *GetItemName(int Type);
virtual const char *Version();
virtual const char *NetVersion();

View file

@ -93,6 +93,7 @@ MACRO_CONFIG_INT(DummyColorFeet, dummy_color_feet, 65408, 0, 0xFFFFFF, CFGFLAG_C
MACRO_CONFIG_STR(DummySkin, dummy_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Dummy skin")
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")
// server
MACRO_CONFIG_INT(SvWarmup, sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of seconds to do warmup before round starts")