From 38cc7813dd54d0e33aa8f70afeba64e352e56fb1 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Mon, 12 Aug 2024 18:01:46 +0200 Subject: [PATCH 01/14] Modernize the README. Convert to markdown and follow the same style as the yquake2 main repository. Use it's resources were appropriate. --- README | 32 --------------------------- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 32 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 5834789..0000000 --- a/README +++ /dev/null @@ -1,32 +0,0 @@ -This is a 64 bit clean and bugfixed version of id Software's Quake II -addon pack "Capture The Flag", developed by David 'Zoid' Kirsch. Hundred -of type errors and strange constructs were fixed, thus this version -should run much more stable than the old SDK version. While it may work -with every Quake II client, the "Yamagi Quake II" client is highly -recommended. For more Information visit http://www.yamagi.org/quake2. - -Installation for FreeBSD, Linux and OpenBSD: --------------------------------------------- -1. Type "make" or "gmake" to compile the game.so. -2. Copy release/game.so to the ctf/ subfolder of your Quake II - installation. The CTF gamedata is part of the 3.20 point release. -3. Start the game with "./quake2 +set game ctf". - -Installation for OS X: ----------------------- -1. Copy game.dll from the zip-archive to ctf/. -2. Start the game with "quake2 +set game ctf" - -If you want to compile 'ctf' for OS X from source, please take a look at -the "Installation" section of the README of the Yamagi Quake II client. -In the same file the integration into an app-bundle is explained. - -Installation for Windows: -------------------------- -1. Copy the game.dll to the ctf\ subfolder of your Quake II - installation. The CTF gamedata is part of the 3.20 point release. -2. Start the game with "quake2.exe +set game ctf". - -If you want to compile 'ctf' for Windows from source, please take a -look at the "Installation" section of the README of the Yamagi Quake -II client. There's descripted how to setup the build environment. diff --git a/README.md b/README.md new file mode 100644 index 0000000..35ee6c3 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# Three Wave Capture The Flag for Yamagi Quake II + +Three Wave Capture The Flag for Yamagi Quake II is a bugfixed version of +the official CTF addon for Quake II. It's based upon the Quake II source +code release and and is licensed under GPL version 2: + +* [LICENSE](https://github.com/yquake2/ctf/blob/master/LICENSE) + +Several bugs were fixed. The addon is intended to be used with Yamagi +Quake II, but it's also fully backward compatible with the last Quake II +pointrelease 3.20 and may work with other source ports. + +Officially supported operating systems are: + +* FreeBSD +* Linux +* Windows + +Beside theses Three Wave Capture The Flag for Yamagi Quake II has +community support for MacOS and most other unixoid operating systems, +including NetBSD, OpenBSD and Solaris. + + +## Development + +Three Wave Capture The Flag for Yamagi Quake II is a community driven +project and lives from community involvement. Please report bugs in our +issue tracker: + +* [Issue Tracker](https://github.com/yquake2/ctf/issues) + +We are always open to code contributions, no matter if they are small +bugfixes or bigger features. However, Yamagi Quake II is a conservative +project with big focus on stability and backward compatibility. We don't +accept breaking changes. When in doubt please open an issue and ask if a +contribution in welcome before putting too much work into it. Open a +pull request to submit code: + +* [Pull Requests](https://github.com/yquake2/ctf/pulls) + +Also have a look at our contributors guide: + +* [Contributors Guide](https://github.com/yquake2/yquake2/blob/master/doc/080_contributing.md) + + +## Documentation + +Yamagi Quake II has rather extensive documentation covering all relevant +areas from installation and configuration to package building. Have a +look at the documentation index: + +* [Documentation Index](https://github.com/yquake2/yquake2/blob/master/doc/010_index.md) + + +## Releases + +Three Wave Capture The Flag for Yamagi Quake II releases at an irregular +schedule. The official releases with source code tarballs and prebuild +Windows binaries can be found at the homepage: + +* [Homepage](https://www.yamagi.org/quake2/) + +Our CI builds **unsupported** Linux, MacOS and Windows binaries at every +commit. The artifacts can be found here: + +* [Github Actions](https://github.com/yquake2/ctf/actions) From b8a45290a25d7291846d6b220e58fdcb3e239b79 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Mon, 12 Aug 2024 18:03:50 +0200 Subject: [PATCH 02/14] Add CI workflows for Linux, MacOS and Windows. This is equivalent to the CI workflows added to the yquake2 main repository. The workflows are triggered on commit, for new pull requests and when the pull request branch is updated. The CI is mostly for providing users with up to date test builds. --- .github/workflows/linux.yml | 45 +++++++++++++++++++++++++++++ .github/workflows/macos.yml | 50 +++++++++++++++++++++++++++++++++ .github/workflows/win32.yml | 56 +++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/win32.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..8e24937 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,45 @@ +name: Testbuild for Linux +run-name: testbuild_linux +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_ubuntu_x64_64: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - env: ubuntu + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: | + # Public runners come with 2 CPUs. + make -j2 + - name: Create testbuild package + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-linux-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-linux-${{github.sha}}/ + # Copy misc assets + cp LICENSE publish/quake2-ctf-linux-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-linux-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-ctf-linux-${{github.sha}} + path: publish/ + if-no-files-found: error diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..f37e8d2 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,50 @@ +name: Testbuild for MacOS +run-name: testbuild_macos +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_macos_aarch64: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - env: macos + steps: + - name: Install build dependencies + run: | + brew update + brew install make + brew upgrade + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: | + # Public runners come with 3 CPUs. + gmake -j3 + - name: Create testbuild package + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-macos-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-macos-${{github.sha}}/ + # Copy misc assets + cp LICENSE publish/quake2-ctf-macos-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-macos-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-ctf-macos-${{github.sha}} + path: publish/ + if-no-files-found: error diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml new file mode 100644 index 0000000..9a07fa9 --- /dev/null +++ b/.github/workflows/win32.yml @@ -0,0 +1,56 @@ +name: Testbuild for Win32 +run-name: testbuild_win32 +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_mingw_x86_32: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { sys: mingw32, env: i686 } + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: >- + git + make + mingw-w64-${{matrix.env}}-gcc + mingw-w64-${{matrix.env}}-make + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + shell: msys2 {0} + run: | + # Public runners come with 2 CPUs. + make -j2 + - name: Create testbuild package + shell: msys2 {0} + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-win32-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-win32-${{github.sha}}/ + # Copy misc assets + cp LICENSE publish/quake2-ctf-win32-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-win32-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-ctf-win32-${{github.sha}} + path: publish/ + if-no-files-found: error From 6a2d5125f6ef4f2bdaa45e5d0979d47409535d84 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Mon, 12 Aug 2024 18:21:51 +0200 Subject: [PATCH 03/14] There's no need to run `brew upgrade`. --- .github/workflows/macos.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f37e8d2..4210fb6 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -26,7 +26,6 @@ jobs: run: | brew update brew install make - brew upgrade - name: Check out repository code uses: actions/checkout@v4 - name: Build From 787de54da5f7337711fad21c7175eb412c5cfde0 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 9 Feb 2025 10:55:51 +0100 Subject: [PATCH 04/14] Update CI to use 4 CPUs on Linux and Windows. --- .github/workflows/linux.yml | 4 ++-- .github/workflows/win32.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8e24937..2f95f1d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -26,8 +26,8 @@ jobs: uses: actions/checkout@v4 - name: Build run: | - # Public runners come with 2 CPUs. - make -j2 + # Public runners come with 4 CPUs. + make -j4 - name: Create testbuild package run: | # Create release directory tree diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml index 9a07fa9..19f9f03 100644 --- a/.github/workflows/win32.yml +++ b/.github/workflows/win32.yml @@ -36,8 +36,8 @@ jobs: - name: Build shell: msys2 {0} run: | - # Public runners come with 2 CPUs. - make -j2 + # Public runners come with 4 CPUs. + make -j4 - name: Create testbuild package shell: msys2 {0} run: | From b9cac9410eb3c4969fe46bae24bef16c3357838a Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 9 Feb 2025 11:33:45 +0100 Subject: [PATCH 05/14] Rename the Linux/x86_64 workflow file. This is a preparation of an upcoming Linux/aarch64 build. While here switch back to Ubuntu 22.04 as builder, we should use the same Ubuntu version everywhere. --- .../workflows/{linux.yml => linux_x86_64.yml} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename .github/workflows/{linux.yml => linux_x86_64.yml} (64%) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux_x86_64.yml similarity index 64% rename from .github/workflows/linux.yml rename to .github/workflows/linux_x86_64.yml index 2f95f1d..bfa53d0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux_x86_64.yml @@ -1,5 +1,5 @@ -name: Testbuild for Linux -run-name: testbuild_linux +name: Testbuild for Linux (x86_64) +run-name: testbuild_linux_x86_64 on: push: branches: @@ -14,8 +14,8 @@ concurrency: group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: - build_ubuntu_x64_64: - runs-on: ubuntu-latest + build_ubuntu_x86_64: + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: @@ -31,15 +31,15 @@ jobs: - name: Create testbuild package run: | # Create release directory tree - mkdir -p publish/quake2-ctf-linux-${{github.sha}}/misc/docs + mkdir -p publish/quake2-ctf-linux_x86_64-${{github.sha}}/misc/docs # Copy release assets - cp -r release/* publish/quake2-ctf-linux-${{github.sha}}/ + cp -r release/* publish/quake2-ctf-linux_x86_64-${{github.sha}}/ # Copy misc assets - cp LICENSE publish/quake2-ctf-linux-${{github.sha}}/misc/docs/LICENSE.txt - cp README.md publish/quake2-ctf-linux-${{github.sha}}/misc/docs/README.txt + cp LICENSE publish/quake2-ctf-linux_x86_64-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-linux_x86_64-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: - name: quake2-ctf-linux-${{github.sha}} + name: quake2-ctf-linux_x86_64-${{github.sha}} path: publish/ if-no-files-found: error From 693e82ffa4a91830de3712de4de14483a0a343c0 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 9 Feb 2025 11:34:17 +0100 Subject: [PATCH 06/14] Add a Linux/aarch64 workflow file. --- .github/workflows/linux_aarch64.yml | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/linux_aarch64.yml diff --git a/.github/workflows/linux_aarch64.yml b/.github/workflows/linux_aarch64.yml new file mode 100644 index 0000000..ef11725 --- /dev/null +++ b/.github/workflows/linux_aarch64.yml @@ -0,0 +1,45 @@ +name: Testbuild for Linux (aarch64) +run-name: testbuild_linux_aarch64 +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_ubuntu_aarch64: + runs-on: ubuntu-22.04-arm + strategy: + fail-fast: false + matrix: + include: + - env: ubuntu + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: | + # Public runners come with 4 CPUs. + make -j4 + - name: Create testbuild package + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-linux_aarch64-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-linux_aarch64-${{github.sha}}/ + # Copy misc assets + cp LICENSE publish/quake2-ctf-linux_aarch64-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-linux_aarch64-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-ctf-linux_aarch64-${{github.sha}} + path: publish/ + if-no-files-found: error From 0a7e3c9c781473ad96826352d18f4cdbd49bd64f Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 9 Feb 2025 11:34:53 +0100 Subject: [PATCH 07/14] Add a Win64 workflow file. --- .github/workflows/win64.yml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/win64.yml diff --git a/.github/workflows/win64.yml b/.github/workflows/win64.yml new file mode 100644 index 0000000..419a072 --- /dev/null +++ b/.github/workflows/win64.yml @@ -0,0 +1,56 @@ +name: Testbuild for Win64 +run-name: testbuild_win64 +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_mingw_x86_64: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { sys: mingw64, env: x86_64 } + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: >- + git + make + mingw-w64-${{matrix.env}}-gcc + mingw-w64-${{matrix.env}}-make + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + shell: msys2 {0} + run: | + # Public runners come with 4 CPUs. + make -j4 + - name: Create testbuild package + shell: msys2 {0} + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-win64-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-win64-${{github.sha}}/ + # Copy misc assets + cp LICENSE publish/quake2-ctf-win64-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-win64-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-ctf-win64-${{github.sha}} + path: publish/ + if-no-files-found: error From 869b18c329c42db967f71f07a66473189f44cf11 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 22 Feb 2025 11:29:42 +0100 Subject: [PATCH 08/14] Force C standard to gnu99 in cmake builds. The Makefiles forces gnu99 since ages. Additionally gcc15 started to default to C23 and our code doesn't (yet) build with it. Reported in issue #20. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 072c844..0f237ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,11 @@ project(yquake2-ctf) # Enforce compiler flags (GCC / Clang compatible, yquake2 # won't build with another compiler anyways) +# -std=gnu99 -> Force same C standard as in the Makefile # -Wall -> More warnings # -fno-strict-aliasing -> Quake 2 is far away from strict aliasing # -fwrapv -> Make signed integer overflows defined -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -fwrapv") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrapv") # Use -O2 as maximum optimization level. -O3 has it's problems with yquake2. string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") From dcc5a1f616d2667f0613bdbf7f71b9a434c837c6 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 1 Mar 2025 12:47:50 +0100 Subject: [PATCH 09/14] Follow yquake2 and don't force a C standard in Makefile and CMakeLists. This reverts 869b18c. --- CMakeLists.txt | 3 +-- Makefile | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f237ac..072c844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,11 +13,10 @@ project(yquake2-ctf) # Enforce compiler flags (GCC / Clang compatible, yquake2 # won't build with another compiler anyways) -# -std=gnu99 -> Force same C standard as in the Makefile # -Wall -> More warnings # -fno-strict-aliasing -> Quake 2 is far away from strict aliasing # -fwrapv -> Make signed integer overflows defined -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrapv") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -fwrapv") # Use -O2 as maximum optimization level. -O3 has it's problems with yquake2. string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") diff --git a/Makefile b/Makefile index 1c1ebfe..ef457c6 100755 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ endif # to get it there... # -fwrapv for defined integer wrapping. MSVC6 did this # and the game code requires it. -override CFLAGS += -std=gnu99 -fno-strict-aliasing -fwrapv +override CFLAGS += -fno-strict-aliasing -fwrapv # -MMD to generate header dependencies. Unsupported by # the Clang shipped with OS X. From 887821682862c3c5376db9517fafbb0431e1e7d4 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 1 Mar 2025 12:48:49 +0100 Subject: [PATCH 10/14] Fix build with C23 by reusing the predefined bool type. --- src/header/shared.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/header/shared.h b/src/header/shared.h index 66e0bda..1c1f2fb 100644 --- a/src/header/shared.h +++ b/src/header/shared.h @@ -36,8 +36,21 @@ #include #include -typedef unsigned char byte; +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L // C23 or newer +typedef bool qboolean; +#else +#ifdef true + #undef true +#endif + +#ifdef false + #undef false +#endif + typedef enum {false, true} qboolean; +#endif + +typedef unsigned char byte; #ifndef NULL #define NULL ((void *)0) From c7a4b27bf67c9b09fe906bfb2263ff9f66fb57b6 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 15 Mar 2025 17:58:12 +0100 Subject: [PATCH 11/14] Fix (potential) problematic use cases of qboolean. xatrix had only one potential problematic use case, putting an int into qboolean. It would have worked if qboolean is a bool, but better do it right. No functional change intended. --- src/g_svcmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_svcmds.c b/src/g_svcmds.c index 4f1dd44..794b2e5 100644 --- a/src/g_svcmds.c +++ b/src/g_svcmds.c @@ -168,11 +168,11 @@ SV_FilterPacket(char *from) { if ((in & ipfilters[i].mask) == ipfilters[i].compare) { - return (int)filterban->value; + return (filterban->value != 0); } } - return (int)!filterban->value; + return (filterban->value == 0); } void From 3a1863f6251f7208c3ff7a231f521c4072819fbc Mon Sep 17 00:00:00 2001 From: Yamagi Date: Wed, 2 Apr 2025 11:22:25 +0200 Subject: [PATCH 12/14] Update the CHANGELOG. --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0e072b6..13fa929 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Three Wave Capture The Flag 1.10 to 1.11 +- Fix build in C23 mode. + Three Wave Capture The Flag 1.09 to 1.10 - Fix build on ARM Macs. From f3057fd2bcb9200ce7224bf7ed521432b585a773 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 11 May 2025 10:11:02 +0200 Subject: [PATCH 13/14] Fix C23 bool type being 1 byte long, while the enum bool is 4 bytes. C23 introduced `true` and `false` as language keywords, breaking YQ2s use of them. The first attempt to get C23 was to use the buildin `bool` type when building in C23 mode and the classic enum based `qboolean` in any other mode. This didn't take into acount, that `bool` is 1 byte long, while the enum based `qboolean` is 4 bytes long. This breaks savegames and may have impact for mods. Fix this by always using `int` as `qboolean` and the buildin `true` and `false` types, either in their C99 or C23 variant. This way `qboolean` is always 4 bytes long and the newly introduced `true` and `false` keywords don't clash. Suggested by @DanielGibson. --- src/header/shared.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/header/shared.h b/src/header/shared.h index 1c1f2fb..27fcffd 100644 --- a/src/header/shared.h +++ b/src/header/shared.h @@ -35,21 +35,9 @@ #include #include #include +#include -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L // C23 or newer -typedef bool qboolean; -#else -#ifdef true - #undef true -#endif - -#ifdef false - #undef false -#endif - -typedef enum {false, true} qboolean; -#endif - +typedef int qboolean; typedef unsigned char byte; #ifndef NULL From 4eae1f094ed3df97ba0ae588b7f180204bd689b1 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 11 May 2025 10:13:03 +0200 Subject: [PATCH 14/14] Update CHANGELOG. --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 13fa929..1742328 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Three Wave Capture The Flag 1.11 to 1.12 +- Fix mod incompatibilities when Yamagi Quake II is complied in C23 + mode. + Three Wave Capture The Flag 1.10 to 1.11 - Fix build in C23 mode.