]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanse PlayerRegen
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 18:33:41 +0000 (04:33 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 18:33:41 +0000 (04:33 +1000)
qcsrc/common/animdecide.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/server/cl_client.qc
qcsrc/server/mutators/events.qh

index 24599e3588165e1199d2c0681b4ddbb2a6c52520..ab389278d16fcd696d850af106c59947b4108da6 100644 (file)
@@ -10,7 +10,7 @@
 bool monsters_animoverride(entity this)
 {
        Monster monster_id = NULL;
-       FOREACH(Monsters, it != MON_Null && it.m_model == this.model, {
+       FOREACH(Monsters, it != MON_Null && it.m_model.model_str() == this.model, {
         monster_id = it;
         break;
        });
index b89871c8423bf27ad64caaa62953ea08340e7db4..cd72bb46b6a7a541eacdde03af3ef874b36e2c6f 100644 (file)
@@ -1036,16 +1036,18 @@ MUTATOR_HOOKFUNCTION(buffs, VehicleExit)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
-{SELFPARAM();
-       if(this.buffs & BUFF_MEDIC.m_itemid)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.buffs & BUFF_MEDIC.m_itemid)
        {
-               regen_mod_rot = autocvar_g_buffs_medic_rot;
-               regen_mod_limit = regen_mod_max = autocvar_g_buffs_medic_max;
-               regen_mod_regen = autocvar_g_buffs_medic_regen;
+               M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod
+               M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod
+               M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod
        }
 
-       if(this.buffs & BUFF_SPEED.m_itemid)
-               regen_mod_regen = autocvar_g_buffs_speed_regen;
+       if(player.buffs & BUFF_SPEED.m_itemid)
+               M_ARGV(2, float) = autocvar_g_buffs_speed_regen; // regen_mod
 }
 
 REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace");
index a25dbe3e7829fa5f59e41c50643a8322bbf48b29..323286bbe947f43dc450e3ed366b3082e253d50e 100644 (file)
@@ -165,12 +165,16 @@ MUTATOR_HOOKFUNCTION(ok, MonsterDropItem)
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerRegen)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        // overkill's values are different, so use custom regen
-       if(!STAT(FROZEN, this))
+       if(!STAT(FROZEN, player))
        {
-               this.armorvalue = CalcRotRegen(this.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > this.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > this.pauserotarmor_finished), autocvar_g_balance_armor_limit);
-               this.health = CalcRotRegen(this.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > this.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > this.pauserothealth_finished), autocvar_g_balance_health_limit);
+               player.armorvalue = CalcRotRegen(player.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear,
+                       1 * frametime * (time > player.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > player.pauserotarmor_finished), autocvar_g_balance_armor_limit);
+               player.health = CalcRotRegen(player.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > player.ok_pauseregen_finished), 200, 0,
+                       autocvar_g_balance_health_rotlinear, 1 * frametime * (time > player.pauserothealth_finished), autocvar_g_balance_health_limit);
 
                float minf, maxf, limitf;
 
@@ -178,7 +182,8 @@ MUTATOR_HOOKFUNCTION(ok, PlayerRegen)
                minf = autocvar_g_balance_fuel_regenstable;
                limitf = autocvar_g_balance_fuel_limit;
 
-               this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
+               player.ammo_fuel = CalcRotRegen(player.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear,
+                       frametime * (time > player.pauseregen_finished) * ((player.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > player.pauserotfuel_finished), limitf);
        }
        return true; // return true anyway, as frozen uses no regen
 }
