]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Step 6: complete
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 11 Jun 2016 13:55:25 +0000 (23:55 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 11 Jun 2016 14:07:43 +0000 (00:07 +1000)
53 files changed:
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/physics/player.qc
qcsrc/common/triggers/func/bobbing.qc
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/fourier.qc
qcsrc/common/triggers/func/pendulum.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/rotating.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/follow.qc
qcsrc/common/triggers/misc/teleport_dest.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/platforms.qh
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/target/speaker.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/dpdefs/post.qh [new file with mode: 0644]
qcsrc/dpdefs/pre.qh [new file with mode: 0644]
qcsrc/lib/_all.inc
qcsrc/lib/csqcmodel/sv_model.qc
qcsrc/lib/net.qh
qcsrc/lib/self.qh
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/server.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_subs.qc
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/sv_main.qc
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh
qcsrc/server/teamplay.qc

index a22d164ef073f9ccf5c55f5b9e4743cd2653c061..b6cca28b141a80db7f0cdd34839ac9857e7c33eb 100644 (file)
@@ -781,8 +781,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new)
 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
 void CSQC_Ent_Update(bool isnew)
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        this.sourceLoc = __FILE__ ":" STR(__LINE__);
        int t = ReadByte();
 
@@ -862,8 +861,7 @@ void Ent_Remove(entity this)
 }
 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(this) as well.
 void CSQC_Ent_Remove()
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype);
        if (wasfreed(this))
        {
index 9ba1114b6bde785bab0249feeee5342ced3f292d..a7c4b1b87b5df7d1eed0c9f889373ee912c1fa1b 100644 (file)
@@ -1370,8 +1370,7 @@ int lasthud;
 float vh_notice_time;
 void WaypointSprite_Load();
 void CSQC_UpdateView(float w, float h)
-{
-    SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
     TC(int, w); TC(int, h);
        entity e;
        float fov;
index 1cada9456d752fccea2edb556d78a5fab4184939..2a431c721d47bd6171609e98ce13036bd2ebdc8e 100644 (file)
@@ -124,7 +124,7 @@ void relocate_nexball(entity this)
                vector o;
                o = this.origin;
                if(!move_out_of_solid(this))
-                       objerror("could not get out of solid at all!");
+                       objerror(this, "could not get out of solid at all!");
                LOG_INFO("^1NOTE: this map needs FIXING. ", this.classname, " at ", vtos(o - '0 0 1'));
                LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
                LOG_INFO(" ", ftos(this.origin.y - o.y));
index ce31eecedc893a721c7bdf0f6ffc9687b8317208..a5ad94e2055fe9d4cf197451778c9853bb99619e 100644 (file)
@@ -418,8 +418,8 @@ void ons_DelayedLinkSetup(entity this)
 {
        this.goalentity = find(world, targetname, this.target);
        this.enemy = find(world, targetname, this.target2);
-       if(!this.goalentity) { objerror("can not find target\n"); }
-       if(!this.enemy) { objerror("can not find target2\n"); }
+       if(!this.goalentity) { objerror(this, "can not find target\n"); }
+       if(!this.enemy) { objerror(this, "can not find target2\n"); }
 
        LOG_DEBUG(strcat(etos(this.goalentity), " linked with ", etos(this.enemy), "\n"));
        this.SendFlags |= 3;
@@ -2203,7 +2203,7 @@ spawnfunc(onslaught_link)
        if(!g_onslaught) { remove(this); return; }
 
        if (this.target == "" || this.target2 == "")
-               objerror("target and target2 must be set\n");
+               objerror(this, "target and target2 must be set\n");
 
        this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist
        ons_worldlinklist = this;
@@ -2242,7 +2242,7 @@ keys:
 spawnfunc(onslaught_generator)
 {
        if(!g_onslaught) { remove(this); return; }
-       if(!this.team) { objerror("team must be set"); }
+       if(!this.team) { objerror(this, "team must be set"); }
 
        ons_GeneratorSetup(this);
 }
index a9d0c42e9b2f0e9d23d8a73be460da17d5d2d39e..61b7e94a954f43d740bf73ec275f80db394be125 100644 (file)
@@ -8,7 +8,7 @@
 .float move_ltime;
 .void(entity this) move_think;
 .float move_nextthink;
-.void() move_blocked;
+.void(entity this) move_blocked;
 
 .float move_movetype;
 .float move_time;
index bb81a41b930c58aa42fb72d9beeeb573f6aac6ae..5079bd97611d47d92c2251cc44570992be3592fa 100644 (file)
@@ -1552,7 +1552,7 @@ void CSQC_ClientMovement_PlayerMove_Frame(entity this)
 #endif
 {
 #ifdef SVQC
-       SELFPARAM(); // needed for engine functions
+       ENGINE_EVENT();
 #endif
        PM_Main(this);
 }
index 583efbe2590076f54d31f2dd2d7af9ff5453067f..094673b5bb4612f0b2dcb25f9b0afb7840ca42b0 100644 (file)
@@ -48,7 +48,7 @@ spawnfunc(func_bobbing)
        this.active = ACTIVE_ACTIVE;
 
        // damage when blocked
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
     if(this.dmg && (this.message2 == ""))
index d8a267608a4fe963f1185171417044e80f843b0b..a8ec50a86540a7be10fed5418c2bcd1b2b1786a3 100644 (file)
@@ -28,7 +28,7 @@ void button_return(entity this)
 }
 
 
-void button_blocked()
+void button_blocked(entity this)
 {
        // do nothing, just don't come all the way back out
 }
@@ -119,7 +119,7 @@ spawnfunc(func_button)
                return;
        this.effects |= EF_LOWPRECISION;
 
-       this.blocked = button_blocked;
+       setblocked(this, button_blocked);
        this.use = button_use;
 
 //     if (this.health == 0) // all buttons are now shootable
index c478079f546c3102ce6f6838b3332b057e666ea9..86d7cb2974f997f9a0a9bdd9a83133b0e04847eb 100644 (file)
@@ -25,8 +25,8 @@ void door_go_up(entity this);
 void door_rotating_go_down(entity this);
 void door_rotating_go_up(entity this);
 
-void door_blocked()
-{SELFPARAM();
+void door_blocked(entity this)
+{
        if((this.spawnflags & 8)
 #ifdef SVQC
                && (other.takedamage != DAMAGE_NO)
@@ -209,7 +209,7 @@ bool door_check_keys(entity door, entity player)
 void door_fire(entity this, entity actor, entity trigger)
 {
        if (this.owner != this)
-               objerror ("door_fire: this.owner != this");
+               objerror (this, "door_fire: this.owner != this");
 
        if (this.spawnflags & DOOR_TOGGLE)
        {
@@ -722,7 +722,7 @@ spawnfunc(func_door)
        precache_sound(this.noise);
        precache_sound(this.noise3);
 
-       this.blocked = door_blocked;
+       setblocked(this, door_blocked);
        this.use = door_use;
 
        if(this.dmg && (this.message == ""))
index 093382a7058fdc7ec4f6c22da835d61b008ac499..31171899fc691a889e204ff06cee003b68b21bea 100644 (file)
@@ -71,7 +71,7 @@ spawnfunc(func_door_rotating)
        //this.effects |= EF_LOWPRECISION;
        this.classname = "door_rotating";
 
-       this.blocked = door_blocked;
+       setblocked(this, door_blocked);
        this.use = door_use;
 
     if(this.spawnflags & 8)
index a2d883ba068299ff78f51101bdcb9bad1a289741..f02fc61f646219626c5cf270df04e4763fb4d0a6 100644 (file)
@@ -135,8 +135,8 @@ void fd_secret_done(entity this)
 
 .float door_finished;
 
-void secret_blocked()
-{SELFPARAM();
+void secret_blocked(entity this)
+{
        if (time < this.door_finished)
                return;
        this.door_finished = time + 0.5;
@@ -214,7 +214,7 @@ spawnfunc(func_door_secret)
        precache_sound(this.noise);
 
        settouch(this, secret_touch);
-       this.blocked = secret_blocked;
+       setblocked(this, secret_blocked);
        this.speed = 50;
        this.use = fd_secret_use;
        IFTARGETED
index cde3c5d494923a423646b7d435745b8194bfe738..52eab115a0655790538c6c43471dabaafbe32be8 100644 (file)
@@ -55,7 +55,7 @@ spawnfunc(func_fourier)
        this.destvec = this.origin;
        this.cnt = 360 / this.speed;
 
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
     if(this.dmg && (this.message2 == ""))
index f1fffd7b927f86e7084a32b457e161c46a5d391f..05f7b75a67602ead968210b1bcf94343d4c32d3c 100644 (file)
@@ -46,7 +46,7 @@ spawnfunc(func_pendulum)
                this.dmgtime = 0.25;
        this.dmgtime2 = time;
 
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
 
        this.avelocity_z = 0.0000001;
        if (!InitMovingBrushTrigger(this))
index dea0077c1f13e881512515af1e15ad6a31f65050..6f7ebaad31522130f7b69bf3509346c2e1e5098c 100644 (file)
@@ -106,7 +106,7 @@ spawnfunc(func_plat)
        this.effects |= EF_LOWPRECISION;
        setsize (this, this.mins , this.maxs);
 
-       this.blocked = plat_crush;
+       setblocked(this, plat_crush);
 
        if (!this.speed) this.speed = 150;
        if (!this.lip) this.lip = 16;
index f34d41e2b02af8737d31d8c7e701de75dbe047e6..22f3dedea282926edb76fd55ec172d740aad02af 100644 (file)
@@ -65,7 +65,7 @@ spawnfunc(func_rotating)
                return;
        // no EF_LOWPRECISION here, as rounding angles is bad
 
-    this.blocked = generic_plat_blocked;
+    setblocked(this, generic_plat_blocked);
 
        // wait for targets to spawn
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
index 1ec63780f12dfde25ffed5ba88c068d534dcc19f..015668328a3c32e0843ab78d7bc7c9181b1e7543 100644 (file)
@@ -77,7 +77,7 @@ void train_next(entity this)
                }
        }
        if (this.target == "")
-               objerror("train_next: no next target");
+               objerror(this, "train_next: no next target");
        this.wait = targ.wait;
        if (!this.wait)
                this.wait = 0.1;
@@ -189,7 +189,7 @@ void func_train_find(entity this)
        targ = find(world, targetname, this.target);
        this.target = targ.target;
        if (this.target == "")
-               objerror("func_train_find: no next target");
+               objerror(this, "func_train_find: no next target");
        SUB_SETORIGIN(this, targ.origin - this.view_ofs);
 
        if(!(this.spawnflags & 4))
@@ -215,7 +215,7 @@ spawnfunc(func_train)
                precache_sound(this.noise);
 
        if (this.target == "")
-               objerror("func_train without a target");
+               objerror(this, "func_train without a target");
        if (!this.speed)
                this.speed = 100;
 
@@ -237,7 +237,7 @@ spawnfunc(func_train)
        // wait for targets to spawn
        InitializeEntity(this, func_train_find, INITPRIO_FINDTARGET);
 
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
     if(this.dmg && (this.message2 == ""))
index dd8804106c2672ca6e18e23de9ca0d98b62af0e4..a336c8b7e289e146b506f2100aa950c4c4d52c1f 100644 (file)
@@ -86,7 +86,7 @@ void func_vectormamamam_findtarget(entity this)
                this.wp03 = find(world, targetname, this.target4);
 
        if(!this.wp00 && !this.wp01 && !this.wp02 && !this.wp03)
-               objerror("No reference entity found, so there is nothing to move. Aborting.");
+               objerror(this, "No reference entity found, so there is nothing to move. Aborting.");
 
        this.destvec = this.origin - func_vectormamamam_origin(this, 0);
 
@@ -129,7 +129,7 @@ spawnfunc(func_vectormamamam)
        if(vlen(this.target4normal))
                this.target4normal = normalize(this.target4normal);
 
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
     if(this.dmg && (this.message == ""))
index dbe1cb7d8c0013aee51a65788547def7624610b3..8949f17a9ebb566e8a216554dc54716ed90241f7 100644 (file)
@@ -13,7 +13,7 @@ void follow_init(entity this)
 
        if(!src && !dst)
        {
-               objerror("follow: could not find target/killtarget");
+               objerror(this, "follow: could not find target/killtarget");
                return;
        }
 
@@ -25,7 +25,7 @@ void follow_init(entity this)
        }
        else if(!src || !dst)
        {
-               objerror("follow: could not find target/killtarget");
+               objerror(this, "follow: could not find target/killtarget");
                return;
        }
        else if(this.spawnflags & 1)
index b3a242076a28b49e6406237ef33ad911adce0563..285f7357f4134608adc110cbdfe3212c5e7a580c 100644 (file)
@@ -44,7 +44,7 @@ spawnfunc(info_teleport_destination)
        {
        }
        else
-               objerror ("^3Teleport destination without a targetname");
+               objerror (this, "^3Teleport destination without a targetname");
 
        teleport_dest_link(this);
 }
index 9d2b3f2bc371911fe65a3120db65064c49fa1339..7b2f43f33a108f4abd8ce4608c7e8b782e06ebda 100644 (file)
@@ -1,7 +1,6 @@
-void generic_plat_blocked()
+void generic_plat_blocked(entity this)
 {
 #ifdef SVQC
-    SELFPARAM();
        if(this.dmg && other.takedamage != DAMAGE_NO)
        {
                if(this.dmgtime2 < time)
@@ -55,7 +54,7 @@ void plat_spawn_inside_trigger(entity this)
 
        // otherwise, something is fishy...
        remove(trigger);
-       objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
+       objerror(this, "plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
 }
 
 void plat_hit_top(entity this)
@@ -140,8 +139,8 @@ void plat_trigger_use(entity this, entity actor, entity trigger)
 }
 
 
-void plat_crush()
-{SELFPARAM();
+void plat_crush(entity this)
+{
        if((this.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
        { // KIll Kill Kill!!
 #ifdef SVQC
@@ -174,7 +173,7 @@ void plat_use(entity this, entity actor, entity trigger)
 {
        this.use = func_null;
        if (this.state != 4)
-               objerror ("plat_use: not in up state");
+               objerror (this, "plat_use: not in up state");
        plat_go_down(this);
 }
 
@@ -222,7 +221,7 @@ bool set_platmovetype(entity e, string s)
 
        if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
        {
-               objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");
+               objerror(e, "Invalid platform move type; platform would go in reverse, which is not allowed.");
                return false;
        }
 
index acb90a7efe71b78dae8d39bb1d2977dbd090fe2b..6bdfb23d68bf0ced7ea0ee836e6cbcb4bb6d0368 100644 (file)
@@ -8,7 +8,7 @@ void plat_outside_touch(entity this);
 void plat_trigger_use(entity this, entity actor, entity trigger);
 void plat_go_up(entity this);
 void plat_go_down(entity this);
-void plat_crush();
+void plat_crush(entity this);
 const float PLAT_LOW_TRIGGER = 1;
 
 .float dmg;
index 1595b9a9cf3b2824bae35f8422a32f7383c2ef09..a71267b0cc5d047d59b01d2e30d739e23421250c 100644 (file)
@@ -189,7 +189,7 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe
        entity controller;
 
        if (!tspeed)
-               objerror ("No speed is defined!");
+               objerror (this, "No speed is defined!");
 
        this.think1 = func;
        this.finaldest = tdest;
@@ -245,7 +245,7 @@ void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, vo
        float   traveltime;
 
        if (!tspeed)
-               objerror ("No speed is defined!");
+               objerror (this, "No speed is defined!");
 
        this.think1 = func;
        this.finaldest = tdest;
@@ -320,7 +320,7 @@ void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float t
        float   traveltime;
 
        if (!tspeed)
-               objerror ("No speed is defined!");
+               objerror (this, "No speed is defined!");
 
        // take the shortest distance for the angles
        this.angles_x -= 360 * floor((this.angles_x - destangle_x) / 360 + 0.5);
index dc9b34b4a95796fc575d4785c8cdaf4e68a83999..7db93a3d1e46c665227b15b5d7223e6003651376 100644 (file)
@@ -119,7 +119,7 @@ spawnfunc(target_speaker)
        }
        else if(this.spawnflags & 2) // LOOPED_OFF
        {
-               objerror("This sound entity can never be activated");
+               objerror(this, "This sound entity can never be activated");
        }
        else
        {
index 492f7f353716b77c61be26bb56be4a783ee688f8..475904d21eafb3e78597ab056955d237f4cab94c 100644 (file)
@@ -264,7 +264,7 @@ void teleport_findtarget(entity this)
        if(n == 0)
        {
                // no dest!
-               objerror ("Teleporter with nonexistant target");
+               objerror (this, "Teleporter with nonexistant target");
                return;
        }
        else if(n == 1)
index c174aa513d8c3990ea0269e0293f4b59b9e7a502..aee2f72cbe63b92513aa7c5749139141be31b641 100644 (file)
@@ -16,7 +16,7 @@ void trigger_impulse_touch1(entity this)
        targ = find(world, targetname, this.target);
        if(!targ)
        {
-               objerror("trigger_force without a (valid) .target!\n");
+               objerror(this, "trigger_force without a (valid) .target!\n");
                remove(this);
                return;
        }
index 9691cdad80ac1a1d89c525adbb7e526052886f66..464d05d089405c9e7e33e439ef2fc7197a8fdc4d 100644 (file)
@@ -304,7 +304,7 @@ void trigger_push_findtarget(entity this)
                {
                        // no dest!
 #ifdef SVQC
-                       objerror ("Jumppad with nonexistant target");
+                       objerror (this, "Jumppad with nonexistant target");
 #endif
                        return;
                }
index 1f08796dd65f99282a46a2fcf07cc2573363d235..9f71eeff329cfb66c9f28f62466d329de6054dce 100644 (file)
@@ -167,7 +167,7 @@ spawnfunc(trigger_multiple)
        if (this.health)
        {
                if (this.spawnflags & SPAWNFLAG_NOTOUCH)
-                       objerror ("health and notouch don't make sense\n");
+                       objerror (this, "health and notouch don't make sense\n");
                this.max_health = this.health;
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;
index 8caa2d5ebe33bb1422bc06a3d267525a1fc5f53c..8ee6b7a69727e091f5a83459b4309b6e9172686f 100644 (file)
@@ -94,7 +94,7 @@ spawnfunc(trigger_teleport)
 
        if (this.target == "")
        {
-               objerror ("Teleporter with no target");
+               objerror (this, "Teleporter with no target");
                return;
        }
 
index d7d988f516172fd1b637ba5a416afc08f8e6aa05..0e13a6bdeb77ce0bfeb9698b67f548ce6d2ba261 100644 (file)
@@ -41,8 +41,7 @@ void trigger_init(entity this)
 
 void trigger_link(entity this, bool(entity this, entity to, int sendflags) sendfunc)
 {
-       this.SendEntity = SendEntity_self;
-       this.SendEntity3 = sendfunc;
+       setSendEntity(this, sendfunc);
        this.SendFlags = 0xFFFFFF;
 }
 
index 8a0254bfb63ffe43bf2df8c61cfd372028bd6405..a512ad2ca85eb80dd522e7c8a74e0acc63057743 100644 (file)
@@ -57,7 +57,7 @@ void W_Porto_Success(entity this)
 {
        if(this.realowner == world)
        {
-               objerror("Cannot succeed successfully: no owner\n");
+               objerror(this, "Cannot succeed successfully: no owner\n");
                return;
        }
 
@@ -70,7 +70,7 @@ void W_Porto_Fail(entity this, float failhard)
 {
        if(this.realowner == world)
        {
-               objerror("Cannot fail successfully: no owner\n");
+               objerror(this, "Cannot fail successfully: no owner\n");
                return;
        }
 
diff --git a/qcsrc/dpdefs/post.qh b/qcsrc/dpdefs/post.qh
new file mode 100644 (file)
index 0000000..fe465e5
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#undef objerror
diff --git a/qcsrc/dpdefs/pre.qh b/qcsrc/dpdefs/pre.qh
new file mode 100644 (file)
index 0000000..f63f0aa
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#define objerror builtin_objerror
index c5e020660d3980f5f029bf97af8112b17603f6f6..23b55cb69de3a31bf4729adeb4765af660472890 100644 (file)
@@ -12,6 +12,8 @@
        #define bool float
 #endif
 
+#include <dpdefs/pre.qh>
+
 #if defined(CSQC)
        #include <dpdefs/csprogsdefs.qh>
        #include <dpdefs/keycodes.qh>
@@ -25,6 +27,8 @@
        #include <dpdefs/keycodes.qh>
 #endif
 
+#include <dpdefs/post.qh>
+
 #define USING(name, T) typedef T name
 
 #include "bool.qh"
index b02df19e0015a25a0f96df60d8abe5a3f5984976..2d0e5eb0947ef0cf30047a138ea6939f1408faa5 100644 (file)
@@ -121,8 +121,7 @@ void CSQCModel_CheckUpdate(entity e)
 
 void CSQCModel_LinkEntity(entity e)
 {
-       e.SendEntity = SendEntity_self;
-       e.SendEntity3 = CSQCModel_Send;
+       setSendEntity(e, CSQCModel_Send);
        e.SendFlags = 0xFFFFFF;
        CSQCModel_CheckUpdate(e);
 }
index 771782ea721ccdf0ac27ba4e06fa5160aabc5bcd..507807919ac9d6bbf0425b1dd03ea4f1b3c691d8 100644 (file)
@@ -101,8 +101,6 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        /** return false to remove from the client */
        .bool(entity this, entity to, int sendflags) SendEntity3;
 
-       bool SendEntity_self(entity to, int sendflags) { SELFPARAM(); return this.SendEntity3(this, to, sendflags); }
-
        void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
        {
                if (e.classname == "") e.classname = "net_linked";
@@ -115,8 +113,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                        setsize(e, mi, ma);
                }
 
-               e.SendEntity = SendEntity_self;
-               e.SendEntity3 = sendfunc;
+               setSendEntity(e, sendfunc);
                e.SendFlags = 0xFFFFFF;
 
                if (!docull) e.effects |= EF_NODEPTHTEST;
index fe26b08a415cc32a381b8040fc5448d003017e31..4af4b8ab024388ad1db5f0b067b7fee533e0a4e8 100644 (file)
@@ -21,6 +21,7 @@
     #define self (this, self)
     #undef SELFPARAM
     #define SELFPARAM() const entity this = __self
+    #define ENGINE_EVENT() const entity this = __self
 #endif
 
 // Step 4: kill unstructured setself
@@ -35,7 +36,7 @@
 #endif
 
 // Step 6: remove SELFPARAM, add parameters
-#if 0
+#if 1
     #undef SELFPARAM
 #endif
 
     #define WITHSELF(value, block) block
 #endif
 
-#define SELFWRAP(T, R, args, forward) \
-    .R() T; \
-    .R() __##T = T; \
+#define SELFWRAP(T, R, oldargs, args, forward) \
+    .R oldargs T; \
+    .R oldargs __##T = T; \
     .R args self##T; \
-    R T##_self() { SELFPARAM(); return this.self##T forward; }
+    R T##_self oldargs { ENGINE_EVENT(); return this.self##T forward; }
 
 noref entity _selftemp;
 #define SELFWRAP_SET(T, e, f) \
@@ -61,21 +62,43 @@ noref entity _selftemp;
 #define _SELFWRAP_GET(T, e) \
     (0, (e).__##T)
 
-SELFWRAP(think, void, (entity this), (this))
+SELFWRAP(think, void, (), (entity this), (this))
 #define setthink(e, f) SELFWRAP_SET(think, e, f)
 #define getthink(e) SELFWRAP_GET(think, e)
 
-SELFWRAP(touch, void, (entity this), (this))
+SELFWRAP(touch, void, (), (entity this), (this))
 #define settouch(e, f) SELFWRAP_SET(touch, e, f)
 #define gettouch(e) SELFWRAP_GET(touch, e)
 
-SELFWRAP(predraw, void, (entity this), (this))
+SELFWRAP(blocked, void, (), (entity this), (this))
+#define setblocked(e, f) SELFWRAP_SET(blocked, e, f)
+#define blocked stopusingthis
+
+SELFWRAP(predraw, void, (), (entity this), (this))
 #define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
 
-SELFWRAP(customizeentityforclient, bool, (entity this), (this))
+SELFWRAP(customizeentityforclient, bool, (), (entity this), (this))
 #define setcefc(e, f) SELFWRAP_SET(customizeentityforclient, e, f)
 #define getcefc(e) SELFWRAP_GET(customizeentityforclient, e)
 
+SELFWRAP(camera_transform, vector, (vector org, vector ang), (entity this, vector org, vector ang), (this, org, ang))
+#define setcamera_transform(e, f) SELFWRAP_SET(camera_transform, e, f)
+
+SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to, int sendflags), (this, to, sendflags))
+#define setSendEntity(e, f) SELFWRAP_SET(SendEntity, e, f)
+
+#ifdef SVQC
+void make_safe_for_remove(entity this);
+#endif
+
+void objerror(entity this, string s)
+{
+#ifdef SVQC
+    make_safe_for_remove(this);
+#endif
+    WITHSELF(this, builtin_objerror(s));
+}
+
 #ifndef MENUQC
 void adaptor_think2touch(entity this) { WITH(entity, other, NULL, gettouch(this)(this)); }
 void adaptor_think2use(entity this) { if (this.use) this.use(this, NULL, NULL); }
index 5967c1ba1a9d564db61f3bf52a6137ee9616387a..704feeb7e7c8b84a60bef620a15aa7505965be37 100644 (file)
@@ -37,10 +37,9 @@ void WarpZone_Accumulator_AddInverse(entity acc, entity wz)
        WarpZone_Accumulator_AddInverseTransform(acc, wz.warpzone_transform, wz.warpzone_shift);
 }
 
-.vector(vector, vector) camera_transform;
 float autocvar_cl_warpzone_usetrace = 1;
-vector WarpZone_camera_transform(vector org, vector ang)
-{SELFPARAM();
+vector WarpZone_camera_transform(entity this, vector org, vector ang)
+{
        vector vf, vr, vu;
        if(this.warpzone_fadestart)
                if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
@@ -74,11 +73,11 @@ void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, ve
        e.warpzone_targetangles = other_ang;
        fixedmakevectors(my_ang); e.warpzone_forward = v_forward;
        fixedmakevectors(other_ang); e.warpzone_targetforward = v_forward;
-       e.camera_transform = WarpZone_camera_transform;
+       setcamera_transform(e, WarpZone_camera_transform);
 }
 
-vector WarpZone_Camera_camera_transform(vector org, vector ang)
-{SELFPARAM();
+vector WarpZone_Camera_camera_transform(entity this, vector org, vector ang)
+{
        // a fixed camera view
        if(this.warpzone_fadestart)
                if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
@@ -94,7 +93,7 @@ void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang) // we assume
 {
        e.warpzone_origin = my_org;
        e.warpzone_angles = my_ang;
-       e.camera_transform = WarpZone_Camera_camera_transform;
+       setcamera_transform(e, WarpZone_Camera_camera_transform);
 }
 
 .entity enemy;
index c373e1eaeec99324b910372846930a12991738bb..a84b7a73984219626a7a91b3d2d62e6abd18d397 100644 (file)
@@ -169,8 +169,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
 
                entity ts = new(warpzone_teleported);
                setmodel(ts, MDL_Null);
-               ts.SendEntity = SendEntity_self;
-               ts.SendEntity3 = WarpZone_Teleported_Send;
+               setSendEntity(ts, WarpZone_Teleported_Send);
                ts.SendFlags = 0xFFFFFF;
                ts.drawonlytoclient = player;
                setthink(ts, SUB_Remove);
@@ -771,8 +770,7 @@ spawnfunc(trigger_warpzone)
                setsize(this, this.mins * this.scale, this.maxs * this.scale);
        else
                setsize(this, this.mins, this.maxs);
-       this.SendEntity = SendEntity_self;
-       this.SendEntity3 = WarpZone_Send;
+       setSendEntity(this, WarpZone_Send);
        this.SendFlags = 0xFFFFFF;
        BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
        this.warpzone_next = warpzone_first;
@@ -798,8 +796,7 @@ spawnfunc(func_camera)
                this.solid = SOLID_BSP;
        else if(this.solid < 0)
                this.solid = SOLID_NOT;
-       this.SendEntity = SendEntity_self;
-       this.SendEntity3 = WarpZone_Camera_Send;
+       setSendEntity(this, WarpZone_Camera_Send);
        this.SendFlags = 0xFFFFFF;
        this.warpzone_next = warpzone_camera_first;
        warpzone_camera_first = this;
index 7dda060119dba09c91ab53fd6a0d23e8ad4f10a9..e92a6082a77d2486c562cd7e03604558ed363714 100644 (file)
@@ -110,7 +110,7 @@ void info_autoscreenshot_findtarget(entity this)
        e = find(world, targetname, this.target);
        if(!e)
        {
-               objerror("Missing target. FAIL!");
+               objerror(this, "Missing target. FAIL!");
                return;
        }
        vector a = vectoangles(e.origin - this.origin);
@@ -123,7 +123,7 @@ spawnfunc(info_autoscreenshot)
 {
        if(++num_autoscreenshot > autocvar_g_max_info_autoscreenshot)
        {
-               objerror("Too many info_autoscreenshot entitites. FAIL!");
+               objerror(this, "Too many info_autoscreenshot entitites. FAIL!");
                return;
        }
        if(this.target != "")
index bd12c1e5caddd588656967bc015c58e0143288d6..8da1f1076401d702f97d8b1a2cfbf7efd62c3372 100644 (file)
@@ -441,8 +441,7 @@ void FixPlayermodel(entity player)
 
 /** Called when a client spawns in the server */
 void PutClientInServer()
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if (IS_BOT_CLIENT(this)) {
                TRANSMUTE(Player, this);
        } else if (IS_REAL_CLIENT(this)) {
@@ -733,7 +732,7 @@ SetChangeParms
 =============
 */
 void SetChangeParms ()
-{SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        // save parms for level change
        parm1 = this.parm_idlesince - time;
 
@@ -949,7 +948,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change,
 }
 
 void ClientKill ()
-{SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if(gameover) return;
        if(this.player_blocked) return;
        if(STAT(FROZEN, this)) return;
@@ -999,7 +998,7 @@ Called once (not at each match start) when a client begins a connection to the s
 =============
 */
 void ClientPreConnect ()
-{SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if(autocvar_sv_eventlog)
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
@@ -1019,8 +1018,7 @@ Called when a client connects to the server
 =============
 */
 void ClientConnect()
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if (Ban_MaybeEnforceBanOnce(this)) return;
        assert(!IS_CLIENT(this), return);
        this.flags |= FL_CLIENT;
@@ -1176,8 +1174,7 @@ Called when a client disconnects from the server
 .entity chatbubbleentity;
 void ReadyCount();
 void ClientDisconnect()
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        assert(IS_CLIENT(this), return);
 
        PlayerStats_GameReport_FinalizePlayer(this);
@@ -2070,8 +2067,7 @@ Called every frame for each client before the physics are run
 .float last_vehiclecheck;
 .int items_added;
 void PlayerPreThink ()
-{
-    SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        WarpZone_PlayerPhysics_FixVAngle(this);
 
     STAT(GAMESTARTTIME, this) = game_starttime;
@@ -2420,8 +2416,7 @@ Called every frame for each client after the physics are run
 */
 .float idlekick_lasttimeleft;
 void PlayerPostThink ()
-{
-    SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        if (sv_maxidle > 0)
        if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
        if (IS_REAL_CLIENT(this))
index cf0b536d515438e844c11b7b4ac5c453aca767e9..1cbc699aeff1d9ab576cfce2883a579f0fb754f5 100644 (file)
@@ -705,8 +705,7 @@ void ClientCommand_macro_write_aliases(float fh)
 // If this function exists, server game code parses clientcommand before the engine code gets it.
 
 void SV_ParseClientCommand(string command)
-{
-       SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        // If invalid UTF-8, don't even parse it
        string command2 = "";
        float len = strlen(command);
index 9e2cd1156f6a282975b18b73bca24d041e9e6746..98f2c436392d63f181412115892f6f9c87062ff9 100644 (file)
@@ -45,7 +45,7 @@ void dynlight_find_aiment(entity this)
 {
        entity targ;
        if (!this.target)
-               objerror ("dynlight: no target to follow");
+               objerror (this, "dynlight: no target to follow");
 
        targ = find(world, targetname, this.target);
        this.movetype = MOVETYPE_FOLLOW;
@@ -61,7 +61,7 @@ void dynlight_find_path(entity this)
 {
        entity targ;
        if (!this.target)
-               objerror ("dynlight: no target to follow");
+               objerror (this, "dynlight: no target to follow");
 
        targ = find(world, targetname, this.target);
        this.target = targ.target;
@@ -73,7 +73,7 @@ void dynlight_find_target(entity this)
 {
        entity targ;
        if (!this.target)
-               objerror ("dynlight: no target to follow");
+               objerror (this, "dynlight: no target to follow");
 
        targ = find(world, targetname, this.target);
        setattachment(this, targ, this.dtagname);
index b3b4d2eb0438d1958599a350d2682e78106c7c64..d4463f6939531ef7da9561b4c3afa082a4237dc9 100644 (file)
@@ -443,7 +443,7 @@ bool InitMovingBrushTrigger(entity this)
        this.movetype = MOVETYPE_PUSH;
        if(this.modelindex == 0)
        {
-               objerror("InitMovingBrushTrigger: no brushes found!");
+               objerror(this, "InitMovingBrushTrigger: no brushes found!");
                return false;
        }
        return true;
index 656eede4c9a81d34a65304533ef19e35ae1308e6..317b897b0c8a98d922b9ff49c4f30a48271d15b9 100644 (file)
@@ -159,7 +159,7 @@ spawnfunc(item_key)
 
        // reject this entity if more than one key was set!
        if (this.itemkeys>0 && (this.itemkeys & (this.itemkeys-1)) != 0) {
-               objerror("item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
+               objerror(this, "item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
                remove(this);
                return;
        }
@@ -201,7 +201,7 @@ spawnfunc(item_key)
                _colormod = '1 1 1';
 
                if (this.netname == "") {
-                       objerror("item_key doesn't have a default name for this key and a custom one was not specified!");
+                       objerror(this, "item_key doesn't have a default name for this key and a custom one was not specified!");
                        remove(this);
                        return;
                }
@@ -216,7 +216,7 @@ spawnfunc(item_key)
        } else if (this.itemkeys >= ITEM_KEY_BIT(3) && this.itemkeys <= ITEM_KEY_BIT(5)) {
                _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model!
        } else if (this.model == "") {
-               objerror("item_key doesn't have a default model for this key and a custom one was not specified!");
+               objerror(this, "item_key doesn't have a default model for this key and a custom one was not specified!");
                remove(this);
                return;
        }
index 44c21610a09f7efcf4f66c9b781c8aa6de0b040b..d4c4bb7e5661faed97d57bae933e715b31f1d641 100644 (file)
@@ -823,12 +823,6 @@ void make_safe_for_remove(entity e)
     }
 }
 
-void objerror(string s)
-{SELFPARAM(); // needed for engine functions
-    make_safe_for_remove(this);
-    builtin_objerror(s);
-}
-
 .float remove_except_protected_forbidden;
 void remove_except_protected(entity e)
 {
index 4ce33b198442141e7aba03e783c01787c7de5bf4..a8304b0e3aff44fa74e91510d4c82b7f1e042332 100644 (file)
@@ -55,7 +55,6 @@ void InitializeEntitiesRun();
 void stopsoundto(float _dest, entity e, float chan);
 void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten);
 
-void objerror(string s);
 void droptofloor(entity this);
 
 void attach_sameorigin(entity e, entity to, string tag);
index cf27a8f0db2cd3b291aec544b555168fd3ca8950..8c9a01e27ce5f8bf80aa68a18e4de3c8cbbf2082 100644 (file)
@@ -148,13 +148,13 @@ void assault_setenemytoobjective(entity this)
                        if(this.enemy == world)
                                this.enemy = objective;
                        else
-                               objerror("more than one objective as target - fix the map!");
+                               objerror(this, "more than one objective as target - fix the map!");
                        break;
                }
        }
 
        if(this.enemy == world)
-               objerror("no objective as target - fix the map!");
+               objerror(this, "no objective as target - fix the map!");
 }
 
 bool assault_decreaser_sprite_visible(entity this, entity player, entity view)
index 5f17bf6a120a3c31ca41d950888cc385bf40560a..eed44a789b4117d04a00dbfcac2b219081ae2d20 100644 (file)
@@ -312,7 +312,7 @@ void dom_controlpoint_setup(entity this)
        while(head && head.netname != "")
                head = find(head, classname, "dom_team");
        if (!head)
-               objerror("no spawnfunc_dom_team with netname \"\" found\n");
+               objerror(this, "no spawnfunc_dom_team with netname \"\" found\n");
 
        // copy important properties from spawnfunc_dom_team entity
        this.goalentity = head;
index 6859b484978cd6668675c0a023437aa56aec8fd6..c71ce1d312a104bf6160575b7e940c5041a238d3 100644 (file)
@@ -81,7 +81,7 @@ void relocate_spawnpoint(entity this)
         this.mins = PL_MIN_CONST;
         this.maxs = PL_MAX_CONST;
         if (!move_out_of_solid(this))
-            objerror("could not get out of solid at all!");
+            objerror(this, "could not get out of solid at all!");
         LOG_INFO("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1'));
         LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
         LOG_INFO(" ", ftos(this.origin.y - o.y));
@@ -96,7 +96,7 @@ void relocate_spawnpoint(entity this)
         {
             setorigin(this, o);
             this.mins = this.maxs = '0 0 0';
-            objerror("player spawn point in solid, mapper sucks!\n");
+            objerror(this, "player spawn point in solid, mapper sucks!\n");
             return;
         }
     }
index 0c1cc66767c62a970c3f5764f36919fe2ea5f1c2..e1bf5c0be25236206f696f2a6c81ee81011f3a75 100644 (file)
@@ -238,7 +238,7 @@ void StartFrame()
 .string cvarfilter;
 bool DoesQ3ARemoveThisEntity(entity this);
 void SV_OnEntityPreSpawnFunction()
-{SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        __spawnfunc_expect = this;
        if (this)
        if (this.gametypefilter != "")
index a74e521ab0c935e48a92b0ef9546099e9e3b9b59..e24a790a148a2cdebbe4bf3c40302178e6ee6adb 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#undef objerror
 #undef droptofloor
 #undef sound
 #undef remove
index ca6a2044d375c7d5b1f2cd6b1921145d00e982fa..7ab3f7b9f62763da2566d9409d6f53cb14ea1e80 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#define objerror builtin_objerror
 #define droptofloor builtin_droptofloor
 #define remove builtin_remove
 #define cvar_set builtin_cvar_set
index 945e7333be37c6e3e5b6b144a93d3f1e732b9867..203396f31411d36440cd94a7b6611a103b2ece6a 100644 (file)
@@ -560,7 +560,7 @@ int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam)
 
 //void() ctf_playerchanged;
 void SV_ChangeTeam(float _color)
-{SELFPARAM(); // needed for engine functions
+{ENGINE_EVENT();
        float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
 
        // in normal deathmatch we can just apply the color and we're done