mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-07-23 13:41:40 +03:00
Compare commits
319 Commits
5.18.0.473
...
master
Author | SHA1 | Date | |
---|---|---|---|
6974c6b749 | |||
e2eaad5e53 | |||
5089ad0912 | |||
185a86b87c | |||
afc0989f00 | |||
aef0be9a51 | |||
62e4f8b029 | |||
61c361e96c | |||
|
8d5aa54ceb | ||
|
a4f48f4e42 | ||
|
99d93ba8a7 | ||
|
5bf71bdb18 | ||
|
797c265db3 | ||
|
312dc3eb84 | ||
|
0fc5213049 | ||
|
f3d8d1b5fd | ||
|
a4d74392f0 | ||
|
35082b5f26 | ||
|
6f70d6dd8e | ||
|
f5cc6f3a8b | ||
|
d3fc7ac000 | ||
|
ce11175e89 | ||
|
b10f23e1e9 | ||
|
b44b09d07b | ||
|
d8faea0966 | ||
|
94a7eb4cbb | ||
|
518f142635 | ||
|
dbec1b589c | ||
|
316405b00d | ||
|
b8e9726347 | ||
|
6adb795fee | ||
|
756deb1ea9 | ||
|
a7395b054d | ||
|
b59bbb1c83 | ||
|
96b2ef2727 | ||
83df6fe961 | |||
be47b94ed2 | |||
|
f63ad678c2 | ||
|
1579273f62 | ||
|
17ae24e012 | ||
|
1a17ef4e45 | ||
|
6f0d17bb74 | ||
|
8a77bba94d | ||
|
3efc5ad166 | ||
|
942f2e6637 | ||
|
df7944ab88 | ||
|
476b5f7afd | ||
|
7738142c69 | ||
|
535ea846a9 | ||
|
9b626b1d82 | ||
|
9b7b1695a9 | ||
|
3f628ea970 | ||
|
19714af6e6 | ||
|
3cf66de905 | ||
|
dc16b12d79 | ||
|
12f4e9bc79 | ||
|
a8fd512dad | ||
|
8b6d659077 | ||
|
4e1cb1091f | ||
|
b6c2c62e8b | ||
|
c7bd4af9b6 | ||
|
fee10d8ba8 | ||
|
c48be87474 | ||
|
77a3f2b25b | ||
|
279799bff9 | ||
|
17386acac4 | ||
|
11638cbb21 | ||
|
a47d55823f | ||
|
ff843fe478 | ||
|
9d9c2de1ff | ||
|
a202425dd7 | ||
|
576e967cbd | ||
|
1991434301 | ||
|
79cfd7103a | ||
|
30572ef0b6 | ||
|
8005dd9ca3 | ||
|
a94c7bd728 | ||
|
ad1c58cef5 | ||
|
fef9bf3a87 | ||
|
bdc96d26d9 | ||
|
c7be8bfe7c | ||
|
7372573c89 | ||
|
c08e6d0180 | ||
|
9f66264562 | ||
|
8706cc5a10 | ||
|
cabdc254c7 | ||
|
8ff1bf1232 | ||
|
8ec5b6cd0f | ||
|
4ecf42799d | ||
|
d7f22ae3ec | ||
|
75f142e18a | ||
|
8cd9086937 | ||
|
2a0e54bbf7 | ||
|
0626800fbb | ||
|
d5eb9c34d2 | ||
|
f24cccfe73 | ||
|
5117374a27 | ||
|
279bd6421b | ||
|
8c14d05168 | ||
|
1ae0091947 | ||
|
f711276d8a | ||
|
a546997723 | ||
|
92775824e6 | ||
|
5d2174fbbf | ||
|
4d90a5f4fa | ||
|
f4c4e891ac | ||
|
2489213127 | ||
|
fb9eb0db55 | ||
|
0bc4ff1d40 | ||
|
5287f2a415 | ||
|
0bbc4bd55d | ||
|
aec3ba2579 | ||
|
b34d564e3c | ||
|
a1af7ca426 | ||
|
bde6aa07bc | ||
|
2d957a7915 | ||
|
4b49f630da | ||
|
051dc0751a | ||
|
89dda43b21 | ||
|
02a0516c2f | ||
|
c0f47949ec | ||
|
e636cbc8f5 | ||
|
15df1a9cf2 | ||
|
71606f8f36 | ||
|
d3c0ec8aeb | ||
|
991573f165 | ||
|
6c9019bcc8 | ||
|
0e68bedf24 | ||
|
28e2bc45f6 | ||
|
b413577428 | ||
|
f63b154637 | ||
|
8c0b684046 | ||
|
abe648b9d6 | ||
|
db5cbee2b8 | ||
|
4928c56f21 | ||
|
f97c9d9f46 | ||
|
806f5651de | ||
|
85e882f4db | ||
|
8ed193d254 | ||
|
e6d25ba159 | ||
|
34e56f61f2 | ||
|
d98e8f8b60 | ||
|
a63bcf0a10 | ||
|
59362ec8d5 | ||
|
4f0818b7bf | ||
|
7c9582f44b | ||
|
0c29cf36fc | ||
|
5e2aadceac | ||
|
7ea9beffdf | ||
|
e5f546c453 | ||
|
6863777b81 | ||
|
f882e81efe | ||
|
d135a67bb7 | ||
|
556406009f | ||
|
15bca2eab9 | ||
|
fba9a335da | ||
|
193c1ed52a | ||
|
b10489f2e0 | ||
|
9ab1589d32 | ||
|
e3d70d2b14 | ||
|
2d0ac93f63 | ||
|
c87761e182 | ||
|
2857986cc7 | ||
|
96e2121c45 | ||
|
426c975a88 | ||
|
7e02dea4a0 | ||
|
a2678a18ed | ||
|
e422a37d8b | ||
|
2f50f5ab9d | ||
|
a9ec63df1b | ||
|
96ba309e4a | ||
|
3a0970a1cd | ||
|
ac07e89269 | ||
|
b962e0eb8e | ||
|
1e49d94792 | ||
|
71c4e21385 | ||
|
108db28143 | ||
|
67e7d87423 | ||
|
8a52b7e38d | ||
|
d7b44099e7 | ||
|
ee34b06605 | ||
|
7b7a1b9d94 | ||
|
1aae57fd17 | ||
|
728f1fcc67 | ||
|
e8bff71475 | ||
|
facc2be534 | ||
|
2e6e77906f | ||
|
f441279294 | ||
|
696f465977 | ||
|
f3723d7a04 | ||
|
02bb06a6ef | ||
|
53d26a7ea5 | ||
|
942776783b | ||
|
c526fa5885 | ||
|
ad13545dac | ||
|
718f0330f1 | ||
|
8a8f348755 | ||
|
11d6b086b4 | ||
|
8a18969be1 | ||
|
e1d1c11992 | ||
|
6da11fa4dd | ||
|
6375ea5504 | ||
|
a5f288fbd6 | ||
|
8ddda261fe | ||
|
d4deabfe59 | ||
|
12560c2b87 | ||
|
e08cf1e72a | ||
|
94bf705196 | ||
|
4b4cd88feb | ||
|
e090a52846 | ||
|
2f88574a94 | ||
|
c756bf89d1 | ||
|
4a7a63533c | ||
|
dce06e91c2 | ||
|
d2ea0d342f | ||
|
eb91f9280d | ||
|
8ff30b4c3e | ||
|
889edc81bf | ||
|
5dec3bad32 | ||
|
7caf748a61 | ||
|
1c68cb0c98 | ||
|
15e7d4a11e | ||
|
9a001cabd1 | ||
|
f3fb30fd9d | ||
|
ab2bfd4b9d | ||
|
980162774a | ||
|
cf8deb9cac | ||
|
86e7215bfd | ||
|
dae415df66 | ||
|
2d44adae43 | ||
|
84f1f5e4c6 | ||
|
946b5a9db0 | ||
|
d8702df548 | ||
|
83151aaf0b | ||
|
98b387bb68 | ||
|
e83eeaed39 | ||
|
10813019c8 | ||
|
21dab90571 | ||
|
6c47f96998 | ||
|
db76e604df | ||
|
f050be77db | ||
|
972e14a527 | ||
|
0bbad64944 | ||
|
bbf4541361 | ||
|
a54abba88f | ||
|
c002edd5b1 | ||
|
09a6c61898 | ||
|
b979b5e84f | ||
|
c872b58bb0 | ||
|
2ac5bdee15 | ||
|
112326aa63 | ||
|
53181d3e9b | ||
|
b9cccc691b | ||
|
c6187f3dc7 | ||
|
dd243eaa0b | ||
|
da24c74c20 | ||
|
667242fadd | ||
|
bb97adefed | ||
|
9233f852ca | ||
|
5aec8aac7e | ||
|
7e2279f8c5 | ||
|
983500c9bd | ||
|
d079f26fc1 | ||
|
f1b253e5b0 | ||
|
67cc153f5d | ||
|
38dda25a84 | ||
|
fbbd6bd083 | ||
|
d85b03096f | ||
|
191857d700 | ||
|
1ac96b8180 | ||
|
59c297d26d | ||
|
55b996c30a | ||
|
a390cadcd0 | ||
|
a9111f8dda | ||
|
5b7159e8de | ||
|
8995b9dc77 | ||
|
2c52c4f4de | ||
|
49b2412e9c | ||
|
ab846f86f4 | ||
|
548cca5e5f | ||
|
517f68af93 | ||
|
3ff0f0cbf9 | ||
|
d80d87366a | ||
|
8d1f4fb673 | ||
|
bbc54cd30e | ||
|
a27ce74e10 | ||
|
64059d1026 | ||
|
e86284b08c | ||
|
f60e5eabee | ||
|
f2ef23db61 | ||
|
9a19e6408c | ||
|
4983a2d38d | ||
|
69b0003e3f | ||
|
f57f3d7bb9 | ||
|
271a49f8ca | ||
|
9736437cb8 | ||
|
fc52871739 | ||
|
913bfc6609 | ||
|
4918e1fb5e | ||
|
f57d28fe72 | ||
|
aae507c9f5 | ||
|
15328fd764 | ||
|
6fc1c2ff84 | ||
|
1155175057 | ||
|
6866339b0c | ||
|
9c6c880644 | ||
|
9b10456590 | ||
|
c56982af18 | ||
|
8d6bf017f5 | ||
|
3a8b0d1330 | ||
|
5e24376237 | ||
|
7721348199 | ||
|
519b7db38d | ||
|
99954a2646 | ||
|
bbfc3fe589 | ||
|
b1c055369d | ||
|
a8802e6276 | ||
|
b0d0ffedff | ||
|
efb06a7a20 |
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -16,14 +16,10 @@
|
||||
|
||||
# Scripts
|
||||
*.sh text eol=lf
|
||||
gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.gradle text eol=crlf
|
||||
*.groovy text eol=crlf
|
||||
*.def text eol=crlf
|
||||
*.fgd text eol=crlf
|
||||
*.cfg text eol=crlf
|
||||
*.properties text eol=crlf
|
||||
*.vm text eol=crlf
|
||||
|
||||
# Compiled Object files
|
||||
|
BIN
.github/media/36073848-14aeec46-0f48-11e8-9958-78affecf46012131.gif
vendored
Normal file
BIN
.github/media/36073848-14aeec46-0f48-11e8-9958-78affecf46012131.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 MiB |
BIN
.github/media/preview-yt-2018-01-21.jpg
vendored
Normal file
BIN
.github/media/preview-yt-2018-01-21.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
393
.github/workflows/build.yml
vendored
Normal file
393
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,393 @@
|
||||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/**'
|
||||
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: 'Windows'
|
||||
runs-on: windows-2025
|
||||
|
||||
env:
|
||||
solution: 'msvc/ReGameDLL.sln'
|
||||
buildPlatform: 'Win32'
|
||||
buildRelease: 'Release'
|
||||
buildReleasePlay: 'Release Play'
|
||||
buildTests: 'Tests'
|
||||
|
||||
steps:
|
||||
- name: Configure
|
||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
# TODO: add support of 141_xp toolchain at VS2022+
|
||||
# - name: Install v140, v141 and v142 toolsets
|
||||
# shell: cmd
|
||||
# run: |
|
||||
# "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
|
||||
# --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^
|
||||
# --add Microsoft.VisualStudio.Component.WindowsXP ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140.x86.x64 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140.xp ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.140.CRT ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141.xp ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v142 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v142.x86.x64 ^
|
||||
# --quiet --norestart
|
||||
|
||||
- name: Select PlatformToolset
|
||||
id: select_toolset
|
||||
shell: pwsh
|
||||
run: |
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$vs2019 = & $vswhere -products * -version "[16.0,17.0)" -property installationPath -latest
|
||||
$vs2022 = & $vswhere -products * -version "[17.0,)" -property installationPath -latest
|
||||
|
||||
if ($vs2019) {
|
||||
"toolset=v140_xp" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Selected v140_xp toolset"
|
||||
} elseif ($vs2022) {
|
||||
"toolset=v143" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Selected v143 toolset"
|
||||
} else {
|
||||
Write-Error "No suitable Visual Studio installation found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Build and Run unittests
|
||||
run: |
|
||||
$toolset = '${{ steps.select_toolset.outputs.toolset }}'
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTests }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
.\"msvc\Tests\mp.exe"
|
||||
If ($LASTEXITCODE -ne 0 -And
|
||||
$LASTEXITCODE -ne 3)
|
||||
{[Environment]::Exit(1)}
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
$toolset = '${{ steps.select_toolset.outputs.toolset }}'
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
- name: Get rcedit from chocolatey
|
||||
shell: pwsh
|
||||
run: |
|
||||
choco install rcedit -y
|
||||
|
||||
- name: Move files
|
||||
run: |
|
||||
mkdir publish\debug
|
||||
mkdir publish\tests
|
||||
mkdir publish\bin\win32\cstrike\dlls
|
||||
move "msvc\${{ env.buildReleasePlay }}\mp.dll" publish\tests\mp.dll
|
||||
move msvc\${{ env.buildRelease }}\mp.dll publish\bin\win32\cstrike\dlls\mp.dll
|
||||
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
|
||||
|
||||
- name: Get app version
|
||||
id: get_version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$versionFile = "regamedll/version/appversion.h"
|
||||
if (-not (Test-Path $versionFile)) {
|
||||
Write-Error "Version file not found: $versionFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$content = Get-Content $versionFile
|
||||
foreach ($line in $content) {
|
||||
if ($line -match '^\s*#define\s+APP_VERSION\s+"([^"]+)"') {
|
||||
$version = $matches[1]
|
||||
"version=$version" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Found version: $version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
Write-Error "APP_VERSION not found in file"
|
||||
exit 1
|
||||
|
||||
- name: Show version
|
||||
run: echo "Version is ${{ steps.get_version.outputs.version }}"
|
||||
|
||||
- name: Import PFX and sign
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
KEY_PFX_PASS: ${{ secrets.KEY_PFX_PASS }}
|
||||
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md
|
||||
run: |
|
||||
$pfxBase64 = "${{ secrets.KEY_PFX_B64 }}"
|
||||
[IO.File]::WriteAllBytes("${{ github.workspace }}\signing-cert.pfx", [Convert]::FromBase64String($pfxBase64))
|
||||
certutil -f -p "${{ secrets.KEY_PFX_PASS }}" -importPFX "${{ github.workspace }}\signing-cert.pfx"
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "Regamedll_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\cstrike\dlls\mp.dll
|
||||
Remove-Item -Recurse -Force "${{ github.workspace }}\signing-cert.pfx"
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Edit resources at windows binaries
|
||||
run: |
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\cstrike\dlls\mp.dll --set-version-string ProductName "Regamedll_CS - mp.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "Regamedll_CS (mp.dll) - provide more stable (than official) version of Counter-Strike game with extended API for mods and plugins, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Regamedll_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so. Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon regamedll/msvc/icon.ico
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Deploy artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: win32
|
||||
path: publish/*
|
||||
|
||||
testdemos:
|
||||
name: 'Test demos'
|
||||
runs-on: ubuntu-latest
|
||||
container: rehldsorg/testdemos:latest
|
||||
needs: [windows]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
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@v4
|
||||
with:
|
||||
name: win32
|
||||
|
||||
- name: Setup dependencies
|
||||
run: |
|
||||
chown root ~
|
||||
rsync -a deps/regamedll/* .
|
||||
mv $GITHUB_WORKSPACE/tests/mp.dll cstrike/dlls/mp.dll
|
||||
|
||||
- name: Play test
|
||||
env:
|
||||
demo: ${{ matrix.test.file }}
|
||||
desc: ${{ matrix.test.desc }}
|
||||
run: ./runTest.sh
|
||||
|
||||
linux:
|
||||
name: 'Linux'
|
||||
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
|
||||
|
||||
- name: GPG Import
|
||||
run: |
|
||||
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
|
||||
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
|
||||
|
||||
# Import the public key
|
||||
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failed to import the public key"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Import the private key
|
||||
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failed to import the private key"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Extract the fingerprint of the imported public key
|
||||
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
|
||||
|
||||
# Check if the fingerprint was extracted
|
||||
if [[ -z "$GPG_LINUX_FINGERPRINT" ]]; then
|
||||
echo "Error: Failed to extract the fingerprint of the key"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Set the trust level for the key
|
||||
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to set trust for the key $GPG_LINUX_FINGERPRINT"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
echo "Key $GPG_LINUX_FINGERPRINT successfully imported and trusted"
|
||||
gpg --list-keys
|
||||
|
||||
#export for global use
|
||||
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name != 'pull_request'
|
||||
|
||||
- name: Build and Run unittests
|
||||
run: |
|
||||
rm -rf build && CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
||||
retVal=0
|
||||
./build/regamedll/cs 2> /dev/null > result.log || retVal=$?
|
||||
while read line; do
|
||||
if [[ ${line} == *"Warning in test"* ]] ; then
|
||||
echo -e "\e[2;38m$line"
|
||||
elif [[ ${line} == *"Failure in test"* ]] ; then
|
||||
echo -e "\e[1;31m$line"
|
||||
else
|
||||
echo -e "\e[0;33m$line"
|
||||
fi
|
||||
done <<< $(cat result.log)
|
||||
|
||||
if [ $retVal -ne 0 ] && [ $retVal -ne 3 ]; then
|
||||
echo -e "\e[30;41mExit code: $retVal\e[0m"
|
||||
exit 1 # Unittest failed
|
||||
else
|
||||
echo -e "\e[30;43mExit code: $retVal\e[0m"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build using GCC Compiler
|
||||
run: |
|
||||
rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8
|
||||
|
||||
- name: Prepare CSSDK
|
||||
run: |
|
||||
mkdir -p publish/cssdk
|
||||
rsync -a regamedll/extra/cssdk/ publish/cssdk/ --exclude=.git --exclude=LICENSE --exclude=README.md
|
||||
|
||||
- name: Move files
|
||||
run: |
|
||||
mkdir -p publish/bin/linux32/cstrike/dlls
|
||||
mv build/regamedll/cs.so publish/bin/linux32/cstrike/dlls/cs.so 2>/dev/null || true
|
||||
mv regamedll/version/appversion.h publish/appversion.h
|
||||
mv dist/ publish/
|
||||
|
||||
- name: Run GLIBC/ABI version compat test
|
||||
run: |
|
||||
binaries=(
|
||||
"publish/bin/linux32/cstrike/dlls/cs.so"
|
||||
)
|
||||
bash ./regamedll/version/glibc_test.sh ${binaries[@]}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1 # Assertion failed
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Deploy artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
id: upload-job
|
||||
with:
|
||||
name: linux32
|
||||
path: publish/*
|
||||
|
||||
publish:
|
||||
name: 'Publish'
|
||||
runs-on: ubuntu-latest
|
||||
needs: [windows, testdemos, linux]
|
||||
|
||||
steps:
|
||||
- name: Deploying linux artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux32
|
||||
|
||||
- name: Deploying windows artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: win32
|
||||
|
||||
- name: Reading appversion.h
|
||||
run: |
|
||||
if [ -e appversion.h ]; then
|
||||
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
|
||||
if [ $? -ne 0 ]; then
|
||||
APP_VERSION=""
|
||||
else
|
||||
# Remove quotes
|
||||
APP_VERSION=$(echo $APP_VERSION | xargs)
|
||||
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
|
||||
fi
|
||||
fi
|
||||
rm -f appversion.h
|
||||
|
||||
- name: Packaging binaries
|
||||
id: packaging-job
|
||||
if: |
|
||||
github.event_name == 'release' &&
|
||||
github.event.action == 'published' &&
|
||||
startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
rsync -a dist/ bin/win32/cstrike
|
||||
rsync -a dist/ bin/linux32/cstrike
|
||||
|
||||
# new runner, niw signs
|
||||
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
|
||||
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
|
||||
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
|
||||
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
|
||||
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
|
||||
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
|
||||
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
|
||||
|
||||
sign_file() {
|
||||
local file=$1
|
||||
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to sign $file"
|
||||
exit 2
|
||||
fi
|
||||
echo "$file signed successfully."
|
||||
}
|
||||
|
||||
# Pack and sign final archive
|
||||
7z a -tzip regamedll-bin-${{ env.APP_VERSION }}.zip bin/ cssdk/
|
||||
sign_file "regamedll-bin-${{ env.APP_VERSION }}.zip"
|
||||
|
||||
- name: Publish artifacts
|
||||
uses: softprops/action-gh-release@v2
|
||||
id: publish-job
|
||||
if: |
|
||||
startsWith(github.ref, 'refs/tags/') &&
|
||||
steps.packaging-job.outcome == 'success'
|
||||
with:
|
||||
files: |
|
||||
*.zip
|
||||
*.7z
|
||||
*.asc
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,10 +1,8 @@
|
||||
**/build
|
||||
**/.gradle
|
||||
.idea
|
||||
*.iml
|
||||
*.bat
|
||||
*.log
|
||||
*.lnk
|
||||
*.aps
|
||||
**/msvc/Debug*
|
||||
**/msvc/Release*
|
||||
**/msvc/Tests
|
||||
@ -15,12 +13,11 @@
|
||||
**/msvc/*.db
|
||||
**/msvc/*.opendb
|
||||
**/msvc/*.txt
|
||||
**/msvc/*.aps
|
||||
**/msvc/*.amplxeproj
|
||||
**/msvc/.vs
|
||||
**/msvc/ipch
|
||||
|
||||
regamedll/version/appversion.h
|
||||
regamedll/msvc/PublishPath*.txt
|
||||
regamedll/_regamedllTestImg
|
||||
regamedll/_dev
|
||||
publish
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "regamedll/extra/cssdk"]
|
||||
path = regamedll/extra/cssdk
|
||||
url = https://github.com/s1lentq/CSSDK.git
|
||||
url = https://github.com/s1lentq/CSSDK.git
|
1155
CHANGELOG.md
Normal file
1155
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
12
CMakeLists.txt
Normal file
12
CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(regamedll CXX)
|
||||
|
||||
if (WIN32)
|
||||
message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/ReGameDLL.sln instead it!")
|
||||
endif()
|
||||
|
||||
add_custom_target(appversion DEPENDS
|
||||
COMMAND "${PROJECT_SOURCE_DIR}/regamedll/version/appversion.sh" "${PROJECT_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
add_subdirectory(regamedll)
|
695
LICENSE
695
LICENSE
@ -1,674 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015–2025 ReGameDLL_CS Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the “Software”), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
16
LICENSE-TRANSITION.md
Normal file
16
LICENSE-TRANSITION.md
Normal file
@ -0,0 +1,16 @@
|
||||
# License Transition Notice
|
||||
|
||||
ReGameDLL_CS was originally licensed under the GNU General Public License v3.0 (GPLv3).
|
||||
|
||||
As of July 2025, the project has transitioned to the MIT License with the explicit agreement of the major contributors, including:
|
||||
|
||||
- s1lent
|
||||
- Vaqtincha
|
||||
- In-line
|
||||
- wopox
|
||||
- WPMGPRoSToTeMa
|
||||
|
||||
All significant contributors have agreed to this license transition.
|
||||
All previous contributions are now considered to be licensed under the MIT License unless otherwise noted.
|
||||
|
||||
For questions, contact us via GitHub or the ReHLDS dev chat.
|
202
README.md
202
README.md
@ -1,22 +1,30 @@
|
||||
# ReGameDLL_CS [/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=ReGameDLLCs_Publish&guest=1) [](https://github.com/s1lentq/ReGameDLL_CS/releases/latest) [](http://isitmaintained.com/project/s1lentq/ReGameDLL_CS "Percentage of issues still open") [](https://www.gnu.org/licenses/gpl-3.0) <img align="right" src="https://cloud.githubusercontent.com/assets/5860435/20008568/b3623150-a2d3-11e6-85f3-0d6571045fc9.png" alt="Counter-Strike 1.6 GameDLL" />
|
||||
# ReGameDLL_CS [](https://github.com/rehlds/ReGameDLL_CS/releases/latest)  [](http://isitmaintained.com/project/rehlds/ReGameDLL_CS "Percentage of issues still open") [](https://www.gnu.org/licenses/gpl-3.0) <img align="right" src="https://cloud.githubusercontent.com/assets/5860435/20008568/b3623150-a2d3-11e6-85f3-0d6571045fc9.png" alt="Counter-Strike 1.6 GameDLL" />
|
||||
Reverse-engineered gamedll (mp.dll / Counter-Strike)
|
||||
|
||||
## What is this?
|
||||
Regamedll_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so
|
||||
ReGameDLL_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so
|
||||
|
||||
## Goals of the project
|
||||
* Provide more stable (than official) version of Counter-Strike game with extended API for mods and plugins
|
||||
|
||||
## 🛠 License
|
||||
|
||||
ReGameDLL_CS is licensed under the [MIT License](./LICENSE).
|
||||
|
||||
### License Transition
|
||||
> [!NOTE]
|
||||
> Originally released under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html), ReHReGameDLL_CSLDS transitioned to the MIT License in July 2025 with the agreement of the core contributors.
|
||||
> See [LICENSE-TRANSITION.md](./LICENSE-TRANSITION.md) for details.
|
||||
|
||||
## How can use it?
|
||||
ReGameDLL_CS is fully compatible with official mod CS 1.6 / CZero by Valve. All you have to do is to download binaries and replace original mp.dll/cs.so
|
||||
|
||||
Compiled binaries are available here: [link](https://github.com/s1lentq/ReGameDLL_CS/releases)
|
||||
## Downloads
|
||||
* [Release builds](https://github.com/rehlds/ReGameDLL_CS/releases)
|
||||
* [Dev builds](https://github.com/rehlds/ReGameDLL_CS/actions/workflows/build.yml)
|
||||
|
||||
Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
* 'pure' version is designed to work exactly as official mod CS
|
||||
* 'bugfixed' version contains some fixes and improvements
|
||||
|
||||
<b>Warning!</b> ReGameDLL_CS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original mod CS. This means that plugins that do binary code analysis (Orpheu for example) probably will not work with ReGameDLL_CS.
|
||||
<b>Warning!</b> ReGameDLL_CS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original mod CS.
|
||||
This means that plugins that do binary code analysis (Orpheu for example) probably will not work with ReGameDLL_CS.
|
||||
|
||||
## How can use beta?
|
||||
<pre>ReGameDLL_CS also have beta version with latest changes from official version of Counter-Strike.</pre>
|
||||
@ -27,7 +35,10 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
| :---------------------------------- | :---------------------------------------------- |
|
||||
| game version | Will show GameDLL build version, date & URL. |
|
||||
| endround | Args:<br/>`T` force round end with Terrorists win. <br/>`CT` force round end with Counter-Terrorists win. <br/> or terminate round draw when called without arguments. |
|
||||
| mp_swapteams | Swap the teams and restart the game. |
|
||||
| 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>
|
||||
@ -40,11 +51,13 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
| mp_buytime | 1.5 | 0.0 | - | Designate the desired amount of buy time for each round. (in minutes)<br />`-1` means no time limit<br />`0` disable buy |
|
||||
| mp_maxmoney | 16000 | 0 | `999999` | The maximum allowable amount of money in the game |
|
||||
| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)<br/>`0` disabled<br/>`1` enabled<br/><br/>or flags<br/>`a` block round time round end check<br/>`b` block needed players round end check<br/>`c` block VIP assassination/success round end check<br/>`d` block prison escape round end check<br/>`e` block bomb round end check<br/>`f` block team extermination round end check<br/>`g` block hostage rescue round end check<br/>`h` block VIP assassination/success round time end check<br/>`i` block prison escape round time end check<br/>`j` block bomb round time end check<br/>`k` block hostage rescue round time end check<br/><br/>`Example setting:` "ae" blocks round time and bomb round end checks |
|
||||
| mp_roundover | 0 | - | - | The round by expired time will be over, if on a map it does not have the scenario of the game.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_roundover | 0 | 0 | 3 | The round by expired time will be over, if on a map it does not have the scenario of the game.<br/>`0` disabled<br/>`1` end of the round with a draw<br/>`2` round end with Terrorists win<br/>`3` round end with Counter-Terrorists win |
|
||||
| mp_round_restart_delay | 5 | - | - | Number of seconds to delay before restarting a round after a win. |
|
||||
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death.<br/>`0` disabled<br/>`1` drop one the grenade<br/>`2` drop an everyone grenades |
|
||||
| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round |
|
||||
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death.<br/>`0` disabled<br/>`1` drop first available grenade<br/>`2` drop all grenades |
|
||||
| mp_weapondrop | 1 | 0 | 3 | Drop player weapon after death.<br/>`0` do not drop weapons after death<br/>`1` drop best/heaviest weapon after death<br/>`2` drop active weapon after death<br/>`3` drop all weapons after death (primary and secondary) |
|
||||
| mp_ammodrop | 1 | 0 | 2 | Drop ammo on weapon boxes on death or manual drop.<br/>`0` always keep ammo on player<br/>`1` drop all ammo only after death<br/>`2` drop all ammo whenever player drops a weapon |
|
||||
| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round.<br />`-1` means no time limit<br /> |
|
||||
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max.<br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on player spawn and on the purchase of the item |
|
||||
| mp_infinite_ammo | 0 | 0 | 2 | Sets the mode infinite ammo for weapons.<br/>`0` disabled<br/>`1` weapon clip infinite<br/>`2` weapon bpammo infinite (This means for reloading) |
|
||||
@ -61,7 +74,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
| mp_show_scenarioicon | 0 | 0 | 1 | Show scenario icon in HUD such as count of alive hostages or ticking bomb.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
|
||||
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
|
||||
| sv_alltalk | 0 | 0 | 4 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.
|
||||
| sv_alltalk | 0 | 0 | 5 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.<br/>`5` alive hear alive teammates, dead hear dead and alive.
|
||||
| bot_deathmatch | 0 | 0 | 1 | Sets the mode for the zBot.<br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
|
||||
| bot_quota_mode | normal | - | - | Determines the type of quota.<br/>`normal` default behaviour<br/>`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota<br/>`match` the server will maintain a `1:N` ratio of humans to bots, where `N` is bot_quota |
|
||||
| bot_join_delay | 0 | - | - | Prevents bots from joining the server for this many seconds after a map change. |
|
||||
@ -70,7 +83,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
| mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict. <br/>`0` New behavior<br/>`1` Legacy behavior|
|
||||
| mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection |
|
||||
| mp_respawn_immunity_effects | 1 | 0 | 1 | Enable effects on player spawn protection.<br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar mp_respawn_immunitytime) |
|
||||
| mp_respawn_immunity_force_unset | 1 | 0 | 1 | Force unset spawn protection if the player doing any action.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_respawn_immunity_force_unset | 1 | 0 | 2 | Force unset spawn protection if the player doing any action.<br/>`0` disabled<br/>`1` when moving and attacking<br/>`2` only when attacking |
|
||||
| mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).<br />Only disable this if you have semiclip or other plugins that prevents stucking.<br/>`0` disabled<br/>`1` enabled |
|
||||
| mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.<br/>`0` disallow<br/>`1` allow<br/>`NOTE`: Potentially dangerous for untrusted maps. |
|
||||
| mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled |
|
||||
@ -94,83 +107,120 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
||||
| 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 |
|
||||
| mp_team_flash | 1 | -1 | 1 | Sets the behaviour for Flashbangs on teammates.<br/>`-1` Don't affect teammates neither flash owner <br/>`0` Don't affect teammates <br/>`1` Affects teammates |
|
||||
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
|
||||
| mp_falldamage | 1 | 0 | 1 | Damage from falling.<br/>`0` disabled <br/>`1` enabled |
|
||||
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled |
|
||||
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
|
||||
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
|
||||
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.<br/>`0` disabled <br/>`1` enabled |
|
||||
| mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. |
|
||||
| mp_hostages_rescued_ratio | 1.0 | 0.0 | 1.0 | Ratio of hostages rescued to win the round. |
|
||||
| mp_legacy_vehicle_block | 1 | 0 | 1 | Legacy func_vehicle behavior when blocked by another entity.<br/>`0` New behavior <br/>`1` Legacy behavior |
|
||||
| mp_dying_time | 3.0 | 0.0 | - | Time for switch to free observing after death.<br/>`0` - disable spectating around death.<br/>`>0.00001` - time delay to start spectate.<br/>`NOTE`: The countdown starts when the player’s death animation is finished. |
|
||||
| mp_deathmsg_flags | abc | 0 | - | Sets a flags for extra information in the player's death message.<br/>`0` disabled<br/>`a` position where the victim died<br/>`b` index of the assistant who helped the attacker kill the victim<br/>`c` rarity classification bits, e.g., `blinkill`, `noscope`, `penetrated`, etc. |
|
||||
| mp_assist_damage_threshold | 40 | 0 | 100 | Sets the percentage of damage needed to score an assist. |
|
||||
| mp_freezetime_duck | 1 | 0 | 1 | Allow players to duck during freezetime.<br/> `0` disabled<br/>`1` enabled |
|
||||
| mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.<br/> `0` disabled<br/>`1` enabled |
|
||||
| mp_defuser_allocation | 0 | 0 | 2 | Give defuser on player spawn.<br/> `0` disabled<br/>`1` Random players. <br/>`2` All players. |
|
||||
| mp_location_area_info | 0 | 0 | 3 | Enable location area info.<br/> `0` disabled<br/>`1` show location below HUD radar.<br/>`2` show location in HUD chat. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")<br/>`3` both displayed. `NOT RECOMMENDED!` [:speech_balloon:](## "Not all client builds are compatible")<br/><br/>`NOTE`: Navigation `maps/.nav` file required and should contain place names<br/>`NOTE`: If option `2` or `3` is enabled, be sure to enable `mp_chat_loc_fallback 1` |
|
||||
| mp_item_respawn_time | 30 | 0.0 | - | The respawn time for items (such as health packs, armor, etc.). |
|
||||
| mp_weapon_respawn_time | 20 | 0.0 | - | The respawn time for weapons. |
|
||||
| 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 CS:CZ hostage AI for CS 1.6?
|
||||
* Extract all the files from an [archive](regamedll/extra/HostageImprov/host_improv.zip?raw=true)
|
||||
* Enable CVar `hostage_ai_enable 1` in `cstrike/game_init.cfg` (if this config file does not exist, create it)
|
||||
|
||||
## Build instructions
|
||||
There are several software requirements for building Regamedll_CS:
|
||||
<ol>
|
||||
<li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li>
|
||||
<li>For Windows: Visual Studio 2015 and later</li>
|
||||
<li>For Linux: GCC/Clang/Intel C++ Compiler 15 and later</li>
|
||||
</ol>
|
||||
|
||||
### Checking requirements
|
||||
#### JDK version
|
||||
Windows<pre>> %JAVA_HOME%\bin\javac -version
|
||||
javac 1.8.0_25
|
||||
</pre>
|
||||
There are several software requirements for building ReGameDLL_CS:
|
||||
|
||||
Linux
|
||||
<pre>$ javac -version
|
||||
javac 1.7.0_65
|
||||
</pre>
|
||||
|
||||
#### Visual Studio
|
||||
Help -> About
|
||||
|
||||
#### ICC
|
||||
<pre>$ icc --version
|
||||
icc (ICC) 15.0.1 20141023
|
||||
</pre>
|
||||
|
||||
### Building and run unit tests using gradle
|
||||
#### On Windows:
|
||||
<pre>gradlew --max-workers=1 clean buildRelease</pre>
|
||||
* For faster building without unit tests use this:exclamation:
|
||||
<pre>gradlew --max-workers=1 clean buildFixes</pre>
|
||||
|
||||
#### On Linux (ICC):
|
||||
<pre>./gradlew --max-workers=1 clean buildRelease</pre>
|
||||
|
||||
* For faster building without unit tests use this:exclamation:
|
||||
<pre>./gradlew --max-workers=1 clean buildFixes</pre>
|
||||
|
||||
#### On Linux (Clang):
|
||||
<pre>./gradlew --max-workers=1 clean -PuseClang buildRelease</pre>
|
||||
|
||||
* For faster building without unit tests use this:exclamation:
|
||||
<pre>./gradlew --max-workers=1 clean -PuseClang buildFixes</pre>
|
||||
|
||||
#### On Linux (GCC):
|
||||
<pre>./gradlew --max-workers=1 clean -PuseGcc buildRelease</pre>
|
||||
|
||||
* For faster building without unit tests use this:exclamation:
|
||||
<pre>./gradlew --max-workers=1 clean -PuseGcc buildFixes</pre>
|
||||
|
||||
Compiled binaries will be placed in the build/binaries/ directory
|
||||
|
||||
### Simplified building using CMake 3.1 and later
|
||||
#### On Windows:
|
||||
<pre>Open solution msvc\ReGameDLL.sln and build it</pre>
|
||||
|
||||
#### On Linux:
|
||||
* Run script `regamedll/compile.sh`
|
||||
* Options using `regamedll/compile.sh -D[option]=[ON or OFF]` (without square brackets)
|
||||
#### Windows
|
||||
<pre>
|
||||
DEBUG - Enables debugging mode
|
||||
USE_INTEL_COMPILER - Switch main compiler to ICC
|
||||
USE_CLANG_COMPILER - Switch main compiler to Clang
|
||||
USE_STATIC_LIBSTDC - Enables static linking library libstdc++
|
||||
Visual Studio 2015 (C++14 standard) and later
|
||||
</pre>
|
||||
|
||||
#### Linux
|
||||
<pre>
|
||||
git >= 1.8.5
|
||||
cmake >= 3.10
|
||||
GCC >= 4.9.2 (Optional)
|
||||
ICC >= 15.0.1 20141023 (Optional)
|
||||
LLVM (Clang) >= 6.0 (Optional)
|
||||
</pre>
|
||||
|
||||
### Building
|
||||
|
||||
#### Windows
|
||||
Use `Visual Studio` to build, open `msvc/ReGameDLL.sln` and just select from the solution configurations list `Release` or `Debug`
|
||||
|
||||
#### Linux
|
||||
|
||||
* Optional options using `build.sh --compiler=[gcc] --jobs=[N] -D[option]=[ON or OFF]` (without square brackets)
|
||||
|
||||
<pre>
|
||||
-c=|--compiler=[icc|gcc|clang] - Select preferred C/C++ compiler to build
|
||||
-j=|--jobs=[N] - Specifies the number of jobs (commands) to run simultaneously (For faster building)
|
||||
|
||||
<sub>Definitions (-D)</sub>
|
||||
DEBUG - Enables debugging mode
|
||||
USE_STATIC_LIBSTDC - Enables static linking library libstdc++
|
||||
</pre>
|
||||
|
||||
* ICC <pre>./build.sh --compiler=intel</pre>
|
||||
* LLVM (Clang) <pre>./build.sh --compiler=clang</pre>
|
||||
* GCC <pre>./build.sh --compiler=gcc</pre>
|
||||
|
||||
##### Checking build environment (Debian / Ubuntu)
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Installing required packages
|
||||
<pre>
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-multilib g++-multilib
|
||||
sudo apt-get install -y build-essential
|
||||
sudo apt-get install -y libc6-dev libc6-dev-i386
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Select the preferred C/C++ Compiler installation
|
||||
<pre>
|
||||
1) sudo apt-get install -y gcc g++
|
||||
2) sudo apt-get install -y clang
|
||||
</pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</details>
|
||||
|
||||
### Credits
|
||||
Thanks to the project [ReHLDS](https://github.com/dreamstalker/rehlds) ( ReGameDLL_CS was created on the basis of ReHLDS )
|
||||
|
||||
|
60
build.gradle
60
build.gradle
@ -1,60 +0,0 @@
|
||||
import versioning.GitVersioner
|
||||
import versioning.RegamedllVersionInfo
|
||||
import org.joda.time.DateTime
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
apply from: 'shared.gradle'
|
||||
group = 'regamedll'
|
||||
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
project {
|
||||
languageLevel = 'JDK_1_7'
|
||||
}
|
||||
}
|
||||
|
||||
def gitInfo = GitVersioner.versionForDir(project.rootDir)
|
||||
RegamedllVersionInfo versionInfo
|
||||
if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
|
||||
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
|
||||
if (!m.find()) {
|
||||
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
|
||||
}
|
||||
|
||||
versionInfo = new RegamedllVersionInfo(
|
||||
majorVersion: m.group(1) as int,
|
||||
minorVersion: m.group(2) as int,
|
||||
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
|
||||
localChanges: gitInfo.localChanges,
|
||||
commitDate: gitInfo.commitDate,
|
||||
commitSHA: gitInfo.commitSHA,
|
||||
commitURL: gitInfo.commitURL
|
||||
)
|
||||
} else {
|
||||
|
||||
if (!gitInfo) {
|
||||
System.err.println "WARNING! couldn't get gitInfo";
|
||||
}
|
||||
|
||||
versionInfo = new RegamedllVersionInfo(
|
||||
majorVersion: project.majorVersion as int,
|
||||
minorVersion: project.minorVersion as int,
|
||||
maintenanceVersion: project.maintenanceVersion as int,
|
||||
suffix: 'dev',
|
||||
localChanges: gitInfo ? gitInfo.localChanges : true,
|
||||
commitDate: gitInfo ? gitInfo.commitDate : new DateTime(),
|
||||
commitSHA: gitInfo ? gitInfo.commitSHA : "",
|
||||
commitURL: gitInfo ? gitInfo.commitURL : "",
|
||||
commitCount: gitInfo ? (gitInfo.commitCount as int) : null
|
||||
)
|
||||
}
|
||||
|
||||
project.ext.regamedllVersionInfo = versionInfo
|
||||
project.version = versionInfo.asMavenVersion()
|
||||
|
||||
apply from: 'publish.gradle'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '2.4'
|
||||
}
|
60
build.sh
Executable file
60
build.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
main()
|
||||
{
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
|
||||
if [[ "$*" =~ "--help" ]]; then
|
||||
help
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
n=0
|
||||
args=()
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-j=*|--jobs=*)
|
||||
jobs="-j${i#*=}"
|
||||
shift
|
||||
;;
|
||||
-c=*|--compiler=*)
|
||||
C="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
args[$n]="$i"
|
||||
((++n))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$C" in
|
||||
("intel"|"icc") CC=icc CXX=icpc ;;
|
||||
("gcc"|"g++") CC=gcc CXX=g++ ;;
|
||||
("clang"|"llvm") CC=clang CXX=clang++ ;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
pushd build &> /dev/null
|
||||
CC=$CC CXX=$CXX cmake ${args[@]} ..
|
||||
make ${jobs}
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
help()
|
||||
{
|
||||
printf "Usage: ./build.sh <options>\n\n"
|
||||
printf " -c= | --compiler=<icc|gcc|clang> - Select preferred C/C++ compiler to build\n"
|
||||
printf " -j= | --jobs=<N> - Specifies the number of jobs (commands) to run simultaneously (For faster building)\n\n"
|
||||
}
|
||||
|
||||
# Initialize
|
||||
main $*
|
||||
|
||||
# Exit normally
|
||||
exit 0
|
@ -1,33 +0,0 @@
|
||||
apply plugin: 'groovy'
|
||||
|
||||
repositories {
|
||||
//mavenLocal()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-dev/'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'commons-lang:commons-lang:2.6'
|
||||
compile 'joda-time:joda-time:2.7'
|
||||
|
||||
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
|
||||
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
|
||||
|
||||
compile 'org.apache.commons:commons-compress:1.9'
|
||||
compile 'org.apache.ant:ant-compress:1.2'
|
||||
compile 'org.apache.ant:ant:1.9.6'
|
||||
|
||||
compile 'org.apache.velocity:velocity:1.7'
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package dirsync.builder
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
class FileSystemTreeBuilder {
|
||||
|
||||
@CompileStatic
|
||||
private static FileNode<File> buildNodeForFile(File file, DirectoryNode<File> parent) {
|
||||
if (parent.getChildren(file.name)) {
|
||||
throw new RuntimeException("Parent dir ${parent.name} already contains child node ${file.name}");
|
||||
}
|
||||
|
||||
return new FileNode(
|
||||
name: file.name,
|
||||
lastModifiedDate: file.lastModified(),
|
||||
data: file,
|
||||
parent: parent,
|
||||
size: file.size()
|
||||
);
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
private static DirectoryNode<File> buildNodeForDirectoryRecursive(File dir, DirectoryNode<File> parent) {
|
||||
if (!dir.isDirectory()) {
|
||||
throw new RuntimeException("File ${dir.absolutePath} is not a directory")
|
||||
}
|
||||
|
||||
if (parent != null && parent.getChildren(dir.name)) {
|
||||
throw new RuntimeException("Parent dir ${parent.name} already contains child node ${dir.name}");
|
||||
}
|
||||
|
||||
DirectoryNode<File> thisNode = new DirectoryNode(
|
||||
name: dir.name,
|
||||
lastModifiedDate: dir.lastModified(),
|
||||
data: dir,
|
||||
parent: parent
|
||||
);
|
||||
|
||||
dir.eachFile { File f ->
|
||||
if (f.isDirectory()) {
|
||||
thisNode.childNodes[f.name] = buildNodeForDirectoryRecursive(f, thisNode)
|
||||
} else {
|
||||
thisNode.childNodes[f.name] = buildNodeForFile(f, thisNode)
|
||||
}
|
||||
}
|
||||
|
||||
return thisNode;
|
||||
}
|
||||
|
||||
static DirectoryNode<File> buildFileSystemTree(File rootDir) {
|
||||
def root = buildNodeForDirectoryRecursive(rootDir, null);
|
||||
PostBuildPass.doPostBuild(root)
|
||||
|
||||
return root
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package dirsync.builder
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
|
||||
class FileTreeMerger {
|
||||
|
||||
private static <T> void mergeContentsRecursive(DirectoryNode<T> newParent, DirectoryNode<T> toMerge) {
|
||||
toMerge.childNodes.each { cn ->
|
||||
def node = cn.value
|
||||
def existingNode = newParent.childNodes[node.name]
|
||||
if (existingNode) {
|
||||
if (!(existingNode instanceof DirectoryNode) || !(node instanceof DirectoryNode))
|
||||
throw new RuntimeException("Failed to merge non-directory nodes ${node.fullPath}")
|
||||
|
||||
def existingDirNode = existingNode as DirectoryNode<T>
|
||||
def dirNode = node as DirectoryNode<T>
|
||||
|
||||
existingDirNode.lastModifiedDate = Math.max(existingDirNode.lastModifiedDate, dirNode.lastModifiedDate)
|
||||
mergeContentsRecursive(existingDirNode, dirNode)
|
||||
} else {
|
||||
if (node instanceof DirectoryNode) {
|
||||
def dirNode = node as DirectoryNode<T>
|
||||
def newNode = new DirectoryNode<T>(
|
||||
name: dirNode.name,
|
||||
data: dirNode.data,
|
||||
parent: newParent,
|
||||
lastModifiedDate: dirNode.lastModifiedDate
|
||||
)
|
||||
newParent.childNodes[node.name] = newNode
|
||||
|
||||
mergeContentsRecursive(newNode, dirNode)
|
||||
} else {
|
||||
FileNode<T> fileNode = node as FileNode<T>
|
||||
FileNode<T> newNode = new FileNode<T>(
|
||||
name: fileNode.name,
|
||||
data: fileNode.data,
|
||||
parent: newParent,
|
||||
lastModifiedDate: fileNode.lastModifiedDate,
|
||||
size: fileNode.size
|
||||
)
|
||||
|
||||
newParent.childNodes[node.name] = newNode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> DirectoryNode<T> mergeTrees(DirectoryNode<T> tree1, DirectoryNode<T> tree2) {
|
||||
DirectoryNode<T> newRoot = new DirectoryNode<T>(
|
||||
name: tree1.name ?: tree2.name
|
||||
)
|
||||
|
||||
mergeContentsRecursive(newRoot, tree1)
|
||||
mergeContentsRecursive(newRoot, tree2)
|
||||
PostBuildPass.doPostBuild(newRoot)
|
||||
|
||||
return newRoot
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package dirsync.builder
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
|
||||
class PostBuildPass {
|
||||
|
||||
private static <T> void postProcessRecursive(DirectoryNode<T> dir) {
|
||||
dir.childNodes.each { cne ->
|
||||
def childNode = cne.value
|
||||
childNode.fullPath = dir.fullPath ? dir.fullPath + '/' + childNode.name : childNode.name
|
||||
if (childNode instanceof DirectoryNode) {
|
||||
def childDirNode = childNode as DirectoryNode<T>
|
||||
postProcessRecursive(childDirNode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T> void doPostBuild(DirectoryNode<T> root) {
|
||||
root.fullPath = ''
|
||||
postProcessRecursive(root)
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package dirsync.builder
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
import dirsync.model.tree.ZipData
|
||||
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
class ZipTreeBuilder {
|
||||
static DirectoryNode<ZipData> buildForZipArchive(String zipArchive, ZipFile zf) {
|
||||
DirectoryNode<ZipData> root = new DirectoryNode<>()
|
||||
|
||||
zf.entries().each { ze ->
|
||||
def path = ze.name.replace('\\', '/')
|
||||
if (path.endsWith('/'))
|
||||
path = path.substring(0, path.length() - 1)
|
||||
|
||||
def parentPath = path.contains('/') ? path.substring(0, path.lastIndexOf('/')) : ''
|
||||
def childPath = path.contains('/') ? path.substring(path.lastIndexOf('/') + 1) : path
|
||||
|
||||
def parentNode = (DirectoryNode<ZipData>) root.getByPath(parentPath)
|
||||
if (parentNode == null)
|
||||
throw new RuntimeException("Error reading ${zipArchive}: could not find parent path ${parentPath} for path ${path}")
|
||||
|
||||
def childNode = parentNode.getChildren(childPath)
|
||||
if (childNode)
|
||||
throw new RuntimeException("Error reading ${zipArchive}: duplicate path ${path}")
|
||||
|
||||
if (ze.directory) {
|
||||
childNode = new DirectoryNode<ZipData>(
|
||||
name: childPath,
|
||||
lastModifiedDate: ze.time,
|
||||
data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive),
|
||||
parent: parentNode
|
||||
);
|
||||
} else {
|
||||
childNode = new FileNode<ZipData>(
|
||||
name: childPath,
|
||||
lastModifiedDate: ze.time,
|
||||
data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive),
|
||||
parent: parentNode,
|
||||
size: ze.size
|
||||
);
|
||||
}
|
||||
parentNode.childNodes[childPath] = childNode
|
||||
|
||||
//println '' + ze.directory + ' ' + ze.name + ' ' + parentPath + ' ' + childPath
|
||||
}
|
||||
|
||||
PostBuildPass.doPostBuild(root)
|
||||
return root
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package dirsync.merger
|
||||
|
||||
import dirsync.model.synccmd.AbstractSyncCmd
|
||||
import dirsync.model.synccmd.CopyDirCmd
|
||||
import dirsync.model.synccmd.CopyFileCmd
|
||||
import dirsync.model.synccmd.DeleteDirCmd
|
||||
import dirsync.model.synccmd.DeleteFileCmd
|
||||
import dirsync.model.synccmd.ReplaceFileCmd
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
@TypeChecked
|
||||
class FileTreeComparator {
|
||||
|
||||
private static <T, U> void mergeDirsRecursive(DirectoryNode<T> left, DirectoryNode<U> right, List<AbstractSyncCmd<T, U>> diffs) {
|
||||
|
||||
// left => right
|
||||
left.childNodes.each { le ->
|
||||
def leftNode = le.value
|
||||
def rightNode = right.childNodes[leftNode.name]
|
||||
|
||||
if (rightNode == null) {
|
||||
switch (leftNode) {
|
||||
case DirectoryNode:
|
||||
def leftDirNode = leftNode as DirectoryNode<T>
|
||||
diffs << new CopyDirCmd<>(src: leftDirNode, dstParentDir: right)
|
||||
break
|
||||
|
||||
case FileNode:
|
||||
def leftFileNode = leftNode as FileNode<T>
|
||||
diffs << new CopyFileCmd<>(src: leftFileNode, dstDir: right)
|
||||
break
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid node class ${leftNode.class.name}")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (rightNode.class != leftNode.class) {
|
||||
throw new RuntimeException("node classes mismatch: ${leftNode.class.name} != ${rightNode.class.name}")
|
||||
}
|
||||
|
||||
switch (rightNode) {
|
||||
case DirectoryNode:
|
||||
def leftDirNode = leftNode as DirectoryNode<T>
|
||||
def rightDirNode = rightNode as DirectoryNode<U>
|
||||
mergeDirsRecursive(leftDirNode, rightDirNode, diffs)
|
||||
break
|
||||
|
||||
case FileNode:
|
||||
def leftFileNode = leftNode as FileNode<T>
|
||||
def rightFileNode = rightNode as FileNode<T>
|
||||
if (leftFileNode.size != rightFileNode.size || leftFileNode.lastModifiedDate != rightFileNode.lastModifiedDate) {
|
||||
diffs << new ReplaceFileCmd<>(src: leftFileNode, dst: rightFileNode)
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid node class ${rightNode.class.name}")
|
||||
}
|
||||
} // ~left => right
|
||||
|
||||
//right => left
|
||||
right.childNodes.each { re ->
|
||||
def rightNode = re.value
|
||||
def leftNode = left.childNodes[rightNode.name]
|
||||
|
||||
if (leftNode != null) {
|
||||
return //already processed in left => right
|
||||
}
|
||||
|
||||
switch (rightNode) {
|
||||
case DirectoryNode:
|
||||
def rightDirNode = rightNode as DirectoryNode<U>
|
||||
diffs << new DeleteDirCmd<>(dirNode: rightDirNode)
|
||||
break
|
||||
|
||||
case FileNode:
|
||||
def rightFileNode = rightNode as FileNode<T>
|
||||
diffs << new DeleteFileCmd<>(node: rightFileNode)
|
||||
break
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid node class ${rightNode.class.name}")
|
||||
}
|
||||
} // ~right => left
|
||||
}
|
||||
|
||||
static <T, U> List<AbstractSyncCmd<T, U>> mergeTrees(DirectoryNode<T> leftRoot, DirectoryNode<U> rightRoot) {
|
||||
List<AbstractSyncCmd<T, U>> res = []
|
||||
mergeDirsRecursive(leftRoot, rightRoot, res)
|
||||
return res
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package dirsync.merger
|
||||
|
||||
import dirsync.model.synccmd.AbstractSyncCmd
|
||||
import dirsync.model.synccmd.CopyDirCmd
|
||||
import dirsync.model.synccmd.CopyFileCmd
|
||||
import dirsync.model.synccmd.DeleteDirCmd
|
||||
import dirsync.model.synccmd.DeleteFileCmd
|
||||
import dirsync.model.synccmd.ReplaceFileCmd
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
import dirsync.model.tree.TreePhysMapper
|
||||
import groovy.transform.TypeChecked
|
||||
import org.apache.commons.io.IOUtils
|
||||
|
||||
@TypeChecked
|
||||
public class FileTreeDiffApplier {
|
||||
|
||||
static <T, U> void copyDirRecursive(DirectoryNode<T> src, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
dstMapper.createDirectory(src.fullPath)
|
||||
src.childNodes.each { ce ->
|
||||
def childNode = ce.value
|
||||
def childPath = childNode.fullPath
|
||||
switch (childNode) {
|
||||
case FileNode:
|
||||
srcMapper.fileContent(childNode.data).withStream { InputStream inStream ->
|
||||
dstMapper.createFile(childPath).withStream { OutputStream outStream ->
|
||||
IOUtils.copy(inStream, outStream)
|
||||
}
|
||||
|
||||
dstMapper.setFileLastUpdatedDate(childPath, childNode.lastModifiedDate)
|
||||
}
|
||||
break;
|
||||
|
||||
case DirectoryNode:
|
||||
copyDirRecursive(childNode as DirectoryNode<T>, srcMapper, dstMapper)
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid node class: ${childNode.class.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T, U> void handleCopyFile(CopyFileCmd<T, U> fileCopy, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
def dstPath = fileCopy.dstDir.fullPath ? fileCopy.dstDir.fullPath + '/' + fileCopy.src.name : fileCopy.src.name
|
||||
srcMapper.fileContent(fileCopy.src.data).withStream { InputStream inStream ->
|
||||
dstMapper.createFile(dstPath).withStream { OutputStream outStream ->
|
||||
IOUtils.copy(inStream, outStream)
|
||||
}
|
||||
|
||||
dstMapper.setFileLastUpdatedDate(dstPath, fileCopy.src.lastModifiedDate)
|
||||
}
|
||||
}
|
||||
|
||||
static <T, U> void handleDeleteDir(DeleteDirCmd<T, U> delDir, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
dstMapper.removeDirectory(delDir.dirNode.fullPath)
|
||||
}
|
||||
|
||||
static <T, U> void handleDeleteFile(DeleteFileCmd<T, U> delFile, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
dstMapper.removeFile(delFile.node.fullPath)
|
||||
}
|
||||
|
||||
static <T, U> void handleReplaceFile(ReplaceFileCmd<T, U> replaceFile, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
dstMapper.removeFile(replaceFile.dst.fullPath)
|
||||
srcMapper.fileContent(replaceFile.src.data).withStream { InputStream inStream ->
|
||||
dstMapper.createFile(replaceFile.dst.fullPath).withStream { OutputStream outStream ->
|
||||
IOUtils.copy(inStream, outStream)
|
||||
}
|
||||
|
||||
dstMapper.setFileLastUpdatedDate(replaceFile.dst.fullPath, replaceFile.src.lastModifiedDate)
|
||||
}
|
||||
}
|
||||
|
||||
static <T, U> void applyDiffs(List<AbstractSyncCmd<T, U>> diffs, TreePhysMapper<T> srcMapper, TreePhysMapper<U> dstMapper) {
|
||||
diffs.each { diff ->
|
||||
switch (diff) {
|
||||
case CopyDirCmd:
|
||||
def copyDir = diff as CopyDirCmd<T, U>
|
||||
copyDirRecursive(copyDir.src, srcMapper, dstMapper)
|
||||
break
|
||||
|
||||
case CopyFileCmd:
|
||||
handleCopyFile(diff as CopyFileCmd<T, U>, srcMapper, dstMapper)
|
||||
break
|
||||
|
||||
case DeleteDirCmd:
|
||||
handleDeleteDir(diff as DeleteDirCmd<T, U>, srcMapper, dstMapper)
|
||||
break
|
||||
|
||||
case DeleteFileCmd:
|
||||
handleDeleteFile(diff as DeleteFileCmd<T, U>, srcMapper, dstMapper)
|
||||
break
|
||||
|
||||
case ReplaceFileCmd:
|
||||
handleReplaceFile(diff as ReplaceFileCmd<T, U>, srcMapper, dstMapper)
|
||||
break
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid diff command ${diff.class.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
class AbstractSyncCmd<T, U> {
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
|
||||
class CopyDirCmd<T, U> extends AbstractSyncCmd<T, U> {
|
||||
DirectoryNode<T> src
|
||||
DirectoryNode<U> dstParentDir
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FileNode
|
||||
|
||||
class CopyFileCmd<T, U> extends AbstractSyncCmd<T, U> {
|
||||
FileNode<T> src
|
||||
DirectoryNode<U> dstDir
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
|
||||
class DeleteDirCmd<T, U> extends AbstractSyncCmd<T, U> {
|
||||
DirectoryNode<U> dirNode
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
import dirsync.model.tree.FileNode
|
||||
|
||||
class DeleteFileCmd<T, U> extends AbstractSyncCmd<T, U> {
|
||||
FileNode<U> node
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package dirsync.model.synccmd
|
||||
|
||||
import dirsync.model.tree.FileNode
|
||||
|
||||
class ReplaceFileCmd<T, U> extends AbstractSyncCmd<T, U> {
|
||||
FileNode<T> src
|
||||
FileNode<U> dst
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
abstract class AbstractFileTreeNode<T> {
|
||||
DirectoryNode<T> parent
|
||||
String name
|
||||
String fullPath
|
||||
long lastModifiedDate
|
||||
T data
|
||||
|
||||
boolean equals(o) {
|
||||
if (this.is(o)) return true
|
||||
if (getClass() != o.class) return false
|
||||
|
||||
AbstractFileTreeNode that = (AbstractFileTreeNode) o
|
||||
|
||||
if (name != that.name) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
int hashCode() {
|
||||
return (name != null ? name.hashCode() : 0)
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
class DirectoryNode<T> extends AbstractFileTreeNode<T> {
|
||||
Map<String, AbstractFileTreeNode<T>> childNodes = new HashMap<>()
|
||||
|
||||
AbstractFileTreeNode<T> getChildren(String name) {
|
||||
return childNodes[name];
|
||||
}
|
||||
|
||||
AbstractFileTreeNode<T> getChildren(String[] names, int idx) {
|
||||
if (idx == names.length)
|
||||
return this
|
||||
|
||||
AbstractFileTreeNode<T> c = childNodes[names[idx]]
|
||||
if (c == null)
|
||||
return null
|
||||
|
||||
if (c instanceof DirectoryNode) {
|
||||
def d = (DirectoryNode<T>) c;
|
||||
return d.getChildren(names, idx + 1)
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
AbstractFileTreeNode<T> getByPath(String path) {
|
||||
path = path.replace('\\', '/')
|
||||
if (path.endsWith('/'))
|
||||
path = path.substring(0, path.length() - 1)
|
||||
|
||||
if (path.empty) {
|
||||
return this
|
||||
}
|
||||
|
||||
String[] components = path.split('/')
|
||||
return getChildren(components, 0)
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
class FSMapper extends TreePhysMapper<File> {
|
||||
final File root
|
||||
|
||||
FSMapper(File root) {
|
||||
this.root = root
|
||||
}
|
||||
|
||||
@Override
|
||||
InputStream fileContent(File file) {
|
||||
return file.newDataInputStream()
|
||||
}
|
||||
|
||||
@Override
|
||||
void createDirectory(String dir) {
|
||||
def target = new File(root, dir)
|
||||
if (!target.mkdirs()) {
|
||||
throw new RuntimeException("Failed to create directory ${target.absolutePath}")
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void removeDirectory(String dir) {
|
||||
def target = new File(root, dir)
|
||||
if (!target.deleteDir()) {
|
||||
throw new RuntimeException("Failed to delete directory ${target.absolutePath}")
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void removeFile(String path) {
|
||||
def target = new File(root, path)
|
||||
if (!target.delete()) {
|
||||
throw new RuntimeException("Failed to delete file ${target.absolutePath}")
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
OutputStream createFile(String path) {
|
||||
def target = new File(root, path)
|
||||
return target.newOutputStream()
|
||||
}
|
||||
|
||||
@Override
|
||||
void setFileLastUpdatedDate(String path, long date) {
|
||||
def target = new File(root, path)
|
||||
target.setLastModified(date)
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
class FileNode<T> extends AbstractFileTreeNode<T> {
|
||||
long size
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
abstract class TreePhysMapper<T> {
|
||||
abstract InputStream fileContent(T file)
|
||||
abstract void createDirectory(String dir)
|
||||
abstract void removeDirectory(String dir)
|
||||
abstract void removeFile(String path)
|
||||
abstract OutputStream createFile(String path)
|
||||
|
||||
abstract void setFileLastUpdatedDate(String path, long date)
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
class ZipData {
|
||||
String zipEntryName
|
||||
String zipArchiveName
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package dirsync.model.tree
|
||||
|
||||
import dirsync.builder.FileTreeMerger
|
||||
import dirsync.builder.ZipTreeBuilder
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException
|
||||
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
public class ZipTreeMapper extends TreePhysMapper<ZipData> implements Closeable {
|
||||
Map<String, ZipFile> zipArchives = [:]
|
||||
|
||||
void addZipArchive(String zipArchive) {
|
||||
zipArchives[zipArchive] = new ZipFile(zipArchive)
|
||||
}
|
||||
|
||||
DirectoryNode<ZipData> buildFileTree() {
|
||||
def root = new DirectoryNode<ZipData>()
|
||||
zipArchives.each { ze ->
|
||||
def zipTree = ZipTreeBuilder.buildForZipArchive(ze.key, ze.value)
|
||||
root = FileTreeMerger.mergeTrees(root, zipTree)
|
||||
}
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
@Override
|
||||
void close() throws IOException {
|
||||
zipArchives.each { ze ->
|
||||
try { ze.value.close() } catch (Exception ignored) { }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
InputStream fileContent(ZipData file) {
|
||||
def archive = zipArchives[file.zipArchiveName]
|
||||
if (!archive) {
|
||||
throw new RuntimeException("Archive ${file.zipArchiveName} is not loaded");
|
||||
}
|
||||
|
||||
def zipEntry = archive.getEntry(file.zipEntryName)
|
||||
if (!zipEntry) {
|
||||
throw new RuntimeException("File ${file.zipEntryName} not found in archive ${file.zipArchiveName}");
|
||||
}
|
||||
|
||||
return archive.getInputStream(zipEntry)
|
||||
}
|
||||
|
||||
@Override
|
||||
void createDirectory(String dir) {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void removeDirectory(String dir) {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void removeFile(String path) {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@Override
|
||||
OutputStream createFile(String path) {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void setFileLastUpdatedDate(String path, long date) {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package gradlecpp
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
|
||||
class CppUnitTestExtension {
|
||||
Project _project
|
||||
|
||||
CppUnitTestExtension(Project p) {
|
||||
_project = p
|
||||
}
|
||||
|
||||
void eachTestExecutable(Closure action) {
|
||||
_project.binaries.each { NativeBinarySpec bin ->
|
||||
if (!bin.hasProperty('cppUnitTestsExecutable')) return
|
||||
action(bin)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,242 +0,0 @@
|
||||
package gradlecpp
|
||||
|
||||
import gradlecpp.teamcity.TeamCityIntegration
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.internal.project.AbstractProject
|
||||
import org.gradle.model.internal.core.DirectNodeModelAction
|
||||
import org.gradle.model.internal.core.ModelActionRole
|
||||
import org.gradle.model.internal.core.ModelPath
|
||||
import org.gradle.model.internal.core.ModelReference
|
||||
import org.gradle.model.internal.core.MutableModelNode
|
||||
import org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor
|
||||
import org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor
|
||||
import org.gradle.model.internal.registry.ModelRegistry
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
import org.gradle.nativeplatform.NativeLibrarySpec
|
||||
import org.gradle.nativeplatform.internal.AbstractNativeBinarySpec
|
||||
|
||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||
|
||||
class CppUnitTestPlugin implements Plugin<Project> {
|
||||
|
||||
private static class TestExecStatus {
|
||||
boolean successful
|
||||
int exitCode
|
||||
String output
|
||||
long durationMsec
|
||||
String cmdLine
|
||||
String execDir
|
||||
}
|
||||
|
||||
static void onBinariesCreated(Project p, String desc, Closure action) {
|
||||
ModelRegistry mr = (p as AbstractProject).getModelRegistry()
|
||||
def modelPath = ModelPath.path("binaries")
|
||||
ModelRuleDescriptor ruleDescriptor = new SimpleModelRuleDescriptor(desc);
|
||||
|
||||
mr.configure(ModelActionRole.Finalize, DirectNodeModelAction.of(ModelReference.of(modelPath), ruleDescriptor, new Action<MutableModelNode>() {
|
||||
@Override
|
||||
void execute(MutableModelNode node) {
|
||||
action()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.extensions.create('cppUnitTest', CppUnitTestExtension, project)
|
||||
onBinariesCreated(project, 'CppUnitTestPlugin::AttachUnitTest', {
|
||||
processCppUnitTests(project)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Attaches test tasks to C/C++ libraries build tasks
|
||||
*/
|
||||
static void processCppUnitTests(Project p) {
|
||||
//println "processCppUnitTests::afterEvaluate on ${p.name}: project type is ${p.projectType}"
|
||||
|
||||
p.binaries.all { NativeBinarySpec bin ->
|
||||
if (!(bin.component instanceof NativeLibrarySpec)) {
|
||||
return
|
||||
}
|
||||
|
||||
def testComponentName = bin.component.name + '_tests'
|
||||
Collection<NativeBinarySpec> testCandidates = p.binaries.matching { it.component.name == testComponentName && bin.buildType == it.buildType && bin.flavor == it.flavor }
|
||||
if (testCandidates.size() > 1) {
|
||||
throw new GradleException("Found >1 test candidates for library ${bin.component.name} in project ${p}: ${testCandidates}")
|
||||
} else if (!testCandidates.empty) {
|
||||
def testBinary = testCandidates.first()
|
||||
GradleCppUtils.onTasksCreated(p, 'CppUnitTestPlugin::AttachUnitTestTask', {
|
||||
attachTestTaskToCppLibrary(bin, testBinary)
|
||||
})
|
||||
String testTaskName = bin.namingScheme.getTaskName('unitTest')
|
||||
bin.ext.cppUnitTestTask = testTaskName
|
||||
} else {
|
||||
throw new GradleException("No tests found for library ${bin.component.name} in project ${p}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static TestExecStatus runTestExecutable(NativeBinarySpec testSubject, String executable, List<String> params, String phase, int timeout) {
|
||||
def execFile = new File(executable)
|
||||
def outDir = new File(testSubject.buildTask.project.buildDir, "tests/${testSubject.name}/run")
|
||||
outDir.mkdirs()
|
||||
|
||||
def outPath = new File(outDir, "${phase}.log")
|
||||
|
||||
def cmdParams = [];
|
||||
cmdParams << execFile.absolutePath
|
||||
cmdParams.addAll(params)
|
||||
|
||||
def execDir = execFile.parentFile
|
||||
def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(execDir)
|
||||
if (!GradleCppUtils.windows) {
|
||||
pb.environment().put('LD_LIBRARY_PATH', '.')
|
||||
}
|
||||
|
||||
|
||||
def sout = new StringBuffer()
|
||||
|
||||
long startTime = System.currentTimeMillis()
|
||||
def p = pb.start()
|
||||
p.consumeProcessOutput(sout, sout)
|
||||
|
||||
p.waitForOrKill(timeout * 1000)
|
||||
long endTime = System.currentTimeMillis()
|
||||
|
||||
int exitVal = p.exitValue()
|
||||
|
||||
outPath.withWriter('UTF-8') { writer ->
|
||||
writer.write(sout.toString())
|
||||
}
|
||||
|
||||
return new TestExecStatus(
|
||||
exitCode: exitVal,
|
||||
successful: (exitVal == 0),
|
||||
output: sout.toString(),
|
||||
durationMsec: endTime - startTime,
|
||||
cmdLine: cmdParams.join(' '),
|
||||
execDir: execDir.absolutePath
|
||||
)
|
||||
}
|
||||
|
||||
static void dumpTestExecStatus(TestExecStatus stat) {
|
||||
if (!stat) {
|
||||
println "Execution of test executable failed"
|
||||
}
|
||||
|
||||
println "Test executable command: ${stat.cmdLine}"
|
||||
println "Test executable run directury: ${stat.execDir}"
|
||||
println "Test executable exit code: ${stat.exitCode}"
|
||||
println "Test executable output BEGIN"
|
||||
println stat.output
|
||||
println "Test executable output END"
|
||||
}
|
||||
|
||||
static void attachTestTaskToCppLibrary(NativeBinarySpec libBin, NativeBinarySpec testExecBin) {
|
||||
Project p = libBin.buildTask.project
|
||||
|
||||
def libBinImpl = libBin as AbstractNativeBinarySpec
|
||||
def libLinkTask = GradleCppUtils.getLinkTask(libBin)
|
||||
def testExecLinkTask = GradleCppUtils.getLinkTask(testExecBin)
|
||||
|
||||
// collect all output files from library and test executable
|
||||
def depFiles = []
|
||||
depFiles.addAll(libLinkTask.outputs.files.files)
|
||||
depFiles.addAll(testExecLinkTask.outputs.files.files)
|
||||
|
||||
//create 'tests' task
|
||||
def testTaskName = libBinImpl.namingScheme.getTaskName('unitTest')
|
||||
def testTask = p.task(testTaskName, { Task testTask ->
|
||||
|
||||
//output dir
|
||||
def testResDir = new File(p.buildDir, "tests/${libBin.name}")
|
||||
|
||||
//inputs/outputs for up-to-date check
|
||||
testTask.outputs.dir testResDir
|
||||
testTask.inputs.files depFiles
|
||||
|
||||
//dependencies on library and test executable
|
||||
testTask.dependsOn libLinkTask
|
||||
testTask.dependsOn testExecLinkTask
|
||||
|
||||
// binary build depends on unit test
|
||||
libBin.buildTask.dependsOn testTask
|
||||
|
||||
// extra project-specific dependencies
|
||||
def testDepsTask = p.tasks.findByName('testDeps')
|
||||
if (testDepsTask != null) {
|
||||
testTask.dependsOn testDepsTask
|
||||
}
|
||||
|
||||
// task actions
|
||||
testTask.doLast {
|
||||
|
||||
//temporary file that store info about all tests (XML)
|
||||
File allTests = File.createTempFile('j4s-testinfo', 'data')
|
||||
allTests.deleteOnExit()
|
||||
|
||||
//fill file with test info
|
||||
print "Fetching test info..."
|
||||
def getTestsStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-writeTestInfo', allTests.absolutePath], '__getTests', 5000)
|
||||
if (!getTestsStatus.successful) {
|
||||
println " Failed"
|
||||
dumpTestExecStatus(getTestsStatus)
|
||||
throw new GradleException("Unable to fetch test names")
|
||||
}
|
||||
println " OK"
|
||||
getTestsStatus = null // allow GC to collect it
|
||||
|
||||
// parse the test info file
|
||||
def root = new XmlSlurper().parse(allTests)
|
||||
|
||||
// run all tests
|
||||
println "Running ${root.test.size()} tests..."
|
||||
TeamCityIntegration.suiteStarted("unitTests.${libBin.name}")
|
||||
int failCount = 0;
|
||||
root.test.list().each { testInfo ->
|
||||
def testName = '' + testInfo.@name.text()
|
||||
def testGroup = '' + testInfo.@group.text()
|
||||
def testTimeout = ('' + testInfo.@timeout.text()) as int
|
||||
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
print " ${testGroup}-${testName}..."
|
||||
System.out.flush()
|
||||
}
|
||||
|
||||
TeamCityIntegration.testStarted("${testGroup}-${testName}")
|
||||
def testExecStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-runTest', testGroup, testName], "${testGroup}-${testName}", testTimeout)
|
||||
if (!testExecStatus.successful) {
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
println " Failed"
|
||||
}
|
||||
|
||||
TeamCityIntegration.testFailed("${testGroup}-${testName}", "test executable return code is ${testExecStatus.exitCode}", "test executable return code is ${testExecStatus.exitCode}")
|
||||
dumpTestExecStatus(testExecStatus)
|
||||
failCount++
|
||||
} else {
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
println " OK"
|
||||
}
|
||||
}
|
||||
|
||||
TeamCityIntegration.testStdOut("${testGroup}-${testName}", testExecStatus.output)
|
||||
TeamCityIntegration.testFinished("${testGroup}-${testName}", testExecStatus.durationMsec)
|
||||
|
||||
}
|
||||
TeamCityIntegration.suiteFinished("unitTests.${libBin.name}")
|
||||
|
||||
if (failCount) {
|
||||
throw new GradleException("CPP unit tests: ${failCount} tests failed");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package gradlecpp
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
class RegamedllPlayTestPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.configurations {
|
||||
regamedll_playtest_image
|
||||
}
|
||||
|
||||
project.dependencies {
|
||||
regamedll_playtest_image 'regamedll.testimg:testimg:2.0'
|
||||
}
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package gradlecpp
|
||||
|
||||
import gradlecpp.teamcity.TeamCityIntegration
|
||||
import org.apache.commons.lang.SystemUtils
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
import regamedll.testdemo.RegamedllDemoRunner
|
||||
import regamedll.testdemo.RegamedllTestParser
|
||||
|
||||
class RegamedllPlayTestTask extends DefaultTask {
|
||||
|
||||
def FileCollection testDemos
|
||||
def Closure postExtractAction
|
||||
def File regamedllImageRoot
|
||||
def File regamedllTestLogs
|
||||
def NativeBinarySpec testFor
|
||||
|
||||
@TaskAction
|
||||
def doPlay() {
|
||||
if (!SystemUtils.IS_OS_WINDOWS) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!testDemos) {
|
||||
println 'RegamedllPlayTestTask: no demos attached to the testDemos property'
|
||||
}
|
||||
|
||||
regamedllImageRoot.mkdirs()
|
||||
regamedllTestLogs.mkdirs()
|
||||
|
||||
def demoRunner = new RegamedllDemoRunner(this.project.configurations.regamedll_playtest_image.getFiles(), regamedllImageRoot, postExtractAction)
|
||||
|
||||
println "Preparing engine..."
|
||||
demoRunner.prepareEngine()
|
||||
|
||||
println "Running ${testDemos.getFiles().size()} ReGameDLL_CS test demos..."
|
||||
|
||||
TeamCityIntegration.suiteStarted("regamedllDemo.${testFor.name}")
|
||||
int failCount = 0;
|
||||
testDemos.getFiles().each { f ->
|
||||
|
||||
demoRunner.prepareEngine();
|
||||
def testInfo = RegamedllTestParser.parseTestInfo(f)
|
||||
|
||||
TeamCityIntegration.testStarted(testInfo.testName)
|
||||
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
println "Running ReGameDLL_CS test demo ${testInfo.testName} "
|
||||
System.out.flush()
|
||||
}
|
||||
|
||||
println "Preparing files for test demo ${testInfo.testName} "
|
||||
|
||||
demoRunner.prepareDemo(f)
|
||||
|
||||
def testRes = demoRunner.runTest(testInfo, regamedllTestLogs)
|
||||
|
||||
if (testRes.success) {
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
println ' OK'
|
||||
}
|
||||
} else {
|
||||
|
||||
TeamCityIntegration.testFailed(testInfo.testName, "Exit code: ${testRes.returnCode}", "Exit code: ${testRes.returnCode}")
|
||||
if (!TeamCityIntegration.writeOutput) {
|
||||
println ' Failed'
|
||||
println "ReGameDLL_CS testdemo ${testInfo.testName} playback failed. Exit status is ${testRes.returnCode}."
|
||||
println "Dumping console output:"
|
||||
println testRes.hldsConsoleOutput
|
||||
}
|
||||
|
||||
failCount++
|
||||
}
|
||||
|
||||
TeamCityIntegration.testStdOut(testInfo.testName, testRes.hldsConsoleOutput)
|
||||
TeamCityIntegration.testFinished(testInfo.testName, testRes.duration)
|
||||
}
|
||||
TeamCityIntegration.suiteFinished("regamedllDemo.${testFor.name}")
|
||||
|
||||
if (failCount) {
|
||||
throw new RuntimeException("ReGameDLL_CS testdemos: failed ${failCount} tests")
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package gradlecpp
|
||||
|
||||
import org.apache.velocity.Template
|
||||
import org.apache.velocity.VelocityContext
|
||||
import org.apache.velocity.app.Velocity
|
||||
import org.joda.time.format.DateTimeFormat
|
||||
|
||||
class VelocityUtils {
|
||||
|
||||
static {
|
||||
Properties p = new Properties();
|
||||
|
||||
p.setProperty("resource.loader", "class");
|
||||
p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
|
||||
p.setProperty("class.resource.loader.path", "");
|
||||
|
||||
p.setProperty("input.encoding", "UTF-8");
|
||||
p.setProperty("output.encoding", "UTF-8");
|
||||
|
||||
Velocity.init(p);
|
||||
}
|
||||
|
||||
static String renderTemplate(File tplFile, Map<String, ? extends Object> ctx) {
|
||||
Template tpl = Velocity.getTemplate(tplFile.absolutePath)
|
||||
if (!tpl) {
|
||||
throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found")
|
||||
}
|
||||
|
||||
|
||||
def velocityContext = new VelocityContext(ctx)
|
||||
velocityContext.put("_DateTimeFormat", DateTimeFormat)
|
||||
|
||||
def sw = new StringWriter()
|
||||
tpl.merge(velocityContext, sw)
|
||||
|
||||
return sw.toString()
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package gradlecpp.teamcity
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
|
||||
class TeamCityIntegration {
|
||||
|
||||
static final String flowId = System.getenv('TEAMCITY_PROCESS_FLOW_ID')
|
||||
static final boolean underTeamcity = System.getenv('TEAMCITY_PROJECT_NAME')
|
||||
static boolean writeOutput = underTeamcity
|
||||
|
||||
@CompileStatic
|
||||
private static String escape(String s) {
|
||||
StringBuilder sb = new StringBuilder((int)(s.length() * 1.2));
|
||||
for (char c in s.chars) {
|
||||
switch (c) {
|
||||
case '\n': sb.append('|n'); break;
|
||||
case '\r': sb.append('|r'); break;
|
||||
case '\'': sb.append('|\''); break;
|
||||
case '|': sb.append('||'); break;
|
||||
case ']': sb.append('|]'); break;
|
||||
default: sb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
static void writeMessage(String name, Map params) {
|
||||
if (!writeOutput) return
|
||||
StringBuilder sb = new StringBuilder()
|
||||
sb.append('##teamcity[').append(name)
|
||||
params.each { e ->
|
||||
if (e.value != null) {
|
||||
sb.append(' ').append('' + e.key).append('=\'').append(escape('' + e.value)).append('\'')
|
||||
}
|
||||
}
|
||||
sb.append(']')
|
||||
|
||||
println sb.toString()
|
||||
}
|
||||
|
||||
static void suiteStarted(String suiteName) {
|
||||
writeMessage('testSuiteStarted', [name: suiteName, flowId: flowId ?: null])
|
||||
}
|
||||
|
||||
static void suiteFinished(String suiteName) {
|
||||
writeMessage('testSuiteFinished', [name: suiteName, flowId: flowId ?: null])
|
||||
}
|
||||
|
||||
static void testStarted(String testName) {
|
||||
writeMessage('testStarted', [name: testName, flowId: flowId ?: null])
|
||||
}
|
||||
|
||||
static void testStdOut(String testName, String output) {
|
||||
writeMessage('testStdOut', [name: testName, out: output, flowId: flowId ?: null])
|
||||
}
|
||||
|
||||
static void testFinished(String testName, long durationMs) {
|
||||
writeMessage('testFinished', [
|
||||
name: testName,
|
||||
flowId: flowId ?: null,
|
||||
duration: (durationMs >= 0) ? durationMs : null
|
||||
])
|
||||
}
|
||||
|
||||
static void testFailed(String testName, String message, String details) {
|
||||
writeMessage('testFailed', [
|
||||
name: testName,
|
||||
flowId: flowId ?: null,
|
||||
message: message,
|
||||
details: details
|
||||
])
|
||||
}
|
||||
|
||||
static void testIgnored(String testName, String message) {
|
||||
writeMessage('testIgnored', [
|
||||
name: testName,
|
||||
flowId: flowId ?: null,
|
||||
message: message,
|
||||
])
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package regamedll.testdemo
|
||||
|
||||
import dirsync.builder.FileSystemTreeBuilder
|
||||
import dirsync.merger.FileTreeComparator
|
||||
import dirsync.merger.FileTreeDiffApplier
|
||||
import dirsync.model.tree.DirectoryNode
|
||||
import dirsync.model.tree.FSMapper
|
||||
import dirsync.model.tree.ZipData
|
||||
import dirsync.model.tree.ZipTreeMapper
|
||||
import org.apache.ant.compress.taskdefs.Unzip
|
||||
import org.apache.tools.ant.types.PatternSet;
|
||||
|
||||
class RegamedllDemoRunner {
|
||||
ZipTreeMapper regamedllImage = new ZipTreeMapper()
|
||||
File rootDir
|
||||
DirectoryNode<ZipData> engineImageTree
|
||||
Closure postExtract
|
||||
|
||||
static class TestResult {
|
||||
boolean success
|
||||
int returnCode
|
||||
String hldsConsoleOutput
|
||||
long duration
|
||||
}
|
||||
|
||||
RegamedllDemoRunner(Collection<File> engineImageZips, File rootDir, Closure postExtract) {
|
||||
this.rootDir = rootDir
|
||||
engineImageZips.each { f ->
|
||||
regamedllImage.addZipArchive(f.absolutePath)
|
||||
}
|
||||
engineImageTree = regamedllImage.buildFileTree()
|
||||
this.postExtract = postExtract
|
||||
}
|
||||
|
||||
void prepareDemo(File demoArchive) {
|
||||
|
||||
if (demoArchive == null) {
|
||||
throw new RuntimeException("ReGameDLL_CS testdemos: file is null")
|
||||
}
|
||||
|
||||
PatternSet patt = new PatternSet();
|
||||
|
||||
patt.setExcludes("**/*.bin");
|
||||
patt.setExcludes("**/*.xml");
|
||||
|
||||
//patt.setIncludes("**/cstrike/*");
|
||||
//patt.setIncludes("**/czero/*");
|
||||
//patt.setIncludes("**/valve/*");
|
||||
|
||||
Unzip unzipper = new Unzip();
|
||||
|
||||
unzipper.setDest( rootDir ); // directory unzipped
|
||||
unzipper.setSrc( demoArchive ); // zip file
|
||||
unzipper.addPatternset( patt );
|
||||
unzipper.execute();
|
||||
}
|
||||
|
||||
void prepareEngine() {
|
||||
def existingTree = FileSystemTreeBuilder.buildFileSystemTree(rootDir)
|
||||
def cmds = FileTreeComparator.mergeTrees(engineImageTree, existingTree)
|
||||
|
||||
FSMapper fsMapper = new FSMapper(rootDir)
|
||||
FileTreeDiffApplier.applyDiffs(cmds, regamedllImage, fsMapper)
|
||||
if (postExtract != null) {
|
||||
postExtract.run()
|
||||
}
|
||||
}
|
||||
|
||||
TestResult runTest(RegamedllTestInfo info, File testLogDir) {
|
||||
long startTime = System.currentTimeMillis()
|
||||
|
||||
//prepareEngine()
|
||||
|
||||
def outPath = new File(testLogDir, "${info.testName}_run.log")
|
||||
|
||||
def cmdParams = []
|
||||
cmdParams << new File(rootDir, 'hlds.exe').absolutePath
|
||||
cmdParams.addAll(info.hldsArgs)
|
||||
if (info.regamedllExtraArgs) {
|
||||
cmdParams.addAll(info.regamedllExtraArgs)
|
||||
}
|
||||
cmdParams << '--rehlds-test-play' << info.testBinFile.absolutePath
|
||||
|
||||
def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(rootDir)
|
||||
def sout = new StringBuffer()
|
||||
|
||||
def p = pb.start()
|
||||
p.consumeProcessOutput(sout, sout)
|
||||
|
||||
p.waitForOrKill(info.timeoutSeconds * 1000)
|
||||
int exitVal = p.exitValue()
|
||||
|
||||
outPath.withWriter('UTF-8') { writer ->
|
||||
writer.write(sout.toString())
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis()
|
||||
|
||||
return new TestResult(
|
||||
success: (exitVal == 777),
|
||||
returnCode: exitVal,
|
||||
hldsConsoleOutput: sout.toString(),
|
||||
duration: endTime - startTime
|
||||
)
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package regamedll.testdemo
|
||||
|
||||
class RegamedllTestInfo {
|
||||
String testName
|
||||
List<String> hldsArgs
|
||||
String regamedllExtraArgs
|
||||
int timeoutSeconds
|
||||
File testBinFile
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package regamedll.testdemo
|
||||
|
||||
import groovy.util.slurpersupport.GPathResult
|
||||
import org.apache.commons.io.IOUtils
|
||||
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
class RegamedllTestParser {
|
||||
static final String REGAMEDLL_TEST_METAINFO_FILE = 'regamedll_test_metainfo.xml'
|
||||
|
||||
static RegamedllTestInfo parseTestInfo(File testArchive) {
|
||||
def zf = new ZipFile(testArchive);
|
||||
try {
|
||||
def metaInfoEntry = zf.getEntry(REGAMEDLL_TEST_METAINFO_FILE)
|
||||
if (metaInfoEntry == null) {
|
||||
throw new RuntimeException("Unable to open ${REGAMEDLL_TEST_METAINFO_FILE} in ${testArchive.absolutePath}")
|
||||
}
|
||||
|
||||
GPathResult metaInfo = null
|
||||
zf.getInputStream(metaInfoEntry).withStream { InputStream ins ->
|
||||
metaInfo = new XmlSlurper().parse(ins)
|
||||
}
|
||||
|
||||
RegamedllTestInfo testInfo = new RegamedllTestInfo(
|
||||
testName: metaInfo.name.text(),
|
||||
hldsArgs: metaInfo.runArgs.arg.list().collect { it.text().trim() },
|
||||
timeoutSeconds: metaInfo.timeout.text() as int
|
||||
)
|
||||
|
||||
//validate testInfo
|
||||
if (!testInfo.testName) {
|
||||
throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test name is not specified")
|
||||
}
|
||||
|
||||
if (!testInfo.hldsArgs) {
|
||||
throw new RuntimeException("Error parsing ${testArchive.absolutePath}: run arguments are not specified")
|
||||
}
|
||||
|
||||
if (testInfo.timeoutSeconds <= 0) {
|
||||
throw new RuntimeException("Error parsing ${testArchive.absolutePath}: bad timeout")
|
||||
}
|
||||
|
||||
def testBinName = testInfo.testName + '.bin'
|
||||
def testBinEntry = zf.getEntry(testBinName)
|
||||
if (testBinEntry == null) {
|
||||
throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test binary ${testBinName} not found inside archive")
|
||||
}
|
||||
|
||||
testInfo.testBinFile = File.createTempFile(testBinName, 'regamedll')
|
||||
testInfo.testBinFile.deleteOnExit()
|
||||
zf.getInputStream(testBinEntry).withStream { InputStream ins ->
|
||||
testInfo.testBinFile.withOutputStream { OutputStream os ->
|
||||
IOUtils.copy(ins, os)
|
||||
}
|
||||
}
|
||||
|
||||
return testInfo
|
||||
} finally {
|
||||
try { zf.close() } catch (Exception ignored) { }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package versioning
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
import org.joda.time.DateTime
|
||||
|
||||
@CompileStatic @TypeChecked
|
||||
class GitInfo {
|
||||
boolean localChanges
|
||||
DateTime commitDate
|
||||
String branch
|
||||
String tag
|
||||
String commitSHA
|
||||
String commitURL
|
||||
Integer commitCount
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
package versioning
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.api.Status;
|
||||
import org.eclipse.jgit.lib.ObjectId
|
||||
import org.eclipse.jgit.lib.Repository
|
||||
import org.eclipse.jgit.lib.StoredConfig
|
||||
import org.eclipse.jgit.submodule.SubmoduleWalk;
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import org.eclipse.jgit.revwalk.RevWalk
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.DateTimeZone
|
||||
|
||||
@CompileStatic @TypeChecked
|
||||
class GitVersioner {
|
||||
|
||||
static GitInfo versionForDir(String dir) {
|
||||
versionForDir(new File(dir))
|
||||
}
|
||||
static int getCountCommit(Repository repo) {
|
||||
Iterable<RevCommit> commits = Git.wrap(repo).log().call()
|
||||
int count = 0;
|
||||
commits.each {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
static String prepareUrlToCommits(String url) {
|
||||
if (url == null) {
|
||||
// default remote url
|
||||
return "https://github.com/s1lentq/ReGameDLL_CS/commit/";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String childPath;
|
||||
int pos = url.indexOf('@');
|
||||
if (pos != -1) {
|
||||
childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/');
|
||||
sb.append('https://');
|
||||
} else {
|
||||
pos = url.lastIndexOf('.git');
|
||||
childPath = (pos == -1) ? url : url.substring(0, pos);
|
||||
}
|
||||
|
||||
// support for different links to history of commits
|
||||
if (url.indexOf('bitbucket.org') != -1) {
|
||||
sb.append(childPath).append('/commits/');
|
||||
} else {
|
||||
sb.append(childPath).append('/commit/');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
// check uncommited changes
|
||||
static boolean getUncommittedChanges(Repository repo) {
|
||||
Git git = new Git(repo);
|
||||
Status status = git.status().setIgnoreSubmodules(SubmoduleWalk.IgnoreSubmoduleMode.ALL).call();
|
||||
Set<String> uncommittedChanges = status.getUncommittedChanges();
|
||||
System.err.println ' UncommittedChanges: ' + uncommittedChanges
|
||||
|
||||
if (!uncommittedChanges.isEmpty()) {
|
||||
System.err.println 'getUncommittedChanges details'
|
||||
System.err.println ' Added: ' + status.getAdded()
|
||||
System.err.println ' Changed: ' + status.getChanged()
|
||||
System.err.println ' Removed: ' + status.getRemoved()
|
||||
System.err.println ' Missing: ' + status.getMissing()
|
||||
System.err.println ' Modified: ' + status.getModified()
|
||||
System.err.println ' Conflicting: ' + status.getConflicting()
|
||||
|
||||
System.err.println ' ConflictingStageState: ' + status.getConflictingStageState()
|
||||
System.err.println ' IgnoredNotInIndex: ' + status.getIgnoredNotInIndex()
|
||||
System.err.println ' Untracked: ' + status.getUntracked()
|
||||
System.err.println ' UntrackedFolders: ' + status.getUntrackedFolders()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static GitInfo versionForDir(File dir) {
|
||||
FileRepositoryBuilder builder = new FileRepositoryBuilder();
|
||||
Repository repo = builder.setWorkTree(dir)
|
||||
.findGitDir()
|
||||
.build()
|
||||
|
||||
ObjectId head = repo.resolve('HEAD');
|
||||
if (!head) {
|
||||
return null
|
||||
}
|
||||
|
||||
final StoredConfig cfg = repo.getConfig();
|
||||
def commit = new RevWalk(repo).parseCommit(head);
|
||||
if (!commit) {
|
||||
throw new RuntimeException("Can't find last commit.");
|
||||
}
|
||||
|
||||
def localChanges = getUncommittedChanges(repo);
|
||||
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC);
|
||||
if (localChanges) {
|
||||
commitDate = new DateTime();
|
||||
}
|
||||
|
||||
def branch = repo.getBranch();
|
||||
|
||||
String url = null;
|
||||
String remote_name = cfg.getString("branch", branch, "remote");
|
||||
|
||||
if (remote_name == null) {
|
||||
for (String remotes : cfg.getSubsections("remote")) {
|
||||
if (url != null) {
|
||||
println 'Found a second remote: (' + remotes + '), url: (' + cfg.getString("remote", remotes, "url") + ')'
|
||||
continue;
|
||||
}
|
||||
|
||||
url = cfg.getString("remote", remotes, "url");
|
||||
}
|
||||
} else {
|
||||
url = cfg.getString("remote", remote_name, "url");
|
||||
}
|
||||
|
||||
String commitURL = prepareUrlToCommits(url);
|
||||
String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key
|
||||
String commitSHA = commit.getId().abbreviate(7).name();
|
||||
|
||||
return new GitInfo(
|
||||
localChanges: localChanges,
|
||||
commitDate: commitDate,
|
||||
branch: branch,
|
||||
tag: tag,
|
||||
commitSHA: commitSHA,
|
||||
commitURL: commitURL,
|
||||
commitCount: getCountCommit(repo)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package versioning
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.ToString
|
||||
import groovy.transform.TypeChecked
|
||||
import org.joda.time.format.DateTimeFormat
|
||||
import org.joda.time.DateTime
|
||||
|
||||
@CompileStatic @TypeChecked
|
||||
@ToString(includeNames = true)
|
||||
class RegamedllVersionInfo {
|
||||
Integer majorVersion
|
||||
Integer minorVersion
|
||||
Integer maintenanceVersion
|
||||
String suffix
|
||||
|
||||
boolean localChanges
|
||||
DateTime commitDate
|
||||
String commitSHA
|
||||
String commitURL
|
||||
Integer commitCount
|
||||
|
||||
String asMavenVersion(boolean extra = true) {
|
||||
StringBuilder sb = new StringBuilder()
|
||||
sb.append(majorVersion).append('.' + minorVersion);
|
||||
if (maintenanceVersion != null) {
|
||||
sb.append('.' + maintenanceVersion);
|
||||
}
|
||||
|
||||
if (commitCount != null) {
|
||||
sb.append('.' + commitCount)
|
||||
}
|
||||
|
||||
if (extra && suffix) {
|
||||
sb.append('-' + suffix)
|
||||
}
|
||||
|
||||
// do mark for this build like a modified version
|
||||
if (extra && localChanges) {
|
||||
sb.append('+m');
|
||||
}
|
||||
|
||||
return sb.toString()
|
||||
}
|
||||
String asCommitDate(String pattern = null) {
|
||||
if (pattern == null) {
|
||||
pattern = "MMM d yyyy";
|
||||
if (commitDate.getDayOfMonth() >= 10) {
|
||||
pattern = "MMM d yyyy";
|
||||
}
|
||||
}
|
||||
|
||||
return DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH).print(commitDate);
|
||||
}
|
||||
String asCommitTime() {
|
||||
return DateTimeFormat.forPattern('HH:mm:ss').withLocale(Locale.ENGLISH).print(commitDate);
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package dirsync.builder
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import java.io.File
|
||||
|
||||
import dirsync.builder.ZipTreeBuilder
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
class ZipTreeBuilderTest {
|
||||
|
||||
@Test
|
||||
void test1() {
|
||||
File zipFile = File.createTempFile('ZipTreeBuilderTest', 'zip')
|
||||
zipFile.deleteOnExit()
|
||||
|
||||
new ZipOutputStream(zipFile.newDataOutputStream()).withStream { ZipOutputStream zos ->
|
||||
zos.putNextEntry(new ZipEntry('aRootFile1.txt'))
|
||||
zos.write(65) //'A'
|
||||
|
||||
zos.putNextEntry(new ZipEntry('dir1/'))
|
||||
zos.putNextEntry(new ZipEntry('dir1/dir2/'))
|
||||
|
||||
zos.putNextEntry(new ZipEntry('dir1/dir2/d1d2f1.txt'))
|
||||
zos.write(65); zos.write(66) //'AB'
|
||||
|
||||
zos.putNextEntry(new ZipEntry('dir1/d1f1.txt'))
|
||||
zos.write(65); zos.write(66); zos.write(67) //'ABC'
|
||||
|
||||
zos.putNextEntry(new ZipEntry('zRootFile2.txt'))
|
||||
zos.write(65); zos.write(66); zos.write(67); zos.write(68) //'ABCD'
|
||||
}
|
||||
|
||||
ZipFile zf = new ZipFile(zipFile.absolutePath)
|
||||
def tree = ZipTreeBuilder.buildForZipArchive(zipFile.absolutePath, zf)
|
||||
|
||||
assert tree.childNodes.size() == 3
|
||||
}
|
||||
}
|
25
dep/cppunitlite/CMakeLists.txt
Normal file
25
dep/cppunitlite/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(cppunitlite CXX)
|
||||
|
||||
add_library(cppunitlite STATIC)
|
||||
|
||||
target_sources(cppunitlite PRIVATE
|
||||
src/Test.cpp
|
||||
src/TestResult.cpp
|
||||
src/TestRegistry.cpp
|
||||
src/Assertions.cpp
|
||||
src/MainAdapter.cpp
|
||||
)
|
||||
|
||||
target_include_directories(cppunitlite PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
target_compile_definitions(cppunitlite PRIVATE
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
)
|
||||
|
||||
target_compile_options(cppunitlite PRIVATE
|
||||
-m32
|
||||
)
|
@ -1,62 +0,0 @@
|
||||
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
|
||||
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
|
||||
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
import org.gradle.nativeplatform.NativeLibrarySpec
|
||||
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: IccCompilerPlugin
|
||||
apply plugin: GccCompilerPlugin
|
||||
|
||||
void setupToolchain(NativeBinarySpec b) {
|
||||
def cfg = rootProject.createToolchainConfig(b)
|
||||
|
||||
ToolchainConfigUtils.apply(project, cfg, b)
|
||||
}
|
||||
|
||||
model {
|
||||
buildTypes {
|
||||
debug
|
||||
release
|
||||
}
|
||||
|
||||
platforms {
|
||||
x86 {
|
||||
architecture "x86"
|
||||
}
|
||||
}
|
||||
|
||||
toolChains {
|
||||
visualCpp(VisualCpp)
|
||||
if (project.hasProperty("useGcc")) {
|
||||
gcc(Gcc)
|
||||
} else {
|
||||
icc(Icc)
|
||||
}
|
||||
}
|
||||
|
||||
components {
|
||||
cppunitlite(NativeLibrarySpec) {
|
||||
targetPlatform 'x86'
|
||||
|
||||
sources {
|
||||
cppul_main(CppSourceSet) {
|
||||
source {
|
||||
srcDir "src"
|
||||
include "**/*.cpp"
|
||||
}
|
||||
|
||||
exportedHeaders {
|
||||
srcDir "include"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binaries.all { NativeBinarySpec b ->
|
||||
project.setupToolchain(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,8 +7,8 @@ public:
|
||||
static void StringEquals(std::string message, std::string expected, std::string actual, const char* fileName, long lineNumber);
|
||||
|
||||
static void StringEquals(std::string message, const char* expected, const char* actual, const char* fileName, long lineNumber);
|
||||
|
||||
static void ConditionFailed(std::string message, std::string condition, const char* fileName, long lineNumber);
|
||||
|
||||
static void ConditionFailed(std::string message, std::string condition, const char* fileName, long lineNumber, bool onlyWarning = false);
|
||||
|
||||
static void LongEquals(std::string message, long expected, long actual, const char* fileName, long lineNumber);
|
||||
|
||||
|
@ -6,12 +6,13 @@
|
||||
class TestFailException : public std::exception {
|
||||
public:
|
||||
|
||||
TestFailException(std::string message, std::string fileName, long lineNumber) {
|
||||
TestFailException(std::string message, std::string fileName, long lineNumber, bool onlyWarning = false) {
|
||||
std::stringstream ss;
|
||||
ss << message << " at " << fileName << " line " << lineNumber;
|
||||
this->message = ss.str();
|
||||
this->fileName = fileName;
|
||||
this->lineNumber = lineNumber;
|
||||
this->warning = onlyWarning;
|
||||
}
|
||||
|
||||
virtual ~TestFailException() throw() {
|
||||
@ -21,6 +22,7 @@ public:
|
||||
std::string message;
|
||||
std::string fileName;
|
||||
long lineNumber;
|
||||
bool warning;
|
||||
|
||||
virtual const char * what() const throw() {
|
||||
return message.c_str();
|
||||
@ -35,6 +37,7 @@ public:
|
||||
this->message = e.message;
|
||||
this->fileName = e.fileName;
|
||||
this->lineNumber = e.lineNumber;
|
||||
this->warning = e.warning;
|
||||
}
|
||||
|
||||
Failure (std::string message, std::string testName) {
|
||||
@ -48,6 +51,7 @@ public:
|
||||
std::string message;
|
||||
std::string fileName;
|
||||
long lineNumber;
|
||||
bool warning;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class GradleAdapter {
|
||||
class MainAdapter {
|
||||
public:
|
||||
int writeAllTestsInfoToFile(const char* fname);
|
||||
int runTest(const char* groupName, const char* testName);
|
@ -20,7 +20,7 @@ public:
|
||||
void setNext(Test *test);
|
||||
Test *getNext () const;
|
||||
void run(TestResult& result);
|
||||
|
||||
|
||||
const char* getName() {
|
||||
return name_.c_str();
|
||||
}
|
||||
@ -28,7 +28,7 @@ public:
|
||||
const char* getGroup() {
|
||||
return group_.c_str();
|
||||
}
|
||||
|
||||
|
||||
int getTimeout() {
|
||||
return timeout_;
|
||||
}
|
||||
@ -47,7 +47,7 @@ protected:
|
||||
{ public: testGroup##testName##Test () : Test (#testName , #testGroup , testTimeout) {} \
|
||||
void runInternal (); } \
|
||||
testGroup##testName##Instance; \
|
||||
void testGroup##testName##Test::runInternal()
|
||||
void testGroup##testName##Test::runInternal()
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,9 @@ protected:
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_WARNING_OUT(msg, condition) { if (!(condition)) { Assertions::ConditionFailed(msg,#condition, __FILE__, __LINE__, true); return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ZSTR_EQUAL(msg,expected,actual) { \
|
||||
Assertions::StringEquals((msg), (expected), (actual), __FILE__, __LINE__); \
|
||||
|
@ -13,6 +13,10 @@ public:
|
||||
int getFailureCount() {
|
||||
return failureCount;
|
||||
}
|
||||
int getWarningCount() {
|
||||
return warningCount;
|
||||
}
|
||||
private:
|
||||
int failureCount;
|
||||
int warningCount;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@ -13,7 +13,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\cppunitlite\Assertions.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\Failure.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\GradleAdapter.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\MainAdapter.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\Test.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\TestHarness.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\TestRegistry.h" />
|
||||
@ -21,7 +21,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Assertions.cpp" />
|
||||
<ClCompile Include="..\src\GradleAdapter.cpp" />
|
||||
<ClCompile Include="..\src\MainAdapter.cpp" />
|
||||
<ClCompile Include="..\src\Test.cpp" />
|
||||
<ClCompile Include="..\src\TestRegistry.cpp" />
|
||||
<ClCompile Include="..\src\TestResult.cpp" />
|
||||
@ -30,7 +30,7 @@
|
||||
<ProjectGuid>{CEB94F7C-E459-4673-AABB-36E2074396C0}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>cppunitlite</RootNamespace>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@ -40,15 +40,7 @@
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Nav|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
@ -58,6 +50,7 @@
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@ -78,7 +71,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
@ -111,4 +104,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<ClInclude Include="..\include\cppunitlite\TestResult.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\cppunitlite\GradleAdapter.h">
|
||||
<ClInclude Include="..\include\cppunitlite\MainAdapter.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@ -44,7 +44,7 @@
|
||||
<ClCompile Include="..\src\TestResult.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\GradleAdapter.cpp">
|
||||
<ClCompile Include="..\src\MainAdapter.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -27,13 +27,13 @@ void Assertions::StringEquals(std::string message, const char *expected, const c
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::ConditionFailed(std::string message, std::string condition, const char *fileName, long lineNumber) {
|
||||
void Assertions::ConditionFailed(std::string message, std::string condition, const char *fileName, long lineNumber, bool onlyWarning) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (condition failed: " << condition << ")";
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber);
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber, onlyWarning);
|
||||
}
|
||||
|
||||
void Assertions::LongEquals(std::string message, long expected, long actual, const char *fileName, long lineNumber) {
|
||||
void Assertions::LongEquals(std::string message, long expected, long actual, const char* fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -41,7 +41,7 @@ void Assertions::LongEquals(std::string message, long expected, long actual, con
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char *fileName, long lineNumber) {
|
||||
void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char* fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -49,7 +49,7 @@ void Assertions::UInt32Equals(std::string message, unsigned int expected, unsign
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::CharEquals(std::string message, char expected, char actual, const char *fileName, long lineNumber) {
|
||||
void Assertions::CharEquals(std::string message, char expected, char actual, const char* fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -57,15 +57,15 @@ void Assertions::CharEquals(std::string message, char expected, char actual, con
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char *fileName, long lineNumber) {
|
||||
if (std::abs(expected - actual) > epsilon) {
|
||||
void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char* fileName, long lineNumber) {
|
||||
if (std::fabs(expected - actual) > epsilon) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::MemoryEquals(std::string message, void *expected, void *actual, int size, const char *fileName, long lineNumber) {
|
||||
void Assertions::MemoryEquals(std::string message, void* expected, void* actual, int size, const char* fileName, long lineNumber) {
|
||||
if (memcmp(expected, actual, size)) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '";
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cppunitlite/GradleAdapter.h"
|
||||
#include "cppunitlite/MainAdapter.h"
|
||||
#include "cppunitlite/Test.h"
|
||||
#include "cppunitlite/TestRegistry.h"
|
||||
|
||||
int GradleAdapter::writeAllTestsInfoToFile(const char *fname) {
|
||||
int MainAdapter::writeAllTestsInfoToFile(const char *fname) {
|
||||
FILE *outFile = fopen(fname, "w");
|
||||
if (!outFile) {
|
||||
return 1;
|
||||
@ -32,7 +32,7 @@ int GradleAdapter::writeAllTestsInfoToFile(const char *fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::runTest(const char *groupName, const char *testName) {
|
||||
int MainAdapter::runTest(const char *groupName, const char *testName) {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
while (curTest) {
|
||||
if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) {
|
||||
@ -52,14 +52,18 @@ int GradleAdapter::runTest(const char *groupName, const char *testName) {
|
||||
if (result.getFailureCount()) {
|
||||
return 1;
|
||||
}
|
||||
else if (result.getWarningCount()) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int GradleAdapter::runGroup(const char *groupName) {
|
||||
int MainAdapter::runGroup(const char *groupName) {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
int warnTest = 0;
|
||||
while (curTest) {
|
||||
if (strcmp(groupName, curTest->getGroup())) {
|
||||
curTest = curTest->getNext();
|
||||
@ -74,6 +78,10 @@ int GradleAdapter::runGroup(const char *groupName) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (result.getWarningCount()) {
|
||||
warnTest++;
|
||||
}
|
||||
|
||||
curTest = curTest->getNext();
|
||||
}
|
||||
|
||||
@ -82,13 +90,19 @@ int GradleAdapter::runGroup(const char *groupName) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (warnTest > 0) {
|
||||
printf("There were no test failures, but with warnings: %d; Tests executed: %d\n", warnTest, ranTests);
|
||||
return 3;
|
||||
}
|
||||
|
||||
printf("There were no test failures; Tests executed: %d\n", ranTests);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::runAllTests() {
|
||||
int MainAdapter::runAllTests() {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
int warnTest = 0;
|
||||
while (curTest) {
|
||||
TestResult result;
|
||||
curTest->run(result);
|
||||
@ -98,14 +112,23 @@ int GradleAdapter::runAllTests() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (result.getWarningCount()) {
|
||||
warnTest++;
|
||||
}
|
||||
|
||||
curTest = curTest->getNext();
|
||||
}
|
||||
|
||||
if (warnTest > 0) {
|
||||
printf("There were no test failures, but with warnings: %d; Tests executed: %d\n", warnTest, ranTests);
|
||||
return 3;
|
||||
}
|
||||
|
||||
printf("There were no test failures; Tests executed: %d\n", ranTests);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::testsEntryPoint(int argc, char *argv[]) {
|
||||
int MainAdapter::testsEntryPoint(int argc, char *argv[]) {
|
||||
if (argc < 2 || !strcmp(argv[1], "-all")) {
|
||||
return runAllTests();
|
||||
}
|
@ -3,9 +3,10 @@
|
||||
#include "cppunitlite/Failure.h"
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Test::Test (const char* testName, const char* testGroup, int timeout)
|
||||
Test::Test(const char *testName, const char *testGroup, int timeout)
|
||||
: name_ (testName), group_ (testGroup), timeout_(timeout)
|
||||
{
|
||||
next_ = nullptr;
|
||||
@ -18,15 +19,17 @@ Test *Test::getNext() const
|
||||
}
|
||||
|
||||
void Test::setNext(Test *test)
|
||||
{
|
||||
{
|
||||
next_ = test;
|
||||
}
|
||||
|
||||
void Test::run(TestResult &result) {
|
||||
void Test::run(TestResult &result)
|
||||
{
|
||||
try {
|
||||
runInternal();
|
||||
} catch (TestFailException *e) {
|
||||
result.addFailure(Failure(*e, name_));
|
||||
std::cout << "Test::run() > " << group_ << "::" << name_ << " Passed" << std::endl;
|
||||
} catch (TestFailException &e) {
|
||||
result.addFailure(Failure(e, name_));
|
||||
} catch (std::exception &e) {
|
||||
std::stringstream ss;
|
||||
ss << "unexpected exception " << e.what();
|
||||
|
@ -1,50 +1,44 @@
|
||||
|
||||
|
||||
#include "cppunitlite/Test.h"
|
||||
#include "cppunitlite/TestResult.h"
|
||||
#include "cppunitlite/TestRegistry.h"
|
||||
|
||||
|
||||
void TestRegistry::addTest (Test *test)
|
||||
void TestRegistry::addTest(Test *test)
|
||||
{
|
||||
instance ().add (test);
|
||||
instance().add(test);
|
||||
}
|
||||
|
||||
|
||||
void TestRegistry::runAllTests (TestResult& result)
|
||||
void TestRegistry::runAllTests(TestResult &result)
|
||||
{
|
||||
instance ().run (result);
|
||||
instance().run(result);
|
||||
}
|
||||
|
||||
Test* TestRegistry::getFirstTest() {
|
||||
Test *TestRegistry::getFirstTest() {
|
||||
return instance().tests;
|
||||
}
|
||||
|
||||
TestRegistry& TestRegistry::instance ()
|
||||
|
||||
TestRegistry& TestRegistry::instance()
|
||||
{
|
||||
static TestRegistry registry;
|
||||
return registry;
|
||||
}
|
||||
|
||||
|
||||
void TestRegistry::add (Test *test)
|
||||
void TestRegistry::add(Test *test)
|
||||
{
|
||||
if (tests == 0) {
|
||||
tests = test;
|
||||
return;
|
||||
}
|
||||
|
||||
test->setNext (tests);
|
||||
|
||||
test->setNext(tests);
|
||||
tests = test;
|
||||
}
|
||||
|
||||
|
||||
void TestRegistry::run (TestResult& result)
|
||||
void TestRegistry::run(TestResult &result)
|
||||
{
|
||||
result.testsStarted ();
|
||||
result.testsStarted();
|
||||
|
||||
for (Test *test = tests; test != 0; test = test->getNext ())
|
||||
test->run (result);
|
||||
result.testsEnded ();
|
||||
for (Test *test = tests; test; test = test->getNext())
|
||||
test->run(result);
|
||||
|
||||
result.testsEnded();
|
||||
}
|
||||
|
||||
|
@ -1,38 +1,48 @@
|
||||
|
||||
#include "cppunitlite/TestResult.h"
|
||||
#include "cppunitlite/Failure.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
TestResult::TestResult ()
|
||||
: failureCount (0)
|
||||
TestResult::TestResult()
|
||||
: failureCount(0), warningCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TestResult::testsStarted ()
|
||||
void TestResult::testsStarted()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TestResult::addFailure (const Failure& failure) {
|
||||
void TestResult::addFailure(const Failure& failure)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Failure in test '" << failure.testName << "' :" << failure.message;
|
||||
ss << (failure.warning ? "Warning in test '" : "Failure in test '") << failure.testName << "' :" << failure.message;
|
||||
std::cout << ss.str() << std::endl;
|
||||
std::cout.flush();
|
||||
failureCount++;
|
||||
|
||||
if (failure.warning) {
|
||||
warningCount++;
|
||||
}
|
||||
else
|
||||
failureCount++;
|
||||
}
|
||||
|
||||
|
||||
void TestResult::testsEnded () {
|
||||
void TestResult::testsEnded()
|
||||
{
|
||||
std::stringstream ss;
|
||||
if (failureCount > 0) {
|
||||
ss << "There were " << failureCount << " failures";
|
||||
} else {
|
||||
if (warningCount > 0) {
|
||||
ss << ", and " << warningCount << " warnings";
|
||||
}
|
||||
}
|
||||
else if (warningCount > 0) {
|
||||
ss << "There were " << warningCount << " warnings";
|
||||
}
|
||||
else {
|
||||
ss << "There were no test failures";
|
||||
}
|
||||
|
||||
std::cout << ss.str() << std::endl;
|
||||
std::cout.flush();
|
||||
}
|
||||
|
262
dist/delta.lst
vendored
Normal file
262
dist/delta.lst
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
// structure name
|
||||
// none == no conditional encode routine
|
||||
// gamedll routine_name : before transmitting data, invoke the named function from the game .dll to reset fields as needed
|
||||
// clientdll routine_name : same as above, except the routine is called via the client.dll
|
||||
|
||||
clientdata_t none
|
||||
{
|
||||
DEFINE_DELTA( flTimeStepSound, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 24, 1024.0 ),
|
||||
DEFINE_DELTA( origin[1], DT_SIGNED | DT_FLOAT, 24, 1024.0 ),
|
||||
DEFINE_DELTA( velocity[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( velocity[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
|
||||
DEFINE_DELTA( m_flNextAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
|
||||
DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 24, 1024.0 ),
|
||||
DEFINE_DELTA( velocity[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
|
||||
DEFINE_DELTA( ammo_nails, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( ammo_shells, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( ammo_cells, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( ammo_rockets, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( m_iId, DT_INTEGER, 5, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( punchangle[2], DT_SIGNED | DT_FLOAT, 21, 8.0 ),
|
||||
DEFINE_DELTA( flags, DT_INTEGER, 32, 1.0 ), // Cut to 3 bits?
|
||||
DEFINE_DELTA( weaponanim, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( health, DT_FLOAT, 17, 1.0 ), // Cut # of bits?
|
||||
DEFINE_DELTA( maxspeed, DT_FLOAT, 16, 10.0 ),
|
||||
DEFINE_DELTA( flDuckTime, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( view_ofs[2], DT_SIGNED | DT_FLOAT, 10, 4.0 ),
|
||||
DEFINE_DELTA( punchangle[0], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( punchangle[1], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( viewmodel, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( weapons, DT_INTEGER, 32, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( pushmsec, DT_INTEGER, 11, 1.0 ),
|
||||
DEFINE_DELTA( deadflag, DT_INTEGER, 3, 1.0 ),
|
||||
DEFINE_DELTA( fov, DT_FLOAT, 8, 1.0 ),
|
||||
DEFINE_DELTA( physinfo, DT_STRING, 1, 1.0 ),
|
||||
DEFINE_DELTA( bInDuck, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( flSwimTime, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( waterjumptime, DT_INTEGER, 15, 1.0 ),
|
||||
DEFINE_DELTA( waterlevel, DT_INTEGER, 2, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( iuser1, DT_INTEGER, 3, 1.0 ),
|
||||
DEFINE_DELTA( iuser2, DT_INTEGER, 6, 1.0 ),
|
||||
DEFINE_DELTA( iuser3, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( iuser4, DT_INTEGER, 2, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( vuser2[0], DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( vuser2[1], DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( vuser2[2], DT_FLOAT, 9, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( vuser3[0], DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( vuser3[1], DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( vuser3[2], DT_FLOAT, 9, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( vuser4[0], DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( vuser4[1], DT_FLOAT, 9, 1.0 ),
|
||||
|
||||
DEFINE_DELTA( fuser1, DT_FLOAT, 9, 1.0 ),
|
||||
DEFINE_DELTA( fuser2, DT_FLOAT, 14, 1.0 ),
|
||||
DEFINE_DELTA( fuser3, DT_FLOAT, 10, 1.0 )
|
||||
}
|
||||
|
||||
entity_state_t gamedll Entity_Encode
|
||||
{
|
||||
DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
|
||||
DEFINE_DELTA( frame, DT_FLOAT, 8, 1.0 ),
|
||||
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( angles[0], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( angles[1], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( origin[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( sequence, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( modelindex, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( movetype, DT_INTEGER, 4, 1.0 ),
|
||||
DEFINE_DELTA( solid, DT_SHORT, 3, 1.0 ),
|
||||
DEFINE_DELTA( mins[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( mins[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( mins[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
|
||||
DEFINE_DELTA( endpos[0], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( endpos[1], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( endpos[2], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( startpos[0], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( startpos[1], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( startpos[2], DT_SIGNED | DT_FLOAT, 13, 1.0 ),
|
||||
DEFINE_DELTA( impacttime, DT_TIMEWINDOW_BIG, 13, 100.0 ),
|
||||
DEFINE_DELTA( starttime, DT_TIMEWINDOW_BIG, 13, 100.0 ),
|
||||
|
||||
DEFINE_DELTA( weaponmodel, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( owner, DT_INTEGER, 5, 1.0 ),
|
||||
DEFINE_DELTA( effects, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( eflags, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( angles[2], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( colormap, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA( framerate, DT_SIGNED | DT_FLOAT, 8, 16.0 ),
|
||||
DEFINE_DELTA( skin, DT_SHORT | DT_SIGNED, 9, 1.0 ),
|
||||
DEFINE_DELTA( controller[0], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[1], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[2], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[3], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( blending[0], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( blending[1], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( body, DT_INTEGER, 18, 1.0 ),
|
||||
DEFINE_DELTA( rendermode, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderamt, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderfx, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( scale, DT_FLOAT, 16, 256.0 ),
|
||||
DEFINE_DELTA( rendercolor.r, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.g, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.b, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( aiment, DT_INTEGER, 11, 1.0 ),
|
||||
DEFINE_DELTA( basevelocity[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( basevelocity[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( basevelocity[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
|
||||
DEFINE_DELTA( iuser4, DT_INTEGER, 2, 1.0 )
|
||||
}
|
||||
|
||||
entity_state_player_t gamedll Player_Encode
|
||||
{
|
||||
DEFINE_DELTA( animtime, DT_TIMEWINDOW_8, 8, 1.0 ),
|
||||
DEFINE_DELTA( frame, DT_FLOAT, 8, 1.0 ),
|
||||
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 24, 32.0 ),
|
||||
DEFINE_DELTA( angles[0], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( angles[1], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( origin[1], DT_SIGNED | DT_FLOAT, 24, 32.0 ),
|
||||
DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 24, 32.0 ),
|
||||
DEFINE_DELTA( gaitsequence, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( sequence, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( modelindex, DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( movetype, DT_INTEGER, 4, 1.0 ),
|
||||
DEFINE_DELTA( solid, DT_SHORT, 3, 1.0 ),
|
||||
DEFINE_DELTA( mins[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( mins[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( mins[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( maxs[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( weaponmodel, DT_INTEGER, 10, 1.0 ),
|
||||
// DEFINE_DELTA( team, DT_INTEGER, 4, 1.0 )
|
||||
// DEFINE_DELTA( playerclass, DT_INTEGER, 4, 1.0 )
|
||||
DEFINE_DELTA( owner, DT_INTEGER, 5, 1.0 ),
|
||||
DEFINE_DELTA( effects, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA( angles[2], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( colormap, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA( framerate, DT_SIGNED | DT_FLOAT, 8, 16.0 ),
|
||||
DEFINE_DELTA( skin, DT_SHORT | DT_SIGNED, 9, 1.0 ),
|
||||
DEFINE_DELTA( controller[0], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[1], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[2], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( controller[3], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( blending[0], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( blending[1], DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( body, DT_INTEGER, 9, 1.0 ),
|
||||
DEFINE_DELTA( rendermode, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderamt, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderfx, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( scale, DT_FLOAT, 16, 256.0 ),
|
||||
DEFINE_DELTA( rendercolor.r, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.g, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.b, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( friction, DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( usehull, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( gravity, DT_SIGNED | DT_FLOAT, 16, 32.0 ),
|
||||
DEFINE_DELTA( aiment, DT_INTEGER, 11, 1.0 ),
|
||||
DEFINE_DELTA( basevelocity[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( basevelocity[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( basevelocity[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( spectator, DT_INTEGER, 1, 1.0 )
|
||||
|
||||
DEFINE_DELTA( iuser4, DT_INTEGER, 2, 1.0 )
|
||||
}
|
||||
|
||||
custom_entity_state_t gamedll Custom_Encode
|
||||
{
|
||||
DEFINE_DELTA( rendermode, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( origin[1], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( angles[0], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( angles[1], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( angles[2], DT_SIGNED | DT_FLOAT, 17, 8.0 ),
|
||||
DEFINE_DELTA( sequence, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA( skin, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA( modelindex, DT_INTEGER, 16, 1.0 ),
|
||||
DEFINE_DELTA_POST( scale, DT_FLOAT, 8, 1.0, 0.1 ),
|
||||
DEFINE_DELTA( body, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.r, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.g, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( rendercolor.b, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderfx, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( renderamt, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( frame, DT_FLOAT, 8, 1.0 ),
|
||||
DEFINE_DELTA_POST( animtime, DT_FLOAT, 8, 1.0, 0.1 )
|
||||
}
|
||||
|
||||
usercmd_t none
|
||||
{
|
||||
DEFINE_DELTA( lerp_msec, DT_SHORT, 9, 1.0 ),
|
||||
DEFINE_DELTA( msec, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( viewangles[1], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( viewangles[0], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( buttons, DT_SHORT, 16, 1.0 ),
|
||||
DEFINE_DELTA( forwardmove, DT_SIGNED | DT_FLOAT, 12, 1.0 ),
|
||||
DEFINE_DELTA( lightlevel, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( sidemove, DT_SIGNED | DT_FLOAT, 12, 1.0 ),
|
||||
DEFINE_DELTA( upmove, DT_SIGNED | DT_FLOAT, 12, 1.0 ),
|
||||
DEFINE_DELTA( impulse, DT_BYTE, 8, 1.0 ),
|
||||
DEFINE_DELTA( viewangles[2], DT_ANGLE, 16, 1.0 ),
|
||||
DEFINE_DELTA( impact_index, DT_INTEGER, 6, 1.0 ),
|
||||
DEFINE_DELTA( impact_position[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( impact_position[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ),
|
||||
DEFINE_DELTA( impact_position[2], DT_SIGNED | DT_FLOAT, 16, 8.0 )
|
||||
}
|
||||
|
||||
weapon_data_t none
|
||||
{
|
||||
DEFINE_DELTA( m_flTimeWeaponIdle, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_flNextPrimaryAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_flNextReload, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_fNextAimBonus, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_flNextSecondaryAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_iClip, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
|
||||
DEFINE_DELTA( m_flPumpTime, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_fInSpecialReload, DT_INTEGER, 2, 1.0 ),
|
||||
DEFINE_DELTA( m_fReloadTime, DT_FLOAT, 16, 100.0 ),
|
||||
DEFINE_DELTA( m_fInReload, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( m_fAimedDamage, DT_FLOAT, 22, 1000.0 ),
|
||||
DEFINE_DELTA( m_fInZoom, DT_INTEGER, 8, 1.0 ),
|
||||
DEFINE_DELTA( m_iWeaponState, DT_INTEGER, 7, 1.0 )
|
||||
DEFINE_DELTA( m_iId, DT_INTEGER, 5, 1.0 )
|
||||
DEFINE_DELTA( fuser1, DT_SIGNED | DT_FLOAT, 22, 1000.0 ),
|
||||
DEFINE_DELTA( fuser2, DT_SIGNED | DT_FLOAT, 22, 128.0 ),
|
||||
DEFINE_DELTA( fuser3, DT_SIGNED | DT_FLOAT, 22, 128.0 ),
|
||||
DEFINE_DELTA( iuser1, DT_SIGNED | DT_INTEGER, 16, 128.0 )
|
||||
}
|
||||
|
||||
event_t none
|
||||
{
|
||||
DEFINE_DELTA( entindex, DT_INTEGER, 11, 1.0 ),
|
||||
DEFINE_DELTA( bparam1, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( bparam2, DT_INTEGER, 1, 1.0 ),
|
||||
DEFINE_DELTA( origin[0], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( origin[1], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( fparam1, DT_FLOAT | DT_SIGNED, 20, 100.0 ),
|
||||
DEFINE_DELTA( fparam2, DT_FLOAT | DT_SIGNED, 20, 100.0 ),
|
||||
DEFINE_DELTA( iparam1, DT_INTEGER | DT_SIGNED, 18, 1.0 ),
|
||||
DEFINE_DELTA( iparam2, DT_INTEGER | DT_SIGNED, 18, 1.0 ),
|
||||
DEFINE_DELTA( angles[0], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( angles[1], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( angles[2], DT_SIGNED | DT_FLOAT, 26, 8192.0 ),
|
||||
DEFINE_DELTA( ducking, DT_INTEGER, 1, 1.0 )
|
||||
}
|
348
dist/game.cfg
vendored
348
dist/game.cfg
vendored
@ -5,7 +5,7 @@ echo Executing ReGameDLL Configuration File
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_freeforall 0
|
||||
mp_freeforall "0"
|
||||
|
||||
// Auto balancing of teams
|
||||
// 0 - disabled
|
||||
@ -13,27 +13,27 @@ mp_freeforall 0
|
||||
// 2 - on next round
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_autoteambalance 1
|
||||
mp_autoteambalance "1"
|
||||
|
||||
// Designate the desired amount of buy time for each round. (in minutes)
|
||||
// -1 - means no time limit
|
||||
// 0 - disable buy
|
||||
//
|
||||
// Default value: "1.5"
|
||||
mp_buytime 0.25
|
||||
mp_buytime "0.25"
|
||||
|
||||
// The maximum allowable amount of money in the game
|
||||
// NOTE: Allowable money limit is 999999
|
||||
//
|
||||
// Default value: "16000"
|
||||
mp_maxmoney 16000
|
||||
mp_maxmoney "16000"
|
||||
|
||||
// Disable round end by game scenario
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled (never end round)
|
||||
//
|
||||
// Flags for fine grained control (choose as many as needed)
|
||||
// a - block round time round end check, contain "h", "i", "j", "k" flags
|
||||
// a - block round time round end check, contains "h", "i", "j", "k" flags
|
||||
// b - block needed players round end check
|
||||
// c - block VIP assassination/success round end check
|
||||
// d - block prison escape round end check
|
||||
@ -47,55 +47,77 @@ mp_maxmoney 16000
|
||||
//
|
||||
// Example setting: "ae" - blocks round time and bomb round end checks
|
||||
// Default value: "0"
|
||||
mp_round_infinite 0
|
||||
mp_round_infinite "0"
|
||||
|
||||
// The round by expired time will be over, if on a map it does not have the scenario of the game.
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
// 1 - end of the round with a draw
|
||||
// 2 - round end with Terrorists win
|
||||
// 3 - round end with Counter-Terrorists win
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_roundover 0
|
||||
mp_roundover "0"
|
||||
|
||||
// Number of seconds to delay before restarting a round after a win.
|
||||
//
|
||||
// Default value: "5"
|
||||
mp_round_restart_delay 5
|
||||
mp_round_restart_delay "5"
|
||||
|
||||
// Disable grenade damage through walls
|
||||
// 0 - disabled
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_hegrenade_penetration 0
|
||||
mp_hegrenade_penetration "0"
|
||||
|
||||
// Drop a grenade after player death
|
||||
// 0 - disabled
|
||||
// 1 - drop one the grenade
|
||||
// 2 - drop an everyone grenades
|
||||
// 1 - drop first available grenade
|
||||
// 2 - drop all grenades
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_nadedrops 0
|
||||
mp_nadedrops "0"
|
||||
|
||||
// Drop player weapon after death
|
||||
// 0 - do not drop weapons after death
|
||||
// 1 - drop best/heaviest weapon after death (default behaviour)
|
||||
// 2 - drop active weapon after death
|
||||
// 3 - drop all weapons after death (primary and secondary)
|
||||
// NOTE: Grenades are dropped separately depending on mp_nadedrops value
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_weapondrop "1"
|
||||
|
||||
// Drop ammo on weapon boxes on death or manual drop
|
||||
// 0 - always keep ammo on player
|
||||
// 1 - drop all ammo only after death (default behaviour)
|
||||
// 2 - drop all ammo whenever player drops a weapon (NOTE: Other weapons may remain without ammo due to same ammo sharing)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_ammodrop "1"
|
||||
|
||||
// Player cannot respawn until next round
|
||||
// if more than N seconds has elapsed since the beginning round
|
||||
// -1 - means no time limit
|
||||
//
|
||||
// Default value: "20"
|
||||
mp_roundrespawn_time 20
|
||||
mp_roundrespawn_time "20"
|
||||
|
||||
// Automatically reload each weapon on player spawn
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_auto_reload_weapons 0
|
||||
mp_auto_reload_weapons "0"
|
||||
|
||||
// Refill amount of backpack ammo up to the max
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - refill backpack ammo on player spawn
|
||||
// 2 - refill backpack ammo on player spawn and on the purchase of the item
|
||||
// 3 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.)
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_refill_bpammo_weapons 0
|
||||
mp_refill_bpammo_weapons "0"
|
||||
|
||||
// Sets the mode infinite ammo for weapons
|
||||
// 0 - disabled (default behaviour)
|
||||
@ -103,48 +125,48 @@ mp_refill_bpammo_weapons 0
|
||||
// 2 - weapon bpammo infinite (This means for reloading)
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_infinite_ammo 0
|
||||
mp_infinite_ammo "0"
|
||||
|
||||
// Enable infinite grenades
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - grenades infinite
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_infinite_grenades 0
|
||||
mp_infinite_grenades "0"
|
||||
|
||||
// Automatically joins the team
|
||||
// 0 - disabled
|
||||
// 1 - enabled (Use in conjunction with the cvar humans_join_team any/SPEC/CT/T)
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_auto_join_team 0
|
||||
mp_auto_join_team "0"
|
||||
|
||||
// Maximum number of allowed teamkills before autokick.
|
||||
// Used when enabled mp_autokick.
|
||||
// 0 - disabled
|
||||
//
|
||||
// Default value: "3"
|
||||
mp_max_teamkills 3
|
||||
mp_max_teamkills "3"
|
||||
|
||||
// If set to something other than 0,
|
||||
// when anybody’s scored reaches mp_fraglimit the server changes map.
|
||||
// 0 - means no limit
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_fraglimit 0
|
||||
mp_fraglimit "0"
|
||||
|
||||
// Period between map rotations.
|
||||
// 0 - means no limit
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_timelimit 20
|
||||
mp_timelimit "20"
|
||||
|
||||
// Players will automatically respawn when killed.
|
||||
// 0 - disabled
|
||||
// >0.00001 - time delay to respawn
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_forcerespawn 0
|
||||
mp_forcerespawn "0"
|
||||
|
||||
// The hostages can take damage.
|
||||
// 0 - disabled
|
||||
@ -153,35 +175,35 @@ mp_forcerespawn 0
|
||||
// 3 - only from T
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_hostage_hurtable 1
|
||||
mp_hostage_hurtable "1"
|
||||
|
||||
// Show radio icon.
|
||||
// 0 - disabled
|
||||
// 1 - enabled (default behavior)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_show_radioicon 1
|
||||
mp_show_radioicon "1"
|
||||
|
||||
// Show scenario icon in HUD such as count of alive hostages or ticking bomb.
|
||||
// 0 - disabled (default behavior)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_show_scenarioicon 0
|
||||
mp_show_scenarioicon "0"
|
||||
|
||||
// Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused
|
||||
// 0 - disabled (default behavior)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_old_bomb_defused_sound 1
|
||||
mp_old_bomb_defused_sound "1"
|
||||
|
||||
// Sets the mode for the zBot
|
||||
// 0 - disabled
|
||||
// 1 - enable mode Deathmatch and not allow to do the scenario
|
||||
//
|
||||
// Default value: "0"
|
||||
bot_deathmatch 0
|
||||
bot_deathmatch "0"
|
||||
|
||||
// Determines the type of quota.
|
||||
// normal - default behaviour
|
||||
@ -194,21 +216,21 @@ bot_quota_mode "normal"
|
||||
// Prevents bots from joining the server for this many seconds after a map change.
|
||||
//
|
||||
// Default value: "0"
|
||||
bot_join_delay 0
|
||||
bot_join_delay "0"
|
||||
|
||||
// Prevents bots on your server from moving.
|
||||
// 0 - disabled (default behavior)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
bot_freeze 0
|
||||
bot_freeze "0"
|
||||
|
||||
// Debug cvar shows triggers.
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
showtriggers 0
|
||||
showtriggers "0"
|
||||
|
||||
// When players can hear each other.
|
||||
// Further explanation: https://github.com/s1lentq/ReGameDLL_CS/wiki/sv_alltalk
|
||||
@ -217,21 +239,22 @@ showtriggers 0
|
||||
// 2 - teammates hear each other
|
||||
// 3 - same as 2, but spectators hear everybody
|
||||
// 4 - alive hear alive, dead hear dead and alive.
|
||||
// 5 - alive hear alive teammates, dead hear dead and alive.
|
||||
//
|
||||
// Default value: "0"
|
||||
sv_alltalk 0
|
||||
sv_alltalk "0"
|
||||
|
||||
// Time to remove item that have been dropped from the players. (in seconds)
|
||||
//
|
||||
// Default value: "300"
|
||||
mp_item_staytime 300
|
||||
mp_item_staytime "300"
|
||||
|
||||
// Legacy func_bomb_target touch. New one is more strict.
|
||||
// 0 - New behavior
|
||||
// 1 - Legacy behavior
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_legacy_bombtarget_touch 1
|
||||
mp_legacy_bombtarget_touch "1"
|
||||
|
||||
// Specifies the players defense time after respawn. (in seconds).
|
||||
// 0 - disabled
|
||||
@ -245,14 +268,15 @@ mp_respawn_immunitytime "0"
|
||||
// 1 - enabled (Use in conjunction with the cvar mp_respawn_immunitytime)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_respawn_immunity_effects 1
|
||||
mp_respawn_immunity_effects "1"
|
||||
|
||||
// Force unset spawn protection if the player doing any action.
|
||||
// 0 - disabled
|
||||
// 1 - enabled
|
||||
// 1 - when moving and attacking
|
||||
// 2 - only when attacking
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_respawn_immunity_force_unset 1
|
||||
mp_respawn_immunity_force_unset "1"
|
||||
|
||||
// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
|
||||
// Only disable this if you have semiclip or other plugins that prevents stucking
|
||||
@ -260,7 +284,7 @@ mp_respawn_immunity_force_unset 1
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_kill_filled_spawn 1
|
||||
mp_kill_filled_spawn "1"
|
||||
|
||||
// Allow use of point_servercommand entities in map.
|
||||
// NOTE: Potentially dangerous for untrusted maps.
|
||||
@ -268,7 +292,7 @@ mp_kill_filled_spawn 1
|
||||
// 1 - allow
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_allow_point_servercommand 0
|
||||
mp_allow_point_servercommand "0"
|
||||
|
||||
// Show 'HP' field into a scoreboard
|
||||
// -1 - disabled
|
||||
@ -280,7 +304,7 @@ mp_allow_point_servercommand 0
|
||||
// 5 - show 'HP' field to teammates and spectators
|
||||
//
|
||||
// Default value: "3"
|
||||
mp_scoreboard_showhealth 3
|
||||
mp_scoreboard_showhealth "3"
|
||||
|
||||
// Show 'Money' field into a scoreboard
|
||||
// -1 - disabled
|
||||
@ -292,7 +316,7 @@ mp_scoreboard_showhealth 3
|
||||
// 5 - show 'Money' field to teammates and spectators
|
||||
//
|
||||
// Default value: "3"
|
||||
mp_scoreboard_showmoney 3
|
||||
mp_scoreboard_showmoney "3"
|
||||
|
||||
// Show 'D. Kit' field into a scoreboard for teammates
|
||||
// NOTE: If you don't want to show defuse kit field for dead enemies
|
||||
@ -301,7 +325,7 @@ mp_scoreboard_showmoney 3
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_scoreboard_showdefkit 1
|
||||
mp_scoreboard_showdefkit "1"
|
||||
|
||||
// How much to reduce damage done to teammates when shot.
|
||||
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
|
||||
@ -345,7 +369,7 @@ mp_radio_timeout "1.5"
|
||||
// 0 - disable radio messages
|
||||
//
|
||||
// Default value: "60"
|
||||
mp_radio_maxinround 60
|
||||
mp_radio_maxinround "60"
|
||||
|
||||
// When set, players can buy anywhere, not only in buyzones.
|
||||
// 0 - disabled
|
||||
@ -354,7 +378,7 @@ mp_radio_maxinround 60
|
||||
// 3 - only CT team
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_buy_anywhere 0
|
||||
mp_buy_anywhere "0"
|
||||
|
||||
// Don't unduck if ducking isn't finished yet.
|
||||
// NOTE: This also prevents double duck.
|
||||
@ -362,14 +386,14 @@ mp_buy_anywhere 0
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_unduck_method 0
|
||||
mp_unduck_method "0"
|
||||
|
||||
// Whether this map should spawn a C4 bomb for a player or not.
|
||||
// 0 - disabled
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_give_player_c4 1
|
||||
mp_give_player_c4 "1"
|
||||
|
||||
// When set, map weapons (located on the floor) will be shown.
|
||||
// NOTE: Effect will work after round restart.
|
||||
@ -377,7 +401,7 @@ mp_give_player_c4 1
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_weapons_allow_map_placed 1
|
||||
mp_weapons_allow_map_placed "1"
|
||||
|
||||
// Observer's screen will fade to black on kill event or permanent.
|
||||
// 0 - No fade
|
||||
@ -385,14 +409,14 @@ mp_weapons_allow_map_placed 1
|
||||
// 2 - fade to black only on kill moment.
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_fadetoblack 0
|
||||
mp_fadetoblack "0"
|
||||
|
||||
// Damage from falling.
|
||||
// 0 - disabled
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_falldamage 1
|
||||
mp_falldamage "1"
|
||||
|
||||
// The default grenades that the Ts will spawn with.
|
||||
// Usage: "hegrenade flash sgren"
|
||||
@ -405,7 +429,7 @@ mp_t_default_grenades ""
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_t_give_player_knife 1
|
||||
mp_t_give_player_knife "1"
|
||||
|
||||
// The default primary (rifle) weapon that the Ts will spawn with.
|
||||
// Usage: "awp m4a1 mp5navy"
|
||||
@ -429,7 +453,7 @@ mp_ct_default_grenades ""
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_ct_give_player_knife 1
|
||||
mp_ct_give_player_knife "1"
|
||||
|
||||
// The default primary (rifle) weapon that the CTs will spawn with.
|
||||
// Usage: "awp m4a1 mp5navy"
|
||||
@ -441,3 +465,225 @@ 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
|
||||
// 2 - Give Kevlar and Helmet
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_free_armor "0"
|
||||
|
||||
// Sets the behaviour for Flashbangs on teammates.
|
||||
// -1 - Don't affect teammates neither flash owner
|
||||
// 0 - Don't affect teammates
|
||||
// 1 - Affects teammates (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_team_flash "1"
|
||||
|
||||
// Players can receive all other players text chat, team restrictions apply.
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
sv_allchat "0"
|
||||
|
||||
// Players automatically re-jump while holding jump button.
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
sv_autobunnyhopping "0"
|
||||
|
||||
// Allow player speed to exceed maximum running speed
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
sv_enablebunnyhopping "0"
|
||||
|
||||
// When set, players can plant anywhere, not only in bombsites.
|
||||
// 0 - disabled (default behaviour)
|
||||
// 1 - enabled
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_plant_c4_anywhere "0"
|
||||
|
||||
// How many bonuses (frags) will get the player who defused or exploded the bomb.
|
||||
// 3 - (default behaviour)
|
||||
//
|
||||
// Default value: "3"
|
||||
mp_give_c4_frags "3"
|
||||
|
||||
// Ratio of hostages rescued to win the round.
|
||||
//
|
||||
// Default value: "1.0"
|
||||
mp_hostages_rescued_ratio "1.0"
|
||||
|
||||
// Legacy func_vehicle behavior when blocked by another entity.
|
||||
// New one is more useful for playing multiplayer.
|
||||
//
|
||||
// 0 - New behavior
|
||||
// 1 - Legacy behavior
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_legacy_vehicle_block "1"
|
||||
|
||||
// Time for switch to free observing after death.
|
||||
// NOTE: The countdown starts when the player’s death animation is finished.
|
||||
// 0 - disable spectating around death
|
||||
// >0.00001 - time delay to start spectate
|
||||
//
|
||||
// Default value: "3.0"
|
||||
mp_dying_time "3.0"
|
||||
|
||||
// Sets a flags for extra information in the player's death message
|
||||
//
|
||||
// a - Position where the victim died
|
||||
// b - Index of the assistant who helped the attacker kill the victim
|
||||
// c - Rarity classification bits, e.g., blinkill, noscope, penetrated, etc
|
||||
//
|
||||
// Set to "0" to send no extra information about death
|
||||
//
|
||||
// Default value: "abc"
|
||||
mp_deathmsg_flags "abc"
|
||||
|
||||
// Sets the percentage of damage needed to score an assist
|
||||
//
|
||||
// Default value: "40"
|
||||
mp_assist_damage_threshold "40"
|
||||
|
||||
// Allow players to duck during freezetime
|
||||
// 0 - disabled
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_freezetime_duck "1"
|
||||
|
||||
// Allow players to jump during freezetime
|
||||
// 0 - disabled
|
||||
// 1 - enabled (default behaviour)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_freezetime_jump "1"
|
||||
|
||||
// Give defuser on player spawn
|
||||
// 0 - No free defusers (default behavior)
|
||||
// 1 - Random players
|
||||
// 2 - All players
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_defuser_allocation "0"
|
||||
|
||||
// Enable location area info
|
||||
// 0 - disabled (default behavior)
|
||||
// 1 - show location below HUD radar
|
||||
// 2 - show location in HUD chat (NOT RECOMMENDED! Not all client builds are compatible)
|
||||
// 3 - both displayed (NOT RECOMMENDED! Not all client builds are compatible)
|
||||
//
|
||||
// NOTE: Navigation maps/.nav file required and should contain place names
|
||||
// NOTE: If option 2 or 3 is enabled, be sure to enable mp_chat_loc_fallback 1
|
||||
//
|
||||
// Default value: "0"
|
||||
mp_location_area_info "0"
|
||||
|
||||
// The respawn time for items (such as health packs, armor, etc.).
|
||||
// 0 - disable delay
|
||||
//
|
||||
// Default value: "30"
|
||||
mp_item_respawn_time "30"
|
||||
|
||||
// The respawn time for weapons.
|
||||
// 0 - disable delay
|
||||
//
|
||||
// Default value: "20"
|
||||
mp_weapon_respawn_time "20"
|
||||
|
||||
// The respawn time for ammunition.
|
||||
// 0 - disable delay
|
||||
//
|
||||
// Default value: "20"
|
||||
mp_ammo_respawn_time "20"
|
||||
|
||||
// Vote systems enabled in server
|
||||
//
|
||||
// k - votekick enabled via vote command
|
||||
// m - votemap enabled via votemap command
|
||||
//
|
||||
// Set to "0" to disable voting systems
|
||||
//
|
||||
// Default value: "km"
|
||||
mp_vote_flags "km"
|
||||
|
||||
// Minimum seconds that must elapse on map before votemap command can be used
|
||||
//
|
||||
// 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"
|
||||
|
16
dist/game_init.cfg
vendored
16
dist/game_init.cfg
vendored
@ -1,5 +1,21 @@
|
||||
// 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)
|
||||
//
|
||||
// Default value: "1"
|
||||
mp_hullbounds_sets "1"
|
||||
|
@ -1,19 +0,0 @@
|
||||
@echo off
|
||||
|
||||
if defined VS150COMNTOOLS (
|
||||
if not exist "%VS150COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS
|
||||
call "%VS150COMNTOOLS%vcvarsqueryregistry.bat"
|
||||
goto :run
|
||||
) else if defined VS140COMNTOOLS (
|
||||
if not exist "%VS140COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS
|
||||
call "%VS140COMNTOOLS%vcvarsqueryregistry.bat"
|
||||
goto :run
|
||||
)
|
||||
|
||||
:NoVS
|
||||
echo Error: Visual Studio 2015 or 2017 required.
|
||||
exit /b 1
|
||||
|
||||
:run
|
||||
echo %UniversalCRTSdkDir%
|
||||
echo %UCRTVersion%
|
@ -1,3 +0,0 @@
|
||||
majorVersion=5
|
||||
minorVersion=18
|
||||
maintenanceVersion=0
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +0,0 @@
|
||||
#Sat Jun 06 16:31:05 BRT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
|
164
gradlew
vendored
164
gradlew
vendored
@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
90
gradlew.bat
vendored
@ -1,90 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31025.194
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReGameDLL", "..\regamedll\msvc\ReGameDLL.vcxproj", "{70A2B904-B7DB-4C48-8DE0-AF567360D572}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@ -10,14 +10,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReGameDLL", "..\regamedll\m
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunitlite", "..\dep\cppunitlite\msvc\cppunitlite.vcxproj", "{CEB94F7C-E459-4673-AABB-36E2074396C0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gradle", "gradle", "{DB570330-2FEE-4C39-971B-340019B6E661}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\build.gradle = ..\build.gradle
|
||||
..\gradle.properties = ..\gradle.properties
|
||||
..\settings.gradle = ..\settings.gradle
|
||||
..\shared.gradle = ..\shared.gradle
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug Play|Win32 = Debug Play|Win32
|
||||
@ -51,4 +43,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E442B676-1D5A-48D0-BFCC-D5D3BAD32ECF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
142
publish.gradle
142
publish.gradle
@ -1,142 +0,0 @@
|
||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||
import org.apache.commons.io.FilenameUtils
|
||||
|
||||
void _copyFileToDir(String from, String to) {
|
||||
if (!project.file(from).exists()) {
|
||||
println 'WARNING: Could not find: ' + from;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!project.file(to).exists()) {
|
||||
project.file(to).mkdirs();
|
||||
}
|
||||
|
||||
def dst = new File(project.file(to), FilenameUtils.getName(from))
|
||||
GradleCppUtils.copyFile(project.file(from), dst, false)
|
||||
}
|
||||
|
||||
void _copyFile(String from, String to) {
|
||||
if (!project.file(from).exists()) {
|
||||
println 'WARNING: Could not find: ' + from;
|
||||
return;
|
||||
}
|
||||
|
||||
GradleCppUtils.copyFile(project.file(from), project.file(to), false)
|
||||
}
|
||||
|
||||
task publishPrepareFiles {
|
||||
doLast {
|
||||
def pubRootDir = project.file('publish/publishRoot')
|
||||
if (pubRootDir.exists()) {
|
||||
if (!pubRootDir.deleteDir()) {
|
||||
throw new RuntimeException("Failed to delete ${pubRootDir}")
|
||||
}
|
||||
}
|
||||
|
||||
pubRootDir.mkdirs()
|
||||
project.file('publish/publishRoot/bin/win32/cstrike/dlls').mkdirs()
|
||||
project.file('publish/publishRoot/bin/linux32/cstrike/dlls').mkdirs()
|
||||
|
||||
// bugfixed binaries
|
||||
_copyFile('publish/releaseRegamedllFixes/mp.dll', 'publish/publishRoot/bin/win32/cstrike/dlls/mp.dll')
|
||||
_copyFile('publish/releaseRegamedllFixes/cs.so', 'publish/publishRoot/bin/linux32/cstrike/dlls/cs.so')
|
||||
|
||||
// copy files from folder dist
|
||||
copy {
|
||||
from('dist')
|
||||
into 'publish/publishRoot/bin/win32/cstrike'
|
||||
}
|
||||
|
||||
copy {
|
||||
from('dist')
|
||||
into 'publish/publishRoot/bin/linux32/cstrike'
|
||||
}
|
||||
|
||||
// cssdk
|
||||
project.file('publish/publishRoot/cssdk').mkdirs()
|
||||
copy {
|
||||
from 'regamedll/extra/cssdk'
|
||||
into 'publish/publishRoot/cssdk'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
||||
baseName = "regamedll-dist-${project.version}"
|
||||
destinationDir file('publish')
|
||||
from 'publish/publishRoot'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
version project.version
|
||||
artifact publishPackage
|
||||
|
||||
pom.withXml {
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = DELEGATE_FIRST
|
||||
name project.name
|
||||
description project.description
|
||||
properties {
|
||||
commitDate project.ext.regamedllVersionInfo.commitDate
|
||||
commitSHA project.ext.regamedllVersionInfo.commitSHA
|
||||
}
|
||||
|
||||
//url github
|
||||
//scm {
|
||||
// url "${github}.git"
|
||||
// connection "scm:git:${github}.git"
|
||||
//}
|
||||
/*
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'dreamstalker'
|
||||
name 'dreamstalker'
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Properties repoCreds = new Properties()
|
||||
project.ext.repoCreds = repoCreds
|
||||
if (file('repo_creds.properties').exists()) {
|
||||
println 'Loading maven repo credentials'
|
||||
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
|
||||
repoCreds.load(r)
|
||||
})
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
if (project.version.contains('dev')) {
|
||||
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-dev/"
|
||||
} else {
|
||||
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/"
|
||||
}
|
||||
credentials {
|
||||
username repoCreds.getProperty('username')
|
||||
password repoCreds.getProperty('password')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task doPublish {
|
||||
dependsOn 'publishPackage'
|
||||
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
|
||||
dependsOn 'publish'
|
||||
}
|
||||
}
|
@ -1,70 +1,146 @@
|
||||
#----------------------------------------
|
||||
# 1. Preparing build:
|
||||
# rm -rf build
|
||||
# mkdir build && cd build
|
||||
#
|
||||
# 2. Select compiler and build it
|
||||
# - Compile with Clang:
|
||||
# CC="clang" CXX="clang++" cmake ..
|
||||
# make
|
||||
#
|
||||
# - Compile with Intel C++ Compiler:
|
||||
# CC="icc" CXX="icpc" cmake ..
|
||||
# make
|
||||
#
|
||||
# - Compile with GCC Compiler:
|
||||
# cmake ..
|
||||
# make
|
||||
#----------------------------------------
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(regamedll CXX)
|
||||
|
||||
option(DEBUG "Build debug application." OFF)
|
||||
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
|
||||
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
option(DEBUG "Build with debug information." OFF)
|
||||
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
|
||||
option(USE_LEGACY_LIBC "Enables linking against legacy libc (<= 2.15) for compat with older distros (Debian 8/Ubuntu 16.04/Centos 7)." OFF)
|
||||
option(XASH_COMPAT "Enable Xash3D FWGS compatiblity (support for it's 64-bit ABI support and crossplatform library suffix)")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (USE_INTEL_COMPILER)
|
||||
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
|
||||
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
|
||||
elseif (USE_CLANG_COMPILER)
|
||||
set(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
# Avoid -rdynamic -fPIC options
|
||||
if (NOT XASH_COMPAT)
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-U_FORTIFY_SOURCE")
|
||||
set(LINK_LIBS dl)
|
||||
|
||||
if (USE_INTEL_COMPILER OR USE_CLANG_COMPILER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fasm-blocks")
|
||||
# do not strip debuginfo during link
|
||||
if (NOT DEBUG)
|
||||
set(LINK_FLAGS "-s")
|
||||
endif()
|
||||
|
||||
# add -m32 flag only on 64-bit systems, if building for 64-bit wasn't enabled with XASH_COMPAT
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (XASH_COMPAT)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DXASH_64BIT")
|
||||
else()
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -m32")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -m32")
|
||||
list(APPEND LINK_LIBS aelf32)
|
||||
set(CMAKE_SIZEOF_VOID_P 4)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(XASH_COMPAT)
|
||||
# Xash3D FWGS Library Naming Scheme compliance
|
||||
# see documentation: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md
|
||||
include(LibraryNaming)
|
||||
endif()
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-builtin -Wno-unknown-pragmas")
|
||||
|
||||
# Remove noxref code and data
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ffunction-sections -fdata-sections")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -ggdb -O3 -Wall -ffunction-sections -fdata-sections")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-rtti -ffunction-sections -fdata-sections")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
if (USE_INTEL_COMPILER)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
else()
|
||||
## Produce code optimized for the most common IA32/AMD64/EM64T processors.
|
||||
## As new processors are deployed in the marketplace, the behavior of this option will change.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\
|
||||
-mtune=generic -msse3\
|
||||
-Wno-write-strings -Wno-invalid-offsetof\
|
||||
-Wno-unused-variable -Wno-unused-function\
|
||||
-Wno-unused-result -Wno-invalid-offsetof\
|
||||
-fpermissive -Wno-switch -Wno-enum-compare\
|
||||
-Wno-unknown-pragmas -Wno-unused-value")
|
||||
# Check Intel C++ compiler
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
#
|
||||
# -fp-model=precise
|
||||
# ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations
|
||||
# https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html#fp-model-fp_GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5
|
||||
#
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-fp-model=precise\
|
||||
-fasm-blocks\
|
||||
-Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
|
||||
if (USE_CLANG_COMPILER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\
|
||||
#
|
||||
# -qno-opt-class-analysis
|
||||
# Don't use c++ class hierarchy for analyze and resolve C++ virtual function calls at compile time
|
||||
#
|
||||
# Example issue:
|
||||
# Expected: FF .. call dword ptr + offset, pEntity->Spawn();
|
||||
# Got: E8 .. call CBaseEntity::Spawn();
|
||||
#
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-qno-opt-class-analysis\
|
||||
-static-intel\
|
||||
-no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (NOT XASH_COMPAT OR XASH_AMD64 OR XASH_X86)
|
||||
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
|
||||
# As new processors are deployed in the marketplace, the behavior of this option will change.
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3")
|
||||
endif()
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-delete-non-virtual-dtor -Wno-invalid-offsetof\
|
||||
-Wno-unused-variable -Wno-unused-value -Wno-unused-result -Wno-unused-function\
|
||||
-Wno-write-strings -Wno-switch -Wno-enum-compare\
|
||||
-Wno-sign-compare -Wno-format -Wno-ignored-attributes -Wno-strict-aliasing")
|
||||
|
||||
# Check Clang compiler
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-Wno-unused-local-typedef\
|
||||
-Wno-unused-private-field\
|
||||
-fno-strict-vtable-pointers\
|
||||
-Wno-overloaded-virtual")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-fno-plt\
|
||||
-fno-devirtualize\
|
||||
-Wno-unused-local-typedefs\
|
||||
-Wno-sign-compare\
|
||||
-Wno-strict-aliasing\
|
||||
-Wno-unused-but-set-variable\
|
||||
-fno-devirtualize")
|
||||
-Wno-unused-but-set-variable")
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess -fcf-protection=none")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT DEBUG AND USE_STATIC_LIBSTDC)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
|
||||
endif()
|
||||
|
||||
if (USE_STATIC_LIBSTDC)
|
||||
add_definitions(-DBUILD_STATIC_LIBSTDC)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
if (NOT DEBUG)
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -75,6 +151,11 @@ set(PROJECT_SRC_DIR
|
||||
"${PROJECT_SOURCE_DIR}/game_shared"
|
||||
"${PROJECT_SOURCE_DIR}/pm_shared"
|
||||
"${PROJECT_SOURCE_DIR}/regamedll"
|
||||
"${PROJECT_SOURCE_DIR}/unittests"
|
||||
)
|
||||
|
||||
set(PROJECT_CPPUNITLITE_DIR
|
||||
"${PROJECT_SOURCE_DIR}/../dep/cppunitlite/include"
|
||||
)
|
||||
|
||||
set(PROJECT_PUBLIC_DIR
|
||||
@ -86,63 +167,273 @@ set(ENGINE_SRCS
|
||||
"engine/unicode_strtools.cpp"
|
||||
)
|
||||
|
||||
file(GLOB SHARED_SRCS
|
||||
"game_shared/bot/*.cpp"
|
||||
"game_shared/*.cpp"
|
||||
"pm_shared/*.cpp"
|
||||
"regamedll/*.cpp"
|
||||
set(SHARED_SRCS
|
||||
"game_shared/shared_util.cpp"
|
||||
"game_shared/voice_gamemgr.cpp"
|
||||
"game_shared/bot/bot.cpp"
|
||||
"game_shared/bot/bot_manager.cpp"
|
||||
"game_shared/bot/bot_profile.cpp"
|
||||
"game_shared/bot/bot_util.cpp"
|
||||
"game_shared/bot/nav_area.cpp"
|
||||
"game_shared/bot/nav_file.cpp"
|
||||
"game_shared/bot/nav_node.cpp"
|
||||
"game_shared/bot/nav_path.cpp"
|
||||
"pm_shared/pm_debug.cpp"
|
||||
"pm_shared/pm_math.cpp"
|
||||
"pm_shared/pm_shared.cpp"
|
||||
"regamedll/regamedll.cpp"
|
||||
"regamedll/precompiled.cpp"
|
||||
"regamedll/public_amalgamation.cpp"
|
||||
"regamedll/hookchains_impl.cpp"
|
||||
"regamedll/sse_mathfun.cpp"
|
||||
"public/FileSystem.cpp"
|
||||
"public/interface.cpp"
|
||||
"public/MemPool.cpp"
|
||||
"version/version.cpp"
|
||||
"public/MemPool.cpp"
|
||||
"public/tier0/dbg.cpp"
|
||||
"public/tier0/platform_posix.cpp"
|
||||
)
|
||||
|
||||
list(REMOVE_ITEM SHARED_SRCS EXCLUDE "${PROJECT_SOURCE_DIR}/regamedll/classes_dummy.cpp")
|
||||
|
||||
file(GLOB GAMEDLL_SRCS
|
||||
"dlls/*.cpp"
|
||||
"dlls/API/*.cpp"
|
||||
"dlls/addons/*.cpp"
|
||||
"dlls/wpn_shared/*.cpp"
|
||||
"dlls/bot/*.cpp"
|
||||
"dlls/bot/states/*.cpp"
|
||||
"dlls/hostage/*.cpp"
|
||||
"dlls/hostage/states/*.cpp"
|
||||
set(GAMEDLL_SRCS
|
||||
"dlls/airtank.cpp"
|
||||
"dlls/ammo.cpp"
|
||||
"dlls/animating.cpp"
|
||||
"dlls/animation.cpp"
|
||||
"dlls/basemonster.cpp"
|
||||
"dlls/bmodels.cpp"
|
||||
"dlls/buttons.cpp"
|
||||
"dlls/career_tasks.cpp"
|
||||
"dlls/cbase.cpp"
|
||||
"dlls/client.cpp"
|
||||
"dlls/cmdhandler.cpp"
|
||||
"dlls/combat.cpp"
|
||||
"dlls/debug.cpp"
|
||||
"dlls/doors.cpp"
|
||||
"dlls/effects.cpp"
|
||||
"dlls/explode.cpp"
|
||||
"dlls/func_break.cpp"
|
||||
"dlls/func_tank.cpp"
|
||||
"dlls/game.cpp"
|
||||
"dlls/gamerules.cpp"
|
||||
"dlls/ggrenade.cpp"
|
||||
"dlls/gib.cpp"
|
||||
"dlls/globals.cpp"
|
||||
"dlls/h_battery.cpp"
|
||||
"dlls/h_cycler.cpp"
|
||||
"dlls/h_export.cpp"
|
||||
"dlls/healthkit.cpp"
|
||||
"dlls/hintmessage.cpp"
|
||||
"dlls/items.cpp"
|
||||
"dlls/lights.cpp"
|
||||
"dlls/mapinfo.cpp"
|
||||
"dlls/maprules.cpp"
|
||||
"dlls/mortar.cpp"
|
||||
"dlls/multiplay_gamerules.cpp"
|
||||
"dlls/observer.cpp"
|
||||
"dlls/pathcorner.cpp"
|
||||
"dlls/plats.cpp"
|
||||
"dlls/player.cpp"
|
||||
"dlls/revert_saved.cpp"
|
||||
"dlls/saverestore.cpp"
|
||||
"dlls/singleplay_gamerules.cpp"
|
||||
"dlls/skill.cpp"
|
||||
"dlls/sound.cpp"
|
||||
"dlls/soundent.cpp"
|
||||
"dlls/spectator.cpp"
|
||||
"dlls/subs.cpp"
|
||||
"dlls/training_gamerules.cpp"
|
||||
"dlls/triggers.cpp"
|
||||
"dlls/tutor.cpp"
|
||||
"dlls/tutor_base_states.cpp"
|
||||
"dlls/tutor_base_tutor.cpp"
|
||||
"dlls/tutor_cs_states.cpp"
|
||||
"dlls/tutor_cs_tutor.cpp"
|
||||
"dlls/util.cpp"
|
||||
"dlls/vehicle.cpp"
|
||||
"dlls/weapons.cpp"
|
||||
"dlls/weapontype.cpp"
|
||||
"dlls/world.cpp"
|
||||
"dlls/API/CAPI_Impl.cpp"
|
||||
"dlls/API/CSEntity.cpp"
|
||||
"dlls/API/CSPlayer.cpp"
|
||||
"dlls/API/CSPlayerItem.cpp"
|
||||
"dlls/API/CSPlayerWeapon.cpp"
|
||||
"dlls/addons/item_airbox.cpp"
|
||||
"dlls/addons/point_command.cpp"
|
||||
"dlls/addons/trigger_random.cpp"
|
||||
"dlls/addons/trigger_setorigin.cpp"
|
||||
"dlls/wpn_shared/wpn_ak47.cpp"
|
||||
"dlls/wpn_shared/wpn_aug.cpp"
|
||||
"dlls/wpn_shared/wpn_awp.cpp"
|
||||
"dlls/wpn_shared/wpn_c4.cpp"
|
||||
"dlls/wpn_shared/wpn_deagle.cpp"
|
||||
"dlls/wpn_shared/wpn_elite.cpp"
|
||||
"dlls/wpn_shared/wpn_famas.cpp"
|
||||
"dlls/wpn_shared/wpn_fiveseven.cpp"
|
||||
"dlls/wpn_shared/wpn_flashbang.cpp"
|
||||
"dlls/wpn_shared/wpn_g3sg1.cpp"
|
||||
"dlls/wpn_shared/wpn_galil.cpp"
|
||||
"dlls/wpn_shared/wpn_glock18.cpp"
|
||||
"dlls/wpn_shared/wpn_hegrenade.cpp"
|
||||
"dlls/wpn_shared/wpn_knife.cpp"
|
||||
"dlls/wpn_shared/wpn_m3.cpp"
|
||||
"dlls/wpn_shared/wpn_m4a1.cpp"
|
||||
"dlls/wpn_shared/wpn_m249.cpp"
|
||||
"dlls/wpn_shared/wpn_mac10.cpp"
|
||||
"dlls/wpn_shared/wpn_mp5navy.cpp"
|
||||
"dlls/wpn_shared/wpn_p90.cpp"
|
||||
"dlls/wpn_shared/wpn_p228.cpp"
|
||||
"dlls/wpn_shared/wpn_scout.cpp"
|
||||
"dlls/wpn_shared/wpn_sg550.cpp"
|
||||
"dlls/wpn_shared/wpn_sg552.cpp"
|
||||
"dlls/wpn_shared/wpn_smokegrenade.cpp"
|
||||
"dlls/wpn_shared/wpn_tmp.cpp"
|
||||
"dlls/wpn_shared/wpn_ump45.cpp"
|
||||
"dlls/wpn_shared/wpn_usp.cpp"
|
||||
"dlls/wpn_shared/wpn_xm1014.cpp"
|
||||
"dlls/bot/cs_bot.cpp"
|
||||
"dlls/bot/cs_bot_chatter.cpp"
|
||||
"dlls/bot/cs_bot_event.cpp"
|
||||
"dlls/bot/cs_bot_init.cpp"
|
||||
"dlls/bot/cs_bot_learn.cpp"
|
||||
"dlls/bot/cs_bot_listen.cpp"
|
||||
"dlls/bot/cs_bot_manager.cpp"
|
||||
"dlls/bot/cs_bot_nav.cpp"
|
||||
"dlls/bot/cs_bot_pathfind.cpp"
|
||||
"dlls/bot/cs_bot_radio.cpp"
|
||||
"dlls/bot/cs_bot_statemachine.cpp"
|
||||
"dlls/bot/cs_bot_update.cpp"
|
||||
"dlls/bot/cs_bot_vision.cpp"
|
||||
"dlls/bot/cs_bot_weapon.cpp"
|
||||
"dlls/bot/cs_gamestate.cpp"
|
||||
"dlls/bot/states/cs_bot_attack.cpp"
|
||||
"dlls/bot/states/cs_bot_buy.cpp"
|
||||
"dlls/bot/states/cs_bot_defuse_bomb.cpp"
|
||||
"dlls/bot/states/cs_bot_escape_from_bomb.cpp"
|
||||
"dlls/bot/states/cs_bot_fetch_bomb.cpp"
|
||||
"dlls/bot/states/cs_bot_follow.cpp"
|
||||
"dlls/bot/states/cs_bot_hide.cpp"
|
||||
"dlls/bot/states/cs_bot_hunt.cpp"
|
||||
"dlls/bot/states/cs_bot_idle.cpp"
|
||||
"dlls/bot/states/cs_bot_investigate_noise.cpp"
|
||||
"dlls/bot/states/cs_bot_move_to.cpp"
|
||||
"dlls/bot/states/cs_bot_plant_bomb.cpp"
|
||||
"dlls/bot/states/cs_bot_use_entity.cpp"
|
||||
"dlls/hostage/hostage.cpp"
|
||||
"dlls/hostage/hostage_improv.cpp"
|
||||
"dlls/hostage/hostage_localnav.cpp"
|
||||
"dlls/hostage/states/hostage_animate.cpp"
|
||||
"dlls/hostage/states/hostage_escape.cpp"
|
||||
"dlls/hostage/states/hostage_follow.cpp"
|
||||
"dlls/hostage/states/hostage_idle.cpp"
|
||||
"dlls/hostage/states/hostage_retreat.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
set(UNITTESTS_SRCS
|
||||
"unittests/animation_tests.cpp"
|
||||
"unittests/struct_offsets_tests.cpp"
|
||||
"unittests/TestRunner.cpp"
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Unittests)
|
||||
if (NOT TARGET cppunitlite)
|
||||
add_subdirectory(../dep/cppunitlite cppunitlite)
|
||||
endif()
|
||||
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
|
||||
add_executable(regamedll ${appversion.sh})
|
||||
else()
|
||||
add_library(regamedll SHARED ${appversion.sh})
|
||||
endif()
|
||||
|
||||
if (NOT TARGET appversion)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..")
|
||||
endif()
|
||||
|
||||
add_dependencies(regamedll appversion)
|
||||
|
||||
target_include_directories(regamedll PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_CPPUNITLITE_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
link_directories(${PROJECT_SOURCE_DIR}/lib/linux32)
|
||||
|
||||
add_definitions(
|
||||
-DREGAMEDLL_FIXES
|
||||
-DBUILD_LATEST
|
||||
-DREGAMEDLL_ADD
|
||||
-DREGAMEDLL_API
|
||||
-DUNICODE_FIXES
|
||||
-DCLIENT_WEAPONS
|
||||
-DUSE_QSTRING
|
||||
-DGNUC
|
||||
-DPOSIX
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_unlink=unlink
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_write=write
|
||||
-D_close=close
|
||||
-D_access=access
|
||||
-D_vsnwprintf=vswprintf
|
||||
target_compile_definitions(regamedll PRIVATE
|
||||
REGAMEDLL_FIXES
|
||||
REGAMEDLL_API
|
||||
REGAMEDLL_ADD
|
||||
UNICODE_FIXES
|
||||
BUILD_LATEST
|
||||
CLIENT_WEAPONS
|
||||
USE_QSTRING
|
||||
_LINUX
|
||||
LINUX
|
||||
NDEBUG
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_unlink=unlink
|
||||
_snprintf=snprintf
|
||||
_vsnprintf=vsnprintf
|
||||
_write=write
|
||||
_close=close
|
||||
_access=access
|
||||
_vsnwprintf=vswprintf
|
||||
)
|
||||
|
||||
add_library(regamedll SHARED ${appversion.sh} ${GAMEDLL_SRCS} ${ENGINE_SRCS} ${SHARED_SRCS})
|
||||
set_property(TARGET regamedll PROPERTY LIBRARY_OUTPUT_NAME cs)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}")
|
||||
set_target_properties(regamedll PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
|
||||
target_link_libraries(regamedll dl aelf32)
|
||||
add_dependencies(regamedll appversion)
|
||||
target_sources(regamedll PRIVATE
|
||||
${GAMEDLL_SRCS}
|
||||
${ENGINE_SRCS}
|
||||
${SHARED_SRCS}
|
||||
|
||||
$<$<CONFIG:Unittests>:
|
||||
${UNITTESTS_SRCS}>
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Unittests)
|
||||
list(APPEND LINK_LIBS cppunitlite)
|
||||
elseif (USE_LEGACY_LIBC)
|
||||
list(APPEND LINK_LIBS libc-2.15.so)
|
||||
endif()
|
||||
|
||||
target_link_libraries(regamedll PRIVATE ${LINK_LIBS})
|
||||
|
||||
if (USE_STATIC_LIBSTDC)
|
||||
target_compile_definitions(regamedll PRIVATE BUILD_STATIC_LIBSTDC)
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -Wl,-rpath,'$ORIGIN/.'")
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -L${PROJECT_SOURCE_DIR}/lib/linux32")
|
||||
endif()
|
||||
|
||||
set_target_properties(regamedll PROPERTIES
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
)
|
||||
|
||||
if (XASH_COMPAT)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set_target_properties(regamedll PROPERTIES
|
||||
OUTPUT_NAME server)
|
||||
else()
|
||||
set_target_properties(regamedll PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME cs${POSTFIX})
|
||||
endif()
|
||||
else()
|
||||
set_target_properties(regamedll PROPERTIES
|
||||
OUTPUT_NAME cs
|
||||
PREFIX ""
|
||||
POSITION_INDEPENDENT_CODE OFF)
|
||||
endif()
|
||||
|
||||
install(TARGETS regamedll
|
||||
RUNTIME DESTINATION "cstrike/dlls/"
|
||||
LIBRARY DESTINATION "cstrike/dlls/"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
@ -1,444 +0,0 @@
|
||||
import gradlecpp.RegamedllPlayTestPlugin
|
||||
import gradlecpp.RegamedllPlayTestTask
|
||||
import gradlecpp.VelocityUtils
|
||||
|
||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||
import org.doomedsociety.gradlecpp.LazyNativeDepSet
|
||||
import org.doomedsociety.gradlecpp.cfg.ToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
|
||||
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet
|
||||
import org.doomedsociety.gradlecpp.msvc.FloatingPointModel
|
||||
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
|
||||
import org.gradle.language.cpp.CppSourceSet
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
import org.gradle.nativeplatform.NativeExecutableSpec
|
||||
import org.gradle.nativeplatform.NativeLibrarySpec
|
||||
import org.gradle.nativeplatform.SharedLibraryBinarySpec
|
||||
import regamedll.testdemo.RegamedllDemoRunner
|
||||
import versioning.RegamedllVersionInfo
|
||||
import org.apache.commons.io.FilenameUtils
|
||||
import org.apache.commons.compress.archivers.ArchiveInputStream
|
||||
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: IccCompilerPlugin
|
||||
apply plugin: GccCompilerPlugin
|
||||
apply plugin: RegamedllPlayTestPlugin
|
||||
apply plugin: gradlecpp.CppUnitTestPlugin
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
regamedll_tests
|
||||
}
|
||||
|
||||
dependencies {
|
||||
regamedll_tests 'regamedll.testdemos:cstrike-basic:1.0'
|
||||
}
|
||||
|
||||
project.ext.dep_cppunitlite = project(':dep/cppunitlite')
|
||||
|
||||
void createIntergrationTestTask(NativeBinarySpec b) {
|
||||
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
|
||||
|
||||
if (!(b instanceof SharedLibraryBinarySpec)) return
|
||||
if (!GradleCppUtils.windows) return
|
||||
if (regamedllFixes) return
|
||||
|
||||
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
|
||||
|
||||
def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask)
|
||||
demoItgTestTask.with {
|
||||
regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg')
|
||||
regamedllTestLogs = new File(this.project.buildDir, "_regamedllTestLogs/${b.name}")
|
||||
testDemos = project.configurations.regamedll_tests
|
||||
testFor = b
|
||||
|
||||
// inputs/outputs for up-to-date check
|
||||
inputs.files testDemos.files
|
||||
outputs.dir regamedllTestLogs
|
||||
|
||||
// dependencies on test executable
|
||||
if (unitTestTask) {
|
||||
dependsOn unitTestTask
|
||||
}
|
||||
|
||||
postExtractAction {
|
||||
def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b)
|
||||
def binaryOutDir = new File(project.projectDir, '/_regamedllTestImg/cstrike/dlls')
|
||||
GradleCppUtils.copyFile(binaryOutFile, new File(binaryOutDir, binaryOutFile.name), true)
|
||||
}
|
||||
}
|
||||
|
||||
b.buildTask.dependsOn demoItgTestTask
|
||||
}
|
||||
|
||||
void postEvaluate(NativeBinarySpec b) {
|
||||
|
||||
// attach generateAppVersion task to all 'compile source' tasks
|
||||
GradleCppUtils.getCompileTasks(b).each { Task t ->
|
||||
t.dependsOn project.generateAppVersion
|
||||
}
|
||||
|
||||
createIntergrationTestTask(b)
|
||||
}
|
||||
|
||||
void setupToolchain(NativeBinarySpec b)
|
||||
{
|
||||
boolean useGcc = project.hasProperty("useGcc")
|
||||
boolean useClang = project.hasProperty("useClang")
|
||||
boolean unitTestExecutable = b.component.name.endsWith('_tests')
|
||||
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
|
||||
|
||||
ToolchainConfig cfg = rootProject.createToolchainConfig(b)
|
||||
cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/public', '/public/regamedll')
|
||||
|
||||
if (unitTestExecutable)
|
||||
{
|
||||
cfg.projectInclude(dep_cppunitlite, '/include')
|
||||
b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true)
|
||||
}
|
||||
|
||||
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'REGAMEDLL_SELF', 'REGAMEDLL_API', 'CLIENT_WEAPONS', 'USE_QSTRING'
|
||||
|
||||
if (cfg instanceof MsvcToolchainConfig)
|
||||
{
|
||||
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
|
||||
enabled: true,
|
||||
pchHeader: 'precompiled.h',
|
||||
pchSourceSet: 'regamedll_pch'
|
||||
);
|
||||
|
||||
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
|
||||
if (!regamedllFixes)
|
||||
{
|
||||
cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE
|
||||
cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED
|
||||
}
|
||||
else {
|
||||
cfg.compilerOptions.args '/Oi', '/GF', '/GS', '/GR'
|
||||
}
|
||||
|
||||
cfg.projectLibpath(project, '/lib')
|
||||
cfg.extraLibs 'libacof32.lib'
|
||||
}
|
||||
else if (cfg instanceof GccToolchainConfig)
|
||||
{
|
||||
if (!useGcc && !useClang)
|
||||
{
|
||||
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
|
||||
enabled: true,
|
||||
pchSourceSet: 'regamedll_pch'
|
||||
);
|
||||
}
|
||||
|
||||
cfg.compilerOptions.languageStandard = 'c++14'
|
||||
cfg.defines([
|
||||
'_stricmp': 'strcasecmp',
|
||||
'_strnicmp': 'strncasecmp',
|
||||
'_strdup': 'strdup',
|
||||
'_unlink': 'unlink',
|
||||
'_vsnprintf': 'vsnprintf',
|
||||
'_write' : 'write',
|
||||
'_close' : 'close',
|
||||
'_vsnwprintf' : 'vswprintf',
|
||||
'_access' : 'access'
|
||||
])
|
||||
|
||||
if (useGcc || useClang) {
|
||||
// Produce code optimized for the most common IA32/AMD64/EM64T processors.
|
||||
// As new processors are deployed in the marketplace, the behavior of this option will change.
|
||||
cfg.compilerOptions.args '-mtune=generic', '-msse3', '-Wno-write-strings', '-Wno-invalid-offsetof', '-fpermissive', '-Wno-switch', '-Wno-unused-value', '-Wno-enum-compare'
|
||||
|
||||
if (useGcc) {
|
||||
cfg.compilerOptions.args '-fno-devirtualize'
|
||||
}
|
||||
else {
|
||||
cfg.compilerOptions.args '-fno-strict-vtable-pointers', '-Wno-overloaded-virtual'
|
||||
}
|
||||
|
||||
} else {
|
||||
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
|
||||
|
||||
// Not use c++ class hierarchy for analyze and resolve C++ virtual function calls at compile time.
|
||||
//
|
||||
// Example issue:
|
||||
// Expected: FF .. call dword ptr + offset, pEntity->Spawn();
|
||||
// Got: E8 .. call CBaseEntity::Spawn();
|
||||
cfg.linkerOptions.args '-qno-opt-class-analysis'
|
||||
}
|
||||
|
||||
if (cfg.linkerOptions.staticLibStdCpp) {
|
||||
cfg.singleDefines 'BUILD_STATIC_LIBSTDC'
|
||||
}
|
||||
|
||||
cfg.compilerOptions.args '-g0', '-fno-exceptions'
|
||||
cfg.projectLibpath(project, '/lib/linux32')
|
||||
cfg.extraLibs 'dl', 'm', 'aelf32'
|
||||
}
|
||||
|
||||
if (GradleCppUtils.windows && !unitTestExecutable) {
|
||||
cfg.linkerOptions.definitionFile = "${projectDir}\\msvc\\mp.def";
|
||||
}
|
||||
|
||||
if (unitTestExecutable) {
|
||||
cfg.singleDefines 'REGAMEDLL_UNIT_TESTS'
|
||||
}
|
||||
|
||||
if (regamedllFixes) {
|
||||
cfg.singleDefines 'REGAMEDLL_FIXES', 'BUILD_LATEST', 'BUILD_LATEST_FIXES', 'REGAMEDLL_CHECKS', 'REGAMEDLL_ADD', 'UNICODE_FIXES', 'NDEBUG'
|
||||
} else {
|
||||
cfg.singleDefines 'PLAY_GAMEDLL'
|
||||
}
|
||||
|
||||
ToolchainConfigUtils.apply(project, cfg, b)
|
||||
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
|
||||
postEvaluate(b)
|
||||
})
|
||||
}
|
||||
|
||||
class RegamedllSrc {
|
||||
static void regamedll_src(def h) {
|
||||
h.engine_src(CppSourceSet) {
|
||||
source {
|
||||
srcDir "engine"
|
||||
include "unicode_strtools.cpp"
|
||||
}
|
||||
}
|
||||
|
||||
h.shared_src(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "game_shared", "pm_shared", "regamedll", "public", "version"
|
||||
|
||||
include "**/*.cpp"
|
||||
|
||||
exclude "precompiled.cpp"
|
||||
exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp"
|
||||
|
||||
if (GradleCppUtils.windows)
|
||||
{
|
||||
exclude "tier0/platform_linux.cpp"
|
||||
}
|
||||
else
|
||||
{
|
||||
exclude "tier0/platform_win32.cpp"
|
||||
exclude "classes_dummy.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h.gamedll_src(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "dlls", "dlls/API", "dlls/addons"
|
||||
include "**/*.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_pch(def h) {
|
||||
h.regamedll_pch(CppSourceSet) {
|
||||
source {
|
||||
srcDir "regamedll"
|
||||
include "precompiled.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_tests_gcc_src(def h) {
|
||||
h.regamedll_tests_gcc_src(CppSourceSet) {
|
||||
source {
|
||||
srcDir "unittests"
|
||||
include "**/*.cpp"
|
||||
exclude "mathfun_tests.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_tests_src(def h) {
|
||||
h.regamedll_tests_src(CppSourceSet) {
|
||||
source {
|
||||
srcDir "unittests"
|
||||
include "**/*.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model {
|
||||
buildTypes {
|
||||
debug
|
||||
release
|
||||
}
|
||||
|
||||
platforms {
|
||||
x86 {
|
||||
architecture "x86"
|
||||
}
|
||||
}
|
||||
|
||||
toolChains {
|
||||
visualCpp(VisualCpp) {
|
||||
}
|
||||
if (project.hasProperty("useClang")) {
|
||||
clang(Clang)
|
||||
}
|
||||
else if (project.hasProperty("useGcc")) {
|
||||
gcc(Gcc)
|
||||
} else {
|
||||
icc(Icc)
|
||||
}
|
||||
}
|
||||
|
||||
flavors {
|
||||
regamedllNofixes
|
||||
regamedllFixes
|
||||
}
|
||||
|
||||
components {
|
||||
|
||||
regamedll_mp_gamedll(NativeLibrarySpec) {
|
||||
targetPlatform 'x86'
|
||||
baseName GradleCppUtils.windows ? 'mp' : 'cs'
|
||||
sources {
|
||||
RegamedllSrc.regamedll_pch(it)
|
||||
RegamedllSrc.regamedll_src(it)
|
||||
}
|
||||
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
||||
}
|
||||
|
||||
regamedll_mp_gamedll_tests(NativeExecutableSpec) {
|
||||
targetPlatform 'x86'
|
||||
sources {
|
||||
RegamedllSrc.regamedll_pch(it)
|
||||
RegamedllSrc.regamedll_src(it)
|
||||
|
||||
if (project.hasProperty("useGcc")) {
|
||||
RegamedllSrc.regamedll_tests_gcc_src(it)
|
||||
} else {
|
||||
RegamedllSrc.regamedll_tests_src(it)
|
||||
}
|
||||
}
|
||||
|
||||
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task buildFinalize << {
|
||||
if (GradleCppUtils.windows) {
|
||||
return;
|
||||
}
|
||||
|
||||
binaries.withType(SharedLibraryBinarySpec) {
|
||||
def sharedBinary = it.getSharedLibraryFile();
|
||||
if (sharedBinary.exists()) {
|
||||
sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", "")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task buildRelease {
|
||||
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
|
||||
blib.buildable && blib.buildType.name == 'release'
|
||||
}
|
||||
}
|
||||
|
||||
task buildFixes {
|
||||
dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
|
||||
SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll'
|
||||
}
|
||||
}
|
||||
|
||||
task buildDebug {
|
||||
dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
|
||||
SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'debug' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll'
|
||||
}
|
||||
}
|
||||
|
||||
buildFixes.finalizedBy(buildFinalize);
|
||||
buildDebug.finalizedBy(buildFinalize);
|
||||
buildRelease.finalizedBy(buildFinalize);
|
||||
|
||||
gradle.taskGraph.whenReady { graph ->
|
||||
if (!graph.hasTask(buildFixes) && !graph.hasTask(buildDebug)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// skip all tasks with the matched substrings in the name like "test"
|
||||
def tasks = graph.getAllTasks();
|
||||
tasks.findAll { it.name.toLowerCase().contains("test") }.each { task ->
|
||||
task.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
task prepareDevEnvTests {
|
||||
def regamedllTests = new File(project.projectDir, '_dev/testDemos')
|
||||
|
||||
inputs.files configurations.regamedll_tests.files
|
||||
outputs.dir regamedllTests
|
||||
|
||||
doLast {
|
||||
regamedllTests.mkdirs()
|
||||
configurations.regamedll_tests.files.each { File f ->
|
||||
def t = zipTree(f)
|
||||
copy {
|
||||
into new File(regamedllTests, FilenameUtils.getBaseName(f.absolutePath))
|
||||
from t
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task prepareDevEnvGamedll << {
|
||||
['_dev/regamedll', '_dev/regamedll_mp'].each { gamedllDir ->
|
||||
def regamedllImage = new File(project.projectDir, gamedllDir)
|
||||
regamedllImage.mkdirs()
|
||||
def demoRunner = new RegamedllDemoRunner(project.configurations.regamedll_playtest_image.getFiles(), regamedllImage, null)
|
||||
demoRunner.prepareEngine()
|
||||
//demoRunner.prepareDemo()
|
||||
}
|
||||
}
|
||||
|
||||
task prepareDevEnv {
|
||||
dependsOn prepareDevEnvGamedll, prepareDevEnvTests
|
||||
}
|
||||
|
||||
tasks.clean.doLast {
|
||||
project.file('version/appversion.h').delete()
|
||||
}
|
||||
|
||||
task generateAppVersion {
|
||||
|
||||
RegamedllVersionInfo verInfo = (RegamedllVersionInfo)rootProject.regamedllVersionInfo
|
||||
def tplFile = project.file('version/appversion.vm')
|
||||
def renderedFile = project.file('version/appversion.h')
|
||||
|
||||
// check to up-to-date
|
||||
inputs.file tplFile
|
||||
inputs.file project.file('gradle.properties')
|
||||
outputs.file renderedFile
|
||||
|
||||
// this will ensure that this task is redone when the versions change
|
||||
inputs.property('version', rootProject.version)
|
||||
inputs.property('commitDate', verInfo.asCommitDate())
|
||||
|
||||
println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']";
|
||||
|
||||
doLast {
|
||||
def templateCtx = [
|
||||
verInfo: verInfo
|
||||
]
|
||||
|
||||
def content = VelocityUtils.renderTemplate(tplFile, templateCtx)
|
||||
renderedFile.delete()
|
||||
renderedFile.write(content, 'utf-8')
|
||||
|
||||
println 'The current ReGameDLL maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')';
|
||||
}
|
||||
}
|
198
regamedll/cmake/LibraryNaming.cmake
Normal file
198
regamedll/cmake/LibraryNaming.cmake
Normal file
@ -0,0 +1,198 @@
|
||||
include(CheckSymbolExists)
|
||||
|
||||
macro(check_build_target symbol)
|
||||
check_symbol_exists(${symbol} "build.h" ${symbol})
|
||||
endmacro()
|
||||
|
||||
macro(check_group_build_target symbol group)
|
||||
if(NOT ${group})
|
||||
check_build_target(${symbol})
|
||||
if(${symbol})
|
||||
set(${group} TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(${symbol} FALSE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# So there is a problem:
|
||||
# 1. Number of these symbols only grows, as we support more and more ports
|
||||
# 2. CMake was written by morons and can't check these symbols in parallel
|
||||
# 3. MSVC is very slow at everything (startup, parsing, generating error)
|
||||
|
||||
# Solution: group these symbols and set variable if one of them was found
|
||||
# this way we can reorder to reorder them by most common configurations
|
||||
# but we can't generate this list anymore! ... OR IS IT ???
|
||||
|
||||
# Well, after reordering positions in engine's buildenums.h, we can partially autogenerate this list!
|
||||
# echo "check_build_target(XASH_64BIT)"
|
||||
# grep "#define PLATFORM" buildenums.h | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print "check_group_build_target(XASH_" $1 " XASH_PLATFORM)" }'
|
||||
# grep "#define ARCHITECTURE" buildenums.h | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print "check_group_build_target(XASH_" $1 " XASH_ARCHITECTURE)"
|
||||
# grep "#define ENDIAN" buildenums.h | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print "check_group_build_target(XASH_" $1 "_ENDIAN XASH_ENDIANNESS)"}'
|
||||
# echo "if(XASH_ARM)"
|
||||
# grep '^#undef XASH' build.h | grep "XASH_ARM[v_]" | awk '{ print "check_build_target(" $2 ")"}'
|
||||
# echo "endif()"
|
||||
# echo "if(XASH_RISCV)"
|
||||
# grep '^#undef XASH' build.h | grep "XASH_RISCV_" | awk '{ print "check_build_target(" $2 ")"}'
|
||||
# echo "endif()"
|
||||
|
||||
# NOTE: Android must have priority over Linux to work correctly!
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/public/")
|
||||
check_build_target(XASH_64BIT)
|
||||
check_group_build_target(XASH_WIN32 XASH_PLATFORM)
|
||||
check_group_build_target(XASH_ANDROID XASH_PLATFORM)
|
||||
check_group_build_target(XASH_LINUX XASH_PLATFORM)
|
||||
check_group_build_target(XASH_FREEBSD XASH_PLATFORM)
|
||||
check_group_build_target(XASH_APPLE XASH_PLATFORM)
|
||||
check_group_build_target(XASH_NETBSD XASH_PLATFORM)
|
||||
check_group_build_target(XASH_OPENBSD XASH_PLATFORM)
|
||||
check_group_build_target(XASH_EMSCRIPTEN XASH_PLATFORM)
|
||||
check_group_build_target(XASH_DOS4GW XASH_PLATFORM)
|
||||
check_group_build_target(XASH_HAIKU XASH_PLATFORM)
|
||||
check_group_build_target(XASH_SERENITY XASH_PLATFORM)
|
||||
check_group_build_target(XASH_IRIX XASH_PLATFORM)
|
||||
check_group_build_target(XASH_NSWITCH XASH_PLATFORM)
|
||||
check_group_build_target(XASH_PSVITA XASH_PLATFORM)
|
||||
check_group_build_target(XASH_WASI XASH_PLATFORM)
|
||||
check_group_build_target(XASH_SUNOS XASH_PLATFORM)
|
||||
check_group_build_target(XASH_X86 XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_AMD64 XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_ARM XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_MIPS XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_PPC XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_JS XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_E2K XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_RISCV XASH_ARCHITECTURE)
|
||||
check_group_build_target(XASH_LITTLE_ENDIAN XASH_ENDIANNESS)
|
||||
check_group_build_target(XASH_BIG_ENDIAN XASH_ENDIANNESS)
|
||||
if(XASH_ARM)
|
||||
check_build_target(XASH_ARM_HARDFP)
|
||||
check_build_target(XASH_ARM_SOFTFP)
|
||||
check_build_target(XASH_ARMv4)
|
||||
check_build_target(XASH_ARMv5)
|
||||
check_build_target(XASH_ARMv6)
|
||||
check_build_target(XASH_ARMv7)
|
||||
check_build_target(XASH_ARMv8)
|
||||
endif()
|
||||
if(XASH_RISCV)
|
||||
check_build_target(XASH_RISCV_DOUBLEFP)
|
||||
check_build_target(XASH_RISCV_SINGLEFP)
|
||||
check_build_target(XASH_RISCV_SOFTFP)
|
||||
endif()
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
# engine/common/build.c
|
||||
if(XASH_ANDROID)
|
||||
set(BUILDOS "android")
|
||||
elseif(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)
|
||||
set(BUILDOS "") # no prefix for default OS
|
||||
elseif(XASH_FREEBSD)
|
||||
set(BUILDOS "freebsd")
|
||||
elseif(XASH_NETBSD)
|
||||
set(BUILDOS "netbsd")
|
||||
elseif(XASH_OPENBSD)
|
||||
set(BUILDOS "openbsd")
|
||||
elseif(XASH_EMSCRIPTEN)
|
||||
set(BUILDOS "emscripten")
|
||||
elseif(XASH_DOS4GW)
|
||||
set(BUILDOS "DOS4GW")
|
||||
elseif(XASH_HAIKU)
|
||||
set(BUILDOS "haiku")
|
||||
elseif(XASH_SERENITY)
|
||||
set(BUILDOS "serenityos")
|
||||
elseif(XASH_NSWITCH)
|
||||
set(BUILDOS "nswitch")
|
||||
elseif(XASH_PSVITA)
|
||||
set(BUILDOS "psvita")
|
||||
elseif(XASH_IRIX)
|
||||
set(BUILDOS "irix")
|
||||
elseif(XASH_WASI)
|
||||
set(BUILDOS "wasi")
|
||||
elseif(XASH_SUNOS)
|
||||
set(BUILDOS "sunos")
|
||||
else()
|
||||
message(SEND_ERROR "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug")
|
||||
endif()
|
||||
|
||||
if(XASH_AMD64)
|
||||
set(BUILDARCH "amd64")
|
||||
elseif(XASH_X86)
|
||||
if(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)
|
||||
set(BUILDARCH "") # no prefix for default OS
|
||||
else()
|
||||
set(BUILDARCH "i386")
|
||||
endif()
|
||||
elseif(XASH_ARM AND XASH_64BIT)
|
||||
set(BUILDARCH "arm64")
|
||||
elseif(XASH_ARM)
|
||||
set(BUILDARCH "armv")
|
||||
if(XASH_ARMv8)
|
||||
set(BUILDARCH "${BUILDARCH}8_32")
|
||||
elseif(XASH_ARMv7)
|
||||
set(BUILDARCH "${BUILDARCH}7")
|
||||
elseif(XASH_ARMv6)
|
||||
set(BUILDARCH "${BUILDARCH}6")
|
||||
elseif(XASH_ARMv5)
|
||||
set(BUILDARCH "${BUILDARCH}5")
|
||||
elseif(XASH_ARMv4)
|
||||
set(BUILDARCH "${BUILDARCH}4")
|
||||
else()
|
||||
message(SEND_ERROR "Unknown ARM")
|
||||
endif()
|
||||
|
||||
if(XASH_ARM_HARDFP)
|
||||
set(BUILDARCH "${BUILDARCH}hf")
|
||||
else()
|
||||
set(BUILDARCH "${BUILDARCH}l")
|
||||
endif()
|
||||
elseif(XASH_MIPS)
|
||||
set(BUILDARCH "mips")
|
||||
if(XASH_64BIT)
|
||||
set(BUILDARCH "${BUILDARCH}64")
|
||||
endif()
|
||||
|
||||
if(XASH_LITTLE_ENDIAN)
|
||||
set(BUILDARCH "${BUILDARCH}el")
|
||||
endif()
|
||||
elseif(XASH_RISCV)
|
||||
set(BUILDARCH "riscv")
|
||||
if(XASH_64BIT)
|
||||
set(BUILDARCH "${BUILDARCH}64")
|
||||
else()
|
||||
set(BUILDARCH "${BUILDARCH}32")
|
||||
endif()
|
||||
|
||||
if(XASH_RISCV_DOUBLEFP)
|
||||
set(BUILDARCH "${BUILDARCH}d")
|
||||
elseif(XASH_RISCV_SINGLEFP)
|
||||
set(BUILDARCH "${BUILDARCH}f")
|
||||
endif()
|
||||
elseif(XASH_JS)
|
||||
set(BUILDARCH "javascript")
|
||||
elseif(XASH_E2K)
|
||||
set(BUILDARCH "e2k")
|
||||
elseif(XASH_PPC)
|
||||
set(BUILDARCH "ppc")
|
||||
if(XASH_64BIT)
|
||||
set(BUILDARCH "${BUILDARCH}64")
|
||||
endif()
|
||||
|
||||
if(XASH_LITTLE_ENDIAN)
|
||||
set(BUILDARCH "${BUILDARCH}el")
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug")
|
||||
endif()
|
||||
|
||||
if(BUILDOS STREQUAL "android")
|
||||
set(POSTFIX "") # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming
|
||||
elseif(BUILDOS AND BUILDARCH)
|
||||
set(POSTFIX "_${BUILDOS}_${BUILDARCH}")
|
||||
elseif(BUILDARCH)
|
||||
set(POSTFIX "_${BUILDARCH}")
|
||||
else()
|
||||
set(POSTFIX "")
|
||||
endif()
|
||||
|
||||
message(STATUS "Library postfix: " ${POSTFIX})
|
@ -96,6 +96,12 @@
|
||||
// Goes into globalvars_t.trace_flags
|
||||
#define FTRACE_SIMPLEBOX BIT(0) // Traceline with a simple box
|
||||
|
||||
// Custom flags that we can retrive in pfnShouldCollide
|
||||
// Starting from BIT(16) to reserve space for more flags for Engine
|
||||
#define FTRACE_BULLET BIT(16)
|
||||
#define FTRACE_FLASH BIT(17)
|
||||
#define FTRACE_KNIFE BIT(18)
|
||||
|
||||
// walkmove modes
|
||||
#define WALKMOVE_NORMAL 0 // normal walkmove
|
||||
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
|
||||
@ -152,6 +158,11 @@
|
||||
#define EF_FORCEVISIBILITY BIT(11) // force visibility
|
||||
#define EF_OWNER_VISIBILITY BIT(12) // visibility for owner
|
||||
#define EF_OWNER_NO_VISIBILITY BIT(13) // no visibility for owner
|
||||
#define EF_NOSLERP BIT(14) // no slerp flag for this entity (addtofullpack)
|
||||
#define EF_FOLLOWKEEPRENDER BIT(15) // the entity following will not copy the render (like it follows nothing)
|
||||
|
||||
// Custom flags that aren't handled by the client
|
||||
#define EF_CUSTOM_BITS (EF_FORCEVISIBILITY | EF_OWNER_VISIBILITY | EF_OWNER_NO_VISIBILITY | EF_NOSLERP | EF_FOLLOWKEEPRENDER)
|
||||
|
||||
// state->eflags values
|
||||
#define EFLAG_SLERP 1 // do studio interpolation of this entity
|
||||
|
@ -1,15 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
void NORETURN Sys_Error(const char *error, ...);
|
||||
#if !defined(_WIN32) && !defined(BUILD_STATIC_LIBSTDC) // if build with static libstdc++ then ignore
|
||||
|
||||
// This file adds the necessary compatibility tricks to avoid symbols with
|
||||
// version GLIBCXX_3.4.16 and bigger, keeping binary compatibility with libstdc++ 4.6.1.
|
||||
namespace std
|
||||
{
|
||||
|
||||
#if __cpp_exceptions
|
||||
logic_error::logic_error(const char *__arg) : exception(), _M_msg(__arg) {}
|
||||
out_of_range::out_of_range(const char *__arg) : logic_error(__arg) {}
|
||||
out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {}
|
||||
#endif // #if __cpp_exceptions
|
||||
|
||||
// We shouldn't be throwing exceptions at all, but it sadly turns out we call STL (inline) functions that do.
|
||||
void __throw_out_of_range_fmt(const char *fmt, ...)
|
||||
{
|
||||
#if __cpp_exceptions
|
||||
va_list ap;
|
||||
char buf[1024]; // That should be big enough.
|
||||
|
||||
@ -18,34 +26,42 @@ namespace std
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
va_end(ap);
|
||||
|
||||
Sys_Error(buf);
|
||||
throw std::out_of_range(buf);
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
}; // namespace std
|
||||
|
||||
// Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8,
|
||||
// but that's equivalent, version-wise. Those calls are added by the compiler
|
||||
// Was added in GCC 4.9
|
||||
// Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, but that's equivalent, version-wise.
|
||||
// Those calls are added by the compiler
|
||||
// itself on `new Class[n]` calls.
|
||||
extern "C"
|
||||
void __cxa_throw_bad_array_new_length()
|
||||
{
|
||||
Sys_Error("Bad array new length.");
|
||||
#if __cpp_exceptions
|
||||
throw std::bad_array_new_length();
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201402L
|
||||
#if defined(__INTEL_COMPILER) && __cplusplus >= 201402L
|
||||
// This operator delete sized deallocations was added in c++14
|
||||
// and required at least not less than CXXABI_1.3.9
|
||||
// we should to keep CXXABI_1.3.8 for binary compatibility with oldest libstdc++.
|
||||
// G++ and clang allow to compile C++14 code with -fno-sized-deallocation to disable the new feature,
|
||||
// GCC and Clang allow to compile C++14 code with -fno-sized-deallocation to disable the new feature, but ICC isn't allow
|
||||
// so that our C++14 library code would never call that version of operator delete,
|
||||
// for other compilers we must override those operators for static linking to the library.
|
||||
// for ICC compiler we must override those operators for static linking to the library.
|
||||
void operator delete[](void *ptr, std::size_t size) noexcept
|
||||
{
|
||||
::operator delete(ptr);
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
void operator delete(void *ptr, std::size_t size) noexcept
|
||||
{
|
||||
::operator delete(ptr);
|
||||
::operator delete(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../ $*
|
||||
make
|
@ -30,31 +30,152 @@
|
||||
|
||||
CReGameHookchains g_ReGameHookchains;
|
||||
|
||||
int EXT_FUNC Cmd_Argc_api() {
|
||||
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||
{
|
||||
size_t len = Q_strlen(source);
|
||||
if (dest == nullptr || Q_strlen(dest) != len) {
|
||||
delete [] dest;
|
||||
dest = new char [len + 1];
|
||||
}
|
||||
|
||||
Q_strcpy(dest, source);
|
||||
}
|
||||
|
||||
void EXT_FUNC RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flRadius, iClassIgnore, bitsDamageType);
|
||||
}
|
||||
|
||||
void EXT_FUNC ClearMultiDamage_api()
|
||||
{
|
||||
ClearMultiDamage();
|
||||
}
|
||||
|
||||
void EXT_FUNC ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker)
|
||||
{
|
||||
ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
}
|
||||
|
||||
void EXT_FUNC AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType)
|
||||
{
|
||||
AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType);
|
||||
}
|
||||
|
||||
int EXT_FUNC Cmd_Argc_api()
|
||||
{
|
||||
return CMD_ARGC_();
|
||||
}
|
||||
|
||||
const char *EXT_FUNC Cmd_Argv_api(int i) {
|
||||
const char *EXT_FUNC Cmd_Argv_api(int i)
|
||||
{
|
||||
return CMD_ARGV_(i);
|
||||
}
|
||||
|
||||
CGrenade *EXT_FUNC PlantBomb_api(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity)
|
||||
{
|
||||
return CGrenade::ShootSatchelCharge(pevOwner, vecStart, vecVelocity);
|
||||
}
|
||||
|
||||
CGib *EXT_FUNC SpawnHeadGib_api(entvars_t *pevVictim)
|
||||
{
|
||||
return CGib::SpawnHeadGib(pevVictim);
|
||||
}
|
||||
|
||||
void EXT_FUNC SpawnRandomGibs_api(entvars_t *pevVictim, int cGibs, int human)
|
||||
{
|
||||
CGib::SpawnRandomGibs(pevVictim, cGibs, human);
|
||||
}
|
||||
|
||||
void EXT_FUNC UTIL_RestartOther_api(const char *szClassname)
|
||||
{
|
||||
UTIL_RestartOther(szClassname);
|
||||
}
|
||||
|
||||
void EXT_FUNC UTIL_ResetEntities_api()
|
||||
{
|
||||
UTIL_ResetEntities();
|
||||
}
|
||||
|
||||
void EXT_FUNC UTIL_RemoveOther_api(const char *szClassname, int nCount)
|
||||
{
|
||||
UTIL_RemoveOther(szClassname, nCount);
|
||||
}
|
||||
|
||||
void EXT_FUNC UTIL_DecalTrace_api(TraceResult *pTrace, int decalNumber)
|
||||
{
|
||||
UTIL_DecalTrace(pTrace, decalNumber);
|
||||
}
|
||||
|
||||
void EXT_FUNC UTIL_Remove_api(CBaseEntity *pEntity)
|
||||
{
|
||||
UTIL_Remove(pEntity);
|
||||
}
|
||||
|
||||
int EXT_FUNC AddAmmoNameToAmmoRegistry_api(const char *szAmmoname)
|
||||
{
|
||||
return AddAmmoNameToAmmoRegistry(szAmmoname);
|
||||
}
|
||||
|
||||
void EXT_FUNC TextureTypePlaySound_api(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType)
|
||||
{
|
||||
TEXTURETYPE_PlaySound(ptr, vecSrc, vecEnd, iBulletType);
|
||||
}
|
||||
|
||||
CWeaponBox *EXT_FUNC CreateWeaponBox_api(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo)
|
||||
{
|
||||
return CreateWeaponBox(pItem, pPlayerOwner, modelName, origin, angles, velocity, lifeTime < 0.0 ? CGameRules::GetItemKillDelay() : lifeTime, packAmmo);
|
||||
}
|
||||
|
||||
CGrenade *EXT_FUNC SpawnGrenade_api(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent)
|
||||
{
|
||||
switch (weaponId)
|
||||
{
|
||||
case WEAPON_HEGRENADE:
|
||||
return CGrenade::ShootTimed2(pevOwner, vecSrc, vecThrow, time, iTeam, usEvent);
|
||||
case WEAPON_FLASHBANG:
|
||||
return CGrenade::ShootTimed(pevOwner, vecSrc, vecThrow, time);
|
||||
case WEAPON_SMOKEGRENADE:
|
||||
return CGrenade::ShootSmokeGrenade(pevOwner, vecSrc, vecThrow, time, usEvent);
|
||||
case WEAPON_C4:
|
||||
return CGrenade::ShootSatchelCharge(pevOwner, vecSrc, vecThrow);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ReGameFuncs_t g_ReGameApiFuncs = {
|
||||
&CREATE_NAMED_ENTITY,
|
||||
CREATE_NAMED_ENTITY,
|
||||
|
||||
&Regamedll_ChangeString_api,
|
||||
Regamedll_ChangeString_api,
|
||||
|
||||
&RadiusDamage_api,
|
||||
&ClearMultiDamage_api,
|
||||
&ApplyMultiDamage_api,
|
||||
&AddMultiDamage_api,
|
||||
RadiusDamage_api,
|
||||
ClearMultiDamage_api,
|
||||
ApplyMultiDamage_api,
|
||||
AddMultiDamage_api,
|
||||
|
||||
&UTIL_FindEntityByString,
|
||||
UTIL_FindEntityByString,
|
||||
|
||||
&AddEntityHashValue,
|
||||
&RemoveEntityHashValue,
|
||||
AddEntityHashValue,
|
||||
RemoveEntityHashValue,
|
||||
|
||||
Cmd_Argc_api,
|
||||
Cmd_Argv_api
|
||||
Cmd_Argv_api,
|
||||
|
||||
PlantBomb_api,
|
||||
|
||||
SpawnHeadGib_api,
|
||||
SpawnRandomGibs_api,
|
||||
|
||||
UTIL_RestartOther_api,
|
||||
UTIL_ResetEntities_api,
|
||||
UTIL_RemoveOther_api,
|
||||
UTIL_DecalTrace_api,
|
||||
UTIL_Remove_api,
|
||||
|
||||
AddAmmoNameToAmmoRegistry_api,
|
||||
TextureTypePlaySound_api,
|
||||
CreateWeaponBox_api,
|
||||
SpawnGrenade_api,
|
||||
};
|
||||
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_Spawn);
|
||||
@ -176,6 +297,48 @@ GAMEHOOK_REGISTRY(CGib_Spawn);
|
||||
GAMEHOOK_REGISTRY(CGib_BounceGibTouch);
|
||||
GAMEHOOK_REGISTRY(CGib_WaitTillLand);
|
||||
|
||||
GAMEHOOK_REGISTRY(CBaseEntity_FireBullets);
|
||||
GAMEHOOK_REGISTRY(CBaseEntity_FireBuckshots);
|
||||
GAMEHOOK_REGISTRY(CBaseEntity_FireBullets3);
|
||||
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_Observer_SetMode);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_Observer_FindNextPlayer);
|
||||
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_Pain);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink);
|
||||
|
||||
GAMEHOOK_REGISTRY(FreeGameRules);
|
||||
GAMEHOOK_REGISTRY(PM_LadderMove);
|
||||
GAMEHOOK_REGISTRY(PM_WaterJump);
|
||||
GAMEHOOK_REGISTRY(PM_CheckWaterJump);
|
||||
GAMEHOOK_REGISTRY(PM_Jump);
|
||||
GAMEHOOK_REGISTRY(PM_Duck);
|
||||
GAMEHOOK_REGISTRY(PM_UnDuck);
|
||||
GAMEHOOK_REGISTRY(PM_PlayStepSound);
|
||||
GAMEHOOK_REGISTRY(PM_AirAccelerate);
|
||||
GAMEHOOK_REGISTRY(ClearMultiDamage);
|
||||
GAMEHOOK_REGISTRY(AddMultiDamage);
|
||||
GAMEHOOK_REGISTRY(ApplyMultiDamage);
|
||||
GAMEHOOK_REGISTRY(BuyItem);
|
||||
GAMEHOOK_REGISTRY(CSGameRules_Think);
|
||||
GAMEHOOK_REGISTRY(CSGameRules_TeamFull);
|
||||
GAMEHOOK_REGISTRY(CSGameRules_TeamStacked);
|
||||
GAMEHOOK_REGISTRY(CSGameRules_PlayerGotWeapon);
|
||||
GAMEHOOK_REGISTRY(CBotManager_OnEvent);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_CheckTimeBasedDamage);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_EntSelectSpawnPoint);
|
||||
GAMEHOOK_REGISTRY(CBasePlayerWeapon_ItemPostFrame);
|
||||
GAMEHOOK_REGISTRY(CBasePlayerWeapon_KickBack);
|
||||
GAMEHOOK_REGISTRY(CBasePlayerWeapon_SendWeaponAnim);
|
||||
GAMEHOOK_REGISTRY(CSGameRules_SendDeathMessage);
|
||||
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_PlayerDeathThink);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_Observer_Think);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_RemoveAllItems);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_UpdateStatusBar);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_TakeDamageImpulse);
|
||||
|
||||
int CReGameApi::GetMajorVersion() {
|
||||
return REGAMEDLL_API_VERSION_MAJOR;
|
||||
}
|
||||
@ -237,35 +400,4 @@ bool CReGameApi::BGetIGameRules(const char *pchVersion) const
|
||||
return false;
|
||||
}
|
||||
|
||||
EXT_FUNC void Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||
{
|
||||
size_t len = Q_strlen(source);
|
||||
if (dest == nullptr || Q_strlen(dest) != len) {
|
||||
delete [] dest;
|
||||
dest = new char [len + 1];
|
||||
}
|
||||
|
||||
Q_strcpy(dest, source);
|
||||
}
|
||||
|
||||
EXT_FUNC void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flRadius, iClassIgnore, bitsDamageType);
|
||||
}
|
||||
|
||||
EXT_FUNC void ClearMultiDamage_api()
|
||||
{
|
||||
ClearMultiDamage();
|
||||
}
|
||||
|
||||
EXT_FUNC void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker)
|
||||
{
|
||||
ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
}
|
||||
|
||||
EXT_FUNC void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType)
|
||||
{
|
||||
AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType);
|
||||
}
|
||||
|
||||
EXPOSE_SINGLE_INTERFACE(CReGameApi, IReGameApi, VRE_GAMEDLL_API_VERSION);
|
||||
|
@ -100,11 +100,21 @@
|
||||
g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_VOID_CHAIN2(functionName)\
|
||||
void functionName() {\
|
||||
g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CHAIN(ret, functionName, args, ...)\
|
||||
ret functionName args {\
|
||||
return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CHAIN2(ret, functionName)\
|
||||
ret functionName() {\
|
||||
return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_GLOB_CLASS_VOID_CHAIN(className, functionName, args, ...)\
|
||||
void className::functionName args {\
|
||||
g_ReGameHookchains.m_##functionName.callChain(className::functionName##_OrigFunc, __VA_ARGS__);\
|
||||
@ -120,16 +130,7 @@
|
||||
return g_ReGameHookchains.m_##customFuncName.callChain(functionName##_OrigFunc, __VA_ARGS__);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_VOID_CHAIN2(functionName)\
|
||||
void functionName() {\
|
||||
g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CHAIN2(ret, functionName)\
|
||||
ret functionName() {\
|
||||
return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
#else
|
||||
#else // REGAMEDLL_API
|
||||
|
||||
#define __API_HOOK(fname)\
|
||||
fname
|
||||
@ -141,14 +142,19 @@
|
||||
#define LINK_HOOK_CLASS_CHAIN3(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM2_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM2_CHAIN2(...)
|
||||
#define LINK_HOOK_VOID_CHAIN(...)
|
||||
#define LINK_HOOK_VOID_CHAIN2(...)
|
||||
#define LINK_HOOK_CHAIN(...)
|
||||
#define LINK_HOOK_CHAIN2(...)
|
||||
#define LINK_HOOK_GLOB_CLASS_VOID_CHAIN(...)
|
||||
#define LINK_HOOK_GLOB_CLASS_CHAIN(...)
|
||||
#define LINK_HOOK_CUSTOM2_CHAIN(...)
|
||||
|
||||
#endif // REGAMEDLL_API
|
||||
|
||||
@ -452,8 +458,8 @@ typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRu
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_RemoveGuns;
|
||||
|
||||
// CHalfLifeMultiplay::GiveC4 hook
|
||||
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRules_GiveC4;
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GiveC4;
|
||||
typedef IHookChainClassImpl<CBasePlayer *, class CHalfLifeMultiplay> CReGameHook_CSGameRules_GiveC4;
|
||||
typedef IHookChainRegistryClassEmptyImpl<CBasePlayer *, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GiveC4;
|
||||
|
||||
// CHalfLifeMultiplay::ChangeLevel hook
|
||||
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRules_ChangeLevel;
|
||||
@ -603,6 +609,154 @@ typedef IHookChainRegistryClassImpl<void, class CGib, CBaseEntity *> CReGameHook
|
||||
typedef IHookChainClassImpl<void, class CGib> CReGameHook_CGib_WaitTillLand;
|
||||
typedef IHookChainRegistryClassImpl<void, class CGib> CReGameHookRegistry_CGib_WaitTillLand;
|
||||
|
||||
// CBaseEntity::FireBullets hook
|
||||
typedef IHookChainClassImpl<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, int, entvars_t *> CReGameHook_CBaseEntity_FireBullets;
|
||||
typedef IHookChainRegistryClassImpl<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, int, entvars_t *> CReGameHookRegistry_CBaseEntity_FireBullets;
|
||||
|
||||
// CBaseEntity::FireBuckshots hook
|
||||
typedef IHookChainClassImpl<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, entvars_t *> CReGameHook_CBaseEntity_FireBuckshots;
|
||||
typedef IHookChainRegistryClassImpl<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, entvars_t *> CReGameHookRegistry_CBaseEntity_FireBuckshots;
|
||||
|
||||
// CBaseEntity::FireBullets3 hook
|
||||
typedef IHookChainClassImpl<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> CReGameHook_CBaseEntity_FireBullets3;
|
||||
typedef IHookChainRegistryClassImpl<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> CReGameHookRegistry_CBaseEntity_FireBullets3;
|
||||
|
||||
// CBasePlayer::Observer_SetMode hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer, int> CReGameHook_CBasePlayer_Observer_SetMode;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int> CReGameHookRegistry_CBasePlayer_Observer_SetMode;
|
||||
|
||||
// CBasePlayer::Observer_FindNextPlayer hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer, bool, const char *> CReGameHook_CBasePlayer_Observer_FindNextPlayer;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer, bool, const char *> CReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer;
|
||||
|
||||
// CBasePlayer::Pain hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer, int, bool> CReGameHook_CBasePlayer_Pain;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int, bool> CReGameHookRegistry_CBasePlayer_Pain;
|
||||
|
||||
// CBasePlayer::DeathSound hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_DeathSound;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_DeathSound;
|
||||
|
||||
// CBasePlayer::JoiningThink hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_JoiningThink;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_JoiningThink;
|
||||
|
||||
// FreeGameRules hook
|
||||
typedef IHookChainImpl<void, CGameRules **> CReGameHook_FreeGameRules;
|
||||
typedef IHookChainRegistryImpl<void, CGameRules **> CReGameHookRegistry_FreeGameRules;
|
||||
|
||||
// PM_LadderMove hook
|
||||
typedef IHookChainImpl<void, struct physent_s *> CReGameHook_PM_LadderMove;
|
||||
typedef IHookChainRegistryImpl<void, struct physent_s *> CReGameHookRegistry_PM_LadderMove;
|
||||
|
||||
// PM_WaterJump hook
|
||||
typedef IHookChainImpl<void> CReGameHook_PM_WaterJump;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_WaterJump;
|
||||
|
||||
// PM_CheckWaterJump hook
|
||||
typedef IHookChainImpl<void> CReGameHook_PM_CheckWaterJump;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_CheckWaterJump;
|
||||
|
||||
// PM_Jump hook
|
||||
typedef IHookChainImpl<void> CReGameHook_PM_Jump;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_Jump;
|
||||
|
||||
// PM_Duck hook
|
||||
typedef IHookChainImpl<void> CReGameHook_PM_Duck;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_Duck;
|
||||
|
||||
// PM_UnDuck hook
|
||||
typedef IHookChainImpl<void> CReGameHook_PM_UnDuck;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_UnDuck;
|
||||
|
||||
// PM_PlayStepSound hook
|
||||
typedef IHookChainImpl<void, int, float> CReGameHook_PM_PlayStepSound;
|
||||
typedef IHookChainRegistryImpl<void, int, float> CReGameHookRegistry_PM_PlayStepSound;
|
||||
|
||||
// PM_AirAccelerate hook
|
||||
typedef IHookChainImpl<void, vec_t *, float, float> CReGameHook_PM_AirAccelerate;
|
||||
typedef IHookChainRegistryImpl<void, vec_t *, float, float> CReGameHookRegistry_PM_AirAccelerate;
|
||||
|
||||
// ClearMultiDamage hook
|
||||
typedef IHookChainImpl<void> CReGameHook_ClearMultiDamage;
|
||||
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_ClearMultiDamage;
|
||||
|
||||
// AddMultiDamage hook
|
||||
typedef IHookChainImpl<void, entvars_t *, CBaseEntity *, float, int> CReGameHook_AddMultiDamage;
|
||||
typedef IHookChainRegistryImpl<void, entvars_t *, CBaseEntity *, float, int> CReGameHookRegistry_AddMultiDamage;
|
||||
|
||||
// ApplyMultiDamage hook
|
||||
typedef IHookChainImpl<void, entvars_t *, entvars_t *> CReGameHook_ApplyMultiDamage;
|
||||
typedef IHookChainRegistryImpl<void, entvars_t *, entvars_t *> CReGameHookRegistry_ApplyMultiDamage;
|
||||
|
||||
// BuyItem hook
|
||||
typedef IHookChainImpl<void, CBasePlayer *, int> CReGameHook_BuyItem;
|
||||
typedef IHookChainRegistryImpl<void, CBasePlayer *, int> CReGameHookRegistry_BuyItem;
|
||||
|
||||
// CHalfLifeMultiplay::Think hook
|
||||
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay> CReGameHook_CSGameRules_Think;
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_Think;
|
||||
|
||||
// CHalfLifeMultiplay::TeamFull hook
|
||||
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, int> CReGameHook_CSGameRules_TeamFull;
|
||||
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, int> CReGameHookRegistry_CSGameRules_TeamFull;
|
||||
|
||||
// CHalfLifeMultiplay::TeamStacked hook
|
||||
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, int, int> CReGameHook_CSGameRules_TeamStacked;
|
||||
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, int, int> CReGameHookRegistry_CSGameRules_TeamStacked;
|
||||
|
||||
// CHalfLifeMultiplay::PlayerGotWeapon hook
|
||||
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_PlayerGotWeapon;
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_PlayerGotWeapon;
|
||||
|
||||
// CHalfLifeMultiplay::SendDeathMessage hook
|
||||
typedef IHookChainClassImpl<void, class CHalfLifeMultiplay, CBaseEntity *, CBasePlayer *, CBasePlayer *, entvars_t *, const char *, int, int> CReGameHook_CSGameRules_SendDeathMessage;
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, class CHalfLifeMultiplay, CBaseEntity *, CBasePlayer *, CBasePlayer *, entvars_t *, const char *, int, int> CReGameHookRegistry_CSGameRules_SendDeathMessage;
|
||||
|
||||
// CBotManager::OnEvent hook
|
||||
typedef IHookChainClassImpl<void, CBotManager, GameEventType, CBaseEntity *, CBaseEntity *> CReGameHook_CBotManager_OnEvent;
|
||||
typedef IHookChainRegistryClassEmptyImpl<void, CBotManager, GameEventType, CBaseEntity*, CBaseEntity*> CReGameHookRegistry_CBotManager_OnEvent;
|
||||
|
||||
// CBasePlayer::CheckTimeBasedDamage hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_CheckTimeBasedDamage;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage;
|
||||
|
||||
// CBasePlayer::EntSelectSpawnPoint hook
|
||||
typedef IHookChainClassImpl<edict_t *, CBasePlayer> CReGameHook_CBasePlayer_EntSelectSpawnPoint;
|
||||
typedef IHookChainRegistryClassImpl<edict_t *, CBasePlayer> CReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint;
|
||||
|
||||
// CBasePlayerWeapon::ItemPostFrame hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayerWeapon> CReGameHook_CBasePlayerWeapon_ItemPostFrame;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayerWeapon> CReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame;
|
||||
|
||||
// CBasePlayerWeapon::KickBack hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayerWeapon, float, float, float, float, float, float, int> CReGameHook_CBasePlayerWeapon_KickBack;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayerWeapon, float, float, float, float, float, float, int> CReGameHookRegistry_CBasePlayerWeapon_KickBack;
|
||||
|
||||
// CBasePlayerWeapon::SendWeaponAnim hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayerWeapon, int, int> CReGameHook_CBasePlayerWeapon_SendWeaponAnim;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayerWeapon, int, int> CReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim;
|
||||
|
||||
// CBasePlayer::PlayerDeathThink hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_PlayerDeathThink;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_PlayerDeathThink;
|
||||
|
||||
// CBasePlayer::Observer_Think hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_Observer_Think;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_Observer_Think;
|
||||
|
||||
// CBasePlayer::RemoveAllItems hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer, BOOL> CReGameHook_CBasePlayer_RemoveAllItems;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer, BOOL> CReGameHookRegistry_CBasePlayer_RemoveAllItems;
|
||||
|
||||
// CBasePlayer::UpdateStatusBar hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_UpdateStatusBar;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_UpdateStatusBar;
|
||||
|
||||
// CBasePlayer::TakeDamageImpulse hook
|
||||
typedef IHookChainClassImpl<void, CBasePlayer, CBasePlayer *, float, float> CReGameHook_CBasePlayer_TakeDamageImpulse;
|
||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer, CBasePlayer *, float, float> CReGameHookRegistry_CBasePlayer_TakeDamageImpulse;
|
||||
|
||||
class CReGameHookchains: public IReGameHookchains {
|
||||
public:
|
||||
// CBasePlayer virtual
|
||||
@ -725,6 +879,48 @@ public:
|
||||
CReGameHookRegistry_CGib_BounceGibTouch m_CGib_BounceGibTouch;
|
||||
CReGameHookRegistry_CGib_WaitTillLand m_CGib_WaitTillLand;
|
||||
|
||||
CReGameHookRegistry_CBaseEntity_FireBullets m_CBaseEntity_FireBullets;
|
||||
CReGameHookRegistry_CBaseEntity_FireBuckshots m_CBaseEntity_FireBuckshots;
|
||||
CReGameHookRegistry_CBaseEntity_FireBullets3 m_CBaseEntity_FireBullets3;
|
||||
|
||||
CReGameHookRegistry_CBasePlayer_Observer_SetMode m_CBasePlayer_Observer_SetMode;
|
||||
CReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer m_CBasePlayer_Observer_FindNextPlayer;
|
||||
|
||||
CReGameHookRegistry_CBasePlayer_Pain m_CBasePlayer_Pain;
|
||||
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
|
||||
CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink;
|
||||
|
||||
CReGameHookRegistry_FreeGameRules m_FreeGameRules;
|
||||
CReGameHookRegistry_PM_LadderMove m_PM_LadderMove;
|
||||
CReGameHookRegistry_PM_WaterJump m_PM_WaterJump;
|
||||
CReGameHookRegistry_PM_CheckWaterJump m_PM_CheckWaterJump;
|
||||
CReGameHookRegistry_PM_Jump m_PM_Jump;
|
||||
CReGameHookRegistry_PM_Duck m_PM_Duck;
|
||||
CReGameHookRegistry_PM_UnDuck m_PM_UnDuck;
|
||||
CReGameHookRegistry_PM_PlayStepSound m_PM_PlayStepSound;
|
||||
CReGameHookRegistry_PM_AirAccelerate m_PM_AirAccelerate;
|
||||
CReGameHookRegistry_ClearMultiDamage m_ClearMultiDamage;
|
||||
CReGameHookRegistry_AddMultiDamage m_AddMultiDamage;
|
||||
CReGameHookRegistry_ApplyMultiDamage m_ApplyMultiDamage;
|
||||
CReGameHookRegistry_BuyItem m_BuyItem;
|
||||
CReGameHookRegistry_CSGameRules_Think m_CSGameRules_Think;
|
||||
CReGameHookRegistry_CSGameRules_TeamFull m_CSGameRules_TeamFull;
|
||||
CReGameHookRegistry_CSGameRules_TeamStacked m_CSGameRules_TeamStacked;
|
||||
CReGameHookRegistry_CSGameRules_PlayerGotWeapon m_CSGameRules_PlayerGotWeapon;
|
||||
CReGameHookRegistry_CBotManager_OnEvent m_CBotManager_OnEvent;
|
||||
CReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage m_CBasePlayer_CheckTimeBasedDamage;
|
||||
CReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint m_CBasePlayer_EntSelectSpawnPoint;
|
||||
CReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame m_CBasePlayerWeapon_ItemPostFrame;
|
||||
CReGameHookRegistry_CBasePlayerWeapon_KickBack m_CBasePlayerWeapon_KickBack;
|
||||
CReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim m_CBasePlayerWeapon_SendWeaponAnim;
|
||||
CReGameHookRegistry_CSGameRules_SendDeathMessage m_CSGameRules_SendDeathMessage;
|
||||
|
||||
CReGameHookRegistry_CBasePlayer_PlayerDeathThink m_CBasePlayer_PlayerDeathThink;
|
||||
CReGameHookRegistry_CBasePlayer_Observer_Think m_CBasePlayer_Observer_Think;
|
||||
CReGameHookRegistry_CBasePlayer_RemoveAllItems m_CBasePlayer_RemoveAllItems;
|
||||
CReGameHookRegistry_CBasePlayer_UpdateStatusBar m_CBasePlayer_UpdateStatusBar;
|
||||
CReGameHookRegistry_CBasePlayer_TakeDamageImpulse m_CBasePlayer_TakeDamageImpulse;
|
||||
|
||||
public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
|
||||
virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache();
|
||||
@ -844,6 +1040,48 @@ public:
|
||||
virtual IReGameHookRegistry_CGib_Spawn *CGib_Spawn();
|
||||
virtual IReGameHookRegistry_CGib_BounceGibTouch *CGib_BounceGibTouch();
|
||||
virtual IReGameHookRegistry_CGib_WaitTillLand *CGib_WaitTillLand();
|
||||
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBullets *CBaseEntity_FireBullets();
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBuckshots *CBaseEntity_FireBuckshots();
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3();
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode();
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer *CBasePlayer_Observer_FindNextPlayer();
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
|
||||
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();
|
||||
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink();
|
||||
|
||||
virtual IReGameHookRegistry_FreeGameRules *FreeGameRules();
|
||||
virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove();
|
||||
virtual IReGameHookRegistry_PM_WaterJump *PM_WaterJump();
|
||||
virtual IReGameHookRegistry_PM_CheckWaterJump *PM_CheckWaterJump();
|
||||
virtual IReGameHookRegistry_PM_Jump *PM_Jump();
|
||||
virtual IReGameHookRegistry_PM_Duck *PM_Duck();
|
||||
virtual IReGameHookRegistry_PM_UnDuck *PM_UnDuck();
|
||||
virtual IReGameHookRegistry_PM_PlayStepSound *PM_PlayStepSound();
|
||||
virtual IReGameHookRegistry_PM_AirAccelerate *PM_AirAccelerate();
|
||||
virtual IReGameHookRegistry_ClearMultiDamage *ClearMultiDamage();
|
||||
virtual IReGameHookRegistry_AddMultiDamage *AddMultiDamage();
|
||||
virtual IReGameHookRegistry_ApplyMultiDamage *ApplyMultiDamage();
|
||||
virtual IReGameHookRegistry_BuyItem *BuyItem();
|
||||
virtual IReGameHookRegistry_CSGameRules_Think *CSGameRules_Think();
|
||||
virtual IReGameHookRegistry_CSGameRules_TeamFull *CSGameRules_TeamFull();
|
||||
virtual IReGameHookRegistry_CSGameRules_TeamStacked *CSGameRules_TeamStacked();
|
||||
virtual IReGameHookRegistry_CSGameRules_PlayerGotWeapon *CSGameRules_PlayerGotWeapon();
|
||||
virtual IReGameHookRegistry_CBotManager_OnEvent *CBotManager_OnEvent();
|
||||
virtual IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage *CBasePlayer_CheckTimeBasedDamage();
|
||||
virtual IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint *CBasePlayer_EntSelectSpawnPoint();
|
||||
virtual IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame *CBasePlayerWeapon_ItemPostFrame();
|
||||
virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack();
|
||||
virtual IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim *CBasePlayerWeapon_SendWeaponAnim();
|
||||
virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage();
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink();
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think();
|
||||
virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems();
|
||||
virtual IReGameHookRegistry_CBasePlayer_UpdateStatusBar *CBasePlayer_UpdateStatusBar();
|
||||
virtual IReGameHookRegistry_CBasePlayer_TakeDamageImpulse *CBasePlayer_TakeDamageImpulse();
|
||||
};
|
||||
|
||||
extern CReGameHookchains g_ReGameHookchains;
|
||||
@ -870,10 +1108,3 @@ public:
|
||||
EXT_FUNC virtual bool BGetICSEntity(const char *pchVersion) const;
|
||||
EXT_FUNC virtual bool BGetIGameRules(const char *pchVersion) const;
|
||||
};
|
||||
|
||||
void Regamedll_ChangeString_api(char *&dest, const char *source);
|
||||
void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
|
||||
|
||||
void ClearMultiDamage_api();
|
||||
void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker);
|
||||
void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
|
||||
|
@ -30,10 +30,15 @@
|
||||
|
||||
void CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
|
||||
{
|
||||
m_pContainingEntity->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
|
||||
BaseEntity()->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
|
||||
}
|
||||
|
||||
void CCSEntity::FireBuckshots(ULONG cShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
|
||||
{
|
||||
BaseEntity()->FireBuckshots(cShots, vecSrc, vecDirShooting, vecSpread, flDistance, iTracerFreq, iDamage, pevAttacker);
|
||||
}
|
||||
|
||||
Vector CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand)
|
||||
{
|
||||
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||
return BaseEntity()->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
|
||||
pPlayer->pev->deadflag = DEAD_DEAD;
|
||||
pPlayer->pev->health = 0;
|
||||
|
||||
if (pPlayer->m_bHasC4)
|
||||
pPlayer->DropPlayerItem("weapon_c4");
|
||||
|
||||
pPlayer->RemoveAllItems(TRUE);
|
||||
pPlayer->m_bHasC4 = false;
|
||||
|
||||
pPlayer->m_iTeam = SPECTATOR;
|
||||
pPlayer->m_iJoiningState = JOINED;
|
||||
@ -58,7 +60,7 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
|
||||
pPlayer->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles);
|
||||
|
||||
// do we have fadetoblack on? (need to fade their screen back in)
|
||||
if (fadetoblack.value)
|
||||
if (fadetoblack.value == FADETOBLACK_STAY)
|
||||
{
|
||||
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN);
|
||||
}
|
||||
@ -112,8 +114,10 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
|
||||
|
||||
if (pPlayer->pev->deadflag == DEAD_NO)
|
||||
{
|
||||
ClientKill(pPlayer->edict());
|
||||
pPlayer->pev->frags++;
|
||||
if (pPlayer->Kill())
|
||||
{
|
||||
pPlayer->pev->frags++;
|
||||
}
|
||||
}
|
||||
|
||||
MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo);
|
||||
@ -151,15 +155,7 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemov
|
||||
if (!pPlayer->m_bHasDefuser)
|
||||
return false;
|
||||
|
||||
pPlayer->m_bHasDefuser = false;
|
||||
pPlayer->pev->body = 0;
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("defuser");
|
||||
MESSAGE_END();
|
||||
|
||||
pPlayer->SendItemStatus();
|
||||
pPlayer->RemoveDefuser();
|
||||
}
|
||||
// item_longjump
|
||||
else if (FStrEq(pszItemName, "longjump"))
|
||||
@ -209,39 +205,34 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemov
|
||||
auto pItem = GetItemByName(pszItemName);
|
||||
if (pItem)
|
||||
{
|
||||
if (FClassnameIs(pItem->pev, "weapon_c4")) {
|
||||
pPlayer->m_bHasC4 = false;
|
||||
pPlayer->pev->body = 0;
|
||||
pPlayer->SetBombIcon(FALSE);
|
||||
pPlayer->SetProgressBarTime(0);
|
||||
}
|
||||
|
||||
if (pItem->IsWeapon())
|
||||
{
|
||||
if (pItem == pPlayer->m_pActiveItem) {
|
||||
((CBasePlayerWeapon *)pItem)->RetireWeapon();
|
||||
// These weapons have a unique type of ammo that is used only by them
|
||||
// If a weapon is removed, its ammo is also reduced, unless the ammo can be used by another weapon
|
||||
if (!bRemoveAmmo && (IsGrenadeWeapon(pItem->m_iId) || pItem->m_iId == WEAPON_C4))
|
||||
{
|
||||
if (pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] > 0)
|
||||
pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]--;
|
||||
|
||||
// Hold the weapon until it runs out of ammo
|
||||
if (pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] > 0)
|
||||
return true; // ammo was reduced, this will be considered a successful result
|
||||
}
|
||||
|
||||
if (bRemoveAmmo) {
|
||||
pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ] = 0;
|
||||
pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0;
|
||||
}
|
||||
|
||||
if (pItem == pPlayer->m_pActiveItem) {
|
||||
((CBasePlayerWeapon *)pItem)->RetireWeapon();
|
||||
|
||||
if (pItem->CanHolster() && pItem != pPlayer->m_pActiveItem && !(pPlayer->pev->weapons &(1 << pItem->m_iId))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pPlayer->RemovePlayerItem(pItem)) {
|
||||
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
|
||||
// No more weapon
|
||||
if ((pPlayer->pev->weapons & ~(1 << WEAPON_SUIT)) == 0) {
|
||||
pPlayer->m_iHideHUD |= HIDEHUD_WEAPONS;
|
||||
}
|
||||
|
||||
pItem->Kill();
|
||||
|
||||
if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
|
||||
pPlayer->m_bHasPrimary = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return pItem->DestroyItem();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -258,11 +249,13 @@ EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItemEx(const char *pszName)
|
||||
|
||||
if (FStrEq(pszName, "weapon_c4")) {
|
||||
pPlayer->m_bHasC4 = true;
|
||||
pPlayer->SetBombIcon();
|
||||
|
||||
if (pPlayer->m_iTeam == TERRORIST) {
|
||||
pPlayer->pev->body = 1;
|
||||
}
|
||||
|
||||
pPlayer->SetBombIcon();
|
||||
|
||||
} else if (FStrEq(pszName, "weapon_shield")) {
|
||||
pPlayer->DropPrimary();
|
||||
pPlayer->DropPlayerItem("weapon_elite");
|
||||
@ -275,7 +268,7 @@ EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItemEx(const char *pszName)
|
||||
|
||||
EXT_FUNC bool CCSPlayer::IsConnected() const
|
||||
{
|
||||
return m_pContainingEntity->has_disconnected == false;
|
||||
return BaseEntity()->has_disconnected == false;
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim)
|
||||
@ -303,14 +296,14 @@ EXT_FUNC void CCSPlayer::GiveShield(bool bDeploy)
|
||||
BasePlayer()->GiveShield(bDeploy);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropShield(bool bDeploy)
|
||||
EXT_FUNC CBaseEntity *CCSPlayer::DropShield(bool bDeploy)
|
||||
{
|
||||
BasePlayer()->DropShield(bDeploy);
|
||||
return BasePlayer()->DropShield(bDeploy);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropPlayerItem(const char *pszItemName)
|
||||
EXT_FUNC CBaseEntity *CCSPlayer::DropPlayerItem(const char *pszItemName)
|
||||
{
|
||||
BasePlayer()->DropPlayerItem(pszItemName);
|
||||
return BasePlayer()->DropPlayerItem(pszItemName);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::RemoveShield()
|
||||
@ -419,6 +412,11 @@ EXT_FUNC void CCSPlayer::Observer_SetMode(int iMode)
|
||||
BasePlayer()->Observer_SetMode(iMode);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::Observer_FindNextPlayer(bool bReverse, const char *name)
|
||||
{
|
||||
BasePlayer()->Observer_FindNextPlayer(bReverse, name);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot)
|
||||
{
|
||||
return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot);
|
||||
@ -514,6 +512,21 @@ EXT_FUNC bool CCSPlayer::HintMessageEx(const char *pMessage, float duration, boo
|
||||
return BasePlayer()->HintMessageEx(pMessage, duration, bDisplayIfPlayerDead, bOverride);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::Reset()
|
||||
{
|
||||
BasePlayer()->Reset();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::OnSpawnEquip(bool addDefault, bool equipGame)
|
||||
{
|
||||
BasePlayer()->OnSpawnEquip(addDefault, equipGame);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetScoreboardAttributes(CBasePlayer *destination)
|
||||
{
|
||||
BasePlayer()->SetScoreboardAttributes(destination);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::CheckActivityInGame()
|
||||
{
|
||||
const CBasePlayer* pPlayer = BasePlayer();
|
||||
@ -526,7 +539,12 @@ EXT_FUNC bool CCSPlayer::CheckActivityInGame()
|
||||
return (fabs(deltaYaw) >= 0.1f && fabs(deltaPitch) >= 0.1f);
|
||||
}
|
||||
|
||||
void CCSPlayer::Reset()
|
||||
EXT_FUNC void CCSPlayer::TakeDamageImpulse(CBasePlayer *pAttacker, float flKnockbackForce, float flVelModifier)
|
||||
{
|
||||
BasePlayer()->TakeDamageImpulse(pAttacker, flKnockbackForce, flVelModifier);
|
||||
}
|
||||
|
||||
void CCSPlayer::ResetVars()
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
|
||||
@ -539,12 +557,29 @@ void CCSPlayer::Reset()
|
||||
m_iWeaponInfiniteIds = 0;
|
||||
m_bCanShootOverride = false;
|
||||
m_bGameForcingRespawn = false;
|
||||
m_bAutoBunnyHopping = false;
|
||||
m_bMegaBunnyJumping = false;
|
||||
m_bSpawnProtectionEffects = false;
|
||||
}
|
||||
|
||||
// Resets all stats
|
||||
void CCSPlayer::ResetAllStats()
|
||||
{
|
||||
// Resets the kill history for this player
|
||||
for (int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
m_iNumKilledByUnanswered[i] = 0;
|
||||
m_bPlayerDominated[i] = false;
|
||||
}
|
||||
|
||||
m_DamageList.Clear();
|
||||
}
|
||||
|
||||
void CCSPlayer::OnSpawn()
|
||||
{
|
||||
m_bGameForcingRespawn = false;
|
||||
m_flRespawnPending = 0.0f;
|
||||
m_DamageList.Clear();
|
||||
}
|
||||
|
||||
void CCSPlayer::OnKilled()
|
||||
@ -562,3 +597,34 @@ void CCSPlayer::OnKilled()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCSPlayer::OnConnect()
|
||||
{
|
||||
ResetVars();
|
||||
ResetAllStats();
|
||||
m_iUserID = GETPLAYERUSERID(BasePlayer()->edict());
|
||||
}
|
||||
|
||||
// Remember this amount of damage that we dealt for stats
|
||||
void CCSPlayer::RecordDamage(CBasePlayer *pAttacker, float flDamage, float flFlashDurationTime)
|
||||
{
|
||||
if (!pAttacker || !pAttacker->IsPlayer())
|
||||
return;
|
||||
|
||||
int attackerIndex = pAttacker->entindex() - 1;
|
||||
if (attackerIndex < 0 || attackerIndex >= MAX_CLIENTS)
|
||||
return;
|
||||
|
||||
CCSPlayer *pCSAttacker = pAttacker->CSPlayer();
|
||||
|
||||
// Accumulate damage
|
||||
CDamageRecord_t &record = m_DamageList[attackerIndex];
|
||||
if (record.flDamage > 0 && record.userId != pCSAttacker->m_iUserID)
|
||||
record.flDamage = 0; // reset damage if attacker became another client
|
||||
|
||||
record.flDamage += flDamage;
|
||||
record.userId = pCSAttacker->m_iUserID;
|
||||
|
||||
if (flFlashDurationTime > 0)
|
||||
record.flFlashDurationTime = gpGlobals->time + flFlashDurationTime;
|
||||
}
|
||||
|
54
regamedll/dlls/API/CSPlayerWeapon.cpp
Normal file
54
regamedll/dlls/API/CSPlayerWeapon.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
EXT_FUNC BOOL CCSPlayerWeapon::DefaultDeploy(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal)
|
||||
{
|
||||
return BasePlayerWeapon()->DefaultDeploy(szViewModel, szWeaponModel, iAnim, szAnimExt, skiplocal);
|
||||
}
|
||||
|
||||
EXT_FUNC int CCSPlayerWeapon::DefaultReload(int iClipSize, int iAnim, float fDelay)
|
||||
{
|
||||
return BasePlayerWeapon()->DefaultReload(iClipSize, iAnim, fDelay);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayerWeapon::DefaultShotgunReload(int iAnim, int iStartAnim, float fDelay, float fStartDelay, const char *pszReloadSound1, const char *pszReloadSound2)
|
||||
{
|
||||
return BasePlayerWeapon()->DefaultShotgunReload(iAnim, iStartAnim, fDelay, fStartDelay, pszReloadSound1, pszReloadSound2);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change)
|
||||
{
|
||||
BasePlayerWeapon()->KickBack(up_base, lateral_base, up_modifier, lateral_modifier, up_max, lateral_max, direction_change);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayerWeapon::SendWeaponAnim(int iAnim, int skiplocal)
|
||||
{
|
||||
BasePlayerWeapon()->SendWeaponAnim(iAnim, skiplocal);
|
||||
}
|
@ -57,12 +57,13 @@ void CItemAirBox::Touch(CBaseEntity *pOther)
|
||||
CArmoury::Touch(pOther);
|
||||
|
||||
// airbox was picked up, so sprite to turn off
|
||||
if ((pev->effects & EF_NODRAW) == EF_NODRAW)
|
||||
if ((pev->effects & EF_NODRAW) == EF_NODRAW)
|
||||
{
|
||||
m_hSprite->TurnOff();
|
||||
|
||||
pev->nextthink = 0;
|
||||
SetThink(nullptr);
|
||||
pev->velocity = g_vecZero;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +71,12 @@ void CItemAirBox::Restart()
|
||||
{
|
||||
CArmoury::Restart();
|
||||
UTIL_SetOrigin(pev, pev->oldorigin);
|
||||
pev->velocity = g_vecZero;
|
||||
|
||||
if (m_flyup < 0)
|
||||
{
|
||||
m_flyup = -m_flyup;
|
||||
}
|
||||
|
||||
if (m_flyup > 0 && m_delay > 0.01f)
|
||||
{
|
||||
|
@ -10,7 +10,11 @@ void CBasePlayerAmmo::Spawn()
|
||||
|
||||
SetTouch(&CBasePlayerAmmo::DefaultTouch);
|
||||
|
||||
if (g_pGameRules->IsMultiplayer())
|
||||
if (g_pGameRules->IsMultiplayer()
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& g_pGameRules->AmmoShouldRespawn(this) == GR_AMMO_RESPAWN_NO
|
||||
#endif
|
||||
)
|
||||
{
|
||||
SetThink(&CBaseEntity::SUB_Remove);
|
||||
pev->nextthink = gpGlobals->time + 2.0f;
|
||||
@ -20,7 +24,7 @@ void CBasePlayerAmmo::Spawn()
|
||||
BOOL CBasePlayerAmmo::AddAmmo(CBaseEntity *pOther)
|
||||
{
|
||||
auto ammoInfo = GetAmmoInfo(pev->classname);
|
||||
if (pOther->GiveAmmo(ammoInfo->buyClipSize, ammoInfo->ammoName2) == -1)
|
||||
if (!ammoInfo || pOther->GiveAmmo(ammoInfo->buyClipSize, ammoInfo->ammoName2) == -1)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -179,6 +179,11 @@ NOXREF int CBaseAnimating::GetBodygroup(int iGroup)
|
||||
return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup);
|
||||
}
|
||||
|
||||
float CBaseAnimating::GetSequenceDuration() const
|
||||
{
|
||||
return ::GetSequenceDuration(GET_MODEL_PTR(ENT(pev)), pev);
|
||||
}
|
||||
|
||||
int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs)
|
||||
{
|
||||
return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs);
|
||||
|
@ -12,7 +12,7 @@ server_studio_api_t IEngineStudio;
|
||||
studiohdr_t *g_pstudiohdr;
|
||||
|
||||
float (*g_pRotationMatrix)[3][4];
|
||||
float (*g_pBoneTransform)[128][3][4];
|
||||
float (*g_pBoneTransform)[MAXSTUDIOBONES][3][4];
|
||||
|
||||
int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs)
|
||||
{
|
||||
@ -246,6 +246,21 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p
|
||||
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
|
||||
}
|
||||
|
||||
float GetSequenceDuration(void *pmodel, entvars_t *pev)
|
||||
{
|
||||
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
|
||||
if (!pstudiohdr)
|
||||
return 0; // model ptr is not valid
|
||||
|
||||
if (pev->sequence < 0 || pev->sequence >= pstudiohdr->numseq)
|
||||
return 0; // sequence is not valid
|
||||
|
||||
// get current sequence time
|
||||
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence);
|
||||
|
||||
return pseqdesc->numframes / pseqdesc->fps;
|
||||
}
|
||||
|
||||
int GetSequenceFlags(void *pmodel, entvars_t *pev)
|
||||
{
|
||||
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
|
||||
@ -522,7 +537,7 @@ C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_inte
|
||||
IEngineStudio.Mod_Extradata = ((struct server_studio_api_s *)pstudio)->Mod_Extradata;
|
||||
|
||||
g_pRotationMatrix = (float (*)[3][4])rotationmatrix;
|
||||
g_pBoneTransform = (float (*)[128][3][4])bonetransform;
|
||||
g_pBoneTransform = (float (*)[MAXSTUDIOBONES][3][4])bonetransform;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -532,7 +547,9 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
|
||||
{
|
||||
static const ALIGN16_BEG size_t ps_signmask[4] ALIGN16_END = { 0x80000000, 0, 0x80000000, 0 };
|
||||
|
||||
__m128 a = _mm_loadu_ps(angles);
|
||||
vec4_t _ps_angles = { angles[0], angles[1], angles[2], 0.0f };
|
||||
|
||||
__m128 a = _mm_loadu_ps(_ps_angles);
|
||||
a = _mm_mul_ps(a, _mm_load_ps(_ps_0p5)); //a *= 0.5
|
||||
__m128 s, c;
|
||||
sincos_ps(a, &s, &c);
|
||||
|
@ -42,6 +42,7 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity);
|
||||
int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity);
|
||||
int LookupSequence(void *pmodel, const char *label);
|
||||
void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed);
|
||||
float GetSequenceDuration(void *pmodel, entvars_t *pev);
|
||||
int GetSequenceFlags(void *pmodel, entvars_t *pev);
|
||||
float SetController(void *pmodel, entvars_t *pev, int iController, float flValue);
|
||||
float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue);
|
||||
|
@ -451,17 +451,13 @@ BOOL CBaseMonster::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, f
|
||||
|
||||
if (pev->health <= 0.0f)
|
||||
{
|
||||
g_pevLastInflictor = pevInflictor;
|
||||
|
||||
if (bitsDamageType & DMG_ALWAYSGIB)
|
||||
Killed(pevAttacker, GIB_ALWAYS);
|
||||
|
||||
KilledInflicted(pevInflictor, pevAttacker, GIB_ALWAYS);
|
||||
else if (bitsDamageType & DMG_NEVERGIB)
|
||||
Killed(pevAttacker, GIB_NEVER);
|
||||
KilledInflicted(pevInflictor, pevAttacker, GIB_NEVER);
|
||||
else
|
||||
Killed(pevAttacker, GIB_NORMAL);
|
||||
KilledInflicted(pevInflictor, pevAttacker, GIB_NORMAL);
|
||||
|
||||
g_pevLastInflictor = nullptr;
|
||||
return FALSE;
|
||||
}
|
||||
if ((pev->flags & FL_MONSTER) && !FNullEnt(pevAttacker))
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
enum
|
||||
{
|
||||
ITBD_PARALLYZE = 0,
|
||||
ITBD_PARALYZE = 0,
|
||||
ITBD_NERVE_GAS,
|
||||
ITBD_POISON,
|
||||
ITBD_RADIATION,
|
||||
|
@ -43,10 +43,7 @@ int GetBotFollowCount(CBasePlayer *pLeader)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
@ -295,6 +292,15 @@ void CCSBot::BotTouch(CBaseEntity *pOther)
|
||||
// See if it's breakable
|
||||
if (FClassnameIs(pOther->pev, "func_breakable"))
|
||||
{
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
CBreakable *pBreak = static_cast<CBreakable *>(pOther);
|
||||
|
||||
// Material is "UnbreakableGlass"
|
||||
if (!pBreak->IsBreakable())
|
||||
return;
|
||||
#endif
|
||||
|
||||
Vector center = (pOther->pev->absmax + pOther->pev->absmin) / 2.0f;
|
||||
bool breakIt = true;
|
||||
|
||||
@ -420,6 +426,20 @@ bool CCSBot::StayOnNavMesh()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void CCSBot::Kill()
|
||||
{
|
||||
m_LastHitGroup = HITGROUP_GENERIC;
|
||||
|
||||
// have the player kill himself
|
||||
pev->health = 0.0f;
|
||||
Killed(VARS(eoNullEntity), GIB_NEVER);
|
||||
|
||||
if (CSGameRules()->m_pVIP == this)
|
||||
CSGameRules()->m_iConsecutiveVIP = 10;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CCSBot::Panic(CBasePlayer *pEnemy)
|
||||
{
|
||||
if (IsSurprised())
|
||||
@ -662,10 +682,7 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
@ -883,3 +900,129 @@ float CCSBot::GetRangeToFarthestEscortedHostage() const
|
||||
|
||||
return away.m_farRange;
|
||||
}
|
||||
|
||||
// Remove all occurrences of a given area from the path list
|
||||
void CCSBot::RemovePath(CNavArea *area)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < m_pathLength)
|
||||
{
|
||||
if (m_path[i].area == area)
|
||||
{
|
||||
// If this area is linked to a ladder, clear the reference
|
||||
if (m_path[i].ladder == m_pathLadder)
|
||||
m_pathLadder = nullptr;
|
||||
|
||||
m_pathLength--;
|
||||
|
||||
// adjust the current path index if the removed element is being used
|
||||
if (i == m_pathIndex)
|
||||
{
|
||||
if (i > 0)
|
||||
m_pathIndex = i - 1;
|
||||
else
|
||||
m_pathIndex = 0;
|
||||
}
|
||||
|
||||
if (m_pathLength != i)
|
||||
Q_memmove(&m_path[i], &m_path[i + 1], (m_pathLength - i) * sizeof(m_path[0]));
|
||||
|
||||
// clear the slot
|
||||
Q_memset(&m_path[m_pathLength], 0, sizeof(m_path[m_pathLength]));
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a hiding spot from the checked spots list
|
||||
void CCSBot::RemoveHidingSpot(HidingSpot *spot)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < m_checkedHidingSpotCount)
|
||||
{
|
||||
if (m_checkedHidingSpot[i].spot == spot)
|
||||
{
|
||||
m_checkedHidingSpotCount--;
|
||||
|
||||
if (m_checkedHidingSpotCount != i)
|
||||
Q_memmove(&m_checkedHidingSpot[i], &m_checkedHidingSpot[i + 1], (m_checkedHidingSpotCount - i) * sizeof(m_checkedHidingSpot[0]));
|
||||
|
||||
// clear the slot
|
||||
Q_memset(&m_checkedHidingSpot[m_checkedHidingSpotCount], 0, sizeof(m_checkedHidingSpot[m_checkedHidingSpotCount]));
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle navigation-related cleanup when a nav area, spot, or encounter is destroyed
|
||||
void CCSBot::OnDestroyNavDataNotify(NavNotifyDestroyType navNotifyType, void *dead)
|
||||
{
|
||||
switch (navNotifyType)
|
||||
{
|
||||
case NAV_NOTIFY_DESTROY_AREA:
|
||||
{
|
||||
CNavArea *area = static_cast<CNavArea *>(dead);
|
||||
|
||||
// If the destroyed area was linked to a spot encounter, clear it
|
||||
if (m_spotEncounter)
|
||||
{
|
||||
if (m_spotEncounter->from.area == area || m_spotEncounter->to.area == area)
|
||||
m_spotEncounter = nullptr;
|
||||
}
|
||||
|
||||
RemovePath(area);
|
||||
|
||||
// Invalidate any references to the destroyed area
|
||||
|
||||
if (m_noiseArea == area)
|
||||
m_noiseArea = nullptr;
|
||||
|
||||
if (m_currentArea == area)
|
||||
m_currentArea = nullptr;
|
||||
|
||||
if (m_lastKnownArea == area)
|
||||
m_lastKnownArea = nullptr;
|
||||
|
||||
if (m_hideState.GetSearchArea() == area)
|
||||
m_hideState.SetSearchArea(nullptr);
|
||||
|
||||
if (m_huntState.GetHuntArea() == area)
|
||||
m_huntState.ClearHuntArea();
|
||||
|
||||
break;
|
||||
}
|
||||
case NAV_NOTIFY_DESTROY_SPOT_ENCOUNTER:
|
||||
{
|
||||
CNavArea *area = static_cast<CNavArea *>(dead);
|
||||
|
||||
// Remove the encounter if it references the destroyed area
|
||||
if (m_spotEncounter && area->HasSpotEncounter(m_spotEncounter))
|
||||
m_spotEncounter = nullptr;
|
||||
|
||||
break;
|
||||
}
|
||||
case NAV_NOTIFY_DESTROY_SPOT:
|
||||
{
|
||||
HidingSpot *spot = static_cast<HidingSpot *>(dead);
|
||||
|
||||
// Remove the destroyed hiding spot from the spot order list
|
||||
if (m_spotEncounter)
|
||||
{
|
||||
SpotOrderList &spotOrderList = m_spotEncounter->spotList;
|
||||
spotOrderList.erase(std::remove_if(spotOrderList.begin(), spotOrderList.end(), [&](SpotOrder &spotOrder) {
|
||||
return spotOrder.spot == spot;
|
||||
}
|
||||
), spotOrderList.end());
|
||||
}
|
||||
|
||||
RemoveHidingSpot(spot);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,6 @@ enum
|
||||
BOT_PROGGRESS_HIDE, // hide status bar progress
|
||||
};
|
||||
|
||||
extern int _navAreaCount;
|
||||
extern int _currentIndex;
|
||||
|
||||
class CCSBot;
|
||||
class BotChatterInterface;
|
||||
|
||||
@ -74,6 +71,7 @@ public:
|
||||
virtual const char *GetName() const { return "Hunt"; }
|
||||
|
||||
void ClearHuntArea() { m_huntArea = nullptr; }
|
||||
CNavArea *GetHuntArea() { return m_huntArea; }
|
||||
|
||||
private:
|
||||
CNavArea *m_huntArea;
|
||||
@ -207,6 +205,7 @@ public:
|
||||
const Vector &GetHidingSpot() const { return m_hidingSpot; }
|
||||
|
||||
void SetSearchArea(CNavArea *area) { m_searchFromArea = area; }
|
||||
CNavArea *GetSearchArea() { return m_searchFromArea; }
|
||||
void SetSearchRange(float range) { m_range = range; }
|
||||
|
||||
void SetDuration(float time) { m_duration = time; }
|
||||
@ -378,6 +377,10 @@ public:
|
||||
|
||||
bool IsBuying() const;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void Kill();
|
||||
#endif
|
||||
|
||||
void Panic(CBasePlayer *pEnemy); // look around in panic
|
||||
void Follow(CBasePlayer *pPlayer); // begin following given Player
|
||||
void ContinueFollowing(); // continue following our leader after finishing what we were doing
|
||||
@ -532,12 +535,21 @@ public:
|
||||
bool IsAwareOfEnemyDeath() const; // return true if we *noticed* that our enemy died
|
||||
int GetLastVictimID() const; // return the ID (entindex) of the last victim we killed, or zero
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
bool CanSeeSniper(void) const; ///< return true if we can see an enemy sniper
|
||||
bool HasSeenSniperRecently(void) const; ///< return true if we have seen a sniper recently
|
||||
#endif
|
||||
|
||||
// navigation
|
||||
bool HasPath() const;
|
||||
void DestroyPath();
|
||||
|
||||
float GetFeetZ() const; // return Z of bottom of feet
|
||||
|
||||
void OnDestroyNavDataNotify(NavNotifyDestroyType navNotifyType, void *dead);
|
||||
void RemovePath(CNavArea *area);
|
||||
void RemoveHidingSpot(HidingSpot *spot);
|
||||
|
||||
enum PathResult
|
||||
{
|
||||
PROGRESSING, // we are moving along the path
|
||||
@ -920,6 +932,11 @@ private:
|
||||
|
||||
float m_fireWeaponTimestamp;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
bool m_isEnemySniperVisible; ///< do we see an enemy sniper right now
|
||||
CountdownTimer m_sawEnemySniperTimer; ///< tracking time since saw enemy sniper
|
||||
#endif
|
||||
|
||||
// reaction time system
|
||||
enum { MAX_ENEMY_QUEUE = 20 };
|
||||
struct ReactionState
|
||||
@ -970,7 +987,6 @@ private:
|
||||
const CNavNode *m_navNodeList;
|
||||
CNavNode *m_currentNode;
|
||||
NavDirType m_generationDir;
|
||||
NavAreaList::iterator m_analyzeIter;
|
||||
|
||||
enum ProcessType
|
||||
{
|
||||
@ -1109,6 +1125,11 @@ inline bool CCSBot::IsAtBombsite()
|
||||
|
||||
inline CCSBot::MoraleType CCSBot::GetMorale() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (cv_bot_excellent_morale.value != 0.0f)
|
||||
return EXCELLENT;
|
||||
#endif
|
||||
|
||||
return m_morale;
|
||||
}
|
||||
|
||||
@ -1250,6 +1271,18 @@ inline int CCSBot::GetLastVictimID() const
|
||||
return m_lastVictimID;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
inline bool CCSBot::CanSeeSniper(void) const
|
||||
{
|
||||
return m_isEnemySniperVisible;
|
||||
}
|
||||
|
||||
inline bool CCSBot::HasSeenSniperRecently(void) const
|
||||
{
|
||||
return !m_sawEnemySniperTimer.IsElapsed();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline bool CCSBot::HasPath() const
|
||||
{
|
||||
return m_pathLength != 0;
|
||||
|
@ -65,10 +65,7 @@ void BotMeme::Transmit(CCSBot *pSender) const
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
@ -249,6 +246,17 @@ void BotHostageBeingTakenMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) con
|
||||
pReceiver->GetChatter()->Say("Affirmative");
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* A teammate warned about snipers, so we shouldn't warn again for awhile
|
||||
*/
|
||||
void BotWarnSniperMeme::Interpret(CCSBot* sender, CCSBot* receiver) const
|
||||
{
|
||||
receiver->GetChatter()->FriendSpottedSniper();
|
||||
}
|
||||
#endif
|
||||
|
||||
BotSpeakable::BotSpeakable()
|
||||
{
|
||||
m_phrase = nullptr;
|
||||
@ -467,6 +475,7 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
|
||||
phraseData = SharedParse(phraseData);
|
||||
if (!phraseData)
|
||||
{
|
||||
if (phrase) delete phrase;
|
||||
CONSOLE_ECHO("Error parsing '%s' - expected identifier\n", filename);
|
||||
FREE_FILE(phraseDataFile);
|
||||
return false;
|
||||
@ -540,8 +549,13 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
|
||||
else if (!Q_stricmp("UNDEFINED", token))
|
||||
placeCriteria = UNDEFINED_PLACE;
|
||||
else
|
||||
{
|
||||
placeCriteria = TheBotPhrases->NameToID(token);
|
||||
|
||||
if (!TheBotPhrases->IsValid() && placeCriteria == UNDEFINED_PLACE)
|
||||
placeCriteria = TheNavAreaGrid.NameToID(token);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1267,6 +1281,9 @@ void BotChatterInterface::Reset()
|
||||
m_planInterval.Invalidate();
|
||||
m_encourageTimer.Invalidate();
|
||||
m_escortingHostageTimer.Invalidate();
|
||||
#ifdef REGAMEDLL_ADD
|
||||
m_warnSniperTimer.Invalidate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Register a statement for speaking
|
||||
@ -1520,10 +1537,7 @@ BotStatement *BotChatterInterface::GetActiveStatement()
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
@ -1626,6 +1640,42 @@ void BotChatterInterface::EnemySpotted()
|
||||
AddStatement(say);
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* If a friend warned of snipers, don't warn again for awhile
|
||||
*/
|
||||
void BotChatterInterface::FriendSpottedSniper(void)
|
||||
{
|
||||
m_warnSniperTimer.Start(60.0f);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Warn of an enemy sniper
|
||||
*/
|
||||
void BotChatterInterface::SpottedSniper(void)
|
||||
{
|
||||
if (!m_warnSniperTimer.IsElapsed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_me->GetFriendsRemaining() == 0)
|
||||
{
|
||||
// no-one to warn
|
||||
return;
|
||||
}
|
||||
|
||||
BotStatement* say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
|
||||
|
||||
say->AppendPhrase(TheBotPhrases->GetPhrase("SniperWarning"));
|
||||
say->AttachMeme(new BotWarnSniperMeme());
|
||||
|
||||
AddStatement(say);
|
||||
}
|
||||
#endif
|
||||
|
||||
NOXREF void BotChatterInterface::Clear(Place place)
|
||||
{
|
||||
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
|
||||
|
@ -140,6 +140,14 @@ public:
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
class BotWarnSniperMeme : public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot* sender, CCSBot* receiver) const; ///< cause the given bot to act on this meme
|
||||
};
|
||||
#endif
|
||||
|
||||
enum BotStatementType
|
||||
{
|
||||
REPORT_VISIBLE_ENEMIES,
|
||||
@ -255,6 +263,8 @@ public:
|
||||
Place NameToID(const char *name) const;
|
||||
const char *IDToName(Place id) const;
|
||||
|
||||
bool IsValid() const { return !m_placeList.empty(); }
|
||||
|
||||
// given a name, return the associated phrase collection
|
||||
const BotPhrase *GetPhrase(const char *name) const;
|
||||
|
||||
@ -529,6 +539,10 @@ public:
|
||||
void KilledFriend();
|
||||
void FriendlyFire();
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
void SpottedSniper(void);
|
||||
void FriendSpottedSniper(void);
|
||||
#endif
|
||||
bool SeesAtLeastOneEnemy() const { return m_seeAtLeastOneEnemy; }
|
||||
|
||||
private:
|
||||
@ -555,6 +569,9 @@ private:
|
||||
CountdownTimer m_spottedLooseBombTimer;
|
||||
CountdownTimer m_heardNoiseTimer;
|
||||
CountdownTimer m_escortingHostageTimer;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
CountdownTimer m_warnSniperTimer;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() const
|
||||
|
@ -56,6 +56,11 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt
|
||||
DecreaseMorale();
|
||||
}
|
||||
break;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
case EVENT_NEW_MATCH:
|
||||
m_morale = POSITIVE; // starting a new round makes everyone a little happy
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!IsAlive())
|
||||
@ -69,16 +74,18 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt
|
||||
{
|
||||
if (event == EVENT_PLAYER_DIED)
|
||||
{
|
||||
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
|
||||
CBasePlayer *pVictim = pPlayer;
|
||||
|
||||
if (BotRelationship(pVictim) == BOT_TEAMMATE)
|
||||
{
|
||||
CBasePlayer *pKiller = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
// check that attacker is an enemy (for friendly fire, etc)
|
||||
if (pKiller && pKiller->IsPlayer())
|
||||
if (pKiller && pKiller->IsPlayer() && BotRelationship(pKiller) == BOT_ENEMY)
|
||||
{
|
||||
// check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat
|
||||
// snipers stay put
|
||||
if (!IsSniper() && IsVisible(&pPlayer->pev->origin))
|
||||
if (!IsSniper() && IsVisible(&pVictim->pev->origin))
|
||||
{
|
||||
// people are dying - we should hurry
|
||||
Hurry(RANDOM_FLOAT(10.0f, 15.0f));
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
cvar_t cv_bot_enable = { "bot_enable", "0", 0, 0.0f, nullptr };
|
||||
cvar_t cv_bot_traceview = { "bot_traceview", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_stop = { "bot_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_show_nav = { "bot_show_nav", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
@ -62,6 +63,9 @@ cvar_t cv_bot_deathmatch = { "bot_deathmatch", "0", FCVAR_SERVER, 0.
|
||||
cvar_t cv_bot_quota_mode = { "bot_quota_mode", "normal", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_join_delay = { "bot_join_delay", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_freeze = { "bot_freeze", "0", 0, 0.0f, nullptr };
|
||||
cvar_t cv_bot_mimic = { "bot_mimic", "0", 0, 0.0f, nullptr };
|
||||
cvar_t cv_bot_mimic_yaw_offset = { "bot_mimic_yaw_offset", "0", 0, 0.0f, nullptr };
|
||||
cvar_t cv_bot_excellent_morale = { "bot_excellent_morale", "0", 0, 0.0f, nullptr };
|
||||
#else
|
||||
// Migrated to bot_quota_mode, use "match"
|
||||
cvar_t cv_bot_quota_match = { "bot_quota_match", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
@ -131,6 +135,9 @@ void Bot_RegisterCVars()
|
||||
CVAR_REGISTER(&cv_bot_quota_mode);
|
||||
CVAR_REGISTER(&cv_bot_join_delay);
|
||||
CVAR_REGISTER(&cv_bot_freeze);
|
||||
CVAR_REGISTER(&cv_bot_mimic);
|
||||
CVAR_REGISTER(&cv_bot_mimic_yaw_offset);
|
||||
CVAR_REGISTER(&cv_bot_excellent_morale);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -189,6 +196,11 @@ void CCSBot::ResetValues()
|
||||
m_currentArea = nullptr;
|
||||
m_lastKnownArea = nullptr;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
m_isEnemySniperVisible = false;
|
||||
m_sawEnemySniperTimer.Invalidate();
|
||||
#endif
|
||||
|
||||
m_avoidFriendTimer.Invalidate();
|
||||
m_isFriendInTheWay = false;
|
||||
m_isWaitingBehindFriend = false;
|
||||
@ -325,10 +337,10 @@ void CCSBot::ResetValues()
|
||||
// NOTE: For some reason, this can be called twice when a bot is added.
|
||||
void CCSBot::SpawnBot()
|
||||
{
|
||||
TheCSBots()->ValidateMapData();
|
||||
TheCSBots()->LoadNavigationMap();
|
||||
ResetValues();
|
||||
|
||||
Q_strcpy(m_name, STRING(pev->netname));
|
||||
Q_strlcpy(m_name, STRING(pev->netname));
|
||||
|
||||
SetState(&m_buyState);
|
||||
SetTouch(&CCSBot::BotTouch);
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
extern cvar_t cv_bot_enable;
|
||||
extern cvar_t cv_bot_traceview;
|
||||
extern cvar_t cv_bot_stop;
|
||||
extern cvar_t cv_bot_show_nav;
|
||||
@ -62,6 +63,9 @@ extern cvar_t cv_bot_deathmatch;
|
||||
extern cvar_t cv_bot_quota_mode;
|
||||
extern cvar_t cv_bot_join_delay;
|
||||
extern cvar_t cv_bot_freeze;
|
||||
extern cvar_t cv_bot_mimic;
|
||||
extern cvar_t cv_bot_mimic_yaw_offset;
|
||||
extern cvar_t cv_bot_excellent_morale;
|
||||
#else
|
||||
extern cvar_t cv_bot_quota_match;
|
||||
#endif
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
const float updateTimesliceDuration = 0.5f;
|
||||
|
||||
int _navAreaCount = 0;
|
||||
int _currentIndex = 0;
|
||||
unsigned int _generationIndex = 0; // used for iterating nav areas during generation process
|
||||
|
||||
inline CNavNode *LadderEndSearch(CBaseEntity *pEntity, const Vector *pos, NavDirType mountDir)
|
||||
{
|
||||
@ -385,11 +384,8 @@ void CCSBot::UpdateLearnProcess()
|
||||
|
||||
void CCSBot::StartAnalyzeAlphaProcess()
|
||||
{
|
||||
m_processMode = PROCESS_ANALYZE_ALPHA;
|
||||
m_analyzeIter = TheNavAreaList.begin();
|
||||
|
||||
_navAreaCount = TheNavAreaList.size();
|
||||
_currentIndex = 0;
|
||||
m_processMode = PROCESS_ANALYZE_ALPHA;
|
||||
_generationIndex = 0;
|
||||
|
||||
ApproachAreaAnalysisPrep();
|
||||
DestroyHidingSpots();
|
||||
@ -400,15 +396,18 @@ void CCSBot::StartAnalyzeAlphaProcess()
|
||||
|
||||
bool CCSBot::AnalyzeAlphaStep()
|
||||
{
|
||||
_currentIndex++;
|
||||
if (m_analyzeIter == TheNavAreaList.end())
|
||||
_generationIndex++;
|
||||
|
||||
if (_generationIndex < 0 || _generationIndex >= TheNavAreaList.size())
|
||||
return false;
|
||||
|
||||
CNavArea *area = (*m_analyzeIter);
|
||||
// TODO: Pretty ugly and very slow way to access element by index
|
||||
// There is no reason not to use a vector instead of a linked list
|
||||
const NavAreaList::const_iterator &iter = std::next(TheNavAreaList.begin(), _generationIndex - 1);
|
||||
|
||||
CNavArea *area = (*iter);
|
||||
area->ComputeHidingSpots();
|
||||
area->ComputeApproachAreas();
|
||||
m_analyzeIter++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -426,29 +425,30 @@ void CCSBot::UpdateAnalyzeAlphaProcess()
|
||||
}
|
||||
}
|
||||
|
||||
float progress = (double(_currentIndex) / double(_navAreaCount)) * 0.5f;
|
||||
float progress = (double(_generationIndex) / double(TheNavAreaList.size())) * 0.5f;
|
||||
drawProgressMeter(progress, "#CZero_AnalyzingHidingSpots");
|
||||
}
|
||||
|
||||
void CCSBot::StartAnalyzeBetaProcess()
|
||||
{
|
||||
m_processMode = PROCESS_ANALYZE_BETA;
|
||||
m_analyzeIter = TheNavAreaList.begin();
|
||||
|
||||
_navAreaCount = TheNavAreaList.size();
|
||||
_currentIndex = 0;
|
||||
m_processMode = PROCESS_ANALYZE_BETA;
|
||||
_generationIndex = 0;
|
||||
}
|
||||
|
||||
bool CCSBot::AnalyzeBetaStep()
|
||||
{
|
||||
_currentIndex++;
|
||||
if (m_analyzeIter == TheNavAreaList.end())
|
||||
_generationIndex++;
|
||||
|
||||
if (_generationIndex < 0 || _generationIndex >= TheNavAreaList.size())
|
||||
return false;
|
||||
|
||||
CNavArea *area = (*m_analyzeIter);
|
||||
// TODO: Pretty ugly and very slow way to access element by index
|
||||
// There is no reason not to use a vector instead of a linked list
|
||||
const NavAreaList::const_iterator &iter = std::next(TheNavAreaList.begin(), _generationIndex - 1);
|
||||
|
||||
CNavArea *area = (*iter);
|
||||
area->ComputeSpotEncounters();
|
||||
area->ComputeSniperSpots();
|
||||
m_analyzeIter++;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -466,7 +466,7 @@ void CCSBot::UpdateAnalyzeBetaProcess()
|
||||
}
|
||||
}
|
||||
|
||||
float progress = (double(_currentIndex) / double(_navAreaCount) + 1.0f) * 0.5f;
|
||||
float progress = (double(_generationIndex) / double(TheNavAreaList.size()) + 1.0f) * 0.5f;
|
||||
drawProgressMeter(progress, "#CZero_AnalyzingApproachPoints");
|
||||
}
|
||||
|
||||
@ -477,31 +477,24 @@ void CCSBot::StartSaveProcess()
|
||||
|
||||
void CCSBot::UpdateSaveProcess()
|
||||
{
|
||||
char filename[256];
|
||||
char msg[256];
|
||||
char cmd[128];
|
||||
char gd[64]{};
|
||||
GET_GAME_DIR(gd);
|
||||
|
||||
GET_GAME_DIR(filename);
|
||||
|
||||
Q_strcat(filename, "\\");
|
||||
Q_strcat(filename, TheBots->GetNavMapFilename());
|
||||
|
||||
HintMessageToAllPlayers("Saving...");
|
||||
char filename[MAX_OSPATH];
|
||||
Q_snprintf(filename, sizeof(filename), "%s\\%s", gd, TheBots->GetNavMapFilename());
|
||||
SaveNavigationMap(filename);
|
||||
|
||||
Q_sprintf(msg, "Navigation file '%s' saved.", filename);
|
||||
char msg[256]{};
|
||||
Q_snprintf(msg, sizeof(msg), "Navigation file '%s' saved.", filename);
|
||||
HintMessageToAllPlayers(msg);
|
||||
CONSOLE_ECHO("%s\n", msg);
|
||||
|
||||
hideProgressMeter();
|
||||
StartNormalProcess();
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
Q_sprintf(cmd, "map %s\n", STRING(gpGlobals->mapname));
|
||||
#else
|
||||
Q_snprintf(cmd, sizeof(cmd), "changelevel %s\n", STRING(gpGlobals->mapname));
|
||||
#endif
|
||||
|
||||
SERVER_COMMAND(cmd);
|
||||
// tell bot manager that the analysis is completed
|
||||
if (TheCSBots())
|
||||
TheCSBots()->AnalysisCompleted();
|
||||
}
|
||||
|
||||
void CCSBot::StartNormalProcess()
|
||||
|
@ -78,7 +78,7 @@ CCSBotManager::CCSBotManager()
|
||||
char *dataPointer = (char *)LOAD_FILE_FOR_ME((char *)filename, &dataLength);
|
||||
if (!dataPointer)
|
||||
{
|
||||
TheBotProfiles->Init("BotProfile.db");
|
||||
TheBotProfiles->Init(cv_bot_profile_db.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -231,13 +231,12 @@ bool CCSBotManager::IsOnOffense(CBasePlayer *pPlayer) const
|
||||
// Invoked when a map has just been loaded
|
||||
void CCSBotManager::ServerActivate()
|
||||
{
|
||||
DestroyNavigationMap();
|
||||
m_isMapDataLoaded = false;
|
||||
|
||||
m_zoneCount = 0;
|
||||
m_gameScenario = SCENARIO_DEATHMATCH;
|
||||
|
||||
ValidateMapData();
|
||||
LoadNavigationMap();
|
||||
RestartRound();
|
||||
|
||||
m_isLearningMap = false;
|
||||
@ -337,6 +336,10 @@ void CCSBotManager::ClientDisconnect(CBasePlayer *pPlayer)
|
||||
pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pevTemp);
|
||||
AddEntityHashValue(pPlayer->pev, STRING(pPlayer->pev->classname), CLASSNAME);
|
||||
pPlayer->pev->flags = FL_DORMANT;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
pPlayer->has_disconnected = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PrintAllEntities()
|
||||
@ -396,26 +399,24 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
const char *name = STRING(pPlayer->pev->netname);
|
||||
if (FStrEq(name, ""))
|
||||
continue;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pPlayer->pev->deadflag != DEAD_NO)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (pPlayer->IsBot())
|
||||
{
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
if (killThemAll || FStrEq(name, msg))
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
ClientKill(pPlayer->edict());
|
||||
#else
|
||||
pPlayer->TakeDamage(pPlayer->pev, pPlayer->pev, 9999.9f, DMG_CRUSH);
|
||||
#endif
|
||||
}
|
||||
pBot->Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -427,13 +428,17 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
else
|
||||
kickThemAll = false;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
bool fillMode = FStrEq(cv_bot_quota_mode.string, "fill");
|
||||
#else
|
||||
bool fillMode = false;
|
||||
#endif
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
const char *name = STRING(pPlayer->pev->netname);
|
||||
@ -448,7 +453,11 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
// adjust bot quota so kicked bot is not immediately added back in
|
||||
int newQuota = cv_bot_quota.value - 1;
|
||||
SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", name));
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, int(cv_bot_quota.value)));
|
||||
|
||||
if (kickThemAll || !fillMode)
|
||||
{
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, int(cv_bot_quota.value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -568,18 +577,21 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_save"))
|
||||
{
|
||||
GET_GAME_DIR(buffer);
|
||||
Q_strcat(buffer, "\\");
|
||||
Q_strcat(buffer, CBotManager::GetNavMapFilename());
|
||||
char gd[64]{};
|
||||
GET_GAME_DIR(gd);
|
||||
|
||||
if (SaveNavigationMap(buffer))
|
||||
CONSOLE_ECHO("Navigation map '%s' saved.\n", buffer);
|
||||
char filename[MAX_OSPATH];
|
||||
Q_snprintf(filename, sizeof(filename), "%s\\%s", gd, CBotManager::GetNavMapFilename());
|
||||
|
||||
if (SaveNavigationMap(filename))
|
||||
CONSOLE_ECHO("Navigation map '%s' saved.\n", filename);
|
||||
else
|
||||
CONSOLE_ECHO("ERROR: Cannot save navigation map '%s'.\n", buffer);
|
||||
CONSOLE_ECHO("ERROR: Cannot save navigation map '%s'.\n", filename);
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_load"))
|
||||
{
|
||||
ValidateMapData();
|
||||
m_isMapDataLoaded = false; // force nav reload
|
||||
LoadNavigationMap();
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_use_place"))
|
||||
{
|
||||
@ -634,11 +646,15 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
{
|
||||
CONSOLE_ECHO("Ambiguous\n");
|
||||
}
|
||||
else
|
||||
else if (found)
|
||||
{
|
||||
CONSOLE_ECHO("Current place set to '%s'\n", found->GetName());
|
||||
SetNavPlace(found->GetID());
|
||||
}
|
||||
else
|
||||
{
|
||||
CONSOLE_ECHO("Error - place name '%s' no exists in phrases BotChatter.db\n", msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_toggle_place_mode"))
|
||||
@ -666,6 +682,9 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
@ -746,6 +765,23 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
|
||||
BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (pPlayer->IsBot())
|
||||
return FALSE;
|
||||
|
||||
if (cv_bot_mimic.value == pPlayer->entindex())
|
||||
{
|
||||
// Bots mimic our client commands
|
||||
ForEachPlayer([pPlayer, pcmd](CBasePlayer *bot)
|
||||
{
|
||||
if (pPlayer != bot && bot->IsBot())
|
||||
bot->ClientCommand(pcmd, CMD_ARGV_(1));
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -788,7 +824,8 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
// decrease the bot quota
|
||||
if (!isFromConsole)
|
||||
{
|
||||
CVAR_SET_FLOAT("bot_quota", cv_bot_quota.value - 1);
|
||||
int newQuota = cv_bot_quota.value - 1;
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, (int)cv_bot_quota.value));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -822,7 +859,8 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
if (isFromConsole)
|
||||
{
|
||||
// increase the bot quota to account for manually added bot
|
||||
CVAR_SET_FLOAT("bot_quota", cv_bot_quota.value + 1);
|
||||
int newQuota = cv_bot_quota.value + 1;
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, gpGlobals->maxClients));
|
||||
}
|
||||
}
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
@ -831,7 +869,8 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
// decrease the bot quota
|
||||
if (!isFromConsole)
|
||||
{
|
||||
CVAR_SET_FLOAT("bot_quota", cv_bot_quota.value - 1);
|
||||
int newQuota = cv_bot_quota.value - 1;
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, (int)cv_bot_quota.value));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -850,20 +889,26 @@ void CCSBotManager::MaintainBotQuota()
|
||||
if (m_isLearningMap)
|
||||
return;
|
||||
|
||||
int totalHumansInGame = UTIL_HumansInGame();
|
||||
int humanPlayersInGame = UTIL_HumansInGame(IGNORE_SPECTATORS);
|
||||
int humanPlayersInGame = UTIL_HumansInGame();
|
||||
|
||||
// don't add bots until local player has been registered, to make sure he's player ID #1
|
||||
if (!IS_DEDICATED_SERVER() && totalHumansInGame == 0)
|
||||
if (!IS_DEDICATED_SERVER() && humanPlayersInGame == 0)
|
||||
return;
|
||||
|
||||
int desiredBotCount = int(cv_bot_quota.value);
|
||||
int occupiedBotSlots = UTIL_BotsInGame();
|
||||
|
||||
bool isRoundInDeathmatch = false;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (round_infinite.value > 0)
|
||||
isRoundInDeathmatch = true; // is no round end gameplay
|
||||
#endif
|
||||
|
||||
// isRoundInProgress is true if the round has progressed far enough that new players will join as dead.
|
||||
bool isRoundInProgress = CSGameRules()->IsGameStarted() &&
|
||||
!TheCSBots()->IsRoundOver() &&
|
||||
(CSGameRules()->GetRoundElapsedTime() >= CSGameRules()->GetRoundRespawnTime());
|
||||
(CSGameRules()->GetRoundRespawnTime() != -1 && CSGameRules()->GetRoundElapsedTime() >= CSGameRules()->GetRoundRespawnTime()) && !isRoundInDeathmatch;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (FStrEq(cv_bot_quota_mode.string, "fill"))
|
||||
@ -917,15 +962,17 @@ void CCSBotManager::MaintainBotQuota()
|
||||
|
||||
// if bots will auto-vacate, we need to keep one slot open to allow players to join
|
||||
if (cv_bot_auto_vacate.value > 0.0)
|
||||
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - (totalHumansInGame + 1));
|
||||
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - (humanPlayersInGame + 1));
|
||||
else
|
||||
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - totalHumansInGame);
|
||||
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - humanPlayersInGame);
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// Try to balance teams, if we are in the first specified seconds of a round and bots can join either team.
|
||||
if (occupiedBotSlots > 0 && desiredBotCount == occupiedBotSlots && CSGameRules()->IsGameStarted())
|
||||
if (occupiedBotSlots > 0 && desiredBotCount == occupiedBotSlots && (CSGameRules()->IsGameStarted() || isRoundInDeathmatch))
|
||||
{
|
||||
if (CSGameRules()->GetRoundElapsedTime() < CSGameRules()->GetRoundRespawnTime()) // new bots can still spawn during this time
|
||||
if (isRoundInDeathmatch ||
|
||||
(CSGameRules()->GetRoundRespawnTime() == -1 || // means no time limit
|
||||
CSGameRules()->GetRoundElapsedTime() < CSGameRules()->GetRoundRespawnTime())) // new bots can still spawn during this time
|
||||
{
|
||||
if (autoteambalance.value > 0.0f)
|
||||
{
|
||||
@ -1042,7 +1089,8 @@ void CCSBotManager::MaintainBotQuota()
|
||||
UTIL_KickBotFromTeam(TERRORIST);
|
||||
}
|
||||
|
||||
CVAR_SET_FLOAT("bot_quota", cv_bot_quota.value - 1.0f);
|
||||
int newQuota = cv_bot_quota.value - 1;
|
||||
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, (int)cv_bot_quota.value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1096,22 +1144,232 @@ private:
|
||||
CCSBotManager::Zone *m_zone;
|
||||
};
|
||||
|
||||
// Search the map entities to determine the game scenario and define important zones.
|
||||
void CCSBotManager::ValidateMapData()
|
||||
LINK_ENTITY_TO_CLASS(info_spawn_point, CPointEntity, CCSPointEntity)
|
||||
|
||||
inline bool IsFreeSpace(Vector vecOrigin, int iHullNumber, edict_t *pSkipEnt = nullptr)
|
||||
{
|
||||
if (UTIL_PointContents(vecOrigin) != CONTENTS_EMPTY)
|
||||
return false;
|
||||
|
||||
TraceResult trace;
|
||||
UTIL_TraceHull(vecOrigin, vecOrigin, dont_ignore_monsters, iHullNumber, pSkipEnt, &trace);
|
||||
|
||||
return (!trace.fStartSolid && !trace.fAllSolid && trace.fInOpen);
|
||||
}
|
||||
|
||||
inline bool pointInRadius(Vector vecOrigin, float radius)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecOrigin, radius)))
|
||||
{
|
||||
if (!UTIL_IsValidEntity(pEntity->edict()))
|
||||
continue; // ignore the entity marked for deletion
|
||||
|
||||
if (FClassnameIs(pEntity->edict(), "info_spawn_point"))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// a simple algorithm that searches for the farthest point (so that the player does not look at the wall)
|
||||
inline bool GetIdealLookYawForSpawnPoint(const Vector &vecStart, float &flIdealLookYaw)
|
||||
{
|
||||
const float ANGLE_STEP = 30.0f;
|
||||
float bestDistance = 0.0f;
|
||||
|
||||
for (float angleYaw = 0.0f; angleYaw <= 360.0f; angleYaw += ANGLE_STEP)
|
||||
{
|
||||
TraceResult tr;
|
||||
UTIL_MakeVectors(Vector(0, angleYaw, 0));
|
||||
|
||||
Vector vecEnd(vecStart + gpGlobals->v_forward * 8192);
|
||||
UTIL_TraceLine(vecStart, vecEnd, ignore_monsters, nullptr, &tr);
|
||||
|
||||
float distance = (vecStart - tr.vecEndPos).Length();
|
||||
if (distance > bestDistance)
|
||||
{
|
||||
bestDistance = distance;
|
||||
flIdealLookYaw = angleYaw;
|
||||
}
|
||||
}
|
||||
|
||||
return bestDistance > 0.0f;
|
||||
}
|
||||
|
||||
// this function from leaked csgo sources 2020y
|
||||
inline bool IsValidArea(CNavArea *area)
|
||||
{
|
||||
ShortestPathCost cost;
|
||||
bool bNotOrphaned;
|
||||
|
||||
// check that we can path from the nav area to a ct spawner to confirm it isn't orphaned.
|
||||
CBaseEntity *CTSpawn = UTIL_FindEntityByClassname(nullptr, "info_player_start");
|
||||
|
||||
if (CTSpawn)
|
||||
{
|
||||
CNavArea *CTSpawnArea = TheNavAreaGrid.GetNearestNavArea(&CTSpawn->pev->origin);
|
||||
bNotOrphaned = NavAreaBuildPath(area, CTSpawnArea, nullptr, cost);
|
||||
|
||||
if (bNotOrphaned)
|
||||
return true;
|
||||
}
|
||||
|
||||
// double check that we can path from the nav area to a t spawner to confirm it isn't orphaned.
|
||||
CBaseEntity *TSpawn = UTIL_FindEntityByClassname(nullptr, "info_player_deathmatch");
|
||||
|
||||
if (TSpawn)
|
||||
{
|
||||
CNavArea *TSpawnArea = TheNavAreaGrid.GetNearestNavArea(&TSpawn->pev->origin);
|
||||
bNotOrphaned = NavAreaBuildPath(area, TSpawnArea, nullptr, cost);
|
||||
|
||||
if (bNotOrphaned)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
// Generates spawn points (info_spawn_point entities) for players and bots based on the navigation map data
|
||||
// It uses the navigation areas to find valid spots for spawn points considering factors like area size, slope,
|
||||
// available free space, and distance from other spawn points.
|
||||
void GenerateSpawnPointsFromNavData()
|
||||
{
|
||||
// Remove any existing spawn points
|
||||
UTIL_RemoveOther("info_spawn_point");
|
||||
|
||||
const int MAX_SPAWNS_POINTS = 128; // Max allowed spawn points
|
||||
|
||||
const float MAX_SLOPE = 0.85f; // Maximum slope allowed for a spawn point
|
||||
const float MIN_AREA_SIZE = 32.0f; // Minimum area size for a valid spawn point
|
||||
const float MIN_NEARBY_SPAWNPOINT = 128.0f; // Minimum distance between spawn point
|
||||
|
||||
// Total number of spawn points generated
|
||||
int totalSpawns = 0;
|
||||
|
||||
for (CNavArea *area : TheNavAreaList)
|
||||
{
|
||||
if (totalSpawns >= MAX_SPAWNS_POINTS)
|
||||
break;
|
||||
|
||||
if (!area)
|
||||
continue;
|
||||
|
||||
// Skip areas that are too small
|
||||
if (area->GetSizeX() < MIN_AREA_SIZE || area->GetSizeY() < MIN_AREA_SIZE)
|
||||
continue;
|
||||
|
||||
// Skip areas with unwanted attributes (jump, crouch, etc.)
|
||||
if (area->GetAttributes() != 0)
|
||||
continue;
|
||||
|
||||
// Skip areas with steep slopes
|
||||
if (area->GetAreaSlope() < MAX_SLOPE)
|
||||
{
|
||||
//CONSOLE_ECHO("Skip area slope: %0.3f\n", area->GetAreaSlope());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate the spawn point position above the area center
|
||||
Vector vecOrigin = *area->GetCenter() + Vector(0, 0, HalfHumanHeight + 5);
|
||||
|
||||
// Ensure there is free space at the calculated position
|
||||
if (!IsFreeSpace(vecOrigin, human_hull))
|
||||
{
|
||||
//CONSOLE_ECHO("No free space!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pointInRadius(vecOrigin, MIN_NEARBY_SPAWNPOINT))
|
||||
continue; // spawn point is too close to others
|
||||
|
||||
if (!IsValidArea(area))
|
||||
continue;
|
||||
|
||||
// Calculate ideal spawn point yaw angle
|
||||
float flIdealSpawnPointYaw = 0.0f;
|
||||
if (GetIdealLookYawForSpawnPoint(vecOrigin, flIdealSpawnPointYaw))
|
||||
{
|
||||
CBaseEntity *pPoint = CBaseEntity::Create("info_spawn_point", vecOrigin, Vector(0, flIdealSpawnPointYaw, 0), nullptr);
|
||||
if (pPoint)
|
||||
{
|
||||
totalSpawns++;
|
||||
//CONSOLE_ECHO("Add spawn at x:%f y:%f z:%f with angle %0.1f slope %0.3f \n", vecOrigin.x, vecOrigin.y, vecOrigin.z, bestAngle.y, area->GetAreaSlope());
|
||||
|
||||
// use only for debugging
|
||||
if (randomspawn.value > 1.0f)
|
||||
{
|
||||
SET_MODEL(ENT(pPoint->pev), "models/player.mdl");
|
||||
pPoint->pev->sequence = ACT_IDLE;
|
||||
pPoint->pev->rendermode = kRenderTransAdd;
|
||||
pPoint->pev->renderamt = 150.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE_ECHO("Total spawns points: %i\n", totalSpawns);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Load the map's navigation data
|
||||
bool CCSBotManager::LoadNavigationMap()
|
||||
{
|
||||
// check if the map data is already loaded or if bots are not allowed
|
||||
if (m_isMapDataLoaded || !AreBotsAllowed())
|
||||
return;
|
||||
return false;
|
||||
|
||||
m_isMapDataLoaded = true;
|
||||
|
||||
if (LoadNavigationMap())
|
||||
// Clear navigation map data from previous map
|
||||
DestroyNavigationMap();
|
||||
|
||||
// Try to load the map's navigation file
|
||||
NavErrorType navStatus = ::LoadNavigationMap();
|
||||
if (navStatus != NAV_OK)
|
||||
{
|
||||
CONSOLE_ECHO("Failed to load navigation map.\n");
|
||||
return;
|
||||
CONSOLE_ECHO("ERROR: Failed to load 'maps/%s.nav' file navigation map!\n", STRING(gpGlobals->mapname));
|
||||
|
||||
switch (navStatus)
|
||||
{
|
||||
case NAV_CANT_ACCESS_FILE:
|
||||
CONSOLE_ECHO("\tNavigation file not found or access denied.\n");
|
||||
break;
|
||||
case NAV_INVALID_FILE:
|
||||
CONSOLE_ECHO("\tInvalid navigation file format.\n");
|
||||
break;
|
||||
case NAV_BAD_FILE_VERSION:
|
||||
CONSOLE_ECHO("\tBad navigation file version.\n");
|
||||
break;
|
||||
case NAV_CORRUPT_DATA:
|
||||
CONSOLE_ECHO("\tCorrupted navigation data detected.\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (navStatus != NAV_CANT_ACCESS_FILE)
|
||||
CONSOLE_ECHO("\tTry regenerating it using the command: bot_nav_analyze\n");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CONSOLE_ECHO("Navigation map loaded.\n");
|
||||
// Determine the scenario for the current map (e.g., bomb defuse, hostage rescue etc)
|
||||
DetermineMapScenario();
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
GenerateSpawnPointsFromNavData();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Search the map entities to determine the game scenario and define important zones.
|
||||
void CCSBotManager::DetermineMapScenario()
|
||||
{
|
||||
m_zoneCount = 0;
|
||||
m_gameScenario = SCENARIO_DEATHMATCH;
|
||||
|
||||
@ -1163,6 +1421,13 @@ void CCSBotManager::ValidateMapData()
|
||||
found = true;
|
||||
isLegacy = false;
|
||||
}
|
||||
else if (FClassnameIs(pEntity->pev, "func_escapezone"))
|
||||
{
|
||||
m_gameScenario = SCENARIO_ESCAPE;
|
||||
found = true;
|
||||
isLegacy = false;
|
||||
}
|
||||
|
||||
|
||||
if (found)
|
||||
{
|
||||
@ -1244,6 +1509,59 @@ void CCSBotManager::ValidateMapData()
|
||||
}
|
||||
}
|
||||
|
||||
// Tell all bots that the given nav data no longer exists
|
||||
// This function is called when a part of the map or the nav data is destroyed
|
||||
void CCSBotManager::OnDestroyNavDataNotify(NavNotifyDestroyType navNotifyType, void *dead)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
// Notify the bot about the destroyed nav data
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
pBot->OnDestroyNavDataNotify(navNotifyType, dead);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the map analysis process has completed
|
||||
// This function makes sure all bots are removed from the map analysis process
|
||||
// and are reset to normal bot behavior. It also reloads the navigation map
|
||||
// and triggers a game restart after the analysis is completed
|
||||
void CCSBotManager::AnalysisCompleted()
|
||||
{
|
||||
// Ensure that all bots are no longer involved in map analysis and start their normal process
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
pBot->StartNormalProcess();
|
||||
}
|
||||
|
||||
m_isLearningMap = false;
|
||||
m_isMapDataLoaded = false;
|
||||
m_isAnalysisRequested = false;
|
||||
|
||||
// Try to reload the navigation map from the file
|
||||
if (LoadNavigationMap())
|
||||
{
|
||||
// Initiate a game restart in 3 seconds
|
||||
CVAR_SET_FLOAT("sv_restart", 3);
|
||||
}
|
||||
}
|
||||
|
||||
bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
|
||||
{
|
||||
if (!AreBotsAllowed())
|
||||
@ -1451,6 +1769,7 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
|
||||
if (bomb)
|
||||
{
|
||||
m_looseBombArea = TheNavAreaGrid.GetNearestNavArea(&bomb->pev->origin);
|
||||
DbgAssert(!TheNavAreaGrid.IsValid() || m_looseBombArea); // TODO: Need investigation and find out why it cannot find nearest area for a lost bomb, just catch it
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1579,7 +1898,8 @@ void CCSBotManager::OnFreeEntPrivateData(CBaseEntity *pEntity)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!pPlayer || pPlayer->IsDormant())
|
||||
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (pPlayer->IsBot())
|
||||
|
@ -56,13 +56,16 @@ public:
|
||||
virtual bool IsImportantPlayer(CBasePlayer *pPlayer) const; // return true if pPlayer is important to scenario (VIP, bomb carrier, etc)
|
||||
|
||||
public:
|
||||
void ValidateMapData();
|
||||
bool LoadNavigationMap();
|
||||
void DetermineMapScenario();
|
||||
void OnFreeEntPrivateData(CBaseEntity *pEntity);
|
||||
void OnDestroyNavDataNotify(NavNotifyDestroyType navNotifyType, void *dead);
|
||||
bool IsLearningMap() const { return m_isLearningMap; }
|
||||
void SetLearningMapFlag() { m_isLearningMap = true; }
|
||||
bool IsAnalysisRequested() const { return m_isAnalysisRequested; }
|
||||
void RequestAnalysis() { m_isAnalysisRequested = true; }
|
||||
void AckAnalysisRequest() { m_isAnalysisRequested = false; }
|
||||
void AnalysisCompleted();
|
||||
|
||||
// difficulty levels
|
||||
static BotDifficultyType GetDifficultyLevel()
|
||||
@ -85,7 +88,8 @@ public:
|
||||
SCENARIO_DEATHMATCH,
|
||||
SCENARIO_DEFUSE_BOMB,
|
||||
SCENARIO_RESCUE_HOSTAGES,
|
||||
SCENARIO_ESCORT_VIP
|
||||
SCENARIO_ESCORT_VIP,
|
||||
SCENARIO_ESCAPE
|
||||
};
|
||||
|
||||
GameScenarioType GetScenario() const
|
||||
@ -268,3 +272,4 @@ inline bool AreBotsAllowed()
|
||||
}
|
||||
|
||||
void PrintAllEntities();
|
||||
void GenerateSpawnPointsFromNavData();
|
||||
|
@ -1118,10 +1118,7 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
if (!UTIL_IsValidPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!pPlayer->IsAlive())
|
||||
@ -1294,7 +1291,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
if (IsOnLadder())
|
||||
Jump(MUST_JUMP);
|
||||
|
||||
assert(m_pathIndex < m_pathLength);
|
||||
Assert(m_pathIndex < m_pathLength);
|
||||
|
||||
// Check if reached the end of the path
|
||||
bool nearEndOfPath = false;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user