Skip to content

Commit

Permalink
Heretic|Hexen: Added audio feedback for "view-size" changes
Browse files Browse the repository at this point in the history
Matches the behavior of the original games.
  • Loading branch information
skyjake committed Feb 7, 2012
1 parent c47026f commit c8ce5d5
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 83 deletions.
70 changes: 30 additions & 40 deletions 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 <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
/**
* @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 <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
*
* 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.
* <small>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</small>
*/

// HEADER FILES ------------------------------------------------------------

#include <string.h>

#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);
Expand Down Expand Up @@ -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},

Expand Down Expand Up @@ -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);
}
73 changes: 30 additions & 43 deletions 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 <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
/**
* @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 <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
*
* 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.
* <small>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</small>
*/

// HEADER FILES ------------------------------------------------------------

#include <string.h>

#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);
Expand Down Expand Up @@ -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},

Expand Down Expand Up @@ -198,10 +179,6 @@ ccmdtemplate_t gameCCmds[] = {
{NULL}
};

// PRIVATE DATA DEFINITIONS ------------------------------------------------

// CODE --------------------------------------------------------------------

/**
* Add the console variables and commands.
*/
Expand Down Expand Up @@ -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);
}

0 comments on commit c8ce5d5

Please sign in to comment.