mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge branch 'master' of http://github.com/oy/teeworlds
Conflicts: data/languages/german.txt src/game/client/components/scoreboard.cpp src/game/editor/ed_layer_tiles.cpp src/game/server/entities/character.cpp src/game/server/gamecontext.cpp src/game/server/gamecontroller.cpp src/game/variables.h
This commit is contained in:
commit
c5648311ed
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
##### translated strings #####
|
##### translated strings #####
|
||||||
|
|
||||||
%d of %d servers, %d players
|
%d of %d servers, %d players
|
||||||
|
@ -76,6 +75,12 @@ As this is the first time you launch the game, please enter your nick name below
|
||||||
Aspect ratio
|
Aspect ratio
|
||||||
== Beeldverhouding
|
== Beeldverhouding
|
||||||
|
|
||||||
|
Automatically record demos
|
||||||
|
== Automatisch demo's opnemen
|
||||||
|
|
||||||
|
Automatically take game over screenshot
|
||||||
|
== Automatisch schermafbeeldingen nemen
|
||||||
|
|
||||||
Blue team
|
Blue team
|
||||||
== Blauwe team
|
== Blauwe team
|
||||||
|
|
||||||
|
@ -412,6 +417,9 @@ Layers
|
||||||
Left
|
Left
|
||||||
== Links
|
== Links
|
||||||
|
|
||||||
|
left
|
||||||
|
== nog
|
||||||
|
|
||||||
Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
|
Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
|
||||||
== Linkermuisknop om te bewegen. Houd shift ingedrukt om te roteren. Houd ctrl ingedrukt om te draaien.
|
== Linkermuisknop om te bewegen. Houd shift ingedrukt om te roteren. Houd ctrl ingedrukt om te draaien.
|
||||||
|
|
||||||
|
@ -449,9 +457,21 @@ Make external
|
||||||
Map
|
Map
|
||||||
== Kaart
|
== Kaart
|
||||||
|
|
||||||
|
Max demos
|
||||||
|
== Maximaal aantal demo's
|
||||||
|
|
||||||
|
Max Screenshots
|
||||||
|
== Maximaal aantal schermafbeeldingen
|
||||||
|
|
||||||
Maximum ping:
|
Maximum ping:
|
||||||
== Hoogste ping:
|
== Hoogste ping:
|
||||||
|
|
||||||
|
minute
|
||||||
|
== minuut
|
||||||
|
|
||||||
|
minutes
|
||||||
|
== minuten
|
||||||
|
|
||||||
Miscellaneous
|
Miscellaneous
|
||||||
== Diverse
|
== Diverse
|
||||||
|
|
||||||
|
@ -468,7 +488,7 @@ Movement
|
||||||
== Bewegen
|
== Bewegen
|
||||||
|
|
||||||
Mute when not active
|
Mute when not active
|
||||||
== Demp, waneer niet actief
|
== Dempen wanneer inactief
|
||||||
|
|
||||||
Name
|
Name
|
||||||
== Naam
|
== Naam
|
||||||
|
@ -497,6 +517,9 @@ Nickname
|
||||||
No
|
No
|
||||||
== Nee
|
== Nee
|
||||||
|
|
||||||
|
no limit
|
||||||
|
== ongelimiteerd
|
||||||
|
|
||||||
No password
|
No password
|
||||||
== Geen wachtwoord
|
== Geen wachtwoord
|
||||||
|
|
||||||
|
@ -597,7 +620,7 @@ Quick search:
|
||||||
== Snel zoeken:
|
== Snel zoeken:
|
||||||
|
|
||||||
Quit
|
Quit
|
||||||
== Stoppen
|
== Afsluiten
|
||||||
|
|
||||||
REC
|
REC
|
||||||
== REC
|
== REC
|
||||||
|
@ -708,7 +731,13 @@ Scoreboard
|
||||||
== Scorebord
|
== Scorebord
|
||||||
|
|
||||||
Screenshot
|
Screenshot
|
||||||
== Screenshot
|
== Schermafbeelding
|
||||||
|
|
||||||
|
second
|
||||||
|
== seconde
|
||||||
|
|
||||||
|
seconds
|
||||||
|
== seconden
|
||||||
|
|
||||||
Select group. Right click for properties.
|
Select group. Right click for properties.
|
||||||
== Kies een groep. Rechtermuisknop voor eigenschappen.
|
== Kies een groep. Rechtermuisknop voor eigenschappen.
|
||||||
|
@ -934,36 +963,6 @@ ZO
|
||||||
|
|
||||||
##### needs translation #####
|
##### needs translation #####
|
||||||
|
|
||||||
Automatically record demos
|
|
||||||
==
|
|
||||||
|
|
||||||
Automatically take game over screenshot
|
|
||||||
==
|
|
||||||
|
|
||||||
Max Screenshots
|
|
||||||
==
|
|
||||||
|
|
||||||
Max demos
|
|
||||||
==
|
|
||||||
|
|
||||||
left
|
|
||||||
==
|
|
||||||
|
|
||||||
minute
|
|
||||||
==
|
|
||||||
|
|
||||||
minutes
|
|
||||||
==
|
|
||||||
|
|
||||||
no limit
|
|
||||||
==
|
|
||||||
|
|
||||||
second
|
|
||||||
==
|
|
||||||
|
|
||||||
seconds
|
|
||||||
==
|
|
||||||
|
|
||||||
##### old translations #####
|
##### old translations #####
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,12 @@ As this is the first time you launch the game, please enter your nick name below
|
||||||
Aspect ratio
|
Aspect ratio
|
||||||
== Seitenverhältnis
|
== Seitenverhältnis
|
||||||
|
|
||||||
|
Automatically record demos
|
||||||
|
== Automatisch Demos aufnehmen
|
||||||
|
|
||||||
|
Automatically take game over screenshot
|
||||||
|
== Automatisch am Ende einer Runde ein Bildschirmfoto erstellen
|
||||||
|
|
||||||
Blue team
|
Blue team
|
||||||
== Blaues Team
|
== Blaues Team
|
||||||
|
|
||||||
|
@ -448,6 +454,12 @@ Make external
|
||||||
Map
|
Map
|
||||||
== Karte
|
== Karte
|
||||||
|
|
||||||
|
Max Screenshots
|
||||||
|
== Maximale Bildschirmfotos
|
||||||
|
|
||||||
|
Max demos
|
||||||
|
== Maximale Demos
|
||||||
|
|
||||||
Maximum ping:
|
Maximum ping:
|
||||||
== Maximaler Ping:
|
== Maximaler Ping:
|
||||||
|
|
||||||
|
@ -931,40 +943,28 @@ ZO
|
||||||
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
|
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
|
||||||
== [Strg+P] Schaltet Testrahmen um. Diese Rahmen zeigen, wie viel der Spieler höchstens sehen kann.
|
== [Strg+P] Schaltet Testrahmen um. Diese Rahmen zeigen, wie viel der Spieler höchstens sehen kann.
|
||||||
|
|
||||||
Loading DDRace Client
|
left
|
||||||
== Lade DDRace Client
|
== noch
|
||||||
|
|
||||||
|
minute
|
||||||
|
== Minute
|
||||||
|
|
||||||
|
minutes
|
||||||
|
== Minuten
|
||||||
|
|
||||||
|
no limit
|
||||||
|
== Keine Begrenzung
|
||||||
|
|
||||||
|
second
|
||||||
|
== Sekunde
|
||||||
|
|
||||||
|
seconds
|
||||||
|
== Sekunden
|
||||||
|
|
||||||
##### needs translation #####
|
##### needs translation #####
|
||||||
|
|
||||||
Automatically record demos
|
|
||||||
==
|
|
||||||
|
|
||||||
Automatically take game over screenshot
|
|
||||||
==
|
|
||||||
|
|
||||||
Max Screenshots
|
|
||||||
==
|
|
||||||
|
|
||||||
Max demos
|
|
||||||
==
|
|
||||||
|
|
||||||
left
|
|
||||||
==
|
|
||||||
|
|
||||||
minute
|
|
||||||
==
|
|
||||||
|
|
||||||
minutes
|
|
||||||
==
|
|
||||||
|
|
||||||
no limit
|
|
||||||
==
|
|
||||||
|
|
||||||
second
|
|
||||||
==
|
|
||||||
|
|
||||||
seconds
|
|
||||||
==
|
|
||||||
|
|
||||||
##### old translations #####
|
##### old translations #####
|
||||||
|
|
||||||
|
Loading DDRace Client
|
||||||
|
== Lade DDRace Client
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,14 @@ RawHeader = '''
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
INPUT_STATE_MASK=0x3f,
|
INPUT_STATE_MASK=0x3f
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TEAM_SPECTATORS=-1,
|
||||||
|
TEAM_RED,
|
||||||
|
TEAM_BLUE
|
||||||
};
|
};
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -83,7 +90,7 @@ Objects = [
|
||||||
NetIntAny("m_X"),
|
NetIntAny("m_X"),
|
||||||
NetIntAny("m_Y"),
|
NetIntAny("m_Y"),
|
||||||
|
|
||||||
NetIntRange("m_Team", 0, 1),
|
NetIntRange("m_Team", 'TEAM_RED', 'TEAM_BLUE'),
|
||||||
NetIntRange("m_CarriedBy", -2, 'MAX_CLIENTS-1')
|
NetIntRange("m_CarriedBy", -2, 'MAX_CLIENTS-1')
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
@ -141,7 +148,7 @@ Objects = [
|
||||||
NetObject("PlayerInfo", [
|
NetObject("PlayerInfo", [
|
||||||
NetIntRange("m_Local", 0, 1),
|
NetIntRange("m_Local", 0, 1),
|
||||||
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
|
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
|
||||||
NetIntRange("m_Team", -1, 1),
|
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
|
||||||
|
|
||||||
NetIntAny("m_Score"),
|
NetIntAny("m_Score"),
|
||||||
NetIntAny("m_Latency"),
|
NetIntAny("m_Latency"),
|
||||||
|
@ -204,7 +211,7 @@ Messages = [
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetMessage("Sv_Chat", [
|
NetMessage("Sv_Chat", [
|
||||||
NetIntRange("m_Team", -1, 1),
|
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
|
||||||
NetIntRange("m_Cid", -1, 'MAX_CLIENTS-1'),
|
NetIntRange("m_Cid", -1, 'MAX_CLIENTS-1'),
|
||||||
NetString("m_pMessage"),
|
NetString("m_pMessage"),
|
||||||
]),
|
]),
|
||||||
|
@ -260,7 +267,7 @@ Messages = [
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetMessage("Cl_SetTeam", [
|
NetMessage("Cl_SetTeam", [
|
||||||
NetIntRange("m_Team", -1, 1),
|
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetMessage("Cl_StartInfo", [
|
NetMessage("Cl_StartInfo", [
|
||||||
|
|
|
@ -32,6 +32,6 @@ for filename in sys.argv[1:]:
|
||||||
hash = hashlib.md5(f).hexdigest().lower()[16:]
|
hash = hashlib.md5(f).hexdigest().lower()[16:]
|
||||||
# TODO: refactor hash that is equal to the 0.5 hash, remove when we
|
# TODO: refactor hash that is equal to the 0.5 hash, remove when we
|
||||||
# TODO: remove when we don't need it any more
|
# TODO: remove when we don't need it any more
|
||||||
if hash == "7e33344691ca8a61":
|
if hash == "026b8eceb4cdd369":
|
||||||
hash = "b67d1f1a1eea234e"
|
hash = "b67d1f1a1eea234e"
|
||||||
print '#define GAME_NETVERSION_HASH "%s"' % hash
|
print '#define GAME_NETVERSION_HASH "%s"' % hash
|
||||||
|
|
|
@ -1813,8 +1813,6 @@ void CClient::Run()
|
||||||
if(!LoadData())
|
if(!LoadData())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DemoRecorder_Init();
|
|
||||||
|
|
||||||
GameClient()->OnInit();
|
GameClient()->OnInit();
|
||||||
char aBuf[256];
|
char aBuf[256];
|
||||||
str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion());
|
str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion());
|
||||||
|
@ -2138,12 +2136,6 @@ void CClient::Con_Play(IConsole::IResult *pResult, void *pUserData, int ClientID
|
||||||
pSelf->DemoPlayer_Play(pResult->GetString(0), IStorage::TYPE_ALL);
|
pSelf->DemoPlayer_Play(pResult->GetString(0), IStorage::TYPE_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::DemoRecorder_Init()
|
|
||||||
{
|
|
||||||
if(!Storage()->CreateFolder("demos/auto", IStorage::TYPE_SAVE))
|
|
||||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "unable to create auto record folder");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
|
void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
|
||||||
{
|
{
|
||||||
if(State() != IClient::STATE_ONLINE)
|
if(State() != IClient::STATE_ONLINE)
|
||||||
|
|
|
@ -315,7 +315,6 @@ public:
|
||||||
void RegisterCommands();
|
void RegisterCommands();
|
||||||
|
|
||||||
const char *DemoPlayer_Play(const char *pFilename, int StorageType);
|
const char *DemoPlayer_Play(const char *pFilename, int StorageType);
|
||||||
void DemoRecorder_Init();
|
|
||||||
void DemoRecorder_Start(const char *pFilename, bool WithTimestamp);
|
void DemoRecorder_Start(const char *pFilename, bool WithTimestamp);
|
||||||
void DemoRecorder_HandleAutoStart();
|
void DemoRecorder_HandleAutoStart();
|
||||||
void DemoRecorder_Stop();
|
void DemoRecorder_Stop();
|
||||||
|
|
|
@ -30,7 +30,7 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36};
|
static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36,64};
|
||||||
#define NUM_FONT_SIZES (sizeof(aFontSizes)/sizeof(int))
|
#define NUM_FONT_SIZES (sizeof(aFontSizes)/sizeof(int))
|
||||||
|
|
||||||
struct CFontChar
|
struct CFontChar
|
||||||
|
@ -178,6 +178,15 @@ class CTextRender : public IEngineTextRender
|
||||||
mem_free(pMem);
|
mem_free(pMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AdjustOutlineThicknessToFontSize(int OutlineThickness, int FontSize)
|
||||||
|
{
|
||||||
|
if(FontSize > 36)
|
||||||
|
OutlineThickness *= 4;
|
||||||
|
else if(FontSize >= 18)
|
||||||
|
OutlineThickness *= 2;
|
||||||
|
return OutlineThickness;
|
||||||
|
}
|
||||||
|
|
||||||
void IncreaseTextureSize(CFontSizeData *pSizeData)
|
void IncreaseTextureSize(CFontSizeData *pSizeData)
|
||||||
{
|
{
|
||||||
if(pSizeData->m_TextureWidth < pSizeData->m_TextureHeight)
|
if(pSizeData->m_TextureWidth < pSizeData->m_TextureHeight)
|
||||||
|
@ -191,14 +200,12 @@ class CTextRender : public IEngineTextRender
|
||||||
// TODO: Refactor: move this into a pFont class
|
// TODO: Refactor: move this into a pFont class
|
||||||
void InitIndex(CFont *pFont, int Index)
|
void InitIndex(CFont *pFont, int Index)
|
||||||
{
|
{
|
||||||
int OutlineThickness = 1;
|
|
||||||
CFontSizeData *pSizeData = &pFont->m_aSizes[Index];
|
CFontSizeData *pSizeData = &pFont->m_aSizes[Index];
|
||||||
|
|
||||||
pSizeData->m_FontSize = aFontSizes[Index];
|
pSizeData->m_FontSize = aFontSizes[Index];
|
||||||
FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, pSizeData->m_FontSize);
|
FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, pSizeData->m_FontSize);
|
||||||
|
|
||||||
if(pSizeData->m_FontSize >= 18)
|
int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize);
|
||||||
OutlineThickness = 2;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned GlyphIndex;
|
unsigned GlyphIndex;
|
||||||
|
@ -290,7 +297,6 @@ class CTextRender : public IEngineTextRender
|
||||||
int SlotW = pSizeData->m_TextureWidth / pSizeData->m_NumXChars;
|
int SlotW = pSizeData->m_TextureWidth / pSizeData->m_NumXChars;
|
||||||
int SlotH = pSizeData->m_TextureHeight / pSizeData->m_NumYChars;
|
int SlotH = pSizeData->m_TextureHeight / pSizeData->m_NumYChars;
|
||||||
int SlotSize = SlotW*SlotH;
|
int SlotSize = SlotW*SlotH;
|
||||||
int OutlineThickness = 1;
|
|
||||||
int x = 1;
|
int x = 1;
|
||||||
int y = 1;
|
int y = 1;
|
||||||
int px, py;
|
int px, py;
|
||||||
|
@ -311,8 +317,7 @@ class CTextRender : public IEngineTextRender
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// adjust spacing
|
// adjust spacing
|
||||||
if(pSizeData->m_FontSize >= 18)
|
int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize);
|
||||||
OutlineThickness = 2;
|
|
||||||
x += OutlineThickness;
|
x += OutlineThickness;
|
||||||
y += OutlineThickness;
|
y += OutlineThickness;
|
||||||
|
|
||||||
|
|
|
@ -231,15 +231,15 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(m_pClient->m_aClients[ClientId].m_Team == -1)
|
if(m_pClient->m_aClients[ClientId].m_Team == TEAM_SPECTATORS)
|
||||||
m_aLines[m_CurrentLine].m_NameColor = -1;
|
m_aLines[m_CurrentLine].m_NameColor = TEAM_SPECTATORS;
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
|
if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
|
||||||
{
|
{
|
||||||
if(m_pClient->m_aClients[ClientId].m_Team == 0)
|
if(m_pClient->m_aClients[ClientId].m_Team == TEAM_RED)
|
||||||
m_aLines[m_CurrentLine].m_NameColor = 0;
|
m_aLines[m_CurrentLine].m_NameColor = TEAM_RED;
|
||||||
else if(m_pClient->m_aClients[ClientId].m_Team == 1)
|
else if(m_pClient->m_aClients[ClientId].m_Team == TEAM_BLUE)
|
||||||
m_aLines[m_CurrentLine].m_NameColor = 1;
|
m_aLines[m_CurrentLine].m_NameColor = TEAM_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientId].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName));
|
str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientId].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName));
|
||||||
|
@ -353,11 +353,11 @@ void CChat::OnRender()
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
|
TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
|
||||||
else if(m_aLines[r].m_Team)
|
else if(m_aLines[r].m_Team)
|
||||||
TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message
|
TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message
|
||||||
else if(m_aLines[r].m_NameColor == 0)
|
else if(m_aLines[r].m_NameColor == TEAM_RED)
|
||||||
TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // red
|
TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // red
|
||||||
else if(m_aLines[r].m_NameColor == 1)
|
else if(m_aLines[r].m_NameColor == TEAM_BLUE)
|
||||||
TextRender()->TextColor(0.7f, 0.7f, 1.0f, Blend); // blue
|
TextRender()->TextColor(0.7f, 0.7f, 1.0f, Blend); // blue
|
||||||
else if(m_aLines[r].m_NameColor == -1)
|
else if(m_aLines[r].m_NameColor == TEAM_SPECTATORS)
|
||||||
TextRender()->TextColor(0.75f, 0.5f, 0.75f, Blend); // spectator
|
TextRender()->TextColor(0.75f, 0.5f, 0.75f, Blend); // spectator
|
||||||
else
|
else
|
||||||
TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
|
TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
|
||||||
|
|
|
@ -87,10 +87,10 @@ void CHud::RenderScoreHud()
|
||||||
if(!(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver) && (GameFlags&GAMEFLAG_TEAMS))
|
if(!(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver) && (GameFlags&GAMEFLAG_TEAMS))
|
||||||
{
|
{
|
||||||
char aScoreTeam[2][32];
|
char aScoreTeam[2][32];
|
||||||
str_format(aScoreTeam[0], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed);
|
str_format(aScoreTeam[TEAM_RED], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed);
|
||||||
str_format(aScoreTeam[1], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue);
|
str_format(aScoreTeam[TEAM_BLUE], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue);
|
||||||
float aScoreTeamWidth[2] = {TextRender()->TextWidth(0, 14.0f, aScoreTeam[0], -1), TextRender()->TextWidth(0, 14.0f, aScoreTeam[1], -1)};
|
float aScoreTeamWidth[2] = {TextRender()->TextWidth(0, 14.0f, aScoreTeam[TEAM_RED], -1), TextRender()->TextWidth(0, 14.0f, aScoreTeam[TEAM_BLUE], -1)};
|
||||||
float ScoreWidthMax = max(max(aScoreTeamWidth[0], aScoreTeamWidth[1]), TextRender()->TextWidth(0, 14.0f, "100", -1));
|
float ScoreWidthMax = max(max(aScoreTeamWidth[TEAM_RED], aScoreTeamWidth[TEAM_BLUE]), TextRender()->TextWidth(0, 14.0f, "100", -1));
|
||||||
float Split = 3.0f;
|
float Split = 3.0f;
|
||||||
float ImageSize = GameFlags&GAMEFLAG_FLAGS ? 16.0f : Split;
|
float ImageSize = GameFlags&GAMEFLAG_FLAGS ? 16.0f : Split;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ void CHud::RenderTeambalanceWarning()
|
||||||
bool Flash = time_get()/(time_freq()/2)%2 == 0;
|
bool Flash = time_get()/(time_freq()/2)%2 == 0;
|
||||||
if (m_pClient->m_Snap.m_pGameobj && (m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS) != 0)
|
if (m_pClient->m_Snap.m_pGameobj && (m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS) != 0)
|
||||||
{
|
{
|
||||||
int TeamDiff = m_pClient->m_Snap.m_aTeamSize[0]-m_pClient->m_Snap.m_aTeamSize[1];
|
int TeamDiff = m_pClient->m_Snap.m_aTeamSize[TEAM_RED]-m_pClient->m_Snap.m_aTeamSize[TEAM_BLUE];
|
||||||
if (g_Config.m_ClWarningTeambalance && (TeamDiff >= 2 || TeamDiff <= -2))
|
if (g_Config.m_ClWarningTeambalance && (TeamDiff >= 2 || TeamDiff <= -2))
|
||||||
{
|
{
|
||||||
const char *pText = Localize("Please balance teams!");
|
const char *pText = Localize("Please balance teams!");
|
||||||
|
@ -411,7 +411,7 @@ void CHud::OnRender()
|
||||||
m_Width = 300*Graphics()->ScreenAspect();
|
m_Width = 300*Graphics()->ScreenAspect();
|
||||||
|
|
||||||
bool Spectate = false;
|
bool Spectate = false;
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == -1)
|
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == TEAM_SPECTATORS)
|
||||||
Spectate = true;
|
Spectate = true;
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver)) {
|
if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver)) {
|
||||||
|
|
|
@ -161,7 +161,7 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent)
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
|
|
||||||
if(pCurrent->m_Team == 0) // red team
|
if(pCurrent->m_Team == TEAM_RED)
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
||||||
else
|
else
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
||||||
|
|
|
@ -51,10 +51,9 @@ void CKillMessages::OnRender()
|
||||||
float StartX = Width*1.5f-10.0f;
|
float StartX = Width*1.5f-10.0f;
|
||||||
float y = 20.0f;
|
float y = 20.0f;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_KILLMSGS; i++)
|
for(int i = 1; i <= MAX_KILLMSGS; i++)
|
||||||
{
|
{
|
||||||
|
int r = (m_KillmsgCurrent+i)%MAX_KILLMSGS;
|
||||||
int r = (m_KillmsgCurrent+i+1)%MAX_KILLMSGS;
|
|
||||||
if(Client()->GameTick() > m_aKillmsgs[r].m_Tick+50*10)
|
if(Client()->GameTick() > m_aKillmsgs[r].m_Tick+50*10)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ void CKillMessages::OnRender()
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
|
|
||||||
if(m_aKillmsgs[r].m_VictimTeam == 0)
|
if(m_aKillmsgs[r].m_VictimTeam == TEAM_RED)
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
||||||
else
|
else
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
||||||
|
@ -116,7 +115,7 @@ void CKillMessages::OnRender()
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
|
|
||||||
if(m_aKillmsgs[r].m_KillerTeam == 0)
|
if(m_aKillmsgs[r].m_KillerTeam == TEAM_RED)
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
|
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
|
||||||
else
|
else
|
||||||
RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
|
RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
|
||||||
|
|
|
@ -182,12 +182,13 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(-1);
|
Graphics()->TextureSet(-1);
|
||||||
else
|
else
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->Get(pTMap->m_Image));
|
Graphics()->TextureSet(m_pClient->m_pMapimages->Get(pTMap->m_Image));
|
||||||
|
|
||||||
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
||||||
Graphics()->BlendNone();
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, vec4(1,1,1,1), TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||||
|
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
||||||
Graphics()->BlendNormal();
|
Graphics()->BlendNormal();
|
||||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, vec4(1,1,1,1), TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
||||||
}
|
}
|
||||||
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,44 +41,6 @@ float CMenus::ms_FontmodHeight = 0.8f;
|
||||||
IInput::CEvent CMenus::m_aInputEvents[MAX_INPUTEVENTS];
|
IInput::CEvent CMenus::m_aInputEvents[MAX_INPUTEVENTS];
|
||||||
int CMenus::m_NumInputEvents;
|
int CMenus::m_NumInputEvents;
|
||||||
|
|
||||||
inline float HueToRgb(float v1, float v2, float h)
|
|
||||||
{
|
|
||||||
if(h < 0) h += 1;
|
|
||||||
if(h > 1) h -= 1;
|
|
||||||
if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h;
|
|
||||||
if((2 * h) < 1) return v2;
|
|
||||||
if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6;
|
|
||||||
return v1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline vec3 HslToRgb(vec3 In)
|
|
||||||
{
|
|
||||||
float v1, v2;
|
|
||||||
vec3 Out;
|
|
||||||
|
|
||||||
if(In.s == 0)
|
|
||||||
{
|
|
||||||
Out.r = In.l;
|
|
||||||
Out.g = In.l;
|
|
||||||
Out.b = In.l;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(In.l < 0.5f)
|
|
||||||
v2 = In.l * (1 + In.s);
|
|
||||||
else
|
|
||||||
v2 = (In.l+In.s) - (In.s*In.l);
|
|
||||||
|
|
||||||
v1 = 2 * In.l - v2;
|
|
||||||
|
|
||||||
Out.r = HueToRgb(v1, v2, In.h + (1.0f/3.0f));
|
|
||||||
Out.g = HueToRgb(v1, v2, In.h);
|
|
||||||
Out.b = HueToRgb(v1, v2, In.h - (1.0f/3.0f));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CMenus::CMenus()
|
CMenus::CMenus()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,40 +37,40 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameobj)
|
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameobj)
|
||||||
{
|
{
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != -1)
|
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
||||||
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
||||||
static int s_SpectateButton = 0;
|
static int s_SpectateButton = 0;
|
||||||
if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button))
|
if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button))
|
||||||
{
|
{
|
||||||
m_pClient->SendSwitchTeam(-1);
|
m_pClient->SendSwitchTeam(TEAM_SPECTATORS);
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pGameobj->m_Flags & GAMEFLAG_TEAMS)
|
if(m_pClient->m_Snap.m_pGameobj->m_Flags & GAMEFLAG_TEAMS)
|
||||||
{
|
{
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != 0)
|
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_RED)
|
||||||
{
|
{
|
||||||
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
||||||
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
||||||
static int s_SpectateButton = 0;
|
static int s_SpectateButton = 0;
|
||||||
if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button))
|
if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button))
|
||||||
{
|
{
|
||||||
m_pClient->SendSwitchTeam(0);
|
m_pClient->SendSwitchTeam(TEAM_RED);
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != 1)
|
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_BLUE)
|
||||||
{
|
{
|
||||||
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
MainView.VSplitLeft(10.0f, &Button, &MainView);
|
||||||
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
MainView.VSplitLeft(120.0f, &Button, &MainView);
|
||||||
static int s_SpectateButton = 0;
|
static int s_SpectateButton = 0;
|
||||||
if(DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button))
|
if(DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button))
|
||||||
{
|
{
|
||||||
m_pClient->SendSwitchTeam(1);
|
m_pClient->SendSwitchTeam(TEAM_BLUE);
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,13 +98,25 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClNameplates, Localize("Show name plates"), g_Config.m_ClNameplates, &Button))
|
if(DoButton_CheckBox(&g_Config.m_ClNameplates, Localize("Show name plates"), g_Config.m_ClNameplates, &Button))
|
||||||
g_Config.m_ClNameplates ^= 1;
|
g_Config.m_ClNameplates ^= 1;
|
||||||
|
|
||||||
//if(config.cl_nameplates)
|
LeftView.HSplitTop(20.0f, &Button, &LeftView);
|
||||||
|
if(g_Config.m_ClNameplates)
|
||||||
{
|
{
|
||||||
LeftView.HSplitTop(20.0f, &Button, &LeftView);
|
|
||||||
Button.VSplitLeft(15.0f, 0, &Button);
|
Button.VSplitLeft(15.0f, 0, &Button);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClNameplatesAlways, Localize("Always show name plates"), g_Config.m_ClNameplatesAlways, &Button))
|
if(DoButton_CheckBox(&g_Config.m_ClNameplatesAlways, Localize("Always show name plates"), g_Config.m_ClNameplatesAlways, &Button))
|
||||||
g_Config.m_ClNameplatesAlways ^= 1;
|
g_Config.m_ClNameplatesAlways ^= 1;
|
||||||
|
|
||||||
|
// draw nameplates size slider
|
||||||
|
CUIRect Label;
|
||||||
|
LeftView.HSplitTop(20.0f, &Button, &LeftView);
|
||||||
|
Button.VSplitLeft(15.0f, 0, &Button);
|
||||||
|
Button.VSplitRight(10.0f, &Button, 0);
|
||||||
|
Button.VSplitLeft(140.0f, &Label, &Button);
|
||||||
|
Button.HMargin(2.0f, &Button);
|
||||||
|
UI()->DoLabel(&Label, Localize("Name plates size"), 13.0f, -1);
|
||||||
|
g_Config.m_ClNameplatesSize = (int)(DoScrollbarH(&g_Config.m_ClNameplatesSize, &Button, g_Config.m_ClNameplatesSize/100.0f)*100.0f+0.1f);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
LeftView.HSplitTop(20.0f, &Button, &LeftView);
|
||||||
|
|
||||||
{
|
{
|
||||||
const CSkins::CSkin *pOwnSkin = m_pClient->m_pSkins->Get(max(0, m_pClient->m_pSkins->Find(g_Config.m_PlayerSkin)));
|
const CSkins::CSkin *pOwnSkin = m_pClient->m_pSkins->Get(max(0, m_pClient->m_pSkins->Find(g_Config.m_PlayerSkin)));
|
||||||
|
|
|
@ -20,18 +20,28 @@ void CNamePlates::RenderNameplate(
|
||||||
|
|
||||||
vec2 Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), IntraTick);
|
vec2 Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), IntraTick);
|
||||||
|
|
||||||
|
|
||||||
|
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
|
||||||
// render name plate
|
// render name plate
|
||||||
if(!pPlayerInfo->m_Local)
|
if(!pPlayerInfo->m_Local)
|
||||||
{
|
{
|
||||||
//TextRender()->TextColor
|
|
||||||
float a = 1;
|
float a = 1;
|
||||||
if(g_Config.m_ClNameplatesAlways == 0)
|
if(g_Config.m_ClNameplatesAlways == 0)
|
||||||
a = clamp(1-powf(distance(m_pClient->m_pControls->m_TargetPos, Position)/200.0f,16.0f), 0.0f, 1.0f);
|
a = clamp(1-powf(distance(m_pClient->m_pControls->m_TargetPos, Position)/200.0f,16.0f), 0.0f, 1.0f);
|
||||||
|
|
||||||
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_aName;
|
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_aName;
|
||||||
float tw = TextRender()->TextWidth(0, 28.0f, pName, -1);
|
float tw = TextRender()->TextWidth(0, FontSize, pName, -1);
|
||||||
TextRender()->TextColor(1,1,1,a);
|
|
||||||
TextRender()->Text(0, Position.x-tw/2.0f, Position.y-60, 28.0f, pName, -1);
|
TextRender()->TextColor(1.0f, 1.0f, 1.0f, a);
|
||||||
|
if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
|
||||||
|
{
|
||||||
|
if(pPlayerInfo->m_Team == TEAM_RED)
|
||||||
|
TextRender()->TextColor(1.0f, 0.5f, 0.5f, a);
|
||||||
|
else if(pPlayerInfo->m_Team == TEAM_BLUE)
|
||||||
|
TextRender()->TextColor(0.7f, 0.7f, 1.0f, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextRender()->Text(0, Position.x-tw/2.0f, Position.y-FontSize-38.0f, FontSize, pName, -1);
|
||||||
|
|
||||||
if(g_Config.m_Debug) // render client id when in debug aswell
|
if(g_Config.m_Debug) // render client id when in debug aswell
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
|
||||||
if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
|
if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
|
||||||
{
|
{
|
||||||
const CNetObj_PlayerInfo *pInfo = (const CNetObj_PlayerInfo *)pData;
|
const CNetObj_PlayerInfo *pInfo = (const CNetObj_PlayerInfo *)pData;
|
||||||
if(pInfo->m_Team == -1)
|
if(pInfo->m_Team == TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
if(Count)
|
if(Count)
|
||||||
str_append(aBuffer, ", ", sizeof(aBuffer));
|
str_append(aBuffer, ", ", sizeof(aBuffer));
|
||||||
|
@ -150,7 +150,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
|
|
||||||
float tw = TextRender()->TextWidth(0, 48, pTitle, -1);
|
float tw = TextRender()->TextWidth(0, 48, pTitle, -1);
|
||||||
|
|
||||||
if(Team == -1)
|
if(Team == TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
TextRender()->Text(0, x+w/2-tw/2, y, 48, pTitle, -1);
|
TextRender()->Text(0, x+w/2-tw/2, y, 48, pTitle, -1);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
/*if(m_pClient->m_Snap.m_pGameobj) // This is Useless
|
/*if(m_pClient->m_Snap.m_pGameobj) // This is Useless
|
||||||
{
|
{
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
int Score = Team ? m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue : m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed;
|
int Score = Team == TEAM_RED ? m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed : m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
|
|
||||||
if(pInfo->m_Team == 0) RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
|
if(pInfo->m_Team == TEAM_RED) RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
|
||||||
else RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
|
else RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
|
||||||
|
|
||||||
float size = 64.0f;
|
float size = 64.0f;
|
||||||
|
@ -337,7 +337,7 @@ void CScoreboard::OnRender()
|
||||||
if(m_Active)
|
if(m_Active)
|
||||||
DoScoreBoard = true;
|
DoScoreBoard = true;
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != -1)
|
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
// we are not a spectator, check if we are ead
|
// we are not a spectator, check if we are ead
|
||||||
if(!m_pClient->m_Snap.m_pLocalCharacter || m_pClient->m_Snap.m_pLocalCharacter->m_Health < 0)
|
if(!m_pClient->m_Snap.m_pLocalCharacter || m_pClient->m_Snap.m_pLocalCharacter->m_Health < 0)
|
||||||
|
@ -383,8 +383,8 @@ void CScoreboard::OnRender()
|
||||||
TextRender()->Text(0, Width/2-w/2, 45, 92.0f, pText, -1);
|
TextRender()->Text(0, Width/2-w/2, 45, 92.0f, pText, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderScoreboard(Width/2-w-20, 150.0f, w, 0, Localize("Red team"));
|
RenderScoreboard(Width/2-w-20, 150.0f, w, TEAM_RED, Localize("Red team"));
|
||||||
RenderScoreboard(Width/2 + 20, 150.0f, w, 1, Localize("Blue team"));
|
RenderScoreboard(Width/2 + 20, 150.0f, w, TEAM_BLUE, Localize("Blue team"));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderGoals(Width/2-w/2, 150+750+25, w);
|
RenderGoals(Width/2-w/2, 150+750+25, w);
|
||||||
|
|
|
@ -140,45 +140,6 @@ int CSkins::Find(const char *pName)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// these converter functions were nicked from some random internet pages
|
|
||||||
static float HueToRgb(float v1, float v2, float h)
|
|
||||||
{
|
|
||||||
if(h < 0) h += 1;
|
|
||||||
if(h > 1) h -= 1;
|
|
||||||
if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h;
|
|
||||||
if((2 * h) < 1) return v2;
|
|
||||||
if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6;
|
|
||||||
return v1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static vec3 HslToRgb(vec3 in)
|
|
||||||
{
|
|
||||||
float v1, v2;
|
|
||||||
vec3 Out;
|
|
||||||
|
|
||||||
if(in.s == 0)
|
|
||||||
{
|
|
||||||
Out.r = in.l;
|
|
||||||
Out.g = in.l;
|
|
||||||
Out.b = in.l;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(in.l < 0.5f)
|
|
||||||
v2 = in.l * (1 + in.s);
|
|
||||||
else
|
|
||||||
v2 = (in.l+in.s) - (in.s*in.l);
|
|
||||||
|
|
||||||
v1 = 2 * in.l - v2;
|
|
||||||
|
|
||||||
Out.r = HueToRgb(v1, v2, in.h + (1.0f/3.0f));
|
|
||||||
Out.g = HueToRgb(v1, v2, in.h);
|
|
||||||
Out.b = HueToRgb(v1, v2, in.h - (1.0f/3.0f));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Out;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 CSkins::GetColorV3(int v)
|
vec3 CSkins::GetColorV3(int v)
|
||||||
{
|
{
|
||||||
return HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
|
return HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
|
||||||
|
@ -186,6 +147,6 @@ vec3 CSkins::GetColorV3(int v)
|
||||||
|
|
||||||
vec4 CSkins::GetColorV4(int v)
|
vec4 CSkins::GetColorV4(int v)
|
||||||
{
|
{
|
||||||
vec3 r = HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
|
vec3 r = GetColorV3(v);
|
||||||
return vec4(r.r, r.g, r.b, 1.0f);
|
return vec4(r.r, r.g, r.b, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -728,7 +728,7 @@ void CGameClient::OnNewSnapshot()
|
||||||
|
|
||||||
// go trough all the items in the snapshot and gather the info we want
|
// go trough all the items in the snapshot and gather the info we want
|
||||||
{
|
{
|
||||||
m_Snap.m_aTeamSize[0] = m_Snap.m_aTeamSize[1] = 0;
|
m_Snap.m_aTeamSize[TEAM_RED] = m_Snap.m_aTeamSize[TEAM_BLUE] = 0;
|
||||||
|
|
||||||
int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT);
|
int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT);
|
||||||
for(int i = 0; i < Num; i++)
|
for(int i = 0; i < Num; i++)
|
||||||
|
@ -789,12 +789,12 @@ void CGameClient::OnNewSnapshot()
|
||||||
m_Snap.m_LocalCid = Item.m_Id;
|
m_Snap.m_LocalCid = Item.m_Id;
|
||||||
m_Snap.m_pLocalInfo = pInfo;
|
m_Snap.m_pLocalInfo = pInfo;
|
||||||
|
|
||||||
if (pInfo->m_Team == -1)
|
if(pInfo->m_Team == TEAM_SPECTATORS)
|
||||||
m_Snap.m_Spectate = true;
|
m_Snap.m_Spectate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate team-balance
|
// calculate team-balance
|
||||||
if(pInfo->m_Team != -1)
|
if(pInfo->m_Team != TEAM_SPECTATORS)
|
||||||
m_Snap.m_aTeamSize[pInfo->m_Team]++;
|
m_Snap.m_aTeamSize[pInfo->m_Team]++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1002,7 @@ void CGameClient::CClientData::UpdateRenderInfo()
|
||||||
if(g_GameClient.m_Snap.m_pGameobj && g_GameClient.m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
|
if(g_GameClient.m_Snap.m_pGameobj && g_GameClient.m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
|
||||||
{
|
{
|
||||||
const int TeamColors[2] = {65387, 10223467};
|
const int TeamColors[2] = {65387, 10223467};
|
||||||
if(m_Team >= 0 && m_Team <= 1)
|
if(m_Team >= TEAM_RED && m_Team <= TEAM_BLUE)
|
||||||
{
|
{
|
||||||
m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture;
|
m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture;
|
||||||
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
|
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
|
||||||
|
|
|
@ -218,6 +218,31 @@ public:
|
||||||
class CScoreboard *m_pScoreboard;
|
class CScoreboard *m_pScoreboard;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline float HueToRgb(float v1, float v2, float h)
|
||||||
|
{
|
||||||
|
if(h < 0.0f) h += 1;
|
||||||
|
if(h > 1.0f) h -= 1;
|
||||||
|
if((6.0f * h) < 1.0f) return v1 + (v2 - v1) * 6.0f * h;
|
||||||
|
if((2.0f * h) < 1.0f) return v2;
|
||||||
|
if((3.0f * h) < 2.0f) return v1 + (v2 - v1) * ((2.0f/3.0f) - h) * 6.0f;
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline vec3 HslToRgb(vec3 HSL)
|
||||||
|
{
|
||||||
|
if(HSL.s == 0.0f)
|
||||||
|
return vec3(HSL.l, HSL.l, HSL.l);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float v2 = HSL.l < 0.5f ? HSL.l * (1.0f + HSL.s) : (HSL.l+HSL.s) - (HSL.s*HSL.l);
|
||||||
|
float v1 = 2.0f * HSL.l - v2;
|
||||||
|
|
||||||
|
return vec3(HueToRgb(v1, v2, HSL.h + (1.0f/3.0f)), HueToRgb(v1, v2, HSL.h), HueToRgb(v1, v2, HSL.h - (1.0f/3.0f)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern const char *Localize(const char *Str);
|
extern const char *Localize(const char *Str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1887,7 +1887,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
||||||
m_SelectedGroup = g;
|
m_SelectedGroup = g;
|
||||||
static int s_LayerPopupId = 0;
|
static int s_LayerPopupId = 0;
|
||||||
if(Result == 2)
|
if(Result == 2)
|
||||||
UiInvokePopupMenu(&s_LayerPopupId, 0, UI()->MouseX(), UI()->MouseY(), 120, 180, PopupLayer);
|
UiInvokePopupMenu(&s_LayerPopupId, 0, UI()->MouseX(), UI()->MouseY(), 120, 220, PopupLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerCur += 14.0f;
|
LayerCur += 14.0f;
|
||||||
|
|
|
@ -406,6 +406,7 @@ public:
|
||||||
int m_Image;
|
int m_Image;
|
||||||
int m_Width;
|
int m_Width;
|
||||||
int m_Height;
|
int m_Height;
|
||||||
|
CColor m_Color;
|
||||||
CTile *m_pTiles;
|
CTile *m_pTiles;
|
||||||
char m_aFileName[512];
|
char m_aFileName[512];
|
||||||
};
|
};
|
||||||
|
|
|
@ -283,11 +283,11 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
||||||
Item.m_Layer.m_Flags = pLayer->m_Flags;
|
Item.m_Layer.m_Flags = pLayer->m_Flags;
|
||||||
Item.m_Layer.m_Type = pLayer->m_Type;
|
Item.m_Layer.m_Type = pLayer->m_Type;
|
||||||
|
|
||||||
Item.m_Color.r = 255; // not in use right now
|
Item.m_Color.r = pLayer->m_Color.r;
|
||||||
Item.m_Color.g = 255;
|
Item.m_Color.g = pLayer->m_Color.g;
|
||||||
Item.m_Color.b = 255;
|
Item.m_Color.b = pLayer->m_Color.b;
|
||||||
Item.m_Color.a = 255;
|
Item.m_Color.a = pLayer->m_Color.a;
|
||||||
Item.m_ColorEnv = -1;
|
Item.m_ColorEnv = -1; // not in use right now
|
||||||
Item.m_ColorEnvOffset = 0;
|
Item.m_ColorEnvOffset = 0;
|
||||||
|
|
||||||
Item.m_Width = pLayer->m_Width;
|
Item.m_Width = pLayer->m_Width;
|
||||||
|
@ -570,6 +570,10 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
||||||
{
|
{
|
||||||
pTiles = new CLayerTiles(pTilemapItem->m_Width, pTilemapItem->m_Height);
|
pTiles = new CLayerTiles(pTilemapItem->m_Width, pTilemapItem->m_Height);
|
||||||
pTiles->m_pEditor = m_pEditor;
|
pTiles->m_pEditor = m_pEditor;
|
||||||
|
pTiles->m_Color.r = pTilemapItem->m_Color.r;
|
||||||
|
pTiles->m_Color.g = pTilemapItem->m_Color.g;
|
||||||
|
pTiles->m_Color.b = pTilemapItem->m_Color.b;
|
||||||
|
pTiles->m_Color.a = pTilemapItem->m_Color.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
pLayer = pTiles;
|
pLayer = pTiles;
|
||||||
|
|
|
@ -22,6 +22,10 @@ CLayerTiles::CLayerTiles(int w, int h)
|
||||||
m_Image = -1;
|
m_Image = -1;
|
||||||
m_TexId = -1;
|
m_TexId = -1;
|
||||||
m_Game = 0;
|
m_Game = 0;
|
||||||
|
m_Color.r = 255;
|
||||||
|
m_Color.g = 255;
|
||||||
|
m_Color.b = 255;
|
||||||
|
m_Color.a = 255;
|
||||||
m_Tele = 0;
|
m_Tele = 0;
|
||||||
m_Speedup = 0;
|
m_Speedup = 0;
|
||||||
m_Front = 0;
|
m_Front = 0;
|
||||||
|
@ -42,7 +46,7 @@ void CLayerTiles::PrepareForSave()
|
||||||
for(int x = 0; x < m_Width; x++)
|
for(int x = 0; x < m_Width; x++)
|
||||||
m_pTiles[y*m_Width+x].m_Flags &= TILEFLAG_VFLIP|TILEFLAG_HFLIP|TILEFLAG_ROTATE;
|
m_pTiles[y*m_Width+x].m_Flags &= TILEFLAG_VFLIP|TILEFLAG_HFLIP|TILEFLAG_ROTATE;
|
||||||
|
|
||||||
if(m_Image != -1)
|
if(m_Image != -1 && m_Color.a == 255)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < m_Height; y++)
|
for(int y = 0; y < m_Height; y++)
|
||||||
for(int x = 0; x < m_Width; x++)
|
for(int x = 0; x < m_Width; x++)
|
||||||
|
@ -62,7 +66,8 @@ void CLayerTiles::Render()
|
||||||
if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size())
|
if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size())
|
||||||
m_TexId = m_pEditor->m_Map.m_lImages[m_Image]->m_TexId;
|
m_TexId = m_pEditor->m_Map.m_lImages[m_Image]->m_TexId;
|
||||||
Graphics()->TextureSet(m_TexId);
|
Graphics()->TextureSet(m_TexId);
|
||||||
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, vec4(1,1,1,1), LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT);
|
vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f);
|
||||||
|
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT);
|
||||||
if(m_Tele)
|
if(m_Tele)
|
||||||
m_pEditor->RenderTools()->RenderTelemap(((CLayerTele*)this)->m_pTeleTile, m_Width, m_Height, 32.0f);
|
m_pEditor->RenderTools()->RenderTelemap(((CLayerTele*)this)->m_pTeleTile, m_Width, m_Height, 32.0f);
|
||||||
if(m_Speedup)
|
if(m_Speedup)
|
||||||
|
@ -343,13 +348,13 @@ void CLayerTiles::BrushFlipY()
|
||||||
|
|
||||||
void CLayerTiles::BrushRotate(float Amount)
|
void CLayerTiles::BrushRotate(float Amount)
|
||||||
{
|
{
|
||||||
int Rotation = (round(360.0f*Amount/(pi*2))/90)%4; // 0=0<EFBFBD>, 1=90<39>, 2=180<38>, 3=270<37>
|
int Rotation = (round(360.0f*Amount/(pi*2))/90)%4; // 0=0?, 1=90?, 2=180?, 3=270?
|
||||||
if(Rotation < 0)
|
if(Rotation < 0)
|
||||||
Rotation +=4;
|
Rotation +=4;
|
||||||
|
|
||||||
if(Rotation == 1 || Rotation == 3)
|
if(Rotation == 1 || Rotation == 3)
|
||||||
{
|
{
|
||||||
// 90<EFBFBD> rotation
|
// 90? rotation
|
||||||
CTile *pTempData = new CTile[m_Width*m_Height];
|
CTile *pTempData = new CTile[m_Width*m_Height];
|
||||||
mem_copy(pTempData, m_pTiles, m_Width*m_Height*sizeof(CTile));
|
mem_copy(pTempData, m_pTiles, m_Width*m_Height*sizeof(CTile));
|
||||||
CTile *pDst = m_pTiles;
|
CTile *pDst = m_pTiles;
|
||||||
|
@ -453,38 +458,47 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
||||||
bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty();
|
bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty();
|
||||||
if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this)
|
if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this)
|
||||||
InGameGroup = false;
|
InGameGroup = false;
|
||||||
static int s_ColclButton = 0;
|
|
||||||
if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), InGameGroup?0:-1, &Button, 0, Localize("Removes collision from this layer")))
|
if(InGameGroup)
|
||||||
{
|
{
|
||||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
static int s_ColclButton = 0;
|
||||||
int w = min(gl->m_Width, m_Width);
|
if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), 0, &Button, 0, Localize("Removes collision from this layer")))
|
||||||
int h = min(gl->m_Height, m_Height);
|
{
|
||||||
for(int y = 0; y < h; y++)
|
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||||
for(int x = 0; x < w; x++)
|
int w = min(gl->m_Width, m_Width);
|
||||||
|
int h = min(gl->m_Height, m_Height);
|
||||||
|
for(int y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
for(int x = 0; x < w; x++)
|
||||||
if(m_pTiles[y*m_Width+x].m_Index)
|
{
|
||||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR;
|
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||||
|
{
|
||||||
|
if(m_pTiles[y*m_Width+x].m_Index)
|
||||||
|
gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
static int s_ColButton = 0;
|
static int s_ColButton = 0;
|
||||||
pToolBox->HSplitBottom(5.0f, pToolBox, &Button);
|
pToolBox->HSplitBottom(5.0f, pToolBox, &Button);
|
||||||
pToolBox->HSplitBottom(12.0f, pToolBox, &Button);
|
pToolBox->HSplitBottom(12.0f, pToolBox, &Button);
|
||||||
if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), InGameGroup?0:-1, &Button, 0, Localize("Constructs collision from this layer")))
|
if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), 0, &Button, 0, Localize("Constructs collision from this layer")))
|
||||||
{
|
{
|
||||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||||
int w = min(gl->m_Width, m_Width);
|
int w = min(gl->m_Width, m_Width);
|
||||||
int h = min(gl->m_Height, m_Height);
|
int h = min(gl->m_Height, m_Height);
|
||||||
for(int y = 0; y < h; y++)
|
for(int y = 0; y < h; y++)
|
||||||
for(int x = 0; x < w; x++)
|
|
||||||
{
|
{
|
||||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
for(int x = 0; x < w; x++)
|
||||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR;
|
{
|
||||||
|
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||||
|
gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -493,19 +507,30 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
||||||
PROP_HEIGHT,
|
PROP_HEIGHT,
|
||||||
PROP_SHIFT,
|
PROP_SHIFT,
|
||||||
PROP_IMAGE,
|
PROP_IMAGE,
|
||||||
|
PROP_COLOR,
|
||||||
NUM_PROPS,
|
NUM_PROPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int Color = 0;
|
||||||
|
Color |= m_Color.r<<24;
|
||||||
|
Color |= m_Color.g<<16;
|
||||||
|
Color |= m_Color.b<<8;
|
||||||
|
Color |= m_Color.a;
|
||||||
|
|
||||||
CProperty aProps[] = {
|
CProperty aProps[] = {
|
||||||
{Localize("Width"), m_Width, PROPTYPE_INT_SCROLL, 1, 1000000000},
|
{Localize("Width"), m_Width, PROPTYPE_INT_SCROLL, 1, 1000000000},
|
||||||
{Localize("Height"), m_Height, PROPTYPE_INT_SCROLL, 1, 1000000000},
|
{Localize("Height"), m_Height, PROPTYPE_INT_SCROLL, 1, 1000000000},
|
||||||
{Localize("Shift"), 0, PROPTYPE_SHIFT, 0, 0},
|
{Localize("Shift"), 0, PROPTYPE_SHIFT, 0, 0},
|
||||||
{Localize("Image"), m_Image, PROPTYPE_IMAGE, 0, 0},
|
{Localize("Image"), m_Image, PROPTYPE_IMAGE, 0, 0},
|
||||||
|
{Localize("Color"), Color, PROPTYPE_COLOR, 0, 0},
|
||||||
{0},
|
{0},
|
||||||
};
|
};
|
||||||
|
|
||||||
if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this) // remove the image from the selection if this is the game/tele/speedup/front/switch layer
|
if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this) // remove the image and color properties if this is the game/tele/speedup/front/switch layer
|
||||||
|
{
|
||||||
aProps[3].m_pName = 0;
|
aProps[3].m_pName = 0;
|
||||||
|
aProps[4].m_pName = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int s_aIds[NUM_PROPS] = {0};
|
static int s_aIds[NUM_PROPS] = {0};
|
||||||
int NewVal = 0;
|
int NewVal = 0;
|
||||||
|
@ -527,6 +552,13 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
||||||
else
|
else
|
||||||
m_Image = NewVal%m_pEditor->m_Map.m_lImages.size();
|
m_Image = NewVal%m_pEditor->m_Map.m_lImages.size();
|
||||||
}
|
}
|
||||||
|
else if(Prop == PROP_COLOR)
|
||||||
|
{
|
||||||
|
m_Color.r = (NewVal>>24)&0xff;
|
||||||
|
m_Color.g = (NewVal>>16)&0xff;
|
||||||
|
m_Color.b = (NewVal>>8)&0xff;
|
||||||
|
m_Color.a = NewVal&0xff;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -589,7 +589,7 @@ void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
|
||||||
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
||||||
mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
|
mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
|
||||||
|
|
||||||
if(m_NumInputs > 2 && m_pPlayer->GetTeam() != -1)
|
if(m_NumInputs > 2 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
HandleWeaponSwitch();
|
HandleWeaponSwitch();
|
||||||
FireWeapon();
|
FireWeapon();
|
||||||
|
@ -1266,7 +1266,7 @@ void CCharacter::TickDefered()
|
||||||
if(Events&COREEVENT_HOOK_HIT_NOHOOK) GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, Mask);
|
if(Events&COREEVENT_HOOK_HIT_NOHOOK) GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, Mask);
|
||||||
|
|
||||||
|
|
||||||
if(m_pPlayer->GetTeam() == -1)
|
if(m_pPlayer->GetTeam() == TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
m_Pos.x = m_Input.m_TargetX;
|
m_Pos.x = m_Input.m_TargetX;
|
||||||
m_Pos.y = m_Input.m_TargetY;
|
m_Pos.y = m_Input.m_TargetY;
|
||||||
|
|
|
@ -508,7 +508,7 @@ void CGameContext::OnTick()
|
||||||
bool aVoteChecked[MAX_CLIENTS] = {0};
|
bool aVoteChecked[MAX_CLIENTS] = {0};
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
if(!m_apPlayers[i] || (g_Config.m_SvSpectatorVotes == 0 && m_apPlayers[i]->GetTeam() == -1) || aVoteChecked[i]) // don't count in votes by spectators
|
if(!m_apPlayers[i] || (g_Config.m_SvSpectatorVotes == 0 && m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS) || aVoteChecked[i]) // don't count in votes by spectators
|
||||||
continue;
|
continue;
|
||||||
if(m_VoteKick &&
|
if(m_VoteKick &&
|
||||||
GetPlayerChar(m_VoteCreator) && GetPlayerChar(i) &&
|
GetPlayerChar(m_VoteCreator) && GetPlayerChar(i) &&
|
||||||
|
@ -706,7 +706,7 @@ void CGameContext::OnSetAuthed(int client_id, int Level)
|
||||||
void CGameContext::OnClientConnected(int ClientId)
|
void CGameContext::OnClientConnected(int ClientId)
|
||||||
{
|
{
|
||||||
// Check which team the player should be on
|
// Check which team the player should be on
|
||||||
const int StartTeam = g_Config.m_SvTournamentMode ? -1 : m_pController->GetAutoTeam(ClientId);
|
const int StartTeam = g_Config.m_SvTournamentMode ? TEAM_SPECTATORS : m_pController->GetAutoTeam(ClientId);
|
||||||
|
|
||||||
m_apPlayers[ClientId] = new(ClientId) CPlayer(this, ClientId, StartTeam);
|
m_apPlayers[ClientId] = new(ClientId) CPlayer(this, ClientId, StartTeam);
|
||||||
//players[client_id].init(client_id);
|
//players[client_id].init(client_id);
|
||||||
|
@ -811,7 +811,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
||||||
|
|
||||||
int64 Now = Server()->Tick();
|
int64 Now = Server()->Tick();
|
||||||
p->m_Last_VoteTry = Now;
|
p->m_Last_VoteTry = Now;
|
||||||
if(g_Config.m_SvSpectatorVotes == 0 && p->GetTeam() == -1)
|
if(g_Config.m_SvSpectatorVotes == 0 && p->GetTeam() == TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
SendChatTarget(ClientId, "Spectators aren't allowed to start a vote.");
|
SendChatTarget(ClientId, "Spectators aren't allowed to start a vote.");
|
||||||
return;
|
return;
|
||||||
|
@ -997,7 +997,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
||||||
SendChatTarget(ClientId,"Use /pause first then you can kill");
|
SendChatTarget(ClientId,"Use /pause first then you can kill");
|
||||||
else{
|
else{
|
||||||
p->m_Last_SetTeam = Server()->Tick();
|
p->m_Last_SetTeam = Server()->Tick();
|
||||||
if(p->GetTeam() == -1 || pMsg->m_Team == -1)
|
if(p->GetTeam() == TEAM_SPECTATORS || pMsg->m_Team == TEAM_SPECTATORS)
|
||||||
m_VoteUpdate = true;
|
m_VoteUpdate = true;
|
||||||
p->SetTeam(pMsg->m_Team);
|
p->SetTeam(pMsg->m_Team);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ IGameController::IGameController(class CGameContext *pGameServer)
|
||||||
m_RoundStartTick = Server()->Tick();
|
m_RoundStartTick = Server()->Tick();
|
||||||
m_RoundCount = 0;
|
m_RoundCount = 0;
|
||||||
m_GameFlags = 0;
|
m_GameFlags = 0;
|
||||||
//m_aTeamscore[0] = 0;
|
//m_aTeamscore[TEAM_RED] = 0;
|
||||||
//m_aTeamscore[1] = 0;
|
//m_aTeamscore[TEAM_BLUE] = 0;
|
||||||
m_aMapWish[0] = 0;
|
m_aMapWish[0] = 0;
|
||||||
|
|
||||||
m_UnbalancedTick = -1;
|
m_UnbalancedTick = -1;
|
||||||
|
@ -96,7 +96,7 @@ bool IGameController::CanSpawn(CPlayer *pPlayer, vec2 *pOutPos)
|
||||||
CSpawnEval Eval;
|
CSpawnEval Eval;
|
||||||
|
|
||||||
// spectators can't spawn
|
// spectators can't spawn
|
||||||
if(pPlayer->GetTeam() == -1)
|
if(pPlayer->GetTeam() == TEAM_SPECTATORS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*if(IsTeamplay())
|
/*if(IsTeamplay())
|
||||||
|
@ -378,8 +378,16 @@ void IGameController::ResetGame()
|
||||||
|
|
||||||
const char *IGameController::GetTeamName(int Team)
|
const char *IGameController::GetTeamName(int Team)
|
||||||
{
|
{
|
||||||
if(Team == 0)
|
/*
|
||||||
return "game";
|
if(Team == TEAM_RED)
|
||||||
|
return "red team";
|
||||||
|
else if(Team == TEAM_BLUE)
|
||||||
|
return "blue team";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{*/
|
||||||
|
if(Team == 0)
|
||||||
|
return "game";
|
||||||
return "spectators";
|
return "spectators";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +402,8 @@ void IGameController::StartRound()
|
||||||
m_SuddenDeath = 0;
|
m_SuddenDeath = 0;
|
||||||
m_GameOverTick = -1;
|
m_GameOverTick = -1;
|
||||||
GameServer()->m_World.m_Paused = false;
|
GameServer()->m_World.m_Paused = false;
|
||||||
|
//m_aTeamscore[TEAM_RED] = 0;
|
||||||
|
//m_aTeamscore[TEAM_BLUE] = 0;
|
||||||
m_ForceBalanced = false;
|
m_ForceBalanced = false;
|
||||||
char aBuf[256];
|
char aBuf[256];
|
||||||
str_format(aBuf, sizeof(aBuf), "start round type='%s' teamplay='%d'", m_pGameType, m_GameFlags&GAMEFLAG_TEAMS);
|
str_format(aBuf, sizeof(aBuf), "start round type='%s' teamplay='%d'", m_pGameType, m_GameFlags&GAMEFLAG_TEAMS);
|
||||||
|
@ -498,7 +508,7 @@ void IGameController::OnPlayerInfoChange(class CPlayer *pP)
|
||||||
const int aTeamColors[2] = {65387, 10223467};
|
const int aTeamColors[2] = {65387, 10223467};
|
||||||
if(IsTeamplay())
|
if(IsTeamplay())
|
||||||
{
|
{
|
||||||
if(pP->GetTeam() >= 0 || pP->GetTeam() <= 1)
|
if(pP->GetTeam() >= TEAM_RED && pP->GetTeam() <= TEAM_BLUE)
|
||||||
{
|
{
|
||||||
pP->m_TeeInfos.m_UseCustomColor = 1;
|
pP->m_TeeInfos.m_UseCustomColor = 1;
|
||||||
pP->m_TeeInfos.m_ColorBody = aTeamColors[pP->GetTeam()];
|
pP->m_TeeInfos.m_ColorBody = aTeamColors[pP->GetTeam()];
|
||||||
|
@ -609,7 +619,7 @@ void IGameController::Tick()
|
||||||
float aPScore[MAX_CLIENTS] = {0.0f};
|
float aPScore[MAX_CLIENTS] = {0.0f};
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != -1)
|
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
|
||||||
{
|
{
|
||||||
aT[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
aT[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
||||||
aPScore[i] = GameServer()->m_apPlayers[i]->m_Score*Server()->TickSpeed()*60.0f/
|
aPScore[i] = GameServer()->m_apPlayers[i]->m_Score*Server()->TickSpeed()*60.0f/
|
||||||
|
@ -659,7 +669,7 @@ void IGameController::Tick()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != -1 && !Server()->IsAuthed(i))
|
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS && !Server()->IsAuthed(i))
|
||||||
{
|
{
|
||||||
if(Server()->Tick() > GameServer()->m_apPlayers[i]->m_LastActionTick+g_Config.m_SvInactiveKickTime*Server()->TickSpeed()*60)
|
if(Server()->Tick() > GameServer()->m_apPlayers[i]->m_LastActionTick+g_Config.m_SvInactiveKickTime*Server()->TickSpeed()*60)
|
||||||
{
|
{
|
||||||
|
@ -668,7 +678,7 @@ void IGameController::Tick()
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// move player to spectator
|
// move player to spectator
|
||||||
GameServer()->m_apPlayers[i]->SetTeam(-1);
|
GameServer()->m_apPlayers[i]->SetTeam(TEAM_SPECTATORS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -676,12 +686,12 @@ void IGameController::Tick()
|
||||||
// move player to spectator if the reserved slots aren't filled yet, kick him otherwise
|
// move player to spectator if the reserved slots aren't filled yet, kick him otherwise
|
||||||
int Spectators = 0;
|
int Spectators = 0;
|
||||||
for(int j = 0; j < MAX_CLIENTS; ++j)
|
for(int j = 0; j < MAX_CLIENTS; ++j)
|
||||||
if(GameServer()->m_apPlayers[j] && GameServer()->m_apPlayers[j]->GetTeam() == -1)
|
if(GameServer()->m_apPlayers[j] && GameServer()->m_apPlayers[j]->GetTeam() == TEAM_SPECTATORS)
|
||||||
++Spectators;
|
++Spectators;
|
||||||
if(Spectators >= g_Config.m_SvSpectatorSlots)
|
if(Spectators >= g_Config.m_SvSpectatorSlots)
|
||||||
Server()->Kick(i, "Kicked for inactivity");
|
Server()->Kick(i, "Kicked for inactivity");
|
||||||
else
|
else
|
||||||
GameServer()->m_apPlayers[i]->SetTeam(-1);
|
GameServer()->m_apPlayers[i]->SetTeam(TEAM_SPECTATORS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -705,8 +715,8 @@ void IGameController::Tick()
|
||||||
{
|
{
|
||||||
if(IsTeamplay())
|
if(IsTeamplay())
|
||||||
{
|
{
|
||||||
Prog = max(Prog, (m_aTeamscore[0]*100)/g_Config.m_SvScorelimit);
|
Prog = max(Prog, (m_aTeamscore[TEAM_RED]*100)/g_Config.m_SvScorelimit);
|
||||||
Prog = max(Prog, (m_aTeamscore[1]*100)/g_Config.m_SvScorelimit);
|
Prog = max(Prog, (m_aTeamscore[TEAM_BLUE]*100)/g_Config.m_SvScorelimit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -760,14 +770,14 @@ void IGameController::Snap(int SnappingClient)
|
||||||
if(SnappingClient == -1)
|
if(SnappingClient == -1)
|
||||||
{
|
{
|
||||||
// we are recording a demo, just set the scores
|
// we are recording a demo, just set the scores
|
||||||
pGameObj->m_TeamscoreRed = 0;//m_aTeamscore[0];
|
pGameObj->m_TeamscoreRed = 0;// m_aTeamscore[TEAM_RED];
|
||||||
pGameObj->m_TeamscoreBlue = 0;//m_aTeamscore[1];
|
pGameObj->m_TeamscoreBlue = 0;// m_aTeamscore[TEAM_BLUE];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: this little hack should be removed
|
// TODO: this little hack should be removed
|
||||||
pGameObj->m_TeamscoreRed = /*IsTeamplay() ? m_aTeamscore[0] : */GameServer()->m_apPlayers[SnappingClient]->m_Score;
|
pGameObj->m_TeamscoreRed = /*IsTeamplay() ? m_aTeamscore[TEAM_RED] : */GameServer()->m_apPlayers[SnappingClient]->m_Score;
|
||||||
pGameObj->m_TeamscoreBlue = 0;//m_aTeamscore[1];
|
pGameObj->m_TeamscoreBlue = 0;// m_aTeamscore[TEAM_BLUE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,15 +792,15 @@ int IGameController::GetAutoTeam(int Notthisid)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i] && i != Notthisid)
|
if(GameServer()->m_apPlayers[i] && i != Notthisid)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i]->GetTeam() == 0 || GameServer()->m_apPlayers[i]->GetTeam() == 1)
|
if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE)
|
||||||
aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Team = 0;
|
int Team = 0;
|
||||||
//if(IsTeamplay())
|
//if(IsTeamplay())
|
||||||
// Team = aNumplayers[0] > aNumplayers[1] ? 1 : 0;
|
//Team = aNumplayers[TEAM_RED] > aNumplayers[TEAM_BLUE] ? TEAM_BLUE : TEAM_RED;
|
||||||
|
|
||||||
if(CanJoinTeam(Team, Notthisid))
|
if(CanJoinTeam(Team, Notthisid))
|
||||||
return Team;
|
return Team;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -798,7 +808,7 @@ int IGameController::GetAutoTeam(int Notthisid)
|
||||||
|
|
||||||
bool IGameController::CanJoinTeam(int Team, int Notthisid)
|
bool IGameController::CanJoinTeam(int Team, int Notthisid)
|
||||||
{
|
{
|
||||||
if(Team == -1 || (GameServer()->m_apPlayers[Notthisid] && GameServer()->m_apPlayers[Notthisid]->GetTeam() != -1))
|
if(Team == TEAM_SPECTATORS || (GameServer()->m_apPlayers[Notthisid] && GameServer()->m_apPlayers[Notthisid]->GetTeam() != TEAM_SPECTATORS))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int aNumplayers[2] = {0,0};
|
int aNumplayers[2] = {0,0};
|
||||||
|
@ -806,7 +816,7 @@ bool IGameController::CanJoinTeam(int Team, int Notthisid)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i] && i != Notthisid)
|
if(GameServer()->m_apPlayers[i] && i != Notthisid)
|
||||||
{
|
{
|
||||||
if(GameServer()->m_apPlayers[i]->GetTeam() >= 0 || GameServer()->m_apPlayers[i]->GetTeam() == 1)
|
if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE)
|
||||||
aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -823,7 +833,7 @@ bool IGameController::CheckTeamBalance()
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
CPlayer *pP = GameServer()->m_apPlayers[i];
|
CPlayer *pP = GameServer()->m_apPlayers[i];
|
||||||
if(pP && pP->GetTeam() != -1)
|
if(pP && pP->GetTeam() != TEAM_SPECTATORS)
|
||||||
aT[pP->GetTeam()]++;
|
aT[pP->GetTeam()]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,26 +859,26 @@ bool IGameController::CanChangeTeam(CPlayer *pPlayer, int JoinTeam)
|
||||||
{
|
{
|
||||||
int aT[2] = {0, 0};
|
int aT[2] = {0, 0};
|
||||||
|
|
||||||
if (!IsTeamplay() || JoinTeam == -1 || !g_Config.m_SvTeambalanceTime)
|
if (!IsTeamplay() || JoinTeam == TEAM_SPECTATORS || !g_Config.m_SvTeambalanceTime)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
CPlayer *pP = GameServer()->m_apPlayers[i];
|
CPlayer *pP = GameServer()->m_apPlayers[i];
|
||||||
if(pP && pP->GetTeam() != -1)
|
if(pP && pP->GetTeam() != TEAM_SPECTATORS)
|
||||||
aT[pP->GetTeam()]++;
|
aT[pP->GetTeam()]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulate what would happen if changed team
|
// simulate what would happen if changed team
|
||||||
aT[JoinTeam]++;
|
aT[JoinTeam]++;
|
||||||
if (pPlayer->GetTeam() != -1)
|
if (pPlayer->GetTeam() != TEAM_SPECTATORS)
|
||||||
aT[JoinTeam^1]--;
|
aT[JoinTeam^1]--;
|
||||||
|
|
||||||
// there is a player-difference of at least 2
|
// there is a player-difference of at least 2
|
||||||
if(absolute(aT[0]-aT[1]) >= 2)
|
if(absolute(aT[0]-aT[1]) >= 2)
|
||||||
{
|
{
|
||||||
// player wants to join team with less players
|
// player wants to join team with less players
|
||||||
if ((aT[0] < aT[1] && JoinTeam == 0) || (aT[0] > aT[1] && JoinTeam == 1))
|
if ((aT[0] < aT[1] && JoinTeam == TEAM_RED) || (aT[0] > aT[1] && JoinTeam == TEAM_BLUE))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -915,10 +925,10 @@ void IGameController::DoTeamScoreWincheck()
|
||||||
if(m_GameOverTick == -1 && !m_Warmup)
|
if(m_GameOverTick == -1 && !m_Warmup)
|
||||||
{
|
{
|
||||||
// check score win condition
|
// check score win condition
|
||||||
if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[0] >= g_Config.m_SvScorelimit || m_aTeamscore[1] >= g_Config.m_SvScorelimit)) ||
|
if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[TEAM_RED] >= g_Config.m_SvScorelimit || m_aTeamscore[TEAM_BLUE] >= g_Config.m_SvScorelimit)) ||
|
||||||
(g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60))
|
(g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60))
|
||||||
{
|
{
|
||||||
if(m_aTeamscore[0] != m_aTeamscore[1])
|
if(m_aTeamscore[TEAM_RED] != m_aTeamscore[TEAM_BLUE])
|
||||||
EndRound();
|
EndRound();
|
||||||
else
|
else
|
||||||
m_SuddenDeath = 1;
|
m_SuddenDeath = 1;
|
||||||
|
@ -931,9 +941,9 @@ void IGameController::DoTeamScoreWincheck()
|
||||||
|
|
||||||
int IGameController::ClampTeam(int Team)
|
int IGameController::ClampTeam(int Team)
|
||||||
{
|
{
|
||||||
if(Team < 0) // spectator
|
if(Team < 0)
|
||||||
return -1;
|
return TEAM_SPECTATORS;
|
||||||
//if(IsTeamplay())
|
//if(IsTeamplay())
|
||||||
// return Team&1;
|
// return Team&1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ bool CGameControllerCTF::OnEntity(int Index, vec2 Pos)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int Team = -1;
|
int Team = -1;
|
||||||
if(Index == ENTITY_FLAGSTAND_RED) Team = 0;
|
if(Index == ENTITY_FLAGSTAND_RED) Team = TEAM_RED;
|
||||||
if(Index == ENTITY_FLAGSTAND_BLUE) Team = 1;
|
if(Index == ENTITY_FLAGSTAND_BLUE) Team = TEAM_BLUE;
|
||||||
if(Team == -1 || m_apFlags[Team])
|
if(Team == -1 || m_apFlags[Team])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ void CGameControllerCTF::Tick()
|
||||||
int Num = GameServer()->m_World.FindEntities(F->m_Pos, CFlag::ms_PhysSize, (CEntity**)apCloseCCharacters, MAX_CLIENTS, NETOBJTYPE_CHARACTER);
|
int Num = GameServer()->m_World.FindEntities(F->m_Pos, CFlag::ms_PhysSize, (CEntity**)apCloseCCharacters, MAX_CLIENTS, NETOBJTYPE_CHARACTER);
|
||||||
for(int i = 0; i < Num; i++)
|
for(int i = 0; i < Num; i++)
|
||||||
{
|
{
|
||||||
if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == -1 || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL))
|
if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == TEAM_SPECTATORS || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Number)
|
if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Number)
|
||||||
|
|
|
@ -159,10 +159,10 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
||||||
if(Character)
|
if(Character)
|
||||||
Character->OnDirectInput(NewInput);
|
Character->OnDirectInput(NewInput);
|
||||||
|
|
||||||
if(!Character && m_Team >= 0 && (NewInput->m_Fire&1))
|
if(!Character && m_Team != TEAM_SPECTATORS && (NewInput->m_Fire&1))
|
||||||
m_Spawning = true;
|
m_Spawning = true;
|
||||||
|
|
||||||
if(!Character && m_Team == -1)
|
if(!Character && m_Team == TEAM_SPECTATORS)
|
||||||
m_ViewPos = vec2(NewInput->m_TargetX, NewInput->m_TargetY);
|
m_ViewPos = vec2(NewInput->m_TargetX, NewInput->m_TargetY);
|
||||||
|
|
||||||
// check for activity
|
// check for activity
|
||||||
|
@ -195,7 +195,7 @@ void CPlayer::KillCharacter(int Weapon)
|
||||||
|
|
||||||
void CPlayer::Respawn()
|
void CPlayer::Respawn()
|
||||||
{
|
{
|
||||||
if(m_Team > -1)
|
if(m_Team != TEAM_SPECTATORS)
|
||||||
m_Spawning = true;
|
m_Spawning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements", -1)
|
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements", -1)
|
||||||
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates", -1)
|
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates", -1)
|
||||||
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance", -1)
|
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance", -1)
|
||||||
|
MACRO_CONFIG_INT(ClNameplatesSize, cl_nameplates_size, 50, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Size of the nameplates from 0 to 100%", -1)
|
||||||
MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup", -1)
|
MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup", -1)
|
||||||
|
|
||||||
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter", -1)
|
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter", -1)
|
||||||
|
|
Loading…
Reference in a new issue