From beb024ac3899a1ec37e45cc7e9e8d6e4054a1d49 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:31:05 +0100 Subject: [PATCH 01/15] build: crazy workflow idea --- .gitea/scripts/ci.sh | 18 ++++++++++++++++++ .gitea/workflows/ci.yml | 26 ++++++++++++++++++++++++++ iw5/scripts/mp/_jump.gsc | 6 ++++++ 3 files changed, 50 insertions(+) create mode 100755 .gitea/scripts/ci.sh create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh new file mode 100755 index 0000000..6772dfa --- /dev/null +++ b/.gitea/scripts/ci.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# setup +mkdir build +cd build +mkdir iw4 +mkdir iw5 +cd .. + +cp iw4/scripts/mp/_jump.gsc build/iw4 + +# replace gsc extension with c so GCC is happy +mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c + +# perform macro expansion +gcc -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in + +mv _jump.in build/iw5/_jump.gsc diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..4c6fec1 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,26 @@ +name: Build + +on: [push] +jobs: + build-linux: + runs-on: ubuntu-latest + + steps: + - name: Check out files + uses: actions/checkout@main + with: + submodules: true + fetch-depth: 0 + lfs: false + + - name: Create release + run: | + ./gitea/scripts/ci.sh + + - name: Upload release + uses: actions/upload-artifact@main + with: + name: release + path: | + build/iw4/_jump.gsc + build/iw5/_jump.gsc diff --git a/iw5/scripts/mp/_jump.gsc b/iw5/scripts/mp/_jump.gsc index 3f8fc0c..bbf6bf5 100644 --- a/iw5/scripts/mp/_jump.gsc +++ b/iw5/scripts/mp/_jump.gsc @@ -4,7 +4,11 @@ #define TOOL #endif +#if !defined(TOOL) #inline scripts\mp\_utility; +#else +#include "_utility.gsh" +#endif GENERIC_INIT; @@ -14,7 +18,9 @@ onPlayerConnect() { level waittill( "connected", player ); +#if defined(TOOL) waittillframeend; +#endif BOT_CHK( player ); -- 2.34.1 From a58ed1537b5202d66bec6aaad8a598101c7f4788 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:32:20 +0100 Subject: [PATCH 02/15] build: crazy workflow idea 2 --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4c6fec1..1a29060 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Create release run: | - ./gitea/scripts/ci.sh + .gitea\scripts\ci.sh - name: Upload release uses: actions/upload-artifact@main -- 2.34.1 From 012dfe6a53c2f8623a50e1ec3cced576efae1c83 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:32:47 +0100 Subject: [PATCH 03/15] build: crazy workflow idea 3 --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 1a29060..8f03b34 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Create release run: | - .gitea\scripts\ci.sh + .gitea/scripts/ci.sh - name: Upload release uses: actions/upload-artifact@main -- 2.34.1 From 2fb8e28071b530e7e4c96405471a53d0b5878f96 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:33:39 +0100 Subject: [PATCH 04/15] build: crazy workflow idea 4 --- iw5/scripts/mp/_jump.gsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iw5/scripts/mp/_jump.gsc b/iw5/scripts/mp/_jump.gsc index bbf6bf5..ee6d87e 100644 --- a/iw5/scripts/mp/_jump.gsc +++ b/iw5/scripts/mp/_jump.gsc @@ -4,7 +4,7 @@ #define TOOL #endif -#if !defined(TOOL) +#if defined(TOOL) #inline scripts\mp\_utility; #else #include "_utility.gsh" -- 2.34.1 From 50121a66a5e46f0d20ae2f8ecc3761114d2ac790 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:34:29 +0100 Subject: [PATCH 05/15] build: crazy workflow idea 5 --- .gitea/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8f03b34..4aa9e7d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Check out files - uses: actions/checkout@main + uses: actions/checkout@4 with: submodules: true fetch-depth: 0 @@ -18,7 +18,7 @@ jobs: .gitea/scripts/ci.sh - name: Upload release - uses: actions/upload-artifact@main + uses: actions/upload-artifact@v3.1.2 with: name: release path: | -- 2.34.1 From 183a1ca6a88b6e129f0a4611aa398bfad3b15404 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:35:20 +0100 Subject: [PATCH 06/15] build: crazy workflow idea 6 --- .gitea/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4aa9e7d..0a4d111 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -22,5 +22,4 @@ jobs: with: name: release path: | - build/iw4/_jump.gsc - build/iw5/_jump.gsc + build -- 2.34.1 From 8a3dbd4edbc41f1524391bfca3acb1040e1919b5 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:35:56 +0100 Subject: [PATCH 07/15] build: crazy workflow idea 7 --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0a4d111..c331f3f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Check out files - uses: actions/checkout@4 + uses: actions/checkout@3 with: submodules: true fetch-depth: 0 -- 2.34.1 From 4cb2b25ad34390cfc0f17429af05af823f925f5c Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:36:09 +0100 Subject: [PATCH 08/15] build: crazy workflow idea 8 --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c331f3f..d031efb 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Check out files - uses: actions/checkout@3 + uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 -- 2.34.1 From d935b12b35adbe64a7174137023d7dcd85403571 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:47:20 +0100 Subject: [PATCH 09/15] build: crazy workflow idea 69 --- .gitea/scripts/ci.sh | 5 ++++- .gitea/scripts/clean.py | 20 ++++++++++++++++++++ .gitea/workflows/ci.yml | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .gitea/scripts/clean.py diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index 6772dfa..d26d5d6 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -15,4 +15,7 @@ mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c # perform macro expansion gcc -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in -mv _jump.in build/iw5/_jump.gsc +# remove things gcc added to the file +python3 .gitea/scripts/clean.py _jump.in _jump.gsc + +mv _jump.gsc build/iw5/_jump.gsc diff --git a/.gitea/scripts/clean.py b/.gitea/scripts/clean.py new file mode 100644 index 0000000..8c48d1c --- /dev/null +++ b/.gitea/scripts/clean.py @@ -0,0 +1,20 @@ +import sys + +def erase_commented_lines(filename, out): + with open(filename, 'r') as file: + lines = file.readlines() + + lines = [line for line in lines if not line.startswith('#')] + + with open(out, 'w') as file: + file.writelines(lines) + +def main(): + if len(sys.argv) != 3: + print(f'Usage: python3 {sys.argv[0]} ') + return + + erase_commented_lines(sys.argv[1], sys.argv[2]) + +if __name__ == '__main__': + main() diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d031efb..136f6cf 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: .gitea/scripts/ci.sh - name: Upload release - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v3 with: name: release path: | -- 2.34.1 From 82f2702463618e3f9adbdd3359110e0a37e0828c Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:51:36 +0100 Subject: [PATCH 10/15] build: crazy workflow idea 80 --- .gitea/scripts/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index d26d5d6..3e30d45 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -13,7 +13,7 @@ cp iw4/scripts/mp/_jump.gsc build/iw4 mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c # perform macro expansion -gcc -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in +gcc -std=c++2a -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in # remove things gcc added to the file python3 .gitea/scripts/clean.py _jump.in _jump.gsc -- 2.34.1 From be8b67d048e1e6aa9191f02b89e17363873621c9 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:52:17 +0100 Subject: [PATCH 11/15] build: crazy workflow idea 81 --- .gitea/scripts/ci.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index 3e30d45..8c7648d 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -9,11 +9,11 @@ cd .. cp iw4/scripts/mp/_jump.gsc build/iw4 -# replace gsc extension with c so GCC is happy -mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c +# replace gsc extension with cpp so GCC is happy +mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.cpp # perform macro expansion -gcc -std=c++2a -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in +g++ -std=c++2a -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.cpp" -o _jump.in # remove things gcc added to the file python3 .gitea/scripts/clean.py _jump.in _jump.gsc -- 2.34.1 From 38483a880961017fdab3997f3a7f90179e3c7e22 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 17:53:30 +0100 Subject: [PATCH 12/15] build: crazy workflow idea 81 --- .gitea/scripts/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index 8c7648d..4e30b75 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -13,7 +13,7 @@ cp iw4/scripts/mp/_jump.gsc build/iw4 mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.cpp # perform macro expansion -g++ -std=c++2a -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.cpp" -o _jump.in +g++ -std=c++20 -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.cpp" -o _jump.in # remove things gcc added to the file python3 .gitea/scripts/clean.py _jump.in _jump.gsc -- 2.34.1 From b74ebc666870a52d36e8a80b40bbb5e8d7f0e3db Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 18:06:12 +0100 Subject: [PATCH 13/15] build: crazy workflow idea 81 --- .gitea/scripts/ci.sh | 4 ++-- iw5/scripts/mp/_utility.gsh | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index 4e30b75..bfcb3f1 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -10,10 +10,10 @@ cd .. cp iw4/scripts/mp/_jump.gsc build/iw4 # replace gsc extension with cpp so GCC is happy -mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.cpp +mv iw5/scripts/mp/_jump.c iw5/scripts/mp/_jump.cpp # perform macro expansion -g++ -std=c++20 -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.cpp" -o _jump.in +gcc -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in # remove things gcc added to the file python3 .gitea/scripts/clean.py _jump.in _jump.gsc diff --git a/iw5/scripts/mp/_utility.gsh b/iw5/scripts/mp/_utility.gsh index f3f99fd..bf189c3 100644 --- a/iw5/scripts/mp/_utility.gsh +++ b/iw5/scripts/mp/_utility.gsh @@ -40,25 +40,21 @@ /* Do not use the + to concatenate strings, let the GSC VM do it for you */ /* Other clients will have print available */ #if defined(IW4MP) - #define PRINT_FUNC printConsole + #define PRINT_FUNC_NAME printConsole #else - #define PRINT_FUNC print -#endif - -#if !defined(TOOL) - PRINT_FUNC( format __VA_OPT__(,) __VA_ARGS__ ) + #define PRINT_FUNC_NAME print #endif #ifdef _UTILITY_DEBUG -#define _VERIFY( cond, msg ) \ - assertEx(cond, msg) + #define _VERIFY(cond, msg) \ + assertEx( cond, msg ) -#define DEBUG_PRINT(msg) \ - PRINT_FUNC(msg) + #define DEBUG_PRINT(msg) \ + PRINT_FUNC_NAME( msg ) #else -/* The following are "empty" defines with gsc-tool */ -#define _VERIFY(cond, msg) -#define DEBUG_PRINT(msg) + /* The following are "empty" defines with gsc-tool */ + #define _VERIFY(cond, msg) + #define DEBUG_PRINT(msg) #endif /* Use Cbuf. Should use the + to concatenate strings before using this */ @@ -106,7 +102,7 @@ #endif #if !defined(TOOL) -#define PLAYER_NOTIFY_CMD(ent, str, action) ent notifyOnPlayerCommand( str, action ) + #define PLAYER_NOTIFY_CMD(ent, str, action) ent notifyOnPlayerCommand( str, action ) #endif /* Tweak as necessary. Can be return, continue or break */ -- 2.34.1 From 9a3697ac6e8af57482c7b2e01dfbf03ba1108891 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 18:08:06 +0100 Subject: [PATCH 14/15] build: crazy workflow idea 81 --- .gitea/scripts/ci.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index bfcb3f1..be11d37 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -7,15 +7,17 @@ mkdir iw4 mkdir iw5 cd .. +# ready for release cp iw4/scripts/mp/_jump.gsc build/iw4 -# replace gsc extension with cpp so GCC is happy -mv iw5/scripts/mp/_jump.c iw5/scripts/mp/_jump.cpp +# replace gsc extension with c. It will make gcc very happy +mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c # perform macro expansion gcc -D_UTILITY_DEBUG -DIW5 -DCI -E "iw5/scripts/mp/_jump.c" -o _jump.in -# remove things gcc added to the file +# remove things gcc added to the file that we do not need python3 .gitea/scripts/clean.py _jump.in _jump.gsc +# ready for release mv _jump.gsc build/iw5/_jump.gsc -- 2.34.1 From 5a2c9727f3f437f117dc9eed35ffd384f5130c4b Mon Sep 17 00:00:00 2001 From: Jack Back Date: Wed, 20 Mar 2024 18:09:38 +0100 Subject: [PATCH 15/15] format --- iw5/scripts/mp/_jump.gsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iw5/scripts/mp/_jump.gsc b/iw5/scripts/mp/_jump.gsc index ee6d87e..79b6339 100644 --- a/iw5/scripts/mp/_jump.gsc +++ b/iw5/scripts/mp/_jump.gsc @@ -131,6 +131,6 @@ onPlayerSpawned() { self waittill( "spawned_player" ); - self setPerk( "specialty_marathon", true, false ); + self setPerk( "specialty_marathon", true, false ); } } -- 2.34.1