port musictest from srb2 + making it not crash
thing is super ugly, also replaces current sound test for now, which needs to be fixed
This commit is contained in:
1 parent
d0f9993385
commit
d41c7bedd8
6 files changed
+458
-35
No files matched your search
+3
-2
@@ -5347,13 +5347,14 @@ static void Gravity_OnChange(void)
|
||||
|
||||
static void SoundTest_OnChange(void)
|
||||
{
|
||||
INT32 sfxfreeint = (INT32)sfxfree;
|
||||
if (cv_soundtest.value < 0)
|
||||
{
|
||||
CV_SetValue(&cv_soundtest, NUMSFX-1);
|
||||
CV_SetValue(&cv_soundtest, sfxfreeint-1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_soundtest.value >= NUMSFX)
|
||||
if (cv_soundtest.value >= sfxfreeint)
|
||||
{
|
||||
CV_SetValue(&cv_soundtest, 0);
|
||||
return;
|
||||
|
||||
+355
-10
@@ -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_SoundTest(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_DrawSoundTest(void);
|
||||
static void M_DrawEmblemHints(void);
|
||||
static void M_DrawPauseMenu(void);
|
||||
static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade);
|
||||
@@ -858,6 +860,12 @@ static menuitem_t SR_UnlockChecklistMenu[] =
|
||||
{IT_SUBMENU | IT_STRING, NULL, "NEXT", &MainDef, 192},
|
||||
};
|
||||
|
||||
static menuitem_t SR_SoundTestMenu[] =
|
||||
{
|
||||
{IT_KEYHANDLER | IT_STRING, NULL, "", M_HandleSoundTest, 0},
|
||||
};
|
||||
|
||||
|
||||
static menuitem_t SR_EmblemHintMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CVAR, NULL, "Medal Radar", &cv_itemfinder, 10},
|
||||
@@ -1568,7 +1576,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
||||
{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_STRING|IT_CALL, NULL, "Sound Test", M_SoundTest, 110},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135},
|
||||
@@ -2476,6 +2484,20 @@ menu_t SR_UnlockChecklistDef =
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_SoundTestDef =
|
||||
{
|
||||
NULL,
|
||||
sizeof (SR_SoundTestMenu)/sizeof (menuitem_t),
|
||||
&SR_MainDef,
|
||||
SR_SoundTestMenu,
|
||||
M_DrawSoundTest,
|
||||
60, 150,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_EmblemHintDef =
|
||||
{
|
||||
NULL,
|
||||
@@ -7988,7 +8010,7 @@ static void M_DrawSkyRoom(void)
|
||||
lengthstring = 8*(midi_disabled ? 3 : 2);*/
|
||||
}
|
||||
|
||||
for (i = 0; i < currentMenu->numitems; ++i)
|
||||
/*for (i = 0; i < currentMenu->numitems; ++i)
|
||||
{
|
||||
if (currentMenu->menuitems[i].itemaction == M_HandleSoundTest)
|
||||
{
|
||||
@@ -8007,7 +8029,7 @@ static void M_DrawSkyRoom(void)
|
||||
|
||||
if (i == itemOn)
|
||||
lengthstring = V_StringWidth(cv_soundtest.string, 0);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (lengthstring)
|
||||
{
|
||||
@@ -8018,6 +8040,261 @@ static void M_DrawSkyRoom(void)
|
||||
}
|
||||
}
|
||||
|
||||
static musicdef_t *curplaying = NULL;
|
||||
static INT32 st_sel = 0;
|
||||
static tic_t st_time = 0;
|
||||
//static patch_t* st_radio[9];
|
||||
//static patch_t* st_launchpad[4];
|
||||
|
||||
static void M_SoundTest(INT32 choice)
|
||||
{
|
||||
INT32 ul = skyRoomMenuTranslations[choice-1];
|
||||
UINT8 i;
|
||||
char buf[8];
|
||||
|
||||
//soundtestpage = (UINT8)(unlockables[ul].variable);
|
||||
if (!soundtestpage)
|
||||
soundtestpage = 1;
|
||||
|
||||
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_SoundTestDef);
|
||||
}
|
||||
|
||||
static void M_DrawSoundTest(void)
|
||||
{
|
||||
INT32 x, y, i;
|
||||
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)
|
||||
{
|
||||
if (curplaying == &soundtestsfx)
|
||||
{
|
||||
if (cv_soundtest.value)
|
||||
{
|
||||
frame[1] = (2-st_time);
|
||||
frame[2] = ((cv_soundtest.value - 1) % 9);
|
||||
frame[3] += (((cv_soundtest.value - 1) / 9) % (MAXSKINCOLORS - frame[3]));
|
||||
if (st_time < 2)
|
||||
st_time++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curplaying->stoppingtics && st_time >= curplaying->stoppingtics)
|
||||
{
|
||||
curplaying = NULL;
|
||||
st_time = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t work;
|
||||
angle_t ang;
|
||||
//bpm = FixedDiv((60*TICRATE)<<FRACBITS, bpm); -- bake this in on load
|
||||
|
||||
work = st_time<<FRACBITS;
|
||||
//work %= bpm;
|
||||
|
||||
if (st_time >= (FRACUNIT>>1)) // prevent overflow jump - takes about 15 minutes of loop on the same song to reach
|
||||
st_time = (work>>FRACBITS);
|
||||
|
||||
//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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, 20, vid.width/vid.dupx, 24, 159);
|
||||
{
|
||||
static fixed_t st_scroll = -1;
|
||||
const char* titl;
|
||||
x = 16;
|
||||
V_DrawString(x, 10, 0, "NOW PLAYING:");
|
||||
if (curplaying)
|
||||
{
|
||||
titl = va("%s - ", curplaying->source);
|
||||
}
|
||||
else
|
||||
titl = "NONE - ";
|
||||
|
||||
i = V_LevelNameWidth(titl);
|
||||
|
||||
if (++st_scroll >= i)
|
||||
st_scroll %= i;
|
||||
|
||||
x -= st_scroll;
|
||||
|
||||
while (x < BASEVIDWIDTH-y)
|
||||
x += i;
|
||||
while (x > y)
|
||||
{
|
||||
x -= i;
|
||||
V_DrawLevelTitle(x, 24, 0, titl);
|
||||
}
|
||||
|
||||
if (curplaying)
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 46, V_ALLOWLOWERCASE, curplaying->source);
|
||||
}
|
||||
|
||||
V_DrawFill(165, 60, 140, 112, 159);
|
||||
|
||||
{
|
||||
INT32 t, b, q, m = 112;
|
||||
|
||||
if (numsoundtestdefs <= 7)
|
||||
{
|
||||
t = 0;
|
||||
b = numsoundtestdefs - 1;
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
q = m;
|
||||
m = (5*m)/numsoundtestdefs;
|
||||
if (st_sel < 3)
|
||||
{
|
||||
t = 0;
|
||||
b = 6;
|
||||
i = 0;
|
||||
}
|
||||
else if (st_sel >= numsoundtestdefs-4)
|
||||
{
|
||||
t = numsoundtestdefs - 7;
|
||||
b = numsoundtestdefs - 1;
|
||||
i = q-m;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = st_sel - 3;
|
||||
b = st_sel + 3;
|
||||
i = (t * (q-m))/(numsoundtestdefs - 7);
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawFill(165+140-1, 60 + i, 1, m, 0);
|
||||
|
||||
if (t != 0)
|
||||
V_DrawString(165+140+4, 60+4 - (skullAnimCounter/5), V_YELLOWMAP, "\x1A");
|
||||
|
||||
if (b != numsoundtestdefs - 1)
|
||||
V_DrawString(165+140+4, 60+112-12 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B");
|
||||
|
||||
x = 169;
|
||||
y = 64;
|
||||
|
||||
while (t <= b)
|
||||
{
|
||||
if (t == st_sel)
|
||||
V_DrawFill(165, y-4, 140-1, 16, 155);
|
||||
if (!soundtestdefs[t]->allowed)
|
||||
{
|
||||
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE, "???");
|
||||
}
|
||||
else if (soundtestdefs[t] == &soundtestsfx)
|
||||
{
|
||||
const char *sfxstr = va("SFX %s", cv_soundtest.string);
|
||||
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0), sfxstr);
|
||||
if (t == st_sel)
|
||||
{
|
||||
V_DrawCharacter(x - 10 - (skullAnimCounter/5), y,
|
||||
'\x1C' | V_YELLOWMAP, false);
|
||||
V_DrawCharacter(x + 2 + V_StringWidth(sfxstr, 0) + (skullAnimCounter/5), y,
|
||||
'\x1D' | V_YELLOWMAP, false);
|
||||
}
|
||||
|
||||
if (curplaying == soundtestdefs[t])
|
||||
{
|
||||
sfxstr = (cv_soundtest.value) ? S_sfx[cv_soundtest.value].name : "N/A";
|
||||
i = V_StringWidth(sfxstr, 0);
|
||||
V_DrawFill(165+140-9-i, y-4, i+8, 16, 150);
|
||||
V_DrawRightAlignedString(165+140-5, y, V_YELLOWMAP, sfxstr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE, soundtestdefs[t]->source);
|
||||
if (curplaying == soundtestdefs[t])
|
||||
{
|
||||
V_DrawFill(165+140-9, y-4, 8, 16, 150);
|
||||
//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_HandleSoundTest(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
@@ -8025,27 +8302,92 @@ static void M_HandleSoundTest(INT32 choice)
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DOWNARROW:
|
||||
M_NextOpt();
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
if (st_sel++ >= numsoundtestdefs-1)
|
||||
st_sel = 0;
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
M_PrevOpt();
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
if (!st_sel--)
|
||||
st_sel = numsoundtestdefs-1;
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
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);
|
||||
}
|
||||
break;
|
||||
case KEY_PGUP:
|
||||
if (st_sel)
|
||||
{
|
||||
st_sel -= 3;
|
||||
if (st_sel < 0)
|
||||
st_sel = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
}
|
||||
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;
|
||||
break;
|
||||
|
||||
case KEY_RIGHTARROW:
|
||||
CV_AddValue(&cv_soundtest, 1);
|
||||
if (soundtestdefs[st_sel] == &soundtestsfx && soundtestdefs[st_sel]->allowed)
|
||||
{
|
||||
S_StopSounds();
|
||||
S_StopMusic();
|
||||
curplaying = soundtestdefs[st_sel];
|
||||
st_time = 0;
|
||||
CV_AddValue(&cv_soundtest, 1);
|
||||
}
|
||||
break;
|
||||
case KEY_LEFTARROW:
|
||||
CV_AddValue(&cv_soundtest, -1);
|
||||
if (soundtestdefs[st_sel] == &soundtestsfx && soundtestdefs[st_sel]->allowed)
|
||||
{
|
||||
S_StopSounds();
|
||||
S_StopMusic();
|
||||
curplaying = soundtestdefs[st_sel];
|
||||
st_time = 0;
|
||||
CV_AddValue(&cv_soundtest, -1);
|
||||
}
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
S_StopSounds();
|
||||
S_StartSound(NULL, cv_soundtest.value);
|
||||
S_StopMusic();
|
||||
st_time = 0;
|
||||
if (soundtestdefs[st_sel]->allowed)
|
||||
{
|
||||
curplaying = soundtestdefs[st_sel];
|
||||
if (curplaying == &soundtestsfx)
|
||||
{
|
||||
// S_StopMusic() -- is this necessary?
|
||||
if (cv_soundtest.value)
|
||||
S_StartSound(NULL, cv_soundtest.value);
|
||||
}
|
||||
else
|
||||
S_ChangeMusicInternal(curplaying->name, !curplaying->stoppingtics);
|
||||
}
|
||||
else
|
||||
{
|
||||
curplaying = NULL;
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -8053,6 +8395,9 @@ static void M_HandleSoundTest(INT32 choice)
|
||||
}
|
||||
if (exitmenu)
|
||||
{
|
||||
Z_Free(soundtestdefs);
|
||||
soundtestdefs = NULL;
|
||||
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
else
|
||||
|
||||
+54
-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
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hook.h" // MusicChange hook
|
||||
@@ -1297,6 +1298,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
|
||||
//
|
||||
@@ -1425,7 +1439,7 @@ skip_lump:
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!stricmp(stoken, "usage")) {
|
||||
#if 0 // Ignore for now
|
||||
STRBUFCPY(def->usage, value);
|
||||
@@ -1463,8 +1477,6 @@ void S_InitMusicDefs(void)
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
S_LoadMusicDefs(i);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// S_FindMusicCredit
|
||||
//
|
||||
@@ -1525,6 +1537,45 @@ void S_ShowMusicCredit(void)
|
||||
S_ShowSpecifiedMusicCredit(music_name);
|
||||
}
|
||||
|
||||
musicdef_t **soundtestdefs = NULL;
|
||||
INT32 numsoundtestdefs = 0;
|
||||
UINT8 soundtestpage = 1;
|
||||
|
||||
//
|
||||
// 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)
|
||||
{
|
||||
def->allowed = false;
|
||||
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;
|
||||
def->allowed = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// ------------------------
|
||||
/// Music Status
|
||||
/// ------------------------
|
||||
|
||||
+16
-1
@@ -145,11 +145,25 @@ boolean S_SpeedMusic(float speed);
|
||||
typedef struct musicdef_s
|
||||
{
|
||||
char name[7];
|
||||
char title[32];
|
||||
char alttitle[64];
|
||||
//char usage[256];
|
||||
char source[256];
|
||||
char authors[256];
|
||||
UINT8 soundtestpage;
|
||||
INT16 soundtestcond; // +ve for map, -ve for conditionset, 0 for already here
|
||||
tic_t stoppingtics;
|
||||
fixed_t bpm;
|
||||
boolean allowed; // question marks or listenable on sound test?
|
||||
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;
|
||||
@@ -158,7 +172,6 @@ extern struct cursongcredit
|
||||
UINT8 trans;
|
||||
} cursongcredit;
|
||||
|
||||
extern musicdef_t *musicdefstart;
|
||||
|
||||
void S_LoadMusicDefs(UINT16 wadnum);
|
||||
void S_InitMusicDefs(void);
|
||||
@@ -166,6 +179,8 @@ musicdef_t *S_FindMusicCredit(const char *musname);
|
||||
void S_ShowSpecifiedMusicCredit(const char *musname);
|
||||
void S_ShowMusicCredit(void);
|
||||
|
||||
boolean S_PrepareSoundTest(void);
|
||||
|
||||
//
|
||||
// Music Seeking
|
||||
//
|
||||
|
||||
+29
-19
@@ -1007,35 +1007,45 @@ void S_InitRuntimeSounds (void)
|
||||
}
|
||||
}
|
||||
|
||||
sfxenum_t sfxfree = sfx_freeslot0;
|
||||
|
||||
// Add a new sound fx into a free sfx slot.
|
||||
//
|
||||
sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean skinsound)
|
||||
{
|
||||
sfxenum_t i, slot;
|
||||
sfxenum_t i;
|
||||
|
||||
if (skinsound)
|
||||
slot = sfx_skinsoundslot0;
|
||||
else
|
||||
slot = sfx_freeslot0;
|
||||
|
||||
for (i = slot; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].priority)
|
||||
for (i = sfx_skinsoundslot0; i < NUMSFX; i++)
|
||||
{
|
||||
strncpy(freeslotnames[i-sfx_freeslot0], name, 6);
|
||||
S_sfx[i].singularity = singular;
|
||||
S_sfx[i].priority = 60;
|
||||
S_sfx[i].pitch = flags;
|
||||
S_sfx[i].volume = -1;
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
S_sfx[i].skinsound = -1;
|
||||
S_sfx[i].usefulness = -1;
|
||||
|
||||
/// \todo if precached load it here
|
||||
S_sfx[i].data = NULL;
|
||||
return i;
|
||||
if (S_sfx[i].priority)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
i = sfxfree;
|
||||
|
||||
if (i < NUMSFX)
|
||||
{
|
||||
strncpy(freeslotnames[i-sfx_freeslot0], name, 6);
|
||||
S_sfx[i].singularity = singular;
|
||||
S_sfx[i].priority = 60;
|
||||
S_sfx[i].pitch = flags;
|
||||
S_sfx[i].volume = -1;
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
S_sfx[i].skinsound = -1;
|
||||
S_sfx[i].usefulness = -1;
|
||||
|
||||
/// \todo if precached load it here
|
||||
S_sfx[i].data = NULL;
|
||||
|
||||
if (!skinsound)
|
||||
sfxfree++;
|
||||
|
||||
return i;
|
||||
}
|
||||
I_Error("Out of Sound Freeslots while allocating \"%s\"\nLoad less addons to fix this.", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1057,6 +1057,7 @@ typedef enum
|
||||
|
||||
void S_InitRuntimeSounds(void);
|
||||
sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean skinsound);
|
||||
extern sfxenum_t sfxfree; // sound test and slotting
|
||||
void S_RemoveSoundFx(sfxenum_t id);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user