From 67453fc32dccf7708f7393ed84774cdd2c17d734 Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Wed, 10 Feb 2016 18:11:23 +0200 Subject: [PATCH 1/6] Ignore changes in here extern int palette[][] is giving link trouble when building on win7 VS2013 Express. This change did not fix palette behaviour for scoreboard. --- Sources/Client/ScoreboardView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Client/ScoreboardView.cpp b/Sources/Client/ScoreboardView.cpp index 122a69662..6a9544b68 100644 --- a/Sources/Client/ScoreboardView.cpp +++ b/Sources/Client/ScoreboardView.cpp @@ -221,7 +221,7 @@ namespace spades { return score > ent.score; } }; - + void ScoreboardView::DrawPlayers(int team, float left, float top, float width, float height){ IFont *font = client->textFont; @@ -257,7 +257,8 @@ namespace spades { int row = 0, col = 0; float colWidth = (float)width / (float)cols; - extern int palette[32][3]; + //Chameleon: ignore this - I just couldn't compile with "extern" in front. Palette doesn't work for player list + int palette[32][3]; std::string colormode = cg_Minimap_Player_Color; for(int i = 0; i < numPlayers; i++){ ScoreboardEntry& ent = entries[i]; From cae574d972568e83b53c5b21914ac4d0b8042998 Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Wed, 10 Feb 2016 18:35:55 +0200 Subject: [PATCH 2/6] Configure-able player name drawing Currently, hottracked player names are drawn on top of crosshair together with distance to them. Center of screen is important region and thus it should be configure-able. This allows you to disable drawing name on the whole or just disable drawing the distance. Also possible to position the name wherever you want. --- Sources/Client/Client_Draw.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Sources/Client/Client_Draw.cpp b/Sources/Client/Client_Draw.cpp index 70acf8380..9c62d2829 100644 --- a/Sources/Client/Client_Draw.cpp +++ b/Sources/Client/Client_Draw.cpp @@ -62,6 +62,9 @@ SPADES_SETTING(cg_keyReloadWeapon, ""); SPADES_SETTING(cg_screenshotFormat, "jpeg"); SPADES_SETTING(cg_stats, "0"); SPADES_SETTING(cg_hideHud, "0"); +SPADES_SETTING(cg_playerNames, "2"); +SPADES_SETTING(cg_playerNameX, "0"); +SPADES_SETTING(cg_playerNameY, "0"); namespace spades { namespace client { @@ -300,6 +303,9 @@ namespace spades { void Client::DrawHottrackedPlayerName() { SPADES_MARK_FUNCTION(); + if ((int)cg_playerNames == 0) + return; + Player *p = GetWorld()->GetLocalPlayer(); hitTag_t tag = hit_None; @@ -307,10 +313,17 @@ namespace spades { if(hottracked){ Vector3 posxyz = Project(hottracked->GetEye()); Vector2 pos = {posxyz.x, posxyz.y}; - float dist = (hottracked->GetEye() - p->GetEye()).GetLength(); - int idist = (int)floorf(dist + .5f); char buf[64]; - sprintf(buf, "%s [%d%s]", hottracked->GetName().c_str(), idist, (idist == 1) ? "block":"blocks"); + if ((int)cg_playerNames == 1){ + float dist = (hottracked->GetEye() - p->GetEye()).GetLength(); + int idist = (int)floorf(dist + .5f); + sprintf(buf, "%s [%d%s]", hottracked->GetName().c_str(), idist, (idist == 1) ? "block" : "blocks"); + } + else + sprintf(buf, "%s", hottracked->GetName().c_str()); + + pos.y += (int)cg_playerNameY; + pos.x += (int)cg_playerNameX; IFont *font = textFont; Vector2 size = font->Measure(buf); From 1f90d95d09ccbbe53879ccc3eaf3a3303dd8da0e Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Wed, 10 Feb 2016 18:43:55 +0200 Subject: [PATCH 3/6] Revert "Ignore changes in here" This reverts commit 67453fc32dccf7708f7393ed84774cdd2c17d734. --- Sources/Client/ScoreboardView.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sources/Client/ScoreboardView.cpp b/Sources/Client/ScoreboardView.cpp index 6a9544b68..122a69662 100644 --- a/Sources/Client/ScoreboardView.cpp +++ b/Sources/Client/ScoreboardView.cpp @@ -221,7 +221,7 @@ namespace spades { return score > ent.score; } }; - + void ScoreboardView::DrawPlayers(int team, float left, float top, float width, float height){ IFont *font = client->textFont; @@ -257,8 +257,7 @@ namespace spades { int row = 0, col = 0; float colWidth = (float)width / (float)cols; - //Chameleon: ignore this - I just couldn't compile with "extern" in front. Palette doesn't work for player list - int palette[32][3]; + extern int palette[32][3]; std::string colormode = cg_Minimap_Player_Color; for(int i = 0; i < numPlayers; i++){ ScoreboardEntry& ent = entries[i]; From e0d2f0b762c0d33019e2fb13173c5afd6966e9db Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Wed, 10 Feb 2016 19:34:09 +0200 Subject: [PATCH 4/6] Configure-able center message Center message takes up too much space on smaller screens (e.g. mine is 800x600), especially on killstreaks or intense CTF servers. So, you can either disable all center messages ("0"), enable all default ones ("1") or disable your kill center messages("2"). To make killfeed easier to read it is advised to make local kill icons be black (stands out the most). --- Sources/Client/Client_NetHandler.cpp | 31 +++++++++++++++++----------- Sources/Client/Client_Update.cpp | 3 ++- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Sources/Client/Client_NetHandler.cpp b/Sources/Client/Client_NetHandler.cpp index f513925c8..3d5089053 100644 --- a/Sources/Client/Client_NetHandler.cpp +++ b/Sources/Client/Client_NetHandler.cpp @@ -22,6 +22,8 @@ #include "Client.h" #include #include +#include +#include #include "IAudioDevice.h" #include "IAudioChunk.h" @@ -38,6 +40,8 @@ #include "NetClient.h" +SPADES_SETTING(cg_centerMessage, "1"); + namespace spades { namespace client { @@ -87,16 +91,19 @@ namespace spades { } chatWindow->AddMessage(msg); - teamName = world->GetTeam(teamId).name; - if(old < 2){ - std::string otherTeam = world->GetTeam(old).name; - msg = _Tr("Client", "{0} captured {1}'s Territory", teamName, otherTeam); - }else{ - msg = _Tr("Client", "{0} captured an Neutral Territory", teamName); + if ((int)cg_centerMessage != 0){ + teamName = world->GetTeam(teamId).name; + if (old < 2){ + std::string otherTeam = world->GetTeam(old).name; + msg = _Tr("Client", "{0} captured {1}'s Territory", teamName, otherTeam); + } + else{ + msg = _Tr("Client", "{0} captured an Neutral Territory", teamName); + } + NetLog("%s", msg.c_str()); + centerMessageView->AddMessage(msg); } - NetLog("%s", msg.c_str()); - centerMessageView->AddMessage(msg); - + if(world->GetLocalPlayer() && !IsMuted()){ if(teamId == world->GetLocalPlayer()->GetTeamId()){ Handle chunk = audioDevice->RegisterSound("Sounds/Feedback/TC/YourTeamCaptured.wav"); @@ -120,7 +127,7 @@ namespace spades { chatWindow->AddMessage(msg); } - { + if ((int)cg_centerMessage != 0){ std::string holderName = p->GetName(); std::string otherTeamName = world->GetTeam(1 - p->GetTeamId()).name; msg = _Tr("Client", "{0} captured {1}'s Intel.", holderName, otherTeamName); @@ -149,7 +156,7 @@ namespace spades { chatWindow->AddMessage(msg); } - { + if ((int)cg_centerMessage != 0){ std::string holderName = p->GetName(); std::string otherTeamName = world->GetTeam(1 - p->GetTeamId()).name; msg = _Tr("Client", "{0} picked up {1}'s Intel.", holderName, otherTeamName); @@ -173,7 +180,7 @@ namespace spades { chatWindow->AddMessage(msg); } - { + if ((int)cg_centerMessage != 0){ std::string holderName = p->GetName(); std::string otherTeamName = world->GetTeam(1 - p->GetTeamId()).name; msg = _Tr("Client", "{0} dropped {1}'s Intel", holderName, otherTeamName); diff --git a/Sources/Client/Client_Update.cpp b/Sources/Client/Client_Update.cpp index 5fb4e75da..add5250d2 100644 --- a/Sources/Client/Client_Update.cpp +++ b/Sources/Client/Client_Update.cpp @@ -54,6 +54,7 @@ SPADES_SETTING(cg_blood, "1"); SPADES_SETTING(cg_ejectBrass, "1"); SPADES_SETTING(cg_alerts, ""); +SPADES_SETTING(cg_centerMessage, ""); namespace spades { @@ -906,7 +907,7 @@ namespace spades { if(killer == local || victim == local){ std::string msg; if( killer == local ) { - msg = _Tr("Client", "You have killed {0}", victim->GetName()); + if ((int)cg_centerMessage == 2) msg = _Tr("Client", "You have killed {0}", victim->GetName()); } else { msg = _Tr("Client", "You were killed by {0}", killer->GetName()); } From 83b061fedf2d384a91919ab75a8232235a7fd938 Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Wed, 10 Feb 2016 20:02:43 +0200 Subject: [PATCH 5/6] Makes local kills on killfeed black Turns icons of local kills (both for kill and death) black. Black colour stands out the most. Useful after having disabled center messages. --- Sources/Client/ChatWindow.cpp | 2 ++ Sources/Client/ChatWindow.h | 1 + Sources/Client/Client_Update.cpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/Sources/Client/ChatWindow.cpp b/Sources/Client/ChatWindow.cpp index 854e64397..701f25cbd 100644 --- a/Sources/Client/ChatWindow.cpp +++ b/Sources/Client/ChatWindow.cpp @@ -197,6 +197,8 @@ namespace spades { return w ? ConvertColor(w->GetTeam(2).color) : MakeVector4( 1, 1, 0, 1 ); case MsgColorRed: return MakeVector4(1,0,0,1); + case MsgColorBlack: + return MakeVector4(0,0,0,1); case MsgColorSysInfo: return MakeVector4(0,1,0,1); default: diff --git a/Sources/Client/ChatWindow.h b/Sources/Client/ChatWindow.h index 57c8417ab..03b998f45 100644 --- a/Sources/Client/ChatWindow.h +++ b/Sources/Client/ChatWindow.h @@ -40,6 +40,7 @@ namespace spades { static const char MsgColorSysInfo = MsgColorGreen; static const char MsgColorRestore = 6; static const char MsgImage = 7; + static const char MsgColorBlack = 8; static const char MsgColorMax = 9; class ChatWindow { diff --git a/Sources/Client/Client_Update.cpp b/Sources/Client/Client_Update.cpp index add5250d2..ab56a8642 100644 --- a/Sources/Client/Client_Update.cpp +++ b/Sources/Client/Client_Update.cpp @@ -877,6 +877,8 @@ namespace spades { if(ff) s += ChatWindow::ColoredMessage(cause, MsgColorRed); + else if (killer == world->GetLocalPlayer() || victim == world->GetLocalPlayer()) + s += ChatWindow::ColoredMessage(cause, MsgColorBlack); else s += cause; From 39a7c74fa69ac6bd9799b0947af65b93097e1ae3 Mon Sep 17 00:00:00 2001 From: Chameleonhider Date: Thu, 11 Feb 2016 10:43:55 +0200 Subject: [PATCH 6/6] Pressing sprint doesn't stop anymore from using tool / weapon Pressing sprint key used to prevent using tool/weapon. Now sprint key must be pressed together with movement keys (while not crouching) to prevent you from using tool/weapon. --- Sources/Client/Client_Input.cpp | 13 ++----------- Sources/Client/Player.cpp | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Sources/Client/Client_Input.cpp b/Sources/Client/Client_Input.cpp index 81f6fd710..d30861be0 100644 --- a/Sources/Client/Client_Input.cpp +++ b/Sources/Client/Client_Input.cpp @@ -377,11 +377,6 @@ namespace spades { playerInput.crouch = down; }else if(CheckKey(cg_keySprint, name)){ playerInput.sprint = down; - if(down){ - if(world->GetLocalPlayer()->IsToolWeapon()){ - weapInput.secondary = false; - } - } }else if(CheckKey(cg_keySneak, name)){ playerInput.sneak = down; }else if(CheckKey(cg_keyJump, name)){ @@ -394,15 +389,11 @@ namespace spades { }else if(CheckKey(cg_keyAltAttack, name)){ auto lastVal = weapInput.secondary; if(world->GetLocalPlayer()->IsToolWeapon() && (!cg_holdAimDownSight)){ - if(down && !playerInput.sprint && !world->GetLocalPlayer()->GetWeapon()->IsReloading()){ + if(down && !world->GetLocalPlayer()->GetWeapon()->IsReloading()){ weapInput.secondary = !weapInput.secondary; } }else{ - if(!playerInput.sprint){ - weapInput.secondary = down; - }else{ - weapInput.secondary = down; - } + weapInput.secondary = down; } if(world->GetLocalPlayer()->IsToolWeapon() && weapInput.secondary && !lastVal && world->GetLocalPlayer()->IsReadyToUseTool() && diff --git a/Sources/Client/Player.cpp b/Sources/Client/Player.cpp index 509368e8e..42d533931 100644 --- a/Sources/Client/Player.cpp +++ b/Sources/Client/Player.cpp @@ -119,7 +119,7 @@ namespace spades { if(!IsAlive()) return; - if(input.sprint){ + if(input.sprint && !input.crouch && (input.moveBackward || input.moveForward || input.moveLeft || input.moveRight)){ newInput.primary = false; newInput.secondary = false; }