From: havoc Date: Tue, 28 Feb 2006 05:41:39 +0000 (+0000) Subject: reduced number of GAME_NEXUIZ checks in the engine (added cl_sound and sv_sound cvars... X-Git-Tag: xonotic-v0.1.0preview~4271 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=170d099107030976e81ff84404258a1a6f9eedfa;p=xonotic%2Fdarkplaces.git reduced number of GAME_NEXUIZ checks in the engine (added cl_sound and sv_sound cvars to change or disable engine-triggered sounds), removed some old unused nexuiz menu code (now that the fallbac k prevents you from even reaching the singleplayer menu) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6043 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index a99cb193..0cfdd68e 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -157,6 +157,13 @@ char *qw_svc_strings[128] = cvar_t demo_nehahra = {0, "demo_nehahra", "0", "reads all quake demos as nehahra movie protocol"}; cvar_t developer_networkentities = {0, "developer_networkentities", "0", "prints received entities, value is 0-4 (higher for more info)"}; +cvar_t cl_sound_wizardhit = {0, "cl_sound_wizardhit", "wizard/hit.wav", "sound to play during TE_WIZSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_hknighthit = {0, "cl_sound_hknighthit", "hknight/hit.wav", "sound to play during TE_KNIGHTSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_tink1 = {0, "cl_sound_tink1", "1", "sound to play with 80% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_ric1 = {0, "cl_sound_ric1", "1", "sound to play with 5% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_ric2 = {0, "cl_sound_ric2", "1", "sound to play with 5% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_ric3 = {0, "cl_sound_ric3", "1", "sound to play with 10% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"}; +cvar_t cl_sound_r_exp3 = {0, "cl_sound_r_exp3", "1", "sound to play during TE_EXPLOSION and related effects (empty cvar disables sound)"}; static qboolean QW_CL_CheckOrDownloadFile(const char *filename); static void QW_CL_RequestNextDownload(void); @@ -520,13 +527,13 @@ static void QW_CL_RequestNextDownload(void) S_ServerSounds(cl.sound_name, cls.qw_downloadnumber); // precache any sounds used by the client - cl.sfx_wizhit = S_PrecacheSound("sound/wizard/hit.wav", false, true); - cl.sfx_knighthit = S_PrecacheSound("sound/hknight/hit.wav", false, true); - cl.sfx_tink1 = S_PrecacheSound("sound/weapons/tink1.wav", false, true); - cl.sfx_ric1 = S_PrecacheSound("sound/weapons/ric1.wav", false, true); - cl.sfx_ric2 = S_PrecacheSound("sound/weapons/ric2.wav", false, true); - cl.sfx_ric3 = S_PrecacheSound("sound/weapons/ric3.wav", false, true); - cl.sfx_r_exp3 = S_PrecacheSound("sound/weapons/r_exp3.wav", false, true); + cl.sfx_wizhit = S_PrecacheSound(cl_sound_wizardhit.string, false, true); + cl.sfx_knighthit = S_PrecacheSound(cl_sound_hknighthit.string, false, true); + cl.sfx_tink1 = S_PrecacheSound(cl_sound_tink1.string, false, true); + cl.sfx_ric1 = S_PrecacheSound(cl_sound_ric1.string, false, true); + cl.sfx_ric2 = S_PrecacheSound(cl_sound_ric2.string, false, true); + cl.sfx_ric3 = S_PrecacheSound(cl_sound_ric3.string, false, true); + cl.sfx_r_exp3 = S_PrecacheSound(cl_sound_r_exp3.string, false, true); // sounds for (i = 1;i < MAX_SOUNDS && cl.sound_name[i][0];i++) @@ -853,7 +860,7 @@ static void QW_CL_ParseNails(void) } } -static void QW_CL_UpdateItemsAndWeapon(void) +static void CL_UpdateItemsAndWeapon(void) { int j; // check for important changes @@ -1111,13 +1118,13 @@ void CL_ParseServerInfo (void) S_ServerSounds (cl.sound_name, numsounds); // precache any sounds used by the client - cl.sfx_wizhit = S_PrecacheSound("sound/wizard/hit.wav", false, true); - cl.sfx_knighthit = S_PrecacheSound("sound/hknight/hit.wav", false, true); - cl.sfx_tink1 = S_PrecacheSound("sound/weapons/tink1.wav", false, true); - cl.sfx_ric1 = S_PrecacheSound("sound/weapons/ric1.wav", false, true); - cl.sfx_ric2 = S_PrecacheSound("sound/weapons/ric2.wav", false, true); - cl.sfx_ric3 = S_PrecacheSound("sound/weapons/ric3.wav", false, true); - cl.sfx_r_exp3 = S_PrecacheSound("sound/weapons/r_exp3.wav", false, true); + cl.sfx_wizhit = S_PrecacheSound(cl_sound_wizardhit.string, false, true); + cl.sfx_knighthit = S_PrecacheSound(cl_sound_hknighthit.string, false, true); + cl.sfx_tink1 = S_PrecacheSound(cl_sound_tink1.string, false, true); + cl.sfx_ric1 = S_PrecacheSound(cl_sound_ric1.string, false, true); + cl.sfx_ric2 = S_PrecacheSound(cl_sound_ric2.string, false, true); + cl.sfx_ric3 = S_PrecacheSound(cl_sound_ric3.string, false, true); + cl.sfx_r_exp3 = S_PrecacheSound(cl_sound_r_exp3.string, false, true); // now we try to load everything that is new @@ -1289,7 +1296,7 @@ Server information pertaining to this client only */ void CL_ParseClientdata (void) { - int i, j, bits; + int i, bits; VectorCopy (cl.mpunchangle[0], cl.mpunchangle[1]); VectorCopy (cl.mpunchvector[0], cl.mpunchvector[1]); @@ -1397,20 +1404,6 @@ void CL_ParseClientdata (void) cl.stats[STAT_VIEWZOOM] = (unsigned short) MSG_ReadShort(); } - // check for important changes - - // set flash times - if (cl.olditems != cl.stats[STAT_ITEMS]) - for (j = 0;j < 32;j++) - if ((cl.stats[STAT_ITEMS] & (1<width) / 2, 4, "gfx/ttl_sgl"); M_DrawTextBox (60, 8 * 8, 23, 4); - if (gamemode == GAME_NEXUIZ) - M_Print(95, 10 * 8, "Nexuiz is for"); - else if (gamemode == GAME_GOODVSBAD2) + if (gamemode == GAME_GOODVSBAD2) M_Print(95, 10 * 8, "Good Vs Bad 2 is for"); else // if (gamemode == GAME_BATTLEMECH) M_Print(95, 10 * 8, "Battlemech is for"); @@ -783,7 +781,7 @@ void M_SinglePlayer_Draw (void) void M_SinglePlayer_Key (int key, char ascii) { - if (gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH) + if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH) { if (key == K_ESCAPE || key == K_ENTER) m_state = m_main; diff --git a/snd_main.c b/snd_main.c index 33918a36..186fc0e5 100644 --- a/snd_main.c +++ b/snd_main.c @@ -416,6 +416,9 @@ sfx_t *S_PrecacheSound (const char *name, qboolean complain, qboolean lock) if (!snd_initialized.integer) return NULL; + if (name == NULL || name[0] == 0) + return NULL; + sfx = S_FindName (name); if (sfx == NULL) return NULL; diff --git a/sv_phys.c b/sv_phys.c index e505b289..1e58ea8b 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -51,6 +51,9 @@ cvar_t sv_newflymove = {CVAR_NOTIFY, "sv_newflymove", "0", "enables simpler/bugg cvar_t sv_freezenonclients = {CVAR_NOTIFY, "sv_freezenonclients", "0", "freezes time, except for players, allowing you to walk around and take screenshots of explosions"}; cvar_t sv_playerphysicsqc = {CVAR_NOTIFY, "sv_playerphysicsqc", "1", "enables QuakeC function to override player physics"}; +cvar_t sv_sound_watersplash = {0, "sv_sound_watersplash", "misc/h2ohit1.wav", "sound to play when MOVETYPE_FLY/TOSS/BOUNCE/STEP entity enters or leaves water (empty cvar disables the sound)"}; +cvar_t sv_sound_land = {0, "sv_sound_land", "demon/dland2.wav", "sound to play when MOVETYPE_STEP entity hits the ground at high speed (empty cvar disables the sound)"}; + #define MOVE_EPSILON 0.01 void SV_Physics_Toss (prvm_edict_t *ent); @@ -64,6 +67,9 @@ void SV_Phys_Init (void) Cvar_RegisterVariable(&sv_freezenonclients); Cvar_RegisterVariable(&sv_playerphysicsqc); + + Cvar_RegisterVariable(&sv_sound_watersplash); + Cvar_RegisterVariable(&sv_sound_land); } /* @@ -1199,8 +1205,8 @@ void SV_CheckWaterTransition (prvm_edict_t *ent) } // check if the entity crossed into or out of water - if (gamemode != GAME_NEXUIZ && ((ent->fields.server->watertype == CONTENTS_WATER || ent->fields.server->watertype == CONTENTS_SLIME) != (cont == CONTENTS_WATER || cont == CONTENTS_SLIME))) - SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); + if (sv_sound_watersplash.string && ((ent->fields.server->watertype == CONTENTS_WATER || ent->fields.server->watertype == CONTENTS_SLIME) != (cont == CONTENTS_WATER || cont == CONTENTS_SLIME))) + SV_StartSound (ent, 0, sv_sound_watersplash.string, 255, 1); if (cont <= CONTENTS_WATER) { @@ -1381,8 +1387,8 @@ void SV_Physics_Step (prvm_edict_t *ent) SV_LinkEdict(ent, true); // just hit ground - if (hitsound && (int)ent->fields.server->flags & FL_ONGROUND && gamemode != GAME_NEXUIZ) - SV_StartSound(ent, 0, "demon/dland2.wav", 255, 1); + if (hitsound && (int)ent->fields.server->flags & FL_ONGROUND && sv_sound_land.string) + SV_StartSound(ent, 0, sv_sound_land.string, 255, 1); } }