Skip to content
Merged
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
13 changes: 11 additions & 2 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set ownership
run: |
Expand All @@ -52,7 +54,7 @@ jobs:
echo "preset_name=$preset_name" >> "$GITHUB_ENV"

- name: Git fetch tags
run: git fetch origin --tags
run: git fetch origin --tags --force

# Libraries

Expand Down Expand Up @@ -157,6 +159,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set reusable strings
run: |
Expand All @@ -183,7 +187,7 @@ jobs:
echo "PATH: $PATH"

- name: Git fetch tags
run: git fetch origin --tags
run: git fetch origin --tags --force

# Libraries

Expand Down Expand Up @@ -270,6 +274,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set reusable strings
run: |
Expand All @@ -281,6 +287,9 @@ jobs:
echo "build_dir=$build_dir" >> "$GITHUB_ENV"
echo "install_dir=$install_dir" >> "$GITHUB_ENV"

- name: Git fetch tags
run: git fetch origin --tags --force

- name: Install packages
run: choco install -y ninja

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ textwindow_temp.html
# Auto-generated by CMake
/game/neo/resource/GameMenu.res
/src/game/shared/neo/neo_version_info.cpp
/src/game/shared/neo/neo_version_number.h

# News cache
/game/neo/news.txt
Expand Down
28 changes: 27 additions & 1 deletion src/cmake/build_info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,29 @@ execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_LATESTTAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

# Get version number from GIT_LATESTTAG
# EX: v20.0-alpha -> 20 0
message(STATUS "GIT_LATESTTAG: ${GIT_LATESTTAG}")
if ("${GIT_LATESTTAG}" STREQUAL "")
message(FATAL_ERROR "Failed to get git tag")
endif ()
string(REPLACE "-" ";" GIT_LATESTTAG_SPLIT "${GIT_LATESTTAG}")
list(GET GIT_LATESTTAG_SPLIT 0 GIT_LATESTTAG_0)
string(REPLACE "v" "" GIT_LATESTTAG_VERSION "${GIT_LATESTTAG_0}")
string(REPLACE "." ";" GIT_LATESTTAG_VERSION_SPLIT "${GIT_LATESTTAG_VERSION}")
list(GET GIT_LATESTTAG_VERSION_SPLIT 0 NEO_VERSION_MAJOR)
list(GET GIT_LATESTTAG_VERSION_SPLIT 1 NEO_VERSION_MINOR)
if ("${NEO_VERSION_MAJOR}" STREQUAL "")
message(FATAL_ERROR "Failed to get NEO_VERSION_MAJOR, check if git tag formatted correctly")
endif ()
if ("${NEO_VERSION_MINOR}" STREQUAL "")
message(FATAL_ERROR "Failed to get NEO_VERSION_MINOR, check if git tag formatted correctly")
endif ()
message(STATUS "NEO_VERSION_MAJOR: ${NEO_VERSION_MAJOR}")
message(STATUS "NEO_VERSION_MINOR: ${NEO_VERSION_MINOR}")

string(TIMESTAMP BUILD_DATE_SHORT "%Y%m%d")
string(TIMESTAMP BUILD_DATE_LONG "%Y-%m-%d")

Expand All @@ -35,3 +55,9 @@ configure_file(
${CMAKE_SOURCE_DIR}/game/shared/neo/neo_version_info.cpp
@ONLY
)

configure_file(
${CMAKE_SOURCE_DIR}/game/shared/neo/neo_version_number.h.in
${CMAKE_SOURCE_DIR}/game/shared/neo/neo_version_number.h
@ONLY
)
75 changes: 75 additions & 0 deletions src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ extern vgui::IInputInternal *g_InputInternal;

#ifdef NEO
#include "neo_version.h"
#include "neo_version_number.h"
#include "ui/neo_loading.h"
#include "ui/neo_root_serverbrowser.h"
#include "neo_player_shared.h"
Expand Down Expand Up @@ -367,6 +368,12 @@ static ConVar s_cl_load_hl1_content("cl_load_hl1_content", "0", FCVAR_ARCHIVE, "

ConVar r_lightmap_bicubic_set( "r_lightmap_bicubic_set", "0", FCVAR_ARCHIVE | FCVAR_HIDDEN, "Hack to get this convar to be re-set on first launch." );

#ifdef NEO
// Don't set current version as default here, handle it in version update check
ConVar cl_neo_cfg_version_major("cl_neo_cfg_version_major", "0", FCVAR_ARCHIVE | FCVAR_HIDDEN, "NT;RE configuration version (major)");
ConVar cl_neo_cfg_version_minor("cl_neo_cfg_version_minor", "0", FCVAR_ARCHIVE | FCVAR_HIDDEN, "NT;RE configuration version (minor)");
#endif // NEO

// Physics system
bool g_bLevelInitialized;
bool g_bTextMode = false;
Expand Down Expand Up @@ -1335,6 +1342,23 @@ static void NeoDeleteDownloadedSprays()
}
filesystem->FindClose(findHdlFL);
}

