X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=b79b28285dc9e2839be9d713b623429be35db94a;hb=bc01573d1b12cc8a102d1b8b22777d5bd71c3420;hp=decd42dd5f253e152e563ea583cdfc286670cfce;hpb=6c4f62990980e74d4a0963b7179c7c964f535398;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index decd42dd5..b79b28285 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -1,3 +1,19 @@ +#include "portals.qh" +#include "_all.qh" + +#include "g_hook.qh" +#include "mutators/mutators_include.qh" +#include "../common/constants.qh" +#include "../common/deathtypes.qh" +#include "../common/notifications.qh" +#include "../common/triggers/teleporters.qh" +#include "../common/triggers/subs.qh" +#include "../common/util.qh" +#include "../common/weapons/all.qh" +#include "../csqcmodellib/sv_model.qh" +#include "../warpzonelib/anglestransform.qh" +#include "../warpzonelib/util_server.qh" + #define PORTALS_ARE_NOT_SOLID const vector SAFENUDGE = '1 1 1'; @@ -13,9 +29,9 @@ float PlayerEdgeDistance(entity p, vector v) { vector vbest; - if(v.x < 0) vbest_x = p.mins.x; else vbest_x = p.maxs.x; - if(v.y < 0) vbest_y = p.mins.y; else vbest_y = p.maxs.y; - if(v.z < 0) vbest_z = p.mins.z; else vbest_z = p.maxs.z; + if(v.x < 0) vbest.x = p.mins.x; else vbest.x = p.maxs.x; + if(v.y < 0) vbest.y = p.mins.y; else vbest.y = p.maxs.y; + if(v.z < 0) vbest.z = p.mins.z; else vbest.z = p.maxs.z; return vbest * v; } @@ -36,7 +52,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) // PLAYERS use different math #ifndef POSITIVE_PITCH_IS_DOWN - ang_x = -ang.x; + ang.x = -ang.x; #endif //print("reference: ", vtos(AnglesTransform_ApplyToVAngles(transform, ang)), "\n"); @@ -66,7 +82,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) ang = fixedvectoangles(new_forward); // this still gets us a nice pitch value... if(new_up * new_yawforward < 0) new_up = -1 * new_up; - ang_y = vectoyaw(new_up); // this vector is the yaw we want + ang.y = vectoyaw(new_up); // this vector is the yaw we want //print("UP/DOWN path: ", vtos(ang), "\n"); } else @@ -77,9 +93,9 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) } #ifndef POSITIVE_PITCH_IS_DOWN - ang_x = -ang.x; + ang.x = -ang.x; #endif - ang_z = vangle.z; + ang.z = vangle.z; return ang; } @@ -154,11 +170,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player) // factor -1 allows chaining portals, but may be weird player.right_vector = -1 * AnglesTransform_Apply(transform, player.right_vector); - entity oldself = self; - self = player; - MUTATOR_CALLHOOK(PortalTeleport); - player = self; - self = oldself; + MUTATOR_CALLHOOK(PortalTeleport, player); if (!teleporter.enemy) { @@ -254,6 +266,10 @@ void Portal_Touch() if(other.classname == "grapplinghook") return; // handled by think + if(!autocvar_g_vehicles_teleportable) + if(other.vehicle_flags & VHF_ISVEHICLE) + return; // no teleporting vehicles? + if(!self.enemy) error("Portal_Touch called for a broken portal\n"); @@ -290,8 +306,8 @@ void Portal_Touch() return; /* - if(other.mins_x < PL_MIN_x || other.mins_y < PL_MIN_y || other.mins_z < PL_MIN_z - || other.maxs_x > PL_MAX_x || other.maxs_y > PL_MAX_y || other.maxs_z > PL_MAX_z) + if(other.mins_x < PL_MIN.x || other.mins_y < PL_MIN.y || other.mins_z < PL_MIN.z + || other.maxs_x > PL_MAX.x || other.maxs_y > PL_MAX.y || other.maxs_z > PL_MAX.z) { // can't teleport this return; @@ -399,7 +415,7 @@ void Portal_Remove(entity portal, float killed) { fixedmakevectors(portal.mangle); sound(portal, CH_SHOTS, "porto/explode.wav", VOL_BASE, ATTEN_NORM); - pointparticles(particleeffectnum("rocket_explode"), portal.origin + v_forward * 16, v_forward * 1024, 4); + Send_Effect("rocket_explode", portal.origin + v_forward * 16, v_forward * 1024, 4); remove(portal); } else @@ -410,7 +426,7 @@ void Portal_Remove(entity portal, float killed) } } -void Portal_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) +void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { if(deathtype == DEATH_TELEFRAG) return; @@ -493,7 +509,7 @@ float Portal_Customize() { self.modelindex = self.savemodelindex; } - return TRUE; + return true; } // cleanup: