diff options
author | neonloop | 2021-10-20 14:54:27 +0000 |
---|---|---|
committer | neonloop | 2021-10-20 14:54:27 +0000 |
commit | ea1947ffcc606d757357398b24e74a3f4ecefa07 (patch) | |
tree | 2031b8d4fc4c61063c710a7148378f57e662efbd /modules/mod_map | |
download | bennugd-main.tar.gz bennugd-main.tar.bz2 bennugd-main.zip |
Initial commit from steward-fu releasemain
Diffstat (limited to 'modules/mod_map')
-rw-r--r-- | modules/mod_map/Makefile | 661 | ||||
-rw-r--r-- | modules/mod_map/Makefile.am | 14 | ||||
-rw-r--r-- | modules/mod_map/Makefile.in | 661 | ||||
-rw-r--r-- | modules/mod_map/file_fnt.c | 601 | ||||
-rw-r--r-- | modules/mod_map/file_fpg.c | 349 | ||||
-rw-r--r-- | modules/mod_map/file_map.c | 261 | ||||
-rw-r--r-- | modules/mod_map/file_pal.c | 208 | ||||
-rw-r--r-- | modules/mod_map/file_pcx.c | 187 | ||||
-rw-r--r-- | modules/mod_map/file_png.c | 629 | ||||
-rw-r--r-- | modules/mod_map/mod_map.c | 1013 | ||||
-rw-r--r-- | modules/mod_map/mod_map.h | 130 | ||||
-rw-r--r-- | modules/mod_map/mod_map_exports.h | 280 |
12 files changed, 4994 insertions, 0 deletions
diff --git a/modules/mod_map/Makefile b/modules/mod_map/Makefile new file mode 100644 index 0000000..dd2fdd6 --- /dev/null +++ b/modules/mod_map/Makefile @@ -0,0 +1,661 @@ +# Makefile.in generated by automake 1.12.1 from Makefile.am. +# mod_map/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +#AUTOMAKE_OPTIONS = no-dependencies foreign + + +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/bennu +pkgincludedir = $(includedir)/bennu +pkglibdir = $(libdir)/bennu +pkglibexecdir = $(libexecdir)/bennu +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-none +host_triplet = arm-unknown-linux-gnu +target_triplet = arm-unknown-linux-gnu +subdir = mod_map +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libmod_map_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libmod_map_la_OBJECTS = libmod_map_la-file_pcx.lo \ + libmod_map_la-file_png.lo libmod_map_la-file_map.lo \ + libmod_map_la-file_pal.lo libmod_map_la-file_fpg.lo \ + libmod_map_la-file_fnt.lo libmod_map_la-mod_map.lo +libmod_map_la_OBJECTS = $(am_libmod_map_la_OBJECTS) +libmod_map_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmod_map_la_CFLAGS) \ + $(CFLAGS) $(libmod_map_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libmod_map_la_SOURCES) +DIST_SOURCES = $(libmod_map_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run aclocal-1.12 +AMTAR = $${TAR-tar} +AR = /opt/miyoo/usr/bin/arm-linux-ar +AS = as +AUTOCONF = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run autoconf +AUTOHEADER = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run autoheader +AUTOMAKE = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run automake-1.12 +AWK = mawk +BGD_PATH = /home/steward/Github/miyoo_src/bennugd/modules/../core +CC = /opt/miyoo/usr/bin/arm-linux-gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -O2 -finline-functions -fno-strict-aliasing -Wall -DTARGET_LINUX -DUSE_LIBDES -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b +COMMON_CFLAGS = -Wall -DTARGET_LINUX -DUSE_LIBDES -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b +COMMON_LDFLAGS = -lc -ldl -D_REENTRANT -L/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b -ldes +CPP = /opt/miyoo/usr/bin/arm-linux-gcc -E +CPPFLAGS = +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"bennu\" -DPACKAGE_TARNAME=\"bennu\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"bennu\ 1.0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"bennu\" -DVERSION=\"1.0.0\" -DHAVE_LIBM=1 +DEPDIR = .deps +DESLIBS = +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +FGREP = /bin/grep -F +GREP = /bin/grep +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /opt/miyoo/usr/bin/arm-linux-ld +LDFLAGS = -D_REENTRANT +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run makeinfo +MANIFEST_TOOL = : +MKDIR_P = /bin/mkdir -p +NM = /opt/miyoo/bin//arm-linux-nm -B +NMEDIT = +OBJDUMP = arm-linux-objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = bennu +PACKAGE_BUGREPORT = +PACKAGE_NAME = bennu +PACKAGE_STRING = bennu 1.0.0 +PACKAGE_TARNAME = bennu +PACKAGE_URL = +PACKAGE_VERSION = 1.0.0 +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +PKG_CONFIG_LIBDIR = /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig +PKG_CONFIG_PATH = /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig +PNGLIBS = +PNG_CFLAGS = -I/usr/include/libpng16 +PNG_LIBS = -lpng16 -lz +RANLIB = /opt/miyoo/usr/bin/arm-linux-ranlib +SDL_CFLAGS = -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT +SDL_LIBS = -lSDL -lpthread +SDL_mixer_CFLAGS = -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT +SDL_mixer_LIBS = -lSDL_mixer -lSDL -lpthread +SED = /bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = /opt/miyoo/usr/bin/arm-linux-strip +VERSION = 1.0.0 +WINDRES = +X11LIBS = -lX11 +ZLIBS = +ZLIB_CFLAGS = +ZLIB_LIBS = -lz +abs_builddir = /home/steward/Github/miyoo_src/bennugd/modules/mod_map +abs_srcdir = /home/steward/Github/miyoo_src/bennugd/modules/mod_map +abs_top_builddir = /home/steward/Github/miyoo_src/bennugd/modules +abs_top_srcdir = /home/steward/Github/miyoo_src/bennugd/modules +ac_ct_AR = +ac_ct_CC = +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-none +build_alias = x86_64 +build_cpu = x86_64 +build_os = none +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = arm-unknown-linux-gnu +host_alias = arm-linux +host_cpu = arm +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /opt/miyoo/usr +program_transform_name = s&^&arm-linux-& +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target = arm-unknown-linux-gnu +target_alias = arm-linux +target_cpu = arm +target_os = linux-gnu +target_vendor = unknown +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +lib_LTLIBRARIES = libmod_map.la +libmod_map_la_SOURCES = file_pcx.c file_png.c file_map.c file_pal.c file_fpg.c file_fnt.c mod_map.c +libmod_map_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libbgload/ -I../librender/ -I../libfont/ -I../libblit/ -I../libvideo/ -I../libgrbase/ +libmod_map_la_LDFLAGS = -s -module -no-undefined -avoid-version +libmod_map_la_LIBADD = $(COMMON_LDFLAGS) $(PNGLIBS) $(SDL_LIBS) -L../libbgload/.libs -lbgload -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../librender/.libs -lrender -L../libfont/.libs -lfont -L../libblit/.libs -lblit -L../libvideo/.libs -lvideo -L../libgrbase/.libs -lgrbase -lpng +CLEANFILES = libmod_map.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mod_map/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu mod_map/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libmod_map.la: $(libmod_map_la_OBJECTS) $(libmod_map_la_DEPENDENCIES) $(EXTRA_libmod_map_la_DEPENDENCIES) + $(libmod_map_la_LINK) -rpath $(libdir) $(libmod_map_la_OBJECTS) $(libmod_map_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/libmod_map_la-file_fnt.Plo +include ./$(DEPDIR)/libmod_map_la-file_fpg.Plo +include ./$(DEPDIR)/libmod_map_la-file_map.Plo +include ./$(DEPDIR)/libmod_map_la-file_pal.Plo +include ./$(DEPDIR)/libmod_map_la-file_pcx.Plo +include ./$(DEPDIR)/libmod_map_la-file_png.Plo +include ./$(DEPDIR)/libmod_map_la-mod_map.Plo + +.c.o: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +libmod_map_la-file_pcx.lo: file_pcx.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_pcx.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_pcx.Tpo -c -o libmod_map_la-file_pcx.lo `test -f 'file_pcx.c' || echo '$(srcdir)/'`file_pcx.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_pcx.Tpo $(DEPDIR)/libmod_map_la-file_pcx.Plo +# source='file_pcx.c' object='libmod_map_la-file_pcx.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_pcx.lo `test -f 'file_pcx.c' || echo '$(srcdir)/'`file_pcx.c + +libmod_map_la-file_png.lo: file_png.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_png.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_png.Tpo -c -o libmod_map_la-file_png.lo `test -f 'file_png.c' || echo '$(srcdir)/'`file_png.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_png.Tpo $(DEPDIR)/libmod_map_la-file_png.Plo +# source='file_png.c' object='libmod_map_la-file_png.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_png.lo `test -f 'file_png.c' || echo '$(srcdir)/'`file_png.c + +libmod_map_la-file_map.lo: file_map.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_map.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_map.Tpo -c -o libmod_map_la-file_map.lo `test -f 'file_map.c' || echo '$(srcdir)/'`file_map.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_map.Tpo $(DEPDIR)/libmod_map_la-file_map.Plo +# source='file_map.c' object='libmod_map_la-file_map.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_map.lo `test -f 'file_map.c' || echo '$(srcdir)/'`file_map.c + +libmod_map_la-file_pal.lo: file_pal.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_pal.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_pal.Tpo -c -o libmod_map_la-file_pal.lo `test -f 'file_pal.c' || echo '$(srcdir)/'`file_pal.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_pal.Tpo $(DEPDIR)/libmod_map_la-file_pal.Plo +# source='file_pal.c' object='libmod_map_la-file_pal.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_pal.lo `test -f 'file_pal.c' || echo '$(srcdir)/'`file_pal.c + +libmod_map_la-file_fpg.lo: file_fpg.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_fpg.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_fpg.Tpo -c -o libmod_map_la-file_fpg.lo `test -f 'file_fpg.c' || echo '$(srcdir)/'`file_fpg.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_fpg.Tpo $(DEPDIR)/libmod_map_la-file_fpg.Plo +# source='file_fpg.c' object='libmod_map_la-file_fpg.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_fpg.lo `test -f 'file_fpg.c' || echo '$(srcdir)/'`file_fpg.c + +libmod_map_la-file_fnt.lo: file_fnt.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_fnt.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_fnt.Tpo -c -o libmod_map_la-file_fnt.lo `test -f 'file_fnt.c' || echo '$(srcdir)/'`file_fnt.c + $(am__mv) $(DEPDIR)/libmod_map_la-file_fnt.Tpo $(DEPDIR)/libmod_map_la-file_fnt.Plo +# source='file_fnt.c' object='libmod_map_la-file_fnt.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_fnt.lo `test -f 'file_fnt.c' || echo '$(srcdir)/'`file_fnt.c + +libmod_map_la-mod_map.lo: mod_map.c + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-mod_map.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-mod_map.Tpo -c -o libmod_map_la-mod_map.lo `test -f 'mod_map.c' || echo '$(srcdir)/'`mod_map.c + $(am__mv) $(DEPDIR)/libmod_map_la-mod_map.Tpo $(DEPDIR)/libmod_map_la-mod_map.Plo +# source='mod_map.c' object='libmod_map_la-mod_map.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-mod_map.lo `test -f 'mod_map.c' || echo '$(srcdir)/'`mod_map.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/modules/mod_map/Makefile.am b/modules/mod_map/Makefile.am new file mode 100644 index 0000000..a6874bb --- /dev/null +++ b/modules/mod_map/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +#AUTOMAKE_OPTIONS = no-dependencies foreign + +lib_LTLIBRARIES = libmod_map.la + +libmod_map_la_SOURCES = file_pcx.c file_png.c file_map.c file_pal.c file_fpg.c file_fnt.c mod_map.c +libmod_map_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libbgload/ -I../librender/ -I../libfont/ -I../libblit/ -I../libvideo/ -I../libgrbase/ +libmod_map_la_LDFLAGS = -s -module -no-undefined -avoid-version +libmod_map_la_LIBADD = $(COMMON_LDFLAGS) $(PNGLIBS) $(SDL_LIBS) -L../libbgload/.libs -lbgload -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../librender/.libs -lrender -L../libfont/.libs -lfont -L../libblit/.libs -lblit -L../libvideo/.libs -lvideo -L../libgrbase/.libs -lgrbase -lpng + +## Make sure these will be cleaned even when they're not built by +## default. +CLEANFILES = libmod_map.la diff --git a/modules/mod_map/Makefile.in b/modules/mod_map/Makefile.in new file mode 100644 index 0000000..5bccf23 --- /dev/null +++ b/modules/mod_map/Makefile.in @@ -0,0 +1,661 @@ +# Makefile.in generated by automake 1.12.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +#AUTOMAKE_OPTIONS = no-dependencies foreign + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = mod_map +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libmod_map_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libmod_map_la_OBJECTS = libmod_map_la-file_pcx.lo \ + libmod_map_la-file_png.lo libmod_map_la-file_map.lo \ + libmod_map_la-file_pal.lo libmod_map_la-file_fpg.lo \ + libmod_map_la-file_fnt.lo libmod_map_la-mod_map.lo +libmod_map_la_OBJECTS = $(am_libmod_map_la_OBJECTS) +libmod_map_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmod_map_la_CFLAGS) \ + $(CFLAGS) $(libmod_map_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libmod_map_la_SOURCES) +DIST_SOURCES = $(libmod_map_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BGD_PATH = @BGD_PATH@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LDFLAGS = @COMMON_LDFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESLIBS = @DESLIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNGLIBS = @PNGLIBS@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SDL_mixer_CFLAGS = @SDL_mixer_CFLAGS@ +SDL_mixer_LIBS = @SDL_mixer_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINDRES = @WINDRES@ +X11LIBS = @X11LIBS@ +ZLIBS = @ZLIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LTLIBRARIES = libmod_map.la +libmod_map_la_SOURCES = file_pcx.c file_png.c file_map.c file_pal.c file_fpg.c file_fnt.c mod_map.c +libmod_map_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libbgload/ -I../librender/ -I../libfont/ -I../libblit/ -I../libvideo/ -I../libgrbase/ +libmod_map_la_LDFLAGS = -s -module -no-undefined -avoid-version +libmod_map_la_LIBADD = $(COMMON_LDFLAGS) $(PNGLIBS) $(SDL_LIBS) -L../libbgload/.libs -lbgload -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../librender/.libs -lrender -L../libfont/.libs -lfont -L../libblit/.libs -lblit -L../libvideo/.libs -lvideo -L../libgrbase/.libs -lgrbase -lpng +CLEANFILES = libmod_map.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mod_map/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu mod_map/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libmod_map.la: $(libmod_map_la_OBJECTS) $(libmod_map_la_DEPENDENCIES) $(EXTRA_libmod_map_la_DEPENDENCIES) + $(libmod_map_la_LINK) -rpath $(libdir) $(libmod_map_la_OBJECTS) $(libmod_map_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_fnt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_fpg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_pal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_pcx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-file_png.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_map_la-mod_map.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libmod_map_la-file_pcx.lo: file_pcx.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_pcx.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_pcx.Tpo -c -o libmod_map_la-file_pcx.lo `test -f 'file_pcx.c' || echo '$(srcdir)/'`file_pcx.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_pcx.Tpo $(DEPDIR)/libmod_map_la-file_pcx.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_pcx.c' object='libmod_map_la-file_pcx.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_pcx.lo `test -f 'file_pcx.c' || echo '$(srcdir)/'`file_pcx.c + +libmod_map_la-file_png.lo: file_png.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_png.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_png.Tpo -c -o libmod_map_la-file_png.lo `test -f 'file_png.c' || echo '$(srcdir)/'`file_png.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_png.Tpo $(DEPDIR)/libmod_map_la-file_png.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_png.c' object='libmod_map_la-file_png.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_png.lo `test -f 'file_png.c' || echo '$(srcdir)/'`file_png.c + +libmod_map_la-file_map.lo: file_map.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_map.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_map.Tpo -c -o libmod_map_la-file_map.lo `test -f 'file_map.c' || echo '$(srcdir)/'`file_map.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_map.Tpo $(DEPDIR)/libmod_map_la-file_map.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_map.c' object='libmod_map_la-file_map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_map.lo `test -f 'file_map.c' || echo '$(srcdir)/'`file_map.c + +libmod_map_la-file_pal.lo: file_pal.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_pal.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_pal.Tpo -c -o libmod_map_la-file_pal.lo `test -f 'file_pal.c' || echo '$(srcdir)/'`file_pal.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_pal.Tpo $(DEPDIR)/libmod_map_la-file_pal.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_pal.c' object='libmod_map_la-file_pal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_pal.lo `test -f 'file_pal.c' || echo '$(srcdir)/'`file_pal.c + +libmod_map_la-file_fpg.lo: file_fpg.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_fpg.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_fpg.Tpo -c -o libmod_map_la-file_fpg.lo `test -f 'file_fpg.c' || echo '$(srcdir)/'`file_fpg.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_fpg.Tpo $(DEPDIR)/libmod_map_la-file_fpg.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_fpg.c' object='libmod_map_la-file_fpg.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_fpg.lo `test -f 'file_fpg.c' || echo '$(srcdir)/'`file_fpg.c + +libmod_map_la-file_fnt.lo: file_fnt.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-file_fnt.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-file_fnt.Tpo -c -o libmod_map_la-file_fnt.lo `test -f 'file_fnt.c' || echo '$(srcdir)/'`file_fnt.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-file_fnt.Tpo $(DEPDIR)/libmod_map_la-file_fnt.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_fnt.c' object='libmod_map_la-file_fnt.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-file_fnt.lo `test -f 'file_fnt.c' || echo '$(srcdir)/'`file_fnt.c + +libmod_map_la-mod_map.lo: mod_map.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -MT libmod_map_la-mod_map.lo -MD -MP -MF $(DEPDIR)/libmod_map_la-mod_map.Tpo -c -o libmod_map_la-mod_map.lo `test -f 'mod_map.c' || echo '$(srcdir)/'`mod_map.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmod_map_la-mod_map.Tpo $(DEPDIR)/libmod_map_la-mod_map.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mod_map.c' object='libmod_map_la-mod_map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_map_la_CFLAGS) $(CFLAGS) -c -o libmod_map_la-mod_map.lo `test -f 'mod_map.c' || echo '$(srcdir)/'`mod_map.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/modules/mod_map/file_fnt.c b/modules/mod_map/file_fnt.c new file mode 100644 index 0000000..6263404 --- /dev/null +++ b/modules/mod_map/file_fnt.c @@ -0,0 +1,601 @@ +/* + * Copyright � 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright � 2002-2006 Fenix Team (Fenix) + * Copyright � 1999-2002 Jos� Luis Cebri�n Pag�e (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include "libfont.h" +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +typedef struct _chardata +{ + int width; + int height; + int xadvance; + int yadvance; + int xoffset; + int yoffset; + int fileoffset ; +} +_chardata ; + +static int gr_font_loadfrom( file * fp ); + +/* --------------------------------------------------------------------------- */ +/* + * FUNCTION : gr_font_load + * + * Load a font from a given file, in FNT (DIV) format + * + * PARAMS : + * filename Name of the file + * + * RETURN VALUE : + * ID of the new font, or -1 if error + * + */ + +int gr_font_load( char * filename ) +{ + file * fp ; + int result; + + if ( !filename ) return -1; + + fp = file_open( filename, "rb" ) ; + if ( !fp ) return -1 ; + + result = gr_font_loadfrom( fp ); + + file_close( fp ); + + return result; +} + +/* --------------------------------------------------------------------------- */ + +static int gr_font_loadfrom( file * fp ) +{ + char header[8]; + int bpp; + int types, i, id; + uint32_t y; + FONT * f; + PALETTE * pal = NULL; + + struct + { + int width ; + int height ; + int yoffset ; + int fileoffset ; + } + oldchardata[256]; + + _chardata chardata[256] ; + + if ( font_count == MAX_FONTS ) return -1 ; + + /* Read the file header */ + + if ( file_read( fp, header, sizeof( header ) ) != sizeof( header ) ) return -1; + + if ( + memcmp( header, FNT_MAGIC, 7 ) != 0 && + memcmp( header, FNX_MAGIC, 7 ) != 0 ) + { + return -1; + } + + bpp = header[7]; + if ( bpp == 0 ) bpp = 8; + + /* Read or ignore the palette */ + + if ( bpp == 8 && !( pal = gr_read_pal_with_gamma( fp ) ) ) return -1 ; + + /* Read the character data (detect old format) */ + + if ( header[2] == 'x' ) + { + if ( !file_readSint32( fp, &types ) ) + { + pal_destroy( pal ); + return -1 ; + } + if ( file_read( fp, chardata, sizeof( chardata ) ) != sizeof( chardata ) ) + { + pal_destroy( pal ); + return -1 ; + } + for ( i = 0 ; i < 256 ; i++ ) + { + ARRANGE_DWORD( &chardata[i].width ); + ARRANGE_DWORD( &chardata[i].height ); + ARRANGE_DWORD( &chardata[i].xadvance ); + ARRANGE_DWORD( &chardata[i].yadvance ); + ARRANGE_DWORD( &chardata[i].xoffset ); + ARRANGE_DWORD( &chardata[i].yoffset ); + ARRANGE_DWORD( &chardata[i].fileoffset ); + } + } + else + { + if ( !file_readSint32( fp, &types ) ) + { + pal_destroy( pal ); + return -1 ; + } + if ( file_read( fp, oldchardata, sizeof( oldchardata ) ) != sizeof( oldchardata ) ) + { + pal_destroy( pal ); + return -1 ; + } + for ( i = 0 ; i < 256 ; i++ ) + { + ARRANGE_DWORD( &oldchardata[i].width ); + ARRANGE_DWORD( &oldchardata[i].height ); + ARRANGE_DWORD( &oldchardata[i].yoffset ); + ARRANGE_DWORD( &oldchardata[i].fileoffset ); + + chardata[i].width = oldchardata[i].width; + chardata[i].height = oldchardata[i].height; + chardata[i].xoffset = 0; + chardata[i].yoffset = oldchardata[i].yoffset; + chardata[i].xadvance = oldchardata[i].width; + chardata[i].yadvance = oldchardata[i].height + oldchardata[i].yoffset; + chardata[i].fileoffset = oldchardata[i].fileoffset; + } + } + + /* Create the font */ + + if ( header[2] == 'x' ) + id = gr_font_new( types, header[7] ) ; + else + id = gr_font_new( CHARSET_CP850, 8 ) ; + + if ( id == -1 ) + { + pal_destroy( pal ); + return -1 ; + } + + f = fonts[id]; + if ( !f ) + { + gr_font_destroy( id ); + pal_destroy( pal ); + return -1 ; + } + + /* Load the character bitmaps */ + + for ( i = 0 ; i < 256 ; i++ ) + { + GRAPH * gr; + uint8_t * ptr; + + f->glyph[i].xadvance = chardata[i].xadvance ; + f->glyph[i].yadvance = chardata[i].yadvance ; + + if ( chardata[i].fileoffset == 0 || chardata[i].width == 0 || chardata[i].height == 0 ) continue ; + + f->glyph[i].xoffset = chardata[i].xoffset ; + f->glyph[i].yoffset = chardata[i].yoffset ; + + file_seek( fp, chardata[i].fileoffset, SEEK_SET ) ; + f->glyph[i].bitmap = gr = bitmap_new( i, chardata[i].width, chardata[i].height, f->bpp ) ; + if ( !gr ) + { + gr_font_destroy( id ); + pal_destroy( pal ); + return -1 ; + } + bitmap_add_cpoint( gr, 0, 0 ) ; + gr->format->palette = pal; + pal_use( pal ); + + for ( y = 0, ptr = gr->data; y < gr->height; y++, ptr += gr->pitch ) + { + if ( file_read( fp, ptr, gr->widthb ) != gr->widthb ) break ; + + if ( gr->format->depth == 16 ) + { + ARRANGE_WORDS( ptr, ( int )gr->width ); + } + else if ( gr->format->depth == 32 ) + { + ARRANGE_DWORDS( ptr, ( int )gr->width ); + } + } + + f->glyph[i].yoffset = chardata[i].yoffset ; + } + if ( f->glyph[32].xadvance == 0 ) f->glyph[32].xadvance = f->glyph['j'].xadvance ; + + pal_destroy( pal ); // Elimino la instancia inicial + + return id ; +} + +/* --------------------------------------------------------------------------- */ +/* + * FUNCTION : gr_font_save + * + * Write a font to disk, in FNT/FNX format + * + * PARAMS : + * fontid ID of the font to save + * filename Name of the file to create + * + * RETURN VALUE : + * 1 if succeded or 0 otherwise + * + */ + +int gr_font_save( int fontid, const char * filename ) +{ + if ( !filename ) return 0; + + file * file; + int n; + uint32_t y; + long offset; + uint8_t * block = NULL ; + uint8_t * lineptr; + + FONT * font; + uint8_t header[8]; + _chardata chardata[256] ; + int palette_saved = 0; + + if ( fontid < 0 || fontid > MAX_FONTS || !fonts[fontid] ) return 0; + + font = fonts[fontid]; + + /* Open the file */ + + file = file_open( filename, "wb0" ); + if ( !file ) return 0; + + /* Write the header */ + + strcpy( ( char * ) header, FNX_MAGIC ); + header[7] = font->bpp; + file_write( file, &header, 8 ); + + /* Write the character information */ + + memset( chardata, 0, sizeof( chardata ) ); + offset = 8 + 4 + (( font->bpp == 8 ) ? 576 + 768 : 0 ) + sizeof( chardata ); + + for ( n = 0 ; n < 256 ; n++ ) + { + chardata[n].xadvance = font->glyph[n].xadvance; + chardata[n].yadvance = font->glyph[n].yadvance; + + if ( font->glyph[n].bitmap ) + { + /* Write the palette */ + if ( !palette_saved && font->bpp == 8 ) + { + uint8_t colors[256][3]; + uint8_t * block = calloc( 576, 1 ) ; + rgb_component * gpal = NULL; + int k; + + if ( font->glyph[n].bitmap->format->palette ) + gpal = font->glyph[n].bitmap->format->palette->rgb; + else if ( sys_pixel_format->palette ) + gpal = sys_pixel_format->palette->rgb; + else + gpal = ( rgb_component * ) default_palette; + + /* Generate palette info */ + for ( k = 0 ; k < 256 ; k++ ) + { + colors[k][0] = gpal[k].r >> 2 ; + colors[k][1] = gpal[k].g >> 2 ; + colors[k][2] = gpal[k].b >> 2 ; + } + + file_write( file, &colors, sizeof(colors) ) ; + file_write( file, block, 576 ) ; + free( block ) ; + palette_saved = 1; + } + + chardata[n].width = font->glyph[n].bitmap->width; + chardata[n].height = font->glyph[n].bitmap->height; + chardata[n].xadvance = font->glyph[n].xadvance; + chardata[n].yadvance = font->glyph[n].yadvance; + chardata[n].xoffset = font->glyph[n].xoffset; + chardata[n].yoffset = font->glyph[n].yoffset; + chardata[n].fileoffset = offset; + + offset += font->glyph[n].bitmap->widthb * chardata[n].height; + } + + ARRANGE_DWORD( &chardata[n].xadvance ); + ARRANGE_DWORD( &chardata[n].yadvance ); + ARRANGE_DWORD( &chardata[n].width ); + ARRANGE_DWORD( &chardata[n].width ); + ARRANGE_DWORD( &chardata[n].xoffset ); + ARRANGE_DWORD( &chardata[n].yoffset ); + ARRANGE_DWORD( &chardata[n].fileoffset ); + } + + file_writeSint32( file, &font->charset ); + + file_write( file, &chardata, sizeof( chardata ) ); + + /* Write the character bitmaps */ + + for ( n = 0 ; n < 256 ; n++ ) + { + if ( font->glyph[n].bitmap ) + { + GRAPH * gr = font->glyph[n].bitmap; + + if ( gr->format->depth != font->bpp ) + { + file_close( file ); + return 0; + } + + if ( gr->format->depth > 8 ) + { + if (( block = malloc( gr->widthb ) ) == NULL ) + { + file_close( file ); + return 0; + } + } + + lineptr = gr->data; + + for ( y = 0 ; y < gr->height ; y++, lineptr += gr->pitch ) + { + if ( gr->format->depth > 8 ) + { + memcpy( block, lineptr, gr->widthb ); + if ( gr->format->depth == 16 ) + { + ARRANGE_WORDS( block, ( int )gr->width ); +/* gr_convert16_ScreenTo565(( uint16_t * )block, gr->width ); */ + file_write( file, block, gr->widthb ); + } + else if ( gr->format->depth == 32 ) + { + file_writeUint32A( file, ( uint32_t * ) block, gr->width ); + } + } + else + { + file_write( file, lineptr, gr->widthb ); + } + } + + if ( gr->format->depth > 8 ) free( block ); + } + } + + file_close( file ); + + return 1; +} + +/* --------------------------------------------------------------------------- */ +/* + * FUNCTION : gr_load_bdf + * + * Load a BDF font from disk. This is a very simple loader that ignores + * anything that is not relevant to screen display or non-horizontal + * writing fonts. + * + * PARAMS : + * filename Name of the BDF file + * + * RETURN VALUE : + * ID of the font if succeded or -1 otherwise + * + */ + +int gr_load_bdf( const char * filename ) +{ + if ( !filename ) return -1; + + file * fp; + char line[2048]; + uint8_t * ptr, * optr; + FONT * font; + int id, x, y, i; + int error = 0; + + uint8_t nibbleh[256]; + uint8_t nibblel[256]; + + int default_xadvance = 0; + int default_yadvance = 0; + int in_char = 0; + int encoding = -1; + int width = 0; + int height = 0; + int xoffset = 0; + int yoffset = 0; + int xadvance = 0; + int yadvance = 0; + int minyoffset = 0; + int len; + + /* Arrays used to convert hex ASCII to binary */ + + memset( nibbleh, 0, sizeof( nibbleh ) ); + memset( nibblel, 0, sizeof( nibblel ) ); + + for ( i = '0' ; i <= '9' ; i++ ) + { + nibbleh[i] = (( i - '0' ) << 4 ); + nibblel[i] = i - '0'; + } + for ( i = 10 ; i <= 15 ; i++ ) + { + nibbleh['A' + i - 10] = ( i << 4 ); + nibbleh['a' + i - 10] = ( i << 4 ); + nibblel['A' + i - 10] = i; + nibblel['a' + i - 10] = i; + } + + /* Open the file and create the font */ + + fp = file_open( filename, "r" ); + if ( !fp ) return -1; + + id = gr_font_new( CHARSET_ISO8859, 1 ); + if ( id < 0 ) return -1; + font = fonts[id]; + font->maxwidth = 0; + font->maxheight = 0; + + /* Process the file, a line each time */ + + for ( line[2047] = 0 ; ; ) + { + if ( !( len = file_gets( fp, line, 2047 ) ) ) break; + if ( line[len-1] == '\n' ) line[len-1] = '\0'; + + /* Handle global-level commands */ + + if ( strncmp( line, "DWIDTH ", 7 ) == 0 && !in_char ) + { + default_xadvance = atoi( line + 7 ); + ptr = ( uint8_t * ) strchr( line + 7, ' ' ); + if ( ptr ) default_yadvance = atoi( ( char * ) ptr + 1 ); + } + else if ( strncmp( line, "STARTCHAR", 9 ) == 0 ) + { + in_char = 1; + encoding = -1; + height = 0; + xadvance = default_xadvance; + yadvance = default_yadvance; + } + else if ( strncmp( line, "ENDCHAR", 7 ) == 0 ) + { + in_char = 0; + } + + /* Handle character-level commands */ + + else if ( strncmp( line, "DWIDTH ", 7 ) == 0 && in_char ) + { + xadvance = atoi( line + 7 ); + ptr = ( uint8_t * ) strchr( line + 7, ' ' ); + if ( ptr ) yadvance = atoi( ( char * ) ptr + 1 ); + } + else if ( strncmp( line, "ENCODING ", 9 ) == 0 && in_char ) + { + encoding = atoi( line + 9 ); + if ( encoding == -1 ) + { + ptr = ( uint8_t * ) strchr( line + 7, ' ' ); + if ( ptr ) encoding = atoi( ( char * ) ptr + 1 ); + } + } + else if ( strncmp( line, "BBX ", 4 ) == 0 && in_char ) + { + width = atoi( ( char * ) line + 4 ); + if ( width & 7 ) width = ( width & ~7 ) + 8; + if (( ptr = ( uint8_t * ) strchr( ( char * ) line + 4, ' ' ) ) == NULL ) continue; + height = atoi( ( char * ) ptr + 1 ); + if (( ptr = ( uint8_t * ) strchr( ( char * ) ptr + 1, ' ' ) ) == NULL ) continue; + xoffset = atoi( ( char * ) ptr + 1 ); + if (( ptr = ( uint8_t * ) strchr( ( char * ) ptr + 1, ' ' ) ) == NULL ) continue; + yoffset = atoi( ( char * ) ptr + 1 ); + } + else if ( strncmp( line, "BITMAP", 6 ) == 0 ) + { + /* Read bitmap data */ + if ( encoding >= 0 && encoding < 256 && height > 0 ) + { + font->glyph[encoding].xadvance = xadvance; + font->glyph[encoding].yadvance = yadvance; + font->glyph[encoding].xoffset = xoffset; + font->glyph[encoding].yoffset = -yoffset - height; + + if ( minyoffset > -yoffset - height ) minyoffset = -yoffset - height; + + error = 1; + font->glyph[encoding].bitmap = bitmap_new( encoding, width, height, 1 ); + if ( font->glyph[encoding].bitmap == 0 ) break; + bitmap_add_cpoint( font->glyph[encoding].bitmap, 0, 0 ) ; + + if ( font->maxwidth < width ) font->maxwidth = width; + if ( font->maxheight < height ) font->maxheight = height; + + for ( y = 0 ; y < height ; y++ ) + { + if ( !( len = file_gets( fp, line, 2047 ) ) ) break; + if ( line[len-1] == '\n' ) line[len-1] = '\0'; + ptr = ( uint8_t * ) line; + optr = ( uint8_t * ) font->glyph[encoding].bitmap->data + font->glyph[encoding].bitmap->pitch * y; + + for ( x = 0 ; x < width ; x += 8 ) + { + if ( !ptr[0] || !ptr[1] ) break; + *optr++ = nibbleh[ptr[0]] | nibblel[ptr[1]]; + ptr += 2; + } + } + if ( y != height ) break; + error = 0; + } + } + } + + file_close( fp ); + + if ( error ) + { + gr_font_destroy( id ); + return -1; + } + + /* Adjust yoffsets to positive */ + + for ( i = 0 ; i < 256 ; i++ ) font->glyph[i].yoffset -= minyoffset; + + if ( font->glyph[32].xadvance == 0 ) font->glyph[32].xadvance = font->glyph['j'].xadvance; + +// fonts[font_count] = font ; + return id /* font_count++ */ ; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/file_fpg.c b/modules/mod_map/file_fpg.c new file mode 100644 index 0000000..1115b18 --- /dev/null +++ b/modules/mod_map/file_fpg.c @@ -0,0 +1,349 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +struct +{ + int code ; + int regsize ; + char name[32] ; + char fpname[12] ; + int width ; + int height ; + int flags ; +} chunk ; + +/* --------------------------------------------------------------------------- */ + +/* Static convenience function */ +static int gr_read_lib( file * fp ) +{ + char header[8] ; + short int px, py ; + int bpp, libid, code; + uint32_t y ; + unsigned c; + GRLIB * lib ; + GRAPH * gr ; + PALETTE * pal = NULL ; + int st = 0; + + libid = grlib_new() ; + if ( libid < 0 ) return -1 ; + + lib = grlib_get( libid ); + if ( !lib ) { + grlib_destroy( libid ) ; + return -1 ; + } + + if ( file_read( fp, header, sizeof( header ) ) != sizeof( header ) ) { + grlib_destroy( libid ) ; + return -1 ; + } + + if ( strcmp( header, F32_MAGIC ) == 0 ) bpp = 32 ; + else if ( strcmp( header, F16_MAGIC ) == 0 ) bpp = 16 ; + else if ( strcmp( header, FPG_MAGIC ) == 0 ) bpp = 8 ; + else if ( strcmp( header, F01_MAGIC ) == 0 ) bpp = 1 ; + else { + grlib_destroy( libid ) ; + return -1 ; + } + + if ( bpp == 8 && !( pal = gr_read_pal_with_gamma( fp ) ) ) { + grlib_destroy( libid ) ; + return -1 ; + } + + while ( !file_eof( fp ) ) { + if ( file_read( fp, &chunk, sizeof( chunk ) ) != sizeof( chunk ) ) break ; + + ARRANGE_DWORD( &chunk.code ) ; + if ( chunk.code < 0 || chunk.code > 999 ) break; + ARRANGE_DWORD( &chunk.regsize ) ; + ARRANGE_DWORD( &chunk.width ) ; + ARRANGE_DWORD( &chunk.height ) ; + ARRANGE_DWORD( &chunk.flags ) ; + + /* Cabecera del gráfico */ + + gr = bitmap_new( chunk.code, chunk.width, chunk.height, bpp ) ; + if ( !gr ) + { + grlib_destroy( libid ) ; + if ( bpp == 8 ) pal_destroy( pal ) ; // Elimino la instancia inicial + return -1 ; + } + memcpy( gr->name, chunk.name, sizeof( chunk.name ) ) ; + gr->name[31] = 0 ; + gr->ncpoints = chunk.flags ; + gr->modified = 2 ; + // bitmap_analize( gr ); + + /* Puntos de control */ + + if ( gr->ncpoints ) { + gr->cpoints = ( CPOINT * ) malloc( gr->ncpoints * sizeof( CPOINT ) ) ; + if ( !gr->cpoints ) { + bitmap_destroy( gr ) ; + grlib_destroy( libid ) ; + if ( bpp == 8 ) pal_destroy( pal ) ; + return -1 ; + } + for ( c = 0 ; c < gr->ncpoints ; c++ ) { + file_readSint16( fp, &px ) ; + file_readSint16( fp, &py ) ; + if ( px == -1 && py == -1 ) { + gr->cpoints[c].x = CPOINT_UNDEFINED ; + gr->cpoints[c].y = CPOINT_UNDEFINED ; + } else { + gr->cpoints[c].x = px ; + gr->cpoints[c].y = py ; + } + } + } else + gr->cpoints = 0 ; + + /* Datos del gráfico */ + + for ( y = 0 ; y < gr->height ; y++ ) { + uint8_t * line = ( uint8_t * )gr->data + gr->pitch * y; + + switch ( bpp ) { + case 32: + st = file_readUint32A( fp, ( uint32_t * ) line, gr->width ); + break; + + case 16: + st = file_readUint16A( fp, ( uint16_t * ) line, gr->width ); + break; + + case 8: + case 1: + if ( ( st = file_read( fp, line, gr->widthb ) ) != gr->widthb ) st = 0; + break; + } + + if ( !st ) { + bitmap_destroy( gr ); + grlib_destroy( libid ) ; + if ( bpp == 8 ) pal_destroy( pal ); + return -1 ; + } + } + + code = grlib_add_map( libid, gr ) ; + if ( bpp == 8 ) pal_map_assign( libid, code, pal ) ; + } + + if ( bpp == 8 ) pal_destroy( pal ) ; // Elimino la instancia inicial + + return libid ; +} + +/* --------------------------------------------------------------------------- */ +/* + * FUNCTION : gr_load_fpg + * + * Load a FPG file + * + * PARAMS : + * libname Name of the file + * + * RETURN VALUE : + * Internal ID of the library or -1 if invalid file + * + */ + +int gr_load_fpg( const char * libname ) +{ + int libid ; + file * fp = file_open( libname, "rb" ) ; + if ( !fp ) return -1 ; + libid = gr_read_lib( fp ) ; + file_close( fp ) ; + return libid ; +} + +/* --------------------------------------------------------------------------- */ + +/* + * FUNCTION : gr_save_fpg + * + * Save a FPG file + * + * PARAMS : + * filename Name of the file + * + * RETURN VALUE : + * 1 if succeded + * >= 0 error + * + */ + +int gr_save_fpg( int libid, const char * filename ) +{ + file * fp; + GRLIB * lib; + uint8_t * block = NULL; + int n, y, c; + int bpp; + int nmaps; + uint8_t header[8]; + rgb_component * palette = NULL; + + /* Get the library and open the file */ +/* + if ( !libid ) + lib = syslib ; + else +*/ + lib = grlib_get( libid ); + + if ( !lib ) return 0; + + /* Guess the FPG depth */ + + nmaps = lib->map_reserved < 1000 ? lib->map_reserved : 1000; + + for ( bpp = n = 0 ; n < nmaps ; n++ ) { + if ( lib->maps[n] ) { + if ( bpp && lib->maps[n]->format->depth != bpp ) return 0; /* save_fpg: don't allow save maps with differents bpp */ + bpp = lib->maps[n]->format->depth; + if ( !palette && bpp == 8 && lib->maps[n]->format->palette ) palette = lib->maps[n]->format->palette->rgb; + } + } + + if ( bpp == 32 ) strcpy( ( char * ) header, F32_MAGIC ); + else if ( bpp == 16 ) strcpy( ( char * ) header, F16_MAGIC ); + else if ( bpp == 8 ) strcpy( ( char * ) header, FPG_MAGIC ); + else if ( bpp == 1 ) strcpy( ( char * ) header, F01_MAGIC ); + else return 0; /* No maps for save */ + + /* Create fpg */ + + fp = file_open( filename, "wb" ); + if ( !fp ) return 0; + + /* Write the header */ + + header[7] = 0x00; /* Version */ + file_write( fp, header, sizeof( header ) ); + + /* Write the color palette */ + + if ( bpp == 8 ) { + uint8_t colors[256][3] ; + uint8_t gamma[576]; + + if ( !palette ) { + if ( sys_pixel_format->palette ) + palette = sys_pixel_format->palette->rgb; + else + palette = ( rgb_component * ) default_palette; + } + + for ( n = 0 ; n < 256 ; n++ ) { + colors[n][0] = palette[n].r >> 2 ; + colors[n][1] = palette[n].g >> 2 ; + colors[n][2] = palette[n].b >> 2 ; + } + + file_write( fp, &colors, 768 ) ; + memset( gamma, '\0', sizeof( gamma ) ); + file_write( fp, gamma, sizeof( gamma ) ) ; + } + + /* Write each map */ + + for ( n = 0 ; n < nmaps ; n++ ) { + GRAPH * gr = lib->maps[n]; + + if ( gr ) { + /* Write the bitmap header */ + + chunk.code = n; + chunk.regsize = 0; + chunk.width = gr->width; + chunk.height = gr->height; + chunk.flags = gr->ncpoints; + chunk.fpname[0] = 0; + strncpy( chunk.name, gr->name, sizeof( chunk.name ) ); + + ARRANGE_DWORD( &chunk.code ); + ARRANGE_DWORD( &chunk.regsize ); + ARRANGE_DWORD( &chunk.width ); + ARRANGE_DWORD( &chunk.height ); + ARRANGE_DWORD( &chunk.flags ); + + file_write( fp, &chunk, sizeof( chunk ) ); + + /* Write the control points */ + + for ( c = 0 ; c < gr->ncpoints ; c++ ) { + file_writeSint16( fp, &gr->cpoints[c].x ); + file_writeSint16( fp, &gr->cpoints[c].y ); + } + + /* Write the bitmap pixel data */ + + if ( bpp > 8 ) { + if ( !( block = malloc( gr->widthb ) ) ) { + file_close( fp ); + return 0; /* No memory */ + } + } + + for ( y = 0 ; y < gr->height ; y++ ) { + if ( bpp > 8 ) { + memcpy( block, ( uint8_t * )gr->data + gr->pitch*y, gr->widthb ); + if ( bpp == 16 ) { +/* gr_convert16_ScreenTo565(( uint16_t * )block, gr->width ); */ + file_writeUint16A( fp, ( uint16_t * ) block, gr->width ); + } else + file_writeUint32A( fp, ( uint32_t * ) block, gr->width ); + } else { + file_write( fp, ( uint8_t * )gr->data + gr->pitch*y, gr->widthb ); + } + } + + if ( bpp > 8 ) free( block ); + } + } + + file_close( fp ); + return 1; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/file_map.c b/modules/mod_map/file_map.c new file mode 100644 index 0000000..65e6597 --- /dev/null +++ b/modules/mod_map/file_map.c @@ -0,0 +1,261 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +static GRAPH * gr_read_map( file * fp ) +{ + char header[8] ; + unsigned short int w, h, c ; + uint32_t y ; + int bpp, code ; + GRAPH * gr ; + int st = 0; + PALETTE * pal = NULL; + + /* Carga los datos de cabecera */ + file_read( fp, header, 8 ) ; + + if ( strcmp( header, M32_MAGIC ) == 0 ) bpp = 32 ; + else if ( strcmp( header, M16_MAGIC ) == 0 ) bpp = 16 ; + else if ( strcmp( header, MAP_MAGIC ) == 0 ) bpp = 8 ; + else if ( strcmp( header, M01_MAGIC ) == 0 ) bpp = 1 ; + else return NULL ; + + file_readUint16( fp, &w ) ; + file_readUint16( fp, &h ) ; + file_readSint32( fp, &code ) ; + + gr = bitmap_new( code, w, h, bpp ) ; + if ( !gr ) return NULL ; + + file_read( fp, gr->name, 32 ) ; + gr->name[31] = 0 ; + + /* Datos de paleta */ + + if ( gr->format->depth == 8 ) + if ( !( pal = gr_read_pal_with_gamma( fp ) ) ) + { + bitmap_destroy( gr ); + return NULL ; + } + + /* Puntos de control */ + + file_readUint16( fp, &c ) ; + gr->ncpoints = c ; + + if ( gr->ncpoints ) + { + gr->cpoints = ( CPOINT * ) malloc( c * sizeof( CPOINT ) ) ; + if ( !gr->cpoints ) + { + bitmap_destroy( gr ); + pal_destroy( pal ); + return NULL ; + } + + for ( c = 0 ; c < gr->ncpoints ; c++ ) + { + file_readUint16( fp, &w ) ; + file_readUint16( fp, &h ) ; + if (( short int ) w == -1 && ( short int ) h == -1 ) + { + w = CPOINT_UNDEFINED; + h = CPOINT_UNDEFINED; + } + gr->cpoints[c].x = w ; + gr->cpoints[c].y = h ; + } + } + else + gr->cpoints = 0 ; + + /* Datos del gráfico */ + + for ( y = 0 ; y < gr->height ; y++ ) + { + uint8_t * line = ( uint8_t * )gr->data + gr->pitch * y; + + switch ( bpp ) + { + case 32: + st = file_readUint32A( fp, ( uint32_t * )line, gr->width ); + break; + + case 16: + st = file_readUint16A( fp, ( uint16_t * )line, gr->width ); + break; + + case 8: + case 1: + st = file_read( fp, line, gr->widthb ); + break; + } + + if ( !st ) + { + bitmap_destroy( gr ); + pal_destroy( pal ); + return NULL ; + } + } + + gr->format->palette = pal; +/* pal_use( pal ); */ + + gr->modified = 0 ; + bitmap_analize( gr ); + + return gr ; +} + +/* --------------------------------------------------------------------------- */ + +int gr_save_map( GRAPH * gr, char * filename ) +{ + int c, st = 0; + MAP_HEADER mh ; + uint8_t gamma[576]; + uint16_t cpoints; + + if ( !gr ) return 0; + + file * fp = file_open( filename, "wb" ); + if ( !fp ) return 0; + + switch ( gr->format->depth ) + { + case 8: + strcpy( ( char * ) mh.magic, MAP_MAGIC ); + break; + + case 32: + strcpy( ( char * ) mh.magic, M32_MAGIC ); + break; + + case 16: + strcpy( ( char * ) mh.magic, M16_MAGIC ); + break; + + case 1: + strcpy( ( char * ) mh.magic, M01_MAGIC ); + break; + } + + mh.version = 0x00; + mh.width = gr->width; + mh.height = gr->height; + mh.code = gr->code ; + strncpy( ( char * ) mh.name, gr->name, 32 ); + + file_write( fp, &mh, sizeof( MAP_HEADER ) ) ; + + if ( gr->format->depth == 8 ) + { + if ( gr->format->palette ) + { + file_write( fp, gr->format->palette->rgb, 768 ) ; + } + else if ( sys_pixel_format->palette ) + { + file_write( fp, sys_pixel_format->palette->rgb, 768 ) ; + } + else + { + file_write( fp, default_palette, 768 ) ; + } + memset( gamma, '\0', sizeof( gamma ) ); + file_write( fp, gamma, sizeof( gamma ) ) ; + } + + cpoints = gr->ncpoints; + file_writeUint16( fp, &cpoints ); + + for ( c = 0 ; c < gr->ncpoints ; c++ ) + { + file_writeUint16( fp, ( uint16_t * ) &gr->cpoints[c].x ) ; + file_writeUint16( fp, ( uint16_t * ) &gr->cpoints[c].y ) ; + } + + for ( c = 0 ; c < gr->height ; c++ ) + { + uint8_t * line = ( uint8_t * )gr->data + gr->pitch * c; + + switch ( gr->format->depth ) + { + case 32: + st = file_writeUint32A( fp, ( uint32_t * )line, gr->width ); + break; + + case 16: + st = file_writeUint16A( fp, ( uint16_t * )line, gr->width ); + break; + + case 8: + case 1: + st = file_write( fp, line, gr->widthb ); + break; + } + + if ( !st ) break; + } + + file_close( fp ) ; + + return 1; +} + +/* --------------------------------------------------------------------------- */ + +/* Funciones de carga de nivel superior */ + +int gr_load_map( const char * mapname ) +{ + GRAPH * gr ; + file * fp = file_open( mapname, "rb" ) ; + if ( !fp ) return 0 ; + + gr = gr_read_map( fp ) ; + file_close( fp ) ; + + if ( !gr ) return 0 ; + + // Don't matter the file code, we must force a new code... + gr->code = bitmap_next_code() ; + + grlib_add_map( 0, gr ) ; + return gr->code ; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/file_pal.c b/modules/mod_map/file_pal.c new file mode 100644 index 0000000..414a449 --- /dev/null +++ b/modules/mod_map/file_pal.c @@ -0,0 +1,208 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +PALETTE * gr_read_pal( file * fp ) +{ + PALETTE * pal; + int i; + uint8_t colors[256*3] ; + + if ( file_read( fp, colors, sizeof( colors ) ) != sizeof( colors ) ) return NULL ; + + for ( i = 0; i < 768; i++ ) colors[i] <<= 2; + + pal = pal_new_rgb(( uint8_t * )colors ); + pal_refresh( pal ); + + if ( !sys_pixel_format->palette ) + { + sys_pixel_format->palette = pal_new( pal ); +/* pal_use( sys_pixel_format->palette ); */ + palette_changed = 1 ; + } + + return pal ; +} + +/* --------------------------------------------------------------------------- */ + +PALETTE * gr_read_pal_with_gamma( file * fp ) +{ + PALETTE * pal = gr_read_pal( fp ); + + /* Ignora definiciones de gama */ + if ( pal ) file_seek( fp, 576, SEEK_CUR ) ; + + return pal ; +} + +/* --------------------------------------------------------------------------- */ + +/* + * FUNCTION : gr_save_pal + * + * Saves palette to the given file + * + * PARAMS : + * filename Name of file to create + * pal Palette + * + * RETURN VALUE : + * 1 if succeded, 0 if error + */ + +int gr_save_pal( const char * filename, PALETTE * pal ) +{ + if ( !filename ) return 0; + + uint8_t colors[256*3] ; + + file * fp ; + char header[8] = PAL_MAGIC; + int i; + + if ( !pal ) return 0; + + fp = file_open( filename, "wb" ); + if ( !fp ) return 0; + + memmove( colors, pal->rgb, sizeof( colors ) ); + for ( i = 0; i < sizeof( colors ); i++ ) colors[i] >>= 2; + + header[7] = 0x00; /* Version */ + file_write( fp, header, 8 ); + file_write( fp, colors, 768 ); + + memset( colors, 0, 576 ); + file_write( fp, colors, 576 ); + file_close( fp ); + + return 1; +} + +/* --------------------------------------------------------------------------- */ + +/* + * FUNCTION : gr_save_system_pal + * + * Saves the current palette to the given file + * + * PARAMS : + * filename Name of file to create + * + * RETURN VALUE : + * 1 if succeded, 0 if error + */ + +int gr_save_system_pal( const char * filename ) +{ + file * fp = file_open( filename, "wb" ); + char header[8] = PAL_MAGIC; + int i; + + if ( !fp ) return 0; + + uint8_t colors[256*3] ; + + memmove( colors, sys_pixel_format->palette ? ( uint8_t * ) sys_pixel_format->palette->rgb : default_palette, sizeof( colors ) ); + for ( i = 0; i < sizeof( colors ); i++ ) colors[i] >>= 2; + + header[7] = 0x00; /* Version */ + file_write( fp, header, 8 ); + file_write( fp, colors, 768 ); + + memset( colors, 0, 576 ); + file_write( fp, colors, 576 ); + file_close( fp ); + + return 1; +} + +/* --------------------------------------------------------------------------- */ + +int gr_load_pal( const char * filename ) +{ + if ( !filename ) return 0; + + file * fp = file_open( filename, "rb" ) ; + char header[8] ; + PALETTE * r = NULL ; + PALETTE * old_sys_pal = sys_pixel_format->palette ; + + if ( !fp ) return 0 ; + + if ( file_read( fp, header, sizeof( header ) ) != sizeof( header ) ) return 0; + if ( !strcmp( header, MAP_MAGIC ) ) + { + file_seek( fp, 48, SEEK_SET ) ; + r = gr_read_pal_with_gamma( fp ) ; + } + else if ( + !strcmp( header, FPG_MAGIC ) || + !strcmp( header, FNT_MAGIC ) || + !strcmp( header, PAL_MAGIC ) ) + { + r = gr_read_pal_with_gamma( fp ) ; + } + else if ( memcmp( header, "\x89PNG", 4 ) == 0 ) + { + GRAPH * graph ; + file_close( fp ); + fp = NULL; + graph = gr_read_png( filename ); + if ( graph ) + { + r = pal_new( graph->format->palette ); + bitmap_destroy( graph ); + } + } + + if ( r ) + { +// pal_use( r ); + if ( old_sys_pal ) + { + pal_destroy( old_sys_pal ); + + sys_pixel_format->palette = pal_new( r ); +/* pal_use( sys_pixel_format->palette ); */ + palette_changed = 1 ; + } + } + + if ( fp ) file_close( fp ) ; + return ( int ) r; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/file_pcx.c b/modules/mod_map/file_pcx.c new file mode 100644 index 0000000..4bdc3df --- /dev/null +++ b/modules/mod_map/file_pcx.c @@ -0,0 +1,187 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +/* + * TYPE DEFINITIONS + */ + +typedef struct +{ + uint8_t Manufacturer; + uint8_t Version; + uint8_t Encoding; + uint8_t BitsPerPixel; + int16_t Xmin, Ymin, Xmax, Ymax; + int16_t HDpi, VDpi; + uint8_t Colormap[48]; + uint8_t Reserved; + uint8_t NPlanes; + int16_t BytesPerLine; + int16_t PaletteInfo; + int16_t HscreenSize; + int16_t VscreenSize; + uint8_t Filler[54]; +} PCXheader ; + +/* --------------------------------------------------------------------------- */ + +/* + * FUNCTION : gr_read_pcx + * + * Returns GRAPH newly created from FILENAME. GRAPH is created in LIB 0 + * + * PARAMS: + * CONST CHAR * filename: File to be read + * + * RETURN VALUE: + * pointer to the newly created GRAPH + * + */ + +GRAPH * gr_read_pcx( const char * filename ) +{ + PCXheader header ; + file * file ; + int width, height, x, y, p, count ; + GRAPH * bitmap ; + uint8_t * ptr, ch ; + + file = file_open( filename, "rb" ) ; + if ( !file ) return NULL ; + + file_read( file, &header, sizeof( header ) ) ; + + /* Arrange the data for big-endian machines */ + ARRANGE_WORD( &header.Xmax ); + ARRANGE_WORD( &header.Xmin ); + ARRANGE_WORD( &header.Ymax ); + ARRANGE_WORD( &header.Ymin ); + ARRANGE_WORD( &header.BytesPerLine ); + ARRANGE_WORD( &header.PaletteInfo ); + ARRANGE_WORD( &header.HDpi ); + ARRANGE_WORD( &header.VDpi ); + ARRANGE_WORD( &header.HscreenSize ); + ARRANGE_WORD( &header.VscreenSize ); + + width = header.Xmax - header.Xmin + 1 ; + height = header.Ymax - header.Ymin + 1 ; + + bitmap = bitmap_new( 0, width, height, ( header.BitsPerPixel == 8 ) ? 8 : 16 ) ; + if ( !bitmap ) + { + file_close( file ); + return NULL; + } + + if ( width > header.BytesPerLine ) + { + bitmap_destroy( bitmap ); + file_close( file ); + return NULL; + } + + if ( header.BitsPerPixel == 8 ) + { + for ( y = 0 ; y < height ; y++ ) + for ( p = 0 ; p < header.NPlanes ; p++ ) + { + ptr = ( uint8_t * )bitmap->data + bitmap->pitch * y ; + for ( x = 0 ; x < header.BytesPerLine ; ) + { + if ( file_read( file, &ch, 1 ) < 1 ) + { + bitmap_destroy( bitmap ); + file_close( file ); + return NULL; + } + if (( ch & 0xC0 ) == 0xC0 ) + { + count = ( ch & 0x3F ) ; + file_read( file, &ch, 1 ) ; + } + else + { + count = 1 ; + } + while ( count-- ) + { + *ptr = ch ; + x++ ; + ptr += header.NPlanes ; + } + } + } + + if ( file_read( file, &ch, 1 ) == 1 && ch == 0x0c ) + { + uint8_t colors[256 * 3] ; + if ( file_read( file, colors, sizeof( colors ) ) ) + { + bitmap->format->palette = pal_new_rgb(( uint8_t * )colors ); + pal_refresh( bitmap->format->palette ); + + if ( !sys_pixel_format->palette ) + { + sys_pixel_format->palette = pal_new( bitmap->format->palette ); +/* pal_use( bitmap->format->palette ); */ + palette_changed = 1 ; + } + } + } + } + else + { + bitmap_destroy( bitmap ); + file_close( file ); + return NULL; + } + + bitmap->modified = 0 ; + bitmap_analize( bitmap ); + + return bitmap ; +} + +/* --------------------------------------------------------------------------- */ + +int gr_load_pcx( const char * mapname ) +{ + GRAPH * gr = gr_read_pcx( mapname ) ; + if ( !gr ) return 0 ; + gr->code = bitmap_next_code() ; + grlib_add_map( 0, gr ) ; + return gr->code ; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/file_png.c b/modules/mod_map/file_png.c new file mode 100644 index 0000000..711e63d --- /dev/null +++ b/modules/mod_map/file_png.c @@ -0,0 +1,629 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include <png.h> + +#include "mod_map.h" + +/* --------------------------------------------------------------------------- */ + +static void user_read_data( png_structp png_ptr, png_bytep data, png_size_t length ) +{ + file * png = (file *)png_get_io_ptr( png_ptr ); + file_read( png, data, length ) ; +} + +GRAPH * gr_read_png( const char * filename ) +{ + GRAPH * bitmap ; + unsigned int n, x ; + uint16_t * ptr ; + uint32_t * ptr32 ; + uint32_t * orig ; + uint32_t * row ; + uint32_t Rshift, Gshift, Bshift ; + uint32_t Rmask, Gmask, Bmask ; + + png_bytep * rowpointers ; + + png_structp png_ptr ; + png_infop info_ptr, end_info ; + png_uint_32 width, height, rowbytes; + int depth, color ; + + /* Abre el fichero y se asegura de que screen está inicializada */ + + file * png = file_open( filename, "rb" ) ; + if ( !png ) return NULL; + + /* Prepara las estructuras internas */ + + png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ) ; + if ( !png_ptr ) + { + file_close( png ); + return NULL; + } + + info_ptr = png_create_info_struct( png_ptr ) ; + end_info = png_create_info_struct( png_ptr ) ; + if ( !info_ptr || !end_info ) + { + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + file_close( png ) ; + return NULL; + } + + /* Rutina de error */ + +#if (PNG_LIBPNG_VER>=10500) + if ( setjmp( png_jmpbuf( png_ptr ) ) ) +#else + if ( setjmp( png_ptr->jmpbuf ) ) +#endif + { + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + file_close( png ) ; + return NULL; + } + + /* Recupera información sobre el PNG */ + + png_set_read_fn( png_ptr, png, user_read_data ) ; + png_read_info( png_ptr, info_ptr ) ; + png_get_IHDR( png_ptr, info_ptr, &width, &height, &depth, &color, 0, 0, 0 ) ; + + row = malloc( sizeof( uint32_t ) * width ); + if ( !row ) + { + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + file_close( png ) ; + return NULL; + } + + rowpointers = malloc( sizeof( png_bytep ) * height ); + if ( !rowpointers ) + { + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + free( row ) ; + file_close( png ) ; + return NULL; + } + + /* Configura los distintos modos disponibles */ +/* + if ( ( color == PNG_COLOR_TYPE_GRAY && depth == 1 ) || color == PNG_COLOR_TYPE_GRAY_ALPHA ) + { + png_set_gray_to_rgb( png_ptr ); + if ( color == PNG_COLOR_TYPE_GRAY ) png_set_filler( png_ptr, 0xFF, PNG_FILLER_AFTER ) ; + } +*/ + if ( depth == 16 ) png_set_strip_16( png_ptr ) ; + + if ( color == PNG_COLOR_TYPE_RGB ) png_set_filler( png_ptr, 0xFF, PNG_FILLER_AFTER ) ; + + png_set_bgr( png_ptr ) ; + + /* Recupera el fichero, convirtiendo a 16 bits si es preciso */ + + rowbytes = png_get_rowbytes( png_ptr, info_ptr ) ; + bitmap = bitmap_new( 0, width, height, ( color == PNG_COLOR_TYPE_GRAY ) ? depth : ( color == PNG_COLOR_TYPE_PALETTE ) ? 8 : ( sys_pixel_format->depth == 16 ? 16 : 32 ) ) ; + if ( !bitmap ) + { + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + free( rowpointers ) ; + free( row ) ; + file_close( png ) ; + return NULL; + } + + if ( color == PNG_COLOR_TYPE_GRAY ) + { + for ( n = 0 ; n < height ; n++ ) rowpointers[n] = (( uint8_t* )bitmap->data ) + n * bitmap->pitch ; + png_read_image( png_ptr, rowpointers ) ; + + if ( depth == 8 ) + { + uint8_t colors[256 * 3]; + uint8_t * p = colors; + + for ( n = 0; n < 256 ; n++ ) + { + * p++ = n; + * p++ = n; + * p++ = n; + } + + bitmap->format->palette = pal_new_rgb(( uint8_t * )colors ); + pal_refresh( bitmap->format->palette ); + } + +// png_read_rows( png_ptr, rowpointers, 0, height ) ; + } + else if ( color == PNG_COLOR_TYPE_PALETTE ) + { + /* Read the color palette */ + + png_colorp png_palette = ( png_colorp ) png_malloc( png_ptr, 256 * sizeof( png_color ) ) ; + if ( !png_palette ) + { + bitmap_destroy( bitmap ); + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + free( rowpointers ) ; + free( row ) ; + file_close( png ) ; + return NULL; + } + png_get_PLTE( png_ptr, info_ptr, &png_palette, ( int * ) &n ) ; + + uint8_t colors[256 * 3]; + uint8_t * p = colors; + + for ( n = 0; n < 256 ; n++ ) + { + * p++ = png_palette[n].red; + * p++ = png_palette[n].green; + * p++ = png_palette[n].blue; + } + + bitmap->format->palette = pal_new_rgb(( uint8_t * )colors ); + pal_refresh( bitmap->format->palette ); + + if ( !sys_pixel_format->palette ) + { + sys_pixel_format->palette = pal_new( bitmap->format->palette ); +/* pal_use( bitmap->format->palette ); */ + palette_changed = 1 ; + } + + for ( n = 0 ; n < height ; n++ ) rowpointers[n] = (( uint8_t* )bitmap->data ) + n * bitmap->pitch ; + png_read_image( png_ptr, rowpointers ) ; + + /* If the depth is less than 8, expand the pixel values */ + + if ( depth == 4 ) + { + for ( n = 0; n < height; n++ ) + { + char * orig, * dest; + orig = ( char * ) ( rowpointers[n] ); + dest = orig + width - 1; + orig += ( width - 1 ) / 2; + + for ( x = width; x--; ) + { + *dest-- = ( *orig >> ((( 1 - ( x & 0x01 ) ) << 2 ) ) ) & 0x0F ; + if ( !( x & 0x01 ) ) orig--; + } + } + } + else if ( depth == 2 ) + { + for ( n = 0; n < height; n++ ) + { + char * orig, * dest; + orig = ( char * ) rowpointers[n]; + dest = orig + width - 1; + orig += ( width - 1 ) / 4; + + for ( x = width; x--; ) + { + *dest-- = ( *orig >> ((( 3 - ( x & 0x03 ) ) << 1 ) ) ) & 0x03 ; + if ( !( x & 0x03 ) ) orig--; + } + } + } + else if ( depth == 1 ) + { + for ( n = 0; n < height; n++ ) + { + char * orig, * dest; + orig = ( char * ) rowpointers[n]; + dest = orig + width - 1; + orig += ( width - 1 ) / 8; + + for ( x = width; x--; ) + { + *dest-- = ( *orig >> ( 7 - ( x & 0x07 ) ) ) & 0x01 ; + if ( !( x & 0x07 ) ) orig--; + } + } + } + } + else if ( depth == 8 && sys_pixel_format->depth != 16 ) + { +#if (PNG_LIBPNG_VER>=10500) + png_color_16p trans_color = 0; + png_get_tRNS( png_ptr, info_ptr, 0, 0, &trans_color); +#endif + + for ( n = 0 ; n < height ; n++ ) + { + rowpointers[0] = ( void * )row ; + png_read_rows( png_ptr, rowpointers, 0, 1 ) ; + + ptr32 = ( uint32_t* )((( uint8_t * )bitmap->data ) + n * bitmap->pitch ); + orig = row ; + for ( x = 0 ; x < width ; x++ ) + { + ARRANGE_DWORD( orig ); + *ptr32 = *orig ; + + /* DCelso */ +#if (PNG_LIBPNG_VER>=10500) + if (( color == PNG_COLOR_TYPE_RGB ) && ( png_get_bit_depth(png_ptr, info_ptr) == 24 ) && ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) )) +#else + if (( color == PNG_COLOR_TYPE_RGB ) && ( info_ptr->pixel_depth == 24 ) && ( info_ptr->valid & PNG_INFO_tRNS )) +#endif + { + uint8_t * ptr8 = (uint8_t *)orig; + if ( +#if (PNG_LIBPNG_VER>=10500) + ( ptr8[0] == trans_color->red ) && + ( ptr8[1] == trans_color->green ) && + ( ptr8[2] == trans_color->blue ) +#else + ( ptr8[0] == info_ptr->trans_values.red ) && + ( ptr8[1] == info_ptr->trans_values.green ) && + ( ptr8[2] == info_ptr->trans_values.blue ) +#endif + ) + *ptr32 = 0; + } + ptr32++, orig++ ; + } + } + } + else + { +#if (PNG_LIBPNG_VER>=10500) + png_color_16p trans_color = 0; + png_get_tRNS( png_ptr, info_ptr, 0, 0, &trans_color); +#endif + + Rshift = 8; + Gshift = 5; + Bshift = 3; + + Rmask = 0xF80000 ; // 3 + Gmask = 0x00FC00 ; // 2 + Bmask = 0x0000F8 ; // 3 + + for ( n = 0 ; n < height ; n++ ) + { + rowpointers[0] = ( void * )row ; + png_read_rows( png_ptr, rowpointers, 0, 1 ) ; + + ptr = ( uint16_t* )((( uint8_t * )bitmap->data ) + n * bitmap->pitch ); + orig = row ; + for ( x = 0 ; x < width ; x++ ) + { + ARRANGE_DWORD( orig ); + + if (( *orig ) & 0x80000000 ) + { + *ptr = (( *orig & Rmask ) >> Rshift ) | (( *orig & Gmask ) >> Gshift ) | (( *orig & Bmask ) >> Bshift ) ; + if ( !*ptr )( *ptr )++ ; + } + else + *ptr = 0 ; + + /* DCelso */ +#if (PNG_LIBPNG_VER>=10500) + if (( color == PNG_COLOR_TYPE_RGB ) && ( png_get_bit_depth(png_ptr, info_ptr) == 24 ) && ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) )) +#else + if (( color == PNG_COLOR_TYPE_RGB ) && ( info_ptr->pixel_depth == 24 ) && ( info_ptr->valid & PNG_INFO_tRNS )) +#endif + { + uint8_t * ptr8 = (uint8_t *)orig; + if ( +#if (PNG_LIBPNG_VER>=10500) + ( ptr8[0] == trans_color->red ) && + ( ptr8[1] == trans_color->green ) && + ( ptr8[2] == trans_color->blue ) +#else + ( ptr8[0] == info_ptr->trans_values.red ) && + ( ptr8[1] == info_ptr->trans_values.green ) && + ( ptr8[2] == info_ptr->trans_values.blue ) +#endif + ) + *ptr = 0; + } + ptr++, orig++ ; + } + } + } + + /* Fin */ + +#if (PNG_LIBPNG_VER>=10500) + if ( !setjmp( png_jmpbuf( png_ptr ) ) ) +#else + if ( !setjmp( png_ptr->jmpbuf ) ) +#endif + png_read_end( png_ptr, 0 ) ; + + bitmap->modified = 1 ; + + png_destroy_read_struct( &png_ptr, &info_ptr, &end_info ) ; + + free( rowpointers ) ; + free( row ) ; + file_close( png ) ; + + return bitmap ; +} + +/* + * FUNCTION : gr_save_png + * + * Save a GRAPH into a PNG file + * + * PARAMS : + * gr GRAPH with the image to save + * filename name for the file + * + * RETURN VALUE : + * 0 - FAILURE + * 1 - SUCCESS + * + */ + +int gr_save_png( GRAPH * gr, const char * filename ) +{ + if ( !gr ) return( 0 ) ; + + FILE * file = fopen( filename, "wb" ) ; + png_structp png_ptr ; + png_infop info_ptr ; + int k, i ; + png_bytep * rowpointers ; + png_colorp pal ; + uint32_t * data, * ptr ; + uint16_t * orig ; + uint32_t * orig32 ; + rgb_component * gpal = NULL; + + if ( !file ) return( 0 ) ; + + rowpointers = malloc( sizeof( png_bytep ) * gr->height ); + if ( !rowpointers ) + { + fclose( file ) ; + return 0 ; + } + + png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ) ; + if ( !png_ptr ) + { + free( rowpointers ) ; + fclose( file ) ; + return( 0 ) ; + } + + info_ptr = png_create_info_struct( png_ptr ) ; + if ( !info_ptr ) + { + png_destroy_write_struct( &png_ptr, NULL ) ; + free( rowpointers ) ; + fclose( file ) ; + return( 0 ) ; + } + + /* Error handling... */ + +#if (PNG_LIBPNG_VER>=10500) + if ( setjmp( png_jmpbuf( png_ptr ) ) ) +#else + if ( setjmp( png_ptr->jmpbuf ) ) +#endif + { + png_destroy_write_struct( &png_ptr, NULL ) ; + free( rowpointers ) ; + fclose( file ) ; + return( 0 ) ; + } + + png_init_io( png_ptr, file ) ; + + if ( gr->format->depth == 1 ) + { + png_set_IHDR( png_ptr, info_ptr, gr->width, + gr->height, 1, PNG_COLOR_TYPE_GRAY, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE ) ; + + png_write_info( png_ptr, info_ptr ) ; + + for ( k = 0 ; k < ( unsigned )gr->height ; k++ ) + rowpointers[k] = ( uint8_t * )gr->data + gr->pitch * k ; + + png_write_image( png_ptr, rowpointers ) ; + } + else + if ( gr->format->depth == 8 ) + { + /* 8 bits PNG file */ + png_set_IHDR( png_ptr, info_ptr, gr->width, + gr->height, 8, PNG_COLOR_TYPE_PALETTE, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE ) ; + + +#if (PNG_LIBPNG_VER>=10500) + if (!( gr->info_flags & GI_NOCOLORKEY )) + { + /* this need test */ + png_color_16 trans_color; + png_byte trans = 1; + + trans_color.red = 0; + trans_color.green = 0; + trans_color.blue = 0; + trans_color.gray = 0; + + png_set_tRNS( png_ptr, info_ptr, &trans, 1, &trans_color ); + } +#else + /* DCelso */ + if (!( gr->info_flags & GI_NOCOLORKEY )) + { + uint8_t trans = 1; + info_ptr->num_trans = 1; + info_ptr->trans = &trans; + info_ptr->valid = info_ptr->valid | PNG_INFO_tRNS; + } + /* DCelso */ +#endif + pal = ( png_colorp ) png_malloc( png_ptr, 256 * sizeof( png_color ) ) ; + if ( !pal ) + { + png_destroy_write_struct( &png_ptr, NULL ) ; + free( rowpointers ) ; + fclose( file ) ; + return( 0 ) ; + } + + if ( gr->format->palette ) + gpal = gr->format->palette->rgb; + else if ( sys_pixel_format->palette ) + gpal = sys_pixel_format->palette->rgb; + else + gpal = ( rgb_component * )default_palette; + + /* Generate palette info */ + for ( k = 0 ; k < 256 ; k++ ) + { + pal[k].red = gpal[k].r ; + pal[k].green = gpal[k].g ; + pal[k].blue = gpal[k].b ; + } + png_set_PLTE( png_ptr, info_ptr, pal, 256 ) ; + png_write_info( png_ptr, info_ptr ) ; + + /* no need to rearrange data */ + for ( k = 0 ; k < ( unsigned )gr->height ; k++ ) + rowpointers[k] = ( uint8_t * )gr->data + gr->pitch * k ; + png_write_image( png_ptr, rowpointers ) ; + + /* Free allocated palette... */ + png_free( png_ptr, ( png_voidp ) pal ) ; +// info_ptr->palette = NULL ; + } + else + { + png_set_IHDR( png_ptr, info_ptr, gr->width, + gr->height, 8, PNG_COLOR_TYPE_RGB_ALPHA, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE ) ; + + png_write_info( png_ptr, info_ptr ) ; + + data = malloc( gr->width * gr->height * 4 ) ; + if ( !data ) + { + png_destroy_write_struct( &png_ptr, NULL ) ; + free( rowpointers ) ; + fclose( file ) ; + return( 0 ) ; + } + + if ( gr->format->depth == 16 ) + { + for ( k = 0; k < ( unsigned )gr->height; k++ ) + { + ptr = data + gr->width * k ; /* uses dword for each pixel! */ + orig = ( uint16_t * )( gr->data + gr->pitch * k ) ; + rowpointers[k] = ( uint8_t * )ptr ; + for ( i = 0 ; i < ( unsigned )gr->width ; i++ ) + { + if ( *orig == 0 && !( gr->info_flags & GI_NOCOLORKEY ) ) + *ptr = 0x00000000 ; + else + { + *ptr = + (( *orig & 0xf800 ) >> 8 ) | + (( *orig & 0x07e0 ) << 5 ) | + (( *orig & 0x001f ) << 19 ) | + 0xFF000000 ; + /* Rearrange data */ + ARRANGE_DWORD( ptr ) ; + } + orig++ ; + ptr++ ; + } + } + } + else if ( gr->format->depth == 32 ) + { + for ( k = 0; k < ( unsigned )gr->height; k++ ) + { + ptr = data + gr->width * k ; /* uses dword for each pixel! */ + orig32 = ( uint32_t * )( gr->data + gr->pitch * k ) ; + rowpointers[k] = ( uint8_t * )ptr ; + for ( i = 0 ; i < ( unsigned )gr->width ; i++ ) + { + *ptr = + (( *orig32 & 0xff000000 ) ) | + (( *orig32 & 0x00ff0000 ) >> 16 ) | + (( *orig32 & 0x0000ff00 ) ) | + (( *orig32 & 0x000000ff ) << 16 ) ; + + /* Rearrange data */ + ARRANGE_DWORD( ptr ) ; + + orig32++ ; + ptr++ ; + } + } + } + png_write_image( png_ptr, rowpointers ) ; + free( data ) ; + } + + png_write_end( png_ptr, info_ptr ) ; + png_destroy_write_struct( &png_ptr, NULL ) ; + free( rowpointers ) ; + fclose( file ) ; + return ( 1 ) ; +} + +/* --------------------------------------------------------------------------- */ + +int gr_load_png( const char * mapname ) +{ + GRAPH * gr = gr_read_png( mapname ) ; + if ( !gr ) return 0 ; + gr->code = bitmap_next_code() ; + grlib_add_map( 0, gr ) ; + return gr->code ; +} + +/* --------------------------------------------------------------------------- */ diff --git a/modules/mod_map/mod_map.c b/modules/mod_map/mod_map.c new file mode 100644 index 0000000..1c541a9 --- /dev/null +++ b/modules/mod_map/mod_map.c @@ -0,0 +1,1013 @@ +/* + * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#include <stdlib.h> + +#include "bgdrtm.h" + +#include "bgddl.h" +#include "dlvaracc.h" + +#include "xstrings.h" +#include "mod_map.h" + +#include "librender.h" + +#include "bgload.h" + +/* --------------------------------------------------------------------------- */ + +static int modmap_graphic_set( INSTANCE * my, int * params ) +{ + GRAPH * map ; + + map = bitmap_get( params[0], params[1] ) ; + if ( !map ) return 0 ; + + switch ( params[2] ) + { + case 2: /* g_center_x */ + bitmap_set_cpoint( map, 0, params[3], ( map->ncpoints ) ? ( map->cpoints[0].y ) : ( map->height / 2 ) ) ; + return 1 ; + + case 3: /* g_center_y */ + bitmap_set_cpoint( map, 0, ( map->ncpoints ) ? ( map->cpoints[0].x ) : ( map->width / 2 ), params[3] ) ; + return 1 ; + } + return 1 ; +} + +static int modmap_graphic_info( INSTANCE * my, int * params ) +{ + GRAPH * map ; + + map = bitmap_get( params[0], params[1] ) ; + if ( !map ) return 0 ; + + switch ( params[2] ) + { + case G_WIDTH: /* g_wide */ + return map->width ; + + case G_HEIGHT: /* g_height */ + return map->height ; + + case G_PITCH: /* g_pitch */ + return map->pitch ; + + case G_DEPTH: /* g_depth */ + return map->format->depth ; + + case G_CENTER_X: /* g_center_x */ + if ( map->ncpoints > 0 ) + if ( map->cpoints[0].x != CPOINT_UNDEFINED ) + return map->cpoints[0].x ; + return map->width / 2 ; + + case G_CENTER_Y: /* g_center_y */ + if ( map->ncpoints > 0 ) + if ( map->cpoints[0].y != CPOINT_UNDEFINED ) + return map->cpoints[0].y ; + return map->height / 2 ; + } + + return 1 ; +} + +static int modmap_set_point( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp || params[2] < 0 || params[2] > 999 ) return -1 ; + bitmap_set_cpoint( bmp, ( uint32_t )params[2], params[3], params[4] ); + return 1 ; +} + +static int modmap_set_center( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp ) return -1 ; + bitmap_set_cpoint( bmp, 0, params[2], params[3] ); + return 1 ; +} + +static int modmap_get_point( INSTANCE * my, int * params ) +{ + GRAPH * bmp ; + + bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp ) return 0 ; + + /* Use the center as control point if it is not there */ + if ( params[2] == 0 && ( bmp->ncpoints == 0 || bmp->cpoints[0].x == CPOINT_UNDEFINED ) ) + { + *( int * )params[3] = bmp->width / 2; + *( int * )params[4] = bmp->height / 2; + return 1 ; + } + + if (( uint32_t )params[2] >= bmp->ncpoints || params[2] < 0 ) + return 0 ; + if ( bmp->cpoints[params[2]].x == CPOINT_UNDEFINED && bmp->cpoints[params[2]].y == CPOINT_UNDEFINED ) + return 0; + + *( int * )params[3] = bmp->cpoints[params[2]].x ; + *( int * )params[4] = bmp->cpoints[params[2]].y ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_load_png( INSTANCE * my, int * params ) +{ + int r = gr_load_png( string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +static int modmap_load_pcx( INSTANCE * my, int * params ) +{ + int r = ( int ) gr_load_pcx( string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_save_png( INSTANCE * my, int * params ) +{ + int r = ( int ) gr_save_png( bitmap_get( params[0], params[1] ), string_get( params[2] ) ) ; + string_discard( params[2] ) ; + return r ; +} + +/* ---------------------------------------------------------------------- */ + +static int modmap_map_buffer( INSTANCE * my, int * params ) +{ + GRAPH * map ; + + if ( params[0] || params[1] ) + map = bitmap_get( params[0], params[1] ) ; + else + map = background ; + + return map ? ( int )map->data : 0 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_clear( INSTANCE * my, int * params ) +{ + GRAPH *map = bitmap_get( params[0], params[1] ) ; + if ( map ) gr_clear_as( map, params[2] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_new_map( INSTANCE * my, int * params ) +{ + GRAPH * map ; + map = bitmap_new_syslib( params[0], params[1], params[2] ) ; + if ( map ) gr_clear( map ); + return map ? map->code : 0 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_new_map_extend( INSTANCE * my, int * params ) +{ + GRAPH * map ; + map = bitmap_new_syslib( params[0], params[1], params[2] ) ; + if ( map && ( params[3] & B_CLEAR )) gr_clear( map ); + return map ? map->code : 0 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_clone( INSTANCE * my, int * params ) +{ + GRAPH * origin, * map = NULL ; + origin = bitmap_get( params[0], params[1] ) ; + if ( origin ) map = bitmap_clone( origin ) ; + if ( !map ) return 0; + map->code = bitmap_next_code(); + grlib_add_map( 0, map ); + return map->code ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_put( INSTANCE * my, int * params ) +{ + GRAPH * dest = bitmap_get( params[0], params[1] ) ; + GRAPH * orig = bitmap_get( params[0], params[2] ) ; + + if ( !dest || !orig ) return 0 ; + + gr_blit( dest, NULL, params[3], params[4], 0, orig ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ +/** MAP_XPUT (FILE, GRAPH_DEST, GRAPH_SRC, X, Y, ANGLE, SIZE, FLAGS) + * Draws a map into another one, with most blitter options including flags and alpha + */ + +static int modmap_map_xput( INSTANCE * my, int * params ) +{ + GRAPH * dest = bitmap_get( params[0], params[1] ) ; + GRAPH * orig = bitmap_get( params[0], params[2] ) ; + + if ( !dest || !orig ) return 0; + + if ( params[5] == 0 && params[6] == 100 ) + gr_blit( dest, 0, params[3], params[4], params[7], orig ) ; + else + gr_rotated_blit( dest, 0, params[3], params[4], params[7], params[5], params[6], params[6], orig ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ +/** MAP_XPUTNP (FILE_DST, GRAPH_DST, FILE_SRC, GRAPH_SRC, X, Y, ANGLE, SCALE_X, SCALE_Y, FLAGS) + * Enhanced MAP_XPUT with all parametes and different FPG file and non-proportional scale + */ + +static int modmap_map_xputnp( INSTANCE * my, int * params ) +{ + GRAPH * dest = bitmap_get( params[0], params[1] ) ; + GRAPH * orig = bitmap_get( params[2], params[3] ) ; + + if ( params[6] == 0 && params[7] == 100 && params[8] == 100 ) + gr_blit( dest, 0, params[4], params[5], params[9], orig ) ; + else + gr_rotated_blit( dest, 0, params[4], params[5], params[9], params[6], params[7], params[8], orig ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_name( INSTANCE * my, int * params ) +{ + GRAPH * map = bitmap_get( params[0], params[1] ); + int result; + + if ( !map ) return 0; + result = string_new( map->name ); + string_use( result ); + return result; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_set_name( INSTANCE * my, int * params ) +{ + GRAPH * map = bitmap_get( params[0], params[1] ); + const char * ptr = string_get( params[2] ) ; + if ( map ) + { + strncpy( map->name, ptr, sizeof( map->name ) ); + map->name[sizeof( map->name )-1] = 0; + } + string_discard( params[2] ); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_exists( INSTANCE * my, int * params ) +{ + GRAPH * map = bitmap_get( params[0], params[1] ); + return map == NULL ? 0 : 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_map_block_copy( INSTANCE * my, int * params ) +{ + GRAPH * dest, * orig ; + REGION clip ; + int centerx, centery, flag ; + uint32_t x, y, w, h, dx, dy ; + + dest = bitmap_get( params[0], params[1] ) ; + if ( !dest ) return 0; + + orig = bitmap_get( params[0], params[4] ) ; + if ( !orig ) return 0; + + x = params[5] ; + y = params[6] ; + w = params[7] ; + h = params[8] ; + dx = params[2] ; + dy = params[3] ; + flag = params[9] ; + + if ( orig->ncpoints > 0 && orig->cpoints[0].x != CPOINT_UNDEFINED ) + { + centerx = orig->cpoints[0].x ; + centery = orig->cpoints[0].y ; + } + else + { + centery = orig->height / 2 ; + centerx = orig->width / 2 ; + } + + if ( flag & B_HMIRROR ) centerx = orig->width - 1 - centerx; + if ( flag & B_VMIRROR ) centery = orig->height - 1 - centery; + + if ( x < 0 ) + { + dx += x ; + w += x ; + x = 0 ; + } + if ( y < 0 ) + { + dy += y ; + h += y ; + y = 0 ; + } + if ( dx < 0 ) + { + x += dx ; + w += dx ; + dx = 0 ; + } + if ( dy < 0 ) + { + y += dy ; + h += dy ; + dy = 0 ; + } + + if ( x + w > orig->width ) w = orig->width - x ; + + if ( y + h > orig->height ) h = orig->height - y ; + + if ( dx + w > dest->width ) w = dest->width - dx ; + + if ( dy + h > dest->height ) h = dest->height - dy ; + + if ( w <= 0 || h <= 0 ) return 0; + + clip.x = dx ; + clip.y = dy ; + clip.x2 = dx + w - 1 ; + clip.y2 = dy + h - 1 ; + gr_blit( dest, &clip, dx - x + centerx, dy - y + centery, flag, orig ) ; + + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_load_map( INSTANCE * my, int * params ) +{ + int r = gr_load_map( string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_unload_map( INSTANCE * my, int * params ) +{ + return grlib_unload_map( params[0], params[1] ) ; +} + +/* ---------------------------------------------------------------------- */ + +static int modmap_save_map( INSTANCE * my, int * params ) +{ + int r = ( int ) gr_save_map( bitmap_get( params[0], params[1] ), ( char * )string_get( params[2] ) ) ; + string_discard( params[2] ) ; + return r ; +} + +/* ---------------------------------------------------------------------- */ + +static int modmap_load_pal( INSTANCE * my, int * params ) +{ + int r = gr_load_pal( string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +/* ---------------------------------------------------------------------- */ + +static int modmap_save_pal( INSTANCE * my, int * params ) +{ + int r = gr_save_pal( string_get( params[0] ), ( PALETTE * )params[1] ); + string_discard( params[0] ); + return r; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_save_system_pal( INSTANCE * my, int * params ) +{ + int r = gr_save_system_pal( string_get( params[0] ) ); + string_discard( params[0] ); + return r; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_convert_palette( INSTANCE * my, int * params ) +{ + GRAPH * map = bitmap_get( params[0], params[1] ) ; + int * newpal = ( int * ) params[2]; + uint32_t x, y ; + uint8_t * orig, * ptr ; + + if ( !map ) return -1 ; + if ( map->format->depth != 8 ) return 0; + + orig = ( uint8_t * )map->data ; + for ( y = 0 ; y < map->height; y++ ) + { + ptr = orig + map->pitch * y ; + for ( x = 0 ; x < map->width ; x++, ptr++ ) *ptr = newpal[*ptr] ; + } + + map->modified = 1; + + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_set_colors( INSTANCE * my, int * params ) +{ + gr_set_colors( params[0], params[1], ( uint8_t * )params[2] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_colors( INSTANCE * my, int * params ) +{ + gr_get_colors( params[0], params[1], ( uint8_t * )params[2] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_roll_palette( INSTANCE * my, int * params ) +{ + gr_roll_palette( params[0], params[1], params[2] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_find_color( INSTANCE * my, int * params ) +{ + return gr_find_nearest_color( params[0], params[1], params[2] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_find_color2( INSTANCE * my, int * params ) +{ + return find_nearest_color( ( PALETTE * ) params[0], 0, 255, params[1], params[2], params[3] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_find_color3( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp || bmp->format->depth != 8 ) return 0 ; + return find_nearest_color( bmp->format->palette, 0, 255, params[2], params[3], params[4] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgb( INSTANCE * my, int * params ) +{ + gr_get_rgb( params[0], ( int * )params[1], ( int * )params[2], ( int * )params[3] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgba( INSTANCE * my, int * params ) +{ + gr_get_rgba( params[0], ( int * )params[1], ( int * )params[2], ( int * )params[3], ( int * )params[4] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgb( INSTANCE * my, int * params ) +{ + return gr_rgb( params[0], params[1], params[2] ); +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgba( INSTANCE * my, int * params ) +{ + return gr_rgba( params[0], params[1], params[2], params[3] ); +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgb_depth( INSTANCE * my, int * params ) +{ + gr_get_rgb_depth( params[4], params[0], ( int * )params[1], ( int * )params[2], ( int * )params[3] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgba_depth( INSTANCE * my, int * params ) +{ + gr_get_rgba_depth( params[5], params[0], ( int * )params[1], ( int * )params[2], ( int * )params[3], ( int * )params[4] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgb_depth( INSTANCE * my, int * params ) +{ + return params[3] > 8 ? + gr_rgb_depth( params[3], params[0], params[1], params[2] ) : + gr_find_nearest_color( params[0], params[1], params[2] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgba_depth( INSTANCE * my, int * params ) +{ + return params[4] > 8 ? + gr_rgba_depth( params[4], params[0], params[1], params[2], params[3] ) : + gr_find_nearest_color( params[0], params[1], params[2] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgb_map( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + _get_rgb( bmp->format, params[2], ( int * )params[3], ( int * )params[4], ( int * )params[5] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_get_rgba_map( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + _get_rgba( bmp->format, params[2], ( int * )params[3], ( int * )params[4], ( int * )params[5], ( int * )params[6] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgb_map( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + return _rgb( bmp->format, params[2], params[3], params[4] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_rgba_map( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + return _rgba( bmp->format, params[2], params[3], params[4], params[5] ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fade( INSTANCE * my, int * params ) +{ + gr_fade_init( params[0], params[1], params[2], params[3] ); + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fade_on( INSTANCE * my, int * params ) +{ + gr_fade_init( 100, 100, 100, 16 ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fade_off( INSTANCE * my, int * params ) +{ + gr_fade_init( 0, 0, 0, 16 ) ; + return 1; +} + +/* --------------------------------------------------------------------------- */ +/* Palette */ + +static int modmap_pal_create( INSTANCE * my, int * params ) +{ + return ( int ) pal_new(( PALETTE * )NULL ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_clone( INSTANCE * my, int * params ) +{ + return ( int ) pal_new(( PALETTE * )( params[0] ) ) ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_unload( INSTANCE * my, int * params ) +{ + pal_destroy(( PALETTE * )( params[0] ) ) ; + return 1; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_refresh( INSTANCE * my, int * params ) +{ + pal_refresh( NULL ) ; + return 1; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_refresh_2( INSTANCE * my, int * params ) +{ + pal_refresh(( PALETTE * )( params[0] ) ); + return 1; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_map_assign( INSTANCE * my, int * params ) +{ + return pal_map_assign( params[0], params[1], ( PALETTE * )( params[2] ) ); +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_map_remove( INSTANCE * my, int * params ) +{ + return pal_map_remove( params[0], params[1] ); +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_map_getid( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp || bmp->format->depth != 8 ) return 0 ; + return ( int ) bmp->format->palette ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_set_system_pal( INSTANCE * my, int * params ) +{ + if ( pal_set(( PALETTE * )NULL, 0, 256, ( uint8_t * )(( PALETTE * )params[0])->rgb ) ) + { + pal_refresh( sys_pixel_format->palette ); + return 1; + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_set_system_pal_raw( INSTANCE * my, int * params ) +{ + if ( pal_set(( PALETTE * )NULL, 0, 256, ( uint8_t * )params[0] ) ) + { + pal_refresh( sys_pixel_format->palette ); + return 1; + } + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int modmap_pal_set( INSTANCE * my, int * params ) +{ + int ret = pal_set(( PALETTE * )( params[0] ), params[1], params[2], ( uint8_t * )params[3] ) ; + if ( ret && !params[0] ) pal_refresh( sys_pixel_format->palette ); + return ret; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_pal_get( INSTANCE * my, int * params ) +{ + return ( pal_get(( PALETTE * )( params[0] ), params[1], params[2], ( uint8_t * )params[3] ) ) ; +} + +/* ---------------------------------------------------------------------- */ + +/* Funciones de FPG */ + +static int modmap_load_fpg( INSTANCE * my, int * params ) +{ + int r; + r = gr_load_fpg( string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_save_fpg( INSTANCE * my, int * params ) +{ + int r; + r = gr_save_fpg( params[0], string_get( params[1] ) ) ; + string_discard( params[1] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_unload_fpg( INSTANCE * my, int * params ) +{ + grlib_destroy( params[0] ) ; + return 1 ; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fpg_exists( INSTANCE * my, int * params ) +{ + GRLIB * lib = grlib_get( params[0] ); + return lib == NULL ? 0 : 1; +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fpg_add( INSTANCE * my, int * params ) +{ + GRAPH * orig = bitmap_get( params[2], params[3] ); + GRAPH * dest ; + + if ( orig == NULL ) return 0; + dest = bitmap_clone( orig ) ; + dest->code = params[1] ; + + return grlib_add_map( params[0], dest ); +} + +/* --------------------------------------------------------------------------- */ + +static int modmap_fpg_new( INSTANCE * my, int * params ) +{ + return grlib_new(); +} + +/* --------------------------------------------------------------------------- */ +/* --------------------------------------------------------------------------- */ +/* --------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------------------- */ +/** LOAD_FNT (STRING FILENAME) + * Load a .FNT font from disk (returns the font ID) + */ + +static int modmap_load_fnt( INSTANCE * my, int * params ) +{ + int r = gr_font_load( ( char * )string_get( params[0] ) ); + string_discard( params[0] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ +/* --------------------------------------------------------------------------- */ +/* --------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------------------- */ +/** LOAD_BDF (STRING FILENAME) + * Load a .BDF font from disk (returns the font ID) + */ + +static int modmap_load_bdf( INSTANCE * my, int * params ) +{ + int r = gr_load_bdf( ( char * )string_get( params[0] ) ) ; + string_discard( params[0] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ +/** UNLOAD_FNT (FONT) + * Destroys a font in memory + */ + +static int modmap_unload_fnt( INSTANCE * my, int * params ) +{ + if ( params[0] > 0 ) gr_font_destroy( params[0] ); + return 0; +} + +/* --------------------------------------------------------------------------- */ +/** FNT_NEW (DEPTH) + * Create a new font in memory (returns the font ID) + */ + +static int modmap_fnt_new( INSTANCE * my, int * params ) +{ + return gr_font_new( CHARSET_CP850, params[0] ); +} + +/* --------------------------------------------------------------------------- */ + +/** FNT_NEW (CHARSET, DEPTH) + * Create a new font in memory (returns the font ID) + */ + +static int modmap_fnt_new_charset( INSTANCE * my, int * params ) +{ + return gr_font_new( params[0], params[1] ); +} + +/* --------------------------------------------------------------------------- */ + +/** FNT_NEW (FILE, GRAPH, CHARSET, WIDTH, HEIGHT, FIRST, LAST, FLAGS) + * Create a new font in memory (returns the font ID) + */ + +static int modmap_fnt_new_from_bitmap( INSTANCE * my, int * params ) +{ + GRAPH * bmp = bitmap_get( params[0], params[1] ) ; + if ( !bmp ) return -1; + return gr_font_newfrombitmap( bmp, params[2], params[3], params[4], params[5], params[6], params[7] ); +} + +/* --------------------------------------------------------------------------- */ +/** GET_GLYPH (FONT, GLYPH) + * Create a system map as a copy of one of the font glyphs (returns the map ID) + */ + +static int modmap_get_glyph( INSTANCE * my, int * params ) +{ + FONT * font = gr_font_get( params[0] ); + GRAPH * map ; + unsigned char c = params[1]; + + if ( font->charset == /*CHARSET_CP850*/ CHARSET_ISO8859 ) c = win_to_dos[c]; + if ( !font ) return 0; + if ( !font->glyph[c].bitmap ) return 0; + + map = bitmap_clone( font->glyph[c].bitmap ); + if ( !map ) return 0; + + map->code = bitmap_next_code(); + + if ( !map->ncpoints ) bitmap_add_cpoint( map, map->width / 2, map->height / 2 ); + bitmap_add_cpoint( map, font->glyph[c].xoffset, font->glyph[c].yoffset ); + bitmap_add_cpoint( map, font->glyph[c].xadvance, font->glyph[c].yadvance ); + + grlib_add_map( 0, map ); + + return map->code; +} + +/* --------------------------------------------------------------------------- */ +/** SET_GLYPH (FONT, GLYPH, LIBRARY, GRAPHIC) + * Change one of the font's glyphs + */ + +static int modmap_set_glyph( INSTANCE * my, int * params ) +{ + FONT * font = gr_font_get( params[0] ); + GRAPH * map = bitmap_get( params[2], params[3] ); + unsigned char c = params[1]; + + if ( font->charset == /*CHARSET_CP850*/CHARSET_ISO8859 ) c = win_to_dos[c]; + + if ( font && map ) + { + if ( font->glyph[c].bitmap ) grlib_unload_map( 0, font->glyph[c].bitmap->code ); + font->glyph[c].bitmap = bitmap_clone( map ); + if ( font->glyph[c].bitmap ) + { + font->glyph[c].bitmap->code = bitmap_next_code(); + + if ( map->ncpoints >= 3 && map->cpoints ) + { + font->glyph[c].xoffset = map->cpoints[1].x; + font->glyph[c].yoffset = map->cpoints[1].y; + font->glyph[c].xadvance = map->cpoints[2].x; + font->glyph[c].yadvance = map->cpoints[2].y; + } + else + { + font->glyph[c].xoffset = 0; + font->glyph[c].yoffset = 0; + font->glyph[c].xadvance = map->width + map->width / 5 ; + font->glyph[c].yadvance = map->height + map->height / 5 ; + bitmap_add_cpoint( font->glyph[c].bitmap, 0, 0 ) ; + } + grlib_add_map( 0, font->glyph[c].bitmap ); + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ +/** SAVE_FNT (FONT, STRING FILENAME) + * Saves a font to disk + */ + +static int modmap_save_fnt( INSTANCE * my, int * params ) +{ + int r = gr_font_save( params[0], ( char * )string_get( params[1] ) ) ; + string_discard( params[1] ) ; + return r ; +} + +/* --------------------------------------------------------------------------- */ +/** + int LOAD_FPG(STRING FICHERO, INT POINTER VARIABLE) + Loads fpg file FICHERO on a separate thread + VARIABLE is -2 while waiting, -1 on error, >=0 otherwise + **/ + +static int modmap_bgload_fpg( INSTANCE * my, int * params ) +{ + bgload( gr_load_fpg, params ); + return 0 ; +} + +static int modmap_bgload_map( INSTANCE * my, int * params ) +{ + bgload( gr_load_map, params ) ; + return 0 ; +} + +static int modmap_bgload_png( INSTANCE * my, int * params ) +{ + bgload( gr_load_png, params ) ; + return 0 ; +} + +static int modmap_bgload_pcx( INSTANCE * my, int * params ) +{ + bgload( gr_load_pcx, params ); + return 0 ; +} + +static int modmap_bgload_pal( INSTANCE * my, int * params ) +{ + bgload( gr_load_pal, params ) ; + return 0 ; +} + +static int modmap_bgload_fnt( INSTANCE * my, int * params ) +{ + bgload( gr_font_load, params ); + return 0 ; +} + +static int modmap_bgload_bdf( INSTANCE * my, int * params ) +{ + bgload( gr_load_bdf, params ) ; + return 0 ; +} + +/* ----------------------------------------------------------------- */ +/* exports */ +/* ----------------------------------------------------------------- */ + +#include "mod_map_exports.h" + +/* ----------------------------------------------------------------- */ diff --git a/modules/mod_map/mod_map.h b/modules/mod_map/mod_map.h new file mode 100644 index 0000000..c6e0a4d --- /dev/null +++ b/modules/mod_map/mod_map.h @@ -0,0 +1,130 @@ +/* + * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +/* --------------------------------------------------------------------------- */ + +#ifndef __MOD_MAP_H +#define __MOD_MAP_H + +/* --------------------------------------------------------------------------- */ + +#define G_WIDE 0 +#define G_WIDTH 0 +#define G_HEIGHT 1 +#define G_CENTER_X 2 +#define G_X_CENTER 2 +#define G_CENTER_Y 3 +#define G_Y_CENTER 3 +#define G_PITCH 4 +#define G_DEPTH 5 + +#define B_CLEAR 0x00000001 + +/* --------------------------------------------------------------------------- */ + +#ifndef __BGDC__ + +#include <stdio.h> + +#include "libgrbase.h" +#include "libvideo.h" +#include "libblit.h" +#include "libfont.h" + +#include "arrange.h" +#include "files.h" + +/* --------------------------------------------------------------------------- */ + +/* CABECERAS DE FICHEROS */ +#define MAP_MAGIC "map\x1A\x0D\x0A\x00" +#define M32_MAGIC "m32\x1A\x0D\x0A\x00" +#define M16_MAGIC "m16\x1A\x0D\x0A\x00" +#define M01_MAGIC "m01\x1A\x0D\x0A\x00" + +#define PAL_MAGIC "pal\x1A\x0D\x0A\x00" + +#define FNT_MAGIC "fnt\x1A\x0D\x0A\x00" +#define FNX_MAGIC "fnx\x1A\x0D\x0A\x00" + +#define FPG_MAGIC "fpg\x1A\x0D\x0A\x00" +#define F32_MAGIC "f32\x1A\x0D\x0A\x00" +#define F16_MAGIC "f16\x1A\x0D\x0A\x00" +#define F01_MAGIC "f01\x1A\x0D\x0A\x00" + +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + +typedef struct +{ + uint8_t magic[7] ; + uint8_t version ; + uint16_t width ; + uint16_t height ; + uint32_t code ; + int8_t name[32] ; +} +#ifdef __GNUC__ +__attribute__ ((packed)) +#endif +MAP_HEADER ; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif + +/* --------------------------------------------------------------------------- */ + +extern int gr_load_fpg( const char * filename ) ; +extern int gr_load_map( const char * filename ) ; +extern int gr_load_pal( const char * filename ) ; +extern int gr_load_png( const char * filename ) ; +extern int gr_load_pcx( const char * filename ) ; + +extern int gr_save_system_pal( const char * filename ) ; + +extern int gr_save_fpg( int libid, const char * filename ) ; +extern int gr_save_map( GRAPH * gr, char * filename ) ; +extern int gr_save_pal( const char * filename, PALETTE * pal ) ; +extern int gr_save_png( GRAPH * gr, const char * filename ) ; + +extern GRAPH * gr_read_png( const char * filename ); + +extern PALETTE * gr_read_pal( file * fp ) ; +extern PALETTE * gr_read_pal_with_gamma( file * fp ); + +extern int gr_font_load( char * filename ) ; +extern int gr_load_bdf( const char * filename ) ; +extern int gr_load_ttf( const char * filename, int size, int bpp, int fg, int bg ) ; +extern int gr_font_save( int fontid, const char * filename ) ; + +/* --------------------------------------------------------------------------- */ + +#endif +#endif diff --git a/modules/mod_map/mod_map_exports.h b/modules/mod_map/mod_map_exports.h new file mode 100644 index 0000000..a48311a --- /dev/null +++ b/modules/mod_map/mod_map_exports.h @@ -0,0 +1,280 @@ +/* + * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd) + * Copyright © 2002-2006 Fenix Team (Fenix) + * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix) + * + * This file is part of Bennu - Game Development + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + */ + +#ifndef __MOD_MAP_EXPORTS +#define __MOD_MAP_EXPORTS + +/* ----------------------------------------------------------------- */ + +#include "bgddl.h" + +/* --------------------------------------------------------------------------- */ + +#if defined(__BGDC__) || !defined(__STATIC__) + +/* ----------------------------------------------------------------- */ + +#include "mod_map.h" +#include "libfont.h" + +/* ----------------------------------------------------------------- */ + +DLCONSTANT __bgdexport( mod_map, constants_def )[] = +{ + { "G_WIDE" , TYPE_INT, G_WIDE }, /* Obsolete */ + { "G_WIDTH" , TYPE_INT, G_WIDTH }, + { "G_HEIGHT" , TYPE_INT, G_HEIGHT }, + { "G_CENTER_X" , TYPE_INT, G_CENTER_X }, + { "G_X_CENTER" , TYPE_INT, G_X_CENTER }, + { "G_CENTER_Y" , TYPE_INT, G_CENTER_Y }, + { "G_Y_CENTER" , TYPE_INT, G_Y_CENTER }, + { "G_PITCH" , TYPE_INT, G_PITCH }, + { "G_DEPTH" , TYPE_INT, G_DEPTH }, + + { "B_CLEAR" , TYPE_INT, B_CLEAR }, + + { "CHARSET_ISO8859" , TYPE_INT, CHARSET_ISO8859 }, + { "CHARSET_CP850" , TYPE_INT, CHARSET_CP850 }, + + { "NFB_VARIABLEWIDTH", TYPE_INT, 0 }, + { "NFB_FIXEDWIDTH" , TYPE_INT, NFB_FIXEDWIDTH }, + + { NULL , 0 , 0 } +} ; + +#endif + +/* --------------------------------------------------------------------------- */ + +DLSYSFUNCS __bgdexport( mod_map, functions_exports )[] = +{ + /* Bitmaps */ + FUNC( "MAP_BLOCK_COPY" , "IIIIIIIIII" , TYPE_INT , modmap_map_block_copy ), + FUNC( "MAP_PUT" , "IIIII" , TYPE_INT , modmap_map_put ), + FUNC( "MAP_XPUT" , "IIIIIIII" , TYPE_INT , modmap_map_xput ), + FUNC( "MAP_NEW" , "III" , TYPE_INT , modmap_new_map ), + FUNC( "MAP_NEW" , "IIII" , TYPE_INT , modmap_new_map_extend ), + FUNC( "MAP_CLEAR" , "III" , TYPE_INT , modmap_map_clear ), + FUNC( "MAP_CLONE" , "II" , TYPE_INT , modmap_map_clone ), + FUNC( "MAP_NAME" , "II" , TYPE_STRING , modmap_map_name ), + FUNC( "MAP_SET_NAME" , "IIS" , TYPE_INT , modmap_map_set_name ), + FUNC( "MAP_EXISTS" , "II" , TYPE_INT , modmap_map_exists ), + FUNC( "MAP_XPUTNP" , "IIIIIIIIII" , TYPE_INT , modmap_map_xputnp ), + FUNC( "MAP_DEL" , "II" , TYPE_INT , modmap_unload_map ), + FUNC( "MAP_UNLOAD" , "II" , TYPE_INT , modmap_unload_map ), + FUNC( "MAP_LOAD" , "S" , TYPE_INT , modmap_load_map ), + FUNC( "MAP_LOAD" , "SP" , TYPE_INT , modmap_bgload_map ), + FUNC( "MAP_SAVE" , "IIS" , TYPE_INT , modmap_save_map ), + FUNC( "MAP_BUFFER" , "II" , TYPE_POINTER , modmap_map_buffer ), + + /* FPG */ + FUNC( "FPG_ADD" , "IIII" , TYPE_INT , modmap_fpg_add ), + FUNC( "FPG_NEW" , "" , TYPE_INT , modmap_fpg_new ), + FUNC( "FPG_EXISTS" , "I" , TYPE_INT , modmap_fpg_exists ), + FUNC( "FPG_LOAD" , "S" , TYPE_INT , modmap_load_fpg ), + FUNC( "FPG_LOAD" , "SP" , TYPE_INT , modmap_bgload_fpg ), + FUNC( "FPG_SAVE" , "IS" , TYPE_INT , modmap_save_fpg ), + FUNC( "FPG_DEL" , "I" , TYPE_INT , modmap_unload_fpg ), + FUNC( "FPG_UNLOAD" , "I" , TYPE_INT , modmap_unload_fpg ), + + /* Palette */ + FUNC( "PAL_NEW" , "" , TYPE_INT , modmap_pal_create ), + FUNC( "PAL_DEL" , "I" , TYPE_INT , modmap_pal_unload ), + FUNC( "PAL_UNLOAD" , "I" , TYPE_INT , modmap_pal_unload ), + FUNC( "PAL_CLONE" , "I" , TYPE_INT , modmap_pal_clone ), + FUNC( "PAL_REFRESH" , "" , TYPE_INT , modmap_pal_refresh ), + FUNC( "PAL_REFRESH" , "I" , TYPE_INT , modmap_pal_refresh_2 ), + FUNC( "PAL_MAP_GETID" , "II" , TYPE_INT , modmap_pal_map_getid ), + FUNC( "PAL_MAP_ASSIGN" , "III" , TYPE_INT , modmap_pal_map_assign ), + FUNC( "PAL_MAP_REMOVE" , "II" , TYPE_INT , modmap_pal_map_remove ), + FUNC( "PAL_GET" , "IIP" , TYPE_INT , modmap_get_colors ), + FUNC( "PAL_GET" , "IIIP" , TYPE_INT , modmap_pal_get ), + FUNC( "PAL_SYS_SET" , "I" , TYPE_INT , modmap_set_system_pal ), + FUNC( "PAL_SYS_SET" , "P" , TYPE_INT , modmap_set_system_pal_raw ), + FUNC( "PAL_SET" , "IIP" , TYPE_INT , modmap_set_colors ), + FUNC( "PAL_SET" , "IIIP" , TYPE_INT , modmap_pal_set ), + FUNC( "PAL_SAVE" , "S" , TYPE_INT , modmap_save_system_pal ), + FUNC( "PAL_SAVE" , "SI" , TYPE_INT , modmap_save_pal ), + FUNC( "PAL_LOAD" , "S" , TYPE_INT , modmap_load_pal ), + FUNC( "PAL_LOAD" , "SP" , TYPE_INT , modmap_bgload_pal ), + + FUNC( "COLORS_SET" , "IIP" , TYPE_INT , modmap_set_colors ), + FUNC( "COLORS_SET" , "IIIP" , TYPE_INT , modmap_pal_set ), + FUNC( "COLORS_GET" , "IIP" , TYPE_INT , modmap_get_colors ), + FUNC( "COLORS_GET" , "IIIP" , TYPE_INT , modmap_pal_get ), + + FUNC( "PALETTE_ROLL" , "III" , TYPE_INT , modmap_roll_palette ), + FUNC( "PALETTE_CONVERT" , "IIP" , TYPE_INT , modmap_convert_palette ), + + FUNC( "COLOR_FIND" , "BBB" , TYPE_INT , modmap_find_color ), + FUNC( "COLOR_FIND" , "IBBB" , TYPE_INT , modmap_find_color2 ), + FUNC( "COLOR_FIND" , "IIBBB" , TYPE_INT , modmap_find_color3 ), + + FUNC( "RGB" , "IIBBB" , TYPE_INT , modmap_rgb_map ), + FUNC( "RGBA" , "IIBBBB" , TYPE_INT , modmap_rgba_map ), + FUNC( "RGB" , "BBBI" , TYPE_INT , modmap_rgb_depth ), + FUNC( "RGBA" , "BBBBI" , TYPE_INT , modmap_rgba_depth ), + FUNC( "RGB" , "BBB" , TYPE_INT , modmap_rgb ), + FUNC( "RGBA" , "BBBB" , TYPE_INT , modmap_rgba ), + + FUNC( "RGB_GET" , "IIIPPP" , TYPE_INT , modmap_get_rgb_map ), + FUNC( "RGBA_GET" , "IIIPPPP" , TYPE_INT , modmap_get_rgba_map ), + FUNC( "RGB_GET" , "IPPPI" , TYPE_INT , modmap_get_rgb_depth ), + FUNC( "RGBA_GET" , "IPPPPI" , TYPE_INT , modmap_get_rgba_depth ), + FUNC( "RGB_GET" , "IPPP" , TYPE_INT , modmap_get_rgb ), + FUNC( "RGBA_GET" , "IPPPP" , TYPE_INT , modmap_get_rgba ), + + FUNC( "FADE" , "IIII" , TYPE_INT , modmap_fade ), + FUNC( "FADE_ON" , "" , TYPE_INT , modmap_fade_on ), + FUNC( "FADE_OFF" , "" , TYPE_INT , modmap_fade_off ), + + /* Informacion de graficos */ + FUNC( "MAP_INFO_SET" , "IIII" , TYPE_INT , modmap_graphic_set ), + FUNC( "MAP_INFO_GET" , "III" , TYPE_INT , modmap_graphic_info ), + FUNC( "MAP_INFO" , "III" , TYPE_INT , modmap_graphic_info ), + + FUNC( "GRAPHIC_SET" , "IIII" , TYPE_INT , modmap_graphic_set ), + FUNC( "GRAPHIC_INFO" , "III" , TYPE_INT , modmap_graphic_info ), + + /* Puntos de control */ + FUNC( "POINT_GET" , "IIIPP" , TYPE_INT , modmap_get_point ), + FUNC( "POINT_SET" , "IIIII" , TYPE_INT , modmap_set_point ), + + FUNC( "CENTER_SET" , "IIII" , TYPE_INT , modmap_set_center ), + + /* Fonts */ + FUNC( "FNT_LOAD" , "S" , TYPE_INT , modmap_load_fnt ), + FUNC( "FNT_LOAD" , "SP" , TYPE_INT , modmap_bgload_fnt ), + FUNC( "FNT_UNLOAD" , "I" , TYPE_INT , modmap_unload_fnt ), + FUNC( "FNT_SAVE" , "IS" , TYPE_INT , modmap_save_fnt ), + FUNC( "FNT_NEW" , "I" , TYPE_INT , modmap_fnt_new ), + FUNC( "FNT_NEW" , "II" , TYPE_INT , modmap_fnt_new_charset ), + FUNC( "FNT_NEW" , "IIIIIIII" , TYPE_INT , modmap_fnt_new_from_bitmap), + + FUNC( "BDF_LOAD" , "S" , TYPE_INT , modmap_load_bdf ), + FUNC( "BDF_LOAD" , "SP" , TYPE_INT , modmap_bgload_bdf ), + + FUNC( "GLYPH_GET" , "II" , TYPE_INT , modmap_get_glyph ), + FUNC( "GLYPH_SET" , "IIII" , TYPE_INT , modmap_set_glyph ), + + /* Importacion de archivos graficos */ + FUNC( "PNG_LOAD" , "S" , TYPE_INT , modmap_load_png ), + FUNC( "PNG_LOAD" , "SP" , TYPE_INT , modmap_bgload_png ), + FUNC( "PCX_LOAD" , "S" , TYPE_INT , modmap_load_pcx ), + FUNC( "PCX_LOAD" , "SP" , TYPE_INT , modmap_bgload_pcx ), + + /* Exportacion de mapas Graficos */ + FUNC( "PNG_SAVE" , "IIS" , TYPE_INT , modmap_save_png ), + + /* ------------ Compatibility ------------ */ + + /* Mapas */ + FUNC( "NEW_MAP" , "III" , TYPE_INT , modmap_new_map ), + FUNC( "LOAD_MAP" , "S" , TYPE_INT , modmap_load_map ), + FUNC( "LOAD_MAP" , "SP" , TYPE_INT , modmap_bgload_map ), + FUNC( "UNLOAD_MAP" , "II" , TYPE_INT , modmap_unload_map ), + FUNC( "SAVE_MAP" , "IIS" , TYPE_INT , modmap_save_map ), + + /* Palette */ + FUNC( "NEW_PAL" , "" , TYPE_INT , modmap_pal_create ), + FUNC( "LOAD_PAL" , "S" , TYPE_INT , modmap_load_pal ), + FUNC( "LOAD_PAL" , "SP" , TYPE_INT , modmap_bgload_pal ), + FUNC( "UNLOAD_PAL" , "I" , TYPE_INT , modmap_pal_unload ), + FUNC( "SAVE_PAL" , "S" , TYPE_INT , modmap_save_system_pal ), + FUNC( "SAVE_PAL" , "SI" , TYPE_INT , modmap_save_pal ), + + FUNC( "SET_COLORS" , "IIP" , TYPE_INT , modmap_set_colors ), + FUNC( "SET_COLORS" , "IIIP" , TYPE_INT , modmap_pal_set ), + FUNC( "GET_COLORS" , "IIP" , TYPE_INT , modmap_get_colors ), + FUNC( "GET_COLORS" , "IIIP" , TYPE_INT , modmap_pal_get ), + + FUNC( "ROLL_PALETTE" , "III" , TYPE_INT , modmap_roll_palette ), + FUNC( "CONVERT_PALETTE" , "IIP" , TYPE_INT , modmap_convert_palette ), + + FUNC( "FIND_COLOR" , "BBB" , TYPE_INT , modmap_find_color ), + FUNC( "FIND_COLOR" , "IBBB" , TYPE_INT , modmap_find_color2 ), + FUNC( "FIND_COLOR" , "IIBBB" , TYPE_INT , modmap_find_color3 ), + + FUNC( "GET_RGB" , "IIIPPP" , TYPE_INT , modmap_get_rgb_map ), + FUNC( "GET_RGBA" , "IIIPPPP" , TYPE_INT , modmap_get_rgba_map ), + FUNC( "GET_RGB" , "IPPPI" , TYPE_INT , modmap_get_rgb_depth ), + FUNC( "GET_RGBA" , "IPPPPI" , TYPE_INT , modmap_get_rgba_depth ), + FUNC( "GET_RGB" , "IPPP" , TYPE_INT , modmap_get_rgb ), + FUNC( "GET_RGBA" , "IPPPP" , TYPE_INT , modmap_get_rgba ), + + /* FPG */ + FUNC( "NEW_FPG" , "" , TYPE_INT , modmap_fpg_new ), + FUNC( "LOAD_FPG" , "S" , TYPE_INT , modmap_load_fpg ), + FUNC( "LOAD_FPG" , "SP" , TYPE_INT , modmap_bgload_fpg ), + FUNC( "SAVE_FPG" , "IS" , TYPE_INT , modmap_save_fpg ), + FUNC( "UNLOAD_FPG" , "I" , TYPE_INT , modmap_unload_fpg ), + + /* Puntos de control */ + FUNC( "GET_POINT" , "IIIPP" , TYPE_INT , modmap_get_point ), + FUNC( "SET_POINT" , "IIIII" , TYPE_INT , modmap_set_point ), + FUNC( "SET_CENTER" , "IIII" , TYPE_INT , modmap_set_center ), + + /* Fonts */ + FUNC( "NEW_FNT" , "I" , TYPE_INT , modmap_fnt_new ), + FUNC( "NEW_FNT" , "II" , TYPE_INT , modmap_fnt_new_charset ), + FUNC( "NEW_FNT" , "IIIIIIII" , TYPE_INT , modmap_fnt_new_from_bitmap), + FUNC( "LOAD_FNT" , "S" , TYPE_INT , modmap_load_fnt ), + FUNC( "LOAD_FNT" , "SP" , TYPE_INT , modmap_bgload_fnt ), + FUNC( "UNLOAD_FNT" , "I" , TYPE_INT , modmap_unload_fnt ), + FUNC( "SAVE_FNT" , "IS" , TYPE_INT , modmap_save_fnt ), + FUNC( "LOAD_BDF" , "S" , TYPE_INT , modmap_load_bdf ), + FUNC( "LOAD_BDF" , "SP" , TYPE_INT , modmap_bgload_bdf ), + FUNC( "GET_GLYPH" , "II" , TYPE_INT , modmap_get_glyph ), + FUNC( "SET_GLYPH" , "IIII" , TYPE_INT , modmap_set_glyph ), + + /* Importacion de archivos graficos */ + FUNC( "LOAD_PNG" , "S" , TYPE_INT , modmap_load_png ), + FUNC( "LOAD_PNG" , "SP" , TYPE_INT , modmap_bgload_png ), + FUNC( "LOAD_PCX" , "S" , TYPE_INT , modmap_load_pcx ), + FUNC( "LOAD_PCX" , "SP" , TYPE_INT , modmap_bgload_pcx ), + + /* Exportacion de mapas Graficos */ + FUNC( "SAVE_PNG" , "IIS" , TYPE_INT , modmap_save_png ), + + FUNC( 0 , 0 , 0 , 0 ) +}; + +/* --------------------------------------------------------------------------- */ + +char * __bgdexport( mod_map, modules_dependency )[] = +{ + "libgrbase", + "libvideo", + "libblit", + "libfont", + NULL +}; + +/* --------------------------------------------------------------------------- */ + +#endif |