mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add hammerfly for dummies
This commit is contained in:
parent
82abac307a
commit
7a5f32f155
|
@ -307,6 +307,9 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta), m_DemoRecorder(&m_SnapshotD
|
||||||
|
|
||||||
m_CurrentInput = 0;
|
m_CurrentInput = 0;
|
||||||
m_LastDummy = 0;
|
m_LastDummy = 0;
|
||||||
|
m_LocalIDs[0] = -1;
|
||||||
|
m_LocalIDs[1] = -1;
|
||||||
|
m_Fire = 0;
|
||||||
|
|
||||||
m_State = IClient::STATE_OFFLINE;
|
m_State = IClient::STATE_OFFLINE;
|
||||||
m_aServerAddressStr[0] = 0;
|
m_aServerAddressStr[0] = 0;
|
||||||
|
@ -433,9 +436,8 @@ void CClient::SendInput()
|
||||||
// fetch input
|
// fetch input
|
||||||
int Size = GameClient()->OnSnapInput(m_aInputs[m_CurrentInput].m_aData);
|
int Size = GameClient()->OnSnapInput(m_aInputs[m_CurrentInput].m_aData);
|
||||||
|
|
||||||
if(!Size)
|
if(Size)
|
||||||
return;
|
{
|
||||||
|
|
||||||
// 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]);
|
||||||
|
@ -460,8 +462,20 @@ void CClient::SendInput()
|
||||||
mem_copy(&DummyInput, &m_aInputs[(m_CurrentInput-2)%200], sizeof(DummyInput));
|
mem_copy(&DummyInput, &m_aInputs[(m_CurrentInput-2)%200], sizeof(DummyInput));
|
||||||
m_LastDummy = g_Config.m_ClDummy;
|
m_LastDummy = g_Config.m_ClDummy;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
m_Fire++;
|
||||||
|
if((((float) m_Fire / 12.5) - (int ((float) m_Fire / 12.5))) > 0.01)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!g_Config.m_ClDummyHammer)
|
||||||
{
|
{
|
||||||
// pack input
|
// pack input
|
||||||
CMsgPacker Msg(NETMSG_INPUT);
|
CMsgPacker Msg(NETMSG_INPUT);
|
||||||
|
@ -475,24 +489,25 @@ void CClient::SendInput()
|
||||||
|
|
||||||
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/*if(m_DummyConnected && !g_Config.m_ClDummy)
|
|
||||||
{
|
{
|
||||||
static int s_Fire = 0;
|
|
||||||
CNetObj_PlayerInput DummyData;
|
CNetObj_PlayerInput DummyData;
|
||||||
mem_zero(&DummyData, sizeof(DummyData));
|
mem_zero(&DummyData, sizeof(DummyData));
|
||||||
|
|
||||||
DummyData.m_Fire = s_Fire / 4.8;
|
DummyData.m_Fire = (int) ((float) m_Fire / 12.5);
|
||||||
DummyData.m_WantedWeapon = WEAPON_HAMMER;
|
DummyData.m_WantedWeapon = WEAPON_HAMMER;
|
||||||
DummyData.m_TargetX = 0;
|
|
||||||
DummyData.m_TargetY = -10;
|
|
||||||
|
|
||||||
s_Fire++;
|
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_Direction = GetAngle(Dir);
|
||||||
|
DummyData.m_TargetX = Dir.x;
|
||||||
|
DummyData.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(INT_MAX);
|
||||||
Msg.AddInt(m_PredTick[g_Config.m_ClDummy]);
|
Msg.AddInt(INT_MAX);
|
||||||
Msg.AddInt(sizeof(DummyData));
|
Msg.AddInt(sizeof(DummyData));
|
||||||
|
|
||||||
// pack it
|
// pack it
|
||||||
|
@ -500,7 +515,8 @@ void CClient::SendInput()
|
||||||
Msg.AddInt(((int*) &DummyData)[i]);
|
Msg.AddInt(((int*) &DummyData)[i]);
|
||||||
|
|
||||||
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
SendMsgExY(&Msg, MSGFLAG_FLUSH, true, !g_Config.m_ClDummy);
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CClient::LatestVersion()
|
const char *CClient::LatestVersion()
|
||||||
|
|
|
@ -249,6 +249,8 @@ public:
|
||||||
int m_DummyConnected;
|
int m_DummyConnected;
|
||||||
int m_DummyConnecting;
|
int m_DummyConnecting;
|
||||||
int m_LastDummyConnectTime;
|
int m_LastDummyConnectTime;
|
||||||
|
int m_LocalIDs[2];
|
||||||
|
int m_Fire;
|
||||||
|
|
||||||
virtual void GetServerInfo(CServerInfo *pServerInfo);
|
virtual void GetServerInfo(CServerInfo *pServerInfo);
|
||||||
void ServerInfoRequest();
|
void ServerInfoRequest();
|
||||||
|
|
|
@ -524,6 +524,7 @@ static CKeyInfo gs_aKeys[] =
|
||||||
{ "Scoreboard", "+scoreboard", 0 },
|
{ "Scoreboard", "+scoreboard", 0 },
|
||||||
{ "Respawn", "kill", 0 },
|
{ "Respawn", "kill", 0 },
|
||||||
{ "Toggle Dummy", "toggle cl_dummy 0 1", 0 },
|
{ "Toggle Dummy", "toggle cl_dummy 0 1", 0 },
|
||||||
|
{ "Hammerfly Dummy", "toggle cl_dummy_hammerfly 0 1", 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is for scripts/update_localization.py to work, don't remove!
|
/* This is for scripts/update_localization.py to work, don't remove!
|
||||||
|
@ -638,9 +639,9 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
// voting settings
|
// voting settings
|
||||||
{
|
{
|
||||||
VotingSettings.VMargin(5.0f, &VotingSettings);
|
VotingSettings.VMargin(5.0f, &VotingSettings);
|
||||||
VotingSettings.HSplitTop(MainView.h/3-75.0f, &VotingSettings, &ChatSettings);
|
VotingSettings.HSplitTop(MainView.h/3-95.0f, &VotingSettings, &ChatSettings);
|
||||||
RenderTools()->DrawUIRect(&VotingSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
RenderTools()->DrawUIRect(&VotingSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||||
VotingSettings.Margin(10.0f, &VotingSettings);
|
VotingSettings.VMargin(10.0f, &VotingSettings);
|
||||||
|
|
||||||
TextRender()->Text(0, VotingSettings.x, VotingSettings.y, 14.0f*UI()->Scale(), Localize("Voting"), -1);
|
TextRender()->Text(0, VotingSettings.x, VotingSettings.y, 14.0f*UI()->Scale(), Localize("Voting"), -1);
|
||||||
|
|
||||||
|
@ -670,7 +671,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
TextRender()->Text(0, MiscSettings.x, MiscSettings.y, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1);
|
TextRender()->Text(0, MiscSettings.x, MiscSettings.y, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1);
|
||||||
|
|
||||||
MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
|
MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
|
||||||
UiDoGetButtons(19, 29, MiscSettings);
|
UiDoGetButtons(19, 30, MiscSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ MACRO_CONFIG_INT(DummyColorBody, dummy_color_body, 65408, 0, 0xFFFFFF, CFGFLAG_C
|
||||||
MACRO_CONFIG_INT(DummyColorFeet, dummy_color_feet, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Dummy feet color")
|
MACRO_CONFIG_INT(DummyColorFeet, dummy_color_feet, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Dummy feet color")
|
||||||
MACRO_CONFIG_STR(DummySkin, dummy_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Dummy skin")
|
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(ClDummy, cl_dummy, 0, 0, 1, CFGFLAG_CLIENT, "0 - player / 1 - dummy")
|
||||||
MACRO_CONFIG_INT(ClSelectCountry, cl_select_country, 0, 0, 1, CFGFLAG_CLIENT, "Select Country in Dummy menu")
|
MACRO_CONFIG_INT(ClDummyHammer, cl_dummy_hammer, 0, 0, 1, CFGFLAG_CLIENT, "Whether dummy is hammering for a hammerfly")
|
||||||
|
|
||||||
// server
|
// server
|
||||||
MACRO_CONFIG_INT(SvWarmup, sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of seconds to do warmup before round starts")
|
MACRO_CONFIG_INT(SvWarmup, sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of seconds to do warmup before round starts")
|
||||||
|
|
Loading…
Reference in a new issue