Skip to content
This repository was archived by the owner on May 25, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions BUILD_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ https://developer.valvesoftware.com/wiki/Source_SDK_2013

## Steam mod setup
https://developer.valvesoftware.com/wiki/Setup_mod_on_steam

## Linux extra notes
### Arch Linux
Install `lib32-gperftools`, and set: `LD_PRELOAD=/usr/lib32/libtcmalloc.so %command% -game /path/to/mp/game/neo` as launch argument

6 changes: 5 additions & 1 deletion mp/src/fgdlib/gdvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "fgdlib/WCKeyValues.h"
#include "fgdlib/gdvar.h"

#ifdef _WIN32
#define snprintf _snprintf
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

Expand Down Expand Up @@ -669,7 +673,7 @@ void GDinputvariable::ToKeyValue(MDkeyvalue *pkv)
}
else if (eStoreAs == INTEGER)
{
itoa(m_nValue, pkv->szValue, 10);
snprintf(pkv->szValue, KEYVALUE_MAX_VALUE_LENGTH, "%d", m_nValue);
}
}

Expand Down
6 changes: 5 additions & 1 deletion mp/src/fgdlib/wckeyvalues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "fgdlib/WCKeyValues.h"

#ifdef _WIN32
#define snprintf _snprintf
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

Expand Down Expand Up @@ -169,7 +173,7 @@ template<class Base>
void WCKeyValuesT<Base>::SetValue(const char *pszKey, int iValue)
{
char szValue[100];
itoa(iValue, szValue, 10);
snprintf(szValue, 100, "%d", iValue);

SetValue(pszKey, szValue);
}
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/client/client_base.vpc
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ $Project
$File "$SRCDIR\game\shared\mp_shareddefs.cpp"
$File "$SRCDIR\game\client\c_vote_controller.h"
$File "$SRCDIR\game\client\c_vote_controller.cpp"
$File "$SRCDIR\game\shared\inttostr.cpp"
//Haptics
$File "$SRCDIR\public\haptics\haptic_msgs.cpp" [!$X360]
$File "$SRCDIR\public\haptics\haptic_utils.cpp" [$WIN32&&!$X360]
Expand Down Expand Up @@ -1219,6 +1220,7 @@ $Project
$File "$SRCDIR\game\shared\weapon_proficiency.h"
$File "$SRCDIR\game\shared\weapon_ifmsteadycam.h"
$File "$SRCDIR\game\shared\mp_shareddefs.h"
$File "$SRCDIR\game\shared\inttostr.h"
}

$Folder "game_controls Header Files"
Expand Down
4 changes: 2 additions & 2 deletions mp/src/game/client/neo/game_controls/neo_teammenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ void CNeoTeamMenu::Update()
wchar_t textUnicode_Jinrai[sizeof(wchar_t) * sizeof(textAscii)];
wchar_t textUnicode_NSF[sizeof(wchar_t) * sizeof(textAscii)];

itoa(numPlayersJinrai, textAscii, sizeof(numPlayersJinrai));
inttostr(textAscii, 3, numPlayersJinrai);
g_pVGuiLocalize->ConvertANSIToUnicode(textAscii, textUnicode_Jinrai, sizeof(textUnicode_Jinrai));
m_pJinrai_PlayercountLabel->SetText(textUnicode_Jinrai);

itoa(numPlayersNSF, textAscii, sizeof(numPlayersNSF));
inttostr(textAscii, 3, numPlayersNSF);
g_pVGuiLocalize->ConvertANSIToUnicode(textAscii, textUnicode_NSF, sizeof(textUnicode_NSF));
m_pNSF_PlayercountLabel->SetText(textUnicode_NSF);
#endif
Expand Down
3 changes: 2 additions & 1 deletion mp/src/game/client/neo/ui/neo_hud_ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ienginevgui.h"

#include "neo_hud_elements.h"
#include "inttostr.h"

#include "ammodef.h"

Expand Down Expand Up @@ -152,7 +153,7 @@ void CNEOHud_Ammo::DrawAmmo() const
{
const int maxLen = 4; // support a max of '999' clips, plus '\0'
char clipsText[maxLen]{ '\0' };
itoa(numClips, clipsText, 10);
inttostr(clipsText, maxLen, numClips);
textLen = V_strlen(clipsText);
wchar_t unicodeClipsText[maxLen]{ L'\0' };
g_pVGuiLocalize->ConvertANSIToUnicode(clipsText, unicodeClipsText, sizeof(unicodeClipsText));
Expand Down
4 changes: 2 additions & 2 deletions mp/src/game/client/neo/ui/neo_hud_childelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CNEOHud_ChildElement
virtual ~CNEOHud_ChildElement() { }

protected:
virtual void DrawNeoHudRoundedBox(const int x0, const int y0, const int x1, const int y1) const final;
virtual void DrawNeoHudRoundedBox(const int x0, const int y0, const int x1, const int y1) const;

virtual void UpdateStateForNeoHudElementDraw() = 0;
virtual void DrawNeoHudElement() = 0;
Expand Down Expand Up @@ -93,4 +93,4 @@ class CNEOHud_ChildElement
CNEOHud_ChildElement(CNEOHud_ChildElement& other);
};

#endif // NEO_HUD_CHILDELEMENT_H
#endif // NEO_HUD_CHILDELEMENT_H
7 changes: 4 additions & 3 deletions mp/src/game/client/neo/ui/neo_hud_health_thermoptic_aux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ienginevgui.h"

