Merge branch 'master' into automapper
BIN
data/skins/coala_bluekitty.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
data/skins/coala_bluestripe.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
data/skins/coala_cammo.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
data/skins/coala_cammostripes.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
data/skins/coala_default.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
data/skins/coala_limekitty.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
data/skins/coala_pinky.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
data/skins/coala_redbopp.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
data/skins/coala_redstripe.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
data/skins/coala_saddo.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
data/skins/coala_toptri.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
data/skins/coala_twinbop.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
data/skins/coala_twintri.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
data/skins/coala_warpaint.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
data/skins/coala_x_ninja.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
data/skins/santa_bluekitty.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
data/skins/santa_bluestripe.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
data/skins/santa_brownbear.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
data/skins/santa_cammo.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
data/skins/santa_cammostripes.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
data/skins/santa_coala.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
data/skins/santa_default.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
data/skins/santa_limekitty.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
data/skins/santa_pinky.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
data/skins/santa_redbopp.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
data/skins/santa_redstripe.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
data/skins/santa_saddo.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
data/skins/santa_toptri.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
data/skins/santa_twinbop.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
data/skins/santa_twintri.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
data/skins/santa_warpaint.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
|
@ -365,10 +365,9 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
|
|
||||||
void CMenus::RenderSettingsTee(CUIRect MainView)
|
void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
{
|
{
|
||||||
CUIRect Button, Label, Button2, Dummy, DummyLabel, SkinList, QuickSearch, QuickSearchClearButton;
|
CUIRect Button, Label, Button2, Dummy, DummyLabel, SkinList, QuickSearch, QuickSearchClearButton, SkinPrefix, SkinPrefixLabel;
|
||||||
|
|
||||||
bool CheckSettings = false;
|
static float s_ClSkinPrefix = 0.0f;
|
||||||
static int s_ClVanillaSkinsOnly = g_Config.m_ClVanillaSkinsOnly;
|
|
||||||
|
|
||||||
static bool s_InitSkinlist = true;
|
static bool s_InitSkinlist = true;
|
||||||
MainView.HSplitTop(10.0f, 0, &MainView);
|
MainView.HSplitTop(10.0f, 0, &MainView);
|
||||||
|
@ -406,6 +405,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
MainView.HSplitTop(20.0f, &Label, &MainView);
|
MainView.HSplitTop(20.0f, &Label, &MainView);
|
||||||
Label.VSplitLeft(280.0f, &Label, &Dummy);
|
Label.VSplitLeft(280.0f, &Label, &Dummy);
|
||||||
Label.VSplitLeft(230.0f, &Label, 0);
|
Label.VSplitLeft(230.0f, &Label, 0);
|
||||||
|
Dummy.VSplitLeft(250.0f, &Dummy, &SkinPrefix);
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin"));
|
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin"));
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
|
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
|
||||||
|
@ -422,30 +422,20 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClVanillaSkinsOnly, Localize("Vanilla skins only"), g_Config.m_ClVanillaSkinsOnly, &DummyLabel))
|
if(DoButton_CheckBox(&g_Config.m_ClVanillaSkinsOnly, Localize("Vanilla skins only"), g_Config.m_ClVanillaSkinsOnly, &DummyLabel))
|
||||||
{
|
{
|
||||||
g_Config.m_ClVanillaSkinsOnly ^= 1;
|
g_Config.m_ClVanillaSkinsOnly ^= 1;
|
||||||
CheckSettings = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
|
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClKittySkins, Localize("Kitty skins (DDCat)"), g_Config.m_ClKittySkins, &DummyLabel))
|
if (DoButton_CheckBox(&g_Config.m_ClFatSkins, Localize("Fat skins (DDFat)"), g_Config.m_ClFatSkins, &DummyLabel))
|
||||||
{
|
|
||||||
g_Config.m_ClKittySkins ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
|
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClFatSkins, Localize("Fat skins (DDFat)"), g_Config.m_ClFatSkins, &DummyLabel))
|
|
||||||
{
|
{
|
||||||
g_Config.m_ClFatSkins ^= 1;
|
g_Config.m_ClFatSkins ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CheckSettings)
|
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
|
||||||
{
|
UI()->DoLabelScaled(&SkinPrefixLabel, Localize("Skin prefix (e.g. kitty, coala, santa)"), 14.0f, -1);
|
||||||
if(s_ClVanillaSkinsOnly == g_Config.m_ClVanillaSkinsOnly)
|
|
||||||
m_NeedRestartSkins = false;
|
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
|
||||||
else
|
DoEditBox(g_Config.m_ClSkinPrefix, &SkinPrefixLabel, g_Config.m_ClSkinPrefix, sizeof(g_Config.m_ClSkinPrefix), 14.0f, &s_ClSkinPrefix);
|
||||||
m_NeedRestartSkins = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
|
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
|
||||||
|
|
||||||
|
|
|
@ -11,39 +11,40 @@
|
||||||
|
|
||||||
#include "skins.h"
|
#include "skins.h"
|
||||||
|
|
||||||
static const char* s_aaVanillaSkins[] = {"bluekitty.png", "bluestripe.png", "brownbear.png",
|
static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear",
|
||||||
"cammo.png", "cammostripes.png", "coala.png", "default.png", "limekitty.png",
|
"cammo", "cammostripes", "coala", "default", "limekitty",
|
||||||
"pinky.png", "redbopp.png", "redstripe.png", "saddo.png", "toptri.png",
|
"pinky", "redbopp", "redstripe", "saddo", "toptri",
|
||||||
"twinbop.png", "twintri.png", "warpaint.png", "x_ninja.png"};
|
"twinbop", "twintri", "warpaint", "x_ninja"};
|
||||||
|
|
||||||
|
static bool IsVanillaSkin(const char *pName)
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < sizeof(VANILLA_SKINS) / sizeof(VANILLA_SKINS[0]); i++)
|
||||||
|
{
|
||||||
|
if(str_comp(pName, VANILLA_SKINS[i]) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
|
int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||||
{
|
{
|
||||||
if(g_Config.m_ClVanillaSkinsOnly)
|
|
||||||
{
|
|
||||||
bool Found = false;
|
|
||||||
for(unsigned int i = 0; i < sizeof(s_aaVanillaSkins) / sizeof(s_aaVanillaSkins[0]); i++)
|
|
||||||
{
|
|
||||||
if(str_comp(pName, s_aaVanillaSkins[i]) == 0)
|
|
||||||
{
|
|
||||||
Found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!Found)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSkins *pSelf = (CSkins *)pUser;
|
CSkins *pSelf = (CSkins *)pUser;
|
||||||
|
|
||||||
int l = str_length(pName);
|
int l = str_length(pName);
|
||||||
if(l < 4 || IsDir || str_comp(pName+l-4, ".png") != 0)
|
if(l < 4 || IsDir || str_comp(pName+l-4, ".png") != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
char aFilenameWithoutPng[128];
|
||||||
|
str_copy(aFilenameWithoutPng, pName, sizeof(aFilenameWithoutPng));
|
||||||
|
aFilenameWithoutPng[str_length(aFilenameWithoutPng) - 4] = 0;
|
||||||
|
|
||||||
// Don't add duplicate skins (one from user's config directory, other from
|
// Don't add duplicate skins (one from user's config directory, other from
|
||||||
// client itself)
|
// client itself)
|
||||||
for(int i = 0; i < pSelf->Num(); i++)
|
for(int i = 0; i < pSelf->Num(); i++)
|
||||||
{
|
{
|
||||||
const char* pExName = pSelf->Get(i)->m_aName;
|
const char *pExName = pSelf->Get(i)->m_aName;
|
||||||
if(str_comp_num(pExName, pName, l-4) == 0 && str_length(pExName) == l-4)
|
if(str_comp_num(pExName, pName, l-4) == 0 && str_length(pExName) == l-4)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -174,27 +175,39 @@ const CSkins::CSkin *CSkins::Get(int Index)
|
||||||
return &m_aSkins[max(0, Index%m_aSkins.size())];
|
return &m_aSkins[max(0, Index%m_aSkins.size())];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSkins::Find(const char *pName)
|
int CSkins::Find(const char *pName) const
|
||||||
{
|
{
|
||||||
char aBuf[24];
|
if(g_Config.m_ClSkinPrefix[0])
|
||||||
if(g_Config.m_ClKittySkins)
|
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < sizeof(s_aaVanillaSkins) / sizeof(s_aaVanillaSkins[0]); i++)
|
char aBuf[64];
|
||||||
|
str_format(aBuf, sizeof(aBuf), "%s_%s", g_Config.m_ClSkinPrefix, pName);
|
||||||
|
// If we find something, use it, otherwise fall back to normal
|
||||||
|
// skins.
|
||||||
|
int Result = FindImpl(aBuf);
|
||||||
|
if(Result != -1)
|
||||||
{
|
{
|
||||||
// index 0 and 7 are bluekitty and limekitty
|
return Result;
|
||||||
if(i != 0 && i != 7 && str_comp_num(pName, s_aaVanillaSkins[i], str_length(s_aaVanillaSkins[i])-4) == 0)
|
|
||||||
{
|
|
||||||
str_format(aBuf, sizeof(aBuf), "kitty_%s", pName);
|
|
||||||
pName = aBuf;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return FindImpl(pName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSkins::FindImpl(const char *pName) const
|
||||||
|
{
|
||||||
for(int i = 0; i < m_aSkins.size(); i++)
|
for(int i = 0; i < m_aSkins.size(); i++)
|
||||||
{
|
{
|
||||||
if(str_comp(m_aSkins[i].m_aName, pName) == 0)
|
if(str_comp(m_aSkins[i].m_aName, pName) == 0)
|
||||||
return i;
|
{
|
||||||
|
if(g_Config.m_ClVanillaSkinsOnly && !IsVanillaSkin(m_aSkins[i].m_aName))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@ public:
|
||||||
vec4 GetColorV4(int v);
|
vec4 GetColorV4(int v);
|
||||||
int Num();
|
int Num();
|
||||||
const CSkin *Get(int Index);
|
const CSkin *Get(int Index);
|
||||||
int Find(const char *pName);
|
int Find(const char *pName) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sorted_array<CSkin> m_aSkins;
|
sorted_array<CSkin> m_aSkins;
|
||||||
|
|
||||||
|
int FindImpl(const char *pName) const;
|
||||||
static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser);
|
static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ void CAutoMapper::Load(const char* pTileName)
|
||||||
CIndexRule NewIndexRule;
|
CIndexRule NewIndexRule;
|
||||||
NewIndexRule.m_ID = ID;
|
NewIndexRule.m_ID = ID;
|
||||||
NewIndexRule.m_Flag = 0;
|
NewIndexRule.m_Flag = 0;
|
||||||
NewIndexRule.m_RandomValue = 0;
|
NewIndexRule.m_RandomProbability = 1.0;
|
||||||
NewIndexRule.m_DefaultRule = true;
|
NewIndexRule.m_DefaultRule = true;
|
||||||
|
|
||||||
if(str_length(aOrientation1) > 0)
|
if(str_length(aOrientation1) > 0)
|
||||||
|
@ -221,7 +221,17 @@ void CAutoMapper::Load(const char* pTileName)
|
||||||
}
|
}
|
||||||
else if(!str_comp_num(pLine, "Random", 6) && pCurrentIndex)
|
else if(!str_comp_num(pLine, "Random", 6) && pCurrentIndex)
|
||||||
{
|
{
|
||||||
sscanf(pLine, "Random %d", &pCurrentIndex->m_RandomValue);
|
float Value;
|
||||||
|
char Specifier = ' ';
|
||||||
|
sscanf(pLine, "Random %f%c", &Value, &Specifier);
|
||||||
|
if(Specifier == '%')
|
||||||
|
{
|
||||||
|
pCurrentIndex->m_RandomProbability = Value / 100.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pCurrentIndex->m_RandomProbability = 1.0 / Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(!str_comp_num(pLine, "NoDefaultRule", 13) && pCurrentIndex)
|
else if(!str_comp_num(pLine, "NoDefaultRule", 13) && pCurrentIndex)
|
||||||
{
|
{
|
||||||
|
@ -354,7 +364,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RespectRules &&
|
if(RespectRules &&
|
||||||
(pRun->m_aIndexRules[i].m_RandomValue <= 1 || (int)((float)rand() / ((float)RAND_MAX + 1) * pRun->m_aIndexRules[i].m_RandomValue) == 1))
|
(pRun->m_aIndexRules[i].m_RandomProbability >= 1.0 || (float)rand() / ((float)RAND_MAX + 1) < pRun->m_aIndexRules[i].m_RandomProbability))
|
||||||
{
|
{
|
||||||
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
||||||
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag == -1 ? 0 : pRun->m_aIndexRules[i].m_Flag;
|
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag == -1 ? 0 : pRun->m_aIndexRules[i].m_Flag;
|
||||||
|
@ -423,7 +433,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RespectRules &&
|
if(RespectRules &&
|
||||||
(pRun->m_aIndexRules[i].m_RandomValue <= 1 || (int)((float)rand() / ((float)RAND_MAX + 1) * pRun->m_aIndexRules[i].m_RandomValue) == 1))
|
(pRun->m_aIndexRules[i].m_RandomProbability >= 1.0 || (float)rand() / ((float)RAND_MAX + 1) < pRun->m_aIndexRules[i].m_RandomProbability))
|
||||||
{
|
{
|
||||||
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
||||||
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag == -1 ? 0 : pRun->m_aIndexRules[i].m_Flag;
|
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag == -1 ? 0 : pRun->m_aIndexRules[i].m_Flag;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CAutoMapper
|
||||||
int m_ID;
|
int m_ID;
|
||||||
array<CPosRule> m_aRules;
|
array<CPosRule> m_aRules;
|
||||||
int m_Flag;
|
int m_Flag;
|
||||||
int m_RandomValue;
|
float m_RandomProbability;
|
||||||
bool m_DefaultRule;
|
bool m_DefaultRule;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ MACRO_CONFIG_INT(ClPlayerUseCustomColor, player_use_custom_color, 0, 0, 1, CFGFL
|
||||||
MACRO_CONFIG_INT(ClPlayerColorBody, player_color_body, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player body color")
|
MACRO_CONFIG_INT(ClPlayerColorBody, player_color_body, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player body color")
|
||||||
MACRO_CONFIG_INT(ClPlayerColorFeet, player_color_feet, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player feet color")
|
MACRO_CONFIG_INT(ClPlayerColorFeet, player_color_feet, 65408, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player feet color")
|
||||||
MACRO_CONFIG_STR(ClPlayerSkin, player_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player skin")
|
MACRO_CONFIG_STR(ClPlayerSkin, player_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player skin")
|
||||||
MACRO_CONFIG_INT(ClKittySkins, cl_kitty_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable kitty skins instead of vanilla skins")
|
MACRO_CONFIG_STR(ClSkinPrefix, cl_skin_prefix, 100, "", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Replace the skins by skins with this prefix (e.g. kitty, coala, santa)")
|
||||||
MACRO_CONFIG_INT(ClFatSkins, cl_fat_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable fat skins")
|
MACRO_CONFIG_INT(ClFatSkins, cl_fat_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable fat skins")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(UiPage, ui_page, 9, 0, 11, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page")
|
MACRO_CONFIG_INT(UiPage, ui_page, 9, 0, 11, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page")
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#ifndef GAME_VERSION_H
|
#ifndef GAME_VERSION_H
|
||||||
#define GAME_VERSION_H
|
#define GAME_VERSION_H
|
||||||
#define GAME_VERSION "0.6.4, 11.2.1"
|
#define GAME_VERSION "0.6.4, 11.3"
|
||||||
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
|
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
|
||||||
#define GAME_RELEASE_VERSION "11.2.1"
|
#define GAME_RELEASE_VERSION "11.3"
|
||||||
#define CLIENT_VERSIONNR 11021
|
#define CLIENT_VERSIONNR 11030
|
||||||
extern const char *GIT_SHORTREV_HASH;
|
extern const char *GIT_SHORTREV_HASH;
|
||||||
#endif
|
#endif
|
||||||
|
|