Skip to content

Commit 5405476

Browse files
committed
Merge branch 'master' of https://github.com/rehlds/ReGameDLL_CS
2 parents c6cf29c + 0fc5213 commit 5405476

39 files changed

Lines changed: 1826 additions & 144 deletions

.github/workflows/build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
buildTests: 'Tests'
2525

2626
steps:
27+
- name: Configure
28+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
29+
2730
- name: Checkout
2831
uses: actions/checkout@v4
2932
with:
@@ -105,11 +108,6 @@ jobs:
105108
container: debian:11-slim
106109

107110
steps:
108-
- name: Checkout
109-
uses: actions/checkout@v4
110-
with:
111-
fetch-depth: 0
112-
113111
- name: Install dependencies
114112
run: |
115113
dpkg --add-architecture i386
@@ -121,6 +119,15 @@ jobs:
121119
git cmake rsync \
122120
g++ gcc
123121
122+
- name: Configure
123+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
124+
125+
- name: Checkout
126+
uses: actions/checkout@v4
127+
with:
128+
submodules: recursive
129+
fetch-depth: 0
130+
124131
- name: Build and Run unittests
125132
run: |
126133
rm -rf build && CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
9898
| mp_ct_give_player_knife | 1 | 0 | 1 | Whether Counter-Terrorist player spawn with knife. |
9999
| mp_ct_default_weapons_primary | "" | "" | - | The default primary (rifle) weapon that the CTs will spawn with. |
100100
| mp_ct_default_weapons_secondary | "usp" | "" | - | The default secondary (pistol) weapon that the CTs will spawn with. |
101+
| mp_default_weapons_random | 0 | 0 | 1 | Randomize default weapons (if there are multiple).<br/> `0` disabled<br/>`1` enabled |
101102
| mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.<br/> `0` disabled<br/>`1` enabled |
102103
| mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.<br/> `0` hide all map weapons.<br/>`1` enabled<br/>`NOTE`: Effect will work after round restart. |
103104
| mp_free_armor | 0 | 0 | 2 | Give free armor on player spawn.<br/>`0` disabled <br/>`1` Give Kevlar <br/>`2` Give Kevlar + Helmet |
@@ -123,6 +124,14 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
123124
| mp_ammo_respawn_time | 20 | 0.0 | - | The respawn time for ammunition. |
124125
| mp_vote_flags | km | 0 | - | Vote systems enabled in server.<br/>`0` voting disabled<br/>`k` votekick enabled via `vote` command<br/>`m` votemap enabled via `votemap` command |
125126
| mp_votemap_min_time | 180 | 0.0 | - | Minimum seconds that must elapse on map before `votemap` command can be used. |
127+
| mp_flymove_method | 0 | 0 | 1 | Set the method used for flymove calculations.<br/> `0` default method<br/>`1` alternative method (more accurate) |
128+
| mp_stamina_restore_rate | 0 | 0.0 | - | Framerate (FPS), that used as reference when restoring stamina (fuser2) after jump. |
129+
| mp_logkills | 1 | 0 | 1 | Log kills.<br/>`0` disabled <br/>`1` enabled |
130+
| mp_jump_height | 45 | 0.0 | - | Player jump height. |
131+
| bot_excellent_morale | 0 | 0 | 1 | Bots always have great morale regardless of defeat or victory. |
132+
| mp_randomspawn | 0 | 0 | 1 | Random player spawns<br/>`0` disabled <br/>`1` enabled<br/>`NOTE`: Navigation `maps/.nav` file required |
133+
| mp_playerid_showhealth | 1 | 0 | 2 | Player ID display mode.<br/>`0` don't show health<br/>`1` show health for teammates only (default CS behaviour)<br/>`2` show health for all players |
134+
| mp_playerid_field | 3 | 0 | 3 | Player ID field display mode.<br/>`0` don't show additional information<br/>`1` show team name<br/>`2` show health percentage<br/>`3` show both team name and health percentage |
126135
| mp_scoreboard_fix | 0 | 0 | 1 | Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit).<br/> `0` disabled<br/>`1` enabled<br/>`NOTE`: Absolutely cannot fix it in "CNCS😂" |
127136
</details>
128137

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ main()
3333
case "$C" in
3434
("intel"|"icc") CC=icc CXX=icpc ;;
3535
("gcc"|"g++") CC=gcc CXX=g++ ;;
36-
("clang|llvm") CC=clang CXX=clang++ ;;
36+
("clang"|"llvm") CC=clang CXX=clang++ ;;
3737
*)
3838
;;
3939
esac

