From: Mircea Kitsune Date: Mon, 26 Apr 2010 21:29:47 +0000 (+0300) Subject: Character voices and pain sounds are currently specified as a playermodel.zym.sounds... X-Git-Tag: xonotic-v0.1.0preview~637^2^2~19 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=ed3e1e7c3b3b180996e303a1fdbee52cae70d41a;p=xonotic%2Fxonotic-data.pk3dir.git Character voices and pain sounds are currently specified as a playermodel.zym.sounds file. This makes it impossible to choose different voices for characters using the same model. This patch fixes that, and sounds are character specific instead. --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index ef83ef635..c7e838006 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -508,7 +508,6 @@ float Client_customizeentityforclient() return TRUE; } -void UpdatePlayerSounds(); void setmodel_lod(entity e, string modelname) { string s; @@ -556,7 +555,6 @@ void setmodel_lod(entity e, string modelname) self.modelindex_lod0_from_xonotic = ((s == "") || (substring(s, 0, 4) == "data")); player_setupanimsformodel(); - UpdatePlayerSounds(); } /* diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 8925f1713..df389f5da 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -167,6 +167,7 @@ float player_getspecies() { local float glob, i, j, fh, len, s, sk; local string fn, l; + local float tokens; s = -1; @@ -186,6 +187,9 @@ float player_getspecies() if(sk == (j ? 0 : self.skinindex)) // 2nd pass skips the skin test if(fgets(fh) == self.model) { + tokens = tokenizebyseparator(fn, "."); + UpdatePlayerSounds(argv(0)); + l = fgets(fh); len = tokenize_console(l); if (len != 2) @@ -1264,14 +1268,15 @@ void LoadPlayerSounds(string f, float first) } .float modelindex_for_playersound; -void UpdatePlayerSounds() +void UpdatePlayerSounds(string filename) { if(self.modelindex == self.modelindex_for_playersound) return; self.modelindex_for_playersound = self.modelindex; ClearPlayerSounds(); LoadPlayerSounds("sound/player/default.sounds", 1); - LoadPlayerSounds(strcat(self.model, ".sounds"), 0); + if(filename != "") + LoadPlayerSounds(strcat(filename, ".sounds"), 0); } void FakeGlobalSound(string sample, float chan, float voicetype) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index b487e3de7..5e7c83cf2 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -501,7 +501,7 @@ string globalsound_metalstep; void PrecachePlayerSounds(string f); void PrecacheGlobalSound(string samplestring); -void UpdatePlayerSounds(); +void UpdatePlayerSounds(string filename); void ClearPlayerSounds(); void PlayerSound(.string samplefield, float channel, float voicetype); void GlobalSound(string samplestring, float channel, float voicetype);