mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 09:12:19 +00:00
Compare commits
5 commits
2ab6820b05
...
b9ebcd9ebb
Author | SHA1 | Date | |
---|---|---|---|
b9ebcd9ebb | |||
5a4d8e26e6 | |||
ffabdee953 | |||
7e1881263d | |||
34871095dc |
|
@ -17,7 +17,7 @@ def parse_config_variables(lines):
|
|||
return matches
|
||||
|
||||
def generate_regex(variable_code):
|
||||
return fr'(g_Config\.m_{variable_code}|Config\(\)->m_{variable_code}|m_pConfig->m_{variable_code})'
|
||||
return fr'(g_Config\.m_{variable_code}\b|Config\(\)->m_{variable_code}\b|m_pConfig->m_{variable_code}\b)'
|
||||
|
||||
def find_config_variables(config_variables):
|
||||
"""Returns the config variables which were not found."""
|
||||
|
|
|
@ -313,7 +313,6 @@ void CMenus::RenderSettingsTeeCustom7(CUIRect MainView)
|
|||
if(DoButton_Menu(&s_RandomSkinButton, s_apDice[s_CurrentDie], 0, &RandomSkinButton, nullptr, IGraphics::CORNER_ALL, 5.0f, -0.2f))
|
||||
{
|
||||
m_pClient->m_Skins7.RandomizeSkin(m_Dummy);
|
||||
Config()->m_ClPlayer7Skin[0] = '\0';
|
||||
SetNeedSendInfo();
|
||||
s_CurrentDie = rand() % std::size(s_apDice);
|
||||
}
|
||||
|
@ -356,7 +355,7 @@ void CMenus::RenderSkinSelection7(CUIRect MainView)
|
|||
const CSkins7::CSkin *pSkin = s_vpSkinList[i];
|
||||
if(pSkin == nullptr)
|
||||
continue;
|
||||
if(!str_comp(pSkin->m_aName, Config()->m_ClPlayer7Skin))
|
||||
if(!str_comp(pSkin->m_aName, CSkins7::ms_apSkinNameVariables[m_Dummy]))
|
||||
{
|
||||
m_pSelectedSkin = pSkin;
|
||||
s_OldSelected = i;
|
||||
|
@ -401,7 +400,7 @@ void CMenus::RenderSkinSelection7(CUIRect MainView)
|
|||
{
|
||||
s_LastSelectionTime = Client()->GlobalTime();
|
||||
m_pSelectedSkin = s_vpSkinList[NewSelected];
|
||||
str_copy(Config()->m_ClPlayer7Skin, m_pSelectedSkin->m_aName);
|
||||
str_copy(CSkins7::ms_apSkinNameVariables[m_Dummy], m_pSelectedSkin->m_aName, protocol7::MAX_SKIN_ARRAY_SIZE);
|
||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||
{
|
||||
str_copy(CSkins7::ms_apSkinVariables[(int)m_Dummy][Part], m_pSelectedSkin->m_apParts[Part]->m_aName, protocol7::MAX_SKIN_ARRAY_SIZE);
|
||||
|
@ -492,7 +491,7 @@ void CMenus::RenderSkinPartSelection7(CUIRect MainView)
|
|||
if(NewSelected != -1 && NewSelected != s_OldSelected)
|
||||
{
|
||||
str_copy(CSkins7::ms_apSkinVariables[(int)m_Dummy][m_TeePartSelected], s_paList[m_TeePartSelected][NewSelected]->m_aName, protocol7::MAX_SKIN_ARRAY_SIZE);
|
||||
Config()->m_ClPlayer7Skin[0] = '\0';
|
||||
CSkins7::ms_apSkinNameVariables[m_Dummy][0] = '\0';
|
||||
SetNeedSendInfo();
|
||||
}
|
||||
s_OldSelected = NewSelected;
|
||||
|
|
|
@ -23,6 +23,7 @@ const char *const CSkins7::ms_apSkinPartNames[protocol7::NUM_SKINPARTS] = {"body
|
|||
const char *const CSkins7::ms_apSkinPartNamesLocalized[protocol7::NUM_SKINPARTS] = {Localizable("Body", "skins"), Localizable("Marking", "skins"), Localizable("Decoration", "skins"), Localizable("Hands", "skins"), Localizable("Feet", "skins"), Localizable("Eyes", "skins")};
|
||||
const char *const CSkins7::ms_apColorComponents[NUM_COLOR_COMPONENTS] = {"hue", "sat", "lgt", "alp"};
|
||||
|
||||
char *CSkins7::ms_apSkinNameVariables[NUM_DUMMIES] = {0};
|
||||
char *CSkins7::ms_apSkinVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS] = {{0}};
|
||||
int *CSkins7::ms_apUCCVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS] = {{0}};
|
||||
int unsigned *CSkins7::ms_apColorVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS] = {{0}};
|
||||
|
@ -231,6 +232,7 @@ int CSkins7::GetInitAmount() const
|
|||
void CSkins7::OnInit()
|
||||
{
|
||||
int Dummy = 0;
|
||||
ms_apSkinNameVariables[Dummy] = Config()->m_ClPlayer7Skin;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_BODY] = Config()->m_ClPlayer7SkinBody;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_MARKING] = Config()->m_ClPlayer7SkinMarking;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_DECORATION] = Config()->m_ClPlayer7SkinDecoration;
|
||||
|
@ -251,6 +253,7 @@ void CSkins7::OnInit()
|
|||
ms_apColorVariables[Dummy][protocol7::SKINPART_EYES] = &Config()->m_ClPlayer7ColorEyes;
|
||||
|
||||
Dummy = 1;
|
||||
ms_apSkinNameVariables[Dummy] = Config()->m_ClDummy7Skin;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_BODY] = Config()->m_ClDummy7SkinBody;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_MARKING] = Config()->m_ClDummy7SkinMarking;
|
||||
ms_apSkinVariables[Dummy][protocol7::SKINPART_DECORATION] = Config()->m_ClDummy7SkinDecoration;
|
||||
|
@ -463,17 +466,19 @@ void CSkins7::RandomizeSkin(int Dummy)
|
|||
if(Part == protocol7::SKINPART_MARKING)
|
||||
Alp = rand() % 255;
|
||||
int ColorVariable = (Alp << 24) | (Hue << 16) | (Sat << 8) | Lgt;
|
||||
*CSkins7::ms_apUCCVariables[Dummy][Part] = true;
|
||||
*CSkins7::ms_apColorVariables[Dummy][Part] = ColorVariable;
|
||||
*ms_apUCCVariables[Dummy][Part] = true;
|
||||
*ms_apColorVariables[Dummy][Part] = ColorVariable;
|
||||
}
|
||||
|
||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||
{
|
||||
const CSkins7::CSkinPart *pSkinPart = GetSkinPart(Part, rand() % NumSkinPart(Part));
|
||||
while(pSkinPart->m_Flags & CSkins7::SKINFLAG_SPECIAL)
|
||||
const CSkinPart *pSkinPart = GetSkinPart(Part, rand() % NumSkinPart(Part));
|
||||
while(pSkinPart->m_Flags & SKINFLAG_SPECIAL)
|
||||
pSkinPart = GetSkinPart(Part, rand() % NumSkinPart(Part));
|
||||
mem_copy(CSkins7::ms_apSkinVariables[Dummy][Part], pSkinPart->m_aName, protocol7::MAX_SKIN_ARRAY_SIZE);
|
||||
str_copy(ms_apSkinVariables[Dummy][Part], pSkinPart->m_aName, protocol7::MAX_SKIN_ARRAY_SIZE);
|
||||
}
|
||||
|
||||
ms_apSkinNameVariables[Dummy][0] = '\0';
|
||||
}
|
||||
|
||||
ColorRGBA CSkins7::GetColor(int Value, bool UseAlpha) const
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
static const char *const ms_apSkinPartNamesLocalized[protocol7::NUM_SKINPARTS];
|
||||
static const char *const ms_apColorComponents[NUM_COLOR_COMPONENTS];
|
||||
|
||||
static char *ms_apSkinNameVariables[NUM_DUMMIES];
|
||||
static char *ms_apSkinVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS];
|
||||
static int *ms_apUCCVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS]; // use custom color
|
||||
static unsigned int *ms_apColorVariables[NUM_DUMMIES][protocol7::NUM_SKINPARTS];
|
||||
|
|
|
@ -376,6 +376,37 @@ void CGameContext::ConToggleSpec(IConsole::IResult *pResult, void *pUserData)
|
|||
ToggleSpecPause(pResult, pUserData, g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED);
|
||||
}
|
||||
|
||||
void CGameContext::ConUnspec(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
if(!CheckClientId(pResult->m_ClientId))
|
||||
return;
|
||||
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientId];
|
||||
if(!pPlayer)
|
||||
return;
|
||||
|
||||
int PauseState = pPlayer->IsPaused();
|
||||
int PauseType = g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED;
|
||||
if(PauseState > 0)
|
||||
{
|
||||
IServer *pServ = pSelf->Server();
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "You are force-paused for %d seconds.", (PauseState - pServ->Tick()) / pServ->TickSpeed());
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", aBuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(-PauseState != CPlayer::PAUSE_NONE && PauseType != CPlayer::PAUSE_NONE)
|
||||
{
|
||||
pPlayer->Pause(CPlayer::PAUSE_NONE, false);
|
||||
|
||||
if(pPlayer->m_SpectatorId != pResult->m_ClientId)
|
||||
pPlayer->SpectateFreeView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
ToggleSpecPauseVoted(pResult, pUserData, g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED);
|
||||
|
|
|
@ -3747,6 +3747,7 @@ void CGameContext::RegisterChatCommands()
|
|||
Console()->Register("converse", "r[message]", CFGFLAG_CHAT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, ConConverse, this, "Converse with the last person you whispered to (private message)");
|
||||
Console()->Register("pause", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTogglePause, this, "Toggles pause");
|
||||
Console()->Register("spec", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConToggleSpec, this, "Toggles spec (if not available behaves as /pause)");
|
||||
Console()->Register("unspec", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConUnspec, this, "Stops spectating the current player and returns to free view mode");
|
||||
Console()->Register("pausevoted", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTogglePauseVoted, this, "Toggles pause on the currently voted player");
|
||||
Console()->Register("specvoted", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConToggleSpecVoted, this, "Toggles spec on the currently voted player");
|
||||
Console()->Register("dnd", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, ConDND, this, "Toggle Do Not Disturb (no chat and server messages)");
|
||||
|
|
|
@ -426,6 +426,7 @@ private:
|
|||
static void ConTogglePause(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConTogglePauseVoted(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConToggleSpec(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConUnspec(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConForcePause(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
|
@ -867,6 +867,12 @@ void CPlayer::SpectatePlayerName(const char *pName)
|
|||
}
|
||||
}
|
||||
|
||||
void CPlayer::SpectateFreeView()
|
||||
{
|
||||
if(m_SpectatorId >= 0)
|
||||
m_SpectatorId = SPEC_FREEVIEW;
|
||||
}
|
||||
|
||||
void CPlayer::ProcessScoreResult(CScorePlayerResult &Result)
|
||||
{
|
||||
if(Result.m_Success) // SQL request was successful
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
const CCharacter *GetCharacter() const;
|
||||
|
||||
void SpectatePlayerName(const char *pName);
|
||||
void SpectateFreeView();
|
||||
|
||||
//---------------------------------------------------------
|
||||
// this is used for snapping so we know how we can clip the view for the player
|
||||
|
|
Loading…
Reference in a new issue