diff --git a/CMakeLists.txt b/CMakeLists.txt
index b26fa98fbab..3681fa5d6c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1847,6 +1847,9 @@ set(EXPECTED_DATA
skins7/x_ninja.json
skins7/xmas_hat.png
strong_weak.png
+ clienticons/duckicon.png
+ clienticons/kaizoicon.png
+ clienticons/license.txt
themes/auto.png
themes/autumn.png
themes/autumn_day.map
diff --git a/data/clienticons/duckicon.png b/data/clienticons/duckicon.png
new file mode 100644
index 00000000000..c75743dd4f8
Binary files /dev/null and b/data/clienticons/duckicon.png differ
diff --git a/data/clienticons/kaizoicon.png b/data/clienticons/kaizoicon.png
new file mode 100644
index 00000000000..9ab866d01cc
Binary files /dev/null and b/data/clienticons/kaizoicon.png differ
diff --git a/data/clienticons/license.txt b/data/clienticons/license.txt
new file mode 100644
index 00000000000..c155e79c806
--- /dev/null
+++ b/data/clienticons/license.txt
@@ -0,0 +1,5 @@
+Licenses for the files inside this folder:
+
+kaizoicon.png by +KZ, released under CC BY-SA 4.0
+
+duckicon.png by Pointer (license: CC BY 4.0)
diff --git a/datasrc/content.py b/datasrc/content.py
index 9e68d861a16..537cf9425de 100644
--- a/datasrc/content.py
+++ b/datasrc/content.py
@@ -492,6 +492,22 @@ def FileList(fmt, num):
container.sprites.Add(Sprite("part_pulley", set_extras, 4,0,1,1))
container.sprites.Add(Sprite("part_hectagon", set_extras, 6,0,2,2))
+# DuckClient Client Icons
+
+# Kaizo Client
+kz_image_kaizoicon= Image("kz_kaizoicon", "clienticons/kaizoicon.png")
+container.images.Add(kz_image_kaizoicon)
+set_kz_kaizoicon = SpriteSet("kz_kaizoicon", kz_image_kaizoicon, 1, 1)
+container.spritesets.Add(set_kz_kaizoicon)
+container.sprites.Add(Sprite("kz_kaizoicon", set_kz_kaizoicon, 0, 0, 1, 1))
+
+# DuckClient
+duck_image_duckicon= Image("duck_duckicon", "clienticons/duckicon.png")
+container.images.Add(duck_image_duckicon)
+set_duck_duckicon = SpriteSet("duck_duckicon", duck_image_duckicon, 1, 1)
+container.spritesets.Add(set_duck_duckicon)
+container.sprites.Add(Sprite("duck_duckicon", set_duck_duckicon, 0, 0, 1, 1))
+
anim = Animation("base")
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
anim.back_foot.frames.Add(AnimKeyframe(0, 0, 10, 0))
diff --git a/src/engine/external/ddnet-custom-clients/README.md b/src/engine/external/ddnet-custom-clients/README.md
new file mode 100644
index 00000000000..db9e82e4058
--- /dev/null
+++ b/src/engine/external/ddnet-custom-clients/README.md
@@ -0,0 +1,17 @@
+# ddnet-custom-clients
+Custom clients IDs for DDNet so custom clients can identify which client is each player using by checking invalid country flags
+
+First implemented in Kaizo Network, but it can also be shared among other clients
+
+Clients using this:
+
+* [Kaizo Network](https://github.com/M0REKZ/kaizo-network)
+* [Chillerbot-UX](https://github.com/chillerbot/chillerbot-ux)
+
+# Adding a new client
+
+When adding a new client ID, make sure the ID number is greater than the ID for Kaizo Network, this way we avoid conflicts with possible future DDNet country flag additions.
+
+# How to use
+
+TODO
diff --git a/src/engine/external/ddnet-custom-clients/custom_clients_ids.h b/src/engine/external/ddnet-custom-clients/custom_clients_ids.h
new file mode 100644
index 00000000000..75eee836d36
--- /dev/null
+++ b/src/engine/external/ddnet-custom-clients/custom_clients_ids.h
@@ -0,0 +1,30 @@
+// This file can be included several times.
+#pragma once
+
+// Copyright (C) BenjamÃn Gajardo (also known as +KZ)
+
+enum
+{
+ // Custom client IDs (Country flag method)
+ CUSTOM_CLIENT_ID_KAIZO_NETWORK = 16777216,
+ CUSTOM_CLIENT_ID_PDUCKCLIENT = 16777217,
+ CUSTOM_CLIENT_ID_GAMER_07 = 16777218, //0.7 Client Reserved
+ CUSTOM_CLIENT_ID_ZILLYWOODS_07 = 16777219, //0.7 Client Reserved
+ CUSTOM_CLIENT_ID_FCLIENT_07 = 16777220, //0.7 Client Reserved
+ CUSTOM_CLIENT_ID_CHILLERBOTUX = 33554432,
+
+ //Range is big enough (16777215 possible IDs in between)
+ MINIMUM_CUSTOM_CLIENT_ID = CUSTOM_CLIENT_ID_KAIZO_NETWORK,
+ MAXIMUM_CUSTOM_CLIENT_ID = CUSTOM_CLIENT_ID_CHILLERBOTUX,
+
+ // Custom client IDs (Skin Color Method)
+ // Range is small (510 possible IDs)
+
+ // Body
+ CCID_COLOR_BODY_KAIZO_CLIENT = 1,
+ CCID_COLOR_BODY_PDUCKCLIENT = 2,
+ CCID_COLOR_BODY_CHILLERBOTUX = 3,
+
+ // Feet
+ // (Empty...)
+};
diff --git a/src/engine/external/ddnet-custom-clients/license.txt b/src/engine/external/ddnet-custom-clients/license.txt
new file mode 100644
index 00000000000..0a041280bd0
--- /dev/null
+++ b/src/engine/external/ddnet-custom-clients/license.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h
index 6f0c4c60e1b..225fbc998cf 100644
--- a/src/engine/shared/config_variables.h
+++ b/src/engine/shared/config_variables.h
@@ -756,6 +756,10 @@ MACRO_CONFIG_INT(ClScoreboardStyle, cl_scoreboard_style, 0, 0, 10, CFGFLAG_CLIEN
MACRO_CONFIG_INT(ClScoreboardShorten, cl_scoreboard_shorten, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Shorten the scoreboard if there are not so many players")
MACRO_CONFIG_INT(ClStatboardWeaponsStyle, cl_statboard_weapons_style, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Change the statboard weapons style to a bar")
+// Client identify (from Kaizo Network)
+MACRO_CONFIG_INT(ClSendClientType, cl_send_client_type, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Let know other clients that we are DuckClient")
+MACRO_CONFIG_INT(ClShowClientType, cl_show_client_type, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Try to identify and show other players clients as icons")
+
MACRO_CONFIG_INT(ClWeatherSnow, cl_weather_snow, 0, 0, 15, CFGFLAG_CLIENT, "Whether to spawn snow")
MACRO_CONFIG_INT(ClUIWidth, cl_ui_width, 600, 400, 1000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Size of UI (low values may break some UI, might need restart)")
MACRO_CONFIG_COL(UiColorButtons, ui_color_buttons, 0xFFFFFFFF, CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_COLALPHA, "Interface buttons color") // 160 70 175 228 hasalpha
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index 2cfabd67149..c0f013984b4 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -400,6 +400,23 @@ void CMenus::RenderSettingsDuckClient(CUIRect MainView)
str_copy(g_Config.m_TcCustomCommunitiesUrl, "https://raw.githubusercontent.com/SollyBunny/ddnet-custom-communities/refs/heads/main/custom-communities-ddnet-info.json");
}
}
+
+ // From Kaizo client
+ {
+ // headline
+ Menu.HSplitTop(30.0f, &Label, &Menu);
+ Ui()->DoLabel(&Label, Localize("From Kaizo Client"), 20.0f, TEXTALIGN_ML);
+
+ Menu.HSplitTop(VerticalSpacing, nullptr, &Menu);
+ Menu.HSplitTop(20.0f, &Button, &Menu);
+ if(DoButton_CheckBox(&g_Config.m_ClSendClientType, Localize("Send Client Type"), g_Config.m_ClSendClientType, &Button))
+ g_Config.m_ClSendClientType ^= 1;
+
+ Menu.HSplitTop(VerticalSpacing, nullptr, &Menu);
+ Menu.HSplitTop(20.0f, &Button, &Menu);
+ if(DoButton_CheckBox(&g_Config.m_ClShowClientType, Localize("Show Client Types"), g_Config.m_ClShowClientType, &Button))
+ g_Config.m_ClShowClientType ^= 1;
+ }
}
void CMenus::SetNeedSendInfo()
diff --git a/src/game/client/components/nameplates.cpp b/src/game/client/components/nameplates.cpp
index 8803bc38c40..153c54fed43 100644
--- a/src/game/client/components/nameplates.cpp
+++ b/src/game/client/components/nameplates.cpp
@@ -14,6 +14,8 @@
#include
#include
+#include //TClient
+
static constexpr float DEFAULT_PADDING = 5.0f;
// Part Types
@@ -441,6 +443,46 @@ class CNamePlatePartHookStrongWeakId : public CNamePlatePartText
CNamePlatePartText(This) {}
};
+class CNamePlatePartCustomClient : public CNamePlatePartSprite
+{
+public:
+ void Update(CGameClient &This, const CNamePlateData &Data) override
+ {
+ if(!g_Config.m_ClShowClientType || Data.m_ClientId == This.m_Snap.m_LocalClientId)
+ {
+ m_Visible = false;
+ return;
+ }
+
+ if(This.m_aClients[Data.m_ClientId].m_CustomClient == CUSTOM_CLIENT_ID_KAIZO_NETWORK)
+ {
+ m_Texture = g_pData->m_aImages[IMAGE_KZ_KAIZOICON].m_Id;
+ m_Sprite = SPRITE_KZ_KAIZOICON;
+ m_Visible = true;
+ }
+ else if(This.m_aClients[Data.m_ClientId].m_CustomClient == CUSTOM_CLIENT_ID_PDUCKCLIENT)
+ {
+ m_Texture = g_pData->m_aImages[IMAGE_DUCK_DUCKICON].m_Id;
+ m_Sprite = SPRITE_DUCK_DUCKICON;
+ m_Visible = true;
+ }
+ else
+ {
+ m_Visible = false;
+ }
+ m_Color.a = Data.m_Color.a;
+ }
+
+ CNamePlatePartCustomClient(CGameClient &This) :
+ CNamePlatePartSprite(This)
+ {
+ m_Texture = g_pData->m_aImages[IMAGE_KZ_KAIZOICON].m_Id;
+ m_Padding = vec2(0.0f, 0.0f);
+ m_Sprite = SPRITE_KZ_KAIZOICON;
+ m_Size = vec2(20 + DEFAULT_PADDING, 20 + DEFAULT_PADDING);
+ }
+};
+
// Name Plates
class CNamePlate
@@ -496,6 +538,8 @@ class CNamePlate
AddPart(This);
AddPart(This);
+
+ AddPart(This);
}
public:
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index b96f343e2ef..28d7102f306 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -86,6 +86,8 @@
#include
+#include
+
using namespace std::chrono_literals;
const char *CGameClient::Version() const { return GAME_VERSION; }
@@ -514,6 +516,8 @@ void CGameClient::OnUpdate()
{
pComponent->OnUpdate();
}
+
+ OnKZUpdate();
}
void CGameClient::OnDummySwap()
@@ -600,6 +604,7 @@ void CGameClient::OnConnected()
pComponent->OnMapLoad();
pComponent->OnReset();
}
+ OnKZReset();
ConfigManager()->ResetGameSettings();
LoadMapSettings();
@@ -728,6 +733,8 @@ void CGameClient::OnReset()
for(auto &pComponent : m_vpAll)
pComponent->OnReset();
+ OnKZReset();
+
Editor()->ResetMentions();
Editor()->ResetIngameMoved();
@@ -1251,6 +1258,7 @@ void CGameClient::OnStateChange(int NewState, int OldState)
// reset everything when not already connected (to keep gathered stuff)
if(NewState < IClient::STATE_ONLINE)
OnReset();
+ OnKZReset();
// then change the state
for(auto &pComponent : m_vpAll)
@@ -1723,6 +1731,7 @@ void CGameClient::OnNewSnapshot()
for(auto &Client : m_aClients)
{
Client.m_SpecCharPresent = false;
+ Client.m_ReceivedDDNetPlayerInfoInLastSnapshot = false;
}
// go through all the items in the snapshot and gather the info we want
@@ -1748,6 +1757,7 @@ void CGameClient::OnNewSnapshot()
}
IntsToStr(pInfo->m_aClan, std::size(pInfo->m_aClan), pClient->m_aClan, std::size(pClient->m_aClan));
pClient->m_Country = pInfo->m_Country;
+ HandleClientCountry(pClient->m_Country, ClientId); //+KZ
IntsToStr(pInfo->m_aSkin, std::size(pInfo->m_aSkin), pClient->m_aSkinName, std::size(pClient->m_aSkinName));
if(!CSkin::IsValidName(pClient->m_aSkinName) ||
@@ -1762,6 +1772,28 @@ void CGameClient::OnNewSnapshot()
if (g_Config.m_ClDuckFilter)
str_copy(pClient->m_aSkinName, "Scrubby Duck");
+
+ //identify kaizo
+ union
+ {
+ int c = 0;
+ unsigned char b[4];
+ } a;
+
+ a.c = pInfo->m_ColorBody;
+
+ if(a.b[3] == CCID_COLOR_BODY_KAIZO_CLIENT)
+ {
+ pClient->m_CustomClient = CUSTOM_CLIENT_ID_KAIZO_NETWORK;
+ }
+ else if(a.b[3] == CCID_COLOR_BODY_CHILLERBOTUX)
+ {
+ pClient->m_CustomClient = CUSTOM_CLIENT_ID_CHILLERBOTUX;
+ }
+ else if(a.b[3] == CCID_COLOR_BODY_PDUCKCLIENT)
+ {
+ pClient->m_CustomClient = CUSTOM_CLIENT_ID_PDUCKCLIENT;
+ }
}
}
else if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
@@ -1798,6 +1830,8 @@ void CGameClient::OnNewSnapshot()
}
else if(m_aStats[pInfo->m_ClientId].IsActive())
m_aStats[pInfo->m_ClientId].JoinSpec(Client()->GameTick(g_Config.m_ClDummy));
+
+ m_aClients[pInfo->m_ClientId].m_ReceivedDDNetPlayerInfoInLastSnapshot = true;
}
}
else if(Item.m_Type == NETOBJTYPE_DDNETPLAYER)
@@ -2079,6 +2113,11 @@ void CGameClient::OnNewSnapshot()
for(CClientData &Client : m_aClients)
{
Client.UpdateSkinInfo();
+
+ if(!Client.m_ReceivedDDNetPlayerInfoInLastSnapshot)
+ {
+ Client.m_CustomClient = 0;
+ }
}
// setup local pointers
@@ -3149,7 +3188,7 @@ void CGameClient::SendInfo(bool Start)
Msg.m_Country = g_Config.m_PlayerCountry;
Msg.m_pSkin = g_Config.m_ClPlayerSkin;
Msg.m_UseCustomColor = g_Config.m_ClPlayerUseCustomColor;
- Msg.m_ColorBody = g_Config.m_ClPlayerColorBody;
+ Msg.m_ColorBody = InsertCustomClientIdIntoSkinColor(g_Config.m_ClPlayerColorBody);
Msg.m_ColorFeet = g_Config.m_ClPlayerColorFeet;
CMsgPacker Packer(&Msg);
Msg.Pack(&Packer);
@@ -3164,7 +3203,7 @@ void CGameClient::SendInfo(bool Start)
Msg.m_Country = g_Config.m_PlayerCountry;
Msg.m_pSkin = g_Config.m_ClPlayerSkin;
Msg.m_UseCustomColor = g_Config.m_ClPlayerUseCustomColor;
- Msg.m_ColorBody = g_Config.m_ClPlayerColorBody;
+ Msg.m_ColorBody = InsertCustomClientIdIntoSkinColor(g_Config.m_ClPlayerColorBody);
Msg.m_ColorFeet = g_Config.m_ClPlayerColorFeet;
CMsgPacker Packer(&Msg);
Msg.Pack(&Packer);
@@ -3191,7 +3230,7 @@ void CGameClient::SendDummyInfo(bool Start)
Msg.m_Country = g_Config.m_ClDummyCountry;
Msg.m_pSkin = g_Config.m_ClDummySkin;
Msg.m_UseCustomColor = g_Config.m_ClDummyUseCustomColor;
- Msg.m_ColorBody = g_Config.m_ClDummyColorBody;
+ Msg.m_ColorBody = InsertCustomClientIdIntoSkinColor(g_Config.m_ClDummyColorBody);
Msg.m_ColorFeet = g_Config.m_ClDummyColorFeet;
CMsgPacker Packer(&Msg);
Msg.Pack(&Packer);
@@ -3206,7 +3245,7 @@ void CGameClient::SendDummyInfo(bool Start)
Msg.m_Country = g_Config.m_ClDummyCountry;
Msg.m_pSkin = g_Config.m_ClDummySkin;
Msg.m_UseCustomColor = g_Config.m_ClDummyUseCustomColor;
- Msg.m_ColorBody = g_Config.m_ClDummyColorBody;
+ Msg.m_ColorBody = InsertCustomClientIdIntoSkinColor(g_Config.m_ClDummyColorBody);
Msg.m_ColorFeet = g_Config.m_ClDummyColorFeet;
CMsgPacker Packer(&Msg);
Msg.Pack(&Packer);
@@ -5354,3 +5393,67 @@ int CGameClient::FindFirstMultiViewId()
}
return ClientId;
}
+
+void CGameClient::OnKZUpdate()
+{
+
+}
+
+void CGameClient::OnKZReset()
+{
+ for(auto &ClientData : m_aClients)
+ {
+ ClientData.KZReset();
+ }
+}
+
+void CGameClient::CClientData::KZReset()
+{
+ m_CustomClient = 0;
+}
+
+// function originally from Kaizo Network by +KZ, credit if used
+int CGameClient::InsertCustomClientIdIntoSkinColor(int Color)
+{
+ if(!g_Config.m_ClSendClientType)
+ {
+ return Color;
+ }
+
+ union
+ {
+ int c = 0;
+ unsigned char b[4];
+ } a;
+
+ a.c = Color;
+
+ //printf("color %d %d %d %d\n", a.b[0], a.b[1], a.b[2], a.b[3]);
+
+ //alpha is unused
+ a.b[3] = (unsigned char)CCID_COLOR_BODY_PDUCKCLIENT;
+ Color = a.c;
+
+ return Color;
+}
+
+// function originally from Kaizo Network by +KZ, credit if used
+bool CGameClient::IsCustomClientId(int Country)
+{
+ return (size_t)Country > m_CountryFlags.Num();
+}
+
+// code originally from Kaizo Network by +KZ, credit if used
+int CGameClient::HandleClientCountry(int Country, int ClientId)
+{
+ if(IsCustomClientId(Country)) //if it is a custom client id, set custom client id and keep country
+ {
+ if(!m_aClients[ClientId].m_CustomClient)
+ m_aClients[ClientId].m_CustomClient = Country;
+ return m_aClients[ClientId].m_Country;
+ }
+ else //otherwise, set country
+ {
+ return Country;
+ }
+}
diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h
index 47ff196c03f..74f866b1ad8 100644
--- a/src/game/client/gameclient.h
+++ b/src/game/client/gameclient.h
@@ -551,6 +551,11 @@ class CGameClient : public IGameClient
// 0.7 Skin
CSixup m_aSixup[NUM_DUMMIES];
+
+ int m_CustomClient = 0;
+ bool m_ReceivedDDNetPlayerInfoInLastSnapshot = false;
+
+ void KZReset();
};
CClientData m_aClients[MAX_CLIENTS];
@@ -937,6 +942,7 @@ class CGameClient : public IGameClient
void ResetMultiView();
int FindFirstMultiViewId();
+ void OnKZUpdate();
void CleanMultiViewId(int ClientId);
private:
@@ -1003,6 +1009,14 @@ class CGameClient : public IGameClient
};
SMultiView m_MultiView;
+
+public:
+ void OnKZReset();
+
+ int InsertCustomClientIdIntoSkinColor(int Color);
+ bool IsCustomClientId(int Country);
+ int HandleClientCountry(int Country, int ClientId);
+ int GetPredictedDummyId() { return m_PredictedDummyId; }
};
ColorRGBA CalculateNameColor(ColorHSLA TextColorHSL);