dist/game.cfg

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,13 @@ mp_ct_default_weapons_primary ""
466466
// Default value: "usp"
467467
mp_ct_default_weapons_secondary "usp"
468468
469+
// Randomize default weapons (if there are multiple)
470+
// 0 - disabled (default behaviour)
471+
// 1 - enabled
472+
//
473+
// Default value: "0"
474+
mp_default_weapons_random "0"
475+
469476
// Give the player free armor on player spawn
470477
// 0 - No armor (default behavior)
471478
// 1 - Give Kevlar
@@ -522,7 +529,7 @@ mp_give_c4_frags "3"
522529
// Default value: "1.0"
523530
mp_hostages_rescued_ratio "1.0"
524531

525-
// Legacy func_vehicle behavior when blocked by another entity.
532+
// Legacy func_vehicle behavior when blocked by another entity.
526533
// New one is more useful for playing multiplayer.
527534
//
528535
// 0 - New behavior
@@ -622,6 +629,59 @@ mp_vote_flags "km"
622629
// Default value: "180"
623630
mp_votemap_min_time "180"
624631
632+
// Set the method used for flymove calculations.
633+
// 0 - default method
634+
// 1 - alternative method (more accurate)
635+
//
636+
// Default value: "0"
637+
mp_flymove_method "0"
638+
639+
// Framerate (FPS), that is used as a reference when restoring stamina (fuser2) after a jump.
640+
// 0 - disabled
641+
//
642+
// Default value: "0"
643+
mp_stamina_restore_rate "0"
644+
645+
// Player jump height
646+
//
647+
// Default value: "45"
648+
mp_jump_height "45"
649+
650+
// Bots always have great morale regardless of defeat or victory.
651+
// 0 - disabled (default behaviour)
652+
// 1 - enabled
653+
//
654+
// Default value: "0"
655+
bot_excellent_morale "0"
656+
657+
// Random player spawns
658+
// 0 - disabled (default behaviour)
659+
// 1 - enabled
660+
//
661+
// NOTE: Navigation "maps/.nav" file required
662+
//
663+
// Default value: "0"
664+
mp_randomspawn "0"
665+
666+
// Player ID display mode
667+
//
668+
// 0 - don't show health (default behaviour)
669+
// 1 - show health for teammates only (default CS behaviour)
670+
// 2 - show health for all players
671+
//
672+
// Default value: "1"
673+
mp_playerid_showhealth "1"
674+
675+
// Player ID field display mode
676+
//
677+
// 0 - don't show additional information
678+
// 1 - show team name
679+
// 2 - show health percentage
680+
// 3 - show both team name and health percentage
681+
//
682+
// Default value: "3"
683+
mp_playerid_field "3"
684+
625685
// Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit)
626686
// 0 - disable
627687
// 1 - enabled

regamedll/CMakeLists.txt

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,47 @@
2020
cmake_minimum_required(VERSION 3.1)
2121
project(regamedll CXX)
2222

23+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
24+
2325
option(DEBUG "Build with debug information." OFF)
2426
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
2527
option(USE_LEGACY_LIBC "Enables linking against legacy libc (<= 2.15) for compat with older distros (Debian 8/Ubuntu 16.04/Centos 7)." OFF)
28+
option(XASH_COMPAT "Enable Xash3D FWGS compatiblity (support for it's 64-bit ABI support and crossplatform library suffix)")
2629

2730
set(CMAKE_CXX_STANDARD 14)
2831
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2932

3033
# Avoid -rdynamic -fPIC options
31-
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
32-
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
34+
if (NOT XASH_COMPAT)
35+
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
36+
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
37+
endif()
3338

34-
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
35-
set(LINK_FLAGS "-m32 -s")
36-
set(LINK_LIBS dl aelf32)
39+
set(COMPILE_FLAGS "-U_FORTIFY_SOURCE")
40+
set(LINK_LIBS dl)
41+
42+
# do not strip debuginfo during link
43+
if (NOT DEBUG)
44+
set(LINK_FLAGS "-s")
45+
endif()
46+
47+
# add -m32 flag only on 64-bit systems, if building for 64-bit wasn't enabled with XASH_COMPAT
48+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
49+
if (XASH_COMPAT)
50+
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DXASH_64BIT")
51+
else()
52+
set(COMPILE_FLAGS "${COMPILE_FLAGS} -m32")
53+
set(LINK_FLAGS "${LINK_FLAGS} -m32")
54+
list(APPEND LINK_LIBS aelf32)
55+
set(CMAKE_SIZEOF_VOID_P 4)
56+
endif()
57+
endif()
58+
59+
if(XASH_COMPAT)
60+
# Xash3D FWGS Library Naming Scheme compliance
61+
# see documentation: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md
62+
include(LibraryNaming)
63+
endif()
3764

