X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_ctf.qc;h=d6859bee3d88f281b6479d879864fe44e2196089;hb=c1b058929459a95a525deff9e0ebb76a513a7c22;hp=10b17719a737a8076331187ba52794b416711559;hpb=f715974f22d9b57b6bb7577c3a3655ec7115f369;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 10b17719a..d6859bee3 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -4,11 +4,10 @@ #include "gamemode.qh" #ifdef SVQC -#include "../vehicles/vehicle.qh" +#include "../../common/vehicles/all.qh" #endif #include "../../warpzonelib/common.qh" -#include "../../warpzonelib/mathlib.qh" void ctf_FakeTimeLimit(entity e, float t) { @@ -53,7 +52,7 @@ void ctf_CaptureRecord(entity flag, entity player) void ctf_FlagcarrierWaypoints(entity player) { - WaypointSprite_Spawn("flagcarrier", 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG, WPCOLOR_FLAGCARRIER(player.team)); + WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG); WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team)); @@ -248,8 +247,10 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) PlayerScore_Add(player, SP_CTF_DROPS, 1); // waypoints - if(autocvar_g_ctf_flag_dropped_waypoint) - WaypointSprite_Spawn("flagdropped", 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, true, RADARICON_FLAG, WPCOLOR_DROPPEDFLAG(flag.team)); + if(autocvar_g_ctf_flag_dropped_waypoint) { + entity wp = WaypointSprite_Spawn(WP_FlagDropped, 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, true, RADARICON_FLAG); + wp.colormod = WPCOLOR_DROPPEDFLAG(flag.team); + } if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health)) { @@ -372,7 +373,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) { makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0')); - flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1))); + flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1))); flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false); ctf_Handle_Drop(flag, player, droptype); break; @@ -418,7 +419,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) if(!player) { return; } // without someone to give the reward to, we can't possibly cap if(CTF_DIFFTEAM(player, flag)) { return; } - + if(ctf_oneflag) for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext) if(SAME_TEAM(tmp_entity, player)) @@ -454,7 +455,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) PlayerScore_Add(player, SP_CTF_CAPTIME, new_time - old_time); // effects - pointparticles(particleeffectnum(flag.capeffect), flag.origin, '0 0 0', 1); + Send_Effect(flag.capeffect, flag.origin, '0 0 0', 1); //shockwave_spawn("models/ctf/shockwavetransring.md3", flag.origin - '0 0 15', -0.8, 0, 1); // other @@ -475,7 +476,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) void ctf_Handle_Return(entity flag, entity player) { // messages and sounds - if(player.flags & FL_MONSTER) + if(IS_MONSTER(player)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_MONSTER_), player.monster_name); } @@ -556,13 +557,13 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) else { Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(flag.team)); } Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT_4(flag, CHOICE_CTF_PICKUP_TEAM_) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(player.team), player.netname); - + if(!flag.team) FOR_EACH_PLAYER(tmp_entity) if(tmp_entity != player) if(DIFF_TEAM(player, tmp_entity)) Send_Notification(NOTIF_ONE, tmp_entity, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); - + if(flag.team) FOR_EACH_PLAYER(tmp_entity) if(tmp_entity != player) @@ -608,7 +609,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) } // effects - pointparticles(particleeffectnum(flag.toucheffect), player.origin, '0 0 0', 1); + Send_Effect(flag.toucheffect, player.origin, '0 0 0', 1); // waypoints if(pickuptype == PICKUP_DROPPED) { WaypointSprite_Kill(flag.wps_flagdropped); } @@ -712,7 +713,8 @@ void ctf_CheckStalemate(void) { if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier)) { - WaypointSprite_Spawn(((ctf_oneflag) ? "flagcarrier" : "enemyflagcarrier"), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team)); + entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG); + wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team); tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize; } } @@ -906,7 +908,7 @@ void ctf_FlagTouch() if(trace_dphitcontents & (DPCONTENTS_PLAYERCLIP | DPCONTENTS_MONSTERCLIP)) { return; } entity toucher = other, tmp_entity; - bool is_not_monster = (!(toucher.flags & FL_MONSTER)), num_perteam = 0; + bool is_not_monster = (!IS_MONSTER(toucher)), num_perteam = 0; // automatically kill the flag and return it if it touched lava/slime/nodrop surfaces if(ITEM_TOUCH_NEEDKILL()) @@ -923,14 +925,14 @@ void ctf_FlagTouch() // special touch behaviors if(toucher.frozen) { return; } - else if(toucher.vehicle_flags & VHF_ISVEHICLE) + else if(IS_VEHICLE(toucher)) { if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner) toucher = toucher.owner; // the player is actually the vehicle owner, not other else return; // do nothing } - else if(toucher.flags & FL_MONSTER) + else if(IS_MONSTER(toucher)) { if(!autocvar_g_ctf_allow_monster_touch) return; // do nothing @@ -939,7 +941,7 @@ void ctf_FlagTouch() { if(time > self.wait) // if we haven't in a while, play a sound/effect { - pointparticles(particleeffectnum(self.toucheffect), self.origin, '0 0 0', 1); + Send_Effect(self.toucheffect, self.origin, '0 0 0', 1); sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTEN_NORM); self.wait = time + FLAG_TOUCHRATE; } @@ -1063,18 +1065,18 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf self.bot_basewaypoint = self.nearestwaypoint; // waypointsprites - string basename = "base"; - - switch(self.team) + entity basename; + switch (self.team) { - case NUM_TEAM_1: basename = "redbase"; break; - case NUM_TEAM_2: basename = "bluebase"; break; - case NUM_TEAM_3: basename = "yellowbase"; break; - case NUM_TEAM_4: basename = "pinkbase"; break; - default: basename = "neutralbase"; break; + case NUM_TEAM_1: basename = WP_FlagBaseRed; break; + case NUM_TEAM_2: basename = WP_FlagBaseBlue; break; + case NUM_TEAM_3: basename = WP_FlagBaseYellow; break; + case NUM_TEAM_4: basename = WP_FlagBasePink; break; + default: basename = WP_FlagBaseNeutral; break; } - WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, ((self.team) ? Team_ColorRGB(self.team) : '1 1 1')); + entity wp = WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG); + wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 1 1'); WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, ((self.team) ? colormapPaletteColor(self.team - 1, false) : '1 1 1')); // captureshield setup @@ -1128,8 +1130,8 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e if(flag.skin == 0) { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); } if(flag.model == "") { flag.model = cvar_string(sprintf("g_ctf_flag_%s_model", teamname)); } set_flag_string(flag, toucheffect, "%sflag_touch", teamname); - set_flag_string(flag, passeffect, "%sflag_pass", teamname); - set_flag_string(flag, capeffect, "%sflag_cap", teamname); + set_flag_string(flag, passeffect, "%s_pass", teamname); + set_flag_string(flag, capeffect, "%s_cap", teamname); // sounds set_flag_string(flag, snd_flag_taken, "ctf/%s_taken.wav", teamname); @@ -1184,7 +1186,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e default: flag.effects |= EF_DIMLIGHT; break; } } - + // flag placement if((flag.spawnflags & 1) || flag.noalign) // don't drop to floor, just stay at fixed location { @@ -1900,7 +1902,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink) int t = 0, t2 = 0, t3 = 0; // initially clear items so they can be set as necessary later. - self.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST + self.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST | CTF_BLUE_FLAG_CARRYING | CTF_BLUE_FLAG_TAKEN | CTF_BLUE_FLAG_LOST | CTF_YELLOW_FLAG_CARRYING | CTF_YELLOW_FLAG_TAKEN | CTF_YELLOW_FLAG_LOST | CTF_PINK_FLAG_CARRYING | CTF_PINK_FLAG_TAKEN | CTF_PINK_FLAG_LOST @@ -1923,7 +1925,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink) { if((flag.owner == self) || (flag.pass_sender == self)) self.ctf_flagstatus |= t; // carrying: self is currently carrying the flag - else + else self.ctf_flagstatus |= t2; // taken: someone else is carrying the flag break; } @@ -2126,7 +2128,7 @@ MUTATOR_HOOKFUNCTION(ctf_HelpMePing) } else // create a normal help me waypointsprite { - WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME, '1 0.5 0'); + WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME); WaypointSprite_Ping(self.wps_helpme); } @@ -2325,13 +2327,13 @@ void spawnfunc_item_flag_team2() /*QUAKED spawnfunc_item_flag_team3 (0 0.5 0.8) (-48 -48 -37) (48 48 37) CTF flag for team three (Yellow). -Keys: -"angle" Angle the flag will point (minus 90 degrees)... +Keys: +"angle" Angle the flag will point (minus 90 degrees)... "model" model to use, note this needs red, blue yellow and pink as skins 0, 1, 2 and 3... "noise" sound played when flag is picked up... "noise1" sound played when flag is returned by a teammate... "noise2" sound played when flag is captured... -"noise3" sound played when flag is lost in the field and respawns itself... +"noise3" sound played when flag is lost in the field and respawns itself... "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team3() @@ -2343,13 +2345,13 @@ void spawnfunc_item_flag_team3() /*QUAKED spawnfunc_item_flag_team4 (0 0.5 0.8) (-48 -48 -37) (48 48 37) CTF flag for team four (Pink). -Keys: -"angle" Angle the flag will point (minus 90 degrees)... +Keys: +"angle" Angle the flag will point (minus 90 degrees)... "model" model to use, note this needs red, blue yellow and pink as skins 0, 1, 2 and 3... "noise" sound played when flag is picked up... "noise1" sound played when flag is returned by a teammate... "noise2" sound played when flag is captured... -"noise3" sound played when flag is lost in the field and respawns itself... +"noise3" sound played when flag is lost in the field and respawns itself... "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team4() @@ -2361,13 +2363,13 @@ void spawnfunc_item_flag_team4() /*QUAKED spawnfunc_item_flag_neutral (0 0.5 0.8) (-48 -48 -37) (48 48 37) CTF flag (Neutral). -Keys: -"angle" Angle the flag will point (minus 90 degrees)... +Keys: +"angle" Angle the flag will point (minus 90 degrees)... "model" model to use, note this needs red, blue yellow and pink as skins 0, 1, 2 and 3... "noise" sound played when flag is picked up... "noise1" sound played when flag is returned by a teammate... "noise2" sound played when flag is captured... -"noise3" sound played when flag is lost in the field and respawns itself... +"noise3" sound played when flag is lost in the field and respawns itself... "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_neutral()