diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 718f66abf..f9f0910ab 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2059,7 +2059,7 @@ int main(int argc, const char **argv) // ignore_convention { if(str_comp("-s", argv[i]) == 0 || str_comp("--silent", argv[i]) == 0) // ignore_convention { - ShowWindow(GetConsoleWindow(), SW_HIDE); + FreeConsole(); break; } } diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index bf3e703cf..ff41550ff 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -48,7 +48,7 @@ void CInput::Init() SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } -void CInput::MouseRelative(int *x, int *y) +void CInput::MouseRelative(float *x, float *y) { int nx = 0, ny = 0; float Sens = g_Config.m_InpMousesens/100.0f; @@ -65,8 +65,8 @@ void CInput::MouseRelative(int *x, int *y) } } - *x = (int)(nx*Sens); - *y = (int)(ny*Sens); + *x = nx*Sens; + *y = ny*Sens; } void CInput::MouseModeAbsolute() diff --git a/src/engine/client/input.h b/src/engine/client/input.h index aeaefca1a..2f5b00bf4 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -19,7 +19,7 @@ public: virtual void Init(); - virtual void MouseRelative(int *x, int *y); + virtual void MouseRelative(float *x, float *y); virtual void MouseModeAbsolute(); virtual void MouseModeRelative(); virtual int MouseDoubleClick(); diff --git a/src/engine/input.h b/src/engine/input.h index 168614c84..3caf02e7d 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -72,7 +72,7 @@ public: virtual void MouseModeAbsolute() = 0; virtual int MouseDoubleClick() = 0; - virtual void MouseRelative(int *x, int *y) = 0; + virtual void MouseRelative(float *x, float *y) = 0; }; diff --git a/src/game/client/components/emoticon.cpp b/src/game/client/components/emoticon.cpp index e2f98397a..5ab8fe3b7 100644 --- a/src/game/client/components/emoticon.cpp +++ b/src/game/client/components/emoticon.cpp @@ -102,7 +102,7 @@ void CEmoticon::OnRender() m_WasActive = true; - int x, y; + float x, y; Input()->MouseRelative(&x, &y); m_SelectorMouse.x += x; diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index b9f202316..662a71245 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -201,7 +201,7 @@ void CHud::RenderTeambalanceWarning() void CHud::RenderVoting() { - if(!m_pClient->m_pVoting->IsVoting()) + if(!m_pClient->m_pVoting->IsVoting() || Client()->State() == IClient::STATE_DEMOPLAYBACK) return; Graphics()->TextureSet(-1); @@ -229,11 +229,11 @@ void CHud::RenderVoting() const char *pYesKey = m_pClient->m_pBinds->GetKey("vote yes"); const char *pNoKey = m_pClient->m_pBinds->GetKey("vote no"); - str_format(Buf, sizeof(Buf), "%s - Vote Yes", pYesKey); + str_format(Buf, sizeof(Buf), "%s - %s", pYesKey, Localize("Vote Yes")); Base.y += Base.h+1; UI()->DoLabel(&Base, Buf, 6.0f, -1); - str_format(Buf, sizeof(Buf), "Vote No - %s", pNoKey); + str_format(Buf, sizeof(Buf), "%s - %s", Localize("Vote No"), pNoKey); UI()->DoLabel(&Base, Buf, 6.0f, 1); } diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 20aee00f2..acc2a15e1 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -437,9 +437,9 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType else { str_format(Item.m_aName, min(static_cast(sizeof(Item.m_aName)), Length), " %s", pName); - char aBuffer[512]; - str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename); - // TODO: many items slow this down, don't load the info from every file when making the filelist + char aBuffer[512]; + str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename); + // TODO: many items slow this down, don't load the info from every file when making the filelist Item.m_Valid = pSelf->DemoPlayer()->GetDemoInfo(pSelf->Storage(), aBuffer, StorageType, Item.m_aMap, sizeof(Item.m_aMap)); } Item.m_IsDir = IsDir != 0; @@ -486,17 +486,17 @@ void CMenus::RenderDemoList(CUIRect MainView) m_DemolistDelEntry = false; } - char aFooterLabel[128] = {0}; - if(m_DemolistSelectedIndex >= 0) - { - if(str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, "..") == 0) - str_copy(aFooterLabel, Localize("Parent Folder"), sizeof(aFooterLabel)); - else if(m_DemolistSelectedIsDir) - str_copy(aFooterLabel, Localize("Folder"), sizeof(aFooterLabel)); - else if(!m_lDemos[m_DemolistSelectedIndex].m_Valid) - str_copy(aFooterLabel, Localize("Invalid Demo"), sizeof(aFooterLabel)); - else - str_format(aFooterLabel, sizeof(aFooterLabel), "%s: %s", Localize("Map"), m_lDemos[m_DemolistSelectedIndex].m_aMap); + char aFooterLabel[128] = {0}; + if(m_DemolistSelectedIndex >= 0) + { + if(str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, "..") == 0) + str_copy(aFooterLabel, Localize("Parent Folder"), sizeof(aFooterLabel)); + else if(m_DemolistSelectedIsDir) + str_copy(aFooterLabel, Localize("Folder"), sizeof(aFooterLabel)); + else if(!m_lDemos[m_DemolistSelectedIndex].m_Valid) + str_copy(aFooterLabel, Localize("Invalid Demo"), sizeof(aFooterLabel)); + else + str_format(aFooterLabel, sizeof(aFooterLabel), "%s: %s", Localize("Map"), m_lDemos[m_DemolistSelectedIndex].m_aMap); } // render background diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 1c49e7a68..faa4390df 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -309,9 +309,9 @@ void CGameClient::OnInit() void CGameClient::DispatchInput() { // handle mouse movement - int x=0, y=0; + float x = 0.0f, y = 0.0f; Input()->MouseRelative(&x, &y); - if(x || y) + if(x != 0.0f || y != 0.0f) { for(int h = 0; h < m_Input.m_Num; h++) { diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 8c812123d..21126644f 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -3286,8 +3286,8 @@ void CEditor::DoMapBorder() void CEditor::UpdateAndRender() { - static int s_MouseX = 0; - static int s_MouseY = 0; + static float s_MouseX = 0.0f; + static float s_MouseY = 0.0f; if(m_Animate) m_AnimateTime = (time_get()-m_AnimateStart)/(float)time_freq(); @@ -3297,7 +3297,7 @@ void CEditor::UpdateAndRender() // handle mouse movement float mx, my, Mwx, Mwy; - int rx, ry; + float rx, ry; { Input()->MouseRelative(&rx, &ry); m_MouseDeltaX = rx; @@ -3309,10 +3309,8 @@ void CEditor::UpdateAndRender() s_MouseY += ry; } - if(s_MouseX < 0) s_MouseX = 0; - if(s_MouseY < 0) s_MouseY = 0; - if(s_MouseX > UI()->Screen()->w) s_MouseX = (int)UI()->Screen()->w; - if(s_MouseY > UI()->Screen()->h) s_MouseY = (int)UI()->Screen()->h; + clamp(s_MouseX, 0.0f, UI()->Screen()->w); + clamp(s_MouseY, 0.0f, UI()->Screen()->h); // update the ui mx = s_MouseX; diff --git a/src/game/variables.h b/src/game/variables.h index 57f6b28c5..f51951281 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -67,9 +67,7 @@ MACRO_CONFIG_INT(SvInactiveKickTime, sv_inactivekick_time, 180, 0, 9999, CFGFLAG MACRO_CONFIG_INT(SvInactiveKick, sv_inactivekick, 1, 0, 2, CFGFLAG_SERVER, "How to deal with inactive players (0=move to spectator, 1=move to free spectator slot/kick, 2=kick)", 3) MACRO_CONFIG_INT(SvVoteKick, sv_vote_kick, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to kick players", 3) -MACRO_CONFIG_INT(SvVoteKickBantime, sv_vote_kick_bantime, 300, 0, 9999, CFGFLAG_SERVER, "The time to ban a player if kicked by vote. 0 makes it just use kick", 3) -/*MACRO_CONFIG_INT(SvVoteScorelimit, sv_vote_scorelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change score limit") -MACRO_CONFIG_INT(SvVoteTimelimit, sv_vote_timelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change time limit")*/ +MACRO_CONFIG_INT(SvVoteKickBantime, sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time to ban a player if kicked by vote. 0 makes it just use kick", 3) // debug #ifdef CONF_DEBUG // this one can crash the server if not used correctly