]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
handle CR and nex scope sending in a better way
authorFruitieX <rasse@rasse-lappy.localdomain>
Thu, 29 Jul 2010 17:53:12 +0000 (20:53 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Thu, 29 Jul 2010 17:53:12 +0000 (20:53 +0300)
qcsrc/client/Main.qc
qcsrc/server/cl_client.qc
qcsrc/server/w_campingrifle.qc
qcsrc/server/w_nex.qc

index 78b45fae37864270e14a40aa830643c6cf105a27..d1a76320f429527c6f454d7709d470dab357d6e8 100644 (file)
@@ -1050,6 +1050,9 @@ void Ent_Init()
        g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
        g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
 
+       nex_scope = !ReadByte();
+       campingrifle_scope = !ReadByte();
+
        if(!postinit)
                PostInit();
 }
@@ -1277,14 +1280,6 @@ void Net_WeaponComplain() {
        complain_weapon_time = time;
 }
 
-void Net_CampingrifleScope() {
-       campingrifle_scope = TRUE;
-}
-
-void Net_NexScope() {
-       nex_scope = TRUE;
-}
-
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
@@ -1355,14 +1350,6 @@ float CSQC_Parse_TempEntity()
                        Net_WeaponComplain();
                        bHandled = true;
                        break;
-               case TE_CSQC_CAMPINGRIFLE_SCOPE:
-                       Net_CampingrifleScope();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_NEX_SCOPE:
-                       Net_NexScope();
-                       bHandled = true;
-                       break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;
index 9244c93eb0f1016782db538b9b184e3c76821609..dcebed41a8be8a0307e4f7edcfb8931846533f66 100644 (file)
@@ -1083,6 +1083,8 @@ float ClientInit_SendEntity(entity to, float sf)
        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
+       WriteByte(MSG_ENTITY, cvar("g_balance_nex_secondary")); // client has to know if it should zoom or not
+       WriteByte(MSG_ENTITY, cvar("g_balance_campingrifle_secondary")); // client has to know if it should zoom or not
        return TRUE;
 }
 
index f14d5689b175116611764c6d26940387e6b5a075..1cd280e007b531f7f23122fbde2c16890e7fa9f3 100644 (file)
@@ -173,7 +173,6 @@ void W_CampingRifle_BulletHail(float mode, void(void) AttackFunc, float fr, floa
 }
 
 .float bot_secondary_campingriflemooth;
-.float sent_campingrifle_scope;
 float w_campingrifle(float req)
 {
        float full;
@@ -231,17 +230,6 @@ float w_campingrifle(float req)
                                                self.campingrifle_accumulator += cvar("g_balance_campingrifle_secondary_burstcost");
                                        }
                                }
-                               else
-                               {
-                                       if(clienttype(self) == CLIENTTYPE_REAL)
-                                       if(!self.sent_campingrifle_scope)
-                                       {
-                                               msg_entity = self;
-                                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                                               WriteByte(MSG_ONE, TE_CSQC_CAMPINGRIFLE_SCOPE);
-                                               self.sent_campingrifle_scope = 1;
-                                       }       
-                               }
                        }
                }
        }
index 3a85e113adc6a9ccbe7bd33469122e155664078f..a6ec07d6a819791392f8716325d6556900668445 100644 (file)
@@ -64,7 +64,6 @@ void W_Nex_Attack (float issecondary)
 
 void spawnfunc_weapon_nex (void); // defined in t_items.qc
 
-.float sent_nex_scope;
 float w_nex(float req)
 {
        if (req == WR_AIM)
@@ -92,17 +91,6 @@ float w_nex(float req)
                                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_secondary_animtime"), w_ready);
                                }
                        }
-                       else
-                       {
-                               if(clienttype(self) == CLIENTTYPE_REAL)
-                               if(!self.sent_nex_scope)
-                               {
-                                       msg_entity = self;
-                                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                                       WriteByte(MSG_ONE, TE_CSQC_NEX_SCOPE);
-                                       self.sent_nex_scope = 1;
-                               }       
-                       }
                }
        }
        else if (req == WR_PRECACHE)