From c8ce5d55a30f522d93993f8c68aebc995e03e34f Mon Sep 17 00:00:00 2001 From: skyjake Date: Tue, 7 Feb 2012 08:11:42 +0200 Subject: [PATCH] Heretic|Hexen: Added audio feedback for "view-size" changes Matches the behavior of the original games. --- doomsday/plugins/jheretic/src/h_console.c | 70 ++++++++++------------ doomsday/plugins/jhexen/src/hconsole.c | 73 ++++++++++------------- 2 files changed, 60 insertions(+), 83 deletions(-) diff --git a/doomsday/plugins/jheretic/src/h_console.c b/doomsday/plugins/jheretic/src/h_console.c index 0ebd7725df..c11f060989 100644 --- a/doomsday/plugins/jheretic/src/h_console.c +++ b/doomsday/plugins/jheretic/src/h_console.c @@ -1,48 +1,32 @@ -/**\file h_console.c - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html - * - *\author Copyright © 2003-2012 Jaakko Keränen - *\author Copyright © 2005-2012 Daniel Swanson +/** + * @file h_console.c + * Heretic specific console stuff. @ingroup console * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @authors Copyright © 2003-2012 Jaakko Keränen + * @authors Copyright © 2005-2012 Daniel Swanson * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * Heretic specific console stuff. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -// HEADER FILES ------------------------------------------------------------ - #include #include "jheretic.h" - +#include "hu_menu.h" #include "hu_stuff.h" #include "p_inventory.h" -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - D_CMD(Cheat); D_CMD(CheatGod); D_CMD(CheatNoClip); @@ -72,18 +56,14 @@ D_CMD(PrintPlayerCoords); void G_UpdateEyeHeight(void); -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - D_CMD(ScreenShot); -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- +static void viewResizeAudioFeedback(void); // Console variables. cvartemplate_t gameCVars[] = { // View/Refresh - {"view-size", 0, CVT_INT, &cfg.setBlocks, 3, 13}, + {"view-size", 0, CVT_INT, &cfg.setBlocks, 3, 13, viewResizeAudioFeedback }, {"hud-title", 0, CVT_BYTE, &cfg.mapTitle, 0, 1}, {"hud-title-author-noiwad", 0, CVT_BYTE, &cfg.hideIWADAuthor, 0, 1}, @@ -243,3 +223,13 @@ D_CMD(ScreenShot) G_ScreenShot(); return true; } + +static void viewResizeAudioFeedback(void) +{ + if(Hu_MenuIsActive()) + { + // The menu slider plays its own audio feedback. + return; + } + S_LocalSound(SFX_KEYUP, NULL); +} diff --git a/doomsday/plugins/jhexen/src/hconsole.c b/doomsday/plugins/jhexen/src/hconsole.c index de1c988c37..046ccf9eaa 100644 --- a/doomsday/plugins/jhexen/src/hconsole.c +++ b/doomsday/plugins/jhexen/src/hconsole.c @@ -1,51 +1,36 @@ -/**\file h_console.c - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html - * - *\author Copyright © 2003-2012 Jaakko Keränen - *\author Copyright © 2005-2012 Daniel Swanson +/** + * @file h_console.c + * Hexen specific console stuff. @ingroup console * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @authors Copyright © 2003-2012 Jaakko Keränen + * @authors Copyright © 2005-2012 Daniel Swanson * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * Hexen specific console stuff. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -// HEADER FILES ------------------------------------------------------------ - #include #include "jhexen.h" #include "d_net.h" +#include "hu_menu.h" #include "hu_stuff.h" #include "g_common.h" #include "g_controls.h" #include "p_inventory.h" -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - D_CMD(Cheat); D_CMD(CheatGod); D_CMD(CheatNoClip); @@ -79,16 +64,12 @@ D_CMD(ScreenShot); void G_UpdateEyeHeight(void); -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- +static void viewResizeAudioFeedback(void); // Console variables. cvartemplate_t gameCVars[] = { // View/Refresh - {"view-size", 0, CVT_INT, &cfg.setBlocks, 3, 13}, + {"view-size", 0, CVT_INT, &cfg.setBlocks, 3, 13, viewResizeAudioFeedback}, {"hud-title", 0, CVT_BYTE, &cfg.mapTitle, 0, 1}, {"hud-title-author-noiwad", 0, CVT_BYTE, &cfg.hideIWADAuthor, 0, 1}, @@ -198,10 +179,6 @@ ccmdtemplate_t gameCCmds[] = { {NULL} }; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - /** * Add the console variables and commands. */ @@ -229,3 +206,13 @@ D_CMD(ScreenShot) G_ScreenShot(); return true; } + +static void viewResizeAudioFeedback(void) +{ + if(Hu_MenuIsActive()) + { + // The menu slider plays its own audio feedback. + return; + } + S_LocalSound(SFX_PICKUP_KEY, NULL); +}