]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into TimePath/universal_weapons
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 28 Sep 2015 02:09:12 +0000 (12:09 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 28 Sep 2015 02:09:12 +0000 (12:09 +1000)
# Conflicts:
# qcsrc/common/turrets/unit/plasma_dual.qc

49 files changed:
defaultXonotic.cfg
qcsrc/client/damage.qc
qcsrc/client/view.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/turrets/unit/plasma_dual.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/weapons/all.inc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/config.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hmg.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rpc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/autocvars.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_nexball_weapon.qc [new file with mode: 0644]
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/t_items.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/weaponsystem.qc
weapons.cfg [deleted file]

index 338808f3d10aea1ea4819ca78be0fba2407c8f3d..c51dfc1a26d29a261d76defc752415d489eecadc 100644 (file)
@@ -640,7 +640,6 @@ alias weapon_group_7 "impulse 7"
 alias weapon_group_8 "impulse 8"
 alias weapon_group_9 "impulse 9"
 alias weapon_group_0 "impulse 14" // cycles the superweapons
-exec weapons.cfg
 
 // score log
 set sv_logscores_console 0     "print scores to server console"
index 4f25aef13ef2d25bd6c9a1cdf81637f8a104e60c..de3145baca1dc45e7cb4f4bee818463bd6c32ca5 100644 (file)
@@ -355,6 +355,6 @@ void Ent_DamageInfo(float isNew)
                        w_backoff = -1 * normalize(force);
                setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { WEP_ACTION(hitwep, WR_IMPACTEFFECT); }
+               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { _WEP_ACTION(hitwep, WR_IMPACTEFFECT); }
        }
 }
index 26089f9158e764ff2d1d47b41f2661b8494c5c46..f220e2affc8dcb596aba669c93a463ff3f9ee930 100644 (file)
@@ -321,6 +321,7 @@ float TrueAimCheck()
        {
                case WEP_TUBA.m_id: // no aim
                case WEP_PORTO.m_id: // shoots from eye
+               case WEP_NEXBALL.m_id: // shoots from eye
                case WEP_HOOK.m_id: // no trueaim
                case WEP_MORTAR.m_id: // toss curve
                        return SHOTTYPE_HITWORLD;
@@ -440,7 +441,7 @@ bool WantEventchase()
                        return true;
                if(MUTATOR_CALLHOOK(WantEventchase, self))
                        return true;
-               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO.m_id)))
+               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_NEXBALL.m_id)))
                        return true;
                if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
                {
@@ -1540,7 +1541,7 @@ void CSQC_UpdateView(float w, float h)
                        // no zoom reticle while dead
                        reticle_type = 0;
                }
-               else if(WEP_ACTION(activeweapon, WR_ZOOMRETICLE) && autocvar_cl_reticle_weapon)
+               else if(_WEP_ACTION(activeweapon, WR_ZOOMRETICLE) && autocvar_cl_reticle_weapon)
                {
                        if(reticle_image != "") { reticle_type = 2; }
                        else { reticle_type = 0; }
index 534005db93f558ea4bf25b9f80a53dc351b7f08a..291ebe364473d21cc6fba61a136300d1e2c90cac 100644 (file)
@@ -15,7 +15,32 @@ REGISTER_MONSTER_SIMPLE(
 #endif
 }
 
+#include "../../weapons/all.qh"
+
+CLASS(MageSpike, PortoLaunch)
+/* flags     */ ATTRIB(MageSpike, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(MageSpike, impulse, int, 9);
+/* refname   */ ATTRIB(MageSpike, netname, string, "magespike");
+/* wepname   */ ATTRIB(MageSpike, message, string, _("Mage spike"));
+ENDCLASS(MageSpike)
+REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
+
 #ifdef SVQC
+
+void M_Mage_Attack_Spike(vector dir);
+METHOD(MageSpike, wr_think, bool(entity thiswep)) {
+       SELFPARAM();
+       if (self.BUTTON_ATCK)
+       if (weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire))) {
+               if (!self.target_range) self.target_range = autocvar_g_monsters_target_range;
+               self.enemy = Monster_FindTarget(self);
+               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+               M_Mage_Attack_Spike(w_shotdir);
+               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+       }
+       return true;
+}
+
 float autocvar_g_monster_mage_health;
 float autocvar_g_monster_mage_damageforcescale = 0.5;
 float autocvar_g_monster_mage_attack_spike_damage;
@@ -111,19 +136,12 @@ void M_Mage_Attack_Spike_Touch()
 // copied from W_Seeker_Think
 void M_Mage_Attack_Spike_Think()
 {SELFPARAM();
-       entity e;
-       vector desireddir, olddir, newdir, eorg;
-       float turnrate;
-       float dist;
-       float spd;
-
-       if (time > self.ltime || self.enemy.health <= 0 || self.owner.health <= 0)
-       {
+       if (time > self.ltime || (self.enemy && self.enemy.health <= 0) || self.owner.health <= 0) {
                self.projectiledeathtype |= HITTYPE_SPLASH;
                M_Mage_Attack_Spike_Explode();
        }
 
-       spd = vlen(self.velocity);
+       float spd = vlen(self.velocity);
        spd = bound(
                spd - (autocvar_g_monster_mage_attack_spike_decel) * frametime,
                (autocvar_g_monster_mage_attack_spike_speed_max),
@@ -136,12 +154,12 @@ void M_Mage_Attack_Spike_Think()
 
        if (self.enemy != world)
        {
-               e                               = self.enemy;
-               eorg                    = 0.5 * (e.absmin + e.absmax);
-               turnrate                = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
-               desireddir              = normalize(eorg - self.origin);
-               olddir                  = normalize(self.velocity); // get my current direction
-               dist                    = vlen(eorg - self.origin);
+               entity e = self.enemy;
+               vector eorg = 0.5 * (e.absmin + e.absmax);
+               float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
+               vector desireddir = normalize(eorg - self.origin);
+               vector olddir = normalize(self.velocity); // get my current direction
+               float dist = vlen(eorg - self.origin);
 
                // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
                if ((autocvar_g_monster_mage_attack_spike_smart) && (dist > (autocvar_g_monster_mage_attack_spike_smart_mindist)))
@@ -159,11 +177,9 @@ void M_Mage_Attack_Spike_Think()
                        desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
                }
 
-               newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
+               vector newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
                self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
        }
-       else
-               dist = 0;
 
        ///////////////
 
@@ -172,14 +188,19 @@ void M_Mage_Attack_Spike_Think()
        UpdateCSQCProjectile(self);
 }
 
-void M_Mage_Attack_Spike()
-{SELFPARAM();
-       entity missile;
-       vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+void M_Mage_Attack_Spike(vector dir);
+void M_Mage_Attack_Spike_Aim()
+{
+       SELFPARAM();
+       return M_Mage_Attack_Spike(normalize((self.enemy.origin + '0 0 10') - self.origin));
+}
 
+void M_Mage_Attack_Spike(vector dir)
+{
+       SELFPARAM();
        makevectors(self.angles);
 
-       missile = spawn ();
+       entity missile = spawn();
        missile.owner = missile.realowner = self;
        missile.think = M_Mage_Attack_Spike_Think;
        missile.ltime = time + 7;
@@ -188,7 +209,7 @@ void M_Mage_Attack_Spike()
        missile.movetype = MOVETYPE_FLYMISSILE;
        missile.flags = FL_PROJECTILE;
        setorigin(missile, self.origin + v_forward * 14 + '0 0 30' + v_right * -14);
-       setsize (missile, '0 0 0', '0 0 0');
+       setsize(missile, '0 0 0', '0 0 0');
        missile.velocity = dir * 400;
        missile.avelocity = '300 300 300';
        missile.enemy = self.enemy;
@@ -328,7 +349,7 @@ float M_Mage_Attack(float attack_type)
                                        setanim(self, self.anim_shoot, true, true, true);
                                        self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
                                        self.anim_finished = time + 1;
-                                       Monster_Delay(1, 0, 0.2, M_Mage_Attack_Spike);
+                                       Monster_Delay(1, 0, 0.2, M_Mage_Attack_Spike_Aim);
                                        return true;
                                }
                        }
index bf3362ab897593149faff730c372e3b6653fff9f..8b2bc252ef092f86565e6a9b88ad8e37a83afaa7 100644 (file)
@@ -10,7 +10,36 @@ REGISTER_TURRET(
 /* fullname   */ _("Dual Plasma Cannon")
 );
 #else
+
+#include "../../weapons/all.qh"
+
+CLASS(PlasmaDualAttack, PortoLaunch)
+/* flags     */ ATTRIB(PlasmaDualAttack, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(PlasmaDualAttack, impulse, int, 5);
+/* refname   */ ATTRIB(PlasmaDualAttack, netname, string, "plasmadual");
+/* wepname   */ ATTRIB(PlasmaDualAttack, message, string, _("Dual plasma"));
+ENDCLASS(PlasmaDualAttack)
+REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack));
+
 #ifdef SVQC
