summaryrefslogtreecommitdiff
path: root/src/hexen
diff options
context:
space:
mode:
Diffstat (limited to 'src/hexen')
-rw-r--r--src/hexen/Makefile.am1
-rw-r--r--src/hexen/a_action.c1
-rw-r--r--src/hexen/g_game.c1
-rw-r--r--src/hexen/h2_main.c48
-rw-r--r--src/hexen/h2def.h19
-rw-r--r--src/hexen/m_misc.c145
-rw-r--r--src/hexen/m_random.c81
-rw-r--r--src/hexen/p_acs.c1
-rw-r--r--src/hexen/p_anim.c1
-rw-r--r--src/hexen/p_enemy.c1
-rw-r--r--src/hexen/p_inter.c1
-rw-r--r--src/hexen/p_lights.c1
-rw-r--r--src/hexen/p_map.c1
-rw-r--r--src/hexen/p_mobj.c1
-rw-r--r--src/hexen/p_plats.c1
-rw-r--r--src/hexen/p_pspr.c1
-rw-r--r--src/hexen/p_telept.c1
-rw-r--r--src/hexen/p_user.c1
-rw-r--r--src/hexen/r_main.c1
-rw-r--r--src/hexen/s_sound.c1
-rw-r--r--src/hexen/sn_sonix.c1
-rw-r--r--src/hexen/xddefs.h13
22 files changed, 110 insertions, 213 deletions
diff --git a/src/hexen/Makefile.am b/src/hexen/Makefile.am
index c47e9746..e8ca8b98 100644
--- a/src/hexen/Makefile.am
+++ b/src/hexen/Makefile.am
@@ -17,6 +17,7 @@ h2_main.c \
info.c info.h \
in_lude.c \
m_misc.c \
+m_random.c m_random.h \
mn_menu.c \
p_acs.c \
p_anim.c \
diff --git a/src/hexen/a_action.c b/src/hexen/a_action.c
index fcecb5fd..29500618 100644
--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c
index 22cc3e3d..abfd8d53 100644
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -23,6 +23,7 @@
#include <string.h>
+#include "m_random.h"
#include "h2def.h"
#include "s_sound.h"
#include "doomkeys.h"
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 9d253575..15b6b1b6 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -214,6 +214,13 @@ static void D_HexenQuitMessage(void)
printf("\nHexen: Beyond Heretic\n");
}
+static void D_AddFile(char *filename)
+{
+ printf(" adding %s\n", filename);
+
+ W_AddFile(filename);
+}
+
//==========================================================================
//
// H2_Main
@@ -275,7 +282,7 @@ void D_DoomMain(void)
"one with the '-iwad' command line parameter.");
}
- W_AddFile(iwadfile);
+ D_AddFile(iwadfile);
HandleArgs();
@@ -467,12 +474,15 @@ static void ExecOptionSKILL(char **args, int tag)
static void ExecOptionFILE(char **args, int tag)
{
+ char *filename;
int p;
p = M_CheckParm("-file");
while (++p != myargc && myargv[p][0] != '-')
{
- W_AddFile(myargv[p]);
+ filename = D_TryFindWADByName(myargv[p]);
+
+ D_AddFile(filename);
}
}
@@ -505,40 +515,6 @@ static void ExecOptionSCRIPTS(char **args, int tag)
}
-long superatol(char *s)
-{
- long int n = 0, r = 10, x, mul = 1;
- char *c = s;
-
- for (; *c; c++)
- {
- x = (*c & 223) - 16;
-
- if (x == -3)
- {
- mul = -mul;
- }
- else if (x == 72 && r == 10)
- {
- n -= (r = n);
- if (!r)
- r = 16;
- if (r < 2 || r > 36)
- return -1;
- }
- else
- {
- if (x > 10)
- x -= 39;
- if (x >= r)
- return -1;
- n = (n * r) + x;
- }
- }
- return (mul * n);
-}
-
-
//==========================================================================
//
// H2_GameLoop
diff --git a/src/hexen/h2def.h b/src/hexen/h2def.h
index a00d90bd..2a64dee0 100644
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -237,9 +237,6 @@ typedef struct
fixed_t x, y, z;
} degenmobj_t;
-// Most damage defined using HITDICE
-#define HITDICE(a) ((1+(P_Random()&7))*a)
-
//
// frame flags
//
@@ -975,22 +972,6 @@ int R_CheckTextureNumForName(char *name);
//----
extern int localQuakeHappening[MAXPLAYERS];
-void M_ExtractFileBase(char *path, char *dest);
-
-void M_ForceUppercase(char *text);
-// Changes a string to uppercase
-
-int M_Random(void);
-int P_Random(void);
-// returns a number from 0 to 255
-
-extern unsigned char rndtable[256];
-extern int prndindex;
-// as M_Random, but used only by the play simulation
-
-void M_ClearRandom(void);
-// fix randoms for demos
-
int M_DrawText(int x, int y, boolean direct, char *string);
//------------------------------
diff --git a/src/hexen/m_misc.c b/src/hexen/m_misc.c
index eb16b621..5382e3cb 100644
--- a/src/hexen/m_misc.c
+++ b/src/hexen/m_misc.c
@@ -24,150 +24,5 @@
// HEADER FILES ------------------------------------------------------------
-#ifdef __NeXT__
-#include <libc.h>
-#else
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#endif
-#include <ctype.h>
#include "h2def.h"
-#include "doomkeys.h"
-#include "i_system.h"
-#include "m_argv.h"
-#include "p_local.h"
-#include "s_sound.h"
-
-// MACROS ------------------------------------------------------------------
-
-#define MALLOC_CLIB 1
-#define MALLOC_ZONE 2
-
-// TYPES -------------------------------------------------------------------
-
-// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
-
-// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
-
-// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
-
-// EXTERNAL DATA DECLARATIONS ----------------------------------------------
-extern char *SavePath;
-
-// PUBLIC DATA DEFINITIONS -------------------------------------------------
-
-// PRIVATE DATA DEFINITIONS ------------------------------------------------
-
-// CODE --------------------------------------------------------------------
-
-//==========================================================================
-//
-// M_ExtractFileBase
-//
-//==========================================================================
-
-void M_ExtractFileBase(char *path, char *dest)
-{
- char *src;
- int length;
-
- src = path + strlen(path) - 1;
-
- // Back up until a \ or the start
- while (src != path && *(src - 1) != '\\' && *(src - 1) != '/')
- {
- src--;
- }
-
- // Copy up to eight characters
- memset(dest, 0, 8);
- length = 0;
- while (*src && *src != '.')
- {
- if (++length == 9)
- {
- I_Error("Filename base of %s > 8 chars", path);
- }
- *dest++ = toupper((int) *src++);
- }
-}
-
-/*
-===============
-=
-= M_Random
-=
-= Returns a 0-255 number
-=
-===============
-*/
-
-
-// This is the new flat distribution table
-unsigned char rndtable[256] = {
- 201, 1, 243, 19, 18, 42, 183, 203, 101, 123, 154, 137, 34, 118, 10, 216,
- 135, 246, 0, 107, 133, 229, 35, 113, 177, 211, 110, 17, 139, 84, 251, 235,
- 182, 166, 161, 230, 143, 91, 24, 81, 22, 94, 7, 51, 232, 104, 122, 248,
- 175, 138, 127, 171, 222, 213, 44, 16, 9, 33, 88, 102, 170, 150, 136, 114,
- 62, 3, 142, 237, 6, 252, 249, 56, 74, 30, 13, 21, 180, 199, 32, 132,
- 187, 234, 78, 210, 46, 131, 197, 8, 206, 244, 73, 4, 236, 178, 195, 70,
- 121, 97, 167, 217, 103, 40, 247, 186, 105, 39, 95, 163, 99, 149, 253, 29,
- 119, 83, 254, 26, 202, 65, 130, 155, 60, 64, 184, 106, 221, 93, 164, 196,
- 112, 108, 179, 141, 54, 109, 11, 126, 75, 165, 191, 227, 87, 225, 156, 15,
- 98, 162, 116, 79, 169, 140, 190, 205, 168, 194, 41, 250, 27, 20, 14, 241,
- 50, 214, 72, 192, 220, 233, 67, 148, 96, 185, 176, 181, 215, 207, 172, 85,
- 89, 90, 209, 128, 124, 2, 55, 173, 66, 152, 47, 129, 59, 43, 159, 240,
- 239, 12, 189, 212, 144, 28, 200, 77, 219, 198, 134, 228, 45, 92, 125, 151,
- 5, 53, 255, 52, 68, 245, 160, 158, 61, 86, 58, 82, 117, 37, 242, 145,
- 69, 188, 115, 76, 63, 100, 49, 111, 153, 80, 38, 57, 174, 224, 71, 231,
- 23, 25, 48, 218, 120, 147, 208, 36, 226, 223, 193, 238, 157, 204, 146, 31
-};
-
-
-int rndindex = 0;
-int prndindex = 0;
-
-int P_Random(void)
-{
- prndindex = (prndindex + 1) & 0xff;
- return rndtable[prndindex];
-}
-
-int M_Random(void)
-{
- rndindex = (rndindex + 1) & 0xff;
- return rndtable[rndindex];
-}
-
-void M_ClearRandom(void)
-{
- rndindex = prndindex = 0;
-}
-
-//---------------------------------------------------------------------------
-//
-// 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/hexen/m_random.c b/src/hexen/m_random.c
new file mode 100644
index 00000000..b84f6d63
--- /dev/null
+++ b/src/hexen/m_random.c
@@ -0,0 +1,81 @@
+// 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.
+//
+//-----------------------------------------------------------------------------
+
+
+// HEADER FILES ------------------------------------------------------------
+
+#include "m_random.h"
+
+// This is the new flat distribution table
+
+static const unsigned char rndtable[256] = {
+ 201, 1, 243, 19, 18, 42, 183, 203, 101, 123, 154, 137, 34, 118, 10, 216,
+ 135, 246, 0, 107, 133, 229, 35, 113, 177, 211, 110, 17, 139, 84, 251, 235,
+ 182, 166, 161, 230, 143, 91, 24, 81, 22, 94, 7, 51, 232, 104, 122, 248,
+ 175, 138, 127, 171, 222, 213, 44, 16, 9, 33, 88, 102, 170, 150, 136, 114,
+ 62, 3, 142, 237, 6, 252, 249, 56, 74, 30, 13, 21, 180, 199, 32, 132,
+ 187, 234, 78, 210, 46, 131, 197, 8, 206, 244, 73, 4, 236, 178, 195, 70,
+ 121, 97, 167, 217, 103, 40, 247, 186, 105, 39, 95, 163, 99, 149, 253, 29,
+ 119, 83, 254, 26, 202, 65, 130, 155, 60, 64, 184, 106, 221, 93, 164, 196,
+ 112, 108, 179, 141, 54, 109, 11, 126, 75, 165, 191, 227, 87, 225, 156, 15,
+ 98, 162, 116, 79, 169, 140, 190, 205, 168, 194, 41, 250, 27, 20, 14, 241,
+ 50, 214, 72, 192, 220, 233, 67, 148, 96, 185, 176, 181, 215, 207, 172, 85,
+ 89, 90, 209, 128, 124, 2, 55, 173, 66, 152, 47, 129, 59, 43, 159, 240,
+ 239, 12, 189, 212, 144, 28, 200, 77, 219, 198, 134, 228, 45, 92, 125, 151,
+ 5, 53, 255, 52, 68, 245, 160, 158, 61, 86, 58, 82, 117, 37, 242, 145,
+ 69, 188, 115, 76, 63, 100, 49, 111, 153, 80, 38, 57, 174, 224, 71, 231,
+ 23, 25, 48, 218, 120, 147, 208, 36, 226, 223, 193, 238, 157, 204, 146, 31
+};
+
+
+int rndindex = 0;
+int prndindex = 0;
+
+/*
+===============
+=
+= M_Random
+=
+= Returns a 0-255 number
+=
+===============
+*/
+
+
+int P_Random(void)
+{
+ prndindex = (prndindex + 1) & 0xff;
+ return rndtable[prndindex];
+}
+
+int M_Random(void)
+{
+ rndindex = (rndindex + 1) & 0xff;
+ return rndtable[rndindex];
+}
+
+void M_ClearRandom(void)
+{
+ rndindex = prndindex = 0;
+}
+
diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c
index b5e938d1..5e4988ac 100644
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "s_sound.h"
#include "i_swap.h"
#include "i_system.h"
diff --git a/src/hexen/p_anim.c b/src/hexen/p_anim.c
index ca7685bf..ef56e811 100644
--- a/src/hexen/p_anim.c
+++ b/src/hexen/p_anim.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index 41cc2fdd..ac73d1f3 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "i_swap.h"
#include "p_local.h"
diff --git a/src/hexen/p_inter.c b/src/hexen/p_inter.c
index 1f57912e..92298f21 100644
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/p_lights.c b/src/hexen/p_lights.c
index 7ea7cf67..648f040c 100644
--- a/src/hexen/p_lights.c
+++ b/src/hexen/p_lights.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "p_local.h"
//============================================================================
diff --git a/src/hexen/p_map.c b/src/hexen/p_map.c
index 827670aa..16734325 100644
--- a/src/hexen/p_map.c
+++ b/src/hexen/p_map.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "m_bbox.h"
#include "p_local.h"
diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c
index 4accc36b..db3078da 100644
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/p_plats.c b/src/hexen/p_plats.c
index 97795ead..4b2eeec3 100644
--- a/src/hexen/p_plats.c
+++ b/src/hexen/p_plats.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
diff --git a/src/hexen/p_pspr.c b/src/hexen/p_pspr.c
index dad7f131..ddfb4601 100644
--- a/src/hexen/p_pspr.c
+++ b/src/hexen/p_pspr.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/p_telept.c b/src/hexen/p_telept.c
index 5b7a0e45..538587fd 100644
--- a/src/hexen/p_telept.c
+++ b/src/hexen/p_telept.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/p_user.c b/src/hexen/p_user.c
index d8db08b3..c86c19e1 100644
--- a/src/hexen/p_user.c
+++ b/src/hexen/p_user.c
@@ -23,6 +23,7 @@
#include "h2def.h"
+#include "m_random.h"
#include "i_system.h"
#include "p_local.h"
#include "s_sound.h"
diff --git a/src/hexen/r_main.c b/src/hexen/r_main.c
index 05b5a0c7..426cbcc7 100644
--- a/src/hexen/r_main.c
+++ b/src/hexen/r_main.c
@@ -23,6 +23,7 @@
#include <math.h>
+#include "m_random.h"
#include "h2def.h"
#include "m_bbox.h"
#include "r_local.h"
diff --git a/src/hexen/s_sound.c b/src/hexen/s_sound.c
index 954bf817..5733c700 100644
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -22,6 +22,7 @@
//-----------------------------------------------------------------------------
#include "h2def.h"
+#include "m_random.h"
#include "i_cdmus.h"
#include "i_sound.h"
#include "i_system.h"
diff --git a/src/hexen/sn_sonix.c b/src/hexen/sn_sonix.c
index 412791a3..2c136504 100644
--- a/src/hexen/sn_sonix.c
+++ b/src/hexen/sn_sonix.c
@@ -25,6 +25,7 @@
// HEADER FILES ------------------------------------------------------------
#include <string.h>
+#include "m_random.h"
#include "h2def.h"
#include "i_system.h"
#include "i_sound.h"
diff --git a/src/hexen/xddefs.h b/src/hexen/xddefs.h
index f62ac4d4..6be289f4 100644
--- a/src/hexen/xddefs.h
+++ b/src/hexen/xddefs.h
@@ -193,17 +193,4 @@ typedef struct
mappatch_t patches[1];
} PACKEDATTR maptexture_t;
-//--------------------------------------------------------------------------
-//
-// Graphics
-//
-//--------------------------------------------------------------------------
-
-// a pic is an unmasked block of pixels
-typedef struct
-{
- byte width, height;
- byte data;
-} pic_t;
-
#endif // __XDDEFS__