X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_ctf.qh;h=b5ff1774a136441373a9ba2d4250a3b48f187bb7;hp=ca4961eddc24231a6056943a0b2bffcdb5dcec06;hb=86c9dc7c3696c329496b06375c1e79fb407401ce;hpb=0f0e69c6625fc4db17559e2e47f2fdaed8298076 diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index ca4961eddc..b5ff1774a1 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -1,3 +1,5 @@ +#ifndef GAMEMODE_CTF_H +#define GAMEMODE_CTF_H // these are needed since mutators are compiled last #ifdef SVQC @@ -5,38 +7,38 @@ void ctf_RespawnFlag(entity flag); // score rule declarations -#define ST_CTF_CAPS 1 -#define SP_CTF_CAPS 4 -#define SP_CTF_CAPTIME 5 -#define SP_CTF_PICKUPS 6 -#define SP_CTF_DROPS 7 -#define SP_CTF_FCKILLS 8 -#define SP_CTF_RETURNS 9 +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; // flag constants // for most of these, there is just one question to be asked: WHYYYYY? -#define FLAG_MIN (PL_MIN + '0 0 -13') -#define FLAG_MAX (PL_MAX + '0 0 -13') +#define FLAG_MIN (PL_MIN_CONST + '0 0 -13') +#define FLAG_MAX (PL_MAX_CONST + '0 0 -13') -#define FLAG_SCALE 0.6 +const float FLAG_SCALE = 0.6; -#define FLAG_THINKRATE 0.2 -#define FLAG_TOUCHRATE 0.5 -#define WPFE_THINKRATE 0.5 +const float FLAG_THINKRATE = 0.2; +const float FLAG_TOUCHRATE = 0.5; +const float WPFE_THINKRATE = 0.5; -#define FLAG_DROP_OFFSET ('0 0 32') -#define FLAG_CARRY_OFFSET ('-16 0 8') -#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13)) -#define FLAG_WAYPOINT_OFFSET ('0 0 64') -#define FLAG_FLOAT_OFFSET ('0 0 32') -#define FLAG_PASS_ARC_OFFSET ('0 0 -10') +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'); -#define VEHICLE_FLAG_OFFSET ('0 0 96') -#define VEHICLE_FLAG_SCALE 1.0 +const vector VEHICLE_FLAG_OFFSET = ('0 0 96'); +const float VEHICLE_FLAG_SCALE = 1.0; // waypoint colors -#define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, FALSE) * 0.75) -#define WPCOLOR_FLAGCARRIER(t) ('0.8 0.8 0') -#define WPCOLOR_DROPPEDFLAG(t) (('0.25 0.25 0.25' + colormapPaletteColor(t - 1, FALSE)) * 0.5) +#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 @@ -65,42 +67,46 @@ entity ctf_worldflaglist; .entity wps_flagdropped; .entity wps_enemyflagcarrier; .float wps_helpme_time; -float wpforenemy_announced; +bool wpforenemy_announced; float wpforenemy_nextthink; // statuses -#define FLAG_BASE 1 -#define FLAG_DROPPED 2 -#define FLAG_CARRY 3 -#define FLAG_PASSING 4 +const int FLAG_BASE = 1; +const int FLAG_DROPPED = 2; +const int FLAG_CARRY = 3; +const int FLAG_PASSING = 4; -#define DROP_NORMAL 1 -#define DROP_THROW 2 -#define DROP_PASS 3 -#define DROP_RESET 4 +const int DROP_NORMAL = 1; +const int DROP_THROW = 2; +const int DROP_PASS = 3; +const int DROP_RESET = 4; -#define PICKUP_BASE 1 -#define PICKUP_DROPPED 2 +const int PICKUP_BASE = 1; +const int PICKUP_DROPPED = 2; -#define CAPTURE_NORMAL 1 -#define CAPTURE_DROPPED 2 +const int CAPTURE_NORMAL = 1; +const int CAPTURE_DROPPED = 2; -#define RETURN_TIMEOUT 1 -#define RETURN_DROPPED 2 -#define RETURN_DAMAGE 3 -#define RETURN_SPEEDRUN 4 -#define RETURN_NEEDKILL 5 +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 -float ctf_stalemate; // indicates that a stalemate is active +bool ctf_stalemate; // indicates that a stalemate is active float ctf_captimerecord; // record time for capturing the flag .float ctf_pickuptime; .float ctf_droptime; -.float ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally) +.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 -.float max_flag_health; +.int max_flag_health; .float next_take_time; +.bool ctf_flagdamaged; +int ctf_teams; // passing/throwing properties .float pass_distance; @@ -108,27 +114,57 @@ float ctf_captimerecord; // record time for capturing the flag .entity pass_target; .float throw_antispam; .float throw_prevtime; -.float throw_count; +.int throw_count; // CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag. -.float ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture +.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 -#define HAVOCBOT_CTF_ROLE_NONE 0 -#define HAVOCBOT_CTF_ROLE_DEFENSE 2 -#define HAVOCBOT_CTF_ROLE_MIDDLE 4 -#define HAVOCBOT_CTF_ROLE_OFFENSE 8 -#define HAVOCBOT_CTF_ROLE_CARRIER 16 -#define HAVOCBOT_CTF_ROLE_RETRIEVER 32 -#define HAVOCBOT_CTF_ROLE_ESCORT 64 +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; -.float havocbot_cantfindflag; +.bool havocbot_cantfindflag; vector havocbot_ctf_middlepoint; float havocbot_ctf_middlepoint_radius; -void havocbot_role_ctf_setrole(entity bot, float role); +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; +#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