Merge branch 'opfor' into opforfixed

This commit is contained in:
Andrey Akhmichin 2024-01-15 14:33:52 +05:00
commit f83bf47e66
27 changed files with 610 additions and 2271 deletions

View File

@ -52,13 +52,13 @@ jobs:
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
- name: Build on Linux with vgui
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc')
run: |
schroot --chroot steamrt_scout_i386 -- cmake -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install

10
.gitignore vendored
View File

@ -29,3 +29,13 @@ CMakeSettings.json
CMakeFiles
CMakeCache.txt
Makefile
# Android Studio/Gradle
.gradle/
.externalNativeBuild
.cxx/
.idea/
local.properties
.project
.classpath
.settings

View File

@ -33,6 +33,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
include(CheckIPOSupported)
project (HLSDK-PORTABLE)
@ -46,16 +47,37 @@ option(USE_NOVGUI_SCOREBOARD "Prefer non-VGUI Scoreboard when USE_VGUI is enable
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON)
option(POLLY "Enable pollyhedral optimization" OFF)
if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR
if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR
((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")))
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "EM64T")))
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON)
else()
option(64BIT "Disable auto -m32 appending to compiler flags" ON)
endif()
# It seems CMAKE_SYSTEM_PROCESSOR parameter completely useless for APPLE platform,
# so may need to set options here manually.
if((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
AND (((CMAKE_SYSTEM_PROCESSOR STREQUAL "x64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "EM64T") AND NOT 64BIT)
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i386"))
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON)
else()
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
endif()
@ -131,6 +153,13 @@ if(VITA)
add_compile_options(-fno-use-cxa-atexit)
endif()
check_ipo_supported(RESULT HAVE_LTO OUTPUT LTO_ERROR)
if(HAVE_LTO)
message(STATUS "IPO / LTO enabled")
else()
message(STATUS "IPO / LTO not supported: <${LTO_ERROR}>")
endif()
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
if(NOT MSVC)
@ -157,3 +186,11 @@ endif()
if(NOT BUILD_SERVER AND NOT BUILD_CLIENT)
message(FATAL_ERROR "Nothing to build")
endif()
if(POLLY)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-mllvm -polly)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fgraphite-identity -floop-interchange -floop-block)
endif()
endif()

View File

@ -164,7 +164,7 @@ sudo ./setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i38
Now you can use cmake and make prepending the commands with `schroot --chroot steamrt_scout_i386 --`:
```
schroot --chroot steamrt_scout_i386 -- cmake -B build-in-steamrt -S .
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -B build-in-steamrt -S .
schroot --chroot steamrt_scout_i386 -- cmake --build build-in-steamrt
```
@ -180,13 +180,20 @@ sudo apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i38
### Building
```
cmake -B build -S .
cmake -DCMAKE_BUILD_TYPE=Release -B build -S .
cmake --build build
```
Note that the libraries built this way might be not compatible with Steam Half-Life. If you have such issue you can configure it to build statically with c++ and gcc libraries:
```
cmake .. -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc" -B build -S .
cmake --build build
```
Alternatively, you can avoid libstdc++/libgcc_s linking using small libsupc++ library and optimization build flags instead(Really just set Release build type and set C compiler as C++ compiler):
```
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=cc -B build -S .
cmake --build build
```
To ensure portability it's still better to build using Steam Runtime or another chroot of some older distro.
@ -229,13 +236,36 @@ Insert your actual user name in place of `yourusername`.
Prepend any make or cmake call with `schroot -c jessie --`:
```
schroot --chroot jessie -- cmake -B build-in-chroot -S .
schroot --chroot jessie -- cmake -DCMAKE_BUILD_TYPE=Release -B build-in-chroot -S .
schroot --chroot jessie -- cmake --build build-in-chroot
```
## Android
1. Set up [Android Studio/Android SDK](https://developer.android.com/studio).
TODO
### Android Studio
Open the project located in the `android` folder and build.
### Command-line
```
cd android
./gradlew assembleRelease
```
### Customizing the build
settings.gradle:
* **rootProject.name** - project name displayed in Android Studio (optional).
app/build.gradle:
* **android->namespace** and **android->defaultConfig->applicationId** - set both to desired package name.
* **getBuildNum** function - set **releaseDate** variable as desired.
app/java/su/xash/hlsdk/MainActivity.java:
* **.putExtra("gamedir", ...)** - set desired gamedir.
src/main/AndroidManifest.xml:
* **application->android:label** - set desired application name.
* **su.xash.engine.gamedir** value - set to same as above.
## Nintendo Switch
@ -307,7 +337,13 @@ Install C and C++ compilers (like gcc or clang), cmake and make.
### Building
```
cmake -B build -S .
cmake -DCMAKE_BUILD_TYPE=Release -B build -S .
cmake --build build
```
Force 64-bit build:
```
cmake -DCMAKE_BUILD_TYPE=Release -D64BIT=1 -B build -S .
cmake --build build
```
@ -316,15 +352,22 @@ cmake --build build
To use waf, you need to install python (2.7 minimum)
```
(./waf configure -T release)
(./waf)
./waf configure -T release
./waf
```
Force 64-bit build:
```
./waf configure -T release -8
./waf
```
## Build options
Some useful build options that can be set during the cmake step.
* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on Windows and Linux, **OFF** on other platforms.
* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on x86 Windows and x86 Linux, **OFF** on other platforms.
* **64BIT** - allows to turn off/on 64-bit build. Set to **OFF** by default on x86_64 Windows, x86_64 Linux and 32-bit platforms, **ON** on other 64-bit platforms.
* **USE_VGUI** - whether to use VGUI library. **OFF** by default. You need to init `vgui_support` submodule in order to build with VGUI.
This list is incomplete. Look at `CMakeLists.txt` to see all available options.

73
android/app/build.gradle Normal file
View File

@ -0,0 +1,73 @@
import java.time.LocalDateTime
import java.time.Month
import java.time.temporal.ChronoUnit
apply plugin: 'com.android.application'
android {
ndkVersion '26.1.10909125'
namespace 'com.example.hlsdk'
defaultConfig {
applicationId 'com.example.hlsdk'
versionName '1.0'
versionCode getBuildNum()
minSdkVersion 3
targetSdk 34
compileSdk 34
externalNativeBuild {
cmake {
arguments '-DPOLLY=ON'
}
}
}
externalNativeBuild {
cmake {
version '3.22.1'
path file('../../CMakeLists.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lint {
abortOnError false
}
androidResources {
noCompress += ''
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}
static def getBuildNum() {
LocalDateTime now = LocalDateTime.now()
LocalDateTime releaseDate = LocalDateTime.of(2023, Month.DECEMBER, 28, 0, 0, 0)
int qBuildNum = releaseDate.until(now, ChronoUnit.DAYS)
int minuteOfDay = now.getHour() * 60 + now.getMinute()
return qBuildNum * 10000 + minuteOfDay
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:forceQueryable="true"
android:icon="@android:mipmap/sym_def_app_icon"
android:label="hlsdk-portable"
tools:targetApi="r">
<meta-data
android:name="su.xash.engine.gamedir"
android:value="valve" />
<activity
android:name="su.xash.hlsdk.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="su.xash.engine.MOD" />
</intent-filter>
</activity>
</application>
<queries>
<package android:name="su.xash.engine" />
<package android:name="su.xash.engine.test" />
</queries>
</manifest>

View File

@ -0,0 +1,37 @@
package su.xash.hlsdk;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String pkg = "su.xash.engine.test";
try {
getPackageManager().getPackageInfo(pkg, 0);
} catch (PackageManager.NameNotFoundException e) {
try {
pkg = "su.xash.engine";
getPackageManager().getPackageInfo(pkg, 0);
} catch (PackageManager.NameNotFoundException ex) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=su.xash.engine")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
finish();
return;
}
}
startActivity(new Intent().setComponent(new ComponentName(pkg, "su.xash.engine.XashActivity"))
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra("gamedir", "valve")
.putExtra("gamelibdir", getApplicationInfo().nativeLibraryDir)
.putExtra("package", getPackageName()));
finish();
}
}

17
android/build.gradle Normal file
View File

@ -0,0 +1,17 @@
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}

21
android/gradle.properties Normal file
View File

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=384m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# android.useDeprecatedNdk=true
android.enableJetifier=true
android.useAndroidX=true

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Thu Dec 28 14:36:02 EET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

160
android/gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/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
# 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\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
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"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# 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
android/gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@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

3
android/settings.gradle Normal file
View File

@ -0,0 +1,3 @@
include ':app'
rootProject.name = 'hlsdk-portable'

View File

@ -20,7 +20,7 @@
# SOFTWARE.
#
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.9)
project (CLDLL)
set (CLDLL_LIBRARY client)
@ -29,13 +29,25 @@ add_definitions(-DCLIENT_DLL)
if(NOT MSVC)
add_compile_options(-fno-exceptions) # GCC/Clang flag
add_compile_options(-Wno-write-strings) # GCC/Clang flag
add_compile_options(-fno-rtti) # GCC/Clang flag
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp)
if(NOT MINGW)
add_definitions(-D_snprintf=snprintf -D_vsnprintf=vsnprintf)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Release"
OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"
AND CMAKE_SYSTEM_NAME STREQUAL "Android"))
add_compile_options(-fno-unwind-tables -fno-asynchronous-unwind-tables) # GCC/Clang flag
add_compile_options(-fomit-frame-pointer) # GCC/Clang flag
add_compile_options(-ftree-vectorize) # GCC/Clang flag
add_compile_options(-funsafe-math-optimizations) # GCC/Clang flag
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_compile_options(-O3 -DNDEBUG) # gradle compiles release builds with RelWithDebInfo(-O2 -g) and strips debug symbols.
target_link_options(${CLDLL_LIBRARY} PUBLIC "LINKER:-O3")
endif()
endif()
else()
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif()
@ -219,8 +231,16 @@ if(MSVC)
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if(HAVE_LTO)
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
install( TARGETS ${CLDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE )
add_custom_command(TARGET ${CLDLL_LIBRARY}
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${CLDLL_LIBRARY}>)

View File

@ -166,7 +166,8 @@ void VectorScale( const float *in, float scale, float *out );
float VectorNormalize( float *v );
void VectorInverse( float *v );
extern vec3_t vec3_origin;
// extern vec3_t vec3_origin;
extern float vec3_origin[3];
// disable 'possible loss of data converting float to int' warning message
#pragma warning( disable: 4244 )

View File

@ -33,11 +33,11 @@
#if !defined(M_PI_F)
#define M_PI_F (float)M_PI
#endif
extern vec3_t vec3_origin;
// extern vec3_t vec3_origin;
// if C++ mangling differs from C symbol name
#if _MSC_VER || __WATCOMC__
vec3_t vec3_origin;
float vec3_origin[3];
#endif
float Length( const float *v )

View File

@ -20,17 +20,30 @@
# SOFTWARE.
#
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.9)
project (SVDLL)
set (SVDLL_LIBRARY server)
if(NOT MSVC)
add_compile_options(-fno-exceptions) # GCC/Clang flag
add_compile_options(-fno-rtti) # GCC/Clang flag
add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
add_definitions(-D_LINUX) # It seems enough for all non-Win32 systems
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf )
if(CMAKE_BUILD_TYPE MATCHES "Release"
OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"
AND CMAKE_SYSTEM_NAME STREQUAL "Android"))
add_compile_options(-fno-unwind-tables -fno-asynchronous-unwind-tables) # GCC/Clang flag
add_compile_options(-fomit-frame-pointer) # GCC/Clang flag
add_compile_options(-ftree-vectorize) # GCC/Clang flag
add_compile_options(-funsafe-math-optimizations) # GCC/Clang flag
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_compile_options(-O3 -DNDEBUG) # gradle compiles release builds with RelWithDebInfo(-O2 -g) and strips debug symbols.
target_link_options(${SVDLL_LIBRARY} PUBLIC "LINKER:-O3")
endif()
endif()
else()
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif()
@ -47,7 +60,6 @@ set (SVDLL_SOURCES
gearbox/eagle.cpp
gearbox/fgrunt.cpp
gearbox/func_tank_of.cpp
# gearbox/gearbox_client.cpp
gearbox/gearbox_effects.cpp
gearbox/gearbox_triggers.cpp
gearbox/gearbox_utils.cpp
@ -224,8 +236,16 @@ if(MSVC)
set_property(TARGET ${SVDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if(HAVE_LTO)
set_property(TARGET ${SVDLL_LIBRARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
install( TARGETS ${SVDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${SERVER_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
add_custom_command(TARGET ${SVDLL_LIBRARY}
POST_BUILD DEPENDS ${SVDLL_LIBRARY}
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${SVDLL_LIBRARY}>)

View File

@ -941,28 +941,6 @@ void ClientPrecache( void )
// Teleport sounds. Used by trigger_xen_return
PRECACHE_SOUND( "debris/beamstart7.wav" );
PRECACHE_MODEL( "models/flag.mdl" );
PRECACHE_MODEL( "models/civ_stand.mdl" );
PRECACHE_MODEL( "models/mil_stand.mdl" );
PRECACHE_MODEL( "models/w_accelerator.mdl" );
PRECACHE_MODEL( "models/w_backpack.mdl" );
PRECACHE_MODEL( "models/w_fgrenade.mdl" );
PRECACHE_MODEL( "models/w_health.mdl" );
PRECACHE_MODEL( "models/w_icon.mdl" );
PRECACHE_MODEL( "models/w_jumppack.mdl" );
PRECACHE_MODEL( "models/w_porthev.mdl" );
PRECACHE_SOUND( "ctf/bm_flagtaken.wav" );
PRECACHE_SOUND( "ctf/civ_flag_capture.wav" );
PRECACHE_SOUND( "ctf/itemthrow.wav" );
PRECACHE_SOUND( "ctf/marine_flag_capture.wav" );
PRECACHE_SOUND( "ctf/pow_armor_charge.wav" );
PRECACHE_SOUND( "ctf/pow_backpack.wav" );
PRECACHE_SOUND( "ctf/pow_big_jump.wav" );
PRECACHE_SOUND( "ctf/pow_health_charge.wav" );
PRECACHE_SOUND( "ctf/soldier_flagtaken.wav" );
}
/*

View File

@ -726,7 +726,7 @@ cvar_t sk_plr_spore3 = { "sk_plr_spore3", "0" };
void GameDLLInit( void )
{
// Register cvars here:
if( CVAR_GET_POINTER( "build" ) )
if( !CVAR_GET_POINTER( "sv_language" ) )
g_fIsXash3D = TRUE;
g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );

View File

@ -200,8 +200,8 @@ void CCTFMultiplay::Think(void)
frags_remaining = bestfrags;
}
if (!g_bSpawnedRunes)
SpawnRunes();
//if (!g_bSpawnedRunes)
// SpawnRunes();
if (m_flFlagStatusTime && m_flFlagStatusTime <= gpGlobals->time)
GetFlagStatus(NULL);

View File

@ -114,12 +114,18 @@ void CPowerupCTFBase::Spawn(void)
m_iszPrintName = ALLOC_STRING(printname);
}
SET_MODEL(ENT(pev), SelectRuneRandom(&m_iRuneFlag) );
PRECACHE_MODEL("models/w_accelerator.mdl");
PRECACHE_MODEL("models/w_backpack.mdl");
PRECACHE_MODEL("models/w_health.mdl");
PRECACHE_MODEL("models/w_jumppack.mdl");
PRECACHE_MODEL("models/w_porthev.mdl");
SET_MODEL(ENT(pev), modelname);
}
else
{
SET_MODEL(ENT(pev), GetRuneModel());
const char* modelname = GetRuneModel();
PRECACHE_MODEL(modelname);
SET_MODEL(ENT(pev), modelname);
m_iRuneFlag = GetRuneFlag();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef GEARBOX_EXPLODE_H
#define GEARBOX_EXPLODE_H
extern DLL_GLOBAL short g_sModelIndexSpore1;
extern DLL_GLOBAL short g_sModelIndexSpore2;
extern DLL_GLOBAL short g_sModelIndexSpore3;
extern DLL_GLOBAL short g_sModelIndexBigSpit;
extern DLL_GLOBAL short g_sModelIndexTinySpit;
#endif // GEARBOX_EXPLODE_H

View File

@ -1,21 +0,0 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef GEARBOX_MONSTERS_H
#define GEARBOX_MONSTERS_H
#define EF_GLOWSHELL 2048
#endif // GEARBOX_MONSTERS_H

View File

@ -1,79 +0,0 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef GEARBOX_PLAYER_H
#define GEARBOX_PLAYER_H
enum Player_Menu {
Team_Menu,
Team_Menu_IG,
};
#define PFLAG_ONROPE ( 1 << 6 )
class CGearboxPlayer : public CBasePlayer
{
public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
BOOL FlashlightIsOn(void);
void FlashlightTurnOn(void);
void FlashlightTurnOff(void);
static TYPEDESCRIPTION m_playerSaveData[];
virtual void Spawn(void);
private:
BOOL m_fInXen;
BOOL m_fIsFrozen;
public:
int m_bHasFlag;
void ShowMenu(int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
int m_iMenu;
float m_flNextTeamChange;
CBasePlayer *pFlagCarrierKiller;
CBasePlayer *pFlagReturner;
CBasePlayer *pCarrierHurter;
float m_flCarrierHurtTime;
float m_flCarrierPickupTime;
float m_flFlagCarrierKillTime;
float m_flFlagReturnTime;
float m_flFlagStatusTime;
float m_flRegenTime;
int m_iRuneStatus;
void W_FireHook(void);
void Throw_Grapple(void);
bool m_bHook_Out;
bool m_bOn_Hook;
CBaseEntity *m_ppHook;
void Service_Grapple(void);
private:
friend class CDisplacer;
friend class CTriggerXenReturn;
friend class CPlayerFreeze;
};
#endif // GEARBOX_PLAYER_H

View File

@ -211,7 +211,7 @@ def configure(conf):
conf.msg(msg='-> processing mod options', result='...', color='BLUE')
regex = re.compile('^([A-Za-z0-9_]+)=([A-Za-z0-9_]+)\ \#\ (.*)$')
with open('mod_options.txt') as fd:
with open(str(conf.path.make_node('mod_options.txt'))) as fd:
lines = fd.readlines()
for line in lines:
m = regex.match(line.strip())
@ -230,6 +230,10 @@ def configure(conf):
if conf.env.HLDEMO_BUILD and conf.env.OEM_BUILD:
conf.fatal('Don\'t mix Demo and OEM builds!')
# force to use server library name
if conf.env.DEST_OS == 'android':
conf.env.SERVER_LIBRARY_NAME = 'server' # can't be any other name, until specified
# strip lib from pattern
if conf.env.DEST_OS not in ['android']:
if conf.env.cxxshlib_PATTERN.startswith('lib'):