removed some magic values

This commit is contained in:
oy 2019-03-24 14:34:56 +01:00
parent e18524ec01
commit 4eb69a1fce
9 changed files with 26 additions and 26 deletions

View file

@ -45,6 +45,14 @@ enum
SPEC_FLAGRED, SPEC_FLAGRED,
SPEC_FLAGBLUE, SPEC_FLAGBLUE,
NUM_SPECMODES, NUM_SPECMODES,
SKINPART_BODY = 0,
SKINPART_MARKING,
SKINPART_DECORATION,
SKINPART_HANDS,
SKINPART_FEET,
SKINPART_EYES,
NUM_SKINPARTS,
}; };
''' '''

View file

@ -30,6 +30,6 @@ for filename in sys.argv[1:]:
hash = hashlib.md5(f).hexdigest().lower()[16:] hash = hashlib.md5(f).hexdigest().lower()[16:]
#TODO 0.8: improve nethash creation #TODO 0.8: improve nethash creation
if hash == "7dc99529e56a8ded": if hash == "7fed48e71cffe081":
hash = "802f1be60a05665f" hash = "802f1be60a05665f"
print('#define GAME_NETVERSION_HASH "%s"' % hash) print('#define GAME_NETVERSION_HASH "%s"' % hash)

View file

@ -744,7 +744,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
str_copy(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_pName, sizeof(m_aClients[pMsg->m_ClientID].m_aName)); str_copy(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_pName, sizeof(m_aClients[pMsg->m_ClientID].m_aName));
str_copy(m_aClients[pMsg->m_ClientID].m_aClan, pMsg->m_pClan, sizeof(m_aClients[pMsg->m_ClientID].m_aClan)); str_copy(m_aClients[pMsg->m_ClientID].m_aClan, pMsg->m_pClan, sizeof(m_aClients[pMsg->m_ClientID].m_aClan));
m_aClients[pMsg->m_ClientID].m_Country = pMsg->m_Country; m_aClients[pMsg->m_ClientID].m_Country = pMsg->m_Country;
for(int i = 0; i < 6; i++) for(int i = 0; i < NUM_SKINPARTS; i++)
{ {
str_copy(m_aClients[pMsg->m_ClientID].m_aaSkinPartNames[i], pMsg->m_apSkinPartNames[i], 24); str_copy(m_aClients[pMsg->m_ClientID].m_aaSkinPartNames[i], pMsg->m_apSkinPartNames[i], 24);
m_aClients[pMsg->m_ClientID].m_aUseCustomColors[i] = pMsg->m_aUseCustomColors[i]; m_aClients[pMsg->m_ClientID].m_aUseCustomColors[i] = pMsg->m_aUseCustomColors[i];
@ -803,7 +803,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
return; return;
} }
for(int i = 0; i < 6; i++) for(int i = 0; i < NUM_SKINPARTS; i++)
{ {
str_copy(m_aClients[pMsg->m_ClientID].m_aaSkinPartNames[i], pMsg->m_apSkinPartNames[i], 24); str_copy(m_aClients[pMsg->m_ClientID].m_aaSkinPartNames[i], pMsg->m_apSkinPartNames[i], 24);
m_aClients[pMsg->m_ClientID].m_aUseCustomColors[i] = pMsg->m_aUseCustomColors[i]; m_aClients[pMsg->m_ClientID].m_aUseCustomColors[i] = pMsg->m_aUseCustomColors[i];
@ -1293,7 +1293,7 @@ void CGameClient::OnDemoRecSnap()
StrToInts(pClientInfo->m_aClan, 3, m_aClients[i].m_aClan); StrToInts(pClientInfo->m_aClan, 3, m_aClients[i].m_aClan);
pClientInfo->m_Country = m_aClients[i].m_Country; pClientInfo->m_Country = m_aClients[i].m_Country;
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
StrToInts(pClientInfo->m_aaSkinPartNames[p], 6, m_aClients[i].m_aaSkinPartNames[p]); StrToInts(pClientInfo->m_aaSkinPartNames[p], 6, m_aClients[i].m_aaSkinPartNames[p]);
pClientInfo->m_aUseCustomColors[p] = m_aClients[i].m_aUseCustomColors[p]; pClientInfo->m_aUseCustomColors[p] = m_aClients[i].m_aUseCustomColors[p];

View file

@ -171,10 +171,10 @@ public:
char m_aName[MAX_NAME_LENGTH]; char m_aName[MAX_NAME_LENGTH];
char m_aClan[MAX_CLAN_LENGTH]; char m_aClan[MAX_CLAN_LENGTH];
int m_Country; int m_Country;
char m_aaSkinPartNames[6][24]; char m_aaSkinPartNames[NUM_SKINPARTS][24];
int m_aUseCustomColors[6]; int m_aUseCustomColors[NUM_SKINPARTS];
int m_aSkinPartColors[6]; int m_aSkinPartColors[NUM_SKINPARTS];
int m_SkinPartIDs[6]; int m_SkinPartIDs[NUM_SKINPARTS];
int m_Team; int m_Team;
int m_Emoticon; int m_Emoticon;
int m_EmoticonStart; int m_EmoticonStart;

View file

@ -9,7 +9,6 @@
#include <engine/map.h> #include <engine/map.h>
#include <engine/textrender.h> #include <engine/textrender.h>
#include <generated/client_data.h> #include <generated/client_data.h>
#include <generated/protocol.h>
#include <game/layers.h> #include <game/layers.h>
#include "animstate.h" #include "animstate.h"
#include "render.h" #include "render.h"

View file

@ -5,6 +5,7 @@
#include <engine/graphics.h> #include <engine/graphics.h>
#include <base/vmath.h> #include <base/vmath.h>
#include <generated/protocol.h>
#include <game/mapitems.h> #include <game/mapitems.h>
#include "ui.h" #include "ui.h"
@ -12,14 +13,6 @@
// sprite renderings // sprite renderings
enum enum
{ {
SKINPART_BODY = 0,
SKINPART_MARKING,
SKINPART_DECORATION,
SKINPART_HANDS,
SKINPART_FEET,
SKINPART_EYES,
NUM_SKINPARTS,
SPRITE_FLAG_FLIP_Y = 1, SPRITE_FLAG_FLIP_Y = 1,
SPRITE_FLAG_FLIP_X = 2, SPRITE_FLAG_FLIP_X = 2,

View file

@ -283,7 +283,7 @@ void CGameContext::SendSkinChange(int ClientID)
{ {
CNetMsg_Sv_SkinChange Msg; CNetMsg_Sv_SkinChange Msg;
Msg.m_ClientID = ClientID; Msg.m_ClientID = ClientID;
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
Msg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p]; Msg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p];
Msg.m_aUseCustomColors[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aUseCustomColors[p]; Msg.m_aUseCustomColors[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aUseCustomColors[p];
@ -619,7 +619,7 @@ void CGameContext::OnClientEnter(int ClientID)
if(g_Config.m_SvSilentSpectatorMode && m_apPlayers[ClientID]->GetTeam() == TEAM_SPECTATORS) if(g_Config.m_SvSilentSpectatorMode && m_apPlayers[ClientID]->GetTeam() == TEAM_SPECTATORS)
NewClientInfoMsg.m_Silent = true; NewClientInfoMsg.m_Silent = true;
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
NewClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p]; NewClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p];
NewClientInfoMsg.m_aUseCustomColors[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aUseCustomColors[p]; NewClientInfoMsg.m_aUseCustomColors[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aUseCustomColors[p];
@ -645,7 +645,7 @@ void CGameContext::OnClientEnter(int ClientID)
ClientInfoMsg.m_pClan = Server()->ClientClan(i); ClientInfoMsg.m_pClan = Server()->ClientClan(i);
ClientInfoMsg.m_Country = Server()->ClientCountry(i); ClientInfoMsg.m_Country = Server()->ClientCountry(i);
ClientInfoMsg.m_Silent = false; ClientInfoMsg.m_Silent = false;
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
ClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[i]->m_TeeInfos.m_aaSkinPartNames[p]; ClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[i]->m_TeeInfos.m_aaSkinPartNames[p];
ClientInfoMsg.m_aUseCustomColors[p] = m_apPlayers[i]->m_TeeInfos.m_aUseCustomColors[p]; ClientInfoMsg.m_aUseCustomColors[p] = m_apPlayers[i]->m_TeeInfos.m_aUseCustomColors[p];
@ -1000,7 +1000,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
pPlayer->m_LastChangeInfo = Server()->Tick(); pPlayer->m_LastChangeInfo = Server()->Tick();
CNetMsg_Cl_SkinChange *pMsg = (CNetMsg_Cl_SkinChange *)pRawMsg; CNetMsg_Cl_SkinChange *pMsg = (CNetMsg_Cl_SkinChange *)pRawMsg;
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
str_copy(pPlayer->m_TeeInfos.m_aaSkinPartNames[p], pMsg->m_apSkinPartNames[p], 24); str_copy(pPlayer->m_TeeInfos.m_aaSkinPartNames[p], pMsg->m_apSkinPartNames[p], 24);
pPlayer->m_TeeInfos.m_aUseCustomColors[p] = pMsg->m_aUseCustomColors[p]; pPlayer->m_TeeInfos.m_aUseCustomColors[p] = pMsg->m_aUseCustomColors[p];
@ -1032,7 +1032,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
Server()->SetClientClan(ClientID, pMsg->m_pClan); Server()->SetClientClan(ClientID, pMsg->m_pClan);
Server()->SetClientCountry(ClientID, pMsg->m_Country); Server()->SetClientCountry(ClientID, pMsg->m_Country);
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
str_copy(pPlayer->m_TeeInfos.m_aaSkinPartNames[p], pMsg->m_apSkinPartNames[p], 24); str_copy(pPlayer->m_TeeInfos.m_aaSkinPartNames[p], pMsg->m_apSkinPartNames[p], 24);
pPlayer->m_TeeInfos.m_aUseCustomColors[p] = pMsg->m_aUseCustomColors[p]; pPlayer->m_TeeInfos.m_aUseCustomColors[p] = pMsg->m_aUseCustomColors[p];

View file

@ -189,7 +189,7 @@ void CPlayer::Snap(int SnappingClient)
StrToInts(pClientInfo->m_aClan, 3, Server()->ClientClan(m_ClientID)); StrToInts(pClientInfo->m_aClan, 3, Server()->ClientClan(m_ClientID));
pClientInfo->m_Country = Server()->ClientCountry(m_ClientID); pClientInfo->m_Country = Server()->ClientCountry(m_ClientID);
for(int p = 0; p < 6; p++) for(int p = 0; p < NUM_SKINPARTS; p++)
{ {
StrToInts(pClientInfo->m_aaSkinPartNames[p], 6, m_TeeInfos.m_aaSkinPartNames[p]); StrToInts(pClientInfo->m_aaSkinPartNames[p], 6, m_TeeInfos.m_aaSkinPartNames[p]);
pClientInfo->m_aUseCustomColors[p] = m_TeeInfos.m_aUseCustomColors[p]; pClientInfo->m_aUseCustomColors[p] = m_TeeInfos.m_aUseCustomColors[p];

View file

@ -81,9 +81,9 @@ public:
// TODO: clean this up // TODO: clean this up
struct struct
{ {
char m_aaSkinPartNames[6][24]; char m_aaSkinPartNames[NUM_SKINPARTS][24];
int m_aUseCustomColors[6]; int m_aUseCustomColors[NUM_SKINPARTS];
int m_aSkinPartColors[6]; int m_aSkinPartColors[NUM_SKINPARTS];
} m_TeeInfos; } m_TeeInfos;
int m_RespawnTick; int m_RespawnTick;