]> git.0x19.co - doomgeneric-snom360/commitdiff
Game now proceeds to the main game loop
authorMaxime Vincent <maxime.vince@gmail.com>
Mon, 16 May 2016 21:27:09 +0000 (23:27 +0200)
committerMaxime Vincent <maxime.vince@gmail.com>
Mon, 16 May 2016 21:27:09 +0000 (23:27 +0200)
frosted-doom/compat/values.h
frosted-doom/d_main.c
frosted-doom/p_spec.c
frosted-doom/r_data.c
frosted-doom/stubs.c
frosted-doom/w_wad.c

index 5ae2ead1d77597b4a3df074e1fed72a8ce5e3222..389b9d24cded3655da035830792e62f2a2ff7ad5 100644 (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
index 0d5276287e0eac7c75f6e5c38ae511d3930cd535..c8c7a2bf021003133305009a81a2c55281162cc6 100644 (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");
index f048afb1048b42b9d1f7f57fffb8eb4fb748f6a6..78452c835698dabf6b380f24e36ab4ded47b5041 100644 (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)
        {
index acabd53f3722593f741ae879580d3fd7a088094a..54e6ec5c3d93b4180f8eb1c7a6aaf4f3d76e46cf 100644 (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);
 }
 
 
index dc1a32ea6334e3a61d5f8002d7b48611245463ef..77a53583ecda3f4c18e77582002ae99dd8bd2be1 100644 (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;
+//}
index de6b2b113730bda52ae534ce5490e412aabdf11b..636e4fb5ed78cab83e9604780c0bead09f42cc1a 100644 (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);
 }