+
+float t_plasma_dual(float req);
+METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep)) {
+       SELFPARAM();
+       if (self.BUTTON_ATCK)
+       if (weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire))) {
+               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+               self.tur_shotdir_updated = w_shotdir;
+               self.tur_shotorg = w_shotorg;
+               self.tur_head = self;
+        self.shot_speed = max(1, ((!self.shot_speed) ? 2500 : self.shot_speed));
+        self.shot_spread = bound(0.0001, ((!self.shot_spread) ? 0.0125 : self.shot_spread), 500);
+               t_plasma_dual(TR_ATTACK);
+               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+       }
+       return true;
+}
+
 void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); }
 
 float t_plasma_dual(float req)
index a1dc7ced65c78c9a69637ad6702bc66dd8dc9456..3c0db885461bafbf9fb0cf29c364a462d21e187b 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef VEHICLE_RACER
 #define VEHICLE_RACER
+
 #ifndef MENUQC
 int v_racer(int);
 #endif
@@ -19,6 +20,17 @@ REGISTER_VEHICLE_SIMPLE(
     this.vehicle_func = v_racer;
 #endif
 }
+
+#include "../../weapons/all.qh"
+
+CLASS(RacerAttack, PortoLaunch)
+/* flags     */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(RacerAttack, impulse, int, 3);
+/* refname   */ ATTRIB(RacerAttack, netname, string, "racercannon");
+/* wepname   */ ATTRIB(RacerAttack, message, string, _("Racer cannon"));
+ENDCLASS(RacerAttack)
+REGISTER_WEAPON(RACER, NEW(RacerAttack));
+
 #endif
 
 #ifdef IMPLEMENTATION
@@ -26,6 +38,18 @@ REGISTER_VEHICLE_SIMPLE(
 #include "../../effects/effects.qh"
 #include "../../triggers/trigger/impulse.qh"
 
+void racer_fire_cannon(string tagname);
+METHOD(RacerAttack, wr_think, bool(entity thiswep)) {
+       SELFPARAM();
+       if (self.BUTTON_ATCK)
+       if (weapon_prepareattack(0, 0)) {
+               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("lasergun_fire"), CH_WEAPON_B, 0);
+               racer_fire_cannon("tag_fire1");
+               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready);
+       }
+       return true;
+}
+
 bool autocvar_g_vehicle_racer;
 
 float autocvar_g_vehicle_racer_speed_afterburn;
index fc89a0cd20360dc8f447542253a57c3e886d61d6..3257215a9fef5b84ef4c073b87774689f496f7c3 100644 (file)
@@ -27,3 +27,5 @@
 #include "weapon/arc.qc"
 #include "weapon/hmg.qc"
 #include "weapon/rpc.qc"
+
+#include "../../server/mutators/gamemode_nexball_weapon.qc"
index f965c39988783e32b704a9959e6068ccaa583c31..1b7cc72724fb6ecae7ee77d3b96bc3b2b3bf5fbe 100644 (file)
@@ -30,22 +30,60 @@ const int WEP_FLAG_MUTATORBLOCKED = 0x200; // hides from impulse 99 etc. (mutato
 
 // weapon requests
 const int WR_SETUP          =  1; // (SERVER) setup weapon data
+.bool(entity this) wr_setup;
 const int WR_THINK          =  2; // (SERVER) logic to run every frame
+.bool(entity this) wr_think;
 const int WR_CHECKAMMO1     =  3; // (SERVER) checks ammo for weapon primary
+.bool(entity this) wr_checkammo1;
 const int WR_CHECKAMMO2     =  4; // (SERVER) checks ammo for weapon second
+.bool(entity this) wr_checkammo2;
 const int WR_AIM            =  5; // (SERVER) runs bot aiming code for this weapon
+.bool(entity this) wr_aim;
 const int WR_INIT           =  6; // (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties
+.bool(entity this) wr_init;
 const int WR_SUICIDEMESSAGE =  7; // (SERVER) notification number for suicide message (may inspect w_deathtype for details)
+.bool(entity this) wr_suicidemessage;
 const int WR_KILLMESSAGE    =  8; // (SERVER) notification number for kill message (may inspect w_deathtype for details)
+.bool(entity this) wr_killmessage;
 const int WR_RELOAD         =  9; // (SERVER) handles reloading for weapon
+.bool(entity this) wr_reload;
 const int WR_RESETPLAYER    = 10; // (SERVER) clears fields that the weapon may use
+.bool(entity this) wr_resetplayer;
 const int WR_IMPACTEFFECT   = 11; // (CLIENT) impact effect for weapon explosion
+.bool(entity this) wr_impacteffect;
 const int WR_PLAYERDEATH    = 12; // (SERVER) called whenever a player dies
+.bool(entity this) wr_playerdeath;
 const int WR_GONETHINK      = 13; // (SERVER) logic to run when weapon is lost
+.bool(entity this) wr_gonethink;
 const int WR_CONFIG         = 14; // (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons)
+.bool(entity this) wr_config;
 const int WR_ZOOMRETICLE    = 15; // (CLIENT) weapon specific zoom reticle
+.bool(entity this) wr_zoomreticle;
 const int WR_DROP           = 16; // (SERVER) the weapon is dropped
+.bool(entity this) wr_drop;
 const int WR_PICKUP         = 17; // (SERVER) a weapon is picked up
+.bool(entity this) wr_pickup;
+
+bool w_new(entity this, int req) {
+    if (req == WR_SETUP) return this.wr_setup ? this.wr_setup(this) : false;
+    if (req == WR_THINK) return this.wr_think ? this.wr_think(this) : false;
+    if (req == WR_CHECKAMMO1) return this.wr_checkammo1 ? this.wr_checkammo1(this) : false;
+    if (req == WR_CHECKAMMO2) return this.wr_checkammo2 ? this.wr_checkammo2(this) : false;
+    if (req == WR_AIM) return this.wr_aim ? this.wr_aim(this) : false;
+    if (req == WR_INIT) return this.wr_init ? this.wr_init(this) : false;
+    if (req == WR_SUICIDEMESSAGE) return this.wr_suicidemessage ? this.wr_suicidemessage(this) : false;
+    if (req == WR_KILLMESSAGE) return this.wr_killmessage ? this.wr_killmessage(this) : false;
+    if (req == WR_RELOAD) return this.wr_reload ? this.wr_reload(this) : false;
+    if (req == WR_RESETPLAYER) return this.wr_resetplayer ? this.wr_resetplayer(this) : false;
+    if (req == WR_IMPACTEFFECT) return this.wr_impacteffect ? this.wr_impacteffect(this) : false;
+    if (req == WR_PLAYERDEATH) return this.wr_playerdeath ? this.wr_playerdeath(this) : false;
+    if (req == WR_GONETHINK) return this.wr_gonethink ? this.wr_gonethink(this) : false;
+    if (req == WR_CONFIG) return this.wr_config ? this.wr_config(this) : false;
+    if (req == WR_ZOOMRETICLE) return this.wr_zoomreticle ? this.wr_zoomreticle(this) : false;
+    if (req == WR_DROP) return this.wr_drop ? this.wr_drop(this) : false;
+    if (req == WR_PICKUP) return this.wr_pickup ? this.wr_pickup(this) : false;
+    return false;
+}
 
 // variables:
 string weaponorder_byid;
