Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 5032 → Rev 5033

/polymer/eduke32/source/gamedef.c
98,6 → 98,7
{ CON_SETMUSICPOSITION, 20150116 },
{ CON_UNDEFINELEVEL, 20150208 },
{ CON_IFCUTSCENE, 20150210 },
{ CON_DEFINEVOLUMEFLAGS, 20150222 },
};
#endif
 
559,6 → 560,7
"undefinelevel", // 377
"startcutscene", // 378
"ifcutscene", // 379
"definevolumeflags", // 380
"<null>"
};
#endif
2228,6 → 2230,13
}
#endif
 
void C_DefineVolumeFlags(int32_t vol, int32_t flags)
{
Bassert((unsigned)vol < MAXVOLUMES);
 
EpisodeFlags[vol] = flags;
}
 
void C_UndefineVolume(int32_t vol)
{
Bassert((unsigned)vol < MAXVOLUMES);
5416,6 → 5425,26
EpisodeNames[j][i] = '\0';
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:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);
/polymer/eduke32/source/gamedef.h
111,6 → 111,7
void G_DoGameStartup(const int32_t *params);
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_UndefineSkill(int32_t skill);
void C_UndefineLevel(int32_t vol, int32_t lev);
984,6 → 985,7
CON_UNDEFINELEVEL, // 377
CON_STARTCUTSCENE, // 378
CON_IFCUTSCENE, // 379
CON_DEFINEVOLUMEFLAGS, // 380
CON_END
};
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
/polymer/eduke32/source/global.c
38,6 → 38,8
int16_t g_spriteDeleteQueueSize = 64;
 
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 GametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
/polymer/eduke32/source/global.h
144,6 → 144,7
extern int32_t g_spriteGravity;
extern int16_t g_spriteDeleteQueueSize;
extern char EpisodeNames[MAXVOLUMES][33];
extern int32_t EpisodeFlags[MAXVOLUMES];
extern char SkillNames[MAXSKILLS][33];
extern char GametypeNames[MAXGAMETYPES][33];
extern int32_t GametypeFlags[MAXGAMETYPES];
168,6 → 169,12
extern char setupfilename[BMAX_PATH];
#endif
 
enum
{
EF_HIDEFROMSP = 1<<0,
EF_HIDEFROMMP = 1<<1,
};
 
#ifdef __cplusplus
}
#endif
/polymer/eduke32/source/lunatic/defs.ilua
741,6 → 741,7
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn);
void C_DefineQuote(int32_t qnum, const char *qstr);
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_DefineSkillName(int32_t skill, const char *name);
void C_UndefineSkill(int32_t skill);
/polymer/eduke32/source/lunatic/dynsymlist
143,6 → 143,7
C_DefineMusic;
C_DefineQuote;
C_DefineVolumeName;
C_DefineVolumeFlags;
C_UndefineVolume;
C_DefineSkillName;
C_UndefineSkill;
/polymer/eduke32/source/lunatic/lunacon.lua
1272,6 → 1272,17
g_data.volname[vol] = name
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)
if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
errprintf("volume number is negative or exceeds maximum volume count.")
1898,6 → 1909,9
music = sp1 * tok.define * match_until(sp1 * tok.filename, sp1 * conl.keyword * sp1)
/ Cmd.music,
 
definevolumeflags = cmd(D,D)
/ Cmd.definevolumeflags,
 
undefinelevel = cmd(D,D)
/ Cmd.undefinelevel,
undefineskill = cmd(D)
/polymer/eduke32/source/menus.c
1030,6 → 1030,7
 
static char *MEOSN_NetGametypes[MAXGAMETYPES];
static char *MEOSN_NetEpisodes[MAXVOLUMES+1];
static int32_t MEOSV_NetEpisodes[MAXVOLUMES+1];
static char *MEOSN_NetLevels[MAXVOLUMES][MAXLEVELS];
static char *MEOSN_NetSkills[MAXSKILLS+1];
 
1045,8 → 1046,9
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 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 MenuOption_t MEO_NETOPTIONS_EPISODE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NETOPTIONS_EPISODE, NULL );
static MenuOptionSet_t MEOS_NETOPTIONS_EPISODE = MAKE_MENUOPTIONSET( MEOSN_NetEpisodes, MEOSV_NetEpisodes, 0x0 );
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 MenuOptionSet_t MEOS_NETOPTIONS_LEVEL[MAXVOLUMES];
static MenuOption_t MEO_NETOPTIONS_LEVEL = MAKE_MENUOPTION( &MF_Bluefont, NULL, &ud.m_level_number );
1293,18 → 1295,25
 
 
// prepare episodes
k = -1;
k = 0;
for (i = 0; i < g_numVolumes; ++i)
{
if (EpisodeNames[i][0])
{
MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = EpisodeNames[i];
if (!(EpisodeFlags[i] & EF_HIDEFROMSP))
{
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
1316,12 → 1325,13
}
MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i];
}
++k;
M_EPISODE.numEntries = g_numVolumes+2; // k;
M_EPISODE.numEntries = g_numVolumes+2;
MEL_EPISODE[g_numVolumes] = &ME_Space4;
MEL_EPISODE[g_numVolumes+1] = &ME_EPISODE_USERMAP;
MEOS_NETOPTIONS_EPISODE.numOptions = g_numVolumes + 1; // k+1;
MEOSN_NetEpisodes[g_numVolumes] = MenuUserMap;
MEOS_NETOPTIONS_EPISODE.numOptions = k + 1;
MEOSN_NetEpisodes[k] = MenuUserMap;
MEOSV_NetEpisodes[k] = MAXVOLUMES;
NetEpisode = MEOSV_NetEpisodes[0];
MMF_Top_Episode.pos.y = (48-(g_numVolumes*2))<<16;
if (g_numSkills == 0)
MEO_EPISODE.linkID = MENU_NULL;
1590,12 → 1600,12
break;
 
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;
else
{
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[5] = (GametypeFlags[ud.m_coop] & (GAMETYPE_PLAYERSFRIENDLY|GAMETYPE_TDM)) ? &ME_NETOPTIONS_FRFIRE : &ME_NETOPTIONS_MAPEXITS;
2550,7 → 2560,7
CONTROL_MapAnalogAxis(M_JOYSTICKAXES.currentEntry, newOption, controldevice_joystick);
else if (entry == &ME_NETOPTIONS_EPISODE)
{
if (newOption < g_numVolumes)
if ((unsigned)newOption < g_numVolumes)
ud.m_volume_number = newOption;
}
else if (entry == &ME_NETOPTIONS_MONSTERS)
2814,8 → 2824,6
#endif
else if (entry == &ME_SOUND_DUKETALK)
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)
return (ud.m_monsters_off ? g_numSkills : ud.m_player_skill);