From 091f93809ee554571a6ed6145b8ac69f17814d91 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 30 Oct 2008 02:10:50 +0000 Subject: Factor out Heretic and Hexen versions of m_misc.c. Make -file for Heretic and Hexen use WAD path lookup. Subversion-branch: /branches/raven-branch Subversion-revision: 1368 --- src/d_mode.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'src/d_mode.c') diff --git a/src/d_mode.c b/src/d_mode.c index 12b97e6a..435ce8d5 100644 --- a/src/d_mode.c +++ b/src/d_mode.c @@ -25,21 +25,26 @@ #include "doomtype.h" #include "d_mode.h" -// Table of valid game modes +// Valid game mode/mission combinations, with the number of +// episodes/maps for each. -static struct { +static struct +{ GameMission_t mission; GameMode_t mode; + int episode; + int map; } valid_modes[] = { - { doom, shareware }, - { doom, registered }, - { doom, retail }, - { doom2, commercial }, - { pack_tnt, commercial }, - { pack_plut, commercial }, - { heretic, shareware }, - { heretic, registered }, - { hexen, commercial }, + { doom, shareware, 1, 9 }, + { doom, registered, 3, 9 }, + { doom, retail, 4, 9 }, + { doom2, commercial, 1, 32 }, + { pack_tnt, commercial, 1, 32 }, + { pack_plut, commercial, 1, 32 }, + { heretic, shareware, 1, 9 }, + { heretic, registered, 3, 9 }, + { heretic, retail, 5, 9 }, + { hexen, commercial, 1, 40 }, }; // Check that a gamemode+gamemission received over the network is valid. @@ -59,6 +64,42 @@ boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode) return false; } +boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode, + int episode, int map) +{ + int i; + + // Hacks for Heretic secret episodes + + if (mission == heretic) + { + if (mode == retail && episode == 6) + { + return map >= 1 && map <= 3; + } + else if (mode == registered && episode == 4) + { + return map == 1; + } + } + + // Find the table entry for this mission/mode combination. + + for (i=0; i= 1 && episode <= valid_modes[i].episode + && map >= 1 && map <= valid_modes[i].map; + } + } + + // Unknown mode/mission combination + + return false; +} + // Table of valid versions static struct { -- cgit v1.2.3