Merge branch 'fruitiex/fruitbalance' of ssh://git.xonotic.org/xonotic-data.pk3dir...
authorFruitieX <rasse@rasse-lappy.localdomain>
Wed, 21 Jul 2010 11:15:20 +0000 (14:15 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Wed, 21 Jul 2010 11:15:20 +0000 (14:15 +0300)
17 files changed:
balance.cfg
balance25.cfg
balanceFruit.cfg
balanceSamual.cfg
balanceXPM.cfg
particles/gauntletbeam.tga [new file with mode: 0644]
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/hook.qc
qcsrc/server/cl_client.qc
qcsrc/server/g_world.qc
qcsrc/server/progs.src
qcsrc/server/w_electro.qc
qcsrc/server/w_laser.qc
qcsrc/server/w_laser.qh [new file with mode: 0644]
sound/weapons/gauntlet_fire.ogg
sound/weapons/gauntletbeam_fly.ogg [new file with mode: 0644]

index 1db210e..123c242 100644 (file)
@@ -217,7 +217,7 @@ set g_balance_laser_primary_animtime 0.3
 set g_balance_laser_primary_lifetime 30
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0.03
-set g_balance_laser_gauntlet 0
+set g_balance_laser_primary_gauntlet 0
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 35
 set g_balance_laser_secondary_edgedamage 10
@@ -230,6 +230,7 @@ set g_balance_laser_secondary_animtime 0.3
 set g_balance_laser_secondary_lifetime 30
 set g_balance_laser_secondary_shotangle 0
 set g_balance_laser_secondary_delay 0
+set g_balance_laser_secondary_gauntlet 0
 // }}}
 // {{{ shotgun
 set g_balance_shotgun_primary_bullets 6
index bc415ca..46b3daf 100644 (file)
@@ -217,7 +217,7 @@ set g_balance_laser_primary_animtime 0.3
 set g_balance_laser_primary_lifetime 30
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
-set g_balance_laser_gauntlet 0
+set g_balance_laser_primary_gauntlet 0
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 35
 set g_balance_laser_secondary_edgedamage 10
@@ -230,6 +230,7 @@ set g_balance_laser_secondary_animtime 0.3
 set g_balance_laser_secondary_lifetime 30
 set g_balance_laser_secondary_shotangle 0
 set g_balance_laser_secondary_delay 0
+set g_balance_laser_secondary_gauntlet 0
 // }}}
 // {{{ shotgun
 set g_balance_shotgun_primary_bullets 6
index 9ef7ab1..a2bfdfb 100644 (file)
@@ -210,26 +210,27 @@ set g_balance_laser_primary_damage 30 // dps 50, hope that's not too high
 set g_balance_laser_primary_edgedamage 30
 set g_balance_laser_primary_force 235
 set g_balance_laser_primary_radius 70
-set g_balance_laser_primary_speed 9000
+set g_balance_laser_primary_speed 4500
 set g_balance_laser_primary_spread 0
 set g_balance_laser_primary_refire 0.6
 set g_balance_laser_primary_animtime 0.6
 set g_balance_laser_primary_lifetime 5
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
-set g_balance_laser_gauntlet 0
-set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
-set g_balance_laser_secondary_damage 35
-set g_balance_laser_secondary_edgedamage 10
-set g_balance_laser_secondary_force 400
-set g_balance_laser_secondary_radius 70
-set g_balance_laser_secondary_speed 4500
+set g_balance_laser_primary_gauntlet 0
+set g_balance_laser_secondary 1 // when 1, a secondary laser mode exists
+set g_balance_laser_secondary_damage 110 // dps
+set g_balance_laser_secondary_edgedamage 0
+set g_balance_laser_secondary_force 500
+set g_balance_laser_secondary_radius 45
+set g_balance_laser_secondary_speed 0
 set g_balance_laser_secondary_spread 0
-set g_balance_laser_secondary_refire 0.7
-set g_balance_laser_secondary_animtime 0.3
-set g_balance_laser_secondary_lifetime 5
+set g_balance_laser_secondary_refire 0.066
+set g_balance_laser_secondary_animtime 0.066
+set g_balance_laser_secondary_lifetime 0
 set g_balance_laser_secondary_shotangle 0
 set g_balance_laser_secondary_delay 0
+set g_balance_laser_secondary_gauntlet 1
 // }}}
 // {{{ shotgun
 set g_balance_shotgun_primary_bullets 16
index d9ae5ec..6cdcb8a 100644 (file)
@@ -217,7 +217,7 @@ set g_balance_laser_primary_animtime 0.3
 set g_balance_laser_primary_lifetime 30
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0.03
-set g_balance_laser_gauntlet 0
+set g_balance_laser_primary_gauntlet 0
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 25
 set g_balance_laser_secondary_edgedamage 10
@@ -230,6 +230,7 @@ set g_balance_laser_secondary_animtime 0.3
 set g_balance_laser_secondary_lifetime 30
 set g_balance_laser_secondary_shotangle -90
 set g_balance_laser_secondary_delay 0
+set g_balance_laser_secondary_gauntlet 0
 // }}}
 // {{{ shotgun
 set g_balance_shotgun_primary_bullets 6
index 9033e42..acca206 100644 (file)
@@ -217,7 +217,7 @@ set g_balance_laser_primary_animtime 0.066
 set g_balance_laser_primary_lifetime 0
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
-set g_balance_laser_gauntlet 1
+set g_balance_laser_primary_gauntlet 1
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 35
 set g_balance_laser_secondary_edgedamage 10
@@ -230,6 +230,7 @@ set g_balance_laser_secondary_animtime 0
 set g_balance_laser_secondary_lifetime 30
 set g_balance_laser_secondary_shotangle 0
 set g_balance_laser_secondary_delay 0
+set g_balance_laser_secondary_gauntlet 0
 // }}}
 // {{{ shotgun
 set g_balance_shotgun_primary_bullets 16
diff --git a/particles/gauntletbeam.tga b/particles/gauntletbeam.tga
new file mode 100644 (file)
index 0000000..20a6ee5
Binary files /dev/null and b/particles/gauntletbeam.tga differ
index b1c423b..1b019d5 100644 (file)
@@ -234,6 +234,7 @@ float tempdb;
 float ClientProgsDB;
 vector hook_shotorigin[4];
 vector electro_shotorigin[4];
+vector gauntlet_shotorigin[4];
 
 #ifdef BLURTEST
 float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power;
index 14a213e..ed851b9 100644 (file)
@@ -1031,6 +1031,10 @@ void Ent_Init()
        electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
        electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
        electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
 
        if(forcefog)
                strunzone(forcefog);
index 8644847..9f690d5 100644 (file)
@@ -6,6 +6,12 @@
 .float LGBeamKillTime;
 .float LGBeamSound;
 .float LGBeamSilent;
+.vector GauntletBeamStart;
+.vector GauntletBeamEnd;
+.float GauntletBeamKillTime;
+.float GauntletBeamSound;
+.float GauntletBeamSilent;
+
 
 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
 {
@@ -138,6 +144,38 @@ void Draw_GrapplingHook()
                setorigin(self, a);
        }
 
+       if(time < self.GauntletBeamKillTime)
+       {
+               s = cvar("cl_gunalign");
+               if(s != 1 && s != 2 && s != 4)
+                       s = 3; // default value
+               --s;
+               vs = gauntlet_shotorigin[s];
+
+               if(self.sv_entnum == player_localentnum - 1)
+               {
+                       b = view_origin + view_forward * MAX_SHOT_DISTANCE;
+                       WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world);
+                       a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+               }
+               else
+               {
+                       a = self.GauntletBeamStart;
+                       b = self.GauntletBeamEnd;
+               }
+
+               tex = "particles/gauntletbeam";
+               rgb = '1 1 1';
+
+               Draw_GrapplingHook_trace_callback_tex = tex;
+               Draw_GrapplingHook_trace_callback_rnd = random();
+               WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NORMAL, world, world, Draw_GrapplingHook_trace_callback);
+               Draw_GrapplingHook_trace_callback_tex = string_null;
+
+               // helps the sound
+               setorigin(self, a);
+       }
+
        if(time < self.LGBeamKillTime && !self.LGBeamSilent)
        {
                if(!self.LGBeamSound)
@@ -154,6 +192,23 @@ void Draw_GrapplingHook()
                        self.LGBeamSound = 0;
                }
        }
