26 #define PORTALS_ARE_NOT_SOLID 40 ((v.x < 0) ? p.mins.x : p.maxs.x),
41 ((v.y < 0) ? p.mins.y : p.maxs.y),
42 ((v.z < 0) ? p.mins.z : p.maxs.z));
49 vector old_forward, old_up;
51 vector new_forward, new_up;
62 #if !(POSITIVE_PITCH_IS_DOWN) 86 if(new_forward.z > 0.7 || new_forward.z < -0.7)
91 if(new_up * new_yawforward < 0)
103 #if !(POSITIVE_PITCH_IS_DOWN) 113 vector from,
to, safe, step, transform, ang, newvel;
114 float planeshift, s, t;
116 if (!teleporter.enemy)
118 backtrace(
"Portal_TeleportPlayer called without other portal being set. Stop.");
122 from = teleporter.origin;
123 transform = teleporter.portal_transform;
125 to = teleporter.enemy.origin;
143 s = (to - teleporter.enemy.origin) *
v_right;
144 t = (to - teleporter.enemy.origin) *
v_up;
145 s =
bound(-48, s, 48);
146 t =
bound(-48, t, 48);
147 to = teleporter.enemy.origin
152 safe = teleporter.enemy.portal_safe_origin;
157 LOG_INFO(
"'safe' teleport location is not safe!");
165 LOG_INFO(
"trace_endpos in solid, this can't be!");
183 if (!teleporter.enemy)
185 backtrace(
"Portal_TeleportPlayer ended up without other portal being set BEFORE TeleportPlayer. Stop.");
194 if(
time < teleporter.teleport_time + 1)
195 Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_ACHIEVEMENT_AMAZING);
199 player.pusher = portal_owner;
204 if (!teleporter.enemy)
206 backtrace(
"Portal_TeleportPlayer ended up without other portal being set AFTER TeleportPlayer. Stop.");
211 teleporter.portal_wants_to_vanish = 0;
234 portal.portal_safe_origin = portal.origin;
241 float dist, distpersec, delta;
244 dist = (eorg - porg) * pnorm;
245 dist +=
min(emins.x * pnorm.x, emaxs.x * pnorm.x);
246 dist +=
min(emins.y * pnorm.y, emaxs.y * pnorm.y);
247 dist +=
min(emins.z * pnorm.z, emaxs.z * pnorm.z);
250 #ifdef PORTALS_ARE_NOT_SOLID 251 distpersec = evel * pnorm;
255 delta = dist / distpersec;
256 v = eorg - evel * delta - porg;
257 v = v - pnorm * (pnorm *
v);
258 return vlen(v) < psize;
268 #ifdef PORTALS_ARE_NOT_SOLID 277 if(toucher.classname ==
"item_flag_team")
280 if(toucher.classname ==
"grapplinghook")
283 if(!autocvar_g_vehicles_teleportable)
288 error(
"Portal_Touch called for a broken portal\n");
290 #ifdef PORTALS_ARE_NOT_SOLID 298 if(toucher.classname ==
"porto")
300 if(toucher.portal_id ==
this.portal_id)
304 if(toucher == this.
aiment)
309 if(toucher != this.
aiment)
313 if(toucher.aiment !=
this.aiment)
318 g =
frametime *
'0 0 -1' * autocvar_sv_gravity;
332 if(toucher.classname ==
"porto")
333 if(toucher.effects &
EF_RED)
344 portal.nextthink = 0;
355 portal.nextthink = 0;
366 portal.nextthink =
time;
377 portal.nextthink = 0;
383 teleporter.enemy =
NULL;
384 destination.enemy =
NULL;
393 teleporter.enemy = destination;
394 destination.enemy = teleporter;
398 destination.fade_time = teleporter.fade_time;
399 teleporter.portal_wants_to_vanish = 0;
400 destination.portal_wants_to_vanish = 0;
401 teleporter.teleport_time =
time;
402 #ifdef PORTALS_ARE_NOT_SOLID 420 if(portal == portal.aiment.portal_in)
421 portal.aiment.portal_in =
NULL;
422 if(portal == portal.aiment.portal_out)
423 portal.aiment.portal_out =
NULL;
431 Send_Effect(EFFECT_ROCKET_EXPLODE, portal.origin +
v_forward * 16,
v_forward * 1024, 4);
444 if(deathtype == DEATH_TELEFRAG.m_id)
446 if(attacker != this.
aiment)
471 #ifdef PORTALS_ARE_NOT_SOLID 477 error(
"Portal_Think called for a broken portal\n");
483 g =
frametime *
'0 0 -1' * autocvar_sv_gravity;
498 if(it.(weaponentity).hook)
515 client = client.enemy;
556 own.portal_in = portal;
559 own.portal_out.portal_id = portal.portal_id;
572 own.portal_out = portal;
575 own.portal_in.portal_id = portal.portal_id;
601 portal.nextthink =
time;
618 if(own.portal_in.portal_id ==
id)
625 if(own.portal_out.portal_id ==
id)
641 portal =
new(portal);
646 portal.angles_x = -portal.angles.x;
648 portal.nextthink = 0;
649 portal.portal_activatetime =
time + 0.1;
655 portal.savemodelindex = portal.modelindex;
664 setsize(portal,
'-48 -48 -48',
'48 48 48');
684 portal.portal_id = portal_id_val;
704 portal.portal_id = portal_id_val;
void Portal_MakeWaitingPortal(entity portal)
void Portal_MakeInPortal(entity portal)
#define PHYS_INPUT_BUTTON_CHAT(s)
float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel, vector porg, vector pnorm, float psize)
void Portal_ClearAllLater(entity own)
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
bool Portal_Customize(entity this, entity client)
float portal_wants_to_vanish
float Portal_FindSafeOrigin(entity portal)
#define IS_INDEPENDENT_PLAYER(e)
#define FOREACH_CLIENT(cond, body)
float autocvar_g_balance_portal_health
float Portal_TeleportPlayer(entity teleporter, entity player, entity portal_owner)
float PlayerEdgeDistance(entity p, vector v)
void Portal_Disconnect(entity teleporter, entity destination)
void Portal_MakeBrokenPortal(entity portal)
void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g, entity portal_owner)
#define move_out_of_solid(e)
float autocvar_g_maxpushtime
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
#define setmodel(this, m)
void Portal_Remove(entity portal, float killed)
void Portal_Connect(entity teleporter, entity destination)
void Portal_MakeOutPortal(entity portal)
const float MOVE_NOMONSTERS
void Portal_ClearAll(entity own)
const int MAX_WEAPONSLOTS
void Portal_Touch(entity this, entity toucher)
void Portal_ClearWithID(entity own, float id)
void Portal_RemoveLater(entity portal, float kill)
void Portal_ClearAllLater_PortalsOnly(entity own)
vector portal_safe_origin
void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
float Portal_SetOutPortal(entity own, entity portal)
vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle)
entity Portal_Spawn(entity own, vector org, vector ang)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float Portal_SpawnOutPortalAtTrace(entity own, vector dir, float portal_id_val)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void Portal_RemoveLater_Think(entity this)
float Portal_SetInPortal(entity own, entity portal)
const float SOLID_TRIGGER
#define MUTATOR_CALLHOOK(id,...)
entity weaponentities[MAX_WEAPONSLOTS]
float autocvar_g_balance_portal_lifetime
void Portal_ClearAll_PortalsOnly(entity own)
vector trace_plane_normal
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
#define TELEPORT_FLAGS_PORTAL
void Portal_Think(entity this)
#define sound(e, c, s, v, a)
float Portal_SpawnInPortalAtTrace(entity own, vector dir, float portal_id_val)
float portal_activatetime
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)