From 244f21bf79d97de11db510fdcb60b44034b1899f Mon Sep 17 00:00:00 2001 From: cypress Date: Sun, 16 Jun 2024 08:41:13 -0700 Subject: [PATCH] Misc. QuakeC workflow improvements (#73) * REPO: Update progs.src standards, consolidate both ssqc to one src file * FTEQCC: Optimize SSQC with -O3 * PROGS: Globally disable useless fastarrays on standard * TOOLS: Consolidate Linux and macOS build scripts into one * Remove some debug stuff * ACTIONS: Change build script reference name --- .github/workflows/compile-and-release.yml | 2 +- progs/csqc.src | 22 ++++++ progs/fte-client.src | 15 ---- progs/fte-server.src | 55 -------------- progs/ssqc.src | 74 +++++++++++++++++++ progs/standard.src | 57 -------------- source/client/defs/custom.qc | 6 +- source/client/particles.qc | 3 +- source/server/utilities/weapon_utilities.qc | 16 ---- .../shared/{defs/custom.qc => shared_defs.qc} | 2 +- .../{weapon_defines.qc => weapon_stats.qc} | 2 +- tools/qc-compiler-gnu.sh | 29 ++++++++ tools/qc-compiler-lin.sh | 22 ------ tools/qc-compiler-mac.sh | 22 ------ tools/qc-compiler-win.bat | 6 +- 15 files changed, 136 insertions(+), 197 deletions(-) create mode 100644 progs/csqc.src delete mode 100644 progs/fte-client.src delete mode 100644 progs/fte-server.src create mode 100644 progs/ssqc.src delete mode 100644 progs/standard.src rename source/shared/{defs/custom.qc => shared_defs.qc} (99%) rename source/shared/{weapon_defines.qc => weapon_stats.qc} (99%) create mode 100755 tools/qc-compiler-gnu.sh delete mode 100755 tools/qc-compiler-lin.sh delete mode 100755 tools/qc-compiler-mac.sh diff --git a/.github/workflows/compile-and-release.yml b/.github/workflows/compile-and-release.yml index 4d255a3..bdcba51 100644 --- a/.github/workflows/compile-and-release.yml +++ b/.github/workflows/compile-and-release.yml @@ -16,7 +16,7 @@ jobs: working-directory: ./tools run: | sudo -i - ./qc-compiler-lin.sh + ./qc-compiler-gnu.sh echo "QC COMPILE STATUS - ${{ job.status }}." - name: Zip Progs working-directory: ./build diff --git a/progs/csqc.src b/progs/csqc.src new file mode 100644 index 0000000..e9846b0 --- /dev/null +++ b/progs/csqc.src @@ -0,0 +1,22 @@ +#pragma noref 1 +#pragma target fte_5768 +#pragma progs_dat "../build/fte/csprogs.dat" + +#pragma includedir "../source/client/" +#pragma includedir "../source/shared/" + +#includelist +defs/fte.qc +shared_defs.qc +sound_enhanced.qc +weapon_stats.qc +defs/custom.qc +menu.qc +achievements.qc +hud.qc +chat.qc +user_input.qc +view_model.qc +particles.qc +main.qc +#endlist \ No newline at end of file diff --git a/progs/fte-client.src b/progs/fte-client.src deleted file mode 100644 index 9a7c6b8..0000000 --- a/progs/fte-client.src +++ /dev/null @@ -1,15 +0,0 @@ -../../build/fte/csprogs.dat - -../source/client/defs/fte.qc -../source/shared/defs/custom.qc -../source/shared/sound_enhanced.qc -../source/shared/weapon_defines.qc -../source/client/defs/custom.qc -../source/client/menu.qc -../source/client/achievements.qc -../source/client/hud.qc -../source/client/chat.qc -../source/client/user_input.qc -../source/client/view_model.qc -../source/client/particles.qc -../source/client/main.qc diff --git a/progs/fte-server.src b/progs/fte-server.src deleted file mode 100644 index 25999d6..0000000 --- a/progs/fte-server.src +++ /dev/null @@ -1,55 +0,0 @@ -../../build/fte/qwprogs.dat - -../source/server/defs/fte.qc -../source/shared/defs/custom.qc -../source/server/defs/custom.qc -../source/shared/weapon_defines.qc -../source/server/utilities/math.qc -../source/server/clientfuncs.qc -../source/server/hash_table.qc - -../source/server/dummies.qc -../source/server/rounds.qc -../source/server/main.qc -../source/server/utilities/weapon_utilities.qc -../source/server/utilities/game_restart.qc -../source/server/utilities/command_parser.qc -../source/server/player.qc -../source/server/damage.qc - -../source/server/entities/sub_functions.qc -../source/server/entities/sounds.qc -../source/server/entities/triggers.qc -../source/server/entities/spawn_points.qc -../source/server/entities/explosive_barrel.qc -../source/server/entities/teleporter.qc -../source/server/entities/map_entities.qc -../source/server/entities/func.qc -../source/server/entities/traps.qc -../source/server/entities/lights.qc -../source/server/entities/pack_a_punch.qc -../source/server/entities/mystery_box.qc -../source/server/entities/doors.qc -../source/server/entities/window.qc -../source/server/entities/machines.qc -../source/server/entities/wall_weapon.qc - -../source/server/weapons/frames_core.qc -../source/server/weapons/rocket_launcher.qc -../source/server/weapons/ray_gun.qc -../source/server/weapons/tesla.qc -../source/server/weapons/flamethrower.qc -../source/server/weapons/grenade_launcher.qc -../source/server/weapons/bouncing_betty.qc -../source/server/weapons/weapon_core.qc - -../source/server/entities/powerups.qc - -../source/server/ai/pathfind_code.qc -../source/server/ai/ai_core.qc -../source/server/ai/fte/waypoints_core.qc -../source/server/ai/zombie_core.qc -../source/server/ai/crawler_core.qc -../source/server/ai/dog_core.qc - -../source/server/utilities/map_compatibility.qc \ No newline at end of file diff --git a/progs/ssqc.src b/progs/ssqc.src new file mode 100644 index 0000000..883660e --- /dev/null +++ b/progs/ssqc.src @@ -0,0 +1,74 @@ +#ifdef FTE +#pragma progs_dat "../build/fte/qwprogs.dat" +#pragma target fte_5768 +#else +#pragma progs_dat "../build/standard/progs.dat" +#pragma flag disable fastarrays +#endif + +#pragma warning disable Q208 +#pragma noref 1 + +#pragma includedir "../source/server/" +#pragma includedir "../source/shared/" + +#includelist +#ifdef FTE +defs/fte.qc +#else +defs/standard.qc +#endif +shared_defs.qc +defs/custom.qc +weapon_stats.qc +utilities/math.qc +clientfuncs.qc +hash_table.qc +dummies.qc +rounds.qc +main.qc +utilities/weapon_utilities.qc +utilities/game_restart.qc +utilities/command_parser.qc +player.qc +damage.qc +entities/sub_functions.qc +entities/sounds.qc +entities/triggers.qc +entities/spawn_points.qc +entities/explosive_barrel.qc +entities/teleporter.qc +entities/map_entities.qc +entities/func.qc +entities/traps.qc +entities/lights.qc +entities/pack_a_punch.qc +entities/mystery_box.qc +entities/doors.qc +entities/window.qc +entities/machines.qc +entities/wall_weapon.qc +weapons/frames_core.qc +weapons/rocket_launcher.qc +weapons/ray_gun.qc +weapons/tesla.qc +weapons/flamethrower.qc +weapons/grenade_launcher.qc +weapons/bouncing_betty.qc +weapons/weapon_core.qc +entities/powerups.qc +#ifdef FTE +ai/pathfind_code.qc +#endif +ai/ai_core.qc +#ifdef FTE +ai/fte/waypoints_core.qc +#else +ai/standard/waypoints_func.qc +ai/standard/waypoints_core.qc +#endif +ai/zombie_core.qc +ai/crawler_core.qc +ai/dog_core.qc +utilities/map_compatibility.qc +#endlist diff --git a/progs/standard.src b/progs/standard.src deleted file mode 100644 index e1b854f..0000000 --- a/progs/standard.src +++ /dev/null @@ -1,57 +0,0 @@ -../../build/standard/progs.dat - -#pragma warning disable Q208 - -../source/server/defs/standard.qc -../source/shared/defs/custom.qc -../source/server/defs/custom.qc -../source/shared/weapon_defines.qc -../source/server/utilities/math.qc -../source/server/clientfuncs.qc -../source/server/hash_table.qc - -../source/server/dummies.qc -../source/server/rounds.qc -../source/server/main.qc -../source/server/utilities/weapon_utilities.qc -../source/server/utilities/game_restart.qc -../source/server/utilities/command_parser.qc -../source/server/player.qc -../source/server/damage.qc - -../source/server/entities/sub_functions.qc -../source/server/entities/sounds.qc -../source/server/entities/triggers.qc -../source/server/entities/spawn_points.qc -../source/server/entities/explosive_barrel.qc -../source/server/entities/teleporter.qc -../source/server/entities/map_entities.qc -../source/server/entities/func.qc -../source/server/entities/traps.qc -../source/server/entities/lights.qc -../source/server/entities/pack_a_punch.qc -../source/server/entities/mystery_box.qc -../source/server/entities/doors.qc -../source/server/entities/window.qc -../source/server/entities/machines.qc -../source/server/entities/wall_weapon.qc - -../source/server/weapons/frames_core.qc -../source/server/weapons/rocket_launcher.qc -../source/server/weapons/ray_gun.qc -../source/server/weapons/tesla.qc -../source/server/weapons/flamethrower.qc -../source/server/weapons/grenade_launcher.qc -../source/server/weapons/bouncing_betty.qc -../source/server/weapons/weapon_core.qc - -../source/server/entities/powerups.qc - -../source/server/ai/ai_core.qc -../source/server/ai/standard/waypoints_func.qc -../source/server/ai/standard/waypoints_core.qc -../source/server/ai/zombie_core.qc -../source/server/ai/crawler_core.qc -../source/server/ai/dog_core.qc - -../source/server/utilities/map_compatibility.qc \ No newline at end of file diff --git a/source/client/defs/custom.qc b/source/client/defs/custom.qc index a6ce2f6..cb99020 100644 --- a/source/client/defs/custom.qc +++ b/source/client/defs/custom.qc @@ -147,9 +147,9 @@ float K_LEFTDOWN, K_RIGHTDOWN, K_BACKDOWN, K_FORWARDDOWN; #define P_FLOP 16 #define P_STAMIN 32 -vector TEXT_LIGHTBLUE = [(2/255), (118/255), (181/255)]; -vector TEXT_ORANGE = [(235/255), (189/255), 0]; -vector TEXT_GREEN = [0, (230/255), (34/255)]; +vector TEXT_LIGHTBLUE = [0, 0.46, 0.70]; +vector TEXT_ORANGE = [0.92, 0.74, 0]; +vector TEXT_GREEN = [0, 0.90, 0.13]; vector TEXT_RED = [1, 0, 0]; float screenflash_type; diff --git a/source/client/particles.qc b/source/client/particles.qc index ea69ee8..b7a01b2 100644 --- a/source/client/particles.qc +++ b/source/client/particles.qc @@ -66,7 +66,7 @@ void() Particles_MuzzleflashCallback = muzzleflash_position += v_forward * muzzleflash_offset_z; muzzleflash_position += v_right * muzzleflash_offset_x; - muzzleflash_position += v_up * muzzleflash_offset_y; + muzzleflash_position += v_up * muzzleflash_offset_y; float muzzleflash_type = rint(random() * 2); // Choose one of three Muzzleflash variances. @@ -92,6 +92,7 @@ void() Particles_MuzzleflashCallback = pointparticles(particleeffectnum("weapons.impact"), particle_position, '0 0 0', 1); pointparticles(particleeffectnum("weapons.impact_decal"), particle_position, '0 0 0', 1); } + }; // This struct must be ordered linearly for fast array lookups. Do NOT skip indexes. diff --git a/source/server/utilities/weapon_utilities.qc b/source/server/utilities/weapon_utilities.qc index 10abda9..75362b6 100644 --- a/source/server/utilities/weapon_utilities.qc +++ b/source/server/utilities/weapon_utilities.qc @@ -26,15 +26,6 @@ */ -// FTEQCC currently has an optimization bug with -fastarrays -// that leads to corruption with the weapon list. Disable -// if we're not on FTE. -#ifndef FTE - -#pragma flag disable fastarrays - -#endif // FTE - // TODO: Actually implement some of these.. // Frame types, generalized. #define ANIM_FIRE 0 @@ -447,10 +438,3 @@ void Weapon_RemoveWeapon(float slot) Weapon_AssignWeapon(slot, 0, 0, 0); Weapon_FixUpList(); }; - -// Re-enable fast array optimization. -#ifndef FTE - -#pragma flag enable fastarrays - -#endif // FTE diff --git a/source/shared/defs/custom.qc b/source/shared/shared_defs.qc similarity index 99% rename from source/shared/defs/custom.qc rename to source/shared/shared_defs.qc index f9a52e9..2de4cec 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/shared_defs.qc @@ -1,5 +1,5 @@ /* - shared/defs/custom.qc + shared/shared_defs.qc shared definitions diff --git a/source/shared/weapon_defines.qc b/source/shared/weapon_stats.qc similarity index 99% rename from source/shared/weapon_defines.qc rename to source/shared/weapon_stats.qc index 9db0887..69b9b41 100644 --- a/source/shared/weapon_defines.qc +++ b/source/shared/weapon_stats.qc @@ -1,5 +1,5 @@ /* - shared/weapon_defines.qc + shared/weapon_stats.qc all weapon stats are stored here diff --git a/tools/qc-compiler-gnu.sh b/tools/qc-compiler-gnu.sh new file mode 100755 index 0000000..2238e9f --- /dev/null +++ b/tools/qc-compiler-gnu.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +FTEQCC=fteqcc-cli-lin + +# Switch to macOS fteqcc binary if on that platform. +if [[ "$OSTYPE" == "darwin"* ]]; then + FTEQCC=fteqcc-cli-mac +fi + +cd ../ + +# generate hash table +echo "Generating Hash Table.." +python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc + +# create build directories +mkdir -p build/{fte,standard} + +cd bin/ + +# build.. +echo "Compiling FTE CSQC.." +./$FTEQCC -srcfile ../progs/csqc.src | grep -E -i "warning |error |defined |not |unknown |branches" +echo "Compiling FTE SSQC.." +./$FTEQCC -O3 -DFTE -srcfile ../progs/ssqc.src | grep -E -i "warning |error |defined |not |unknown |branches" +echo "Compiling Standard/Id SSQC.." +./$FTEQCC -O3 -srcfile ../progs/ssqc.src | grep -E -i "warning |error |defined |not |unknown |branches" + +echo "End of script." \ No newline at end of file diff --git a/tools/qc-compiler-lin.sh b/tools/qc-compiler-lin.sh deleted file mode 100755 index c26b49a..0000000 --- a/tools/qc-compiler-lin.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -cd ../ - -# generate hash table -echo "Generating Hash Table.." -python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc - -# create build directories -mkdir -p build/{fte,standard} - -cd bin/ - -# build.. -echo "Compiling FTE CSQC.." -./fteqcc-cli-lin -srcfile ../progs/fte-client.src | grep -E -i "warning |error |defined |not |unknown |branches" -echo "Compiling FTE SSQC.." -./fteqcc-cli-lin -O2 -srcfile ../progs/fte-server.src | grep -E -i "warning |error |defined |not |unknown |branches" -echo "Compiling Standard/Id SSQC.." -./fteqcc-cli-lin -O2 -srcfile ../progs/standard.src | grep -E -i "warning |error |defined |not |unknown |branches" - -echo "End of script." \ No newline at end of file diff --git a/tools/qc-compiler-mac.sh b/tools/qc-compiler-mac.sh deleted file mode 100755 index 9d3b840..0000000 --- a/tools/qc-compiler-mac.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -cd ../ - -# generate hash table -echo "Generating Hash Table.." -python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc - -# create build directories -mkdir -p build/{fte,standard} - -cd bin/ - -# build.. -echo "Compiling FTE CSQC.." -./fteqcc-cli-mac -srcfile ../progs/fte-client.src | grep -E -i "warning |error |defined |not |unknown |branches" -echo "Compiling FTE SSQC.." -./fteqcc-cli-mac -O2 -srcfile ../progs/fte-server.src | grep -E -i "warning |error |defined |not |unknown |branches" -echo "Compiling Standard/Id SSQC.." -./fteqcc-cli-mac -O2 -srcfile ../progs/standard.src | grep -E -i "warning |error |defined |not |unknown |branches" - -echo "End of script." \ No newline at end of file diff --git a/tools/qc-compiler-win.bat b/tools/qc-compiler-win.bat index c96f86e..dfa3c2b 100644 --- a/tools/qc-compiler-win.bat +++ b/tools/qc-compiler-win.bat @@ -14,11 +14,11 @@ CD bin/ REM ****** build.. ****** echo Compiling FTE CSQC.. -fteqcc-cli-win.exe -srcfile ../progs/fte-client.src +fteqcc-cli-win.exe -srcfile ../progs/csqc.src echo Compiling FTE SSQC.. -fteqcc-cli-win.exe -O2 -srcfile ../progs/fte-server.src +fteqcc-cli-win.exe -O3 -DFTE -srcfile ../progs/ssqc.src echo Compiling Standard/Id SSQC.. -fteqcc-cli-win.exe -O2 -srcfile ../progs/standard.src +fteqcc-cli-win.exe -O3 -srcfile ../progs/ssqc.src echo End of script. pause \ No newline at end of file