Mercurial > hg > batmud > maputils
changeset 97:c094c3637841
Updates
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 17 Dec 2006 10:03:43 +0000 |
parents | 3d10542703a9 |
children | c856945880be |
files | Makefile.gen colormap.c diffmap.c maputils.c maputils.h mkloc.c mkmap.c mkspecial.c |
diffstat | 8 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.gen Sun Dec 17 10:03:35 2006 +0000 +++ b/Makefile.gen Sun Dec 17 10:03:43 2006 +0000 @@ -18,9 +18,10 @@ MAKEBCMAP_BIN=$(BINPATH)mkbcmap$(EXEEXT) DIFFMAP_BIN=$(BINPATH)diffmap$(EXEEXT) MKLOC_BIN=$(BINPATH)mkloc$(EXEEXT) +MAP2PPM_BIN=$(BINPATH)map2ppm$(EXEEXT) TARGETS=$(MKMAP_BIN) $(COLORMAP_BIN) $(MKSPECIAL_BIN) \ - $(MAKEBCMAP_BIN) $(DIFFMAP_BIN) \ + $(MAKEBCMAP_BIN) $(DIFFMAP_BIN) $(MAP2PPM_BIN) \ $(MKLOC_BIN) votk.html lanzia.html MAPFILES=tooltip.js votk.html votk.map lanzia.html lanzia.map @@ -52,6 +53,9 @@ $(DIFFMAP_BIN): diffmap.c maputils.o th_util.o $(COMP) -o $@ $+ $(LDFLAGS) +$(MAP2PPM_BIN): map2ppm.c maputils.o th_util.o th_args.o th_string.o + $(COMP) -o $@ $+ $(LDFLAGS) + %.cmap: %.raw $(MKMAP_BIN) $(MKMAP_BIN) -o $@ -r 10 -w 21 -h 21 $< -v -d -m 80 -f 99 @@ -59,12 +63,14 @@ %.map: %.raw $(MKMAP_BIN) $(MKMAP_BIN) -o $@ -r 10 -w 13 -h 7 $< -v -d -m 70 -f 99 +%.png: %.map $(MAP2PPM_BIN) + $(MAP2PPM_BIN) -O $< | pnmscale 5 | pnmtopng -compression=9 > $@ votk.html: votk.map $(COLORMAP_BIN) - $(COLORMAP_BIN) -t "Valley of the Kings" -vaOC -f xhtml -o $@ $< + $(COLORMAP_BIN) -t "Valley of the Kings" -aOC -f xhtml -o $@ $< lanzia.html: lanzia.map $(COLORMAP_BIN) - $(COLORMAP_BIN) -t "The Isle of Lanzia" -vaOC -f xhtml -o $@ $< + $(COLORMAP_BIN) -t "The Isle of Lanzia" -aOC -f xhtml -o $@ $< #
--- a/colormap.c Sun Dec 17 10:03:35 2006 +0000 +++ b/colormap.c Sun Dec 17 10:03:43 2006 +0000 @@ -1,5 +1,5 @@ /* - * Convert given outerworld ASCII map input to different formats + * Convert BatMUD ASCII map to different formats * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen) * (C) Copyright 2006 Tecnic Software productions (TNSP) */
--- a/diffmap.c Sun Dec 17 10:03:35 2006 +0000 +++ b/diffmap.c Sun Dec 17 10:03:43 2006 +0000 @@ -20,6 +20,7 @@ fputc(*c, f); c++; } + fputc(0xff, f); } } @@ -86,10 +87,10 @@ useOld ? "OLD" : "NEW"); /* Read mapfiles */ - if ((map1 = parseFile(argv[1])) == NULL) + if ((map1 = parseFile(argv[1], FALSE)) == NULL) exit(2); - if ((map2 = parseFile(argv[2])) == NULL) + if ((map2 = parseFile(argv[2], FALSE)) == NULL) exit(2); /* Compute and output data */
--- a/maputils.c Sun Dec 17 10:03:35 2006 +0000 +++ b/maputils.c Sun Dec 17 10:03:43 2006 +0000 @@ -184,7 +184,7 @@ /* Parse single arbitrary sized block from given mapfile */ -mapblock_t * parseFile(char *mapFilename) +mapblock_t * parseFile(char *mapFilename, BOOL isDiff) { FILE *inFile; mapblock_t *res; @@ -201,7 +201,8 @@ /* Probe map width */ resH = 0; resW = -1; maxW = 0; while ((c = fgetc(inFile)) != EOF) { - if (c == '\n' || c == '\r') { + if ((!isDiff && c == '\n') || + (isDiff && c == 0xff)) { if (maxW > resW) resW = maxW; maxW = 0; @@ -230,7 +231,7 @@ o = res->d; y = x = 0; while ((c = fgetc(inFile)) != EOF && (y < res->h)) { - if (c == '\n') { + if ((!isDiff && c == '\n') || (isDiff && c == 0xff)) { if (x != res->w) { THERR("Broken block, line width %d < %d!\n", x, res->w);
--- a/maputils.h Sun Dec 17 10:03:35 2006 +0000 +++ b/maputils.h Sun Dec 17 10:03:43 2006 +0000 @@ -77,7 +77,7 @@ mapblock_t * allocBlock(int, int); void freeBlock(mapblock_t *); -mapblock_t * parseFile(char *); +mapblock_t * parseFile(char *, BOOL); void printBlock(FILE *, mapblock_t *); int putBlockDo(mapblock_t *, mapblock_t *, int, int); int putBlock(mapblock_t **, mapblock_t *, int, int, int);
--- a/mkloc.c Sun Dec 17 10:03:35 2006 +0000 +++ b/mkloc.c Sun Dec 17 10:03:43 2006 +0000 @@ -515,7 +515,7 @@ /* Read initial map */ THMSG(2, "Reading map '%s'\n", srcFile); - worldMap = parseFile(srcFile); + worldMap = parseFile(srcFile, FALSE); if (!worldMap) { THERR("World map could not be loaded!\n"); exit(1);
--- a/mkmap.c Sun Dec 17 10:03:35 2006 +0000 +++ b/mkmap.c Sun Dec 17 10:03:43 2006 +0000 @@ -417,7 +417,7 @@ /* Read initial map */ if (optInitialMap) { THMSG(1, "Reading initial map '%s'\n", optInitialMap); - initialMap = parseFile(optInitialMap); + initialMap = parseFile(optInitialMap, FALSE); if (initialMap) { THMSG(2, "Initial dimensions %d x %d\n", initialMap->w, initialMap->h);
--- a/mkspecial.c Sun Dec 17 10:03:35 2006 +0000 +++ b/mkspecial.c Sun Dec 17 10:03:43 2006 +0000 @@ -346,7 +346,7 @@ /* Read initial map */ if (optInitialMap) { THMSG(1, "Reading initial map '%s'\n", optInitialMap); - initialMap = parseFile(optInitialMap); + initialMap = parseFile(optInitialMap, FALSE); if (initialMap) { THMSG(2, "Initial dimensions %d x %d\n", initialMap->w, initialMap->h);