index 457822e8e406107d15721fe15eca3f223794470f..93a63e5ac6c63bd56c58924256186b964bea73e4 100644 (file)
@@ -1483,18 +1483,28 @@ void player_regen(entity this)
 {
        float max_mod, regen_mod, rot_mod, limit_mod;
        max_mod = regen_mod = rot_mod = limit_mod = 1;
-       regen_mod_max = max_mod;
-       regen_mod_regen = regen_mod;
-       regen_mod_rot = rot_mod;
-       regen_mod_limit = limit_mod;
-
-       regen_health = autocvar_g_balance_health_regen;
-       regen_health_linear = autocvar_g_balance_health_regenlinear;
-       regen_health_rot = autocvar_g_balance_health_rot;
-       regen_health_rotlinear = autocvar_g_balance_health_rotlinear;
-       regen_health_stable = autocvar_g_balance_health_regenstable;
-       regen_health_rotstable = autocvar_g_balance_health_rotstable;
-       if(!MUTATOR_CALLHOOK(PlayerRegen))
+
+       float regen_health = autocvar_g_balance_health_regen;
+       float regen_health_linear = autocvar_g_balance_health_regenlinear;
+       float regen_health_rot = autocvar_g_balance_health_rot;
+       float regen_health_rotlinear = autocvar_g_balance_health_rotlinear;
+       float regen_health_stable = autocvar_g_balance_health_regenstable;
+       float regen_health_rotstable = autocvar_g_balance_health_rotstable;
+       bool mutator_returnvalue = MUTATOR_CALLHOOK(PlayerRegen, this, max_mod, regen_mod, rot_mod, limit_mod, regen_health, regen_health_linear, regen_health_rot,
+               regen_health_rotlinear, regen_health_stable, regen_health_rotstable);
+       max_mod = M_ARGV(1, float);
+       regen_mod = M_ARGV(2, float);
+       rot_mod = M_ARGV(3, float);
+       limit_mod = M_ARGV(4, float);
+       regen_health = M_ARGV(5, float);
+       regen_health_linear = M_ARGV(6, float);
+       regen_health_rot = M_ARGV(7, float);
+       regen_health_rotlinear = M_ARGV(8, float);
+       regen_health_stable = M_ARGV(9, float);
+       regen_health_rotstable = M_ARGV(10, float);
+
+
+       if(!mutator_returnvalue)
        if(!STAT(FROZEN, this))
        {
                float mina, maxa, limith, limita;
@@ -1503,11 +1513,6 @@ void player_regen(entity this)
                limith = autocvar_g_balance_health_limit;
                limita = autocvar_g_balance_armor_limit;
 
-               max_mod = regen_mod_max;
-               regen_mod = regen_mod_regen;
-               rot_mod = regen_mod_rot;
-               limit_mod = regen_mod_limit;
-
                regen_health_rotstable = regen_health_rotstable * max_mod;
                regen_health_stable = regen_health_stable * max_mod;
                limith = limith * limit_mod;
index 4c25477c374936ee19d1fdfb7d20e8b7d7f61c2f..a18b6b80d2edc1241cc9386a92273a5618770086 100644 (file)
@@ -361,17 +361,30 @@ MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
  * called every player think frame
  * return 1 to disable regen
  */
-float regen_mod_max;
-float regen_mod_regen;
-float regen_mod_rot;
-float regen_mod_limit;
-float regen_health;
-float regen_health_linear;
-float regen_health_rot;
-float regen_health_rotlinear;
-float regen_health_stable;
-float regen_health_rotstable;
-MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
+ #define EV_PlayerRegen(i, o) \
+    /** player */               i(entity, MUTATOR_ARGV_0_entity) \
+    /** max_mod */              i(float, MUTATOR_ARGV_1_float) \
+    /**/                        o(float, MUTATOR_ARGV_1_float) \
+    /** regen_mod */            i(float, MUTATOR_ARGV_2_float) \
+    /**/                        o(float, MUTATOR_ARGV_2_float) \
+    /** rot_mod */              i(float, MUTATOR_ARGV_3_float) \
+    /**/                        o(float, MUTATOR_ARGV_3_float) \
+    /** limit_mod */            i(float, MUTATOR_ARGV_4_float) \
+    /**/                        o(float, MUTATOR_ARGV_4_float) \
+    /** health_regen */         i(float, MUTATOR_ARGV_5_float) \
+    /**/                        o(float, MUTATOR_ARGV_5_float) \
+    /** health_regenlinear */   i(float, MUTATOR_ARGV_6_float) \
+    /**/                        o(float, MUTATOR_ARGV_6_float) \
+    /** health_rot */           i(float, MUTATOR_ARGV_7_float) \
+    /**/                        o(float, MUTATOR_ARGV_7_float) \
+    /** health_rotlinear */     i(float, MUTATOR_ARGV_8_float) \
+    /**/                        o(float, MUTATOR_ARGV_8_float) \
+    /** health_stable */        i(float, MUTATOR_ARGV_9_float) \
+    /**/                        o(float, MUTATOR_ARGV_9_float) \
+    /** health_rotstable */     i(float, MUTATOR_ARGV_10_float) \
+    /**/                        o(float, MUTATOR_ARGV_10_float) \
+    /**/
+MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
 
 /**
  * called when the use key is pressed