]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Code cleanup
authorterencehill <piuntn@gmail.com>
Fri, 10 Jan 2025 22:46:59 +0000 (23:46 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 10 Jan 2025 22:46:59 +0000 (23:46 +0100)
* rename Superweapons class to Superweapon because class names should always be singular
* rename StatusEffects class to StatusEffect because class names should always be singular
* rename StatusEffect registry to StatusEffects because registry names should always be plural
* rename Powerup class child of StatusEffect to PowerupStatusEffect so to remove ambiguity
 with Powerup child of Pickup

34 files changed:
qcsrc/client/view.qc
qcsrc/common/monsters/monster/spider.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/buffs.qh
qcsrc/common/mutators/mutator/buffs/cl_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/overkill/okhmg.qc
qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc
qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh
qcsrc/common/mutators/mutator/powerups/powerup/shield.qc
qcsrc/common/mutators/mutator/powerups/powerup/shield.qh
qcsrc/common/mutators/mutator/powerups/powerup/speed.qc
qcsrc/common/mutators/mutator/powerups/powerup/speed.qh
qcsrc/common/mutators/mutator/powerups/powerup/strength.qc
qcsrc/common/mutators/mutator/powerups/powerup/strength.qh
qcsrc/common/mutators/mutator/powerups/powerups.qh
qcsrc/common/mutators/mutator/powerups/sv_powerups.qc
qcsrc/common/mutators/mutator/status_effects/all.qh
qcsrc/common/mutators/mutator/status_effects/cl_status_effects.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/burning.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/burning.qh
qcsrc/common/mutators/mutator/status_effects/status_effect/spawnshield.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/spawnshield.qh
qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qh
qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh
qcsrc/common/mutators/mutator/status_effects/status_effects.qc
qcsrc/common/mutators/mutator/status_effects/status_effects.qh
qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc
qcsrc/server/client.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/items/items.qc
qcsrc/server/weapons/throwing.qc

index 84bf0d4f11fbc29c7c3fe64df35ce6d0736a94de..583f167dc7569f8fbb62cd628d478f1f3ae395d9 100644 (file)
@@ -1306,7 +1306,7 @@ void View_PostProcessing()
 
                // edge detection postprocess handling done second (used by hud_powerup)
                float sharpen_intensity = 0;
-               FOREACH(StatusEffect, it.instanceOfPowerups,
+               FOREACH(StatusEffects, it.instanceOfPowerupStatusEffect,
                {
                        float powerup_finished = StatusEffects_gettime(it, g_statuseffects) - time;
                        if(powerup_finished > 0)
index e0fd001f9a994323b715fc0101f66cd8be0c60ec..7e2c34041db19cac8d473b5fb3d83870250c0fde 100644 (file)
@@ -31,7 +31,7 @@ REGISTER_WEAPON(SPIDER_ATTACK, NEW(SpiderAttack));
 
 #include <common/mutators/mutator/status_effects/all.qh>
 
-CLASS(Webbed, StatusEffects)
+CLASS(Webbed, StatusEffect)
     ATTRIB(Webbed, netname, string, "webbed");
 #if 0
     // NOTE: status effect name and icon disabled as they are not displayed
index ce51e4fa4a368167eedae552d5d8a7d960ef67df..baf813e8ee277c16f99c7ed98044123c8aaabc53 100644 (file)
@@ -2,7 +2,7 @@
 
 string BUFF_NAME(int i)
 {
-    Buff b = REGISTRY_GET(StatusEffect, i);
+    Buff b = REGISTRY_GET(StatusEffects, i);
     return strcat(rgb_to_hexcolor(b.m_color), b.m_name);
 }
 
index 4963e90ef4f8cb3cfb2e0f4c0b6763f865444be0..6c214b3dffd09a853c7cdfdb74ca88d397847254 100644 (file)
@@ -8,10 +8,10 @@
 #include <common/mutators/mutator/waypoints/all.qh>
 #endif
 
-#define REGISTER_BUFF(id, inst) REGISTER(StatusEffect, BUFF_##id, m_id, inst)
+#define REGISTER_BUFF(id, inst) REGISTER(StatusEffects, BUFF_##id, m_id, inst)
 
 #include <common/mutators/mutator/status_effects/_mod.qh>
-CLASS(Buff, StatusEffects)
+CLASS(Buff, StatusEffect)
 #ifdef GAMEQC
        ATTRIB(Buff, m_itemid, int, IT_BUFF);
 #endif
@@ -32,7 +32,7 @@ CLASS(Buff, StatusEffects)
 ENDCLASS(Buff)
 
 STATIC_INIT(REGISTER_BUFFS) {
-       FOREACH(StatusEffect, it.instanceOfBuff, {
+       FOREACH(StatusEffects, it.instanceOfBuff, {
                it.m_sprite = strzone(strcat("buff-", it.netname));
        });
 }
index c6e7377c61e4db0446e145d06995b6e4a7162d73..d5e6adc235dbffb3b5c34be18411e0dc2cdede0b 100644 (file)
@@ -7,7 +7,7 @@ MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
     string s = M_ARGV(1, string);
     if (s == WP_Buff.netname || s == RADARICON_Buff.netname)
     {
-        Buff b = REGISTRY_GET(StatusEffect, this.wp_extra);
+        Buff b = REGISTRY_GET(StatusEffects, this.wp_extra);
         M_ARGV(2, vector) = b.m_color;
         M_ARGV(3, string) = b.m_name;
         M_ARGV(4, string) = b.m_icon;
index 1ea676dd9424ada8aca007b7b6a0f4052dcc60e9..39010127af79be99aec2226fce80b7b4f031dde9 100644 (file)
@@ -268,7 +268,7 @@ float buff_Available(entity buff)
 void buff_NewType(entity ent)
 {
        RandomSelection_Init();
-       FOREACH(StatusEffect, it.instanceOfBuff && buff_Available(it),
+       FOREACH(StatusEffects, it.instanceOfBuff && buff_Available(it),
        {
                // if it's already been chosen, give it a lower priority
                float myseencount = (it.buff_seencount > 0) ? it.buff_seencount : 1; // no division by zero please!
@@ -285,7 +285,7 @@ void buff_RemoveAll(entity actor, int removal_type)
 {
        if(!actor.statuseffects)
                return;
-       FOREACH(StatusEffect, it.instanceOfBuff,
+       FOREACH(StatusEffects, it.instanceOfBuff,
        {
                it.m_remove(it, actor, removal_type);
        });
@@ -295,7 +295,7 @@ entity buff_FirstFromFlags(entity actor)
 {
        if(!actor.statuseffects)
                return NULL;
-       FOREACH(StatusEffect, it.instanceOfBuff && it.m_active(it, actor), { return it; });
+       FOREACH(StatusEffects, it.instanceOfBuff && it.m_active(it, actor), { return it; });
        return NULL;
 }
 
@@ -519,13 +519,13 @@ float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, flo
        return offset_y + (intersect_y - offset_y) * logn(((damg - offset_x) * ((base - 1) / intersect_x)) + 1, base);
 }
 
-METHOD(Buff, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(Buff, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     if(IS_PLAYER(actor))
        actor.effects |= EF_NOSHADOW; // does not play well with buff icon
     SUPER(Buff).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(Buff, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(Buff, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
        bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
        if(wasactive)
@@ -545,7 +545,7 @@ METHOD(Buff, m_remove, void(StatusEffects this, entity actor, int removal_type))
        SUPER(Buff).m_remove(this, actor, removal_type);
 }
 
-METHOD(AmmoBuff, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(AmmoBuff, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive)
@@ -565,7 +565,7 @@ METHOD(AmmoBuff, m_apply, void(StatusEffects this, entity actor, float eff_time,
     }
     SUPER(AmmoBuff).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(AmmoBuff, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(AmmoBuff, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
        bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
        if(wasactive)
@@ -586,7 +586,7 @@ METHOD(AmmoBuff, m_remove, void(StatusEffects this, entity actor, int removal_ty
        actor.buff_ammo_prev_infitems = 0;
        SUPER(AmmoBuff).m_remove(this, actor, removal_type);
 }
-METHOD(AmmoBuff, m_tick, void(StatusEffects this, entity actor))
+METHOD(AmmoBuff, m_tick, void(StatusEffect this, entity actor))
 {
        if(IS_PLAYER(actor))
        {
@@ -602,7 +602,7 @@ METHOD(AmmoBuff, m_tick, void(StatusEffects this, entity actor))
 }
 
 
-METHOD(FlightBuff, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(FlightBuff, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive)
@@ -613,7 +613,7 @@ METHOD(FlightBuff, m_apply, void(StatusEffects this, entity actor, float eff_tim
     }
     SUPER(FlightBuff).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(FlightBuff, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(FlightBuff, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
        bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
        if(wasactive)
@@ -624,7 +624,7 @@ METHOD(FlightBuff, m_remove, void(StatusEffects this, entity actor, int removal_
        SUPER(FlightBuff).m_remove(this, actor, removal_type);
 }
 
-METHOD(MagnetBuff, m_tick, void(StatusEffects this, entity actor))
+METHOD(MagnetBuff, m_tick, void(StatusEffect this, entity actor))
 {
        if(IS_PLAYER(actor))
        {
index 6f4693f2afb1f08dc5bc77ba46ca72ac28779874..199c86e576902cc3f0a9b46829aaed2637e6a011 100644 (file)
@@ -18,7 +18,7 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity
                return;
        }
 
-       if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_AMMO)) || (!StatusEffects_active(STATUSEFFECT_Superweapons, actor) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
+       if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_AMMO)) || (!StatusEffects_active(STATUSEFFECT_Superweapon, actor) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
                w_ready(thiswep, actor, weaponentity, fire);
index ebc83e870a051d844df9a3c0d323ced08aef9cd5..f16e8457a79891d4505af019577cc246eddbcf89 100644 (file)
@@ -1,7 +1,7 @@
 #include "invisibility.qh"
 
 #ifdef SVQC
-METHOD(InvisibilityStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(InvisibilityStatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
@@ -19,7 +19,7 @@ METHOD(InvisibilityStatusEffect, m_remove, void(StatusEffects this, entity actor
     }
     SUPER(InvisibilityStatusEffect).m_remove(this, actor, removal_type);
 }
-METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive && IS_PLAYER(actor))
@@ -30,7 +30,7 @@ METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffects this, entity actor,
     }
     SUPER(InvisibilityStatusEffect).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(InvisibilityStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(InvisibilityStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
     if(!actor.vehicle)
index ef814f39c2bb072c37fe31d854ab2494b2dfb577..ce6e678c4a4bb3f13c8309d885dd0627b1aa434c 100644 (file)
@@ -55,10 +55,10 @@ REGISTER_ITEM(Invisibility, NEW(InvisibilityItem));
 SPAWNFUNC_ITEM(item_invisibility, ITEM_Invisibility)
 SPAWNFUNC_ITEM(item_buff_invisibility, ITEM_Invisibility)
 
-CLASS(InvisibilityStatusEffect, Powerups)
-    ATTRIB(InvisibilityStatusEffect, netname, string, "invisibility");
-    ATTRIB(InvisibilityStatusEffect, m_name, string, _("Invisibility"));
-    ATTRIB(InvisibilityStatusEffect, m_color, vector, '0.5 0.5 1');
-    ATTRIB(InvisibilityStatusEffect, m_icon, string, "buff_invisible");
+CLASS(InvisibilityStatusEffect, PowerupStatusEffect)
+       ATTRIB(InvisibilityStatusEffect, netname, string, "invisibility");
+       ATTRIB(InvisibilityStatusEffect, m_name, string, _("Invisibility"));
+       ATTRIB(InvisibilityStatusEffect, m_color, vector, '0.5 0.5 1');
+       ATTRIB(InvisibilityStatusEffect, m_icon, string, "buff_invisible");
 ENDCLASS(InvisibilityStatusEffect)
 REGISTER_STATUSEFFECT(Invisibility, NEW(InvisibilityStatusEffect));
index 999b683ef586be18fdb6da3d3302c352f03d060e..5130e695590be9a79248d50fc821b42682f4f195 100644 (file)
@@ -1,7 +1,7 @@
 #include "shield.qh"
 
 #ifdef SVQC
-METHOD(ShieldStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(ShieldStatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
@@ -14,7 +14,7 @@ METHOD(ShieldStatusEffect, m_remove, void(StatusEffects this, entity actor, int
     actor.effects &= ~(EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
     SUPER(ShieldStatusEffect).m_remove(this, actor, removal_type);
 }
-METHOD(ShieldStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(ShieldStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive && IS_PLAYER(actor))
@@ -25,7 +25,7 @@ METHOD(ShieldStatusEffect, m_apply, void(StatusEffects this, entity actor, float
     }
     SUPER(ShieldStatusEffect).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(ShieldStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
     actor.effects |= (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
@@ -33,13 +33,13 @@ METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor))
 }
 #endif
 #ifdef CSQC
-METHOD(ShieldStatusEffect, m_active, bool(StatusEffects this, entity actor))
+METHOD(ShieldStatusEffect, m_active, bool(StatusEffect this, entity actor))
 {
     if(autocvar__hud_configure)
         return true;
     return SUPER(ShieldStatusEffect).m_active(this, actor);
 }
-METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(ShieldStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     if(this.m_hidden)
         return;
index 280b4a33f86fd54ca7518da477a0010b40adfdbe..5f05a293cafeebfa4f7e961bf58346ba169d79c4 100644 (file)
@@ -53,9 +53,9 @@ REGISTER_ITEM(Shield, NEW(ShieldItem));
 SPAWNFUNC_ITEM(item_shield, ITEM_Shield)
 SPAWNFUNC_ITEM(item_invincible, ITEM_Shield)
 
-CLASS(ShieldStatusEffect, Powerups)
-    ATTRIB(ShieldStatusEffect, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item
-    ATTRIB(ShieldStatusEffect, m_name, string, _("Shield"));
-    ATTRIB(ShieldStatusEffect, m_icon, string, "shield");
+CLASS(ShieldStatusEffect, PowerupStatusEffect)
+       ATTRIB(ShieldStatusEffect, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item
+       ATTRIB(ShieldStatusEffect, m_name, string, _("Shield"));
+       ATTRIB(ShieldStatusEffect, m_icon, string, "shield");
 ENDCLASS(ShieldStatusEffect)
 REGISTER_STATUSEFFECT(Shield, NEW(ShieldStatusEffect));
index db481fe2a7f59807766d2f8729190b89808163e7..887a1459196c914df8fbb7066e241b592d40efa7 100644 (file)
@@ -1,7 +1,7 @@
 #include "speed.qh"
 
 #ifdef SVQC
-METHOD(SpeedStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(SpeedStatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
@@ -13,7 +13,7 @@ METHOD(SpeedStatusEffect, m_remove, void(StatusEffects this, entity actor, int r
         stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound
     SUPER(SpeedStatusEffect).m_remove(this, actor, removal_type);
 }
-METHOD(SpeedStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(SpeedStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive && IS_PLAYER(actor))
@@ -24,7 +24,7 @@ METHOD(SpeedStatusEffect, m_apply, void(StatusEffects this, entity actor, float
     }
     SUPER(SpeedStatusEffect).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(SpeedStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(SpeedStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
     SUPER(SpeedStatusEffect).m_tick(this, actor);
index 0682f16d61a99ad5a37659f793ab11208fcc08a2..5d55126048f0129a928f93fb656eb8bd75e6acce 100644 (file)
@@ -56,10 +56,10 @@ REGISTER_ITEM(Speed, NEW(SpeedItem));
 SPAWNFUNC_ITEM(item_speed, ITEM_Speed)
 SPAWNFUNC_ITEM(item_buff_speed, ITEM_Speed)
 
-CLASS(SpeedStatusEffect, Powerups)
-    ATTRIB(SpeedStatusEffect, netname, string, "speed");
-    ATTRIB(SpeedStatusEffect, m_name, string, _("Speed"));
-    ATTRIB(SpeedStatusEffect, m_color, vector, '0.1 1 0.84');
-    ATTRIB(SpeedStatusEffect, m_icon, string, "buff_speed");
+CLASS(SpeedStatusEffect, PowerupStatusEffect)
+       ATTRIB(SpeedStatusEffect, netname, string, "speed");
+       ATTRIB(SpeedStatusEffect, m_name, string, _("Speed"));
+       ATTRIB(SpeedStatusEffect, m_color, vector, '0.1 1 0.84');
+       ATTRIB(SpeedStatusEffect, m_icon, string, "buff_speed");
 ENDCLASS(SpeedStatusEffect)
 REGISTER_STATUSEFFECT(Speed, NEW(SpeedStatusEffect));
index 2c5c7d20ada36722683b7061215743086080c1e4..c520363fe6d12eaa525fef6c32d9f6cabfac28bb 100644 (file)
@@ -1,7 +1,7 @@
 #include "strength.qh"
 
 #ifdef SVQC
-METHOD(StrengthStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(StrengthStatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
@@ -14,7 +14,7 @@ METHOD(StrengthStatusEffect, m_remove, void(StatusEffects this, entity actor, in
     actor.effects &= ~(EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
     SUPER(StrengthStatusEffect).m_remove(this, actor, removal_type);
 }
-METHOD(StrengthStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(StrengthStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
     bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
     if(!wasactive && IS_PLAYER(actor))
@@ -25,7 +25,7 @@ METHOD(StrengthStatusEffect, m_apply, void(StatusEffects this, entity actor, flo
     }
     SUPER(StrengthStatusEffect).m_apply(this, actor, eff_time, eff_flags);
 }
-METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(StrengthStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
     actor.effects |= (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
@@ -33,13 +33,13 @@ METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor))
 }
 #endif
 #ifdef CSQC
-METHOD(StrengthStatusEffect, m_active, bool(StatusEffects this, entity actor))
+METHOD(StrengthStatusEffect, m_active, bool(StatusEffect this, entity actor))
 {
     if(autocvar__hud_configure)
         return true;
     return SUPER(StrengthStatusEffect).m_active(this, actor);
 }
-METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor))
+METHOD(StrengthStatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
     if(this.m_hidden)
         return;
index 74fbaf7a64fa7bf578818358e829fd5709a7ad45..bfe7cd11f185f2c7b2c6071d925c544c23d17ef2 100644 (file)
@@ -54,9 +54,9 @@ REGISTER_ITEM(Strength, NEW(StrengthItem));
 
 SPAWNFUNC_ITEM(item_strength, ITEM_Strength)
 
-CLASS(StrengthStatusEffect, Powerups)
-    ATTRIB(StrengthStatusEffect, netname, string, "strength");
-    ATTRIB(StrengthStatusEffect, m_name, string, _("Strength"));
-    ATTRIB(StrengthStatusEffect, m_icon, string, "strength");
+CLASS(StrengthStatusEffect, PowerupStatusEffect)
+       ATTRIB(StrengthStatusEffect, netname, string, "strength");
+       ATTRIB(StrengthStatusEffect, m_name, string, _("Strength"));
+       ATTRIB(StrengthStatusEffect, m_icon, string, "strength");
 ENDCLASS(StrengthStatusEffect)
 REGISTER_STATUSEFFECT(Strength, NEW(StrengthStatusEffect));
index ecd754672d3bbed1e9fbe544a71b4065e8b2bd2c..07bc1c37ebca5e76da9eb13b390cb034d0d2365f 100644 (file)
@@ -12,8 +12,8 @@ CLASS(Powerup, Pickup)
 ENDCLASS(Powerup)
 
 #include <common/mutators/mutator/status_effects/all.qh>
-CLASS(Powerups, StatusEffects)
+CLASS(PowerupStatusEffect, StatusEffect)
 #ifdef GAMEQC
-    ATTRIB(Powerups, m_sound_rm, Sound, SND_POWEROFF);
+    ATTRIB(PowerupStatusEffect, m_sound_rm, Sound, SND_POWEROFF);
 #endif
-ENDCLASS(Powerups)
+ENDCLASS(PowerupStatusEffect)
index f2902799fb6e738c4352d8e9504b0574ce355261..9f6ace3059924bf0fb1c6cd59670613008344d2b 100644 (file)
@@ -90,7 +90,7 @@ void powerups_DropItem_Think(entity this)
        }
 }
 
-void powerups_DropItem(entity this, StatusEffects effect, bool freezeTimer)
+void powerups_DropItem(entity this, StatusEffect effect, bool freezeTimer)
 {
        float t = StatusEffects_gettime(effect, this);
        float timeleft = t - time;
@@ -153,7 +153,7 @@ MUTATOR_HOOKFUNCTION(powerups, PlayerDies)
 
        entity frag_target = M_ARGV(2, entity);
 
-       FOREACH(StatusEffect, it.instanceOfPowerups,
+       FOREACH(StatusEffects, it.instanceOfPowerupStatusEffect,
        {
                if(StatusEffects_active(it, frag_target))
                        powerups_DropItem(frag_target, it, autocvar_g_powerups_drop_ondeath == 2);
@@ -166,7 +166,7 @@ MUTATOR_HOOKFUNCTION(powerups, PlayerUseKey)
 
        entity player = M_ARGV(0, entity);
 
-       FOREACH(StatusEffect, it.instanceOfPowerups,
+       FOREACH(StatusEffects, it.instanceOfPowerupStatusEffect,
        {
                if(StatusEffects_active(it, player)) {
                        powerups_DropItem(player, it, autocvar_g_powerups_drop == 2);
index 6fc47573841f3bdb723c375b866d372613b7f64b..05ab15776282f282f482173eeb00340ddff1ec11 100644 (file)
@@ -1,18 +1,18 @@
 #pragma once
 
 #ifdef GAMEQC
-    #include <common/sounds/all.qh>
+       #include <common/sounds/all.qh>
 #endif
 
-REGISTRY(StatusEffect, 32)
-REGISTER_REGISTRY(StatusEffect)
-#define REGISTER_STATUSEFFECT(id, inst) REGISTER(StatusEffect, STATUSEFFECT, id, m_id, inst)
+REGISTRY(StatusEffects, 32)
+REGISTER_REGISTRY(StatusEffects)
+#define REGISTER_STATUSEFFECT(id, inst) REGISTER(StatusEffects, STATUSEFFECT, id, m_id, inst)
 
-REGISTRY_SORT(StatusEffect)
-REGISTRY_CHECK(StatusEffect)
+REGISTRY_SORT(StatusEffects)
+REGISTRY_CHECK(StatusEffects)
 
-REGISTRY_DEFINE_GET(StatusEffect, NULL)
-STATIC_INIT(StatusEffect) { FOREACH(StatusEffect, true, it.m_id = i); }
+REGISTRY_DEFINE_GET(StatusEffects, NULL)
+STATIC_INIT(StatusEffects) { FOREACH(StatusEffects, true, it.m_id = i); }
 
 enum
 {
@@ -27,33 +27,33 @@ enum
     STATUSEFFECT_REMOVE_CLEAR          ///< Effect is being forcibly removed without calling any additional mechanics.
 };
 
-CLASS(StatusEffects, Object)
-    ATTRIB(StatusEffects, m_id, int, 0);
-    ATTRIB(StatusEffects, m_name, string);
-    ATTRIB(StatusEffects, m_icon, string);
-    ATTRIB(StatusEffects, m_color, vector, '1 1 1');
-    /** Whether the effect is displayed in the HUD */
-    ATTRIB(StatusEffects, m_hidden, bool, false);
-    /** Lifetime scale for HUD progress bars */
-    ATTRIB(StatusEffects, m_lifetime, float, 30);
+CLASS(StatusEffect, Object)
+       ATTRIB(StatusEffect, m_id, int, 0);
+       ATTRIB(StatusEffect, m_name, string);
+       ATTRIB(StatusEffect, m_icon, string);
+       ATTRIB(StatusEffect, m_color, vector, '1 1 1');
+       /** Whether the effect is displayed in the HUD */
+       ATTRIB(StatusEffect, m_hidden, bool, false);
+       /** Lifetime scale for HUD progress bars */
+       ATTRIB(StatusEffect, m_lifetime, float, 30);
 #ifdef GAMEQC
-    ATTRIB(StatusEffects, m_sound, Sound, SND_Null);
-    ATTRIB(StatusEffects, m_sound_rm, Sound, SND_Null);
-    METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor));
-    METHOD(StatusEffects, m_active, bool(StatusEffects this, entity actor));
-    /** Stores times of status effects, the id being the index */
-    ATTRIBARRAY(StatusEffects, statuseffect_time, float, REGISTRY_MAX(StatusEffect));
-    ATTRIBARRAY(StatusEffects, statuseffect_flags, int, REGISTRY_MAX(StatusEffect));
+       ATTRIB(StatusEffect, m_sound, Sound, SND_Null);
+       ATTRIB(StatusEffect, m_sound_rm, Sound, SND_Null);
+       METHOD(StatusEffect, m_tick, void(StatusEffect this, entity actor));
+       METHOD(StatusEffect, m_active, bool(StatusEffect this, entity actor));
+       /** Stores times of status effects, the id being the index */
+       ATTRIBARRAY(StatusEffect, statuseffect_time, float, REGISTRY_MAX(StatusEffects));
+       ATTRIBARRAY(StatusEffect, statuseffect_flags, int, REGISTRY_MAX(StatusEffects));
 #endif
 #ifdef SVQC
-    METHOD(StatusEffects, m_apply, void(StatusEffects this, entity actor, float eff_time, int eff_flags));
-    METHOD(StatusEffects, m_remove, void(StatusEffects this, entity actor, int removal_type));
-    /** Sets the persistent flag and updates client side if returning true */
-    METHOD(StatusEffects, m_persistent, bool(StatusEffects this, entity actor)) { return false; };
+       METHOD(StatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, int eff_flags));
+       METHOD(StatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type));
+       /** Sets the persistent flag and updates client side if returning true */
+       METHOD(StatusEffect, m_persistent, bool(StatusEffect this, entity actor)) { return false; };
 #endif
-    METHOD(StatusEffects, display, void(StatusEffects this, void(string name, string icon) returns))
-    {
-        TC(StatusEffects, this);
-        returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
-    }
-ENDCLASS(StatusEffects)
+       METHOD(StatusEffect, display, void(StatusEffect this, void(string name, string icon) returns))
+       {
+               TC(StatusEffect, this);
+               returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
+       }
+ENDCLASS(StatusEffect)
index b65555eb903be7915946d3e39a35b65fbbe1c570..4c68c1bad6f4bca301bd3379d944e09ef0658853 100644 (file)
@@ -1,13 +1,13 @@
 #include "cl_status_effects.qh"
 
-METHOD(StatusEffects, m_active, bool(StatusEffects this, entity actor))
+METHOD(StatusEffect, m_active, bool(StatusEffect this, entity actor))
 {
        if(!actor) return false;
-       TC(StatusEffects, this);
+       TC(StatusEffect, this);
        return (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE);
 }
 
-METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor))
+METHOD(StatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
        if(this.m_hidden || autocvar__hud_configure)
                return;
index 2e632c70f2aaf53573aacdf513b83fb8d68caf64..53a34c3a9ebeab4f0df6b2eaa009cba1d2b6f091 100644 (file)
@@ -1,16 +1,16 @@
 #include "burning.qh"
 
 #ifdef SVQC
-METHOD(Burning, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(Burning, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     actor.effects &= ~EF_FLAME;
     SUPER(Burning).m_remove(this, actor, removal_type);
 }
-METHOD(Burning, m_persistent, bool(StatusEffects this, entity actor))
+METHOD(Burning, m_persistent, bool(StatusEffect this, entity actor))
 {
     return (autocvar_g_balance_contents_playerdamage_lava_burn && actor.waterlevel && actor.watertype == CONTENT_LAVA);
 }
-METHOD(Burning, m_tick, void(StatusEffects this, entity actor))
+METHOD(Burning, m_tick, void(StatusEffect this, entity actor))
 {
     if(STAT(FROZEN, actor) || (actor.waterlevel && actor.watertype != CONTENT_LAVA))
     {
index 8935d49a2c631780f359094a606e56a56208783c..30c6a06dc384b276940db6688355975cf880c793 100644 (file)
@@ -8,7 +8,7 @@ void Fire_ApplyDamage(entity e);
 #ifdef GAMEQC
 SOUND(Burning_Remove, "desertfactory/steam_burst");
 #endif
-CLASS(Burning, StatusEffects)
+CLASS(Burning, StatusEffect)
     ATTRIB(Burning, netname, string, "burning");
 #if 0
     // NOTE: status effect name and icon disabled as they are not displayed
index 6673de650fdbad2894dff4d9e65d81d44893d304..5cc224e51558b41a7f39098e291fe43c70de3a80 100644 (file)
@@ -1,12 +1,12 @@
 #include "burning.qh"
 
 #ifdef SVQC
-METHOD(SpawnShield, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(SpawnShield, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     actor.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
     SUPER(SpawnShield).m_remove(this, actor, removal_type);
 }
-METHOD(SpawnShield, m_tick, void(StatusEffects this, entity actor))
+METHOD(SpawnShield, m_tick, void(StatusEffect this, entity actor))
 {
     if(time >= game_starttime)
         actor.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
index 14db808079376d0cd8ff008db616acd39de83820..9e31473cbb4893e0dfdd5c9063cd088c043f0777 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <common/mutators/mutator/status_effects/all.qh>
 
-CLASS(SpawnShield, StatusEffects)
+CLASS(SpawnShield, StatusEffect)
     ATTRIB(SpawnShield, netname, string, "spawnshield");
 #if 0
     // NOTE: status effect name and icon disabled as they are not displayed
index f16fb39a871707c90aa2db6de58c6ecc700aeb3c..c562d8664d4296289443fbb831650583d0912543 100644 (file)
@@ -1,19 +1,19 @@
 #include "stunned.qh"
 
 #ifdef SVQC
-METHOD(Stunned, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(Stunned, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
     actor.effects &= ~EF_SHOCK;
     SUPER(Stunned).m_remove(this, actor, removal_type);
 }
 #if 0
 // TODO: some infinite source of stunning? e.g. some electric current
-METHOD(Stunned, m_persistent, bool(StatusEffects this, entity actor))
+METHOD(Stunned, m_persistent, bool(StatusEffect this, entity actor))
 {
     return true;
 }
 #endif
-METHOD(Stunned, m_tick, void(StatusEffects this, entity actor))
+METHOD(Stunned, m_tick, void(StatusEffect this, entity actor))
 {
     if(STAT(FROZEN, actor))
     {
index 1acf49c128626ccd31d2286efa039c7a783642af..c178e4331a788e1164ce977a3fba318dfca64e2f 100644 (file)
@@ -8,7 +8,7 @@
 #ifdef GAMEQC
 SOUND(Stunned_Remove, "onslaught/ons_spark1");
 #endif
-CLASS(Stunned, StatusEffects)
+CLASS(Stunned, StatusEffect)
     ATTRIB(Stunned, netname, string, "stunned");
 #if 0
     // NOTE: status effect name and icon disabled as they are not displayed
index f4707163aef8fe16b76194092a140f2bf00450b0..43e1571e663b34bbcb98a284ee6326d5718a5cfa 100644 (file)
@@ -1,20 +1,20 @@
 #include "superweapons.qh"
 
 #ifdef SVQC
-METHOD(Superweapons, m_persistent, bool(StatusEffects this, entity actor))
+METHOD(Superweapon, m_persistent, bool(StatusEffect this, entity actor))
 {
     return (actor.items & IT_UNLIMITED_SUPERWEAPONS);
 }
 #endif
 
 #ifdef CSQC
-METHOD(Superweapons, m_active, bool(StatusEffects this, entity actor))
+METHOD(Superweapon, m_active, bool(StatusEffect this, entity actor))
 {
     if(autocvar__hud_configure)
         return true;
-    return SUPER(Superweapons).m_active(this, actor);
+    return SUPER(Superweapon).m_active(this, actor);
 }
-METHOD(Superweapons, m_tick, void(StatusEffects this, entity actor))
+METHOD(Superweapon, m_tick, void(StatusEffect this, entity actor))
 {
     if(this.m_hidden)
         return;
index 3926bbe62bad1d3439e1e7cc522b49ac711688e9..e6a2288585741cca00adb2307c41155d893318ae 100644 (file)
@@ -2,12 +2,12 @@
 
 #include <common/mutators/mutator/status_effects/all.qh>
 
-CLASS(Superweapons, StatusEffects)
-    ATTRIB(Superweapons, netname, string, "superweapons");
-    ATTRIB(Superweapons, m_name, string, _("Superweapons"));
-    ATTRIB(Superweapons, m_icon, string, "superweapons");
+CLASS(Superweapon, StatusEffect)
+    ATTRIB(Superweapon, netname, string, "superweapons");
+    ATTRIB(Superweapon, m_name, string, _("Superweapons"));
+    ATTRIB(Superweapon, m_icon, string, "superweapons");
 #ifdef GAMEQC
-    ATTRIB(Superweapons, m_sound_rm, Sound, SND_POWEROFF);
+    ATTRIB(Superweapon, m_sound_rm, Sound, SND_POWEROFF);
 #endif
-ENDCLASS(Superweapons)
-REGISTER_STATUSEFFECT(Superweapons, NEW(Superweapons));
+ENDCLASS(Superweapon)
+REGISTER_STATUSEFFECT(Superweapon, NEW(Superweapon));
index e4301d3c59a05965a864ee1dc6f46b980a212f96..6436a95d9725cd224f30aba8b21719f6af4821cb 100644 (file)
@@ -1,20 +1,20 @@
 #include "status_effects.qh"
 
 #ifdef GAMEQC
-bool StatusEffects_active(StatusEffects this, entity actor)
+bool StatusEffects_active(StatusEffect this, entity actor)
 {
        return this.m_active(this, actor);
 }
 
 void StatusEffects_tick(entity actor)
 {
-       FOREACH(StatusEffect, it.m_active(it, actor),
+       FOREACH(StatusEffects, it.m_active(it, actor),
        {
                it.m_tick(it, actor);
        });
 }
 
-float StatusEffects_gettime(StatusEffects this, entity actor)
+float StatusEffects_gettime(StatusEffect this, entity actor)
 {
        entity store = actor;
 #ifdef SVQC
@@ -28,7 +28,7 @@ float StatusEffects_gettime(StatusEffects this, entity actor)
 }
 #endif
 #ifdef SVQC
-void StatusEffects_apply(StatusEffects this, entity actor, float eff_time, int eff_flags)
+void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
 {
        if (!actor || eff_time <= time)
                return;
@@ -36,11 +36,11 @@ void StatusEffects_apply(StatusEffects this, entity actor, float eff_time, int e
        this.m_apply(this, actor, eff_time, eff_flags);
 }
 
-void StatusEffects_copy(StatusEffects this, entity store, float time_offset)
+void StatusEffects_copy(StatusEffect this, entity store, float time_offset)
 {
        if(!this || !store)
                return;
-       FOREACH(StatusEffect, true,
+       FOREACH(StatusEffects, true,
        {
                if(time_offset)
                        store.statuseffect_time[it.m_id] = time + this.statuseffect_time[it.m_id] - time_offset;
@@ -50,7 +50,7 @@ void StatusEffects_copy(StatusEffects this, entity store, float time_offset)
        });
 }
 
-void StatusEffects_remove(StatusEffects this, entity actor, int removal_type)
+void StatusEffects_remove(StatusEffect this, entity actor, int removal_type)
 {
        this.m_remove(this, actor, removal_type);
 }
@@ -59,7 +59,7 @@ void StatusEffects_removeall(entity actor, int removal_type)
 {
        if(!actor.statuseffects)
                return;
-       FOREACH(StatusEffect, true,
+       FOREACH(StatusEffects, true,
        {
                it.m_remove(it, actor, removal_type);
        });
index f7795094cdb805648c6815fd9e4a353df5528e78..3f6d26a9e1c214901edc13d6656c6653081bfd92 100644 (file)
@@ -10,14 +10,14 @@ REGISTER_MUTATOR(status_effects, true);
 
 #ifdef GAMEQC
 /** Entity statuseffects */
-.StatusEffects statuseffects;
+.StatusEffect statuseffects;
 /** Player statuseffects storage (holds previous state) */
-.StatusEffects statuseffects_store;
+.StatusEffect statuseffects_store;
 
 REGISTER_NET_LINKED(ENT_CLIENT_STATUSEFFECTS)
 
 const int StatusEffects_groups_minor = 8; // must be a multiple of 8 (one byte) to optimize bandwidth usage
-const int StatusEffects_groups_major = 4; // must be >= ceil(REGISTRY_COUNT(StatusEffect) / StatusEffects_groups_minor)
+const int StatusEffects_groups_major = 4; // must be >= ceil(REGISTRY_COUNT(StatusEffects) / StatusEffects_groups_minor)
 #endif
 
 // no need to perform these checks on both server and client
@@ -26,7 +26,7 @@ STATIC_INIT(StatusEffects)
 {
        if (StatusEffects_groups_minor / 8 != floor(StatusEffects_groups_minor / 8))
                error("StatusEffects_groups_minor is not a multiple of 8.");
-       int min_major_value = ceil(REGISTRY_COUNT(StatusEffect) / StatusEffects_groups_minor);
+       int min_major_value = ceil(REGISTRY_COUNT(StatusEffects) / StatusEffects_groups_minor);
        if (StatusEffects_groups_major < min_major_value)
                error(sprintf("StatusEffects_groups_major can not be < %d.", min_major_value));
 }
@@ -38,7 +38,7 @@ STATIC_INIT(StatusEffects)
 #endif
 
 #ifdef CSQC
-StatusEffects g_statuseffects;
+StatusEffect g_statuseffects;
 void StatusEffects_entremove(entity this)
 {
     if(g_statuseffects == this)
@@ -60,7 +60,7 @@ NET_HANDLE(ENT_CLIENT_STATUSEFFECTS, bool isnew)
             if (!(minorBits & BIT(j))) {
                 continue;
             }
-            const StatusEffects it = REGISTRY_GET(StatusEffect, StatusEffects_groups_minor * i + j);
+            const StatusEffect it = REGISTRY_GET(StatusEffects, StatusEffects_groups_minor * i + j);
             this.statuseffect_time[it.m_id] = ReadFloat();
             this.statuseffect_flags[it.m_id] = ReadByte();
         }
@@ -71,19 +71,19 @@ NET_HANDLE(ENT_CLIENT_STATUSEFFECTS, bool isnew)
 
 #ifdef SVQC
 int SEFminorBitsArr[StatusEffects_groups_major];
-void StatusEffects_Write(StatusEffects data, StatusEffects store)
+void StatusEffects_Write(StatusEffect data, StatusEffect store)
 {
     if (!data) {
         WriteShort(MSG_ENTITY, 0);
         return;
     }
-    TC(StatusEffects, data);
+    TC(StatusEffect, data);
 
        for (int i = 0; i < StatusEffects_groups_major; ++i)
                SEFminorBitsArr[i] = 0;
 
     int majorBits = 0;
-    FOREACH(StatusEffect, true, {
+    FOREACH(StatusEffects, true, {
         .float fld = statuseffect_time[it.m_id];
         .int flg = statuseffect_flags[it.m_id];
         const bool changed = (store.(fld) != data.(fld) || store.(flg) != data.(flg));
@@ -109,7 +109,7 @@ void StatusEffects_Write(StatusEffects data, StatusEffects store)
                        if (!(minorBits & BIT(j)))
                                continue;
 
-                       const entity it = REGISTRY_GET(StatusEffect, StatusEffects_groups_minor * i + j);
+                       const entity it = REGISTRY_GET(StatusEffects, StatusEffects_groups_minor * i + j);
             WriteFloat(MSG_ENTITY, data.statuseffect_time[it.m_id]);
                        WriteByte(MSG_ENTITY, data.statuseffect_flags[it.m_id]);
                }
@@ -121,9 +121,9 @@ void StatusEffects_Write(StatusEffects data, StatusEffects store)
 #undef G_MINOR
 
 #ifdef SVQC
-bool StatusEffects_Send(StatusEffects this, Client to, int sf)
+bool StatusEffects_Send(StatusEffect this, Client to, int sf)
 {
-    TC(StatusEffects, this);
+    TC(StatusEffect, this);
     WriteHeader(MSG_ENTITY, ENT_CLIENT_STATUSEFFECTS);
     StatusEffects_Write(this, to.statuseffects_store);
     return true;
@@ -137,7 +137,7 @@ bool StatusEffects_customize(entity this, entity client)
 
 void StatusEffects_new(entity this)
 {
-    StatusEffects eff = NEW(StatusEffects);
+    StatusEffect eff = NEW(StatusEffect);
        this.statuseffects = eff;
        eff.owner = this;
     if(this.statuseffects_store)
@@ -146,8 +146,10 @@ void StatusEffects_new(entity this)
         Net_LinkEntity(eff, false, 0, StatusEffects_Send);
     }
 }
+
 void StatusEffects_delete(entity e) { delete(e.statuseffects); e.statuseffects = NULL; }
 // may be called on non-player entities, should be harmless!
+
 void StatusEffects_update(entity e) { e.statuseffects.SendFlags = 0xFFFFFF; }
 
 // this clears the storage entity instead of the statuseffects object, useful for map resets and such
@@ -157,13 +159,13 @@ void StatusEffects_clearall(entity store)
         return; // safety net
     // NOTE: you will need to perform StatusEffects_update after this to update the storage entity
     // (unless store is the storage entity)
-    FOREACH(StatusEffect, true, {
+    FOREACH(StatusEffects, true, {
         store.statuseffect_time[it.m_id] = 0;
         store.statuseffect_flags[it.m_id] = 0;
     });
 }
 
-void StatusEffectsStorage_attach(entity e) { e.statuseffects_store = NEW(StatusEffects); e.statuseffects_store.drawonlytoclient = e; }
+void StatusEffectsStorage_attach(entity e) { e.statuseffects_store = NEW(StatusEffect); e.statuseffects_store.drawonlytoclient = e; }
 void StatusEffectsStorage_delete(entity e) { delete(e.statuseffects_store); e.statuseffects_store = NULL; }
 
 // called when an entity is deleted with delete() / remove()
@@ -177,7 +179,7 @@ void ONREMOVE(entity this)
 #endif
 
 #ifdef GAMEQC
-bool StatusEffects_active(StatusEffects this, entity actor);
+bool StatusEffects_active(StatusEffect this, entity actor);
 
 // runs every SV_StartFrame on the server
 // called by HUD_Powerups_add on the client
@@ -186,18 +188,18 @@ void StatusEffects_tick(entity actor);
 // accesses the status effect timer, returns 0 if the entity has no statuseffects object
 // pass g_statuseffects as the actor on client side
 // pass the entity with a .statuseffects on server side
-float StatusEffects_gettime(StatusEffects this, entity actor);
+float StatusEffects_gettime(StatusEffect this, entity actor);
 #endif
 #ifdef SVQC
 // call when applying the effect to an entity
-void StatusEffects_apply(StatusEffects this, entity actor, float eff_time, int eff_flags);
+void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags);
 
 // copies all the status effect fields to the specified storage entity
 // does not perform an update
-void StatusEffects_copy(StatusEffects this, entity store, float time_offset);
+void StatusEffects_copy(StatusEffect this, entity store, float time_offset);
 
 // call when removing the effect
-void StatusEffects_remove(StatusEffects this, entity actor, int removal_type);
+void StatusEffects_remove(StatusEffect this, entity actor, int removal_type);
 
 void StatusEffects_removeall(entity actor, int removal_type);
 #endif
index 2f654333dafa580d716b58ab73b2a4622bc7f7a1..97b1cec68804a15fcd05117627be4f1a6960e72a 100644 (file)
@@ -1,16 +1,16 @@
 #include "sv_status_effects.qh"
 
-METHOD(StatusEffects, m_active, bool(StatusEffects this, entity actor))
+METHOD(StatusEffect, m_active, bool(StatusEffect this, entity actor))
 {
-       TC(StatusEffects, this);
+       TC(StatusEffect, this);
        if(!actor.statuseffects)
                return false; // safety net
        return (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE);
 }
 
-METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor))
+METHOD(StatusEffect, m_tick, void(StatusEffect this, entity actor))
 {
-       StatusEffects data = actor.statuseffects;
+       StatusEffect data = actor.statuseffects;
        .int flg = statuseffect_flags[this.m_id];
        int oldflag = data.(flg);
        data.(flg) = BITSET(data.(flg), STATUSEFFECT_FLAG_PERSISTENT, this.m_persistent(this, actor));
@@ -26,7 +26,7 @@ METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor))
        }
 }
 
-METHOD(StatusEffects, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
+METHOD(StatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
 {
        if(!actor.statuseffects)
                StatusEffects_new(actor);
@@ -37,9 +37,9 @@ METHOD(StatusEffects, m_apply, void(StatusEffects this, entity actor, float eff_
        StatusEffects_update(actor);
 }
 
-METHOD(StatusEffects, m_remove, void(StatusEffects this, entity actor, int removal_type))
+METHOD(StatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
 {
-       StatusEffects data = actor.statuseffects;
+       StatusEffect data = actor.statuseffects;
        if(!data)
                return;
        // NOTE: persistent effects do not make a sound on removal, this is intended as a workaround for #2620
index 5c8c85380c3df18ee83b68624a55cfe207aa3f79..afcbaf27ebf8c4abcc282db3de31b45887bae854 100644 (file)
@@ -638,7 +638,7 @@ void PutPlayerInServer(entity this)
        PS(this).dual_weapons = '0 0 0';
 
        if(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS)
-               StatusEffects_apply(STATUSEFFECT_Superweapons, this, time + autocvar_g_balance_superweapons_time, 0);
+               StatusEffects_apply(STATUSEFFECT_Superweapon, this, time + autocvar_g_balance_superweapons_time, 0);
 
        this.items = start_items;
 
@@ -1563,7 +1563,7 @@ void player_powerups(entity this)
                {
                        if (!(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS))
                        {
-                               StatusEffects_remove(STATUSEFFECT_Superweapons, this, STATUSEFFECT_REMOVE_NORMAL);
+                               StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_NORMAL);
                                this.items &= ~IT_SUPERWEAPON;
                                //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
                                Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
@@ -1574,8 +1574,8 @@ void player_powerups(entity this)
                        }
                        else
                        {
-                               play_countdown(this, StatusEffects_gettime(STATUSEFFECT_Superweapons, this), SND_POWEROFF);
-                               if (time >= StatusEffects_gettime(STATUSEFFECT_Superweapons, this))
+                               play_countdown(this, StatusEffects_gettime(STATUSEFFECT_Superweapon, this), SND_POWEROFF);
+                               if (time >= StatusEffects_gettime(STATUSEFFECT_Superweapon, this))
                                {
                                        this.items &= ~IT_SUPERWEAPON;
                                        STAT(WEAPONS, this) &= ~WEPSET_SUPERWEAPONS;
@@ -1586,7 +1586,7 @@ void player_powerups(entity this)
                }
                else if(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS)
                {
-                       if (time < StatusEffects_gettime(STATUSEFFECT_Superweapons, this) || (this.items & IT_UNLIMITED_SUPERWEAPONS))
+                       if (time < StatusEffects_gettime(STATUSEFFECT_Superweapon, this) || (this.items & IT_UNLIMITED_SUPERWEAPONS))
                        {
                                this.items |= IT_SUPERWEAPON;
                                if(!(this.items & IT_UNLIMITED_SUPERWEAPONS))
@@ -1598,14 +1598,14 @@ void player_powerups(entity this)
                        }
                        else
                        {
-                               if(StatusEffects_active(STATUSEFFECT_Superweapons, this))
-                                       StatusEffects_remove(STATUSEFFECT_Superweapons, this, STATUSEFFECT_REMOVE_TIMEOUT);
+                               if(StatusEffects_active(STATUSEFFECT_Superweapon, this))
+                                       StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_TIMEOUT);
                                STAT(WEAPONS, this) &= ~WEPSET_SUPERWEAPONS;
                        }
                }
-               else if(StatusEffects_active(STATUSEFFECT_Superweapons, this)) // cheaper to check than to update each frame!
+               else if(StatusEffects_active(STATUSEFFECT_Superweapon, this)) // cheaper to check than to update each frame!
                {
-                       StatusEffects_remove(STATUSEFFECT_Superweapons, this, STATUSEFFECT_REMOVE_CLEAR);
+                       StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_CLEAR);
                }
        }
 
index c868eeee2fe1f701d90ec3b7a0f19f4d4ef10166..6e40357df934badbf7470e44397dc58d29ac8f52 100644 (file)
@@ -170,7 +170,7 @@ void target_init_use(entity this, entity actor, entity trigger)
 
        if (!(this.spawnflags & 8))
        {
-               FOREACH(StatusEffect, it.instanceOfPowerups,
+               FOREACH(StatusEffects, it.instanceOfPowerupStatusEffect,
                {
                        it.m_remove(it, actor, STATUSEFFECT_REMOVE_NORMAL);
                });
index 2b28ec466f2b5b3f345c5f4c7d548c27262bd3cf..593d238a0a27b405985b7c7eacf82cd046f8ba0f 100644 (file)
@@ -643,8 +643,8 @@ bool Item_GiveTo(entity item, entity player)
        if (item.superweapons_finished)
        {
                pickedup = true;
-               float t = StatusEffects_gettime(STATUSEFFECT_Superweapons, player);
-               StatusEffects_apply(STATUSEFFECT_Superweapons, player, t + item.superweapons_finished, 0);
+               float t = StatusEffects_gettime(STATUSEFFECT_Superweapon, player);
+               StatusEffects_apply(STATUSEFFECT_Superweapon, player, t + item.superweapons_finished, 0);
        }
 
        // always eat teamed entities
@@ -1362,7 +1362,7 @@ spawnfunc(target_items)
                        else if(argv(j) == "fuel_regen")             this.items |= ITEM_JetpackRegen.m_itemid;
                        else
                        {
-                               FOREACH(StatusEffect, it.instanceOfBuff,
+                               FOREACH(StatusEffects, it.instanceOfBuff,
                                {
                                        string s = Buff_CompatName(argv(j));
                                        if(s == it.netname)
@@ -1431,7 +1431,7 @@ spawnfunc(target_items)
                res = GetResource(this, RES_FUEL);    if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "fuel");
                res = GetResource(this, RES_HEALTH);  if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "health");
                res = GetResource(this, RES_ARMOR);   if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "armor");
-               FOREACH(StatusEffect, it.instanceOfBuff, str = sprintf("%s %s%d %s", str, valueprefix, this.buffs_finished * boolean(this.buffdef == it), it.netname));
+               FOREACH(StatusEffects, it.instanceOfBuff, str = sprintf("%s %s%d %s", str, valueprefix, this.buffs_finished * boolean(this.buffdef == it), it.netname));
                FOREACH(Weapons, it != WEP_Null, str = sprintf("%s %s%d %s", str, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname));
        }
        this.netname = strzone(str);
@@ -1554,7 +1554,7 @@ bool GiveResourceValue(entity e, Resource res_type, int op, int val)
 
        return SetResourceExplicit(e, res_type, new_val);
 }
-bool GiveStatusEffect(entity e, StatusEffects this, int op, float val)
+bool GiveStatusEffect(entity e, StatusEffect this, int op, float val)
 {
        bool had_eff = StatusEffects_active(this, e);
        float new_eff_time = ((had_eff) ? StatusEffects_gettime(this, e) : time);
@@ -1616,7 +1616,7 @@ float GiveItems(entity e, float beginarg, float endarg)
        PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Shield);
        PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Speed);
        PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Invisibility);
-       //PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Superweapons);
+       //PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Superweapon);
        PREGIVE_RESOURCE(e, RES_BULLETS);
        PREGIVE_RESOURCE(e, RES_CELLS);
        PREGIVE_RESOURCE(e, RES_SHELLS);
@@ -1654,7 +1654,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                                continue;
                        case "ALL":
                                got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val);
-                               FOREACH(StatusEffect, it.instanceOfPowerups, got += GiveStatusEffect(e, it, op, val));
+                               FOREACH(StatusEffects, it.instanceOfPowerupStatusEffect, got += GiveStatusEffect(e, it, op, val));
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val);
                        case "all":
                                got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val);
@@ -1664,7 +1664,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                                FOREACH(Weapons, it != WEP_Null && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN)),
                                        got += GiveWeapon(e, it.m_id, op, val));
                        //case "allbuffs": // all buffs makes a player god, do not want!
-                               //FOREACH(StatusEffect, it.instanceOfBuff, got += GiveBuff(e, it, op, val));
+                               //FOREACH(StatusEffects, it.instanceOfBuff, got += GiveBuff(e, it, op, val));
                        case "allammo":
                                got += GiveResourceValue(e, RES_CELLS, op, val);
                                got += GiveResourceValue(e, RES_SHELLS, op, val);
@@ -1702,7 +1702,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                                got += GiveStatusEffect(e, STATUSEFFECT_Invisibility, op, val);
                                break;
                        case "superweapons":
-                               got += GiveStatusEffect(e, STATUSEFFECT_Superweapons, op, val);
+                               got += GiveStatusEffect(e, STATUSEFFECT_Superweapon, op, val);
                                break;
                        case "cells":
                                got += GiveResourceValue(e, RES_CELLS, op, val);
@@ -1727,7 +1727,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                                got += GiveResourceValue(e, RES_FUEL, op, val);
                                break;
                        default:
-                               FOREACH(StatusEffect, it.instanceOfBuff && buff_Available(it) && Buff_CompatName(cmd) == it.netname,
+                               FOREACH(StatusEffects, it.instanceOfBuff && buff_Available(it) && Buff_CompatName(cmd) == it.netname,
                                {
                                        got += GiveBuff(e, it, op, val);
                                        break;
@@ -1764,11 +1764,11 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_RES_ROT(e, RES_ARMOR, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_ARMOR25, SND_Null);
        POSTGIVE_RES_ROT(e, RES_HEALTH, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
 
-       if(!StatusEffects_active(STATUSEFFECT_Superweapons, e))
+       if(!StatusEffects_active(STATUSEFFECT_Superweapon, e))
        {
                // also give default superweapon time if player had no superweapons and just got one
                if(!g_weaponarena && !(save_weapons & WEPSET_SUPERWEAPONS) && (STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS))
-                       StatusEffects_apply(STATUSEFFECT_Superweapons, e, time + autocvar_g_balance_superweapons_time, 0);
+                       StatusEffects_apply(STATUSEFFECT_Superweapon, e, time + autocvar_g_balance_superweapons_time, 0);
        }
 
        if(e.statuseffects)
index 38d0f97a35c99235fd4e89827bc493a995e942ef..8dc37f00a417bc6aeb40fcff1145d74724e6e5e0 100644 (file)
@@ -52,18 +52,18 @@ float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector
                        });
                        if(superweapons <= 1)
                        {
-                               wep.superweapons_finished = StatusEffects_gettime(STATUSEFFECT_Superweapons, own);
-                               StatusEffects_remove(STATUSEFFECT_Superweapons, own, STATUSEFFECT_REMOVE_CLEAR);
+                               wep.superweapons_finished = StatusEffects_gettime(STATUSEFFECT_Superweapon, own);
+                               StatusEffects_remove(STATUSEFFECT_Superweapon, own, STATUSEFFECT_REMOVE_CLEAR);
                        }
                        else
                        {
-                               float timeleft = StatusEffects_gettime(STATUSEFFECT_Superweapons, own) - time;
+                               float timeleft = StatusEffects_gettime(STATUSEFFECT_Superweapon, own) - time;
                                float weptimeleft = timeleft / superweapons;
                                wep.superweapons_finished = time + weptimeleft;
                                if(own.statuseffects)
                                {
                                        // TODO: this doesn't explicitly enable the effect, use apply here?
-                                       own.statuseffects.statuseffect_time[STATUSEFFECT_Superweapons.m_id] -= weptimeleft;
+                                       own.statuseffects.statuseffect_time[STATUSEFFECT_Superweapon.m_id] -= weptimeleft;
                                        StatusEffects_update(own);
                                }
                        }