From 5deee035668ed2b0cf6615536358f33edcf0a9ec Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Wed, 20 Feb 2013 16:51:19 +0200 Subject: [PATCH] Make player sounds per-skin instead of per-model like in Xonotic. Will be needed for a future change. --- .../{fox.iqm.sounds => fox.iqm_0.sounds} | 0 data/models/player/fox.iqm_1.sounds | 40 +++++++++++++++++++ data/qcsrc/server/cl_player.qc | 6 ++- data/qcsrc/server/miscfunctions.qc | 34 ++++++++++++---- docs/TODO.txt | 4 +- 5 files changed, 73 insertions(+), 11 deletions(-) rename data/models/player/{fox.iqm.sounds => fox.iqm_0.sounds} (100%) create mode 100644 data/models/player/fox.iqm_1.sounds diff --git a/data/models/player/fox.iqm.sounds b/data/models/player/fox.iqm_0.sounds similarity index 100% rename from data/models/player/fox.iqm.sounds rename to data/models/player/fox.iqm_0.sounds diff --git a/data/models/player/fox.iqm_1.sounds b/data/models/player/fox.iqm_1.sounds new file mode 100644 index 00000000..1dd83fcd --- /dev/null +++ b/data/models/player/fox.iqm_1.sounds @@ -0,0 +1,40 @@ +//TAG: female +//affirmative sound/player/fox_female/coms/affirmative 0 +attack sound/player/fox_female/coms/attack 2 +//attacking sound/player/fox_female/coms/attacking 0 +attackinfive sound/player/fox_female/coms/attackinfive 0 +coverme sound/player/fox_female/coms/coverme 0 +defend sound/player/fox_female/coms/defend 0 +//defending sound/player/fox_female/coms/defending 0 +//droppedflag sound/player/fox_female/coms/droppedflag 0 +//flagcarriertakingdamage sound/player/fox_female/coms/flagcarriertakingdamage 0 +freelance sound/player/fox_female/coms/freelance 2 +//getflag sound/player/fox_female/coms/getflag 0 +incoming sound/player/fox_female/coms/incoming 0 +meet sound/player/fox_female/coms/meet 0 +needhelp sound/player/fox_female/coms/needhelp 1 +//negative sound/player/fox_female/coms/negative 0 +//onmyway sound/player/fox_female/coms/onmyway 0 +//roaming sound/player/fox_female/coms/roaming 0 +//seenenemy sound/player/fox_female/coms/seenenemy 0 +seenflag sound/player/fox_female/coms/seenflag 0 +taunt sound/player/fox_female/coms/taunt 5 +pred sound/player/fox_female/coms/pred 5 +prey sound/player/fox_female/coms/prey 5 +teamshoot sound/player/fox_female/coms/teamshoot 4 +death sound/player/fox_female/player/death 3 +drown sound/player/fox_female/player/drown 0 +fall sound/player/fox_female/player/fall 1 +falling sound/player/fox_female/player/falling 0 +gasp sound/player/fox_female/player/gasp 0 +jump sound/player/fox_female/player/jump 0 +grab sound/player/fox_female/player/grab 0 +swallow sound/player/fox_female/player/swallow 2 +digest sound/player/fox_female/player/digest 0 +regurgitate sound/player/fox_female/player/regurgitate 2 +regurgitate_prepare sound/player/fox_female/player/regurgitate_prepare 0 +gurgle sound/player/fox_female/player/gurgle 0 +pain25 sound/player/fox_female/player/pain25 0 +pain50 sound/player/fox_female/player/pain50 0 +pain75 sound/player/fox_female/player/pain75 0 +pain100 sound/player/fox_female/player/pain100 0 diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index c0887e40..4ee6f9b9 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1194,14 +1194,18 @@ void LoadPlayerSounds(string f, float first) } .float modelindex_for_playersound; +.float skin_for_playersound; void UpdatePlayerSounds() { if(self.modelindex == self.modelindex_for_playersound) + if(self.skin == self.skin_for_playersound) return; self.modelindex_for_playersound = self.modelindex; + self.skin_for_playersound = self.skin; ClearPlayerSounds(); LoadPlayerSounds("sound/player/default.sounds", 1); - LoadPlayerSounds(strcat(self.model, ".sounds"), 0); + if not(LoadPlayerSounds(strcat(self.model, "_", ftos(self.skin), ".", "sounds"), 0)) + LoadPlayerSounds(strcat(self.model, ".", "sounds"), 0); } void GlobalSound(string sample, float chan, float voicetype, float vol) diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index 33f6d4a6..f16f60aa 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -1324,7 +1324,26 @@ void play2all(string samp) } void PrecachePlayerSounds(string f); -void precache_all_models(string pattern) +void precache_playermodel(string m) +{ + float globhandle, i, n; + string f; + + precache_model(m); + + globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE); + if (globhandle < 0) + return; + n = search_getsize(globhandle); + for (i = 0; i < n; ++i) + { + //print(search_getfilename(globhandle, i), "\n"); + f = search_getfilename(globhandle, i); + PrecachePlayerSounds(f); + } + search_end(globhandle); +} +void precache_all_playermodels(string pattern) { float globhandle, i, n; string f; @@ -1337,8 +1356,7 @@ void precache_all_models(string pattern) { //print(search_getfilename(globhandle, i), "\n"); f = search_getfilename(globhandle, i); - precache_model(f); - PrecachePlayerSounds(strcat(f, ".sounds")); + precache_playermodel(f); } search_end(globhandle); } @@ -1362,11 +1380,11 @@ void precache() if (cvar("sv_precacheplayermodels")) { PrecachePlayerSounds("sound/player/default.sounds"); - precache_all_models("models/player/*.zym"); - precache_all_models("models/player/*.dpm"); - precache_all_models("models/player/*.md3"); - precache_all_models("models/player/*.psk"); - precache_all_models("models/player/*.iqm"); + precache_all_playermodels("models/player/*.zym"); + precache_all_playermodels("models/player/*.dpm"); + precache_all_playermodels("models/player/*.md3"); + precache_all_playermodels("models/player/*.psk"); + precache_all_playermodels("models/player/*.iqm"); } if (cvar("sv_defaultcharacter")) diff --git a/docs/TODO.txt b/docs/TODO.txt index 0591f4ba..ea6ed7c3 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -172,8 +172,6 @@ - 0.8 BUG (reported): The biggest bug that I've noticed so far would be the fact that there's a horrible lag in the single-player campaign starting at level 4 (Gas Station). The maps themselves work fine when running through Instant Action, so it must have to do with something unique to the campaign mode itself - quite possible the Story dialogue that loops across the top of the screen. I don't know the cause, but it certainly needs to be fixed. -- 0.8: Make character.sounds also depend on skin (eg: character_0.sounds). And / or make all character setups same as in Xonotic - - 0.8: Prey - Use EF_NODRAW instead of self.alpha = -1 - +0.9: Add some inclined HUD effect for more coolness, if it's possible. Maybe for the menu too @@ -247,3 +245,5 @@ - 0.8: Make some HUD backgrounds show when dead - 0.8 BUG: I think prey swallow pogress doesn't decrease for consumable items + +- 0.8 BUG: Someone's reporting swallow speed doesn't change with the cvar -- 2.39.2