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/hexen/m_misc.c | 145 ----------------------------------------------------- 1 file changed, 145 deletions(-) (limited to 'src/hexen/m_misc.c') 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 -#else -#include -#include -#include -#include -#endif -#include #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++; - } - } -} -- cgit v1.2.3