X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=f5861909162a60c2351045ca49035ac0c9e59993;hb=f8287888da112f1cd5d711903be8f840ff9f0d70;hp=33d43cbc23876c9990834e1391c2c72ec0381033;hpb=0ee74987765518ffed584a790f90607c3f3f8e71;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 33d43cbc2..f58619091 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -99,6 +99,8 @@ const string STR_OBSERVER = "observer"; #define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if (!IS_PLAYER(v)) // Samual: shouldn't this be IS_SPEC(v)? and rather create a separate macro to include observers too #define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(IS_PLAYER(v)) +#define FOR_EACH_MONSTER(v) for(v = world; (v = findflags(v, flags, FL_MONSTER)) != world; ) + #define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5))) // copies a string to a tempstring (so one can strunzone it) @@ -353,7 +355,7 @@ string formatmessage(string msg) wep = self.switchweapon; if (!wep) wep = self.cnt; - replacement = W_Name(wep); + replacement = WEP_NAME(wep); } else if (escape == "W") { if (self.items & IT_SHELLS) replacement = "shells"; else if (self.items & IT_NAILS) replacement = "bullets"; @@ -624,9 +626,7 @@ float warmup_start_health; float warmup_start_armorvalue; float g_weapon_stay; -entity get_weaponinfo(float w); - -float want_weapon(string cvarprefix, entity weaponinfo, float allguns) +float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done? { var float i = weaponinfo.weapon; var float d = 0; @@ -642,18 +642,18 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns) d = FALSE; } else if (g_cts) - d = (i == WEP_SHOTGUN); // todo: how to handle shotgun in CTS mode? we're removing it.. so.... + d = (i == WEP_SHOTGUN); else if (g_nexball) d = 0; // weapon is set a few lines later else - d = (i == WEP_LASER || i == WEP_SHOTGUN); + d = !(!weaponinfo.weaponstart); if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook d |= (i == WEP_HOOK); - if(weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED) // never default mutator blocked guns + if(!g_cts && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns d = 0; - var float t = cvar(strcat(cvarprefix, weaponinfo.netname)); + var float t = weaponinfo.weaponstartoverride; //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n")); @@ -776,7 +776,7 @@ void readplayerstartcvars() for (i = WEP_FIRST; i <= WEP_LAST; ++i) { e = get_weaponinfo(i); - float w = want_weapon("g_start_weapon_", e, FALSE); + float w = want_weapon(e, FALSE); if(w & 1) start_weapons |= WepSet_FromWeapon(i); if(w & 2) @@ -834,7 +834,7 @@ void readplayerstartcvars() for (i = WEP_FIRST; i <= WEP_LAST; ++i) { e = get_weaponinfo(i); - float w = want_weapon("g_start_weapon_", e, g_warmup_allguns); + float w = want_weapon(e, g_warmup_allguns); if(w & 1) warmup_start_weapons |= WepSet_FromWeapon(i); if(w & 2) @@ -908,7 +908,7 @@ void readlevelcvars(void) { if(cvar(mut_cvar) && dependence) { MUTATOR_ADD(mut_name); } } CHECK_MUTATOR_ADD("g_dodging", mutator_dodging, 1); - CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, 1); + CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, teamplay); CHECK_MUTATOR_ADD("g_physical_items", mutator_physical_items, 1); CHECK_MUTATOR_ADD("g_touchexplode", mutator_touchexplode, 1); CHECK_MUTATOR_ADD("g_minstagib", mutator_minstagib, 1); @@ -1709,7 +1709,7 @@ float SUB_NoImpactCheck() if(trace_dphitcontents == 0) { //dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n"); - dprint(sprintf("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin))); + dprintf("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin)); checkclient(); } if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) @@ -1998,65 +1998,6 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f return FALSE; } -float zcurveparticles_effectno; -vector zcurveparticles_start; -float zcurveparticles_spd; - -void endzcurveparticles() -{ - if(zcurveparticles_effectno) - { - // terminator - WriteShort(MSG_BROADCAST, zcurveparticles_spd | 0x8000); - } - zcurveparticles_effectno = 0; -} - -void zcurveparticles(float effectno, vector start, vector end, float end_dz, float spd) -{ - spd = bound(0, floor(spd / 16), 32767); - if(effectno != zcurveparticles_effectno || start != zcurveparticles_start) - { - endzcurveparticles(); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_ZCURVEPARTICLES); - WriteShort(MSG_BROADCAST, effectno); - WriteCoord(MSG_BROADCAST, start_x); - WriteCoord(MSG_BROADCAST, start_y); - WriteCoord(MSG_BROADCAST, start_z); - zcurveparticles_effectno = effectno; - zcurveparticles_start = start; - } - else - WriteShort(MSG_BROADCAST, zcurveparticles_spd); - WriteCoord(MSG_BROADCAST, end_x); - WriteCoord(MSG_BROADCAST, end_y); - WriteCoord(MSG_BROADCAST, end_z); - WriteCoord(MSG_BROADCAST, end_dz); - zcurveparticles_spd = spd; -} - -void zcurveparticles_from_tracetoss(float effectno, vector start, vector end, vector vel) -{ - float end_dz; - vector vecxy, velxy; - - vecxy = end - start; - vecxy_z = 0; - velxy = vel; - velxy_z = 0; - - if (vlen(velxy) < 0.000001 * fabs(vel_z)) - { - endzcurveparticles(); - trailparticles(world, effectno, start, end); - return; - } - - end_dz = vlen(vecxy) / vlen(velxy) * vel_z - (end_z - start_z); - zcurveparticles(effectno, start, end, end_dz, vlen(vel)); -} - void write_recordmarker(entity pl, float tstart, float dt) { GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));