Skip to content

Commit

Permalink
Refactor|Hexen: Use HexLex to parse SNDINFO/SNDSEQ data
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 23, 2014
1 parent 067e9b5 commit ff8d2ed
Show file tree
Hide file tree
Showing 10 changed files with 764 additions and 803 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/common/common.pri
Expand Up @@ -107,7 +107,7 @@ SOURCES += \
$$common_src/p_saveg.cpp \
$$common_src/p_saveio.c \
$$common_src/p_scroll.c \
$$common_src/p_sound.c \
$$common_src/p_sound.cpp \
$$common_src/p_start.cpp \
$$common_src/p_switch.c \
$$common_src/p_terraintype.c \
Expand Down
45 changes: 27 additions & 18 deletions doomsday/plugins/common/include/p_sound.h
@@ -1,12 +1,10 @@
/**
* @file p_sound.h
* id tech 1 sound playback functionality for the play simulation.
/** @file p_sound.h id Tech 1 sound playback functionality.
*
* @ingroup play
*
* @authors Copyright &copy; 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright &copy; 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright &copy; 1993-1996 by id Software, Inc.
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 1993-1996 id Software, Inc.
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -28,38 +26,49 @@

#include "doomsday.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* Start the song for the specified map.
*/
void S_MapMusic(uint episode, uint map);

/**
* Doom-like sector sounds: when a new sound starts, stop any existing
* sounds from other origins in this Sector.
* Doom-like sector sounds: when a new sound starts, stop any existing sounds from
* other origins in this Sector.
*
* @param sec Sector to use as the origin of the sound.
* @param id ID number of the sound to be played.
* @param sec Sector to use as the origin of the sound.
* @param id ID number of the sound to be played.
*/
void S_SectorSound(Sector* sec, int id);

/**
* @param sec Sector in which to stop sounds.
* @param sec Sector in which to stop sounds.
*/
void S_SectorStopSounds(Sector* sec);

/**
* Doom-like sector sounds: when a new sound starts, stop any existing
* sounds from other origins in the same Sector.
* Doom-like sector sounds: when a new sound starts, stop any existing sounds from
* other origins in the same Sector.
*
* @param plane Plane to use as the origin of the sound.
* @param id ID number of the sound to be played.
* @param plane Plane to use as the origin of the sound.
* @param id ID number of the sound to be played.
*/
void S_PlaneSound(Plane* pln, int id);
void S_PlaneSound(Plane *pln, int id);

#ifdef __JHEXEN__
int S_GetSoundID(const char* name);
int S_GetSoundID(char const *name);

/**
* Attempt to parse the script on the identified @a path as "sound definition" data.
*/
void SndInfoParser(Str const *path);
#endif

void S_ParseSndInfoLump(void);
#ifdef __cplusplus
} // extern "C"
#endif

#endif // LIBCOMMON_PLAY_SOUND_H
72 changes: 18 additions & 54 deletions doomsday/plugins/common/src/g_update.c
@@ -1,44 +1,24 @@
/**\file g_update.c
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file g_update.c Engine reset => game update logic.
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*
* 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.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* 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>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>
*/

/**
* Routines to call when updating the state of the engine
*/

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

#include <ctype.h>

#if __JDOOM__
# include "jdoom.h"
#elif __JDOOM64__
# include "jdoom64.h"
#elif __JHERETIC__
# include "jheretic.h"
#elif __JHEXEN__
# include "jhexen.h"
#endif
#include "common.h"

#include "hu_chat.h"
#include "hu_log.h"
Expand All @@ -54,27 +34,11 @@
# include "m_cheat.h"
#endif

// MACROS ------------------------------------------------------------------
#include <ctype.h>

#define MANGLE_STATE(x) (INT2PTR(state_t, ((x)? (x)-STATES : -1)))
#define RESTORE_STATE(x) (PTR2INT(x) < 0? NULL : &STATES[PTR2INT(x)])

// TYPES -------------------------------------------------------------------

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

// PUBLIC DATA DEFINITIONS -------------------------------------------------

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

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

static int mangleMobj(thinker_t* th, void* context)
{
mobj_t* mo = (mobj_t *) th;
Expand Down Expand Up @@ -164,7 +128,7 @@ void G_UpdateState(int step)
Hu_MenuInit();

#if __JHEXEN__
S_ParseSndInfoLump();
SndInfoParser(AutoStr_FromText("Lumps:SNDINFO"));
#endif

#if __JDOOM__ || __JHERETIC__ || __JDOOM64__
Expand Down
175 changes: 0 additions & 175 deletions doomsday/plugins/common/src/p_sound.c

This file was deleted.

0 comments on commit ff8d2ed

Please sign in to comment.