From e4b3c468f2f09c904a551310ae6de10a5f31c465 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Oct 2010 01:19:22 +0200 Subject: [PATCH 1/5] don't show voting hud when playing a demo and added missing localisations. Closes #88 --- src/game/client/components/hud.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } From c828f7d725d9b243e094b44f62a844a9b47790a5 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Oct 2010 01:24:37 +0200 Subject: [PATCH 2/5] removed unused commands. Closes #60 --- src/game/variables.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/variables.h b/src/game/variables.h index 475953643..28efad48e 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -68,8 +68,6 @@ MACRO_CONFIG_INT(SvInactiveKick, sv_inactivekick, 1, 0, 2, CFGFLAG_SERVER, "How MACRO_CONFIG_INT(SvVoteKick, sv_vote_kick, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to kick players") 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") -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") // debug #ifdef CONF_DEBUG // this one can crash the server if not used correctly From e4fe7457c8acdb479e91a79cf832c48d10898be5 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Oct 2010 12:47:42 +0200 Subject: [PATCH 3/5] fixed problems with the mouse movement. Closes #214 --- src/engine/client/input.cpp | 6 +++--- src/engine/client/input.h | 2 +- src/engine/input.h | 2 +- src/game/client/components/emoticon.cpp | 2 +- src/game/client/gameclient.cpp | 4 ++-- src/game/editor/ed_editor.cpp | 12 +++++------- 6 files changed, 13 insertions(+), 15 deletions(-) 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 9139c2c12..de822b4f2 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/gameclient.cpp b/src/game/client/gameclient.cpp index df6eb889f..4728cd731 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -304,9 +304,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 295f72b94..8d1be882a 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -3194,8 +3194,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(); @@ -3205,7 +3205,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; @@ -3217,10 +3217,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; From 8fb39524a9f36424c9f0ff1bf856a602ccd3dc15 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Oct 2010 12:54:27 +0200 Subject: [PATCH 4/5] do not use console in silent mode. Closes #48 --- src/engine/client/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 44997ce0d..c07a24789 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2001,7 +2001,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; } } From 5801326ebcea91909349c8dc543f108c6d0ebcb8 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Oct 2010 12:59:30 +0200 Subject: [PATCH 5/5] fixed line endings --- src/game/client/components/menus_demo.cpp | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) 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