Improve the minimap system ,user configurable
This commit is contained in:
parent
f75d9083ec
commit
64dc4a1036
1
AUTHORS
1
AUTHORS
@ -10,3 +10,4 @@ CREDITS
|
|||||||
"JoJoe_Stinky" - Win32 Icon
|
"JoJoe_Stinky" - Win32 Icon
|
||||||
"theunknownxy" - Fixes for the Linux support
|
"theunknownxy" - Fixes for the Linux support
|
||||||
"noway421" - Russian locale, various testing, ideas.
|
"noway421" - Russian locale, various testing, ideas.
|
||||||
|
"pandaro" - Improvements to the Minimap
|
@ -3,7 +3,7 @@
|
|||||||
All paks for development vesion
|
All paks for development vesion
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
http://yvt.jp/files/programs/osppaks/DevPaks27.zip
|
https://www.dropbox.com/s/aprb9aufqk2abe1/DevPaks28.zip?dl=1
|
||||||
|
|
||||||
These paks are not included in the source tree because they contains some
|
These paks are not included in the source tree because they contains some
|
||||||
non-opensource materials and they seem too large to include in the git tree.
|
non-opensource materials and they seem too large to include in the git tree.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Weapon.h"
|
||||||
#include "MapView.h"
|
#include "MapView.h"
|
||||||
#include "IRenderer.h"
|
#include "IRenderer.h"
|
||||||
#include "IImage.h"
|
#include "IImage.h"
|
||||||
@ -30,6 +31,8 @@
|
|||||||
#include "../Core/Settings.h"
|
#include "../Core/Settings.h"
|
||||||
|
|
||||||
SPADES_SETTING(cg_minimapSize, "128");
|
SPADES_SETTING(cg_minimapSize, "128");
|
||||||
|
SPADES_SETTING(cg_Minimap_Player_Color,"1");
|
||||||
|
SPADES_SETTING(cg_Minimap_Player_Icon,"1");
|
||||||
|
|
||||||
namespace spades {
|
namespace spades {
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -384,6 +387,55 @@ namespace spades {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//draw objects
|
//draw objects
|
||||||
|
|
||||||
|
//definite a palette of 32 color in RGB code
|
||||||
|
int palette[32][3]={
|
||||||
|
{0,0,0},//0 black
|
||||||
|
{255,255,255},//1 white
|
||||||
|
{128,128,128},//2 grey
|
||||||
|
{255,255,0},//3 yellow
|
||||||
|
{0,255,255},//4 cyan-acqua
|
||||||
|
{255,0,255},//5 fuchsia
|
||||||
|
{255,0,0},//6 red
|
||||||
|
{0,255,0},//7 lime
|
||||||
|
{0,0,255},//8 blue
|
||||||
|
|
||||||
|
{128,0,0},//9 maroon
|
||||||
|
{0,128,0},//10 green
|
||||||
|
{0,0,128},//11 navy
|
||||||
|
{128,128,0},//12 olive
|
||||||
|
{128,0,128},//13 purple
|
||||||
|
{0,128,128},//14 teal
|
||||||
|
|
||||||
|
{255,128,0},//15 orange
|
||||||
|
{255,0,128},//16 deep pink
|
||||||
|
{128,0,255},//17 violet
|
||||||
|
{0,128,255},//18 bluette
|
||||||
|
{128,255,0},//19 lime 2
|
||||||
|
{0,255,128},//20 spring green
|
||||||
|
|
||||||
|
{255,128,128},//21 light pink
|
||||||
|
{128,255,128},//22 light spring
|
||||||
|
{128,128,255},//23 light blue
|
||||||
|
{128,255,255},//24 light azure
|
||||||
|
{255,255,128},//25 light yellow
|
||||||
|
{255,128,255},//26 light pink2
|
||||||
|
|
||||||
|
{165,42,42},//27 brown
|
||||||
|
{255,69,0},//28 orange red
|
||||||
|
{255,165,0},//29 orange
|
||||||
|
{139,69,19},//30 maroon medium
|
||||||
|
{210,105,30},//31 choccolate
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string iconmode = cg_Minimap_Player_Icon;//import variable from configuration file
|
||||||
|
std::string colormode = cg_Minimap_Player_Color;//import variable from configuration file
|
||||||
|
|
||||||
|
Handle<IImage> playerSMG = renderer->RegisterImage("Gfx/Map/SMG.png");
|
||||||
|
Handle<IImage> playerRifle = renderer->RegisterImage("Gfx/Map/Rifle.png");
|
||||||
|
Handle<IImage> playerShotgun = renderer->RegisterImage("Gfx/Map/Shotgun.png");
|
||||||
Handle<IImage> playerIcon = renderer->RegisterImage("Gfx/Map/Player.png");
|
Handle<IImage> playerIcon = renderer->RegisterImage("Gfx/Map/Player.png");
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -428,12 +480,43 @@ namespace spades {
|
|||||||
ang = client->followYaw - static_cast<float>(M_PI) * .5f;
|
ang = client->followYaw - static_cast<float>(M_PI) * .5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//use a spec color for each player
|
||||||
|
if ( colormode=="1"){
|
||||||
|
IntVector3 Colorplayer=IntVector3::Make(palette[i][0],palette[i][1],palette[i][2]);
|
||||||
|
Vector4 ColorplayerF = ModifyColor(Colorplayer);
|
||||||
|
ColorplayerF *=1.0f;
|
||||||
|
renderer->SetColorAlphaPremultiplied(ColorplayerF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
renderer->SetColorAlphaPremultiplied(teamColorF);
|
||||||
|
}
|
||||||
|
|
||||||
renderer->SetColorAlphaPremultiplied(teamColorF);
|
//use a different icon in minimap according to weapon of player
|
||||||
|
if( iconmode=="1"){
|
||||||
DrawIcon(player->GetTeamId() >= 2 ?
|
std::string weapon=world->GetPlayer(i)->GetWeapon()->GetName();
|
||||||
client->followPos :
|
if (weapon=="SMG"){
|
||||||
p->GetPosition(), playerIcon, ang);
|
DrawIcon(player->GetTeamId() >= 2 ?
|
||||||
|
client->followPos :
|
||||||
|
p->GetPosition(),playerSMG , ang);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (weapon=="Rifle"){
|
||||||
|
DrawIcon(player->GetTeamId() >= 2 ?
|
||||||
|
client->followPos :
|
||||||
|
p->GetPosition(), playerRifle, ang);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (weapon=="Shotgun"){
|
||||||
|
DrawIcon(player->GetTeamId() >= 2 ?
|
||||||
|
client->followPos :
|
||||||
|
p->GetPosition(), playerShotgun, ang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{//draw normal color
|
||||||
|
DrawIcon(player->GetTeamId() >= 2 ?
|
||||||
|
client->followPos :
|
||||||
|
p->GetPosition(), playerIcon, ang);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,3 +580,4 @@ namespace spades {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#include "TCGameMode.h"
|
#include "TCGameMode.h"
|
||||||
#include "NetClient.h"
|
#include "NetClient.h"
|
||||||
#include <Core/Strings.h>
|
#include <Core/Strings.h>
|
||||||
|
#include "../Core/Settings.h"
|
||||||
|
|
||||||
|
SPADES_SETTING(cg_Minimap_Player_Color,"1");
|
||||||
|
|
||||||
namespace spades {
|
namespace spades {
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -241,6 +244,50 @@ namespace spades {
|
|||||||
int row = 0, col = 0;
|
int row = 0, col = 0;
|
||||||
float colWidth = (float)width / (float)cols;
|
float colWidth = (float)width / (float)cols;
|
||||||
|
|
||||||
|
//definite a palette of 32 color in RGB code
|
||||||
|
int palette[32][3]={
|
||||||
|
{0,0,0},//0 black
|
||||||
|
{255,255,255},//1 white
|
||||||
|
{128,128,128},//2 grey
|
||||||
|
{255,255,0},//3 yellow
|
||||||
|
{0,255,255},//4 cyan-acqua
|
||||||
|
{255,0,255},//5 fuchsia
|
||||||
|
{255,0,0},//6 red
|
||||||
|
{0,255,0},//7 lime
|
||||||
|
{0,0,255},//8 blue
|
||||||
|
|
||||||
|
{128,0,0},//9 maroon
|
||||||
|
{0,128,0},//10 green
|
||||||
|
{0,0,128},//11 navy
|
||||||
|
{128,128,0},//12 olive
|
||||||
|
{128,0,128},//13 purple
|
||||||
|
{0,128,128},//14 teal
|
||||||
|
|
||||||
|
{255,128,0},//15 orange
|
||||||
|
{255,0,128},//16 deep pink
|
||||||
|
{128,0,255},//17 violet
|
||||||
|
{0,128,255},//18 bluette
|
||||||
|
{128,255,0},//19 lime 2
|
||||||
|
{0,255,128},//20 spring green
|
||||||
|
|
||||||
|
{255,128,128},//21 light pink
|
||||||
|
{128,255,128},//22 light spring
|
||||||
|
{128,128,255},//23 light blue
|
||||||
|
{128,255,255},//24 light azure
|
||||||
|
{255,255,128},//25 light yellow
|
||||||
|
{255,128,255},//26 light pink2
|
||||||
|
|
||||||
|
{165,42,42},//27 brown
|
||||||
|
{255,69,0},//28 orange red
|
||||||
|
{255,165,0},//29 orange
|
||||||
|
|
||||||
|
{139,69,19},//30 maroon medium
|
||||||
|
{210,105,30},//31 choccolate
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string colormode = cg_Minimap_Player_Color;
|
||||||
|
|
||||||
for(int i = 0; i < numPlayers; i++){
|
for(int i = 0; i < numPlayers; i++){
|
||||||
ScoreboardEntry& ent = entries[i];
|
ScoreboardEntry& ent = entries[i];
|
||||||
|
|
||||||
@ -251,10 +298,16 @@ namespace spades {
|
|||||||
color = GetTeamColor(team);
|
color = GetTeamColor(team);
|
||||||
|
|
||||||
sprintf(buf, "#%d", ent.id); // FIXME: 1-base?
|
sprintf(buf, "#%d", ent.id); // FIXME: 1-base?
|
||||||
size = font->Measure(buf);
|
size = font->Measure(buf);
|
||||||
font->Draw(buf, MakeVector2(colX + 35.f - size.x,
|
if ( colormode=="1"){
|
||||||
rowY),
|
IntVector3 Colorplayer=IntVector3::Make(palette[i][0],palette[i][1],palette[i][2]);
|
||||||
1.f, color);
|
Vector4 ColorplayerF = ModifyColor(Colorplayer);
|
||||||
|
ColorplayerF *=1.0f;
|
||||||
|
font->Draw(buf, MakeVector2(colX + 35.f - size.x,rowY),1.f, changeF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
font->Draw(buf, MakeVector2(colX + 35.f - size.x,rowY),1.f, color);
|
||||||
|
}
|
||||||
|
|
||||||
font->Draw(ent.name, MakeVector2(colX + 45.f,
|
font->Draw(ent.name, MakeVector2(colX + 45.f,
|
||||||
rowY),
|
rowY),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user