@@ -66,7 +104,7 @@ WepSet ReadWepSet();
 
 // weapon name macros
 const int WEP_FIRST = 1;
-#define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
+#define WEP_MAXCOUNT 32 // Increase as needed. Can be up to 72.
 int WEP_COUNT;
 #define WEP_LAST (WEP_FIRST + WEP_COUNT - 1)
 WepSet WEPSET_ALL;
@@ -103,7 +141,8 @@ string W_Model(string w_mdl);
 .int ammo_none;
 
 // other useful macros
-#define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
+#define WEP_ACTION(wpn,wrequest) wpn.weapon_func(wpn, wrequest)
+#define _WEP_ACTION(wpn,wrequest) WEP_ACTION(get_weaponinfo(wpn), wrequest)
 #define WEP_AMMO(wpn) (WEP_##wpn.ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
 #define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
 
@@ -143,8 +182,6 @@ string W_Model(string w_mdl);
 //  Weapon Registration
 // =====================
 
-bool w_null(int) { return false; }
-
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0)
@@ -156,7 +193,7 @@ CLASS(Weapon, Object)
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
     /** M: function  : w_... */
-    ATTRIB(Weapon, weapon_func, bool(int), w_null);
+    METHOD(Weapon, weapon_func, bool(entity this, int req)) { return w_new(this, req); }
     /** M: ammotype  : main ammo field */
     ATTRIB(Weapon, ammo_field, .int, ammo_none);
     /** M: impulse   : weapon impulse */
@@ -191,7 +228,7 @@ CLASS(Weapon, Object)
        }
 
        CONSTRUCTOR(Weapon,
-               bool(int) function,
+               bool(entity this, int req) function,
                .int ammotype,
                int i,
                int weapontype,
@@ -228,7 +265,7 @@ CLASS(Weapon, Object)
                this.weapons = bit;
                this.wpmodel = strzone(strcat("wpn-", ftos(id)));
                #ifdef CSQC
-               this.weapon_func(WR_INIT);
+               this.weapon_func(this, WR_INIT);
                #endif
        }
 ENDCLASS(Weapon)
@@ -238,24 +275,29 @@ REGISTER_REGISTRY(RegisterWeapons)
 entity weapon_info[WEP_MAXCOUNT], weapon_info_first, weapon_info_last;
 entity dummy_weapon_info;
 
-#define _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
+#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__))
+
+#define REGISTER_WEAPON_2(id, inst) \
        WepSet WEPSET_##id; \
-       REGISTER(RegisterWeapons, WEP, weapon_info, WEP_COUNT, id, m_id, \
-               NEW(Weapon, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
-       ) { \
+       REGISTER(RegisterWeapons, WEP, weapon_info, WEP_COUNT, id, m_id, inst) { \
                this.m_id++; \
                WEPSET_ALL |= (WEPSET_##id = WepSet_FromWeapon(this.m_id)); \
-               if ((flags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= WEPSET_##id; \
+               if ((this.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= WEPSET_##id; \
                register_weapon(this, this.m_id, WEPSET_##id); \
-       }
+               localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1)); \
+       } \
+       REGISTER_INIT(WEP, id)
+
+#define _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
+       REGISTER_WEAPON_2(id, NEW(Weapon, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname))
 
 #ifndef MENUQC
-       #define REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
-       bool function(int); \
+       #define REGISTER_WEAPON_13(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
+       bool function(entity this, int); \
        _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname)
 #else
-       #define REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
-               _REGISTER_WEAPON(id, w_null,   ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname)
+       #define REGISTER_WEAPON_13(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
+               _REGISTER_WEAPON(id, w_new,   ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname)
 #endif
 
 #include "all.inc"
index b90c01f4a65abd6e300485335c03fa2bd74e32ed..8db08079769a930a8a24bcb1afd20b5b10a6a09f 100644 (file)
@@ -35,7 +35,7 @@ void Dump_Weapon_Settings(void)
                        { wep_config_queue[x] = string_null; }
 
                // step 2: build new queue
-               WEP_ACTION(i, WR_CONFIG);
+               _WEP_ACTION(i, WR_CONFIG);
 
                // step 3: sort queue
                heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
index 400c950c8cf904b76534d599991e5aa7e5761a4c..4de7814688a0706a5e970952721f1411490cdc4e 100644 (file)
@@ -273,7 +273,7 @@ void W_Arc_Beam_Think(void)
 
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
                setself(self.owner);
-               if(!WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO2))
+               if(!WEP_ACTION(WEP_ARC, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC, WR_CHECKAMMO2))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
@@ -631,7 +631,7 @@ void Arc_Smoke()
        }
 }
 
-bool W_Arc(int req)
+bool W_Arc(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
@@ -1509,7 +1509,7 @@ void Ent_ReadArcBeam(float isnew)
        }
 }
 
-bool W_Arc(int req)
+bool W_Arc(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 6b6d207bfada68b1d3a526c601b18f66c7290e45..b71ec598d641cabf89ba31608367f9b0622a0872 100644 (file)
@@ -144,7 +144,7 @@ void W_Blaster_Attack(
                WITH(entity, self, missile, missile.think());
        }
 }
