X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_subs.qc;h=94856c9c4fbd882d29562f8a91e52a6474866be4;hp=cc6f3694b9897bd3126c826b1a3d6e964e14e505;hb=e4715af2d04656465b64492ddf1c02ac1503ac43;hpb=1532af143411264782fd7646d151df486e2b16aa diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index cc6f3694b..94856c9c4 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -14,8 +14,8 @@ void spawnfunc_info_null (void) void setanim(entity e, vector anim, float looping, float override, float restart) { if (!anim) - return; // no animation was given to us! We can't use this. - + return; // no animation was given to us! We can't use this. + if (anim_x == e.animstate_startframe) if (anim_y == e.animstate_numframes) if (anim_z == e.animstate_framerate) @@ -29,9 +29,9 @@ void setanim(entity e, vector anim, float looping, float override, float restart else return; } - e.animstate_startframe = anim_x; - e.animstate_numframes = anim_y; - e.animstate_framerate = anim_z; + e.animstate_startframe = anim.x; + e.animstate_numframes = anim.y; + e.animstate_framerate = anim.z; e.animstate_starttime = servertime - 0.1 * serverframetime; // shift it a little bit into the past to prevent float inaccuracy hiccups e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate; e.animstate_looping = looping; @@ -49,7 +49,7 @@ void updateanim(entity e) e.animstate_starttime = e.animstate_endtime; e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate; } - e.animstate_override = FALSE; + e.animstate_override = false; } e.frame = e.animstate_startframe + bound(0, (time - e.animstate_starttime) * e.animstate_framerate, e.animstate_numframes - 1); //print(ftos(time), " -> ", ftos(e.frame), "\n"); @@ -180,12 +180,12 @@ void SUB_CalcMove_controller_think (void) vector destangle; destangle = delta + 2 * delta2 * phasepos; destangle = vectoangles(destangle); - destangle_x = -destangle_x; // flip up / down orientation + destangle_x = -destangle.x; // flip up / down orientation // take the shortest distance for the angles - self.owner.angles_x -= 360 * floor((self.owner.angles_x - destangle_x) / 360 + 0.5); - self.owner.angles_y -= 360 * floor((self.owner.angles_y - destangle_y) / 360 + 0.5); - self.owner.angles_z -= 360 * floor((self.owner.angles_z - destangle_z) / 360 + 0.5); + self.owner.angles_x -= 360 * floor((self.owner.angles.x - destangle.x) / 360 + 0.5); + self.owner.angles_y -= 360 * floor((self.owner.angles.y - destangle.y) / 360 + 0.5); + self.owner.angles_z -= 360 * floor((self.owner.angles.z - destangle.z) / 360 + 0.5); angloc = destangle - self.owner.angles; angloc = angloc * (1 / sys_frametime); // so it arrives for the next frame self.owner.avelocity = angloc; @@ -294,7 +294,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float // the thinking is now done by the controller self.think = SUB_NullThink; // for PushMove self.nextthink = self.ltime + traveltime; - + // invoke controller self = controller; self.think(); @@ -392,9 +392,9 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() objerror ("No speed is defined!"); // take the shortest distance for the angles - self.angles_x -= 360 * floor((self.angles_x - destangle_x) / 360 + 0.5); - self.angles_y -= 360 * floor((self.angles_y - destangle_y) / 360 + 0.5); - self.angles_z -= 360 * floor((self.angles_z - destangle_z) / 360 + 0.5); + self.angles_x -= 360 * floor((self.angles.x - destangle.x) / 360 + 0.5); + self.angles_y -= 360 * floor((self.angles.y - destangle.y) / 360 + 0.5); + self.angles_z -= 360 * floor((self.angles.z - destangle.z) / 360 + 0.5); delta = destangle - self.angles; switch(tspeedtype) @@ -467,7 +467,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, // check whether antilagged traces are enabled if (lag < 0.001) lag = 0; - if not(IS_REAL_CLIENT(forent)) + if (!IS_REAL_CLIENT(forent)) lag = 0; // only antilag for clients // change shooter to SOLID_BBOX so the shot can hit corpses @@ -481,6 +481,8 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, FOR_EACH_PLAYER(player) if(player != forent) antilag_takeback(player, time - lag); + FOR_EACH_MONSTER(player) + antilag_takeback(player, time - lag); } // do the trace @@ -495,6 +497,8 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, FOR_EACH_PLAYER(player) if(player != forent) antilag_restore(player); + FOR_EACH_MONSTER(player) + antilag_restore(player); } // restore shooter solid type @@ -503,7 +507,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, } void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag) { - tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, FALSE); + tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, false); } void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag) { @@ -515,11 +519,11 @@ void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2 { if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag) lag = 0; - tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, FALSE); + tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false); } void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag) { - tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, TRUE); + tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, true); } void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag) { @@ -531,10 +535,10 @@ void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, { if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag) lag = 0; - tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, TRUE); + tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true); } -float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity) // returns the number of traces done, for benchmarking +float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) // returns the number of traces done, for benchmarking { vector pos, dir, t; float nudge; @@ -550,9 +554,9 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon float c; c = 0; - for(;;) + for(0;;) { - if((pos - v1) * dir >= (v2 - v1) * dir) + if(pos * dir >= v2 * dir) { // went too far trace_fraction = 1; @@ -587,7 +591,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon pos = t + dir * nudge; // but if we hit an entity, stop RIGHT before it - if(stopatentity && stopentity) + if(stopatentity && stopentity && stopentity != ignorestopatentity) { trace_ent = stopentity; trace_endpos = t; @@ -612,9 +616,9 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon } } -void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity) +void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) { - tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity); + tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity, ignorestopatentity); } /* @@ -636,20 +640,20 @@ vector findbetterlocation (vector org, float mindist) c = 0; while (c < 6) { - traceline (org, org + vec, TRUE, world); + traceline (org, org + vec, true, world); vec = vec * -1; if (trace_fraction < 1) { loc = trace_endpos; - traceline (loc, loc + vec, TRUE, world); + traceline (loc, loc + vec, true, world); if (trace_fraction >= 1) org = loc + vec; } if (c & 1) { - h = vec_y; - vec_y = vec_x; - vec_x = vec_z; + h = vec.y; + vec_y = vec.x; + vec_x = vec.z; vec_z = h; } c = c + 1; @@ -723,7 +727,7 @@ float LOD_customize() self.modelindex = self.lodmodelindex1; else // if(d == 3) self.modelindex = self.lodmodelindex2; - return TRUE; + return true; } // TODO csqc network this so it only gets sent once @@ -735,7 +739,7 @@ float LOD_customize() else self.modelindex = self.lodmodelindex2; - return TRUE; + return true; } void LOD_uncustomize() @@ -799,30 +803,30 @@ void LODmodel_attach() } if(self.lodmodelindex1) - if not(self.SendEntity) + if (!self.SendEntity) SetCustomizer(self, LOD_customize, LOD_uncustomize); } void ApplyMinMaxScaleAngles(entity e) { - if(e.angles_x != 0 || e.angles_z != 0 || self.avelocity_x != 0 || self.avelocity_z != 0) // "weird" rotation + if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation { e.maxs = '1 1 1' * vlen( - '1 0 0' * max(-e.mins_x, e.maxs_x) + - '0 1 0' * max(-e.mins_y, e.maxs_y) + - '0 0 1' * max(-e.mins_z, e.maxs_z) + '1 0 0' * max(-e.mins.x, e.maxs.x) + + '0 1 0' * max(-e.mins.y, e.maxs.y) + + '0 0 1' * max(-e.mins.z, e.maxs.z) ); e.mins = -e.maxs; } - else if(e.angles_y != 0 || self.avelocity_y != 0) // yaw only is a bit better + else if(e.angles.y != 0 || self.avelocity.y != 0) // yaw only is a bit better { e.maxs_x = vlen( - '1 0 0' * max(-e.mins_x, e.maxs_x) + - '0 1 0' * max(-e.mins_y, e.maxs_y) + '1 0 0' * max(-e.mins.x, e.maxs.x) + + '0 1 0' * max(-e.mins.y, e.maxs.y) ); - e.maxs_y = e.maxs_x; - e.mins_x = -e.maxs_x; - e.mins_y = -e.maxs_x; + e.maxs_y = e.maxs.x; + e.mins_x = -e.maxs.x; + e.mins_y = -e.maxs.x; } if(e.scale) setsize(e, e.mins * e.scale, e.maxs * e.scale);