diff --git a/Makefile.mingw b/Makefile.mingw index d49b5b379..bd7f39f4e 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -28,7 +28,7 @@ ifndef RELEASETARGET RELEASETARGET = zdoomgcc.exe endif ifndef DEBUGTARGET - DEBUGTARGE = zdoomgccd.exe + DEBUGTARGET = zdoomgccd.exe endif DEBUGOBJDIR = debugobj RELEASEOBJDIR = releaseobj @@ -156,6 +156,7 @@ OBJECTS += \ $(OBJDIR)/p_writemap.o \ $(OBJDIR)/p_xlat.o \ $(OBJDIR)/po_man.o \ + $(OBJDIR)/r_anim.o \ $(OBJDIR)/r_bsp.o \ $(OBJDIR)/r_data.o \ $(OBJDIR)/r_draw.o \ @@ -365,7 +366,6 @@ OBJECTS += \ ifndef NOASM OBJECTS += \ $(OBJDIR)/a.o \ - $(OBJDIR)/blocks.o \ $(OBJDIR)/misc.o \ $(OBJDIR)/tmap.o \ $(OBJDIR)/tmap2.o \ diff --git a/default.cbd b/default.cbd index d3822cb13..f9c9494d9 100644 --- a/default.cbd +++ b/default.cbd @@ -138,7 +138,6 @@ done ${COMPILER} "autostart.cpp \ a.nas \ - blocks.nas \ misc.nas \ tmap.nas \ tmap2.nas \ @@ -235,6 +234,7 @@ ${COMPILER} "autostart.cpp \ p_writemap.cpp \ p_xlat.cpp \ po_man.cpp \ + r_anim.cpp \ r_bsp.cpp \ r_data.cpp \ r_draw.cpp \ diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 6ae3ce61e..57bfc3e26 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +May 20, 2006 +- Fixed default.cbd and Makefile.mingw for current code state. +- New: Pausing the game (through any means, not just the pause key) now pauses + sound effects as well as music. "PauseMusicInMenus" has been added as a + MAPINFO flag to also pause the music when a menu or the console are open. + May 20, 2006 (Changes by Graf Zahl) - Fixed: The automap code had the check for rotation reversed. - Changed type PClass::FreeIndices to TArray because that's diff --git a/src/d_net.cpp b/src/d_net.cpp index 326b32ed9..6b86a581c 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2175,7 +2175,7 @@ void Net_DoCommand (int type, byte **stream, int player) else { paused = player + 1; - S_PauseSound (); + S_PauseSound (false); } BorderNeedRefresh = screen->GetPageCount (); } diff --git a/src/g_level.cpp b/src/g_level.cpp index fe411483f..ea5c1f347 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -246,6 +246,7 @@ static const char *MapInfoMapLevel[] = "wrapmidtextures", "allowcrouch", "nocrouch", + "pausemusicinmenus", NULL }; @@ -361,6 +362,7 @@ MapHandlers[] = { MITYPE_SETFLAG, LEVEL_WRAPMIDTEX, 0 }, { MITYPE_SCFLAGS, LEVEL_CROUCH_YES, ~LEVEL_CROUCH_NO }, { MITYPE_SCFLAGS, LEVEL_CROUCH_NO, ~LEVEL_CROUCH_YES }, + { MITYPE_SCFLAGS, LEVEL_PAUSE_MUSIC_IN_MENUS, 0 }, }; static const char *MapInfoClusterLevel[] = diff --git a/src/g_level.h b/src/g_level.h index ad4b0bf2c..e5cadc7a5 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -106,6 +106,8 @@ #define LEVEL_CROUCH_NO UCONST64(0x80000000000) #define LEVEL_CROUCH_YES UCONST64(0x100000000000) +#define LEVEL_PAUSE_MUSIC_IN_MENUS UCONST64(0x200000000000) + struct acsdefered_s; struct FSpecialAction diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 9bef2392a..9f5b4a035 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -63,6 +63,7 @@ #include "templates.h" #include "lists.h" #include "gi.h" +#include "p_tick.h" // MACROS ------------------------------------------------------------------ @@ -587,6 +588,9 @@ void M_ActivateMenuInput () { ResetButtonStates (); menuactive = MENU_On; + // Pause sound effects before we play the menu switch sound. + // That way, it won't be paused. + P_CheckTickerPaused (); } void M_DeactivateMenuInput () diff --git a/src/m_random.cpp b/src/m_random.cpp index 40fa1b832..f96148b12 100644 --- a/src/m_random.cpp +++ b/src/m_random.cpp @@ -170,7 +170,6 @@ int FRandom::HitDice (int count) void FRandom::StaticClearRandom () { - Printf ("init with seed %d\n", rngseed); const DWORD seed = rngseed*2+1; // add 3/26/98: add rngseed FRandom *rng = FRandom::RNGList; diff --git a/src/p_tick.cpp b/src/p_tick.cpp index f894ea778..33a0a688d 100644 --- a/src/p_tick.cpp +++ b/src/p_tick.cpp @@ -27,12 +27,40 @@ #include "p_acs.h" #include "c_console.h" #include "b_bot.h" - +#include "s_sound.h" #include "doomstat.h" #include "sbar.h" extern gamestate_t wipegamestate; +//========================================================================== +// +// P_CheckTickerPaused +// +// Returns true if the ticker should be paused. In that cause, it also +// pauses sound effects and possibly music. If the ticker should not be +// paused, then it returns false but does not unpause anything. +// +//========================================================================== + +bool P_CheckTickerPaused () +{ + // pause if in menu or console and at least one tic has been run + if ( !netgame + && gamestate != GS_TITLELEVEL + && ((menuactive != MENU_Off && menuactive != MENU_OnNoPause) || + ConsoleState == c_down || ConsoleState == c_falling) + && !demoplayback + && !demorecording + && players[consoleplayer].viewz != 1 + && wipegamestate == gamestate) + { + S_PauseSound (!(level.flags & LEVEL_PAUSE_MUSIC_IN_MENUS)); + return true; + } + return false; +} + // // P_Ticker // @@ -44,22 +72,10 @@ void P_Ticker (void) r_NoInterpolate = true; // run the tic - if (paused) + if (paused || P_CheckTickerPaused()) return; - // pause if in menu or console and at least one tic has been run - if ( !netgame - && gamestate != GS_TITLELEVEL - && ((menuactive != MENU_Off && menuactive != MENU_OnNoPause) || - ConsoleState == c_down || ConsoleState == c_falling) - && !demoplayback - && !demorecording - && players[consoleplayer].viewz != 1 - && wipegamestate == gamestate) - { - return; - } - + S_ResumeSound (); P_ResetSightCounters (false); // Since things will be moving, it's okay to interpolate them in the renderer. diff --git a/src/p_tick.h b/src/p_tick.h index 8bf195678..aa35fff63 100644 --- a/src/p_tick.h +++ b/src/p_tick.h @@ -30,6 +30,7 @@ // Carries out all thinking of monsters and players. void P_Ticker (void); +bool P_CheckTickerPaused (); #endif diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d39be3f2e..3b2928923 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -142,7 +142,8 @@ static void CalcPosVel (fixed_t *pt, AActor *mover, int constz, float pos[3], int MAX_SND_DIST; static channel_t *Channel; // the set of channels available -static BOOL mus_paused; // whether songs are paused +static bool SoundPaused; // whether sound effects are paused +static bool MusicPaused; // whether music is paused static MusPlayingInfo mus_playing; // music currently being played static FString LastSong; // last music that was played static byte *SoundCurve; @@ -341,7 +342,8 @@ void S_Init () } // no sounds are playing, and they are not paused - mus_paused = 0; + MusicPaused = false; + SoundPaused = false; // Note that sounds have not been cached (yet). // for (i=1; (size_t)i < S_sfx.Size (); i++) @@ -442,7 +444,8 @@ void S_Start () } // start new music for the level - mus_paused = 0; + MusicPaused = false; + SoundPaused = false; // [RH] This is a lot simpler now. if (!savegamerestore) @@ -1227,15 +1230,20 @@ bool S_IsActorPlayingSomething (AActor *actor, int channel) // // S_PauseSound // -// Stop music, during game PAUSE. +// Stop music and sound effects, during game PAUSE. //========================================================================== -void S_PauseSound () +void S_PauseSound (bool notmusic) { - if (mus_playing.handle && !mus_paused) + if (!notmusic && mus_playing.handle && !MusicPaused) { I_PauseSong (mus_playing.handle); - mus_paused = true; + MusicPaused = true; + } + if (GSnd != NULL && !SoundPaused) + { + GSnd->SetSfxPaused (true); + SoundPaused = true; } } @@ -1243,15 +1251,20 @@ void S_PauseSound () // // S_ResumeSound // -// Resume music, after game PAUSE. +// Resume music and sound effects, after game PAUSE. //========================================================================== void S_ResumeSound () { - if (mus_playing.handle && mus_paused) + if (mus_playing.handle && MusicPaused) { I_ResumeSong (mus_playing.handle); - mus_paused = false; + MusicPaused = false; + } + if (GSnd != NULL && SoundPaused) + { + GSnd->SetSfxPaused (false); + SoundPaused = false; } } @@ -1603,7 +1616,7 @@ void S_StopMusic (bool force) // [RH] Don't stop if a playlist is active. if ((force || PlayList == NULL) && !mus_playing.name.IsEmpty()) { - if (mus_paused) + if (MusicPaused) I_ResumeSong(mus_playing.handle); I_StopSong(mus_playing.handle); diff --git a/src/s_sound.h b/src/s_sound.h index 5388821e9..806f5c2b0 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -171,7 +171,7 @@ int S_GetMusic (char **name); void S_StopMusic (bool force); // Stop and resume music, during game PAUSE. -void S_PauseSound (); +void S_PauseSound (bool notmusic); void S_ResumeSound (); // diff --git a/src/sdl/i_input.cpp b/src/sdl/i_input.cpp index 5d3df7f82..29441c894 100644 --- a/src/sdl/i_input.cpp +++ b/src/sdl/i_input.cpp @@ -268,12 +268,12 @@ void MessagePump (const SDL_Event &sev) { // kill focus FlushDIKState (); if (!paused) - S_PauseSound (); + S_PauseSound (false); } else { // set focus if (!paused) - S_ResumeSound (); + S_ResumeSound (false); } } break; diff --git a/src/sound/altsound.cpp b/src/sound/altsound.cpp index 1927796be..067dd9fe6 100644 --- a/src/sound/altsound.cpp +++ b/src/sound/altsound.cpp @@ -75,6 +75,7 @@ struct AltSoundRenderer::Channel SDWORD LeftVolume; SDWORD RightVolume; bool Looping; + bool Paused; CRITICAL_SECTION CriticalSection; }; @@ -521,6 +522,7 @@ long AltSoundRenderer::StartSound (sfxinfo_t *sfx, int vol, int sep, int pitch, chan->LeftVolume = left; chan->RightVolume = right; chan->Looping = !!looping; + chan->Paused = false; LeaveCriticalSection (&chan->CriticalSection); return channel + 1; @@ -541,6 +543,22 @@ void AltSoundRenderer::StopSound (long handle) chan->Sample = NULL; } +//========================================================================== +// +// AltSoundRenderer :: SetSfxPaused +// +//========================================================================== + +void AltSoundRenderer::SetSfxPaused (bool paused) +{ + if (Channels == NULL) return; + + for (int i = 0; i < NumChannels; ++i) + { + Channels[i].Paused = paused; + } +} + //========================================================================== // // AltSoundRenderer :: IsPlayingSound @@ -857,7 +875,7 @@ void AltSoundRenderer::UpdateSound () for (int i = 0; i < NumChannels; ++i) { EnterCriticalSection (&Channels[i].CriticalSection); - if (Channels[i].Sample != NULL) + if (Channels[i].Sample != NULL && !Channels[i].Paused) { if (Channels[i].Sample->b16bit) { diff --git a/src/sound/altsound.h b/src/sound/altsound.h index 34cc433c4..252f4d6db 100644 --- a/src/sound/altsound.h +++ b/src/sound/altsound.h @@ -30,6 +30,9 @@ public: // Stops a sound channel. void StopSound (long handle); + // Pauses or resumes all sound effect channels. + void SetSfxPaused (bool paused); + // Returns true if the channel is still playing a sound. bool IsPlayingSound (long handle); diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index ee385b0eb..72b637f62 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -739,7 +739,7 @@ long FMODSoundRenderer::StartSound3D (sfxinfo_t *sfx, float vol, int pitch, int void FMODSoundRenderer::StopSound (long handle) { - if (!handle ||!ChannelMap) + if (!handle || !ChannelMap) return; handle--; @@ -752,6 +752,16 @@ void FMODSoundRenderer::StopSound (long handle) } } +void FMODSoundRenderer::SetSfxPaused (bool paused) +{ + for (int i = 0; i < NumChannels; ++i) + { + if (ChannelMap[i].soundID != -1) + { + FSOUND_SetPaused (ChannelMap[i].channelID, paused); + } + } +} bool FMODSoundRenderer::IsPlayingSound (long handle) { diff --git a/src/sound/fmodsound.h b/src/sound/fmodsound.h index a7a063b2d..f1065ef4a 100644 --- a/src/sound/fmodsound.h +++ b/src/sound/fmodsound.h @@ -32,6 +32,9 @@ public: // Stops a sound channel. void StopSound (long handle); + // Pauses or resumes all sound effect channels. + void SetSfxPaused (bool paused); + // Returns true if the channel is still playing a sound. bool IsPlayingSound (long handle); diff --git a/src/sound/i_sound.h b/src/sound/i_sound.h index e49f91bfd..50be4e2b3 100644 --- a/src/sound/i_sound.h +++ b/src/sound/i_sound.h @@ -99,6 +99,9 @@ public: // Stops a sound channel. virtual void StopSound (long handle) = 0; + // Pauses or resumes all sound effect channels. + virtual void SetSfxPaused (bool paused) = 0; + // Returns true if the channel is still playing a sound. virtual bool IsPlayingSound (long handle) = 0; diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index ae22569a3..315472d49 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -1538,7 +1538,7 @@ static void SetSoundPaused (int state) { if (paused == 0) { - S_PauseSound (); + S_PauseSound (false); if (!netgame #ifdef _DEBUG && !demoplayback