diff options
| author | GreYFoXGTi <GreYFoXGTi@GMaiL.CoM> | 2011-02-12 12:40:36 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-12 21:18:41 +0100 |
| commit | 1b2703aaba9ef21b8fca7c12b299fcd0fd4b9251 (patch) | |
| tree | d4b94b98105c3af23c79bae02a132bfe66738392 /src/game | |
| parent | e45ad2a085d8f02aadc5d823a1d7dda4e1da70aa (diff) | |
| download | zcatch-1b2703aaba9ef21b8fca7c12b299fcd0fd4b9251.tar.gz zcatch-1b2703aaba9ef21b8fca7c12b299fcd0fd4b9251.zip | |
Refactoring & fixed WEAPONSPEC_GUN in content.py
Diffstat (limited to 'src/game')
43 files changed, 573 insertions, 573 deletions
diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index f2cdd85f..7f473ef4 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -26,17 +26,17 @@ CBinds::CBinds() m_SpecialBinds.m_pBinds = this; } -void CBinds::Bind(int KeyId, const char *pStr) +void CBinds::Bind(int KeyID, const char *pStr) { - if(KeyId < 0 || KeyId >= KEY_LAST) + if(KeyID < 0 || KeyID >= KEY_LAST) return; - str_copy(m_aaKeyBindings[KeyId], pStr, sizeof(m_aaKeyBindings[KeyId])); + str_copy(m_aaKeyBindings[KeyID], pStr, sizeof(m_aaKeyBindings[KeyID])); char aBuf[256]; - if(!m_aaKeyBindings[KeyId][0]) - str_format(aBuf, sizeof(aBuf), "unbound %s (%d)", Input()->KeyName(KeyId), KeyId); + if(!m_aaKeyBindings[KeyID][0]) + str_format(aBuf, sizeof(aBuf), "unbound %s (%d)", Input()->KeyName(KeyID), KeyID); else - str_format(aBuf, sizeof(aBuf), "bound %s (%d) = %s", Input()->KeyName(KeyId), KeyId, m_aaKeyBindings[KeyId]); + str_format(aBuf, sizeof(aBuf), "bound %s (%d) = %s", Input()->KeyName(KeyID), KeyID, m_aaKeyBindings[KeyID]); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf); } @@ -60,10 +60,10 @@ void CBinds::UnbindAll() m_aaKeyBindings[i][0] = 0; } -const char *CBinds::Get(int KeyId) +const char *CBinds::Get(int KeyID) { - if(KeyId > 0 && KeyId < KEY_LAST) - return m_aaKeyBindings[KeyId]; + if(KeyID > 0 && KeyID < KEY_LAST) + return m_aaKeyBindings[KeyID]; return ""; } @@ -136,7 +136,7 @@ void CBinds::ConBind(IConsole::IResult *pResult, void *pUserData) { CBinds *pBinds = (CBinds *)pUserData; const char *pKeyName = pResult->GetString(0); - int id = pBinds->GetKeyId(pKeyName); + int id = pBinds->GetKeyID(pKeyName); if(!id) { @@ -154,7 +154,7 @@ void CBinds::ConUnbind(IConsole::IResult *pResult, void *pUserData) { CBinds *pBinds = (CBinds *)pUserData; const char *pKeyName = pResult->GetString(0); - int id = pBinds->GetKeyId(pKeyName); + int id = pBinds->GetKeyID(pKeyName); if(!id) { @@ -188,7 +188,7 @@ void CBinds::ConDumpBinds(IConsole::IResult *pResult, void *pUserData) } } -int CBinds::GetKeyId(const char *pKeyName) +int CBinds::GetKeyID(const char *pKeyName) { // check for numeric if(pKeyName[0] == '&') diff --git a/src/game/client/components/binds.h b/src/game/client/components/binds.h index 1f73016e..ad51a47c 100644 --- a/src/game/client/components/binds.h +++ b/src/game/client/components/binds.h @@ -9,7 +9,7 @@ class CBinds : public CComponent { char m_aaKeyBindings[KEY_LAST][128]; - int GetKeyId(const char *pKeyName); + int GetKeyID(const char *pKeyName); static void ConBind(IConsole::IResult *pResult, void *pUserData); static void ConUnbind(IConsole::IResult *pResult, void *pUserData); @@ -31,10 +31,10 @@ public: CBindsSpecial m_SpecialBinds; - void Bind(int KeyId, const char *pStr); + void Bind(int KeyID, const char *pStr); void SetDefaults(); void UnbindAll(); - const char *Get(int KeyId); + const char *Get(int KeyID); const char *GetKey(const char *pBindStr); virtual void OnConsoleInit(); diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 3632b45d..524f0e75 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -192,13 +192,13 @@ void CChat::OnMessage(int MsgType, void *pRawMsg) if(MsgType == NETMSGTYPE_SV_CHAT) { CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg; - AddLine(pMsg->m_Cid, pMsg->m_Team, pMsg->m_pMessage); + AddLine(pMsg->m_ClientID, pMsg->m_Team, pMsg->m_pMessage); } } -void CChat::AddLine(int ClientId, int Team, const char *pLine) +void CChat::AddLine(int ClientID, int Team, const char *pLine) { - if(ClientId != -1 && m_pClient->m_aClients[ClientId].m_aName[0] == '\0') // unknown client + if(ClientID != -1 && m_pClient->m_aClients[ClientID].m_aName[0] == '\0') // unknown client return; char *p = const_cast<char*>(pLine); @@ -219,30 +219,30 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine) m_aLines[m_CurrentLine].m_Time = time_get(); m_aLines[m_CurrentLine].m_YOffset[0] = -1.0f; m_aLines[m_CurrentLine].m_YOffset[1] = -1.0f; - m_aLines[m_CurrentLine].m_ClientId = ClientId; + m_aLines[m_CurrentLine].m_ClientID = ClientID; m_aLines[m_CurrentLine].m_Team = Team; m_aLines[m_CurrentLine].m_NameColor = -2; - m_aLines[m_CurrentLine].m_Highlighted = str_find_nocase(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalCid].m_aName) != 0; + m_aLines[m_CurrentLine].m_Highlighted = str_find_nocase(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName) != 0; - if(ClientId == -1) // server message + if(ClientID == -1) // server message { str_copy(m_aLines[m_CurrentLine].m_aName, "*** ", sizeof(m_aLines[m_CurrentLine].m_aName)); str_format(m_aLines[m_CurrentLine].m_aText, sizeof(m_aLines[m_CurrentLine].m_aText), "%s", pLine); } else { - if(m_pClient->m_aClients[ClientId].m_Team == TEAM_SPECTATORS) + if(m_pClient->m_aClients[ClientID].m_Team == TEAM_SPECTATORS) m_aLines[m_CurrentLine].m_NameColor = TEAM_SPECTATORS; if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS) { - if(m_pClient->m_aClients[ClientId].m_Team == TEAM_RED) + if(m_pClient->m_aClients[ClientID].m_Team == TEAM_RED) m_aLines[m_CurrentLine].m_NameColor = TEAM_RED; - else if(m_pClient->m_aClients[ClientId].m_Team == TEAM_BLUE) + else if(m_pClient->m_aClients[ClientID].m_Team == TEAM_BLUE) m_aLines[m_CurrentLine].m_NameColor = TEAM_BLUE; } - str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientId].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName)); + str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientID].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName)); str_format(m_aLines[m_CurrentLine].m_aText, sizeof(m_aLines[m_CurrentLine].m_aText), ": %s", pLine); } @@ -252,7 +252,7 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine) } // play sound - if(ClientId >= 0) + if(ClientID >= 0) m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_CLIENT, 0, vec2(0,0)); else m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_SERVER, 0, vec2(0,0)); @@ -349,7 +349,7 @@ void CChat::OnRender() Cursor.m_LineWidth = LineWidth; // render name - if(m_aLines[r].m_ClientId == -1) + if(m_aLines[r].m_ClientID == -1) TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system else if(m_aLines[r].m_Team) TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message @@ -365,7 +365,7 @@ void CChat::OnRender() TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1); // render line - if(m_aLines[r].m_ClientId == -1) + if(m_aLines[r].m_ClientID == -1) TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system else if(m_aLines[r].m_Highlighted) TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // highlighted diff --git a/src/game/client/components/chat.h b/src/game/client/components/chat.h index da6a3b16..652564ed 100644 --- a/src/game/client/components/chat.h +++ b/src/game/client/components/chat.h @@ -18,7 +18,7 @@ class CChat : public CComponent { int64 m_Time; float m_YOffset[2]; - int m_ClientId; + int m_ClientID; int m_Team; int m_NameColor; char m_aName[64]; @@ -57,7 +57,7 @@ public: bool IsActive() const { return m_Mode != MODE_NONE; } - void AddLine(int ClientId, int Team, const char *pLine); + void AddLine(int ClientID, int Team, const char *pLine); void EnableMode(int Team); diff --git a/src/game/client/components/effects.cpp b/src/game/client/components/effects.cpp index 9f99d431..edf39c97 100644 --- a/src/game/client/components/effects.cpp +++ b/src/game/client/components/effects.cpp @@ -148,17 +148,17 @@ void CEffects::PlayerSpawn(vec2 Pos) m_pClient->m_pSounds->Play(CSounds::CHN_WORLD, SOUND_PLAYER_SPAWN, 1.0f, Pos); } -void CEffects::PlayerDeath(vec2 Pos, int Cid) +void CEffects::PlayerDeath(vec2 Pos, int ClientID) { vec3 BloodColor(1.0f,1.0f,1.0f); - if(Cid >= 0) + if(ClientID >= 0) { - if(m_pClient->m_aClients[Cid].m_UseCustomColor) - BloodColor = m_pClient->m_pSkins->GetColorV3(m_pClient->m_aClients[Cid].m_ColorBody); + if(m_pClient->m_aClients[ClientID].m_UseCustomColor) + BloodColor = m_pClient->m_pSkins->GetColorV3(m_pClient->m_aClients[ClientID].m_ColorBody); else { - const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[Cid].m_SkinId); + const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[ClientID].m_SkinID); if(s) BloodColor = s->m_BloodColor; } diff --git a/src/game/client/components/effects.h b/src/game/client/components/effects.h index 494c5137..b3924382 100644 --- a/src/game/client/components/effects.h +++ b/src/game/client/components/effects.h @@ -21,7 +21,7 @@ public: void AirJump(vec2 Pos); void DamageIndicator(vec2 Pos, vec2 Dir); void PlayerSpawn(vec2 Pos); - void PlayerDeath(vec2 Pos, int ClientId); + void PlayerDeath(vec2 Pos, int ClientID); void PowerupShine(vec2 Pos, vec2 Size); void Update(); diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index c49abca1..b87cf650 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -122,13 +122,13 @@ void CHud::RenderScoreHud() else if(m_pClient->m_Snap.m_paFlags[t]->m_CarriedBy >= 0) { // draw name of the flag holder - int Id = m_pClient->m_Snap.m_paFlags[t]->m_CarriedBy%MAX_CLIENTS; - const char *pName = m_pClient->m_aClients[Id].m_aName; + int ID = m_pClient->m_Snap.m_paFlags[t]->m_CarriedBy%MAX_CLIENTS; + const char *pName = m_pClient->m_aClients[ID].m_aName; float w = TextRender()->TextWidth(0, 10.0f, pName, -1); TextRender()->Text(0, Whole-ScoreWidthMax-ImageSize-3*Split-w, 247.0f+t*20, 10.0f, pName, -1); // draw tee of the flag holder - CTeeRenderInfo Info = m_pClient->m_aClients[Id].m_RenderInfo; + CTeeRenderInfo Info = m_pClient->m_aClients[ID].m_RenderInfo; Info.m_Size = 18.0f; RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1,0), vec2(Whole-ScoreWidthMax-Info.m_Size/2-Split, 246.0f+Info.m_Size/2+t*20)); @@ -147,7 +147,7 @@ void CHud::RenderScoreHud() if(m_pClient->m_Snap.m_paInfoByScore[i]->m_Team != TEAM_SPECTATORS) { apPlayerInfo[t] = m_pClient->m_Snap.m_paInfoByScore[i]; - if(apPlayerInfo[t]->m_ClientId == m_pClient->m_Snap.m_LocalCid) + if(apPlayerInfo[t]->m_ClientID == m_pClient->m_Snap.m_LocalClientID) Local = t; ++t; } @@ -159,7 +159,7 @@ void CHud::RenderScoreHud() { if(m_pClient->m_Snap.m_paInfoByScore[i]->m_Team != TEAM_SPECTATORS) ++aPos[1]; - if(m_pClient->m_Snap.m_paInfoByScore[i]->m_ClientId == m_pClient->m_Snap.m_LocalCid) + if(m_pClient->m_Snap.m_paInfoByScore[i]->m_ClientID == m_pClient->m_Snap.m_LocalClientID) { apPlayerInfo[1] = m_pClient->m_Snap.m_paInfoByScore[i]; Local = 1; @@ -198,7 +198,7 @@ void CHud::RenderScoreHud() // draw tee if(apPlayerInfo[t]) { - CTeeRenderInfo Info = m_pClient->m_aClients[apPlayerInfo[t]->m_ClientId].m_RenderInfo; + CTeeRenderInfo Info = m_pClient->m_aClients[apPlayerInfo[t]->m_ClientID].m_RenderInfo; Info.m_Size = 18.0f; RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1,0), vec2(Whole-ScoreWidthMax-Info.m_Size/2-Split, 246.0f+Info.m_Size/2+t*20)); diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index 3379378b..fe14a339 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -15,7 +15,7 @@ #include "items.h" -void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemId) +void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID) { // get positions @@ -70,12 +70,12 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemId) if(!pInfo->m_Paused) Time += (Client()->LocalTime()-LastLocalTime)*pInfo->m_Speed; - Graphics()->QuadsSetRotation(Time*pi*2*2 + ItemId); + Graphics()->QuadsSetRotation(Time*pi*2*2 + ItemID); LastLocalTime = Client()->LocalTime(); } else - Graphics()->QuadsSetRotation(Client()->LocalTime()*pi*2*2 + ItemId); + Graphics()->QuadsSetRotation(Client()->LocalTime()*pi*2*2 + ItemID); } else { @@ -175,7 +175,7 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent) Pos = vec2(pCurrent->m_X, pCurrent->m_Y); // make sure to use predicted position if we are the carrier - if(m_pClient->m_Snap.m_pLocalInfo && pCurrent->m_CarriedBy == m_pClient->m_Snap.m_pLocalInfo->m_ClientId) + if(m_pClient->m_Snap.m_pLocalInfo && pCurrent->m_CarriedBy == m_pClient->m_Snap.m_pLocalInfo->m_ClientID) Pos = m_pClient->m_LocalCharacterPos; IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-Size*0.75f, Size, Size*2); @@ -262,11 +262,11 @@ void CItems::OnRender() if(Item.m_Type == NETOBJTYPE_PROJECTILE) { - RenderProjectile((const CNetObj_Projectile *)pData, Item.m_Id); + RenderProjectile((const CNetObj_Projectile *)pData, Item.m_ID); } else if(Item.m_Type == NETOBJTYPE_PICKUP) { - const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_Id); + const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if(pPrev) RenderPickup((const CNetObj_Pickup *)pPrev, (const CNetObj_Pickup *)pData); } @@ -284,7 +284,7 @@ void CItems::OnRender() if(Item.m_Type == NETOBJTYPE_FLAG) { - const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_Id); + const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if (pPrev) RenderFlag((const CNetObj_Flag *)pPrev, (const CNetObj_Flag *)pData); } diff --git a/src/game/client/components/items.h b/src/game/client/components/items.h index 444d0209..2fd188eb 100644 --- a/src/game/client/components/items.h +++ b/src/game/client/components/items.h @@ -6,7 +6,7 @@ class CItems : public CComponent { - void RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemId); + void RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID); void RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCurrent); void RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent); void RenderLaser(const struct CNetObj_Laser *pCurrent); diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 40f6f1bd..35a9918f 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -78,7 +78,7 @@ class CMenus : public CComponent CUIRect m_HitRect; }; - void UiDoListboxStart(void *pId, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems, + void UiDoListboxStart(void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems, int ItemsPerRow, int SelectedIndex, float ScrollValue); CListboxItem UiDoListboxNextItem(void *pID, bool Selected = false); CListboxItem UiDoListboxNextRow(); diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 6fc2cb26..f977dba6 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -27,7 +27,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) struct CColumn { - int m_Id; + int m_ID; int m_Sort; CLocConstString m_Caption; int m_Direction; @@ -270,14 +270,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) Button.h = Row.h; Button.w = s_aCols[c].m_Rect.w; - int Id = s_aCols[c].m_Id; + int ID = s_aCols[c].m_ID; - if(Id == COL_FLAG_LOCK) + if(ID == COL_FLAG_LOCK) { if(pItem->m_Flags & SERVER_FLAG_PASSWORD) DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK, &Button); } - else if(Id == COL_FLAG_PURE) + else if(ID == COL_FLAG_PURE) { if( str_comp(pItem->m_aGameType, "DM") == 0 || str_comp(pItem->m_aGameType, "TDM") == 0 || @@ -291,12 +291,12 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE, &Button); } } - else if(Id == COL_FLAG_FAV) + else if(ID == COL_FLAG_FAV) { if(pItem->m_Favorite) DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART, &Button); } - else if(Id == COL_NAME) + else if(ID == COL_NAME) { CTextCursor Cursor; TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); @@ -305,14 +305,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME)) { // highlight the parts that matches - const char *s = str_find_nocase(pItem->m_aName, g_Config.m_BrFilterString); - if(s) + const char *pStr = str_find_nocase(pItem->m_aName, g_Config.m_BrFilterString); + if(pStr) { - TextRender()->TextEx(&Cursor, pItem->m_aName, (int)(s-pItem->m_aName)); + TextRender()->TextEx(&Cursor, pItem->m_aName, (int)(pStr-pItem->m_aName)); TextRender()->TextColor(0.4f,0.4f,1.0f,1); - TextRender()->TextEx(&Cursor, s, str_length(g_Config.m_BrFilterString)); + TextRender()->TextEx(&Cursor, pStr, str_length(g_Config.m_BrFilterString)); TextRender()->TextColor(1,1,1,1); - TextRender()->TextEx(&Cursor, s+str_length(g_Config.m_BrFilterString), -1); + TextRender()->TextEx(&Cursor, pStr+str_length(g_Config.m_BrFilterString), -1); } else TextRender()->TextEx(&Cursor, pItem->m_aName, -1); @@ -320,14 +320,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) else TextRender()->TextEx(&Cursor, pItem->m_aName, -1); } - else if(Id == COL_MAP) + else if(ID == COL_MAP) { CTextCursor Cursor; TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); Cursor.m_LineWidth = Button.w; TextRender()->TextEx(&Cursor, pItem->m_aMap, -1); } - else if(Id == COL_PLAYERS) + else if(ID == COL_PLAYERS) { str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumPlayers, pItem->m_MaxPlayers); if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_PLAYERNAME)) @@ -335,17 +335,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1); TextRender()->TextColor(1,1,1,1); } - else if(Id == COL_PING) + else if(ID == COL_PING) { str_format(aTemp, sizeof(aTemp), "%i", pItem->m_Latency); UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1); } - else if(Id == COL_VERSION) + else if(ID == COL_VERSION) { const char *pVersion = pItem->m_aVersion; UI()->DoLabelScaled(&Button, pVersion, 12.0f, 1); } - else if(Id == COL_GAMETYPE) + else if(ID == COL_GAMETYPE) { CTextCursor Cursor; TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 9ffe7aa6..5663bd85 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -26,12 +26,12 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, return UI()->DoButtonLogic(pID, pText, Checked, pRect); } -int CMenus::DoButton_DemoPlayer_Sprite(const void *pID, int SpriteId, int Checked, const CUIRect *pRect) +int CMenus::DoButton_DemoPlayer_Sprite(const void *pID, int SpriteID, int Checked, const CUIRect *pRect) { RenderTools()->DrawUIRect(pRect, vec4(1,1,1, Checked ? 0.10f : 0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_DEMOBUTTONS].m_Id); Graphics()->QuadsBegin(); - RenderTools()->SelectSprite(SpriteId); + RenderTools()->SelectSprite(SpriteID); IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h); Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->QuadsEnd(); @@ -79,8 +79,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) // do seekbar { - static int s_SeekBarId = 0; - void *id = &s_SeekBarId; + static int s_SeekBarID = 0; + void *id = &s_SeekBarID; char aBuffer[128]; RenderTools()->DrawUIRect(&SeekBar, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 5.0f); @@ -235,7 +235,7 @@ static int gs_ListBoxItemsPerRow; static float gs_ListBoxScrollValue; static bool gs_ListBoxItemActivated; -void CMenus::UiDoListboxStart(void *pId, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems, +void CMenus::UiDoListboxStart(void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems, int ItemsPerRow, int SelectedIndex, float ScrollValue) { CUIRect Scroll, Row; @@ -290,7 +290,7 @@ void CMenus::UiDoListboxStart(void *pId, const CUIRect *pRect, float RowHeight, } Scroll.HMargin(5.0f, &Scroll); - gs_ListBoxScrollValue = DoScrollbarV(pId, &Scroll, gs_ListBoxScrollValue); + gs_ListBoxScrollValue = DoScrollbarV(pID, &Scroll, gs_ListBoxScrollValue); // the list gs_ListBoxView = gs_ListBoxOriginalView; diff --git a/src/game/client/components/nameplates.cpp b/src/game/client/components/nameplates.cpp index 39d081a9..ee67eb82 100644 --- a/src/game/client/components/nameplates.cpp +++ b/src/game/client/components/nameplates.cpp @@ -29,7 +29,7 @@ void CNamePlates::RenderNameplate( if(g_Config.m_ClNameplatesAlways == 0) a = clamp(1-powf(distance(m_pClient->m_pControls->m_TargetPos, Position)/200.0f,16.0f), 0.0f, 1.0f); - const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_aName; + const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aName; float tw = TextRender()->TextWidth(0, FontSize, pName, -1); TextRender()->TextColor(1.0f, 1.0f, 1.0f, a); @@ -46,7 +46,7 @@ void CNamePlates::RenderNameplate( if(g_Config.m_Debug) // render client id when in debug aswell { char aBuf[128]; - str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientId); + str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientID); TextRender()->Text(0, Position.x, Position.y-90, 28.0f, aBuf, -1); } diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 0544010a..3094a738 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -94,7 +94,7 @@ void CPlayers::RenderHook( Player = *pPlayerChar; CNetObj_PlayerInfo pInfo = *pPlayerInfo; - CTeeRenderInfo RenderInfo = m_pClient->m_aClients[pInfo.m_ClientId].m_RenderInfo; + CTeeRenderInfo RenderInfo = m_pClient->m_aClients[pInfo.m_ClientID].m_RenderInfo; // check for teamplay modes bool IsTeamplay = false; @@ -154,7 +154,7 @@ void CPlayers::RenderHook( if(pPlayerChar->m_HookedPlayer != -1) { - if(m_pClient->m_Snap.m_pLocalInfo && pPlayerChar->m_HookedPlayer == m_pClient->m_Snap.m_pLocalInfo->m_ClientId) + if(m_pClient->m_Snap.m_pLocalInfo && pPlayerChar->m_HookedPlayer == m_pClient->m_Snap.m_pLocalInfo->m_ClientID) { if(Client()->State() == IClient::STATE_DEMOPLAYBACK) // only use prediction if needed HookPos = vec2(m_pClient->m_LocalCharacterPos.x, m_pClient->m_LocalCharacterPos.y); @@ -217,7 +217,7 @@ void CPlayers::RenderPlayer( Player = *pPlayerChar; CNetObj_PlayerInfo pInfo = *pPlayerInfo; - CTeeRenderInfo RenderInfo = m_pClient->m_aClients[pInfo.m_ClientId].m_RenderInfo; + CTeeRenderInfo RenderInfo = m_pClient->m_aClients[pInfo.m_ClientID].m_RenderInfo; // check for teamplay modes bool IsTeamplay = false; @@ -509,13 +509,13 @@ void CPlayers::RenderPlayer( Graphics()->QuadsEnd(); } - if (m_pClient->m_aClients[pInfo.m_ClientId].m_EmoticonStart != -1 && m_pClient->m_aClients[pInfo.m_ClientId].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick()) + if (m_pClient->m_aClients[pInfo.m_ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[pInfo.m_ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick()) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id); Graphics()->QuadsBegin(); - int SinceStart = Client()->GameTick() - m_pClient->m_aClients[pInfo.m_ClientId].m_EmoticonStart; - int FromEnd = m_pClient->m_aClients[pInfo.m_ClientId].m_EmoticonStart + 2 * Client()->GameTickSpeed() - Client()->GameTick(); + int SinceStart = Client()->GameTick() - m_pClient->m_aClients[pInfo.m_ClientID].m_EmoticonStart; + int FromEnd = m_pClient->m_aClients[pInfo.m_ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() - Client()->GameTick(); float a = 1; @@ -536,7 +536,7 @@ void CPlayers::RenderPlayer( Graphics()->SetColor(1.0f,1.0f,1.0f,a); // client_datas::emoticon is an offset from the first emoticon - RenderTools()->SelectSprite(SPRITE_OOP + m_pClient->m_aClients[pInfo.m_ClientId].m_Emoticon); + RenderTools()->SelectSprite(SPRITE_OOP + m_pClient->m_aClients[pInfo.m_ClientID].m_Emoticon); IGraphics::CQuadItem QuadItem(Position.x, Position.y - 23 - 32*h, 64, 64*h); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->QuadsEnd(); diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index bed48619..d5588c10 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -102,7 +102,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w) { if(Count) str_append(aBuffer, ", ", sizeof(aBuffer)); - str_append(aBuffer, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, sizeof(aBuffer)); + str_append(aBuffer, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, sizeof(aBuffer)); Count++; } } @@ -198,9 +198,9 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch TextRender()->Text(0, x+ScoreWidth-Width, y+(FontSize-FontSizeResize)/2, FontSizeResize, aBuf, -1); FontSizeResize = FontSize; - while(TextRender()->TextWidth(0, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-163.0f-PingWidth) + while(TextRender()->TextWidth(0, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1) > w-163.0f-PingWidth) --FontSizeResize; - TextRender()->Text(0, x+128.0f, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1); + TextRender()->Text(0, x+128.0f, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1); FontSizeResize = FontSize; str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Latency, -9999, 9999)); @@ -209,8 +209,8 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch TextRender()->Text(0, x+w-35.0f-Width, y+(FontSize-FontSizeResize)/2, FontSizeResize, aBuf, -1); // render avatar - if((m_pClient->m_Snap.m_paFlags[0] && m_pClient->m_Snap.m_paFlags[0]->m_CarriedBy == pInfo->m_ClientId) || - (m_pClient->m_Snap.m_paFlags[1] && m_pClient->m_Snap.m_paFlags[1]->m_CarriedBy == pInfo->m_ClientId)) + if((m_pClient->m_Snap.m_paFlags[0] && m_pClient->m_Snap.m_paFlags[0]->m_CarriedBy == pInfo->m_ClientID) || + (m_pClient->m_Snap.m_paFlags[1] && m_pClient->m_Snap.m_paFlags[1]->m_CarriedBy == pInfo->m_ClientID)) { Graphics()->BlendNormal(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id); @@ -225,7 +225,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch Graphics()->QuadsEnd(); } - CTeeRenderInfo TeeInfo = m_pClient->m_aClients[pInfo->m_ClientId].m_RenderInfo; + CTeeRenderInfo TeeInfo = m_pClient->m_aClients[pInfo->m_ClientID].m_RenderInfo; TeeInfo.m_Size *= TeeSizeMod; RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28+TeeOffset)); diff --git a/src/game/client/components/sounds.cpp b/src/game/client/components/sounds.cpp index d631a330..f162e5e6 100644 --- a/src/game/client/components/sounds.cpp +++ b/src/game/client/components/sounds.cpp @@ -62,7 +62,7 @@ void CSounds::Enqueue(int SetId) void CSounds::PlayAndRecord(int Chn, int SetId, float Vol, vec2 Pos) { CNetMsg_Sv_SoundGlobal Msg; - Msg.m_Soundid = SetId; + Msg.m_SoundID = SetId; Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND|MSGFLAG_RECORD); Play(Chn, SetId, Vol, Pos); diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index 4ddd6318..e2531818 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -31,13 +31,13 @@ void CVoting::Callvote(const char *pType, const char *pValue) Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); } -void CVoting::CallvoteKick(int ClientId, const char *pReason) +void CVoting::CallvoteKick(int ClientID, const char *pReason) { char aBuf[32]; if(pReason[0]) - str_format(aBuf, sizeof(aBuf), "%d %s", ClientId, pReason); + str_format(aBuf, sizeof(aBuf), "%d %s", ClientID, pReason); else - str_format(aBuf, sizeof(aBuf), "%d", ClientId); + str_format(aBuf, sizeof(aBuf), "%d", ClientID); Callvote("kick", aBuf); } @@ -57,13 +57,13 @@ void CVoting::CallvoteOption(int OptionId) } } -void CVoting::ForcevoteKick(int ClientId, const char *pReason) +void CVoting::ForcevoteKick(int ClientID, const char *pReason) { char aBuf[32]; if(pReason[0]) - str_format(aBuf, sizeof(aBuf), "kick %d %s", ClientId, pReason); + str_format(aBuf, sizeof(aBuf), "kick %d %s", ClientID, pReason); else - str_format(aBuf, sizeof(aBuf), "kick %d", ClientId); + str_format(aBuf, sizeof(aBuf), "kick %d", ClientID); Client()->Rcon(aBuf); } diff --git a/src/game/client/components/voting.h b/src/game/client/components/voting.h index 60631107..87e0ec10 100644 --- a/src/game/client/components/voting.h +++ b/src/game/client/components/voting.h @@ -41,9 +41,9 @@ public: void RenderBars(CUIRect Bars, bool Text); - void CallvoteKick(int ClientId, const char *pReason); + void CallvoteKick(int ClientID, const char *pReason); void CallvoteOption(int Option); - void ForcevoteKick(int ClientId, const char *pReason); + void ForcevoteKick(int ClientID, const char *pReason); void ForcevoteOption(int Option); void Vote(int v); // -1 = no, 1 = yes diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index f1ff3709..99195dc3 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -374,7 +374,7 @@ void CGameClient::OnReset() for(int i = 0; i < MAX_CLIENTS; i++) { m_aClients[i].m_aName[0] = 0; - m_aClients[i].m_SkinId = 0; + m_aClients[i].m_SkinID = 0; m_aClients[i].m_Team = 0; m_aClients[i].m_Angle = 0; m_aClients[i].m_Emoticon = 0; @@ -465,12 +465,12 @@ void CGameClient::OnRender() if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*5 < time_get()) { // resend if client info differs - if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalCid].m_aName) || - str_comp(g_Config.m_PlayerSkin, m_aClients[m_Snap.m_LocalCid].m_aSkinName) || + if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalClientID].m_aName) || + str_comp(g_Config.m_PlayerSkin, m_aClients[m_Snap.m_LocalClientID].m_aSkinName) || (g_GameClient.m_Snap.m_pGameobj && !(g_GameClient.m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS) && // no teamgame? - (g_Config.m_PlayerUseCustomColor != m_aClients[m_Snap.m_LocalCid].m_UseCustomColor || - g_Config.m_PlayerColorBody != m_aClients[m_Snap.m_LocalCid].m_ColorBody || - g_Config.m_PlayerColorFeet != m_aClients[m_Snap.m_LocalCid].m_ColorFeet))) + (g_Config.m_PlayerUseCustomColor != m_aClients[m_Snap.m_LocalClientID].m_UseCustomColor || + g_Config.m_PlayerColorBody != m_aClients[m_Snap.m_LocalClientID].m_ColorBody || + g_Config.m_PlayerColorFeet != m_aClients[m_Snap.m_LocalClientID].m_ColorFeet))) { SendInfo(false); } @@ -553,8 +553,8 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) CNetMsg_Sv_Emoticon *pMsg = (CNetMsg_Sv_Emoticon *)pRawMsg; // apply - m_aClients[pMsg->m_Cid].m_Emoticon = pMsg->m_Emoticon; - m_aClients[pMsg->m_Cid].m_EmoticonStart = Client()->GameTick(); + m_aClients[pMsg->m_ClientID].m_Emoticon = pMsg->m_Emoticon; + m_aClients[pMsg->m_ClientID].m_EmoticonStart = Client()->GameTick(); } else if(MsgId == NETMSGTYPE_SV_SOUNDGLOBAL) { @@ -563,12 +563,12 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) // don't enqueue pseudo-global sounds from demos (created by PlayAndRecord) CNetMsg_Sv_SoundGlobal *pMsg = (CNetMsg_Sv_SoundGlobal *)pRawMsg; - if(pMsg->m_Soundid == SOUND_CTF_DROP || pMsg->m_Soundid == SOUND_CTF_RETURN || - pMsg->m_Soundid == SOUND_CTF_CAPTURE || pMsg->m_Soundid == SOUND_CTF_GRAB_EN || - pMsg->m_Soundid == SOUND_CTF_GRAB_PL) - g_GameClient.m_pSounds->Enqueue(pMsg->m_Soundid); + if(pMsg->m_SoundID == SOUND_CTF_DROP || pMsg->m_SoundID == SOUND_CTF_RETURN || + pMsg->m_SoundID == SOUND_CTF_CAPTURE || pMsg->m_SoundID == SOUND_CTF_GRAB_EN || + pMsg->m_SoundID == SOUND_CTF_GRAB_PL) + g_GameClient.m_pSounds->Enqueue(pMsg->m_SoundID); else - g_GameClient.m_pSounds->Play(CSounds::CHN_GLOBAL, pMsg->m_Soundid, 1.0f, vec2(0,0)); + g_GameClient.m_pSounds->Play(CSounds::CHN_GLOBAL, pMsg->m_SoundID, 1.0f, vec2(0,0)); } } @@ -638,12 +638,12 @@ void CGameClient::ProcessEvents() else if(Item.m_Type == NETEVENTTYPE_DEATH) { NETEVENT_DEATH *ev = (NETEVENT_DEATH *)pData; - g_GameClient.m_pEffects->PlayerDeath(vec2(ev->m_X, ev->m_Y), ev->m_ClientId); + g_GameClient.m_pEffects->PlayerDeath(vec2(ev->m_X, ev->m_Y), ev->m_ClientID); } else if(Item.m_Type == NETEVENTTYPE_SOUNDWORLD) { NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)pData; - g_GameClient.m_pSounds->Play(CSounds::CHN_WORLD, ev->m_SoundId, 1.0f, vec2(ev->m_X, ev->m_Y)); + g_GameClient.m_pSounds->Play(CSounds::CHN_WORLD, ev->m_SoundID, 1.0f, vec2(ev->m_X, ev->m_Y)); } } } @@ -654,7 +654,7 @@ void CGameClient::OnNewSnapshot() // clear out the invalid pointers mem_zero(&g_GameClient.m_Snap, sizeof(g_GameClient.m_Snap)); - m_Snap.m_LocalCid = -1; + m_Snap.m_LocalClientID = -1; // secure snapshot { @@ -668,7 +668,7 @@ void CGameClient::OnNewSnapshot() if(g_Config.m_Debug) { char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "invalidated index=%d type=%d (%s) size=%d id=%d", Index, Item.m_Type, m_NetObjHandler.GetObjName(Item.m_Type), Item.m_DataSize, Item.m_Id); + str_format(aBuf, sizeof(aBuf), "invalidated index=%d type=%d (%s) size=%d id=%d", Index, Item.m_Type, m_NetObjHandler.GetObjName(Item.m_Type), Item.m_DataSize, Item.m_ID); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); } Client()->SnapInvalidateItem(IClient::SNAP_CURRENT, Index); @@ -708,41 +708,41 @@ void CGameClient::OnNewSnapshot() if(Item.m_Type == NETOBJTYPE_CLIENTINFO) { const CNetObj_ClientInfo *pInfo = (const CNetObj_ClientInfo *)pData; - int Cid = Item.m_Id; - IntsToStr(&pInfo->m_Name0, 6, m_aClients[Cid].m_aName); - IntsToStr(&pInfo->m_Skin0, 6, m_aClients[Cid].m_aSkinName); + int ClientID = Item.m_ID; + IntsToStr(&pInfo->m_Name0, 6, m_aClients[ClientID].m_aName); + IntsToStr(&pInfo->m_Skin0, 6, m_aClients[ClientID].m_aSkinName); - m_aClients[Cid].m_UseCustomColor = pInfo->m_UseCustomColor; - m_aClients[Cid].m_ColorBody = pInfo->m_ColorBody; - m_aClients[Cid].m_ColorFeet = pInfo->m_ColorFeet; + m_aClients[ClientID].m_UseCustomColor = pInfo->m_UseCustomColor; + m_aClients[ClientID].m_ColorBody = pInfo->m_ColorBody; + m_aClients[ClientID].m_ColorFeet = pInfo->m_ColorFeet; // prepare the info - if(m_aClients[Cid].m_aSkinName[0] == 'x' || m_aClients[Cid].m_aSkinName[1] == '_') - str_copy(m_aClients[Cid].m_aSkinName, "default", 64); + if(m_aClients[ClientID].m_aSkinName[0] == 'x' || m_aClients[ClientID].m_aSkinName[1] == '_') + str_copy(m_aClients[ClientID].m_aSkinName, "default", 64); - m_aClients[Cid].m_SkinInfo.m_ColorBody = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorBody); - m_aClients[Cid].m_SkinInfo.m_ColorFeet = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorFeet); - m_aClients[Cid].m_SkinInfo.m_Size = 64; + m_aClients[ClientID].m_SkinInfo.m_ColorBody = m_pSkins->GetColorV4(m_aClients[ClientID].m_ColorBody); + m_aClients[ClientID].m_SkinInfo.m_ColorFeet = m_pSkins->GetColorV4(m_aClients[ClientID].m_ColorFeet); + m_aClients[ClientID].m_SkinInfo.m_Size = 64; // find new skin - m_aClients[Cid].m_SkinId = g_GameClient.m_pSkins->Find(m_aClients[Cid].m_aSkinName); - if(m_aClients[Cid].m_SkinId < 0) + m_aClients[ClientID].m_SkinID = g_GameClient.m_pSkins->Find(m_aClients[ClientID].m_aSkinName); + if(m_aClients[ClientID].m_SkinID < 0) { - m_aClients[Cid].m_SkinId = g_GameClient.m_pSkins->Find("default"); - if(m_aClients[Cid].m_SkinId < 0) - m_aClients[Cid].m_SkinId = 0; + m_aClients[ClientID].m_SkinID = g_GameClient.m_pSkins->Find("default"); + if(m_aClients[ClientID].m_SkinID < 0) + m_aClients[ClientID].m_SkinID = 0; } - if(m_aClients[Cid].m_UseCustomColor) - m_aClients[Cid].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[Cid].m_SkinId)->m_ColorTexture; + if(m_aClients[ClientID].m_UseCustomColor) + m_aClients[ClientID].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[ClientID].m_SkinID)->m_ColorTexture; else { - m_aClients[Cid].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[Cid].m_SkinId)->m_OrgTexture; - m_aClients[Cid].m_SkinInfo.m_ColorBody = vec4(1,1,1,1); - m_aClients[Cid].m_SkinInfo.m_ColorFeet = vec4(1,1,1,1); + m_aClients[ClientID].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[ClientID].m_SkinID)->m_OrgTexture; + m_aClients[ClientID].m_SkinInfo.m_ColorBody = vec4(1,1,1,1); + m_aClients[ClientID].m_SkinInfo.m_ColorFeet = vec4(1,1,1,1); } - m_aClients[Cid].UpdateRenderInfo(); + m_aClients[ClientID].UpdateRenderInfo(); g_GameClient.m_Snap.m_NumPlayers++; } @@ -750,12 +750,12 @@ void CGameClient::OnNewSnapshot() { const CNetObj_PlayerInfo *pInfo = (const CNetObj_PlayerInfo *)pData; - m_aClients[pInfo->m_ClientId].m_Team = pInfo->m_Team; - m_Snap.m_paPlayerInfos[pInfo->m_ClientId] = pInfo; + m_aClients[pInfo->m_ClientID].m_Team = pInfo->m_Team; + m_Snap.m_paPlayerInfos[pInfo->m_ClientID] = pInfo; if(pInfo->m_Local) { - m_Snap.m_LocalCid = Item.m_Id; + m_Snap.m_LocalClientID = Item.m_ID; m_Snap.m_pLocalInfo = pInfo; if(pInfo->m_Team == TEAM_SPECTATORS) @@ -769,17 +769,17 @@ void CGameClient::OnNewSnapshot() } else if(Item.m_Type == NETOBJTYPE_CHARACTER) { - const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_Id); + const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_ID); if(pOld) { - m_Snap.m_aCharacters[Item.m_Id].m_Active = true; - m_Snap.m_aCharacters[Item.m_Id].m_Prev = *((const CNetObj_Character *)pOld); - m_Snap.m_aCharacters[Item.m_Id].m_Cur = *((const CNetObj_Character *)pData); - - if(m_Snap.m_aCharacters[Item.m_Id].m_Prev.m_Tick) - Evolve(&m_Snap.m_aCharacters[Item.m_Id].m_Prev, Client()->PrevGameTick()); - if(m_Snap.m_aCharacters[Item.m_Id].m_Cur.m_Tick) - Evolve(&m_Snap.m_aCharacters[Item.m_Id].m_Cur, Client()->GameTick()); + m_Snap.m_aCharacters[Item.m_ID].m_Active = true; + m_Snap.m_aCharacters[Item.m_ID].m_Prev = *((const CNetObj_Character *)pOld); + m_Snap.m_aCharacters[Item.m_ID].m_Cur = *((const CNetObj_Character *)pData); + + if(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick) + Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, Client()->PrevGameTick()); + if(m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick) + Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Cur, Client()->GameTick()); } } else if(Item.m_Type == NETOBJTYPE_GAME) @@ -793,21 +793,21 @@ void CGameClient::OnNewSnapshot() s_GameOver = m_Snap.m_pGameobj->m_GameOver; } else if(Item.m_Type == NETOBJTYPE_FLAG) - m_Snap.m_paFlags[Item.m_Id%2] = (const CNetObj_Flag *)pData; + m_Snap.m_paFlags[Item.m_ID%2] = (const CNetObj_Flag *)pData; } } // setup local pointers - if(m_Snap.m_LocalCid >= 0) + if(m_Snap.m_LocalClientID >= 0) { - CSnapState::CCharacterInfo *c = &m_Snap.m_aCharacters[m_Snap.m_LocalCid]; + CSnapState::CCharacterInfo *c = &m_Snap.m_aCharacters[m_Snap.m_LocalClientID]; if(c->m_Active) { m_Snap.m_pLocalCharacter = &c->m_Cur; m_Snap.m_pLocalPrevCharacter = &c->m_Prev; m_LocalCharacterPos = vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y); } - else if(Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, m_Snap.m_LocalCid)) + else if(Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, m_Snap.m_LocalClientID)) { // player died m_pControls->OnPlayerDeath(); @@ -853,7 +853,7 @@ void CGameClient::OnPredict() CCharacterCore BeforeChar = m_PredictedChar; // we can't predict without our own id or own character - if(m_Snap.m_LocalCid == -1 || !m_Snap.m_aCharacters[m_Snap.m_LocalCid].m_Active) + if(m_Snap.m_LocalClientID == -1 || !m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_Active) return; // don't predict anything if we are paused @@ -885,8 +885,8 @@ void CGameClient::OnPredict() for(int Tick = Client()->GameTick()+1; Tick <= Client()->PredGameTick(); Tick++) { // fetch the local - if(Tick == Client()->PredGameTick() && World.m_apCharacters[m_Snap.m_LocalCid]) - m_PredictedPrevChar = *World.m_apCharacters[m_Snap.m_LocalCid]; + if(Tick == Client()->PredGameTick() && World.m_apCharacters[m_Snap.m_LocalClientID]) + m_PredictedPrevChar = *World.m_apCharacters[m_Snap.m_LocalClientID]; // first calculate where everyone should move for(int c = 0; c < MAX_CLIENTS; c++) @@ -895,7 +895,7 @@ void CGameClient::OnPredict() continue; mem_zero(&World.m_apCharacters[c]->m_Input, sizeof(World.m_apCharacters[c]->m_Input)); - if(m_Snap.m_LocalCid == c) + if(m_Snap.m_LocalClientID == c) { // apply player input int *pInput = Client()->GetInput(Tick); @@ -924,10 +924,10 @@ void CGameClient::OnPredict() m_LastNewPredictedTick = Tick; m_NewPredictedTick = true; - if(m_Snap.m_LocalCid != -1 && World.m_apCharacters[m_Snap.m_LocalCid]) + if(m_Snap.m_LocalClientID != -1 && World.m_apCharacters[m_Snap.m_LocalClientID]) { - vec2 Pos = World.m_apCharacters[m_Snap.m_LocalCid]->m_Pos; - int Events = World.m_apCharacters[m_Snap.m_LocalCid]->m_TriggeredEvents; + vec2 Pos = World.m_apCharacters[m_Snap.m_LocalClientID]->m_Pos; + int Events = World.m_apCharacters[m_Snap.m_LocalClientID]->m_TriggeredEvents; if(Events&COREEVENT_GROUND_JUMP) g_GameClient.m_pSounds->PlayAndRecord(CSounds::CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, Pos); /*if(events&COREEVENT_AIR_JUMP) @@ -944,8 +944,8 @@ void CGameClient::OnPredict() } } - if(Tick == Client()->PredGameTick() && World.m_apCharacters[m_Snap.m_LocalCid]) - m_PredictedChar = *World.m_apCharacters[m_Snap.m_LocalCid]; + if(Tick == Client()->PredGameTick() && World.m_apCharacters[m_Snap.m_LocalClientID]) + m_PredictedChar = *World.m_apCharacters[m_Snap.m_LocalClientID]; } if(g_Config.m_Debug && g_Config.m_ClPredict && m_PredictedTick == Client()->PredGameTick()) @@ -987,7 +987,7 @@ void CGameClient::CClientData::UpdateRenderInfo() const int TeamColors[2] = {65387, 10223467}; if(m_Team >= TEAM_RED && m_Team <= TEAM_BLUE) { - m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture; + m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinID)->m_ColorTexture; m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]); m_RenderInfo.m_ColorFeet = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]); } @@ -1029,7 +1029,7 @@ void CGameClient::SendInfo(bool Start) } } -void CGameClient::SendKill(int ClientId) +void CGameClient::SendKill(int ClientID) { CNetMsg_Cl_Kill Msg; Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 1e5c4856..35deec7b 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -113,7 +113,7 @@ public: const CNetObj_PlayerInfo *m_paPlayerInfos[MAX_CLIENTS]; const CNetObj_PlayerInfo *m_paInfoByScore[MAX_CLIENTS]; - int m_LocalCid; + int m_LocalClientID; int m_NumPlayers; int m_aTeamSize[2]; bool m_Spectate; @@ -145,7 +145,7 @@ public: char m_aName[64]; char m_aSkinName[64]; - int m_SkinId; + int m_SkinID; int m_SkinColor; int m_Team; int m_Emoticon; @@ -193,7 +193,7 @@ public: // TODO: move these void SendSwitchTeam(int Team); void SendInfo(bool Start); - void SendKill(int ClientId); + void SendKill(int ClientID); // pointers to all systems class CGameConsole *m_pGameConsole; diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 4ffd7b9d..43df0be6 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -51,30 +51,30 @@ void CCollision::Init(class CLayers *pLayers) } } -int CCollision::GetTile(int x, int y) +int CCollision::GetTile(int X, int Y) { - int nx = clamp(x/32, 0, m_Width-1); - int ny = clamp(y/32, 0, m_Height-1); + int Nx = clamp(X/32, 0, m_Width-1); + int Ny = clamp(Y/32, 0, m_Height-1); - return m_pTiles[ny*m_Width+nx].m_Index > 128 ? 0 : m_pTiles[ny*m_Width+nx].m_Index; + return m_pTiles[Ny*m_Width+Nx].m_Index > 128 ? 0 : m_pTiles[Ny*m_Width+Nx].m_Index; } -bool CCollision::IsTileSolid(int x, int y) +bool CCollision::IsTileSolid(int X, int Y) { - return GetTile(x,y)&COLFLAG_SOLID; + return GetTile(X, Y)&COLFLAG_SOLID; } // TODO: rewrite this smarter! int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision) { - float d = distance(Pos0, Pos1); - int End(d+1); + float D = distance(Pos0, Pos1); + int End(D+1); vec2 Last = Pos0; for(int i = 0; i < End; i++) { - float a = i/d; - vec2 Pos = mix(Pos0, Pos1, a); + float A = i/D; + vec2 Pos = mix(Pos0, Pos1, A); if(CheckPoint(Pos.x, Pos.y)) { if(pOutCollision) diff --git a/src/game/collision.h b/src/game/collision.h index 8bcbe789..3a0a490a 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -25,9 +25,9 @@ public: CCollision(); void Init(class CLayers *pLayers); - bool CheckPoint(float x, float y) { return IsTileSolid(round(x), round(y)); } - bool CheckPoint(vec2 p) { return CheckPoint(p.x, p.y); } - int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); } + bool CheckPoint(float X, float Y) { return IsTileSolid(round(X), round(Y)); } + bool CheckPoint(vec2 P) { return CheckPoint(P.x, P.y); } + int GetCollisionAt(float X, float Y) { return GetTile(round(X), round(Y)); } int GetWidth() { return m_Width; }; int GetHeight() { return m_Height; }; int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision); diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index ec708f0c..69040499 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -37,7 +37,7 @@ enum CEditorImage::~CEditorImage() { - m_pEditor->Graphics()->UnloadTexture(m_TexId); + m_pEditor->Graphics()->UnloadTexture(m_TexID); } CLayerGroup::CLayerGroup() @@ -159,9 +159,9 @@ void CEditorImage::AnalyseTileFlags() { unsigned char *pPixelData = (unsigned char *)m_pData; - int TileId = 0; + int TileID = 0; for(int ty = 0; ty < 16; ty++) - for(int tx = 0; tx < 16; tx++, TileId++) + for(int tx = 0; tx < 16; tx++, TileID++) { bool Opaque = true; for(int x = 0; x < tw; x++) @@ -176,7 +176,7 @@ void CEditorImage::AnalyseTileFlags() } if(Opaque) - m_aTileFlags[TileId] |= TILEFLAG_OPAQUE; + m_aTileFlags[TileID] |= TILEFLAG_OPAQUE; } } @@ -278,16 +278,16 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str return ReturnValue; } -vec4 CEditor::ButtonColorMul(const void *pId) +vec4 CEditor::ButtonColorMul(const void *pID) { - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) return vec4(1,1,1,0.5f); - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) return vec4(1,1,1,1.5f); return vec4(1,1,1,1); } -float CEditor::UiDoScrollbarV(const void *pId, const CUIRect *pRect, float Current) +float CEditor::UiDoScrollbarV(const void *pID, const CUIRect *pRect, float Current) { CUIRect Handle; static float s_OffsetY; @@ -299,7 +299,7 @@ float CEditor::UiDoScrollbarV(const void *pId, const CUIRect *pRect, float Curre float Ret = Current; int Inside = UI()->MouseInside(&Handle); - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) { if(!UI()->MouseButton(0)) UI()->SetActiveItem(0); @@ -311,17 +311,17 @@ float CEditor::UiDoScrollbarV(const void *pId, const CUIRect *pRect, float Curre if(Ret < 0.0f) Ret = 0.0f; if(Ret > 1.0f) Ret = 1.0f; } - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) { if(UI()->MouseButton(0)) { - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); s_OffsetY = UI()->MouseY()-Handle.y; } } if(Inside) - UI()->SetHotItem(pId); + UI()->SetHotItem(pID); // render CUIRect Rail; @@ -336,24 +336,24 @@ float CEditor::UiDoScrollbarV(const void *pId, const CUIRect *pRect, float Curre Slider = Handle; Slider.Margin(5.0f, &Slider); - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f)*ButtonColorMul(pId), CUI::CORNER_ALL, 2.5f); + RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 2.5f); return Ret; } -vec4 CEditor::GetButtonColor(const void *pId, int Checked) +vec4 CEditor::GetButtonColor(const void *pID, int Checked) { if(Checked < 0) return vec4(0,0,0,0.5f); if(Checked > 0) { - if(UI()->HotItem() == pId) + if(UI()->HotItem() == pID) return vec4(1,0,0,0.75f); return vec4(1,0,0,0.5f); } - if(UI()->HotItem() == pId) + if(UI()->HotItem() == pID) return vec4(1,1,1,0.75f); return vec4(1,1,1,0.5f); } @@ -464,14 +464,14 @@ void CEditor::RenderBackground(CUIRect View, int Texture, float Size, float Brig Graphics()->QuadsEnd(); } -int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip) +int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip) { // logic static float s_Value; int Ret = 0; - int Inside = UI()->MouseInside(r); + int Inside = UI()->MouseInside(pRect); - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) { if(!UI()->MouseButton(0)) { @@ -501,27 +501,27 @@ int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Cu if(pToolTip) m_pTooltip = pToolTip; } - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) { if(UI()->MouseButton(0)) { m_LockMouse = true; s_Value = 0; - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); } if(pToolTip) m_pTooltip = pToolTip; } if(Inside) - UI()->SetHotItem(pId); + UI()->SetHotItem(pID); // render char aBuf[128]; str_format(aBuf, sizeof(aBuf),"%s %d", pLabel, Current); - RenderTools()->DrawUIRect(r, GetButtonColor(pId, 0), CUI::CORNER_ALL, 5.0f); - r->y += r->h/2.0f-7.0f; - UI()->DoLabel(r, aBuf, 10, 0, -1); + RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, 0), CUI::CORNER_ALL, 5.0f); + pRect->y += pRect->h/2.0f-7.0f; + UI()->DoLabel(pRect, aBuf, 10, 0, -1); return Current; } @@ -844,7 +844,7 @@ void CEditor::DoQuad(CQuad *q, int Index) }; // some basic values - void *pId = &q->m_aPoints[4]; // use pivot addr as id + void *pID = &q->m_aPoints[4]; // use pivot addr as id static CPoint s_RotatePoints[4]; static float s_LastWx; static float s_LastWy; @@ -860,7 +860,7 @@ void CEditor::DoQuad(CQuad *q, int Index) float dx = (CenterX - wx)/m_WorldZoom; float dy = (CenterY - wy)/m_WorldZoom; if(dx*dx+dy*dy < 50) - UI()->SetHotItem(pId); + UI()->SetHotItem(pID); // draw selection background if(m_SelectedQuad == Index) @@ -870,7 +870,7 @@ void CEditor::DoQuad(CQuad *q, int Index) Graphics()->QuadsDraw(&QuadItem, 1); } - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) { // check if we only should move pivot if(s_Operation == OP_MOVE_PIVOT) @@ -904,8 +904,8 @@ void CEditor::DoQuad(CQuad *q, int Index) { if(!UI()->MouseButton(1)) { - static int s_QuadPopupId = 0; - UiInvokePopupMenu(&s_QuadPopupId, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupQuad); + static int s_QuadPopupID = 0; + UiInvokePopupMenu(&s_QuadPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupQuad); m_LockMouse = false; s_Operation = OP_NONE; UI()->SetActiveItem(0); @@ -923,9 +923,9 @@ void CEditor::DoQuad(CQuad *q, int Index) Graphics()->SetColor(1,1,1,1); } - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) { - ms_pUiGotContext = pId; + ms_pUiGotContext = pID; Graphics()->SetColor(1,1,1,1); m_pTooltip = Localize("Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate."); @@ -947,7 +947,7 @@ void CEditor::DoQuad(CQuad *q, int Index) else s_Operation = OP_MOVE_ALL; - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); m_SelectedQuad = Index; s_LastWx = wx; s_LastWy = wy; @@ -957,7 +957,7 @@ void CEditor::DoQuad(CQuad *q, int Index) { m_SelectedQuad = Index; s_Operation = OP_CONTEXT_MENU; - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); } } else @@ -967,23 +967,23 @@ void CEditor::DoQuad(CQuad *q, int Index) Graphics()->QuadsDraw(&QuadItem, 1); } -void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) +void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V) { - void *pId = &q->m_aPoints[v]; + void *pID = &pQuad->m_aPoints[V]; float wx = UI()->MouseWorldX(); float wy = UI()->MouseWorldY(); - float px = fx2f(q->m_aPoints[v].x); - float py = fx2f(q->m_aPoints[v].y); + float px = fx2f(pQuad->m_aPoints[V].x); + float py = fx2f(pQuad->m_aPoints[V].y); float dx = (px - wx)/m_WorldZoom; float dy = (py - wy)/m_WorldZoom; if(dx*dx+dy*dy < 50) - UI()->SetHotItem(pId); + UI()->SetHotItem(pID); // draw selection background - if(m_SelectedQuad == QuadIndex && m_SelectedPoints&(1<<v)) + if(m_SelectedQuad == QuadIndex && m_SelectedPoints&(1<<V)) { Graphics()->SetColor(0,0,0,1); IGraphics::CQuadItem QuadItem(px, py, 7.0f, 7.0f); @@ -1001,7 +1001,7 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) static bool s_Moved; static int s_Operation = OP_NONE; - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) { float dx = m_MouseDeltaWx; float dy = m_MouseDeltaWy; @@ -1018,8 +1018,8 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) for(int m = 0; m < 4; m++) if(m_SelectedPoints&(1<<m)) { - q->m_aPoints[m].x += f2fx(dx); - q->m_aPoints[m].y += f2fx(dy); + pQuad->m_aPoints[m].x += f2fx(dx); + pQuad->m_aPoints[m].y += f2fx(dy); } } else if(s_Operation == OP_MOVEUV) @@ -1030,11 +1030,11 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) // 0,2;1,3 - line x // 0,1;2,3 - line y - q->m_aTexcoords[m].x += f2fx(dx*0.001f); - q->m_aTexcoords[(m+2)%4].x += f2fx(dx*0.001f); + pQuad->m_aTexcoords[m].x += f2fx(dx*0.001f); + pQuad->m_aTexcoords[(m+2)%4].x += f2fx(dx*0.001f); - q->m_aTexcoords[m].y += f2fx(dy*0.001f); - q->m_aTexcoords[m^1].y += f2fx(dy*0.001f); + pQuad->m_aTexcoords[m].y += f2fx(dy*0.001f); + pQuad->m_aTexcoords[m^1].y += f2fx(dy*0.001f); } } } @@ -1043,8 +1043,8 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) { if(!UI()->MouseButton(1)) { - static int s_PointPopupId = 0; - UiInvokePopupMenu(&s_PointPopupId, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupPoint); + static int s_PointPopupID = 0; + UiInvokePopupMenu(&s_PointPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupPoint); UI()->SetActiveItem(0); } } @@ -1055,9 +1055,9 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) if(!s_Moved) { if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) - m_SelectedPoints ^= 1<<v; + m_SelectedPoints ^= 1<<V; else - m_SelectedPoints = 1<<v; + m_SelectedPoints = 1<<V; } m_LockMouse = false; UI()->SetActiveItem(0); @@ -1066,16 +1066,16 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) Graphics()->SetColor(1,1,1,1); } - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) { - ms_pUiGotContext = pId; + ms_pUiGotContext = pID; Graphics()->SetColor(1,1,1,1); m_pTooltip = Localize("Left mouse button to move. Hold shift to move the texture."); if(UI()->MouseButton(0)) { - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); s_Moved = false; if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) { @@ -1085,12 +1085,12 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) else s_Operation = OP_MOVEPOINT; - if(!(m_SelectedPoints&(1<<v))) + if(!(m_SelectedPoints&(1<<V))) { if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) - m_SelectedPoints |= 1<<v; + m_SelectedPoints |= 1<<V; else - m_SelectedPoints = 1<<v; + m_SelectedPoints = 1<<V; s_Moved = true; } @@ -1100,13 +1100,13 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) { s_Operation = OP_CONTEXT_MENU; m_SelectedQuad = QuadIndex; - UI()->SetActiveItem(pId); - if(!(m_SelectedPoints&(1<<v))) + UI()->SetActiveItem(pID); + if(!(m_SelectedPoints&(1<<V))) { if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) - m_SelectedPoints |= 1<<v; + m_SelectedPoints |= 1<<V; else - m_SelectedPoints = 1<<v; + m_SelectedPoints = 1<<V; s_Moved = true; } } @@ -1142,7 +1142,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } } - static void *s_pEditorId = (void *)&s_pEditorId; + static void *s_pEditorID = (void *)&s_pEditorID; int Inside = UI()->MouseInside(&View); // fetch mouse position @@ -1182,7 +1182,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) if(t) { m_TilesetPicker.m_Image = t->m_Image; - m_TilesetPicker.m_TexId = t->m_TexId; + m_TilesetPicker.m_TexID = t->m_TexID; m_TilesetPicker.Render(); } } @@ -1233,7 +1233,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) if(Inside) { - UI()->SetHotItem(s_pEditorId); + UI()->SetHotItem(s_pEditorID); // do global operations like pan and zoom if(UI()->ActiveItem() == 0 && (UI()->MouseButton(0) || UI()->MouseButton(2))) @@ -1249,19 +1249,19 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) s_Operation = OP_PAN_EDITOR; else s_Operation = OP_PAN_WORLD; - UI()->SetActiveItem(s_pEditorId); + UI()->SetActiveItem(s_pEditorID); } } // brush editing - if(UI()->HotItem() == s_pEditorId) + if(UI()->HotItem() == s_pEditorID) { if(m_Brush.IsEmpty()) m_pTooltip = Localize("Use left mouse button to drag and create a brush."); else m_pTooltip = Localize("Use left mouse button to paint with the brush. Right button clears the brush."); - if(UI()->ActiveItem() == s_pEditorId) + if(UI()->ActiveItem() == s_pEditorID) { CUIRect r; r.x = s_StartWx; @@ -1339,7 +1339,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) if(UI()->MouseButton(0) && s_Operation == OP_NONE) { - UI()->SetActiveItem(s_pEditorId); + UI()->SetActiveItem(s_pEditorID); if(m_Brush.IsEmpty()) s_Operation = OP_BRUSH_GRAB; @@ -1430,7 +1430,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } // do panning - if(UI()->ActiveItem() == s_pEditorId) + if(UI()->ActiveItem() == s_pEditorID) { if(s_Operation == OP_PAN_WORLD) { @@ -1452,7 +1452,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } } } - else if(UI()->ActiveItem() == s_pEditorId) + else if(UI()->ActiveItem() == s_pEditorID) { // release mouse if(!UI()->MouseButton(0)) @@ -1575,7 +1575,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } -int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int *pNewVal) +int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *pNewVal) { int Change = -1; @@ -1599,12 +1599,12 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * RenderTools()->DrawUIRect(&Shifter, vec4(1,1,1,0.5f), 0, 0.0f); UI()->DoLabel(&Shifter, aBuf, 10.0f, 0, -1); - if(DoButton_ButtonDec(&pIds[i], 0, 0, &Dec, 0, Localize("Decrease"))) + if(DoButton_ButtonDec(&pIDs[i], 0, 0, &Dec, 0, Localize("Decrease"))) { *pNewVal = pProps[i].m_Value-1; Change = i; } - if(DoButton_ButtonInc(((char *)&pIds[i])+1, 0, 0, &Inc, 0, Localize("Increase"))) + if(DoButton_ButtonInc(((char *)&pIDs[i])+1, 0, 0, &Inc, 0, Localize("Increase"))) { *pNewVal = pProps[i].m_Value+1; Change = i; @@ -1614,12 +1614,12 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * { CUIRect No, Yes; Shifter.VSplitMid(&No, &Yes); - if(DoButton_ButtonDec(&pIds[i], Localize("No"), !pProps[i].m_Value, &No, 0, "")) + if(DoButton_ButtonDec(&pIDs[i], Localize("No"), !pProps[i].m_Value, &No, 0, "")) { *pNewVal = 0; Change = i; } - if(DoButton_ButtonInc(((char *)&pIds[i])+1, Localize("Yes"), pProps[i].m_Value, &Yes, 0, "")) + if(DoButton_ButtonInc(((char *)&pIDs[i])+1, Localize("Yes"), pProps[i].m_Value, &Yes, 0, "")) { *pNewVal = 1; Change = i; @@ -1627,7 +1627,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * } else if(pProps[i].m_Type == PROPTYPE_INT_SCROLL) { - int NewValue = UiDoValueSelector(&pIds[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1, 1.0f, Localize("Use left mouse button to drag and change the value. Hold shift to be more precise.")); + int NewValue = UiDoValueSelector(&pIDs[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1, 1.0f, Localize("Use left mouse button to drag and change the value. Hold shift to be more precise.")); if(NewValue != pProps[i].m_Value) { *pNewVal = NewValue; @@ -1643,7 +1643,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * for(int c = 0; c < 4; c++) { int v = (pProps[i].m_Value >> s_aShift[c])&0xff; - NewColor |= UiDoValueSelector(((char *)&pIds[i])+c, &Shifter, s_paTexts[c], v, 0, 255, 1, 1.0f, Localize("Use left mouse button to drag and change the color value. Hold shift to be more precise."))<<s_aShift[c]; + NewColor |= UiDoValueSelector(((char *)&pIDs[i])+c, &Shifter, s_paTexts[c], v, 0, 255, 1, 1.0f, Localize("Use left mouse button to drag and change the color value. Hold shift to be more precise."))<<s_aShift[c]; if(c != 3) { @@ -1667,7 +1667,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * else str_format(aBuf, sizeof(aBuf),"%s", m_Map.m_lImages[pProps[i].m_Value]->m_aName); - if(DoButton_Editor(&pIds[i], aBuf, 0, &Shifter, 0, 0)) + if(DoButton_Editor(&pIDs[i], aBuf, 0, &Shifter, 0, 0)) PopupSelectImageInvoke(pProps[i].m_Value, UI()->MouseX(), UI()->MouseY()); int r = PopupSelectImageResult(); @@ -1691,22 +1691,22 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int * Shifter.VSplitRight(10.0f, &Shifter, &Down); RenderTools()->DrawUIRect(&Shifter, vec4(1,1,1,0.5f), 0, 0.0f); UI()->DoLabel(&Shifter, "Y", 10.0f, 0, -1); - if(DoButton_ButtonDec(&pIds[i], "-", 0, &Left, 0, Localize("Left"))) + if(DoButton_ButtonDec(&pIDs[i], "-", 0, &Left, 0, Localize("Left"))) { *pNewVal = 1; Change = i; } - if(DoButton_ButtonInc(((char *)&pIds[i])+3, "+", 0, &Right, 0, Localize("Right"))) + if(DoButton_ButtonInc(((char *)&pIDs[i])+3, "+", 0, &Right, 0, Localize("Right"))) { *pNewVal = 2; Change = i; } - if(DoButton_ButtonDec(((char *)&pIds[i])+1, "-", 0, &Up, 0, Localize("Up"))) + if(DoButton_ButtonDec(((char *)&pIDs[i])+1, "-", 0, &Up, 0, Localize("Up"))) { *pNewVal = 4; Change = i; } - if(DoButton_ButtonInc(((char *)&pIds[i])+2, "+", 0, &Down, 0, Localize("Down"))) + if(DoButton_ButtonInc(((char *)&pIDs[i])+2, "+", 0, &Down, 0, Localize("Down"))) { *pNewVal = 8; Change = i; @@ -1831,9 +1831,9 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View) { m_SelectedLayer = i; m_SelectedGroup = g; - static int s_LayerPopupId = 0; + static int s_LayerPopupID = 0; if(Result == 2) - UiInvokePopupMenu(&s_LayerPopupId, 0, UI()->MouseX(), UI()->MouseY(), 120, 220, PopupLayer); + UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 220, PopupLayer); } LayerCur += 14.0f; @@ -1867,11 +1867,11 @@ void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser) CEditorImage *pImg = pEditor->m_Map.m_lImages[pEditor->m_SelectedImage]; int External = pImg->m_External; - pEditor->Graphics()->UnloadTexture(pImg->m_TexId); + pEditor->Graphics()->UnloadTexture(pImg->m_TexID); *pImg = ImgInfo; pImg->m_External = External; pEditor->ExtractName(pFileName, pImg->m_aName, sizeof(pImg->m_aName)); - pImg->m_TexId = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); + pImg->m_TexID = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); pEditor->SortImages(); for(int i = 0; i < pEditor->m_Map.m_lImages.size(); ++i) { @@ -1899,7 +1899,7 @@ void CEditor::AddImage(const char *pFileName, int StorageType, void *pUser) CEditorImage *pImg = new CEditorImage(pEditor); *pImg = ImgInfo; - pImg->m_TexId = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); + pImg->m_TexID = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); pImg->m_External = 1; // external by default str_copy(pImg->m_aName, aBuf, sizeof(pImg->m_aName)); pEditor->m_Map.m_lImages.add(pImg); @@ -2087,9 +2087,9 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View) { m_SelectedImage = i; - static int s_PopupImageId = 0; + static int s_PopupImageID = 0; if(Result == 2) - UiInvokePopupMenu(&s_PopupImageId, 0, UI()->MouseX(), UI()->MouseY(), 120, 80, PopupImage); + UiInvokePopupMenu(&s_PopupImageID, 0, UI()->MouseX(), UI()->MouseY(), 120, 80, PopupImage); } ToolBox.HSplitTop(2.0f, 0, &ToolBox); @@ -2103,7 +2103,7 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View) r.w = r.h; else r.h = r.w; - Graphics()->TextureSet(m_Map.m_lImages[i]->m_TexId); + Graphics()->TextureSet(m_Map.m_lImages[i]->m_TexID); Graphics()->BlendNormal(); Graphics()->QuadsBegin(); IGraphics::CQuadItem QuadItem(r.x, r.y, r.w, r.h); @@ -2213,9 +2213,9 @@ void CEditor::RenderFileDialog() // filebox if(m_FileDialogStorageType == IStorage::TYPE_SAVE) { - static int s_FileBoxId = 0; + static int s_FileBoxID = 0; UI()->DoLabel(&FileBoxLabel, Localize("Filename:"), 10.0f, -1, -1); - if(DoEditBox(&s_FileBoxId, &FileBox, m_aFileDialogFileName, sizeof(m_aFileDialogFileName), 10.0f)) + if(DoEditBox(&s_FileBoxID, &FileBox, m_aFileDialogFileName, sizeof(m_aFileDialogFileName), 10.0f)) { // remove '/' and '\' for(int i = 0; m_aFileDialogFileName[i]; ++i) @@ -2571,7 +2571,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(pEnvelope) { static array<int> Selection; - static int sEnvelopeEditorId = 0; + static int sEnvelopeEditorID = 0; static int s_ActiveChannels = 0xf; if(pEnvelope) @@ -2624,9 +2624,9 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) float ValueScale = (Top-Bottom)/View.h; if(UI()->MouseInside(&View)) - UI()->SetHotItem(&sEnvelopeEditorId); + UI()->SetHotItem(&sEnvelopeEditorID); - if(UI()->HotItem() == &sEnvelopeEditorId) + if(UI()->HotItem() == &sEnvelopeEditorID) { // do stuff if(pEnvelope) @@ -2699,12 +2699,12 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) v.h = CurveBar.h; v.w = CurveBar.h; v.x -= v.w/2; - void *pId = &pEnvelope->m_lPoints[i].m_Curvetype; + void *pID = &pEnvelope->m_lPoints[i].m_Curvetype; const char *paTypeName[] = { "N", "L", "S", "F", "M" }; - if(DoButton_Editor(pId, paTypeName[pEnvelope->m_lPoints[i].m_Curvetype], 0, &v, 0, Localize("Switch curve type"))) + if(DoButton_Editor(pID, paTypeName[pEnvelope->m_lPoints[i].m_Curvetype], 0, &v, 0, Localize("Switch curve type"))) pEnvelope->m_lPoints[i].m_Curvetype = (pEnvelope->m_lPoints[i].m_Curvetype+1)%NUM_CURVETYPES; } } @@ -2772,14 +2772,14 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) Final.w = 4.0f; Final.h = 4.0f; - void *pId = &pEnvelope->m_lPoints[i].m_aValues[c]; + void *pID = &pEnvelope->m_lPoints[i].m_aValues[c]; if(UI()->MouseInside(&Final)) - UI()->SetHotItem(pId); + UI()->SetHotItem(pID); float ColorMod = 1.0f; - if(UI()->ActiveItem() == pId) + if(UI()->ActiveItem() == pID) { if(!UI()->MouseButton(0)) { @@ -2812,13 +2812,13 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) ColorMod = 100.0f; Graphics()->SetColor(1,1,1,1); } - else if(UI()->HotItem() == pId) + else if(UI()->HotItem() == pID) { if(UI()->MouseButton(0)) { Selection.clear(); Selection.add(i); - UI()->SetActiveItem(pId); + UI()->SetActiveItem(pID); } // remove point @@ -2830,7 +2830,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) m_pTooltip = Localize("Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point aswell. Right click to delete."); } - if(UI()->ActiveItem() == pId || UI()->HotItem() == pId) + if(UI()->ActiveItem() == pID || UI()->HotItem() == pID) { CurrentTime = pEnvelope->m_lPoints[i].m_Time; CurrentValue = pEnvelope->m_lPoints[i].m_aValues[c]; @@ -3136,7 +3136,7 @@ void CEditorMap::MakeGameLayer(CLayer *pLayer) { m_pGameLayer = (CLayerGame *)pLayer; m_pGameLayer->m_pEditor = m_pEditor; - m_pGameLayer->m_TexId = m_pEditor->ms_EntitiesTexture; + m_pGameLayer->m_TexID = m_pEditor->ms_EntitiesTexture; } void CEditorMap::MakeGameGroup(CLayerGroup *pGroup) diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 007e94f1..648a5829 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -235,7 +235,7 @@ public: CEditorImage(CEditor *pEditor) { m_pEditor = pEditor; - m_TexId = -1; + m_TexID = -1; m_aName[0] = 0; m_External = 0; m_Width = 0; @@ -248,7 +248,7 @@ public: void AnalyseTileFlags(); - int m_TexId; + int m_TexID; int m_External; char m_aName[128]; unsigned char m_aTileFlags[256]; @@ -389,7 +389,7 @@ public: void GetSize(float *w, float *h) { *w = m_Width*32.0f; *h = m_Height*32.0f; } - int m_TexId; + int m_TexID; int m_Game; int m_Image; int m_Width; @@ -535,7 +535,7 @@ public: CLayer *GetSelectedLayer(int Index); CLayerGroup *GetSelectedGroup(); - int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal); + int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIDs, int *pNewVal); int m_Mode; int m_Dialog; @@ -643,10 +643,10 @@ public: void RenderBackground(CUIRect View, int Texture, float Size, float Brightness); - void UiInvokePopupMenu(void *pId, int Flags, float x, float y, float w, float h, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra=0); + void UiInvokePopupMenu(void *pID, int Flags, float X, float Y, float W, float H, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra=0); void UiDoPopupMenu(); - int UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip); + int UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip); static int PopupGroup(CEditor *pEditor, CUIRect View); static int PopupLayer(CEditor *pEditor, CUIRect View); @@ -664,14 +664,14 @@ public: void PopupSelectGametileOpInvoke(float x, float y); int PopupSelectGameTileOpResult(); - vec4 ButtonColorMul(const void *pId); + vec4 ButtonColorMul(const void *pID); void DoQuadPoint(CQuad *pQuad, int QuadIndex, int v); void DoMapEditor(CUIRect View, CUIRect Toolbar); void DoToolbar(CUIRect Toolbar); void DoQuad(CQuad *pQuad, int Index); - float UiDoScrollbarV(const void *id, const CUIRect *pRect, float Current); - vec4 GetButtonColor(const void *id, int Checked); + float UiDoScrollbarV(const void *pID, const CUIRect *pRect, float Current); + vec4 GetButtonColor(const void *pID, int Checked); static void ReplaceImage(const char *pFilename, int StorageType, void *pUser); static void AddImage(const char *pFilename, int StorageType, void *pUser); diff --git a/src/game/editor/ed_io.cpp b/src/game/editor/ed_io.cpp index 2eff397c..4dd71245 100644 --- a/src/game/editor/ed_io.cpp +++ b/src/game/editor/ed_io.cpp @@ -428,7 +428,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL)) { *pImg = ImgInfo; - pImg->m_TexId = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); + pImg->m_TexID = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0); pImg->m_External = 1; } } @@ -442,7 +442,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag void *pData = DataFile.GetData(pItem->m_ImageData); pImg->m_pData = mem_alloc(pImg->m_Width*pImg->m_Height*4, 1); mem_copy(pImg->m_pData, pData, pImg->m_Width*pImg->m_Height*4); - pImg->m_TexId = m_pEditor->Graphics()->LoadTextureRaw(pImg->m_Width, pImg->m_Height, pImg->m_Format, pImg->m_pData, CImageInfo::FORMAT_AUTO, 0); + pImg->m_TexID = m_pEditor->Graphics()->LoadTextureRaw(pImg->m_Width, pImg->m_Height, pImg->m_Format, pImg->m_pData, CImageInfo::FORMAT_AUTO, 0); } // copy image name diff --git a/src/game/editor/ed_layer_quads.cpp b/src/game/editor/ed_layer_quads.cpp index 033dadba..0aa58ac5 100644 --- a/src/game/editor/ed_layer_quads.cpp +++ b/src/game/editor/ed_layer_quads.cpp @@ -43,7 +43,7 @@ void CLayerQuads::Render() { Graphics()->TextureSet(-1); if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size()) - Graphics()->TextureSet(m_pEditor->m_Map.m_lImages[m_Image]->m_TexId); + Graphics()->TextureSet(m_pEditor->m_Map.m_lImages[m_Image]->m_TexID); m_pEditor->RenderTools()->RenderQuads(m_lQuads.base_ptr(), m_lQuads.size(), LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT, EnvelopeEval, m_pEditor); } diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp index 6ef2d256..c8425947 100644 --- a/src/game/editor/ed_layer_tiles.cpp +++ b/src/game/editor/ed_layer_tiles.cpp @@ -18,7 +18,7 @@ CLayerTiles::CLayerTiles(int w, int h) m_Width = w; m_Height = h; m_Image = -1; - m_TexId = -1; + m_TexID = -1; m_Game = 0; m_Color.r = 255; m_Color.g = 255; @@ -58,8 +58,8 @@ void CLayerTiles::MakePalette() void CLayerTiles::Render() { if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size()) - m_TexId = m_pEditor->m_Map.m_lImages[m_Image]->m_TexId; - Graphics()->TextureSet(m_TexId); + m_TexID = m_pEditor->m_Map.m_lImages[m_Image]->m_TexID; + Graphics()->TextureSet(m_TexID); vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f); m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT); } @@ -137,7 +137,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect) // create new layers CLayerTiles *pGrabbed = new CLayerTiles(r.w, r.h); pGrabbed->m_pEditor = m_pEditor; - pGrabbed->m_TexId = m_TexId; + pGrabbed->m_TexID = m_TexID; pGrabbed->m_Image = m_Image; pGrabbed->m_Game = m_Game; pBrush->AddLayer(pGrabbed); @@ -396,7 +396,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) { if (NewVal == -1) { - m_TexId = -1; + m_TexID = -1; m_Image = -1; } else diff --git a/src/game/editor/ed_popups.cpp b/src/game/editor/ed_popups.cpp index c0fcc5d5..e43c6c91 100644 --- a/src/game/editor/ed_popups.cpp +++ b/src/game/editor/ed_popups.cpp @@ -20,19 +20,19 @@ static struct static int g_UiNumPopups = 0; -void CEditor::UiInvokePopupMenu(void *Id, int Flags, float x, float y, float w, float h, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra) +void CEditor::UiInvokePopupMenu(void *pID, int Flags, float X, float Y, float W, float H, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra) { Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "editor", "invoked"); - if(x + w > UI()->Screen()->w) - x -= w; - if(y + h > UI()->Screen()->h) - y -= h; - s_UiPopups[g_UiNumPopups].m_pId = Id; + if(X + W > UI()->Screen()->w) + X -= W; + if(Y + H > UI()->Screen()->h) + Y -= H; + s_UiPopups[g_UiNumPopups].m_pId = pID; s_UiPopups[g_UiNumPopups].m_IsMenu = Flags; - s_UiPopups[g_UiNumPopups].m_Rect.x = x; - s_UiPopups[g_UiNumPopups].m_Rect.y = y; - s_UiPopups[g_UiNumPopups].m_Rect.w = w; - s_UiPopups[g_UiNumPopups].m_Rect.h = h; + s_UiPopups[g_UiNumPopups].m_Rect.x = X; + s_UiPopups[g_UiNumPopups].m_Rect.y = Y; + s_UiPopups[g_UiNumPopups].m_Rect.w = W; + s_UiPopups[g_UiNumPopups].m_Rect.h = H; s_UiPopups[g_UiNumPopups].m_pfnFunc = pfnFunc; s_UiPopups[g_UiNumPopups].m_pExtra = pExtra; g_UiNumPopups++; @@ -441,7 +441,7 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View) } if(ShowImage >= 0 && ShowImage < pEditor->m_Map.m_lImages.size()) - pEditor->Graphics()->TextureSet(pEditor->m_Map.m_lImages[ShowImage]->m_TexId); + pEditor->Graphics()->TextureSet(pEditor->m_Map.m_lImages[ShowImage]->m_TexID); else pEditor->Graphics()->TextureSet(-1); pEditor->Graphics()->QuadsBegin(); diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp index 629b32e8..a3d3e6c9 100644 --- a/src/game/gamecore.cpp +++ b/src/game/gamecore.cpp @@ -43,9 +43,9 @@ bool CTuningParams::Get(const char *pName, float *pValue) return false; } -float HermiteBasis1(float v) +float HermiteBasis1(float V) { - return 2*v*v*v - 3*v*v+1; + return 2*V*V*V - 3*V*V+1; } float VelocityRamp(float Value, float Start, float Range, float Curvature) @@ -100,16 +100,16 @@ void CCharacterCore::Tick(bool UseInput) m_Direction = m_Input.m_Direction; // setup angle - float a = 0; + float A = 0; if(m_Input.m_TargetX == 0) - a = atanf((float)m_Input.m_TargetY); + A = atanf((float)m_Input.m_TargetY); else - a = atanf((float)m_Input.m_TargetY/(float)m_Input.m_TargetX); + A = atanf((float)m_Input.m_TargetY/(float)m_Input.m_TargetX); if(m_Input.m_TargetX < 0) - a = a+pi; + A = A+pi; - m_Angle = (int)(a*256.0f); + m_Angle = (int)(A*256.0f); // handle jump if(m_Input.m_Jump) @@ -212,19 +212,19 @@ void CCharacterCore::Tick(bool UseInput) float Dist = 0.0f; for(int i = 0; i < MAX_CLIENTS; i++) { - CCharacterCore *p = m_pWorld->m_apCharacters[i]; - if(!p || p == this) + CCharacterCore *pCharCore = m_pWorld->m_apCharacters[i]; + if(!pCharCore || pCharCore == this) continue; - vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, p->m_Pos); - if(distance(p->m_Pos, ClosestPoint) < PhysSize+2.0f) + vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, pCharCore->m_Pos); + if(distance(pCharCore->m_Pos, ClosestPoint) < PhysSize+2.0f) { - if (m_HookedPlayer == -1 || distance(m_HookPos, p->m_Pos) < Dist) + if (m_HookedPlayer == -1 || distance(m_HookPos, pCharCore->m_Pos) < Dist) { m_TriggeredEvents |= COREEVENT_HOOK_ATTACH_PLAYER; m_HookState = HOOK_GRABBED; m_HookedPlayer = i; - Dist = distance(m_HookPos, p->m_Pos); + Dist = distance(m_HookPos, pCharCore->m_Pos); } } } @@ -252,9 +252,9 @@ void CCharacterCore::Tick(bool UseInput) { if(m_HookedPlayer != -1) { - CCharacterCore *p = m_pWorld->m_apCharacters[m_HookedPlayer]; - if(p) - m_HookPos = p->m_Pos; + CCharacterCore *pCharCore = m_pWorld->m_apCharacters[m_HookedPlayer]; + if(pCharCore) + m_HookPos = pCharCore->m_Pos; else { // release hook @@ -306,42 +306,42 @@ void CCharacterCore::Tick(bool UseInput) { for(int i = 0; i < MAX_CLIENTS; i++) { - CCharacterCore *p = m_pWorld->m_apCharacters[i]; - if(!p) + CCharacterCore *pCharCore = m_pWorld->m_apCharacters[i]; + if(!pCharCore) continue; //player *p = (player*)ent; - if(p == this) // || !(p->flags&FLAG_ALIVE) + if(pCharCore == this) // || !(p->flags&FLAG_ALIVE) continue; // make sure that we don't nudge our self // handle player <-> player collision - float d = distance(m_Pos, p->m_Pos); - vec2 Dir = normalize(m_Pos - p->m_Pos); - if(d < PhysSize*1.25f && d > 1.0f) + float D = distance(m_Pos, pCharCore->m_Pos); + vec2 Dir = normalize(m_Pos - pCharCore->m_Pos); + if(D < PhysSize*1.25f && D > 1.0f) { - float a = (PhysSize*1.45f - d); - float v = 0.5f; + float A = (PhysSize*1.45f - D); + float V = 0.5f; // make sure that we don't add excess force by checking the // direction against the current velocity. if not zero. if (length(m_Vel) > 0.0001) - v = 1-(dot(normalize(m_Vel), Dir)+1)/2; + V = 1-(dot(normalize(m_Vel), Dir)+1)/2; - m_Vel += Dir*a*(v*0.75f); + m_Vel += Dir*A*(V*0.75f); m_Vel *= 0.85f; } // handle hook influence if(m_HookedPlayer == i) { - if(d > PhysSize*1.50f) // TODO: fix tweakable variable + if(D > PhysSize*1.50f) // TODO: fix tweakable variable { - float Accel = m_pWorld->m_Tuning.m_HookDragAccel * (d/m_pWorld->m_Tuning.m_HookLength); + float Accel = m_pWorld->m_Tuning.m_HookDragAccel * (D/m_pWorld->m_Tuning.m_HookLength); float DragSpeed = m_pWorld->m_Tuning.m_HookDragSpeed; // add force to the hooked player - p->m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, p->m_Vel.x, Accel*Dir.x*1.5f); - p->m_Vel.y = SaturatedAdd(-DragSpeed, DragSpeed, p->m_Vel.y, Accel*Dir.y*1.5f); + pCharCore->m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.x, Accel*Dir.x*1.5f); + pCharCore->m_Vel.y = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.y, Accel*Dir.y*1.5f); // add a little bit force to the guy who has the grip m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, m_Vel.x, -Accel*Dir.x*0.25f); diff --git a/src/game/gamecore.h b/src/game/gamecore.h index 43456c90..6e86d988 100644 --- a/src/game/gamecore.h +++ b/src/game/gamecore.h @@ -54,19 +54,19 @@ inline vec2 GetDirection(int Angle) return vec2(cosf(a), sinf(a)); } -inline vec2 GetDir(float a) +inline vec2 GetDir(float A) { - return vec2(cosf(a), sinf(a)); + return vec2(cosf(A), sinf(A)); } inline float GetAngle(vec2 Dir) { if(Dir.x == 0 && Dir.y == 0) return 0.0f; - float a = atanf(Dir.y/Dir.x); + float A = atanf(Dir.y/Dir.x); if(Dir.x < 0) - a = a+pi; - return a; + A = A+pi; + return A; } inline void StrToInts(int *pInts, int Num, const char *pStr) @@ -105,13 +105,13 @@ inline void IntsToStr(const int *pInts, int Num, char *pStr) -inline vec2 CalcPos(vec2 p, vec2 v, float Curvature, float Speed, float t) +inline vec2 CalcPos(vec2 P, vec2 V, float Curvature, float Speed, float T) { - vec2 n; - t *= Speed; - n.x = p.x + v.x*t; - n.y = p.y + v.y*t + Curvature/10000*(t*t); - return n; + vec2 N; + T *= Speed; + N.x = P.x + V.x*T; + N.y = P.y + V.y*T + Curvature/10000*(T*T); + return N; } diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 2f6568fa..184702cb 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -97,7 +97,7 @@ void CLaser::Snap(int SnappingClient) if(NetworkClipped(SnappingClient)) return; - CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser))); + CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index 136e3efe..56b319d2 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -122,7 +122,7 @@ void CPickup::Snap(int SnappingClient) if(m_SpawnTick != -1 || NetworkClipped(SnappingClient)) return; - CNetObj_Pickup *pP = static_cast<CNetObj_Pickup *>(Server()->SnapNewItem(NETOBJTYPE_PICKUP, m_Id, sizeof(CNetObj_Pickup))); + CNetObj_Pickup *pP = static_cast<CNetObj_Pickup *>(Server()->SnapNewItem(NETOBJTYPE_PICKUP, m_ID, sizeof(CNetObj_Pickup))); if(!pP) return; diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index 6e256e95..07e96627 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -99,7 +99,7 @@ void CProjectile::Snap(int SnappingClient) if(NetworkClipped(SnappingClient, GetPos(Ct))) return; - CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_Id, sizeof(CNetObj_Projectile))); + CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_ID, sizeof(CNetObj_Projectile))); if(pProj) FillInfo(pProj); } diff --git a/src/game/server/entity.cpp b/src/game/server/entity.cpp index aff36943..03b55982 100644 --- a/src/game/server/entity.cpp +++ b/src/game/server/entity.cpp @@ -16,7 +16,7 @@ CEntity::CEntity(CGameWorld *pGameWorld, int ObjType) m_ProximityRadius = 0; m_MarkedForDestroy = false; - m_Id = Server()->SnapNewID(); + m_ID = Server()->SnapNewID(); m_pPrevTypeEntity = 0; m_pNextTypeEntity = 0; @@ -25,7 +25,7 @@ CEntity::CEntity(CGameWorld *pGameWorld, int ObjType) CEntity::~CEntity() { GameWorld()->RemoveEntity(this); - Server()->SnapFreeID(m_Id); + Server()->SnapFreeID(m_ID); } int CEntity::NetworkClipped(int SnappingClient) diff --git a/src/game/server/entity.h b/src/game/server/entity.h index d56c60e7..ff4d82eb 100644 --- a/src/game/server/entity.h +++ b/src/game/server/entity.h @@ -65,7 +65,7 @@ class CEntity class CGameWorld *m_pGameWorld; protected: bool m_MarkedForDestroy; - int m_Id; + int m_ID; int m_ObjType; public: CEntity(CGameWorld *pGameWorld, int Objtype); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index d0e13f47..5b82b785 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -74,52 +74,52 @@ void CGameContext::Clear() } -class CCharacter *CGameContext::GetPlayerChar(int ClientId) +class CCharacter *CGameContext::GetPlayerChar(int ClientID) { - if(ClientId < 0 || ClientId >= MAX_CLIENTS || !m_apPlayers[ClientId]) + if(ClientID < 0 || ClientID >= MAX_CLIENTS || !m_apPlayers[ClientID]) return 0; - return m_apPlayers[ClientId]->GetCharacter(); + return m_apPlayers[ClientID]->GetCharacter(); } -void CGameContext::CreateDamageInd(vec2 p, float Angle, int Amount) +void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount) { - float a = 3 * 3.14159f / 2 + Angle; + float A = 3 * 3.14159f / 2 + Angle; //float a = get_angle(dir); - float s = a-pi/3; - float e = a+pi/3; + float S = A-pi/3; + float E = A+pi/3; for(int i = 0; i < Amount; i++) { - float f = mix(s, e, float(i+1)/float(Amount+2)); - NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)m_Events.Create(NETEVENTTYPE_DAMAGEIND, sizeof(NETEVENT_DAMAGEIND)); - if(ev) + float F = mix(S, E, float(i+1)/float(Amount+2)); + NETEVENT_DAMAGEIND *pEvent = (NETEVENT_DAMAGEIND *)m_Events.Create(NETEVENTTYPE_DAMAGEIND, sizeof(NETEVENT_DAMAGEIND)); + if(pEvent) { - ev->m_X = (int)p.x; - ev->m_Y = (int)p.y; - ev->m_Angle = (int)(f*256.0f); + pEvent->m_X = (int)Pos.x; + pEvent->m_Y = (int)Pos.y; + pEvent->m_Angle = (int)(F*256.0f); } } } -void CGameContext::CreateHammerHit(vec2 p) +void CGameContext::CreateHammerHit(vec2 Pos) { // create the event - NETEVENT_HAMMERHIT *ev = (NETEVENT_HAMMERHIT *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(NETEVENT_HAMMERHIT)); - if(ev) + NETEVENT_HAMMERHIT *pEvent = (NETEVENT_HAMMERHIT *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(NETEVENT_HAMMERHIT)); + if(pEvent) { - ev->m_X = (int)p.x; - ev->m_Y = (int)p.y; + pEvent->m_X = (int)Pos.x; + pEvent->m_Y = (int)Pos.y; } } -void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage) +void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage) { // create the event - NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION)); - if(ev) + NETEVENT_EXPLOSION *pEvent = (NETEVENT_EXPLOSION *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION)); + if(pEvent) { - ev->m_X = (int)p.x; - ev->m_Y = (int)p.y; + pEvent->m_X = (int)Pos.x; + pEvent->m_Y = (int)Pos.y; } if (!NoDamage) @@ -128,10 +128,10 @@ void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage) CCharacter *apEnts[MAX_CLIENTS]; float Radius = 135.0f; float InnerRadius = 48.0f; - int Num = m_World.FindEntities(p, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); + int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); for(int i = 0; i < Num; i++) { - vec2 Diff = apEnts[i]->m_Pos - p; + vec2 Diff = apEnts[i]->m_Pos - Pos; vec2 ForceDir(0,1); float l = length(Diff); if(l) @@ -145,37 +145,37 @@ void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage) } /* -void create_smoke(vec2 p) +void create_smoke(vec2 P) { // create the event - EV_EXPLOSION *ev = (EV_EXPLOSION *)events.create(EVENT_SMOKE, sizeof(EV_EXPLOSION)); - if(ev) + EV_EXPLOSION *pEvent = (EV_EXPLOSION *)events.create(EVENT_SMOKE, sizeof(EV_EXPLOSION)); + if(pEvent) { - ev->x = (int)p.x; - ev->y = (int)p.y; + pEvent->x = (int)P.x; + pEvent->y = (int)P.y; } }*/ -void CGameContext::CreatePlayerSpawn(vec2 p) +void CGameContext::CreatePlayerSpawn(vec2 Pos) { // create the event NETEVENT_SPAWN *ev = (NETEVENT_SPAWN *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(NETEVENT_SPAWN)); if(ev) { - ev->m_X = (int)p.x; - ev->m_Y = (int)p.y; + ev->m_X = (int)Pos.x; + ev->m_Y = (int)Pos.y; } } -void CGameContext::CreateDeath(vec2 p, int ClientId) +void CGameContext::CreateDeath(vec2 Pos, int ClientID) { // create the event - NETEVENT_DEATH *ev = (NETEVENT_DEATH *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(NETEVENT_DEATH)); - if(ev) + NETEVENT_DEATH *pEvent = (NETEVENT_DEATH *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(NETEVENT_DEATH)); + if(pEvent) { - ev->m_X = (int)p.x; - ev->m_Y = (int)p.y; - ev->m_ClientId = ClientId; + pEvent->m_X = (int)Pos.x; + pEvent->m_Y = (int)Pos.y; + pEvent->m_ClientID = ClientID; } } @@ -185,12 +185,12 @@ void CGameContext::CreateSound(vec2 Pos, int Sound, int Mask) return; // create a sound - NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)m_Events.Create(NETEVENTTYPE_SOUNDWORLD, sizeof(NETEVENT_SOUNDWORLD), Mask); - if(ev) + NETEVENT_SOUNDWORLD *pEvent = (NETEVENT_SOUNDWORLD *)m_Events.Create(NETEVENTTYPE_SOUNDWORLD, sizeof(NETEVENT_SOUNDWORLD), Mask); + if(pEvent) { - ev->m_X = (int)Pos.x; - ev->m_Y = (int)Pos.y; - ev->m_SoundId = Sound; + pEvent->m_X = (int)Pos.x; + pEvent->m_Y = (int)Pos.y; + pEvent->m_SoundID = Sound; } } @@ -200,7 +200,7 @@ void CGameContext::CreateSoundGlobal(int Sound, int Target) return; CNetMsg_Sv_SoundGlobal Msg; - Msg.m_Soundid = Sound; + Msg.m_SoundID = Sound; Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, Target); } @@ -209,17 +209,17 @@ void CGameContext::SendChatTarget(int To, const char *pText) { CNetMsg_Sv_Chat Msg; Msg.m_Team = 0; - Msg.m_Cid = -1; + Msg.m_ClientID = -1; Msg.m_pMessage = pText; Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, To); } -void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText) +void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText) { char aBuf[256]; - if(ChatterClientId >= 0 && ChatterClientId < MAX_CLIENTS) - str_format(aBuf, sizeof(aBuf), "%d:%d:%s: %s", ChatterClientId, Team, Server()->ClientName(ChatterClientId), pText); + if(ChatterClientID >= 0 && ChatterClientID < MAX_CLIENTS) + str_format(aBuf, sizeof(aBuf), "%d:%d:%s: %s", ChatterClientID, Team, Server()->ClientName(ChatterClientID), pText); else str_format(aBuf, sizeof(aBuf), "*** %s", pText); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "chat", aBuf); @@ -228,7 +228,7 @@ void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText) { CNetMsg_Sv_Chat Msg; Msg.m_Team = 0; - Msg.m_Cid = ChatterClientId; + Msg.m_ClientID = ChatterClientID; Msg.m_pMessage = pText; Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, -1); } @@ -236,7 +236,7 @@ void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText) { CNetMsg_Sv_Chat Msg; Msg.m_Team = 1; - Msg.m_Cid = ChatterClientId; + Msg.m_ClientID = ChatterClientID; Msg.m_pMessage = pText; // pack one for the recording only @@ -251,27 +251,27 @@ void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText) } } -void CGameContext::SendEmoticon(int ClientId, int Emoticon) +void CGameContext::SendEmoticon(int ClientID, int Emoticon) { CNetMsg_Sv_Emoticon Msg; - Msg.m_Cid = ClientId; + Msg.m_ClientID = ClientID; Msg.m_Emoticon = Emoticon; Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, -1); } -void CGameContext::SendWeaponPickup(int ClientId, int Weapon) +void CGameContext::SendWeaponPickup(int ClientID, int Weapon) { CNetMsg_Sv_WeaponPickup Msg; Msg.m_Weapon = Weapon; - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); } -void CGameContext::SendBroadcast(const char *pText, int ClientId) +void CGameContext::SendBroadcast(const char *pText, int ClientID) { CNetMsg_Sv_Broadcast Msg; Msg.m_pMessage = pText; - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); } // @@ -307,7 +307,7 @@ void CGameContext::EndVote() SendVoteSet(-1); } -void CGameContext::SendVoteSet(int ClientId) +void CGameContext::SendVoteSet(int ClientID) { CNetMsg_Sv_VoteSet Msg; if(m_VoteCloseTime) @@ -322,10 +322,10 @@ void CGameContext::SendVoteSet(int ClientId) Msg.m_pDescription = ""; Msg.m_pCommand = ""; } - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); } -void CGameContext::SendVoteStatus(int ClientId, int Total, int Yes, int No) +void CGameContext::SendVoteStatus(int ClientID, int Total, int Yes, int No) { CNetMsg_Sv_VoteStatus Msg = {0}; Msg.m_Total = Total; @@ -333,13 +333,13 @@ void CGameContext::SendVoteStatus(int ClientId, int Total, int Yes, int No) Msg.m_No = No; Msg.m_Pass = Total - (Yes+No); - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); } -void CGameContext::AbortVoteKickOnDisconnect(int ClientId) +void CGameContext::AbortVoteKickOnDisconnect(int ClientID) { - if(m_VoteCloseTime && !str_comp_num(m_aVoteCommand, "kick ", 5) && str_toint(&m_aVoteCommand[5]) == ClientId) + if(m_VoteCloseTime && !str_comp_num(m_aVoteCommand, "kick ", 5) && str_toint(&m_aVoteCommand[5]) == ClientID) m_VoteCloseTime = -1; } @@ -363,7 +363,7 @@ void CGameContext::CheckPureTuning() } } -void CGameContext::SendTuningParams(int Cid) +void CGameContext::SendTuningParams(int ClientID) { CheckPureTuning(); @@ -371,7 +371,7 @@ void CGameContext::SendTuningParams(int Cid) int *pParams = (int *)&m_Tuning; for(unsigned i = 0; i < sizeof(m_Tuning)/sizeof(int); i++) Msg.AddInt(pParams[i]); - Server()->SendMsg(&Msg, MSGFLAG_VITAL, Cid); + Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CGameContext::OnTick() @@ -496,26 +496,26 @@ void CGameContext::OnClientPredictedInput(int ClientID, void *pInput) m_apPlayers[ClientID]->OnPredictedInput((CNetObj_PlayerInput *)pInput); } -void CGameContext::OnClientEnter(int ClientId) +void CGameContext::OnClientEnter(int ClientID) { //world.insert_entity(&players[client_id]); - m_apPlayers[ClientId]->Respawn(); + m_apPlayers[ClientID]->Respawn(); char aBuf[512]; - str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientId), m_pController->GetTeamName(m_apPlayers[ClientId]->GetTeam())); + str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientID), m_pController->GetTeamName(m_apPlayers[ClientID]->GetTeam())); SendChat(-1, CGameContext::CHAT_ALL, aBuf); - str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientId, Server()->ClientName(ClientId), m_apPlayers[ClientId]->GetTeam()); + str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientID, Server()->ClientName(ClientID), m_apPlayers[ClientID]->GetTeam()); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); m_VoteUpdate = true; } -void CGameContext::OnClientConnected(int ClientId) +void CGameContext::OnClientConnected(int ClientID) { // Check which team the player should be on - const int StartTeam = g_Config.m_SvTournamentMode ? TEAM_SPECTATORS : m_pController->GetAutoTeam(ClientId); + const int StartTeam = g_Config.m_SvTournamentMode ? TEAM_SPECTATORS : m_pController->GetAutoTeam(ClientID); - m_apPlayers[ClientId] = new(ClientId) CPlayer(this, ClientId, StartTeam); + m_apPlayers[ClientID] = new(ClientID) CPlayer(this, ClientID, StartTeam); //players[client_id].init(client_id); //players[client_id].client_id = client_id; @@ -524,58 +524,58 @@ void CGameContext::OnClientConnected(int ClientId) #ifdef CONF_DEBUG if(g_Config.m_DbgDummies) { - if(ClientId >= MAX_CLIENTS-g_Config.m_DbgDummies) + if(ClientID >= MAX_CLIENTS-g_Config.m_DbgDummies) return; } #endif // send active vote if(m_VoteCloseTime) - SendVoteSet(ClientId); + SendVoteSet(ClientID); // send motd CNetMsg_Sv_Motd Msg; Msg.m_pMessage = g_Config.m_SvMotd; - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); } -void CGameContext::OnClientDrop(int ClientId) +void CGameContext::OnClientDrop(int ClientID) { - AbortVoteKickOnDisconnect(ClientId); - m_apPlayers[ClientId]->OnDisconnect(); - delete m_apPlayers[ClientId]; - m_apPlayers[ClientId] = 0; + AbortVoteKickOnDisconnect(ClientID); + m_apPlayers[ClientID]->OnDisconnect(); + delete m_apPlayers[ClientID]; + m_apPlayers[ClientID] = 0; (void)m_pController->CheckTeamBalance(); m_VoteUpdate = true; } -void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) +void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) { - void *pRawMsg = m_NetObjHandler.SecureUnpackMsg(MsgId, pUnpacker); - CPlayer *p = m_apPlayers[ClientId]; + void *pRawMsg = m_NetObjHandler.SecureUnpackMsg(MsgID, pUnpacker); + CPlayer *pPlayer = m_apPlayers[ClientID]; if(!pRawMsg) { char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "dropped weird message '%s' (%d), failed on '%s'", m_NetObjHandler.GetMsgName(MsgId), MsgId, m_NetObjHandler.FailedMsgOn()); + str_format(aBuf, sizeof(aBuf), "dropped weird message '%s' (%d), failed on '%s'", m_NetObjHandler.GetMsgName(MsgID), MsgID, m_NetObjHandler.FailedMsgOn()); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf); return; } - if(MsgId == NETMSGTYPE_CL_SAY) + if(MsgID == NETMSGTYPE_CL_SAY) { CNetMsg_Cl_Say *pMsg = (CNetMsg_Cl_Say *)pRawMsg; int Team = pMsg->m_Team; if(Team) - Team = p->GetTeam(); + Team = pPlayer->GetTeam(); else Team = CGameContext::CHAT_ALL; - if(g_Config.m_SvSpamprotection && p->m_Last_Chat && p->m_Last_Chat+Server()->TickSpeed() > Server()->Tick()) + if(g_Config.m_SvSpamprotection && pPlayer->m_Last_Chat && pPlayer->m_Last_Chat+Server()->TickSpeed() > Server()->Tick()) return; - p->m_Last_Chat = Server()->Tick(); + pPlayer->m_Last_Chat = Server()->Tick(); // check for invalid chars unsigned char *pMessage = (unsigned char *)pMsg->m_pMessage; @@ -586,33 +586,33 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) pMessage++; } - SendChat(ClientId, Team, pMsg->m_pMessage); + SendChat(ClientID, Team, pMsg->m_pMessage); } - else if(MsgId == NETMSGTYPE_CL_CALLVOTE) + else if(MsgID == NETMSGTYPE_CL_CALLVOTE) { - if(g_Config.m_SvSpamprotection && p->m_Last_VoteTry && p->m_Last_VoteTry+Server()->TickSpeed()*3 > Server()->Tick()) + if(g_Config.m_SvSpamprotection && pPlayer->m_Last_VoteTry && pPlayer->m_Last_VoteTry+Server()->TickSpeed()*3 > Server()->Tick()) return; int64 Now = Server()->Tick(); - p->m_Last_VoteTry = Now; - if(p->GetTeam() == TEAM_SPECTATORS) + pPlayer->m_Last_VoteTry = Now; + if(pPlayer->GetTeam() == TEAM_SPECTATORS) { - SendChatTarget(ClientId, "Spectators aren't allowed to start a vote."); + SendChatTarget(ClientID, "Spectators aren't allowed to start a vote."); return; } if(m_VoteCloseTime) { - SendChatTarget(ClientId, "Wait for current vote to end before calling a new one."); + SendChatTarget(ClientID, "Wait for current vote to end before calling a new one."); return; } - int Timeleft = p->m_Last_VoteCall + Server()->TickSpeed()*60 - Now; - if(p->m_Last_VoteCall && Timeleft > 0) + int Timeleft = pPlayer->m_Last_VoteCall + Server()->TickSpeed()*60 - Now; + if(pPlayer->m_Last_VoteCall && Timeleft > 0) { char aChatmsg[512] = {0}; str_format(aChatmsg, sizeof(aChatmsg), "You must wait %d seconds before making another vote", (Timeleft/Server()->TickSpeed())+1); - SendChatTarget(ClientId, aChatmsg); + SendChatTarget(ClientID, aChatmsg); return; } @@ -627,7 +627,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) { if(str_comp_nocase(pMsg->m_Value, pOption->m_aCommand) == 0) { - str_format(aChatmsg, sizeof(aChatmsg), "'%s' called vote to change server option '%s'", Server()->ClientName(ClientId), pOption->m_aCommand); + str_format(aChatmsg, sizeof(aChatmsg), "'%s' called vote to change server option '%s'", Server()->ClientName(ClientID), pOption->m_aCommand); str_format(aDesc, sizeof(aDesc), "%s", pOption->m_aCommand); str_format(aCmd, sizeof(aCmd), "%s", pOption->m_aCommand); break; @@ -639,7 +639,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) if(!pOption) { str_format(aChatmsg, sizeof(aChatmsg), "'%s' isn't an option on this server", pMsg->m_Value); - SendChatTarget(ClientId, aChatmsg); + SendChatTarget(ClientID, aChatmsg); return; } } @@ -647,48 +647,48 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) { if(!g_Config.m_SvVoteKick) { - SendChatTarget(ClientId, "Server does not allow voting to kick players"); + SendChatTarget(ClientID, "Server does not allow voting to kick players"); return; } - int KickId = str_toint(pMsg->m_Value); - if(KickId < 0 || KickId >= MAX_CLIENTS || !m_apPlayers[KickId]) + int KickID = str_toint(pMsg->m_Value); + if(KickID < 0 || KickID >= MAX_CLIENTS || !m_apPlayers[KickID]) { - SendChatTarget(ClientId, "Invalid client id to kick"); + SendChatTarget(ClientID, "Invalid client id to kick"); return; } - if(KickId == ClientId) + if(KickID == ClientID) { - SendChatTarget(ClientId, "You cant kick yourself"); + SendChatTarget(ClientID, "You cant kick yourself"); return; } - if(Server()->IsAuthed(KickId)) + if(Server()->IsAuthed(KickID)) { - SendChatTarget(ClientId, "You cant kick admins"); + SendChatTarget(ClientID, "You cant kick admins"); char aBufKick[128]; - str_format(aBufKick, sizeof(aBufKick), "'%s' called for vote to kick you", Server()->ClientName(ClientId)); - SendChatTarget(KickId, aBufKick); + str_format(aBufKick, sizeof(aBufKick), "'%s' called for vote to kick you", Server()->ClientName(ClientID)); + SendChatTarget(KickID, aBufKick); return; } const char *pReason = "No reason given"; - for(const char *p = pMsg->m_Value; *p; ++p) + for(const char *pStr = pMsg->m_Value; *pStr; ++pStr) { - if(*p == ' ') + if(*pStr == ' ') { - pReason = p+1; + pReason = pStr+1; break; } } - str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientId), Server()->ClientName(KickId), pReason); - str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId)); + str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientID), Server()->ClientName(KickID), pReason); + str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickID)); if (!g_Config.m_SvVoteKickBantime) - str_format(aCmd, sizeof(aCmd), "kick %d Kicked by vote", KickId); + str_format(aCmd, sizeof(aCmd), "kick %d Kicked by vote", KickID); else { char aBuf[64] = {0}; - Server()->GetClientIP(KickId, aBuf, sizeof(aBuf)); + Server()->GetClientIP(KickID, aBuf, sizeof(aBuf)); str_format(aCmd, sizeof(aCmd), "ban %s %d Banned by vote", aBuf, g_Config.m_SvVoteKickBantime); } } @@ -697,127 +697,127 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) { SendChat(-1, CGameContext::CHAT_ALL, aChatmsg); StartVote(aDesc, aCmd); - p->m_Vote = 1; - p->m_VotePos = m_VotePos = 1; - m_VoteCreator = ClientId; - p->m_Last_VoteCall = Now; + pPlayer->m_Vote = 1; + pPlayer->m_VotePos = m_VotePos = 1; + m_VoteCreator = ClientID; + pPlayer->m_Last_VoteCall = Now; } } - else if(MsgId == NETMSGTYPE_CL_VOTE) + else if(MsgID == NETMSGTYPE_CL_VOTE) { if(!m_VoteCloseTime) return; - if(p->m_Vote == 0) + if(pPlayer->m_Vote == 0) { CNetMsg_Cl_Vote *pMsg = (CNetMsg_Cl_Vote *)pRawMsg; if(!pMsg->m_Vote) return; - p->m_Vote = pMsg->m_Vote; - p->m_VotePos = ++m_VotePos; + pPlayer->m_Vote = pMsg->m_Vote; + pPlayer->m_VotePos = ++m_VotePos; m_VoteUpdate = true; } } - else if (MsgId == NETMSGTYPE_CL_SETTEAM && !m_World.m_Paused) + else if (MsgID == NETMSGTYPE_CL_SETTEAM && !m_World.m_Paused) { CNetMsg_Cl_SetTeam *pMsg = (CNetMsg_Cl_SetTeam *)pRawMsg; - if(p->GetTeam() == pMsg->m_Team || (g_Config.m_SvSpamprotection && p->m_Last_SetTeam && p->m_Last_SetTeam+Server()->TickSpeed()*3 > Server()->Tick())) + if(pPlayer->GetTeam() == pMsg->m_Team || (g_Config.m_SvSpamprotection && pPlayer->m_Last_SetTeam && pPlayer->m_Last_SetTeam+Server()->TickSpeed()*3 > Server()->Tick())) return; // Switch team on given client and kill/respawn him - if(m_pController->CanJoinTeam(pMsg->m_Team, ClientId)) + if(m_pController->CanJoinTeam(pMsg->m_Team, ClientID)) { - if(m_pController->CanChangeTeam(p, pMsg->m_Team)) + if(m_pController->CanChangeTeam(pPlayer, pMsg->m_Team)) { - p->m_Last_SetTeam = Server()->Tick(); - if(p->GetTeam() == TEAM_SPECTATORS || pMsg->m_Team == TEAM_SPECTATORS) + pPlayer->m_Last_SetTeam = Server()->Tick(); + if(pPlayer->GetTeam() == TEAM_SPECTATORS || pMsg->m_Team == TEAM_SPECTATORS) m_VoteUpdate = true; - p->SetTeam(pMsg->m_Team); + pPlayer->SetTeam(pMsg->m_Team); (void)m_pController->CheckTeamBalance(); } else - SendBroadcast("Teams must be balanced, please join other team", ClientId); + SendBroadcast("Teams must be balanced, please join other team", ClientID); } else { char aBuf[128]; str_format(aBuf, sizeof(aBuf), "Only %d active players are allowed", g_Config.m_SvMaxClients-g_Config.m_SvSpectatorSlots); - SendBroadcast(aBuf, ClientId); + SendBroadcast(aBuf, ClientID); } } - else if (MsgId == NETMSGTYPE_CL_CHANGEINFO || MsgId == NETMSGTYPE_CL_STARTINFO) + else if (MsgID == NETMSGTYPE_CL_CHANGEINFO || MsgID == NETMSGTYPE_CL_STARTINFO) { CNetMsg_Cl_ChangeInfo *pMsg = (CNetMsg_Cl_ChangeInfo *)pRawMsg; - if(g_Config.m_SvSpamprotection && p->m_Last_ChangeInfo && p->m_Last_ChangeInfo+Server()->TickSpeed()*5 > Server()->Tick()) + if(g_Config.m_SvSpamprotection && pPlayer->m_Last_ChangeInfo && pPlayer->m_Last_ChangeInfo+Server()->TickSpeed()*5 > Server()->Tick()) return; - p->m_Last_ChangeInfo = Server()->Tick(); + pPlayer->m_Last_ChangeInfo = Server()->Tick(); - p->m_TeeInfos.m_UseCustomColor = pMsg->m_UseCustomColor; - p->m_TeeInfos.m_ColorBody = pMsg->m_ColorBody; - p->m_TeeInfos.m_ColorFeet = pMsg->m_ColorFeet; + pPlayer->m_TeeInfos.m_UseCustomColor = pMsg->m_UseCustomColor; + pPlayer->m_TeeInfos.m_ColorBody = pMsg->m_ColorBody; + pPlayer->m_TeeInfos.m_ColorFeet = pMsg->m_ColorFeet; // copy old name char aOldName[MAX_NAME_LENGTH]; - str_copy(aOldName, Server()->ClientName(ClientId), MAX_NAME_LENGTH); + str_copy(aOldName, Server()->ClientName(ClientID), MAX_NAME_LENGTH); - Server()->SetClientName(ClientId, pMsg->m_pName); - if(MsgId == NETMSGTYPE_CL_CHANGEINFO && str_comp(aOldName, Server()->ClientName(ClientId)) != 0) + Server()->SetClientName(ClientID, pMsg->m_pName); + if(MsgID == NETMSGTYPE_CL_CHANGEINFO && str_comp(aOldName, Server()->ClientName(ClientID)) != 0) { char aChatText[256]; - str_format(aChatText, sizeof(aChatText), "'%s' changed name to '%s'", aOldName, Server()->ClientName(ClientId)); + str_format(aChatText, sizeof(aChatText), "'%s' changed name to '%s'", aOldName, Server()->ClientName(ClientID)); SendChat(-1, CGameContext::CHAT_ALL, aChatText); } // set skin - str_copy(p->m_TeeInfos.m_SkinName, pMsg->m_pSkin, sizeof(p->m_TeeInfos.m_SkinName)); + str_copy(pPlayer->m_TeeInfos.m_SkinName, pMsg->m_pSkin, sizeof(pPlayer->m_TeeInfos.m_SkinName)); - m_pController->OnPlayerInfoChange(p); + m_pController->OnPlayerInfoChange(pPlayer); - if(MsgId == NETMSGTYPE_CL_STARTINFO) + if(MsgID == NETMSGTYPE_CL_STARTINFO) { // send vote options CNetMsg_Sv_VoteClearOptions ClearMsg; - Server()->SendPackMsg(&ClearMsg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&ClearMsg, MSGFLAG_VITAL, ClientID); CVoteOption *pCurrent = m_pVoteOptionFirst; while(pCurrent) { CNetMsg_Sv_VoteOption OptionMsg; OptionMsg.m_pCommand = pCurrent->m_aCommand; - Server()->SendPackMsg(&OptionMsg, MSGFLAG_VITAL, ClientId); + Server()->SendPackMsg(&OptionMsg, MSGFLAG_VITAL, ClientID); pCurrent = pCurrent->m_pNext; } // send tuning parameters to client - SendTuningParams(ClientId); + SendTuningParams(ClientID); // CNetMsg_Sv_ReadyToEnter m; - Server()->SendPackMsg(&m, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientId); + Server()->SendPackMsg(&m, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); } } - else if (MsgId == NETMSGTYPE_CL_EMOTICON && !m_World.m_Paused) + else if (MsgID == NETMSGTYPE_CL_EMOTICON && !m_World.m_Paused) { CNetMsg_Cl_Emoticon *pMsg = (CNetMsg_Cl_Emoticon *)pRawMsg; - if(g_Config.m_SvSpamprotection && p->m_Last_Emote && p->m_Last_Emote+Server()->TickSpeed()*3 > Server()->Tick()) + if(g_Config.m_SvSpamprotection && pPlayer->m_Last_Emote && pPlayer->m_Last_Emote+Server()->TickSpeed()*3 > Server()->Tick()) return; - p->m_Last_Emote = Server()->Tick(); + pPlayer->m_Last_Emote = Server()->Tick(); - SendEmoticon(ClientId, pMsg->m_Emoticon); + SendEmoticon(ClientID, pMsg->m_Emoticon); } - else if (MsgId == NETMSGTYPE_CL_KILL && !m_World.m_Paused) + else if (MsgID == NETMSGTYPE_CL_KILL && !m_World.m_Paused) { - if(p->m_Last_Kill && p->m_Last_Kill+Server()->TickSpeed()*3 > Server()->Tick()) + if(pPlayer->m_Last_Kill && pPlayer->m_Last_Kill+Server()->TickSpeed()*3 > Server()->Tick()) return; - p->m_Last_Kill = Server()->Tick(); - p->KillCharacter(WEAPON_SELF); - p->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()*3; + pPlayer->m_Last_Kill = Server()->Tick(); + pPlayer->KillCharacter(WEAPON_SELF); + pPlayer->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()*3; } } @@ -841,8 +841,8 @@ void CGameContext::ConTuneParam(IConsole::IResult *pResult, void *pUserData) void CGameContext::ConTuneReset(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; - CTuningParams p; - *pSelf->Tuning() = p; + CTuningParams TuningParams; + *pSelf->Tuning() = TuningParams; pSelf->SendTuningParams(-1); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "Tuning reset"); } @@ -853,9 +853,9 @@ void CGameContext::ConTuneDump(IConsole::IResult *pResult, void *pUserData) char aBuf[256]; for(int i = 0; i < pSelf->Tuning()->Num(); i++) { - float v; - pSelf->Tuning()->Get(i, &v); - str_format(aBuf, sizeof(aBuf), "%s %.2f", pSelf->Tuning()->m_apNames[i], v); + float V; + pSelf->Tuning()->Get(i, &V); + str_format(aBuf, sizeof(aBuf), "%s %.2f", pSelf->Tuning()->m_apNames[i], V); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf); } } @@ -890,17 +890,17 @@ void CGameContext::ConSay(IConsole::IResult *pResult, void *pUserData) void CGameContext::ConSetTeam(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; - int ClientId = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1); + int ClientID = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1); int Team = clamp(pResult->GetInteger(1), -1, 1); char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "moved client %d to team %d", ClientId, Team); + str_format(aBuf, sizeof(aBuf), "moved client %d to team %d", ClientID, Team); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); - if(!pSelf->m_apPlayers[ClientId]) + if(!pSelf->m_apPlayers[ClientID]) return; - pSelf->m_apPlayers[ClientId]->SetTeam(Team); + pSelf->m_apPlayers[ClientID]->SetTeam(Team); (void)pSelf->m_pController->CheckTeamBalance(); } @@ -1112,16 +1112,16 @@ void CGameContext::OnShutdown() Clear(); } -void CGameContext::OnSnap(int ClientId) +void CGameContext::OnSnap(int ClientID) { - m_World.Snap(ClientId); - m_pController->Snap(ClientId); - m_Events.Snap(ClientId); + m_World.Snap(ClientID); + m_pController->Snap(ClientID); + m_Events.Snap(ClientID); for(int i = 0; i < MAX_CLIENTS; i++) { if(m_apPlayers[i]) - m_apPlayers[i]->Snap(ClientId); + m_apPlayers[i]->Snap(ClientID); } } void CGameContext::OnPreSnap() {} diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 99e7e56d..6ad7204d 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -80,14 +80,14 @@ public: CGameWorld m_World; // helper functions - class CCharacter *GetPlayerChar(int ClientId); + class CCharacter *GetPlayerChar(int ClientID); // voting void StartVote(const char *pDesc, const char *pCommand); void EndVote(); - void SendVoteSet(int ClientId); - void SendVoteStatus(int ClientId, int Total, int Yes, int No); - void AbortVoteKickOnDisconnect(int ClientId); + void SendVoteSet(int ClientID); + void SendVoteStatus(int ClientID, int Total, int Yes, int No); + void AbortVoteKickOnDisconnect(int ClientID); int m_VoteCreator; int64 m_VoteCloseTime; @@ -133,15 +133,15 @@ public: // network void SendChatTarget(int To, const char *pText); - void SendChat(int ClientId, int Team, const char *pText); - void SendEmoticon(int ClientId, int Emoticon); - void SendWeaponPickup(int ClientId, int Weapon); - void SendBroadcast(const char *pText, int ClientId); + void SendChat(int ClientID, int Team, const char *pText); + void SendEmoticon(int ClientID, int Emoticon); + void SendWeaponPickup(int ClientID, int Weapon); + void SendBroadcast(const char *pText, int ClientID); // void CheckPureTuning(); - void SendTuningParams(int ClientId); + void SendTuningParams(int ClientID); // engine events virtual void OnInit(); @@ -150,23 +150,23 @@ public: virtual void OnTick(); virtual void OnPreSnap(); - virtual void OnSnap(int ClientId); + virtual void OnSnap(int ClientID); virtual void OnPostSnap(); - virtual void OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId); + virtual void OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID); - virtual void OnClientConnected(int ClientId); - virtual void OnClientEnter(int ClientId); - virtual void OnClientDrop(int ClientId); - virtual void OnClientDirectInput(int ClientId, void *pInput); - virtual void OnClientPredictedInput(int ClientId, void *pInput); + virtual void OnClientConnected(int ClientID); + virtual void OnClientEnter(int ClientID); + virtual void OnClientDrop(int ClientID); + virtual void OnClientDirectInput(int ClientID, void *pInput); + virtual void OnClientPredictedInput(int ClientID, void *pInput); virtual const char *Version(); virtual const char *NetVersion(); }; inline int CmaskAll() { return -1; } -inline int CmaskOne(int ClientId) { return 1<<ClientId; } -inline int CmaskAllExceptOne(int ClientId) { return 0x7fffffff^CmaskOne(ClientId); } -inline bool CmaskIsSet(int Mask, int ClientId) { return (Mask&CmaskOne(ClientId)) != 0; } +inline int CmaskOne(int ClientID) { return 1<<ClientID; } +inline int CmaskAllExceptOne(int ClientID) { return 0x7fffffff^CmaskOne(ClientID); } +inline bool CmaskIsSet(int Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; } #endif diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index d3de11e7..9cabf0cb 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -349,17 +349,17 @@ void IGameController::DoWarmup(int Seconds) m_Warmup = Seconds*Server()->TickSpeed(); } -bool IGameController::IsFriendlyFire(int Cid1, int Cid2) +bool IGameController::IsFriendlyFire(int ClientID1, int ClientID2) { - if(Cid1 == Cid2) + if(ClientID1 == ClientID2) return false; if(IsTeamplay()) { - if(!GameServer()->m_apPlayers[Cid1] || !GameServer()->m_apPlayers[Cid2]) + if(!GameServer()->m_apPlayers[ClientID1] || !GameServer()->m_apPlayers[ClientID2]) return false; - if(GameServer()->m_apPlayers[Cid1]->GetTeam() == GameServer()->m_apPlayers[Cid2]->GetTeam()) + if(GameServer()->m_apPlayers[ClientID1]->GetTeam() == GameServer()->m_apPlayers[ClientID2]->GetTeam()) return true; } @@ -377,7 +377,7 @@ bool IGameController::IsForceBalanced() return false; } -bool IGameController::CanBeMovedOnBalance(int Cid) +bool IGameController::CanBeMovedOnBalance(int ClientID) { return true; } @@ -568,7 +568,7 @@ void IGameController::Snap(int SnappingClient) } } -int IGameController::GetAutoTeam(int Notthisid) +int IGameController::GetAutoTeam(int NotThisID) { // this will force the auto balancer to work overtime aswell if(g_Config.m_DbgStress) @@ -577,7 +577,7 @@ int IGameController::GetAutoTeam(int Notthisid) int aNumplayers[2] = {0,0}; for(int i = 0; i < MAX_CLIENTS; i++) { - if(GameServer()->m_apPlayers[i] && i != Notthisid) + if(GameServer()->m_apPlayers[i] && i != NotThisID) { if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE) aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++; @@ -588,20 +588,20 @@ int IGameController::GetAutoTeam(int Notthisid) if(IsTeamplay()) Team = aNumplayers[TEAM_RED] > aNumplayers[TEAM_BLUE] ? TEAM_BLUE : TEAM_RED; - if(CanJoinTeam(Team, Notthisid)) + if(CanJoinTeam(Team, NotThisID)) return Team; return -1; } -bool IGameController::CanJoinTeam(int Team, int Notthisid) +bool IGameController::CanJoinTeam(int Team, int NotThisID) { - if(Team == TEAM_SPECTATORS || (GameServer()->m_apPlayers[Notthisid] && GameServer()->m_apPlayers[Notthisid]->GetTeam() != TEAM_SPECTATORS)) + if(Team == TEAM_SPECTATORS || (GameServer()->m_apPlayers[NotThisID] && GameServer()->m_apPlayers[NotThisID]->GetTeam() != TEAM_SPECTATORS)) return true; int aNumplayers[2] = {0,0}; for(int i = 0; i < MAX_CLIENTS; i++) { - if(GameServer()->m_apPlayers[i] && i != Notthisid) + if(GameServer()->m_apPlayers[i] && i != NotThisID) { if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE) aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++; diff --git a/src/game/server/gamecontroller.h b/src/game/server/gamecontroller.h index 070cb094..36989454 100644 --- a/src/game/server/gamecontroller.h +++ b/src/game/server/gamecontroller.h @@ -77,14 +77,14 @@ public: void EndRound(); void ChangeMap(const char *pToMap); - bool IsFriendlyFire(int Cid1, int Cid2); + bool IsFriendlyFire(int ClientID1, int ClientID2); bool IsForceBalanced(); /* */ - virtual bool CanBeMovedOnBalance(int Cid); + virtual bool CanBeMovedOnBalance(int ClientID); virtual void Tick(); @@ -135,8 +135,8 @@ public: */ virtual const char *GetTeamName(int Team); - virtual int GetAutoTeam(int NotThisId); - virtual bool CanJoinTeam(int Team, int NotThisId); + virtual int GetAutoTeam(int NotThisID); + virtual bool CanJoinTeam(int Team, int NotThisID); bool CheckTeamBalance(); bool CanChangeTeam(CPlayer *pPplayer, int JoinTeam); int ClampTeam(int Team); diff --git a/src/game/server/gamemodes/ctf.cpp b/src/game/server/gamemodes/ctf.cpp index 6cefe435..f4ef6808 100644 --- a/src/game/server/gamemodes/ctf.cpp +++ b/src/game/server/gamemodes/ctf.cpp @@ -63,9 +63,9 @@ int CGameControllerCTF::OnCharacterDeath(class CCharacter *pVictim, class CPlaye return HadFlag; } -bool CGameControllerCTF::CanBeMovedOnBalance(int Cid) +bool CGameControllerCTF::CanBeMovedOnBalance(int ClientID) { - CCharacter* Character = GameServer()->m_apPlayers[Cid]->GetCharacter(); + CCharacter* Character = GameServer()->m_apPlayers[ClientID]->GetCharacter(); if(Character) { for(int fi = 0; fi < 2; fi++) diff --git a/src/game/server/gamemodes/ctf.h b/src/game/server/gamemodes/ctf.h index ffe0baba..e6fb9c89 100644 --- a/src/game/server/gamemodes/ctf.h +++ b/src/game/server/gamemodes/ctf.h @@ -11,7 +11,7 @@ public: class CFlag *m_apFlags[2]; CGameControllerCTF(class CGameContext *pGameServer); - virtual bool CanBeMovedOnBalance(int Cid); + virtual bool CanBeMovedOnBalance(int ClientID); virtual void Tick(); virtual bool OnEntity(int Index, vec2 Pos); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 5147cbfb..32eec986 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -9,14 +9,14 @@ MACRO_ALLOC_POOL_ID_IMPL(CPlayer, MAX_CLIENTS) IServer *CPlayer::Server() const { return m_pGameServer->Server(); } -CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team) +CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) { m_pGameServer = pGameServer; m_RespawnTick = Server()->Tick(); m_DieTick = Server()->Tick(); m_ScoreStartTick = Server()->Tick(); Character = 0; - this->m_ClientID = CID; + this->m_ClientID = ClientID; m_Team = GameServer()->m_pController->ClampTeam(Team); m_LastActionTick = Server()->Tick(); } @@ -102,7 +102,7 @@ void CPlayer::Snap(int SnappingClient) pPlayerInfo->m_Latency = m_Latency.m_Min; pPlayerInfo->m_LatencyFlux = m_Latency.m_Max-m_Latency.m_Min; pPlayerInfo->m_Local = 0; - pPlayerInfo->m_ClientId = m_ClientID; + pPlayerInfo->m_ClientID = m_ClientID; pPlayerInfo->m_Score = m_Score; pPlayerInfo->m_Team = m_Team; diff --git a/src/game/server/player.h b/src/game/server/player.h index c4c413fc..fbbf5567 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -13,7 +13,7 @@ class CPlayer MACRO_ALLOC_POOL_ID() public: - CPlayer(CGameContext *pGameServer, int CID, int Team); + CPlayer(CGameContext *pGameServer, int ClientID, int Team); ~CPlayer(); void Init(int CID); |