#include "neo_hud_elements.h"
#include "inttostr.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
Expand Down Expand Up @@ -103,9 +104,9 @@ void CNEOHud_HTA::DrawHTA() const
const int thermoptic = player->m_HL2Local.m_flSuitPower;
const int aux = player->m_HL2Local.m_flSuitPower;

itoa(health, value_Integrity, 10);
itoa(thermoptic, value_ThermOptic, 10);
itoa(aux, value_Aux, 10);
inttostr(value_Integrity, 10, health);
inttostr(value_ThermOptic, 10, thermoptic);
inttostr(value_Aux, 10, aux);

const int valLen_Integrity = V_strlen(value_Integrity);
const int valLen_ThermOptic = V_strlen(value_ThermOptic);
Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_round_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ CNEOHud_RoundState::CNEOHud_RoundState(const char *pElementName, vgui::Panel *pa
starF = new vgui::ImagePanel(this, "star_foxtrot");
starF->SetImage(vgui::scheme()->GetImage("hud/star_foxtrot", starsHwFiltered));

const auto stars = { starNone, starA, starB, starC, starD, starE, starF };
vgui::ImagePanel *stars[] = { starNone, starA, starB, starC, starD, starE, starF };

const bool starAutoDelete = true;
COMPILE_TIME_ASSERT(starAutoDelete); // If not, we need to handle that memory on dtor manually
Expand Down
4 changes: 2 additions & 2 deletions mp/src/game/client/neo/ui/neo_hud_round_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CNEOHud_RoundState : public CNEOHud_ChildElement, public CHudElement, publ
char m_szStatusANSI[6];
wchar_t m_wszStatusUnicode[6];

vgui::ImagePanel* starNone, *starA, *starB, *starC, *starD, *starE, *starF;
vgui::ImagePanel *starNone, *starA, *starB, *starC, *starD, *starE, *starF;

int m_iPreviouslyActiveStar;
int m_iPreviouslyActiveTeam;
Expand All @@ -45,4 +45,4 @@ class CNEOHud_RoundState : public CNEOHud_ChildElement, public CHudElement, publ
CNEOHud_RoundState(const CNEOHud_RoundState &other);
};

#endif // NEO_HUD_ROUND_STATE_H
#endif // NEO_HUD_ROUND_STATE_H
2 changes: 2 additions & 0 deletions mp/src/game/server/server_base.vpc
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ $Project
$File "world.cpp"
$File "world.h"
$File "$SRCDIR\game\shared\mp_shareddefs.cpp"
$File "$SRCDIR\game\shared\inttostr.cpp"
$File "$SRCDIR\game\shared\SharedFunctorUtils.h"
$File "$SRCDIR\game\server\vote_controller.h"
$File "$SRCDIR\game\server\vote_controller.cpp"
Expand Down Expand Up @@ -993,6 +994,7 @@ $Project
$File "$SRCDIR\public\worldsize.h"
$File "$SRCDIR\public\zip_uncompressed.h"
$File "$SRCDIR\game\shared\mp_shareddefs.h"
$File "$SRCDIR\game\shared\inttostr.h"
$File "$SRCDIR\game\shared\econ\ihasowner.h"
//Haptics
$File "$SRCDIR\public\haptics\haptic_utils.h" [$WIN32]
Expand Down
14 changes: 14 additions & 0 deletions mp/src/game/shared/inttostr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "cbase.h"
#include "inttostr.h"

#include <stdio.h>
#include <stdlib.h>

void inttostr(char *str, const int strSize, const int srcInt)
{
#ifdef _WIN32
itoa(srcInt, str, strSize);
#else
snprintf(str, strSize, "%d", srcInt);
#endif
}
10 changes: 10 additions & 0 deletions mp/src/game/shared/inttostr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INTTOSTR_H
#define INTTOSTR_H
#ifdef _WIN32
#pragma once
#endif

void inttostr(char *str, const int strSize, const int src);

#endif // INTTOSTR_H

3 changes: 2 additions & 1 deletion mp/src/game/shared/neo/neo_mount_original.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "shareddefs.h"
#include "steam/steam_api.h"
#include "filesystem.h"
#include "inttostr.h"

#ifdef LINUX
// User for renaming folder paths.
Expand Down Expand Up @@ -85,7 +86,7 @@ bool IsNeoGameInfoPathOK(char *out_neoPath, const int pathLen)
for (int i = 1; i <= maxExtraLibs; i++)
{
char libStr[3];
itoa(i, libStr, sizeof(libStr));
inttostr(libStr, 3, i);

KeyValues *pKvLib = pKvLibFolders->FindKey(libStr);
if (!pKvLib)
Expand Down
6 changes: 5 additions & 1 deletion mp/src/utils/vbsp/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#include "fgdlib/fgdlib.h"
#include "manifest.h"

#ifdef _WIN32
#define snprintf _snprintf
#endif

#ifdef VSVMFIO
#include "VmfImport.h"
#endif // VSVMFIO
Expand Down Expand Up @@ -1271,7 +1275,7 @@ void ConvertSideList( entity_t *mapent, char *key )
}

char szIndex[15];
itoa( nIndex, szIndex, 10 );
snprintf(szIndex, 15, "%d", nIndex);
strcat( szNewValue, szIndex );
}
}
Expand Down