+
+       if(time < self.GauntletBeamKillTime && !self.GauntletBeamSilent)
+       {
+               if(!self.GauntletBeamSound)
+               {
+                       sound (self, CHAN_PROJECTILE, "weapons/gauntletbeam_fly.wav", VOL_BASE, ATTN_NORM);
+                       self.GauntletBeamSound = 1;
+               }
+       }
+       else
+       {
+               if(self.GauntletBeamSound)
+               {
+                       sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
+                       self.GauntletBeamSound = 0;
+               }
+       }
 }
 
 void Net_GrapplingHook()
@@ -201,10 +256,18 @@ void Net_GrapplingHook()
                        p.LGBeamSilent = 1;
                        p.draw = Draw_GrapplingHook;
                        break;
+               case 3: // gauntlet beam
+                       p.GauntletBeamKillTime = time + 0.1;
+                       p.GauntletBeamStart = start;
+                       p.GauntletBeamEnd = end;
+                       p.GauntletBeamSilent = 0;
+                       p.draw = Draw_GrapplingHook;
+                       break;
        }
 }
 
 void Hook_Precache()
 {
        precache_sound("weapons/lgbeam_fly.wav");
+       precache_sound("weapons/gauntletbeam_fly.wav");
 }
index f4b83c5..fda3e90 100644 (file)
@@ -1071,6 +1071,10 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[1]));
        WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[2]));
        WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[3]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[0]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[1]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[2]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[3]));
        if(sv_foginterval && world.fog != "")
                WriteString(MSG_ENTITY, world.fog);
        else
