From 28ca8192ce5debecd6337f6aad350e9312ce7694 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Mon, 23 Dec 2024 00:58:25 +0800 Subject: [PATCH] Relocate descriptions of powerups from statuseffects to items Due to 89ad1fa8 the descriptions need to be shifted to the ITEM_ powerup not the STATUSEFFECT_ powerup. Also made the distinction between the two clear for the main 4 powerups. --- .../mutator/powerups/powerup/invisibility.qc | 18 +++---- .../mutator/powerups/powerup/invisibility.qh | 50 ++++++++++--------- .../mutator/powerups/powerup/shield.qc | 24 ++++----- .../mutator/powerups/powerup/shield.qh | 47 ++++++++--------- .../mutator/powerups/powerup/speed.qc | 18 +++---- .../mutator/powerups/powerup/speed.qh | 50 ++++++++++--------- .../mutator/powerups/powerup/strength.qc | 24 ++++----- .../mutator/powerups/powerup/strength.qh | 47 ++++++++--------- .../mutators/mutator/powerups/powerups.qh | 14 +++--- 9 files changed, 149 insertions(+), 143 deletions(-) diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc index 57fa99af9..fa096b5fd 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc @@ -1,7 +1,7 @@ #include "invisibility.qh" #ifdef SVQC -METHOD(Invisibility, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(InvisibilityStatusEffect, m_remove, void(StatusEffects 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)) @@ -17,9 +17,9 @@ METHOD(Invisibility, m_remove, void(StatusEffects this, entity actor, int remova if(actor.exteriorweaponentity) actor.exteriorweaponentity.alpha = default_weapon_alpha; } - SUPER(Invisibility).m_remove(this, actor, removal_type); + SUPER(InvisibilityStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Invisibility, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffects 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)) @@ -28,9 +28,9 @@ METHOD(Invisibility, m_apply, void(StatusEffects this, entity actor, float eff_t Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_INVISIBILITY, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } - SUPER(Invisibility).m_apply(this, actor, eff_time, eff_flags); + SUPER(InvisibilityStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Invisibility, m_tick, void(StatusEffects this, entity actor)) +METHOD(InvisibilityStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); if(!actor.vehicle) @@ -39,16 +39,16 @@ METHOD(Invisibility, m_tick, void(StatusEffects this, entity actor)) if(actor.exteriorweaponentity) actor.exteriorweaponentity.alpha = autocvar_g_balance_powerup_invisibility_alpha; } - SUPER(Invisibility).m_tick(this, actor); + SUPER(InvisibilityStatusEffect).m_tick(this, actor); } #endif #ifdef MENUQC -METHOD(Invisibility, describe, string(Invisibility this)) +METHOD(InvisibilityItem, describe, string(InvisibilityItem this)) { - TC(Invisibility, this); + TC(InvisibilityItem, this); return sprintf(_("The %s powerup increases your translucency while the powerup is active, making it more difficult for enemies to see you. " "This powerup is often present in InstaGib\n\n" "Since it is a powerup, it will drop if you die while holding it"), - COLORED_NAME(STATUSEFFECT_Invisibility)); + COLORED_NAME(this)); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh index 483392273..feaf47e73 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh @@ -29,35 +29,37 @@ void powerup_invisibility_init(Pickup def, entity item) item.invisibility_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invisibility_time; } #endif -REGISTER_ITEM(Invisibility, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_invisibility"; + +CLASS(InvisibilityItem, Powerup) + ATTRIB(InvisibilityItem, m_canonical_spawnfun, string, "item_invisibility"); #ifdef SVQC - this.m_iteminit = powerup_invisibility_init; + ATTRIB(InvisibilityItem, m_iteminit, void(Pickup def, entity item), powerup_invisibility_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_INVISIBILITY; - this.m_model = MDL_BUFF; // TODO: MDL_Invisibility_ITEM when new model available - this.m_skin = 12; - this.m_sound = SND_Invisibility; - this.m_glow = true; - this.m_respawnsound = SND_STRENGTH_RESPAWN; + ATTRIB(InvisibilityItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(InvisibilityItem, m_itemid, int, IT_INVISIBILITY); + ATTRIB(InvisibilityItem, m_model, Model, MDL_BUFF); // TODO: MDL_Invisibility_ITEM when new model available + ATTRIB(InvisibilityItem, m_skin, int, 12); + ATTRIB(InvisibilityItem, m_sound, Sound, SND_Invisibility); + ATTRIB(InvisibilityItem, m_glow, bool, true); + ATTRIB(InvisibilityItem, m_respawnsound, Sound, SND_STRENGTH_RESPAWN); #endif - this.netname = "invisibility"; - this.m_name = _("Invisibility"); - this.m_icon = "buff_invisible"; - this.m_color = COLOR_POWERUP_INVISIBILITY; - this.m_waypoint = _("Invisibility"); - this.m_waypointblink = 2; -} + ATTRIB(InvisibilityItem, netname, string, "invisibility"); + ATTRIB(InvisibilityItem, m_name, string, _("Invisibility")); + ATTRIB(InvisibilityItem, m_icon, string, "buff_invisible"); + ATTRIB(InvisibilityItem, m_color, vector, COLOR_POWERUP_INVISIBILITY); + ATTRIB(InvisibilityItem, m_waypoint, string, _("Invisibility")); + ATTRIB(InvisibilityItem, m_waypointblink, int, 2); +ENDCLASS(InvisibilityItem) +REGISTER_ITEM(Invisibility, NEW(InvisibilityItem)); SPAWNFUNC_ITEM(item_invisibility, ITEM_Invisibility) SPAWNFUNC_ITEM(item_buff_invisibility, ITEM_Invisibility) -CLASS(Invisibility, Powerups) - ATTRIB(Invisibility, netname, string, "invisibility"); - ATTRIB(Invisibility, m_name, string, _("Invisibility")); - ATTRIB(Invisibility, m_color, vector, COLOR_POWERUP_INVISIBILITY); - ATTRIB(Invisibility, m_icon, string, "buff_invisible"); -ENDCLASS(Invisibility) -REGISTER_STATUSEFFECT(Invisibility, NEW(Invisibility)); +CLASS(InvisibilityStatusEffect, Powerups) + ATTRIB(InvisibilityStatusEffect, netname, string, "invisibility"); + ATTRIB(InvisibilityStatusEffect, m_name, string, _("Invisibility")); + ATTRIB(InvisibilityStatusEffect, m_color, vector, COLOR_POWERUP_INVISIBILITY); + ATTRIB(InvisibilityStatusEffect, m_icon, string, "buff_invisible"); +ENDCLASS(InvisibilityStatusEffect) +REGISTER_STATUSEFFECT(Invisibility, NEW(InvisibilityStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc index c5e856996..bfbc41433 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc @@ -1,7 +1,7 @@ #include "shield.qh" #ifdef SVQC -METHOD(Shield, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(ShieldStatusEffect, m_remove, void(StatusEffects 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)) @@ -12,9 +12,9 @@ METHOD(Shield, m_remove, void(StatusEffects this, entity actor, int removal_type if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound actor.effects &= ~(EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Shield).m_remove(this, actor, removal_type); + SUPER(ShieldStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Shield, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(ShieldStatusEffect, m_apply, void(StatusEffects 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)) @@ -23,23 +23,23 @@ METHOD(Shield, m_apply, void(StatusEffects this, entity actor, float eff_time, f Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SHIELD, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SHIELD); } - SUPER(Shield).m_apply(this, actor, eff_time, eff_flags); + SUPER(ShieldStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Shield, m_tick, void(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); actor.effects |= (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Shield).m_tick(this, actor); + SUPER(ShieldStatusEffect).m_tick(this, actor); } #endif #ifdef CSQC -METHOD(Shield, m_active, bool(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_active, bool(StatusEffects this, entity actor)) { if(autocvar__hud_configure) return true; - return SUPER(Shield).m_active(this, actor); + return SUPER(ShieldStatusEffect).m_active(this, actor); } -METHOD(Shield, m_tick, void(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor)) { if(this.m_hidden) return; @@ -49,12 +49,12 @@ METHOD(Shield, m_tick, void(StatusEffects this, entity actor)) } #endif #ifdef MENUQC -METHOD(Shield, describe, string(Shield this)) +METHOD(ShieldItem, describe, string(ShieldItem this)) { - TC(Shield, this); + TC(ShieldItem, this); return sprintf(_("The %s powerup greatly decreases the damage you take until the powerup expires, having a compounding effect with armor. " "It also makes you more resistant to knockback\n\n" "Since it is a powerup, it will drop if you die while holding it"), - COLORED_NAME(STATUSEFFECT_Shield)); + COLORED_NAME(this)); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh index 13b27cb12..629a2cf3c 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh @@ -28,34 +28,35 @@ void powerup_shield_init(Pickup def, entity item) item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time; } #endif -REGISTER_ITEM(Shield, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_shield"; + +CLASS(ShieldItem, Powerup) + ATTRIB(ShieldItem, m_canonical_spawnfunc, string, "item_shield"); #ifdef SVQC - this.m_iteminit = powerup_shield_init; + ATTRIB(ShieldItem, m_iteminit, void(Pickup def, entity item), powerup_shield_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_INVINCIBLE; - this.m_model = MDL_Shield_ITEM; - this.m_sound = SND_Shield; - this.m_glow = true; - this.m_respawnsound = SND_SHIELD_RESPAWN; + ATTRIB(ShieldItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(ShieldItem, m_itemid, int, IT_INVINCIBLE); + ATTRIB(ShieldItem, m_model, Model, MDL_Shield_ITEM); + ATTRIB(ShieldItem, m_sound, Sound, SND_Shield); + ATTRIB(ShieldItem, m_glow, bool, true); + ATTRIB(ShieldItem, m_respawnsound, Sound, SND_SHIELD_RESPAWN); #endif - this.netname = "invincible"; - this.m_name = _("Shield"); - this.m_icon = "shield"; - this.m_color = COLOR_POWERUP_SHIELD; - this.m_waypoint = _("Shield"); - this.m_waypointblink = 2; -} + ATTRIB(ShieldItem, netname, string, "invincible"); + ATTRIB(ShieldItem, m_name, string, _("Shield")); + ATTRIB(ShieldItem, m_icon, string, "shield"); + ATTRIB(ShieldItem, m_color, vector, COLOR_POWERUP_SHIELD); + ATTRIB(ShieldItem, m_waypoint, string, _("Shield")); + ATTRIB(ShieldItem, m_waypointblink, int, 2); +ENDCLASS(ShieldItem) +REGISTER_ITEM(Shield, NEW(ShieldItem)); SPAWNFUNC_ITEM(item_shield, ITEM_Shield) SPAWNFUNC_ITEM(item_invincible, ITEM_Shield) -CLASS(Shield, Powerups) - ATTRIB(Shield, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item - ATTRIB(Shield, m_name, string, _("Shield")); - ATTRIB(Shield, m_color, vector, COLOR_POWERUP_SHIELD); - ATTRIB(Shield, m_icon, string, "shield"); -ENDCLASS(Shield) -REGISTER_STATUSEFFECT(Shield, NEW(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"); +ENDCLASS(ShieldStatusEffect) +REGISTER_STATUSEFFECT(Shield, NEW(ShieldStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc index d3f465fb0..5e871367d 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc @@ -1,7 +1,7 @@ #include "speed.qh" #ifdef SVQC -METHOD(Speed, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(SpeedStatusEffect, m_remove, void(StatusEffects 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)) @@ -11,9 +11,9 @@ METHOD(Speed, m_remove, void(StatusEffects this, entity actor, int removal_type) } if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound - SUPER(Speed).m_remove(this, actor, removal_type); + SUPER(SpeedStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(SpeedStatusEffect, m_apply, void(StatusEffects 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)) @@ -22,21 +22,21 @@ METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, fl Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SPEED, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SPEED); } - SUPER(Speed).m_apply(this, actor, eff_time, eff_flags); + SUPER(SpeedStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Speed, m_tick, void(StatusEffects this, entity actor)) +METHOD(SpeedStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); - SUPER(Speed).m_tick(this, actor); + SUPER(SpeedStatusEffect).m_tick(this, actor); } #endif #ifdef MENUQC -METHOD(Speed, describe, string(Speed this)) +METHOD(SpeedItem, describe, string(SpeedItem this)) { - TC(Speed, this); + TC(SpeedItem, this); return sprintf(_("The %s powerup increases your movement speed, attack speed, and health regeneration speed while the powerup is active. " "However, it also makes you a bit more vulnerable to incoming attacks\n\n" "Since it is a powerup, it will drop if you die while holding it"), - COLORED_NAME(STATUSEFFECT_Speed)); + COLORED_NAME(this)); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh index 9f6f8ccc2..f52a99e5b 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh @@ -30,35 +30,37 @@ void powerup_speed_init(Pickup def, entity item) item.speed_finished = (item.count) ? item.count : autocvar_g_balance_powerup_speed_time; } #endif -REGISTER_ITEM(Speed, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_speed"; + +CLASS(SpeedItem, Powerup) + ATTRIB(SpeedItem, m_canonical_spawnfunc, string, "item_speed"); #ifdef SVQC - this.m_iteminit = powerup_speed_init; + ATTRIB(SpeedItem, m_iteminit, void(Pickup def, entity item), powerup_speed_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_SPEED; - this.m_model = MDL_BUFF; // TODO: MDL_Speed_ITEM when new model available - this.m_skin = 9; - this.m_sound = SND_Speed; - this.m_glow = true; - this.m_respawnsound = SND_SHIELD_RESPAWN; + ATTRIB(SpeedItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(SpeedItem, m_itemid, int, IT_SPEED); + ATTRIB(SpeedItem, m_model, Model, MDL_BUFF); // TODO: MDL_Speed_ITEM when new model available + ATTRIB(SpeedItem, m_skin, int, 9); + ATTRIB(SpeedItem, m_sound, Sound, SND_Speed); + ATTRIB(SpeedItem, m_glow, bool, true); + ATTRIB(SpeedItem, m_respawnsound, Sound, SND_SHIELD_RESPAWN); #endif - this.netname = "speed"; - this.m_name = _("Speed"); - this.m_icon = "buff_speed"; - this.m_color = COLOR_POWERUP_SPEED; - this.m_waypoint = _("Speed"); - this.m_waypointblink = 2; -} + ATTRIB(SpeedItem, netname, string, "speed"); + ATTRIB(SpeedItem, m_name, string, _("Speed")); + ATTRIB(SpeedItem, m_icon, string, "buff_speed"); + ATTRIB(SpeedItem, m_color, vector, COLOR_POWERUP_SPEED); + ATTRIB(SpeedItem, m_waypoint, string, _("Speed")); + ATTRIB(SpeedItem, m_waypointblink, int, 2); +ENDCLASS(SpeedItem) +REGISTER_ITEM(Speed, NEW(SpeedItem)); SPAWNFUNC_ITEM(item_speed, ITEM_Speed) SPAWNFUNC_ITEM(item_buff_speed, ITEM_Speed) -CLASS(Speed, Powerups) - ATTRIB(Speed, netname, string, "speed"); - ATTRIB(Speed, m_name, string, _("Speed")); - ATTRIB(Speed, m_color, vector, COLOR_POWERUP_SPEED); - ATTRIB(Speed, m_icon, string, "buff_speed"); -ENDCLASS(Speed) -REGISTER_STATUSEFFECT(Speed, NEW(Speed)); +CLASS(SpeedStatusEffect, Powerups) + ATTRIB(SpeedStatusEffect, netname, string, "speed"); + ATTRIB(SpeedStatusEffect, m_name, string, _("Speed")); + ATTRIB(SpeedStatusEffect, m_color, vector, COLOR_POWERUP_SPEED); + ATTRIB(SpeedStatusEffect, m_icon, string, "buff_speed"); +ENDCLASS(SpeedStatusEffect) +REGISTER_STATUSEFFECT(Speed, NEW(SpeedStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc index 0e6891b3f..be82b2b89 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc @@ -1,7 +1,7 @@ #include "strength.qh" #ifdef SVQC -METHOD(Strength, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(StrengthStatusEffect, m_remove, void(StatusEffects 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)) @@ -12,9 +12,9 @@ METHOD(Strength, m_remove, void(StatusEffects this, entity actor, int removal_ty if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound actor.effects &= ~(EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Strength).m_remove(this, actor, removal_type); + SUPER(StrengthStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Strength, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(StrengthStatusEffect, m_apply, void(StatusEffects 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)) @@ -23,23 +23,23 @@ METHOD(Strength, m_apply, void(StatusEffects this, entity actor, float eff_time, Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_STRENGTH, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_STRENGTH); } - SUPER(Strength).m_apply(this, actor, eff_time, eff_flags); + SUPER(StrengthStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Strength, m_tick, void(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); actor.effects |= (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Strength).m_tick(this, actor); + SUPER(StrengthStatusEffect).m_tick(this, actor); } #endif #ifdef CSQC -METHOD(Strength, m_active, bool(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_active, bool(StatusEffects this, entity actor)) { if(autocvar__hud_configure) return true; - return SUPER(Strength).m_active(this, actor); + return SUPER(StrengthStatusEffect).m_active(this, actor); } -METHOD(Strength, m_tick, void(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor)) { if(this.m_hidden) return; @@ -49,13 +49,13 @@ METHOD(Strength, m_tick, void(StatusEffects this, entity actor)) } #endif #ifdef MENUQC -METHOD(Strength, describe, string(Strength this)) +METHOD(StrengthItem, describe, string(StrengthItem this)) { - TC(Strength, this); + TC(StrengthItem, this); return sprintf(_("The %s powerup greatly increases the damage you deal, until the powerup expires. " "It also increases the knockback that your attacks deal\n\n" "The damage and knockback you deal to yourself also increases but by a smaller amount\n\n" "Since it is a powerup, it will drop if you die while holding it"), - COLORED_NAME(STATUSEFFECT_Strength)); + COLORED_NAME(this)); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh index f4bf17e1c..a78d64efc 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh @@ -30,33 +30,34 @@ void powerup_strength_init(Pickup def, entity item) item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time; } #endif -REGISTER_ITEM(Strength, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_strength"; + +CLASS(StrengthItem, Powerup) + ATTRIB(StrengthItem, m_canonical_spawnfunc, string, "item_strength"); #ifdef SVQC - this.m_iteminit = powerup_strength_init; + ATTRIB(StrengthItem, m_iteminit, void(Pickup def, entity item), powerup_strength_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_STRENGTH; - this.m_model = MDL_Strength_ITEM; - this.m_sound = SND_Strength; - this.m_glow = true; - this.m_respawnsound = SND_STRENGTH_RESPAWN; + ATTRIB(StrengthItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(StrengthItem, m_itemid, int, IT_STRENGTH); + ATTRIB(StrengthItem, m_model, Model, MDL_Strength_ITEM); + ATTRIB(StrengthItem, m_sound, Sound, SND_Strength); + ATTRIB(StrengthItem, m_glow, bool, true); + ATTRIB(StrengthItem, m_respawnsound, Sound, SND_STRENGTH_RESPAWN); #endif - this.netname = "strength"; - this.m_name = _("Strength"); - this.m_icon = "strength"; - this.m_color = COLOR_POWERUP_STRENGTH; - this.m_waypoint = _("Strength"); - this.m_waypointblink = 2; -} + ATTRIB(StrengthItem, netname, string, "strength"); + ATTRIB(StrengthItem, m_name, string, _("Strength")); + ATTRIB(StrengthItem, m_icon, string, "strength"); + ATTRIB(StrengthItem, m_color, vector, COLOR_POWERUP_STRENGTH); + ATTRIB(StrengthItem, m_waypoint, string, _("Strength")); + ATTRIB(StrengthItem, m_waypointblink, int, 2); +ENDCLASS(StrengthItem) +REGISTER_ITEM(Strength, NEW(StrengthItem)); SPAWNFUNC_ITEM(item_strength, ITEM_Strength) -CLASS(Strength, Powerups) - ATTRIB(Strength, netname, string, "strength"); - ATTRIB(Strength, m_name, string, _("Strength")); - ATTRIB(Strength, m_color, vector, COLOR_POWERUP_STRENGTH); - ATTRIB(Strength, m_icon, string, "strength"); -ENDCLASS(Strength) -REGISTER_STATUSEFFECT(Strength, NEW(Strength)); +CLASS(StrengthStatusEffect, Powerups) + ATTRIB(StrengthStatusEffect, netname, string, "strength"); + ATTRIB(StrengthStatusEffect, m_name, string, _("Strength")); + ATTRIB(StrengthStatusEffect, m_icon, string, "strength"); +ENDCLASS(StrengthStatusEffect) +REGISTER_STATUSEFFECT(Strength, NEW(StrengthStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerups.qh b/qcsrc/common/mutators/mutator/powerups/powerups.qh index fb4949733..42e43d384 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerups.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerups.qh @@ -9,6 +9,13 @@ CLASS(Powerup, Pickup) ATTRIB(Powerup, m_respawntime, float(), GET(g_pickup_respawntime_powerup)); ATTRIB(Powerup, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_powerup)); #endif +#ifdef MENUQC + METHOD(Powerup, describe, string(Powerup this)) + { + TC(Powerup, this); + return SUPER(Object).describe(this); + } +#endif ENDCLASS(Powerup) #include @@ -16,11 +23,4 @@ CLASS(Powerups, StatusEffects) #ifdef GAMEQC ATTRIB(Powerups, m_sound_rm, Sound, SND_POWEROFF); #endif -#ifdef MENUQC - METHOD(Powerups, describe, string(Powerups this)) - { - TC(Powerups, this); - return SUPER(Object).describe(this); - } -#endif ENDCLASS(Powerups) -- 2.39.2