mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
CON: Add starttrackslot <volume> <level>
Clobbering ud.volume_number is a hack no one should need to use any more. Only this command supports specifying -1 for volume to access the main menu, briefing, etc themes. git-svn-id: https://svn.eduke32.com/eduke32@6414 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
bc1ed207d6
commit
cbb18f5c70
3 changed files with 32 additions and 8 deletions
|
@ -599,6 +599,7 @@ const char *keyw[] = {
|
|||
"getclosestcol", // 403
|
||||
"drawline256", // 404
|
||||
"drawlinergb", // 405
|
||||
"starttrackslot", // 406
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
@ -4120,6 +4121,7 @@ DO_DEFSTATE:
|
|||
case CON_QSTRCPY:
|
||||
case CON_QGETSYSSTR:
|
||||
case CON_STOPACTORSOUND:
|
||||
case CON_STARTTRACKSLOT:
|
||||
C_GetManyVars(2);
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1141,6 +1141,7 @@ enum ScriptKeywords_t
|
|||
CON_GETCLOSESTCOL, // 403
|
||||
CON_DRAWLINE256, // 404
|
||||
CON_DRAWLINERGB, // 405
|
||||
CON_STARTTRACKSLOT, // 406
|
||||
CON_END
|
||||
};
|
||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||
|
|
|
@ -1140,11 +1140,11 @@ void G_GetTimeDate(int32_t * const pValues)
|
|||
pValues[7] = pTime->tm_yday;
|
||||
}
|
||||
|
||||
int G_StartTrack(int const levelNum)
|
||||
static int G_StartTrackSlot(int const volumeNum, int const levelNum)
|
||||
{
|
||||
if ((unsigned)levelNum < MAXLEVELS)
|
||||
if ((unsigned)volumeNum <= MAXVOLUMES && (unsigned)levelNum < MAXLEVELS)
|
||||
{
|
||||
int trackNum = MAXLEVELS*ud.volume_number + levelNum;
|
||||
int trackNum = MAXLEVELS*volumeNum + levelNum;
|
||||
|
||||
if (g_mapInfo[trackNum].musicfn != NULL)
|
||||
{
|
||||
|
@ -1159,6 +1159,20 @@ int G_StartTrack(int const levelNum)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void G_StartTrackSlotWrap(int const volumeNum, int const levelNum)
|
||||
{
|
||||
if (EDUKE32_PREDICT_FALSE(G_StartTrackSlot(volumeNum, levelNum)))
|
||||
CON_ERRPRINTF("invalid level %d or null music for volume %d level %d\n",
|
||||
levelNum, volumeNum, levelNum);
|
||||
}
|
||||
|
||||
#ifdef LUNATIC
|
||||
int G_StartTrack(int const levelNum)
|
||||
{
|
||||
return G_StartTrackSlot(ud.volume_number, levelNum);
|
||||
}
|
||||
#endif
|
||||
|
||||
LUNATIC_EXTERN void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sect,
|
||||
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp)
|
||||
{
|
||||
|
@ -4920,14 +4934,21 @@ finish_qsprintf:
|
|||
continue;
|
||||
|
||||
case CON_STARTTRACK:
|
||||
insptr++;
|
||||
G_StartTrackSlotWrap(ud.volume_number, *(insptr++));
|
||||
continue;
|
||||
|
||||
case CON_STARTTRACKVAR:
|
||||
insptr++;
|
||||
{
|
||||
int const levelNum = (tw == CON_STARTTRACK) ? *(insptr++) : Gv_GetVarX(*(insptr++));
|
||||
G_StartTrackSlotWrap(ud.volume_number, Gv_GetVarX(*(insptr++)));
|
||||
continue;
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(G_StartTrack(levelNum)))
|
||||
CON_ERRPRINTF("invalid level %d or null music for volume %d level %d\n",
|
||||
levelNum, ud.volume_number, levelNum);
|
||||
case CON_STARTTRACKSLOT:
|
||||
insptr++;
|
||||
{
|
||||
int const volumeNum = Gv_GetVarX(*(insptr++));
|
||||
int const levelNum = Gv_GetVarX(*(insptr++));
|
||||
G_StartTrackSlotWrap(volumeNum == -1 ? MAXVOLUMES : volumeNum, levelNum);
|
||||
}
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue