Skip to content

Commit

Permalink
- split off all music code from s_sound.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 23, 2019
1 parent 1595bf3 commit 66db894
Show file tree
Hide file tree
Showing 25 changed files with 1,075 additions and 808 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -1001,6 +1001,7 @@ set (PCH_SOURCES
sound/s_environment.cpp
sound/s_sndseq.cpp
sound/s_sound.cpp
sound/s_music.cpp
serializer.cpp
scriptutil.cpp
st_stuff.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/console/c_console.cpp
Expand Up @@ -64,6 +64,7 @@
#include "g_levellocals.h"
#include "vm.h"
#include "utf8.h"
#include "s_music.h"


#include "gi.h"
Expand Down Expand Up @@ -1268,6 +1269,7 @@ void C_FullConsole ()
gamestate = GS_FULLCONSOLE;
primaryLevel->Music = "";
S_Start ();
S_StartMusic();
P_FreeLevelData ();
}
else
Expand Down
4 changes: 4 additions & 0 deletions src/d_main.cpp
Expand Up @@ -102,6 +102,7 @@
#include "g_cvars.h"
#include "r_data/r_vanillatrans.h"
#include "atterm.h"
#include "s_music.h"

EXTERN_CVAR(Bool, hud_althud)
EXTERN_CVAR(Int, vr_mode)
Expand Down Expand Up @@ -1034,6 +1035,7 @@ void D_DoomLoop ()
// Update display, next frame, with current state.
I_StartTic ();
D_Display ();
S_UpdateMusic();
if (wantToRestart)
{
wantToRestart = false;
Expand Down Expand Up @@ -2459,6 +2461,7 @@ void D_DoomMain (void)

if (!batchrun) Printf ("S_Init: Setting up sound.\n");
S_Init ();
S_InitMusic();

if (!batchrun) Printf ("ST_Init: Init startup screen.\n");
if (!restart)
Expand Down Expand Up @@ -2752,6 +2755,7 @@ void D_DoomMain (void)
R_DeinitTranslationTables(); // some tables are initialized from outside the translation code.
gameinfo.~gameinfo_t();
new (&gameinfo) gameinfo_t; // Reset gameinfo
S_ShutdownMusic();
S_Shutdown(); // free all channels and delete playlist
C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here
DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods
Expand Down
1 change: 1 addition & 0 deletions src/d_net.cpp
Expand Up @@ -67,6 +67,7 @@
#include "i_system.h"
#include "vm.h"
#include "gstrings.h"
#include "s_music.h"

EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (Int, autosavecount)
Expand Down
8 changes: 8 additions & 0 deletions src/g_level.cpp
Expand Up @@ -89,6 +89,7 @@
#include "actorinlines.h"
#include "i_time.h"
#include "p_maputl.h"
#include "s_music.h"

void STAT_StartNewGame(const char *lev);
void STAT_ChangeLevel(const char *newl, FLevelLocals *Level);
Expand Down Expand Up @@ -2221,3 +2222,10 @@ int IsPointInMap(FLevelLocals *Level, double x, double y, double z)
return true;
}


void FLevelLocals::SetMusic()
{
if (cdtrack == 0 || !S_ChangeCDMusic(cdtrack, cdid))
S_ChangeMusic(Music, musicorder);
}

7 changes: 2 additions & 5 deletions src/g_levellocals.h
Expand Up @@ -424,11 +424,8 @@ struct FLevelLocals
return thinker;
}

void SetMusic()
{
if (cdtrack == 0 || !S_ChangeCDMusic(cdtrack, cdid))
S_ChangeMusic(Music, musicorder);
}
void SetMusic();


TArray<vertex_t> vertexes;
TArray<sector_t> sectors;
Expand Down
3 changes: 2 additions & 1 deletion src/intermission/intermission.cpp
Expand Up @@ -51,6 +51,7 @@
#include "g_levellocals.h"
#include "utf8.h"
#include "templates.h"
#include "s_music.h"

