diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..6c2b7305 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,259 @@ +name: build + +on: + workflow_dispatch: + push: + branches: [master] + paths-ignore: + - "**.md" + - "**.txt" + - ".gitignore" + pull_request: + branches: [master] + paths-ignore: + - "**.md" + - "**.txt" + - ".gitignore" + release: + types: [published] + +jobs: + msvc: + name: Windows ${{ matrix.arch }} ${{ matrix.build_type }} + runs-on: windows-2022 + strategy: + fail-fast: false + matrix: + arch: [x86, x86_64] + build_type: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + # for cl.exe + - uses: ilammy/msvc-dev-cmd@v1 + + - uses: leafo/gh-actions-lua@v10 + with: + luaVersion: 5.4 + + # waiting for https://github.com/leafo/gh-actions-luarocks/pull/14 to be merged + # - uses: leafo/gh-actions-luarocks@v4 + + - name: Install Luarocks + working-directory: ${{ github.workspace }} + shell: pwsh + run: | + Invoke-WebRequest "http://luarocks.github.io/luarocks/releases/luarocks-3.9.2-windows-64.zip" -OutFile luarocks.zip + Expand-Archive .\luarocks.zip . + cd .\luarocks-3.9.2-windows-64\ + .\luarocks.exe config variables.LUA_DIR ${{ github.workspace }}/.lua/ + .\luarocks.exe config variables.LUA_INCDIR ${{ github.workspace }}/.lua/include + .\luarocks.exe config variables.LUA_LIBDIR ${{ github.workspace }}/.lua/lib + .\luarocks.exe install luafilesystem + + - name: Install Scons + working-directory: ${{ github.workspace }} + run: python -m pip install scons + + - name: Build + working-directory: ${{ github.workspace }} + shell: bash + run: | + if [ ${{ matrix.arch }} == "x86" ]; then + export FORCE32=1 + fi + ./build.sh ${{ matrix.build_type }} + + - name: Package + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }} + shell: pwsh + run: | + if ( "${{ matrix.arch }}" -eq "x86" ) { + $env:TARGET_ARCH="x86" + } + $env:PATH="${{ github.workspace }}\.lua\lib;$env:PATH" + $env:LUA_CPATH="$env:USERPROFILE\AppData\Roaming\LuaRocks\lib\lua\5.4\?.dll" + lua package.lua + 7z a -tzip -y japp-windows-${{ matrix.arch }}-${{ matrix.build_type }}.zip *.pk3 + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: japp-windows-${{ matrix.arch }}-${{ matrix.build_type }} + path: ${{ github.workspace }}/japp-windows-${{ matrix.arch }}-${{ matrix.build_type }}.zip + if-no-files-found: error + + ubuntu: + name: Ubuntu ${{ matrix.arch }} ${{ matrix.build_type }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + arch: [x86, x86_64] + build_type: [Debug, Release] + + steps: + - uses: actions/checkout@v3 + + - name: Prepare environment + run: | + if [ ${{ matrix.arch }} == "x86" ]; then + sudo dpkg --add-architecture i386 + sudo apt-get -qq update + sudo apt-get -y install gcc-multilib g++-multilib + sudo apt-get -y install libgtk2.0-dev:i386 libnotify-dev:i386 libreadline-dev:i386 + else + sudo apt-get -qq update + sudo apt-get -y install libgtk2.0-dev libnotify-dev libreadline-dev + fi + sudo apt-get -y install lua5.4 lua-filesystem + sudo apt-get -y install scons + + - name: Build + working-directory: ${{ github.workspace }} + shell: bash + run: | + if [ ${{ matrix.arch }} == "x86" ]; then + export FORCE32=1 + export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH" + fi + ./build.sh ${{ matrix.build_type }} + + - name: Package + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }} + shell: bash + run: | + if [ ${{ matrix.arch }} == "x86" ]; then + export TARGET_ARCH="i386" + fi + ./package.lua + tar -czvf japp-linux-${{ matrix.arch }}-${{ matrix.build_type }}.tar.gz *.zip + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: japp-linux-${{ matrix.arch }}-${{ matrix.build_type }} + path: ${{github.workspace}}/japp-linux-${{ matrix.arch }}-${{ matrix.build_type }}.tar.gz + if-no-files-found: error + + macos: + name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} + runs-on: macos-12 + strategy: + fail-fast: false + matrix: + arch: [x86_64] + build_type: [Debug, Release] + + steps: + - uses: actions/checkout@v3 + + - name: Prepare environment + run: | + brew install scons lua luarocks + luarocks install luafilesystem + + - name: Build + working-directory: ${{ github.workspace }} + shell: bash + run: CC=clang CXX=clang++ ./build.sh ${{ matrix.build_type }} + + - name: Package + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }} + shell: bash + run: | + ./package.lua + tar -czvf japp-macos-${{ matrix.arch }}-${{ matrix.build_type }}.tar.gz *.zip + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: japp-macos-${{ matrix.arch }}-${{ matrix.build_type }} + path: ${{ github.workspace }}/japp-macos-${{ matrix.arch }}-${{ matrix.build_type }}.tar.gz + if-no-files-found: error + + create-latest: + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + needs: [msvc, ubuntu, macos] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Download Artifacts + uses: actions/download-artifact@v3 + + - name: Create binary archives + run: | + 7z a -r japp-windows-x86.zip ./japp-windows-x86-Release/* + 7z a -r japp-windows-x86_64.zip ./japp-windows-x86_64-Release/* + mv ./japp-linux-x86-Release/* japp-linux-x86.tar.gz + mv ./japp-linux-x86_64-Release/* japp-linux-x86_64.tar.gz + mv ./japp-macos-x86_64-Release/* japp-macos-x86_64.tar.gz + + - name: Create latest build + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: "latest" + prerelease: false + title: Latest Build + files: | + *.zip + *.tar.gz + + create-release: + if: github.event_name == 'release' + needs: [msvc, ubuntu, macos] + runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - artifact_dir: japp-windows-x86-Release + artifact_name: japp-windows-x86.zip + zip: true + + - artifact_dir: japp-windows-x86_64-Release + artifact_name: japp-windows-x86_64.zip + zip: true + + - artifact_dir: japp-linux-x86-Release + artifact_name: japp-linux-x86.tar.gz + zip: false + + - artifact_dir: japp-linux-x86_64-Release + artifact_name: japp-linux-x86_64.tar.gz + zip: false + + - artifact_dir: japp-macos-x86_64-Release + artifact_name: japp-macos-x86_64.tar.gz + zip: false + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Download Artifacts + uses: actions/download-artifact@v3 + + - name: Create archive + run: | + if [ "${{ matrix.zip }}" == "true" ]; then + 7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* + else + mv ./${{ matrix.artifact_dir }}/* ${{ matrix.artifact_name }} + fi + + - name: Upload archives + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} + overwrite: true + file: ${{ matrix.artifact_name }} diff --git a/.gitignore b/.gitignore index 75c96e88..e6d49263 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,15 @@ +# intermediate files .cache/ +build/ .sconsign.dblite +compile_commands.json + +# build results *.dll +*.dylib *.pk3 *.so -build/ -compile_commands.json +*.zip + +# OS clutter +.DS_Store diff --git a/.lua-format b/.lua-format index 41d558b0..ee4d2bc5 100644 --- a/.lua-format +++ b/.lua-format @@ -1,2 +1,3 @@ column_limit: 120 double_quote_to_single_quote: true +extra_sep_at_table_end: true diff --git a/.luacheckrc b/.luacheckrc index bd30988d..60ed08d4 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,2 +1,8 @@ -- see -return {['globals'] = {'lfs'}} +return { + globals = { + -- LuaFormatter off + 'lfs', + -- LuaFormatter on + }, +} diff --git a/.luarc.json b/.luarc.json index e6db708c..af327e7e 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,11 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", - "diagnostics": { - "globals": [ - "lfs" - ] - }, - "runtime.version": "Lua 5.3", + "runtime.version": "Lua 5.4", "telemetry.enable": false, "workspace.library": [ "${3rd}/lfs/library" diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..2166ab62 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +lua 5.4.6 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a7b00c5e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: generic -env: -- MORE_WARNINGS=1 -- NO_SSE=1 - -matrix: - include: - - os: linux - sudo: false - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-5 - - g++-5 - - libreadline-dev - -script: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install scons sdl2; fi - - scons -Q -j1 debug=0 force32=0 no_sql=1 project=game,cgame,ui tools=default CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 diff --git a/SConstruct b/SConstruct index b078d2fa..1a3ba782 100644 --- a/SConstruct +++ b/SConstruct @@ -21,10 +21,14 @@ # cross-compile from linux64 to win32: # CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \ # scons -Q no_sql=1 no_crashhandler=1 no_geoip=1 force32=1 target=Windows +# compile on macOS without pretending clang is gcc: +# CC=clang CXX=clang++ scons -Q # # envvars: # NO_SSE disable SSE floating point instructions, force x87 fpu # MORE_WARNINGS enable additional warnings +# LESS_WARNINGS disable some default warnings +# SCONS_DEBUG disable some default warnings # import platform @@ -72,10 +76,14 @@ def run_command(cmd): out, err = p.communicate() out = out.decode("utf-8").strip("\n") if err: - print("run_command: " + err) + print("run_command: " + err.decode("utf-8").strip("\n")) return 0 if not err else 1, out +def get_env(key, default_value=None): + return default_value if key not in os.environ else os.environ[key] + + host_plat = platform.system() # Windows, Linux, Darwin target_plat = ARGUMENTS.get("target", host_plat) # Windows, Linux, Darwin try: @@ -99,27 +107,16 @@ if bits == 32: else: raise RuntimeError("unexpected platform: " + target_plat) elif bits == 64: - if target_plat == "Windows": - arch = "x64" - elif target_plat in ("Linux", "Darwin"): - if platform.machine()[:3] == "arm": - arch = "arm64" - else: - arch = "x86_64" + if platform.machine()[:3] == "arm": + arch = "arm64" else: - raise RuntimeError("unexpected platform: " + target_plat) + arch = "x86_64" else: raise RuntimeError("could not determine architecture width: " + str(bits)) -clangHack = host_plat == "Darwin" - # create the build environment # FIXME: also consider LD, AS, AR in the toolset -def get_env(key, default_value=None): - return default_value if key not in os.environ else os.environ[key] - - env = Environment( TARGET_ARCH=arch, tools=tools, @@ -129,6 +126,7 @@ env = Environment( "PATH": get_env("PATH"), "CC": get_env("CC"), "CXX": get_env("CXX"), + "PKG_CONFIG_PATH": get_env("PKG_CONFIG_PATH"), }, ) env.Tool("compilation_db") @@ -151,29 +149,6 @@ colours["orange"] = "\033[33m" if enableColours else "" colours["green"] = "\033[92m" if enableColours else "" colours["end"] = "\033[0m" if enableColours else "" -# env["SHCCCOMSTR"] = env["SHCXXCOMSTR"] = env["CCCOMSTR"] = env[ -# "CXXCOMSTR" -# ] = "%s compiling: %s$SOURCE%s" % (colours["cyan"], colours["white"], colours["end"]) -# env["ARCOMSTR"] = "%s archiving: %s$TARGET%s" % ( -# colours["orange"], -# colours["white"], -# colours["end"], -# ) -# env["RANLIBCOMSTR"] = "%s indexing: %s$TARGET%s" % ( -# colours["orange"], -# colours["white"], -# colours["end"], -# ) -# env["ASCOMSTR"] = "%sassembling: %s$TARGET%s" % ( -# colours["orange"], -# colours["white"], -# colours["end"], -# ) -# env["SHLINKCOMSTR"] = env["LINKCOMSTR"] = "%s linking: %s$TARGET%s" % ( -# colours["green"], -# colours["white"], -# colours["end"], -# ) env["SHCCCOMSTR"] = env["SHCXXCOMSTR"] = env["CCCOMSTR"] = env[ "CXXCOMSTR" ] = f"{colours['cyan']} compiling: {colours['white']}$SOURCE{colours['end']}" @@ -199,6 +174,7 @@ ccversion = get_compiler_version() # git revision +# TODO: consider tags def get_git_revision(): cmd_status, rawrevision = run_command("git rev-parse --short HEAD") git_revision = None if cmd_status else rawrevision @@ -281,7 +257,7 @@ if not env.GetOption("clean"): + "\n" + "\tinstruction set: " + arch - + ((" with x87 fpu" if "NO_SSE" in os.environ else " with SSE") if arch[:3] != "arm" else "") + + ((" with x87 fpu" if int(get_env("NO_SSE", 0)) else " with SSE") if arch[:3] != "arm" else "") + "\n" + "\tsql support: " + ("dis" if no_sql else "en") @@ -301,7 +277,7 @@ if not env.GetOption("clean"): ) # build environment - if "SCONS_DEBUG" in os.environ: + if int(get_env("SCONS_DEBUG", 0)): msg += env["CC"] + " located at " + run_command("where " + env["CC"])[1].split("\n", maxsplit=1)[0] + "\n" if "AR" in env: msg += env["AR"] + " located at " + run_command("where " + env["AR"])[1].split("\n", maxsplit=1)[0] + "\n" @@ -315,7 +291,7 @@ if not env.GetOption("clean"): # clear default compiler/linker switches def emptyEnv(_env, e): - if "SCONS_DEBUG" in os.environ: + if int(get_env("SCONS_DEBUG", 0)): if e in _env: if _env[e]: print("discarding " + e + ": " + _env[e]) @@ -367,7 +343,7 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: ] # strict c/cpp warnings - if "MORE_WARNINGS" in os.environ: + if int(get_env("MORE_WARNINGS", 0)): env["CFLAGS"] += [ "-Wbad-function-cast", ] @@ -381,21 +357,22 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: "-Wswitch-default", "-Wunreachable-code", ] - if not clangHack: - env["CFLAGS"] += [ - "-Wunsuffixed-float-constants", - ] - env["CCFLAGS"] += [ - "-Wdouble-promotion", - #'-Wsuggest-attribute=const', - ] # gcc-specific warnings - if "gcc" in env["CC"] and cmp_version(ccversion, "4.6") >= 0 and arch[:3] != "arm": + if "gcc" in env["CC"]: + env["CFLAGS"] += [ + "-Wunsuffixed-float-constants", + ] env["CCFLAGS"] += [ - "-Wlogical-op", + "-Wdouble-promotion", + #'-Wsuggest-attribute=const', ] + if cmp_version(ccversion, "4.6") >= 0 and arch[:3] != "arm": + env["CCFLAGS"] += [ + "-Wlogical-op", + ] + # requires gcc 4.7 or above if cmp_version(ccversion, "4.7") >= 0: env["CCFLAGS"] += [ @@ -407,12 +384,18 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: "-Wno-char-subscripts", ] + env["CCFLAGS"] += [ + "-fvisibility=hidden", + ] + # c/cpp flags if arch[:3] == "arm": + # arm env["CCFLAGS"] += [ "-fsigned-char", ] else: + # x86 env["CCFLAGS"] += [ "-mstackrealign", "-masm=intel", @@ -421,29 +404,29 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: "-msyntax=intel", "-mmnemonic=intel", ] - if "NO_SSE" in os.environ: + if int(get_env("NO_SSE", 0)): env["CCFLAGS"] += [ "-mno-sse2", ] - if "clang" not in env["CC"]: - env["CFLAGS"] += [ - "-fexcess-precision=standard", - "-mfpmath=387", - "-ffloat-store", - ] - else: - env["CCFLAGS"] += [ - "-mfpmath=sse", - "-msse2", - ] - if arch == "i386": - env["CCFLAGS"] += [ - "-march=i686", - ] - elif arch == "x86_64": - env["CCFLAGS"] += [ - "-mtune=generic", - ] + if "clang" not in env["CC"]: + env["CFLAGS"] += [ + "-fexcess-precision=standard", + "-mfpmath=387", + "-ffloat-store", + ] + else: + env["CCFLAGS"] += [ + "-mfpmath=sse", + "-msse2", + ] + if arch == "i386": + env["CCFLAGS"] += [ + "-march=i686", + ] + elif arch == "x86_64": + env["CCFLAGS"] += [ + "-mtune=generic", + ] if bits == 32: env["CCFLAGS"] += [ @@ -452,9 +435,6 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: env["LINKFLAGS"] += [ "-m32", ] - env["CCFLAGS"] += [ - "-fvisibility=hidden", - ] # misc settings # if 'gcc' in env['CC'] and cmp_version( ccversion, '4.9' ) >= 0: @@ -495,8 +475,15 @@ elif env["CC"] == "cl": env["LINKFLAGS"] += [ "/ERRORREPORT:none", # don't send error reports for internal linker errors "/NOLOGO", # remove watermark - "/MACHINE:" + arch, # 32/64 bit linking ] + if arch == "x86_64": + env["LINKFLAGS"] += [ + "/MACHINE:X64", + ] + else: + env["LINKFLAGS"] += [ + "/MACHINE:" + arch, + ] if bits == 64: env["LINKFLAGS"] += [ "/SUBSYSTEM:WINDOWS", # graphical application @@ -515,7 +502,7 @@ elif env["CC"] == "cl": ] # fpu control - if "NO_SSE" in os.environ: + if int(get_env("NO_SSE", 0)): env["CCFLAGS"] += [ "/fp:precise", # precise FP ] @@ -533,7 +520,7 @@ elif env["CC"] == "cl": ] # strict c/cpp warnings - if "LESS_WARNINGS" in os.environ: + if int(get_env("LESS_WARNINGS", 0)): env["CCFLAGS"] += [ "/W2", ] @@ -554,7 +541,7 @@ elif env["CC"] == "cl": "/we 4305", "/we 4700", ] - if "MORE_WARNINGS" in os.environ: + if int(get_env("MORE_WARNINGS", 0)): env["CCFLAGS"] += [ "/Wall", ] @@ -592,15 +579,19 @@ if target_plat == "Darwin": # debug / release if debug in (0, 2): + # release or fastdebug if "gcc" in env["CC"] or "clang" in env["CC"]: env["CCFLAGS"] += [ "-O2", # O3 may not be best, due to cache size not being big enough for the amount of inlining performed "-fomit-frame-pointer", ] - if debug == 0 and "gcc" in env["CC"]: - env["LINKFLAGS"] += [ - "-s", # strip unused symbols - ] + if debug == 0: + # strip unused symbols + # for macOS, we run the `strip` utility after linking + if "gcc" in env["CC"]: + env["LINKFLAGS"] += [ + "-s", + ] elif env["CC"] == "cl": env["CCFLAGS"] += [ "/O2", # maximise speed @@ -692,7 +683,7 @@ env["CPPPATH"] = [ "#", ".." + os.sep + "game", ] -env["LIBPATH"] = ["#" + os.sep + "libs" + os.sep + target_plat + os.sep + env["CC"] + os.sep + str(bits) + os.sep] +env["LIBPATH"] = ["#" + os.sep + "libs" + os.sep + target_plat + os.sep + str(bits) + os.sep] if target_plat == "Windows": env["SHLIBSUFFIX"] = ".dll" @@ -709,7 +700,7 @@ projects = [ ] for project in [p for p in projects if not proj or p in proj.split(",")]: - env.SConscript( + result = env.SConscript( os.path.join(project, "SConscript"), exports=[ "arch", @@ -724,3 +715,8 @@ for project in [p for p in projects if not proj or p in proj.split(",")]: "target_plat", ], ) + # strip symbols + # if not env.GetOption("clean") + if host_plat == "Darwin" and "clang" in env["CC"]: + for f in result: + AddPostAction(result, Action("strip -x " + f.name)) diff --git a/build.sh b/build.sh index 941f3f14..2fd260bd 100755 --- a/build.sh +++ b/build.sh @@ -3,26 +3,26 @@ set -euo pipefail cd "$(dirname "$0")" -# fetch arguments -ARGS=("$@") -ARGSLEN=${#ARGS[@]} - # options -PROJECT=game,cgame,ui -TOOLS=default -DEBUG=0 -FORCE32=0 -NOSQL=1 -NONOTIFY=0 -NOCRASHHANDLER=0 -NOGEOIP=0 -USE_ASAN=0 -export NO_SSE=1 +: "${PROJECT:=game,cgame,ui}" +: "${TOOLS:=default}" +: "${DEBUG:=0}" +: "${FORCE32:=0}" +: "${NOSQL:=1}" +: "${NONOTIFY:=0}" +: "${NOCRASHHANDLER:=0}" +: "${NOGEOIP:=0}" +: "${USE_ASAN:=0}" +export NO_SSE="${NO_SSE:=1}" build="scons -Q" -for ((i = 0; i < ARGSLEN; i++)); do - case ${ARGS[$i]} in +ARGS=("$@") +for ((i = 0; i < ${#ARGS[@]}; i++)); do + case ${ARGS[$i],,} in + "release") + DEBUG=0 + ;; "debug") DEBUG=1 ;; diff --git a/cJSON/SConscript b/cJSON/SConscript index 7a58b22e..b54b2312 100644 --- a/cJSON/SConscript +++ b/cJSON/SConscript @@ -20,7 +20,7 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: "-Wno-cast-qual", "-Wno-implicit-fallthrough", ] - if "clang" not in env["CC"]: + if "gcc" in env["CC"]: json_env["CCFLAGS"] += [ "-Wno-unsuffixed-float-constants", ] diff --git a/cgame/SConscript b/cgame/SConscript index cd8ae060..bc243e73 100644 --- a/cgame/SConscript +++ b/cgame/SConscript @@ -146,4 +146,5 @@ if env["CC"] == "cl": cgame_env["PDB"] = "#" + os.sep + "cgame" + arch + ".pdb" # targets -cgame_env.SharedLibrary("#" + os.sep + "cgame" + arch, files) +result = cgame_env.SharedLibrary("#" + os.sep + "cgame" + arch, files) +Return("result") diff --git a/cgame/cg_consolecmds.cpp b/cgame/cg_consolecmds.cpp index 6e20b83b..83da2522 100644 --- a/cgame/cg_consolecmds.cpp +++ b/cgame/cg_consolecmds.cpp @@ -156,8 +156,10 @@ static void CG_CopyNames_f(void) { #endif // WIN32 } -#if !defined(NO_CRASHHANDLER) && !defined(MACOS_X) -static void CG_Crash_f(void) { qasm1(int 3); } +#if ARCH_WIDTH == 64 || defined(MACOS_X) || defined(QARCH_ARM) || defined(NO_CRASHHANDLER) +// no crash handler +#else +static void CG_Crash_f(void) { qasm1(int 3) } #endif static void CG_ShowPlayerID_f(void) { @@ -398,7 +400,9 @@ static const command_t commands[] = { {"chattabprev", Cmd_ChatboxSelectTabPrev}, {"clearchat", CG_ClearChat_f}, {"copynames", CG_CopyNames_f}, -#if !defined(NO_CRASHHANDLER) && !defined(MACOS_X) +#if ARCH_WIDTH == 64 || defined(MACOS_X) || defined(QARCH_ARM) || defined(NO_CRASHHANDLER) +// no crash handler +#else {"crash", CG_Crash_f}, #endif {"engage_fullforceduel", NULL}, diff --git a/cgame/cg_local.h b/cgame/cg_local.h index c898b378..662e2570 100644 --- a/cgame/cg_local.h +++ b/cgame/cg_local.h @@ -999,7 +999,7 @@ void CG_LoadingString(const char *s); void CG_LoadingItem(int itemNum); void CG_LoadingClient(int clientNum); void CG_LoadMenus(const char *menuFile); -void CG_LogPrintf(fileHandle_t fileHandle, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void CG_LogPrintf(fileHandle_t fileHandle, const char *fmt, ...) Q_PRINT_FORMAT(2, 3); localEntity_t *CG_MakeExplosion(vector3 *origin, vector3 *dir, qhandle_t hModel, int numframes, qhandle_t shader, int msec, qboolean isSprite, float scale, uint32_t flags); void CG_ManualEntityRender(centity_t *cent); diff --git a/cgame/cg_public.h b/cgame/cg_public.h index a875d376..8c6ab821 100644 --- a/cgame/cg_public.h +++ b/cgame/cg_public.h @@ -449,8 +449,8 @@ typedef enum cgameExportLegacy_e { typedef struct cgameImport_s { // common - void (*Print)(const char *msg, ...) __attribute__((format(printf, 1, 2))); - void (*Error)(int level, const char *error, ...) __attribute__((format(printf, 2, 3))); + void (*Print)(const char *msg, ...) Q_PRINT_FORMAT(1, 2); + void (*Error)(int level, const char *error, ...) Q_PRINT_FORMAT(2, 3); void (*SnapVector)(vector3 *v); int (*MemoryRemaining)(void); void (*RegisterSharedMemory)(char *memory); diff --git a/clean.sh b/clean.sh index 9e8d8141..916a5b7a 100755 --- a/clean.sh +++ b/clean.sh @@ -3,26 +3,26 @@ set -euo pipefail cd "$(dirname "$0")" -# fetch arguments -ARGS=("$@") -ARGSLEN=${#ARGS[@]} - # options -PROJECT=game,cgame,ui -TOOLS=default -DEBUG=0 -FORCE32=0 -NOSQL=1 -NONOTIFY=0 -NOCRASHHANDLER=0 -NOGEOIP=0 -USE_ASAN=0 -export NO_SSE=1 +: "${PROJECT:=game,cgame,ui}" +: "${TOOLS:=default}" +: "${DEBUG:=0}" +: "${FORCE32:=0}" +: "${NOSQL:=1}" +: "${NONOTIFY:=0}" +: "${NOCRASHHANDLER:=0}" +: "${NOGEOIP:=0}" +: "${USE_ASAN:=0}" +export NO_SSE="${NO_SSE:=1}" clean="scons -Qc" -for ((i = 0; i < ARGSLEN; i++)); do - case ${ARGS[$i]} in +ARGS=("$@") +for ((i = 0; i < ${#ARGS[@]}; i++)); do + case ${ARGS[$i],,} in + "release") + DEBUG=0 + ;; "debug") DEBUG=1 ;; diff --git a/game/SConscript b/game/SConscript index bdb82994..2b2c7dec 100644 --- a/game/SConscript +++ b/game/SConscript @@ -200,4 +200,5 @@ if env["CC"] == "cl": game_env["PDB"] = "#" + os.sep + "jampgame" + arch + ".pdb" # targets -game_env.SharedLibrary("#" + os.sep + "jampgame" + arch, files) +result = game_env.SharedLibrary("#" + os.sep + "jampgame" + arch, files) +Return("result") diff --git a/game/b_local.h b/game/b_local.h index 2aa560d1..c12f3a94 100644 --- a/game/b_local.h +++ b/game/b_local.h @@ -53,8 +53,8 @@ float NPC_GetPainChance(gentity_t *self, int damage); // // NPC_misc.cpp // -void Debug_Printf(vmCvar_t *cv, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); -void Debug_NPCPrintf(gentity_t *printNPC, vmCvar_t *cv, int debugLevel, const char *fmt, ...) __attribute__((format(printf, 4, 5))); +void Debug_Printf(vmCvar_t *cv, int level, const char *fmt, ...) Q_PRINT_FORMAT(3, 4); +void Debug_NPCPrintf(gentity_t *printNPC, vmCvar_t *cv, int debugLevel, const char *fmt, ...) Q_PRINT_FORMAT(4, 5); // NPC_ai variables - shared by NPC.cpp andf the following modules extern gentity_t *NPC; diff --git a/game/bg_luainternal.h b/game/bg_luainternal.h index 6b7a6a37..ad38b6e9 100644 --- a/game/bg_luainternal.h +++ b/game/bg_luainternal.h @@ -26,7 +26,7 @@ extern struct luaState_t { lua_State *L; } ls; -void DPrintf(const char *msg, ...) __attribute__((format(printf, 1, 2))); +void DPrintf(const char *msg, ...) Q_PRINT_FORMAT(1, 2); // these all act on a given lua state qboolean Call(lua_State *L, int argCount, int resCount); diff --git a/game/botlib.h b/game/botlib.h index b3c58506..ee127de4 100644 --- a/game/botlib.h +++ b/game/botlib.h @@ -137,7 +137,7 @@ typedef struct bot_entitystate_s { // bot AI library exported functions typedef struct botlib_import_s { // print messages from the bot library - void (*Print)(int type, char *fmt, ...) __attribute__((format(printf, 2, 3))); + void (*Print)(int type, char *fmt, ...) Q_PRINT_FORMAT(2, 3); // trace a bbox through the world void (*Trace)(bsp_trace_t *trace, vector3 *start, vector3 *mins, vector3 *maxs, vector3 *end, int passent, int contentmask); // trace a bbox against a specific entity diff --git a/game/g_local.h b/game/g_local.h index cfd0db1a..043c74cc 100644 --- a/game/g_local.h +++ b/game/g_local.h @@ -906,7 +906,7 @@ void G_Knockdown(gentity_t *self); void G_LeaveVehicle(gentity_t *ent, qboolean ConCheck); void G_LoadArenas(void); void G_LogExit(const char *string); -void G_LogPrintf(fileHandle_t filehandle, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void G_LogPrintf(fileHandle_t filehandle, const char *fmt, ...) Q_PRINT_FORMAT(2, 3); void G_LogWeaponDamage(int client, int mod, int amount); void G_LogWeaponDeath(int client, int weaponid); void G_LogWeaponFire(int client, int weaponid); diff --git a/game/g_public.h b/game/g_public.h index fd2daabe..37a1562f 100644 --- a/game/g_public.h +++ b/game/g_public.h @@ -95,27 +95,27 @@ typedef struct entityShared_s { } entityShared_t; // bstate.h -typedef enum //# bState_e +typedef enum // # bState_e { // These take over only if script allows them to be autonomous - BS_DEFAULT = 0, //# default behavior for that NPC - BS_ADVANCE_FIGHT, //# Advance to captureGoal and shoot enemies if you can - BS_SLEEP, //# Play awake script when startled by sound - BS_FOLLOW_LEADER, //# Follow your leader and shoot any enemies you come across - BS_JUMP, //# Face navgoal and jump to it. - BS_SEARCH, //# Using current waypoint as a base, search the immediate branches of waypoints for enemies - BS_WANDER, //# Wander down random waypoint paths - BS_NOCLIP, //# Moves through walls, etc. - BS_REMOVE, //# Waits for player to leave PVS then removes itself - BS_CINEMATIC, //# Does nothing but face it's angles and move to a goal if it has one - //# #eol - // internal bStates only - BS_WAIT, //# Does nothing but face it's angles + BS_DEFAULT = 0, // # default behavior for that NPC + BS_ADVANCE_FIGHT, // # Advance to captureGoal and shoot enemies if you can + BS_SLEEP, // # Play awake script when startled by sound + BS_FOLLOW_LEADER, // # Follow your leader and shoot any enemies you come across + BS_JUMP, // # Face navgoal and jump to it. + BS_SEARCH, // # Using current waypoint as a base, search the immediate branches of waypoints for enemies + BS_WANDER, // # Wander down random waypoint paths + BS_NOCLIP, // # Moves through walls, etc. + BS_REMOVE, // # Waits for player to leave PVS then removes itself + BS_CINEMATIC, // # Does nothing but face it's angles and move to a goal if it has one + // # #eol + // internal bStates only + BS_WAIT, // # Does nothing but face it's angles BS_STAND_GUARD, BS_PATROL, - BS_INVESTIGATE, //# head towards temp goal and look for enemies and listen for sounds + BS_INVESTIGATE, // # head towards temp goal and look for enemies and listen for sounds BS_STAND_AND_SHOOT, BS_HUNT_AND_KILL, - BS_FLEE, //# Run away! + BS_FLEE, // # Run away! NUM_BSTATES } bState_t; @@ -128,7 +128,7 @@ enum { NODE_NAVGOAL, }; -typedef enum //# taskID_e +typedef enum // # taskID_e { TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime @@ -143,27 +143,27 @@ typedef enum //# taskID_e NUM_TIDS, // for def of taskID array } taskID_t; -typedef enum //# bSet_e +typedef enum // # bSet_e { // This should check to matching a behavior state name first, then look for a script BSET_INVALID = -1, BSET_FIRST = 0, - BSET_SPAWN = 0, //# script to use when first spawned - BSET_USE, //# script to use when used - BSET_AWAKE, //# script to use when awoken/startled - BSET_ANGER, //# script to use when aquire an enemy - BSET_ATTACK, //# script to run when you attack - BSET_VICTORY, //# script to run when you kill someone - BSET_LOSTENEMY, //# script to run when you can't find your enemy - BSET_PAIN, //# script to use when take pain - BSET_FLEE, //# script to use when take pain below 50% of health - BSET_DEATH, //# script to use when killed - BSET_DELAYED, //# script to run when self->delayScriptTime is reached - BSET_BLOCKED, //# script to run when blocked by a friendly NPC or player - BSET_BUMPED, //# script to run when bumped into a friendly NPC or player (can set bumpRadius) - BSET_STUCK, //# script to run when blocked by a wall - BSET_FFIRE, //# script to run when player shoots their own teammates - BSET_FFDEATH, //# script to run when player kills a teammate - BSET_MINDTRICK, //# script to run when player does a mind trick on this NPC + BSET_SPAWN = 0, // # script to use when first spawned + BSET_USE, // # script to use when used + BSET_AWAKE, // # script to use when awoken/startled + BSET_ANGER, // # script to use when aquire an enemy + BSET_ATTACK, // # script to run when you attack + BSET_VICTORY, // # script to run when you kill someone + BSET_LOSTENEMY, // # script to run when you can't find your enemy + BSET_PAIN, // # script to use when take pain + BSET_FLEE, // # script to use when take pain below 50% of health + BSET_DEATH, // # script to use when killed + BSET_DELAYED, // # script to run when self->delayScriptTime is reached + BSET_BLOCKED, // # script to run when blocked by a friendly NPC or player + BSET_BUMPED, // # script to run when bumped into a friendly NPC or player (can set bumpRadius) + BSET_STUCK, // # script to run when blocked by a wall + BSET_FFIRE, // # script to run when player shoots their own teammates + BSET_FFDEATH, // # script to run when player kills a teammate + BSET_MINDTRICK, // # script to run when player does a mind trick on this NPC NUM_BSETS } bSet_t; @@ -757,8 +757,8 @@ typedef enum gameExportLegacy_e { typedef struct gameImport_s { // misc - void (*Print)(const char *msg, ...) __attribute__((format(printf, 1, 2))); - void (*Error)(int level, const char *error, ...) __attribute__((format(printf, 2, 3))); + void (*Print)(const char *msg, ...) Q_PRINT_FORMAT(1, 2); + void (*Error)(int level, const char *error, ...) Q_PRINT_FORMAT(2, 3); int (*Milliseconds)(void); void (*PrecisionTimerStart)(void **timer); int (*PrecisionTimerEnd)(void *timer); diff --git a/lua/SConscript b/lua/SConscript index aca7b784..64956b3a 100644 --- a/lua/SConscript +++ b/lua/SConscript @@ -52,7 +52,7 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: lua_env["CCFLAGS"] += [ "-Wno-cast-qual", ] - if "clang" not in env["CC"]: + if "gcc" in env["CC"]: lua_env["CCFLAGS"] += [ "-Wno-unsuffixed-float-constants", ] diff --git a/package.lua b/package.lua old mode 100644 new mode 100755 index 1eccafdd..ec392464 --- a/package.lua +++ b/package.lua @@ -1,39 +1,65 @@ +#!/usr/bin/env lua + require 'lfs' -- lua filesystem --[[ -JA++ binaries package script -author: Raz0r + JA++ binaries package script -requirements: -- lua 5.1 -- lua-filesystem -- 7zip + requirements: + - lua 5.4 + - luafilesystem + - 7z or zip --]] -if lfs == nil then error('lua-filesystem not available for this version of lua (' .. _VERSION .. ')') end - -local linux = true and package.config:find('/') or false -local bits = (arg[1] == '64bit') and 64 or 32 -local extension = linux and '.zip' or '.pk3' -local suffix = (linux and 'linux' or 'win') .. tostring(bits) -local libExt = linux and '.so' or '.dll' -local arch -if linux then - arch = (bits == 32) and 'i386' or 'x86_64' -else - arch = (bits == 32) and 'x86' or 'x64' +if lfs == nil then error('missing lua-filesystem (Lua ' .. _VERSION .. ') - try installing with luarocks') end + +local function get_platform_details() + if package.config:sub(1, 1) == '\\' then + -- Windows + local env_OS = os.getenv('OS') + local osTranslation = {Windows_NT = 'Windows'}; + local os_name = osTranslation[env_OS] and osTranslation[env_OS] or env_OS + + local env_ARCH = os.getenv('PROCESSOR_ARCHITECTURE') + local archTranslation = {AMD64 = 'x86_64'}; + local arch_name = archTranslation[env_ARCH] and archTranslation[env_ARCH] or env_ARCH + + return os_name, arch_name + else + -- hopefullu a POSIX-y unix + local os_name = io.popen('uname -s', 'r'):read('*l') + local arch_name = io.popen('uname -m', 'r'):read('*l') + return os_name, arch_name + end end +local host_platform, arch = get_platform_details() +local target_arch = os.getenv('TARGET_ARCH') -- this can override what arch we're packaging +arch = target_arch and target_arch or arch + +local nixy = true and package.config:find('/') or false +local suffix = host_platform .. '_' .. arch +local libExt = ({ + Linux = '.so', -- + Windows = '.dll', -- + Darwin = '.dylib', +})[host_platform] +local extension = nixy and '.zip' or '.pk3' +local redirect_stdout = nixy and '>/dev/null' or '>nul' +local redirect_all = nixy and '>/dev/null 2>&1' or '>nul 2>&1' + +local function test_cmd(cmd) return os.execute((nixy and 'command -v ' or 'where.exe ') .. cmd .. redirect_all) end + local paks = { ['cl'] = { - ['bins'] = {'cgame' .. arch .. libExt, 'ui' .. arch .. libExt} + ['bins'] = {'cgame' .. arch .. libExt, 'ui' .. arch .. libExt}, -- pdb for windows? }, ['sv'] = { - ['bins'] = {'jampgame' .. arch .. libExt} + ['bins'] = {'jampgame' .. arch .. libExt}, -- pdb for windows? - } + }, } for prefix, pak in pairs(paks) do @@ -58,9 +84,15 @@ for prefix, pak in pairs(paks) do if #filelist ~= 0 then print('creating "' .. outname .. '"') - local redirect = (linux ~= false) and '>/dev/null 2>&1' or '>nul 2>&1' - -- FIXME: consider `zip` on macOS, check availability with `command -v foo` - os.execute('7z a -tzip -y ' .. outname .. ' ' .. filelist .. ' ' .. redirect) + local cmd = nil + if test_cmd('zip') then + cmd = 'zip ' .. outname .. ' ' .. filelist .. redirect_stdout + elseif test_cmd('7z') then + cmd = '7z a -tzip -y ' .. outname .. ' ' .. filelist .. ' ' .. redirect_stdout + else + error('can\'t find zip or 7z on PATH') + end + if os.execute(cmd) == nil then error() end end end end diff --git a/qcommon/q_shared.h b/qcommon/q_shared.h index 6bba931d..a500db4e 100644 --- a/qcommon/q_shared.h +++ b/qcommon/q_shared.h @@ -63,30 +63,32 @@ #if defined(_MSC_VER) // visual studio +#define Q_CDECL __cdecl +#define Q_EXPORT __declspec(dllexport) #define Q_FUNCTION __FUNCTION__ #define Q_FUNCTION_VERBOSE __FUNCSIG__ -#define Q_EXPORT __declspec(dllexport) #define Q_NAKED __declspec(naked) -#define Q_USED +#define Q_PRINT_FORMAT(stringPos, vaPos) #define Q_UNUSED +#define Q_USED #define Q_WARN_UNUSED_RESULT -#define Q_CDECL __cdecl #elif defined(__GNUC__) || defined(__clang__) // gcc, clang -#define Q_FUNCTION __FUNCTION__ -#define Q_FUNCTION_VERBOSE __PRETTY_FUNCTION__ -#define Q_EXPORT __attribute__((visibility("default"))) -#define Q_NAKED __attribute__((noinline)) -#define Q_USED __attribute__((used)) -#define Q_UNUSED __attribute__((unused)) -#define Q_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #if defined(QARCH_X86) #define Q_CDECL __attribute__((cdecl)) #else #define Q_CDECL #endif +#define Q_EXPORT __attribute__((visibility("default"))) +#define Q_FUNCTION __FUNCTION__ +#define Q_FUNCTION_VERBOSE __PRETTY_FUNCTION__ +#define Q_NAKED __attribute__((noinline)) +#define Q_PRINT_FORMAT(stringPos, vaPos) __attribute__((format(printf, stringPos, vaPos))) +#define Q_UNUSED __attribute__((unused)) +#define Q_USED __attribute__((used)) +#define Q_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #elif defined(__INTEL_COMPILER) @@ -715,7 +717,7 @@ extern const vector4 colorDkBlue; #define Q_COLOR_ESCAPE '^' #define Q_COLOR_BITS 0xF // was 7 // you MUST have the last bit on here about colour strings being less than 7 or taiwanese strings register as colour!!!! -//#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE && *((p)+1) <= '7' && *((p)+1) >= '0' ) +// #define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE && *((p)+1) <= '7' && *((p)+1) >= '0' ) #define Q_IsColorString(p) (p && *(p) == Q_COLOR_ESCAPE && *((p) + 1) && *((p) + 1) != Q_COLOR_ESCAPE && *((p) + 1) <= '9' && *((p) + 1) >= '0') #define Q_IsColorStringExt(p) ((p) && *(p) == Q_COLOR_ESCAPE && *((p) + 1) && *((p) + 1) >= '0' && *((p) + 1) <= '9') // ^[0-9] @@ -763,7 +765,7 @@ extern vector3 axisDefault[3]; float Q_fabs(float f); float Q_rsqrt(float f); // reciprocal square root -#define SQRTFAST(x) ((x)*Q_rsqrt(x)) +#define SQRTFAST(x) ((x) * Q_rsqrt(x)) signed char ClampChar(int i); signed short ClampShort(int i); @@ -780,8 +782,8 @@ void ByteToDir(int b, vector3 *dir); #define Square(x) ((x) * (x)) -#define DEG2RAD(a) (((a)*M_PI) / 180.0F) -#define RAD2DEG(a) (((a)*180.0f) / M_PI) +#define DEG2RAD(a) (((a) * M_PI) / 180.0F) +#define RAD2DEG(a) (((a) * 180.0f) / M_PI) void VectorAdd(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut); void VectorSubtract(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut); @@ -893,8 +895,8 @@ const char *SkipWhitespace(const char *data, qboolean *hasNewLines); char *COM_Parse(const char **data_p); char *COM_ParseExt(const char **data_p, qboolean allowLineBreak); ptrdiff_t COM_Compress(char *data_p); -void COM_ParseError(char *format, ...) __attribute__((format(printf, 1, 2))); -void COM_ParseWarning(char *format, ...) __attribute__((format(printf, 1, 2))); +void COM_ParseError(char *format, ...) Q_PRINT_FORMAT(1, 2); +void COM_ParseWarning(char *format, ...) Q_PRINT_FORMAT(1, 2); qboolean COM_ParseString(const char **data, const char **s); qboolean COM_ParseInt(const char **data, int *i); qboolean COM_ParseFloat(const char **data, float *f); @@ -955,8 +957,8 @@ const char *Q_stristr(const char *s, const char *find); void Q_CleanString(char *string, uint32_t flags); void Q_ConvertLinefeeds(char *string); void Q_LerpColour(const vector4 *start, const vector4 *end, vector4 *out, float point); -void Com_sprintf(char *dest, int size, const char *fmt, ...) __attribute__((format(printf, 3, 4))); -const char *va(const char *format, ...) __attribute__((format(printf, 1, 2))); +void Com_sprintf(char *dest, int size, const char *fmt, ...) Q_PRINT_FORMAT(3, 4); +const char *va(const char *format, ...) Q_PRINT_FORMAT(1, 2); // 64-bit integers for global rankings interface // implemented as a struct for qvm compatibility @@ -979,11 +981,11 @@ bool Info_NextPair(const char **s, infoPair_t *ip); // this is only here so the functions in q_shared.c and bg_*.c can link #if defined(PROJECT_GAME) || defined(PROJECT_CGAME) || defined(PROJECT_UI) -extern void (*Com_Error)(int level, const char *error, ...) __attribute__((format(printf, 2, 3))); -extern void (*Com_Printf)(const char *msg, ...) __attribute__((format(printf, 1, 2))); +extern void (*Com_Error)(int level, const char *error, ...) Q_PRINT_FORMAT(2, 3); +extern void (*Com_Printf)(const char *msg, ...) Q_PRINT_FORMAT(1, 2); #else -void Q_CDECL Com_Error(int level, const char *error, ...) __attribute__((format(printf, 2, 3))); -void Q_CDECL Com_Printf(const char *msg, ...) __attribute__((format(printf, 1, 2))); +void Q_CDECL Com_Error(int level, const char *error, ...) Q_PRINT_FORMAT(2, 3); +void Q_CDECL Com_Printf(const char *msg, ...) Q_PRINT_FORMAT(1, 2); #endif // Many variables can be used for cheating purposes, so when cheats is zero, force all unspecified variables to their @@ -1136,23 +1138,23 @@ typedef struct orientation_s { // channel 0 never willingly overrides // other channels will allways override a playing sound on that channel typedef enum soundChannel_e { - CHAN_AUTO, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # Auto-picks an empty channel to play sound on - CHAN_LOCAL, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # menu sounds, etc - CHAN_WEAPON, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" - CHAN_VOICE, //## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Voice sounds cause mouth animation - CHAN_VOICE_ATTEN, //## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Causes mouth animation but still use normal sound falloff - CHAN_ITEM, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" - CHAN_BODY, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" - CHAN_AMBIENT, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # added for ambient sounds - CHAN_LOCAL_SOUND, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #chat messages, etc - CHAN_ANNOUNCER, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #announcer voices, etc - CHAN_LESS_ATTEN, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #attenuates similar to chan_voice, but uses empty channel auto-pick behaviour - CHAN_MENU1, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #menu stuff, etc - CHAN_VOICE_GLOBAL, //## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Causes mouth animation and is broadcast, like announcer - CHAN_MUSIC, //## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #music played as a looping sound - added by BTO (VV) + CHAN_AUTO, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # Auto-picks an empty channel to play sound on + CHAN_LOCAL, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # menu sounds, etc + CHAN_WEAPON, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" + CHAN_VOICE, // ## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Voice sounds cause mouth animation + CHAN_VOICE_ATTEN, // ## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Causes mouth animation but still use normal sound falloff + CHAN_ITEM, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" + CHAN_BODY, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" + CHAN_AMBIENT, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" # added for ambient sounds + CHAN_LOCAL_SOUND, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #chat messages, etc + CHAN_ANNOUNCER, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #announcer voices, etc + CHAN_LESS_ATTEN, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #attenuates similar to chan_voice, but uses empty channel auto-pick behaviour + CHAN_MENU1, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #menu stuff, etc + CHAN_VOICE_GLOBAL, // ## %s !!"W:\game\base\!!sound\voice\*.wav;*.mp3" # Causes mouth animation and is broadcast, like announcer + CHAN_MUSIC, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #music played as a looping sound - added by BTO (VV) } soundChannel_t; -#define ANGLE2SHORT(x) ((int)((x)*65536 / 360) & 65535) +#define ANGLE2SHORT(x) ((int)((x) * 65536 / 360) & 65535) #define SHORT2ANGLE(x) ((x) * (360.0f / 65536)) #define SNAPFLAG_RATE_DELAYED 1 @@ -1317,9 +1319,9 @@ typedef enum forceSide_e { FORCESIDE_NEUTRAL, FORCESIDE_LIGHT, FORCESIDE_DARK } #define DUEL_FULLFORCE 0x00000002u #define DUEL_START 0x00000004u -//#define _ONEBIT_COMBO -// Crazy optimization attempt to take all those 1 bit values and shove them into a single -// send. May help us not have to send so many 1/0 bits to acknowledge modified values. -rww +// #define _ONEBIT_COMBO +// Crazy optimization attempt to take all those 1 bit values and shove them into a single +// send. May help us not have to send so many 1/0 bits to acknowledge modified values. -rww #define _OPTIMIZED_VEHICLE_NETWORKING // Instead of sending 2 full playerStates for the pilot and the vehicle, send a smaller, diff --git a/semver/SConscript b/semver/SConscript index 67ad4f3f..d6c55724 100644 --- a/semver/SConscript +++ b/semver/SConscript @@ -19,9 +19,12 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: semver_env["CFLAGS"] += [ "-std=c99", "-Wno-declaration-after-statement", - "-Wno-stack-usage", "-Wno-unused-function", ] + if "gcc" in env["CC"]: + semver_env["CFLAGS"] += [ + "-Wno-stack-usage", + ] # targets result = semver_env.StaticLibrary(build_dir + "libsemver", files) diff --git a/ui/SConscript b/ui/SConscript index cc0b2ee5..c7ce6b7e 100644 --- a/ui/SConscript +++ b/ui/SConscript @@ -79,4 +79,5 @@ if env["CC"] == "cl": ui_env["PDB"] = "#" + os.sep + "ui" + arch + ".pdb" # targets -ui_env.SharedLibrary("#" + os.sep + "ui" + arch, files) +result = ui_env.SharedLibrary("#" + os.sep + "ui" + arch, files) +Return("result")