Skip to content

Implement CBasePlayerItem:: hook #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
607a5cc
Implement CBasePlayerItem:: hook
lozatto Aug 13, 2024
dc16b12
[skip ci] VisualStudio: Add auto visualizer for some structures/classes
s1lentq Aug 24, 2024
3cf66de
fix mp_kill_filled_spawn (#1011)
Vaqtincha Sep 12, 2024
19714af
get rid of unsafe string functions
s1lentq Sep 12, 2024
3f628ea
DeathSound: Don't interrupt pain sounds with death sound, use any ava…
s1lentq Sep 16, 2024
9b7b169
escape feature for bots (#1012)
Vaqtincha Sep 17, 2024
9b626b1
add desc to readme (#1014)
Vaqtincha Sep 18, 2024
535ea84
client.cpp: Use macros for pfnPrecacheEvent (#1019)
Nord1cWarr1or Oct 23, 2024
7738142
CI Workflow Refactor and Fixes (#1016)
wopox1337 Oct 29, 2024
476b5f7
fix typo
s1lentq Dec 9, 2024
df7944a
Disable broken angle adjustment with throw direction in Killed to avo…
s1lentq Dec 10, 2024
942f2e6
Removed -bots and -host-improve command line params in favor of using…
s1lentq Dec 10, 2024
3efc5ad
AUG/SG552: Reset maxspeed when zooming
s1lentq Dec 10, 2024
8a77bba
always consider all human players on the server to use bot_auto_vacat…
s1lentq Dec 10, 2024
6f0d17b
fixed issues reported by static analyzer
s1lentq Dec 11, 2024
1a17ef4
Reset bot morale on new match(game) (#1025)
Vaqtincha Dec 11, 2024
17ae24e
fix build
s1lentq Dec 11, 2024
1579273
Add target_cdaudio in fgd (Closes #1030)
s1lentq Dec 11, 2024
f63ad67
Hostage minor fixes
s1lentq Dec 14, 2024
96b2ef2
Update build.yml
s1lentq Mar 27, 2025
b59bbb1
CMake improvements, add 64-bit support for use in Xash3D FWGS (#1053)
a1batross Mar 27, 2025
a7395b0
Bot Chatter: Bots will react to enemy snipers presence (#1055)
Huga22118 Mar 27, 2025
756deb1
fix: calculate UpdateLocation fun not so often (#1040)
golukon Mar 27, 2025
6adb795
Team Say refactory/enhancement (#1042)
dystopm Mar 27, 2025
b8e9726
fix: bots can't buy sec ammo if preferred pistol (ex. "WeaponPreferen…
Vaqtincha Mar 27, 2025
316405b
add new cvar "bot_excellent_morale" (#1035)
Vaqtincha Mar 27, 2025
dbec1b5
Randomspawn (#1013)
Vaqtincha Mar 27, 2025
518f142
Add new CVar mp_default_weapons_random (#1015)
Vaqtincha Mar 27, 2025
94a7eb4
added forgot pistols fiveseven and dualelite touching for vip (#1045)
Vaqtincha Mar 27, 2025
d8faea0
Add new CVar mp_jump_height (#1022)
Vaqtincha Mar 27, 2025
b44b09d
feat: add new cvar "mp_logkills" (#1039)
golukon Mar 27, 2025
b10f23e
Add new CVars mp_playerid_showhealth & mp_playerid_field (#1046)
Vaqtincha Mar 27, 2025
ce11175
Add cvar for stamina restoration speed based on fps reference. (#1005)
Garey27 Mar 27, 2025
d3fc7ac
New flymove more accurate method (#1006)
Garey27 Mar 27, 2025
f5cc6f3
AngleQuaternion: fix buffer overflow
s1lentq Apr 3, 2025
6f70d6d
ZBot: Implemented immediate reloading of nav data after bot analysis,…
s1lentq Apr 3, 2025
35082b5
fix build.sh for clang compiler
s1lentq Apr 3, 2025
a4d7439
Update player's HUD after round restart time expires, not before it
s1lentq Apr 3, 2025
f3d8d1b
fix typo
s1lentq Apr 4, 2025
0fc5213
Implements UpdateStatusBar Hook (#968)
GLoOoccK Apr 4, 2025
312dc3e
Fix defuse behavior when bomb explodes
s1lentq Apr 5, 2025
797c265
API: Implemented CBasePlayer::Observer_FindNextPlayer() (#1065)
jonathan-up Apr 6, 2025
5bf71bd
CCSBot::FindMostDangerousThreat: Fix crash when m_pActiveItem is null…
s1lentq Apr 7, 2025
99d93ba
Fix crash nav generation with impossibly-large grid
s1lentq Apr 16, 2025
a4f48f4
`FIX`: Remove grenades and C4 (#1066)
GLoOoccK Apr 20, 2025
8d5aa54
API: Knockback (#1069)
GLoOoccK Apr 20, 2025
755052d
Merge branch 'master' into HooksCBasePlayerItem
lozatto May 8, 2025
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
117 changes: 43 additions & 74 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
buildTests: 'Tests'

steps:
- name: Configure
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -32,7 +35,7 @@ jobs:
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: '16.8'
vs-version: '16'

- name: Build and Run unittests
run: |
Expand All @@ -58,95 +61,72 @@ jobs:
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb

- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
with:
name: win32
path: publish/*

testdemos:
name: 'Test demos'
runs-on: ubuntu-20.04
container: s1lentq/testdemos:latest
runs-on: ubuntu-latest
container: rehldsorg/testdemos:latest
needs: [windows]

env:
WINEDEBUG: -all
WINEDLLOVERRIDES: mshtml=
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

defaults:
run:
shell: bash
working-directory: ../../../opt/HLDS
working-directory: /opt/HLDS

strategy:
fail-fast: false
matrix:
test: [
{ file: 'cstrike-basic-1', desc: 'CS: Testing jumping, scenarios, shooting etc' },
]

steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32

- name: Play demos
- name: Setup dependencies
run: |
chown root ~
rsync -a deps/regamedll/* .
mv $GITHUB_WORKSPACE/tests/mp.dll cstrike/dlls/mp.dll

descs=(
"CS: Testing jumping, scenarios, shooting etc"
)

demos=(
"cstrike-basic-1"
)

retVal=0
for i in "${!demos[@]}"; do
params=$(cat "testdemos/${demos[i]}.params")

echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[0m"
echo -e " - \e[0;33mParameters $params\e[0m"

wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/${demos[i]}.bin" $params &> result.log || retVal=$?

if [ $retVal -ne 777 ] && [ $retVal -ne 9 ]; then
# Print with catchy messages
while read line; do
echo -e " \e[0;33m$line"
done <<< $(cat result.log | sed '0,/demo failed/I!d;/wine:/d;/./,$!d')

echo " 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸"
while read line; do
echo -e " \e[1;31m$line";
done < rehlds_demo_error.txt
echo -e " \e[30;41mExit code: $retVal\e[0m"
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;31m Failed ❌"
exit 6 # Test demo failed
else
# Print result HLDS console
while read line; do
echo -e " \e[0;33m$line"
done <<< $(cat result.log | sed '/wine:/d;/./,$!d')
echo -e " \e[30;43mExit code: $retVal\e[0m"
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;32m Succeed ✔"
fi
done
- name: Play test
env:
demo: ${{ matrix.test.file }}
desc: ${{ matrix.test.desc }}
run: ./runTest.sh

linux:
name: 'Linux'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container: debian:11-slim

steps:
- name: Install dependencies
run: |
dpkg --add-architecture i386
apt-get update
apt-get install -y \
gcc-multilib g++-multilib \
build-essential \
libc6-dev libc6-dev-i386 \
git cmake rsync \
g++ gcc

- name: Configure
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
submodules: true

- name: Check dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib

- name: Build and Run unittests
run: |
Expand All @@ -171,7 +151,7 @@ jobs:
fi
shell: bash

- name: Build
- name: Build using GCC Compiler
run: |
rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8

Expand Down Expand Up @@ -199,31 +179,25 @@ jobs:
shell: bash

- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
id: upload-job
with:
name: linux32
path: publish/*

- name: Cleanup temporary artifacts
if: success() && steps.upload-job.outcome == 'success'
run: |
rm -rf cssdk
rm -f appversion.h

publish:
name: 'Publish'
runs-on: ubuntu-latest
needs: [windows, testdemos, linux]

steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: linux32

- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32

Expand Down Expand Up @@ -264,8 +238,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

- name: Cleanup temporary artifacts
if: success() && steps.publish-job.outcome == 'success'
run: |
rm -rf bin dist debug cssdk
rm -f *.zip appversion.h
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| swapteams | Swap the teams and restart the game (1 sec delay to restart by default).<br/> Args: <br/>`0` - swap teams without restart. <br/> `>0.001` - time delay in seconds to restart the round after swap. |
| give | Give weapon command.<br/> Args:<br/><weapon_name><br/>Usage:<br/>`give weapon_ak47`<br/>`give weapon_usp`<br/><br/>NOTE: `sv_cheats 1` required. |
| impulse 255 | Give all weapons.<br/><br/>NOTE: `sv_cheats 1` required. |
| impulse 200 | Noclip with air acceleration.<br/><br/>NOTE: `sv_cheats 1` required. |

## Configuration (cvars)
<details>
Expand Down Expand Up @@ -97,6 +98,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_ct_give_player_knife | 1 | 0 | 1 | Whether Counter-Terrorist player spawn with knife. |
| mp_ct_default_weapons_primary | "" | "" | - | The default primary (rifle) weapon that the CTs will spawn with. |
| mp_ct_default_weapons_secondary | "usp" | "" | - | The default secondary (pistol) weapon that the CTs will spawn with. |
| mp_default_weapons_random | 0 | 0 | 1 | Randomize default weapons (if there are multiple).<br/> `0` disabled<br/>`1` enabled |
| 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 |
| 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. |
| mp_free_armor | 0 | 0 | 2 | Give free armor on player spawn.<br/>`0` disabled <br/>`1` Give Kevlar <br/>`2` Give Kevlar + Helmet |
Expand All @@ -122,16 +124,25 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_ammo_respawn_time | 20 | 0.0 | - | The respawn time for ammunition. |
| 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 |
| mp_votemap_min_time | 180 | 0.0 | - | Minimum seconds that must elapse on map before `votemap` command can be used. |
| mp_flymove_method | 0 | 0 | 1 | Set the method used for flymove calculations.<br/> `0` default method<br/>`1` alternative method (more accurate) |
| mp_stamina_restore_rate | 0 | 0.0 | - | Framerate (FPS), that used as reference when restoring stamina (fuser2) after jump. |
| mp_logkills | 1 | 0 | 1 | Log kills.<br/>`0` disabled <br/>`1` enabled |
| mp_jump_height | 45 | 0.0 | - | Player jump height. |
| bot_excellent_morale | 0 | 0 | 1 | Bots always have great morale regardless of defeat or victory. |
| mp_randomspawn | 0 | 0 | 1 | Random player spawns<br/>`0` disabled <br/>`1` enabled<br/>`NOTE`: Navigation `maps/.nav` file required |
| 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 |
| 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 |
| mp_knockback | 170 | - | - | Knockback force applied to the victim when damaged by strong weapons (e.g. `AWP`, `AK47`).<br/>Works only if not crouching, and not hit in the legs.<br/>Set to `0` to disable. |

</details>

## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)
* Enter `-bots` option at the command line HLDS
* Enable CVar `bot_enable 1` in `cstrike/game_init.cfg` (if this config file does not exist, create it)

## How to install CSCZ hostage AI for CS 1.6?
## How to install CS:CZ hostage AI for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/HostageImprov/host_improv.zip?raw=true)
* Enter `-host-improv` option at the command line HLDS
* Enable CVar `hostage_ai_enable 1` in `cstrike/game_init.cfg` (if this config file does not exist, create it)

## Build instructions
### Checking requirements
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ main()
case "$C" in
("intel"|"icc") CC=icc CXX=icpc ;;
("gcc"|"g++") CC=gcc CXX=g++ ;;
("clang|llvm") CC=clang CXX=clang++ ;;
("clang"|"llvm") CC=clang CXX=clang++ ;;
*)
;;
esac
Expand Down
69 changes: 68 additions & 1 deletion dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ mp_ct_default_weapons_primary ""
// Default value: "usp"
mp_ct_default_weapons_secondary "usp"

// Randomize default weapons (if there are multiple)
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
mp_default_weapons_random "0"

// Give the player free armor on player spawn
// 0 - No armor (default behavior)
// 1 - Give Kevlar
Expand Down Expand Up @@ -521,7 +528,7 @@ mp_give_c4_frags "3"
// Default value: "1.0"
mp_hostages_rescued_ratio "1.0"

// Legacy func_vehicle behavior when blocked by another entity.
// Legacy func_vehicle behavior when blocked by another entity.
// New one is more useful for playing multiplayer.
//
// 0 - New behavior
Expand Down Expand Up @@ -620,3 +627,63 @@ mp_vote_flags "km"
//
// Default value: "180"
mp_votemap_min_time "180"

// Set the method used for flymove calculations.
// 0 - default method
// 1 - alternative method (more accurate)
//
// Default value: "0"
mp_flymove_method "0"

// Framerate (FPS), that is used as a reference when restoring stamina (fuser2) after a jump.
// 0 - disabled
//
// Default value: "0"
mp_stamina_restore_rate "0"

// Player jump height
//
// Default value: "45"
mp_jump_height "45"

// Bots always have great morale regardless of defeat or victory.
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
bot_excellent_morale "0"

// Random player spawns
// 0 - disabled (default behaviour)
// 1 - enabled
//
// NOTE: Navigation "maps/.nav" file required
//
// Default value: "0"
mp_randomspawn "0"

// Player ID display mode
//
// 0 - don't show health (default behaviour)
// 1 - show health for teammates only (default CS behaviour)
// 2 - show health for all players
//
// Default value: "1"
mp_playerid_showhealth "1"

// Player ID field display mode
//
// 0 - don't show additional information
// 1 - show team name
// 2 - show health percentage
// 3 - show both team name and health percentage
//
// Default value: "3"
mp_playerid_field "3"

// Knockback force applied to the victim when damaged by strong weapons (e.g. AWP, AK47).
// Works only if not crouching, and not hit in the legs.
// Set to "0" to disable.
//
// Default: "170"
mp_knockback "170"
15 changes: 15 additions & 0 deletions dist/game_init.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Enables ZBots for the server
// NOTE: ZBots are always enabled on a listen server, regardless of this cvar
// 0 - disabled
// 1 - enabled
//
// Default value: "0"
bot_enable "0"

// Enables the improve AI for hostages from CS:CZ
// 0 - disabled (classic hostage)
// 1 - enabled (improved hostage)
//
// Default value: "0"
hostage_ai_enable "0"

// Sets mins/maxs hull bounds for the player.
// 0 - disabled (default behaviour, sets engine)
// 1 - enabled (sets gamedll)
Expand Down
Loading