[deutex] 02/04: New upstream version 5.0.0

Jonathan Dowland jmtd at moszumanska.debian.org
Tue Aug 1 10:55:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag debian/5.0.0-1
in repository deutex.

commit c303a1c2210e42bc1400b4c1930ba97000229f70
Author: Jonathan Dowland <jmtd at debian.org>
Date:   Tue Aug 1 08:02:49 2017 +0100

    New upstream version 5.0.0
---
 AUTHORS       |   1 +
 Makefile.in   |   2 +-
 NEWS.adoc     |   6 +-
 configure     |  20 +++---
 configure.ac  |   2 +-
 src/compose.c |   2 +-
 src/deutex.c  |  13 ++--
 src/ident.c   |  17 ++++-
 src/listdir.c |   2 +-
 src/mkwad.c   |  11 +--
 src/picture.c | 217 ++++++++++++++++++++++++++++++++++++++++------------------
 src/sound.c   |   6 +-
 src/tools.c   | 184 ++++++++++++-------------------------------------
 src/tools.h   |   5 --
 14 files changed, 237 insertions(+), 251 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 62acf57..d7b9f84 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,5 @@
 André Majorel <amajorel at teaser.fr>
+Ayub Ahmed <ayubahmed2240 at gmail.com>
 Jon Dowland <jmtd at debian.org>
 Mike Swanson <mikeonthecomputer at gmail.com>
 Nick Zatkovich <NZatkovich at gmail.com>
diff --git a/Makefile.in b/Makefile.in
index 1d69d4d..c4a1eb5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -157,7 +157,7 @@ CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(top_srcdir)/pkg.w32/config.make.in AUTHORS COPYING \
-	COPYING.LIB compile depcomp install-sh missing
+	COPYING.LIB compile install-sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
diff --git a/NEWS.adoc b/NEWS.adoc
index 49ae241..29d2e8f 100644
--- a/NEWS.adoc
+++ b/NEWS.adoc
@@ -1,4 +1,4 @@
-5.0.0 (2017-??-??)
+5.0.0 (2017-07-31)
 ------------------
 
 Removed features