index 020c24b..07898df 100644 (file)
@@ -513,6 +513,7 @@ void spawnfunc_worldspawn (void)
        readlevelcvars();
        GrappleHookInit();
        ElectroInit();
+       LaserInit();
 
        player_count = 0;
        bot_waypoints_for_items = cvar("g_waypoints_for_items");
index 929b0df..adf4b4a 100644 (file)
@@ -44,6 +44,7 @@ portals.qh
 
 g_hook.qh
 w_electro.qh
+w_laser.qh
 
 scores.qh
 
index 4d4fda1..3a54cf3 100644 (file)
@@ -184,7 +184,7 @@ void W_Electro_Attack2()
        CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
 }
 
-.entity lgbeam, exteriorlgbeam;
+.entity lgbeam;
 .float prevlgfire;
 void lgbeam_think()
 {
index 00e0fff..8633297 100644 (file)
@@ -101,18 +101,105 @@ void W_Laser_Attack (float issecondary)
        }
 }
 
-void W_Laser_Attack2 (void) // gauntlet
+.entity gauntletbeam;
+.float prevgauntletfire;
+void gauntletbeam_think()
 {
-       W_SetupShot (self, TRUE, 0, "weapons/gauntlet_fire.wav", cvar("g_balance_laser_primary_damage"));
+       float damage, myforce, myradius;
+       if(self.cnt)
+       {
+               damage = cvar("g_balance_laser_secondary_damage");
+               myforce = cvar("g_balance_laser_secondary_force");
+               myradius = cvar("g_balance_laser_secondary_radius");
+       }
+       else
+       {
+               damage = cvar("g_balance_laser_primary_damage");
+               myforce = cvar("g_balance_laser_primary_force");
+               myradius = cvar("g_balance_laser_primary_radius");
+       }
+
+       self.owner.prevgauntletfire = time;
+       if (self.owner.weaponentity.state != WS_INUSE || self != self.owner.gauntletbeam || self.owner.deadflag != DEAD_NO || (!self.owner.BUTTON_ATCK2 && self.cnt) || (!self.owner.BUTTON_ATCK && !self.cnt))
+       {
+               remove(self);
+               return;
+       }
+
+       self.nextthink = time;
+
+       makevectors(self.owner.v_angle);
+       vector angle;
+       angle = v_forward;
+
+       WarpZone_traceline_antilag(self.owner, self.owner.origin + self.owner.view_ofs, self.owner.origin + self.owner.view_ofs + angle * myradius, FALSE, self.owner, ANTILAG_LATENCY(self.owner));
+
+       // apply the damage
+       if(trace_fraction < 1)
+       {
+               vector force;
+               force = angle * myforce;
+               Damage (trace_ent, self.owner, self.owner, damage * frametime, WEP_ELECTRO, trace_endpos, force * frametime);
+       }
 
-       WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * (cvar("g_balance_laser_primary_radius") + vlen(eX * self.velocity_x + eY * self.velocity_y)/5), FALSE, self, ANTILAG_LATENCY(self));
+       // draw effect
+       vector vecs, org;
+       if(self.owner.weaponentity.movedir_x > 0)
+       {
+               vecs = self.owner.weaponentity.movedir;
+               vecs_y = -vecs_y;
+       }
+       else
+               vecs = '0 0 0';
+       org = self.owner.origin + self.owner.view_ofs + v_forward * vecs_x + v_right * vecs_y + v_up * vecs_z;
+       
+       // TODO turn into a csqc entity
+       WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
+       WriteByte(MSG_BROADCAST, TE_CSQC_BEAM);
+       WriteByte(MSG_BROADCAST, num_for_edict(self.owner));
+       WriteByte(MSG_BROADCAST, 3);
+       WriteCoord(MSG_BROADCAST, trace_endpos_x);
+       WriteCoord(MSG_BROADCAST, trace_endpos_y);
+       WriteCoord(MSG_BROADCAST, trace_endpos_z);
+       WriteCoord(MSG_BROADCAST, org_x);
+       WriteCoord(MSG_BROADCAST, org_y);
+       WriteCoord(MSG_BROADCAST, org_z);
+}
 