-bool W_Blaster(int request)
+bool W_Blaster(entity thiswep, int request)
 {SELFPARAM();
        switch(request)
        {
@@ -259,7 +259,7 @@ bool W_Blaster(int request)
 }
 #endif
 #ifdef CSQC
-bool W_Blaster(int request)
+bool W_Blaster(entity thiswep, int request)
 {SELFPARAM();
        switch(request)
        {
index 43771079e2b50814d896bb11ec9b6cb4980f12ce..1120a184648b0bd9311f3b5af5946a1678668366 100644 (file)
@@ -564,7 +564,7 @@ void W_Crylink_Attack2(void)
        }
 }
 
-bool W_Crylink(int req)
+bool W_Crylink(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -581,7 +581,7 @@ bool W_Crylink(int req)
                case WR_THINK:
                {
                        if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
 
                        if(self.BUTTON_ATCK)
                        {
@@ -624,7 +624,7 @@ bool W_Crylink(int req)
                                                setorigin(linkjoineffect, pos);
                                        }
                                        self.crylink_waitrelease = 0;
-                                       if(!W_Crylink(WR_CHECKAMMO1) && !W_Crylink(WR_CHECKAMMO2))
+                                       if(!W_Crylink(WEP_CRYLINK, WR_CHECKAMMO1) && !W_Crylink(WEP_CRYLINK, WR_CHECKAMMO2))
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                // ran out of ammo!
@@ -684,7 +684,7 @@ bool W_Crylink(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Crylink(int req)
+bool W_Crylink(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index a011846315b81c4ecbc75633e351e59591b29fb9..410dd246be37c084718e9ece0b5dbf3f8b6c6c3b 100644 (file)
@@ -392,7 +392,7 @@ void W_Devastator_Attack(void)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-bool W_Devastator(int req)
+bool W_Devastator(entity thiswep, int req)
 {SELFPARAM();
        entity rock;
        float rockfound;
@@ -530,7 +530,7 @@ bool W_Devastator(int req)
                case WR_THINK:
                {
                        if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
                                if(self.BUTTON_ATCK)
@@ -646,7 +646,7 @@ bool W_Devastator(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Devastator(int req)
+bool W_Devastator(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index fbc07338808e01a22dc1b10daad005a437f61f5c..d0e300cc570f269d4b298dfcfa49faf002f5f2d8 100644 (file)
@@ -420,7 +420,7 @@ void W_Electro_CheckAttack(void)
 }
 
 .float bot_secondary_electromooth;
-bool W_Electro(int req)
+bool W_Electro(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -467,7 +467,7 @@ bool W_Electro(int req)
 
                                if(!ammo_amount)
                                {
-                                       WEP_ACTION(self.weapon, WR_RELOAD);
+                                       _WEP_ACTION(self.weapon, WR_RELOAD);
                                        return false;
                                }
 
@@ -562,7 +562,7 @@ bool W_Electro(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Electro(int req)
+bool W_Electro(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 2bf2a6267abb63cc03ad7b508fc524bdfe10f51d..89e421f727d6204a095ff661ec2248fb7c1ebf06 100644 (file)
@@ -348,7 +348,7 @@ void W_Fireball_Attack2(void)
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-bool W_Fireball(int req)
+bool W_Fireball(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
@@ -441,7 +441,7 @@ bool W_Fireball(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Fireball(int req)
+bool W_Fireball(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 8001ce15e82a041cefc4f68cc29d54be3b7bb3dd..84d7335869a633b5a64bf2638cbb159a088a9ff8 100644 (file)
@@ -387,7 +387,7 @@ void W_Hagar_Attack2_Load(void)
                self.hagar_warning = false;
 
                // we aren't checking ammo during an attack, so we must do it here
-               if(!(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
+               if(!(_WEP_ACTION(self.weapon, WR_CHECKAMMO1) + _WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
@@ -397,7 +397,7 @@ void W_Hagar_Attack2_Load(void)
        }
 }
 
-bool W_Hagar(int req)
+bool W_Hagar(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -419,7 +419,7 @@ bool W_Hagar(int req)
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(); // must always run each frame
                        if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(self.BUTTON_ATCK && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(hagar, refire)))
@@ -519,7 +519,7 @@ bool W_Hagar(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Hagar(int req)
+bool W_Hagar(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index a0408d6b9eb26d261f65ad80f93e1068564a795a..1f69bb5ce92248c2d0bf5b25f3db5ee0e34d8a49 100644 (file)
@@ -169,7 +169,7 @@ void W_HLAC_Attack_Frame(void)
 
        if(self.BUTTON_ATCK)
        {
-               if(!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+               if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -204,7 +204,7 @@ void W_HLAC_Attack2_Frame(void)
        }
 }
 
-bool W_HLAC(int req)
+bool W_HLAC(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -217,7 +217,7 @@ bool W_HLAC(int req)
                case WR_THINK:
                {
                        if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(self.BUTTON_ATCK)
                        {
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
@@ -279,7 +279,7 @@ bool W_HLAC(int req)
 }
 #endif
 #ifdef CSQC
-bool W_HLAC(int req)
+bool W_HLAC(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 03196daf6760cad6d0fa86ea6dfbc5db7b07296c..beeac392b913979668bd8c709f25213f49c24785 100644 (file)
@@ -51,7 +51,7 @@ void W_HeavyMachineGun_Attack_Auto()
                return;
        }
 
-       if(!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -86,7 +86,7 @@ void W_HeavyMachineGun_Attack_Auto()
        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
 }
 
-bool W_HeavyMachineGun(int req)
+bool W_HeavyMachineGun(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -103,7 +103,7 @@ bool W_HeavyMachineGun(int req)
                case WR_THINK:
                {
                        if(WEP_CVAR(hmg, reload_ammo) && self.clip_load < WEP_CVAR(hmg, ammo)) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
                                if (self.BUTTON_ATCK)
@@ -165,7 +165,7 @@ bool W_HeavyMachineGun(int req)
 }
 #endif
 #ifdef CSQC
-bool W_HeavyMachineGun(int req)
+bool W_HeavyMachineGun(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index af52ec15bb01c71601e5aeec50be58f4bdebfc55..65327f9c2dda238fcf45e7cbb22576b7bb9d6b8d 100644 (file)
@@ -174,7 +174,7 @@ void W_Hook_Attack2(void)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-bool W_Hook(int req)
+bool W_Hook(entity thiswep, int req)
 {SELFPARAM();
        float hooked_time_max, hooked_fuel;
 
@@ -331,7 +331,7 @@ bool W_Hook(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Hook(int req)
+bool W_Hook(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 6db6d1633d4f2ad295473b295206e02fc6a18d4c..be1781a94bd7b159306de52d832aaceee6273ec7 100644 (file)
@@ -144,7 +144,7 @@ void W_MachineGun_Attack_Frame(void)
        }
        if(self.BUTTON_ATCK)
        {
-               if(!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+               if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -170,7 +170,7 @@ void W_MachineGun_Attack_Auto(void)
                return;
        }
 
-       if(!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -236,7 +236,7 @@ void W_MachineGun_Attack_Burst(void)
 
 }
 
-bool W_MachineGun(int req)
+bool W_MachineGun(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -253,7 +253,7 @@ bool W_MachineGun(int req)
                case WR_THINK:
                {
                        if(WEP_CVAR(machinegun, reload_ammo) && self.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(WEP_CVAR(machinegun, mode) == 1)
                        {
                                if(self.BUTTON_ATCK)
@@ -266,7 +266,7 @@ bool W_MachineGun(int req)
                                if(self.BUTTON_ATCK2)
                                if(weapon_prepareattack(1, 0))
                                {
-                                       if(!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+                                       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -365,7 +365,7 @@ bool W_MachineGun(int req)
 }
 #endif
 #ifdef CSQC
-bool W_MachineGun(int req)
+bool W_MachineGun(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 05dde9852737836bf8b193944b2ffcc8947e89f0..ce2ea7d3551c748bff7e2893b28f3ab58c91641d 100644 (file)
@@ -123,7 +123,7 @@ void W_MineLayer_Explode(void)
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
-               if(!WEP_ACTION(WEP_MINE_LAYER.m_id, WR_CHECKAMMO1))
+               if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
@@ -148,7 +148,7 @@ void W_MineLayer_DoRemoteExplode(void)
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
-               if(!WEP_ACTION(WEP_MINE_LAYER.m_id, WR_CHECKAMMO1))
+               if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
@@ -397,7 +397,7 @@ float W_MineLayer_PlacedMines(float detonate)
        return minfound;
 }
 
-bool W_MineLayer(int req)
+bool W_MineLayer(entity thiswep, int req)
 {SELFPARAM();
        entity mine;
        float ammo_amount;
@@ -509,7 +509,7 @@ bool W_MineLayer(int req)
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
                                if(!(W_MineLayer_PlacedMines(false) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo)))
-                                       WEP_ACTION(self.weapon, WR_RELOAD);
+                                       _WEP_ACTION(self.weapon, WR_RELOAD);
                        }
                        else if(self.BUTTON_ATCK)
                        {
@@ -579,7 +579,7 @@ bool W_MineLayer(int req)
 }
 #endif
 #ifdef CSQC
-bool W_MineLayer(int req)
+bool W_MineLayer(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 665367fd78ad836ddc4408133455f0125c53b803..77cb4602030b67a6cc755d91d1db06890d13ee43 100644 (file)
@@ -294,7 +294,7 @@ void W_Mortar_Attack2(void)
 }
 
 .float bot_secondary_grenademooth;
-bool W_Mortar(int req)
+bool W_Mortar(entity thiswep, int req)
 {SELFPARAM();
        entity nade;
        float nadefound;
@@ -343,7 +343,7 @@ bool W_Mortar(int req)
                case WR_THINK:
                {
                        if(autocvar_g_balance_mortar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(self.BUTTON_ATCK)
                        {
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(mortar, refire)))
@@ -423,7 +423,7 @@ bool W_Mortar(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Mortar(int req)
+bool W_Mortar(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index d764286b705dd099154a55c2c9e286576fc636f2..7e8b282188316659c1f9eefa898131b7b586f429 100644 (file)
@@ -1,19 +1,20 @@
 #ifndef IMPLEMENTATION
-REGISTER_WEAPON(
-/* WEP_##id  */ PORTO,
-/* function  */ W_Porto,
-/* ammotype  */ ammo_none,
-/* impulse   */ 0,
-/* flags     */ WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON,
-/* rating    */ 0,
-/* color     */ '0.5 0.5 0.5',
-/* modelname */ "porto",
-/* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairporto 0.6",
-/* wepimg    */ "weaponporto",
-/* refname   */ "porto",
-/* wepname   */ _("Port-O-Launch")
-);
+CLASS(PortoLaunch, Weapon)
+/* ammotype  */ ATTRIB(PortoLaunch, ammo_field, .int, ammo_none)
+/* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0)
+/* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON);
+/* rating    */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0);
+/* color     */ ATTRIB(PortoLaunch, wpcolor, vector, '0.5 0.5 0.5');
+/* modelname */ ATTRIB(PortoLaunch, mdl, string, "porto");
+/* model     */ ATTRIB(PortoLaunch, model, string, strzone(W_Model(strcat("g_", this.mdl, ".md3"))));
+/* simplemdl */ ATTRIB(PortoLaunch, w_simplemdl, string, "foobar");
+/* crosshair */ ATTRIB(PortoLaunch, w_crosshair, string, "gfx/crosshairporto");
+/* crosshair */ ATTRIB(PortoLaunch, w_crosshair_size, float, 0.6);
+/* wepimg    */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
+/* refname   */ ATTRIB(PortoLaunch, netname, string, "porto");
+/* wepname   */ ATTRIB(PortoLaunch, message, string, _("Port-O-Launch"));
+ENDCLASS(PortoLaunch)
+REGISTER_WEAPON(PORTO, NEW(PortoLaunch));
 
 #define PORTO_SETTINGS(w_cvar,w_prop) PORTO_SETTINGS_LIST(w_cvar, w_prop, PORTO, porto)
 #define PORTO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
@@ -283,17 +284,9 @@ void W_Porto_Attack(float type)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-bool w_nexball_weapon(int req); // WEAPONTODO
-bool W_Porto(int req)
-{SELFPARAM();
-       //vector v_angle_save;
-
-       if(g_nexball) { return w_nexball_weapon(req); }
-
-       switch(req)
-       {
-               case WR_AIM:
+               METHOD(PortoLaunch, wr_aim, bool(entity thiswep))
                {
+                       SELFPARAM();
                        self.BUTTON_ATCK = false;
                        self.BUTTON_ATCK2 = false;
                        if(!WEP_CVAR(porto, secondary))
@@ -302,13 +295,14 @@ bool W_Porto(int req)
 
                        return true;
                }
-               case WR_CONFIG:
+               METHOD(PortoLaunch, wr_config, bool(entity this))
                {
                        PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
                        return true;
                }
-               case WR_THINK:
+               METHOD(PortoLaunch, wr_think, bool(entity thiswep))
                {
+                       SELFPARAM();
                        if(WEP_CVAR(porto, secondary))
                        {
                                if(self.BUTTON_ATCK)
@@ -365,53 +359,46 @@ bool W_Porto(int req)
 
                        return true;
                }
-               case WR_CHECKAMMO1:
-               case WR_CHECKAMMO2:
+               METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
                {
                        // always allow infinite ammo
                        return true;
                }
-               case WR_INIT:
+               METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
+               {
+                       // always allow infinite ammo
+                       return true;
+               }
+               METHOD(PortoLaunch, wr_init, bool(entity this))
                {
                        PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                        return true;
                }
-               case WR_SETUP:
+               METHOD(PortoLaunch, wr_setup, bool(entity thiswep))
                {
+                       SELFPARAM();
                        self.ammo_field = ammo_none;
                        return true;
                }
-               case WR_RESETPLAYER:
+               METHOD(PortoLaunch, wr_resetplayer, bool(entity thiswep))
                {
+                       SELFPARAM();
                        self.porto_current = world;
                        return true;
                }
-       }
-       return false;
-}
 #endif
 #ifdef CSQC
-bool W_Porto(int req)
-{SELFPARAM();
-       switch(req)
-       {
-               case WR_IMPACTEFFECT:
-               {
-                       LOG_INFO("Since when does Porto send DamageInfo?\n");
+               METHOD(PortoLaunch, wr_impacteffect, bool(entity this)) {
+                       LOG_WARNING("Since when does Porto send DamageInfo?\n");
                        return true;
                }
-               case WR_INIT:
-               {
+               METHOD(PortoLaunch, wr_init, bool(entity this)) {
                        // nothing to do
                        return true;
                }
-               case WR_ZOOMRETICLE:
-               {
+               METHOD(PortoLaunch, wr_zoomreticle, bool(entity this)) {
                        // no weapon specific image for this weapon
                        return false;
                }
-       }
-       return false;
-}
 #endif
 #endif
index 6d4a58f272d123ea7abba15e306fda9af89e1c73..a6f2649516e127f1fc9c9cc0da4955df8a8930c8 100644 (file)
@@ -134,7 +134,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
 }
 
 .float bot_secondary_riflemooth;
-bool W_Rifle(int req)
+bool W_Rifle(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
 
@@ -168,7 +168,7 @@ bool W_Rifle(int req)
                case WR_THINK:
                {
                        if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
                                self.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), self.rifle_accumulator, time);
@@ -185,7 +185,7 @@ bool W_Rifle(int req)
                                        if(WEP_CVAR(rifle, secondary))
                                        {
                                                if(WEP_CVAR_SEC(rifle, reload))
-                                                       WEP_ACTION(self.weapon, WR_RELOAD);
+                                                       _WEP_ACTION(self.weapon, WR_RELOAD);
                                                else
                                                {
                                                        if(weapon_prepareattack_check(1, WEP_CVAR_SEC(rifle, refire)))
@@ -260,7 +260,7 @@ bool W_Rifle(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Rifle(int req)
+bool W_Rifle(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 5fe7552ccb60fdd6c2620b2d2609f6b789c8086c..a91280874865c9df217e638c29a00ce0aff2c5dd 100644 (file)
@@ -147,7 +147,7 @@ void W_RocketPropelledChainsaw_Attack (void)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-bool W_RocketPropelledChainsaw(int req)
+bool W_RocketPropelledChainsaw(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount = false;
        switch(req)
@@ -160,7 +160,7 @@ bool W_RocketPropelledChainsaw(int req)
                case WR_THINK:
                {
                        if(WEP_CVAR(rpc, reload_ammo) && self.clip_load < WEP_CVAR(rpc, ammo))
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
                                if (self.BUTTON_ATCK)
@@ -228,7 +228,7 @@ bool W_RocketPropelledChainsaw(int req)
 #endif
 
 #ifdef CSQC
-bool W_RocketPropelledChainsaw(int req)
+bool W_RocketPropelledChainsaw(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index b79bb081e25e76a26fc98b2e2ed6e4459e54b823..a81b460d54271c6c981bd72d141d142a9823b53b 100644 (file)
@@ -596,7 +596,7 @@ void W_Seeker_Fire_Tag(void)
 // Begin: Genereal weapon functions
 // ============================
 
-bool W_Seeker(int req)
+bool W_Seeker(entity thiswep, int req)
 {SELFPARAM();
        float ammo_amount;
 
@@ -616,7 +616,7 @@ bool W_Seeker(int req)
                case WR_THINK:
                {
                        if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
 
                        else if(self.BUTTON_ATCK)
                        {
@@ -719,7 +719,7 @@ bool W_Seeker(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Seeker(int req)
+bool W_Seeker(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 0ef52fbd9d69051b328ab0b4008c8802f8329af6..ec91b17b3b23c03a9e0c8c33473b3ead091d69c5 100644 (file)
@@ -666,7 +666,7 @@ void W_Shockwave_Attack(void)
        }
 }
 
-bool W_Shockwave(int req)
+bool W_Shockwave(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
@@ -858,7 +858,7 @@ void Net_ReadShockwaveParticle(void)
        shockwave.sw_time = time;
 }
 
-bool W_Shockwave(int req)
+bool W_Shockwave(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index 9a8d9d0db706e1453573151d895aa10acd7c1081..1de326384c716a8ff6969f00429302bac0a9596e 100644 (file)
@@ -195,7 +195,7 @@ void W_Shotgun_Attack2(void)
 // alternate secondary weapon frames
 void W_Shotgun_Attack3_Frame2()
 {SELFPARAM();
-       if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -209,7 +209,7 @@ void W_Shotgun_Attack3_Frame2()
 }
 void W_Shotgun_Attack3_Frame1()
 {SELFPARAM();
-       if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -223,7 +223,7 @@ void W_Shotgun_Attack3_Frame1()
 
 .float shotgun_primarytime;
 
-float W_Shotgun(float req)
+float W_Shotgun(entity thiswep, float req)
 {SELFPARAM();
        float ammo_amount;
        switch(req)
@@ -243,7 +243,7 @@ float W_Shotgun(float req)
                        {
                                // don't force reload an empty shotgun if its melee attack is active
                                if(WEP_CVAR(shotgun, secondary) < 2)
-                                       WEP_ACTION(self.weapon, WR_RELOAD);
+                                       _WEP_ACTION(self.weapon, WR_RELOAD);
                        }
                        else
                        {
@@ -344,7 +344,7 @@ float W_Shotgun(float req)
 #endif
 #ifdef CSQC
 .float prevric;
-float W_Shotgun(float req)
+float W_Shotgun(entity thiswep, float req)
 {SELFPARAM();
        switch(req)
        {
index 20100bf39f0db4694419540ce41262f82fc9ae7c..2d88f3d2c3e4e3a1b6f9bf2a68cec50745f37ed8 100644 (file)
@@ -365,7 +365,7 @@ void W_Tuba_NoteOn(float hittype)
        }
 }
 
-bool W_Tuba(int req)
+bool W_Tuba(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
@@ -481,7 +481,7 @@ bool W_Tuba(int req)
 }
 #endif
 #ifdef CSQC
-bool W_Tuba(int req)
+bool W_Tuba(entity thiswep, int req)
 {SELFPARAM();
        // nothing to do here; particles of tuba are handled differently
        // WEAPONTODO
index d27f99180f2b0964a840944fd6af12dd8622ddb5..8bf5f06ee099d6c1ae4bbd6384c42943d59b1ccf 100644 (file)
@@ -235,7 +235,7 @@ void W_RocketMinsta_Attack3 (void)
     }
 }
 
-float W_Vaporizer(float req)
+float W_Vaporizer(entity thiswep, float req)
 {SELFPARAM();
        float ammo_amount;
        float vaporizer_ammo;
@@ -259,9 +259,9 @@ float W_Vaporizer(float req)
                {
                        // if the laser uses load, we also consider its ammo for reloading
                        if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
                        {
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
@@ -387,7 +387,7 @@ float W_Vaporizer(float req)
 }
 #endif
 #ifdef CSQC
-float W_Vaporizer(float req)
+float W_Vaporizer(entity thiswep, float req)
 {SELFPARAM();
        switch(req)
        {
index 8584b8ab91147db1932d3648ff354e22e685348d..6f2b7012eba1aee6c94447459d2bac0a2cbe284f 100644 (file)
@@ -132,7 +132,7 @@ void W_Vortex_Attack(float issecondary)
 void spawnfunc_weapon_vortex(void); // defined in t_items.qc
 
 .float vortex_chargepool_pauseregen_finished;
-bool W_Vortex(int req)
+bool W_Vortex(entity thiswep, int req)
 {SELFPARAM();
        float dt;
        float ammo_amount;
@@ -163,7 +163,7 @@ bool W_Vortex(int req)
                                }
 
                        if(autocvar_g_balance_vortex_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) // forced reload
-                               WEP_ACTION(self.weapon, WR_RELOAD);
+                               _WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
                                if(self.BUTTON_ATCK)
@@ -310,7 +310,7 @@ bool W_Vortex(int req)
 #endif
 #ifdef CSQC
 float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
-bool W_Vortex(int req)
+bool W_Vortex(entity thiswep, int req)
 {SELFPARAM();
        switch(req)
        {
index fcf209faca6ddbdb2e7e7ea44c4ee407dea503af..83677a24c5977852730998b72812067031c8e015 100644 (file)
@@ -416,22 +416,8 @@ float autocvar_g_multijump_speed;
 float autocvar_g_multijump_maxspeed;
 float autocvar_g_multijump_dodging = 1;
 string autocvar_g_mutatormsg;
-float autocvar_g_nexball_basketball_bouncefactor;
-float autocvar_g_nexball_basketball_bouncestop;
-float autocvar_g_nexball_basketball_carrier_highspeed;
-bool autocvar_g_nexball_basketball_meter;
-float autocvar_g_nexball_basketball_meter_maxpower;
-float autocvar_g_nexball_basketball_meter_minpower;
-float autocvar_g_nexball_delay_collect;
-float autocvar_g_nexball_delay_goal;
-float autocvar_g_nexball_delay_start;
-float autocvar_g_nexball_football_bouncefactor;
-float autocvar_g_nexball_football_bouncestop;
 int autocvar_g_nexball_goalleadlimit;
 #define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit")
-bool autocvar_g_nexball_radar_showallplayers;
-bool autocvar_g_nexball_sound_bounce;
-int autocvar_g_nexball_trail_color;
 //float autocvar_g_nick_flood_penalty;
 int autocvar_g_nick_flood_penalty_red;
 int autocvar_g_nick_flood_penalty_yellow;
index 7a3ac0561af3c6ec66917479cad1b6a2ab1756de..4f7f7fb8ecad12b386a23eab720679fd4226d69d 100644 (file)
@@ -102,7 +102,7 @@ void havocbot_ai()
 
                if(self.weapons)
                {
-                       WEP_ACTION(self.weapon, WR_AIM);
+                       _WEP_ACTION(self.weapon, WR_AIM);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
                                self.BUTTON_ATCK = false;
@@ -963,7 +963,7 @@ float havocbot_chooseweapon_checkreload(int new_weapon)
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
                        // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
-                       if (WEP_ACTION(i, WR_CHECKAMMO1) + WEP_ACTION(i, WR_CHECKAMMO2))
+                       if (_WEP_ACTION(i, WR_CHECKAMMO1) + _WEP_ACTION(i, WR_CHECKAMMO2))
                                other_weapon_available = true;
                }
                if(other_weapon_available)
index b31d4d55666dc747c5bd8f24126874ce1f872f0a..4afd34e7ccef7cbde855f98d014be20db686cdad 100644 (file)
@@ -619,7 +619,7 @@ void PutClientInServer()
                // reset fields the weapons may use
                for (int j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       WEP_ACTION(j, WR_RESETPLAYER);
+                       _WEP_ACTION(j, WR_RESETPLAYER);
 
                        // all weapons must be fully loaded when we spawn
                        entity e = get_weaponinfo(j);
index bc71664b72ce80bc1de31b39d1a301de0a8f548a..823f2a6652005ca493c695d265d45a1db7bea7c9 100644 (file)
@@ -134,7 +134,7 @@ void ImpulseCommands (void)
                                        W_PreviousWeapon(1);
                                        break;
                                case 20:
-                                       if(!forbidWeaponUse(self)) { WEP_ACTION(self.weapon, WR_RELOAD); }
+                                       if(!forbidWeaponUse(self)) { _WEP_ACTION(self.weapon, WR_RELOAD); }
                                        break;
                        }
                }
index 182c3304111966ef15918f978c652ea16e12c002..db6893d36e20a07938a279d60ac285f05594dd92 100644 (file)
@@ -548,7 +548,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
                excess = frag_damage;
 
-               WEP_ACTION(self.weapon, WR_PLAYERDEATH);
+               _WEP_ACTION(self.weapon, WR_PLAYERDEATH);
 
                RemoveGrapplingHook(self);
 
@@ -630,7 +630,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                // reset fields the weapons may use just in case
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       WEP_ACTION(j, WR_RESETPLAYER);
+                       _WEP_ACTION(j, WR_RESETPLAYER);
                        ATTACK_FINISHED_FOR(self, j) = 0;
                }
        }
index 02e80845b778c91fb58ed24b1f4ab26674cb39ef..a165f9d440042c6aca7aee62cb388e3e2433a8a4 100644 (file)
@@ -164,7 +164,7 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 
 // WEAPONTODO
 .float autoswitch;
-//float WEP_ACTION(float wpn, float wrequest);
+//float _WEP_ACTION(float wpn, float wrequest);
 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
 void w_clear();
 void w_ready();
index b5d87eed172cb27eafd02cec6d4af64a6dfd440e..76e69865a7edf593bf67fb92ca81ddd5ad2fd5ee 100644 (file)
@@ -265,7 +265,7 @@ float Obituary_WeaponDeath(
        if(death_weapon)
        {
                w_deathtype = deathtype;
-               int death_message = WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
+               int death_message = _WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
                w_deathtype = false;
 
                if (death_message)
index 779ec90c9932e921265729ad0053863d710a7cf8..c101d7271e3cc5bd4d2be16c30a4ce15f237c3fc 100644 (file)
@@ -522,7 +522,7 @@ void GrappleHookInit()
        }
        else
        {
-               WEP_ACTION(WEP_HOOK.m_id, WR_INIT);
+               WEP_ACTION(WEP_HOOK, WR_INIT);
                hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 1);
                hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 2);
                hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 3);
index bcba19e30ab170e7223e2f0ac11629dcbaceac46..9cf9d0c2c2e7adda6b0cf7cbba3a4a5b5cabb329 100644 (file)
@@ -720,7 +720,7 @@ void readplayerstartcvars()
        {
                e = get_weaponinfo(i);
                if(precache_weapons & WepSet_FromWeapon(i))
-                       WEP_ACTION(i, WR_INIT);
+                       _WEP_ACTION(i, WR_INIT);
        }
 
        start_ammo_shells = max(0, start_ammo_shells);
index 37e9073f3d084b97ea9f39e247c082cc7a468084..6148ee8fdc9c493148d369449ad2b38972128a82 100644 (file)
@@ -421,7 +421,7 @@ void readlevelcvars(void)
                game_starttime = time + cvar("g_start_delay");
 
        for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
-               WEP_ACTION(i, WR_INIT);
+               _WEP_ACTION(i, WR_INIT);
 
        readplayerstartcvars();
 }
index a318748fda952e97f28aebe85c4b9977e82a8a22..10690001d49dd2dfa2aa20c63fef302ea931ec2b 100644 (file)
@@ -3,6 +3,21 @@
 
 #include "gamemode.qh"
 
+float autocvar_g_nexball_basketball_bouncefactor;
+float autocvar_g_nexball_basketball_bouncestop;
+float autocvar_g_nexball_basketball_carrier_highspeed;
+bool autocvar_g_nexball_basketball_meter;
+float autocvar_g_nexball_basketball_meter_maxpower;
+float autocvar_g_nexball_basketball_meter_minpower;
+float autocvar_g_nexball_delay_collect;
+float autocvar_g_nexball_delay_goal;
+float autocvar_g_nexball_delay_start;
+float autocvar_g_nexball_football_bouncefactor;
+float autocvar_g_nexball_football_bouncestop;
+bool autocvar_g_nexball_radar_showallplayers;
+bool autocvar_g_nexball_sound_bounce;
+int autocvar_g_nexball_trail_color;
+
 float autocvar_g_nexball_safepass_turnrate;
 float autocvar_g_nexball_safepass_maxdist;
 float autocvar_g_nexball_safepass_holdtime;
@@ -153,11 +168,11 @@ void GiveBall(entity plyr, entity ball)
 
        plyr.weaponentity.weapons = plyr.weapons;
        plyr.weaponentity.switchweapon = plyr.weapon;
-       plyr.weapons = WEPSET_PORTO;
+       plyr.weapons = WEPSET_NEXBALL;
        setself(plyr);
-       WEP_ACTION(WEP_PORTO.m_id, WR_RESETPLAYER);
-       plyr.switchweapon = WEP_PORTO.m_id;
-       W_SwitchWeapon(WEP_PORTO.m_id);
+       WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
+       plyr.switchweapon = WEP_NEXBALL.m_id;
+       W_SwitchWeapon(WEP_NEXBALL.m_id);
        setself(this);
 }
 
@@ -826,6 +841,11 @@ float ball_customize()
        return true;
 }
 
+float w_nexball_weapon(float req);
+METHOD(BallStealer, weapon_func, bool(entity this, int req)) {
+       return w_nexball_weapon(req);
+}
+
 float w_nexball_weapon(float req)
 {SELFPARAM();
        if(req == WR_THINK)
@@ -926,7 +946,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
                        if(self.weaponentity.weapons)
                        {
                                self.weapons = self.weaponentity.weapons;
-                               WEP_ACTION(WEP_PORTO.m_id, WR_RESETPLAYER);
+                               WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
                                self.switchweapon = self.weaponentity.switchweapon;
                                W_SwitchWeapon(self.switchweapon);
 
@@ -946,7 +966,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
        self.weaponentity.weapons = '0 0 0';
 
        if(nexball_mode & NBM_BASKETBALL)
-               self.weapons |= WEPSET_PORTO;
+               self.weapons |= WEPSET_NEXBALL;
        else
                self.weapons = '0 0 0';
 
@@ -963,13 +983,6 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
-{
-       start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
-
-       return false;
-}
-
 MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
 {SELFPARAM();
        if(self.weapon == WEP_MORTAR.m_id)
@@ -995,7 +1008,6 @@ MUTATOR_DEFINITION(gamemode_nexball)
        MUTATOR_HOOK(PlayerSpawn, nexball_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPreThink, nexball_PlayerPreThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPhysics, nexball_PlayerPhysics, CBC_ORDER_ANY);
-       MUTATOR_HOOK(SetStartItems, nexball_SetStartItems, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, nexball_ForbidThrowing, CBC_ORDER_ANY);
        MUTATOR_HOOK(FilterItem, nexball_FilterItem, CBC_ORDER_ANY);
 
diff --git a/qcsrc/server/mutators/gamemode_nexball_weapon.qc b/qcsrc/server/mutators/gamemode_nexball_weapon.qc
new file mode 100644 (file)
index 0000000..a8822f8
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef IMPLEMENTATION
+
+CLASS(BallStealer, PortoLaunch)
+/* flags     */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(BallStealer, impulse, int, 2);
+/* refname   */ ATTRIB(BallStealer, netname, string, "ballstealer");
+/* wepname   */ ATTRIB(BallStealer, message, string, _("Ball Stealer"));
+ENDCLASS(BallStealer)
+REGISTER_WEAPON(NEXBALL, NEW(BallStealer));
+
+#endif
index 8cf0118d4e428465befc4f810012246f5b700b15..93864b18445790047df2585b0d2bac3cf7f55418 100644 (file)
@@ -60,7 +60,7 @@ void NIX_GiveCurrentWeapon()
                        nix_nextchange = time; // start the first round now!
                else
                        nix_nextchange = time + autocvar_g_balance_nix_roundtime;
-               //WEP_ACTION(nix_weapon, WR_INIT); // forget it, too slow
+               //_WEP_ACTION(nix_weapon, WR_INIT); // forget it, too slow
        }
 
        // get weapon info
@@ -101,7 +101,7 @@ void NIX_GiveCurrentWeapon()
                else
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               WEP_ACTION(nix_weapon, WR_RESETPLAYER);
+               _WEP_ACTION(nix_weapon, WR_RESETPLAYER);
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
@@ -156,7 +156,7 @@ void NIX_precache()
        float i;
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
                if (NIX_CanChooseWeapon(i))
-                       WEP_ACTION(i, WR_INIT);
+                       _WEP_ACTION(i, WR_INIT);
 }
 
 MUTATOR_HOOKFUNCTION(nix_ForbidThrowCurrentWeapon)
index 7d3e59836b9ebb80f85769d2de5a45130942d5d5..c921502cf390f442b5cdf618c34585e1389afa64 100644 (file)
@@ -1445,7 +1445,7 @@ void spawnfunc_target_items (void)
                                        {
                                                self.weapons |= WepSet_FromWeapon(j);
                                                if(self.spawnflags == 0 || self.spawnflags == 2)
-                                                       WEP_ACTION(e.weapon, WR_INIT);
+                                                       _WEP_ACTION(e.weapon, WR_INIT);
                                                break;
                                        }
                                }
@@ -1515,7 +1515,7 @@ void spawnfunc_target_items (void)
                        e = get_weaponinfo(j);
                        if(argv(i) == e.netname)
                        {
-                               WEP_ACTION(e.weapon, WR_INIT);
+                               _WEP_ACTION(e.weapon, WR_INIT);
                                break;
                        }
                }
@@ -1829,7 +1829,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                        POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null);
                        if (!(save_weapons & WepSet_FromWeapon(j)))
                                if(e.weapons & WepSet_FromWeapon(j))
-                                       WEP_ACTION(wi.weapon, WR_INIT);
+                                       _WEP_ACTION(wi.weapon, WR_INIT);
                }
        }
        POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));
index ce464c18e49252562f12f5b2b17e8dcd0716a9dc..f145799c1ac416cdda140db0626685dbb572431b 100644 (file)
@@ -47,8 +47,8 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                        else
                        {
                                setself(cl);
-                               f = WEP_ACTION(wpn, WR_CHECKAMMO1);
-                               f = f + WEP_ACTION(wpn, WR_CHECKAMMO2);
+                               f = _WEP_ACTION(wpn, WR_CHECKAMMO1);
+                               f = f + _WEP_ACTION(wpn, WR_CHECKAMMO2);
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                entity mine;
@@ -260,7 +260,7 @@ void W_SwitchWeapon(float imp)
                else
                        self.selectweapon = imp; // update selectweapon ANYWAY
        }
-       else if(!forbidWeaponUse(self)) { WEP_ACTION(self.weapon, WR_RELOAD); }
+       else if(!forbidWeaponUse(self)) { _WEP_ACTION(self.weapon, WR_RELOAD); }
 }
 
 void W_CycleWeapon(string weaponorder, float dir)
index 81261383f5f061b3aeeb001fb4e2e0c1bd7a2179..4fb84744c9a9264b12f8e96625a479f6cdaee467 100644 (file)
@@ -181,6 +181,6 @@ void weapon_defaultspawnfunc(float wpn)
        self.item_pickupsound_ent = SND_WEAPONPICKUP;
        #if 0 // WEAPONTODO
        if (self.modelindex) // don't precache if self was removed
-               WEP_ACTION(e.weapon, WR_INIT);
+               _WEP_ACTION(e.weapon, WR_INIT);
        #endif
 }
index ba33c515ffea422da230ed8648cb308279ab1bf2..d26a6102f6c3de89c7a4b76ee7c9cda60fa3f105 100644 (file)
@@ -460,7 +460,7 @@ void w_ready()
 float weapon_prepareattack_checkammo(float secondary)
 {SELFPARAM();
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
-       if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary))
+       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary))
        {
                // always keep the Mine Layer if we placed mines, so that we can detonate them
                entity mine;
@@ -478,7 +478,7 @@ float weapon_prepareattack_checkammo(float secondary)
                        self.prevdryfire = time;
                }
 
-               if(WEP_ACTION(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo
+               if(_WEP_ACTION(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo
                {
                        if(time - self.prevwarntime > 1)
                        {
@@ -702,7 +702,7 @@ void W_WeaponFrame()
                        self.weaponname = newwep.mdl;
                        self.bulletcounter = 0;
                        self.ammo_field = newwep.ammo_field;
-                       WEP_ACTION(self.switchweapon, WR_SETUP);
+                       _WEP_ACTION(self.switchweapon, WR_SETUP);
                        self.weaponentity.state = WS_RAISE;
 
                        // set our clip load to the load of the weapon we switched to, if it's reloadable
@@ -768,9 +768,9 @@ void W_WeaponFrame()
                v_up = up;
 
                if(w)
-                       WEP_ACTION(self.weapon, WR_THINK);
+                       _WEP_ACTION(self.weapon, WR_THINK);
                else
-                       WEP_ACTION(self.weapon, WR_GONETHINK);
+                       _WEP_ACTION(self.weapon, WR_GONETHINK);
 
                if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
                {
@@ -932,7 +932,7 @@ void W_Reload(float sent_ammo_min, string sent_sound)
                        self.reload_complain = time + 1;
                }
                // switch away if the amount of ammo is not enough to keep using this weapon
-               if (!(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
+               if (!(_WEP_ACTION(self.weapon, WR_CHECKAMMO1) + _WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
                {
                        self.clip_load = -1; // reload later
                        W_SwitchToOtherWeapon(self);
@@ -971,6 +971,6 @@ void W_DropEvent(float event, entity player, float weapon_type, entity weapon_it
 {SELFPARAM();
        setself(player);
        weapon_dropevent_item = weapon_item;
-       WEP_ACTION(weapon_type, event);
+       _WEP_ACTION(weapon_type, event);
        setself(this);
 }
diff --git a/weapons.cfg b/weapons.cfg
deleted file mode 100644 (file)
index eb768df..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-alias weapon_blaster "impulse 230"
-alias weapon_shotgun "impulse 231"
-alias weapon_machinegun "impulse 232"
-alias weapon_mortar "impulse 233"
-alias weapon_minelayer "impulse 234"
-alias weapon_electro "impulse 235"
-alias weapon_crylink "impulse 236"
-alias weapon_vortex "impulse 237"
-alias weapon_hagar "impulse 238"
-alias weapon_devastator "impulse 239"
-alias weapon_porto "impulse 240"
-alias weapon_vaporizer "impulse 241"
-alias weapon_hook "impulse 242"
-alias weapon_hlac "impulse 243"
-alias weapon_tuba "impulse 244"
-alias weapon_rifle "impulse 245"
-alias weapon_fireball "impulse 246"
-alias weapon_seeker "impulse 247"
-alias weapon_shockwave "impulse 248"
-alias weapon_arc "impulse 249"
-
-// Backwards compatibility with 0.7.0
-alias weapon_laser "weapon_blaster"
-alias weapon_uzi "weapon_machinegun"
-alias weapon_grenadelauncher "weapon_mortar"
-alias weapon_nex "weapon_vortex"
-alias weapon_rocketlauncher "weapon_devastator"
-alias weapon_minstanex "weapon_vaporizer"