]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/portals.qc
Merge branch 'master' into TimePath/scoreboard_elo
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / portals.qc
index b6f1576d266cdcd29b6982d0d2accb9694751648..f6502dfd812335d794b6a43f79322a03f68a6402 100644 (file)
@@ -249,8 +249,8 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel,
 #endif
 }
 
-void Portal_Touch()
-{SELFPARAM();
+void Portal_Touch(entity this)
+{
        vector g;
 
 #ifdef PORTALS_ARE_NOT_SOLID
@@ -322,13 +322,13 @@ void Portal_Touch()
                                other.effects += EF_BLUE - EF_RED;
 }
 
-void Portal_Think();
+void Portal_Think(entity this);
 void Portal_MakeBrokenPortal(entity portal)
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
-       portal.think = func_null;
+       settouch(portal, func_null);
+       setthink(portal, func_null);
        portal.effects = 0;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_NO;
@@ -338,8 +338,8 @@ void Portal_MakeWaitingPortal(entity portal)
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
-       portal.think = func_null;
+       settouch(portal, func_null);
+       setthink(portal, func_null);
        portal.effects = EF_ADDITIVE;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_YES;
@@ -349,8 +349,8 @@ void Portal_MakeInPortal(entity portal)
 {
        portal.skin = 0;
        portal.solid = SOLID_NOT; // this is done when connecting them!
-       portal.touch = Portal_Touch;
-       portal.think = Portal_Think;
+       settouch(portal, Portal_Touch);
+       setthink(portal, Portal_Think);
        portal.effects = EF_RED;
        portal.nextthink = time;
        portal.takedamage = DAMAGE_NO;
@@ -360,8 +360,8 @@ void Portal_MakeOutPortal(entity portal)
 {
        portal.skin = 1;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
-       portal.think = func_null;
+       settouch(portal, func_null);
+       setthink(portal, func_null);
        portal.effects = EF_STARDUST | EF_BLUE;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_YES;
@@ -369,8 +369,8 @@ void Portal_MakeOutPortal(entity portal)
 
 void Portal_Disconnect(entity teleporter, entity destination)
 {
-       teleporter.enemy = world;
-       destination.enemy = world;
+       teleporter.enemy = NULL;
+       destination.enemy = NULL;
        Portal_MakeBrokenPortal(teleporter);
        Portal_MakeBrokenPortal(destination);
 }
@@ -407,10 +407,10 @@ void Portal_Remove(entity portal, float killed)
        }
 
        if(portal == portal.aiment.portal_in)
-               portal.aiment.portal_in = world;
+               portal.aiment.portal_in = NULL;
        if(portal == portal.aiment.portal_out)
-               portal.aiment.portal_out = world;
-       //portal.aiment = world;
+               portal.aiment.portal_out = NULL;
+       //portal.aiment = NULL;
 
        // makes the portal vanish
        if(killed)
@@ -452,8 +452,8 @@ void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g)
                Portal_TeleportPlayer(this, e);
 }
 
-void Portal_Think()
-{SELFPARAM();
+void Portal_Think(entity this)
+{
        entity o;
        vector g;
 
@@ -467,7 +467,7 @@ void Portal_Think()
 
        o = this.aiment;
        this.solid = SOLID_BBOX;
-       this.aiment = world;
+       this.aiment = NULL;
 
        g = frametime * '0 0 -1' * autocvar_sv_gravity;
 
@@ -494,8 +494,8 @@ void Portal_Think()
                Portal_Remove(this, 0);
 }
 
-float Portal_Customize()
-{SELFPARAM();
+float Portal_Customize(entity this)
+{
        if(IS_SPEC(other))
                other = other.enemy;
        if(other == this.aiment)
@@ -574,15 +574,15 @@ void Portal_ClearAll(entity own)
        Portal_ClearAll_PortalsOnly(own);
        W_Porto_Remove(own);
 }
-void Portal_RemoveLater_Think()
-{SELFPARAM();
+void Portal_RemoveLater_Think(entity this)
+{
        Portal_Remove(this, this.cnt);
 }
 void Portal_RemoveLater(entity portal, float kill)
 {
        Portal_MakeBrokenPortal(portal);
        portal.cnt = kill;
-       portal.think = Portal_RemoveLater_Think;
+       setthink(portal, Portal_RemoveLater_Think);
        portal.nextthink = time;
 }
 void Portal_ClearAllLater_PortalsOnly(entity own)
@@ -621,7 +621,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
 
        fixedmakevectors(ang);
        if(!CheckWireframeBox(own, org - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
-               return world;
+               return NULL;
 
        portal = new(portal);
        portal.aiment = own;
@@ -629,7 +629,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        portal.mangle = ang;
        portal.angles = ang;
        portal.angles_x = -portal.angles.x; // is a bmodel
-       portal.think = Portal_Think;
+       setthink(portal, Portal_Think);
        portal.nextthink = 0;
        portal.portal_activatetime = time + 0.1;
        portal.takedamage = DAMAGE_AIM;
@@ -638,12 +638,12 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        portal.health = autocvar_g_balance_portal_health;
        setmodel(portal, MDL_PORTAL);
        portal.savemodelindex = portal.modelindex;
-       portal.customizeentityforclient = Portal_Customize;
+       setcefc(portal, Portal_Customize);
 
        if(!Portal_FindSafeOrigin(portal))
        {
                remove(portal);
-               return world;
+               return NULL;
        }
 
        setsize(portal, '-48 -48 -48', '48 48 48');