CON: Add "definevolumeflags", currently equipped to hide an episode from the single player and/or multiplayer screens.

enum
{
    EF_HIDEFROMSP = 1<<0,
    EF_HIDEFROMMP = 1<<1,
};

git-svn-id: https://svn.eduke32.com/eduke32@5033 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-02-22 22:15:20 +00:00
parent afccb6d735
commit 697e7d0936
8 changed files with 81 additions and 17 deletions

View file

@ -98,6 +98,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
{ CON_SETMUSICPOSITION, 20150116 }, { CON_SETMUSICPOSITION, 20150116 },
{ CON_UNDEFINELEVEL, 20150208 }, { CON_UNDEFINELEVEL, 20150208 },
{ CON_IFCUTSCENE, 20150210 }, { CON_IFCUTSCENE, 20150210 },
{ CON_DEFINEVOLUMEFLAGS, 20150222 },
}; };
#endif #endif
@ -559,6 +560,7 @@ const char *keyw[] =
"undefinelevel", // 377 "undefinelevel", // 377
"startcutscene", // 378 "startcutscene", // 378
"ifcutscene", // 379 "ifcutscene", // 379
"definevolumeflags", // 380
"<null>" "<null>"
}; };
#endif #endif
@ -2228,6 +2230,13 @@ void C_DefineGameType(int32_t idx, int32_t flags, const char *name)
} }
#endif #endif
void C_DefineVolumeFlags(int32_t vol, int32_t flags)
{
Bassert((unsigned)vol < MAXVOLUMES);
EpisodeFlags[vol] = flags;
}
void C_UndefineVolume(int32_t vol) void C_UndefineVolume(int32_t vol)
{ {
Bassert((unsigned)vol < MAXVOLUMES); Bassert((unsigned)vol < MAXVOLUMES);
@ -5416,6 +5425,26 @@ repeatcase:
EpisodeNames[j][i] = '\0'; EpisodeNames[j][i] = '\0';
continue; continue;
case CON_DEFINEVOLUMEFLAGS:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
j = *g_scriptPtr;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
k = *g_scriptPtr;
if (EDUKE32_PREDICT_FALSE((unsigned)j > MAXVOLUMES-1))
{
initprintf("%s:%d: error: volume number exceeds maximum volume count.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerErrors++;
C_NextLine();
continue;
}
C_DefineVolumeFlags(j, k);
continue;
case CON_DEFINEGAMEFUNCNAME: case CON_DEFINEGAMEFUNCNAME:
g_scriptPtr--; g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);

View file

@ -111,6 +111,7 @@ extern vmstate_t vm;
void G_DoGameStartup(const int32_t *params); void G_DoGameStartup(const int32_t *params);
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn); void C_DefineMusic(int32_t vol, int32_t lev, const char *fn);
void C_DefineVolumeFlags(int32_t vol, int32_t flags);
void C_UndefineVolume(int32_t vol); void C_UndefineVolume(int32_t vol);
void C_UndefineSkill(int32_t skill); void C_UndefineSkill(int32_t skill);
void C_UndefineLevel(int32_t vol, int32_t lev); void C_UndefineLevel(int32_t vol, int32_t lev);
@ -984,6 +985,7 @@ enum ScriptKeywords_t
CON_UNDEFINELEVEL, // 377 CON_UNDEFINELEVEL, // 377
CON_STARTCUTSCENE, // 378 CON_STARTCUTSCENE, // 378
CON_IFCUTSCENE, // 379 CON_IFCUTSCENE, // 379
CON_DEFINEVOLUMEFLAGS, // 380
CON_END CON_END
}; };
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua // KEEPINSYNC with the keyword list in lunatic/con_lang.lua

View file

@ -38,6 +38,8 @@ int32_t g_spriteGravity=176;
int16_t g_spriteDeleteQueueSize = 64; int16_t g_spriteDeleteQueueSize = 64;
char EpisodeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" }; char EpisodeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
int32_t EpisodeFlags[MAXVOLUMES]; // all initialize to zero
char SkillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" }; char SkillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
char GametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; char GametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };

View file