// Makes sure that: bind is not set and default button is not set before setting it
static void SetupBindIfNotSet(const char *pszBindName, const ButtonCode_t bc)
{
const char *pszBinding = gameuifuncs->GetBindingForButtonCode(bc);

const bool bBindNotUsed = gameuifuncs->GetButtonCodeForBind(pszBindName) <= BUTTON_CODE_NONE;
const bool bButtonCodeNotUsed = (!pszBinding || !pszBinding[0]);
if (bBindNotUsed && bButtonCodeNotUsed)
{
const char *pszButtonName = g_pInputSystem->ButtonCodeToString(bc);
char szCmd[128];
V_sprintf_safe(szCmd, "bind \"%s\" \"%s\"\n", pszButtonName, pszBindName);
engine->ClientCmd_Unrestricted(szCmd);
}
}

#endif // NEO

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1375,6 +1399,57 @@ void CHLClient::PostInit()
g_pCVar->FindVar("cl_neo_crosshair")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<NEO_XHAIR_SEQMAX>);
g_pCVar->FindVar("sv_use_steam_networking")->SetValue(false);
RestrictNeoClientCheats();

// ConVarRef so that it properly sets the ConVar value
ConVarRef cvr_cl_neo_cfg_version_major("cl_neo_cfg_version_major");
ConVarRef cvr_cl_neo_cfg_version_minor("cl_neo_cfg_version_minor");
const int iCfgVerMajor = cvr_cl_neo_cfg_version_major.GetInt();
const int iCfgVerMinor = cvr_cl_neo_cfg_version_minor.GetInt();
if ((iCfgVerMajor < NEO_VERSION_MAJOR) || ((iCfgVerMajor == NEO_VERSION_MAJOR) && (iCfgVerMinor < NEO_VERSION_MINOR)))
{
// NEO NOTE (nullsystem):
//
// If the config version saved in the player's convar is lower than
// current version, check if there's need to setup new keybinds.
//
// Without this, when updating the player's binds will not be updated
// with the new keybinds.
//
// Using SetupBindIfNotSet, this will only do it if the player haven't
// set the bind already and if the player haven't set the key for which
// the bind defaults to.
if (iCfgVerMajor < 22)
{
SetupBindIfNotSet("+attack3", MOUSE_MIDDLE); // Ping location
SetupBindIfNotSet("kdinfo_toggle", KEY_F11); // KD-info toggle
SetupBindIfNotSet("kdinfo_page_prev", KEY_P); // KD-info page previous
SetupBindIfNotSet("kdinfo_page_next", KEY_N); // KD-info page next
SetupBindIfNotSet("neo_mp3", KEY_M); // MP3 player toggle

// neo_aim_hold removal, +aim split to +aim and toggle_aim
// Since neo_aim_hold got removed, cannot tell if player used
// it or not, so just force toggle_aim if not set
const ButtonCode_t bcTAim = gameuifuncs->GetButtonCodeForBind("toggle_aim");
const ButtonCode_t bcPAim = gameuifuncs->GetButtonCodeForBind("+aim");
if (bcTAim <= BUTTON_CODE_NONE && bcPAim > BUTTON_CODE_NONE)
{
const char *bindBtnName = g_pInputSystem->ButtonCodeToString(bcPAim);
if (bindBtnName && bindBtnName[0])
{
char szCmd[128];

V_sprintf_safe(szCmd, "unbind \"%s\"\n", bindBtnName);
engine->ClientCmd_Unrestricted(szCmd);

V_sprintf_safe(szCmd, "bind \"%s\" \"toggle_aim\"\n", bindBtnName);
engine->ClientCmd_Unrestricted(szCmd);
}
}
}

cvr_cl_neo_cfg_version_major.SetValue(NEO_VERSION_MAJOR);
cvr_cl_neo_cfg_version_minor.SetValue(NEO_VERSION_MINOR);
}
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions src/game/shared/neo/neo_version_number.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* NEO NOTE/WARNING (nullsystem):
* neo_version_number.h is char*generated by CMake, the actual file to
* edit is neo_version_number.h.in which takes defined CMake variables
*/

static constexpr const int NEO_VERSION_MAJOR = @NEO_VERSION_MAJOR@;
static constexpr const int NEO_VERSION_MINOR = @NEO_VERSION_MINOR@;