]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add header files for the newly split up code files
authorSamual Lenks <samual@xonotic.org>
Mon, 1 Jul 2013 22:14:43 +0000 (18:14 -0400)
committerSamual Lenks <samual@xonotic.org>
Mon, 1 Jul 2013 22:14:43 +0000 (18:14 -0400)
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh [new file with mode: 0644]
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh [new file with mode: 0644]
qcsrc/server/weapons/spawning.qh [new file with mode: 0644]
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh [new file with mode: 0644]
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh [new file with mode: 0644]
qcsrc/server/weapons/weaponsystem.qc

index 936b954cad252d2308bde9a2c0fe433d0ab3d451..98fd533535fe129d04202c310711e4321cc56891 100644 (file)
@@ -17,6 +17,18 @@ void W_GiveWeapon (entity e, float wep)
        self = oldself;
 }
 
+void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
+{
+       if((player.items & IT_STRENGTH)
+               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+               {
+                       sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM);
+                       player.prevstrengthsound = time;
+               }
+               player.prevstrengthsoundattempt = time;
+}
+
 float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception)
 {
        float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA);
diff --git a/qcsrc/server/weapons/common.qh b/qcsrc/server/weapons/common.qh
new file mode 100644 (file)
index 0000000..8f9454e
--- /dev/null
@@ -0,0 +1,7 @@
+
+void W_GiveWeapon (entity e, float wep);
+.float prevstrengthsound;
+.float prevstrengthsoundattempt;
+void W_PlayStrengthSound(entity player);
+float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception);
+void W_PrepareExplosionByDamage(entity attacker, void() explode);
index b8e08050e3efed2f6dddcc23625a2d211672a937..837350229eaf417c841c99b5afce432b3dab9981 100644 (file)
@@ -9,7 +9,6 @@ void Send_WeaponComplain(entity e, float wpn, string wpnname, float type)
        WriteByte(MSG_ONE, type);
 }
 
-.float hasweapon_complain_spam;
 float client_hasweapon(entity cl, float wpn, float andammo, float complain)
 {
        float f;
@@ -106,7 +105,6 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
        return FALSE;
 }
 
-.float weaponcomplainindex;
 float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
 {
        // We cannot tokenize in this function, as GiveItems calls this
@@ -186,8 +184,6 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        return 0;
 }
 
-#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, FALSE, TRUE)
-
 void W_SwitchWeapon_Force(entity e, float w)
 {
        e.cnt = e.switchweapon;
diff --git a/qcsrc/server/weapons/selection.qh b/qcsrc/server/weapons/selection.qh
new file mode 100644 (file)
index 0000000..17310eb
--- /dev/null
@@ -0,0 +1,29 @@
+// switch between weapons
+void Send_WeaponComplain(entity e, float wpn, string wpnname, float type);
+
+.float hasweapon_complain_spam;
+float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+
+.float weaponcomplainindex;
+float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing);
+
+#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, FALSE, TRUE)
+
+void W_SwitchWeapon_Force(entity e, float w);
+
+// perform weapon to attack (weaponstate and attack_finished check is here)
+void W_SwitchToOtherWeapon(entity pl);
+void W_SwitchWeapon(float imp);
+
+void W_CycleWeapon(string weaponorder, float dir);
+
+void W_NextWeaponOnImpulse(float imp);
+
+// next weapon
+void W_NextWeapon(float list);
+
+// prev weapon
+void W_PreviousWeapon(float list);
+
+// previously used if exists and has ammo, (second) best otherwise
+void W_LastWeapon(void);
diff --git a/qcsrc/server/weapons/spawning.qh b/qcsrc/server/weapons/spawning.qh
new file mode 100644 (file)
index 0000000..c6939e5
--- /dev/null
@@ -0,0 +1,3 @@
+string W_Apply_Weaponreplace(string in);
+
+void weapon_defaultspawnfunc(float wpn);
index c5e21f2f445ea1cd1e3485fc538983a9d7d4dd05..31c8f89be8b347ec5d0f62ef26f2a8b8c5c2912b 100644 (file)
@@ -1,4 +1,3 @@
-.float savenextthink;
 void thrown_wep_think()
 {
        self.owner = world;
diff --git a/qcsrc/server/weapons/throwing.qh b/qcsrc/server/weapons/throwing.qh
new file mode 100644 (file)
index 0000000..9dd70a6
--- /dev/null
@@ -0,0 +1,10 @@
+.float savenextthink;
+void thrown_wep_think();
+
+// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
+string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
+
+float W_IsWeaponThrowable(float w);
+
+// toss current weapon
+void W_ThrowWeapon(vector velo, vector delta, float doreduce);
index e946636c4bd7e8a0249b9905737d3442c633efba..50dcd532fb26fee30c15a8a7c45d0a2c5003154b 100644 (file)
@@ -1,9 +1,3 @@
-.float antilag_debug;
-
-vector w_shotorg;
-vector w_shotdir;
-vector w_shotend;
-
 // this function calculates w_shotorg and w_shotdir based on the weapon model
 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
 // make sure you call makevectors first (FIXME?)
@@ -123,12 +117,6 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        w_shotend = w_shotend + normalize(w_shotend - w_shotorg) * nudge;
 }
 
