]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_buffs.qc
Merge branch 'master' into terencehill/menu_gametype_tooltips_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_buffs.qc
index 62e4d9f53d3a79303716a9e34064a5cb0d10e5ae..7aeadce75efde15406d80af051ecdfb9c4ec3e78 100644 (file)
@@ -4,15 +4,15 @@
 
 #include "mutator.qh"
 
-#include "../../common/buffs.qh"
+#include "../../common/buffs/all.qh"
 
 entity buff_FirstFromFlags(int _buffs)
 {
        if (flags)
        {
-               FOREACH(BUFFS, it.m_itemid & _buffs, LAMBDA(return it));
+               FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it));
        }
-       return BUFF_NULL;
+       return BUFF_Null;
 }
 
 bool buffs_BuffModel_Customize()
@@ -47,7 +47,7 @@ bool buffs_BuffModel_Customize()
 void buffs_BuffModel_Spawn(entity player)
 {
        player.buff_model = spawn();
-       setmodel(player.buff_model, BUFF_MODEL);
+       setmodel(player.buff_model, MDL_BUFF);
        setsize(player.buff_model, '0 0 -40', '0 0 40');
        setattachment(player.buff_model, player, "");
        setorigin(player.buff_model, '0 0 1' * (player.buff_model.maxs.z * 1));
@@ -92,9 +92,9 @@ float buff_Waypoint_visible_for_player(entity plr)
 void buff_Waypoint_Spawn(entity e)
 {
        entity buff = buff_FirstFromFlags(e.buffs);
-       entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_POWERUP);
+       entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_Buff);
        wp.wp_extra = buff.m_id;
-       WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_POWERUP, e.glowmod);
+       WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod);
        e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player;
 }
 
@@ -140,7 +140,7 @@ void buff_Respawn(entity ent)
 
        WaypointSprite_Ping(ent.buff_waypoint);
 
-       sound(ent, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
+       sound(ent, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
 void buff_Touch()
@@ -178,7 +178,7 @@ void buff_Touch()
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ITEM_BUFF_LOST, other.netname, buffid);
 
                        other.buffs = 0;
-                       //sound(other, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM);
+                       //sound(other, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                }
                else { return; } // do nothing
        }
@@ -191,13 +191,13 @@ void buff_Touch()
        Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, buffid);
 
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
-       sound(other, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTN_NORM);
+       sound(other, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
        other.buffs |= (self.buffs);
 }
 
 float buff_Available(entity buff)
 {
-       if (buff == BUFF_NULL)
+       if (buff == BUFF_Null)
                return false;
        if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_AMMO) || (cvar("g_melee_only"))))
                return false;
@@ -211,7 +211,7 @@ float buff_Available(entity buff)
 void buff_NewType(entity ent, float cb)
 {
        RandomSelection_Init();
-       FOREACH(BUFFS, buff_Available(it), LAMBDA(
+       FOREACH(Buffs, buff_Available(it), LAMBDA(
                it.buff_seencount += 1;
                // if it's already been chosen, give it a lower priority
                RandomSelection_Add(world, it.m_itemid, string_null, 1, max(0.2, 1 / it.buff_seencount));
@@ -228,7 +228,7 @@ void buff_Think()
                self.glowmod = buff_GlowColor(buff);
                self.skin = buff.m_skin;
 
-               setmodel(self, BUFF_MODEL);
+               setmodel(self, MDL_BUFF);
 
                if(self.buff_waypoint)
                {
@@ -271,7 +271,7 @@ void buff_Think()
                if(!self.buff_activetime)
                {
                        self.buff_active = true;
-                       sound(self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM);
                        Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
                }
        }
@@ -368,7 +368,7 @@ void buff_Init(entity ent)
        if(self.noalign)
                self.movetype = MOVETYPE_NONE; // reset by random location
 
-       setmodel(self, BUFF_MODEL);
+       setmodel(self, MDL_BUFF);
        setsize(self, BUFF_MIN, BUFF_MAX);
 
        if(cvar("g_buffs_random_location") || (self.spawnflags & 64))
@@ -596,7 +596,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey)
                Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, buffid);
 
                self.buffs = 0;
-               sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                return true;
        }
        return false;
@@ -661,8 +661,8 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey)
                        Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1);
                        Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1);
 
-                       sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM);
-                       sound(closest, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM);
+                       sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
+                       sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
 
                        // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam
                        self.buffs = 0;
@@ -771,7 +771,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                        if(buff_lost >= 2)
                        {
                                Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message?
-                               sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                        }
                        self.buffs = 0;
                }
@@ -806,7 +806,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
        if(self.buffs != self.oldbuffs)
        {
                entity buff = buff_FirstFromFlags(self.buffs);
-               float bufftime = buff != BUFF_NULL ? buff.m_time(buff) : 0;
+               float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0;
                self.buff_time = (bufftime) ? time + bufftime : 0;
 
                BUFF_ONADD(BUFF_AMMO)
@@ -957,13 +957,6 @@ void buffs_DelayedInit()
 
 void buffs_Initialize()
 {
-       precache_model(BUFF_MODEL);
-       precache_sound("misc/strength_respawn.wav");
-       precache_sound("misc/shield_respawn.wav");
-       precache_sound("relics/relic_effect.wav");
-       precache_sound(W_Sound("rocket_impact"));
-       precache_sound("keepaway/respawn.wav");
-
        addstat(STAT_BUFFS, AS_INT, buffs);
        addstat(STAT_BUFF_TIME, AS_FLOAT, buff_time);