-       pointparticles(particleeffectnum("laser_gauntletmuzzleflash"), w_shotorg, w_shotdir * 1000, 1);
-       pointparticles(particleeffectnum("laser_gauntlet"), w_shotorg + w_shotdir * (cvar("g_balance_laser_primary_radius") + vlen(eX * self.velocity_x + eY * self.velocity_y)/5), w_shotdir * 1000, 1);
-       pointparticles(particleeffectnum("laser_gauntlet"), w_shotorg + w_shotdir * (cvar("g_balance_laser_primary_radius") + vlen(eX * self.velocity_x + eY * self.velocity_y)/5) * 0.5, w_shotdir * 1000, 1);
+// experimental gauntlet
+void W_Laser_Attack2 (float issecondary)
+{
+       // only play fire sound if 0.5 sec has passed since player let go the fire button
+       if(time - self.prevgauntletfire > 0.5)
+       {
+               sound (self, CHAN_WEAPON, "weapons/gauntlet_fire.wav", VOL_BASE, ATTN_NORM);
+       }
+
+       entity beam, oldself;
+
+       self.gauntletbeam = beam = spawn();
+       beam.solid = SOLID_NOT;
+       beam.think = gauntletbeam_think;
+       beam.owner = self;
+       beam.movetype = MOVETYPE_NONE;
+       beam.shot_spread = 0;
+       beam.bot_dodge = TRUE;
+       beam.bot_dodgerating = cvar("g_balance_laser_primary_damage");
+       beam.cnt = issecondary;
 
-       if (trace_fraction < 1)
-               Damage(trace_ent, self, self, cvar("g_balance_laser_primary_damage"), WEP_LASER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_laser_primary_force") * w_shotdir);
+       oldself = self;
+       self = beam;
+       self.think();
+       self = oldself;
+}
+
+void LaserInit()
+{
+       weapon_action(WEP_LASER, WR_PRECACHE);
+       gauntlet_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LASER), FALSE, FALSE, 1);
+       gauntlet_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LASER), FALSE, FALSE, 2);
+       gauntlet_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LASER), FALSE, FALSE, 3);
+       gauntlet_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LASER), FALSE, FALSE, 4);
 }
 
 void spawnfunc_weapon_laser (void)
@@ -143,8 +230,8 @@ float w_laser(float req)
                if (self.BUTTON_ATCK)
                if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
                {
-                       if(cvar("g_balance_laser_gauntlet"))
-                               W_Laser_Attack2();
+                       if(cvar("g_balance_laser_primary_gauntlet"))
+                               W_Laser_Attack2(0);
                        else
                                W_Laser_Attack(0);
                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
@@ -155,7 +242,10 @@ float w_laser(float req)
                        {
                                if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
                                {
-                                       W_Laser_Attack(1);
+                                       if(cvar("g_balance_laser_secondary_gauntlet"))
+                                               W_Laser_Attack2(1);
+                                       else
+                                               W_Laser_Attack(1);
                                        weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
                                }
                        }
diff --git a/qcsrc/server/w_laser.qh b/qcsrc/server/w_laser.qh
new file mode 100644 (file)
index 0000000..0f2c137
--- /dev/null
@@ -0,0 +1,2 @@
+void LaserInit();
+vector gauntlet_shotorigin[4];
index 0190693..03802f6 100644 (file)
Binary files a/sound/weapons/gauntlet_fire.ogg and b/sound/weapons/gauntlet_fire.ogg differ
diff --git a/sound/weapons/gauntletbeam_fly.ogg b/sound/weapons/gauntletbeam_fly.ogg
new file mode 100644 (file)
index 0000000..874d246
Binary files /dev/null and b/sound/weapons/gauntletbeam_fly.ogg differ