From 2aff8d6ec1d0c014f3ffecfffd51be23585b9587 Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 15 Mar 2016 16:48:05 +1100 Subject: [PATCH] client: pass compilation units test --- qcsrc/client/csqcmodel_hooks.qc | 20 -- qcsrc/client/csqcmodel_hooks.qh | 25 +++ qcsrc/client/hud/hud.qc | 3 + qcsrc/client/hud/hud.qh | 10 + qcsrc/client/hud/panel.qh | 5 + qcsrc/client/hud/panel/ammo.qc | 3 + qcsrc/client/hud/panel/ammo.qh | 1 + qcsrc/client/hud/panel/centerprint.qc | 3 + qcsrc/client/hud/panel/centerprint.qh | 1 + qcsrc/client/hud/panel/chat.qh | 1 + qcsrc/client/hud/panel/engineinfo.qh | 1 + qcsrc/client/hud/panel/healtharmor.qc | 3 + qcsrc/client/hud/panel/healtharmor.qh | 1 + qcsrc/client/hud/panel/infomessages.qc | 4 + qcsrc/client/hud/panel/infomessages.qh | 1 + qcsrc/client/hud/panel/minigame.qh | 1 + qcsrc/client/hud/panel/modicons.qc | 5 + qcsrc/client/hud/panel/modicons.qh | 1 + qcsrc/client/hud/panel/notify.qh | 1 + qcsrc/client/hud/panel/physics.qc | 4 + qcsrc/client/hud/panel/physics.qh | 1 + qcsrc/client/hud/panel/powerups.qc | 3 + qcsrc/client/hud/panel/powerups.qh | 1 + qcsrc/client/hud/panel/pressedkeys.qh | 1 + qcsrc/client/hud/panel/quickmenu.qh | 1 + qcsrc/client/hud/panel/racetimer.qc | 3 + qcsrc/client/hud/panel/racetimer.qh | 1 + qcsrc/client/hud/panel/radar.qc | 7 + qcsrc/client/hud/panel/radar.qh | 1 + qcsrc/client/hud/panel/score.qc | 5 + qcsrc/client/hud/panel/score.qh | 1 + qcsrc/client/hud/panel/timer.qh | 1 + qcsrc/client/hud/panel/vote.qc | 3 + qcsrc/client/hud/panel/vote.qh | 1 + qcsrc/client/hud/panel/weapons.qh | 1 + qcsrc/client/quickmenu.qc | 1 + qcsrc/client/scoreboard.qc | 11 +- qcsrc/client/shownames.qc | 9 +- qcsrc/client/view.qc | 36 ++-- qcsrc/common/debug.qh | 4 + qcsrc/common/minigames/cl_minigames_hud.qc | 8 + qcsrc/server/mutators/mutator/gamemode_ctf.qc | 176 +----------------- qcsrc/server/mutators/mutator/gamemode_ctf.qh | 170 +++++++++++++++++ qcsrc/tools/compilationunits.sh | 2 +- 44 files changed, 321 insertions(+), 221 deletions(-) create mode 100644 qcsrc/client/hud/panel.qh diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 376ef9b607..d0910e3745 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -460,26 +460,6 @@ void CSQCModel_AutoTagIndex_Apply(entity this) } } -// FEATURE: EF_NODRAW workalike -const int EF_BRIGHTFIELD = BIT(0); -const int EF_BRIGHTLIGHT = BIT(2); -const int EF_DIMLIGHT = BIT(3); -const int EF_DOUBLESIDED = BIT(15); -const int EF_NOSELFSHADOW = BIT(16); -const int EF_DYNAMICMODELLIGHT = BIT(17); -const int EF_RESTARTANIM_BIT = BIT(20); -const int EF_TELEPORT_BIT = BIT(21); -const int MF_ROCKET = BIT(0); // leave a trail -const int MF_GRENADE = BIT(1); // leave a trail -const int MF_GIB = BIT(2); // leave a trail -const int MF_ROTATE = BIT(3); // rotate (bonus items) -const int MF_TRACER = BIT(4); // green split trail -const int MF_ZOMGIB = BIT(5); // small blood trail -const int MF_TRACER2 = BIT(6); // orange split trail -const int MF_TRACER3 = BIT(7); // purple trail -.int csqcmodel_effects; -.int csqcmodel_modelflags; -.int csqcmodel_traileffect; void CSQCModel_Effects_PreUpdate(entity this) { this.effects = this.csqcmodel_effects; diff --git a/qcsrc/client/csqcmodel_hooks.qh b/qcsrc/client/csqcmodel_hooks.qh index 6f70f09bee..56a3fb4a54 100644 --- a/qcsrc/client/csqcmodel_hooks.qh +++ b/qcsrc/client/csqcmodel_hooks.qh @@ -1 +1,26 @@ #pragma once + +// FEATURE: EF_NODRAW workalike +const int EF_BRIGHTFIELD = BIT(0); +const int EF_BRIGHTLIGHT = BIT(2); +const int EF_DIMLIGHT = BIT(3); +const int EF_DOUBLESIDED = BIT(15); +const int EF_NOSELFSHADOW = BIT(16); +const int EF_DYNAMICMODELLIGHT = BIT(17); +const int EF_RESTARTANIM_BIT = BIT(20); +const int EF_TELEPORT_BIT = BIT(21); + +const int MF_ROCKET = BIT(0); // leave a trail +const int MF_GRENADE = BIT(1); // leave a trail +const int MF_GIB = BIT(2); // leave a trail +const int MF_ROTATE = BIT(3); // rotate (bonus items) +const int MF_TRACER = BIT(4); // green split trail +const int MF_ZOMGIB = BIT(5); // small blood trail +const int MF_TRACER2 = BIT(6); // orange split trail +const int MF_TRACER3 = BIT(7); // purple trail + +.int csqcmodel_effects; +.int csqcmodel_modelflags; +.int csqcmodel_traileffect; + +void CSQCModel_Effects_Apply(entity this); diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index b0f2b9ea65..a4cac531cc 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -410,6 +411,8 @@ Main HUD system ================== */ +void CSQC_BUMBLE_GUN_HUD(); + void HUD_Vehicle() { if(autocvar__hud_configure) return; diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index b931a34ef7..7664abc2f1 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -41,9 +41,19 @@ bool radar_panel_modified; float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary); void HUD_Radar_Hide_Maximized(); +float HUD_GetRowCount(int item_count, vector size, float item_aspect); +vector HUD_Get_Num_Color (float x, float maxvalue); +void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha); +void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp); +void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag); +vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect); + void HUD_Reset (); void HUD_Main (); +int race_CheckName(string net_name); +string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname); + int vote_yescount; int vote_nocount; int vote_needed; diff --git a/qcsrc/client/hud/panel.qh b/qcsrc/client/hud/panel.qh new file mode 100644 index 0000000000..66ca0772b6 --- /dev/null +++ b/qcsrc/client/hud/panel.qh @@ -0,0 +1,5 @@ +#pragma once + +#include "hud.qh" +#include "hud_config.qh" +#include diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index 12212ff857..0ccdbf2f03 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -1,4 +1,7 @@ #include "ammo.qh" + +#include + // Ammo (#1) void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color) diff --git a/qcsrc/client/hud/panel/ammo.qh b/qcsrc/client/hud/panel/ammo.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/ammo.qh +++ b/qcsrc/client/hud/panel/ammo.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index bf5a82ec68..cde2b501c8 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -1,4 +1,7 @@ #include "centerprint.qh" + +#include + // CenterPrint (#16) const int CENTERPRINT_MAX_MSGS = 10; diff --git a/qcsrc/client/hud/panel/centerprint.qh b/qcsrc/client/hud/panel/centerprint.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/centerprint.qh +++ b/qcsrc/client/hud/panel/centerprint.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/chat.qh b/qcsrc/client/hud/panel/chat.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/chat.qh +++ b/qcsrc/client/hud/panel/chat.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/engineinfo.qh b/qcsrc/client/hud/panel/engineinfo.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/engineinfo.qh +++ b/qcsrc/client/hud/panel/engineinfo.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/healtharmor.qc b/qcsrc/client/hud/panel/healtharmor.qc index ae901e05a7..3b03979177 100644 --- a/qcsrc/client/hud/panel/healtharmor.qc +++ b/qcsrc/client/hud/panel/healtharmor.qc @@ -1,4 +1,7 @@ #include "healtharmor.qh" + +#include + /** Health/armor (#3) */ void HUD_HealthArmor() { diff --git a/qcsrc/client/hud/panel/healtharmor.qh b/qcsrc/client/hud/panel/healtharmor.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/healtharmor.qh +++ b/qcsrc/client/hud/panel/healtharmor.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 8ddfe89c50..8199bd8dd6 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -1,4 +1,8 @@ #include "infomessages.qh" + +#include +#include + // Info messages panel (#14) #define drawInfoMessage(s) MACRO_BEGIN { \ diff --git a/qcsrc/client/hud/panel/infomessages.qh b/qcsrc/client/hud/panel/infomessages.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/infomessages.qh +++ b/qcsrc/client/hud/panel/infomessages.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/minigame.qh b/qcsrc/client/hud/panel/minigame.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/minigame.qh +++ b/qcsrc/client/hud/panel/minigame.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/modicons.qc b/qcsrc/client/hud/panel/modicons.qc index e6808d972b..727272e2ad 100644 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@ -1,4 +1,9 @@ #include "modicons.qh" + +#include +#include +#include // TODO: remove + // Mod icons panel (#10) bool mod_active; // is there any active mod icon? diff --git a/qcsrc/client/hud/panel/modicons.qh b/qcsrc/client/hud/panel/modicons.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/modicons.qh +++ b/qcsrc/client/hud/panel/modicons.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/notify.qh b/qcsrc/client/hud/panel/notify.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/notify.qh +++ b/qcsrc/client/hud/panel/notify.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/physics.qc b/qcsrc/client/hud/panel/physics.qc index 9b1db7b762..7a9f664eb2 100644 --- a/qcsrc/client/hud/panel/physics.qc +++ b/qcsrc/client/hud/panel/physics.qc @@ -1,4 +1,8 @@ #include "physics.qh" + +#include +#include + // Physics panel (#15) vector acc_prevspeed; diff --git a/qcsrc/client/hud/panel/physics.qh b/qcsrc/client/hud/panel/physics.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/physics.qh +++ b/qcsrc/client/hud/panel/physics.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 85ee99c8da..b4118e8445 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -1,4 +1,7 @@ #include "powerups.qh" + +#include + // Powerups (#2) // Powerup item fields (reusing existing fields) diff --git a/qcsrc/client/hud/panel/powerups.qh b/qcsrc/client/hud/panel/powerups.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/powerups.qh +++ b/qcsrc/client/hud/panel/powerups.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/pressedkeys.qh b/qcsrc/client/hud/panel/pressedkeys.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/pressedkeys.qh +++ b/qcsrc/client/hud/panel/pressedkeys.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/quickmenu.qh b/qcsrc/client/hud/panel/quickmenu.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/quickmenu.qh +++ b/qcsrc/client/hud/panel/quickmenu.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index 8bac1614b4..7a9f90f9af 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -1,4 +1,7 @@ #include "racetimer.qh" + +#include + /** Race timer (#8) */ void HUD_RaceTimer () { diff --git a/qcsrc/client/hud/panel/racetimer.qh b/qcsrc/client/hud/panel/racetimer.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/racetimer.qh +++ b/qcsrc/client/hud/panel/racetimer.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 35fab19fef..a70e0416af 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -1,4 +1,11 @@ #include "radar.qh" + +#include +#include +#include +#include +#include + // Radar (#6) float HUD_Radar_Clickable() diff --git a/qcsrc/client/hud/panel/radar.qh b/qcsrc/client/hud/panel/radar.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/radar.qh +++ b/qcsrc/client/hud/panel/radar.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index ce199ee683..12114b4e35 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -1,4 +1,9 @@ #include "score.qh" + +#include +#include +#include + // Score (#7) void HUD_UpdatePlayerTeams(); diff --git a/qcsrc/client/hud/panel/score.qh b/qcsrc/client/hud/panel/score.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/score.qh +++ b/qcsrc/client/hud/panel/score.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/timer.qh b/qcsrc/client/hud/panel/timer.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/timer.qh +++ b/qcsrc/client/hud/panel/timer.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 8e3605f0d7..502b237f78 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -1,4 +1,7 @@ #include "vote.qh" + +#include + /** Vote window (#9) */ void HUD_Vote() { diff --git a/qcsrc/client/hud/panel/vote.qh b/qcsrc/client/hud/panel/vote.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/vote.qh +++ b/qcsrc/client/hud/panel/vote.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/hud/panel/weapons.qh b/qcsrc/client/hud/panel/weapons.qh index 6f70f09bee..6db88c68b3 100644 --- a/qcsrc/client/hud/panel/weapons.qh +++ b/qcsrc/client/hud/panel/weapons.qh @@ -1 +1,2 @@ #pragma once +#include "../panel.qh" diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 63416f2b01..0208fc1828 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -1,5 +1,6 @@ #include "quickmenu.qh" +#include #include "hud/all.qh" #include "mapvoting.qh" diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 3204af9f08..a99db0360c 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -3,11 +3,12 @@ #include "quickmenu.qh" #include "hud/all.qh" -#include "../common/constants.qh" -#include "../common/mapinfo.qh" -#include "../common/minigames/cl_minigames.qh" -#include "../common/stats.qh" -#include "../common/teams.qh" +#include +#include +#include +#include +#include +#include float scoreboard_alpha_bg; float scoreboard_alpha_fg; diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index fc36c47274..bfbba30fb8 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -2,11 +2,12 @@ #include "hud/all.qh" -#include "../common/constants.qh" -#include "../common/mapinfo.qh" -#include "../common/teams.qh" +#include +#include +#include +#include -#include "../lib/csqcmodel/cl_model.qh" +#include // this.isactive = player is in range and coordinates/status (health and armor) are up to date // this.origin = player origin diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 611116cfdb..64a8642b24 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -9,26 +9,30 @@ #include "mutators/events.qh" -#include "../common/anim.qh" -#include "../common/constants.qh" -#include "../common/debug.qh" -#include "../common/mapinfo.qh" +#include +#include +#include +#include +#include +#include #include -#include "../common/physics/player.qh" -#include "../common/stats.qh" -#include "../common/triggers/target/music.qh" -#include "../common/teams.qh" +#include +#include +#include +#include #include #include -#include "../common/viewloc.qh" -#include "../common/minigames/cl_minigames.qh" -#include "../common/minigames/cl_minigames_hud.qh" +#include +#include +#include -#include "../lib/csqcmodel/cl_player.qh" +#include +#include +#include "csqcmodel_hooks.qh" -#include "../lib/warpzone/client.qh" -#include "../lib/warpzone/common.qh" +#include +#include #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT) @@ -149,7 +153,7 @@ void viewmodel_animate(entity this) vel = view.velocity; else { - vector forward, right = '0 0 0', up = '0 0 0'; + vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; MAKEVECTORS(makevectors, view_angles, forward, right, up); vel.x = view.velocity * forward; vel.y = view.velocity * right * -1; @@ -175,7 +179,7 @@ void viewmodel_animate(entity this) if(autocvar_cl_followmodel_velocity_absolute) { vector fixed_gunorg; - vector forward, right = '0 0 0', up = '0 0 0'; + vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; MAKEVECTORS(makevectors, view_angles, forward, right, up); fixed_gunorg.x = gunorg * forward; fixed_gunorg.y = gunorg * right * -1; diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index 113019a7c7..07703ee373 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -1,5 +1,9 @@ #pragma once +#ifdef CSQC +.entity tag_entity; +#endif + #ifndef MENUQC .bool debug; .int sv_entnum; diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 50fd2bab58..dfe918feca 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -1,6 +1,14 @@ #include "cl_minigames_hud.qh" + +#include + #include "minigames.qh" +.vector colormod; + +#include +#include + // whether the mouse is over the given panel bool HUD_mouse_over(entity somepanel) { diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index eb5b72ef8a..78d84e244d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1,7 +1,6 @@ #include "gamemode_ctf.qh" -#ifndef GAMEMODE_CTF_H -#define GAMEMODE_CTF_H +#ifdef IMPLEMENTATION #ifndef CSQC void ctf_Initialize(); @@ -35,179 +34,6 @@ REGISTER_MUTATOR(ctf, false) } #endif -#ifdef SVQC -// used in cheats.qc -void ctf_RespawnFlag(entity flag); - -// score rule declarations -const int ST_CTF_CAPS = 1; -const int SP_CTF_CAPS = 4; -const int SP_CTF_CAPTIME = 5; -const int SP_CTF_PICKUPS = 6; -const int SP_CTF_DROPS = 7; -const int SP_CTF_FCKILLS = 8; -const int SP_CTF_RETURNS = 9; - -CLASS(Flag, Pickup) - ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13') - ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13') -ENDCLASS(Flag) -Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } -void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); } - -// flag constants // for most of these, there is just one question to be asked: WHYYYYY? - -const float FLAG_SCALE = 0.6; - -const float FLAG_THINKRATE = 0.2; -const float FLAG_TOUCHRATE = 0.5; -const float WPFE_THINKRATE = 0.5; - -const vector FLAG_DROP_OFFSET = ('0 0 32'); -const vector FLAG_CARRY_OFFSET = ('-16 0 8'); -#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) -const vector FLAG_WAYPOINT_OFFSET = ('0 0 64'); -const vector FLAG_FLOAT_OFFSET = ('0 0 32'); -const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10'); - -const vector VEHICLE_FLAG_OFFSET = ('0 0 96'); -const float VEHICLE_FLAG_SCALE = 1.0; - -// waypoint colors -#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1') -#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color) -#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1') - -// sounds -#define snd_flag_taken noise -#define snd_flag_returned noise1 -#define snd_flag_capture noise2 -#define snd_flag_respawn noise3 -.string snd_flag_dropped; -.string snd_flag_touch; -.string snd_flag_pass; - -// effects -.string toucheffect; -.string passeffect; -.string capeffect; - -// list of flags on the map -entity ctf_worldflaglist; -.entity ctf_worldflagnext; -.entity ctf_staleflagnext; - -// waypoint sprites -.entity bot_basewaypoint; // flag waypointsprite -.entity wps_helpme; -.entity wps_flagbase; -.entity wps_flagcarrier; -.entity wps_flagdropped; -.entity wps_enemyflagcarrier; -.float wps_helpme_time; -bool wpforenemy_announced; -float wpforenemy_nextthink; - -// statuses -const int FLAG_BASE = 1; -const int FLAG_DROPPED = 2; -const int FLAG_CARRY = 3; -const int FLAG_PASSING = 4; - -const int DROP_NORMAL = 1; -const int DROP_THROW = 2; -const int DROP_PASS = 3; -const int DROP_RESET = 4; - -const int PICKUP_BASE = 1; -const int PICKUP_DROPPED = 2; - -const int CAPTURE_NORMAL = 1; -const int CAPTURE_DROPPED = 2; - -const int RETURN_TIMEOUT = 1; -const int RETURN_DROPPED = 2; -const int RETURN_DAMAGE = 3; -const int RETURN_SPEEDRUN = 4; -const int RETURN_NEEDKILL = 5; - -void ctf_Handle_Throw(entity player, entity receiver, float droptype); - -// flag properties -#define ctf_spawnorigin dropped_origin -bool ctf_stalemate; // indicates that a stalemate is active -float ctf_captimerecord; // record time for capturing the flag -.float ctf_pickuptime; -.float ctf_droptime; -.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally) -.entity ctf_dropper; // don't allow spam of dropping the flag -.int max_flag_health; -.float next_take_time; -.bool ctf_flagdamaged; -int ctf_teams; - -// passing/throwing properties -.float pass_distance; -.entity pass_sender; -.entity pass_target; -.float throw_antispam; -.float throw_prevtime; -.int throw_count; - -// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag. -.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture -float ctf_captureshield_min_negscore; // punish at -20 points -float ctf_captureshield_max_ratio; // punish at most 30% of each team -float ctf_captureshield_force; // push force of the shield - -// 1 flag ctf -bool ctf_oneflag; // indicates whether or not a neutral flag has been found - -// bot player logic -const int HAVOCBOT_CTF_ROLE_NONE = 0; -const int HAVOCBOT_CTF_ROLE_DEFENSE = 2; -const int HAVOCBOT_CTF_ROLE_MIDDLE = 4; -const int HAVOCBOT_CTF_ROLE_OFFENSE = 8; -const int HAVOCBOT_CTF_ROLE_CARRIER = 16; -const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32; -const int HAVOCBOT_CTF_ROLE_ESCORT = 64; - -.bool havocbot_cantfindflag; - -vector havocbot_ctf_middlepoint; -float havocbot_ctf_middlepoint_radius; - -void havocbot_role_ctf_setrole(entity bot, int role); - -// team checking -#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b)) -#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b)) - -// networked flag statuses -.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS); -#endif - -const int CTF_RED_FLAG_TAKEN = 1; -const int CTF_RED_FLAG_LOST = 2; -const int CTF_RED_FLAG_CARRYING = 3; -const int CTF_BLUE_FLAG_TAKEN = 4; -const int CTF_BLUE_FLAG_LOST = 8; -const int CTF_BLUE_FLAG_CARRYING = 12; -const int CTF_YELLOW_FLAG_TAKEN = 16; -const int CTF_YELLOW_FLAG_LOST = 32; -const int CTF_YELLOW_FLAG_CARRYING = 48; -const int CTF_PINK_FLAG_TAKEN = 64; -const int CTF_PINK_FLAG_LOST = 128; -const int CTF_PINK_FLAG_CARRYING = 192; -const int CTF_NEUTRAL_FLAG_TAKEN = 256; -const int CTF_NEUTRAL_FLAG_LOST = 512; -const int CTF_NEUTRAL_FLAG_CARRYING = 768; -const int CTF_FLAG_NEUTRAL = 2048; -const int CTF_SHIELDED = 4096; -#endif - -#ifdef IMPLEMENTATION - #ifdef SVQC #include #include diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index 6f70f09bee..c323cb5675 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -1 +1,171 @@ #pragma once + +#ifdef SVQC +// used in cheats.qc +void ctf_RespawnFlag(entity flag); + +// score rule declarations +const int ST_CTF_CAPS = 1; +const int SP_CTF_CAPS = 4; +const int SP_CTF_CAPTIME = 5; +const int SP_CTF_PICKUPS = 6; +const int SP_CTF_DROPS = 7; +const int SP_CTF_FCKILLS = 8; +const int SP_CTF_RETURNS = 9; + +CLASS(Flag, Pickup) + ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13') + ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13') +ENDCLASS(Flag) +Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } +void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); } + +// flag constants // for most of these, there is just one question to be asked: WHYYYYY? + +const float FLAG_SCALE = 0.6; + +const float FLAG_THINKRATE = 0.2; +const float FLAG_TOUCHRATE = 0.5; +const float WPFE_THINKRATE = 0.5; + +const vector FLAG_DROP_OFFSET = ('0 0 32'); +const vector FLAG_CARRY_OFFSET = ('-16 0 8'); +#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) +const vector FLAG_WAYPOINT_OFFSET = ('0 0 64'); +const vector FLAG_FLOAT_OFFSET = ('0 0 32'); +const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10'); + +const vector VEHICLE_FLAG_OFFSET = ('0 0 96'); +const float VEHICLE_FLAG_SCALE = 1.0; + +// waypoint colors +#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1') +#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color) +#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1') + +// sounds +#define snd_flag_taken noise +#define snd_flag_returned noise1 +#define snd_flag_capture noise2 +#define snd_flag_respawn noise3 +.string snd_flag_dropped; +.string snd_flag_touch; +.string snd_flag_pass; + +// effects +.string toucheffect; +.string passeffect; +.string capeffect; + +// list of flags on the map +entity ctf_worldflaglist; +.entity ctf_worldflagnext; +.entity ctf_staleflagnext; + +// waypoint sprites +.entity bot_basewaypoint; // flag waypointsprite +.entity wps_helpme; +.entity wps_flagbase; +.entity wps_flagcarrier; +.entity wps_flagdropped; +.entity wps_enemyflagcarrier; +.float wps_helpme_time; +bool wpforenemy_announced; +float wpforenemy_nextthink; + +// statuses +const int FLAG_BASE = 1; +const int FLAG_DROPPED = 2; +const int FLAG_CARRY = 3; +const int FLAG_PASSING = 4; + +const int DROP_NORMAL = 1; +const int DROP_THROW = 2; +const int DROP_PASS = 3; +const int DROP_RESET = 4; + +const int PICKUP_BASE = 1; +const int PICKUP_DROPPED = 2; + +const int CAPTURE_NORMAL = 1; +const int CAPTURE_DROPPED = 2; + +const int RETURN_TIMEOUT = 1; +const int RETURN_DROPPED = 2; +const int RETURN_DAMAGE = 3; +const int RETURN_SPEEDRUN = 4; +const int RETURN_NEEDKILL = 5; + +void ctf_Handle_Throw(entity player, entity receiver, float droptype); + +// flag properties +#define ctf_spawnorigin dropped_origin +bool ctf_stalemate; // indicates that a stalemate is active +float ctf_captimerecord; // record time for capturing the flag +.float ctf_pickuptime; +.float ctf_droptime; +.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally) +.entity ctf_dropper; // don't allow spam of dropping the flag +.int max_flag_health; +.float next_take_time; +.bool ctf_flagdamaged; +int ctf_teams; + +// passing/throwing properties +.float pass_distance; +.entity pass_sender; +.entity pass_target; +.float throw_antispam; +.float throw_prevtime; +.int throw_count; + +// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag. +.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture +float ctf_captureshield_min_negscore; // punish at -20 points +float ctf_captureshield_max_ratio; // punish at most 30% of each team +float ctf_captureshield_force; // push force of the shield + +// 1 flag ctf +bool ctf_oneflag; // indicates whether or not a neutral flag has been found + +// bot player logic +const int HAVOCBOT_CTF_ROLE_NONE = 0; +const int HAVOCBOT_CTF_ROLE_DEFENSE = 2; +const int HAVOCBOT_CTF_ROLE_MIDDLE = 4; +const int HAVOCBOT_CTF_ROLE_OFFENSE = 8; +const int HAVOCBOT_CTF_ROLE_CARRIER = 16; +const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32; +const int HAVOCBOT_CTF_ROLE_ESCORT = 64; + +.bool havocbot_cantfindflag; + +vector havocbot_ctf_middlepoint; +float havocbot_ctf_middlepoint_radius; + +void havocbot_role_ctf_setrole(entity bot, int role); + +// team checking +#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b)) +#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b)) + +// networked flag statuses +.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS); +#endif + +const int CTF_RED_FLAG_TAKEN = 1; +const int CTF_RED_FLAG_LOST = 2; +const int CTF_RED_FLAG_CARRYING = 3; +const int CTF_BLUE_FLAG_TAKEN = 4; +const int CTF_BLUE_FLAG_LOST = 8; +const int CTF_BLUE_FLAG_CARRYING = 12; +const int CTF_YELLOW_FLAG_TAKEN = 16; +const int CTF_YELLOW_FLAG_LOST = 32; +const int CTF_YELLOW_FLAG_CARRYING = 48; +const int CTF_PINK_FLAG_TAKEN = 64; +const int CTF_PINK_FLAG_LOST = 128; +const int CTF_PINK_FLAG_CARRYING = 192; +const int CTF_NEUTRAL_FLAG_TAKEN = 256; +const int CTF_NEUTRAL_FLAG_LOST = 512; +const int CTF_NEUTRAL_FLAG_CARRYING = 768; +const int CTF_FLAG_NEUTRAL = 2048; +const int CTF_SHIELDED = 4096; diff --git a/qcsrc/tools/compilationunits.sh b/qcsrc/tools/compilationunits.sh index 88bba83c0a..8f9491d5c8 100755 --- a/qcsrc/tools/compilationunits.sh +++ b/qcsrc/tools/compilationunits.sh @@ -9,13 +9,13 @@ QCC=../../../../gmqcc/gmqcc declare -a QCCDEFS=( -DNDEBUG=1 + -DWATERMARK="\"$(git describe --tags --dirty='*')\"" ) QCCDEFS="${QCCDEFS[@]}" declare -a QCCFLAGS=( -std=gmqcc -Wall -Werror - -fftepp -fftepp-predefs -Wcpp -futf8 -freturn-assignments -frelaxed-switch -- 2.39.2