]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mirceakitsune/per_character_sounds
authorRudolf Polzer <divverent@alientrap.org>
Sun, 9 May 2010 13:04:19 +0000 (15:04 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 9 May 2010 13:04:19 +0000 (15:04 +0200)
1  2 
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc

index 1fe043f2a8401cc024775c1a20d2151132ef8e0a,0ec16a9a3db6de3c40590be7c3a179e62d798e12..cf941e9e3c2ee269d7a3b171791a3a22a09ebed4
@@@ -508,6 -508,7 +508,6 @@@ float Client_customizeentityforclient(
        return TRUE;
  }
  
 -void UpdatePlayerSounds();
  void setmodel_lod(entity e, string modelname)
  {
        string s;
        self.modelindex_lod0_from_xonotic = ((s == "") || (substring(s, 0, 4) == "data"));
  
        player_setupanimsformodel();
 -      UpdatePlayerSounds();
  }
  
  /*
@@@ -1062,14 -1064,50 +1062,50 @@@ float ClientInit_SendEntity(entity to, 
                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;
  }
  
+ 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()
  {
-       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 6fee98bcd47dc7e34206fda85d626f2ae98c28ce,47b7ac069587e036ff5e583f15b55d43309f8814..ee6d11dfd455d2e8969e8b9a47975a766cb2d7f2
@@@ -165,14 -165,56 +165,14 @@@ void CopyBody(float keepvelocity
  
  float player_getspecies()
  {
 -      local float glob, i, j, fh, len, s, sk;
 -      local string fn, l;
 -
 -      s = -1;
 -
 -      glob = search_begin("models/player/*.txt", TRUE, TRUE);
 -      if(glob < 0)
 -              return s;
 -      for(j = 0; j <= 1; ++j)
 +      get_model_parameters(self.playermodel, self.skinindex);
 +      if(get_model_parameters_species >= 0)
        {
 -              for(i = 0; i < search_getsize(glob); ++i)
 -              {
 -                      fn = search_getfilename(glob, i);
 -                      fh = fopen(fn, FILE_READ);
 -                      if(fh < 0)
 -                              continue;
 -                      fgets(fh); fgets(fh);
 -                      sk = stof(fgets(fh));
 -                      if(sk == (j ? 0 : self.skinindex)) // 2nd pass skips the skin test
 -                      if(fgets(fh) == self.model)
 -                      {
 -                              l = fgets(fh);
 -                              len = tokenize_console(l);
 -                              if (len != 2)
 -                                      goto nospecies;
 -                              if (argv(0) != "species")
 -                                      goto nospecies;
 -                              switch(argv(1))
 -                              {
 -                                      case "human":       s = SPECIES_HUMAN;       break;
 -                                      case "alien":       s = SPECIES_ALIEN;       break;
 -                                      case "robot_shiny": s = SPECIES_ROBOT_SHINY; break;
 -                                      case "robot_rusty": s = SPECIES_ROBOT_RUSTY; break;
 -                                      case "robot_solid": s = SPECIES_ROBOT_SOLID; break;
 -                                      case "animal":      s = SPECIES_ANIMAL;      break;
 -                                      case "reserved":    s = SPECIES_RESERVED;    break;
 -                              }
 -                      }
 -:nospecies
 -                      fclose(fh);
 -              }
 -              if (s >= 0)
 -                      break;
 +              get_model_parameters(string_null, 0);
 +              return get_model_parameters_species;
        }
 -      search_end(glob);
 -
 -      if (s < 0)
 -              s = SPECIES_HUMAN;
 -
 -      return s;
 +      get_model_parameters(string_null, 0);
 +      return SPECIES_HUMAN;
  }
  
  void player_setupanimsformodel()
@@@ -594,6 -636,7 +594,7 @@@ void PlayerDamage (entity inflictor, en
  
                frag_attacker = attacker;
                frag_inflictor = inflictor;
+               frag_target = self;
                MUTATOR_CALLHOOK(PlayerDies);
  
                if(self.flagcarried)
@@@ -1222,17 -1265,14 +1223,17 @@@ void LoadPlayerSounds(string f, float f
  }
  
  .float modelindex_for_playersound;
 +.float skinindex_for_playersound;
  void UpdatePlayerSounds()
  {
        if(self.modelindex == self.modelindex_for_playersound)
 +      if(self.skinindex == self.skinindex_for_playersound)
                return;
        self.modelindex_for_playersound = self.modelindex;
 +      self.skinindex_for_playersound = self.skinindex;
        ClearPlayerSounds();
        LoadPlayerSounds("sound/player/default.sounds", 1);
 -      LoadPlayerSounds(strcat(self.model, ".sounds"), 0);
 +      LoadPlayerSounds(get_model_datafilename(self.playermodel, self.skinindex, "sounds"), 0);
  }
  
  void FakeGlobalSound(string sample, float chan, float voicetype)