diff --git a/src/doomdef.h b/src/doomdef.h index ffffd59d5..5318ee3e7 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -564,7 +564,7 @@ typedef enum DBG_DETAILED = 0x00000002, DBG_PLAYER = 0x00000004, DBG_RENDER = 0x00000008, - //DBG_NIGHTSBASIC = 0x00000010, // free + DBG_MUSIC = 0x00000010, //DBG_NIGHTS = 0x00000020, // free DBG_POLYOBJ = 0x00000040, DBG_GAMELOGIC = 0x00000080, diff --git a/src/m_cheat.c b/src/m_cheat.c index edd23041c..3124db460 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -690,6 +690,7 @@ struct debugFlagNames_s const debug_flag_names[] = {"Lua", DBG_LUA}, {"RNG", DBG_RNG}, {"Randomizer", DBG_RNG}, // alt name + {"Music", DBG_MUSIC}, {NULL, 0} }; diff --git a/src/s_sound.c b/src/s_sound.c index b8b621f95..d5557f43a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1364,7 +1364,7 @@ int musicdef_volume; // // Find music def by 6 char name // -static musicdef_t *S_FindMusicDef(const char *name) +musicdef_t *S_FindMusicDef(const char *name) { musicdef_t *def = musicdefstart; @@ -2461,8 +2461,6 @@ static inline void PrintMusicDefField(const char *label, const char *field) static void PrintSongAuthors(const musicdef_t *def) { - CONS_Printf("Volume: %d/100\n\n", def->volume); - PrintMusicDefField("Title: ", def->title); PrintMusicDefField("Author: ", def->author); diff --git a/src/s_sound.h b/src/s_sound.h index bd3ad99e4..14192b377 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -202,6 +202,7 @@ extern int musicdef_volume; void S_LoadMusicDefs(UINT16 wadnum); void S_InitMusicDefs(void); +musicdef_t *S_FindMusicDef(const char *name); void S_ShowMusicCredit(void); // diff --git a/src/st_stuff.c b/src/st_stuff.c index 3f7e793eb..5216edc8c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -357,6 +357,60 @@ static INT32 SCR(INT32 r) // ========================================================================= // Devmode information + +static void ST_pushDebugString(INT32 *height, const char *string) +{ + V_DrawRightAlignedString(320, *height, V_MONOSPACE, string); + *height -= 8; +} + +static void ST_pushDebugTimeMS(INT32 *height, const char *label, UINT32 ms) +{ + ST_pushDebugString(height, va("%s%02d:%05.2f", label, + ms / 60000, ms % 60000 / 1000.f)); +} + +static void ST_drawMusicDebug(INT32 *height) +{ + char mname[7]; + UINT16 mflags; // unused + boolean looping; + + const musicdef_t *def; + const char *format; + + if (!S_MusicInfo(mname, &mflags, &looping)) + { + ST_pushDebugString(height, "Song: "); + return; + } + + def = S_FindMusicDef(mname); + format = S_MusicType(); + + ST_pushDebugTimeMS(height, " Elapsed: ", S_GetMusicPosition()); + ST_pushDebugTimeMS(height, looping + ? " Loop B: " + : "Duration: ", S_GetMusicLength()); + + if (looping) + { + ST_pushDebugTimeMS(height, " Loop A: ", S_GetMusicLoopPoint()); + } + + if (def) + { + ST_pushDebugString(height, va(" Volume: %4d/100", def->volume)); + } + + if (format) + { + ST_pushDebugString(height, va(" Format: %8s", S_MusicType())); + } + + ST_pushDebugString(height, va(" Song: %8s", mname)); +} + static void ST_drawDebugInfo(void) { INT32 height = 192; @@ -419,6 +473,11 @@ static void ST_drawDebugInfo(void) height -= 32; } + if (cht_debug & DBG_MUSIC) + { + ST_drawMusicDebug(&height); + } + if (cht_debug & DBG_MEMORY) V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10))); }