3865
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-builtin -Wno-unknown-pragmas")
3966

@@ -47,7 +74,7 @@ else()
4774
endif()
4875

4976
# Check Intel C++ compiler
50-
if ("$ENV{CXX}" MATCHES "icpc")
77+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
5178
#
5279
# -fp-model=precise
5380
# ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations
@@ -75,19 +102,23 @@ if ("$ENV{CXX}" MATCHES "icpc")
75102
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
76103
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
77104
endif()
78-
else()
79-
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
80-
# As new processors are deployed in the marketplace, the behavior of this option will change.
105+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
106+
if (NOT XASH_COMPAT OR XASH_AMD64 OR XASH_X86)
107+
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
108+
# As new processors are deployed in the marketplace, the behavior of this option will change.
109+
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
110+
-mtune=generic -msse3")
111+
endif()
112+
81113
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
82-
-mtune=generic -msse3\
83114
-fpermissive -fno-sized-deallocation\
84115
-Wno-delete-non-virtual-dtor -Wno-invalid-offsetof\
85116
-Wno-unused-variable -Wno-unused-value -Wno-unused-result -Wno-unused-function\
86117
-Wno-write-strings -Wno-switch -Wno-enum-compare\
87118
-Wno-sign-compare -Wno-format -Wno-ignored-attributes -Wno-strict-aliasing")
88119

89120
# Check Clang compiler
90-
if ("$ENV{CXX}" MATCHES "clang")
121+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
91122
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
92123
-Wno-unused-local-typedef\
93124
-Wno-unused-private-field\
@@ -102,16 +133,11 @@ else()
102133

103134
# GCC >= 8.3
104135
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
105-
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess")
136+
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess -fcf-protection=none")
106137
endif()
107138
endif()
108139
endif()
109140

110-
# GCC >= 8.3
111-
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
112-
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
113-
endif()
114-
115141
if (NOT DEBUG)
116142
set(LINK_FLAGS "${LINK_FLAGS} \
117143
-Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
@@ -378,14 +404,36 @@ if (USE_STATIC_LIBSTDC)
378404
set(LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
379405
endif()
380406

381-
set(LINK_FLAGS "${LINK_FLAGS} \
382-
-Wl,-rpath,'$ORIGIN/.' \
383-
-L${PROJECT_SOURCE_DIR}/lib/linux32")
407+
set(LINK_FLAGS "${LINK_FLAGS} -Wl,-rpath,'$ORIGIN/.'")
408+
409+
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
410+
set(LINK_FLAGS "${LINK_FLAGS} -L${PROJECT_SOURCE_DIR}/lib/linux32")
411+
endif()
384412

385413
set_target_properties(regamedll PROPERTIES
386-
OUTPUT_NAME cs
387-
PREFIX ""
388414
COMPILE_FLAGS ${COMPILE_FLAGS}
389415
LINK_FLAGS ${LINK_FLAGS}
390-
POSITION_INDEPENDENT_CODE OFF
391416
)
417+
418+
if (XASH_COMPAT)
419+
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
420+
set_target_properties(regamedll PROPERTIES
421+
OUTPUT_NAME server)
422+
else()
423+
set_target_properties(regamedll PROPERTIES
424+
PREFIX ""
425+
OUTPUT_NAME cs${POSTFIX})
426+
endif()
427+
else()
428+
set_target_properties(regamedll PROPERTIES
429+
OUTPUT_NAME cs
430+
PREFIX ""
431+
POSITION_INDEPENDENT_CODE OFF)
432+
endif()
433+
434+
install(TARGETS regamedll
435+
RUNTIME DESTINATION "cstrike/dlls/"
436+
LIBRARY DESTINATION "cstrike/dlls/"
437+
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
438+
GROUP_READ GROUP_EXECUTE
439+
WORLD_READ WORLD_EXECUTE)

0 commit comments

Comments
 (0)