]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
custom bouncefactor/bouncestopspeed for mortar
authorRudolf Polzer <divVerent@alientrap.org>
Sat, 8 May 2010 13:28:03 +0000 (15:28 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Sat, 8 May 2010 13:28:03 +0000 (15:28 +0200)
qcsrc/client/Main.qc
qcsrc/client/projectile.qc
qcsrc/server/cl_client.qc
qcsrc/server/csqcprojectile.qc

index ddff8e18fe033bdb84048936d44853d2e1a9d1c3..d16e91820e1a31cdda5a0406791331e1d1b777d8 100644 (file)
@@ -1017,6 +1017,9 @@ void Ent_Init()
 
        g_weaponswitchdelay = ReadByte() / 255.0;
 
 
        g_weaponswitchdelay = ReadByte() / 255.0;
 
+       g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
+       g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
+
        if(!postinit)
                PostInit();
 }
        if(!postinit)
                PostInit();
 }
index b22a5b9dbd1242e952ca26ff79ac4dc2bdcde629..1cbab300f9d967d599bb76f03b3a2826413be02c 100644 (file)
@@ -158,11 +158,9 @@ void Ent_RemoveProjectile()
        }
 }
 
        }
 }
 
-.float bouncefactor;
-.float bouncestop;
 void Ent_Projectile()
 {
 void Ent_Projectile()
 {
-       float f, s;
+       float f;
 
        // projectile properties:
        //   kind (interpolated, or clientside)
 
        // projectile properties:
        //   kind (interpolated, or clientside)
@@ -216,19 +214,8 @@ void Ent_Projectile()
                        self.velocity_y = ReadCoord();
                        self.velocity_z = ReadCoord();
                        self.gravity = ReadCoord();
                        self.velocity_y = ReadCoord();
                        self.velocity_z = ReadCoord();
                        self.gravity = ReadCoord();
-
-                       s = ReadByte();
-
-                       if (s & 1)
-                       {
-                               self.bouncefactor = ReadCoord();
-                               self.bouncestop = ReadCoord();
-                       }
-
                        self.move_origin = self.origin;
                        self.move_velocity = self.velocity;
                        self.move_origin = self.origin;
                        self.move_velocity = self.velocity;
-                       self.move_bounce_factor = self.bouncefactor;
-                       self.move_bounce_stopspeed = self.bouncestop;
                }
 
                if(time == self.spawntime || (self.count & 0x80) || (f & 0x10))
                }
 
                if(time == self.spawntime || (self.count & 0x80) || (f & 0x10))
@@ -316,6 +303,8 @@ void Ent_Projectile()
                                self.maxs = '0 0 -3';
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = SUB_Null;
                                self.maxs = '0 0 -3';
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = SUB_Null;
+                               self.move_bounce_factor = g_balance_grenadelauncher_secondary_bouncefactor;
+                               self.move_bounce_stopspeed = g_balance_grenadelauncher_secondary_bouncestop;
                                break;
                        case PROJECTILE_PORTO_RED:
                                self.colormod = '2 1 1';
                                break;
                        case PROJECTILE_PORTO_RED:
                                self.colormod = '2 1 1';
index 8a3fe88fd54ef39d6eb4de33f658417e57f7fba7..0ec16a9a3db6de3c40590be7c3a179e62d798e12 100644 (file)
@@ -1064,14 +1064,50 @@ float ClientInit_SendEntity(entity to, float sf)
                WriteString(MSG_ENTITY, world.fog);
        else
                WriteString(MSG_ENTITY, "");
                WriteString(MSG_ENTITY, world.fog);
        else
                WriteString(MSG_ENTITY, "");
-       WriteByte(MSG_ENTITY, cvar("g_balance_armor_blockpercent") * 255.0);
-       WriteByte(MSG_ENTITY, cvar("g_balance_weaponswitchdelay") * 255.0);
+       WriteByte(MSG_ENTITY, self.count * 255.0); // g_balance_armor_blockpercent
+       WriteByte(MSG_ENTITY, self.cnt * 255.0); // g_balance_weaponswitchdelay
+       WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_grenadelauncher_secondary_bouncefactor
+       WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_grenadelauncher_secondary_bouncestop
        return TRUE;
 }
 
        return TRUE;
 }
 
+void ClientInit_CheckUpdate()
+{
+       self.nextthink = time;
+       if(self.count != cvar("g_balance_armor_blockpercent"))
+       {
+               self.count = cvar("g_balance_armor_blockpercent");
+               self.SendFlags |= 1;
+       }
+       if(self.cnt != cvar("g_balance_weaponswitchdelay"))
+       {
+               self.cnt = cvar("g_balance_weaponswitchdelay");
+               self.SendFlags |= 1;
+       }
+       if(self.bouncefactor != cvar("g_balance_grenadelauncher_secondary_bouncefactor"))
+       {
+               self.bouncefactor = cvar("g_balance_grenadelauncher_secondary_bouncefactor");
+               self.SendFlags |= 1;
+       }
+       if(self.bouncestop != cvar("g_balance_grenadelauncher_secondary_bouncestop"))
+       {
+               self.bouncestop = cvar("g_balance_grenadelauncher_secondary_bouncestop");
+               self.SendFlags |= 1;
+       }
+}
+
 void ClientInit_Spawn()
 {
 void ClientInit_Spawn()
 {
-       Net_LinkEntity(spawn(), FALSE, 0, ClientInit_SendEntity);
+       entity o;
+       entity e;
+       e.classname = "clientinit";
+       e.think = ClientInit_CheckUpdate;
+       e.nextthink = time;
+       Net_LinkEntity(e, FALSE, 0, ClientInit_SendEntity);
+       o = self;
+       self = e;
+       ClientInit_CheckUpdate();
+       self = o;
 }
 
 /*
 }
 
 /*
index aecdcf7f2f186b7091123ee7253fcb02753edf9f..e585b1e37900497737a4800e9f5e5192588a7b50 100644 (file)
@@ -3,7 +3,6 @@
 float CSQCProjectile_SendEntity(entity to, float sf)
 {
        float ft, fr;
 float CSQCProjectile_SendEntity(entity to, float sf)
 {
        float ft, fr;
-       float s;
 
        // note: flag 0x10 = no trail please
        sf = sf & 0x1F;
 
        // note: flag 0x10 = no trail please
        sf = sf & 0x1F;
@@ -22,13 +21,6 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        sf |= 0x20;
        }
 
                        sf |= 0x20;
        }
 
-       // HACK: subflags for sendflags = 0x80
-
-       s = 0;
-
-       if (self.movetype == MOVETYPE_BOUNCEMISSILE || self.movetype == MOVETYPE_BOUNCE)
-               s |= 1;
-
        WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
        WriteByte(MSG_ENTITY, sf);
 
        WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
        WriteByte(MSG_ENTITY, sf);
 
@@ -44,14 +36,6 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        WriteCoord(MSG_ENTITY, self.velocity_y);
                        WriteCoord(MSG_ENTITY, self.velocity_z);
                        WriteCoord(MSG_ENTITY, self.gravity);
                        WriteCoord(MSG_ENTITY, self.velocity_y);
                        WriteCoord(MSG_ENTITY, self.velocity_z);
                        WriteCoord(MSG_ENTITY, self.gravity);
-
-                       WriteByte(MSG_ENTITY, s);
-
-                       if (s & 1)
-                       {
-                               WriteCoord(MSG_ENTITY, self.bouncefactor);
-                               WriteCoord(MSG_ENTITY, self.bouncestop);
-                       }
                }
 
                if(sf & 0x20)
                }
 
                if(sf & 0x20)