]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Wrap customizeentityforclient
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 9 Jun 2016 10:54:19 +0000 (20:54 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 9 Jun 2016 10:54:19 +0000 (20:54 +1000)
19 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/minigames/minigames.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/minigames/sv_minigames.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/lib/net.qh
qcsrc/lib/self.qh
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_subs.qc
qcsrc/server/g_subs.qh
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/portals.qc
qcsrc/server/weapons/weaponsystem.qc

index 426cab70e151aea46122fac85d0896113cf1319e..6c6bcac9e2553002097769b9fb7ea116d1e6b012 100644 (file)
@@ -609,8 +609,8 @@ spawnfunc(nexball_football)
        SpawnBall(this);
 }
 
-float nb_Goal_Customize()
-{SELFPARAM();
+float nb_Goal_Customize(entity this)
+{
        entity e, wp_owner;
        e = WaypointSprite_getviewentity(other);
        wp_owner = self.owner;
@@ -629,7 +629,7 @@ void SpawnGoal(entity this)
        {
                entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (this.absmin + this.absmax) * 0.5, this, sprite, RADARICON_NONE);
                wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0.5 0');
-               this.sprite.customizeentityforclient = nb_Goal_Customize;
+               setcefc(this.sprite, nb_Goal_Customize);
        }
 
        this.classname = "nexball_goal";
@@ -838,13 +838,13 @@ void W_Nexball_Attack2(entity actor)
        CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
 }
 
