From abda5fb4937716069d57b06bca19f220b446d0af Mon Sep 17 00:00:00 2001 From: Jack Back Date: Thu, 21 Mar 2024 10:18:08 +0100 Subject: [PATCH 1/4] iw5: more cursed macros --- iw5/scripts/mp/_jump.gsc | 15 +++++---------- iw5/scripts/mp/_utility.gsh | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/iw5/scripts/mp/_jump.gsc b/iw5/scripts/mp/_jump.gsc index a272ea7..29d565e 100644 --- a/iw5/scripts/mp/_jump.gsc +++ b/iw5/scripts/mp/_jump.gsc @@ -30,7 +30,8 @@ _ON_PLAYER_CNCT_BEGIN player thread jumper(); player thread displaySpeed(); - player thread onPlayerSpawned(); + + _ON_PLAYER_SPAWNED_COROUTINE( player ); _ON_PLAYER_CNCT_END @@ -119,14 +120,8 @@ jumper() } } -onPlayerSpawned() -{ - GENERIC_COROUTINE_END; - - while ( true ) - { - self waittill( "spawned_player" ); +_ON_PLAYER_SPAWNED_BEGIN self setPerk( "specialty_marathon", true, false ); - } -} + +_ON_PLAYER_SPAWNED_END diff --git a/iw5/scripts/mp/_utility.gsh b/iw5/scripts/mp/_utility.gsh index fd4cb7e..0506e39 100644 --- a/iw5/scripts/mp/_utility.gsh +++ b/iw5/scripts/mp/_utility.gsh @@ -55,6 +55,21 @@ } \ } +#define _ON_PLAYER_SPAWNED_COROUTINE(ent) \ + ent thread onPlayerSpawned() + +/* Captures a "spawned" event. Perform your action(s) using the "self" variable */ +#define _ON_PLAYER_SPAWNED_BEGIN onPlayerSpawned() \ + { \ + GENERIC_COROUTINE_END \ + while ( true ) \ + { \ + self waittill( "spawned_player" ); + +#define _ON_PLAYER_SPAWNED_END \ + } \ + } + /* IW4x MP has printConsole Built-in. __VA_OPT__ requires C++20 compliant preprocessor */ /* Do not use the + to concatenate strings, let the GSC VM do it for you */ /* Other clients will have print available */ -- 2.34.1 From 7bbb15b71351dd35d2eb5fba960b5498dc7679ae Mon Sep 17 00:00:00 2001 From: Jack Back Date: Thu, 21 Mar 2024 10:25:09 +0100 Subject: [PATCH 2/4] build: small ci improvement --- .gitea/scripts/ci.sh | 2 ++ .gitea/workflows/ci.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/scripts/ci.sh b/.gitea/scripts/ci.sh index be11d37..df739ba 100755 --- a/.gitea/scripts/ci.sh +++ b/.gitea/scripts/ci.sh @@ -9,6 +9,7 @@ cd .. # ready for release cp iw4/scripts/mp/_jump.gsc build/iw4 +echo "Created release for IW4" # replace gsc extension with c. It will make gcc very happy mv iw5/scripts/mp/_jump.gsc iw5/scripts/mp/_jump.c @@ -21,3 +22,4 @@ python3 .gitea/scripts/clean.py _jump.in _jump.gsc # ready for release mv _jump.gsc build/iw5/_jump.gsc +echo "Created release for IW5" diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 136f6cf..0b1dc9d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -14,8 +14,9 @@ jobs: lfs: false - name: Create release + shell: bash run: | - .gitea/scripts/ci.sh + -e .gitea/scripts/ci.sh - name: Upload release uses: actions/upload-artifact@v3 -- 2.34.1 From 19a616764eb7974c5c282221e0dc4b7b001d45e0 Mon Sep 17 00:00:00 2001 From: Jack Back Date: Thu, 21 Mar 2024 10:26:37 +0100 Subject: [PATCH 3/4] build: small ci improvement (maybe) --- .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 0b1dc9d..746ebd0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -14,9 +14,8 @@ jobs: lfs: false - name: Create release - shell: bash run: | - -e .gitea/scripts/ci.sh + bash -e .gitea/scripts/ci.sh - name: Upload release uses: actions/upload-artifact@v3 -- 2.34.1 From b65c498ea849868f8fab4ad5b9c64bc26b17604e Mon Sep 17 00:00:00 2001 From: Jack Back Date: Mon, 8 Apr 2024 14:18:16 +0200 Subject: [PATCH 4/4] maint: remove gsc-tool hacks --- iw5/scripts/mp/_jump.gsc | 9 --------- iw5/scripts/mp/_utility.gsh | 6 ++---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/iw5/scripts/mp/_jump.gsc b/iw5/scripts/mp/_jump.gsc index 29d565e..6834193 100644 --- a/iw5/scripts/mp/_jump.gsc +++ b/iw5/scripts/mp/_jump.gsc @@ -14,19 +14,10 @@ GENERIC_INIT; _ON_PLAYER_CNCT_BEGIN -#if defined(TOOL) - waittillframeend; -#endif - BOT_CHK( player ); -#if defined(TOOL) - player notifyOnPlayerCommand( "save_pos", "+reload" ); - player notifyOnPlayerCommand( "load_saved_pos", "+activate" ); -#else PLAYER_NOTIFY_CMD( player, "save_pos", "+reload" ); PLAYER_NOTIFY_CMD( player, "load_saved_pos", "+activate" ); -#endif player thread jumper(); player thread displaySpeed(); diff --git a/iw5/scripts/mp/_utility.gsh b/iw5/scripts/mp/_utility.gsh index 0506e39..a7e5372 100644 --- a/iw5/scripts/mp/_utility.gsh +++ b/iw5/scripts/mp/_utility.gsh @@ -135,14 +135,12 @@ #define WAIT_ANY_RET(ent, ...) ent waittill_any_return( __VA_ARGS__ ) #endif -#if !defined(TOOL) - #define PLAYER_NOTIFY_CMD(ent, str, action) ent notifyOnPlayerCommand( str, action ) -#endif +#define PLAYER_NOTIFY_CMD(ent, str, action) ent notifyOnPlayerCommand( str, action ) /* Tweak as necessary. Can be return, continue or break */ #define CHK_ACTION continue -#if (defined(IW4MP) || defined(IW5x) || defined(IW5)) && !defined(TOOL) +#if (defined(IW4MP) || defined(IW5x) || defined(IW5)) #define BOT_CHK(ent) \ if ( ent isTestClient() ) \ { \ -- 2.34.1