]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add support for Quake 3 buffs
authorMario <zacjardine@y7mail.com>
Tue, 4 Nov 2014 06:38:05 +0000 (17:38 +1100)
committerMario <zacjardine@y7mail.com>
Tue, 4 Nov 2014 06:38:05 +0000 (17:38 +1100)
qcsrc/common/buffs.qh
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/server/t_quake3.qc

index b61d5307de0745f40505ccc6d0fdd444b16fa09a..fe2dcc6ac35f309b5ce07d5d4466c3575773fc91 100644 (file)
@@ -42,6 +42,7 @@ REGISTER_BUFF(_("Vengeance"),vengeance,VENGEANCE,15,'0.55 0.5 1');
 REGISTER_BUFF(_("Jump"),jump,JUMP,10,'0.7 0.2 1');
 REGISTER_BUFF(_("Flight"),flight,FLIGHT,11,'1 0.2 0.5');
 REGISTER_BUFF(_("Invisible"),invisible,INVISIBLE,12,'0.9 0.9 0.9');
+#undef REGISTER_BUFF
 
 #ifdef SVQC
 .float buffs;
@@ -49,7 +50,7 @@ void buff_Init(entity ent);
 void buff_Init_Compat(entity ent, float replacement);
 
 #define BUFF_SPAWNFUNC(e,b,t) void spawnfunc_item_buff_##e() { self.buffs = b; self.team = t; buff_Init(self); }
-#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o,r) void spawnfunc_##o() { buff_Init_Compat(self,r); }
+#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o,r) void spawnfunc_item_##o() { buff_Init_Compat(self,r); }
 #define BUFF_SPAWNFUNCS(e,b)                         \
         BUFF_SPAWNFUNC(e,           b,  0)           \
         BUFF_SPAWNFUNC(e##_team1,   b,  NUM_TEAM_1) \
@@ -70,10 +71,16 @@ BUFF_SPAWNFUNCS(flight,                     BUFF_FLIGHT)
 BUFF_SPAWNFUNCS(invisible,             BUFF_INVISIBLE)
 BUFF_SPAWNFUNCS(random,                        0)
 
-BUFF_SPAWNFUNC_Q3TA_COMPAT(item_doubler,    BUFF_MEDIC)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(item_resistance,    BUFF_RESISTANCE)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(item_scout,      BUFF_SPEED)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(item_ammoregen,  BUFF_AMMO)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler,    BUFF_MEDIC)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(scout,      BUFF_SPEED)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen,  BUFF_AMMO)
+
+// actually Q3
+BUFF_SPAWNFUNC_Q3TA_COMPAT(flight,     BUFF_FLIGHT)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(haste,      BUFF_SPEED)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(invis,      BUFF_INVISIBLE)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(medic,      BUFF_MEDIC)
 #endif
 
 vector Buff_Color(float buff_id);
index 200c307ac78a81d4d2fa16f8278c9644fece8335..12c3e4febb5e8d5661a49bce7ed453b9f55605b1 100644 (file)
@@ -1,10 +1,16 @@
 float buffs_BuffModel_Customize()
 {
-       float same_team = (SAME_TEAM(other, self.owner) || (IS_SPEC(other) && SAME_TEAM(other.enemy, self.owner)));
-       if(self.owner.alpha <= 0.5 && !same_team && self.owner.alpha != 0)
+       entity player, myowner;
+       float same_team;
+
+       player = WaypointSprite_getviewentity(other);
+       myowner = self.owner;
+       same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner));
+
+       if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0)
                return FALSE;
-               
-       if(other == self.owner || (IS_SPEC(other) && other.enemy == self.owner))
+
+       if(player == myowner || (IS_SPEC(other) && other.enemy == myowner))
        {
                // somewhat hide the model, but keep the glow
                self.effects = 0;
@@ -66,10 +72,14 @@ void buff_Respawn(entity ent)
        if(!MoveToRandomMapLocation(ent, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((autocvar_g_buffs_random_location_attempts > 0) ? autocvar_g_buffs_random_location_attempts : 10), 1024, 256))
        {
                entity spot = SelectSpawnPoint(TRUE);
-               setorigin(self, (spot.origin + '0 0 200') + (randomvec() * 300));
-               self.angles = spot.angles;
+               setorigin(ent, ((spot.origin + '0 0 200') + (randomvec() * 300)));
+               ent.angles = spot.angles;
        }
        
+       tracebox(ent.origin, ent.mins * 1.5, self.maxs * 1.5, ent.origin, MOVE_NOMONSTERS, ent);
+       
+       setorigin(ent, trace_endpos); // attempt to unstick
+       
        ent.movetype = MOVETYPE_TOSS;
        
        makevectors(ent.angles);
index bb1128bd60e8c532c217de9d8f9d99f9c0404d27..5a1885588f1ce6a893cf6391b0b6e15fee1f43ca 100644 (file)
@@ -114,18 +114,18 @@ void spawnfunc_target_give()
        InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
 }
 
-//void spawnfunc_item_flight()       /* not supported */
-//void spawnfunc_item_haste()        /* not supported */
+//void spawnfunc_item_flight()       /* handled by buffs mutator */
+//void spawnfunc_item_haste()        /* handled by buffs mutator */
 //void spawnfunc_item_health()       /* handled in t_quake.qc */
 //void spawnfunc_item_health_large() /* handled in t_items.qc */
 //void spawnfunc_item_health_small() /* handled in t_items.qc */
 //void spawnfunc_item_health_mega()  /* handled in t_items.qc */
-//void spawnfunc_item_invis()        /* not supported */
-//void spawnfunc_item_regen()        /* not supported */
+//void spawnfunc_item_invis()        /* handled by buffs mutator */
+//void spawnfunc_item_regen()        /* handled by buffs mutator */
 
 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
 
-void spawnfunc_item_flight()         { spawnfunc_item_jetpack();       }
+//void spawnfunc_item_flight()         { spawnfunc_item_jetpack();       }
 
 .float notteam;
 .float notsingle;