]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Lets make the shotorigin work for lightning with everyone involved + some other things.
authorSamual <samual@xonotic.org>
Mon, 7 Mar 2011 00:58:13 +0000 (19:58 -0500)
committerSamual <samual@xonotic.org>
Mon, 7 Mar 2011 00:58:13 +0000 (19:58 -0500)
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/hook.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/g_world.qc
qcsrc/server/progs.src
qcsrc/server/w_electro.qc
qcsrc/server/w_lightning.qc
qcsrc/server/w_lightning.qh [new file with mode: 0644]

index 62acc624968492cec56841ec85a64e70d0cd4084..ab86f698184d39bc0b57a8e61bc8757692fe71cd 100644 (file)
@@ -233,6 +233,7 @@ float announcer_5min;
 float tempdb;
 float ClientProgsDB;
 vector hook_shotorigin[4];
+vector electro_shotorigin[4];
 vector lightning_shotorigin[4];
 vector gauntlet_shotorigin[4];
 
index 1424a8c2794364fff7c211e5742284401fa52f39..f3ae91ca099a66a74c5c67bac72028d082f2cceb 100644 (file)
@@ -961,7 +961,8 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
                case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
-               case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
+               case ENT_CLIENT_ELECTRO_BEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_ELECTRO_BEAM); break;
+               case ENT_CLIENT_LIGHTNING_BEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LIGHTNING_BEAM); break;
                case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
                case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
                default:
@@ -1067,6 +1068,10 @@ void Ent_Init()
        hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
        hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
        hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
        lightning_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
        lightning_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
        lightning_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
index 91f62154ee4e2418f39f553249093d882ed48471..dc0780e047608f54b718cdb40a9fe96179c73ac4 100644 (file)
@@ -75,7 +75,10 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        vs = hook_shotorigin[s];
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+                       vs = electro_shotorigin[s];
+                       break;
+               case ENT_CLIENT_LIGHTNING_BEAM:
                        vs = lightning_shotorigin[s];
                        break;
                case ENT_CLIENT_GAUNTLET:
@@ -92,7 +95,8 @@ void Draw_GrapplingHook()
                                a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
                                b = self.origin;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_LIGHTNING_BEAM:
                        case ENT_CLIENT_GAUNTLET:
                                if(self.HookRange)
                                        b = view_origin + view_forward * self.HookRange;
@@ -113,7 +117,8 @@ void Draw_GrapplingHook()
                                a = self.velocity;
                                b = self.origin;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_LIGHTNING_BEAM:
                        case ENT_CLIENT_GAUNTLET:
                                a = self.origin;
                                b = self.velocity;
@@ -155,7 +160,13 @@ void Draw_GrapplingHook()
                                rgb = '.3 1 .3';
                        }
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+                       intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
+                       offset = Noise_Brown(self, frametime) * 10;
+                       tex = "particles/lgbeam";
+                       rgb = '1 1 1';
+                       break;
+               case ENT_CLIENT_LIGHTNING_BEAM: // todo
                        intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
                        offset = Noise_Brown(self, frametime) * 10;
                        tex = "particles/lgbeam";
@@ -193,7 +204,8 @@ void Draw_GrapplingHook()
                                self.drawmask = 0;
                        }
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+               case ENT_CLIENT_LIGHTNING_BEAM:
                case ENT_CLIENT_GAUNTLET:
                        setorigin(self, a); // beam origin!
                        break;
@@ -204,7 +216,10 @@ void Draw_GrapplingHook()
                default:
                case ENT_CLIENT_HOOK:
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+                       pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
+                       break;
+               case ENT_CLIENT_LIGHTNING_BEAM:
                        pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
                        break;
                case ENT_CLIENT_GAUNTLET:
@@ -240,7 +255,8 @@ void Ent_ReadHook(float bIsNew, float type)
                        case ENT_CLIENT_GAUNTLET:
                                self.HookRange = 0;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_LIGHTNING_BEAM:
                                self.HookRange = ReadCoord();
                                break;
                }
@@ -274,7 +290,10 @@ void Ent_ReadHook(float bIsNew, float type)
                                setmodel(self, "models/hook.md3");
                                self.drawmask = MASK_NORMAL;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                               sound (self, CHAN_PROJECTILE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTN_NORM);
+                               break;
+                       case ENT_CLIENT_LIGHTNING_BEAM:
                                sound (self, CHAN_PROJECTILE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTN_NORM);
                                break;
                        case ENT_CLIENT_GAUNTLET:
index 60633f57472b111687223018d3491f9488a28fbf..eb92f5c9437ef6700b98b3d976c4e92b2a6399f9 100644 (file)
@@ -110,9 +110,10 @@ const float ENT_CLIENT_WARPZONE = 24;
 const float ENT_CLIENT_WARPZONE_CAMERA = 25;
 const float ENT_CLIENT_TRIGGER_MUSIC = 26;
 const float ENT_CLIENT_HOOK = 27;
-const float ENT_CLIENT_LGBEAM = 28;
-const float ENT_CLIENT_GAUNTLET = 29;
-const float ENT_CLIENT_ACCURACY = 30;
+const float ENT_CLIENT_ELECTRO_BEAM = 28;
+const float ENT_CLIENT_LIGHTNING_BEAM = 29;
+const float ENT_CLIENT_GAUNTLET = 30;
+const float ENT_CLIENT_ACCURACY = 31;
 
 const float ENT_CLIENT_TURRET = 40;
 