-#define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
-#define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
-#define W_SetupShot_Dir(ent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
-#define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
-#define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
-
 vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute)
 {
        vector mdirection;
@@ -178,21 +166,16 @@ void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float
        missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, pSpeed * dir, forceAbsolute);
 }
 
-void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
+void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) // WEAPONTODO
 {
        W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread, FALSE);
 }
 
-#define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"), FALSE)
-#define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"), FALSE)
-
 
 // ====================
 //  Ballistics Tracing
 // ====================
 
-.float railgundistance;
-.vector railgunforce;
 void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype)
 {
        vector hitloc, force, endpoint, dir;
@@ -336,10 +319,6 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        trace_dphitq3surfaceflags = endq3surfaceflags;
 }
 
-.float dmg_force;
-.float dmg_radius;
-.float dmg_total;
-//.float last_yoda;
 void W_BallisticBullet_Hit (void)
 {
        float f, q, g;
@@ -379,11 +358,6 @@ void W_BallisticBullet_Hit (void)
        self.enemy = other; // don't hit the same player twice with the same bullet
 }
 
-.void(void) W_BallisticBullet_LeaveSolid_think_save;
-.float W_BallisticBullet_LeaveSolid_nextthink_save;
-.vector W_BallisticBullet_LeaveSolid_origin;
-.vector W_BallisticBullet_LeaveSolid_velocity;
-
 void W_BallisticBullet_LeaveSolid_think()
 {
        setorigin(self, self.W_BallisticBullet_LeaveSolid_origin);
@@ -545,13 +519,11 @@ void W_BallisticBullet_Touch (void)
        self.projectiledeathtype |= HITTYPE_BOUNCE;
 }
 
-void endFireBallisticBullet()
+void endFireBallisticBullet() // WEAPONTODO
 {
        endzcurveparticles();
 }
 
-entity fireBallisticBullet_trace_callback_ent;
-float fireBallisticBullet_trace_callback_eff;
 void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
 {
        if(vlen(trace_endpos - fireBallisticBullet_trace_callback_ent.origin) > 16)
diff --git a/qcsrc/server/weapons/tracing.qh b/qcsrc/server/weapons/tracing.qh
new file mode 100644 (file)
index 0000000..4dda934
--- /dev/null
@@ -0,0 +1,72 @@
+.float antilag_debug;
+
+vector w_shotorg;
+vector w_shotdir;
+vector w_shotend;
+
+// this function calculates w_shotorg and w_shotdir based on the weapon model
+// offset, trueaim and antilag, and won't put w_shotorg inside a wall.
+// make sure you call makevectors first (FIXME?)
+void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range);
+
+#define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
+#define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
+#define W_SetupShot_Dir(ent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
+#define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
+#define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
+
+vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute);
+
+#if 0
+float mspercallsum;
+float mspercallsstyle;
+float mspercallcount;
+#endif
+void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
+
+void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread); /* WEAPONTODO
+{
+       W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread, FALSE);
+}*/
+
+#define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"), FALSE)
+#define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"), FALSE)
+
+
+// ====================
+//  Ballistics Tracing
+// ====================
+
+.float railgundistance;
+.vector railgunforce;
+void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype);
+
+.float dmg_force;
+.float dmg_radius;
+.float dmg_total;
+//.float last_yoda;
+void W_BallisticBullet_Hit (void);
+
+.void(void) W_BallisticBullet_LeaveSolid_think_save;
+.float W_BallisticBullet_LeaveSolid_nextthink_save;
+.vector W_BallisticBullet_LeaveSolid_origin;
+.vector W_BallisticBullet_LeaveSolid_velocity;
+
+void W_BallisticBullet_LeaveSolid_think();
+
+float W_BallisticBullet_LeaveSolid(float eff);
+
+void W_BallisticBullet_Touch (void);
+
+void endFireBallisticBullet(); /* WEAPONTODO
+{
+       endzcurveparticles();
+}*/
+
+entity fireBallisticBullet_trace_callback_ent;
+float fireBallisticBullet_trace_callback_eff;
+void fireBallisticBullet_trace_callback(vector start, vector hit, vector end);
+
+void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant);
+
+void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer);
index 70588b29d81413edbb8ee9df1d429332773ef9d9..23441cbee787ce5e8e017c976632435e9fe2d858 100644 (file)
@@ -27,20 +27,6 @@ float WFRAME_RELOAD = 3;
 
 void(float fr, float t, void() func) weapon_thinkf;
 
-.float prevstrengthsound;
-.float prevstrengthsoundattempt;
-void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
-{
-       if((player.items & IT_STRENGTH)
-               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
-               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
-               {
-                       sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM);
-                       player.prevstrengthsound = time;
-               }
-               player.prevstrengthsoundattempt = time;
-}
-
 float CL_Weaponentity_CustomizeEntityForClient()
 {
        self.viewmodelforclient = self.owner;