@@ -30,8 +30,8 @@ General
     (illegal file name characters on DOS, but not current Windows
     systems), and sprite names with `\` are now altered to use `^`
     on-disk, matching the ZDoom PK3 standard.
-  * Graphics with a height > 128 and < 256 are now inserted into Doom
-    WAD files correctly.
+  * Graphics with a height > 128 are now inserted into Doom WAD files
+    correctly.
   * UDMF (Universal Doom Map Format) support.
 
 Build systems, code standards
diff --git a/configure b/configure
index e5d18fe..a82a4d8 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for DeuTex 5.0.0-beta.2.
+# Generated by GNU Autoconf 2.69 for DeuTex 5.0.0.
 #
 # Report bugs to <https://github.com/Doom-Utils/deutex/issues>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='DeuTex'
 PACKAGE_TARNAME='deutex'
-PACKAGE_VERSION='5.0.0-beta.2'
-PACKAGE_STRING='DeuTex 5.0.0-beta.2'
+PACKAGE_VERSION='5.0.0'
+PACKAGE_STRING='DeuTex 5.0.0'
 PACKAGE_BUGREPORT='https://github.com/Doom-Utils/deutex/issues'
 PACKAGE_URL=''
 
@@ -1238,7 +1238,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures DeuTex 5.0.0-beta.2 to adapt to many kinds of systems.
+\`configure' configures DeuTex 5.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1304,7 +1304,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of DeuTex 5.0.0-beta.2:";;
+     short | recursive ) echo "Configuration of DeuTex 5.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1406,7 +1406,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-DeuTex configure 5.0.0-beta.2
+DeuTex configure 5.0.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1461,7 +1461,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by DeuTex $as_me 5.0.0-beta.2, which was
+It was created by DeuTex $as_me 5.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2325,7 +2325,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='deutex'
- VERSION='5.0.0-beta.2'
+ VERSION='5.0.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4475,7 +4475,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by DeuTex $as_me 5.0.0-beta.2, which was
+This file was extended by DeuTex $as_me 5.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4541,7 +4541,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-DeuTex config.status 5.0.0-beta.2
+DeuTex config.status 5.0.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 0773bc7..af36026 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([DeuTex], [5.0.0-beta.2], [https://github.com/Doom-Utils/deutex/issues])
+AC_INIT([DeuTex], [5.0.0], [https://github.com/Doom-Utils/deutex/issues])
 AC_PACKAGE_URL([https://github.com/Doom-Utils/deutex])
 AM_INIT_AUTOMAKE([foreign])
 AC_PROG_CC
diff --git a/src/compose.c b/src/compose.c
index 1810448..3472d1d 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -100,7 +100,7 @@ void CMPOerrorAction(void)
     if (CMPOwadout == NULL)
         return;
     WADRclose(CMPOrwad);        /*close file */
-    Unlink(CMPOwadout);         /*delete file */
+    remove(CMPOwadout);         /*delete file */
 }
 
 void CMPOmakePWAD(const char *doomwad, WADTYPE type, const char *PWADname,
diff --git a/src/deutex.c b/src/deutex.c
index f069e6e..28fbb2c 100644
--- a/src/deutex.c
+++ b/src/deutex.c
@@ -870,9 +870,6 @@ int main(int argc, char *argv_non_const[])
         }
     }
 
-    /* Sanity checks */
-    check_types();
-
     /*
     ** default parameters
     */
@@ -896,10 +893,6 @@ int main(int argc, char *argv_non_const[])
 
     /*setbuf(stdout,(char *)NULL); */
     setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
-    /*
-    ** print on screen or file?
-    */
-    PrintInit(false);
     PrintVerbosity(2);
 
     /* Do a second pass through argv to catch options like --help that
@@ -957,6 +950,7 @@ int main(int argc, char *argv_non_const[])
                 "freedoom1",    /* Freedoom: Phase 1 */
                 "freedoom2",    /* Freedoom: Phase 2 */
                 "freedm",       /* FreeDM */
+                "blasphem",     /* Blasphemer */
                 "heretic",      /* Heretic */
                 "hexen",        /* Hexen */
                 "strife1",      /* Strife */
@@ -964,6 +958,8 @@ int main(int argc, char *argv_non_const[])
                 "doom1",        /* Doom shareware */
                 "heretic1",     /* Heretic demo */
                 "strife0",      /* Strife demo */
+                "hacx",         /* Hacx IWAD */
+                "chex3",        /* Chex Quest 3 IWAD */
                 NULL
             };
             int gotit = 0;
@@ -1172,7 +1168,7 @@ void COMvers(int argc, const char *argv[])
 {
     (void) argc;
     (void) argv;
-    printf("%s %.32s\n", PACKAGE_NAME, PACKAGE_VERSION);
+    printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
     exit(0);
 }
 
@@ -1328,4 +1324,5 @@ static void call_opt(comfun_t func, ...)
         }
     }
     func(argc, argv);
+    va_end(args);
 }
diff --git a/src/ident.c b/src/ident.c
index ad7601f..0bb75b3 100644
--- a/src/ident.c
+++ b/src/ident.c
@@ -169,7 +169,7 @@ int IDENTgraphic(struct WADINFO *info, int16_t n)
 {
     int32_t start = info->dir[n].start;
     int32_t size = info->dir[n].size;
-    char *buf;
+    unsigned char *buf;
     pic_head_t h;
     int x;
     int bad_order = 0;
@@ -781,6 +781,7 @@ ENTRY *IDENTentriesIWAD(struct WADINFO *info, char *Pnam, int32_t Pnamsz,
     if (WADRfindEntry(info, "ENDTEXT") < 0)     /*Not Heretic */
         if (WADRfindEntry(info, "ENDOOM") >= 0)
             Doom = true;
+
     /*
     ** identify for IWAD
     */
@@ -793,7 +794,12 @@ ENTRY *IDENTentriesIWAD(struct WADINFO *info, char *Pnam, int32_t Pnamsz,
     IDENTdirPCSounds(ids, info, false); /*fast */
     IDENTdirPatches(ids, info, Pnam, Pnamsz, false);    /*fast */
     IDENTdirGraphics(ids, info);        /*fast */
-    IDENTdirSscripts(ids, info); // FIXME Should not be called if not Strife!
+    /*
+    **  Check if Strife's ENDSTRF lump is present
+    */
+    if(WADRfindEntry(info, "ENDSTRF") >= 0) {
+        IDENTdirSscripts(ids, info);
+    }
     if (Fast != true) {
         IDENTdirSounds(ids, info, Doom);        /*slow! */
         IDENTdirGraphics2(ids, info, true);     /*slow! */
@@ -833,7 +839,12 @@ ENTRY *IDENTentriesPWAD(struct WADINFO * info, char *Pnam, int32_t Pnamsz)
     IDENTdirPCSounds(ids, info, true);
     IDENTdirPatches(ids, info, Pnam, Pnamsz, true);
     IDENTdirGraphics(ids, info);
-    IDENTdirSscripts(ids, info); // FIXME Should not be called if not Strife!
+    /*
+    **  Check if Strife's ENDSTRF lump is present
+    */
+    if(WADRfindEntry(info, "ENDSTRF") >= 0) {
+        IDENTdirSscripts(ids, info);
+    }
     IDENTdirSounds(ids, info, false);
     IDENTdirGraphics2(ids, info, true);
     ident_func = "IDENTentriesPWAD";
diff --git a/src/listdir.c b/src/listdir.c
index f62fd31..2d29b6c 100644
--- a/src/listdir.c
+++ b/src/listdir.c
@@ -647,7 +647,7 @@ void XTRcompakWAD(const char *DataDir, const char *wadin,
     WADRopenR(&pwad, wadin);
     pnb = (int16_t) pwad.ntry;
     pdir = pwad.dir;
-    psame = (bool *) Malloc(pnb * sizeof(bool));
+    psame = (bool *) Malloc(pnb);
     for (p = 0; p < pnb; p++) {
         psame[p] = false;
     }
diff --git a/src/mkwad.c b/src/mkwad.c
index 4aa29ad..45db4cd 100644
--- a/src/mkwad.c
+++ b/src/mkwad.c
@@ -11,10 +11,11 @@
 
 #include "deutex.h"
 
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
-#include <errno.h>
+#include <unistd.h>
 
 #include "tools.h"
 #include "mkwad.h"
@@ -132,7 +133,6 @@ void WADRopenR(struct WADINFO *info, const char *wadin)
           (long) ntry);
 }
 
-static char signature[19 + 32];
 void WADRopenW(struct WADINFO *info, const char *wadout, WADTYPE type,
                int verbose)
 {
@@ -166,11 +166,6 @@ void WADRopenW(struct WADINFO *info, const char *wadout, WADTYPE type,
     /* will be fixed when closing the WAD */
     WADRwriteLong(info, -1);    /* no counter of dir entries */
     WADRwriteLong(info, -1);    /* no dir pointer */
-    /* DeuTex notice */
-    sprintf(signature, " " PACKAGE_NAME " %.32s %cOJM 94 ",
-            PACKAGE_VERSION, 0xB8);
-    /********----**----**-********/
-    WADRwriteBytes(info, signature, strlen(signature));
     WADRalign4(info);
 }
 
@@ -278,7 +273,7 @@ void WADRchsize(struct WADINFO *info, int32_t fsize)
 {
     if (!(info->ok & WADR_WRITE))
         Bug("WW93", "WadcSz");
-    if (Chsize(fileno(info->fd), fsize) != 0)
+    if (ftruncate(fileno(info->fd), fsize) != 0)
         ProgError("WW95", "%s: %s", fname(info->filename),
                   strerror(errno));
     /*@ AEO while trying the change the size of the wad */
diff --git a/src/picture.c b/src/picture.c
index 32bcaa1..1451f64 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -315,9 +315,9 @@ int32_t PICsaveInWAD(struct WADINFO * info, char *file, PICTYPE type,
         ProgError("GB10", "%s: picture width < 1", fname(file));
     if (rawY < 1)
         ProgError("GB11", "%s: picture height < 1", fname(file));
-    /* AYM (256 -> 509) */
-    if (rawY > 509)
-        ProgError("GB13", "%s: picture height > 509", fname(file));
+    /*max tallpic is 2048*/
+    if (rawY > 2048)
+        ProgError("GB13", "%s: picture height > 2048", fname(file));
     switch (type) {
     case PGRAPH:
     case PWEAPN:
@@ -400,6 +400,11 @@ static char *RAWtoPIC(int32_t * ppicsz, char *raw, int16_t rawX,
                       char transparent)
 {
     int16_t x, y;
+    int16_t rowpos;
+    int16_t number_of_pix_index = 1;
+    int16_t first_pix_index = 3;
+    bool is_tall_pic_post_header;
+    bool is_first_254;
     char pix, lastpix;          /*pixels */
     /*Doom PIC */
     char *pic;                  /*picture */
@@ -414,34 +419,12 @@ static char *RAWtoPIC(int32_t * ppicsz, char *raw, int16_t rawX,
     /*offset of first column */
     colnbase = sizeof(struct PICHEAD) + ((int32_t) rawX) * sizeof(int32_t);
     /* worst expansion when converting from PIXEL column to
-    ** list of sets: (5*Ysize/2)+1, corresponding to a dotted vertical
-    ** transparent line. Ysize/2 dots, 4overhead+1pix, 1 last FF code.
-    ** but if too big, allow only a 10 split mean per line
+    ** list of sets: (5*Ysize/2)+(Y/254*8), corresponding to a dotted vertical
+    ** transparent line with tallpic posts.
     */
-    /*this memory optimisation doesn't work for big pics
-      with many transparent areas. it limits the number of transp slots
-      to a mean of 10. so a resize could be needed later.
-      else, the biggest would be 162k
-    */
-    /* AYM 1999-05-09: changed the calculation of picsz.
-       Previously, it was assumed that the worst case was when
-       every second pixel was transparent. This is not true for
-       textures that are only 2-pixel high; in that case, if the
-       two pixels are opaque, the column uses 7 bytes. The old
-       code thought that was 6 bytes, and overflowed the buffer
-       for at least one picture (Strife's STBFN045). */
-    /* Highest possible picture :
-       Post 1  yofs = 0    length = 254
-       Post 2  yofs = 254  length = 255
-       Max height is 509 pixels. */
-    {
-        /* FIXME */
-        int worst_case_1 = 5 * (((long) rawY + 1) / 2) + 1 + 1; /* "+ 1" matters ! */
-        int worst_case_2 = 4 + rawY + 1;
-        int worst_case =
-            worst_case_1 > worst_case_2 ? worst_case_1 : worst_case_2;
-        picsz = colnbase + ((int32_t) rawX) * worst_case;
-    }
+    int32_t worst_case = (int32_t) (5 * ((rawY + 1) / 2) + ((rawY / 254) * 8 ));
+    picsz = colnbase + ((int32_t) rawX) * worst_case;
+
     pic = (char *) Malloc(picsz);
     ColOfs = (int32_t *) & (pic[sizeof(struct PICHEAD)]);
     pichead = (struct PICHEAD *) pic;
@@ -457,69 +440,147 @@ static char *RAWtoPIC(int32_t * ppicsz, char *raw, int16_t rawX,
         write_i32_le(ColOfs + x, colnpos);
         setpos = 0;
         lastpix = transparent;
+        /* So this is how posts work:
+           0 [y-offset]
+           1 [n# of pixels in post]
+           2 [dummy pixel]
+           3 [pixel 0]
+           4 [pixel 1]
+           ...
+           3+n-1 [pixel n-1]
+           4+n-1 [dummy pixel]
+
+           It makes a new one every tranparent pixel.
+
+           If y % 254 == 0 and the height of the image is >= 256, 509, etc,
+           then a new tallpic post is started like this:
+
+           0 [254]
+           1 [0]
+           2 [0]
+           3 [0]
+           4 [no. of trans pixels between pixel 254 and the next non transparent pixel]
+           5 [n# of pixels in post]
+           6 [dummy pixel]
+           7 [pixel 0]
+           8 [pixel 1]
+           ...
+           7+n-1 [pixel n-1]
+           8+n-1 [dummy pixel]
+
+           THEN, every subsequent post after the tallpic post goes like this:
+           0 [row offset from first non-transparent pixel of last post]
+           1 [n# of pixels]
+           2 [dummy]
+           etc.
+        */
+        is_tall_pic_post_header = false;
+        is_first_254 = true;
+        number_of_pix_index = 1;
+        first_pix_index = 3;
+        rowpos = 0;
+
         for (y = 0; y < rawY; y++) {    /*get column pixel */
             rawpos = ((int32_t) x) + ((int32_t) rawX) * ((int32_t) y);
             pix = raw[rawpos];
+            /*if this is a picture that has a height of >=256, make tallpic post.*/
+            if (((y == 254) ||
+                (y > 254 && setcount == 254) ||
+                (y > 254 && rowpos >= 254 && lastpix == transparent))
+                 && rawY > 255 ) {
+                is_tall_pic_post_header = true;
+                is_first_254 = false;
+                /*finish the current set, if any */
+                if (lastpix != transparent) {
+                    Set[number_of_pix_index] = setcount;
+                    Set[first_pix_index + setcount] = lastpix;
+                    setpos += first_pix_index + setcount + 1; /*1pos,1cnt,1dmy,setcount pixels,1dmy */
+                }
+                Set = (char *) &(pic[colnpos + setpos]);
+                rowpos = 0; //reset row position for subsequent posts after this one.
+                setcount = 0;
+                number_of_pix_index = 5;
+                first_pix_index = 7;
+
+                /*start new tallpic post*/
+                Set[0] = 254;
+                Set[1] = 0;
+                Set[2] = 0;
+                Set[3] = 0;
+                Set[4] = 0; /*number of transparent pixels between this post and next*/
+                Set[5] = 0; /*count (updated later) */
+                if (pix != transparent)
+                    Set[6] = pix; //dummy
+                else
+                    Set[6] = 0; //dummy
+            }
             /* Start new post ? */
             if (pix != transparent) {
-                /* End current post and start new one if either :
-                   - more than 255 consecutive non-transparent
-                   pixels (a post cannot be longer than 255
-                   pixels)
-                   - current Y-offset is 254; since the maximum
-                   start Y-offset for a post is 254, a new post
-                   should be started when we reach that position.
+                if (is_tall_pic_post_header) {
+                    //We are done making the tallpic post header.
+                    is_tall_pic_post_header = false;
+                    lastpix = pix; //we DO NOT want to start a new post.
+                }
+                /* End current post and start new one if more than
+                   128 consecutive non-transparent pixels AND picture
+                   is less than 256 pixels tall
                 */
-                if ((setcount == 128 || setcount == 256 || y == 254)
-                    && lastpix != transparent) {
-                    if (setcount == 256)
-                        setcount--;     /* That's backtracking */
+                if (setcount == 128 && rawY < 256 && lastpix != transparent) {
                     Set[1] = setcount;
-                    Set[3 + setcount] = lastpix;
+                    Set[3 + setcount] = lastpix; //dummy
                     setpos += 3 + setcount + 1;
-                    Set = (char *) &(pic[colnpos + setpos]);
-                    setcount = 0;
-                    Set[0] = y; /* Y-offset */
-                    Set[1] = 0; /* Count (updated later) */
-                    Set[2] = pix;       /* Unused */
-                }
-                /* More than 509 pixels for this column. Quit. */
-                if (y >= 509) {
-                    Warning("PI20",
-                            "Column has more than 509 pixels, truncating at (%d,%d)",
-                            (int) x, (int) y);
-                    break;
+                    lastpix = transparent; //start a new post
                 }
                 if (lastpix == transparent) {   /* begining of post */
                     Set = (char *) &(pic[colnpos + setpos]);
                     setcount = 0;
-                    Set[0] = y; /* y position */
+                    number_of_pix_index = 1;
+                    first_pix_index = 3;
+                    Set[0] = rowpos; /* y position */
                     Set[1] = 0; /*count (updated later) */
                     Set[2] = pix;       /*unused */
+                    if (!is_first_254) {
+                        //reset rowpos if we are in relative offset mode
+                        rowpos = 0;
+                    }
                 }
-                Set[3 + setcount] = pix;        /*non transparent pixel */
+                Set[first_pix_index + setcount] = pix;        /*non transparent pixel */
                 setcount++;     /*update count of pixel in set */
             } else {            /*pix is transparent */
-                if (lastpix != transparent) {   /*finish the current set */
-                    Set[1] = setcount;
-                    Set[3 + setcount] = lastpix;
-                    setpos += 3 + setcount + 1; /*1pos,1cnt,1dmy,setcount pixels,1dmy */
+                if (is_tall_pic_post_header){
+                    Set[4] += 1; //increase transparent pixel count in tallpic post header
+                    rowpos = -1; //keep resetting rowpos until we get a non-transparent pixel
                 }
+                else if (lastpix != transparent) {   /*finish the current set */
+                    Set[number_of_pix_index] = setcount;
+                    Set[first_pix_index + setcount] = lastpix; //dummy
+                    setpos += first_pix_index + setcount + 1; /*1pos,1cnt,1dmy,setcount pixels,1dmy */
+                }
+
                 /*else: not in set but in transparent area */
             }
             lastpix = pix;
+            rowpos++;
         }
         if (lastpix != transparent) {   /*finish current set, if any */
-            Set[1] = setcount;
-            Set[3 + setcount] = lastpix;
-            setpos += 3 + setcount + 1;
+            Set[number_of_pix_index] = setcount;
+            Set[first_pix_index + setcount] = lastpix; //dummy
+            setpos += first_pix_index + setcount + 1; /*1pos,1cnt,1dmy,setcount pixels,1dmy */
+        }
+        /*If we've reached the end of the column and we're still in the tallpic header,
+          end the post at offset 4.*/
+        if (is_tall_pic_post_header) {
+            Set[4] = (char) 0xFF;
+            setpos += 4;
+        } else {
+            //otherwise, end it normally.
+            pic[colnpos + setpos] = (char) 0xFF;    /*end of all sets */
         }
-        pic[colnpos + setpos] = (char) 0xFF;    /*end of all sets */
         colnpos += (int32_t) (setpos + 1);      /*position of next column */
     }
     /*picsz was an overestimated size for PIC */
     pic = (char *) Realloc(pic, colnpos);
-    *ppicsz = colnpos; /*real size of PIC */ ;
+    *ppicsz = colnpos; /*real size of PIC */
     return pic;
 }
 
@@ -543,6 +604,8 @@ static char *PICtoRAW(int16_t * prawX, int16_t * prawY, int16_t * pXinsr,
 {
     int16_t x, y;               /*pixels */
     const void *offsets;
+    int realY;
+    bool is_first_254;
     /* Last byte of pic buffer */
     const unsigned char *pic_end =
         ((const unsigned char *) pic) + picsz - 1;
@@ -614,6 +677,8 @@ static char *PICtoRAW(int16_t * prawX, int16_t * prawY, int16_t * pXinsr,
                         (long) ((const char *) pic - (const char *) post));
         }
         /* Read an entire post */
+        realY = 0;
+        is_first_254 = true;
         for (;;) {
             int post_length;
             const unsigned char *post_end;
@@ -626,8 +691,25 @@ static char *PICtoRAW(int16_t * prawX, int16_t * prawY, int16_t * pXinsr,
             /* Read the header of the post */
             if (*post == 0xff)
                 break;          /* Last post */
-            y = *post++;
-            post_length = *post++;
+            else if (*post == 0xfe) { //If this is a tallpic post
+                is_first_254 = false;
+                y = *post;
+                y += realY;
+                post = &post[4];
+                if (*post == 0xff) //last post
+                    break;
+                y += *post++; //read transparent pixel count, go to count
+                post_length = *post++;
+                realY = y;
+            }
+            else{
+                y = *post++;
+                post_length = *post++;
+                if (is_first_254 == false) { //if we are in relative offset mode
+                    y += realY;
+                    realY = y;
+                }
+            }
             if (h.dummy_bytes)
                 post++;
             post_end = post + post_length;
@@ -1130,7 +1212,6 @@ static char *PNGtoRAW(int16_t * rawX, int16_t * rawY, char *file)
             return raw;
         } else {
             ProgError("GR33", "libPNG decoding error");
-            return 0;
         }
     }
 }
diff --git a/src/sound.c b/src/sound.c
index 4b232a7..a16c056 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -111,7 +111,11 @@ char *SNDloadWaveFile(char *file, int32_t * psize, int32_t * pspeed)
         chunk += sizeof(struct CHUNK) + peek_i32_le(&headc.size);
     }
     fseek(fp, chunk, SEEK_SET);
-    fread(&headf, sizeof(struct WAVEFMT), 1, fp);
+    if (fread(&headf, sizeof(struct WAVEFMT), 1, fp) == 1) {
+        Info("RR01", "%s is a WAVE file", fname(file));
+    } else {
+        ProgError("RR02", "%s is not a WAVE file", fname(file));
+    }
     if (peek_i16_le(&headf.tag) != 1)
         ProgError("RR16", "%s: not raw data", fname(file));
     if (peek_i16_le(&headf.channel) != 1)
diff --git a/src/tools.c b/src/tools.c
index fa686e7..ab614ed 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -19,10 +19,7 @@
 #include <stdarg.h>
 #include "tools.h"
 
-#define SEPARATOR "/"
-#include <unistd.h>
 #include <memory.h>
-
 #include <utime.h>
 
 #include <time.h>
@@ -38,62 +35,6 @@
 static const char hex_digit[16] = "0123456789ABCDEF";
 
 /*
- *      check_types
- *      Sanity checks on the specified-width types.
- *      Will help catching porting errors.
- */
-typedef struct {
-    const char *name;
-    size_t mandated_size;
-    size_t actual_size;
-} type_check_t;
-
-static const type_check_t type_checks[] = {
-    {"int8_t", 1, sizeof(int8_t)}
-    ,
-    {"int16_t", 2, sizeof(int16_t)}
-    ,
-    {"int32_t", 4, sizeof(int32_t)}
-    ,
-    {"uint8_t", 1, sizeof(uint8_t)}
-    ,
-    {"uint16_t", 2, sizeof(uint16_t)}
-    ,
-    {"uint32_t", 4, sizeof(uint32_t)}
-};
-
-void check_types(void)
-{
-    const type_check_t *t;
-    for (t = type_checks; t - type_checks < sizeof type_checks / sizeof *t;
-         t++) {
-        /* FIXME Perhaps too strict. Wouldn't "<" suffice ? */
-        if (t->actual_size != t->mandated_size)
-            ProgError("AA01",
-                      "Type %s has size %d (should be %d);"
-                      " fix deutex.h and recompile", t->name,
-                      (int) t->actual_size, (int) t->mandated_size);
-    }
-}
-
-/*
-** Resize a file
-** returns   0 if okay    -1 if failed.
-*/
-int16_t Chsize(int handle, int32_t newsize)
-{
-    return (int16_t) ftruncate(handle, newsize);
-}
-
-/*
-** Delete a file
-*/
-void Unlink(const char *file)
-{
-    remove(file);
-}
-
-/*
 ** Get a file time stamp. (date of last modification)
 */
 int32_t Get_File_Time(const char *path)
@@ -142,9 +83,6 @@ void Memset(void *dest, char car, long n)
 /*
 ** Allocate memory
 */
-/*code derived from DEU*/
-#define SIZE_THRESHOLD        0x400L
-#define SIZE_OF_BLOCK        0xFFFL
 /* actually, this is (size - 1) */
 void *Malloc(long size)
 {
@@ -205,12 +143,12 @@ static void NameDir(char file[128], const char *path, const char *dir, const
         }
     if (dir != NULL)
         if (strlen(dir) > 0) {
-            strcat(file, SEPARATOR);
+            strcat(file, "/");
             strncat(file, dir, 12);
         }
     if (sdir != NULL)
         if (strlen(sdir) > 0) {
-            strcat(file, SEPARATOR);
+            strcat(file, "/");
             strncat(file, sdir, 12);
         }
     ToLowerCase(file);
@@ -261,7 +199,7 @@ bool MakeFileName(char file[128], const char *path, const char *dir, const
     /*
     ** file name
     */
-    strcat(file, SEPARATOR);
+    strcat(file, "/");
     strncat(file, name2, 8);
     strcat(file, ".");
     strncat(file, extens, 4);
@@ -287,13 +225,10 @@ void GetNameOfWAD(char name[8], const char *path)
     /*find end of DOS or Unix path */
     for (nam = n = 0; n < len; n++)
         switch (path[n]) {
-            /* FIXME AYM 1999-06-09: I don't understand what "$" is
-               doing here. */
-            /* FIXME AYM 1999-06-09: Is it really a good idea to
-               consider "\" a path separator under Unix ? */
+#ifdef _WIN32
         case '\\':
+#endif
         case '/':
-        case '$':
             nam = n + 1;
         }
     /*find root name */
@@ -455,38 +390,6 @@ const char *quotechar(char c)
 */
 static bool asFile = false;
 static int16_t Verbosity = 2;
-static FILE *Stdout;            /*command output */
-static FILE *Stderr;            /*errors */
-static FILE *Stdwarn;           /*warningss */
-static FILE *Stdinfo;           /*infos */
-
-#define stderr_  (Stderr  != NULL ? Stderr  : stderr)
-#define stdinfo_ (Stdinfo != NULL ? Stdinfo : stdout)
-#define stdout_  (Stdout  != NULL ? Stdout  : stdout)
-#define stdwarn_ (Stdwarn != NULL ? Stdwarn : stderr)
-
-void PrintInit(bool asfile)
-{
-    /*clear a previous call */
-    PrintExit();
-    /* choose */
-    if (asfile == true) {
-        if ((Stdout = fopen("output.txt", FOPEN_WT)) == NULL)
-            ProgError("DI10", "output.txt: %s", strerror(errno));
-        if ((Stderr = fopen("error.txt", FOPEN_WT)) == NULL) {
-            Stderr = stderr;
-            ProgError("DI20", "error.txt: %s", strerror(errno));
-        }
-        Stdinfo = stdout;
-        Stdwarn = Stderr;
-    } else {
-        Stdout = stdout;
-        Stderr = stderr;
-        Stdwarn = stderr;
-        Stdinfo = stdout;
-    }
-    asFile = asfile;
-}
 
 void PrintVerbosity(int16_t level)
 {
@@ -496,9 +399,8 @@ void PrintVerbosity(int16_t level)
 void PrintExit(void)
 {
     if (asFile == true) {
-        fclose(Stdout);
-        fclose(Stderr);
-        /*fclose(Stdinfo); */
+        fclose(stdout);
+        fclose(stderr);
     }
 }
 
@@ -522,14 +424,14 @@ void ProgError(const char *code, const char *fmt, ...)
 {
     va_list args;
 
-    fflush(stdout_);
-    fprintf(stderr_, "E %s ", code);
+    fflush(stdout);
+    fprintf(stderr, "E %s ", code);
     va_start(args, fmt);
-    vfprintf(stderr_, fmt, args);
+    vfprintf(stderr, fmt, args);
     va_end(args);
     va_start(args, fmt);
     va_end(args);
-    fputc('\n', stderr_);
+    fputc('\n', stderr);
     (*Action) ();               /* execute error handler */
     PrintExit();
     exit(2);
@@ -542,30 +444,30 @@ void nf_err(const char *code, const char *fmt, ...)
 {
     va_list args;
 
-    fflush(stdout_);
-    fprintf(stderr_, "%c %s ", MSGCLASS_ERR, code);
+    fflush(stdout);
+    fprintf(stderr, "%c %s ", MSGCLASS_ERR, code);
     va_start(args, fmt);
-    vfprintf(stderr_, fmt, args);
+    vfprintf(stderr, fmt, args);
     va_end(args);
     va_start(args, fmt);
     va_end(args);
-    fputc('\n', stderr_);
-    fflush(stderr_);
+    fputc('\n', stderr);
+    fflush(stderr);
 }
 
 void Bug(const char *code, const char *fmt, ...)
 {
     va_list args;
 
-    fflush(stdout_);
-    fprintf(stdwarn_, "%c %s ", MSGCLASS_BUG, code);
+    fflush(stdout);
+    fprintf(stderr, "%c %s ", MSGCLASS_BUG, code);
     va_start(args, fmt);
-    vfprintf(stderr_, fmt, args);
+    vfprintf(stderr, fmt, args);
     va_end(args);
     va_start(args, fmt);
     va_end(args);
-    fputc('\n', stderr_);
-    fputs("Please report that bug\n", stderr_);
+    fputc('\n', stderr);
+    fputs("Please report that bug\n", stderr);
     /* CloseWadFiles(); */
     PrintExit();
     exit(3);
@@ -575,14 +477,14 @@ void Warning(const char *code, const char *fmt, ...)
 {
     va_list args;
 
-    fflush(stdout_);
-    fprintf(stdwarn_, "%c %s ", MSGCLASS_WARN, code);
+    fflush(stdout);
+    fprintf(stderr, "%c %s ", MSGCLASS_WARN, code);
     va_start(args, fmt);
-    vfprintf(stdwarn_, fmt, args);
+    vfprintf(stderr, fmt, args);
     va_end(args);
     va_start(args, fmt);
     va_end(args);
-    fputc('\n', stdwarn_);
+    fputc('\n', stderr);
 }
 
 void LimitedWarn(int *left, const char *code, const char *fmt, ...)
@@ -590,14 +492,14 @@ void LimitedWarn(int *left, const char *code, const char *fmt, ...)
     if (left == NULL || (left != NULL && *left > 0)) {
         va_list args;
 
-        fflush(stdout_);
-        fprintf(stdwarn_, "%c %s ", MSGCLASS_WARN, code);
+        fflush(stdout);
+        fprintf(stderr, "%c %s ", MSGCLASS_WARN, code);
         va_start(args, fmt);
-        vfprintf(stdwarn_, fmt, args);
+        vfprintf(stderr, fmt, args);
         va_end(args);
         va_start(args, fmt);
         va_end(args);
-        fputc('\n', stdwarn_);
+        fputc('\n', stderr);
     }
     if (left != NULL)
         (*left)--;
@@ -606,17 +508,17 @@ void LimitedWarn(int *left, const char *code, const char *fmt, ...)
 void LimitedEpilog(int *left, const char *code, const char *fmt, ...)
 {
     if (left != NULL && *left < 0) {
-        fflush(stdout_);
+        fflush(stdout);
         if (fmt != NULL) {
             va_list args;
-            fprintf(stdwarn_, "%c %s ", MSGCLASS_WARN, code);
+            fprintf(stderr, "%c %s ", MSGCLASS_WARN, code);
             va_start(args, fmt);
-            vfprintf(stdwarn_, fmt, args);
+            vfprintf(stderr, fmt, args);
             va_end(args);
             va_start(args, fmt);
             va_end(args);
         }
-        fprintf(stdwarn_, "%d warnings omitted\n", -*left);
+        fprintf(stderr, "%d warnings omitted\n", -*left);
     }
 }
 
@@ -625,7 +527,7 @@ void Output(const char *fmt, ...)
     va_list args;
 
     va_start(args, fmt);
-    vfprintf(stdout_, fmt, args);
+    vfprintf(stdout, fmt, args);
     va_end(args);
     va_start(args, fmt);
     va_end(args);
@@ -636,13 +538,13 @@ void Info(const char *code, const char *fmt, ...)
     if (Verbosity >= 1) {
         va_list args;
 
-        fprintf(stdinfo_, "%c %s ", MSGCLASS_INFO, code);
+        fprintf(stdout, "%c %s ", MSGCLASS_INFO, code);
         va_start(args, fmt);
-        vfprintf(stdinfo_, fmt, args);
+        vfprintf(stdout, fmt, args);
         va_end(args);
         va_start(args, fmt);
         va_end(args);
-        fputc('\n', stdinfo_);
+        fputc('\n', stdout);
     }
 }
 
@@ -651,13 +553,13 @@ void Phase(const char *code, const char *fmt, ...)
     if (Verbosity >= 2) {
         va_list args;
 
-        fprintf(stdinfo_, "%c %s ", MSGCLASS_INFO, code);
+        fprintf(stdout, "%c %s ", MSGCLASS_INFO, code);
         va_start(args, fmt);
-        vfprintf(stdinfo_, fmt, args);
+        vfprintf(stdout, fmt, args);
         va_end(args);
         va_start(args, fmt);
         va_end(args);
-        fputc('\n', stdinfo_);
+        fputc('\n', stdout);
     }
 }
 
@@ -666,12 +568,12 @@ void Detail(const char *code, const char *fmt, ...)
     if (Verbosity >= 3) {
         va_list args;
 
-        fprintf(stdinfo_, "%c %s ", MSGCLASS_INFO, code);
+        fprintf(stdout, "%c %s ", MSGCLASS_INFO, code);
         va_start(args, fmt);
-        vfprintf(stdinfo_, fmt, args);
+        vfprintf(stdout, fmt, args);
         va_end(args);
         va_start(args, fmt);
         va_end(args);
-        fputc('\n', stdinfo_);
+        fputc('\n', stdout);
     }
 }
diff --git a/src/tools.h b/src/tools.h
index 3ec1f0a..fcb5404 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -14,8 +14,6 @@
 #define MSGCLASS_ERR  'E'
 #define MSGCLASS_BUG  'B'
 
-void check_types(void);
-
 void PrintCopyright(void);
 void print_version(void);
 void NoCommandGiven(void);
@@ -26,7 +24,6 @@ char *lump_name(const char *name);
 char *short_dump(const char *data, size_t size);
 const char *quotechar(char c);
 
-void PrintInit(bool asFile);
 void PrintVerbosity(int16_t level);
 void PrintExit(void);
 
@@ -49,10 +46,8 @@ void MakeDir(char file[128], const char *path, const char *dir, const char
 bool MakeFileName(char file[128], const char *path, const char *dir, const
                   char *sdir, const char *name, const char *extens);
 void GetNameOfWAD(char name[8], const char *path);
-int16_t Chsize(int handle, int32_t newsize);
 int32_t Get_File_Time(const char *path);
 void Set_File_Time(const char *path, int32_t time);
-void Unlink(const char *file);
 void Memcpy(void *dest, const void *src, long n);
 void Memset(void *dest, char car, long n);
 void *Malloc(long size);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/deutex.git



More information about the Pkg-games-commits mailing list