#include <float.h>
#define MAXDOUBLE DBL_MAX
-#define MAXFLOAT FLT_MAX
#define MINDOUBLE DBL_MIN
#define MINFLOAT FLT_MIN
#define DMINEXP DBL_MIN_EXP
char *doomwaddir;
doomwaddir = getenv("DOOMWADDIR");
if (!doomwaddir)
- doomwaddir = ".";
+ doomwaddir = "/mnt";
+ //XXX doomwaddir = ".";
// Commercial.
doom2wad = malloc(strlen(doomwaddir)+1+9+1);
// Shareware.
doom1wad = malloc(strlen(doomwaddir)+1+9+1);
- sprintf(doom1wad, "%s/doom1.wad", doomwaddir);
+ //XXX sprintf(doom1wad, "%s/doom1.wad", doomwaddir);
+ sprintf(doom1wad, "%s/DOOM1.WAD", doomwaddir);
// Bug, dear Shawn.
// Insufficient malloc, caused spurious realloc errors.
doom2fwad = malloc(strlen(doomwaddir)+1+10+1);
sprintf(doom2fwad, "%s/doom2f.wad", doomwaddir);
- home = getenv("HOME");
+ //home = getenv("HOME");
+ home = "/mnt";
if (!home)
I_Error("Please set $HOME to your home directory");
sprintf(basedefault, "%s/.doomrc", home);
IdentifyVersion ();
- setbuf (stdout, NULL);
+ //XXX setbuf (stdout, NULL);
modifiedgame = false;
nomonsters = M_CheckParm ("-nomonsters");
{true, "WFALL4", "WFALL1", 8},
{true, "DBRAIN4", "DBRAIN1", 8},
- {-1}
+ {false, "\0", "\0", 0}
};
anim_t anims[MAXANIMS];
// Init animation
lastanim = anims;
- for (i=0 ; animdefs[i].istexture != -1 ; i++)
+ //for (i=0 ; animdefs[i].istexture != -1 ; i++)
+ for (i=0 ; animdefs[i].startname[0] != NULL ; i++)
{
if (animdefs[i].istexture)
{
// that are covered by more than one patch.
// Fill in the lump / offset, so columns
// with only a single patch are all done.
- patchcount = (byte *)alloca (texture->width);
+ //XXX patchcount = (byte *)alloca (texture->width);
+ patchcount = (byte *)malloc (texture->width);
+ if (!patchcount)
+ return;
memset (patchcount, 0, texture->width);
patch = texture->patches;
texturecompositesize[texnum] += texture->height;
}
- }
+ }
+
+ free(patchcount);
}
names = W_CacheLumpName ("PNAMES", PU_STATIC);
nummappatches = LONG ( *((int *)names) );
name_p = names+4;
- patchlookup = alloca (nummappatches*sizeof(*patchlookup));
+ //XXX patchlookup = alloca (nummappatches*sizeof(*patchlookup));
+ patchlookup = malloc (nummappatches*sizeof(*patchlookup));
+ if (!patchlookup)
+ return;
for (i=0 ; i<nummappatches ; i++)
{
for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i;
+
+ free(patchlookup);
}
return;
// Precache flats.
- flatpresent = alloca(numflats);
+ //XXX flatpresent = alloca(numflats);
+ flatpresent = malloc(numflats);
+ if (!flatpresent)
+ return;
memset (flatpresent,0,numflats);
for (i=0 ; i<numsectors ; i++)
W_CacheLumpNum(lump, PU_CACHE);
}
}
+
+ free(flatpresent);
// Precache textures.
- texturepresent = alloca(numtextures);
+ //XXX texturepresent = alloca(numtextures);
+ texturepresent = malloc(numtextures);
+ if (!texturepresent)
+ return;
memset (texturepresent,0, numtextures);
for (i=0 ; i<numsides ; i++)
W_CacheLumpNum(lump , PU_CACHE);
}
}
+
+ free(texturepresent);
// Precache sprites.
- spritepresent = alloca(numsprites);
+ //XXX spritepresent = alloca(numsprites);
+ spritepresent = malloc(numsprites);
+ if (!numsprites)
+ return;
memset (spritepresent,0, numsprites);
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
}
}
}
+
+ free(numsprites);
}
}
// XXX FIXME
-int usleep(useconds_t us)
-{
- return 0;
-}
-
+//int usleep(useconds_t us)
+//{
+// return 0;
+//}
+//
+//
+//struct hostent *gethostbyname(const char *name)
+//{
+// return NULL;
+//}
header.numlumps = LONG(header.numlumps);
header.infotableofs = LONG(header.infotableofs);
length = header.numlumps*sizeof(filelump_t);
- fileinfo = alloca (length);
+ //XXX fileinfo = alloca (length);
+ fileinfo = malloc (length);
lseek (handle, header.infotableofs, SEEK_SET);
read (handle, fileinfo, length);
numlumps += header.numlumps;
lump_p->size = LONG(fileinfo->size);
strncpy (lump_p->name, fileinfo->name, 8);
}
+
+ //XXX: Alloca replacement
+ free(fileinfo);
if (reloadname)
close (handle);
lumpcount = LONG(header.numlumps);
header.infotableofs = LONG(header.infotableofs);
length = lumpcount*sizeof(filelump_t);
- fileinfo = alloca (length);
+ //XXX fileinfo = alloca (length);
+ fileinfo = malloc (length);
+ if (!fileinfo)
+ return;
lseek (handle, header.infotableofs, SEEK_SET);
read (handle, fileinfo, length);
lump_p->position = LONG(fileinfo->filepos);
lump_p->size = LONG(fileinfo->size);
}
-
+
+ free(fileinfo);
close (handle);
}