Game now proceeds to the main game loop

This commit is contained in:
Maxime Vincent 2016-05-16 23:27:09 +02:00
parent 6ab1ad1ed2
commit 2562c5dcef
6 changed files with 62 additions and 21 deletions

View File

@ -51,7 +51,6 @@
#include <float.h>
#define MAXDOUBLE DBL_MAX
#define MAXFLOAT FLT_MAX
#define MINDOUBLE DBL_MIN
#define MINFLOAT FLT_MIN
#define DMINEXP DBL_MIN_EXP

View File

@ -577,7 +577,8 @@ void IdentifyVersion (void)
char *doomwaddir;
doomwaddir = getenv("DOOMWADDIR");
if (!doomwaddir)
doomwaddir = ".";
doomwaddir = "/mnt";
//XXX doomwaddir = ".";
// Commercial.
doom2wad = malloc(strlen(doomwaddir)+1+9+1);
@ -593,7 +594,8 @@ void IdentifyVersion (void)
// 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.
@ -608,7 +610,8 @@ void IdentifyVersion (void)
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);
@ -802,7 +805,7 @@ void D_DoomMain (void)
IdentifyVersion ();
setbuf (stdout, NULL);
//XXX setbuf (stdout, NULL);
modifiedgame = false;
nomonsters = M_CheckParm ("-nomonsters");

View File

@ -128,7 +128,7 @@ animdef_t animdefs[] =
{true, "WFALL4", "WFALL1", 8},
{true, "DBRAIN4", "DBRAIN1", 8},
{-1}
{false, "\0", "\0", 0}
};
anim_t anims[MAXANIMS];
@ -152,7 +152,8 @@ void P_InitPicAnims (void)
// 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)
{

View File

@ -319,7 +319,10 @@ void R_GenerateLookup (int texnum)
// 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;
@ -370,7 +373,9 @@ void R_GenerateLookup (int texnum)
texturecompositesize[texnum] += texture->height;
}
}
}
free(patchcount);
}
@ -448,7 +453,10 @@ void R_InitTextures (void)
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++)
{
@ -571,6 +579,8 @@ void R_InitTextures (void)
for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i;
free(patchlookup);
}
@ -759,7 +769,10 @@ void R_PrecacheLevel (void)
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++)
@ -779,9 +792,14 @@ void R_PrecacheLevel (void)
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++)
@ -814,9 +832,14 @@ void R_PrecacheLevel (void)
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)
@ -842,6 +865,8 @@ void R_PrecacheLevel (void)
}
}
}
free(numsprites);
}

View File

@ -10,8 +10,13 @@ in_addr_t inet_addr(const char *cp)
}
// XXX FIXME
int usleep(useconds_t us)
{
return 0;
}
//int usleep(useconds_t us)
//{
// return 0;
//}
//
//
//struct hostent *gethostbyname(const char *name)
//{
// return NULL;
//}

View File

@ -196,7 +196,8 @@ void W_AddFile (char *filename)
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;
@ -220,6 +221,9 @@ void W_AddFile (char *filename)
lump_p->size = LONG(fileinfo->size);
strncpy (lump_p->name, fileinfo->name, 8);
}
//XXX: Alloca replacement
free(fileinfo);
if (reloadname)
close (handle);
@ -253,7 +257,10 @@ void W_Reload (void)
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);
@ -270,7 +277,8 @@ void W_Reload (void)
lump_p->position = LONG(fileinfo->filepos);
lump_p->size = LONG(fileinfo->size);
}
free(fileinfo);
close (handle);
}