Musictest #80
No files matched your search
@@ -1504,6 +1504,7 @@ void D_SRB2Main(void)
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
}
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
|
||||
@@ -1111,6 +1111,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_lastserver);
|
||||
|
||||
CV_RegisterVar(&cv_showallmaps);
|
||||
CV_RegisterVar(&cv_showmusicfilename);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
|
||||
+421
-3
@@ -224,6 +224,7 @@ static void M_GetAllEmeralds(INT32 choice);
|
||||
static void M_DestroyRobots(INT32 choice);
|
||||
//static void M_LevelSelectWarp(INT32 choice);
|
||||
static void M_Credits(INT32 choice);
|
||||
static void M_MusicTest(INT32 choice);
|
||||
static void M_PandorasBox(INT32 choice);
|
||||
static void M_EmblemHints(INT32 choice);
|
||||
static char *M_GetConditionString(condition_t cond);
|
||||
@@ -393,6 +394,7 @@ static void M_DrawCenteredMenu(void);
|
||||
static void M_DrawAddons(void);
|
||||
static void M_DrawSkyRoom(void);
|
||||
static void M_DrawChecklist(void);
|
||||
static void M_DrawMusicTest(void);
|
||||
static void M_DrawEmblemHints(void);
|
||||
static void M_DrawPauseMenu(void);
|
||||
static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade);
|
||||
@@ -427,6 +429,7 @@ static boolean M_ExitPandorasBox(void);
|
||||
static boolean M_QuitMultiPlayerMenu(void);
|
||||
static void M_HandleAddons(INT32 choice);
|
||||
static void M_HandleSoundTest(INT32 choice);
|
||||
static void M_HandleMusicTest(INT32 choice);
|
||||
static void M_HandleImageDef(INT32 choice);
|
||||
//static void M_HandleLoadSave(INT32 choice);
|
||||
static void M_HandleLevelStats(INT32 choice);
|
||||
@@ -467,7 +470,9 @@ CV_PossibleValue_t gametype_cons_t[NUMGAMETYPES+1];
|
||||
|
||||
consvar_t cv_newgametype = {"newgametype", "Race", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showallmaps = {"showallmaps", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_showallmaps = {"showallmaps", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showmusicfilename = {"showmusicfilename", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t serversort_cons_t[] = {
|
||||
{0,"Ping"},
|
||||
@@ -858,6 +863,12 @@ static menuitem_t SR_UnlockChecklistMenu[] =
|
||||
{IT_SUBMENU | IT_STRING, NULL, "NEXT", &MainDef, 192},
|
||||
};
|
||||
|
||||
static menuitem_t SR_MusicTestMenu[] =
|
||||
{
|
||||
{IT_KEYHANDLER | IT_STRING, NULL, "", M_HandleMusicTest, 0},
|
||||
};
|
||||
|
||||
|
||||
static menuitem_t SR_EmblemHintMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CVAR, NULL, "Medal Radar", &cv_itemfinder, 10},
|
||||
@@ -1567,8 +1578,9 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
||||
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
|
||||
|
||||
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110},
|
||||
|
||||
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
|
||||
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135},
|
||||
@@ -1588,6 +1600,7 @@ static const char* OP_SoundTooltips[] =
|
||||
"Frequency of character voice lines.",
|
||||
"Should the powerup warning be a sound effect or music?",
|
||||
"Testing sounds...",
|
||||
"Testing music...",
|
||||
"Should the games music play while unfocused?",
|
||||
"Should the games sound play while unfocused?",
|
||||
"Options for advanced sound settings.",
|
||||
@@ -2492,6 +2505,20 @@ menu_t SR_UnlockChecklistDef =
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_MusicTestDef =
|
||||
{
|
||||
NULL,
|
||||
sizeof (SR_MusicTestMenu)/sizeof (menuitem_t),
|
||||
&OP_SoundOptionsDef,
|
||||
SR_MusicTestMenu,
|
||||
M_DrawMusicTest,
|
||||
60, 150,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_EmblemHintDef =
|
||||
{
|
||||
NULL,
|
||||
@@ -8089,6 +8116,397 @@ static void M_HandleSoundTest(INT32 choice)
|
||||
}
|
||||
}
|
||||
|
||||
static musicdef_t *curplaying = NULL;
|
||||
static INT32 st_sel = 0;
|
||||
static tic_t st_time = 0;
|
||||
static size_t st_namescroll = 0;
|
||||
static size_t st_namescrollstate = 0;
|
||||
//static patch_t* st_radio[9];
|
||||
//static patch_t* st_launchpad[4];
|
||||
|
||||
static void M_MusicTest(INT32 choice)
|
||||
{
|
||||
INT32 ul = skyRoomMenuTranslations[choice-1];
|
||||
UINT8 i;
|
||||
char buf[8];
|
||||
|
||||
if (!S_PrepareSoundTest())
|
||||
{
|
||||
M_StartMessage(M_GetText("No selectable tracks found.\n"),NULL,MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
/*STRBUFCPY(buf, "M_RADIOn");
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if (st_radio[i])
|
||||
W_UnlockCachedPatch(st_radio[i]);
|
||||
buf[7] = (char)('0'+i);
|
||||
st_radio[i] = W_CachePatchName(buf, PU_STATIC);
|
||||
}
|
||||
|
||||
STRBUFCPY(buf, "M_LPADn");
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (st_launchpad[i])
|
||||
W_UnlockCachedPatch(st_launchpad[i]);
|
||||
buf[6] = (char)('0'+i);
|
||||
st_launchpad[i] = W_CachePatchName(buf, PU_STATIC);
|
||||
}*/
|
||||
|
||||
curplaying = NULL;
|
||||
st_time = 0;
|
||||
|
||||
st_sel = 0;
|
||||
|
||||
M_SetupNextMenu(&SR_MusicTestDef);
|
||||
}
|
||||
|
||||
static void M_DrawMusicTest(void)
|
||||
{
|
||||
INT32 x, y, i;
|
||||
char* title;
|
||||
//fixed_t hscale = FRACUNIT/2, vscale = FRACUNIT/2, bounce = 0;
|
||||
//UINT8 frame[4] = {0, 0, -1, SKINCOLOR_RUBY};
|
||||
|
||||
// let's handle the ticker first. ideally we'd tick this somewhere else, BUT...
|
||||
if (curplaying)
|
||||
{
|
||||
{
|
||||
fixed_t work;
|
||||
//angle_t ang;
|
||||
//bpm = FixedDiv((60*TICRATE)<<FRACBITS, bpm); -- bake this in on load
|
||||
|
||||
work = st_time;
|
||||
//work %= bpm;
|
||||
|
||||
if (st_time >= (FRACUNIT << (FRACBITS - 2))) // prevent overflow jump - takes about 15 minutes of loop on the same song to reach
|
||||
st_time = work;
|
||||
|
||||
//work = FixedDiv(work*180, bpm);
|
||||
//frame[0] = 8-(work/(20<<FRACBITS));
|
||||
//ang = (FixedAngle(work)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
//bounce = (FINESINE(ang) - FRACUNIT/2);
|
||||
//hscale -= bounce/16;
|
||||
//vscale += bounce/16;
|
||||
|
||||
st_time += renderdeltatics;
|
||||
}
|
||||
}
|
||||
|
||||
x = 90<<FRACBITS;
|
||||
y = (BASEVIDHEIGHT-32)<<FRACBITS;
|
||||
|
||||
/*V_DrawStretchyFixedPatch(x, y,
|
||||
hscale, vscale,
|
||||
0, st_radio[frame[0]], NULL);
|
||||
|
||||
V_DrawFixedPatch(x, y, FRACUNIT/2, 0, st_launchpad[0], NULL);
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if (i == frame[2])
|
||||
{
|
||||
UINT8 *colmap = R_GetTranslationColormap(TC_RAINBOW, frame[3], GTC_CACHE);
|
||||
V_DrawFixedPatch(x, y + (frame[1]<<FRACBITS), FRACUNIT/2, 0, st_launchpad[frame[1]+1], colmap);
|
||||
}
|
||||
else
|
||||
V_DrawFixedPatch(x, y, FRACUNIT/2, 0, st_launchpad[1], NULL);
|
||||
|
||||
if ((i % 3) == 2)
|
||||
{
|
||||
x -= ((2*28) + 25)<<(FRACBITS-1);
|
||||
y -= ((2*7) - 11)<<(FRACBITS-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 28<<(FRACBITS-1);
|
||||
y += 7<<(FRACBITS-1);
|
||||
}
|
||||
}*/
|
||||
|
||||
y = (BASEVIDWIDTH-(vid.width/vid.dupx))/2;
|
||||
|
||||
V_DrawFill(y-1, 20, vid.width/vid.dupx+1, 24, 239);
|
||||
{
|
||||
static fixed_t st_scroll = -FRACUNIT;
|
||||
const char* titl;
|
||||
|
||||
x = 16;
|
||||
V_DrawString(x, 10, 0, "NOW PLAYING:");
|
||||
if (curplaying)
|
||||
{
|
||||
if (curplaying->title[0] && curplaying->alttitle[0])
|
||||
titl = va("%s - %s - ", curplaying->title, curplaying->alttitle);
|
||||
else if (curplaying->title[0])
|
||||
titl = va("%s - ", curplaying->title);
|
||||
else
|
||||
titl = va("%s - ", curplaying->source);
|
||||
}
|
||||
else
|
||||
titl = "NONE - ";
|
||||
|
||||
i = V_LevelNameWidth(titl);
|
||||
|
||||
st_scroll += renderdeltatics;
|
||||
|
||||
while (st_scroll >= (i << FRACBITS))
|
||||
st_scroll -= i << FRACBITS;
|
||||
|
||||
x -= st_scroll >> FRACBITS;
|
||||
|
||||
while (x < BASEVIDWIDTH-y)
|
||||
x += i;
|
||||
while (x > y)
|
||||
{
|
||||
x -= i;
|
||||
V_DrawLevelTitle(x, 24, 0, titl);
|
||||
}
|
||||
|
||||
if (curplaying && curplaying->authors[0])
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH-16, 46, V_ALLOWLOWERCASE, curplaying->authors);
|
||||
|
||||
if (curplaying)
|
||||
{
|
||||
if (!curplaying->usage[0])
|
||||
V_DrawString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", curplaying->name));
|
||||
else {
|
||||
V_DrawSmallString(vid.dupx, vid.height - 5*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", curplaying->name, curplaying->usage));
|
||||
}
|
||||
|
||||
if (cv_showmusicfilename.value)
|
||||
V_DrawSmallString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, curplaying->filename);
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawFill(20, 60, 280, 128, 239);
|
||||
|
||||
{
|
||||
INT32 t, b, q, m = 128;
|
||||
|
||||
if (numsoundtestdefs <= 8)
|
||||
{
|
||||
t = 0;
|
||||
b = numsoundtestdefs - 1;
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
q = m;
|
||||
m = (5*m)/numsoundtestdefs;
|
||||
if (st_sel < 3)
|
||||
{
|
||||
t = 0;
|
||||
b = 7;
|
||||
i = 0;
|
||||
}
|
||||
else if (st_sel >= numsoundtestdefs-4)
|
||||
{
|
||||
t = numsoundtestdefs - 8;
|
||||
b = numsoundtestdefs - 1;
|
||||
i = q-m;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = st_sel - 3;
|
||||
b = st_sel + 4;
|
||||
i = (t * (q-m))/(numsoundtestdefs - 8);
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawFill(20+280-1, 60 + i, 1, m, 0);
|
||||
|
||||
if (t != 0)
|
||||
V_DrawString(20+280+4, 60+4 - (skullAnimCounter/5), V_YELLOWMAP, "\x1A");
|
||||
|
||||
if (b != numsoundtestdefs - 1)
|
||||
V_DrawString(20+280+4, 60+128-12 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B");
|
||||
|
||||
x = 24;
|
||||
y = 64;
|
||||
|
||||
if (renderisnewtic) ++st_namescroll;
|
||||
|
||||
while (t <= b)
|
||||
{
|
||||
if (t == st_sel)
|
||||
V_DrawFill(20, y-4, 280-1, 16, 237);
|
||||
|
||||
{
|
||||
const size_t MAXLENGTH = 34;
|
||||
const tic_t SCROLLSPEED = TICRATE/5; // Number of tics for name being scrolled by 1 letter
|
||||
size_t nameoffset = 0;
|
||||
size_t namelength = strlen(soundtestdefs[t]->source);
|
||||
if (soundtestdefs[t]->title[0])
|
||||
namelength = strlen(soundtestdefs[t]->title);
|
||||
|
||||
char buf[MAXLENGTH+1];
|
||||
|
||||
if (t == st_sel && namelength > MAXLENGTH)
|
||||
{
|
||||
switch (st_namescrollstate)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
// Scroll forward
|
||||
nameoffset = (st_namescroll/SCROLLSPEED) % (namelength - MAXLENGTH + 1);
|
||||
|
||||
if (nameoffset == namelength - MAXLENGTH)
|
||||
{
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
nameoffset = namelength - MAXLENGTH;
|
||||
|
||||
// Show name end for 1 second, then start scrolling back
|
||||
if (st_namescroll == TICRATE)
|
||||
{
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
// Scroll back
|
||||
nameoffset = (namelength - MAXLENGTH - 1) - (st_namescroll/SCROLLSPEED) % (namelength - MAXLENGTH);
|
||||
|
||||
if (nameoffset == 0)
|
||||
{
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
{
|
||||
nameoffset = 0;
|
||||
|
||||
// Show name beginning for 1 second, then start scrolling forward again
|
||||
if (st_namescroll == TICRATE)
|
||||
{
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (soundtestdefs[t]->title[0])
|
||||
strncpy(buf, soundtestdefs[t]->title + nameoffset, MAXLENGTH);
|
||||
else
|
||||
strncpy(buf, soundtestdefs[t]->source + nameoffset, MAXLENGTH);
|
||||
buf[MAXLENGTH] = 0;
|
||||
|
||||
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
|
||||
if (curplaying == soundtestdefs[t])
|
||||
{
|
||||
V_DrawFill(20+280-9, y-4, 8, 16, 230);
|
||||
//V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false);
|
||||
//V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
|
||||
}
|
||||
}
|
||||
t++;
|
||||
y += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M_HandleMusicTest(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DOWNARROW:
|
||||
if (st_sel++ >= numsoundtestdefs-1)
|
||||
st_sel = 0;
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
if (!st_sel--)
|
||||
st_sel = numsoundtestdefs-1;
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
break;
|
||||
case KEY_PGDN:
|
||||
if (st_sel < numsoundtestdefs-1)
|
||||
{
|
||||
st_sel += 3;
|
||||
if (st_sel >= numsoundtestdefs-1)
|
||||
st_sel = numsoundtestdefs-1;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
break;
|
||||
case KEY_PGUP:
|
||||
if (st_sel)
|
||||
{
|
||||
st_sel -= 3;
|
||||
if (st_sel < 0)
|
||||
st_sel = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
if (curplaying)
|
||||
{
|
||||
S_StopSounds();
|
||||
S_StopMusic();
|
||||
curplaying = NULL;
|
||||
st_time = 0;
|
||||
S_StartSound(NULL, sfx_skid);
|
||||
}
|
||||
break;
|
||||
case KEY_ESCAPE:
|
||||
exitmenu = true;
|
||||
st_namescroll = 0;
|
||||
st_namescrollstate = 0;
|
||||
break;
|
||||
|
||||
case KEY_RIGHTARROW:
|
||||
case KEY_LEFTARROW:
|
||||
case KEY_ENTER:
|
||||
S_StopSounds();
|
||||
S_StopMusic();
|
||||
st_time = 0;
|
||||
curplaying = soundtestdefs[st_sel];
|
||||
S_ChangeMusicInternal(curplaying->name, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (exitmenu)
|
||||
{
|
||||
Z_Free(soundtestdefs);
|
||||
soundtestdefs = NULL;
|
||||
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Entering secrets menu
|
||||
/*static void M_SecretsMenu(INT32 choice)
|
||||
{
|
||||
|
||||
@@ -245,6 +245,7 @@ extern description_t description[MAXSKINS];
|
||||
extern consvar_t cv_showfocuslost;
|
||||
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
|
||||
extern consvar_t cv_showallmaps;
|
||||
extern consvar_t cv_showmusicfilename;
|
||||
extern CV_PossibleValue_t gametype_cons_t[];
|
||||
|
||||
extern char dummystaffname[22];
|
||||
|
||||
@@ -3551,6 +3551,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// edit music defs for stuff like musictest
|
||||
//
|
||||
S_LoadMTDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
+230
-3
@@ -27,6 +27,7 @@
|
||||
#include "r_sky.h" // skyflatnum
|
||||
#include "p_local.h" // camera info
|
||||
#include "m_misc.h" // for tunes command
|
||||
#include "m_cond.h" // for conditionsets
|
||||
#include "m_menu.h" // bird music stuff
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
@@ -1322,6 +1323,19 @@ static UINT32 queue_fadeinms;
|
||||
musicdef_t *musicdefstart = NULL; // First music definition
|
||||
struct cursongcredit cursongcredit; // Currently displayed song credit info
|
||||
|
||||
musicdef_t soundtestsfx = {
|
||||
"_STSFX", // prevents exactly one valid track name from being used on the sound test
|
||||
"Sound Effects",
|
||||
"",
|
||||
"SEGA, Sonic Team Jr, other sources",
|
||||
1, // show on soundtest page 1
|
||||
0, // with no conditions
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
@@ -1428,6 +1442,8 @@ void S_LoadMusicDefs(UINT16 wadnum)
|
||||
//CONS_Printf("S_LoadMusicDefs: Added song '%s'\n", def->name);
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(def->filename, wadfiles[wadnum]->filename, 256);
|
||||
|
||||
skip_lump:
|
||||
stoken = strtok(NULL, "\r\n ");
|
||||
@@ -1450,19 +1466,33 @@ skip_lump:
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!stricmp(stoken, "usage")) {
|
||||
#if 0 // Ignore for now
|
||||
STRBUFCPY(def->usage, value);
|
||||
for (value = def->usage; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set usage to '%s'\n", def->usage);
|
||||
#endif
|
||||
} else if (!stricmp(stoken, "source")) {
|
||||
STRBUFCPY(def->source, value);
|
||||
for (value = def->source; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else if (!stricmp(stoken, "title")) {
|
||||
def->use_info = true;
|
||||
STRBUFCPY(def->title, value);
|
||||
for (value = def->title; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else if (!stricmp(stoken, "alttitle")) {
|
||||
STRBUFCPY(def->alttitle, value);
|
||||
for (value = def->alttitle; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else if (!stricmp(stoken, "authors")) {
|
||||
STRBUFCPY(def->authors, value);
|
||||
for (value = def->authors; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else {
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
}
|
||||
@@ -1489,7 +1519,168 @@ void S_InitMusicDefs(void)
|
||||
S_LoadMusicDefs(i);
|
||||
}
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
static UINT16 W_CheckForMusicInfoInPwad(UINT16 wadid)
|
||||
{
|
||||
UINT16 i;
|
||||
lumpinfo_t *lump_p;
|
||||
|
||||
lump_p = wadfiles[wadid]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
||||
if (memcmp(lump_p->name, "MUSCINFO", 8) == 0)
|
||||
return i;
|
||||
|
||||
return INT16_MAX; // not found
|
||||
}
|
||||
|
||||
void S_LoadMTDefs(UINT16 wadnum)
|
||||
{
|
||||
UINT16 lump;
|
||||
char *buf;
|
||||
char *buf2;
|
||||
char *stoken;
|
||||
char *value;
|
||||
size_t size;
|
||||
musicdef_t *def, *prev;
|
||||
UINT16 line = 1; // for better error msgs
|
||||
|
||||
lump = W_CheckForMusicInfoInPwad(wadnum);
|
||||
if (lump == INT16_MAX)
|
||||
return;
|
||||
|
||||
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
|
||||
size = W_LumpLengthPwad(wadnum, lump);
|
||||
|
||||
// for strtok
|
||||
buf2 = malloc(size+1);
|
||||
if (!buf2)
|
||||
I_Error("S_LoadMTDefs: No more free memory\n");
|
||||
M_Memcpy(buf2,buf,size);
|
||||
buf2[size] = '\0';
|
||||
|
||||
def = prev = NULL;
|
||||
|
||||
stoken = strtok (buf2, "\r\n ");
|
||||
// Find music def
|
||||
while (stoken)
|
||||
{
|
||||
/*if ((stoken[0] == '/' && stoken[1] == '/')
|
||||
|| (stoken[0] == '#')) // skip comments
|
||||
{
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
if (def)
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
else
|
||||
stoken = strtok(NULL, "\r\n ");
|
||||
line++;
|
||||
}
|
||||
else*/ if (!stricmp(stoken, "lump"))
|
||||
{
|
||||
value = strtok(NULL, "\r\n ");
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Lump '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_lump;
|
||||
}
|
||||
|
||||
// No existing musicdefs
|
||||
if (!musicdefstart)
|
||||
{
|
||||
musicdefstart = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
|
||||
STRBUFCPY(musicdefstart->name, value);
|
||||
strlwr(musicdefstart->name);
|
||||
def = musicdefstart;
|
||||
//CONS_Printf("S_LoadMusicDefs: Initialized musicdef w/ song '%s'\n", def->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
def = musicdefstart;
|
||||
|
||||
// Search if this is a replacement
|
||||
//CONS_Printf("S_LoadMusicDefs: Searching for song replacement...\n");
|
||||
while (def)
|
||||
{
|
||||
if (!stricmp(def->name, value))
|
||||
{
|
||||
//CONS_Printf("S_LoadMusicDefs: Found song replacement '%s'\n", def->name);
|
||||
break;
|
||||
}
|
||||
|
||||
prev = def;
|
||||
def = def->next;
|
||||
}
|
||||
|
||||
// Nothing found, abort.
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Music def for '%s' does not exist. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
skip_lump:
|
||||
stoken = strtok(NULL, "\r\n ");
|
||||
line++;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = strtok(NULL, "\r\n= ");
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_field;
|
||||
}
|
||||
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "MUSCINFO: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(stoken, "title")) {
|
||||
def->use_info = true;
|
||||
STRBUFCPY(def->title, value);
|
||||
for (value = def->title; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else if (!stricmp(stoken, "alttitle")) {
|
||||
STRBUFCPY(def->alttitle, value);
|
||||
for (value = def->alttitle; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else if (!stricmp(stoken, "authors")) {
|
||||
STRBUFCPY(def->authors, value);
|
||||
for (value = def->authors; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
} else {
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
}
|
||||
|
||||
skip_field:
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
void S_InitMTDefs(void)
|
||||
{
|
||||
UINT16 i;
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
S_LoadMTDefs(i);
|
||||
}
|
||||
//
|
||||
// S_FindMusicCredit
|
||||
//
|
||||
@@ -1550,6 +1741,42 @@ void S_ShowMusicCredit(void)
|
||||
S_ShowSpecifiedMusicCredit(music_name);
|
||||
}
|
||||
|
||||
musicdef_t **soundtestdefs = NULL;
|
||||
INT32 numsoundtestdefs = 0;
|
||||
|
||||
//
|
||||
// S_PrepareSoundTest
|
||||
//
|
||||
// Prepare sound test. What am I, your butler?
|
||||
//
|
||||
boolean S_PrepareSoundTest(void)
|
||||
{
|
||||
musicdef_t *def;
|
||||
INT32 pos = numsoundtestdefs = 0;
|
||||
|
||||
for (def = musicdefstart; def; def = def->next)
|
||||
{
|
||||
numsoundtestdefs++;
|
||||
}
|
||||
|
||||
if (!numsoundtestdefs)
|
||||
return false;
|
||||
|
||||
if (soundtestdefs)
|
||||
Z_Free(soundtestdefs);
|
||||
|
||||
if (!(soundtestdefs = Z_Malloc(numsoundtestdefs*sizeof(musicdef_t *), PU_STATIC, NULL)))
|
||||
I_Error("S_PrepareSoundTest(): could not allocate soundtestdefs.");
|
||||
|
||||
for (def = musicdefstart; def /*&& i < numsoundtestdefs*/; def = def->next)
|
||||
{
|
||||
soundtestdefs[pos++] = def;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// ------------------------
|
||||
/// Music Status
|
||||
/// ------------------------
|
||||
|
||||
+19
-2
@@ -159,11 +159,25 @@ boolean S_SpeedMusic(float speed);
|
||||
typedef struct musicdef_s
|
||||
{
|
||||
char name[7];
|
||||
//char usage[256];
|
||||
char usage[256];
|
||||
char source[256];
|
||||
char filename[256];
|
||||
// for the music test stuff
|
||||
// generally if these are present on vanilla the game would throw up a warning
|
||||
// a sacrifice i suppose
|
||||
char title[256];
|
||||
char alttitle[256];
|
||||
char authors[256];
|
||||
boolean use_info;
|
||||
struct musicdef_s *next;
|
||||
} musicdef_t;
|
||||
|
||||
extern musicdef_t soundtestsfx;
|
||||
extern musicdef_t *musicdefstart;
|
||||
extern musicdef_t **soundtestdefs;
|
||||
extern INT32 numsoundtestdefs;
|
||||
extern UINT8 soundtestpage;
|
||||
|
||||
extern struct cursongcredit
|
||||
{
|
||||
musicdef_t *def;
|
||||
@@ -172,14 +186,17 @@ extern struct cursongcredit
|
||||
UINT8 trans;
|
||||
} cursongcredit;
|
||||
|
||||
extern musicdef_t *musicdefstart;
|
||||
|
||||
void S_LoadMusicDefs(UINT16 wadnum);
|
||||
void S_InitMusicDefs(void);
|
||||
void S_LoadMTDefs(UINT16 wadnum);
|
||||
void S_InitMTDefs(void);
|
||||
musicdef_t *S_FindMusicCredit(const char *musname);
|
||||
void S_ShowSpecifiedMusicCredit(const char *musname);
|
||||
void S_ShowMusicCredit(void);
|
||||
|
||||
boolean S_PrepareSoundTest(void);
|
||||
|
||||
//
|
||||
// Music Seeking
|
||||
//
|
||||
|
||||
+2
-1
@@ -2138,8 +2138,9 @@ int W_VerifyNMUSlumps(const char *filename)
|
||||
{"K_", 2}, // Kart graphic changes
|
||||
{"MUSICDEF", 8}, // Kart song definitions
|
||||
{"SP_", 3}, // Speedometer changes do not count either.
|
||||
{"SC_", 3}, // No idea what the SC_SMSTC thing does, ask nepdisk idk
|
||||
{"SC_", 3}, // Colored speedometer stuff too.
|
||||
{"SPRTINFO", 8}, // Sprite info
|
||||
{"MUSCINFO", 8}, // Music test definitions
|
||||
|
||||
#ifdef HWRENDER
|
||||
{"SHADERS", 7},
|
||||
|
||||
Reference in new issue
Block a user