@ -144,6 +144,7 @@ extern const char *s_buildDate;
extern int32_t g_spriteGravity; extern int32_t g_spriteGravity;
extern int16_t g_spriteDeleteQueueSize; extern int16_t g_spriteDeleteQueueSize;
extern char EpisodeNames[MAXVOLUMES][33]; extern char EpisodeNames[MAXVOLUMES][33];
extern int32_t EpisodeFlags[MAXVOLUMES];
extern char SkillNames[MAXSKILLS][33]; extern char SkillNames[MAXSKILLS][33];
extern char GametypeNames[MAXGAMETYPES][33]; extern char GametypeNames[MAXGAMETYPES][33];
extern int32_t GametypeFlags[MAXGAMETYPES]; extern int32_t GametypeFlags[MAXGAMETYPES];
@ -168,6 +169,12 @@ extern char CheatKeys[2];
extern char setupfilename[BMAX_PATH]; extern char setupfilename[BMAX_PATH];
#endif #endif
enum
{
EF_HIDEFROMSP = 1<<0,
EF_HIDEFROMMP = 1<<1,
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -741,6 +741,7 @@ int32_t C_DefineSound(int32_t sndidx, const char *fn, int32_t args [5]);
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn); void C_DefineMusic(int32_t vol, int32_t lev, const char *fn);
void C_DefineQuote(int32_t qnum, const char *qstr); void C_DefineQuote(int32_t qnum, const char *qstr);
void C_DefineVolumeName(int32_t vol, const char *name); void C_DefineVolumeName(int32_t vol, const char *name);
void C_DefineVolumeFlags(int32_t vol, int32_t flags);
void C_UndefineVolume(int32_t vol); void C_UndefineVolume(int32_t vol);
void C_DefineSkillName(int32_t skill, const char *name); void C_DefineSkillName(int32_t skill, const char *name);
void C_UndefineSkill(int32_t skill); void C_UndefineSkill(int32_t skill);

View file

@ -143,6 +143,7 @@ C_DefineSound;
C_DefineMusic; C_DefineMusic;
C_DefineQuote; C_DefineQuote;
C_DefineVolumeName; C_DefineVolumeName;
C_DefineVolumeFlags;
C_UndefineVolume; C_UndefineVolume;
C_DefineSkillName; C_DefineSkillName;
C_UndefineSkill; C_UndefineSkill;

View file

