diff --git a/data/skins/coala_bluekitty.png b/data/skins/coala_bluekitty.png new file mode 100644 index 000000000..4cdf199cc Binary files /dev/null and b/data/skins/coala_bluekitty.png differ diff --git a/data/skins/coala_bluestripe.png b/data/skins/coala_bluestripe.png new file mode 100644 index 000000000..4b3f7032a Binary files /dev/null and b/data/skins/coala_bluestripe.png differ diff --git a/data/skins/coala_cammo.png b/data/skins/coala_cammo.png new file mode 100644 index 000000000..28aaf4812 Binary files /dev/null and b/data/skins/coala_cammo.png differ diff --git a/data/skins/coala_cammostripes.png b/data/skins/coala_cammostripes.png new file mode 100644 index 000000000..f0a415323 Binary files /dev/null and b/data/skins/coala_cammostripes.png differ diff --git a/data/skins/coala_default.png b/data/skins/coala_default.png new file mode 100644 index 000000000..56039405f Binary files /dev/null and b/data/skins/coala_default.png differ diff --git a/data/skins/coala_limekitty.png b/data/skins/coala_limekitty.png new file mode 100644 index 000000000..5c0c6c1a5 Binary files /dev/null and b/data/skins/coala_limekitty.png differ diff --git a/data/skins/coala_pinky.png b/data/skins/coala_pinky.png new file mode 100644 index 000000000..3da330444 Binary files /dev/null and b/data/skins/coala_pinky.png differ diff --git a/data/skins/coala_redbopp.png b/data/skins/coala_redbopp.png new file mode 100644 index 000000000..05366ce81 Binary files /dev/null and b/data/skins/coala_redbopp.png differ diff --git a/data/skins/coala_redstripe.png b/data/skins/coala_redstripe.png new file mode 100644 index 000000000..acb93c34d Binary files /dev/null and b/data/skins/coala_redstripe.png differ diff --git a/data/skins/coala_saddo.png b/data/skins/coala_saddo.png new file mode 100644 index 000000000..f7bc2b6d6 Binary files /dev/null and b/data/skins/coala_saddo.png differ diff --git a/data/skins/coala_toptri.png b/data/skins/coala_toptri.png new file mode 100644 index 000000000..b21353bfc Binary files /dev/null and b/data/skins/coala_toptri.png differ diff --git a/data/skins/coala_twinbop.png b/data/skins/coala_twinbop.png new file mode 100644 index 000000000..a5659b96f Binary files /dev/null and b/data/skins/coala_twinbop.png differ diff --git a/data/skins/coala_twintri.png b/data/skins/coala_twintri.png new file mode 100644 index 000000000..eb389b65f Binary files /dev/null and b/data/skins/coala_twintri.png differ diff --git a/data/skins/coala_warpaint.png b/data/skins/coala_warpaint.png new file mode 100644 index 000000000..1aeab2000 Binary files /dev/null and b/data/skins/coala_warpaint.png differ diff --git a/data/skins/coala_x_ninja.png b/data/skins/coala_x_ninja.png new file mode 100644 index 000000000..4e2b1703f Binary files /dev/null and b/data/skins/coala_x_ninja.png differ diff --git a/data/skins/santa_bluekitty.png b/data/skins/santa_bluekitty.png new file mode 100644 index 000000000..fe3067675 Binary files /dev/null and b/data/skins/santa_bluekitty.png differ diff --git a/data/skins/santa_bluestripe.png b/data/skins/santa_bluestripe.png new file mode 100644 index 000000000..e7d748d76 Binary files /dev/null and b/data/skins/santa_bluestripe.png differ diff --git a/data/skins/santa_brownbear.png b/data/skins/santa_brownbear.png new file mode 100644 index 000000000..9f5146ae1 Binary files /dev/null and b/data/skins/santa_brownbear.png differ diff --git a/data/skins/santa_cammo.png b/data/skins/santa_cammo.png new file mode 100644 index 000000000..a3966fb3f Binary files /dev/null and b/data/skins/santa_cammo.png differ diff --git a/data/skins/santa_cammostripes.png b/data/skins/santa_cammostripes.png new file mode 100644 index 000000000..5d6826702 Binary files /dev/null and b/data/skins/santa_cammostripes.png differ diff --git a/data/skins/santa_coala.png b/data/skins/santa_coala.png new file mode 100644 index 000000000..fbf026e21 Binary files /dev/null and b/data/skins/santa_coala.png differ diff --git a/data/skins/santa_default.png b/data/skins/santa_default.png new file mode 100644 index 000000000..f513a6175 Binary files /dev/null and b/data/skins/santa_default.png differ diff --git a/data/skins/santa_limekitty.png b/data/skins/santa_limekitty.png new file mode 100644 index 000000000..da048901f Binary files /dev/null and b/data/skins/santa_limekitty.png differ diff --git a/data/skins/santa_pinky.png b/data/skins/santa_pinky.png new file mode 100644 index 000000000..ced15eecd Binary files /dev/null and b/data/skins/santa_pinky.png differ diff --git a/data/skins/santa_redbopp.png b/data/skins/santa_redbopp.png new file mode 100644 index 000000000..0f5171b9c Binary files /dev/null and b/data/skins/santa_redbopp.png differ diff --git a/data/skins/santa_redstripe.png b/data/skins/santa_redstripe.png new file mode 100644 index 000000000..96cf4baa8 Binary files /dev/null and b/data/skins/santa_redstripe.png differ diff --git a/data/skins/santa_saddo.png b/data/skins/santa_saddo.png new file mode 100644 index 000000000..5f9c4ab28 Binary files /dev/null and b/data/skins/santa_saddo.png differ diff --git a/data/skins/santa_toptri.png b/data/skins/santa_toptri.png new file mode 100644 index 000000000..98ddf6967 Binary files /dev/null and b/data/skins/santa_toptri.png differ diff --git a/data/skins/santa_twinbop.png b/data/skins/santa_twinbop.png new file mode 100644 index 000000000..59ade0dce Binary files /dev/null and b/data/skins/santa_twinbop.png differ diff --git a/data/skins/santa_twintri.png b/data/skins/santa_twintri.png new file mode 100644 index 000000000..3752a44f4 Binary files /dev/null and b/data/skins/santa_twintri.png differ diff --git a/data/skins/santa_warpaint.png b/data/skins/santa_warpaint.png new file mode 100644 index 000000000..e47642749 Binary files /dev/null and b/data/skins/santa_warpaint.png differ diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index ac191c2c5..9ed63997e 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -365,10 +365,9 @@ void CMenus::RenderSettingsPlayer(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 int s_ClVanillaSkinsOnly = g_Config.m_ClVanillaSkinsOnly; + static float s_ClSkinPrefix = 0.0f; static bool s_InitSkinlist = true; MainView.HSplitTop(10.0f, 0, &MainView); @@ -406,6 +405,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) MainView.HSplitTop(20.0f, &Label, &MainView); Label.VSplitLeft(280.0f, &Label, &Dummy); Label.VSplitLeft(230.0f, &Label, 0); + Dummy.VSplitLeft(250.0f, &Dummy, &SkinPrefix); char aBuf[128]; str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin")); 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)) { g_Config.m_ClVanillaSkinsOnly ^= 1; - CheckSettings = true; } Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy); - if(DoButton_CheckBox(&g_Config.m_ClKittySkins, Localize("Kitty skins (DDCat)"), g_Config.m_ClKittySkins, &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)) + if (DoButton_CheckBox(&g_Config.m_ClFatSkins, Localize("Fat skins (DDFat)"), g_Config.m_ClFatSkins, &DummyLabel)) { g_Config.m_ClFatSkins ^= 1; } + + SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix); + UI()->DoLabelScaled(&SkinPrefixLabel, Localize("Skin prefix (e.g. kitty, coala, santa)"), 14.0f, -1); - if(CheckSettings) - { - if(s_ClVanillaSkinsOnly == g_Config.m_ClVanillaSkinsOnly) - m_NeedRestartSkins = false; - else - m_NeedRestartSkins = true; - } + SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix); + DoEditBox(g_Config.m_ClSkinPrefix, &SkinPrefixLabel, g_Config.m_ClSkinPrefix, sizeof(g_Config.m_ClSkinPrefix), 14.0f, &s_ClSkinPrefix); Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy); diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp index 7a1a1ca47..cd980e7aa 100644 --- a/src/game/client/components/skins.cpp +++ b/src/game/client/components/skins.cpp @@ -11,39 +11,40 @@ #include "skins.h" -static const char* s_aaVanillaSkins[] = {"bluekitty.png", "bluestripe.png", "brownbear.png", - "cammo.png", "cammostripes.png", "coala.png", "default.png", "limekitty.png", - "pinky.png", "redbopp.png", "redstripe.png", "saddo.png", "toptri.png", - "twinbop.png", "twintri.png", "warpaint.png", "x_ninja.png"}; +static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear", + "cammo", "cammostripes", "coala", "default", "limekitty", + "pinky", "redbopp", "redstripe", "saddo", "toptri", + "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) { - 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; int l = str_length(pName); if(l < 4 || IsDir || str_comp(pName+l-4, ".png") != 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 // client itself) 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) return 0; } @@ -174,27 +175,39 @@ const CSkins::CSkin *CSkins::Get(int Index) 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_ClKittySkins) + if(g_Config.m_ClSkinPrefix[0]) { - 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 - 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 Result; } } + return FindImpl(pName); +} + +int CSkins::FindImpl(const char *pName) const +{ for(int i = 0; i < m_aSkins.size(); i++) { 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; } diff --git a/src/game/client/components/skins.h b/src/game/client/components/skins.h index 519f45216..abdecca90 100644 --- a/src/game/client/components/skins.h +++ b/src/game/client/components/skins.h @@ -26,11 +26,12 @@ public: vec4 GetColorV4(int v); int Num(); const CSkin *Get(int Index); - int Find(const char *pName); + int Find(const char *pName) const; private: sorted_array m_aSkins; + int FindImpl(const char *pName) const; static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser); }; #endif diff --git a/src/game/editor/auto_map.cpp b/src/game/editor/auto_map.cpp index fa3bf5d41..a66dc74e6 100644 --- a/src/game/editor/auto_map.cpp +++ b/src/game/editor/auto_map.cpp @@ -73,7 +73,7 @@ void CAutoMapper::Load(const char* pTileName) CIndexRule NewIndexRule; NewIndexRule.m_ID = ID; NewIndexRule.m_Flag = 0; - NewIndexRule.m_RandomValue = 0; + NewIndexRule.m_RandomProbability = 1.0; NewIndexRule.m_DefaultRule = true; if(str_length(aOrientation1) > 0) @@ -221,7 +221,17 @@ void CAutoMapper::Load(const char* pTileName) } 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) { @@ -354,7 +364,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID) } 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_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 && - (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_Flags = pRun->m_aIndexRules[i].m_Flag == -1 ? 0 : pRun->m_aIndexRules[i].m_Flag; diff --git a/src/game/editor/auto_map.h b/src/game/editor/auto_map.h index 2ca70deff..610c1350a 100644 --- a/src/game/editor/auto_map.h +++ b/src/game/editor/auto_map.h @@ -31,7 +31,7 @@ class CAutoMapper int m_ID; array m_aRules; int m_Flag; - int m_RandomValue; + float m_RandomProbability; bool m_DefaultRule; }; diff --git a/src/game/variables.h b/src/game/variables.h index 7dd1e8549..6aaf4688c 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -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(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_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(UiPage, ui_page, 9, 0, 11, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page") diff --git a/src/game/version.h b/src/game/version.h index ee5b9adfd..b4b37dc95 100644 --- a/src/game/version.h +++ b/src/game/version.h @@ -2,9 +2,9 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #ifndef 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_RELEASE_VERSION "11.2.1" -#define CLIENT_VERSIONNR 11021 +#define GAME_RELEASE_VERSION "11.3" +#define CLIENT_VERSIONNR 11030 extern const char *GIT_SHORTREV_HASH; #endif