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/heretic/Makefile.am | 1 - src/heretic/d_main.c | 12 +++++-- src/heretic/doomdef.h | 11 ------ src/heretic/m_misc.c | 92 ------------------------------------------------- src/heretic/sb_bar.c | 2 +- 5 files changed, 10 insertions(+), 108 deletions(-) delete mode 100644 src/heretic/m_misc.c (limited to 'src/heretic') diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index f5e620b6..4a539c47 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -16,7 +16,6 @@ f_finale.c \ g_game.c \ info.c info.h \ in_lude.c \ -m_misc.c \ m_random.c m_random.h \ mn_menu.c \ p_ceilng.c \ diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 669d7b3d..70fd57c0 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -857,12 +857,18 @@ void D_DoomMain(void) // -FILE [filename] [filename] ... // Add files to the wad list. p = M_CheckParm("-file"); + if (p) - { // the parms after p are wadfile/lump names, until end of parms + { + char *filename; + + // the parms after p are wadfile/lump names, until end of parms // or another - preceded parm + while (++p != myargc && myargv[p][0] != '-') { - D_AddFile(myargv[p]); + filename = D_FindWADByName(myargv[p]); + D_AddFile(filename); } } @@ -1011,7 +1017,7 @@ void D_DoomMain(void) // Check valid episode and map if (autostart || netgame) { - if (M_ValidEpisodeMap(startepisode, startmap) == false) + if (!D_ValidEpisodeMap(gamemission, gamemode, startepisode, startmap)) { startepisode = 1; startmap = 1; diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index aac70e2f..e18f14f9 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -833,17 +833,6 @@ int R_CheckTextureNumForName(char *name); //---- // returns the position of the given parameter in the arg list (0 if not found) -boolean M_ValidEpisodeMap(int episode, int map); -// returns true if the episode/map combo is valid for the current -// game configuration - -void M_ForceUppercase(char *text); -// Changes a string to uppercase - -void M_LoadDefaults(void); - -void M_SaveDefaults(void); - int M_DrawText(int x, int y, boolean direct, char *string); //---------------------- diff --git a/src/heretic/m_misc.c b/src/heretic/m_misc.c deleted file mode 100644 index 39674e4b..00000000 --- a/src/heretic/m_misc.c +++ /dev/null @@ -1,92 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 1993-2008 Raven Software -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -//----------------------------------------------------------------------------- - -// M_misc.c - -#include -#include -#include -#include - -#include - -#include "doomdef.h" -#include "i_swap.h" -#include "i_video.h" -#include "m_argv.h" -#include "s_sound.h" - -//--------------------------------------------------------------------------- -// -// FUNC M_ValidEpisodeMap -// -//--------------------------------------------------------------------------- - -boolean M_ValidEpisodeMap(int episode, int map) -{ - if (episode < 1 || map < 1 || map > 9) - { - return false; - } - - switch (gamemode) - { - case shareware: - return episode == 1; - - case retail: - return episode <= 5 || (episode == 6 && map <= 3); - - case registered: - return episode <= 3 || (episode == 4 && map == 1); - - default: - return false; - } -} - -//--------------------------------------------------------------------------- -// -// PROC M_ForceUppercase -// -// Change string to uppercase. -// -//--------------------------------------------------------------------------- - -void M_ForceUppercase(char *text) -{ - char c; - - while ((c = *text) != 0) - { - if (c >= 'a' && c <= 'z') - { - *text++ = c - ('a' - 'A'); - } - else - { - text++; - } - } -} - diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 3fefe54f..e21fc1c2 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -1237,7 +1237,7 @@ static void CheatWarpFunc(player_t * player, Cheat_t * cheat) episode = args[0] - '0'; map = args[1] - '0'; - if (M_ValidEpisodeMap(episode, map)) + if (D_ValidEpisodeMap(gamemission, gamemode, episode, map)) { G_DeferedInitNew(gameskill, episode, map); P_SetMessage(player, TXT_CHEATWARP, false); -- cgit v1.2.3