@ -1272,6 +1272,17 @@ function Cmd.definevolumename(vol, name)
g_data.volname[vol] = name g_data.volname[vol] = name
end end
function Cmd.definevolumeflags(vol, flags)
if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
errprintf("volume number is negative or exceeds maximum volume count.")
return
end
if (ffi) then
ffiC.C_DefineVolumeFlags(vol, flags)
end
end
function Cmd.undefinevolume(vol) function Cmd.undefinevolume(vol)
if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
errprintf("volume number is negative or exceeds maximum volume count.") errprintf("volume number is negative or exceeds maximum volume count.")
@ -1898,6 +1909,9 @@ local Couter = {
music = sp1 * tok.define * match_until(sp1 * tok.filename, sp1 * conl.keyword * sp1) music = sp1 * tok.define * match_until(sp1 * tok.filename, sp1 * conl.keyword * sp1)
/ Cmd.music, / Cmd.music,
definevolumeflags = cmd(D,D)
/ Cmd.definevolumeflags,
undefinelevel = cmd(D,D) undefinelevel = cmd(D,D)
/ Cmd.undefinelevel, / Cmd.undefinelevel,
undefineskill = cmd(D) undefineskill = cmd(D)

View file

@ -1030,6 +1030,7 @@ static char *MenuSkillNone = "None";
static char *MEOSN_NetGametypes[MAXGAMETYPES]; static char *MEOSN_NetGametypes[MAXGAMETYPES];
static char *MEOSN_NetEpisodes[MAXVOLUMES+1]; static char *MEOSN_NetEpisodes[MAXVOLUMES+1];
static int32_t MEOSV_NetEpisodes[MAXVOLUMES+1];
static char *MEOSN_NetLevels[MAXVOLUMES][MAXLEVELS]; static char *MEOSN_NetLevels[MAXVOLUMES][MAXLEVELS];
static char *MEOSN_NetSkills[MAXSKILLS+1]; static char *MEOSN_NetSkills[MAXSKILLS+1];
@ -1045,8 +1046,9 @@ static MenuEntry_t *MEL_NETHOST[] = {
static MenuOptionSet_t MEOS_NETOPTIONS_GAMETYPE = MAKE_MENUOPTIONSET( MEOSN_NetGametypes, NULL, 0x0 ); static MenuOptionSet_t MEOS_NETOPTIONS_GAMETYPE = MAKE_MENUOPTIONSET( MEOSN_NetGametypes, NULL, 0x0 );
static MenuOption_t MEO_NETOPTIONS_GAMETYPE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NETOPTIONS_GAMETYPE, &ud.m_coop ); static MenuOption_t MEO_NETOPTIONS_GAMETYPE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NETOPTIONS_GAMETYPE, &ud.m_coop );
static MenuEntry_t ME_NETOPTIONS_GAMETYPE = MAKE_MENUENTRY( "Game Type", &MF_Redfont, &MEF_NetSetup, &MEO_NETOPTIONS_GAMETYPE, Option ); static MenuEntry_t ME_NETOPTIONS_GAMETYPE = MAKE_MENUENTRY( "Game Type", &MF_Redfont, &MEF_NetSetup, &MEO_NETOPTIONS_GAMETYPE, Option );
static MenuOptionSet_t MEOS_NETOPTIONS_EPISODE = MAKE_MENUOPTIONSET( MEOSN_NetEpisodes, NULL, 0x0 ); static MenuOptionSet_t MEOS_NETOPTIONS_EPISODE = MAKE_MENUOPTIONSET( MEOSN_NetEpisodes, MEOSV_NetEpisodes, 0x0 );
static MenuOption_t MEO_NETOPTIONS_EPISODE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NETOPTIONS_EPISODE, NULL ); static int32_t NetEpisode;
static MenuOption_t MEO_NETOPTIONS_EPISODE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NETOPTIONS_EPISODE, &NetEpisode );
static MenuEntry_t ME_NETOPTIONS_EPISODE = MAKE_MENUENTRY( "Episode", &MF_Redfont, &MEF_NetSetup, &MEO_NETOPTIONS_EPISODE, Option ); static MenuEntry_t ME_NETOPTIONS_EPISODE = MAKE_MENUENTRY( "Episode", &MF_Redfont, &MEF_NetSetup, &MEO_NETOPTIONS_EPISODE, Option );
static MenuOptionSet_t MEOS_NETOPTIONS_LEVEL[MAXVOLUMES]; static MenuOptionSet_t MEOS_NETOPTIONS_LEVEL[MAXVOLUMES];
static MenuOption_t MEO_NETOPTIONS_LEVEL = MAKE_MENUOPTION( &MF_Bluefont, NULL, &ud.m_level_number ); static MenuOption_t MEO_NETOPTIONS_LEVEL = MAKE_MENUOPTION( &MF_Bluefont, NULL, &ud.m_level_number );
@ -1293,18 +1295,25 @@ void M_Init(void)
// prepare episodes // prepare episodes
k = -1; k = 0;
for (i = 0; i < g_numVolumes; ++i) for (i = 0; i < g_numVolumes; ++i)
{ {
if (EpisodeNames[i][0]) if (EpisodeNames[i][0])
{ {
MEL_EPISODE[i] = &ME_EPISODE[i]; if (!(EpisodeFlags[i] & EF_HIDEFROMSP))
ME_EPISODE[i] = ME_EPISODE_TEMPLATE; {
ME_EPISODE[i].name = EpisodeNames[i]; MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = EpisodeNames[i];
}
MEOSN_NetEpisodes[i] = EpisodeNames[i]; if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
{
MEOSN_NetEpisodes[k] = EpisodeNames[i];
MEOSV_NetEpisodes[k] = i;
k = i; k++;
}
} }
// prepare levels // prepare levels
@ -1316,12 +1325,13 @@ void M_Init(void)
} }
MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i]; MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i];
} }
++k; M_EPISODE.numEntries = g_numVolumes+2;
M_EPISODE.numEntries = g_numVolumes+2; // k;
MEL_EPISODE[g_numVolumes] = &ME_Space4; MEL_EPISODE[g_numVolumes] = &ME_Space4;
MEL_EPISODE[g_numVolumes+1] = &ME_EPISODE_USERMAP; MEL_EPISODE[g_numVolumes+1] = &ME_EPISODE_USERMAP;
MEOS_NETOPTIONS_EPISODE.numOptions = g_numVolumes + 1; // k+1; MEOS_NETOPTIONS_EPISODE.numOptions = k + 1;
MEOSN_NetEpisodes[g_numVolumes] = MenuUserMap; MEOSN_NetEpisodes[k] = MenuUserMap;
MEOSV_NetEpisodes[k] = MAXVOLUMES;
NetEpisode = MEOSV_NetEpisodes[0];
MMF_Top_Episode.pos.y = (48-(g_numVolumes*2))<<16; MMF_Top_Episode.pos.y = (48-(g_numVolumes*2))<<16;
if (g_numSkills == 0) if (g_numSkills == 0)
MEO_EPISODE.linkID = MENU_NULL; MEO_EPISODE.linkID = MENU_NULL;
@ -1590,12 +1600,12 @@ static void M_PreMenu(MenuID_t cm)
break; break;
case MENU_NETOPTIONS: case MENU_NETOPTIONS:
if (MEO_NETOPTIONS_EPISODE.currentOption == MEOS_NETOPTIONS_EPISODE.numOptions-1) if (MEOSV_NetEpisodes[MEO_NETOPTIONS_EPISODE.currentOption] == MAXVOLUMES)
MEL_NETOPTIONS[2] = &ME_NETOPTIONS_USERMAP; MEL_NETOPTIONS[2] = &ME_NETOPTIONS_USERMAP;
else else
{ {
MEL_NETOPTIONS[2] = &ME_NETOPTIONS_LEVEL; MEL_NETOPTIONS[2] = &ME_NETOPTIONS_LEVEL;
MEO_NETOPTIONS_LEVEL.options = &MEOS_NETOPTIONS_LEVEL[MEO_NETOPTIONS_EPISODE.currentOption]; MEO_NETOPTIONS_LEVEL.options = &MEOS_NETOPTIONS_LEVEL[MEOSV_NetEpisodes[MEO_NETOPTIONS_EPISODE.currentOption]];
} }
MEL_NETOPTIONS[4] = (GametypeFlags[ud.m_coop] & GAMETYPE_MARKEROPTION) ? &ME_NETOPTIONS_MARKERS : &ME_NETOPTIONS_MARKERS_DISABLED; MEL_NETOPTIONS[4] = (GametypeFlags[ud.m_coop] & GAMETYPE_MARKEROPTION) ? &ME_NETOPTIONS_MARKERS : &ME_NETOPTIONS_MARKERS_DISABLED;
MEL_NETOPTIONS[5] = (GametypeFlags[ud.m_coop] & (GAMETYPE_PLAYERSFRIENDLY|GAMETYPE_TDM)) ? &ME_NETOPTIONS_FRFIRE : &ME_NETOPTIONS_MAPEXITS; MEL_NETOPTIONS[5] = (GametypeFlags[ud.m_coop] & (GAMETYPE_PLAYERSFRIENDLY|GAMETYPE_TDM)) ? &ME_NETOPTIONS_FRFIRE : &ME_NETOPTIONS_MAPEXITS;
@ -2550,7 +2560,7 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption)
CONTROL_MapAnalogAxis(M_JOYSTICKAXES.currentEntry, newOption, controldevice_joystick); CONTROL_MapAnalogAxis(M_JOYSTICKAXES.currentEntry, newOption, controldevice_joystick);
else if (entry == &ME_NETOPTIONS_EPISODE) else if (entry == &ME_NETOPTIONS_EPISODE)
{ {
if (newOption < g_numVolumes) if ((unsigned)newOption < g_numVolumes)
ud.m_volume_number = newOption; ud.m_volume_number = newOption;
} }
else if (entry == &ME_NETOPTIONS_MONSTERS) else if (entry == &ME_NETOPTIONS_MONSTERS)
@ -2814,8 +2824,6 @@ static int32_t M_MenuEntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
#endif #endif
else if (entry == &ME_SOUND_DUKETALK) else if (entry == &ME_SOUND_DUKETALK)
return ud.config.VoiceToggle & 1; return ud.config.VoiceToggle & 1;
else if (entry == &ME_NETOPTIONS_EPISODE)
return (currentValue < g_numVolumes ? ud.m_volume_number : g_numVolumes);
else if (entry == &ME_NETOPTIONS_MONSTERS) else if (entry == &ME_NETOPTIONS_MONSTERS)
return (ud.m_monsters_off ? g_numSkills : ud.m_player_skill); return (ud.m_monsters_off ? g_numSkills : ud.m_player_skill);