FIntermissionDescriptorList IntermissionDescriptors;

Expand Down Expand Up @@ -1100,4 +1101,4 @@ CCMD(measureintermissions)
}
}
}
}
}
1 change: 1 addition & 0 deletions src/p_saveg.cpp
Expand Up @@ -59,6 +59,7 @@
#include "r_sky.h"
#include "version.h"
#include "fragglescript/t_script.h"
#include "s_music.h"

EXTERN_CVAR(Bool, save_formatted)

Expand Down
2 changes: 2 additions & 0 deletions src/p_setup.cpp
Expand Up @@ -76,6 +76,7 @@
#include "v_video.h"
#include "fragglescript/t_script.h"
#include "atterm.h"
#include "s_music.h"

extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);

Expand Down Expand Up @@ -407,6 +408,7 @@ void P_SetupLevel(FLevelLocals *Level, int position, bool newGame)

// Make sure all sounds are stopped before Z_FreeTags.
S_Start();
S_StartMusic();

// [RH] clear out the mid-screen message
C_MidPrint(nullptr, nullptr);
Expand Down
1 change: 0 additions & 1 deletion src/playsim/a_dynlight.cpp
Expand Up @@ -989,4 +989,3 @@ void FLevelLocals::RecreateAllAttachedLights()
}
}
}

1 change: 1 addition & 0 deletions src/playsim/fragglescript/t_func.cpp
Expand Up @@ -51,6 +51,7 @@
#include "scriptutil.h"
#include "vm.h"
#include "a_lights.h"
#include "s_music.h"

static FRandom pr_script("FScript");

Expand Down
1 change: 1 addition & 0 deletions src/playsim/fragglescript/t_load.cpp
Expand Up @@ -34,6 +34,7 @@
#include "g_levellocals.h"
#include "xlat/xlat.h"
#include "maploader/maploader.h"
#include "s_music.h"

class FScriptLoader
{
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_acs.cpp
Expand Up @@ -75,6 +75,7 @@
#include "actorinlines.h"
#include "types.h"
#include "scriptutil.h"
#include "s_music.h"

// P-codes for ACS scripts
enum
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_user.cpp
Expand Up @@ -91,6 +91,7 @@
#include "g_game.h"
#include "v_video.h"
#include "gstrings.h"
#include "s_music.h"

static FRandom pr_skullpop ("SkullPop");

Expand Down
1 change: 1 addition & 0 deletions src/posix/cocoa/i_main.mm
Expand Up @@ -46,6 +46,7 @@
#include "st_console.h"
#include "version.h"
#include "doomerrors.h"
#include "s_music.h"


#define ZD_UNUSED(VARIABLE) ((void)(VARIABLE))
Expand Down
1 change: 1 addition & 0 deletions src/sound/backend/i_sound.cpp
Expand Up @@ -48,6 +48,7 @@
#include "v_text.h"
#include "c_cvars.h"
#include "stats.h"
#include "s_music.h"

EXTERN_CVAR (Float, snd_sfxvolume)
EXTERN_CVAR (Float, snd_musicvolume)
Expand Down
1 change: 1 addition & 0 deletions src/sound/music/i_music.cpp
Expand Up @@ -47,6 +47,7 @@
#include "stats.h"
#include "timidity/timidity.h"
#include "vm.h"
#include "s_music.h"



Expand Down
1 change: 1 addition & 0 deletions src/sound/music/music_midi_base.cpp
Expand Up @@ -36,6 +36,7 @@

#include "v_text.h"
#include "menu/menu.h"
#include "s_music.h"

static uint32_t nummididevices;
static bool nummididevicesset;
Expand Down
1 change: 1 addition & 0 deletions src/sound/s_advsound.cpp
Expand Up @@ -49,6 +49,7 @@
#include "vm.h"
#include "i_system.h"
#include "atterm.h"
#include "s_music.h"

// MACROS ------------------------------------------------------------------

Expand Down

0 comments on commit 66db894

Please sign in to comment.