index 71584d350379869717ce8e3cd1ca6a2a3ce47f24..b8d9707027b9681a442186e5a34f9caeaf18cb4a 100644 (file)
@@ -1092,6 +1092,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(lightning_shotorigin[0]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(lightning_shotorigin[1]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(lightning_shotorigin[2]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(lightning_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]));
index 84402f0139441e3eda2e1e2945443006a013c67a..977aade6030e4cc779c2c09f1321377623c01885 100644 (file)
@@ -692,6 +692,7 @@ void spawnfunc_worldspawn (void)
        InitGameplayMode();
        readlevelcvars();
        GrappleHookInit();
+       LightningInit();
        ElectroInit();
        LaserInit();
 
index c76395fdbc27df7bdd26371a491fe1da65064276..13a4c64eb70c9eeaee6d4c433fc042635798a2de 100644 (file)
@@ -47,6 +47,7 @@ portals.qh
 
 g_hook.qh
 w_electro.qh
+w_lightning.qh
 w_laser.qh
 
 scores.qh
index f5491f39aa1054b2c112e70581731437f631d0f0..77477a23ee4393bffc866f7a215838c55965059a 100644 (file)
@@ -198,7 +198,7 @@ void W_Electro_Attack2()
 .vector hook_start, hook_end;
 float lgbeam_send(entity to, float sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_LGBEAM);
+       WriteByte(MSG_ENTITY, ENT_CLIENT_ELECTRO_BEAM);
        sf = sf & 0x7F;
        if(sound_allowed(MSG_BROADCAST, self.owner))
                sf |= 0x80;
index 2febfc2628e04c55b7a758165290271934859428..d42028d3c0a6ae47fac408c2cbedc298c507bd40 100644 (file)
@@ -6,14 +6,13 @@ REGISTER_WEAPON(LIGHTNING, w_lightning, IT_CELLS, 5, WEP_FLAG_NORMAL | WEP_TYPE_
 // Declarations ========================= 
 .vector hook_start, hook_end; // used for beam
 .entity lightning_beam; // used for beam
-//.float bot_aim_whichfiretype; // ???
 .float BUTTON_ATCK_prev; // for better animation control
 .float lg_fire_prev; // for better animation control
 
 // Lightning functions ========================= 
 float W_Lightning_Beam_Send(entity to, float sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_LGBEAM);
+       WriteByte(MSG_ENTITY, ENT_CLIENT_LIGHTNING_BEAM);
        sf = sf & 0x7F;
        if(sound_allowed(MSG_BROADCAST, self.owner))
                sf |= 0x80;
@@ -124,20 +123,6 @@ void W_Lightning_Attack1 (void)
        self = oldself;
 }
 
-void LightningInit()
-{
-       weapon_action(WEP_LIGHTNING, WR_PRECACHE);
-       lightning_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 1);
-       lightning_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 2);
-       lightning_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 3);
-       lightning_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 4);
-}
-
-void spawnfunc_weapon_lightning (void)
-{
-       weapon_defaultspawnfunc(WEP_LIGHTNING);
-}
-
 float w_lightning(float req)
 {
        if (req == WR_AIM)
@@ -240,6 +225,20 @@ float w_lightning(float req)
        }
        return TRUE;
 };
+
+void LightningInit()
+{
+       weapon_action(WEP_LIGHTNING, WR_PRECACHE);
+       lightning_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 1);
+       lightning_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 2);
+       lightning_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 3);
+       lightning_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_LIGHTNING), FALSE, FALSE, 4);
+}
+
+void spawnfunc_weapon_lightning (void) // should this really be here?
+{
+       weapon_defaultspawnfunc(WEP_LIGHTNING);
+}
 #endif
 #ifdef CSQC
 float w_lightning(float req)
@@ -248,6 +247,7 @@ float w_lightning(float req)
        {
                vector org2;
                org2 = w_org + w_backoff * 6;
+               
                if(w_deathtype & HITTYPE_SECONDARY)
                {
                        pointparticles(particleeffectnum("lightning_ballexplode"), org2, '0 0 0', 1);
@@ -256,19 +256,9 @@ float w_lightning(float req)
                }
                else
                {
-                       if(w_deathtype & HITTYPE_BOUNCE)
-                       {
-                               // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
-                               pointparticles(particleeffectnum("lightning_combo"), org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/lightning_impact_combo.wav", VOL_BASE, ATTN_NORM);
-                       }
-                       else
-                       {
-                               pointparticles(particleeffectnum("lightning_impact"), org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/lightning_impact.wav", VOL_BASE, ATTN_NORM);
-                       }
+                       pointparticles(particleeffectnum("lightning_impact"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                               sound(self, CHAN_PROJECTILE, "weapons/lightning_impact.wav", VOL_BASE, ATTN_NORM);
                }
        }
        else if(req == WR_PRECACHE)
diff --git a/qcsrc/server/w_lightning.qh b/qcsrc/server/w_lightning.qh
new file mode 100644 (file)
index 0000000..57d6ceb
--- /dev/null
@@ -0,0 +1,2 @@
+void LightningInit();
+vector lightning_shotorigin[4];