-float ball_customize()
-{SELFPARAM();
+float ball_customize(entity this)
+{
        if(!self.owner)
        {
                self.effects &= ~EF_FLAME;
                self.scale = 1;
-               self.customizeentityforclient = func_null;
+               setcefc(self, func_null);
                return true;
        }
 
@@ -948,7 +948,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
                {
                        // 'view ball'
                        self.ballcarried.velocity = self.velocity;
-                       self.ballcarried.customizeentityforclient = ball_customize;
+                       setcefc(self.ballcarried, ball_customize);
 
                        vector org = self.origin + self.view_ofs +
                                          v_forward * autocvar_g_nexball_viewmodel_offset.x +
index 0870ed6bfa323b0811b504b9d7db39330c9fd19a..1b6433076c119cacf81dfb23c18e5577dfcdad9b 100644 (file)
@@ -162,8 +162,8 @@ void FixSize(entity e);
 // CaptureShield Functions
 // =======================
 
-bool ons_CaptureShield_Customize()
-{SELFPARAM();
+bool ons_CaptureShield_Customize(entity this)
+{
        entity e = WaypointSprite_getviewentity(other);
 
        if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
@@ -209,7 +209,7 @@ void ons_CaptureShield_Spawn(entity generator, bool is_generator)
        shield.colormap = generator.colormap;
        shield.reset = ons_CaptureShield_Reset;
        settouch(shield, ons_CaptureShield_Touch);
-       shield.customizeentityforclient = ons_CaptureShield_Customize;
+       setcefc(shield, ons_CaptureShield_Customize);
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
        shield.solid = SOLID_TRIGGER;
index 71cf41a3aa44340d471491aad35b2e893ff19a0c..0ccbc0e922aa1ed762dafc4cc2c445675676209b 100644 (file)
@@ -91,7 +91,7 @@ entity msle_spawn(entity minigame_session, string class_name)
        e.owner = minigame_session;
        e.minigame_autoclean = 1;
        #ifdef SVQC
-               e.customizeentityforclient = minigame_CheckSend;
+               setcefc(e, minigame_CheckSend);
                Net_LinkEntity(e, false, 0, minigame_SendEntity);
        #endif
        return e;
index 18e1d3216ee38e14ae103df2720b96a9773dc405..bde942616b66ee9a46952c0bab8247d7ad946ad3 100644 (file)
@@ -112,8 +112,8 @@ void minigame_resend(entity minigame)
        }
 }
 
-bool minigame_CheckSend()
-{SELFPARAM();
+bool minigame_CheckSend(entity this)
+{
        entity e;
        for ( e = self.owner.minigame_players; e != world; e = e.list_next )
                if ( e.minigame_players == other )
@@ -141,7 +141,7 @@ int minigame_addplayer(entity minigame_session, entity player)
                minigame_session.minigame_players = player_pointer;
                player.active_minigame = minigame_session;
                player.minigame_players = player_pointer;
-               player_pointer.customizeentityforclient = minigame_CheckSend;
+               setcefc(player_pointer, minigame_CheckSend);
                Net_LinkEntity(player_pointer, false, 0, minigame_SendEntity);
 
                if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
index 1e00fd1b3be536a4360454b967532724857db03d..60785c560d39ff4018ad0dd735619c1c8bd2c9dd 100644 (file)
@@ -24,7 +24,7 @@ void end_minigames();
 
 // Only sends entities to players who joined the minigame
 // Use on customizeentityforclient for gameplay entities
-bool minigame_CheckSend();
+bool minigame_CheckSend(entity this);
 
 // Check for minigame impulses
 bool MinigameImpulse(entity this, int imp);
index c450dc5703d8ba2520a64518701b442c9737bb6a..731b10ce97277d50b9903bda294076205fdb350c 100644 (file)
@@ -92,8 +92,8 @@ REGISTER_MUTATOR(buffs, cvar("g_buffs"))
        }
 }
 
-bool buffs_BuffModel_Customize()
-{SELFPARAM();
+bool buffs_BuffModel_Customize(entity this)
+{
        entity player, myowner;
        bool same_team;
 
@@ -132,7 +132,7 @@ void buffs_BuffModel_Spawn(entity player)
        player.buff_model.scale = 0.7;
        player.buff_model.pflags = PFLAGS_FULLDYNAMIC;
        player.buff_model.light_lev = 200;
-       player.buff_model.customizeentityforclient = buffs_BuffModel_Customize;
+       setcefc(player.buff_model, buffs_BuffModel_Customize);
 }
 
 vector buff_GlowColor(entity buff)
@@ -389,8 +389,8 @@ void buff_Reset(entity this)
                buff_Respawn(this);
 }
 
-float buff_Customize()
-{SELFPARAM();
+float buff_Customize(entity this)
+{
        entity player = WaypointSprite_getviewentity(other);
        if(!this.buff_active || (this.team && DIFF_TEAM(player, this)))
        {
@@ -432,7 +432,7 @@ void buff_Init(entity this)
        this.skin = buff.m_skin;
        this.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW;
        this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
-       this.customizeentityforclient = buff_Customize;
+       setcefc(this, buff_Customize);
        //this.gravity = 100;
        this.color = buff.m_color;
        this.glowmod = buff_GlowColor(this);
index 4e339cea0ed3397acbe476a9f55742a84a0313f0..6fca6178f53c801ffd848958e50b82d40b2e2c04 100644 (file)
@@ -865,7 +865,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        _nade.max_health = _nade.health;
        _nade.takedamage = DAMAGE_AIM;
        _nade.event_damage = nade_damage;
-       _nade.customizeentityforclient = func_null;
+       setcefc(_nade, func_null);
        _nade.exteriormodeltoclient = world;
        _nade.traileffectnum = 0;
        _nade.teleportable = true;
@@ -930,8 +930,8 @@ MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
        nades_RemoveBonus(self);
 }
 
-float nade_customize()
-{SELFPARAM();
+float nade_customize(entity this)
+{
        //if(IS_SPEC(other)) { return false; }
        if(other == self.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == self.exteriormodeltoclient))
        {
@@ -962,7 +962,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        setmodel(n, MDL_PROJECTILE_NADE);
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
-       n.customizeentityforclient = nade_customize;
+       setcefc(n, nade_customize);
        n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
        n.colormod = Nades_from(n.nade_type).m_color;
        n.realowner = nowner;
index 3e82db0b5070220b590070aaf8b8ea823333e5b4..55136ddc5754d2934e88612ba67239bf3e2ab083 100644 (file)
@@ -963,8 +963,8 @@ float WaypointSprite_isteammate(entity e, entity e2)
     return e2 == e;
 }
 
-float WaypointSprite_Customize()
-{SELFPARAM();
+float WaypointSprite_Customize(entity this)
+{
     // this is not in SendEntity because it shall run every frame, not just every update
 
     // make spectators see what the player would see
@@ -1022,7 +1022,7 @@ entity WaypointSprite_Spawn(
     setthink(wp, WaypointSprite_Think);
     wp.nextthink = time;
     wp.model1 = spr.netname;
-    wp.customizeentityforclient = WaypointSprite_Customize;
+    setcefc(wp, WaypointSprite_Customize);
     wp.waypointsprite_visible_for_player = WaypointSprite_visible_for_player;
     wp.reset2 = WaypointSprite_Reset;
     wp.cnt = icon.m_id;
index 385d9fa749653c59048c3dcf7c2f78991a8a5de6..84f028c6e3078386ab8c875785038cf4eb10973a 100644 (file)
@@ -168,7 +168,7 @@ entity WaypointSprite_getviewentity(entity e);
 
 float WaypointSprite_isteammate(entity e, entity e2);
 
-float WaypointSprite_Customize();
+float WaypointSprite_Customize(entity this);
 
 bool WaypointSprite_SendEntity(entity this, entity to, float sendflags);
 
index f0a9cc282dc4d24d28a7abb3d8b9097af3f0a982..75644b3ad77089eaa3a478d925c7b91939b9252f 100644 (file)
@@ -136,9 +136,9 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        .void() uncustomizeentityforclient;
        .float uncustomizeentityforclient_set;
 
-       void SetCustomizer(entity e, float() customizer, void() uncustomizer)
+       void SetCustomizer(entity e, bool(entity this) customizer, void() uncustomizer)
        {
-               e.customizeentityforclient = customizer;
+               setcefc(e, customizer);
                e.uncustomizeentityforclient = uncustomizer;
                e.uncustomizeentityforclient_set = !!uncustomizer;
        }
index 50196a03a97d4f614725faa16113d3fdcbc207ab..c729a0c8b7375626be684bcb8191c4803274d1b8 100644 (file)
@@ -72,6 +72,10 @@ SELFWRAP(touch, void, (entity this), (this))
 SELFWRAP(predraw, void, (entity this), (this))
 #define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
 
+SELFWRAP(customizeentityforclient, bool, (entity this), (this))
+#define setcefc(e, f) SELFWRAP_SET(customizeentityforclient, e, f)
+#define getcefc(e) SELFWRAP_GET(customizeentityforclient, e)
+
 #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 85044c27409c948609d42a47f7aec70d0983816c..42a301eaf8a14a696ee9166b45b4879be2c17d2b 100644 (file)
@@ -95,7 +95,7 @@ void CopyBody(entity this, float keepvelocity)
        clone.solid = this.solid;
        clone.ballistics_density = this.ballistics_density;
        clone.takedamage = this.takedamage;
-       clone.customizeentityforclient = this.customizeentityforclient;
+       setcefc(clone, getcefc(this));
        clone.uncustomizeentityforclient = this.uncustomizeentityforclient;
        clone.uncustomizeentityforclient_set = this.uncustomizeentityforclient_set;
        if (keepvelocity == 1)
index fd6bf729366cbe628798e20eaf3bcc01bc57cb2f..9f70266302307cd8d90145dc745f6bd98cda0bfa 100644 (file)
@@ -179,7 +179,6 @@ bool nJoinAllowed(entity this, entity ignore);
 float default_player_alpha;
 float default_weapon_alpha;
 
-.float() customizeentityforclient;
 .float cvar_cl_handicap;
 .float cvar_cl_clippedspectating;
 .float cvar_cl_autoscreenshot;
index cc4d2c60d69da5900d4b87113aa9f75fbdb459d3..5d4f156165e0c8ba1d646d8422ae3424565ff1bd 100644 (file)
@@ -234,8 +234,8 @@ vector findbetterlocation (vector org, float mindist)
        return org;
 }
 
-float LOD_customize()
-{SELFPARAM();
+float LOD_customize(entity this)
+{
        if(autocvar_loddebug)
        {
                int d = autocvar_loddebug;
index 1b785c2f284b6f59232519cbc2c0d87301a52447..35d90ffeedbc8aca75b148be10fd7b073ccae8c8 100644 (file)
@@ -138,7 +138,7 @@ float angc (float a1, float a2);
 .float loddistance1;
 .float loddistance2;
 
-float LOD_customize();
+float LOD_customize(entity this);
 
 void LOD_uncustomize();
 
index 2d52916b1736141a58c67b814882029f7c95494c..a5256c9ea8a73772353131114c49b0ca7ed114d4 100644 (file)
@@ -366,4 +366,3 @@ entity initialize_entity_first;
 
 float sound_allowed(float dest, entity e);
 void InitializeEntity(entity e, void(entity this) func, float order);
-void SetCustomizer(entity e, float() customizer, void() uncustomizer);
index bb949a49de9869fe87609336f36825dd23cf1f5b..cbd527289014cfb629e65cf6b12a9fdc29305a17 100644 (file)
@@ -278,8 +278,8 @@ void ctf_CaptureShield_Update(entity player, bool wanted_status)
        }
 }
 
-bool ctf_CaptureShield_Customize()
-{SELFPARAM();
+bool ctf_CaptureShield_Customize(entity this)
+{
        if(!other.ctf_captureshielded) { return false; }
        if(CTF_SAMETEAM(self, other)) { return false; }
 
@@ -305,7 +305,7 @@ void ctf_CaptureShield_Spawn(entity flag)
        shield.enemy = self;
        shield.team = self.team;
        settouch(shield, ctf_CaptureShield_Touch);
-       shield.customizeentityforclient = ctf_CaptureShield_Customize;
+       setcefc(shield, ctf_CaptureShield_Customize);
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
        shield.solid = SOLID_TRIGGER;
@@ -747,8 +747,8 @@ void ctf_CheckFlagReturn(entity flag, int returntype)
        }
 }
 
-bool ctf_Stalemate_Customize()
-{SELFPARAM();
+bool ctf_Stalemate_Customize(entity this)
+{
        // make spectators see what the player would see
        entity e, wp_owner;
        e = WaypointSprite_getviewentity(other);
@@ -814,7 +814,7 @@ void ctf_CheckStalemate()
                        {
                                entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG);
                                wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team);
-                               tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize;
+                               setcefc(tmp_entity.owner.wps_enemyflagcarrier, ctf_Stalemate_Customize);
                        }
                }
 
index f0728b720084d011d909ce684835f2fb1c5aacd8..9c4b08647d6e15129f434e4d8c02a49ff216f918 100644 (file)
@@ -494,8 +494,8 @@ void Portal_Think(entity this)
                Portal_Remove(this, 0);
 }
 
-float Portal_Customize()
-{SELFPARAM();
+float Portal_Customize(entity this)
+{
        if(IS_SPEC(other))
                other = other.enemy;
        if(other == this.aiment)
@@ -638,7 +638,7 @@ 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))
        {
index d5a89b3a1e5b84088276fe94d2e5c9153660a766..d6b1550480acbef6b2e4cfefd4bf51bb141d9838 100644 (file)
@@ -40,9 +40,8 @@ float W_WeaponSpeedFactor()
 }
 
 
-bool CL_Weaponentity_CustomizeEntityForClient()
+bool CL_Weaponentity_CustomizeEntityForClient(entity this)
 {
-       SELFPARAM();
        this.viewmodelforclient = this.owner;
        if (IS_SPEC(other) && other.enemy == this.owner) this.viewmodelforclient = other;
        return true;
@@ -169,7 +168,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
        setthink(view, CL_Weaponentity_Think);
        view.nextthink = time;
        view.viewmodelforclient = actor;
-       view.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
+       setcefc(view, CL_Weaponentity_CustomizeEntityForClient);
 
        if (weaponentity == weaponentities[0])
        {