mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Make hook collision line size adjustable
This commit is contained in:
parent
9d1844e086
commit
3b93e656a0
|
@ -370,6 +370,7 @@ MACRO_CONFIG_INT(ClPredictFreeze, cl_predict_freeze, 1, 0, 2, CFGFLAG_CLIENT | C
|
|||
MACRO_CONFIG_INT(ClShowNinja, cl_show_ninja, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ninja skin")
|
||||
MACRO_CONFIG_INT(ClShowHookCollOther, cl_show_hook_coll_other, 1, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show other players' hook collision line (2 to always show)")
|
||||
MACRO_CONFIG_INT(ClShowHookCollOwn, cl_show_hook_coll_own, 1, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show own players' hook collision line (2 to always show)")
|
||||
MACRO_CONFIG_INT(ClHookCollSize, cl_hook_coll_size, 0, 0, 20, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Size of hook collision line")
|
||||
|
||||
MACRO_CONFIG_COL(ClHookCollColorNoColl, cl_hook_coll_color_no_coll, 65407, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Specifies the color of a hookline that hits nothing.")
|
||||
MACRO_CONFIG_COL(ClHookCollColorHookableColl, cl_hook_coll_color_hookable_coll, 6401973, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Specifies the color of a hookline that hits hookable tiles.")
|
||||
|
|
|
@ -2151,6 +2151,17 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
|
||||
UI()->DoLabelScaled(&SectionTwo, Localize("Hookline"), 20.0f, TEXTALIGN_LEFT);
|
||||
|
||||
MainView.Margin(5.0f, &MainView);
|
||||
|
||||
{
|
||||
CUIRect Button, Label;
|
||||
MainView.HSplitTop(5.0f, &Button, &MainView);
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
Button.VSplitLeft(40.0f, &Label, &Button);
|
||||
UI()->DoLabelScaled(&Label, Localize("Size"), 14.0f, TEXTALIGN_LEFT);
|
||||
g_Config.m_ClHookCollSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClHookCollSize, &Button, g_Config.m_ClHookCollSize / 20.0f) * 20.0f);
|
||||
}
|
||||
|
||||
MainView.HSplitTop(5.0f, 0x0, &MainView);
|
||||
MainView.HSplitTop(25.0f, &SectionTwo, &MainView);
|
||||
|
||||
|
|
|
@ -294,7 +294,11 @@ void CPlayers::RenderPlayer(
|
|||
vec2 InitPos = Position;
|
||||
vec2 FinishPos = InitPos + ExDirection * (m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength - 42.0f);
|
||||
|
||||
Graphics()->LinesBegin();
|
||||
if(g_Config.m_ClHookCollSize > 0)
|
||||
Graphics()->QuadsBegin();
|
||||
else
|
||||
Graphics()->LinesBegin();
|
||||
|
||||
ColorRGBA HookCollColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClHookCollColorNoColl));
|
||||
|
||||
float PhysSize = 28.0f;
|
||||
|
@ -352,9 +356,24 @@ void CPlayers::RenderPlayer(
|
|||
HookCollColor = color_invert(HookCollColor);
|
||||
}
|
||||
Graphics()->SetColor(HookCollColor.WithAlpha(Alpha));
|
||||
IGraphics::CLineItem LineItem(InitPos.x, InitPos.y, FinishPos.x, FinishPos.y);
|
||||
Graphics()->LinesDraw(&LineItem, 1);
|
||||
Graphics()->LinesEnd();
|
||||
if(g_Config.m_ClHookCollSize > 0)
|
||||
{
|
||||
float LineWidth = 0.5f + (float)(g_Config.m_ClHookCollSize - 1) * 0.25f;
|
||||
vec2 PerpToAngle = normalize(vec2(ExDirection.y, -ExDirection.x)) * GameClient()->m_Camera.m_Zoom;
|
||||
vec2 Pos0 = FinishPos + PerpToAngle * -LineWidth;
|
||||
vec2 Pos1 = FinishPos + PerpToAngle * LineWidth;
|
||||
vec2 Pos2 = InitPos + PerpToAngle * -LineWidth;
|
||||
vec2 Pos3 = InitPos + PerpToAngle * LineWidth;
|
||||
IGraphics::CFreeformItem FreeformItem(Pos0.x, Pos0.y, Pos1.x, Pos1.y, Pos2.x, Pos2.y, Pos3.x, Pos3.y);
|
||||
Graphics()->QuadsDrawFreeform(&FreeformItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
IGraphics::CLineItem LineItem(InitPos.x, InitPos.y, FinishPos.x, FinishPos.y);
|
||||
Graphics()->LinesDraw(&LineItem, 1);
|
||||
Graphics()->LinesEnd();
|
||||
}
|
||||
}
|
||||
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
|
Loading…
Reference in a new issue