]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix player model sound and species loading for invalid skin values; use .model and...
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 13 Dec 2010 06:00:20 +0000 (07:00 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 13 Dec 2010 06:00:20 +0000 (07:00 +0100)
qcsrc/common/util.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc

index 83ea8e3e5827fedbc29f9f7534aec14f8865ca80..1bfbca6ae107cf27eab18fe437035669cc140e02 100644 (file)
@@ -1837,7 +1837,13 @@ float get_model_parameters(string m, float sk)
        fn = get_model_datafilename(m, sk, "txt");
        fh = fopen(fn, FILE_READ);
        if(fh < 0)
        fn = get_model_datafilename(m, sk, "txt");
        fh = fopen(fn, FILE_READ);
        if(fh < 0)
-               return 0;
+       {
+               sk = 0;
+               fn = get_model_datafilename(m, sk, "txt");
+               fh = fopen(fn, FILE_READ);
+               if(fh < 0)
+                       return 0;
+       }
 
        get_model_parameters_modelname = m;
        get_model_parameters_modelskin = sk;
 
        get_model_parameters_modelname = m;
        get_model_parameters_modelskin = sk;
index 5ff519bd70695e15627a7680d7342b2ef9f441d7..e480b4f25aca65701096ef886c752936b118c5b2 100644 (file)
@@ -724,15 +724,6 @@ void PutObserverInServer (void)
                self.frags = FRAGS_SPECTATOR;
 }
 
                self.frags = FRAGS_SPECTATOR;
 }
 
-float RestrictSkin(float s)
-{
-       if(!teams_matter)
-               return s;
-       if(s == 6)
-               return 6;
-       return mod(s, 3);
-}
-
 void FixPlayermodel()
 {
        local string defaultmodel;
 void FixPlayermodel()
 {
        local string defaultmodel;
@@ -794,7 +785,7 @@ void FixPlayermodel()
                }
 
                oldskin = self.skinindex;
                }
 
                oldskin = self.skinindex;
-               self.skinindex = RestrictSkin(stof(self.playerskin));
+               self.skinindex = stof(self.playerskin);
        }
 
        if(chmdl || oldskin != self.skinindex)
        }
 
        if(chmdl || oldskin != self.skinindex)
index 27bd209c501ca6d799f48ec6e13f822b6e7eee86..2b4981745bfd879b0256d48d4f3e789b6139727e 100644 (file)
@@ -168,7 +168,7 @@ void CopyBody(float keepvelocity)
 float player_getspecies()
 {
        float s;
 float player_getspecies()
 {
        float s;
-       get_model_parameters(self.playermodel, self.skinindex);
+       get_model_parameters(self.model, self.skinindex);
        s = get_model_parameters_species;
        get_model_parameters(string_null, 0);
        if(s < 0)
        s = get_model_parameters_species;
        get_model_parameters(string_null, 0);
        if(s < 0)
@@ -1224,7 +1224,7 @@ void ClearPlayerSounds()
 #undef _VOICEMSG
 }
 
 #undef _VOICEMSG
 }
 
-void LoadPlayerSounds(string f, float first)
+float LoadPlayerSounds(string f, float first)
 {
        float fh;
        string s;
 {
        float fh;
        string s;
@@ -1233,7 +1233,7 @@ void LoadPlayerSounds(string f, float first)
        if(fh < 0)
        {
                dprint("Player sound file not found: ", f, "\n");
        if(fh < 0)
        {
                dprint("Player sound file not found: ", f, "\n");
-               return;
+               return 0;
        }
        while((s = fgets(fh)))
        {
        }
        while((s = fgets(fh)))
        {
@@ -1249,6 +1249,7 @@ void LoadPlayerSounds(string f, float first)
                self.field = strzone(strcat(argv(1), " ", argv(2)));
        }
        fclose(fh);
                self.field = strzone(strcat(argv(1), " ", argv(2)));
        }
        fclose(fh);
+       return 1;
 }
 
 .float modelindex_for_playersound;
 }
 
 .float modelindex_for_playersound;
@@ -1262,7 +1263,8 @@ void UpdatePlayerSounds()
        self.skinindex_for_playersound = self.skinindex;
        ClearPlayerSounds();
        LoadPlayerSounds("sound/player/default.sounds", 1);
        self.skinindex_for_playersound = self.skinindex;
        ClearPlayerSounds();
        LoadPlayerSounds("sound/player/default.sounds", 1);
-       LoadPlayerSounds(get_model_datafilename(self.playermodel, self.skinindex, "sounds"), 0);
+       if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0))
+               LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0);
 }
 
 void FakeGlobalSound(string sample, float chan, float voicetype)
 }
 
 void FakeGlobalSound(string sample, float chan, float voicetype)