xblast-2.10.4/0000755000175000017500000000000010444637351012217 5ustar rhondaalfiexblast-2.10.4/m4/0000755000175000017500000000000010444637351012537 5ustar rhondaalfiexblast-2.10.4/m4/codeset.m40000644000175000017500000000135110372735174014431 0ustar rhondaalfie# codeset.m4 serial AM1 (gettext-0.10.40) dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) xblast-2.10.4/m4/gettext.m40000644000175000017500000005172510372735174014501 0ustar rhondaalfie# gettext.m4 serial 36 (gettext-0.14.3) dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The dnl default (if it is not specified or empty) is 'no-libtool'. dnl INTLSYMBOL should be 'external' for packages with no intl directory, dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_included_intl], ifelse([$1], [external], [no], [yes])) define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not dnl documented, we avoid it. ifelse(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. AM_NLS ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. dnl Add a version number to the cache macros. define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, [AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings;], [bindtextdomain ("", ""); return (gettext ("") != 0)]ifelse([$2], [need-ngettext], [ + (ngettext ("", "", 0) != 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no)]) if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return (gettext ("") != 0)]ifelse([$2], [need-ngettext], [ + (ngettext ("", "", 0) != 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) dnl Now see whether libintl exists and depends on libiconv. if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return (gettext ("") != 0)]ifelse([$2], [need-ngettext], [ + (ngettext ("", "", 0) != 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext_libintl=yes ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if test "$gt_cv_func_gnugettext_libc" = "yes" \ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Some extra flags are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE(HAVE_GETTEXT, 1, [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi AC_SUBST(INTLOBJS) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST(INTLLIBS) dnl Make all documented variables known to autoconf. AC_SUBST(LIBINTL) AC_SUBST(LTLIBINTL) AC_SUBST(POSUB) ]) dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. AC_DEFUN([AM_INTL_SUBDIR], [ AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([gt_GLIBC2])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([bh_C_SIGNED])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl AC_REQUIRE([gt_TYPE_WCHAR_T])dnl AC_REQUIRE([gt_TYPE_WINT_T])dnl AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_REQUIRE([gt_TYPE_INTMAX_T]) AC_REQUIRE([gt_PRINTF_POSIX]) AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([gl_GLIBC21])dnl AC_REQUIRE([gt_INTDIV0])dnl AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl AC_REQUIRE([gl_XSIZE])dnl AC_REQUIRE([gt_INTL_MACOSX])dnl AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ __fsetlocking]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). gt_CHECK_DECL(_snprintf, [#include ]) gt_CHECK_DECL(_snwprintf, [#include ]) dnl Use the *_unlocked functions only if they are declared. dnl (because some of them were defined without being declared in Solaris dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built dnl on Solaris 2.5.1 to run on Solaris 2.6). dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. gt_CHECK_DECL(feof_unlocked, [#include ]) gt_CHECK_DECL(fgets_unlocked, [#include ]) gt_CHECK_DECL(getc_unlocked, [#include ]) case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; *) HAVE_POSIX_PRINTF=0 ;; esac AC_SUBST([HAVE_POSIX_PRINTF]) if test "$ac_cv_func_asprintf" = yes; then HAVE_ASPRINTF=1 else HAVE_ASPRINTF=0 fi AC_SUBST([HAVE_ASPRINTF]) if test "$ac_cv_func_snprintf" = yes; then HAVE_SNPRINTF=1 else HAVE_SNPRINTF=0 fi AC_SUBST([HAVE_SNPRINTF]) if test "$ac_cv_func_wprintf" = yes; then HAVE_WPRINTF=1 else HAVE_WPRINTF=0 fi AC_SUBST([HAVE_WPRINTF]) AM_ICONV AM_LANGINFO_CODESET if test $ac_cv_header_locale_h = yes; then gt_LC_MESSAGES fi if test -n "$INTL_MACOSX_LIBS"; then CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" fi dnl intl/plural.c is generated from intl/plural.y. It requires bison, dnl because plural.y uses bison specific features. It requires at least dnl bison-1.26 because earlier versions generate a plural.c that doesn't dnl compile. dnl bison is only needed for the maintainer (who touches plural.y). But in dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put dnl the rule in general Makefile. Now, some people carelessly touch the dnl files or have a broken "make" program, hence the plural.c rule will dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not dnl present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else dnl Found it, now check the version. AC_MSG_CHECKING([version of bison]) changequote(<<,>>)dnl ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) changequote([,])dnl ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac AC_MSG_RESULT([$ac_prog_version]) fi if test $ac_verc_fail = yes; then INTLBISON=: fi ]) dnl Checks for special options needed on MacOS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ dnl Check for API introduced in MacOS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], gt_cv_func_CFPreferencesCopyAppValue, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" AC_TRY_LINK([#include ], [CFPreferencesCopyAppValue(NULL, NULL)], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in MacOS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no]) CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) dnl gt_CHECK_DECL(FUNC, INCLUDES) dnl Check whether a function is declared. AC_DEFUN([gt_CHECK_DECL], [ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, [AC_TRY_COMPILE([$2], [ #ifndef $1 char *p = (char *) $1; #endif ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) if test $ac_cv_have_decl_$1 = yes; then gt_value=1 else gt_value=0 fi AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) xblast-2.10.4/m4/glibc2.m40000644000175000017500000000135410372735174014150 0ustar rhondaalfie# glibc2.m4 serial 1 dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Test for the GNU C Library, version 2.0 or newer. # From Bruno Haible. AC_DEFUN([gt_GLIBC2], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, ac_cv_gnu_library_2, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2=yes, ac_cv_gnu_library_2=no) ] ) AC_SUBST(GLIBC2) GLIBC2="$ac_cv_gnu_library_2" ] ) xblast-2.10.4/m4/glibc21.m40000644000175000017500000000144510372735174014232 0ustar rhondaalfie# glibc21.m4 serial 3 dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. AC_DEFUN([gl_GLIBC21], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, ac_cv_gnu_library_2_1, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2_1=yes, ac_cv_gnu_library_2_1=no) ] ) AC_SUBST(GLIBC21) GLIBC21="$ac_cv_gnu_library_2_1" ] ) xblast-2.10.4/m4/iconv.m40000644000175000017500000000642610372735174014131 0ustar rhondaalfie# iconv.m4 serial AM4 (gettext-0.11.3) dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST(LIBICONV) AC_SUBST(LTLIBICONV) ]) AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- }[$]am_cv_proto_iconv) AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi ]) xblast-2.10.4/m4/intdiv0.m40000644000175000017500000000334010372735174014360 0ustar rhondaalfie# intdiv0.m4 serial 1 (gettext-0.11.3) dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([gt_INTDIV0], [ AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], gt_cv_int_divbyzero_sigfpe, [ AC_TRY_RUN([ #include #include static void #ifdef __cplusplus sigfpe_handler (int sig) #else sigfpe_handler (sig) int sig; #endif { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); } int x = 1; int y = 0; int z; int nan; int main () { signal (SIGFPE, sigfpe_handler); /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) signal (SIGTRAP, sigfpe_handler); #endif /* Linux/SPARC yields signal SIGILL. */ #if defined (__sparc__) && defined (__linux__) signal (SIGILL, sigfpe_handler); #endif z = x / y; nan = y / y; exit (1); } ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, [ # Guess based on the CPU. case "$host_cpu" in alpha* | i[34567]86 | m68k | s390*) gt_cv_int_divbyzero_sigfpe="guessing yes";; *) gt_cv_int_divbyzero_sigfpe="guessing no";; esac ]) ]) case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; *) value=0;; esac AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, [Define if integer division by zero raises signal SIGFPE.]) ]) xblast-2.10.4/m4/intmax.m40000644000175000017500000000174610372735174014313 0ustar rhondaalfie# intmax.m4 serial 2 (gettext-0.14.2) dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether the system has the 'intmax_t' type, but don't attempt to dnl find a replacement if it is lacking. AC_DEFUN([gt_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, [AC_TRY_COMPILE([ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) fi ]) xblast-2.10.4/m4/inttypes-pri.m40000644000175000017500000000200210372735174015444 0ustar rhondaalfie# inttypes-pri.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. # Define PRI_MACROS_BROKEN if exists and defines the PRI* # macros to non-string values. This is the case on AIX 4.3.3. AC_DEFUN([gt_INTTYPES_PRI], [ AC_REQUIRE([gt_HEADER_INTTYPES_H]) if test $gt_cv_header_inttypes_h = yes; then AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], gt_cv_inttypes_pri_broken, [ AC_TRY_COMPILE([#include #ifdef PRId32 char *p = PRId32; #endif ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) ]) fi if test "$gt_cv_inttypes_pri_broken" = yes; then AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, [Define if exists and defines unusable PRI* macros.]) fi ]) xblast-2.10.4/m4/inttypes.m40000644000175000017500000000147210372735174014666 0ustar rhondaalfie# inttypes.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_INTTYPES_H if exists and doesn't clash with # . AC_DEFUN([gt_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, [ AC_TRY_COMPILE( [#include #include ], [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) ]) if test $gt_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, [Define if exists and doesn't clash with .]) fi ]) xblast-2.10.4/m4/inttypes_h.m40000644000175000017500000000162310372735174015173 0ustar rhondaalfie# inttypes_h.m4 serial 6 dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) xblast-2.10.4/m4/isc-posix.m40000644000175000017500000000170610372735174014725 0ustar rhondaalfie# isc-posix.m4 serial 2 (gettext-0.11.2) dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # This file is not needed with autoconf-2.53 and newer. Remove it in 2005. # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) # still uses it. Otherwise, the use in gettext.m4 makes autoheader # give these diagnostics: # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX undefine([AC_ISC_POSIX]) AC_DEFUN([AC_ISC_POSIX], [ dnl This test replaces the obsolescent AC_ISC_POSIX kludge. AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) ] ) xblast-2.10.4/m4/lcmessage.m40000644000175000017500000000240410372735174014746 0ustar rhondaalfie# lcmessage.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995. # Check whether LC_MESSAGES is available in . AC_DEFUN([gt_LC_MESSAGES], [ AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)]) if test $gt_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi ]) xblast-2.10.4/m4/lib-ld.m40000644000175000017500000000653110372735174014153 0ustar rhondaalfie# lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] [re_direlt='/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(acl_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) xblast-2.10.4/m4/lib-link.m40000644000175000017500000005542610372735174014520 0ustar rhondaalfie# lib-link.m4 serial 6 (gettext-0.14.3) dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ(2.50) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, dnl hardcode_direct, hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Tell automake >= 1.10 to complain if config.rpath is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib$1-prefix], [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib$1-prefix don't search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) xblast-2.10.4/m4/lib-prefix.m40000644000175000017500000001231010372735174015041 0ustar rhondaalfie# lib-prefix.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) xblast-2.10.4/m4/longdouble.m40000644000175000017500000000205310372735174015135 0ustar rhondaalfie# longdouble.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether the compiler supports the 'long double' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_LONGDOUBLE], [ AC_CACHE_CHECK([for long double], gt_cv_c_long_double, [if test "$GCC" = yes; then gt_cv_c_long_double=yes else AC_TRY_COMPILE([ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ long double foo = 0.0; /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; ], , gt_cv_c_long_double=yes, gt_cv_c_long_double=no) fi]) if test $gt_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) fi ]) xblast-2.10.4/m4/longlong.m40000644000175000017500000000141610372735174014624 0ustar rhondaalfie# longlong.m4 serial 5 dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG if 'long long' works. AC_DEFUN([gl_AC_TYPE_LONG_LONG], [ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, [AC_TRY_LINK([long long ll = 1LL; int i = 63;], [long long llmax = (long long) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;], ac_cv_type_long_long=yes, ac_cv_type_long_long=no)]) if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the 'long long' type.]) fi ]) xblast-2.10.4/m4/nls.m40000644000175000017500000000353010372735174013600 0ustar rhondaalfie# nls.m4 serial 2 (gettext-0.14.3) dnl Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) ]) AC_DEFUN([AM_MKINSTALLDIRS], [ dnl Tell automake >= 1.10 to complain if mkinstalldirs is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])]) dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but $(top_srcdir). dnl Try to locate it. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; esac fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) ]) xblast-2.10.4/m4/po.m40000644000175000017500000004364310372735174013433 0ustar rhondaalfie# po.m4 serial 7 (gettext-0.14.3) dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AM_NLS])dnl dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU msgfmt. if test "$GMSGFMT" != ":"; then dnl If it is no GNU msgfmt we define it as : so that the dnl Makefiles still can work. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` AC_MSG_RESULT( [found $GMSGFMT program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi fi dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po fi AC_OUTPUT_COMMANDS([ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat < "$ac_file.tmp" if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" < /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" < #include /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, [ AC_EGREP_CPP(notposix, [ #if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif ], gt_cv_func_printf_posix="guessing no", gt_cv_func_printf_posix="guessing yes") ]) ]) case $gt_cv_func_printf_posix in *yes) AC_DEFINE(HAVE_POSIX_PRINTF, 1, [Define if your printf() function supports format strings with positions.]) ;; esac ]) xblast-2.10.4/m4/progtest.m40000644000175000017500000000555010372735174014657 0ustar rhondaalfie# progtest.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. AC_PREREQ(2.50) # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in ifelse([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) xblast-2.10.4/m4/sdl.m40000644000175000017500000001437010374427576013600 0ustar rhondaalfie# Configure paths for SDL # Sam Lantinga 9/21/99 # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl AC_DEFUN([AM_PATH_SDL], [dnl dnl Get the cflags and libraries from the sdl-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi AC_REQUIRE([AC_CANONICAL_TARGET]) PATH="$prefix/bin:$prefix/usr/bin:$PATH" AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl checks the results of sdl-config to some extent dnl rm -f conf.sdltest AC_TRY_RUN([ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_CXXFLAGS="" SDL_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) rm -f conf.sdltest ]) xblast-2.10.4/m4/signed.m40000644000175000017500000000115410372735174014255 0ustar rhondaalfie# signed.m4 serial 1 (gettext-0.10.40) dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([bh_C_SIGNED], [ AC_CACHE_CHECK([for signed], bh_cv_c_signed, [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) if test $bh_cv_c_signed = no; then AC_DEFINE(signed, , [Define to empty if the C compiler doesn't support this keyword.]) fi ]) xblast-2.10.4/m4/size_max.m40000644000175000017500000000364510372735174014632 0ustar rhondaalfie# size_max.m4 serial 2 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) result= AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif ], result=yes) if test -z "$result"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', dnl which is guaranteed to work from LONG_MIN to LONG_MAX. _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, [#include ], result=?) _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, [#include ], result=?) _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, [#include ], result=?) if test "$fits_in_uint" = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_TRY_COMPILE([#include extern size_t foo; extern unsigned long foo; ], [], fits_in_uint=0) fi if test -z "$result"; then if test "$fits_in_uint" = 1; then result="$res_hi$res_lo"U else result="$res_hi$res_lo"UL fi else dnl Shouldn't happen, but who knows... result='~(size_t)0' fi fi AC_MSG_RESULT([$result]) if test "$result" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) xblast-2.10.4/m4/stdint_h.m40000644000175000017500000000157310372735174014625 0ustar rhondaalfie# stdint_h.m4 serial 5 dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) xblast-2.10.4/m4/uintmax_t.m40000644000175000017500000000207610372735174015020 0ustar rhondaalfie# uintmax_t.m4 serial 9 dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. AC_PREREQ(2.13) # Define uintmax_t to 'unsigned long' or 'unsigned long long' # if it is not already defined in or . AC_DEFUN([gl_AC_TYPE_UINTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, [Define to unsigned long or unsigned long long if and don't define.]) else AC_DEFINE(HAVE_UINTMAX_T, 1, [Define if you have the 'uintmax_t' type in or .]) fi ]) xblast-2.10.4/m4/ulonglong.m40000644000175000017500000000161510372735174015012 0ustar rhondaalfie# ulonglong.m4 serial 4 dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], [ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], [unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, [Define if you have the 'unsigned long long' type.]) fi ]) xblast-2.10.4/m4/wchar_t.m40000644000175000017500000000132610372735174014434 0ustar rhondaalfie# wchar_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, [AC_TRY_COMPILE([#include wchar_t foo = (wchar_t)'\0';], , gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) fi ]) xblast-2.10.4/m4/wint_t.m40000644000175000017500000000130410372735174014305 0ustar rhondaalfie# wint_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether has the 'wint_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, [AC_TRY_COMPILE([#include wint_t foo = (wchar_t)'\0';], , gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) fi ]) xblast-2.10.4/m4/xsize.m40000644000175000017500000000064510372735174014152 0ustar rhondaalfie# xsize.m4 serial 3 dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_REQUIRE([AC_C_INLINE]) AC_CHECK_HEADERS(stdint.h) ]) xblast-2.10.4/po/0000755000175000017500000000000010444637351012635 5ustar rhondaalfiexblast-2.10.4/po/Makevars0000644000175000017500000000344110412562022014316 0ustar rhondaalfie# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Xblast authors # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = xblast-devel@lists.sourceforge.net # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = xblast-2.10.4/po/LINGUAS0000644000175000017500000000000610412562050013642 0ustar rhondaalfiede fr xblast-2.10.4/po/Makefile.in.in0000644000175000017500000003170710372735175015322 0ustar rhondaalfie# Makefile for PO directory in any package using GNU gettext. # Copyright (C) 1995-1997, 2000-2005 by Ulrich Drepper # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License but which still want to provide support for the GNU gettext # functionality. # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. # # Origin: gettext-0.14.3 PACKAGE = @PACKAGE@ VERSION = @VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ localedir = $(datadir)/locale gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = @MKINSTALLDIRS@ mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ MSGMERGE = msgmerge MSGMERGE_UPDATE = @MSGMERGE@ --update MSGINIT = msginit MSGCONV = msgconv MSGFILTER = msgfilter POFILES = @POFILES@ GMOFILES = @GMOFILES@ UPDATEPOFILES = @UPDATEPOFILES@ DUMMYPOFILES = @DUMMYPOFILES@ DISTFILES.common = Makefile.in.in remove-potcdate.sin \ $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ $(POFILES) $(GMOFILES) \ $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) POTFILES = \ CATALOGS = @CATALOGS@ # Makevars gets inserted here. (Don't remove this line!) .SUFFIXES: .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .po.mo: @echo "$(MSGFMT) -c -o $@ $<"; \ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo .sin.sed: sed -e '/^#/d' $< > t-$@ mv t-$@ $@ all: all-@USE_NLS@ all-yes: stamp-po all-no: # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because # we don't want to bother translators with empty POT files). We assume that # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. # In this case, stamp-po is a nop (i.e. a phony target). # stamp-po is a timestamp denoting the last time at which the CATALOGS have # been loosely updated. Its purpose is that when a developer or translator # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent # invocations of "make" will do nothing. This timestamp would not be necessary # if updating the $(CATALOGS) would always touch them; however, the rule for # $(POFILES) has been designed to not touch files that don't need to be # changed. stamp-po: $(srcdir)/$(DOMAIN).pot test ! -f $(srcdir)/$(DOMAIN).pot || \ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @test ! -f $(srcdir)/$(DOMAIN).pot || { \ echo "touch stamp-po" && \ echo timestamp > stamp-poT && \ mv stamp-poT stamp-po; \ } # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. # This target rebuilds $(DOMAIN).pot; it is an expensive operation. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ else \ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ fi; \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --msgid-bugs-address="$$msgid_bugs_address" test ! -f $(DOMAIN).po || { \ if test -f $(srcdir)/$(DOMAIN).pot; then \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ else \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ else \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ } # This rule has no dependencies: we don't need to update $(DOMAIN).pot at # every "make" invocation, only create it when it is missing. # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. $(srcdir)/$(DOMAIN).pot: $(MAKE) $(DOMAIN).pot-update # This target rebuilds a PO file if $(DOMAIN).pot has changed. # Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ if test -f "$(srcdir)/$${lang}.po"; then \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ else \ $(MAKE) $${lang}.po-create; \ fi install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ for file in $(DISTFILES.common) Makevars.template; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ for file in Makevars; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi install-data-no: all install-data-yes: all $(mkinstalldirs) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkinstalldirs) $(DESTDIR)$$dir; \ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ fi; \ done; \ done install-strip: install installdirs: installdirs-exec installdirs-data installdirs-exec: installdirs-data: installdirs-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi installdirs-data-no: installdirs-data-yes: $(mkinstalldirs) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkinstalldirs) $(DESTDIR)$$dir; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ fi; \ done; \ done # Define this as empty until I found a useful application. installcheck: uninstall: uninstall-exec uninstall-data uninstall-exec: uninstall-data: uninstall-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ for file in $(DISTFILES.common) Makevars.template; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi uninstall-data-no: uninstall-data-yes: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ done; \ done check: all info dvi ps pdf html tags TAGS ctags CTAGS ID: mostlyclean: rm -f remove-potcdate.sed rm -f stamp-poT rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES *.mo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(MAKE) update-po @$(MAKE) dist2 # This is a separate target because 'update-po' must be executed before. dist2: stamp-po $(DISTFILES) dists="$(DISTFILES)"; \ if test "$(PACKAGE)" = "gettext-tools"; then \ dists="$$dists Makevars.template"; \ fi; \ if test -f $(srcdir)/$(DOMAIN).pot; then \ dists="$$dists $(DOMAIN).pot stamp-po"; \ fi; \ if test -f $(srcdir)/ChangeLog; then \ dists="$$dists ChangeLog"; \ fi; \ for i in 0 1 2 3 4 5 6 7 8 9; do \ if test -f $(srcdir)/ChangeLog.$$i; then \ dists="$$dists ChangeLog.$$i"; \ fi; \ done; \ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ if test -f $$file; then \ cp -p $$file $(distdir) || exit 1; \ else \ cp -p $(srcdir)/$$file $(distdir) || exit 1; \ fi; \ done update-po: Makefile $(MAKE) $(DOMAIN).pot-update test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo # General rule for creating PO files. .nop.po-create: @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ exit 1 # General rule for updating PO files. .nop.po-update: @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ cd $(srcdir); \ if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ $(SHELL) ./config.status force: # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xblast-2.10.4/po/POTFILES.in0000644000175000017500000000616610372751770014425 0ustar rhondaalfie# List of source files which contain translatable strings. action.c action.h atom.c atom.h bomb.c bomb.h bot.c bot.h browse.c browse.h central.c central.h cfg_control.c cfg_control.h cfg_demo.c cfg_demo.h cfg_game.c cfg_game.h cfg_level.c cfg_level.h cfg_main.c cfg_main.h cfg_player.c cfg_player.h cfg_stat.c cfg_stat.h cfg_xblast.c cfg_xblast.h chat.c chat.h client.c client.h color.c color.h com.c com.h com_base.c com_base.h com_browse.c com_browse.h com_central.c com_central.h com_dg_client.c com_dg_client.h com_dg_server.c com_dg_server.h com_dgram.c com_dgram.h com_from_central.c com_from_central.h com_listen.c com_listen.h com_newgame.c com_newgame.h com_query.c com_query.h com_reply.c com_reply.h com_stream.c com_stream.h com_to_central.c com_to_central.h com_to_client.c com_to_client.h com_to_server.c com_to_server.h config.h dat_rating.c dat_rating.h debug.c debug.h demo.c demo.h event.c event.h func.c func.h game.c game.h game_client.c game_client.h game_demo.c game_demo.h game_local.c game_local.h game_server.c game_server.h geom.h gui.h image.c image.h info.c info.h ini_file.c ini_file.h intro.c intro.h introdat.c introdat.h level.c level.h map.c map.h menu.c menu.h menu_control.c menu_control.h menu_edit.c menu_edit.h menu_extras.c menu_extras.h menu_game.c menu_game.h menu_layout.h menu_level.c menu_level.h menu_network.c menu_network.h menu_player.c menu_player.h mi_base.c mi_base.h mi_button.c mi_button.h mi_color.c mi_color.h mi_combo.c mi_combo.h mi_cyclic.c mi_cyclic.h mi_host.c mi_host.h mi_int.c mi_int.h mi_keysym.c mi_keysym.h mi_label.c mi_label.h mi_map.c mi_map.h mi_player.c mi_player.h mi_stat.c mi_stat.h mi_string.c mi_string.h mi_tag.c mi_tag.h mi_toggle.c mi_toggle.h mi_tool.c mi_tool.h net_dgram.c net_dgram.h net_socket.c net_socket.h net_tele.c net_tele.h network.c network.h player.c player.h random.c random.h randomlib.c randomlib.h rating.h scramble.c scramble.h sdl_atom.c sdl_common.c sdl_common.h sdl_config.c sdl_config.h sdl_event.c sdl_event.h sdl_image.c sdl_image.h sdl_init.c sdl_joystick.c sdl_joystick.h sdl_keysym.c sdl_keysym.h sdl_msgbox.c sdl_pixmap.c sdl_pixmap.h sdl_ppm.c sdl_socket.c sdl_socket.h sdl_sound.c sdl_sound.h sdl_sprite.c sdl_sprite.h sdl_text.c sdl_text.h sdl_tile.c sdl_tile.h server.c server.h shrink.c shrink.h shrinkdat.h snd.h socket.h sprite.c sprite.h status.c status.h str_util.c str_util.h time.c timeval.h try.c user.c user.h util.c util.h version.c version.h w32_atom.c w32_color.h w32_common.c w32_common.h w32_config.c w32_config.h w32_event.c w32_event.h w32_image.c w32_image.h w32_init.c w32_joystick.c w32_joystick.h w32_keysym.c w32_keysym.h w32_mm.h w32_msgbox.c w32_pixmap.c w32_pixmap.h w32_sndsrv.c w32_sndsrv.h w32_socket.c w32_socket.h w32_sound.c w32_sprite.c w32_sprite.h w32_text.c w32_text.h w32_tile.c w32_tile.h x11_atom.c x11_common.c x11_common.h x11_config.c x11_config.h x11_event.c x11_event.h x11_joystick.c x11_joystick.h x11_msgbox.c x11_socket.c x11_socket.h x11_sound.c x11_sound.h x11c_image.c x11c_image.h x11c_init.c x11c_pixmap.c x11c_pixmap.h x11c_sprite.c x11c_sprite.h x11c_text.c x11c_text.h x11c_tile.c x11c_tile.h xblast.c xblast.h xbsndsrv.c xblast-2.10.4/po/Rules-quot0000644000175000017500000000337610372735175014654 0ustar rhondaalfie# Special Makefile rules for English message catalogs with quotation marks. DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot .SUFFIXES: .insert-header .po-update-en en@quot.po-create: $(MAKE) en@quot.po-update en@boldquot.po-create: $(MAKE) en@boldquot.po-update en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en .insert-header.po-update-en: @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ ll=`echo $$lang | sed -e 's/@.*//'`; \ LC_ALL=C; export LC_ALL; \ cd $(srcdir); \ if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "creation of $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi en@quot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header en@boldquot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header mostlyclean: mostlyclean-quot mostlyclean-quot: rm -f *.insert-header xblast-2.10.4/po/boldquot.sed0000644000175000017500000000033110372735175015163 0ustar rhondaalfies/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g s/“/“/g s/â€/â€/g s/‘/‘/g s/’/’/g xblast-2.10.4/po/de.po0000644000175000017500000006044310444625011013562 0ustar rhondaalfie# translation catalogue for xblast-tnt. # Copyright (C) 2006 Xblast authors # This file is distributed under the same license as the xblast-tnt package. # Gerfried Fuchs , 2006. # msgid "" msgstr "" "Project-Id-Version: xblast 2.10.3\n" "Report-Msgid-Bugs-To: xblast-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2006-06-11 15:51+0200\n" "PO-Revision-Date: 2006-06-16 16:59-0500\n" "Last-Translator: Gerfried Fuchs \n" "Language-Team: German \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-15\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: bomb.c:295 msgid "Napalm bomb" msgstr "Napalm-Bombe" #: bomb.c:296 #, fuzzy msgid "Instant bomb" msgstr "Anfängliche Mini-Bomben" #: bomb.c:298 msgid "Firecracker" msgstr "" #: bomb.c:300 msgid "Construction bomb" msgstr "" #: bomb.c:301 #, fuzzy msgid "Three bomb" msgstr "Eine Bombe" #: bomb.c:302 msgid "Grenade" msgstr "" #: bomb.c:303 msgid "Triangle bomb" msgstr "" #: bomb.c:304 msgid "Destruction bomb" msgstr "" #: bomb.c:305 msgid "Fungus bomb" msgstr "" #: bomb.c:306 msgid "Renovation bomb" msgstr "" #: bomb.c:307 #, fuzzy msgid "Pyro bomb" msgstr "Keine Bomben" #: bomb.c:309 msgid "Random bomb" msgstr "Zufällige Bombe" #: bomb.c:310 #, fuzzy msgid "Fast bomb" msgstr "Eine Bombe" #: bomb.c:311 #, fuzzy msgid "Diagonal bomb" msgstr "Keine Bomben" #: bomb.c:312 msgid "Scissor bomb >" msgstr "" #: bomb.c:313 msgid "Scissor bomb <" msgstr "" #: bomb.c:314 msgid "Parallel bomb" msgstr "" #: bomb.c:315 msgid "Distance bomb" msgstr "" #: bomb.c:316 #, fuzzy msgid "Lucky bomb" msgstr "Eine Bombe" #: bomb.c:317 #, fuzzy msgid "Parasol bomb" msgstr "Keine Bomben" #: bomb.c:318 #, fuzzy msgid "Combo bomb" msgstr "Keine Bomben" #: bomb.c:319 #, fuzzy msgid "Farpyro bomb" msgstr "Keine Bomben" #: bomb.c:320 #, fuzzy msgid "Nuclear bomb" msgstr "Keine Bomben" #: bomb.c:321 #, fuzzy msgid "Protection bomb" msgstr "Permanente Mini-Bomben" #: bomb.c:322 msgid "Ring of Fire" msgstr "" #: bomb.c:323 msgid "Mine" msgstr "Mine" #: bomb.c:324 msgid "Row" msgstr "Reihe" #: bomb.c:325 msgid "Column" msgstr "Spalte" #: bomb.c:326 msgid "Psycho" msgstr "" #: bomb.c:546 #, c-format msgid "%s as default" msgstr "" #: bomb.c:552 #, c-format msgid "%s as an extra" msgstr "%s als Extra" #: bomb.c:560 msgid "All bombs are long fused" msgstr "" #: bomb.c:563 msgid "All bombs are short fused" msgstr "" #: bomb.c:575 msgid "All bombs are haunted" msgstr "" #: bomb.c:578 msgid "All bombs are haunted (and dangerous)" msgstr "" #: bomb.c:585 msgid "Bombs rebound from others" msgstr "" #: bomb.c:588 msgid "Bombs explode on contact with others" msgstr "" #: bomb.c:591 msgid "Bombs turn clockwise on hitting others" msgstr "" #: bomb.c:594 msgid "Bombs turn anticlockwise on hitting others" msgstr "" #: bomb.c:597 msgid "Bombs bounce off randomly from others" msgstr "" #: bomb.c:600 msgid "Bombs are snooker bombs" msgstr "Bomben sind Snooker-Bomben" #: bomb.c:604 msgid "Bombs split with contact off Bombs" msgstr "" #: bomb.c:608 msgid "Bombs rebound off walls" msgstr "Bomben prallen von der Wand ab" #: bomb.c:611 msgid "Bombs explode on contact with walls" msgstr "" #: bomb.c:614 msgid "Bombs turn clockwise on hitting walls" msgstr "" #: bomb.c:617 msgid "Bombs turn anticlockwise on hitting walls" msgstr "" #: bomb.c:620 msgid "Bombs bounce off randomly of walls" msgstr "" #: bomb.c:624 msgid "Bombs split with contact off Walls" msgstr "" #: bomb.c:628 msgid "Bombs stun players running through" msgstr "" #: bomb.c:631 msgid "Bombs explode on contact with players" msgstr "" #: bomb.c:634 msgid "Bombs rebound off players" msgstr "Bomben prallen von Spielern ab" #: bomb.c:638 msgid "Bombs split with contact off players" msgstr "" #: bomb.c:642 msgid "The Walls launch bombs" msgstr "Die Wände werfen Bomben" #: cfg_stat.c:369 msgid "All Levels" msgstr "Alle Level" #: cfg_stat.c:383 msgid "Draw Games" msgstr "Unentschieden" #: cfg_stat.c:386 msgid "Out of Time" msgstr "Zeit überschritten" #: func.c:37 msgid "No Special Extra" msgstr "" #: func.c:38 msgid "No Special Key" msgstr "" #: func.c:788 msgid "Airpump as an extra" msgstr "Luftpumpe als Extra" #: func.c:791 msgid "Bfarter as an extra" msgstr "" #: func.c:794 msgid "Choice as an extra" msgstr "" #: func.c:797 msgid "Cloak as an extra" msgstr "" #: func.c:800 msgid "Daleif as an extra" msgstr "" #: func.c:803 msgid "Electrify as an extra" msgstr "" #: func.c:806 msgid "Farter as an extra" msgstr "" #: func.c:809 msgid "Frogger as an extra" msgstr "" #: func.c:812 msgid "Ghost as an extra" msgstr "Geist als Extra" #: func.c:815 msgid "The Holy Grail as an extra" msgstr "" #: func.c:818 msgid "Button as an extra" msgstr "" #: func.c:821 msgid "Invincibility as an extra" msgstr "Unsichtbarkeit als Extra" #: func.c:824 msgid "Jump as an extra" msgstr "Springen als Extra" #: func.c:827 msgid "Junkie virus as an extra" msgstr "Junkie-Virus als Extra" #: func.c:830 msgid "Kick as an extra" msgstr "" #: func.c:833 msgid "Free life as an extra" msgstr "Frei-Leben als Extra" #: func.c:836 msgid "Spinner as an extra" msgstr "" #: func.c:839 msgid "Mayhem (Kick & Run) as an extra" msgstr "" #: func.c:842 msgid "Morphing as an extra" msgstr "Verwandeln als Extra" #: func.c:845 msgid "Random special extra" msgstr "Zufälliges Spezial-Extra" #: func.c:848 msgid "Phantom as an extra" msgstr "Phantom als Extra" #: func.c:851 msgid "Poison as an extra" msgstr "Gift als Extra" #: func.c:854 msgid "Remote control as an extra" msgstr "Fernbedienung als Extra" #: func.c:857 msgid "Revive control as an extra" msgstr "" #: func.c:860 msgid "Snipe as an extra" msgstr "" #: func.c:863 func.c:884 msgid "Stop as an extra" msgstr "Stop als Extra" #: func.c:866 msgid "Sucker as an extra" msgstr "" #: func.c:869 msgid "Swapcolor as an extra" msgstr "Farbtausch als Extra" #: func.c:872 msgid "Swapposition as an extra" msgstr "Positionstausch als Extra" #: func.c:875 msgid "Slowdown as an extra" msgstr "Langsam als Extra" #: func.c:878 msgid "Speed as an extra" msgstr "Schnell als Extra" #: func.c:881 msgid "SpeedII as an extra" msgstr "Schnell2 als Extra" #: func.c:887 msgid "Stunner as an extra" msgstr "" #: func.c:890 msgid "Teleporter as an extra" msgstr "Teleportieren als Extra" #: func.c:893 msgid "Through as an extra" msgstr "" #: game.c:628 msgid "Draw Game" msgstr "Unentschieden" #: intro.c:376 msgid "Loading ..." msgstr "Laden ..." #: intro.c:440 introdat.c:36 msgid "Press Space or Return" msgstr "Space oder Enter drücken" #: intro.c:890 msgid "Scoreboard" msgstr "" #: introdat.c:31 msgid "On a Workstation not far away" msgstr "Auf einem nicht weit entfernten Rechner" #: introdat.c:78 msgid "Coauthor Garth Denley" msgstr "Co-Autor Garth Denley" #: introdat.c:88 msgid "Sound by Norbert Nicolay" msgstr "Klang von Norbert Nicolay" #: introdat.c:130 menu.c:163 msgid "visit http://xblast.sf.net/" msgstr "Besucht http://xblast.sf.net/" #: introdat.c:154 menu_extras.c:308 msgid "Player Info" msgstr "Spieler-Info" #: introdat.c:212 msgid "Level Info" msgstr "Level-Info" #: introdat.c:270 msgid "Extra Info" msgstr "Extra-Info" #: map.c:208 msgid "Walls are invisible" msgstr "Wände sind unsichtbar" #: map.c:213 msgid "Extras all look the same" msgstr "Extras sehen alle gleich aus" #: map.c:216 msgid "Some walls are blastable" msgstr "" #: map.c:232 msgid "scarce" msgstr "vereinzelt" #: map.c:235 msgid "rare" msgstr "selten" #: map.c:238 msgid "uncommon" msgstr "unüblich" #: map.c:241 msgid "common" msgstr "üblich" #: map.c:244 msgid "plentiful" msgstr "reichlich" #: map.c:395 #, c-format msgid "Bomb extras are %s" msgstr "Bomben-Extras sind %s" #: map.c:398 #, c-format msgid "Rang extras are %s" msgstr "" #: map.c:401 #, c-format msgid "Infections are %s" msgstr "" #: map.c:404 #, c-format msgid "Special extras are %s" msgstr "Spezial-Extras sind %s" #: map.c:407 #, c-format msgid "Hidden bombs are %s" msgstr "Versteckte Bomben sind %s" #: menu.c:60 menu_game.c:172 menu_level.c:200 msgid "None" msgstr "Keines" #: menu.c:61 msgid "Beep" msgstr "" #: menu.c:62 msgid "Waveout" msgstr "" #: menu.c:68 msgid "No" msgstr "Nein" # XXX No - no ? #: menu.c:69 msgid "Yes" msgstr "Ja" # XXX Yes - yes ? #: menu.c:146 msgid "XBlast Main Menu" msgstr "XBlast Hauptmenü" #: menu.c:148 msgid "Start Local Game" msgstr "Lokales Spiel starten" #: menu.c:150 msgid "Create Network Game" msgstr "Netzwerkspiel erstellen" #: menu.c:152 menu_game.c:778 msgid "Join Network Game" msgstr "Netzwerkspiel beitreten" #: menu.c:154 msgid "Options" msgstr "Optionen" #: menu.c:156 menu_extras.c:481 msgid "Extras" msgstr "Extras" #: menu.c:158 msgid "Start Central" msgstr "" #: menu.c:162 msgid "to talk to others go to http://xblast.sf.net/irc/" msgstr "http://xblast.sf.net/irc/ besuchen und mit anderen reden" #: menu.c:165 msgid "Quit" msgstr "" #: menu.c:237 msgid "Sound Setup" msgstr "" #: menu.c:239 msgid "Mode:" msgstr "" #: menu.c:241 msgid "Stereo:" msgstr "Stereo:" #: menu.c:246 menu.c:288 menu.c:322 menu.c:358 menu_control.c:117 #: menu_control.c:169 menu_edit.c:1706 msgid "Cancel" msgstr "Abbrechen" #: menu.c:248 menu.c:290 menu.c:324 menu.c:362 menu_control.c:122 #: menu_control.c:174 menu_edit.c:246 menu_edit.c:356 menu_edit.c:527 #: menu_edit.c:582 menu_edit.c:810 menu_edit.c:1809 msgid "Ok" msgstr "" #: menu.c:284 msgid "Screen Setup" msgstr "" #: menu.c:285 msgid "Fullscreen:" msgstr "" #: menu.c:310 menu.c:344 msgid "Central Setup" msgstr "" #: menu.c:315 msgid "Hostname:" msgstr "" #: menu.c:316 menu.c:351 msgid "TCP-Port:" msgstr "TCP-Port:" #: menu.c:326 msgid "Select Central" msgstr "" #: menu.c:349 msgid "Hostname List:" msgstr "" #: menu.c:359 msgid "Enter Manually" msgstr "Manuell eingeben" #: menu.c:378 msgid "XBlast Options Menu" msgstr "" #: menu.c:380 menu_extras.c:392 msgid "Players" msgstr "Spieler" #: menu.c:381 msgid "Controls" msgstr "" #: menu.c:382 msgid "Sound" msgstr "" #: menu.c:384 msgid "Video" msgstr "" #: menu.c:386 msgid "Central" msgstr "" #: menu.c:389 menu_extras.c:626 msgid "Main Menu" msgstr "Hauptmenü" #: menu_control.c:87 menu_control.c:161 msgid "Configure Keyboard" msgstr "Tastatur konfigurieren" #: menu_control.c:90 msgid "Go up:" msgstr "Nach oben:" #: menu_control.c:91 msgid "Drop Bomb:" msgstr "Bombe setzen:" #: menu_control.c:93 msgid "Go down:" msgstr "Nach unten:" #: menu_control.c:94 msgid "Special extra:" msgstr "" #: menu_control.c:96 msgid "Go left:" msgstr "Nach links:" #: menu_control.c:97 msgid "Pause game:" msgstr "Spiel pausieren:" #: menu_control.c:99 msgid "Go right:" msgstr "Nach rechts:" #: menu_control.c:100 msgid "Abort level:" msgstr "Level abbrechen:" #: menu_control.c:103 msgid "Laola:" msgstr "Laola:" #: menu_control.c:104 msgid "Looser:" msgstr "Looser:" #: menu_control.c:107 msgid "Stop:" msgstr "" #: menu_control.c:108 msgid "Cancel abort:" msgstr "" #: menu_control.c:110 msgid "Bot:" msgstr "Bot:" #: menu_control.c:111 msgid "Chat Send:" msgstr "" #: menu_control.c:113 msgid "Chat Start:" msgstr "" #: menu_control.c:114 msgid "Chat Cancel:" msgstr "" #: menu_control.c:119 msgid "Next" msgstr "" #: menu_control.c:171 msgid "Last" msgstr "" #: menu_control.c:193 msgid "Configure Controls" msgstr "" #: menu_control.c:196 menu_game.c:62 msgid "Right Keyboard" msgstr "Rechte Tastatur" #: menu_control.c:199 menu_game.c:63 msgid "Left Keyboard" msgstr "Linke Tastatur" #: menu_control.c:208 msgid "Options Menu" msgstr "" #: menu_edit.c:119 msgid "Save Level" msgstr "Level speichern" #: menu_edit.c:120 msgid "Name:" msgstr "Name:" #: menu_edit.c:122 menu_edit.c:245 menu_edit.c:355 menu_edit.c:525 #: menu_edit.c:581 menu_edit.c:808 menu_edit.c:1502 menu_edit.c:1807 msgid "Abort" msgstr "" #: menu_edit.c:124 menu_edit.c:1505 msgid "Save" msgstr "Speichern" #: menu_edit.c:237 menu_edit.c:1685 msgid "Edit Level Info" msgstr "Level-Infos editieren" #: menu_edit.c:238 msgid "Title:" msgstr "Titel:" #: menu_edit.c:240 msgid "Author:" msgstr "Autor:" #: menu_edit.c:242 msgid "Hint:" msgstr "Tipp:" #: menu_edit.c:319 msgid "Edit Bomb Settings" msgstr "Bomben-Einstellungen editieren" #: menu_edit.c:341 msgid "Default Bomb Type" msgstr "" #: menu_edit.c:343 msgid "Initial Range" msgstr "" #: menu_edit.c:345 msgid "Initial Bombs" msgstr "" #: menu_edit.c:347 msgid "Special Bombs" msgstr "" #: menu_edit.c:350 msgid "Special Bomb Type" msgstr "" #: menu_edit.c:352 msgid "Hidden Bomb Type" msgstr "" #: menu_edit.c:511 msgid "Edit Extras Settings" msgstr "" #: menu_edit.c:512 msgid "Extra Type" msgstr "" #: menu_edit.c:515 msgid "Key Type" msgstr "" #: menu_edit.c:518 msgid "Init Extra" msgstr "" #: menu_edit.c:520 msgid "Revive Extra" msgstr "" #: menu_edit.c:522 msgid "Init Kick" msgstr "" #: menu_edit.c:523 msgid "Rev Kick" msgstr "" #: menu_edit.c:572 msgid "Edit Nasty Walls" msgstr "" #: menu_edit.c:574 msgid "Nasty Walls:" msgstr "" #: menu_edit.c:576 msgid "Intensity" msgstr "" #: menu_edit.c:578 msgid "Range" msgstr "" #: menu_edit.c:600 menu_edit.c:1692 msgid "Edit Bombs" msgstr "Bomben editieren" #: menu_edit.c:601 msgid "General Settings" msgstr "Allgemeine Einstellungen" #: menu_edit.c:603 msgid "Nasty Walls" msgstr "" #: menu_edit.c:607 menu_extras.c:326 menu_extras.c:572 menu_game.c:688 #: menu_game.c:704 menu_game.c:732 menu_game.c:748 menu_game.c:792 msgid "Back" msgstr "Zurück" #: menu_edit.c:782 menu_edit.c:1686 msgid "Edit Shrink" msgstr "Schrumpfen editieren" #: menu_edit.c:794 msgid "Shrink Type" msgstr "Schrumpf-Typ" #: menu_edit.c:797 msgid "Use Scramble Draw" msgstr "" #: menu_edit.c:800 msgid "Scramble Draw Time (%)" msgstr "" #: menu_edit.c:802 msgid "Use Scramble Delete" msgstr "" #: menu_edit.c:804 msgid "Scramble DeleteTime (%)" msgstr "" #: menu_edit.c:1326 menu_edit.c:1486 msgid "Free Block" msgstr "" #: menu_edit.c:1340 msgid "Burned Block" msgstr "" #: menu_edit.c:1354 menu_edit.c:1489 msgid "Solid Block" msgstr "" #: menu_edit.c:1368 menu_edit.c:1490 msgid "Rising Block" msgstr "" #: menu_edit.c:1382 menu_edit.c:1491 msgid "Blastable Block" msgstr "" #: menu_edit.c:1396 menu_edit.c:1466 menu_edit.c:1499 msgid "Void Block" msgstr "" #: menu_edit.c:1410 msgid "Bomb Block" msgstr "" #: menu_edit.c:1424 msgid "Range Block" msgstr "" #: menu_edit.c:1438 msgid "Trap Block" msgstr "" #: menu_edit.c:1452 msgid "Special Block" msgstr "" #: menu_edit.c:1482 msgid "Select Block" msgstr "" #: menu_edit.c:1487 msgid "Shadowed Block" msgstr "" #: menu_edit.c:1493 msgid "Blasted Block" msgstr "" #: menu_edit.c:1494 msgid "Extra Bomb" msgstr "" #: menu_edit.c:1495 msgid "Extra Range" msgstr "" #: menu_edit.c:1496 msgid "Trap" msgstr "" #: menu_edit.c:1497 msgid "Special Extra" msgstr "" #: menu_edit.c:1503 menu_edit.c:1545 msgid "Apply" msgstr "" #: menu_edit.c:1538 msgid "Return" msgstr "" #: menu_edit.c:1540 msgid "Change Block" msgstr "Block ändern" #: menu_edit.c:1542 msgid "Change Colors" msgstr "Farben ändern" #: menu_edit.c:1610 msgid "exit" msgstr "" #: menu_edit.c:1684 msgid "Edit Level" msgstr "Level editieren" #: menu_edit.c:1689 msgid "Edit Special Extras" msgstr "" #: menu_edit.c:1695 msgid "Edit Graphics" msgstr "Grafiken editieren" #: menu_edit.c:1698 msgid "Edit Map" msgstr "Karte editieren" #: menu_edit.c:1703 msgid "Save as ..." msgstr "Speichern als ..." #: menu_edit.c:1777 msgid "Write something clever here" msgstr "Hier etwas Sinnvolles hinschreiben" #: menu_edit.c:1778 msgid "My name" msgstr "Mein Name" #: menu_edit.c:1779 msgid "My new level" msgstr "Mein neues Level" #: menu_edit.c:1802 msgid "Load Level" msgstr "Lade Level" #: menu_edit.c:1803 msgid "Level File:" msgstr "Level-Datei:" #: menu_edit.c:1820 menu_extras.c:621 msgid "Edit Levels" msgstr "Levels editieren" #: menu_edit.c:1821 msgid "Create New Level" msgstr "Neues Level erstellen" #: menu_edit.c:1823 msgid "Load Existing Level" msgstr "Vorhandenes Level laden" #: menu_edit.c:1825 menu_extras.c:613 msgid "Extras Menu" msgstr "" #: menu_extras.c:128 menu_extras.c:341 menu_extras.c:615 msgid "Player Statistics" msgstr "Spieler-Statistiken" #: menu_extras.c:142 menu_extras.c:355 msgid "Up" msgstr "" #: menu_extras.c:177 menu_extras.c:238 mi_stat.c:407 msgid "Level" msgstr "Level" #: menu_extras.c:194 menu_extras.c:221 msgid "Player" msgstr "Spieler" #: menu_extras.c:468 menu_extras.c:619 msgid "Demo Playback" msgstr "" #: menu_extras.c:528 msgid "Update finished!" msgstr "" #: menu_extras.c:560 msgid "Update statistics" msgstr "" #: menu_extras.c:568 msgid "Connected..." msgstr "Verbunden..." #: menu_extras.c:569 msgid "Receiving players..." msgstr "Empfange Spieler..." #: menu_extras.c:577 msgid "Unable to connect to central." msgstr "" #: menu_extras.c:579 msgid "Damn" msgstr "" #: menu_extras.c:617 msgid "Level Statistics" msgstr "Level-Statistiken" #: menu_extras.c:622 msgid "Central Statistics" msgstr "" #: menu_extras.c:623 msgid "Update Central Statistics" msgstr "" #: menu_game.c:61 #, fuzzy msgid "none" msgstr "Keines" #: menu_game.c:64 msgid "Joystick 1" msgstr "Joystick 1" #: menu_game.c:65 msgid "Joystick 2" msgstr "Joystick 2" #: menu_game.c:66 msgid "Joystick 3" msgstr "Joystick 3" #: menu_game.c:67 msgid "Joystick 4" msgstr "Joystick 4" #: menu_game.c:107 msgid "Alphabetic" msgstr "Alphabetisch" #: menu_game.c:108 msgid "Random" msgstr "Zufällig" #: menu_game.c:109 msgid "Time" msgstr "Zeit" #: menu_game.c:173 msgid "Team" msgstr "Team" #: menu_game.c:581 msgid "Lives:" msgstr "Leben:" #: menu_game.c:583 msgid "Victories:" msgstr "Siege:" #: menu_game.c:585 msgid "Frame Rate:" msgstr "" #: menu_game.c:589 msgid "Level Order:" msgstr "" #: menu_game.c:591 msgid "Info screen:" msgstr "Info-Schirm:" #: menu_game.c:593 menu_game.c:782 msgid "Record Demo:" msgstr "Demo aufnehmen:" #: menu_game.c:596 msgid "Maximum bots:" msgstr "" #: menu_game.c:599 msgid "Recom. Lives:" msgstr "" #: menu_game.c:601 menu_game.c:788 msgid "Music:" msgstr "Musik:" #: menu_game.c:605 msgid "Rated Game:" msgstr "" #: menu_game.c:691 menu_game.c:709 menu_network.c:1104 msgid "Start" msgstr "Starten" #: menu_game.c:697 msgid "Setup Local Game" msgstr "" #: menu_game.c:706 menu_game.c:750 msgid "Select Levels" msgstr "Level auswählen" #: menu_game.c:735 msgid "Cont." msgstr "" #: menu_game.c:741 msgid "Start Network Game" msgstr "Netzwerkspiel starten" #: menu_game.c:753 msgid "Continue" msgstr "" #: menu_game.c:786 msgid "Beep at start:" msgstr "" #: menu_game.c:794 msgid "Search Central" msgstr "" #: menu_game.c:797 msgid "Connect ..." msgstr "Verbinden ..." #: menu_game.c:800 msgid "Search LAN" msgstr "" #: menu_level.c:174 msgid "Level Selection" msgstr "Level-Auswahl" #: menu_level.c:193 msgid "Backward" msgstr "Zurück" #: menu_level.c:196 msgid "Forward" msgstr "Weiter" #: menu_level.c:199 msgid "All" msgstr "Alle" #: menu_network.c:1099 menu_network.c:1237 msgid "Disconnect" msgstr "" #: menu_network.c:1101 msgid "Kick out" msgstr "" #: menu_network.c:1234 #, fuzzy msgid "Chat with lamer Rado and others in http://xblast.sf.net/irc/" msgstr "http://xblast.sf.net/irc/ besuchen und mit anderen reden" #: mi_stat.c:288 msgid "Score" msgstr "" #: mi_stat.c:290 msgid "Avg. Score" msgstr "" #: mi_stat.c:291 mi_stat.c:336 msgid "# Won" msgstr "" #: mi_stat.c:292 mi_stat.c:337 #, c-format msgid "%% Won" msgstr "" #: mi_stat.c:293 mi_stat.c:338 msgid "# Total" msgstr "" #: mi_stat.c:334 msgid "Rating" msgstr "" #: mi_stat.c:335 msgid "Rank" msgstr "" #: mi_stat.c:372 msgid "Parameter" msgstr "Parameter" #: mi_stat.c:373 msgid "Value" msgstr "Wert" #: mi_stat.c:406 msgid "Date & Time" msgstr "" #: mi_stat.c:409 msgid "#players" msgstr "" #: mi_stat.c:442 msgid "Game" msgstr "" #: mi_stat.c:443 msgid "Host" msgstr "" #: mi_stat.c:444 msgid "Ping" msgstr "Ping" #: mi_stat.c:446 msgid "Version" msgstr "Version" #: mi_stat.c:447 msgid "#lives" msgstr "" #: mi_stat.c:448 msgid "#wins" msgstr "" #: mi_stat.c:449 msgid "FPS" msgstr "FPS" #: mi_tool.c:39 msgid "no" msgstr "Nein" #: mi_tool.c:40 msgid "yes" msgstr "Ja" #: player.c:236 msgid "Permanent random bombing" msgstr "" #: player.c:237 msgid "Permanent slowdown" msgstr "Permanentes Langsam" #: player.c:238 msgid "Permanent running" msgstr "Permanentes Laufen" #: player.c:239 msgid "Permanent mini bombs" msgstr "Permanente Mini-Bomben" #: player.c:240 player.c:253 msgid "No bomb while healthy" msgstr "" #: player.c:241 msgid "Permanent invisibility" msgstr "" #: player.c:242 msgid "Permanent malfunctions" msgstr "Permanente Fehlfunktionen" #: player.c:243 msgid "Permanent reverse controls" msgstr "" #: player.c:244 msgid "Permanent reverse(2) controls" msgstr "" #: player.c:245 msgid "Permanent random teleporting" msgstr "Permanentes zufälliges Teleportieren" #: player.c:249 msgid "Initial random bombing" msgstr "" #: player.c:250 msgid "Initial slowdown" msgstr "Anfängliches Langsam" #: player.c:251 msgid "Initial running" msgstr "Anfängliches Laufen" #: player.c:252 msgid "Initial mini bombs" msgstr "Anfängliche Mini-Bomben" #: player.c:254 msgid "Initial invisibility" msgstr "Anfängliche Unsichtbarkeit" #: player.c:255 msgid "Initial malfunctions" msgstr "Anfängliche Fehlfunktionen" #: player.c:256 msgid "Initial reverse controls" msgstr "" #: player.c:257 msgid "Initial reverse(2) controls" msgstr "" #: player.c:258 msgid "Initial random teleporting" msgstr "Anfängliches zufälliges Teleportieren" #: player.c:262 msgid "Revived with random bombing" msgstr "" #: player.c:263 msgid "Revived with slowdown" msgstr "Erholung mit Langsam" #: player.c:264 msgid "Revived with running" msgstr "Erholung mit Laufen" #: player.c:265 msgid "Revived with mini bombs" msgstr "Erholung mit Mini-Bomben" #: player.c:266 msgid "Revived with bombs while healthy" msgstr "" #: player.c:267 msgid "Revived with invisibility" msgstr "" #: player.c:268 msgid "Revived with malfunctions" msgstr "Erholung mit Fehlfunktionen" #: player.c:269 msgid "Revived with reverse controls" msgstr "" #: player.c:270 msgid "Revived with reverse(2) controls" msgstr "" #: player.c:271 msgid "Revived with random teleporting" msgstr "Erholung mit zufälligem Teleportieren" #: player.c:563 msgid "No bomb" msgstr "Keine Bomben" #: player.c:566 msgid "1 bomb" msgstr "Eine Bombe" #. TRANSLATORS: %d > 1 (multiple bombs only) #: player.c:570 #, c-format msgid "%d bombs" msgstr "%d Bomben" #: player.c:575 msgid "No initial range" msgstr "" #: player.c:578 msgid "Only mini bombs" msgstr "Nur Mini-Bomben" #: player.c:581 #, c-format msgid "Initial range %d" msgstr "" #: player.c:599 msgid "Daleif as default" msgstr "" #: player.c:602 msgid "Initial Daleif" msgstr "" #: player.c:606 msgid "Revived with Daleif" msgstr "" #: player.c:610 msgid "Remote control as default" msgstr "" #: player.c:613 msgid "Initial remote control" msgstr "Anfängliche Fernbedienung" #: player.c:617 msgid "Revived with remote control" msgstr "Erholung mit Fernbedienung" #: player.c:621 msgid "Jump as default" msgstr "" #: player.c:624 msgid "Initial Jump" msgstr "Anfängliches Springen" #: player.c:628 msgid "Revived with Jump" msgstr "Erholung mit Springen" #: player.c:632 msgid "Airpump as default" msgstr "" #: player.c:635 msgid "Initial airpump" msgstr "Anfängliche Luftpumpe" #: player.c:639 msgid "Revived with airpump" msgstr "Erholung mit Luftpumpe" #: player.c:643 msgid "Cloak as default" msgstr "" #: player.c:646 msgid "Initial cloak" msgstr "" #: player.c:650 msgid "Revived with cloak" msgstr "" #: player.c:654 player.c:657 msgid "Initial kick" msgstr "" #: player.c:661 msgid "Revived with kick" msgstr "" #: player.c:665 msgid "Morphing as default" msgstr "" #: player.c:668 msgid "Initial morphing" msgstr "Anfängliches Verwandeln" #: player.c:672 msgid "Revived with morphing" msgstr "Erholung mit Verwandeln" #: player.c:676 msgid "Throughing as default" msgstr "" #: player.c:679 msgid "Initial throughing" msgstr "" #: player.c:683 msgid "Revived with throughing" msgstr "" #: player.c:688 msgid "Sucker as default" msgstr "" #: player.c:691 msgid "Initial sucker" msgstr "" #: player.c:695 msgid "Revived with sucker" msgstr "" #: player.c:786 #, c-format msgid "%s wins" msgstr "" #: player.c:795 msgid "CONGRATULATIONS!" msgstr "GRATULIERE!" #: player.c:2720 msgid "Bot Activated" msgstr "Bot aktiviert" #: player.c:2723 msgid "Bot Deactivated" msgstr "Bot deaktiviert" #~ msgid "Right Keyboard:" #~ msgstr "Rechte Tastatur:" #~ msgid "Left Keyboard:" #~ msgstr "Linke Tastatur:" #~ msgid "bot:" #~ msgstr "Bot:" xblast-2.10.4/po/en@boldquot.header0000644000175000017500000000247110372735175016272 0ustar rhondaalfie# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # # This catalog furthermore displays the text between the quotation marks in # bold face, assuming the VT100/XTerm escape sequences. # xblast-2.10.4/po/en@quot.header0000644000175000017500000000226310372735175015430 0ustar rhondaalfie# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # xblast-2.10.4/po/fr.po0000644000175000017500000006271510443242102013600 0ustar rhondaalfie# French translations for xblast package # Traduction anglaise du package xblast. # Copyright (C) 2006 Frank Zago # This file is distributed under the same license as the xblast package. # msgid "" msgstr "" "Project-Id-Version: xblast 2.10.3\n" "Report-Msgid-Bugs-To: xblast-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2006-06-11 15:51+0200\n" "PO-Revision-Date: 2006-06-11 03:10+0200\n" "Last-Translator: fzago - frank [] zago net\n" "Language-Team: French\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: bomb.c:295 msgid "Napalm bomb" msgstr "Bombe au napalm" #: bomb.c:296 msgid "Instant bomb" msgstr "Bombe instantannée" #: bomb.c:298 msgid "Firecracker" msgstr "" #: bomb.c:300 msgid "Construction bomb" msgstr "" #: bomb.c:301 msgid "Three bomb" msgstr "3 bombes" #: bomb.c:302 msgid "Grenade" msgstr "Grenade" #: bomb.c:303 msgid "Triangle bomb" msgstr "" #: bomb.c:304 msgid "Destruction bomb" msgstr "" #: bomb.c:305 msgid "Fungus bomb" msgstr "" #: bomb.c:306 msgid "Renovation bomb" msgstr "" #: bomb.c:307 msgid "Pyro bomb" msgstr "Bombe pyro" #: bomb.c:309 msgid "Random bomb" msgstr "Bombe aléatoire" #: bomb.c:310 msgid "Fast bomb" msgstr "Bombe rapide" #: bomb.c:311 msgid "Diagonal bomb" msgstr "" #: bomb.c:312 msgid "Scissor bomb >" msgstr "" #: bomb.c:313 msgid "Scissor bomb <" msgstr "" #: bomb.c:314 msgid "Parallel bomb" msgstr "" #: bomb.c:315 msgid "Distance bomb" msgstr "" #: bomb.c:316 msgid "Lucky bomb" msgstr "Bombe chanceuse" #: bomb.c:317 msgid "Parasol bomb" msgstr "Bombe parasol" #: bomb.c:318 msgid "Combo bomb" msgstr "Bombe combo" #: bomb.c:319 msgid "Farpyro bomb" msgstr "" #: bomb.c:320 msgid "Nuclear bomb" msgstr "Bombe nucléaire" #: bomb.c:321 msgid "Protection bomb" msgstr "" #: bomb.c:322 msgid "Ring of Fire" msgstr "" #: bomb.c:323 msgid "Mine" msgstr "Mine" #: bomb.c:324 msgid "Row" msgstr "" #: bomb.c:325 msgid "Column" msgstr "" #: bomb.c:326 msgid "Psycho" msgstr "" #: bomb.c:546 #, c-format msgid "%s as default" msgstr "%s par défaut" #: bomb.c:552 #, c-format msgid "%s as an extra" msgstr "%s en extra" #: bomb.c:560 msgid "All bombs are long fused" msgstr "Mèches longues" #: bomb.c:563 msgid "All bombs are short fused" msgstr "mèches courtes" #: bomb.c:575 msgid "All bombs are haunted" msgstr "Les bombes sont hantées" #: bomb.c:578 msgid "All bombs are haunted (and dangerous)" msgstr "Les bombes sont hantées (et dangereuses)" #: bomb.c:585 msgid "Bombs rebound from others" msgstr "Bombes rebondissent sur les autres" #: bomb.c:588 msgid "Bombs explode on contact with others" msgstr "Bombes explosent au contact des autres" #: bomb.c:591 msgid "Bombs turn clockwise on hitting others" msgstr "" #: bomb.c:594 msgid "Bombs turn anticlockwise on hitting others" msgstr "" #: bomb.c:597 msgid "Bombs bounce off randomly from others" msgstr "Bombes rebondissent aléatoirement sur les autres" #: bomb.c:600 msgid "Bombs are snooker bombs" msgstr "Bombes boules de billard" #: bomb.c:604 msgid "Bombs split with contact off Bombs" msgstr "" #: bomb.c:608 msgid "Bombs rebound off walls" msgstr "Bombes rebondissent sur les murs" #: bomb.c:611 msgid "Bombs explode on contact with walls" msgstr "Bombes explosent au contact des murs" #: bomb.c:614 msgid "Bombs turn clockwise on hitting walls" msgstr "" #: bomb.c:617 msgid "Bombs turn anticlockwise on hitting walls" msgstr "" #: bomb.c:620 msgid "Bombs bounce off randomly of walls" msgstr "Bombes rebondissent aléatoirement sur les murs" #: bomb.c:624 msgid "Bombs split with contact off Walls" msgstr "" #: bomb.c:628 msgid "Bombs stun players running through" msgstr "" #: bomb.c:631 msgid "Bombs explode on contact with players" msgstr "Bombes explosent au contact des joueurs" #: bomb.c:634 msgid "Bombs rebound off players" msgstr "Bombes rebomdissent sur les joueurs" #: bomb.c:638 msgid "Bombs split with contact off players" msgstr "Bombes se divisent au contact des joueurs" #: bomb.c:642 msgid "The Walls launch bombs" msgstr "Les murs lancent des bombes" #: cfg_stat.c:369 msgid "All Levels" msgstr "Tous les niveaux" #: cfg_stat.c:383 msgid "Draw Games" msgstr "Matchs nul" #: cfg_stat.c:386 msgid "Out of Time" msgstr "Temps épuisé" # Spécial : #: func.c:37 msgid "No Special Extra" msgstr "Pas d'extra" # Spécial : #: func.c:38 msgid "No Special Key" msgstr "" #: func.c:788 msgid "Airpump as an extra" msgstr "" #: func.c:791 msgid "Bfarter as an extra" msgstr "" #: func.c:794 msgid "Choice as an extra" msgstr "" #: func.c:797 msgid "Cloak as an extra" msgstr "Camouflage en extra" #: func.c:800 msgid "Daleif as an extra" msgstr "Daleif en extra" #: func.c:803 msgid "Electrify as an extra" msgstr "" #: func.c:806 msgid "Farter as an extra" msgstr "" #: func.c:809 msgid "Frogger as an extra" msgstr "" #: func.c:812 msgid "Ghost as an extra" msgstr "" #: func.c:815 msgid "The Holy Grail as an extra" msgstr "" #: func.c:818 msgid "Button as an extra" msgstr "" #: func.c:821 msgid "Invincibility as an extra" msgstr "Invicibilité en extra" #: func.c:824 msgid "Jump as an extra" msgstr "Saut en extra" #: func.c:827 msgid "Junkie virus as an extra" msgstr "" #: func.c:830 msgid "Kick as an extra" msgstr "" #: func.c:833 msgid "Free life as an extra" msgstr "Vie supp. en extra" # Spécial : #: func.c:836 msgid "Spinner as an extra" msgstr "" #: func.c:839 msgid "Mayhem (Kick & Run) as an extra" msgstr "" #: func.c:842 msgid "Morphing as an extra" msgstr "" # Spécial : #: func.c:845 msgid "Random special extra" msgstr "Extra : aléatoire" #: func.c:848 msgid "Phantom as an extra" msgstr "Extra : fantome" #: func.c:851 msgid "Poison as an extra" msgstr "Extra : poison" #: func.c:854 msgid "Remote control as an extra" msgstr "Extra : télécommande" #: func.c:857 msgid "Revive control as an extra" msgstr "" # Spécial : #: func.c:860 msgid "Snipe as an extra" msgstr "" #: func.c:863 func.c:884 msgid "Stop as an extra" msgstr "Stop en extra" #: func.c:866 msgid "Sucker as an extra" msgstr "" #: func.c:869 msgid "Swapcolor as an extra" msgstr "" #: func.c:872 msgid "Swapposition as an extra" msgstr "" #: func.c:875 msgid "Slowdown as an extra" msgstr "" # Spécial : #: func.c:878 msgid "Speed as an extra" msgstr "Extra: accélération" # Spécial : #: func.c:881 msgid "SpeedII as an extra" msgstr "Extra: accélération II" #: func.c:887 msgid "Stunner as an extra" msgstr "" #: func.c:890 msgid "Teleporter as an extra" msgstr "" #: func.c:893 msgid "Through as an extra" msgstr "" #: game.c:628 msgid "Draw Game" msgstr "Match nul" #: intro.c:376 msgid "Loading ..." msgstr "Chargement ..." #: intro.c:440 introdat.c:36 msgid "Press Space or Return" msgstr "Appuyez sur espace ou entrée" #: intro.c:890 msgid "Scoreboard" msgstr "Tableau des scores" #: introdat.c:31 msgid "On a Workstation not far away" msgstr "Dans un ordinateur, pas très loin d'ici ..." #: introdat.c:78 msgid "Coauthor Garth Denley" msgstr "Co-auteur Garth Denley" #: introdat.c:88 msgid "Sound by Norbert Nicolay" msgstr "Sons par Norbert Nicolay" #: introdat.c:130 menu.c:163 msgid "visit http://xblast.sf.net/" msgstr "visitez http://xblast.sf.net/" #: introdat.c:154 menu_extras.c:308 msgid "Player Info" msgstr "Infos joueurs" #: introdat.c:212 msgid "Level Info" msgstr "Infos niveau" #: introdat.c:270 msgid "Extra Info" msgstr "Infos extras" #: map.c:208 msgid "Walls are invisible" msgstr "Murs invisibles" #: map.c:213 msgid "Extras all look the same" msgstr "Les extras se ressemblent" #: map.c:216 msgid "Some walls are blastable" msgstr "Certains murs sont destructibles" #: map.c:232 msgid "scarce" msgstr "exceptionnels" #: map.c:235 msgid "rare" msgstr "rares" #: map.c:238 msgid "uncommon" msgstr "peu courants" #: map.c:241 msgid "common" msgstr "courants" #: map.c:244 msgid "plentiful" msgstr "abondants" #: map.c:395 #, c-format msgid "Bomb extras are %s" msgstr "Bombes extras sont : %s" #: map.c:398 #, c-format msgid "Rang extras are %s" msgstr "" #: map.c:401 #, c-format msgid "Infections are %s" msgstr "Les maladies sont : %s" # Spécial : #: map.c:404 #, c-format msgid "Special extras are %s" msgstr "Les extras sont : %s" #: map.c:407 #, c-format msgid "Hidden bombs are %s" msgstr "Bombes cachées sont : %s" #: menu.c:60 menu_game.c:172 menu_level.c:200 msgid "None" msgstr "Aucun(e)" #: menu.c:61 msgid "Beep" msgstr "Bip" #: menu.c:62 msgid "Waveout" msgstr "Stéreo" #: menu.c:68 msgid "No" msgstr "Non" #: menu.c:69 msgid "Yes" msgstr "Oui" #: menu.c:146 msgid "XBlast Main Menu" msgstr "Menu principal" #: menu.c:148 msgid "Start Local Game" msgstr "Créer un jeu local" #: menu.c:150 msgid "Create Network Game" msgstr "Créer un jeu réseau" #: menu.c:152 menu_game.c:778 msgid "Join Network Game" msgstr "Joindre un jeu réseau" #: menu.c:154 msgid "Options" msgstr "Options" #: menu.c:156 menu_extras.c:481 msgid "Extras" msgstr "Extras" # Démarrer Central #: menu.c:158 msgid "Start Central" msgstr "Démarrer Central" #: menu.c:162 msgid "to talk to others go to http://xblast.sf.net/irc/" msgstr "Pour tchater avec d'autres joueurs, visitez http://xblast.sf.net/irc/" #: menu.c:165 msgid "Quit" msgstr "Quitter" #: menu.c:237 msgid "Sound Setup" msgstr "Configuration audio" #: menu.c:239 msgid "Mode:" msgstr "Mode:" #: menu.c:241 msgid "Stereo:" msgstr "Stéreo" #: menu.c:246 menu.c:288 menu.c:322 menu.c:358 menu_control.c:117 #: menu_control.c:169 menu_edit.c:1706 msgid "Cancel" msgstr "Annuler" #: menu.c:248 menu.c:290 menu.c:324 menu.c:362 menu_control.c:122 #: menu_control.c:174 menu_edit.c:246 menu_edit.c:356 menu_edit.c:527 #: menu_edit.c:582 menu_edit.c:810 menu_edit.c:1809 msgid "Ok" msgstr "Ok" #: menu.c:284 msgid "Screen Setup" msgstr "Configuration video" #: menu.c:285 msgid "Fullscreen:" msgstr "Plein écran:" #: menu.c:310 menu.c:344 msgid "Central Setup" msgstr "Configration Central" #: menu.c:315 msgid "Hostname:" msgstr "Machine :" #: menu.c:316 menu.c:351 msgid "TCP-Port:" msgstr "Port TCP :" # Démarrer Central #: menu.c:326 msgid "Select Central" msgstr "" #: menu.c:349 msgid "Hostname List:" msgstr "" #: menu.c:359 msgid "Enter Manually" msgstr "Entrer manuellement" #: menu.c:378 msgid "XBlast Options Menu" msgstr "Menu des options" #: menu.c:380 menu_extras.c:392 msgid "Players" msgstr "Joueurs" #: menu.c:381 msgid "Controls" msgstr "" #: menu.c:382 msgid "Sound" msgstr "Sons" #: menu.c:384 msgid "Video" msgstr "Vidéo" # Démarrer Central #: menu.c:386 msgid "Central" msgstr "Central" #: menu.c:389 menu_extras.c:626 msgid "Main Menu" msgstr "Menu principal" #: menu_control.c:87 menu_control.c:161 msgid "Configure Keyboard" msgstr "Configuration clavier" #: menu_control.c:90 msgid "Go up:" msgstr "Haut :" #: menu_control.c:91 msgid "Drop Bomb:" msgstr "Larguer bombe :" #: menu_control.c:93 msgid "Go down:" msgstr "Bas :" # Spécial : #: menu_control.c:94 msgid "Special extra:" msgstr "Spécial :" #: menu_control.c:96 msgid "Go left:" msgstr "Gauche :" #: menu_control.c:97 msgid "Pause game:" msgstr "Pause :" #: menu_control.c:99 msgid "Go right:" msgstr "Droite :" #: menu_control.c:100 msgid "Abort level:" msgstr "Abandon niveau :" #: menu_control.c:103 msgid "Laola:" msgstr "Laola :" #: menu_control.c:104 msgid "Looser:" msgstr "Perdant :" #: menu_control.c:107 msgid "Stop:" msgstr "Stop :" #: menu_control.c:108 msgid "Cancel abort:" msgstr "Annuler abandon :" #: menu_control.c:110 msgid "Bot:" msgstr "Bot :" #: menu_control.c:111 msgid "Chat Send:" msgstr "Envoyer message :" #: menu_control.c:113 msgid "Chat Start:" msgstr "" #: menu_control.c:114 msgid "Chat Cancel:" msgstr "Annuler message :" #: menu_control.c:119 msgid "Next" msgstr "Suivant" #: menu_control.c:171 msgid "Last" msgstr "Dernier" #: menu_control.c:193 msgid "Configure Controls" msgstr "" #: menu_control.c:196 menu_game.c:62 msgid "Right Keyboard" msgstr "Clavier droit" #: menu_control.c:199 menu_game.c:63 msgid "Left Keyboard" msgstr "Clavier gauche" #: menu_control.c:208 msgid "Options Menu" msgstr "Menu des options" #: menu_edit.c:119 msgid "Save Level" msgstr "Sauver niveau" #: menu_edit.c:120 msgid "Name:" msgstr "Nom :" #: menu_edit.c:122 menu_edit.c:245 menu_edit.c:355 menu_edit.c:525 #: menu_edit.c:581 menu_edit.c:808 menu_edit.c:1502 menu_edit.c:1807 msgid "Abort" msgstr "Annuler" #: menu_edit.c:124 menu_edit.c:1505 msgid "Save" msgstr "Enregistrer" #: menu_edit.c:237 menu_edit.c:1685 msgid "Edit Level Info" msgstr "Editer infos niveau" #: menu_edit.c:238 msgid "Title:" msgstr "Nom du niveau :" #: menu_edit.c:240 msgid "Author:" msgstr "Auteur :" #: menu_edit.c:242 msgid "Hint:" msgstr "Indice :" #: menu_edit.c:319 msgid "Edit Bomb Settings" msgstr "" #: menu_edit.c:341 msgid "Default Bomb Type" msgstr "" #: menu_edit.c:343 msgid "Initial Range" msgstr "Portée initiale" #: menu_edit.c:345 msgid "Initial Bombs" msgstr "Bombes initiales" #: menu_edit.c:347 msgid "Special Bombs" msgstr "" #: menu_edit.c:350 msgid "Special Bomb Type" msgstr "" #: menu_edit.c:352 msgid "Hidden Bomb Type" msgstr "Type de bombes cachées" #: menu_edit.c:511 msgid "Edit Extras Settings" msgstr "" #: menu_edit.c:512 msgid "Extra Type" msgstr "Type extra" #: menu_edit.c:515 msgid "Key Type" msgstr "" #: menu_edit.c:518 msgid "Init Extra" msgstr "" #: menu_edit.c:520 msgid "Revive Extra" msgstr "" #: menu_edit.c:522 msgid "Init Kick" msgstr "Coup de pied initial" #: menu_edit.c:523 msgid "Rev Kick" msgstr "" #: menu_edit.c:572 msgid "Edit Nasty Walls" msgstr "" #: menu_edit.c:574 msgid "Nasty Walls:" msgstr "" #: menu_edit.c:576 msgid "Intensity" msgstr "" #: menu_edit.c:578 msgid "Range" msgstr "Portée" #: menu_edit.c:600 menu_edit.c:1692 msgid "Edit Bombs" msgstr "" #: menu_edit.c:601 msgid "General Settings" msgstr "" #: menu_edit.c:603 msgid "Nasty Walls" msgstr "" #: menu_edit.c:607 menu_extras.c:326 menu_extras.c:572 menu_game.c:688 #: menu_game.c:704 menu_game.c:732 menu_game.c:748 menu_game.c:792 msgid "Back" msgstr "Retour" #: menu_edit.c:782 menu_edit.c:1686 msgid "Edit Shrink" msgstr "" #: menu_edit.c:794 msgid "Shrink Type" msgstr "" #: menu_edit.c:797 msgid "Use Scramble Draw" msgstr "" #: menu_edit.c:800 msgid "Scramble Draw Time (%)" msgstr "" #: menu_edit.c:802 msgid "Use Scramble Delete" msgstr "" #: menu_edit.c:804 msgid "Scramble DeleteTime (%)" msgstr "" #: menu_edit.c:1326 menu_edit.c:1486 msgid "Free Block" msgstr "" #: menu_edit.c:1340 msgid "Burned Block" msgstr "" #: menu_edit.c:1354 menu_edit.c:1489 msgid "Solid Block" msgstr "" #: menu_edit.c:1368 menu_edit.c:1490 msgid "Rising Block" msgstr "" #: menu_edit.c:1382 menu_edit.c:1491 msgid "Blastable Block" msgstr "" #: menu_edit.c:1396 menu_edit.c:1466 menu_edit.c:1499 msgid "Void Block" msgstr "" #: menu_edit.c:1410 msgid "Bomb Block" msgstr "" #: menu_edit.c:1424 msgid "Range Block" msgstr "" #: menu_edit.c:1438 msgid "Trap Block" msgstr "" #: menu_edit.c:1452 msgid "Special Block" msgstr "" #: menu_edit.c:1482 msgid "Select Block" msgstr "Choix du bloc" #: menu_edit.c:1487 msgid "Shadowed Block" msgstr "" #: menu_edit.c:1493 msgid "Blasted Block" msgstr "" #: menu_edit.c:1494 msgid "Extra Bomb" msgstr "Bombe extra" #: menu_edit.c:1495 msgid "Extra Range" msgstr "Portée extra" #: menu_edit.c:1496 msgid "Trap" msgstr "" # Spécial : #: menu_edit.c:1497 msgid "Special Extra" msgstr "Extra spécial" #: menu_edit.c:1503 menu_edit.c:1545 msgid "Apply" msgstr "" #: menu_edit.c:1538 msgid "Return" msgstr "" #: menu_edit.c:1540 msgid "Change Block" msgstr "" #: menu_edit.c:1542 msgid "Change Colors" msgstr "" #: menu_edit.c:1610 msgid "exit" msgstr "sortie" #: menu_edit.c:1684 msgid "Edit Level" msgstr "Editer niveau" # Spécial : #: menu_edit.c:1689 msgid "Edit Special Extras" msgstr "Editer extras" #: menu_edit.c:1695 msgid "Edit Graphics" msgstr "" #: menu_edit.c:1698 msgid "Edit Map" msgstr "" #: menu_edit.c:1703 msgid "Save as ..." msgstr "Enregistrer sous ..." #: menu_edit.c:1777 msgid "Write something clever here" msgstr "Ecrivez quelquechose ici" #: menu_edit.c:1778 msgid "My name" msgstr "Mon nom" #: menu_edit.c:1779 msgid "My new level" msgstr "Mon nouveau niveau" #: menu_edit.c:1802 msgid "Load Level" msgstr "Charger niveau" #: menu_edit.c:1803 msgid "Level File:" msgstr "Fichier de niveau" #: menu_edit.c:1820 menu_extras.c:621 msgid "Edit Levels" msgstr "Editeur de niveaux" #: menu_edit.c:1821 msgid "Create New Level" msgstr "Créer un niveau" #: menu_edit.c:1823 msgid "Load Existing Level" msgstr "Charger niveau existant" #: menu_edit.c:1825 menu_extras.c:613 msgid "Extras Menu" msgstr "Menu extras" #: menu_extras.c:128 menu_extras.c:341 menu_extras.c:615 msgid "Player Statistics" msgstr "Statistiques joueurs" #: menu_extras.c:142 menu_extras.c:355 msgid "Up" msgstr "Retour" #: menu_extras.c:177 menu_extras.c:238 mi_stat.c:407 msgid "Level" msgstr "Niveau" #: menu_extras.c:194 menu_extras.c:221 msgid "Player" msgstr "Joueur" #: menu_extras.c:468 menu_extras.c:619 msgid "Demo Playback" msgstr "" #: menu_extras.c:528 msgid "Update finished!" msgstr "" #: menu_extras.c:560 msgid "Update statistics" msgstr "" #: menu_extras.c:568 msgid "Connected..." msgstr "" #: menu_extras.c:569 msgid "Receiving players..." msgstr "" #: menu_extras.c:577 msgid "Unable to connect to central." msgstr "" #: menu_extras.c:579 msgid "Damn" msgstr "" #: menu_extras.c:617 msgid "Level Statistics" msgstr "Statistiques par niveaux" #: menu_extras.c:622 msgid "Central Statistics" msgstr "Statistiques Central" #: menu_extras.c:623 msgid "Update Central Statistics" msgstr "" #: menu_game.c:61 msgid "none" msgstr "aucun(e)" #: menu_game.c:64 msgid "Joystick 1" msgstr "Joystick 1" #: menu_game.c:65 msgid "Joystick 2" msgstr "Joystick 2" #: menu_game.c:66 msgid "Joystick 3" msgstr "Joystick 3" #: menu_game.c:67 msgid "Joystick 4" msgstr "Joystick 4" #: menu_game.c:107 msgid "Alphabetic" msgstr "Alphabétique" #: menu_game.c:108 msgid "Random" msgstr "Aléatoire" #: menu_game.c:109 msgid "Time" msgstr "Durée" #: menu_game.c:173 msgid "Team" msgstr "Equipe" #: menu_game.c:581 msgid "Lives:" msgstr "Vies :" #: menu_game.c:583 msgid "Victories:" msgstr "Victoires :" #: menu_game.c:585 msgid "Frame Rate:" msgstr "" #: menu_game.c:589 msgid "Level Order:" msgstr "Choix des niveaux :" #: menu_game.c:591 msgid "Info screen:" msgstr "Ecran d'infos :" #: menu_game.c:593 menu_game.c:782 msgid "Record Demo:" msgstr "Enregistrer démo :" #: menu_game.c:596 msgid "Maximum bots:" msgstr "" #: menu_game.c:599 msgid "Recom. Lives:" msgstr "" #: menu_game.c:601 menu_game.c:788 msgid "Music:" msgstr "Musique :" #: menu_game.c:605 msgid "Rated Game:" msgstr "" #: menu_game.c:691 menu_game.c:709 menu_network.c:1104 msgid "Start" msgstr "Commencer" #: menu_game.c:697 msgid "Setup Local Game" msgstr "Configurer un jeu local" #: menu_game.c:706 menu_game.c:750 msgid "Select Levels" msgstr "Choix des niveaux" #: menu_game.c:735 msgid "Cont." msgstr "Cont." #: menu_game.c:741 msgid "Start Network Game" msgstr "Démarrer un jeu réseau" #: menu_game.c:753 msgid "Continue" msgstr "Continuer" #: menu_game.c:786 msgid "Beep at start:" msgstr "" # Démarrer Central #: menu_game.c:794 msgid "Search Central" msgstr "Chercher sur Central" #: menu_game.c:797 msgid "Connect ..." msgstr "" #: menu_game.c:800 msgid "Search LAN" msgstr "Cherche sur réseau local" #: menu_level.c:174 msgid "Level Selection" msgstr "Choix des niveaux" #: menu_level.c:193 msgid "Backward" msgstr "" #: menu_level.c:196 msgid "Forward" msgstr "" #: menu_level.c:199 msgid "All" msgstr "Tous" #: menu_network.c:1099 menu_network.c:1237 msgid "Disconnect" msgstr "" #: menu_network.c:1101 msgid "Kick out" msgstr "" #: menu_network.c:1234 #, fuzzy msgid "Chat with lamer Rado and others in http://xblast.sf.net/irc/" msgstr "Pour tchater avec d'autres joueurs, visitez http://xblast.sf.net/irc/" #: mi_stat.c:288 msgid "Score" msgstr "Score" #: mi_stat.c:290 msgid "Avg. Score" msgstr "Score moy." #: mi_stat.c:291 mi_stat.c:336 msgid "# Won" msgstr "nb Vict." #: mi_stat.c:292 mi_stat.c:337 #, c-format msgid "%% Won" msgstr "%% Vict." #: mi_stat.c:293 mi_stat.c:338 msgid "# Total" msgstr "nb total" #: mi_stat.c:334 msgid "Rating" msgstr "Classement" #: mi_stat.c:335 msgid "Rank" msgstr "Rang" #: mi_stat.c:372 msgid "Parameter" msgstr "Paramêtre" #: mi_stat.c:373 msgid "Value" msgstr "Valeur" #: mi_stat.c:406 msgid "Date & Time" msgstr "Date & heure" #: mi_stat.c:409 msgid "#players" msgstr "nb. Joueurs" #: mi_stat.c:442 msgid "Game" msgstr "Jeu" #: mi_stat.c:443 msgid "Host" msgstr "Machine" #: mi_stat.c:444 msgid "Ping" msgstr "Ping" #: mi_stat.c:446 msgid "Version" msgstr "Version" #: mi_stat.c:447 msgid "#lives" msgstr "nb vies :" #: mi_stat.c:448 msgid "#wins" msgstr "#Vict." #: mi_stat.c:449 msgid "FPS" msgstr "IPS" #: mi_tool.c:39 msgid "no" msgstr "non" #: mi_tool.c:40 msgid "yes" msgstr "oui" #: player.c:236 msgid "Permanent random bombing" msgstr "Bombardement aléatoire permanent" #: player.c:237 msgid "Permanent slowdown" msgstr "Ralentissemnt permanent" #: player.c:238 msgid "Permanent running" msgstr "Accélération permanente" #: player.c:239 msgid "Permanent mini bombs" msgstr "Mini bombes permanentes" #: player.c:240 player.c:253 msgid "No bomb while healthy" msgstr "" #: player.c:241 msgid "Permanent invisibility" msgstr "Invisibilité permanente" #: player.c:242 msgid "Permanent malfunctions" msgstr "" #: player.c:243 msgid "Permanent reverse controls" msgstr "Contrôle inversé permanent" #: player.c:244 msgid "Permanent reverse(2) controls" msgstr "Contrôle inversé permanent (2)" #: player.c:245 msgid "Permanent random teleporting" msgstr "Téléportation aléatoire permanente" #: player.c:249 msgid "Initial random bombing" msgstr "" #: player.c:250 msgid "Initial slowdown" msgstr "" #: player.c:251 msgid "Initial running" msgstr "" #: player.c:252 msgid "Initial mini bombs" msgstr "" #: player.c:254 msgid "Initial invisibility" msgstr "Invisibilité initiale" #: player.c:255 msgid "Initial malfunctions" msgstr "" #: player.c:256 msgid "Initial reverse controls" msgstr "" #: player.c:257 msgid "Initial reverse(2) controls" msgstr "" #: player.c:258 msgid "Initial random teleporting" msgstr "" #: player.c:262 msgid "Revived with random bombing" msgstr "Renaît avec bombardement aléatoire" #: player.c:263 msgid "Revived with slowdown" msgstr "Renaît avec ralentissement" #: player.c:264 msgid "Revived with running" msgstr "Renaît avec accélération" #: player.c:265 msgid "Revived with mini bombs" msgstr "Renaît avec les mini bombes" #: player.c:266 msgid "Revived with bombs while healthy" msgstr "" #: player.c:267 msgid "Revived with invisibility" msgstr "Renaît invisible" #: player.c:268 msgid "Revived with malfunctions" msgstr "" #: player.c:269 msgid "Revived with reverse controls" msgstr "Renaît avec les controles inversés" #: player.c:270 msgid "Revived with reverse(2) controls" msgstr "Renaît avec les controles inversés (2)" #: player.c:271 msgid "Revived with random teleporting" msgstr "Renaît avec la téléportation aléatoire" #: player.c:563 msgid "No bomb" msgstr "Sans bombe" #: player.c:566 msgid "1 bomb" msgstr "1 bombe" #. TRANSLATORS: %d > 1 (multiple bombs only) #: player.c:570 #, c-format msgid "%d bombs" msgstr "%d bombes" #: player.c:575 msgid "No initial range" msgstr "Pas de portée initiale" #: player.c:578 msgid "Only mini bombs" msgstr "Seulement des mini bombes" #: player.c:581 #, c-format msgid "Initial range %d" msgstr "Portée initiale %d" #: player.c:599 msgid "Daleif as default" msgstr "Avec Daleif" #: player.c:602 msgid "Initial Daleif" msgstr "Daleif initial" #: player.c:606 msgid "Revived with Daleif" msgstr "Renaît avec Daleif" #: player.c:610 msgid "Remote control as default" msgstr "Télécommande par défaut" #: player.c:613 msgid "Initial remote control" msgstr "Télécommande initale" #: player.c:617 msgid "Revived with remote control" msgstr "Renaît avec le télécommande" #: player.c:621 msgid "Jump as default" msgstr "" #: player.c:624 msgid "Initial Jump" msgstr "" #: player.c:628 msgid "Revived with Jump" msgstr "" #: player.c:632 msgid "Airpump as default" msgstr "Avec pompe à air" #: player.c:635 msgid "Initial airpump" msgstr "Pompe à air initiale" #: player.c:639 msgid "Revived with airpump" msgstr "Renaît avec la pompe à air" #: player.c:643 msgid "Cloak as default" msgstr "Camouflage par défaut" #: player.c:646 msgid "Initial cloak" msgstr "Camouflage initial" #: player.c:650 msgid "Revived with cloak" msgstr "Renaît avec camouflage" #: player.c:654 player.c:657 msgid "Initial kick" msgstr "Coup de pied initial" #: player.c:661 msgid "Revived with kick" msgstr "Renaît avec le coup de pied" #: player.c:665 msgid "Morphing as default" msgstr "" #: player.c:668 msgid "Initial morphing" msgstr "" #: player.c:672 msgid "Revived with morphing" msgstr "Renaît avec métamorphose" #: player.c:676 msgid "Throughing as default" msgstr "" #: player.c:679 msgid "Initial throughing" msgstr "" #: player.c:683 msgid "Revived with throughing" msgstr "" #: player.c:688 msgid "Sucker as default" msgstr "" #: player.c:691 msgid "Initial sucker" msgstr "" #: player.c:695 msgid "Revived with sucker" msgstr "" #: player.c:786 #, c-format msgid "%s wins" msgstr "%s gagne" #: player.c:795 msgid "CONGRATULATIONS!" msgstr "FELICITATIONS !" #: player.c:2720 msgid "Bot Activated" msgstr "Bot activé" #: player.c:2723 msgid "Bot Deactivated" msgstr "Bot désactivé" #~ msgid "Bot" #~ msgstr "Bot" #~ msgid "Right Keyboard:" #~ msgstr "Clavier droit :" #~ msgid "Left Keyboard:" #~ msgstr "Clavier gauche :" #~ msgid "bot:" #~ msgstr "bot :" xblast-2.10.4/po/insert-header.sin0000644000175000017500000000124010372735175016102 0ustar rhondaalfie# Sed script that inserts the file called HEADER before the header entry. # # At each occurrence of a line starting with "msgid ", we execute the following # commands. At the first occurrence, insert the file. At the following # occurrences, do nothing. The distinction between the first and the following # occurrences is achieved by looking at the hold space. /^msgid /{ x # Test if the hold space is empty. s/m/m/ ta # Yes it was empty. First occurrence. Read the file. r HEADER # Output the file's contents by reading the next line. But don't lose the # current line while doing this. g N bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } xblast-2.10.4/po/quot.sed0000644000175000017500000000023110372735175014321 0ustar rhondaalfies/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g xblast-2.10.4/po/remove-potcdate.sin0000644000175000017500000000066010372735175016453 0ustar rhondaalfie# Sed script that remove the POT-Creation-Date line in the header entry # from a POT file. # # The distinction between the first and the following occurrences of the # pattern is achieved by looking at the hold space. /^"POT-Creation-Date: .*"$/{ x # Test if the hold space is empty. s/P/P/ ta # Yes it was empty. First occurrence. Remove the line. g d bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } xblast-2.10.4/po/xblast.pot0000644000175000017500000005217010443242102014644 0ustar rhondaalfie# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Xblast authors # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: xblast-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2006-06-11 15:51+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: bomb.c:295 msgid "Napalm bomb" msgstr "" #: bomb.c:296 msgid "Instant bomb" msgstr "" #: bomb.c:298 msgid "Firecracker" msgstr "" #: bomb.c:300 msgid "Construction bomb" msgstr "" #: bomb.c:301 msgid "Three bomb" msgstr "" #: bomb.c:302 msgid "Grenade" msgstr "" #: bomb.c:303 msgid "Triangle bomb" msgstr "" #: bomb.c:304 msgid "Destruction bomb" msgstr "" #: bomb.c:305 msgid "Fungus bomb" msgstr "" #: bomb.c:306 msgid "Renovation bomb" msgstr "" #: bomb.c:307 msgid "Pyro bomb" msgstr "" #: bomb.c:309 msgid "Random bomb" msgstr "" #: bomb.c:310 msgid "Fast bomb" msgstr "" #: bomb.c:311 msgid "Diagonal bomb" msgstr "" #: bomb.c:312 msgid "Scissor bomb >" msgstr "" #: bomb.c:313 msgid "Scissor bomb <" msgstr "" #: bomb.c:314 msgid "Parallel bomb" msgstr "" #: bomb.c:315 msgid "Distance bomb" msgstr "" #: bomb.c:316 msgid "Lucky bomb" msgstr "" #: bomb.c:317 msgid "Parasol bomb" msgstr "" #: bomb.c:318 msgid "Combo bomb" msgstr "" #: bomb.c:319 msgid "Farpyro bomb" msgstr "" #: bomb.c:320 msgid "Nuclear bomb" msgstr "" #: bomb.c:321 msgid "Protection bomb" msgstr "" #: bomb.c:322 msgid "Ring of Fire" msgstr "" #: bomb.c:323 msgid "Mine" msgstr "" #: bomb.c:324 msgid "Row" msgstr "" #: bomb.c:325 msgid "Column" msgstr "" #: bomb.c:326 msgid "Psycho" msgstr "" #: bomb.c:546 #, c-format msgid "%s as default" msgstr "" #: bomb.c:552 #, c-format msgid "%s as an extra" msgstr "" #: bomb.c:560 msgid "All bombs are long fused" msgstr "" #: bomb.c:563 msgid "All bombs are short fused" msgstr "" #: bomb.c:575 msgid "All bombs are haunted" msgstr "" #: bomb.c:578 msgid "All bombs are haunted (and dangerous)" msgstr "" #: bomb.c:585 msgid "Bombs rebound from others" msgstr "" #: bomb.c:588 msgid "Bombs explode on contact with others" msgstr "" #: bomb.c:591 msgid "Bombs turn clockwise on hitting others" msgstr "" #: bomb.c:594 msgid "Bombs turn anticlockwise on hitting others" msgstr "" #: bomb.c:597 msgid "Bombs bounce off randomly from others" msgstr "" #: bomb.c:600 msgid "Bombs are snooker bombs" msgstr "" #: bomb.c:604 msgid "Bombs split with contact off Bombs" msgstr "" #: bomb.c:608 msgid "Bombs rebound off walls" msgstr "" #: bomb.c:611 msgid "Bombs explode on contact with walls" msgstr "" #: bomb.c:614 msgid "Bombs turn clockwise on hitting walls" msgstr "" #: bomb.c:617 msgid "Bombs turn anticlockwise on hitting walls" msgstr "" #: bomb.c:620 msgid "Bombs bounce off randomly of walls" msgstr "" #: bomb.c:624 msgid "Bombs split with contact off Walls" msgstr "" #: bomb.c:628 msgid "Bombs stun players running through" msgstr "" #: bomb.c:631 msgid "Bombs explode on contact with players" msgstr "" #: bomb.c:634 msgid "Bombs rebound off players" msgstr "" #: bomb.c:638 msgid "Bombs split with contact off players" msgstr "" #: bomb.c:642 msgid "The Walls launch bombs" msgstr "" #: cfg_stat.c:369 msgid "All Levels" msgstr "" #: cfg_stat.c:383 msgid "Draw Games" msgstr "" #: cfg_stat.c:386 msgid "Out of Time" msgstr "" #: func.c:37 msgid "No Special Extra" msgstr "" #: func.c:38 msgid "No Special Key" msgstr "" #: func.c:788 msgid "Airpump as an extra" msgstr "" #: func.c:791 msgid "Bfarter as an extra" msgstr "" #: func.c:794 msgid "Choice as an extra" msgstr "" #: func.c:797 msgid "Cloak as an extra" msgstr "" #: func.c:800 msgid "Daleif as an extra" msgstr "" #: func.c:803 msgid "Electrify as an extra" msgstr "" #: func.c:806 msgid "Farter as an extra" msgstr "" #: func.c:809 msgid "Frogger as an extra" msgstr "" #: func.c:812 msgid "Ghost as an extra" msgstr "" #: func.c:815 msgid "The Holy Grail as an extra" msgstr "" #: func.c:818 msgid "Button as an extra" msgstr "" #: func.c:821 msgid "Invincibility as an extra" msgstr "" #: func.c:824 msgid "Jump as an extra" msgstr "" #: func.c:827 msgid "Junkie virus as an extra" msgstr "" #: func.c:830 msgid "Kick as an extra" msgstr "" #: func.c:833 msgid "Free life as an extra" msgstr "" #: func.c:836 msgid "Spinner as an extra" msgstr "" #: func.c:839 msgid "Mayhem (Kick & Run) as an extra" msgstr "" #: func.c:842 msgid "Morphing as an extra" msgstr "" #: func.c:845 msgid "Random special extra" msgstr "" #: func.c:848 msgid "Phantom as an extra" msgstr "" #: func.c:851 msgid "Poison as an extra" msgstr "" #: func.c:854 msgid "Remote control as an extra" msgstr "" #: func.c:857 msgid "Revive control as an extra" msgstr "" #: func.c:860 msgid "Snipe as an extra" msgstr "" #: func.c:863 func.c:884 msgid "Stop as an extra" msgstr "" #: func.c:866 msgid "Sucker as an extra" msgstr "" #: func.c:869 msgid "Swapcolor as an extra" msgstr "" #: func.c:872 msgid "Swapposition as an extra" msgstr "" #: func.c:875 msgid "Slowdown as an extra" msgstr "" #: func.c:878 msgid "Speed as an extra" msgstr "" #: func.c:881 msgid "SpeedII as an extra" msgstr "" #: func.c:887 msgid "Stunner as an extra" msgstr "" #: func.c:890 msgid "Teleporter as an extra" msgstr "" #: func.c:893 msgid "Through as an extra" msgstr "" #: game.c:628 msgid "Draw Game" msgstr "" #: intro.c:376 msgid "Loading ..." msgstr "" #: intro.c:440 introdat.c:36 msgid "Press Space or Return" msgstr "" #: intro.c:890 msgid "Scoreboard" msgstr "" #: introdat.c:31 msgid "On a Workstation not far away" msgstr "" #: introdat.c:78 msgid "Coauthor Garth Denley" msgstr "" #: introdat.c:88 msgid "Sound by Norbert Nicolay" msgstr "" #: introdat.c:130 menu.c:163 msgid "visit http://xblast.sf.net/" msgstr "" #: introdat.c:154 menu_extras.c:308 msgid "Player Info" msgstr "" #: introdat.c:212 msgid "Level Info" msgstr "" #: introdat.c:270 msgid "Extra Info" msgstr "" #: map.c:208 msgid "Walls are invisible" msgstr "" #: map.c:213 msgid "Extras all look the same" msgstr "" #: map.c:216 msgid "Some walls are blastable" msgstr "" #: map.c:232 msgid "scarce" msgstr "" #: map.c:235 msgid "rare" msgstr "" #: map.c:238 msgid "uncommon" msgstr "" #: map.c:241 msgid "common" msgstr "" #: map.c:244 msgid "plentiful" msgstr "" #: map.c:395 #, c-format msgid "Bomb extras are %s" msgstr "" #: map.c:398 #, c-format msgid "Rang extras are %s" msgstr "" #: map.c:401 #, c-format msgid "Infections are %s" msgstr "" #: map.c:404 #, c-format msgid "Special extras are %s" msgstr "" #: map.c:407 #, c-format msgid "Hidden bombs are %s" msgstr "" #: menu.c:60 menu_game.c:172 menu_level.c:200 msgid "None" msgstr "" #: menu.c:61 msgid "Beep" msgstr "" #: menu.c:62 msgid "Waveout" msgstr "" #: menu.c:68 msgid "No" msgstr "" #: menu.c:69 msgid "Yes" msgstr "" #: menu.c:146 msgid "XBlast Main Menu" msgstr "" #: menu.c:148 msgid "Start Local Game" msgstr "" #: menu.c:150 msgid "Create Network Game" msgstr "" #: menu.c:152 menu_game.c:778 msgid "Join Network Game" msgstr "" #: menu.c:154 msgid "Options" msgstr "" #: menu.c:156 menu_extras.c:481 msgid "Extras" msgstr "" #: menu.c:158 msgid "Start Central" msgstr "" #: menu.c:162 msgid "to talk to others go to http://xblast.sf.net/irc/" msgstr "" #: menu.c:165 msgid "Quit" msgstr "" #: menu.c:237 msgid "Sound Setup" msgstr "" #: menu.c:239 msgid "Mode:" msgstr "" #: menu.c:241 msgid "Stereo:" msgstr "" #: menu.c:246 menu.c:288 menu.c:322 menu.c:358 menu_control.c:117 #: menu_control.c:169 menu_edit.c:1706 msgid "Cancel" msgstr "" #: menu.c:248 menu.c:290 menu.c:324 menu.c:362 menu_control.c:122 #: menu_control.c:174 menu_edit.c:246 menu_edit.c:356 menu_edit.c:527 #: menu_edit.c:582 menu_edit.c:810 menu_edit.c:1809 msgid "Ok" msgstr "" #: menu.c:284 msgid "Screen Setup" msgstr "" #: menu.c:285 msgid "Fullscreen:" msgstr "" #: menu.c:310 menu.c:344 msgid "Central Setup" msgstr "" #: menu.c:315 msgid "Hostname:" msgstr "" #: menu.c:316 menu.c:351 msgid "TCP-Port:" msgstr "" #: menu.c:326 msgid "Select Central" msgstr "" #: menu.c:349 msgid "Hostname List:" msgstr "" #: menu.c:359 msgid "Enter Manually" msgstr "" #: menu.c:378 msgid "XBlast Options Menu" msgstr "" #: menu.c:380 menu_extras.c:392 msgid "Players" msgstr "" #: menu.c:381 msgid "Controls" msgstr "" #: menu.c:382 msgid "Sound" msgstr "" #: menu.c:384 msgid "Video" msgstr "" #: menu.c:386 msgid "Central" msgstr "" #: menu.c:389 menu_extras.c:626 msgid "Main Menu" msgstr "" #: menu_control.c:87 menu_control.c:161 msgid "Configure Keyboard" msgstr "" #: menu_control.c:90 msgid "Go up:" msgstr "" #: menu_control.c:91 msgid "Drop Bomb:" msgstr "" #: menu_control.c:93 msgid "Go down:" msgstr "" #: menu_control.c:94 msgid "Special extra:" msgstr "" #: menu_control.c:96 msgid "Go left:" msgstr "" #: menu_control.c:97 msgid "Pause game:" msgstr "" #: menu_control.c:99 msgid "Go right:" msgstr "" #: menu_control.c:100 msgid "Abort level:" msgstr "" #: menu_control.c:103 msgid "Laola:" msgstr "" #: menu_control.c:104 msgid "Looser:" msgstr "" #: menu_control.c:107 msgid "Stop:" msgstr "" #: menu_control.c:108 msgid "Cancel abort:" msgstr "" #: menu_control.c:110 msgid "Bot:" msgstr "" #: menu_control.c:111 msgid "Chat Send:" msgstr "" #: menu_control.c:113 msgid "Chat Start:" msgstr "" #: menu_control.c:114 msgid "Chat Cancel:" msgstr "" #: menu_control.c:119 msgid "Next" msgstr "" #: menu_control.c:171 msgid "Last" msgstr "" #: menu_control.c:193 msgid "Configure Controls" msgstr "" #: menu_control.c:196 menu_game.c:62 msgid "Right Keyboard" msgstr "" #: menu_control.c:199 menu_game.c:63 msgid "Left Keyboard" msgstr "" #: menu_control.c:208 msgid "Options Menu" msgstr "" #: menu_edit.c:119 msgid "Save Level" msgstr "" #: menu_edit.c:120 msgid "Name:" msgstr "" #: menu_edit.c:122 menu_edit.c:245 menu_edit.c:355 menu_edit.c:525 #: menu_edit.c:581 menu_edit.c:808 menu_edit.c:1502 menu_edit.c:1807 msgid "Abort" msgstr "" #: menu_edit.c:124 menu_edit.c:1505 msgid "Save" msgstr "" #: menu_edit.c:237 menu_edit.c:1685 msgid "Edit Level Info" msgstr "" #: menu_edit.c:238 msgid "Title:" msgstr "" #: menu_edit.c:240 msgid "Author:" msgstr "" #: menu_edit.c:242 msgid "Hint:" msgstr "" #: menu_edit.c:319 msgid "Edit Bomb Settings" msgstr "" #: menu_edit.c:341 msgid "Default Bomb Type" msgstr "" #: menu_edit.c:343 msgid "Initial Range" msgstr "" #: menu_edit.c:345 msgid "Initial Bombs" msgstr "" #: menu_edit.c:347 msgid "Special Bombs" msgstr "" #: menu_edit.c:350 msgid "Special Bomb Type" msgstr "" #: menu_edit.c:352 msgid "Hidden Bomb Type" msgstr "" #: menu_edit.c:511 msgid "Edit Extras Settings" msgstr "" #: menu_edit.c:512 msgid "Extra Type" msgstr "" #: menu_edit.c:515 msgid "Key Type" msgstr "" #: menu_edit.c:518 msgid "Init Extra" msgstr "" #: menu_edit.c:520 msgid "Revive Extra" msgstr "" #: menu_edit.c:522 msgid "Init Kick" msgstr "" #: menu_edit.c:523 msgid "Rev Kick" msgstr "" #: menu_edit.c:572 msgid "Edit Nasty Walls" msgstr "" #: menu_edit.c:574 msgid "Nasty Walls:" msgstr "" #: menu_edit.c:576 msgid "Intensity" msgstr "" #: menu_edit.c:578 msgid "Range" msgstr "" #: menu_edit.c:600 menu_edit.c:1692 msgid "Edit Bombs" msgstr "" #: menu_edit.c:601 msgid "General Settings" msgstr "" #: menu_edit.c:603 msgid "Nasty Walls" msgstr "" #: menu_edit.c:607 menu_extras.c:326 menu_extras.c:572 menu_game.c:688 #: menu_game.c:704 menu_game.c:732 menu_game.c:748 menu_game.c:792 msgid "Back" msgstr "" #: menu_edit.c:782 menu_edit.c:1686 msgid "Edit Shrink" msgstr "" #: menu_edit.c:794 msgid "Shrink Type" msgstr "" #: menu_edit.c:797 msgid "Use Scramble Draw" msgstr "" #: menu_edit.c:800 msgid "Scramble Draw Time (%)" msgstr "" #: menu_edit.c:802 msgid "Use Scramble Delete" msgstr "" #: menu_edit.c:804 msgid "Scramble DeleteTime (%)" msgstr "" #: menu_edit.c:1326 menu_edit.c:1486 msgid "Free Block" msgstr "" #: menu_edit.c:1340 msgid "Burned Block" msgstr "" #: menu_edit.c:1354 menu_edit.c:1489 msgid "Solid Block" msgstr "" #: menu_edit.c:1368 menu_edit.c:1490 msgid "Rising Block" msgstr "" #: menu_edit.c:1382 menu_edit.c:1491 msgid "Blastable Block" msgstr "" #: menu_edit.c:1396 menu_edit.c:1466 menu_edit.c:1499 msgid "Void Block" msgstr "" #: menu_edit.c:1410 msgid "Bomb Block" msgstr "" #: menu_edit.c:1424 msgid "Range Block" msgstr "" #: menu_edit.c:1438 msgid "Trap Block" msgstr "" #: menu_edit.c:1452 msgid "Special Block" msgstr "" #: menu_edit.c:1482 msgid "Select Block" msgstr "" #: menu_edit.c:1487 msgid "Shadowed Block" msgstr "" #: menu_edit.c:1493 msgid "Blasted Block" msgstr "" #: menu_edit.c:1494 msgid "Extra Bomb" msgstr "" #: menu_edit.c:1495 msgid "Extra Range" msgstr "" #: menu_edit.c:1496 msgid "Trap" msgstr "" #: menu_edit.c:1497 msgid "Special Extra" msgstr "" #: menu_edit.c:1503 menu_edit.c:1545 msgid "Apply" msgstr "" #: menu_edit.c:1538 msgid "Return" msgstr "" #: menu_edit.c:1540 msgid "Change Block" msgstr "" #: menu_edit.c:1542 msgid "Change Colors" msgstr "" #: menu_edit.c:1610 msgid "exit" msgstr "" #: menu_edit.c:1684 msgid "Edit Level" msgstr "" #: menu_edit.c:1689 msgid "Edit Special Extras" msgstr "" #: menu_edit.c:1695 msgid "Edit Graphics" msgstr "" #: menu_edit.c:1698 msgid "Edit Map" msgstr "" #: menu_edit.c:1703 msgid "Save as ..." msgstr "" #: menu_edit.c:1777 msgid "Write something clever here" msgstr "" #: menu_edit.c:1778 msgid "My name" msgstr "" #: menu_edit.c:1779 msgid "My new level" msgstr "" #: menu_edit.c:1802 msgid "Load Level" msgstr "" #: menu_edit.c:1803 msgid "Level File:" msgstr "" #: menu_edit.c:1820 menu_extras.c:621 msgid "Edit Levels" msgstr "" #: menu_edit.c:1821 msgid "Create New Level" msgstr "" #: menu_edit.c:1823 msgid "Load Existing Level" msgstr "" #: menu_edit.c:1825 menu_extras.c:613 msgid "Extras Menu" msgstr "" #: menu_extras.c:128 menu_extras.c:341 menu_extras.c:615 msgid "Player Statistics" msgstr "" #: menu_extras.c:142 menu_extras.c:355 msgid "Up" msgstr "" #: menu_extras.c:177 menu_extras.c:238 mi_stat.c:407 msgid "Level" msgstr "" #: menu_extras.c:194 menu_extras.c:221 msgid "Player" msgstr "" #: menu_extras.c:468 menu_extras.c:619 msgid "Demo Playback" msgstr "" #: menu_extras.c:528 msgid "Update finished!" msgstr "" #: menu_extras.c:560 msgid "Update statistics" msgstr "" #: menu_extras.c:568 msgid "Connected..." msgstr "" #: menu_extras.c:569 msgid "Receiving players..." msgstr "" #: menu_extras.c:577 msgid "Unable to connect to central." msgstr "" #: menu_extras.c:579 msgid "Damn" msgstr "" #: menu_extras.c:617 msgid "Level Statistics" msgstr "" #: menu_extras.c:622 msgid "Central Statistics" msgstr "" #: menu_extras.c:623 msgid "Update Central Statistics" msgstr "" #: menu_game.c:61 msgid "none" msgstr "" #: menu_game.c:64 msgid "Joystick 1" msgstr "" #: menu_game.c:65 msgid "Joystick 2" msgstr "" #: menu_game.c:66 msgid "Joystick 3" msgstr "" #: menu_game.c:67 msgid "Joystick 4" msgstr "" #: menu_game.c:107 msgid "Alphabetic" msgstr "" #: menu_game.c:108 msgid "Random" msgstr "" #: menu_game.c:109 msgid "Time" msgstr "" #: menu_game.c:173 msgid "Team" msgstr "" #: menu_game.c:581 msgid "Lives:" msgstr "" #: menu_game.c:583 msgid "Victories:" msgstr "" #: menu_game.c:585 msgid "Frame Rate:" msgstr "" #: menu_game.c:589 msgid "Level Order:" msgstr "" #: menu_game.c:591 msgid "Info screen:" msgstr "" #: menu_game.c:593 menu_game.c:782 msgid "Record Demo:" msgstr "" #: menu_game.c:596 msgid "Maximum bots:" msgstr "" #: menu_game.c:599 msgid "Recom. Lives:" msgstr "" #: menu_game.c:601 menu_game.c:788 msgid "Music:" msgstr "" #: menu_game.c:605 msgid "Rated Game:" msgstr "" #: menu_game.c:691 menu_game.c:709 menu_network.c:1104 msgid "Start" msgstr "" #: menu_game.c:697 msgid "Setup Local Game" msgstr "" #: menu_game.c:706 menu_game.c:750 msgid "Select Levels" msgstr "" #: menu_game.c:735 msgid "Cont." msgstr "" #: menu_game.c:741 msgid "Start Network Game" msgstr "" #: menu_game.c:753 msgid "Continue" msgstr "" #: menu_game.c:786 msgid "Beep at start:" msgstr "" #: menu_game.c:794 msgid "Search Central" msgstr "" #: menu_game.c:797 msgid "Connect ..." msgstr "" #: menu_game.c:800 msgid "Search LAN" msgstr "" #: menu_level.c:174 msgid "Level Selection" msgstr "" #: menu_level.c:193 msgid "Backward" msgstr "" #: menu_level.c:196 msgid "Forward" msgstr "" #: menu_level.c:199 msgid "All" msgstr "" #: menu_network.c:1099 menu_network.c:1237 msgid "Disconnect" msgstr "" #: menu_network.c:1101 msgid "Kick out" msgstr "" #: menu_network.c:1234 msgid "Chat with lamer Rado and others in http://xblast.sf.net/irc/" msgstr "" #: mi_stat.c:288 msgid "Score" msgstr "" #: mi_stat.c:290 msgid "Avg. Score" msgstr "" #: mi_stat.c:291 mi_stat.c:336 msgid "# Won" msgstr "" #: mi_stat.c:292 mi_stat.c:337 #, c-format msgid "%% Won" msgstr "" #: mi_stat.c:293 mi_stat.c:338 msgid "# Total" msgstr "" #: mi_stat.c:334 msgid "Rating" msgstr "" #: mi_stat.c:335 msgid "Rank" msgstr "" #: mi_stat.c:372 msgid "Parameter" msgstr "" #: mi_stat.c:373 msgid "Value" msgstr "" #: mi_stat.c:406 msgid "Date & Time" msgstr "" #: mi_stat.c:409 msgid "#players" msgstr "" #: mi_stat.c:442 msgid "Game" msgstr "" #: mi_stat.c:443 msgid "Host" msgstr "" #: mi_stat.c:444 msgid "Ping" msgstr "" #: mi_stat.c:446 msgid "Version" msgstr "" #: mi_stat.c:447 msgid "#lives" msgstr "" #: mi_stat.c:448 msgid "#wins" msgstr "" #: mi_stat.c:449 msgid "FPS" msgstr "" #: mi_tool.c:39 msgid "no" msgstr "" #: mi_tool.c:40 msgid "yes" msgstr "" #: player.c:236 msgid "Permanent random bombing" msgstr "" #: player.c:237 msgid "Permanent slowdown" msgstr "" #: player.c:238 msgid "Permanent running" msgstr "" #: player.c:239 msgid "Permanent mini bombs" msgstr "" #: player.c:240 player.c:253 msgid "No bomb while healthy" msgstr "" #: player.c:241 msgid "Permanent invisibility" msgstr "" #: player.c:242 msgid "Permanent malfunctions" msgstr "" #: player.c:243 msgid "Permanent reverse controls" msgstr "" #: player.c:244 msgid "Permanent reverse(2) controls" msgstr "" #: player.c:245 msgid "Permanent random teleporting" msgstr "" #: player.c:249 msgid "Initial random bombing" msgstr "" #: player.c:250 msgid "Initial slowdown" msgstr "" #: player.c:251 msgid "Initial running" msgstr "" #: player.c:252 msgid "Initial mini bombs" msgstr "" #: player.c:254 msgid "Initial invisibility" msgstr "" #: player.c:255 msgid "Initial malfunctions" msgstr "" #: player.c:256 msgid "Initial reverse controls" msgstr "" #: player.c:257 msgid "Initial reverse(2) controls" msgstr "" #: player.c:258 msgid "Initial random teleporting" msgstr "" #: player.c:262 msgid "Revived with random bombing" msgstr "" #: player.c:263 msgid "Revived with slowdown" msgstr "" #: player.c:264 msgid "Revived with running" msgstr "" #: player.c:265 msgid "Revived with mini bombs" msgstr "" #: player.c:266 msgid "Revived with bombs while healthy" msgstr "" #: player.c:267 msgid "Revived with invisibility" msgstr "" #: player.c:268 msgid "Revived with malfunctions" msgstr "" #: player.c:269 msgid "Revived with reverse controls" msgstr "" #: player.c:270 msgid "Revived with reverse(2) controls" msgstr "" #: player.c:271 msgid "Revived with random teleporting" msgstr "" #: player.c:563 msgid "No bomb" msgstr "" #: player.c:566 msgid "1 bomb" msgstr "" #. TRANSLATORS: %d > 1 (multiple bombs only) #: player.c:570 #, c-format msgid "%d bombs" msgstr "" #: player.c:575 msgid "No initial range" msgstr "" #: player.c:578 msgid "Only mini bombs" msgstr "" #: player.c:581 #, c-format msgid "Initial range %d" msgstr "" #: player.c:599 msgid "Daleif as default" msgstr "" #: player.c:602 msgid "Initial Daleif" msgstr "" #: player.c:606 msgid "Revived with Daleif" msgstr "" #: player.c:610 msgid "Remote control as default" msgstr "" #: player.c:613 msgid "Initial remote control" msgstr "" #: player.c:617 msgid "Revived with remote control" msgstr "" #: player.c:621 msgid "Jump as default" msgstr "" #: player.c:624 msgid "Initial Jump" msgstr "" #: player.c:628 msgid "Revived with Jump" msgstr "" #: player.c:632 msgid "Airpump as default" msgstr "" #: player.c:635 msgid "Initial airpump" msgstr "" #: player.c:639 msgid "Revived with airpump" msgstr "" #: player.c:643 msgid "Cloak as default" msgstr "" #: player.c:646 msgid "Initial cloak" msgstr "" #: player.c:650 msgid "Revived with cloak" msgstr "" #: player.c:654 player.c:657 msgid "Initial kick" msgstr "" #: player.c:661 msgid "Revived with kick" msgstr "" #: player.c:665 msgid "Morphing as default" msgstr "" #: player.c:668 msgid "Initial morphing" msgstr "" #: player.c:672 msgid "Revived with morphing" msgstr "" #: player.c:676 msgid "Throughing as default" msgstr "" #: player.c:679 msgid "Initial throughing" msgstr "" #: player.c:683 msgid "Revived with throughing" msgstr "" #: player.c:688 msgid "Sucker as default" msgstr "" #: player.c:691 msgid "Initial sucker" msgstr "" #: player.c:695 msgid "Revived with sucker" msgstr "" #: player.c:786 #, c-format msgid "%s wins" msgstr "" #: player.c:795 msgid "CONGRATULATIONS!" msgstr "" #: player.c:2720 msgid "Bot Activated" msgstr "" #: player.c:2723 msgid "Bot Deactivated" msgstr "" xblast-2.10.4/ABOUT-NLS0000644000175000017500000020347410372735174013462 0ustar rhondaalfie1 Notes on the Free Translation Project *************************************** Free software is going international! The Free Translation Project is a way to get maintainers of free software, translators, and users all together, so that free software will gradually become able to speak many languages. A few packages already provide translations for their messages. If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, itself available at your nearest GNU archive site. But you do _not_ need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work on translations can contact the appropriate team. When reporting bugs in the `intl/' directory or bugs which may be related to internationalization, you should tell about the version of `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. 1.1 Quick configuration advice ============================== If you want to exploit the full power of internationalization, you should configure it using ./configure --with-included-gettext to force usage of internationalizing routines provided within this package, despite the existence of internationalizing capabilities in the operating system where this package is being installed. So far, only the `gettext' implementation in the GNU C library version 2 provides as many features (such as locale alias, message inheritance, automatic charset conversion or plural form handling) as the implementation here. It is also not possible to offer this additional functionality on top of a `catgets' implementation. Future versions of GNU `gettext' will very likely convey even more functionality. So it might be a good idea to change to GNU `gettext' as soon as possible. So you need _not_ provide this option if you are using GNU libc 2 or you have installed a recent copy of the GNU gettext package with the included `libintl'. 1.2 INSTALL Matters =================== Some packages are "localizable" when properly installed; the programs they contain can be made to speak your own native language. Most such packages use GNU `gettext'. Other packages have their own ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already provides the GNU `gettext' functions. If not, the included GNU `gettext' library will be used. This library is wholly contained within this package, usually in the `intl/' subdirectory, so prior installation of the GNU `gettext' package is _not_ required. Installers may use special options at configuration time for changing the default behaviour. The commands: ./configure --with-included-gettext ./configure --disable-nls will, respectively, bypass any pre-existing `gettext' to use the internationalizing routines provided within this package, or else, _totally_ disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will probably detect the previously built and installed `libintl.a' file and will decide to use this. This might not be desirable. You should use the more recent version of the GNU `gettext' library. I.e. if the file `intl/VERSION' shows that the library which comes with this package is more recent, you should use ./configure --with-included-gettext to prevent auto-detection. The configuration process will not test for the `catgets' function and therefore it will not be used. The reason is that even an emulation of `gettext' on top of `catgets' could not provide all the extensions of the GNU `gettext' library. Internationalized packages usually have many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at `configure' time by using the `--disable-nls' switch, all available translations are installed together with the package. However, the environment variable `LINGUAS' may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. 1.3 Using This Package ====================== As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate `LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, and `CC' is an ISO 3166 two-letter country code. For example, let's suppose that you speak German and live in Germany. At the shell prompt, merely execute `setenv LANG de_DE' (in `csh'), `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). This can be done from your `.login' or `.profile' file, once and for all. You might think that the country code specification is redundant. But in fact, some languages have dialects in different countries. For example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The country code serves to distinguish the dialects. The locale naming convention of `LL_CC', with `LL' denoting the language and `CC' denoting the country, is the one use on systems based on GNU libc. On other systems, some variations of this scheme are used, such as `LL' or `LL_CC.ENCODING'. You can get the list of locales supported by your system for your country by running the command `locale -a | grep '^LL''. Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. This is done through a different environment variable, called `LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' for the purpose of message handling, but you still need to have `LANG' set to the primary language; this is required by other parts of the system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. Special advice for Norwegian users: The language code for Norwegian bokma*l changed from `no' to `nb' recently (in 2003). During the transition period, while some message catalogs for this language are installed under `nb' and some older ones under `no', it's recommended for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and older translations are used. In the `LANGUAGE' environment variable, but not in the `LANG' environment variable, `LL_CC' combinations can be abbreviated as `LL' to denote the language's main dialect. For example, `de' is equivalent to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' (Portuguese as spoken in Portugal) in this context. 1.4 Translating Teams ===================== For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of teams can be found at the Free Translation Project's homepage, `http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" area. If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. The subscribing address is _not_ the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `translation@iro.umontreal.ca' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skill are praised more than programming skill, here. 1.5 Available Packages ====================== Languages are not equally supported in all packages. The following matrix shows the current state of internationalization, as of March 2005. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination, with a translation percentage of at least 50%. Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB +-------------------------------------------------+ GNUnet | | a2ps | [] [] [] [] [] | aegis | () | ant-phone | () | anubis | [] | ap-utils | | aspell | [] [] [] [] | bash | [] [] | batchelor | [] | bfd | [] | bibshelf | [] | binutils | [] | bison | [] [] | bluez-pin | [] [] [] [] | clisp | [] [] | console-tools | [] [] | coreutils | [] [] [] [] | cpio | | cpplib | [] [] [] | darkstat | [] () [] | dialog | [] [] [] [] [] [] | diffutils | [] [] [] [] [] | doodle | [] | e2fsprogs | [] [] | enscript | [] [] [] [] | error | [] [] [] [] | fetchmail | [] () [] [] [] | fileutils | [] [] | findutils | [] [] [] | flex | [] [] [] | fslint | [] | gas | | gawk | [] [] [] | gbiff | [] | gcal | [] | gcc | [] | gettext-examples | [] [] [] [] | gettext-runtime | [] [] [] [] | gettext-tools | [] [] | gimp-print | [] [] [] [] | gip | | gliv | [] | glunarclock | [] | gmult | [] [] | gnubiff | () | gnucash | [] () () [] | gnucash-glossary | [] () | gnupg | [] () [] [] | gpe-aerial | [] [] | gpe-beam | [] [] | gpe-calendar | [] [] | gpe-clock | [] [] | gpe-conf | [] [] | gpe-contacts | | gpe-edit | [] | gpe-go | [] | gpe-login | [] [] | gpe-ownerinfo | [] [] | gpe-sketchbook | [] [] | gpe-su | [] [] | gpe-taskmanager | [] [] | gpe-timesheet | [] | gpe-today | [] [] | gpe-todo | [] [] | gphoto2 | [] [] [] [] | gprof | [] [] | gpsdrive | () () | gramadoir | [] [] | grep | [] [] [] [] [] [] | gretl | | gsasl | [] | gss | | gst-plugins | [] [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] () | gtkspell | [] [] [] | hello | [] [] [] [] | id-utils | [] [] | impost | | indent | [] [] | iso_3166 | | iso_3166_1 | [] [] [] [] [] | iso_3166_2 | | iso_3166_3 | [] | iso_4217 | | iso_639 | | jpilot | [] | jtag | | jwhois | | kbd | [] [] [] [] | latrine | () | ld | [] | libc | [] [] [] [] [] | libextractor | | libgpewidget | [] [] [] | libgsasl | | libiconv | [] [] [] [] [] | libidn | | lifelines | [] () | lilypond | [] | lingoteach | | lynx | [] [] [] [] | m4 | [] [] [] [] | mailutils | [] | make | [] [] | man-db | [] () [] [] | minicom | [] [] | mysecretdiary | [] [] | nano | [] () [] | nano_1_0 | [] () [] [] | opcodes | [] | parted | [] [] [] [] | psmisc | | ptx | [] [] [] | pwdutils | | python | | radius | [] | recode | [] [] [] [] [] | rpm | [] [] | screem | | scrollkeeper | [] [] [] [] [] [] [] [] | sed | [] [] | sh-utils | [] [] | shared-mime-info | [] [] | sharutils | [] [] [] [] [] | silky | () | skencil | [] () | sketch | [] () | solfege | [] | soundtracker | [] [] | sp | [] | stardict | [] | tar | | texinfo | [] [] | textutils | [] [] [] | tin | () () | tp-robot | [] | tuxpaint | [] [] [] [] [] [] [] | unicode-han-tra... | | unicode-transla... | | util-linux | [] [] [] [] | vorbis-tools | [] [] [] [] | wastesedge | () | wdiff | [] [] [] [] | wget | [] [] [] [] [] [] | xchat | [] [] [] [] | xkeyboard-config | | xpad | | +-------------------------------------------------+ af am ar az be bg bs ca cs cy da de el en en_GB 10 0 0 2 7 4 0 42 43 3 53 92 21 1 15 eo es et eu fa fi fr ga gl he hr hu id is it +-----------------------------------------------+ GNUnet | | a2ps | [] [] [] () | aegis | | ant-phone | [] | anubis | [] | ap-utils | [] | aspell | [] [] | bash | [] [] [] [] | batchelor | [] [] | bfd | [] [] | bibshelf | [] [] [] | binutils | [] [] | bison | [] [] [] [] [] [] | bluez-pin | [] [] [] [] [] [] | clisp | [] [] | console-tools | | coreutils | [] [] [] [] [] | cpio | [] [] | cpplib | [] [] | darkstat | [] () [] [] [] | dialog | [] [] [] [] [] [] [] [] | diffutils | [] [] [] [] [] [] [] [] [] [] | doodle | [] [] | e2fsprogs | [] [] [] | enscript | [] [] | error | [] [] [] [] [] | fetchmail | [] | fileutils | [] [] [] [] [] [] | findutils | [] [] [] [] [] | flex | [] [] [] | fslint | [] | gas | [] [] | gawk | [] [] [] | gbiff | [] | gcal | [] [] | gcc | [] | gettext-examples | [] [] [] [] | gettext-runtime | [] [] [] [] [] [] | gettext-tools | [] [] | gimp-print | [] [] | gip | [] [] [] | gliv | () | glunarclock | [] [] [] | gmult | [] [] [] | gnubiff | () () | gnucash | [] () [] | gnucash-glossary | [] [] | gnupg | [] [] [] [] [] [] [] [] | gpe-aerial | [] [] | gpe-beam | [] [] | gpe-calendar | [] [] [] [] | gpe-clock | [] [] [] | gpe-conf | [] | gpe-contacts | [] | gpe-edit | [] [] | gpe-go | [] [] | gpe-login | [] [] [] | gpe-ownerinfo | [] [] [] [] [] | gpe-sketchbook | [] [] | gpe-su | [] [] [] | gpe-taskmanager | [] [] [] | gpe-timesheet | [] [] [] [] | gpe-today | [] [] [] [] | gpe-todo | [] [] [] | gphoto2 | [] [] [] [] [] | gprof | [] [] [] | gpsdrive | () () [] () | gramadoir | [] [] | grep | [] [] [] [] [] [] [] [] [] [] [] [] | gretl | [] [] [] | gsasl | [] [] [] | gss | [] | gst-plugins | [] [] [] | gstreamer | [] | gtick | [] [] [] [] [] | gtkspell | [] [] [] [] [] [] | hello | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | id-utils | [] [] [] [] | impost | [] [] | indent | [] [] [] [] [] [] [] [] [] [] [] | iso_3166 | [] [] | iso_3166_1 | [] [] [] [] [] [] | iso_3166_2 | [] | iso_3166_3 | [] | iso_4217 | [] [] | iso_639 | [] [] [] | jpilot | [] [] | jtag | [] | jwhois | [] [] [] [] [] | kbd | [] [] | latrine | [] [] [] | ld | [] [] | libc | [] [] [] [] [] | libextractor | | libgpewidget | [] [] [] [] [] | libgsasl | [] [] | libiconv | [] [] [] [] [] [] [] [] [] [] [] | libidn | [] [] | lifelines | () | lilypond | [] | lingoteach | [] [] [] | lynx | [] [] [] | m4 | [] [] [] [] | mailutils | [] [] | make | [] [] [] [] [] [] [] | man-db | () | minicom | [] [] [] [] | mysecretdiary | [] [] [] | nano | [] [] () [] [] | nano_1_0 | [] [] [] [] [] | opcodes | [] [] | parted | [] [] [] [] | psmisc | [] [] | ptx | [] [] [] [] [] [] [] [] [] | pwdutils | | python | | radius | [] [] | recode | [] [] [] [] [] [] [] [] | rpm | [] | screem | | scrollkeeper | [] [] | sed | [] [] [] [] [] | sh-utils | [] [] [] [] [] [] [] | shared-mime-info | [] [] [] [] [] [] | sharutils | [] [] [] [] [] [] [] | silky | () [] () () | skencil | [] [] | sketch | [] [] | solfege | [] | soundtracker | [] [] [] | sp | [] | stardict | [] | tar | [] [] [] [] [] | texinfo | [] [] [] | textutils | [] [] [] [] [] | tin | [] () | tp-robot | [] [] | tuxpaint | [] [] [] [] [] [] [] [] [] | unicode-han-tra... | | unicode-transla... | [] [] | util-linux | [] [] [] [] [] [] | vorbis-tools | [] [] | wastesedge | () | wdiff | [] [] [] [] [] [] [] [] | wget | [] [] [] [] [] [] [] [] [] [] | xchat | [] [] [] [] [] | xkeyboard-config | | xpad | [] [] [] | +-----------------------------------------------+ eo es et eu fa fi fr ga gl he hr hu id is it 14 86 22 15 2 31 117 44 18 8 6 40 28 1 45 ja ko lg lt lv mk mn ms mt nb nl nn no nso or +-----------------------------------------------+ GNUnet | | a2ps | () [] [] () | aegis | () | ant-phone | [] | anubis | [] [] [] | ap-utils | | aspell | [] [] | bash | [] | batchelor | [] | bfd | | bibshelf | | binutils | [] | bison | [] [] [] | bluez-pin | [] | clisp | [] | console-tools | | coreutils | [] [] | cpio | | cpplib | | darkstat | [] [] | dialog | [] | diffutils | [] [] [] | doodle | | e2fsprogs | | enscript | [] | error | [] | fetchmail | [] [] | fileutils | [] [] | findutils | | flex | [] [] | fslint | [] | gas | | gawk | [] [] | gbiff | [] | gcal | | gcc | | gettext-examples | [] [] | gettext-runtime | [] [] [] | gettext-tools | [] [] | gimp-print | [] [] | gip | [] | gliv | [] | glunarclock | [] [] | gmult | [] | gnubiff | | gnucash | () () [] | gnucash-glossary | [] | gnupg | [] [] | gpe-aerial | [] | gpe-beam | [] | gpe-calendar | [] | gpe-clock | [] | gpe-conf | [] | gpe-contacts | | gpe-edit | [] | gpe-go | [] | gpe-login | [] | gpe-ownerinfo | [] | gpe-sketchbook | [] | gpe-su | [] | gpe-taskmanager | [] | gpe-timesheet | [] | gpe-today | [] | gpe-todo | [] | gphoto2 | [] [] | gprof | | gpsdrive | () () () | gramadoir | () | grep | [] [] [] | gretl | | gsasl | [] | gss | | gst-plugins | [] [] | gstreamer | [] | gtick | [] | gtkspell | [] [] | hello | [] [] [] [] [] [] [] [] | id-utils | [] | impost | | indent | [] [] | iso_3166 | [] | iso_3166_1 | [] [] | iso_3166_2 | [] | iso_3166_3 | [] | iso_4217 | [] [] [] | iso_639 | [] [] [] | jpilot | () () () | jtag | | jwhois | [] | kbd | [] | latrine | [] | ld | | libc | [] [] [] [] [] | libextractor | | libgpewidget | [] | libgsasl | [] | libiconv | [] | libidn | | lifelines | [] | lilypond | [] | lingoteach | [] | lynx | [] [] | m4 | [] [] | mailutils | | make | [] [] [] | man-db | () | minicom | [] | mysecretdiary | [] | nano | [] [] | nano_1_0 | [] [] [] | opcodes | [] | parted | [] [] | psmisc | [] [] | ptx | [] [] [] | pwdutils | | python | | radius | | recode | [] | rpm | [] [] | screem | [] | scrollkeeper | [] [] [] | sed | [] [] | sh-utils | [] [] | shared-mime-info | [] [] [] [] | sharutils | [] [] | silky | [] | skencil | | sketch | | solfege | [] [] | soundtracker | | sp | () | stardict | [] [] | tar | [] [] | texinfo | [] [] [] | textutils | [] [] [] | tin | | tp-robot | [] | tuxpaint | [] [] [] [] [] [] | unicode-han-tra... | | unicode-transla... | | util-linux | [] [] | vorbis-tools | [] | wastesedge | [] | wdiff | [] [] | wget | [] [] | xchat | [] [] [] [] | xkeyboard-config | [] | xpad | [] | +-----------------------------------------------+ ja ko lg lt lv mk mn ms mt nb nl nn no nso or 35 11 1 1 2 2 3 11 0 15 96 7 5 0 1 pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta +----------------------------------------------+ GNUnet | | a2ps | () [] [] [] [] [] [] | aegis | () () | ant-phone | [] | anubis | [] [] [] | ap-utils | () | aspell | [] [] | bash | [] [] [] | batchelor | [] | bfd | [] [] | bibshelf | | binutils | [] [] | bison | [] [] [] [] [] | bluez-pin | [] [] [] [] [] [] [] [] | clisp | [] | console-tools | [] | coreutils | [] [] [] [] | cpio | [] [] | cpplib | | darkstat | [] [] [] [] [] [] | dialog | [] [] [] [] [] [] | diffutils | [] [] [] [] [] [] | doodle | [] | e2fsprogs | [] [] | enscript | [] [] [] [] | error | [] [] [] | fetchmail | [] () [] [] [] | fileutils | [] [] [] [] [] | findutils | [] [] [] [] [] [] | flex | [] [] [] [] [] | fslint | [] [] [] | gas | | gawk | [] [] [] [] | gbiff | [] | gcal | [] | gcc | | gettext-examples | [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] [] | gettext-tools | [] [] [] [] [] [] [] | gimp-print | [] [] | gip | [] [] [] | gliv | [] [] [] | glunarclock | [] [] [] [] [] [] | gmult | [] [] [] [] | gnubiff | () [] | gnucash | () [] [] [] [] | gnucash-glossary | [] [] [] | gnupg | [] [] [] | gpe-aerial | [] [] [] [] [] [] | gpe-beam | [] [] [] [] [] [] | gpe-calendar | [] [] [] [] [] [] [] | gpe-clock | [] [] [] [] [] [] [] | gpe-conf | [] [] [] [] [] [] | gpe-contacts | [] [] [] | gpe-edit | [] [] [] [] [] [] [] | gpe-go | [] [] [] [] [] | gpe-login | [] [] [] [] [] [] [] | gpe-ownerinfo | [] [] [] [] [] [] [] | gpe-sketchbook | [] [] [] [] [] [] [] | gpe-su | [] [] [] [] [] [] [] | gpe-taskmanager | [] [] [] [] [] [] [] | gpe-timesheet | [] [] [] [] [] [] [] | gpe-today | [] [] [] [] [] [] [] | gpe-todo | [] [] [] [] [] [] [] | gphoto2 | [] [] [] [] | gprof | [] [] [] | gpsdrive | [] | gramadoir | [] | grep | [] [] [] [] [] [] [] | gretl | [] | gsasl | [] [] [] [] [] | gss | [] [] [] | gst-plugins | [] [] [] | gstreamer | [] [] [] [] | gtick | [] [] [] | gtkspell | [] [] [] [] [] | hello | [] [] [] [] [] [] [] | id-utils | [] [] [] [] | impost | | indent | [] [] [] [] [] [] | iso_3166 | [] [] [] [] [] | iso_3166_1 | [] [] [] [] | iso_3166_2 | | iso_3166_3 | [] [] [] | iso_4217 | [] [] | iso_639 | [] [] [] | jpilot | | jtag | [] | jwhois | [] [] [] () () | kbd | [] [] [] | latrine | [] [] | ld | [] | libc | [] [] [] [] [] | libextractor | [] | libgpewidget | [] [] [] [] [] [] | libgsasl | [] [] [] | libiconv | [] [] [] [] [] [] [] [] [] [] | libidn | [] () | lifelines | [] [] | lilypond | [] | lingoteach | [] | lynx | [] [] [] | m4 | [] [] [] [] [] | mailutils | [] [] [] | make | [] [] [] [] | man-db | [] [] | minicom | [] [] [] [] | mysecretdiary | [] [] [] | nano | [] [] [] | nano_1_0 | [] [] [] [] | opcodes | [] [] | parted | [] [] [] [] | psmisc | [] [] | ptx | [] [] [] [] [] [] | pwdutils | [] | python | | radius | [] [] | recode | [] [] [] [] [] [] | rpm | [] [] [] [] | screem | | scrollkeeper | [] [] [] [] [] [] [] | sed | [] [] [] [] [] [] [] [] | sh-utils | [] [] [] | shared-mime-info | [] [] [] [] [] | sharutils | [] [] [] | silky | () [] | skencil | [] [] [] | sketch | [] [] [] | solfege | | soundtracker | [] [] | sp | | stardict | [] [] | tar | [] [] [] [] | texinfo | [] [] [] [] | textutils | [] [] [] | tin | | tp-robot | [] | tuxpaint | [] [] [] [] [] [] [] [] | unicode-han-tra... | | unicode-transla... | | util-linux | [] [] [] | vorbis-tools | [] [] | wastesedge | | wdiff | [] [] [] [] [] [] | wget | [] [] [] [] [] [] [] [] [] | xchat | [] [] [] [] [] [] | xkeyboard-config | | xpad | | +----------------------------------------------+ pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta 0 48 30 58 6 81 69 4 46 13 12 50 88 0 tg th tk tr uk ven vi wa xh zh_CN zh_TW zu +--------------------------------------------+ GNUnet | | 0 a2ps | [] [] | 18 aegis | | 0 ant-phone | [] | 4 anubis | [] | 9 ap-utils | () | 1 aspell | [] [] [] | 13 bash | | 10 batchelor | [] [] | 7 bfd | [] | 6 bibshelf | [] | 5 binutils | [] [] | 8 bison | [] | 17 bluez-pin | [] [] [] [] [] | 24 clisp | | 7 console-tools | [] | 4 coreutils | [] | 16 cpio | [] | 5 cpplib | [] [] | 7 darkstat | [] () () | 15 dialog | [] [] | 23 diffutils | [] [] [] | 27 doodle | | 4 e2fsprogs | [] | 8 enscript | [] | 12 error | [] [] | 15 fetchmail | [] | 12 fileutils | [] [] [] | 18 findutils | [] [] | 16 flex | [] | 14 fslint | [] | 7 gas | [] | 3 gawk | [] | 13 gbiff | | 4 gcal | [] | 5 gcc | [] | 3 gettext-examples | [] [] [] [] | 20 gettext-runtime | [] [] [] [] [] | 25 gettext-tools | [] [] [] | 16 gimp-print | [] | 11 gip | [] | 8 gliv | [] | 6 glunarclock | [] [] | 14 gmult | [] [] [] | 13 gnubiff | [] | 3 gnucash | () [] | 10 gnucash-glossary | [] | 8 gnupg | [] [] [] | 19 gpe-aerial | [] [] | 13 gpe-beam | [] [] | 13 gpe-calendar | [] [] [] [] | 18 gpe-clock | [] [] [] | 16 gpe-conf | [] [] | 12 gpe-contacts | [] [] | 6 gpe-edit | [] [] [] | 14 gpe-go | [] | 10 gpe-login | [] [] [] [] | 17 gpe-ownerinfo | [] [] [] | 18 gpe-sketchbook | [] | 13 gpe-su | [] [] | 15 gpe-taskmanager | [] [] | 15 gpe-timesheet | [] [] [] | 16 gpe-today | [] [] [] [] | 18 gpe-todo | [] [] [] | 16 gphoto2 | [] [] | 17 gprof | [] [] | 10 gpsdrive | | 2 gramadoir | [] | 6 grep | [] [] [] [] | 32 gretl | | 4 gsasl | [] [] | 12 gss | [] | 5 gst-plugins | [] [] | 16 gstreamer | [] [] [] | 14 gtick | [] | 11 gtkspell | [] [] [] | 19 hello | [] [] [] [] | 37 id-utils | [] [] | 13 impost | [] | 3 indent | [] [] [] | 24 iso_3166 | [] [] | 10 iso_3166_1 | [] [] | 19 iso_3166_2 | | 2 iso_3166_3 | [] [] | 8 iso_4217 | [] | 8 iso_639 | [] | 10 jpilot | [] [] [] | 6 jtag | | 2 jwhois | [] [] [] | 12 kbd | [] | 11 latrine | [] [] | 8 ld | [] | 5 libc | [] [] | 22 libextractor | | 1 libgpewidget | [] [] | 17 libgsasl | [] | 7 libiconv | [] [] [] [] [] | 32 libidn | [] | 4 lifelines | | 4 lilypond | [] | 5 lingoteach | | 5 lynx | [] [] | 14 m4 | [] [] | 17 mailutils | [] | 7 make | [] [] | 18 man-db | | 5 minicom | | 11 mysecretdiary | [] [] | 11 nano | | 11 nano_1_0 | [] [] | 17 opcodes | [] | 7 parted | [] [] [] | 17 psmisc | [] | 7 ptx | [] [] | 23 pwdutils | | 1 python | | 0 radius | [] | 6 recode | [] [] | 22 rpm | [] [] | 11 screem | | 1 scrollkeeper | [] [] | 22 sed | [] [] | 19 sh-utils | [] | 15 shared-mime-info | [] [] | 19 sharutils | [] [] [] | 20 silky | | 3 skencil | | 6 sketch | | 6 solfege | | 4 soundtracker | [] | 8 sp | [] | 3 stardict | [] [] [] [] | 10 tar | [] [] | 13 texinfo | [] [] | 14 textutils | [] [] [] | 17 tin | | 1 tp-robot | [] [] | 7 tuxpaint | [] [] [] [] | 34 unicode-han-tra... | | 0 unicode-transla... | | 2 util-linux | [] [] | 17 vorbis-tools | [] | 10 wastesedge | | 1 wdiff | [] [] | 22 wget | [] [] [] [] | 31 xchat | [] [] [] | 22 xkeyboard-config | | 1 xpad | [] | 5 +--------------------------------------------+ 71 teams tg th tk tr uk ven vi wa xh zh_CN zh_TW zu 148 domains 0 0 1 69 29 0 61 16 0 42 21 0 1704 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are used for implementing regional variants of languages, or language dialects. For a PO file in the matrix above to be effective, the package to which it applies should also have been internationalized and distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. If March 2005 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. 1.6 Using `gettext' in new packages =================================== If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your package. Of course you have to respect the GNU Library General Public License which covers the use of the GNU `gettext' library. This means in particular that even non-free programs can use `libintl' as a shared library, whereas only free software can use `libintl' as a static library or use modified versions of `libintl'. Once the sources are changed appropriately and the setup can handle the use of `gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact `translation@iro.umontreal.ca' to make the `.pot' files available to the translation teams. xblast-2.10.4/AUTHORS0000644000175000017500000000007210060056271013254 0ustar rhondaalfieKoen Skywalker Bombenfutter ALu Kuni Snowcrash and Alfie xblast-2.10.4/COPYING0000644000175000017500000004311010050664360013242 0ustar rhondaalfie GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xblast-2.10.4/ChangeLog0000644000175000017500000030536010444637231013775 0ustar rhondaalfie2006-06-16 23:27 alfie * config.guess, config.sub: Updated config.{guess,sub} 2006-06-16 22:09 alfie * Makefile.in, config.h.in, configure, version.h: autogen for 2.10.4 release 2006-06-16 22:00 alfie * po/de.po: Some updates/enhances 2006-06-15 10:49 fzago * Makefile.am: Do not build xbsndsrv for SDL target. 2006-06-13 11:19 fzago * sdl_sound.c: Add more mixing channels so less sound effects are skipped. Do not call Mix_SetPanning is there is no mix channel available. 2006-06-13 11:11 fzago * game.c, menu_network.c, player.c: New strings to translate. 2006-06-13 11:10 fzago * menu_game.c, sdl_sound.c: Fixed 2 typos. 2006-06-12 11:06 fzago * intro.c, sdl_sound.c, snd.h, x11_sound.c, xbsndsrv.c: Stop all sounds before playing the "won" music at the end of a level, else that music might never play (not enough mix channels). 2006-06-12 10:55 fzago * version.h: Updated copyright year. 2006-06-12 10:55 fzago * util.c: Fixed a few warnings. 2006-06-12 10:54 fzago * introdat.c: Enlarge and move down the "press space .." box on the intro window so French translation appear in full. 2006-06-12 10:51 fzago * cfg_player.c: Fixed typo. 2006-06-12 10:51 fzago * bomb.c: More strings to translate. 2006-06-12 10:48 fzago * Makefile.am: Adds $(DESTDIR) to fix rpm package build. Makefile.dist and common.h are no longer present so don't look for them during "make dist". 2006-06-12 10:42 fzago * acinclude.m4, configure.in: Add more compile flags when gcc is used. 2006-06-12 10:38 fzago * po/: fr.po, xblast.pot: More French translations and more strings to translate. 2006-06-01 17:47 alfie * po/de.po: Some more strings.... 2006-05-04 17:28 fzago * sdl_init.c: Don't ignore the first SDL_QUIT event. 2006-05-04 17:26 fzago * x11c_text.c: Typo 2006-04-14 20:43 iskywalker * configure.in: Fail if sdl libs are not found 2006-04-11 16:54 fzago * sdl_init.c: Commented out unused code. Activate the event filter (alloows for instance fullscreen hotkey). Do not filter out key up events since they are needed in a keyboard option. 2006-04-11 16:45 fzago * xbsndsrv.c: Fixed a couple function declarations. 2006-04-11 16:44 fzago * ini_file.c, ini_file.h, menu_edit.c: DB_GetSection does not return a const, so fix its declaration. And remove a bunch of casts that were added because of that. 2006-03-29 21:48 alfie * Makefile.in, config.h.in, configure: Update of the automatic generated files 2006-03-29 21:46 alfie * func.c: Fixed a string 2006-03-29 21:45 alfie * player.c, po/Makevars.template[DEAD], po/de.po, po/fr.po, po/xblast.pot: player.c: Added a comment for translators po/xblast.pot: regenerated po/de.po, po/fr.po: updated from pot po/de.po: Added some more translation po/Makevars.template: Unneeded template file removed 2006-03-29 19:59 fzago * po/fr.po: Translation updates. 2006-03-29 19:46 fzago * po/LINGUAS: Added de 2006-03-29 19:46 fzago * po/Makevars: Set MSGID_BUGS_ADDRESS. 2006-03-29 19:39 fzago * player.c: "%d bomb" -> "%d bombs" 2006-03-29 19:33 fzago * player.c: no bombs -> no bomb 2006-03-29 09:44 alfie * po/: de.po, xblast.pot: Updated some of the default headers with sensible data. Added initial german file. 2006-03-28 11:58 fzago * xblast.h: Include stdint.h 2006-03-28 11:54 fzago * sdl_sound.c: Change file lengths from long to int (better on 64 bits platforms). Removed some dead code and unused variables. When converting a sound from mono to stereo, avoid allocating some memory. 2006-03-28 11:50 fzago * sdl_pixmap.c: Handle case where pixmap is not found (avoids segfault). Move variables declarations at the beggining of the block. 2006-03-28 11:49 fzago * sdl_common.h: Includes 2 more headers. 2006-03-28 11:48 fzago * ini_file.c, sdl_image.c, sdl_joystick.c: Minor code cleanups: moved variables declaraions at the beggining of the block, fixed functions prototypes. 2006-03-28 11:41 fzago * central.c, cfg_control.c, cfg_level.c, chat.c, client.c, com_central.c, demo.c, game.c, info.c, intro.c, level.c, menu_edit.c, menu_extras.c, menu_level.c, net_socket.c, network.c, player.c, scramble.c, sdl_text.c, sdl_tile.c, server.c, shrink.c, user.c: Minor code cleanups: fixed function declarations, moved variables declarations at the beggining of blocks, added static/const keywords, removed/commented out dead code, replaced 0 by NULL whenever possible. 2006-02-25 16:13 fzago * sdl_image.c: Added missing CR. 2006-02-24 22:14 fzago * sdl_event.h: Removed unused defines. 2006-02-24 22:13 fzago * map.c: emoved bad cast. 2006-02-24 22:09 fzago * game_client.c, game_local.c: Hide the mouse pointer during a game. 2006-02-24 21:57 fzago * gui.h, sdl_event.c, w32_event.c, x11_event.c: Introducing GUI_ShowCursor() to show or hide the mouse cursor. 2006-02-24 21:52 fzago * sdl_event.c: GUI_SetMouseMode is intended to mask/unmask mouse events. So ignore it for SDL. 2006-02-24 21:42 fzago * sdl_atom.c, sdl_event.c, sdl_image.c: Cleanups: fix typos, use correct casts, made a couple functions static. 2006-02-24 21:36 fzago * sdl_socket.c: includes sdl_socket.h 2006-02-24 21:29 fzago * browse.c, cfg_demo.c, cfg_game.c, cfg_player.c, cfg_stat.c, chat.c, chat.h, com_base.c, com_central.c, com_dgram.c, com_newgame.c, menu_edit.c, server.c, user.c: Cleanups: make some functions static, fixed some prototypes, use proper casts. 2006-02-20 09:26 lodott * xblast.h: correcting include for mingw-config makes 'make -f Makefile.windows' work on cygwin 2006-02-19 17:22 fzago * xblast.h: Always include time.h 2006-02-19 14:49 lodott * x11_socket.c: enabling socket close after shutdown for writing 2006-02-19 13:41 lodott * Makefile.windows: updating mingw Makefile to use config-mingw.h 2006-02-19 13:39 lodott * xblast.h: fixing include order, enable non-autoconf config headers 2006-02-19 13:37 lodott * config-mingw.h: mingw-specific config file, can probably be trimmed 2006-02-19 13:33 lodott * w32_atom.c, w32_config.c, w32_event.c, w32_image.c, w32_init.c, w32_joystick.c, w32_joystick.h, w32_keysym.c, w32_msgbox.c, w32_pixmap.c, w32_sndsrv.c, w32_socket.c, w32_sound.c, w32_sprite.c, w32_text.c, w32_text.h, w32_tile.c, w32_tile.h: fixing xblast.h inclusion to enable mingw-compilation under cygwin 2006-02-19 13:26 lodott * util.c: print search path list for files not found 2006-02-19 13:06 fzago * sdl_text.c: TTF_OpenFont() segfaults if the font doesn't exist. So test for the presence of the file before calling TTF_OpenFont(). 2006-02-18 23:31 fzago * sdl_text.c: Changed the return type of DrawAlignedText from int to void, since the result was never used. 2006-02-18 23:26 fzago * sdl_init.c, sdl_text.c: Replaced several printf() by Dbg_Out(). 2006-02-18 21:40 fzago * central.c, cfg_level.c, chat.c, client.c, com_dg_client.c, com_dg_server.c, com_dgram.c, debug.c, game_server.c, network.c, server.c: Fixed warnings in debug format strings (64 bits fixes, missing arguments, extra arguments). 2006-02-18 13:38 fzago * sdl_common.h, sdl_event.c, sdl_socket.c, sdl_socket.h: Straighten SDL event handling. This fixes network games and chat. 2006-02-18 12:24 lodott * configure.in, xbsndsrv.c: adding checks for sound headers and using them 2006-02-17 22:57 fzago * sdl_socket.c: Fix network interfaces enumeration. 2006-02-17 20:32 fzago * sdl_socket.c: Fix format warnings in debug traces. 2006-02-17 19:52 fzago * client.c, com_dgram.c, com_query.c, server.c, util.c, x11_socket.c: Fixed some warnings in debug traces. 2006-02-15 22:30 fzago * xblast.c, xblast.h: Do not use nls includes and functions when nls is not enabled, or not present. 2006-02-14 20:51 fzago * map.c: Fixed crash in map editor. 2006-02-14 19:52 lodott * configure.in: corrected checkin, library has to be added to LIBS, not LDFLAGS (sorry) 2006-02-14 19:29 lodott * configure.in: adding LIBINTL library for linking in cygwin, needed because gettext not in libc (probably) 2006-02-14 19:29 lodott * m4/sdl.m4: autoconf macro definition for sdl, for systems without sdl taken from sdl distribution 2006-02-14 19:28 lodott * autogen.sh: corrected: adding m4 as search directory for aclocal 2006-02-14 19:28 lodott * central.c: corrected: manually including limits.h to define INT_MAX in cygwin 2006-02-14 19:28 lodott * Makefile.in, aclocal.m4, configure: unintended checkin, but probably doesn't hurt 2006-02-13 21:35 fzago * po/: fr.po, xblast.pot: More translations. 2006-02-13 21:34 fzago * cfg_stat.c, menu_edit.c, mi_stat.c: Added some translation tags. 2006-02-11 13:51 fzago * po/: fr.po, xblast.pot: Updated translation strings. 2006-02-11 13:50 fzago * func.c, info.c, introdat.c, map.c, menu_extras.c, player.c: Added translation markers. 2006-02-11 12:30 fzago * bomb.c: Fixed typo. 2006-02-11 12:28 fzago * player.c: s/Initital/Initial/ 2006-02-11 12:27 fzago * player.c: Added translation markers. 2006-02-10 15:35 fzago * po/: fr.po, xblast.pot: Updated pot file and partial french translation. 2006-02-10 15:07 fzago * version.h, xblast.h, version.c, user.h, server.c, server.h, shrink.c, shrink.h, snd.h, status.c, status.h, random.c, scramble.h, sdl_config.h, sdl_init.c, sdl_keysym.c, sdl_sprite.c, bomb.c, central.h, chat.c, chat.h, client.c, client.h, com_central.h, com_dg_server.c, func.c, game_server.c, info.h, ini_file.h, level.c, level.h, menu_extras.c, menu_level.c, menu_level.h, menu_network.c, mi_button.h, network.h, player.c, player.h: Fix non-ansi prototypes. Added static to some functions. Commented out some dead code. Fixed some compilation warnings. 2006-02-10 13:28 fzago * sdl_text.c, version.c, w32_event.c, x11c_text.c: dos2unix and make indent 2006-02-10 13:23 fzago * bomb.c: s/whith/with/ 2006-02-10 13:22 fzago * bomb.c, intro.c, menu.c, menu_control.c, menu_extras.c, menu_game.c, menu_level.c, mi_tool.c: Added translation markers. 2006-02-10 11:02 fzago * po/fr.po: [no log message] 2006-02-10 10:53 fzago * intro.c, sdl_text.c: Move the call to gettext to where it belongs. 2006-02-10 10:27 fzago * xbsndsrv.c: Includes xblast.h 2006-02-09 23:44 fzago * Makefile.am, Makefile.in, config.h.in, configure, intro.c, introdat.c, sdl_text.c, xblast.c, xblast.h, po/LINGUAS, po/POTFILES.in, po/fr.po, po/xblast.pot: i18n 2006-02-09 22:10 fzago * po/Makevars: From Makevars.template 2006-02-09 22:10 fzago * configure.in: i18n 2006-02-09 22:09 fzago * aclocal.m4: Regenerated (aclocal -I m4) 2006-02-09 21:56 fzago * ABOUT-NLS, Makefile.am, Makefile.in, config.rpath, configure.in, m4/codeset.m4, m4/gettext.m4, m4/glibc2.m4, m4/glibc21.m4, m4/iconv.m4, m4/intdiv0.m4, m4/intmax.m4, m4/inttypes-pri.m4, m4/inttypes.m4, m4/inttypes_h.m4, m4/isc-posix.m4, m4/lcmessage.m4, m4/lib-ld.m4, m4/lib-link.m4, m4/lib-prefix.m4, m4/longdouble.m4, m4/longlong.m4, m4/nls.m4, m4/po.m4, m4/printf-posix.m4, m4/progtest.m4, m4/signed.m4, m4/size_max.m4, m4/stdint_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4, m4/wchar_t.m4, m4/wint_t.m4, m4/xsize.m4, po/Makefile.in.in, po/Makevars.template, po/POTFILES.in, po/Rules-quot, po/boldquot.sed, po/en@boldquot.header, po/en@quot.header, po/insert-header.sin, po/quot.sed, po/remove-potcdate.sin: i18n first pass. 2006-02-09 21:31 fzago * common.h[DEAD]: Removed. 2006-02-09 21:21 fzago * action.c, action.h, atom.c, atom.h, bomb.c, bomb.h, bot.c, bot.h, browse.c, browse.h, central.c, central.h, cfg_control.c, cfg_control.h, cfg_demo.c, cfg_demo.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, cfg_player.c, cfg_player.h, cfg_stat.c, cfg_stat.h, cfg_xblast.c, cfg_xblast.h, chat.c, chat.h, client.c, client.h, color.c, color.h, com.c, com_base.c, com_base.h, com_browse.c, com_browse.h, com_central.c, com_central.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_dgram.h, com_from_central.c, com_from_central.h, com_listen.c, com_listen.h, com_newgame.c, com_newgame.h, com_query.c, com_query.h, com_reply.c, com_reply.h, com_stream.c, com_stream.h, com_to_central.c, com_to_central.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, dat_rating.c, dat_rating.h, debug.c, debug.h, demo.c, demo.h, event.c, event.h, func.c, func.h, game.c, game.h, game_client.c, game_client.h, game_demo.c, game_local.c, game_server.c, geom.h, gui.h, image.c, image.h, info.c, info.h, ini_file.c, ini_file.h, intro.c, intro.h, introdat.c, introdat.h, level.c, level.h, map.c, map.h, menu.c, menu.h, menu_control.c, menu_control.h, menu_edit.c, menu_edit.h, menu_extras.c, menu_extras.h, menu_game.c, menu_game.h, menu_level.c, menu_level.h, menu_network.c, menu_network.h, menu_player.c, menu_player.h, mi_base.c, mi_base.h, mi_button.c, mi_button.h, mi_color.c, mi_color.h, mi_combo.c, mi_combo.h, mi_cyclic.c, mi_cyclic.h, mi_host.c, mi_host.h, mi_int.c, mi_int.h, mi_keysym.c, mi_keysym.h, mi_label.c, mi_label.h, mi_map.c, mi_player.c, mi_player.h, mi_stat.c, mi_stat.h, mi_string.c, mi_string.h, mi_tag.c, mi_tag.h, mi_toggle.c, mi_toggle.h, mi_tool.c, mi_tool.h, net_dgram.c, net_dgram.h, net_socket.c, net_socket.h, net_tele.c, net_tele.h, network.c, network.h, player.c, player.h, random.c, scramble.c, scramble.h, sdl_atom.c, sdl_common.c, sdl_common.h, sdl_config.c, sdl_config.h, sdl_event.c, sdl_event.h, sdl_image.c, sdl_image.h, sdl_init.c, sdl_joystick.c, sdl_joystick.h, sdl_keysym.c, sdl_keysym.h, sdl_msgbox.c, sdl_pixmap.c, sdl_pixmap.h, sdl_socket.c, sdl_socket.h, sdl_sound.c, sdl_sprite.c, sdl_sprite.h, sdl_text.c, sdl_text.h, sdl_tile.c, sdl_tile.h, server.c, server.h, shrink.c, shrink.h, snd.h, socket.h, sprite.c, sprite.h, status.c, status.h, str_util.c, str_util.h, user.c, user.h, util.c, util.h, version.c, version.h, w32_config.h, w32_event.h, w32_image.h, w32_keysym.h, w32_pixmap.h, w32_sndsrv.h, w32_socket.h, w32_sprite.h, x11_atom.c, x11_common.c, x11_common.h, x11_config.c, x11_event.c, x11_event.h, x11_joystick.c, x11_joystick.h, x11_msgbox.c, x11_socket.c, x11_socket.h, x11_sound.c, x11c_image.c, x11c_image.h, x11c_init.c, x11c_pixmap.c, x11c_pixmap.h, x11c_sprite.c, x11c_sprite.h, x11c_text.c, x11c_text.h, x11c_tile.c, x11c_tile.h, xbconfig.h, xblast.c, xblast.h: Reorganize include. Only (almost) one include per C file, and no include in headers. Paves the way for i18n and split into libraries. 2006-02-09 18:31 fzago * action.c, action.h, atom.c, atom.h, bomb.c, bomb.h, bot.c, bot.h, browse.c, browse.h, central.c, central.h, cfg_control.c, cfg_control.h, cfg_demo.c, cfg_demo.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, cfg_player.c, cfg_player.h, cfg_stat.c, cfg_stat.h, cfg_xblast.c, cfg_xblast.h, chat.c, chat.h, client.c, client.h, color.c, color.h, com.c, com_base.c, com_base.h, com_browse.c, com_browse.h, com_central.c, com_central.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_dgram.h, com_from_central.c, com.h, com_from_central.h, com_listen.c, com_newgame.c, com_newgame.h, com_query.c, com_query.h, com_reply.c, com_reply.h, com_stream.c, com_stream.h, com_to_central.c, com_to_central.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, common.h, dat_rating.c, dat_rating.h, debug.c, debug.h, demo.c, demo.h, event.c, event.h, func.c, func.h, game.c, game.h, game_client.c, game_demo.c, game_local.c, game_local.h, game_server.c, geom.h, gui.h, image.c, image.h, info.c, info.h, ini_file.c, ini_file.h, intro.c, intro.h, introdat.c, introdat.h, level.c, level.h, map.c, map.h, menu.c, menu_control.c, menu_edit.c, menu_edit.h, menu_extras.c, menu_game.c, menu_game.h, menu_layout.h, menu_level.c, menu_level.h, menu_network.c, menu_network.h, menu_player.c, mi_base.c, mi_base.h, mi_button.c, mi_button.h, mi_color.c, mi_color.h, mi_combo.c, mi_combo.h, mi_cyclic.c, mi_cyclic.h, mi_host.c, mi_host.h, mi_int.c, mi_int.h, mi_keysym.c, mi_keysym.h, mi_label.c, mi_label.h, mi_map.c, mi_player.c, mi_player.h, mi_stat.c, mi_stat.h, mi_string.c, mi_string.h, mi_tag.c, mi_toggle.c, mi_toggle.h, mi_tool.c, mi_tool.h, net_dgram.c, net_dgram.h, net_socket.c, net_socket.h, net_tele.c, net_tele.h, network.c, network.h, player.c, player.h, random.c, random.h, randomlib.c, randomlib.h, scramble.c, scramble.h, sdl_atom.c, sdl_common.c, sdl_common.h, sdl_config.c, sdl_config.h, sdl_event.c, sdl_image.c, sdl_image.h, sdl_init.c, sdl_joystick.c, sdl_joystick.h, sdl_keysym.c, sdl_msgbox.c, sdl_pixmap.c, sdl_ppm.c, sdl_socket.c, sdl_socket.h, SDL_vkeys.h, sdl_sound.c, sdl_sprite.c, sdl_sprite.h, sdl_text.c, sdl_text.h, sdl_tile.c, server.c, server.h, shrink.c, shrink.h, shrinkdat.h, snd.h, socket.h, sprite.c, sprite.h, status.c, status.h, str_util.c, str_util.h, time.c, timeval.h, try.c, user.c, user.h, util.c, util.h, version.c, version.h, w32_atom.c, w32_common.c, w32_common.h, w32_config.c, w32_config.h, w32_event.c, w32_image.c, w32_image.h, w32_init.c, w32_joystick.c, w32_joystick.h, w32_keysym.c, w32_mm.h, w32_msgbox.c, w32_pixmap.c, w32_pixmap.h, w32_sndsrv.c, w32_sndsrv.h, w32_socket.c, w32_sound.c, w32_sprite.c, w32_text.c, w32_tile.c, x11_atom.c, x11_common.c, x11_common.h, x11_config.c, x11_config.h, x11_event.c, x11_joystick.c, x11_joystick.h, x11_msgbox.c, x11_socket.c, x11_socket.h, x11_sound.c, x11c_image.c, x11c_image.h, x11c_init.c, x11c_pixmap.c, x11c_sprite.c, x11c_text.c, x11c_tile.c, xbconfig.h, xblast.c, xblast.h, xbsndsrv.c: Reindent (make indent) 2006-02-09 18:29 fzago * Makefile.am, Makefile.in: Added indent rule. 2006-02-08 20:23 fzago * debug.h: Added possible DEBUG_*. Added __attribute__ ((format (printf, 1, 2))) to prototypes of debug functions. 2006-02-03 23:47 fzago * atom.c, atom.h, cfg_xblast.c, cfg_xblast.h, menu.c, sdl_init.c: Added a fullscreen option for SDL. 2006-02-03 23:43 fzago * sdl_atom.c: fix memleak in sdl_atom.c. 2006-02-03 23:41 fzago * menu_edit.c: 64 bits fixes. 2006-02-03 23:39 fzago * com_central.c, func.c, sdl_atom.c, sdl_event.c, sdl_image.c, sdl_init.c, sdl_sound.c, sdl_sprite.c, sdl_text.c, sdl_text.h, sdl_tile.c: Fixes compilation warnings. 2006-02-03 23:28 fzago * configure, configure.in: Changed summary of options selected. 2006-02-03 23:27 fzago * Makefile.in: Regenerated. 2006-02-03 23:22 fzago * config.guess, config.sub, depcomp, install-sh, missing, mkinstalldirs: Updates (from autoupdate). 2006-02-03 23:19 fzago * Makefile.am: Add missing files. 2006-02-03 22:52 fzago * Makefile.am, Makefile.in, acinclude.m4, aclocal.m4, config.h.in, configure, configure.in: Update build system for SDL target. 2006-02-03 22:36 fzago * sdl_event.c: Fix compile issue. 2006-02-03 20:32 fzago * sdl_atom.c, sdl_common.c, sdl_common.h, sdl_config.c, sdl_config.h, sdl_event.c, sdl_event.h, sdl_image.c, sdl_image.h, sdl_init.c, sdl_joystick.c, sdl_joystick.h, sdl_keysym.c, sdl_keysym.h, sdl_msgbox.c, sdl_pixmap.c, sdl_pixmap.h, sdl_ppm.c, sdl_socket.c, sdl_socket.h, sdl_sound.c, sdl_sound.h, sdl_sprite.c, sdl_sprite.h, sdl_text.c, sdl_text.h, sdl_tile.c, sdl_tile.h: Imported sdl files from the sdl branch, and updated existing ones. 2005-12-30 17:18 lodott * game.c, game_server.c, network.h, server.c, server.h: moving winning team codes to network.h; output of winning teams per host in case of async; server system messages via chat 2005-12-30 17:12 lodott * chat.c, chat.h: support for system messages; slight extension of max message length 2005-12-30 17:09 lodott * str_util.c, str_util.h: adding helper function: temporary string creation 2005-11-14 14:18 alfie * configure: network debugging switch 2005-06-06 11:18 lodott * game_server.c: minor simplification and output for central network events 2005-06-06 11:10 lodott * user.h, user.c: defines for central network events 2005-06-03 12:49 iskywalker * game_server.c, user.c: differ from disconnection from central and disconnect from game server 2005-05-30 15:52 lodott * server.c: fixed: out team state was set to none on change to chaos mode 2005-05-27 22:14 iskywalker * configure.in, game.c, INSTALL: bomberman was already in options/player/controls 2005-05-27 19:22 iskywalker * INSTALL: updated with configure.in 2005-05-27 19:08 iskywalker * game.c, configure.in: bomberman like, extra for gryzor _ stop key set as default _ 2005-05-20 18:34 lodott * net_socket.c: set reuse option before bind on listen socket 2005-05-14 15:50 iskywalker * configure.in, version.h: bumped version 2005-05-14 15:49 iskywalker * menu_edit.c: cleared warnings 2005-05-14 15:38 lodott * game_server.c: replacing local central connection flag with more accurate connection indicator from user.c 2005-05-14 15:36 iskywalker * menu_edit.c: add kick to init, rev extras 2005-05-14 15:34 iskywalker * user.c: fix bug when terminating server 2005-05-14 15:04 lodott * client.c: clear network events on passive disconnect 2005-05-13 11:32 lodott * menu_extras.c: fixing failure message for statistics update from central 2005-05-13 11:29 lodott * menu_network.c: fix possible client segfaults on disconnect during connect process 2005-05-10 02:55 iskywalker * func.c: fixed some functions needed by menu_edit.c 2005-05-10 02:53 iskywalker * menu_edit.c: fixed some extra inits things 2005-04-28 09:09 alfie * xblast.man: major rewrite and formating fixes 2005-04-27 12:39 iskywalker * menu_player.c: mistyped 2005-04-26 13:16 iskywalker * cfg_player.c: seems to work 2005-04-26 12:59 iskywalker * cfg_player.c, menu_player.c: not final solution for bug 2005-04-19 15:23 iskywalker * util.c: fixed sub dirs bug 2005-04-18 09:39 alfie * configure: autogen.sh update 2005-04-09 00:02 iskywalker * warning.rtf: windows warning installation text 2005-04-08 17:32 lodott * version.h: setting version string for 2.10.2 release 2005-04-08 17:30 lodott * player.c: removing unconditional debug output 2005-04-08 17:16 lodott * Makefile.windows: no debug flags as default 2005-04-05 14:15 lodott * com_stream.c: removing double-free while closing stream waiting for eof 2005-04-02 14:55 lodott * central.c, com_from_central.c, central.h: adding counter for tcp connections, slot id alone not sufficient for identification 2005-04-02 14:53 lodott * com_central.c: check success for games.html, delayed retry on failure 2005-04-02 14:43 lodott * debug.c: fixed memory debugging 2005-04-02 14:13 lodott * com_stream.c: correctly handle errors while waiting for eof 2005-04-02 14:09 lodott * debug.c: memory debugging to stderr, ignore internal table by default 2005-03-23 13:40 lodott * central.c, com_browse.c, com_central.c, net_dgram.c, net_tele.c, network.c, w32_socket.c: using sizeof with typenames instead of variable names 2005-03-21 17:22 lodott * com_stream.c: syncing with xbcs (just formatting) 2005-03-21 17:12 lodott * com.c, com_browse.c: syncing with xbcs (just difference in comments) 2005-03-21 17:11 lodott * com_from_central.c: fixing output, synced with xbcs 2005-03-21 16:54 lodott * com_central.c: updating central udp to current xbcs (rewritten game table handlign, some fixes) 2005-03-21 16:50 lodott * com_base.c: debugging for XBComm's, comments, whitespaces 2005-03-21 16:50 lodott * debug.c, debug.h: adding debugging support for XBComm's 2005-03-18 09:59 lodott * com_stream.c: fixed assert failure when tcp is closed (DEBUG_STREAM) 2005-03-15 14:54 lodott * net_socket.c, socket.h, w32_socket.c, x11_socket.c: enable reuse of listening tcp socket (not implemented for w32) 2005-03-15 14:22 lodott * net_dgram.c: syncing with xbcs 2005-03-15 14:17 lodott * com_stream.c, com_stream.h: syncing with xbcs 2005-03-15 14:09 lodott * central.c, central.h, com_from_central.c, com_from_central.h, menu_network.c: syncing with xbcs 2005-03-15 14:03 lodott * com_central.c: write games file only when changed, synced with xbcs 2005-03-14 17:31 lodott * com_dgram.c: fix memory leaks around connection ping 2005-03-14 17:28 lodott * com_newgame.c, com_reply.c: fixing two tiny memory leaks 2005-03-12 17:37 iskywalker * cfg_demo.c, cfg_level.c, image.c, ini_file.c, ini_file.h, menu_edit.c, util.c, util.h: code performance improved and sanity check not mixed up with recursive, xb-stile conform 2005-03-12 16:56 lodott * cfg_demo.c, cfg_level.c, image.c, ini_file.c, ini_file.h, menu_edit.c, util.c, util.h: recursive dir search as parameter for DB_LoadDir and CreateFileList 2005-03-12 16:27 lodott * util.c: formatting, whitespaces, comments 2005-03-12 15:51 iskywalker * SConstruct: working Sconstruct for 2.10.x 2005-03-12 15:25 iskywalker * util.c: recursive dir search for windows, also fixed memory leak 2005-03-12 14:51 lodott * cfg_demo.c, cfg_game.c, cfg_level.c, game_client.c: a bunch of minor corrections 2005-03-12 14:15 lodott * version.h: adding version check documentation for swapcolor extra 2005-03-12 14:13 lodott * w32_config.c, x11_config.c: adding debug output for gui config 2005-03-12 14:12 lodott * demo.c, demo.h, game_client.c, game_local.c, game_server.c: adding demo game type (client, server, local) in demo file name 2005-03-12 14:11 lodott * cfg_control.c, cfg_demo.c, cfg_game.c, cfg_level.c, cfg_player.c, cfg_stat.c, cfg_xblast.c: adding debug output for config data 2005-03-12 14:09 lodott * debug.c, debug.h: debug output for config and files 2005-03-12 11:20 lodott * cfg_demo.c, cfg_demo.h: whitespaces, formatting, comments 2005-03-12 10:44 lodott * demo.c, demo.h: whitespaces, formatting, comments 2005-03-11 19:46 iskywalker * x11_event.c: cleaned code 2005-03-11 19:45 iskywalker * ini_file.c, util.c, util.h: search subdirs for levels in level directory 2005-03-10 17:53 lodott * func.c: only swapcolor is problematic, swapposition is okay 2005-03-10 17:33 lodott * func.c: add a version check for levels with swap extras 2005-03-10 15:38 iskywalker * w32_event.c: make ms vc++ compiler happy 2005-03-10 15:18 iskywalker * player.c: corrected SMPF bug and add optinal variations 2005-03-10 14:56 lodott * com_dg_server.c: make sure client has not been disconnected before queueing data 2005-03-08 17:48 lodott * x11_event.c: removing compiler warning on sun 2005-03-08 17:27 lodott * xbsndsrv.c: removing compiler warnings on sun, adding PID_FORMAT macro 2005-03-08 16:42 lodott * game_server.c: removing compiler warning when DEBUG_GAME not set 2005-03-08 16:39 lodott * ini_file.c, str_util.c, menu_edit.c: adding explicit cast for isspace(), removes warning on sun 2005-03-08 16:36 lodott * xbsndsrv.c: whitespaces, removing unused var 2005-03-08 16:36 iskywalker * player.c: changed MAX_PLAYER for numPlayer, code cleaned up and formatted a little 2005-03-08 16:34 iskywalker * menu_game.c: liberate for all the possible fps 2005-03-08 16:32 iskywalker * x11c_init.c: changed minimized icon 2005-03-08 10:25 lodott * version.h, configure.in: bumping version to 2.10.2rc 2005-03-08 09:58 lodott * game_client.c: use GUI beeping 2005-03-08 09:58 lodott * server.c: better cleanup when listen fails, use GUI beeping 2005-03-08 09:55 lodott * cfg_game.c: store beep settings for server in database, fixes missing beep for connections 2005-03-08 09:54 lodott * snd.h, w32_sound.c, x11_sound.c: add routine for single beep, win and x11 2005-03-07 16:48 lodott * com_browse.c: properly cleaning up received browse datagrams 2005-03-07 16:22 lodott * xblast.c, menu_level.c, map.c, menu_level.h: some more memory cleanup to find real memory leaks 2005-03-07 15:34 lodott * cfg_level.c: fixing memory cleanup 2005-03-07 15:33 lodott * menu_network.c: fix some compiler warnings 2005-03-07 15:31 lodott * user.c, user.h: cleanup, raise network event for finished update 2005-03-07 14:47 lodott * menu_extras.c, network.c: handling ranking update with network events, more efficient display, error display 2005-03-07 14:43 lodott * mi_tag.c, mi_tag.h, mi_tool.c, mi_tool.h: adding new menu item - integer tag 2005-03-07 13:07 lodott * cfg_xblast.c: removing ip translation for ancient central 2005-03-07 13:05 lodott * mi_label.c, mi_tag.c: whitespace cleanup, some formatting 2005-03-03 18:17 lodott * ini_file.c, ini_file.h, xblast.c: clean up databases at end to ease memory debugging 2005-03-03 17:59 lodott * mi_stat.c: fixing a small memory leak (menu table cells not freed) 2005-03-03 17:47 lodott * mi_stat.c: whitespaces, formatting, comments 2005-03-03 17:36 lodott * cfg_game.c, menu_network.c: cleaning up ip history, proper cleanup of history data 2005-03-03 17:33 lodott * atom.c: formatting, making history atom creation more consistent 2005-03-02 15:36 lodott * cfg_game.c: fixing buffer overflow in ip history strings 2005-03-02 15:04 lodott * chat.c: fixing sys chat GUI display 2005-03-02 15:03 lodott * map.c: whitespaces, remove a small memory leak 2005-03-01 17:51 lodott * chat.c: refining chat output, adding name truncation option for display 2005-03-01 16:14 lodott * client.c, client.h, com_to_server.c: client correctly handles server disconnect announcement now, fixes double free 2005-03-01 16:11 lodott * server.c: fixing memory leak/assert when server fails to get udp socket to central 2005-03-01 10:04 lodott * net_tele.c: add malloc() check when creating telegrams, add comments for telegram parser 2005-02-28 13:27 iskywalker * xblast.man: rewrited for xblast tnt 2005-02-26 23:41 lodott * menu_network.c: simplify focus handlers, removing obsolete code 2005-02-26 23:40 lodott * mi_player.c: do not display player sprite when team color changed to invalid 2005-02-26 23:38 lodott * mi_host.c, network.c: display team "out", ignore out players in global game config 2005-02-26 23:36 lodott * server.c: handling an out request for a player 2005-02-26 23:34 lodott * com_to_client.c, com_to_client.h, network.h: adding a new team state "out" 2005-02-26 22:11 lodott * map.c, version.c, version.h: added version constant for 2_10_2, refined Version_AtLeast function 2005-02-26 19:23 lodott * menu_network.c, network.c, network.h: slightly reducing code for team color change 2005-02-26 18:42 lodott * intro.c: cleaning up, comments, format 2005-02-26 18:17 lodott * game_client.c: act on escape key in sync loops, forgotten in previous checkin 2005-02-26 18:13 lodott * game_client.c, game_server.c: allowing escape in sync loops, removing temporary chat deactivation 2005-02-26 18:10 lodott * game.c: code cleanup, simplifying player input initialization 2005-02-26 17:46 lodott * w32_event.c: cleaning up: whitespaces, formatting, comments 2005-02-25 22:46 lodott * intro.c: enabling chat during intro screens 2005-02-25 22:41 lodott * x11_event.c: enabling chat during sync'ing for x11 as well 2005-02-25 22:39 lodott * game_client.c, game_server.c, gui.h, w32_event.c: enabling chat during client/server sync step 2005-02-25 21:07 lodott * menu_network.c, network.c: max player check for server, when creating global game config 2005-02-25 19:23 lodott * menu_network.c: disallow start when hosts can't handle player count, set them out 2005-02-25 19:22 lodott * client.c, server.c: add case for game config result, set mask bytes after receiving global game config 2005-02-25 19:20 lodott * network.c, network.h: modified range checking, add functions to retrieve network data 2005-02-25 19:14 lodott * com_dgram.c, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.h: add support for changing maskbyte count for client/server dgram connections 2005-02-25 17:07 lodott * client.c, network.c, server.c, menu_game.c: use game constants received in game configs, store before entering network game 2005-02-25 17:01 lodott * cfg_game.h: comments, reordering, adding prototype 2005-02-25 14:44 iskywalker * menu_player.c: keep compiler with wall happy 2005-02-25 14:38 iskywalker * event.h, w32_event.c, x11_event.c, cfg_control.c, chat.c: insert enter as send key and corrected xbkeys and chat keys 2005-02-25 13:24 iskywalker * menu_player.c: keep compiler happy with Wall 2005-02-25 13:22 iskywalker * cfg_player.h, chat.c, configure.in, game_server.c, gui.h, menu_network.c, menu_player.c, mi_tool.c, mi_tool.h, timeval.h, x11_event.c, x11_socket.c: compiling with Wall and menu_player corrected for x11 2005-02-24 22:43 lodott * network.c: removing accidental protocol change, all 2.10.x should be compatible again 2005-02-24 21:19 lodott * mi_player.c: autoupdate colors and shapes in player colors menu 2005-02-24 21:18 lodott * menu_player.c: player colors: removing apply button, initial color selection, non-looping player animation 2005-02-24 21:16 lodott * mi_tool.c, mi_tool.h: make item selection external 2005-02-24 17:54 iskywalker * mi_tool.c, menu_player.c, mi_player.c, mi_player.h, mi_tool.h: got player updating, almost there 2005-02-23 15:11 lodott * com_to_server.c: remove superfluous line that can cause segfaults 2005-02-23 14:50 lodott * client.c: fixing misplaced code from last commit 2005-02-23 14:30 lodott * network.c: fixing keyboard assignemnt for chat 2005-02-23 13:45 alfie * aclocal.m4, config.h.in, configure: Update generated files. 2005-02-23 13:40 lodott * client.c, network.c, network.h, server.c: moving host id check for game config to network.c 2005-02-23 13:21 iskywalker * chat.c, x11_event.c: keep compiler happy 2005-02-22 20:10 lodott * com_dgram.c: fixing possible buffer overflow on server when clients have bad connection 2005-02-22 20:02 lodott * cfg_game.c, cfg_game.h: adding game constants to game confg, for later use; securing player data defaults 2005-02-22 19:47 lodott * game_server.c: disconnect when game init fails, instead just return 2005-02-22 19:44 lodott * version.c, version.h: making local version constant extern 2005-02-22 19:42 lodott * chat.c: fixing chat backspace implementation 2005-02-22 19:40 lodott * atom.c, atom.h: some new atoms for game constants 2005-02-22 18:05 iskywalker * player.c: corrected cloak bugg 2005-02-22 15:14 iskywalker * x11_event.c: fprintf out 2005-02-22 15:12 iskywalker * x11_event.c: chat for x11 2005-02-21 18:00 lodott * chat.c, chat.h: updated chat event handling, fixing a bug when canceling chat 2005-02-21 17:57 lodott * cfg_control.c, event.c, event.h: modifying existing key tables 2005-02-21 17:54 lodott * w32_event.c: cleaning up windows keyboard event generation 2005-02-21 17:51 lodott * game.c: changing order in event handling 2005-02-21 17:49 lodott * mi_tool.c: cleaning up event handling for menus 2005-02-20 15:19 lodott * w32_event.c: correcting a typo in precious checkin 2005-02-20 15:15 lodott * w32_event.c: some minor correction, adding the Finish routine for the new keytable 2005-02-20 15:13 lodott * x11_event.c: adding similar modifications as for w32, but ascii keys still don't work 2005-02-20 14:40 lodott * x11_event.c: fix to make it compile, whitespaces - chat doesn't work, correct events need yet to be generated 2005-02-20 14:31 lodott * chat.c, chat.h: belongs to previous checkin 2005-02-20 14:24 lodott * client.c, event.c, game.c, game_client.c, game_server.c, mi_tool.c, network.c, server.c, w32_event.c: moving chat event handling to chat.c, generation of chat-specific events, chatting is done with the game keys alone, both in menu as well as in game (windows only so far) 2005-02-20 13:53 lodott * cfg_control.c, cfg_control.h, event.h: adding a keytable for chat keys 2005-02-19 21:10 lodott * central.c, client.c, game_client.c, game_server.c, menu_network.c, network.c, network.h, server.c, server.h: separating global from local config, use define for game config atoms, make server receive global config like clients do, fix attempt for NAT detection 2005-02-19 20:59 lodott * com_dgram.h, xblast.h: moving MASK_BYTES define to xblast.h 2005-02-19 20:57 lodott * w32_socket.c: fixing compile error with Debug_Socket 2005-02-18 18:42 iskywalker * INSTALL: better instructions 2005-02-18 18:23 iskywalker * INSTALL, acinclude.m4, configure.in: better INSTALL and configure options 2005-02-18 16:49 iskywalker * configure.in, xbsndsrv.c: sound support for solaris 2.7 mschoepf 2005-02-17 23:47 lodott * client.c, client.h, com_to_server.c, menu_network.c, network.c, network.h, server.c: complete revision of game config exchange between client/server requires more testing!! 2005-02-17 23:44 lodott * cfg_game.c: checking range when extracting game config, version storage/retrieval secured 2005-02-17 17:10 lodott * Makefile.windows: correct comment regarding cygwin options 2005-02-17 17:08 lodott * client.c, client.h, server.c, menu_network.c, network.c, network.h: storing local host id in network.c, for both server and client 2005-02-17 17:04 lodott * version.c: minor correction in debug output and comments 2005-02-17 14:59 lodott * client.c, network.c, network.h, server.c, version.c, version.h: moving version control for hosts from network.c to version.c 2005-02-17 12:52 lodott * mi_tool.c: removing unneeded routine 2005-02-17 12:50 lodott * game.c: removing unnecessary warning flood and variables 2005-02-16 14:49 alfie * xbsndsrv.c: Incorporated patch for 16 bit solaris stereo support, sent in by 2005-02-15 19:12 lodott * game.c: assigning input events to default players, remove unneeded vars 2005-02-15 16:41 lodott * menu_network.c: server sends local players in final game config again 2005-02-15 15:06 lodott * client.c: fixing compile error with DEBUG_CLIENT 2005-02-15 15:04 lodott * server.c: fixing previous checkin 2005-02-14 13:49 lodott * server.c, server.h: using receive mechanism for local server init 2005-02-12 13:08 lodott * chat.c, chat.h, client.c, client.h, com_to_client.c, com_to_server.c, game.c, mi_tool.c, network.c, network.h, player.c, server.c: reworking chat, moving chat code to chat.c 2005-02-12 12:49 lodott * debug.c, debug.h: debugging out for chat 2005-02-10 18:50 lodott * Makefile.windows: setting no-cygwin compile as default (cygwin-compile currently broken). removing mini as default 2005-02-10 17:27 lodott * com_dgram.c, com_dgram.h: adding support for extensible action mask size 2005-02-10 13:01 iskywalker * com_dgram.c, com_dgram.h: fixed mask problem, hopefully 2005-02-08 21:02 lodott * menu_network.c, client.c: immediate disconnect from server on error, no delay 2005-02-08 20:57 lodott * mi_host.c: adding reset for local request 2005-02-08 20:27 lodott * menu_network.c: getting back OLDMENU, instead removing the old menu code 2005-02-08 20:09 lodott * server.c, client.c, network.c, network.h: adding checks for MAX_PLAYER when receiving game configs 2005-02-07 15:09 iskywalker * game_client.c, game_server.c, mi_tool.c, mi_tool.h: fixed chat bug 2005-02-03 16:21 lodott * com_newgame.c, x11_socket.c: use sun macro instead of sparc macro 2005-02-02 14:33 lodott * cfg_game.h, menu_network.c, mi_host.c, network.c, network.h: removing OLDMENUS switch 2005-02-02 14:21 lodott * client.c, server.c, version.c, version.h: minor rearrangement of version tools, added comments 2005-02-02 14:20 lodott * debug.h: deactivating implicit DEBUG macro 2005-02-02 09:52 alfie * configure: Update generated configure, too. 2005-02-01 19:05 lodott * game_server.c: continually send suicide for unlinked players to avoid async by data loss 2005-02-01 18:47 lodott * action.c: really fixing auto-suicide bug (missing default value) 2005-02-01 13:17 lodott * game_client.c: correcting finish gametime for client 2005-02-01 12:40 lodott * configure.in, version.h: bumping version to 2.10.1-cvs for development 2005-02-01 11:45 lodott * menu_game.c: adding bot option for server in game setup 2005-02-01 11:44 lodott * com_dgram.h: removing assertion failure on clients when level times out on clients 2005-02-01 11:44 lodott * game_client.c: no action output unless explicitly requested with DEBUG_ACTION 2005-01-31 21:28 lodott * game_client.c: adding action debugging, avoid early server events, continue to wait on invalid server events - fixes async action status on client/server, making client timeout 2005-01-31 21:23 lodott * com_dg_server.c, com_dgram.c: fixing some debugging output 2005-01-31 21:21 lodott * debug.c, debug.h: debug output for game action 2005-01-31 07:45 iskywalker * xblast.wxs: better configuration, with control dialogs 2005-01-30 13:45 lodott * game_server.c: fixing incorrect team counting in team mode 2005-01-30 02:24 lodott * game_client.c, player.c: improving client bot management, multiple local players are handled 2005-01-30 01:45 lodott * game_server.c: improving server bot handling, handles multiple local players now 2005-01-30 01:43 lodott * game.c: simplification of local event checking 2005-01-30 01:42 lodott * cfg_game.c: adding explicit conversion result checking, for easier readability 2005-01-30 01:33 lodott * bot.c, player.c, player.h: adding some bot-related routines 2005-01-29 13:57 lodott * server.c: fix query allocation for new game connection 2005-01-28 23:12 lodott * client.c: non-SMPF clients can deal with an SMPF server now 2005-01-28 21:58 lodott * mi_host.c: fix display bug for player graphics on change of team color 2005-01-28 21:56 lodott * network.c, network.h, server.c: save team assignment before switch to chaos, restore on switch back 2005-01-28 21:54 lodott * com_newgame.c: do not connect socket for sparcs, can cause trouble with sendto() 2005-01-28 16:18 alfie * INSTALL, README, menu.c, menu_network.c: Changed irc.xblast-center.com to xblast.sf.net/irc/ 2005-01-27 23:51 iskywalker * menu_network.c, mi_host.c, x11_event.c: Rmoved some debug msgs, remove team bug 2005-01-26 08:29 iskywalker * xblast.wxs: add desktop shortcut and icon 2005-01-25 20:46 alfie * version.h: Uups, remove the CVS from VERSION_STRING 2005-01-25 12:59 iskywalker * makewxs.sh, xblast.wxs: initial import, files for .msi 2005-01-23 17:28 lodott * cfg_player.c: whitespace cleanup, set default PID to invalid 2005-01-23 16:55 lodott * central.c: fix player registration for client in slot #0 2005-01-23 16:54 lodott * menu_player.c: general cleanup, comments 2005-01-23 16:13 lodott * debug.c: typo fix 2005-01-23 16:12 lodott * menu_extras.c, menu_extras.h, user.c: fixing bug when updating central scores 2005-01-23 15:02 lodott * menu_extras.c: comments, general cleanup 2005-01-23 14:30 lodott * com_query.c: corrected output 2005-01-23 14:29 lodott * menu_game.c: removing team mode in server config (default none) 2005-01-23 14:26 lodott * net_dgram.c: some minor correction in comments/output 2005-01-23 14:24 lodott * browse.c: removing superfluous output 2005-01-23 14:23 lodott * menu_network.c: fixing update bug in central menu 2005-01-23 14:21 lodott * central.c, central.h: general cleanup, debugging output 2005-01-23 14:19 lodott * com_central.c, com_central.h: some renaming, more debugging and general cleanup 2005-01-23 14:18 lodott * debug.c, debug.h: adding debugging for C2B (central udp socket) 2005-01-23 12:07 lodott * debug.c, debug.h: whitespace-cleanup 2005-01-23 12:05 lodott * debug.c, debug.h: central debug output 2005-01-21 22:22 lodott * client.c, com_query.c, com_query.h: central queries only on default device, no broadcast previous behaviour if FULL_CENTRAL_QUERY set 2005-01-21 22:19 lodott * net_dgram.c: extra check for failure to set broadcast flag 2005-01-20 13:17 lodott * Makefile.windows, INSTALL: Updated windows/cygwin Makefile, more detailed INSTALL instructions 2005-01-18 15:36 lodott * game_client.c, game_server.c: more frequent updating of player link status plus bugfix (missing break in switch) 2005-01-18 15:33 lodott * game.c, server.c, version.c: some debug corrections 2005-01-17 16:21 lodott * com_dg_client.c: server bases udp timeout for clients only on receive interval now 2005-01-17 16:17 lodott * client.c, com_query.c, game_client.c, game_server.c: some minor output changes, removing a compiler warning 2005-01-16 08:48 iskywalker * net_socket.h: forgot a ifdef 2005-01-15 17:41 iskywalker * action.c, com_listen.c, com_query.c, common.h, net_socket.h, time.c, timeval.h, w32_joystick.c, w32_socket.c, xblastc.dsp: memory leak in joystick, abort loser problem correctted, cygwin, wms and mingw compatible now 2005-01-15 12:48 lodott * client.c: removing accidentally checked in line, adding a comment 2005-01-15 12:40 lodott * client.c, com_dgram.c, com_newgame.c, com_query.c, common.h, debug.c, server.c, timeval.h, util.c, w32_event.c: removing some more compiler warnings 2005-01-15 09:41 iskywalker * bot.c: fixed memory leak 2005-01-14 22:20 iskywalker * map.c: memory leak fixed 2005-01-14 19:57 lodott * cfg_level.c, cfg_stat.c: removing compiler warnings 2005-01-14 13:46 lodott * client.c, menu_network.c, server.c, w32_event.c, w32_image.c, w32_pixmap.c: removing some minor compiler warnings 2005-01-14 13:20 alfie * configure, configure.in: Updated version in configure.in also. 2005-01-13 18:58 lodott * map.c, version.c, version.h: activating slowMotionBurst for version 2.10.1 2005-01-13 18:52 lodott * debug.c, debug.h: debug output for version stuff 2005-01-13 11:40 lodott * str_util.c: fixing split error for strings with trailing spaces - from http://luc.saillard.free.fr/XBlast-TNT/patches/XBlast-TNT-str_util-memleak.patch 2005-01-12 15:50 lodott * client.c, network.c, network.h, server.c, version.c, version.h: calculate joint(=min) version of all connected hosts 2005-01-12 15:48 lodott * bomb.c, map.c: deactivating slowMotionBurst for release 2005-01-12 13:21 alfie * Makefile.am, Makefile.in, config.h.in: Added version.c to Makefile.am (rest is auto generated). 2005-01-12 13:02 alfie * Makefile.in, configure: Updated the generated files. 2005-01-12 00:20 lodott * cfg_game.c, cfg_game.h, client.c, network.c, network.h, server.c, version.c, version.h: basic version management for network games 2005-01-11 22:44 lodott * atom.c, atom.h, bomb.c, func.c, info.c, map.c, player.c, shrink.c: checking existence of level sections, adding missing default for ceilNasty 2005-01-11 19:48 iskywalker * atom.c, atom.h, bomb.c, bomb.h, map.c: slowmotionflame request from zorgzorg2 2005-01-11 17:58 iskywalker * config.h[DEAD]: delete old config 2005-01-11 17:51 iskywalker * mi_tool.c, random.c: new configure method with config.h, old fix for leveleditor 2005-01-11 17:37 lodott * client.c, client.h, game_client.c: clearing player actions at client before each level 2005-01-11 17:33 iskywalker * configure.in, color.h, common.h: new configure method with config.h 2005-01-11 17:32 iskywalker * xbconfig.h: oldconfig.h 2005-01-11 17:30 iskywalker * config.h[DEAD], config.h: changed old coinfig.h to configure config.h 2005-01-11 15:33 lodott * game.c: clear suicide flag for next player action 2005-01-11 14:00 alfie * game_server.c: Made MAX_REJECTS a define and default to 50. 2005-01-08 05:17 lodott * menu_network.c, server.c: fixing server override of client Go! requests 2005-01-07 23:36 lodott * server.c: eliminating superfluous host/team state changes, some output corrections 2005-01-07 23:34 lodott * menu_network.c: deactivating host button after disconnect 2005-01-07 19:06 lodott * mi_host.c: host button correctly cleared now, when client disconnects 2005-01-07 00:43 lodott * game_server.c: react to disconnect's between game start and first level 2005-01-06 23:50 alfie * version.h: Mark 2.10.0 as CVS version in VERSION_STRING. 2005-01-06 23:09 lodott * cfg_level.c: actually call level parser when checking the level.. 2005-01-06 22:36 alfie * config.guess, config.sub: Updated to more current versions. 2005-01-06 22:34 lodott * menu_game.c: song choice also in "join network" menu 2005-01-06 22:27 lodott * game_client.c, game_local.c, game_server.c: stop the correct song on level end 2005-01-06 21:44 lodott * com_query.c, intro.c, network.c: some more warnings removed 2005-01-06 21:42 lodott * cfg_game.c, cfg_game.h, game_client.c, game_local.c, game_server.c, menu_game.c: music choice via combobox instead of boolean toggle 2005-01-06 18:28 lodott * ini_file.c, ini_file.h, menu_network.c, mi_host.c: removing some compiler warnings, thanks to jlh 2005-01-06 00:17 alfie * server.h: GetTeamState should return TeamState and GetHostState should return HostState. :) 2005-01-05 18:20 lodott * cfg_level.c: removing check for level version entries 2005-01-05 17:14 alfie * Makefile.am, configure, version.h: Bumped version for release, did autogen.sh for release, too. 2005-01-05 17:12 alfie * xbsndck.sh[DEAD], xbsndsrv.c: Cleaned up. 2005-01-04 15:58 iskywalker * configure.in: optimized 2005-01-04 15:19 iskywalker * xbsndsrv.c: final version (haha) 2005-01-04 14:53 iskywalker * Makefile.am, configure.in: autoconf tools rpaired 2005-01-04 03:02 iskywalker * x11c_init.c, xbsndsrv.c: corrections, xbsndsrv n==0, is EOF, XFree xsh not xch 2 times 2005-01-02 19:36 iskywalker * atom.c, x11c_image.c, x11c_init.c, xbsndsrv.c: Stefan proposals 2004-12-21 02:19 iskywalker * Makefile.am, map.c, xbsndck.sh, xbsndsrv.c: checking for running xblast versions 2004-12-19 15:05 iskywalker * xbsndsrv.c: fixed bug for creating file 2004-12-06 15:41 lodott * player.c: fixed reclives level entry, doesn't overwrite maxLives anymore 2004-12-04 06:04 lodott * cfg_level.c: complete revision: some cleanup, parse levels with -check instead of config; let client reject a level proposal if it parses with warnings 2004-12-04 06:01 lodott * info.c, info.h, level.c, level.h: store game mode in info.c 2004-12-04 05:58 lodott * map.c: splitting map into parse and configure step 2004-12-04 05:57 lodott * game_client.c, game_server.c: minor fix for clean end of game 2004-12-04 03:21 iskywalker * xbsndsrv.c: checking for multiple sound servers 2004-12-04 01:44 lodott * cfg_game.h, menu_network.c, mi_host.c, network.c, network.h, server.c, server.h: standard is now previous STATES with simplified request handling (imitating the previous standard plus Ready states and dynamic team mode) REQUESTS flag adds detailed request info OLDMENUS flag for old code (not tested, expect to be removed soon) 2004-12-04 01:35 lodott * com_to_client.c: disable server listening to "toggle" signals from client 2004-12-01 12:40 lodott * map.c: correcting extra probabilities 2004-11-29 17:32 lodott * bomb.c, player.c: complete conversion tables 2004-11-29 16:55 lodott * map.c: add non-NULL entry for no extra Distribution in levels 2004-11-29 16:49 iskywalker * menu_edit.c: [no log message] 2004-11-29 14:48 lodott * random.c: formatting 2004-11-29 14:46 lodott * cfg_game.c: adapting to new conversion routines 2004-11-29 14:44 lodott * bomb.c, bomb.h, func.c, func.h, info.c, info.h, level.c, map.c, map.h, player.c, player.h, scramble.c, scramble.h, shrink.c, shrink.h: improved level parsing, unknown strings are stored as warnings 2004-11-29 14:41 lodott * ini_file.c, ini_file.h: some functions to deal with databases 2004-11-29 14:40 lodott * xblast.c: whitespaces, return -2 when -check fails 2004-11-27 02:34 iskywalker * introdat.c, menu.c: change default central, publicitys spams 2004-11-26 11:27 alfie * Changelog[DEAD]: This file didn't contain anything useful and creates a conflict on not-to-be-named stupid file systems. 2004-11-19 17:09 lodott * game_client.c, game_demo.c, game_local.c, game_server.c, intro.c, intro.h: auto-keypressing for bot on info/levelend/scoreboard 2004-11-18 15:25 lodott * server.c: fixed dgram timeout, udp wasn't removed before 2004-11-15 19:03 lodott * game_server.c: fixed async random numbers - thanks to lefant for finding/debugging this one! 2004-11-14 15:17 lodott * game_client.c, game_local.c, game_server.c: handle errors when configuring a level 2004-11-14 15:15 lodott * ini_file.c, ini_file.h: some new database functions 2004-11-13 18:40 lodott * ini_file.c, ini_file.h: formatting, reordering 2004-11-13 16:48 lodott * level.c, level.h: corrected version of previous commit 2004-11-13 16:45 lodott * level.c: whitespace cleanup, make debug output dependent on DEBUG_LEVEL switch 2004-11-13 12:25 lodott * game.c: formatting, cleaning up LevelResult 2004-11-11 17:58 lodott * action.c, game.c: fixed suicide feature 2004-11-11 17:22 lodott * network.c: proper cleanup of network data on disconnect, whitespaces removed 2004-11-11 15:02 lodott * game_server.c: check for breakdown of connection to central 2004-11-11 15:01 lodott * menu_extras.c: player registration adapted, trailing whitespaces 2004-11-11 14:58 lodott * user.c, user.h: event handling for central connection, code cleanup 2004-11-11 14:57 lodott * com_to_central.c, com_to_central.h: implementing events for connection to central 2004-11-11 14:54 lodott * debug.c, debug.h: debugging for user connection to central 2004-11-11 12:48 lodott * user.c, user.h: formatting 2004-11-08 20:43 lodott * net_dgram.c, net_tele.c, net_tele.h: formatting, completed debug translations for telegram id's 2004-11-08 20:08 lodott * game_client.c: formatting, more detailed exit messages when server disconnects 2004-11-08 20:07 lodott * game_server.c: correctly check for disconnections, proper cleanup 2004-11-08 20:05 lodott * game.c, server.c: implement suicide 2004-11-08 20:02 lodott * player.c, player.h: remove disconnect solution for suicide, does not work with more than two clients 2004-11-08 19:59 lodott * action.c, action.h, xblast.h: add suicide action, formatting 2004-11-08 15:08 lodott * game_server.c, player.c, player.h: revising game server, immediately suicide disconnected players 2004-11-08 15:05 lodott * debug.c, debug.h: debug output for game and level 2004-11-06 22:37 lodott * server.c, server.h: DgramClosed event, inform others when dgram fails for client 2004-11-06 22:35 lodott * com_dg_server.c: handle dgram events, in particular Close 2004-11-06 22:33 lodott * com_dg_client.c: DgramClosed event for client 2004-11-06 22:32 lodott * com_dgram.c: commenting out test assert 2004-11-06 22:30 lodott * client.c, client.h: handle DgramEvents instead of DgramErrors, in particular XBSC_DgramClosed 2004-11-06 19:54 lodott * menu_network.c: client needs ping to be marked as In now (-DSTATES only) 2004-11-06 19:52 lodott * com_dgram.h: additional dgram event, belongs to previous commit 2004-11-06 19:51 lodott * com_dg_client.c, server.c, server.h: replace DgramError by DgramEvent, use CLOSE event for cleanup 2004-11-06 19:46 lodott * com_dgram.c: more detailed dgram events 2004-11-06 02:04 lodott * client.c, client.h, server.c, server.h: stream events handling instead of stream errors 2004-11-06 02:01 lodott * com_from_central.h: some comments 2004-11-06 02:00 lodott * com_from_central.c: basic stream event handling, automatic connection shutdown in background 2004-11-06 01:59 lodott * com_to_central.c: basic stream event handling 2004-11-06 01:59 lodott * com_to_server.c: stream event handling 2004-11-06 01:56 lodott * com_to_client.c: stream event handling, use prepFinish for automatic structure removal in background 2004-11-06 01:53 lodott * com_stream.c, com_stream.h: define stream events, extend error handler to an stream event handler 2004-11-06 01:38 lodott * debug.c, debug.h: debug output for tcp to and from central 2004-11-05 16:43 lodott * com_listen.c, com_listen.h, server.c: added regular close of listen socket and shutdown flag to distinguish between expected and unexpected shutdowns. 2004-11-05 15:59 lodott * server.c, com_listen.c, server.h: revising com_listen.c, adding shutdown notification to catch socket errors 2004-11-05 15:57 lodott * debug.c, debug.h: debug output for com_listen.c 2004-11-04 17:04 lodott * x11_socket.c: perror output for debug 2004-11-04 16:48 lodott * server.c: minor fix in debug output 2004-11-04 16:46 lodott * w32_socket.c: added error codes for debug output 2004-11-04 16:41 lodott * socket.h: reordered 2004-11-04 16:40 lodott * net_socket.c: implement user port range for client sockets use #define's USER_MINPORT and USER_MAXPORT to set range at compile time 2004-11-04 16:26 lodott * com_newgame.c: do not broadcast game data to central 2004-11-04 16:25 lodott * x11_socket.c: use ACCEPT_TIMEOUT for accept instead of CONNECT_TIMEOUT 2004-11-04 16:23 lodott * client.c, com_query.c, com_query.h: minor changes, better variable naming/order 2004-11-03 14:56 lodott * x11_socket.c: complete revision, making output similar to w32_socket.c 2004-11-02 21:25 lodott * com_newgame.c: minor bug, some cosmetic changes 2004-11-02 21:22 lodott * w32_socket.c: complete revision, fixed interface detection (WSIF_MOD is not needed anymore) 2004-11-02 21:20 lodott * debug.c, debug.h: debug output for sockets 2004-11-02 18:36 lodott * com_browse.c: require browse events for browse communications 2004-11-02 18:28 lodott * com_central.c: browse events for central games 2004-11-02 18:20 lodott * client.c, client.h, com_query.c, com_query.h: browse events and interface id for query communication, better debug output 2004-11-02 18:16 lodott * debug.c, debug.h: debug output for query sockets 2004-11-02 16:10 lodott * server.c: use default interface for server registration at central; compile with -DOLDIFCODE to get the old behaviour 2004-10-30 21:18 lodott * com_reply.c: revising reply communication, adding browse event handling 2004-10-30 21:16 lodott * com_newgame.c: cosmetic change 2004-10-30 21:15 lodott * browse.c: commenting browse communication parser 2004-10-30 21:14 lodott * debug.c, debug.h: debug output for reply communication 2004-10-30 20:11 lodott * com_newgame.c, com_newgame.h: revising newgame communication, close signal now triggers shutdown *after* sending 2004-10-30 20:08 lodott * server.c, server.h: splitting newgame close into an active and passive routine 2004-10-30 20:04 lodott * menu_network.c: fixing unnecessary initial double send of game data 2004-10-30 20:02 lodott * debug.c, debug.h: Debug output for Newgame sockets 2004-10-26 09:16 aluleich * debug.c, debug.h: Corrected some misplaced debug-macros 2004-10-21 19:28 lodott * com_browse.c, com_browse.h, com_central.c, com_newgame.c, com_query.c, com_reply.c: add browse event handling mechanism 2004-10-21 19:27 lodott * debug.c, debug.h: debug output for Browse networking level 2004-10-20 01:20 lodott * debug.c, debug.h: remove warnings for debug outputs with undefined DEBUG flags 2004-10-19 23:33 iskywalker * menu_network.c, network.c: keep compiler happy 2004-10-19 23:27 lodott * network.c: fixed compile error without DEBUG_NETWORK 2004-10-19 22:19 lodott * menu_network.c, server.c: fixing request handling, restricting local requests 2004-10-19 21:19 lodott * client.c, com_to_server.c, com_to_server.h: fixed client join with two players 2004-10-19 18:28 lodott * network.c, network.h, server.c: team request handling, team mode now negotiable 2004-10-19 17:59 iskywalker * bot.c, cfg_level.h, client.h, game.c, game_client.c, game_local.c, gui.h, ini_file.h, map.c, map.h, menu_edit.c, menu_edit.h, menu_network.c, mi_label.c, mi_tool.c, network.h, player.c, player.h, sdl_event.c, shrink.c, shrink.h, sprite.c, status.c, status.h, w32_pixmap.c, x11c_pixmap.c, xblast.c: keep compiler with Wall happy 2004-10-19 17:31 lodott * menu_network.c: implement remote start 2004-10-19 17:30 lodott * mi_host.c: slight correction of hostname display in wait menu 2004-10-19 17:28 lodott * network.c, network.h, server.c: request handling for server, in particular remote start 2004-10-19 17:27 lodott * debug.c, debug.h: Debug output for network 2004-10-19 15:42 iskywalker * bot.c: keep compiler happy 2004-10-19 09:06 lodott * menu_network.c: fix automatic change to team mode in standard mode 2004-10-19 01:57 iskywalker * game_local.c: no fprintfs 2004-10-18 21:32 iskywalker * action.h, game.c, game_client.c, game_local.c, game_server.c: auto bot activation 2004-10-18 08:56 lodott * menu_network.c: fix to allow non-team game in standard mode 2004-10-17 21:11 iskywalker * menu_edit.c, shrink.c: Alll should work now, documentation and some saving stuff should be although implemented _edit level info_ deletes all changed stuff _only map is saved_ 2004-10-15 23:14 lodott * client.c, com_to_server.c, com_to_server.h: moving request handling to client 2004-10-15 22:08 lodott * cfg_player.c, cfg_player.h, menu_network.c, mi_player.c: show sprites in team colors in wait menu 2004-10-13 17:02 lodott * cfg_game.h: add invalid player team, for correct transfer of game setup 2004-10-13 17:01 lodott * menu_network.c: reimplementing start button, -DSTATES playable now 2004-10-13 16:58 lodott * server.c, server.h: moved initial state assignment to server, clean up comments 2004-10-13 16:55 lodott * client.c: clear data when disconnecting 2004-10-13 16:53 lodott * network.c, network.h: routines to clear host data 2004-10-13 16:51 lodott * mi_host.c: fix initial local team request 2004-10-12 18:47 lodott * com_to_client.c: minor corrections 2004-10-12 10:56 lodott * com_to_client.c, com_to_server.c: unified request data format for server send/client receive 2004-10-11 14:21 lodott * server.c, server.h: correct types instead of unsigned for states, basic server state request handling 2004-10-11 14:20 lodott * menu_player.c, mi_host.c: fixing compile error for standard due to previous checkin (typedef move) 2004-10-11 14:01 lodott * mi_tool.h, network.c, network.h: moving type def for host/team states to network 2004-10-11 13:59 lodott * mi_host.c: improved host/team item display with respect to local requests 2004-10-10 21:08 lodott * client.c, client.h, com_dg_client.c, menu_network.c, network.c, network.h, server.c, server.h: moving ping time data to network.c 2004-10-10 21:07 lodott * mi_host.c: defining out team state Invalid for standard/SMPF 2004-10-10 20:29 lodott * mi_host.c, mi_tool.h: sensible starting values for host/team items 2004-10-10 20:21 lodott * com_to_server.c: fix for sending team requests 2004-10-10 18:02 lodott * client.c, menu_network.c, network.c, network.h, server.c: moving state data to network, adding network types 2004-10-10 14:31 lodott * menu_network.c, mi_tool.c, mi_tool.h, mi_host.c, mi_host.h: added focus handler for host/team items (-DSTATES) 2004-10-09 19:30 lodott * menu_network.c, mi_host.c, mi_host.h, mi_tool.c, mi_tool.h: variant wait menu for client/server with -DSTATES (not finished); completely separated from -DSMPF and standard now 2004-10-09 13:49 lodott * menu_network.c, mi_host.c: trivial requests exchange for hosts implemented 2004-10-09 13:47 lodott * com_dg_client.c: allow to check connectedness of server just as for a host 2004-10-09 13:45 lodott * server.c, server.h: proper data initialization, prototypef for state retrieval 2004-10-09 13:44 lodott * client.c, client.h: proper data initialization, state data retrieval unified 2004-10-08 21:31 lodott * client.c, client.h, com_to_server.c, com_to_server.h: client send/rcv facilities for host/team state requests 2004-10-08 20:34 lodott * com_to_client.c, net_tele.h: send/rcv facilities for server for host/team state requests 2004-10-08 19:37 lodott * mi_host.c, menu_network.c, mi_host.h, mi_tool.c, mi_tool.h: display for host/team states (with -DSTATES) 2004-10-06 23:33 lodott * com_to_client.c, com_to_client.h, menu_network.c, server.c, server.h: check dgram success, completed server states managing except actual sending 2004-10-06 22:20 lodott * menu_network.c: Started new variant for wait menu display (use -DSTATES) 2004-10-06 22:16 lodott * mi_host.c, mi_tool.c, mi_tool.h, mi_host.h: added generic host item with requested states, ordered source by item type 2004-10-06 12:22 lodott * menu_network.c: reordering source into menu sections 2004-10-05 20:11 lodott * client.c, client.h, com_to_server.c, com_to_server.h: Clean socket closing for clients 2004-10-05 20:08 lodott * server.c, server.h: slight refinement of disconnect sequence 2004-10-05 18:26 lodott * server.c, server.h, com_to_client.c, com_to_client.h: better structuring, error handling, cleaner socket closing 2004-10-05 13:24 lodott * client.c, client.h, com_dg_server.c: reordering, completing prototypes, client controls dgram shutdown now 2004-10-05 12:35 lodott * client.c, client.h, com_to_server.c, com_to_server.h: better structuring, debugging, error communication 2004-10-05 12:32 lodott * debug.c, debug.h: C2S and S2C debugging 2004-10-04 15:18 lodott * com_stream.c, com_stream.h, debug.c, debug.h: debugging for streams, minor code cosmetics 2004-10-04 14:44 lodott * com_dg_client.c, server.c, server.h: adding prototypes for server send, server controls dgram shutdown now 2004-10-04 12:13 lodott * client.c, client.h, com_dg_server.c, com_dg_server.h: better error communication, more structuring 2004-10-03 17:27 lodott * com_dg_client.c, com_dg_client.h, server.c, server.h: structuring source files, better error communication, preparation for host/team states extension 2004-10-03 16:36 lodott * debug.c, debug.h: Add debugging output for SERVER 2004-10-02 21:52 lodott * com_dg_client.c, com_dg_server.c, com_dgram.c, com_dgram.h: better variable names and comments for dgram communications, info handler extending finish handler, preparations to fix potential segfaults when errors occur 2004-10-02 21:45 lodott * debug.c, debug.h: Debug output for DGRAM, D2C, D2S 2004-09-26 00:07 iskywalker * menu_edit.c: imporved led and shrink 2004-09-23 18:02 lodott * client.c, client.h, com_to_server.c: Restructuring client.c, prepare host/team state protocol extension 2004-09-23 17:57 lodott * debug.c, debug.h: Add Dbg_Client() for use with -DDEBUG and -DDEBUG_CLIENT 2004-09-23 13:36 iskywalker * menu_edit.c, shrink.c: editor improved 2004-09-22 23:47 iskywalker * menu_edit.c, shrink.c, shrink.h: imporved editor 2004-09-20 19:34 iskywalker * menu.c: better central choose 2004-09-20 10:00 alfie * cfg_xblast.c: Changed default central to xblast.debian.net. 2004-09-17 20:15 lodott * atom.c, atom.h: Added atoms for result and ratings file name 2004-09-17 19:50 lodott * central.c: create rating/result files for central, better comments 2004-09-17 18:56 lodott * cfg_player.c, cfg_player.h: Added functions to append game results and time+rating to config files 2004-09-17 18:54 lodott * ini_file.c, ini_file.h: Added function to append database entries to config files 2004-09-17 18:05 lodott * central.c: Added name check for player registration, code cleanup 2004-09-17 17:59 lodott * cfg_player.c, cfg_player.h: Added function to find player name doubles 2004-09-17 15:25 lodott * com_central.c: Central checks received gameID and host:port now - formatting, comments 2004-09-17 12:42 lodott * com_newgame.c, com_query.c: Better debug output for debugging central messages 2004-09-16 20:32 lodott * net_tele.h: Fixed telegram id order to allow registering in central 2004-09-16 20:14 iskywalker * bomb.c, map.c, menu.c, menu_edit.c: central default button, ringoffire corrected, menu_edit extended 2004-09-16 15:22 lodott * com_query.c: Better debug output for -DDEBUG 2004-09-13 22:33 tenderflake * sdl_common.c, sdl_image.h: Changed #include sdl files to lowercase. 2004-09-13 22:32 tenderflake * sdl_image.c: Set transparent background for epm files 2004-09-13 10:15 alfie * Makefile.in: Synced Makefile.in with Makefile.am 2004-09-13 09:10 lodott * menu_network.c: Recognizes ready hoststate as in now, some streamlining 2004-09-12 22:11 lodott * client.c, client.h, com_to_client.c, com_to_client.h, com_to_server.c, menu_network.c, mi_host.c, mi_tool.h, net_tele.h, network.h, server.c, server.h: Added "Ready" hostState and means for its communication and display, slight protocol change 2004-09-10 19:03 tenderflake * sdl_common.c, sdl_common.h, sdl_image.c, sdl_image.h: Converted functions that load epm, ppm, etc to generate SDL_Surface bitmaps. 2004-09-09 23:33 iskywalker * sdl_common.c, sdl_common.h, sdl_event.c, sdl_image.c, sdl_image.h, sdl_init.c, sdl_pixmap.c, sdl_ppm.c, sdl_text.c, sdl_tile.c: initial import for sdl bracnch 2004-09-08 13:09 lodott * client.c, com_query.c, com_query.h: Proper free'ing of Query sockets for Lan/Central searching 2004-09-08 08:18 lodott * Makefile.windows: Added missing object file menu_edit.o 2004-09-07 19:40 iskywalker * menu_edit.c: set led 2004-09-07 19:05 iskywalker * menu_edit.c: a lot of improvements 2004-09-02 12:11 iskywalker * bomb.c, ini_file.c, mi_tool.c: bugs corrected 2004-08-30 16:57 iskywalker * game.c, game_client.c, player.c: some gimmics and correctures 2004-08-30 02:55 iskywalker * menu_edit.c: seg fault corrected 2004-08-30 01:06 iskywalker * sprite.c, ini_file.c, menu_edit.c, menu_edit.h, mi_tool.c, mi_tool.h, shrink.c: enhanced editor and some nice compiler,want to get -Wall 2004-08-21 23:48 iskywalker * SConstruct: initial import 2004-08-21 16:04 iskywalker * func.c, func.h, map.c, menu_edit.c, mi_map.c, mi_tool.c, mi_tool.h, sprite.c, sprite.h: editor scpecial extras,bug fixed 2004-08-19 19:49 iskywalker * Makefile.am, game_client.c, menu_edit.c, menu_edit.h: wait ingame menu better, make dist better, compiles nicier 2004-08-19 06:54 alfie * Makefile.in, depcomp: automake1.7 needs depcomp Makefile.in sync with Makefile.am 2004-08-17 19:26 iskywalker * README: Sound bug 2004-08-17 18:23 iskywalker * menu_edit.c, map.c, map.h, mi_tool.c, sprite.c, w32_pixmap.c, x11c_pixmap.c: Editor improved,(evilbomb showinging and saving 2004-08-17 11:57 iskywalker * Makefile.am: level editor 2004-08-17 11:33 iskywalker * menu_extras.c: level editor 2004-08-16 22:16 iskywalker * menu_edit.c, menu_edit.h: initial import 2004-08-16 22:14 iskywalker * bomb.c, bomb.h, event.h, map.c, map.h, menu_extras.c, mi_map.c, mi_tool.c, mi_tool.h, shrink.c, shrink.h, w32_event.c, x11_event.c, x11_event.h: level editor integrated 2004-08-16 18:51 alfie * Makefile.am, Makefile.in, aclocal.m4, config.guess, config.sub, configure: Some long standing updates (config.guess and config.sub), one fix in the Makefile.am and the rest regenerated. 2004-08-16 18:48 alfie * xbsndsrv.c: Don't use 100% CPU if xblast dies away. Rather die also, if the pipe is broken. 2004-08-16 06:46 alfie * x11_sound.c: Make it possible to -D a full path to the sound server. 2004-08-15 17:31 iskywalker * game_client.c, game_local.c, game_server.c, server.c: beep mode for windows with log file, stop sound when escaping 2004-08-15 04:28 iskywalker * debug.c: dgb_out go into error.log for windows 2004-08-13 18:56 lodott * client.c, network.c, network.h, server.c: Improving initial version check 2004-08-13 18:53 lodott * net_tele.h: moving async signal to receive signals from older clients correctly 2004-08-13 18:52 lodott * player.c: Leading comment is comment again 2004-08-13 11:39 iskywalker * game.c, player.c: unommented the SND_STEP lines for hearing steping 2004-08-13 05:38 iskywalker * Makefile.windows, atom.c, atom.h, bomb.c, func.c, intro.c, player.c, w32_event.c, xblast.coff: through, ceil, handlep0oll error fixed, minor fixes 2004-08-12 21:31 iskywalker * w32_sndsrv.c, xbsndsrv.c: fix sound 2004-08-12 21:20 iskywalker * atom.c, atom.h, cfg_game.c, cfg_game.h, client.c, game_client.c, game_local.c, game_server.c, menu_game.c, player.c, snd.h, xbsndsrv.c: music in 2004-08-12 21:16 lodott * server.c: server must also add game version to its game config 2004-08-12 18:45 iskywalker * atom.c, atom.h, cfg_game.c, cfg_game.h, client.c, game_client.c, intro.c, menu_game.c, xbsndsrv.c: beep when game start (optional) 2004-08-12 18:30 lodott * cfg_game.c, cfg_game.h, client.c, com_to_server.c, network.c, server.c: Added initial version check on client connect - all clients who don't send version data are disconnected 2004-08-12 17:53 lodott * atom.c, atom.h, cfg_game.c, cfg_level.c: changing atom names for version 2004-08-12 16:47 iskywalker * cfg_game.c, cfg_game.h, com_query.c, menu_network.c, server.c: beeping for incoming clients 2004-08-11 19:34 iskywalker * Makefile.windows, client.c, game.c, player.c, player.h, server.c, xblast.coff: team chat fixed 2004-08-11 11:14 iskywalker * x11_event.c: cancel added 2004-08-10 23:23 iskywalker * Makefile.windows, bomb.c, func.c, game.c, mi_tool.c, player.c, player.h, w32_event.c, xblast.coff: input, through (extra) 2004-08-10 20:47 iskywalker * w32_event.c: better keyboard handling 2004-08-10 17:57 iskywalker * ini_file.c: scpace check on ini_file (seg fault if not and level raped 2004-08-10 17:28 iskywalker * game.c, mi_tool.c, x11_event.c: backspace and return added to chatmode 2004-08-10 12:20 lodott * map.c: Fixed minor memory leak - tile names not been freed before 2004-08-09 11:55 lodott * bomb.c, bomb.h, func.c, func.h, level.c, map.c, map.h, player.c, scramble.c, shrink.c: splitting level config into parse and setup stage 2004-08-08 03:39 lodott * cfg_level.c, info.c, info.h, level.c, player.c, player.h, scramble.c, scramble.h, shrink.c: Splitting level config into parse and setup stage, to allow refined level negotiations 2004-08-07 18:27 lodott * bomb.c, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, level.c, xblast.c: Added command-line option -check to check configs before menu (levels only so far) 2004-08-07 01:11 iskywalker * event.c, intro.c, mi_string.c, mi_tool.c, w32_event.c, w32_pixmap.c: Chat works also for windows, backspace implemnted 2004-08-06 13:31 lodott * w32_socket.c: add handling of close event for sockets, removes server crash on client disconnect 2004-08-06 11:29 iskywalker * mi_tool.c: chatMode after sending reseted(fix) 2004-08-06 02:47 iskywalker * SDL_vkeys.h: initial import, needed by w32_event.c 2004-08-06 02:00 iskywalker * bot.c: async prob fixed 2004-08-06 01:57 iskywalker * intro.c, w32_event.c, w32_pixmap.c, w32_text.c, xblast.coff: Capslock and better ascii sensitive 2004-08-05 23:37 iskywalker * w32_event.c: Key fix for windows, fucking windows key 2004-08-05 22:38 lodott * game_client.c: fixed escape key for client 2004-08-05 22:37 lodott * client.c, server.c: output as unsigned to avoid some confusing output 2004-08-05 19:51 iskywalker * Makefile.in, aclocal.m4, cfg_control.c, chat.c, client.c, com_to_client.c, com_to_server.c, configure, event.h, game.c, menu_network.c, mi_tool.c, network.c, server.c, server.h, w32_event.c, x11_config.c, x11_event.c, x11_socket.c, xblast.c: chat also in Menu mode! (delete,home,end) 2004-08-05 12:03 iskywalker * menu_control.c: fixing bug 2004-08-04 22:02 iskywalker * chat.h, client.c, game.c, server.c: working chat, with private and team msgs 2004-08-04 21:14 iskywalker * client.c, game.c, server.c, server.h, xblast.coff: working chat, next step public private msgs, maybe also team msgs 2004-08-04 19:29 lodott * menu_network.c: Removed free() call for XBChat, freeing handled by chat.c now 2004-08-04 19:26 lodott * com_to_client.c, com_to_server.c: Fixed small bug (wrong length for chat string) 2004-08-04 19:24 lodott * client.h: Minor fix (parameter order in prototype) 2004-08-04 19:22 lodott * client.c: minor fix, better comments 2004-08-04 19:01 lodott * chat.c: Fixed stupid bugs 2004-08-04 17:41 lodott * chat.c, chat.h: Chat line manager 2004-08-04 17:39 lodott * menu_network.c: Simple interface for "waiting for clients" menu to access chat data 2004-08-04 17:38 lodott * net_tele.h: add id for tcp chat signal 2004-08-04 17:36 lodott * client.c, client.h, server.c, server.h: add tcp chat handling for client and server 2004-08-04 17:34 lodott * com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h: add tcp chat signals 2004-08-04 17:33 lodott * com_dg_client.c, com_dg_server.c, com_dgram.c, com_dgram.h: Removed udp chat facilities, replace with a reserved facility for future extensions 2004-08-04 17:18 iskywalker * cfg_control.c, client.c, game.c: improved chat 2004-08-04 10:14 iskywalker * chat.c, chat.h: initial import 2004-08-04 08:08 iskywalker * Makefile.windows, atom.c, atom.h, cfg_control.c, cfg_control.h, event.h, game.c, gui.h, intro.c, menu.c, menu_control.c, status.c, w32_tile.c, x11c_tile.c: chat target selction (some cosmetics too) 2004-08-04 04:46 iskywalker * Makefile.am, Makefile.in, Makefile.windows, aclocal.m4, action.h, atom.c, atom.h, bomb.c, bot.c, cfg_control.c, cfg_control.h, client.c, client.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_dgram.h, configure, event.c, event.h, game.c, game.h, game_client.c, geom.h, intro.c, map.c, menu_control.c, menu_network.c, network.h, player.c, player.h, server.c, server.h, status.c, w32_event.c, w32_pixmap.c, x11_event.c, x11c_pixmap.c, x11c_text.c: local chat implemented 2004-08-02 14:56 lodott * cfg_level.c, cfg_level.h: enable server to check levels for version entries 2004-08-02 13:57 iskywalker * game_client.c, game_server.c: fix kunix patch 2004-08-02 13:51 lodott * server.c: adding some comments, cleaning up some other comments 2004-08-02 13:11 iskywalker * game.c: fix kunis patch 2004-08-02 11:40 iskywalker * atom.c, atom.h, cfg_level.c, cfg_level.h, client.c, client.h, event.h, mi_tool.c, x11_sound.c, xblast.coff: kunis patch 2004-08-02 11:03 iskywalker * bot.c: async bot causer away 2004-08-02 01:44 iskywalker * Makefile.windows, bot.c, cfg_game.c, cfg_level.c, cfg_level.h, client.c, client.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, game.c, game_client.c, game_server.c, menu_game.c, net_tele.h, network.h, server.c, server.h, w32_event.c: recommended level patch, kunis async routines, level version check 2004-08-01 17:40 iskywalker * player.c: rec lives fixed 2004-08-01 14:53 iskywalker * atom.c, atom.h, cfg_game.c, cfg_game.h, cfg_player.c, cfg_player.h, game.c, menu_game.c, menu_player.c, player.c, player.h: Laola msgs configure, recommended lives for level 2004-07-30 14:05 iskywalker * Makefile.windows: For without cygwin1.dll 2004-07-30 14:03 iskywalker * game_server.c, menu_network.c, server.c, server.h: Kunis patch for showing how many players are waiting for game start and score fo r running games 2004-07-30 14:02 iskywalker * com_newgame.c, com_newgame.h: Kunis patch for showing how many players are waiting for game start and score for running games 2004-07-30 12:19 iskywalker * bomb.c, func.c: format 2004-07-30 12:18 iskywalker * map.c: fix ghost 2004-07-30 12:17 iskywalker * player.c: Snipe fix 2004-07-16 09:59 iskywalker * missing: automake happy (--run) 2004-07-16 09:58 iskywalker * x11_socket.c: Assert makes XBlast to quit, when it should save the modification None by exiting 2004-07-16 09:57 iskywalker * autogen.sh: Rado and Alfie happy 2004-07-16 09:57 iskywalker * README: Rado happy 2004-07-16 09:56 iskywalker * Makefile.am: automake happy 2004-07-11 21:20 iskywalker * w32_socket.c: Kuni fixs for searching network 2004-07-08 16:36 iskywalker * configure.in, version.h: testing new version 2004-07-08 16:29 iskywalker * version.h, configure.in: release version 2004-07-07 16:43 iskywalker * Makefile.windows, common.h, net_socket.h, util.c: compiling with cygwin1.dll cause central works then :( 2004-07-07 11:05 iskywalker * Makefile.in, aclocal.m4, configure: WMS compatibility 2004-07-07 11:02 iskywalker * xblast.c: WMS gcc compatibility 2004-07-07 10:53 iskywalker * xblast.c: [no log message] 2004-07-07 10:24 iskywalker * Makefile.in, Makefile.windows, aclocal.m4, com_newgame.c, com_newgame.h, configure, game_server.c, menu_network.c, server.c, server.h, xblast.coff: running scores 2004-06-30 16:06 iskywalker * configure, func.c, func.h, game_server.c, map.c, map.h, player.c, player.h, shrink.c: Botkey also for server and ghost integrated! one of the last epfl features missing 2004-06-29 17:09 iskywalker * com_newgame.c: bufferoverflow check inserted 2004-06-28 13:36 iskywalker * bomb.c: Split click 2004-06-28 10:16 iskywalker * game_client.c: more comments 2004-06-28 10:15 iskywalker * player.c: fixed bug with speed 2 which make initRun dont work, maybe there is a better way to solve it 2004-06-27 01:40 iskywalker * game_client.c, game_server.c: More comments better debug layout 2004-06-26 19:09 iskywalker * intro.c: [no log message] 2004-06-26 03:36 iskywalker * player.c, player.h: rever 2 illness 2004-06-26 03:35 iskywalker * mi_tool.h: keep compiler happy 2004-06-26 03:34 iskywalker * map.c: walk through walls check function 2004-06-26 03:33 iskywalker * image.c: MS compatibility 2004-06-26 03:33 iskywalker * game_local.c: bot key 2004-06-26 03:31 iskywalker * game.c: reverse 2 illness 2004-06-26 03:30 iskywalker * func.c: speed 2 extra 2004-06-26 03:29 iskywalker * com_dgram.h: MS compatibility 2004-06-26 03:28 iskywalker * bot.c: improved ai! 2004-06-26 03:23 iskywalker * common.h, debug.c, ini_file.h, net_socket.c, net_socket.h, server.c, timeval.h, util.c, xblast.c, xblastc.dsp, xblastc.dsw: MS Compiler compatibility 2004-06-26 03:20 iskywalker * client.c, com_central.c, com_newgame.c: MS Compiler compatibility 2004-06-26 03:18 iskywalker * bomb.c: (Con)Destruction bombs fixed i hope it depends on compiler :( 2004-06-25 15:44 iskywalker * README: updated a little 2004-06-25 15:44 iskywalker * INSTALL: configure install not xmkmf! 2004-06-25 13:21 iskywalker * game.c: Fixed draw game problems with one life 2004-06-25 11:03 iskywalker * configure.in, version.h: Thats why .19 shouldnt be release, this is the developer version, and .21 should be than released. That is why the cvs version is .20 now! 2004-06-24 20:00 iskywalker * image.c: changed so that datadir works 2004-06-24 20:00 iskywalker * util.c: changed so that --with-otherdatadir really work 2004-06-24 15:53 iskywalker * bomb.c: ptr!=NULL problem solved with specialbombdestruction and specialbombconstruction! 2004-06-21 11:25 alfie * Makefile.am, Makefile.in, configure, configure.in, w32_tile.c: build files: Some fixes requested by iskywalke. w32_tile.c: wrong variable used. 2004-06-08 12:29 iskywalker * w32_event.c: ALu's mods 2004-06-06 04:30 iskywalker * player.h: jump extra! new look (Alfie freundlicher Stil) 2004-06-06 04:24 iskywalker * player.c: jump extra! new look (Alfie freundlicher Stil) 2004-06-06 04:24 iskywalker * status.c: SMPF support for victory 2004-06-06 04:24 iskywalker * w32_tile.c, x11c_tile.c: SMPF support 2004-06-06 04:19 iskywalker * bomb.c, bomb.h, func.c: jump extra! new look (Alfie freundlicher Stil) 2004-06-05 18:49 iskywalker * configure.in: make some correctures (english and layout) 2004-06-05 18:46 iskywalker * Makefile.am: sounds in install mode added 2004-06-05 18:27 iskywalker * Makefile.am: put Imakefile in any case in dist. 2004-06-05 18:10 iskywalker * Makefile.am: *.h added to sources w32 added time.c timeval.h new layout 2004-06-05 18:08 iskywalker * xblast.c: make Skywalker happy 2004-06-05 18:08 iskywalker * game_server.c: Make Alfie happy 2004-06-05 16:54 alfie * Makefile.in: Udated Makefile.in according to Makefile.am. 2004-06-04 21:42 iskywalker * bot.c, map.c, map.h: [no log message] 2004-06-04 21:19 iskywalker * game_server.c: [no log message] 2004-06-04 21:09 iskywalker * Makefile.am: Made automake happy 2004-06-04 13:29 alfie * Makefile.in, aclocal.m4, configure: Update them after the changes in Makefile.am, and with some more recent autoconf/aclocal version. 2004-06-04 13:15 alfie * game_client.c: Some identation fixups. 2004-06-04 11:27 iskywalker * AUTHORS, NEWS: first commit 2004-06-04 11:24 iskywalker * Makefile.in, Makefile.windows, aclocal.m4, bot.c, configure, game.c, game_server.c, menu_network.h, mi_stat.c, net_tele.c, network.h, xblast.c: updating my xblast to cvs. (some little changes) 2004-06-04 11:19 iskywalker * configure.in: --enable-SMPF 2004-06-04 10:02 iskywalker * configure.in, version.h: .19 2004-06-04 09:09 iskywalker * network.h: SMPF xblasts can join non SMPF! 2004-06-03 21:15 iskywalker * x11c_pixmap.c: SMPF better supported 2004-06-03 21:14 iskywalker * bomb.c: int defaultBMP not more static 2004-06-03 21:11 iskywalker * game_server.c: SMPF support and Async fix 2004-06-03 21:11 iskywalker * game_client.c: SMPF support 2004-06-03 21:11 iskywalker * map.c: ALu SMPF patch 2004-06-03 21:09 iskywalker * w32_event.c, w32_pixmap.c: ALu patch 2004-06-03 21:07 iskywalker * network.h: SMPF support for async 2004-06-03 17:09 iskywalker * player.c: crash cause disconnected player (uninitialized position field) fixed 2004-06-02 14:17 iskywalker * menu_network.c: 10 seconds refresh 2004-06-02 12:19 iskywalker * Makefile.am: repaired xbsndsrv compiling flags 2004-06-01 19:07 iskywalker * configure.in: _XBLAST added to MINI 2004-06-01 18:36 iskywalker * player.c: revive extras fixed! 2004-06-01 16:51 iskywalker * menu_network.c: change refresh time to 5 seconds 2004-06-01 15:39 iskywalker * configure: updated to new configure.in 2004-06-01 15:38 iskywalker * configure.in: enable-mini and bug fixed in enable-sound 2004-05-28 12:15 iskywalker * client.c: nextGame =NULL if lastGame and firstGame=NULL why not nextGame . 2004-05-28 12:15 iskywalker * xbsndsrv.c: Gamedatadir included also for it 2004-05-16 16:52 iskywalker * x11_common.h: aix compatibility 2004-05-14 10:00 alfie * Makefile.w32, Makefile.windows, action.c, action.h, atom.c, atom.h, bomb.c, bomb.h, bot.c, bot.h, browse.c, browse.h, central.c, central.h, cfg_control.c, cfg_control.h, cfg_demo.c, cfg_demo.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, cfg_player.c, cfg_player.h, cfg_stat.c, cfg_stat.h, cfg_xblast.c, cfg_xblast.h, client.c, client.h, color.c, color.h, com.c, com.h, com_base.c, com_base.h, com_browse.c, com_browse.h, com_central.c, com_central.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_from_central.c, com_from_central.h, com_listen.c, com_listen.h, com_newgame.c, com_newgame.h, com_query.c, com_query.h, com_reply.c, com_reply.h, com_stream.c, com_stream.h, com_to_central.c, com_to_central.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, common.h, config.h, dat_rating.c, dat_rating.h, debug.c, debug.h, demo.c, demo.h, event.c, event.h, func.c, func.h, game.c, game.h, game_client.c, game_client.h, game_demo.c, game_demo.h, game_local.c, game_local.h, game_server.c, game_server.h, geom.h, gui.h, image.c, image.h, info.c, info.h, ini_file.c, ini_file.h, intro.c, intro.h, introdat.c, introdat.h, level.c, level.h, map.c, map.h, menu.c, menu.h, menu_control.c, menu_control.h, menu_extras.c, menu_extras.h, menu_game.c, menu_game.h, menu_layout.h, menu_level.c, menu_level.h, menu_network.c, menu_network.h, menu_player.c, menu_player.h, mi_base.c, mi_base.h, mi_button.c, mi_button.h, mi_color.c, mi_color.h, mi_combo.c, mi_combo.h, mi_cyclic.c, mi_cyclic.h, mi_host.c, mi_host.h, mi_int.c, mi_int.h, mi_keysym.c, mi_keysym.h, mi_label.c, mi_label.h, mi_map.c, mi_map.h, mi_player.c, mi_player.h, mi_stat.c, mi_stat.h, mi_string.c, mi_string.h, mi_tag.c, mi_tag.h, mi_toggle.c, mi_toggle.h, mi_tool.c, mi_tool.h, net_dgram.c, net_dgram.h, net_socket.c, net_socket.h, net_tele.c, net_tele.h, network.c, network.h, player.c, player.h, random.c, random.h, rating.h, scramble.c, scramble.h, server.c, server.h, shrink.c, shrink.h, shrinkdat.h, snd.h, socket.h, sprite.c, sprite.h, status.c, status.h, str_util.c, str_util.h, user.c, user.h, util.c, util.h, version.h, w32_atom.c, w32_color.h, w32_common.c, w32_common.h, w32_config.c, w32_config.h, w32_event.c, w32_event.h, w32_image.c, w32_image.h, w32_init.c, w32_joystick.c, w32_joystick.h, w32_keysym.c, w32_keysym.h, w32_mm.h, w32_msgbox.c, w32_pixmap.c, w32_pixmap.h, w32_sndsrv.c, w32_sndsrv.h, w32_socket.c, w32_socket.h, w32_sound.c, w32_sprite.c, w32_sprite.h, w32_text.c, w32_text.h, w32_tile.c, w32_tile.h, x11_atom.c, x11_common.c, x11_common.h, x11_config.c, x11_config.h, x11_event.c, x11_event.h, x11_joystick.c, x11_joystick.h, x11_msgbox.c, x11_socket.c, x11_socket.h, x11_sound.c, x11_sound.h, x11c_image.c, x11c_image.h, x11c_init.c, x11c_pixmap.c, x11c_pixmap.h, x11c_sprite.c, x11c_sprite.h, x11c_text.c, x11c_text.h, x11c_tile.c, x11c_tile.h, xblast.c, xblast.h, xblast.man, xbsndsrv.c: Updated FSF address. Removed $Log$ entries.... 2004-05-13 19:31 alfie * net_tele.c: Fixed spacing. 2004-05-13 19:30 alfie * net_socket.h: Fixed #ifdef 2004-05-13 19:27 alfie * net_dgram.c: Fixed spacing 2004-05-13 19:16 alfie * menu_extras.c: fb's changes commited back in 2004-05-13 18:56 alfie * game_client.c: Readded deleted space 2004-05-13 17:55 alfie * version.h_norm[DEAD], version.h_smpf[DEAD], Imakefile.norm[DEAD], Imakefile.smpf[DEAD]: No, we don't need those! 2004-05-13 14:23 alfie * x11c_tile.c, xblast.h: Aligned spacing. 2004-05-13 12:54 alfie * ini_file.c: No, removed #ifdef GAME_DATADIR as a whole, like discussed with fbenites 2004-05-13 12:32 alfie * Makefile.in, aclocal.m4, configure: Updated auto stuff again. 2004-05-13 12:24 iskywalker * COPYING, Imakefile, Imakefile.norm, Imakefile.smpf, Makefile.am, Makefile.in, README, aclocal.m4, action.h, atom.c, atom.h, bomb.c, bot.c, cfg_control.c, cfg_control.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, common.h, configure, configure.in, event.c, event.h, game.c, game_client.c, image.c, introdat.c, menu.c, menu_control.c, menu_network.c, mi_label.c, mi_label.h, mi_stat.c, mi_tool.c, net_dgram.c, net_socket.h, net_tele.c, player.c, player.h, snd.h, status.c, util.c, w32_event.c, w32_joystick.c, w32_sndsrv.c, w32_socket.c, w32_tile.c, x11_sound.c, x11c_tile.c, xblast.c, xblast.h: .18 2004-05-13 12:19 iskywalker * time.c, timeval.h, version.h_norm, version.h_smpf, xblast.coff, xblast.man: some files xblast need to compile under windows and help files 2004-05-13 12:17 iskywalker * Makefile.windows: my cygwin compile file 2004-05-13 12:16 iskywalker * xbsndsrv.c: sound server 2004-05-13 12:01 alfie * ini_file.c: Added missing , -- problem noticed by Kruno, thanks!! 2004-05-13 09:20 alfie * Makefile.in, aclocal.m4, configure: Run autogen.sh and updated the scripts 2004-05-10 15:31 alfie * missing: Missing missing (autotools script) 2004-05-10 15:06 iskywalker * Makefile.am: xbsndsrv changed 2004-05-10 15:04 iskywalker * Makefile.am: initial import 2004-05-10 14:57 iskywalker * configure: Configure for Alfie... 2004-05-10 12:03 iskywalker * configure.in: LEX and YACC removed 2004-05-10 08:45 alfie * COPYING, Changelog, Imakefile, Imakefile.norm, Imakefile.smpf, Makefile.in, Makefile.w32, README, acinclude.m4, aclocal.m4, action.c, action.h, atom.c, atom.h, autogen.sh, automake.fig, bomb.c, bomb.h, bot.c, bot.h, browse.c, browse.h, central.c, central.h, cfg_control.c, cfg_control.h, cfg_demo.c, cfg_demo.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, cfg_player.c, cfg_player.h, cfg_stat.c, cfg_stat.h, cfg_xblast.c, cfg_xblast.h, client.c, client.h, color.c, color.h, com.c, com.h, com_base.c, com_base.h, com_browse.c, com_browse.h, com_central.c, com_central.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_dgram.h, com_from_central.c, com_from_central.h, com_listen.c, com_listen.h, com_newgame.c, com_newgame.h, com_query.c, com_query.h, com_reply.c, com_reply.h, com_stream.c, com_stream.h, com_to_central.c, com_to_central.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, common.h, config.guess, config.h, config.h.in, config.sub, configure, configure.in, dat_rating.c, dat_rating.h, debug.c, debug.h, demo.c, demo.h, event.c, event.h, func.c, func.h, game.c, game.h, game_client.c, game_client.h, game_demo.c, game_demo.h, game_local.c, game_local.h, game_server.c, game_server.h, geom.h, gui.h, image.c, image.h, info.c, info.h, ini_file.c, ini_file.h, install-sh, intro.c, intro.h, introdat.c, introdat.h, level.c, level.h, makew32.bat, map.c, map.h, menu.c, menu.h, menu_control.c, menu_control.h, menu_extras.c, menu_extras.h, menu_game.c, menu_game.h, menu_layout.h, menu_level.c, menu_level.h, menu_network.c, menu_network.h, menu_player.c, menu_player.h, mi_base.c, mi_base.h, mi_button.c, mi_button.h, mi_color.c, mi_color.h, mi_combo.c, mi_combo.h, mi_cyclic.c, mi_cyclic.h, mi_host.c, mi_host.h, mi_int.c, mi_int.h, mi_keysym.c, mi_keysym.h, mi_label.c, mi_label.h, mi_map.c, mi_map.h, mi_player.c, mi_player.h, mi_stat.c, mi_stat.h, mi_string.c, mi_string.h, mi_tag.c, mi_tag.h, mi_toggle.c, mi_toggle.h, mi_tool.c, mi_tool.h, mkinstalldirs, net_dgram.c, net_dgram.h, net_socket.c, net_socket.h, net_tele.c, net_tele.h, network.c, network.h, player.c, player.h, random.c, random.h, rating.h, scramble.c, scramble.h, server.c, server.h, shrink.c, shrink.h, shrinkdat.h, snd.h, socket.h, sprite.c, sprite.h, status.c, status.h, str_util.c, str_util.h, user.c, user.h, util.c, util.h, version.h, w32_atom.c, w32_color.h, w32_common.c, w32_common.h, w32_config.c, w32_config.h, w32_event.c, w32_event.h, w32_image.c, w32_image.h, w32_init.c, w32_joystick.c, w32_joystick.h, w32_keysym.c, w32_keysym.h, w32_mm.h, w32_msgbox.c, w32_pixmap.c, w32_pixmap.h, w32_sndsrv.c, w32_sndsrv.h, w32_socket.c, w32_socket.h, w32_sound.c, w32_sprite.c, w32_sprite.h, w32_text.c, w32_text.h, w32_tile.c, w32_tile.h, x11_atom.c, x11_common.c, x11_common.h, x11_config.c, x11_config.h, x11_event.c, x11_event.h, x11_joystick.c, x11_joystick.h, x11_msgbox.c, x11_socket.c, x11_socket.h, x11_sound.c, x11_sound.h, x11c_image.c, x11c_image.h, x11c_init.c, x11c_pixmap.c, x11c_pixmap.h, x11c_sprite.c, x11c_sprite.h, x11c_text.c, x11c_text.h, x11c_tile.c, x11c_tile.h, xblast-alex.ico, xblast-norbert.ico, xblast-olaf.ico, xblast-olli.ico, xblast-rodi.ico, xblast-ted.ico, xblast.c, xblast.h, xblast.ico, xblast.rc: Updated to 2.9.18. 2004-05-09 21:06 alfie * Makefile.16[DEAD], Makefile.16.mini[DEAD], Makefile.mini[DEAD], Makefile.normal[DEAD], makeepfl.bat[DEAD]: Not really used. 2004-05-09 18:23 alfie * version.h_norm[DEAD]: Not used, removed it. 2004-05-05 15:58 alfie * action.c, action.h, atom.c, atom.h, bomb.c, bomb.h, browse.c, browse.h, central.c, central.h, cfg_control.c, cfg_control.h, cfg_demo.c, cfg_demo.h, cfg_game.c, cfg_game.h, cfg_level.c, cfg_level.h, cfg_main.c, cfg_main.h, cfg_player.c, cfg_player.h, cfg_stat.c, cfg_stat.h, cfg_xblast.c, cfg_xblast.h, client.c, Imakefile, Imakefile.norm, Imakefile.smpf, client.h, color.c, color.h, com.c, com.h, com_base.c, com_base.h, com_browse.c, com_browse.h, com_central.c, com_central.h, com_dg_client.c, com_dg_client.h, com_dg_server.c, com_dg_server.h, com_dgram.c, com_dgram.h, com_from_central.c, com_from_central.h, com_listen.c, com_listen.h, com_newgame.c, com_newgame.h, com_query.c, com_query.h, com_reply.c, com_reply.h, com_stream.c, com_stream.h, com_to_central.c, com_to_central.h, com_to_client.c, com_to_client.h, com_to_server.c, com_to_server.h, common.h, config.h, dat_rating.c, dat_rating.h, debug.c, debug.h, demo.c, demo.h, event.c, event.h, func.c, func.h, game.c, game.h, game_client.c, game_client.h, game_demo.c, game_demo.h, game_local.c, game_local.h, game_server.c, game_server.h, geom.h, gui.h, image.c, image.h, Makefile.16, Makefile.16.mini, Makefile.mini, Makefile.normal, info.c, info.h, ini_file.c, ini_file.h, intro.c, intro.h, introdat.c, introdat.h, level.c, level.h, makeepfl.bat, map.c, map.h, menu.c, menu.h, menu_control.c, menu_control.h, menu_extras.c, menu_extras.h, menu_game.c, menu_game.h, menu_layout.h, menu_level.c, menu_level.h, menu_network.c, menu_network.h, menu_player.c, menu_player.h, mi_base.c, mi_base.h, mi_button.c, mi_button.h, mi_color.c, mi_color.h, mi_combo.c, mi_combo.h, mi_cyclic.c, mi_cyclic.h, mi_host.c, mi_host.h, mi_int.c, mi_int.h, mi_keysym.c, mi_keysym.h, mi_label.c, mi_label.h, mi_map.c, mi_map.h, mi_player.c, mi_player.h, mi_stat.c, mi_stat.h, mi_string.c, mi_string.h, mi_tag.c, mi_tag.h, mi_toggle.c, mi_toggle.h, mi_tool.c, mi_tool.h, net_dgram.c, net_dgram.h, net_socket.c, net_socket.h, net_tele.c, net_tele.h, network.c, network.h, player.c, player.h, random.c, random.h, randomlib.c, randomlib.h, rating.h, scramble.c, scramble.h, server.c, server.h, shrink.c, shrink.h, shrinkdat.h, snd.h, socket.h, sprite.c, sprite.h, status.c, status.h, str_util.c, str_util.h, try.c, user.c, user.h, util.c, util.h, version.h, version.h_norm, x11_atom.c, x11_common.c, x11_common.h, x11_config.c, x11_config.h, x11_event.c, x11_event.h, x11_joystick.c, x11_joystick.h, x11_msgbox.c, x11_socket.c, x11_socket.h, x11_sound.c, x11_sound.h, x11c_image.c, x11c_image.h, x11c_init.c, x11c_pixmap.c, x11c_pixmap.h, x11c_sprite.c, x11c_sprite.h, x11c_text.c, x11c_text.h, x11c_tile.c, x11c_tile.h, INSTALL, xblast.c, xblast.h: Initial revision xblast-2.10.4/INSTALL0000644000175000017500000000410410245715751013247 0ustar rhondaalfieGETTING XBLAST use the Download links on http://xblast.sf.net/ o get source package xblast, if you want to compile yourself o for win you can alternatively get a pre-compiled binary o get data packages images, levels, models o optionally get sound packages sounds and musics PREPARING SOURCES o extract the packages in some temporary directory o create xblast directory if necessary o place win binary in xblast, if you downloaded it o move images dir to xblast/image o move levels dir to xblast/level o move models dir to xblast/image/sprite o move sounds dir to xblast/sounds, if you have it o move content of musics dir to xblast/sounds, if you have it COMPILING THE BINARY Linux/Cygwin o change into xblast dir o run 'autogen.sh' to create config.h o run 'configure' with appropriate options o for public installation (requires root) (will install binaries in /usr/games/bin and data into /usr/share/games/XBlast-TNT) --prefix=/usr/games --enable-admin o for sound --enable-sound o for half-sized window --enable-mini o for 16-player support --enable-SMPF o if you want that data go to a different path then $prefix/share/games/XBlast-TNT --with-otherdatadir=mydir Examples: Private install: configure Root install with mini, SMPF, sound, data in /usr/local/share/xblast and with xblast and xbsndsrv in /usr/bin: configure --enable-admin --enable-sound --enable-SMPF --enable-mini \ --prefix=/usr --with-otherdatadir=/usr/local/share/xblast o run 'make' to create the binary o run 'make install' for public install (requires root) o move xblast dir where you want it, for private install Cygwin (alternative) o change into xblast dir o uncomment CYGWIN vars for binary independent of cygwin1.dll (requires mingw) o run 'make -f Makefile.windows' to create the binary o move xblast dir where you want it MSVC-Compiler for details on compilation with msvc, contact devs for more informations read README or pass by: http://xblast.sf.net/irc/ http://xblast.sf.net/ xblast-2.10.4/Imakefile0000644000175000017500000000575310050664360014033 0ustar rhondaalfie/* * Imakefile for UNIX/X11 with sound * * $Id: Imakefile,v 1.3 2004/05/13 12:24:16 iskywalker Exp $ */ XBLASTDIR=$(LIBDIR)/xblast /* * Libraries needed for XBlast * (The Solaris setting is very conservative) */ /* #ifdef SOLARIS DEPLIBS=$(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES=$(XTOOLLIB) $(XLIB) -lSM -lICE #else*/ DEPLIBS=$(DEPXLIB) LOCAL_LIBRARIES=$(XLIB) -lm /* #endif */ /* * compiler specifc flags (uncomment and edit if needed) */ # CDEBUGFLAGS=-g -O2 # CCOPTIONS=-ansi -Wall -pedantic EXTRA_DEFINES=-DXBLASTDIR=\"$(XBLASTDIR)\" -DAPPLOADDIR=\"$(XAPPLOADDIR)\" \ -DDEBUG # -DSMPF # -DDEBUG_PIXMAP SRCS=xblast.c util.c str_util.c intro.c introdat.c map.c sprite.c \ color.c status.c player.c action.c bomb.c bot.c event.c image.c \ shrink.c func.c info.c ini_file.c atom.c scramble.c \ demo.c debug.c level.c random.c \ game_local.c game_demo.c game_server.c game_client.c game.c\ menu.c menu_player.c menu_level.c menu_control.c menu_game.c\ menu_network.c menu_extras.c\ mi_tool.c mi_base.c mi_button.c mi_color.c mi_combo.c mi_cyclic.c\ mi_host.c mi_int.c mi_keysym.c mi_label.c mi_player.c mi_string.c \ mi_tag.c mi_toggle.c mi_map.c mi_stat.c\ client.c server.c network.c com.c browse.c\ com_to_server.c com_listen.c com_to_client.c com_stream.c \ com_dg_client.c com_dg_server.c com_dgram.c \ com_query.c com_browse.c com_reply.c com_base.c \ net_socket.c net_tele.c net_dgram.c \ central.c com_newgame.c com_to_central.c com_from_central.c com_central.c user.c dat_rating.c \ cfg_main.c cfg_level.c cfg_player.c cfg_game.c cfg_control.c \ cfg_stat.c cfg_demo.c cfg_xblast.c\ x11_common.c x11_event.c x11_atom.c x11_config.c x11_msgbox.c\ x11c_init.c x11c_image.c x11c_text.c x11c_tile.c x11c_sprite.c \ x11c_pixmap.c x11_sound.c x11_socket.c x11_joystick.c OBJS=xblast.o util.o str_util.o intro.o introdat.o map.o sprite.o \ color.o status.o player.o bomb.o bot.o action.o event.o image.o \ shrink.o func.o info.o ini_file.o atom.o scramble.o \ demo.o debug.o level.o random.o \ game_local.o game_demo.o game_server.o game_client.o game.o\ menu.o menu_player.o menu_level.o menu_control.o menu_game.o\ menu_network.o menu_extras.o\ mi_tool.o mi_base.o mi_button.o mi_color.o mi_combo.o mi_cyclic.o\ mi_host.o mi_int.o mi_keysym.o mi_label.o mi_player.o mi_string.o\ mi_tag.o mi_toggle.o mi_map.o mi_stat.o \ client.o server.o network.o com.o browse.o\ com_to_server.o com_listen.o com_to_client.o com_stream.o \ com_dg_client.o com_dg_server.o com_dgram.o \ com_query.o com_browse.o com_reply.o com_base.o \ net_socket.o net_tele.o net_dgram.o \ central.o com_newgame.o com_to_central.o com_from_central.o com_central.o user.o dat_rating.o \ cfg_main.o cfg_level.o cfg_player.o cfg_game.o cfg_control.o\ cfg_stat.o cfg_demo.o cfg_xblast.o\ x11_common.o x11_event.o x11_atom.o x11_config.o x11_msgbox.o\ x11c_init.o x11c_image.o x11c_text.o x11c_tile.o x11c_sprite.o \ x11c_pixmap.o x11_sound.o x11_socket.o x11_joystick.o AllTarget(xblast) ComplexProgramTarget(xblast) xblast-2.10.4/Makefile.am0000644000175000017500000001041510444235456014254 0ustar rhondaalfieif SDL sdl_files=sdl_common.h sdl_event.h sdl_config.h sdl_image.h sdl_keysym.h\ sdl_text.h sdl_tile.h sdl_sprite.h sdl_pixmap.h\ sdl_common.c sdl_event.c sdl_atom.c sdl_config.c\ sdl_msgbox.c sdl_init.c sdl_image.c sdl_text.c\ sdl_tile.c sdl_sprite.c sdl_pixmap.c sdl_keysym.c\ sdl_socket.c sdl_joystick.c sdl_socket.h sdl_sprite.h sdl_joystick.h\ sdl_sound.c x11_files= x11_sound.h else if XBSNDSRV soundbinaries = xbsndsrv else soundbinaries = endif sdl_files= x11_files= x11_common.c x11_event.c x11_atom.c x11_config.c\ x11_msgbox.c x11c_init.c x11c_image.c x11c_text.c\ x11c_tile.c x11c_sprite.c x11c_pixmap.c x11_sound.c\ x11_socket.c x11_joystick.c\ x11_common.h x11_event.h x11_config.h x11c_image.h\ x11c_text.h x11c_tile.h x11c_sprite.h x11c_pixmap.h\ x11_sound.h x11_socket.h x11_joystick.h endif bin_PROGRAMS = ${soundbinaries} xblast xblast_SOURCES=xblast.c util.c str_util.c intro.c introdat.c map.c sprite.c \ color.c status.c player.c action.c bomb.c event.c image.c\ shrink.c func.c info.c ini_file.c atom.c scramble.c \ demo.c debug.c level.c random.c \ game_local.c game_demo.c game_server.c game_client.c game.c\ menu.c menu_player.c menu_level.c menu_control.c menu_game.c\ menu_network.c menu_extras.c mi_tool.c mi_base.c\ mi_button.c mi_color.c mi_combo.c mi_cyclic.c\ mi_host.c mi_int.c mi_keysym.c mi_label.c mi_player.c\ mi_string.c mi_tag.c mi_toggle.c mi_map.c mi_stat.c client.c\ server.c network.c com.c browse.c com_to_server.c\ com_listen.c com_to_client.c com_stream.c com_dg_client.c\ com_dg_server.c com_dgram.c com_query.c com_browse.c\ com_reply.c com_base.c net_socket.c net_tele.c\ net_dgram.c central.c com_newgame.c com_to_central.c\ com_from_central.c com_central.c user.c dat_rating.c \ cfg_main.c cfg_level.c cfg_player.c cfg_game.c\ cfg_control.c cfg_stat.c cfg_demo.c cfg_xblast.c\ bot.c xblast.h util.h \ str_util.h intro.h introdat.h map.h sprite.h color.h \ status.h player.h action.h bomb.h event.h image.h \ shrink.h func.h info.h ini_file.h atom.h scramble.h \ demo.h debug.h level.h random.h \ game_local.h game_demo.h game_server.h game_client.h game.h\ menu.h menu_player.h menu_level.h menu_control.h menu_game.h\ menu_network.h menu_extras.h mi_tool.h mi_base.h\ mi_button.h mi_color.h mi_combo.h mi_cyclic.h\ mi_host.h mi_int.h mi_keysym.h mi_label.h mi_player.h\ mi_string.h mi_tag.h mi_toggle.h mi_map.h mi_stat.h client.h\ server.h network.h com.h browse.h com_to_server.h\ com_listen.h com_to_client.h com_stream.h \ com_dg_client.h com_dg_server.h com_dgram.h \ com_query.h com_browse.h com_reply.h com_base.h \ net_socket.h net_tele.h net_dgram.h central.h\ com_newgame.h com_to_central.h com_from_central.h com_central.h\ user.h dat_rating.h cfg_main.h cfg_level.h cfg_player.h\ cfg_game.h cfg_control.h cfg_stat.h cfg_demo.h cfg_xblast.h\ bot.h shrinkdat.h\ version.h x11c_sprite.h socket.h gui.h geom.h config.h snd.h\ menu_layout.h chat.h chat.c menu_edit.c menu_edit.h version.c\ ${sdl_files} ${x11_files} EXTRA_DIST = config.rpath xblast.man autogen.sh Makefile.w32 Makefile.windows *.ico \ *.coff xblast.rc w32*.h w32*.c time.c timeval.h Imakefile\ image/misc/*.ppm image/misc/*.pbm image/explosion/*.pbm \ image/explosion/*.ppm image/score/*.epm image/score/*.ppm \ image/sprite/*.pbm image/sprite/*.ppm image/block/*.ppm \ image/sprite/*.epm level/*.xal sounds/*.raw xbsndsrv_SOURCES = xbsndsrv.c snd.h game_datadir=@game_datadir@ localedir = $(game_datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ install-data-local: @$(NORMAL_INSTALL) if test -d $(srcdir)/image; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir); \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/image; \ cp -r $(srcdir)/image/* $(DESTDIR)$(game_datadir)/image;\ fi; \ if test -d $(srcdir)/level; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/ ; \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/level; \ cp -r $(srcdir)/level/* $(DESTDIR)$(game_datadir)/level;\ fi; \ if test -d $(srcdir)/sounds; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/ ; \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/sounds; \ cp -r $(srcdir)/sounds/* $(DESTDIR)$(game_datadir)/sounds;\ fi; indent: indent -npro -gnu -ts4 -i4 -br -lp -sob -l100 -ss -ncs *.[ch] SUBDIRS = po ACLOCAL_AMFLAGS = -I m4 xblast-2.10.4/Makefile.in0000644000175000017500000012117310444626004014262 0ustar rhondaalfie# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ bin_PROGRAMS = $(am__EXEEXT_1) xblast$(EXEEXT) DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ INSTALL NEWS config.guess config.rpath config.sub depcomp \ install-sh missing mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/sdl.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = @SDL_FALSE@@XBSNDSRV_TRUE@am__EXEEXT_1 = xbsndsrv$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__xblast_SOURCES_DIST = xblast.c util.c str_util.c intro.c \ introdat.c map.c sprite.c color.c status.c player.c action.c \ bomb.c event.c image.c shrink.c func.c info.c ini_file.c \ atom.c scramble.c demo.c debug.c level.c random.c game_local.c \ game_demo.c game_server.c game_client.c game.c menu.c \ menu_player.c menu_level.c menu_control.c menu_game.c \ menu_network.c menu_extras.c mi_tool.c mi_base.c mi_button.c \ mi_color.c mi_combo.c mi_cyclic.c mi_host.c mi_int.c \ mi_keysym.c mi_label.c mi_player.c mi_string.c mi_tag.c \ mi_toggle.c mi_map.c mi_stat.c client.c server.c network.c \ com.c browse.c com_to_server.c com_listen.c com_to_client.c \ com_stream.c com_dg_client.c com_dg_server.c com_dgram.c \ com_query.c com_browse.c com_reply.c com_base.c net_socket.c \ net_tele.c net_dgram.c central.c com_newgame.c \ com_to_central.c com_from_central.c com_central.c user.c \ dat_rating.c cfg_main.c cfg_level.c cfg_player.c cfg_game.c \ cfg_control.c cfg_stat.c cfg_demo.c cfg_xblast.c bot.c \ xblast.h util.h str_util.h intro.h introdat.h map.h sprite.h \ color.h status.h player.h action.h bomb.h event.h image.h \ shrink.h func.h info.h ini_file.h atom.h scramble.h demo.h \ debug.h level.h random.h game_local.h game_demo.h \ game_server.h game_client.h game.h menu.h menu_player.h \ menu_level.h menu_control.h menu_game.h menu_network.h \ menu_extras.h mi_tool.h mi_base.h mi_button.h mi_color.h \ mi_combo.h mi_cyclic.h mi_host.h mi_int.h mi_keysym.h \ mi_label.h mi_player.h mi_string.h mi_tag.h mi_toggle.h \ mi_map.h mi_stat.h client.h server.h network.h com.h browse.h \ com_to_server.h com_listen.h com_to_client.h com_stream.h \ com_dg_client.h com_dg_server.h com_dgram.h com_query.h \ com_browse.h com_reply.h com_base.h net_socket.h net_tele.h \ net_dgram.h central.h com_newgame.h com_to_central.h \ com_from_central.h com_central.h user.h dat_rating.h \ cfg_main.h cfg_level.h cfg_player.h cfg_game.h cfg_control.h \ cfg_stat.h cfg_demo.h cfg_xblast.h bot.h shrinkdat.h version.h \ x11c_sprite.h socket.h gui.h geom.h config.h snd.h \ menu_layout.h chat.h chat.c menu_edit.c menu_edit.h version.c \ sdl_common.h sdl_event.h sdl_config.h sdl_image.h sdl_keysym.h \ sdl_text.h sdl_tile.h sdl_sprite.h sdl_pixmap.h sdl_common.c \ sdl_event.c sdl_atom.c sdl_config.c sdl_msgbox.c sdl_init.c \ sdl_image.c sdl_text.c sdl_tile.c sdl_sprite.c sdl_pixmap.c \ sdl_keysym.c sdl_socket.c sdl_joystick.c sdl_socket.h \ sdl_joystick.h sdl_sound.c x11_common.c x11_event.c x11_atom.c \ x11_config.c x11_msgbox.c x11c_init.c x11c_image.c x11c_text.c \ x11c_tile.c x11c_sprite.c x11c_pixmap.c x11_sound.c \ x11_socket.c x11_joystick.c x11_common.h x11_event.h \ x11_config.h x11c_image.h x11c_text.h x11c_tile.h \ x11c_pixmap.h x11_sound.h x11_socket.h x11_joystick.h @SDL_TRUE@am__objects_1 = sdl_common.$(OBJEXT) sdl_event.$(OBJEXT) \ @SDL_TRUE@ sdl_atom.$(OBJEXT) sdl_config.$(OBJEXT) \ @SDL_TRUE@ sdl_msgbox.$(OBJEXT) sdl_init.$(OBJEXT) \ @SDL_TRUE@ sdl_image.$(OBJEXT) sdl_text.$(OBJEXT) \ @SDL_TRUE@ sdl_tile.$(OBJEXT) sdl_sprite.$(OBJEXT) \ @SDL_TRUE@ sdl_pixmap.$(OBJEXT) sdl_keysym.$(OBJEXT) \ @SDL_TRUE@ sdl_socket.$(OBJEXT) sdl_joystick.$(OBJEXT) \ @SDL_TRUE@ sdl_sound.$(OBJEXT) @SDL_FALSE@am__objects_2 = x11_common.$(OBJEXT) x11_event.$(OBJEXT) \ @SDL_FALSE@ x11_atom.$(OBJEXT) x11_config.$(OBJEXT) \ @SDL_FALSE@ x11_msgbox.$(OBJEXT) x11c_init.$(OBJEXT) \ @SDL_FALSE@ x11c_image.$(OBJEXT) x11c_text.$(OBJEXT) \ @SDL_FALSE@ x11c_tile.$(OBJEXT) x11c_sprite.$(OBJEXT) \ @SDL_FALSE@ x11c_pixmap.$(OBJEXT) x11_sound.$(OBJEXT) \ @SDL_FALSE@ x11_socket.$(OBJEXT) x11_joystick.$(OBJEXT) am_xblast_OBJECTS = xblast.$(OBJEXT) util.$(OBJEXT) str_util.$(OBJEXT) \ intro.$(OBJEXT) introdat.$(OBJEXT) map.$(OBJEXT) \ sprite.$(OBJEXT) color.$(OBJEXT) status.$(OBJEXT) \ player.$(OBJEXT) action.$(OBJEXT) bomb.$(OBJEXT) \ event.$(OBJEXT) image.$(OBJEXT) shrink.$(OBJEXT) \ func.$(OBJEXT) info.$(OBJEXT) ini_file.$(OBJEXT) \ atom.$(OBJEXT) scramble.$(OBJEXT) demo.$(OBJEXT) \ debug.$(OBJEXT) level.$(OBJEXT) random.$(OBJEXT) \ game_local.$(OBJEXT) game_demo.$(OBJEXT) game_server.$(OBJEXT) \ game_client.$(OBJEXT) game.$(OBJEXT) menu.$(OBJEXT) \ menu_player.$(OBJEXT) menu_level.$(OBJEXT) \ menu_control.$(OBJEXT) menu_game.$(OBJEXT) \ menu_network.$(OBJEXT) menu_extras.$(OBJEXT) mi_tool.$(OBJEXT) \ mi_base.$(OBJEXT) mi_button.$(OBJEXT) mi_color.$(OBJEXT) \ mi_combo.$(OBJEXT) mi_cyclic.$(OBJEXT) mi_host.$(OBJEXT) \ mi_int.$(OBJEXT) mi_keysym.$(OBJEXT) mi_label.$(OBJEXT) \ mi_player.$(OBJEXT) mi_string.$(OBJEXT) mi_tag.$(OBJEXT) \ mi_toggle.$(OBJEXT) mi_map.$(OBJEXT) mi_stat.$(OBJEXT) \ client.$(OBJEXT) server.$(OBJEXT) network.$(OBJEXT) \ com.$(OBJEXT) browse.$(OBJEXT) com_to_server.$(OBJEXT) \ com_listen.$(OBJEXT) com_to_client.$(OBJEXT) \ com_stream.$(OBJEXT) com_dg_client.$(OBJEXT) \ com_dg_server.$(OBJEXT) com_dgram.$(OBJEXT) \ com_query.$(OBJEXT) com_browse.$(OBJEXT) com_reply.$(OBJEXT) \ com_base.$(OBJEXT) net_socket.$(OBJEXT) net_tele.$(OBJEXT) \ net_dgram.$(OBJEXT) central.$(OBJEXT) com_newgame.$(OBJEXT) \ com_to_central.$(OBJEXT) com_from_central.$(OBJEXT) \ com_central.$(OBJEXT) user.$(OBJEXT) dat_rating.$(OBJEXT) \ cfg_main.$(OBJEXT) cfg_level.$(OBJEXT) cfg_player.$(OBJEXT) \ cfg_game.$(OBJEXT) cfg_control.$(OBJEXT) cfg_stat.$(OBJEXT) \ cfg_demo.$(OBJEXT) cfg_xblast.$(OBJEXT) bot.$(OBJEXT) \ chat.$(OBJEXT) menu_edit.$(OBJEXT) version.$(OBJEXT) \ $(am__objects_1) $(am__objects_2) xblast_OBJECTS = $(am_xblast_OBJECTS) xblast_LDADD = $(LDADD) am_xbsndsrv_OBJECTS = xbsndsrv.$(OBJEXT) xbsndsrv_OBJECTS = $(am_xbsndsrv_OBJECTS) xbsndsrv_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(xblast_SOURCES) $(xbsndsrv_SOURCES) DIST_SOURCES = $(am__xblast_SOURCES_DIST) $(xbsndsrv_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_FALSE = @SDL_FALSE@ SDL_LIBS = @SDL_LIBS@ SDL_TRUE = @SDL_TRUE@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XBSNDSRV_FALSE = @XBSNDSRV_FALSE@ XBSNDSRV_TRUE = @XBSNDSRV_TRUE@ XGETTEXT = @XGETTEXT@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 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@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ game_datadir = @game_datadir@ 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 = $(game_datadir)/locale 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@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ @SDL_FALSE@sdl_files = @SDL_TRUE@sdl_files = sdl_common.h sdl_event.h sdl_config.h sdl_image.h sdl_keysym.h\ @SDL_TRUE@ sdl_text.h sdl_tile.h sdl_sprite.h sdl_pixmap.h\ @SDL_TRUE@ sdl_common.c sdl_event.c sdl_atom.c sdl_config.c\ @SDL_TRUE@ sdl_msgbox.c sdl_init.c sdl_image.c sdl_text.c\ @SDL_TRUE@ sdl_tile.c sdl_sprite.c sdl_pixmap.c sdl_keysym.c\ @SDL_TRUE@ sdl_socket.c sdl_joystick.c sdl_socket.h sdl_sprite.h sdl_joystick.h\ @SDL_TRUE@ sdl_sound.c @SDL_FALSE@x11_files = x11_common.c x11_event.c x11_atom.c x11_config.c\ @SDL_FALSE@ x11_msgbox.c x11c_init.c x11c_image.c x11c_text.c\ @SDL_FALSE@ x11c_tile.c x11c_sprite.c x11c_pixmap.c x11_sound.c\ @SDL_FALSE@ x11_socket.c x11_joystick.c\ @SDL_FALSE@ x11_common.h x11_event.h x11_config.h x11c_image.h\ @SDL_FALSE@ x11c_text.h x11c_tile.h x11c_sprite.h x11c_pixmap.h\ @SDL_FALSE@ x11_sound.h x11_socket.h x11_joystick.h @SDL_TRUE@x11_files = x11_sound.h @SDL_FALSE@@XBSNDSRV_FALSE@soundbinaries = @SDL_FALSE@@XBSNDSRV_TRUE@soundbinaries = xbsndsrv xblast_SOURCES = xblast.c util.c str_util.c intro.c introdat.c map.c sprite.c \ color.c status.c player.c action.c bomb.c event.c image.c\ shrink.c func.c info.c ini_file.c atom.c scramble.c \ demo.c debug.c level.c random.c \ game_local.c game_demo.c game_server.c game_client.c game.c\ menu.c menu_player.c menu_level.c menu_control.c menu_game.c\ menu_network.c menu_extras.c mi_tool.c mi_base.c\ mi_button.c mi_color.c mi_combo.c mi_cyclic.c\ mi_host.c mi_int.c mi_keysym.c mi_label.c mi_player.c\ mi_string.c mi_tag.c mi_toggle.c mi_map.c mi_stat.c client.c\ server.c network.c com.c browse.c com_to_server.c\ com_listen.c com_to_client.c com_stream.c com_dg_client.c\ com_dg_server.c com_dgram.c com_query.c com_browse.c\ com_reply.c com_base.c net_socket.c net_tele.c\ net_dgram.c central.c com_newgame.c com_to_central.c\ com_from_central.c com_central.c user.c dat_rating.c \ cfg_main.c cfg_level.c cfg_player.c cfg_game.c\ cfg_control.c cfg_stat.c cfg_demo.c cfg_xblast.c\ bot.c xblast.h util.h \ str_util.h intro.h introdat.h map.h sprite.h color.h \ status.h player.h action.h bomb.h event.h image.h \ shrink.h func.h info.h ini_file.h atom.h scramble.h \ demo.h debug.h level.h random.h \ game_local.h game_demo.h game_server.h game_client.h game.h\ menu.h menu_player.h menu_level.h menu_control.h menu_game.h\ menu_network.h menu_extras.h mi_tool.h mi_base.h\ mi_button.h mi_color.h mi_combo.h mi_cyclic.h\ mi_host.h mi_int.h mi_keysym.h mi_label.h mi_player.h\ mi_string.h mi_tag.h mi_toggle.h mi_map.h mi_stat.h client.h\ server.h network.h com.h browse.h com_to_server.h\ com_listen.h com_to_client.h com_stream.h \ com_dg_client.h com_dg_server.h com_dgram.h \ com_query.h com_browse.h com_reply.h com_base.h \ net_socket.h net_tele.h net_dgram.h central.h\ com_newgame.h com_to_central.h com_from_central.h com_central.h\ user.h dat_rating.h cfg_main.h cfg_level.h cfg_player.h\ cfg_game.h cfg_control.h cfg_stat.h cfg_demo.h cfg_xblast.h\ bot.h shrinkdat.h\ version.h x11c_sprite.h socket.h gui.h geom.h config.h snd.h\ menu_layout.h chat.h chat.c menu_edit.c menu_edit.h version.c\ ${sdl_files} ${x11_files} EXTRA_DIST = config.rpath xblast.man autogen.sh Makefile.w32 Makefile.windows *.ico \ *.coff xblast.rc w32*.h w32*.c time.c timeval.h Imakefile\ image/misc/*.ppm image/misc/*.pbm image/explosion/*.pbm \ image/explosion/*.ppm image/score/*.epm image/score/*.ppm \ image/sprite/*.pbm image/sprite/*.ppm image/block/*.ppm \ image/sprite/*.epm level/*.xal sounds/*.raw xbsndsrv_SOURCES = xbsndsrv.c snd.h SUBDIRS = po ACLOCAL_AMFLAGS = -I m4 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) xblast$(EXEEXT): $(xblast_OBJECTS) $(xblast_DEPENDENCIES) @rm -f xblast$(EXEEXT) $(LINK) $(xblast_LDFLAGS) $(xblast_OBJECTS) $(xblast_LDADD) $(LIBS) xbsndsrv$(EXEEXT): $(xbsndsrv_OBJECTS) $(xbsndsrv_DEPENDENCIES) @rm -f xbsndsrv$(EXEEXT) $(LINK) $(xbsndsrv_LDFLAGS) $(xbsndsrv_OBJECTS) $(xbsndsrv_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/action.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bomb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/browse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/central.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_control.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_demo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_game.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_level.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_player.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg_xblast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_base.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_browse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_central.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_dg_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_dg_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_dgram.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_from_central.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_listen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_newgame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_query.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_reply.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_to_central.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_to_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com_to_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dat_rating.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/func.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_demo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_local.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intro.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/introdat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/level.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_control.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_edit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_extras.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_game.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_level.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_network.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_player.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_base.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_combo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_cyclic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_host.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_int.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_keysym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_label.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_player.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_tag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_toggle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mi_tool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_dgram.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net_tele.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scramble.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_atom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_config.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_event.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_joystick.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_keysym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_msgbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_pixmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_sprite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_tile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shrink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sprite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_atom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_config.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_event.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_joystick.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_msgbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_pixmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_sprite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11c_tile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xblast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbsndsrv.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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) '$<'` uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(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; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(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; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/image/block $(distdir)/image/explosion $(distdir)/image/misc $(distdir)/image/score $(distdir)/image/sprite $(distdir)/level $(distdir)/m4 $(distdir)/po $(distdir)/sounds @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-recursive clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-data-local install-exec-am: install-binPROGRAMS install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-binPROGRAMS clean-generic clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-data-local install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am install-data-local: @$(NORMAL_INSTALL) if test -d $(srcdir)/image; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir); \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/image; \ cp -r $(srcdir)/image/* $(DESTDIR)$(game_datadir)/image;\ fi; \ if test -d $(srcdir)/level; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/ ; \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/level; \ cp -r $(srcdir)/level/* $(DESTDIR)$(game_datadir)/level;\ fi; \ if test -d $(srcdir)/sounds; then \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/ ; \ $(mkinstalldirs) $(DESTDIR)$(game_datadir)/sounds; \ cp -r $(srcdir)/sounds/* $(DESTDIR)$(game_datadir)/sounds;\ fi; indent: indent -npro -gnu -ts4 -i4 -br -lp -sob -l100 -ss -ncs *.[ch] # 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: xblast-2.10.4/Makefile.w320000644000175000017500000000541010051114262014252 0ustar rhondaalfie# # file makefile - makefile for cygwin including debug infos # # Program XBlast # (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation; either version 2; or (at your option) # any later version # # This program is distributed in the hope that it will be entertaining, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # CC=gcc.exe CFLAGS=-g -O2 -Wall -pedantic -idirafter "C:\cygnus\cygwin-b20\w32api-1.3-2\include" -DXBLASTDIR=\".\" -DW32 -DYYTEXT_POINTER=1 -DYYTEXT_POINTER=1 -DPACKAGE=\"xblast\" -DHAVE_LIBICE=1 -DHAVE_LIBX11=0 -DHAVE_LIBM=1 -DHAVE_LIBPNG=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DRETSIGTYPE=void -DHAVE_STRFTIME=1 -DHAVE_VPRINTF=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_MKDIR=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRSTR=1 #-DMINI_XBLAST -DSMPF LOADLIBES=-lwinmm -luser32 -lgdi32 -lwsock32 -lws2_32 LDFLAGS=-g OBJS_W32= xblast.o util.o str_util.o intro.o introdat.o map.o sprite.o \ color.o status.o player.o bot.o bomb.o action.o event.o image.o shrink.o \ func.o info.o ini_file.o atom.o scramble.o demo.o debug.o level.o \ random.o game_local.o game_demo.o game_server.o game_client.o game.o \ menu.o menu_player.o menu_level.o menu_control.o menu_game.o \ menu_network.o menu_extras.o mi_tool.o mi_base.o mi_button.o \ mi_color.o mi_combo.o mi_cyclic.o mi_host.o mi_int.o mi_keysym.o \ mi_label.o mi_player.o mi_string.o mi_tag.o mi_toggle.o mi_map.o \ mi_stat.o client.o server.o central.o network.o com.o browse.o com_to_server.o \ com_listen.o com_to_client.o com_newgame.o com_stream.o com_dg_client.o \ com_to_central.o com_from_central.o com_central.o user.o dat_rating.o \ com_dg_server.o com_dgram.o com_query.o com_browse.o com_reply.o \ com_base.o net_socket.o net_tele.o net_dgram.o cfg_main.o cfg_level.o \ cfg_player.o cfg_game.o cfg_control.o cfg_stat.o cfg_demo.o \ cfg_xblast.o \ w32_init.o w32_event.o w32_common.o w32_pixmap.o w32_image.o \ w32_text.o w32_tile.o w32_sprite.o w32_atom.o w32_config.o \ w32_keysym.o w32_sound.o w32_sndsrv.o w32_msgbox.o w32_joystick.o w32_socket.o \ xblast.coff xblast: $(OBJS_W32) xblast.coff: xblast.rc windres -i xblast.rc -o xblast.coff clean: rm -f $(OBJS_W32) # # end of file makefile # xblast-2.10.4/Makefile.windows0000644000175000017500000000542110376072557015357 0ustar rhondaalfie# # file makefile - makefile for cygwin including debug infos # # Program XBlast # (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation; either version 2; or (at your option) # any later version # # This program is distributed in the hope that it will be entertaining, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc. # 675 Mass Ave, Cambridge, MA 02139, USA. # # cygwin options for exe independent of cygwin1.dll # comment out or remove for dependent exe CYGWINOPT=-mno-cygwin CYGWINLIB=-lmingw32 DEBUGFLAGS=#-DDEBUG_CHAT -DDEBUG_SERVER -DDEBUG_CLIENT -DDEBUG_NETWORK -DDEBUG_VERSION GCCWARN=-Wall -Wno-comment GCCOPTS=-O2 $(CYGWINOPT) #-std=c99 -pedantic XBLAST=-DW32 -DDEBUG_NAT -DXBLAST_SOUND -DMINI_XBLAST #-DREQUESTS XBLASTDIRS=-DXBLASTDIR=\".\" -DGAME_DATADIR=\".\" CC=gcc.exe #/lib/gcc-lib/i686-pc-mingw32/3.2/cc1.exe CFLAGS=$(GCCOPTS) $(GCCWARN) $(XBLASTDIRS) $(XBLAST) $(DEBUGFLAGS) LOADLIBES=-lwinmm -luser32 -lgdi32 -lwsock32 -lws2_32 $(CYGWINLIB) LDFLAGS=-g -v $(CYGWINOPT) OBJS_W32= xblast.o util.o str_util.o intro.o introdat.o map.o sprite.o \ color.o status.o player.o bomb.o action.o event.o image.o shrink.o \ func.o info.o ini_file.o atom.o scramble.o demo.o debug.o level.o \ random.o game_local.o game_demo.o game_server.o game_client.o game.o \ menu.o menu_player.o menu_level.o menu_control.o menu_game.o \ menu_network.o menu_extras.o mi_tool.o mi_base.o mi_button.o \ mi_color.o mi_combo.o mi_cyclic.o mi_host.o mi_int.o mi_keysym.o \ mi_label.o mi_player.o mi_string.o mi_tag.o mi_toggle.o mi_map.o \ mi_stat.o client.o server.o central.o network.o com.o browse.o com_to_server.o \ com_listen.o com_to_client.o com_newgame.o com_stream.o com_dg_client.o \ com_to_central.o com_from_central.o com_central.o user.o dat_rating.o \ com_dg_server.o com_dgram.o com_query.o com_browse.o com_reply.o \ com_base.o net_socket.o net_tele.o net_dgram.o cfg_main.o cfg_level.o \ cfg_player.o cfg_game.o cfg_control.o cfg_stat.o cfg_demo.o \ cfg_xblast.o \ w32_init.o w32_event.o w32_common.o w32_pixmap.o w32_image.o \ w32_text.o w32_tile.o w32_sprite.o w32_atom.o w32_config.o \ w32_keysym.o w32_sound.o w32_sndsrv.o w32_msgbox.o w32_joystick.o w32_socket.o \ bot.o time.o chat.o menu_edit.o version.o xblast: $(OBJS_W32) xblast.coff xblast.coff: xblast.rc windres -i xblast.rc -o xblast.coff clean: rm -f $(OBJS_W32) # # end of file makefile # xblast-2.10.4/NEWS0000644000175000017500000000006310060056271012703 0ustar rhondaalfie Look in www.xblast-center.com! or in xblast.sf.netxblast-2.10.4/README0000644000175000017500000000352010176462763013104 0ustar rhondaalfie XBlast TNT XBlast TNT was created by Oliver Vogel under the GNU General Public License. 0. This Mod 1. Install 2. Community 3. Bugs 4. Central 0. This Mod This is a Modification by Koen and Skywalker. It has a central server for the scores and game search. It features almost the whole epfl features plus some new. 1. Install To install read the INSTALL. (tststs why i wrote it for :) ) 2. Community See www.xblast-center.com, xbresse has now a serious job (*g*) but i'll try to warn him if something important is out there :), Thx bresse for the good page! Join the irc channel! http://xblast.sf.net/irc/ or with chatzilla or other irc client: irc.freenode.net for example, channel #xblast or irc.europe.net #xblast There is also a mailinglist look for it in www.xblast-center.com, and xblast.sf.net 3. Bugs Got a bug, send it to: iskywalker@gmx.de or xblast-devel@lists.sourceforge.net I will put in my buglist :) 3.1 No Sound If you are in Linux: PATH=.:$PATH ./xblast xblast starts xbsndsrv normally when not installed (make install) from ./ so it should be in your PATH. Export it (export PATH=$PATH:.; put it in your .bashrc or .profile for not more needing it) if you want only ./xblast. 4. Central Atm there is no webpage to check central games... but if you want to play a central game: 1. step(optinal): Register your player! In options, player, your player! Your registration number is saved under .xblast_tnt/config/player.cfg . Keep it if you change the account, computer, harddisk. 2. step: Join network game, join central game. Maybe you should open your firewall to play central games. To host a game: open your firewall, if you got one. create network game, rated game option (yes)(optional), then click continue, then visible in central (server options). and then in the next step wait for people(bots) to join your server. xblast-2.10.4/SConstruct0000644000175000017500000000365110214610013014233 0ustar rhondaalfielist=Split("""xblast.c util.c str_util.c intro.c introdat.c map.c sprite.c color.c status.c player.c bomb.c action.c event.c image.c shrink.c func.c info.c ini_file.c atom.c scramble.c demo.c debug.c level.c random.c game_local.c game_demo.c game_server.c game_client.c game.c menu.c menu_player.c menu_level.c menu_control.c menu_game.c menu_network.c menu_extras.c mi_tool.c mi_base.c mi_button.c mi_color.c mi_combo.c mi_cyclic.c mi_host.c mi_int.c mi_keysym.c mi_label.c mi_player.c mi_string.c mi_tag.c mi_toggle.c mi_map.c mi_stat.c client.c server.c central.c network.c com.c browse.c com_to_server.c com_listen.c com_to_client.c com_newgame.c com_stream.c com_dg_client.c com_to_central.c com_from_central.c com_central.c user.c dat_rating.c com_dg_server.c com_dgram.c com_query.c com_browse.c com_reply.c com_base.c net_socket.c net_tele.c net_dgram.c cfg_main.c cfg_level.c cfg_player.c cfg_game.c cfg_control.c cfg_stat.c cfg_demo.c cfg_xblast.c chat.c x11_common.c x11_event.c x11_atom.c x11_config.c x11_msgbox.c x11c_init.c x11c_image.c x11c_text.c x11c_tile.c x11c_sprite.c x11c_pixmap.c x11_sound.c x11_socket.c x11_joystick.c bot.c menu_edit.c version.c""") opts = Options() opts.Add(PathOption('Datadir', 'Path to configuration file', '.')) env = Environment(options = opts, CPPDEFINES={'GAME_DATADIR' : '"$CONFIG"'}, CPPPATH = ['/usr/include'], LIBPATH = ['/usr/lib','/usr/X11R6/lib'] ) if 'bar' in COMMAND_LINE_TARGETS: print "Don't forget to copy `bar' to the archive!" print "Don't forget to copy `bar' to the archive!" conf = Configure(env) if not conf.CheckLib('m'): print 'Did not find libm.a or m.lib, exiting!' Exit(1) if not conf.CheckLib('X11'): print 'Did not find lib X11 , exiting!' Exit(1) env = conf.Finish() env.Program('xblast',list)xblast-2.10.4/SDL_vkeys.h0000644000175000017500000000372110372705222014227 0ustar rhondaalfie/* SDL - Simple DirectMedia Layer Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Sam Lantinga slouken@libsdl.org */ #ifdef SAVE_RCSID static char rcsid = "@(#) $Id: SDL_vkeys.h,v 1.2 2006/02/09 18:31:46 fzago Exp $"; #endif #ifndef VK_0 #define VK_0 '0' #define VK_1 '1' #define VK_2 '2' #define VK_3 '3' #define VK_4 '4' #define VK_5 '5' #define VK_6 '6' #define VK_7 '7' #define VK_8 '8' #define VK_9 '9' #define VK_A 'A' #define VK_B 'B' #define VK_C 'C' #define VK_D 'D' #define VK_E 'E' #define VK_F 'F' #define VK_G 'G' #define VK_H 'H' #define VK_I 'I' #define VK_J 'J' #define VK_K 'K' #define VK_L 'L' #define VK_M 'M' #define VK_N 'N' #define VK_O 'O' #define VK_P 'P' #define VK_Q 'Q' #define VK_R 'R' #define VK_S 'S' #define VK_T 'T' #define VK_U 'U' #define VK_V 'V' #define VK_W 'W' #define VK_X 'X' #define VK_Y 'Y' #define VK_Z 'Z' #endif /* VK_0 */ /* These keys haven't been defined, but were experimentally determined */ #define VK_SEMICOLON 0xBA #define VK_EQUALS 0xBB #define VK_COMMA 0xBC #define VK_MINUS 0xBD #define VK_PERIOD 0xBE #define VK_SLASH 0xBF #define VK_GRAVE 0xC0 #define VK_LBRACKET 0xDB #define VK_BACKSLASH 0xDC #define VK_RBRACKET 0xDD #define VK_APOSTROPHE 0xDE #define VK_BACKTICK 0xDF xblast-2.10.4/acinclude.m40000644000175000017500000000126710443242444014410 0ustar rhondaalfieAC_DEFUN([MY_EXPAND_DIR], [ $1=$2 $1=`( test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" eval echo \""[$]$1"/games/XBlast-TNT/\" )` ]) # From SANE (sane-project.org) # XBLAST_CC_SET_CFLAGS() # Set CFLAGS. Enable/disable compilation warnings if we gcc is used. AC_DEFUN([XBLAST_CC_SET_CFLAGS],[ if test "${ac_cv_c_compiler_gnu}" = "yes"; then CFLAGS="$CFLAGS \ -ggdb \ -Wall \ -Wcast-align \ -Wcast-qual \ -Wmissing-declarations \ -Wmissing-prototypes \ -Wpointer-arith \ -Wreturn-type \ -Wstrict-prototypes \ " fi # ac_cv_c_compiler_gnu ]) xblast-2.10.4/aclocal.m40000644000175000017500000007523410374427557014101 0ustar rhondaalfie# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file 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. # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/gettext.m4]) m4_include([m4/iconv.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) m4_include([m4/nls.m4]) m4_include([m4/po.m4]) m4_include([m4/progtest.m4]) m4_include([m4/sdl.m4]) m4_include([acinclude.m4]) xblast-2.10.4/action.c0000644000175000017500000001111010372731122013621 0ustar rhondaalfie/* * file action.c - converting player actions to bytes and back * * $Id: action.c,v 1.9 2006/02/09 21:21:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ /* direction action masks */ #define PA_DIR_MASK ((unsigned char) 0x07) #define PA_GO_DEFAULT ((unsigned char) 0x00) #define PA_GO_STOP ((unsigned char) 0x01) #define PA_GO_UP ((unsigned char) 0x02) #define PA_GO_LEFT ((unsigned char) 0x03) #define PA_GO_DOWN ((unsigned char) 0x04) #define PA_GO_RIGHT ((unsigned char) 0x05) /* other action masks */ #define PA_BOMB ((unsigned char) 0x08) #define PA_SPECIAL ((unsigned char) 0x10) #define PA_PAUSE ((unsigned char) 0x20) /* abort action masks */ #define PA_ABORT_MASK ((unsigned char) 0xC0) #define PA_ABORT_NONE ((unsigned char) 0x00) #define PA_ABORT_TRUE ((unsigned char) 0x40) #define PA_ABORT_CANCEL ((unsigned char) 0x80) /* laola/loser */ #define PA_LAOLA PA_PAUSE #define PA_LOSER (PA_ABORT_CANCEL | PA_ABORT_TRUE) /* suicide */ #define PA_GO_ALL PA_DIR_MASK /* * global function: PlayerActionToByte * description: convert player action to byte * return value: byte wih player action * parameters: playerAction - action struct to convert */ unsigned char PlayerActionToByte (const PlayerAction * playerAction) { unsigned char result; assert (playerAction != NULL); /* direction 0-2 */ if (playerAction->suicide) { result = PA_GO_ALL; } else { switch (playerAction->dir) { case GoStop: result = PA_GO_STOP; break; case GoUp: result = PA_GO_UP; break; case GoLeft: result = PA_GO_LEFT; break; case GoDown: result = PA_GO_DOWN; break; case GoRight: result = PA_GO_RIGHT; break; default: result = PA_GO_DEFAULT; break; } } /* drop bomb 3 */ if (playerAction->bomb) { result |= PA_BOMB; } /* special extra 4 */ if (playerAction->special) { result |= PA_SPECIAL; } /* laola uses PAUSE mask */ if (playerAction->laola) { result |= PA_LAOLA; } /* loser */ if (playerAction->looser) { result |= PA_LOSER; } else { switch (playerAction->abort) { case ABORT_CANCEL: result |= PA_ABORT_CANCEL; break; case ABORT_TRUE: result |= PA_ABORT_TRUE; break; default: result |= PA_ABORT_NONE; break; } } /* that's all */ return result; } /* PlayerActionToByte */ /* * global function: PlayerActionFromByte * description: convert byte to player action * return value: none * parameters: playerAction - player action to set * value - byte to convert */ void PlayerActionFromByte (PlayerAction * playerAction, unsigned char value) { assert (playerAction != NULL); /* direction */ switch (value & PA_DIR_MASK) { case PA_GO_STOP: playerAction->dir = GoStop; break; case PA_GO_UP: playerAction->dir = GoUp; break; case PA_GO_LEFT: playerAction->dir = GoLeft; break; case PA_GO_DOWN: playerAction->dir = GoDown; break; case PA_GO_RIGHT: playerAction->dir = GoRight; break; case PA_GO_ALL: playerAction->suicide = XBTrue; break; default: playerAction->dir = GoDefault; playerAction->suicide = XBFalse; break; } /* drop bomb */ playerAction->bomb = (value & PA_BOMB) ? XBTrue : XBFalse; /* special extras */ playerAction->special = (value & PA_SPECIAL) ? XBTrue : XBFalse; /* pause keys */ playerAction->laola = (value & PA_LAOLA) ? XBTrue : XBFalse; /* abort 6-7 */ if (value & PA_ABORT_TRUE && value & PA_ABORT_CANCEL) { playerAction->looser = XBTrue; } else { playerAction->looser = XBFalse; switch (value & PA_ABORT_MASK) { case PA_ABORT_CANCEL: playerAction->abort = ABORT_CANCEL; break; case PA_ABORT_TRUE: playerAction->abort = ABORT_TRUE; break; default: playerAction->abort = ABORT_NONE; break; } } } /* PlayerActionFromByte */ /* * end of file action.c */ xblast-2.10.4/action.h0000644000175000017500000000317110372731122013636 0ustar rhondaalfie/* * file action.h - converting player actions to bytes and back * * $Id: action.h,v 1.9 2006/02/09 21:21:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_ACTION_H #define XBLAST_ACTION_H /* * type definitions */ /* status of player abort */ typedef enum { ABORT_NONE = 0, ABORT_TRUE, ABORT_CANCEL } PlayerAbort; /* chat defines */ #define CHAT_NONE 0 #define CHAT_START 1 #define CHAT_SEND 2 #define CHAT_CANCEL 3 #define CHAT_LEN 40 /* player action(s) at last turn */ typedef struct { int player; BMDirection dir; XBBool bomb; XBBool special; XBBool pause; PlayerAbort abort; XBBool suicide; XBBool laola; XBBool looser; XBBool bot; XBBool away; } PlayerAction; /* * global prototypes */ extern unsigned char PlayerActionToByte (const PlayerAction *); extern void PlayerActionFromByte (PlayerAction *, unsigned char); #endif /* * end of file action.h */ xblast-2.10.4/atom.c0000644000175000017500000003541410372731122013321 0ustar rhondaalfie/* * file atom .c - predefined atoms fast database access * * $Id: atom.c,v 1.21 2006/02/09 21:21:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * global variables */ XBAtom atomAllLevels; XBAtom atomAllowNat; XBAtom atomArmsLegs; XBAtom atomAuthor; XBAtom atomBackpack; XBAtom atomBeep; XBAtom atomBody; XBAtom atomBombClick; XBAtom atomBombs; XBAtom atomBot; XBAtom atomBottom; XBAtom atomBrowseLan; XBAtom atomCentral; // XBCC XBAtom atomCentralJoinName; // XBCC XBAtom atomCentralJoinPort; // XBCC XBAtom atomCentralLocal; // XBCC XBAtom atomCentralRemote; // XBCC XBAtom atomClient; XBAtom atomColor; XBAtom atomControl; XBAtom atomDarkText1; XBAtom atomDarkText2; XBAtom atomDefault; XBAtom atomDemo; XBAtom atomDirection; XBAtom atomDrawGame; XBAtom atomExtra; XBAtom atomExtraDistribution; XBAtom atomFace; XBAtom atomFixedUdpPort; XBAtom atomFont; XBAtom atomFontMini; XBAtom atomFrameRate; XBAtom atomFrames; XBAtom atomFunc; XBAtom atomFuseTime; XBAtom atomGame; XBAtom atomGameMode; XBAtom atomGeneral; XBAtom atomGeometry; XBAtom atomGraphics; XBAtom atomHandsFeet; XBAtom atomHaunt; XBAtom atomHelmet; XBAtom atomHidden; XBAtom atomHint; XBAtom atomHost; XBAtom atomIfRecLives; XBAtom atomInfo; XBAtom atomInfoTime; // LRF XBAtom atomInitExtra; XBAtom atomInitVirus; XBAtom atomKey; XBAtom atomKeyAbort; XBAtom atomKeyAbortCancel; /* Skywalker */ XBAtom atomKeyLaola; XBAtom atomKeyLooser; XBAtom atomKeyBot; XBAtom atomKeyChatStart; XBAtom atomKeyChatChangeReceiver; XBAtom atomKeyChatSend; XBAtom atomKeyChatCancel; /* */ XBAtom atomKeyBomb; XBAtom atomKeyDown; XBAtom atomKeyLeft; XBAtom atomKeyPause; XBAtom atomKeyRight; XBAtom atomKeySpecial; XBAtom atomKeyStop; XBAtom atomKeyUp; XBAtom atomLarge; XBAtom atomLastPlayed; // LRF XBAtom atomLeft; XBAtom atomLeftKeyboard; XBAtom atomLevel; XBAtom atomLevelOrder; // LRF XBAtom atomLevelShuffled; XBAtom atomLevelSorted; XBAtom atomLevelStat; XBAtom atomLightText1; XBAtom atomLightText2; XBAtom atomLives; XBAtom atomLocal; XBAtom atomMap; XBAtom atomMaskBytes; XBAtom atomMaxHosts; XBAtom atomMaxLocals; XBAtom atomMaxMaskBytes; XBAtom atomMaxPlayers; XBAtom atomMedium; XBAtom atomMissing; XBAtom atomMode; XBAtom atomMsgGloat; XBAtom atomMsgLaola; XBAtom atomMsgLoseLevel; XBAtom atomMsgLoseLife; XBAtom atomMsgLoser; XBAtom atomMsgWelcome; XBAtom atomMsgWinGame; XBAtom atomMsgWinLevel; XBAtom atomMusic; XBAtom atomName; XBAtom atomNastyCeil; XBAtom atomNastyGentle; XBAtom atomNastyRange; XBAtom atomNextNasty; XBAtom atomNumBlocks; XBAtom atomNumFrames; XBAtom atomNumPlayers; XBAtom atomOutOfTime; XBAtom atomPlayer; XBAtom atomPass; // XBCC XBAtom atomPID; // XBCC XBAtom atomPlayerClick; XBAtom atomPlayerRating; // XBCC XBAtom atomPlayerStat; XBAtom atomPort; XBAtom atomProbBomb; XBAtom atomProbHidden; XBAtom atomProbRange; XBAtom atomProbSpecial; XBAtom atomProbVirus; XBAtom atomRandomLevels; XBAtom atomRandomPlayers; XBAtom atomRandomSeed; XBAtom atomRange; XBAtom atomRatedGame; // XBCC XBAtom atomRecLives; XBAtom atomRecordDemo; XBAtom atomRecorded; XBAtom atomRemote; XBAtom atomRemoteGame; XBAtom atomRemotePlayer; XBAtom atomResults; XBAtom atomReviveExtra; XBAtom atomReviveVirus; XBAtom atomRight; XBAtom atomRightKeyboard; XBAtom atomScrambleDel; XBAtom atomScrambleDraw; XBAtom atomSelect; XBAtom atomServer; XBAtom atomShape; XBAtom atomShrink; XBAtom atomShuffle; XBAtom atomSlowFlame; XBAtom atomSmall; XBAtom atomSound; XBAtom atomSpecial; XBAtom atomSpecialBombs; XBAtom atomStatusBg; XBAtom atomStatusFg; XBAtom atomStatusLed; XBAtom atomStereo; XBAtom atomTeamMode; XBAtom atomTime; XBAtom atomTimeRatings; XBAtom atomTitleBg; XBAtom atomTitleFg; XBAtom atomTop; XBAtom atomTotal; XBAtom atomTurnStepKeyboard; XBAtom atomTurnStepJoystick; XBAtom atomType; XBAtom atomUseStopKey; XBAtom atomVersionMajor; XBAtom atomVersionMinor; XBAtom atomVersionPatch; XBAtom atomVideo; XBAtom atomWallClick; XBAtom atomWin32; XBAtom atomWinner; XBAtom atomWins; XBAtom atomX11; XBAtom atomXBCCRating; // XBCC XBAtom atomXBCCGamesPlayed; // XBCC XBAtom atomXBCCRealWins; // XBCC XBAtom atomXBCCRelativeWins; // XBCC XBAtom atomXBCCTimeUpdate; // XBCC XBAtom atomXBCCTimeRegister; // XBCC XBAtom atomXblast; XBAtom atomArrayBlock00[MAX_BLOCK]; XBAtom atomArrayControl0[MAX_PLAYER + 1]; XBAtom atomArrayHost0[MAX_HOSTS]; XBAtom atomArrayPlayer0[MAX_PLAYER + 1]; XBAtom atomArrayPos0[MAX_PLAYER + 1]; XBAtom atomArrayPos000[MAZE_W * MAZE_H]; XBAtom atomArrayRow00[MAZE_H]; XBAtom atomArrayTeam0[MAX_PLAYER + 1]; XBAtom atomGamehis[10]; XBAtom atomPorthis[10]; /* * initialize predefined atoms */ void InitDefaultAtoms (void) { int i; /* skalars */ atomAllLevels = GUI_StringToAtom ("allLevels"); atomAllowNat = GUI_StringToAtom ("allowNat"); atomArmsLegs = GUI_StringToAtom ("armsLegs"); atomAuthor = GUI_StringToAtom ("author"); atomAuthor = GUI_StringToAtom ("author"); atomBackpack = GUI_StringToAtom ("backpack"); atomBeep = GUI_StringToAtom ("beep"); atomBody = GUI_StringToAtom ("body"); atomBombClick = GUI_StringToAtom ("bombClick"); atomBombs = GUI_StringToAtom ("bombs"); atomBot = GUI_StringToAtom ("bot"); atomBottom = GUI_StringToAtom ("bottom"); atomBrowseLan = GUI_StringToAtom ("browseLan"); atomServer = GUI_StringToAtom ("server"); atomClient = GUI_StringToAtom ("client"); atomCentral = GUI_StringToAtom ("central"); // XBCC atomCentralJoinName = GUI_StringToAtom ("centraljoinname"); // XBCC atomCentralJoinPort = GUI_StringToAtom ("centraljoinport"); // XBCC atomCentralLocal = GUI_StringToAtom ("localStat"); // XBCC atomCentralRemote = GUI_StringToAtom ("remoteStat"); // XBCC atomColor = GUI_StringToAtom ("color"); atomControl = GUI_StringToAtom ("control"); atomDarkText1 = GUI_StringToAtom ("darkText1"); atomDarkText2 = GUI_StringToAtom ("darkText2"); atomDefault = GUI_StringToAtom ("default"); atomDemo = GUI_StringToAtom ("demo"); atomDirection = GUI_StringToAtom ("direction"); atomDrawGame = GUI_StringToAtom ("drawGame"); atomExtra = GUI_StringToAtom ("extra"); atomExtraDistribution = GUI_StringToAtom ("extraDistribution"); atomFace = GUI_StringToAtom ("face"); atomFixedUdpPort = GUI_StringToAtom ("fixedUdpPort"); atomFont = GUI_StringToAtom ("font"); atomFontMini = GUI_StringToAtom ("fontMini"); atomFrameRate = GUI_StringToAtom ("frameRate"); atomFrames = GUI_StringToAtom ("frames"); atomFunc = GUI_StringToAtom ("func"); atomFuseTime = GUI_StringToAtom ("fuseTime"); atomGame = GUI_StringToAtom ("game"); atomGameMode = GUI_StringToAtom ("gameMode"); atomGeneral = GUI_StringToAtom ("general"); atomGeometry = GUI_StringToAtom ("geometry"); atomGraphics = GUI_StringToAtom ("graphics"); atomHandsFeet = GUI_StringToAtom ("handsFeet"); atomHaunt = GUI_StringToAtom ("haunt"); atomHelmet = GUI_StringToAtom ("helmet"); atomHidden = GUI_StringToAtom ("hidden"); atomHint = GUI_StringToAtom ("hint"); atomHost = GUI_StringToAtom ("host"); atomIfRecLives = GUI_StringToAtom ("ifRecLives"); atomInfo = GUI_StringToAtom ("info"); atomInfoTime = GUI_StringToAtom ("infoTime"); atomInitExtra = GUI_StringToAtom ("initExtra"); atomInitVirus = GUI_StringToAtom ("initVirus"); atomKey = GUI_StringToAtom ("key"); atomKeyAbort = GUI_StringToAtom ("keyAbort"); atomKeyAbortCancel = GUI_StringToAtom ("keyAbortCancel"); /* Skywalker */ atomKeyLaola = GUI_StringToAtom ("keyLaola"); atomKeyLooser = GUI_StringToAtom ("keyLooser"); atomKeyBot = GUI_StringToAtom ("keyBot"); atomKeyChatCancel = GUI_StringToAtom ("keyChatCancel"); atomKeyChatChangeReceiver = GUI_StringToAtom ("keyChatChangeReceiver"); atomKeyChatStart = GUI_StringToAtom ("keyChatStart"); atomKeyChatSend = GUI_StringToAtom ("keyChatSend"); /* */ atomKeyBomb = GUI_StringToAtom ("keyBomb"); atomKeyDown = GUI_StringToAtom ("keyDown"); atomKeyLeft = GUI_StringToAtom ("keyLeft"); atomKeyPause = GUI_StringToAtom ("keyPause"); atomKeyRight = GUI_StringToAtom ("keyRight"); atomKeySpecial = GUI_StringToAtom ("keySpecial"); atomKeyStop = GUI_StringToAtom ("keyStop"); atomKeyUp = GUI_StringToAtom ("keyUp"); atomLarge = GUI_StringToAtom ("large"); atomLastPlayed = GUI_StringToAtom ("lastPlayed"); // LRF atomLeft = GUI_StringToAtom ("left"); atomLeftKeyboard = GUI_StringToAtom ("leftKeyboard"); atomLevel = GUI_StringToAtom ("level"); atomLevelOrder = GUI_StringToAtom ("levelOrder"); // LRF atomLevelShuffled = GUI_StringToAtom ("levelShuffled"); atomLevelSorted = GUI_StringToAtom ("levelSorted"); atomLevelStat = GUI_StringToAtom ("levelStat"); atomLightText1 = GUI_StringToAtom ("lightText1"); atomLightText2 = GUI_StringToAtom ("lightText2"); atomLives = GUI_StringToAtom ("lives"); atomLocal = GUI_StringToAtom ("local"); atomMap = GUI_StringToAtom ("map"); atomMaskBytes = GUI_StringToAtom ("maskBytes"); atomMaxHosts = GUI_StringToAtom ("maxHosts"); atomMaxLocals = GUI_StringToAtom ("maxLocals"); atomMaxMaskBytes = GUI_StringToAtom ("maxMaskBytes"); atomMaxPlayers = GUI_StringToAtom ("maxPlayers"); atomMedium = GUI_StringToAtom ("medium"); atomMissing = GUI_StringToAtom ("missing"); atomMode = GUI_StringToAtom ("mode"); atomMsgGloat = GUI_StringToAtom ("msgGloat"); atomMsgLaola = GUI_StringToAtom ("msgLaola"); atomMsgLoseLevel = GUI_StringToAtom ("msgLoseLevel"); atomMsgLoseLife = GUI_StringToAtom ("msgLoseLife"); atomMsgLoser = GUI_StringToAtom ("msgLoser"); atomMsgWelcome = GUI_StringToAtom ("msgWelcome"); atomMsgWinGame = GUI_StringToAtom ("msgWinGame"); atomMsgWinLevel = GUI_StringToAtom ("msgWinLevel"); atomMusic = GUI_StringToAtom ("music"); atomName = GUI_StringToAtom ("name"); atomNastyCeil = GUI_StringToAtom ("nastyCeil"); atomNastyGentle = GUI_StringToAtom ("nastyGentle"); atomNastyRange = GUI_StringToAtom ("nastyRange"); atomNextNasty = GUI_StringToAtom ("nextNasty"); atomNumBlocks = GUI_StringToAtom ("numBlocks"); atomNumFrames = GUI_StringToAtom ("numFrames"); atomNumPlayers = GUI_StringToAtom ("numPlayers"); atomOutOfTime = GUI_StringToAtom ("outOfTime"); atomPass = GUI_StringToAtom ("pass"); // XBCC atomPID = GUI_StringToAtom ("PID"); // XBCC atomPlayer = GUI_StringToAtom ("player"); atomPlayerClick = GUI_StringToAtom ("playerClick"); atomPlayerRating = GUI_StringToAtom ("playerRating"); // XBCC atomPlayerStat = GUI_StringToAtom ("playerStat"); atomPort = GUI_StringToAtom ("port"); atomProbBomb = GUI_StringToAtom ("probBomb"); atomProbHidden = GUI_StringToAtom ("probHidden"); atomProbRange = GUI_StringToAtom ("probRange"); atomProbSpecial = GUI_StringToAtom ("probSpecial"); atomProbVirus = GUI_StringToAtom ("probVirus"); atomRandomLevels = GUI_StringToAtom ("randomLevels"); atomRandomPlayers = GUI_StringToAtom ("randomPlayers"); atomRandomSeed = GUI_StringToAtom ("randomSeed"); atomRatedGame = GUI_StringToAtom ("ratedGame"); // XBCC atomRange = GUI_StringToAtom ("range"); atomRecLives = GUI_StringToAtom ("reclives"); atomRecordDemo = GUI_StringToAtom ("recordDemo"); atomRecorded = GUI_StringToAtom ("recorded"); atomRemote = GUI_StringToAtom ("remote"); atomRemoteGame = GUI_StringToAtom ("remoteGame"); atomRemotePlayer = GUI_StringToAtom ("remotePlayer"); atomResults = GUI_StringToAtom ("results"); atomReviveExtra = GUI_StringToAtom ("reviveExtra"); atomReviveVirus = GUI_StringToAtom ("reviveVirus"); atomRight = GUI_StringToAtom ("right"); atomRightKeyboard = GUI_StringToAtom ("rightKeyboard"); atomScrambleDel = GUI_StringToAtom ("scrambleDel"); atomScrambleDraw = GUI_StringToAtom ("scrambleDraw"); atomSelect = GUI_StringToAtom ("select"); atomServer = GUI_StringToAtom ("server"); atomShape = GUI_StringToAtom ("shape"); atomShrink = GUI_StringToAtom ("shrink"); atomShuffle = GUI_StringToAtom ("shuffle"); atomSlowFlame = GUI_StringToAtom ("slowMotionBurst"); atomSmall = GUI_StringToAtom ("small"); atomSound = GUI_StringToAtom ("sound"); atomSpecial = GUI_StringToAtom ("special"); atomSpecialBombs = GUI_StringToAtom ("specialBombs"); atomStatusBg = GUI_StringToAtom ("statusBg"); atomStatusFg = GUI_StringToAtom ("statusFg"); atomStatusLed = GUI_StringToAtom ("statusLed"); atomStereo = GUI_StringToAtom ("stereo"); atomTeamMode = GUI_StringToAtom ("teamMode"); atomTime = GUI_StringToAtom ("time"); atomTimeRatings = GUI_StringToAtom ("ratings"); atomTitleBg = GUI_StringToAtom ("titleBg"); atomTitleFg = GUI_StringToAtom ("titleFg"); atomTurnStepKeyboard = GUI_StringToAtom ("turnStepKeyboard"); atomTurnStepJoystick = GUI_StringToAtom ("turnStepJoystick"); atomTop = GUI_StringToAtom ("top"); atomTotal = GUI_StringToAtom ("total"); atomType = GUI_StringToAtom ("type"); atomUseStopKey = GUI_StringToAtom ("useStopKey"); atomVersionMajor = GUI_StringToAtom ("major"); atomVersionMinor = GUI_StringToAtom ("minor"); atomVersionPatch = GUI_StringToAtom ("patch"); atomVideo = GUI_StringToAtom ("video"); atomWallClick = GUI_StringToAtom ("wallClick"); atomWin32 = GUI_StringToAtom ("win32"); atomWinner = GUI_StringToAtom ("winner"); atomWins = GUI_StringToAtom ("wins"); atomX11 = GUI_StringToAtom ("x11"); atomXblast = GUI_StringToAtom ("xblast"); atomXBCCRating = GUI_StringToAtom ("XBCCRating"); // XBCC atomXBCCGamesPlayed = GUI_StringToAtom ("XBCCGamesPlayed"); atomXBCCRealWins = GUI_StringToAtom ("XBCCRealWins"); atomXBCCRelativeWins = GUI_StringToAtom ("XBCCRelativeWins"); atomXBCCTimeUpdate = GUI_StringToAtom ("XBCCTimeUpdate"); atomXBCCTimeRegister = GUI_StringToAtom ("XBCCTimeRegister"); /* arrays */ for (i = 0; i < MAX_BLOCK; i++) { atomArrayBlock00[i] = GUI_FormatToAtom ("block%02d", i); } for (i = 0; i < MAX_HOSTS; i++) { atomArrayHost0[i] = GUI_FormatToAtom ("host%01d", i); } for (i = 0; i <= MAX_PLAYER; i++) { atomArrayControl0[i] = GUI_FormatToAtom ("control%1d", i); atomArrayPos0[i] = GUI_FormatToAtom ("pos%1d", i); atomArrayPlayer0[i] = GUI_FormatToAtom ("player%1d", i); atomArrayTeam0[i] = GUI_FormatToAtom ("team%1d", i); } for (i = 0; i < MAZE_W * MAZE_H; i++) { atomArrayPos000[i] = GUI_FormatToAtom ("pos%03d", i); } for (i = 0; i < MAZE_H; i++) { atomArrayRow00[i] = GUI_FormatToAtom ("row%02d", i); } for (i = 0; i < 10; i++) { atomGamehis[i] = GUI_FormatToAtom ("game%i", i); atomPorthis[i] = GUI_FormatToAtom ("port%i", i); } } /* InitDefaultAtoms */ /* * end of file atom.c */ xblast-2.10.4/atom.h0000644000175000017500000001527010372731122013324 0ustar rhondaalfie/* * file atom.h - predefined atoms fast database access * * $Id: atom.h,v 1.19 2006/02/09 21:21:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_ATOM_H #define XBLAST_ATOM_H /* * global variables */ extern XBAtom atomAllLevels; extern XBAtom atomAllowNat; extern XBAtom atomArmsLegs; extern XBAtom atomAuthor; extern XBAtom atomAuthor; extern XBAtom atomBackpack; extern XBAtom atomBeep; extern XBAtom atomBody; extern XBAtom atomBombClick; extern XBAtom atomBombs; extern XBAtom atomBot; extern XBAtom atomBottom; extern XBAtom atomBrowseLan; extern XBAtom atomCentral; // XBCC extern XBAtom atomCentralJoinName; // XBCC extern XBAtom atomCentralJoinPort; // XBCC extern XBAtom atomCentralLocal; // XBCC extern XBAtom atomCentralRemote; // XBCC extern XBAtom atomClient; extern XBAtom atomColor; extern XBAtom atomControl; extern XBAtom atomDarkText1; extern XBAtom atomDarkText2; extern XBAtom atomDefault; extern XBAtom atomDemo; extern XBAtom atomDirection; extern XBAtom atomDrawGame; extern XBAtom atomExtra; extern XBAtom atomExtraDistribution; extern XBAtom atomFace; extern XBAtom atomFixedUdpPort; extern XBAtom atomFont; extern XBAtom atomFontMini; extern XBAtom atomFrameRate; extern XBAtom atomFrames; extern XBAtom atomFunc; extern XBAtom atomFuseTime; extern XBAtom atomGame; extern XBAtom atomGamehis[10]; extern XBAtom atomGameMode; extern XBAtom atomGameMode; extern XBAtom atomGeneral; extern XBAtom atomGeometry; extern XBAtom atomGraphics; extern XBAtom atomHandsFeet; extern XBAtom atomHaunt; extern XBAtom atomHelmet; extern XBAtom atomHidden; extern XBAtom atomHint; extern XBAtom atomHost; extern XBAtom atomIfRecLives; extern XBAtom atomInfo; extern XBAtom atomInfoTime; // LRF extern XBAtom atomInitExtra; extern XBAtom atomInitVirus; extern XBAtom atomKey; extern XBAtom atomKeyAbort; extern XBAtom atomKeyAbortCancel; extern XBAtom atomKeyBomb; extern XBAtom atomKeyDown; extern XBAtom atomKeyLeft; extern XBAtom atomKeyPause; extern XBAtom atomKeyRight; extern XBAtom atomKeySpecial; extern XBAtom atomKeyStop; extern XBAtom atomKeyUp; extern XBAtom atomLarge; extern XBAtom atomLastPlayed; // LRF Better random leves (hopefully) extern XBAtom atomLeft; extern XBAtom atomLeftKeyboard; extern XBAtom atomLevel; extern XBAtom atomLevelOrder; // LRF extern XBAtom atomLevelShuffled; extern XBAtom atomLevelSorted; extern XBAtom atomLevelStat; extern XBAtom atomLightText1; extern XBAtom atomLightText2; extern XBAtom atomLives; extern XBAtom atomLocal; extern XBAtom atomMap; extern XBAtom atomMaskBytes; extern XBAtom atomMaxHosts; extern XBAtom atomMaxLocals; extern XBAtom atomMaxMaskBytes; extern XBAtom atomMaxPlayers; extern XBAtom atomMedium; extern XBAtom atomMissing; extern XBAtom atomMode; extern XBAtom atomMsgGloat; extern XBAtom atomMsgLaola; extern XBAtom atomMsgLoseLevel; extern XBAtom atomMsgLoseLife; extern XBAtom atomMsgLoser; extern XBAtom atomMsgWelcome; extern XBAtom atomMsgWinGame; extern XBAtom atomMsgWinLevel; extern XBAtom atomMusic; extern XBAtom atomName; extern XBAtom atomNastyCeil; extern XBAtom atomNastyGentle; extern XBAtom atomNastyRange; extern XBAtom atomNextNasty; extern XBAtom atomNumBlocks; extern XBAtom atomNumFrames; extern XBAtom atomNumPlayers; extern XBAtom atomOutOfTime; extern XBAtom atomPass; // XBCC extern XBAtom atomPID; // XBCC extern XBAtom atomPlayer; extern XBAtom atomPlayerClick; extern XBAtom atomPlayerRating; // XBCC extern XBAtom atomPlayerStat; extern XBAtom atomPort; extern XBAtom atomPorthis[10]; extern XBAtom atomProbBomb; extern XBAtom atomProbHidden; extern XBAtom atomProbRange; extern XBAtom atomProbSpecial; extern XBAtom atomProbVirus; extern XBAtom atomRandomLevels; extern XBAtom atomRandomPlayers; extern XBAtom atomRandomSeed; extern XBAtom atomRange; extern XBAtom atomRatedGame; // XBCC extern XBAtom atomRecLives; extern XBAtom atomRecordDemo; extern XBAtom atomRecorded; extern XBAtom atomRemote; extern XBAtom atomRemoteGame; extern XBAtom atomRemotePlayer; extern XBAtom atomResults; extern XBAtom atomReviveExtra; extern XBAtom atomReviveVirus; extern XBAtom atomRight; extern XBAtom atomRightKeyboard; extern XBAtom atomScrambleDel; extern XBAtom atomScrambleDraw; extern XBAtom atomSelect; extern XBAtom atomServer; extern XBAtom atomShape; extern XBAtom atomShrink; extern XBAtom atomShuffle; extern XBAtom atomSlowFlame; extern XBAtom atomSmall; extern XBAtom atomSound; extern XBAtom atomSpecial; extern XBAtom atomSpecialBombs; extern XBAtom atomStatusBg; extern XBAtom atomStatusFg; extern XBAtom atomStatusLed; extern XBAtom atomStereo; extern XBAtom atomTeamMode; extern XBAtom atomTime; extern XBAtom atomTimeRatings; extern XBAtom atomTitleBg; extern XBAtom atomTitleFg; extern XBAtom atomTop; extern XBAtom atomTotal; extern XBAtom atomTurnStepKeyboard; extern XBAtom atomTurnStepJoystick; extern XBAtom atomType; extern XBAtom atomUseStopKey; extern XBAtom atomVersionMajor; extern XBAtom atomVersionMinor; extern XBAtom atomVersionPatch; extern XBAtom atomVideo; extern XBAtom atomWallClick; extern XBAtom atomWin32; extern XBAtom atomWinner; extern XBAtom atomWins; extern XBAtom atomX11; extern XBAtom atomXBCCRating; // XBCC extern XBAtom atomXBCCGamesPlayed; extern XBAtom atomXBCCRealWins; extern XBAtom atomXBCCRelativeWins; extern XBAtom atomXBCCTimeUpdate; extern XBAtom atomXBCCTimeRegister; extern XBAtom atomXblast; /* Skywalker */ extern XBAtom atomKeyLaola; extern XBAtom atomKeyLooser; extern XBAtom atomKeyBot; extern XBAtom atomKeyChatStart; extern XBAtom atomKeyChatSend; extern XBAtom atomKeyChatCancel; extern XBAtom atomKeyChatChangeReceiver; /* */ extern XBAtom atomArrayBlock00[MAX_BLOCK]; extern XBAtom atomArrayControl0[MAX_PLAYER + 1]; extern XBAtom atomArrayHost0[MAX_HOSTS]; extern XBAtom atomArrayPlayer0[MAX_PLAYER + 1]; extern XBAtom atomArrayPos0[MAX_PLAYER + 1]; extern XBAtom atomArrayPos000[MAZE_W * MAZE_H]; extern XBAtom atomArrayRow00[MAZE_H]; extern XBAtom atomArrayTeam0[MAX_PLAYER + 1]; /* * global prototypes */ extern void InitDefaultAtoms (void); #endif /* * end of file atom.h */ xblast-2.10.4/autogen.sh0000755000175000017500000000021310374427560014215 0ustar rhondaalfie#!/bin/sh autoheader aclocal -I m4 autoconf automake --gnu --add-missing --copy if [ -s config.cache ] ; then rm config.cache; fi xblast-2.10.4/automake.fig0000644000175000017500000000014310047640425014505 0ustar rhondaalfieQUITONERROR FILES=*.c COMPILE=@fcc -c -g %fi LINK=@fcc -g -o %ex @%rf TARGET=Target.exe xblast-2.10.4/bomb.c0000644000175000017500000022574610443243435013315 0ustar rhondaalfie/* * file bomb.c - bombs and explosions * * $Id: bomb.c,v 1.30 2006/06/12 10:51:09 fzago Exp $ * * Program XBLAST * (C) 1993-1999 by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * macros */ #define BOMB_ERROR_PROB 32 // 23 apr 2002 #define BOMB_DELAY 5 /* haunt factors */ #define HAUNT_NONE 0 #define HAUNT_FAST 10 #define HAUNT_SLOW 35 /* nasty walls */ #define NASTY_INC GAME_TIME/12 /* * local types */ char *bomb_name_choice[] = { /*"Normal" -> */ "Normal", /*"Napalm" -> */ "Napalm", /*"Instant" -> */ "blastnow", /*"Close" -> */ "close", /*"Firecracker" -> */ "firecracker", /*"Firecracker 2" -> */ "firecracker2", /*"Construction" -> */ "Construction", /*"Three" -> */ "threebombs", /*"Grenade" -> */ "Grenade", /*"Triangle" -> */ "triangle", /*"Destruction" -> */ "Destruction", /*"Fungus" -> */ "Fungus", /*"Renovation" -> */ "Renovation", /*"Pyro" -> */ "Pyro", /*"Instant Pyro" -> */ "pyro2", /*"Random" -> */ "random", /* short -> */ "short", /*"Diagonal" -> */ "Diagonal", /*"Scissor" -> */ "Scissor", /*"Anti Scissor" -> */ "Anti Scissor", /*"Parallel" -> */ "Parallel", /*"Distance" -> */ "Distance", /*"Lucky" -> */ "Lucky", /*"Parasol" -> */ "Parasol", /*"Comb" -> */ "Comb", /*"Far Pyro" -> */ NULL, /*"Nuclear" -> */ NULL, /*"Protection" -> */ "Protection", /* */ "ringoffire", /*"Mine" -> */ "Auto Mine", /*"Short" -> */ NULL, /*"Row" -> */ NULL, /*"Column" -> */ NULL, /*"Searching" -> */ "Searching", /*"Ring Of Fire" -> */ NULL, /*"Psycho" -> */ NULL, /* */ NULL, /**/ }; int ChoiceDefaultBomb; /* pointer to function with type specifix behaviour */ typedef XBBool (*XBSpecialBombFunc) (Explosion *); /* * local prototypes */ /* "constructor" for a bomb */ static XBBool NewExplosion (BMPlayer * player, int x, int y, int range, XBBool remoteControlled, XBBool malfunction, BMBombType type, int typeExtr, BMDirection initialdir); /* special bomb functions */ static XBBool SpecialBombNormal (Explosion * ptr); static XBBool SpecialBombNapalm (Explosion * ptr); static XBBool SpecialBombFirecracker (Explosion * ptr); static XBBool SpecialBombConstruction (Explosion * ptr); static XBBool SpecialBombThreebombs (Explosion * ptr); static XBBool SpecialBombGrenade (Explosion * ptr); static XBBool SpecialBombTrianglebombs (Explosion * ptr); static XBBool SpecialBombDestruction (Explosion * ptr); static XBBool SpecialBombFungus (Explosion * ptr); static XBBool SpecialBombRenovation (Explosion * ptr); static XBBool SpecialBombPyro (Explosion * ptr); /* EPFL SHIT */ static XBBool SpecialBombDiagThree (Explosion * ptr); static XBBool SpecialBombScissor (Explosion * ptr); /* added by stn */ static XBBool SpecialBombScissor2 (Explosion * ptr); /* added by stn */ static XBBool SpecialBombParallel (Explosion * ptr); /* added by stn */ static XBBool SpecialBombDistance (Explosion * ptr); /* added by stn */ static XBBool SpecialBombLucky (Explosion * ptr); /* added by stn */ static XBBool SpecialBombParasol (Explosion * ptr); /* added by stn */ static XBBool SpecialBombComb (Explosion * ptr); /* added by stn */ static XBBool SpecialBombFarpyro (Explosion * ptr); /* added by stn */ static XBBool SpecialBombNuclear (Explosion * ptr); /* added by stn */ static XBBool SpecialBombProtectbombs (Explosion * ptr); /* Written by Amilhastre */ static XBBool SpecialBombRingofire (Explosion * ptr); /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombMine (Explosion * ptr); /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombRow (Explosion * ptr); /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombColumn (Explosion * ptr); /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombPsycho (Explosion * ptr); /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombChangeDirectionAtHalf (Explosion * ptr); /* Added by Skywalker */ /* bomb click functions */ void BombClickNone (Explosion * bomb); void BombClickInitial (Explosion * bomb); void BombClickThru (Explosion * bomb); void BombClickSnooker (Explosion * bomb); void BombClickContact (Explosion * bomb); void BombClickClockwise (Explosion * bomb); void BombClickAnticlockwise (Explosion * bomb); void BombClickRandomdir (Explosion * bomb); void BombClickRebound (Explosion * bomb); void BombClickSplit (Explosion * bomb); static void SpreXDir (int lx, int ly, int range, int type, int type_extr, BMDirection dir); /* * local variables */ /* array to locate bomb/explosion on map */ static Explosion *bombMaze[MAZE_W][MAZE_H]; /* list with all bombs and explosions */ static int numExpl = 0; Explosion *exploList; static Explosion *explEnd; int initialBombDir; static int hauntFactor; int curBombTime; int defaultBMT; static int specialBMT, evilBMT; static int slowMotionBurst = 0; static int nextNasty; static int ceilNasty; static int divNextNasty; static int gentleNasty; static int rangeNasty; /* bomb click functions */ XBBombClickFunc doBombClick; XBBombClickFunc doWallClick; XBBombClickFunc doPlayerClick; /* lookup table for special bomb function */ static XBSpecialBombFunc doSpecialBombFunction[NUM_BMT] = { SpecialBombNormal, SpecialBombNapalm, SpecialBombNormal, SpecialBombNormal, SpecialBombFirecracker, SpecialBombFirecracker, SpecialBombConstruction, SpecialBombThreebombs, SpecialBombGrenade, SpecialBombTrianglebombs, SpecialBombDestruction, SpecialBombFungus, SpecialBombRenovation, SpecialBombPyro, SpecialBombPyro, SpecialBombNormal, SpecialBombNormal, /* EPFL SHIT *//* FUNCTION NAMES */ SpecialBombDiagThree, SpecialBombScissor, SpecialBombScissor2, SpecialBombParallel, SpecialBombDistance, SpecialBombLucky, SpecialBombParasol, SpecialBombComb, SpecialBombFarpyro, SpecialBombNuclear, SpecialBombProtectbombs, SpecialBombRingofire, SpecialBombMine, SpecialBombRow, SpecialBombColumn, SpecialBombPsycho, SpecialBombNormal, /* search bomb */ SpecialBombChangeDirectionAtHalf,/** Skywalker **/ }; /* conversion table for bomb clicks */ static DBToData bombClickTable[] = { {"anticlockwise", (void *)BombClickAnticlockwise}, {"clockwise", (void *)BombClickClockwise}, {"contact", (void *)BombClickContact}, {"initial", (void *)BombClickInitial}, {"none", (void *)BombClickNone}, {"null", (void *)BombClickNone}, {"randomdir", (void *)BombClickRandomdir}, {"rebound", (void *)BombClickRebound}, {"snooker", (void *)BombClickSnooker}, {"split", (void *)BombClickSplit}, {"thru", (void *)BombClickThru}, {NULL, NULL}, }; /* conversion table for direction */ static DBToInt bombDirTable[] = { {"down", GoDown}, {"left", GoLeft}, {"right", GoRight}, {"up", GoUp}, {"stop", GoStop}, {NULL, -1} }; /* conversion table for fuse times */ static DBToInt fuseTimeTable[] = { {"long", LONG_FUSE}, {"short", SHORT_FUSE}, {"normal", BOMB_TIME}, {NULL, -1} }; /* conversion table for bomb types */ static DBToInt bombTypeTable[] = { /* NAME IN LEVEL FILE ALFABETICAL ORDER !!! */ {"blastnow", BMTblastnow}, {"changedirectionathalf", BMTchangedirectionathalf /* Skywalker */ }, {"close", BMTclose}, {"column", BMTcolumn}, {"comb", BMTcomb}, {"construction", BMTconstruction}, {"default", BMTdefault}, {"destruction", BMTdestruction}, {"diagional", BMTdiagthreebombs}, /* EPFL */ {"distance", BMTdistance}, {"farpyro2", BMTfarpyro}, {"firecracker", BMTfirecracker}, {"firecracker2", BMTfirecracker2}, {"fungus", BMTfungus}, {"grenade", BMTgrenade}, {"lucky", BMTlucky}, {"mine", BMTmine}, {"napalm", BMTnapalm}, {"normal", BMTnormal}, {"nuclear", BMTnuclear}, {"parallel", BMTparallel}, {"parasol", BMTparasol}, {"protectbombs", BMTprotectbombs}, {"psycho", BMTpsycho}, {"pyro", BMTpyro}, {"pyro2", BMTpyro2}, {"random", BMTrandom}, {"renovation", BMTrenovation}, {"ringofire", BMTringofire}, {"row", BMTrow}, {"scissor", BMTscissor}, {"scissor2", BMTscissor2}, {"search", BMTsearch}, {"short", BMTshort}, {"snipe", BMTsnipe}, {"threebombs", BMTthreebombs}, {"trianglebombs", BMTtrianglebombs}, {NULL, NUM_BMT}, }; /* bomb haunting */ static DBToInt hauntFactorTable[] = { {"fast", HAUNT_FAST}, {"slow", HAUNT_SLOW}, {"none", HAUNT_NONE}, {NULL, -1}, }; /* bomb extra info */ static char *bombName[] = { NULL, N_("Napalm bomb"), N_("Instant bomb"), NULL, N_("Firecracker"), NULL, N_("Construction bomb"), N_("Three bomb"), N_("Grenade"), N_("Triangle bomb"), N_("Destruction bomb"), N_("Fungus bomb"), N_("Renovation bomb"), N_("Pyro bomb"), NULL, N_("Random bomb"), N_("Fast bomb"), N_("Diagonal bomb"), N_("Scissor bomb >"), N_("Scissor bomb <"), N_("Parallel bomb"), N_("Distance bomb"), N_("Lucky bomb"), N_("Parasol bomb"), N_("Combo bomb"), N_("Farpyro bomb"), N_("Nuclear bomb"), N_("Protection bomb"), N_("Ring of Fire"), N_("Mine"), N_("Row"), N_("Column"), N_("Psycho"), }; /* bomb direction info */ static const char *bombDirInfo[MAX_DIR] = { NULL, "Bombs are going up", "Bombs are going left", "Bombs are falling down", "Bombs are going right", NULL, }; static char *bmNormalName = "normal"; const char * GetBombName (BMBombType type) { int i; if (type == BMTnormal) return bmNormalName; for (i = 0; i < NUM_BMT; ++i) if (bombTypeTable[i].value == type) return bombTypeTable[i].key; return bmNormalName; } void SetSlowMotionBurst (int flame) { slowMotionBurst = flame; } /* * load bombs from level data */ XBBool ParseLevelBombs (const DBSection * section, DBSection * warn) { void *ptr; assert (NULL == exploList); assert (NULL == explEnd); assert (0 == numExpl); /* check if section exists */ if (NULL == section) { Dbg_Out ("LEVEL: bomb section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* clear list */ ptr = NULL; /* clear lookup table */ memset (bombMaze, 0, sizeof (bombMaze)); /* BombClick has default */ switch (DB_ConvertEntryData (section, atomBombClick, &ptr, bombClickTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomBombClick)); doBombClick = BombClickNone; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomBombClick)); doBombClick = BombClickNone; DB_CreateEntryString (warn, atomBombClick, DB_DataToString (bombClickTable, doBombClick)); break; default: doBombClick = (XBBombClickFunc) ptr; break; } /* WallClick has default */ switch (DB_ConvertEntryData (section, atomWallClick, &ptr, bombClickTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomWallClick)); doWallClick = BombClickNone; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomWallClick)); doWallClick = BombClickNone; DB_CreateEntryString (warn, atomWallClick, DB_DataToString (bombClickTable, doWallClick)); break; default: doWallClick = (XBBombClickFunc) ptr; break; } /* PlayerClick has default */ switch (DB_ConvertEntryData (section, atomPlayerClick, &ptr, bombClickTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomPlayerClick)); doPlayerClick = BombClickNone; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomPlayerClick)); doPlayerClick = BombClickNone; DB_CreateEntryString (warn, atomPlayerClick, DB_DataToString (bombClickTable, doPlayerClick)); break; default: doPlayerClick = (XBBombClickFunc) ptr; break; } /* Direction has default */ switch (DB_ConvertEntryInt (section, atomDirection, &initialBombDir, bombDirTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomDirection)); initialBombDir = GoStop; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomDirection)); initialBombDir = GoStop; DB_CreateEntryString (warn, atomDirection, DB_IntToString (bombDirTable, initialBombDir)); break; default: break; } /* FuseTime has default */ switch (DB_ConvertEntryInt (section, atomFuseTime, &curBombTime, fuseTimeTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomFuseTime)); curBombTime = BOMB_TIME; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomFuseTime)); curBombTime = BOMB_TIME; DB_CreateEntryString (warn, atomFuseTime, DB_IntToString (fuseTimeTable, curBombTime)); break; default: break; } /* Haunt has default */ switch (DB_ConvertEntryInt (section, atomHaunt, &hauntFactor, hauntFactorTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomHaunt)); hauntFactor = HAUNT_NONE; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomHaunt)); hauntFactor = HAUNT_NONE; DB_CreateEntryString (warn, atomHaunt, DB_IntToString (hauntFactorTable, hauntFactor)); break; default: break; } /* Haunt has default */ switch (DB_ConvertEntryInt (section, atomDefault, &defaultBMT, bombTypeTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomDefault)); defaultBMT = BMTnormal; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomDefault)); defaultBMT = BMTnormal; DB_CreateEntryString (warn, atomDefault, DB_IntToString (bombTypeTable, defaultBMT)); break; default: break; } /* Special has default */ switch (DB_ConvertEntryInt (section, atomSpecial, &specialBMT, bombTypeTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomSpecial)); specialBMT = BMTnormal; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomSpecial)); specialBMT = BMTnormal; DB_CreateEntryString (warn, atomSpecial, DB_IntToString (bombTypeTable, specialBMT)); break; default: break; } /* Hidden has default */ switch (DB_ConvertEntryInt (section, atomHidden, &evilBMT, bombTypeTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomHidden)); evilBMT = BMTnormal; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomHidden)); evilBMT = BMTnormal; DB_CreateEntryString (warn, atomHidden, DB_IntToString (bombTypeTable, evilBMT)); break; default: break; } /* NastyCeil has default */ if (!DB_GetEntryInt (section, atomNastyCeil, &ceilNasty)) { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomNastyCeil)); ceilNasty = 0; } /* NastyGentle/NastyRange have default */ if (DB_GetEntryInt (section, atomNastyGentle, &gentleNasty) && DB_GetEntryInt (section, atomNastyRange, &rangeNasty)) { /* check for NextNasty */ if (!DB_GetEntryInt (section, atomNextNasty, &divNextNasty) || (divNextNasty == 0)) { divNextNasty = 1; } nextNasty = NASTY_INC / divNextNasty;; gentleNasty *= GAME_TIME; } else { Dbg_Level ("default nasty data\n"); nextNasty = GAME_TIME + NASTY_INC + 1; gentleNasty = 0; rangeNasty = 0; } return XBTrue; } /* * set level info text */ void ConfigLevelBombs (const DBSection * section) { const char *s; /* bomb types */ if (NULL != bombName[defaultBMT]) { AddLevelInfo (_("%s as default"), bombName[defaultBMT]); } if (0 != NumSpecialBombs () && NULL != bombName[specialBMT]) { AddLevelInfo ("%d %ss", NumSpecialBombs (), bombName[specialBMT]); } if (HasSpecialBombs () && NULL != bombName[specialBMT]) { AddLevelInfo (_("%s as an extra"), bombName[specialBMT]); } if (NULL != bombName[evilBMT]) { AddLevelInfo ("Hidden %ss", bombName[evilBMT]); } /* fuse time */ switch (curBombTime) { case LONG_FUSE: AddLevelInfo (N_("All bombs are long fused")); break; case SHORT_FUSE: AddLevelInfo (N_("All bombs are short fused")); break; default: break; } /* direction */ if (NULL != (s = bombDirInfo[initialBombDir])) { AddLevelInfo (s); } /* haunting */ switch (hauntFactor) { case HAUNT_SLOW: AddLevelInfo (N_("All bombs are haunted")); break; case HAUNT_FAST: AddLevelInfo (N_("All bombs are haunted (and dangerous)")); break; default: break; } /* bomb click */ if (doBombClick == BombClickRebound) { AddLevelInfo (N_("Bombs rebound from others")); } else if (doBombClick == BombClickContact) { AddLevelInfo (N_("Bombs explode on contact with others")); } else if (doBombClick == BombClickClockwise) { AddLevelInfo (N_("Bombs turn clockwise on hitting others")); } else if (doBombClick == BombClickAnticlockwise) { AddLevelInfo (N_("Bombs turn anticlockwise on hitting others")); } else if (doBombClick == BombClickRandomdir) { AddLevelInfo (N_("Bombs bounce off randomly from others")); } else if (doBombClick == BombClickSnooker) { AddLevelInfo (N_("Bombs are snooker bombs")); } else if (doBombClick == BombClickSplit) { fprintf (stderr, "Bombs split with contact off Bombs"); AddLevelInfo (N_("Bombs split with contact off Bombs")); } /* wall click */ if (doWallClick == BombClickRebound) { AddLevelInfo (N_("Bombs rebound off walls")); } else if (doWallClick == BombClickContact) { AddLevelInfo (N_("Bombs explode on contact with walls")); } else if (doWallClick == BombClickClockwise) { AddLevelInfo (N_("Bombs turn clockwise on hitting walls")); } else if (doWallClick == BombClickAnticlockwise) { AddLevelInfo (N_("Bombs turn anticlockwise on hitting walls")); } else if (doWallClick == BombClickRandomdir) { AddLevelInfo (N_("Bombs bounce off randomly of walls")); } else if (doWallClick == BombClickSplit) { fprintf (stderr, "Bombs split with contact off walls"); AddLevelInfo (N_("Bombs split with contact off Walls")); } /* player click */ if (doPlayerClick == BombClickThru) { AddLevelInfo (N_("Bombs stun players running through")); } else if (doPlayerClick == BombClickContact) { AddLevelInfo (N_("Bombs explode on contact with players")); } else if (doPlayerClick == BombClickRebound) { AddLevelInfo (N_("Bombs rebound off players")); } else if (doPlayerClick == BombClickSplit) { fprintf (stderr, "Bombs split with contact off players"); AddLevelInfo (N_("Bombs split with contact off players")); } /* nasty walls */ if (gentleNasty != 0) { AddLevelInfo (N_("The Walls launch bombs")); } ChoiceDefaultBomb = defaultBMT; /* that's all */ } /* ConfigBombs */ /* * */ static void OneExplAt (int x, int y, int ra, int ri, BMBurnOut * burnOut) { int i; assert (NULL != burnOut); /* right */ if (0 == (*burnOut & BO_RIGHT)) { for (i = 0; (i <= ra) && CheckMazeOpen (x + i, y); i++) { if (i >= ri) { if (i != ri && i != ra) { SetExplBlock (x + i, y, 0x1a); } else if (i != ri) { SetExplBlock (x + i, y, 0x18); } else if (i == ra) { SetExplBlock (x + i, y, 0x10); } else { SetExplBlock (x + i, y, 0x12); } } } if (i < ri) { *burnOut |= BO_RIGHT; } if ((i <= ra) && (CheckMazeExtra (x + i, y))) { SetMazeBlock (x + i, y, BTExtraOpen); } } /* left */ if (0 == (*burnOut & BO_LEFT)) { for (i = 0; (i <= ra) && CheckMazeOpen (x - i, y); i++) { if (i >= ri) { if (i != ri && i != ra) { SetExplBlock (x - i, y, 0x1a); } else if (i != ri) { SetExplBlock (x - i, y, 0x12); } else if (i == ra) { SetExplBlock (x - i, y, 0x10); } else { SetExplBlock (x - i, y, 0x18); } } } if (i < ri) { *burnOut |= BO_LEFT; } if ((i <= ra) && (CheckMazeExtra (x - i, y))) { SetMazeBlock (x - i, y, BTExtraOpen); } } /* up */ if (0 == (*burnOut & BO_UP)) { for (i = 0; (i <= ra) && CheckMazeOpen (x, y - i); i++) { if (i >= ri) { if (i != ri && i != ra) { SetExplBlock (x, y - i, 0x15); } else if (i != ri) { SetExplBlock (x, y - i, 0x14); } else if (i == ra) { SetExplBlock (x, y - i, 0x10); } else { SetExplBlock (x, y - i, 0x11); } } } if (i < ri) { *burnOut |= BO_UP; } if ((i <= ra) && CheckMazeExtra (x, y - i)) { SetMazeBlock (x, y - i, BTExtraOpen); } } /* down */ if (0 == (*burnOut & BO_DOWN)) { for (i = 0; (i <= ra) && CheckMazeOpen (x, y + i); i++) { if (i >= ri) { if (i != ri && i != ra) { SetExplBlock (x, y + i, 0x15); } else if (i != ri) { SetExplBlock (x, y + i, 0x11); } else if (i == ra) { SetExplBlock (x, y + i, 0x10); } else { SetExplBlock (x, y + i, 0x14); } } } if (i < ri) { *burnOut |= BO_DOWN; } if ((i <= ra) && CheckMazeExtra (x, y + i)) { SetMazeBlock (x, y + i, BTExtraOpen); } } } /* OneExplAt */ /* * */ static void DelExplosion (Explosion * ptr) { Explosion *hilf; int i, x, y, r; assert (ptr != NULL); /* give bomb back to player */ if (ptr->player != NULL) { ptr->player->bombs++; if (ptr->isMorphed) { /* remorph player, if he was this bomb */ ptr->player->morphed = 0; ptr->player->x = ptr->x * BLOCK_WIDTH; ptr->player->y = (ptr->y - 1) * BLOCK_HEIGHT; ptr->player->num_extras--; } /** Skywalker **/ if (ptr->isSniping) { ptr->player->sniping = 0; ptr->player->num_extras--; // ptr->player->x = ptr->x * BLOCK_WIDTH; // ptr->player->y = (ptr->y-1) * BLOCK_HEIGHT; } /** **/ } /* just for convenience */ x = ptr->x; y = ptr->y; r = ptr->range; /* currect lookup map */ bombMaze[x][y] = NULL; /* one less explosions to worry about */ numExpl--; /* look right for blocks to blast */ for (i = 0; i <= r; i++) { if (!CheckMazeFree2 (x + i, y)) { BlastExtraBlock (x + i, y); break; } } /* look left for blocks to blast */ for (i = 0; i <= r; i++) { if (!CheckMazeFree2 (x - i, y)) { BlastExtraBlock (x - i, y); break; } } /* look down for blocks to blast */ for (i = 0; i <= r; i++) { if (!CheckMazeFree2 (x, y + i)) { BlastExtraBlock (x, y + i); break; } } /* look up for blocks to blast */ for (i = 0; i <= r; i++) { if (!CheckMazeFree2 (x, y - i)) { BlastExtraBlock (x, y - i); break; } } /* delete bomb sprite */ if (ptr->sprite != NULL) { DeleteSprite (ptr->sprite); } /* remove form list */ if (ptr == exploList) { exploList = ptr->next; if (exploList == NULL) { explEnd = NULL; } } else { for (hilf = exploList; hilf->next != NULL; hilf = hilf->next) { if (hilf->next == ptr) { if (explEnd == ptr) { explEnd = hilf; } hilf->next = hilf->next->next; break; } } } /* free memory */ free (ptr); } /* DelExplosion */ /* * delete all explosions in the game */ void DeleteAllExplosions (void) { Dbg_Out ("delete all explosions\n"); /* just delete the first element as long as one exists */ while (NULL != exploList) { DelExplosion (exploList); } assert (NULL == exploList); assert (NULL == explEnd); } /* DeleteAllExplosions */ /*------------------------------------------------------------------------* * * Player, wall, and bomb click functions (Garth Denley) * *------------------------------------------------------------------------*/ /* * no effect (bomb stops) */ void BombClickNone (Explosion * bomb) { bomb->dir = GoStop; bomb->dx = 0; bomb->dy = 0; } /* BombClickNone */ /* * bomb goes on with inital direction */ void BombClickInitial (Explosion * bomb) { switch (initialBombDir) { case GoStop: bomb->dx = 0; bomb->dy = 0; break; case GoRight: if (CheckMazeFree (bomb->x + 1, bomb->y)) { bomb->dx = BOMB_VX; } bomb->dy = 0; break; case GoLeft: if (CheckMazeFree (bomb->x - 1, bomb->y)) { bomb->dx = -BOMB_VX; } bomb->dy = 0; break; case GoDown: bomb->dx = 0; if (CheckMazeFree (bomb->x, bomb->y + 1)) { bomb->dy = BOMB_VY; } break; case GoUp: bomb->dx = 0; if (CheckMazeFree (bomb->x, bomb->y - 1)) { bomb->dy = -BOMB_VY; } break; } bomb->dir = initialBombDir; } /* BombClickInitial */ /* * bomb goes thru */ void BombClickThru (Explosion * bomb) { } /* BombClickThru */ /* * snooker bombs */ void BombClickSnooker (Explosion * bomb) { int dir; dir = bomb->dir; bomb->dir = GoStop; bomb->dx = 0; bomb->dy = 0; switch (dir) { case GoUp: MoveBomb (bomb->x, bomb->y - 1, dir); break; case GoLeft: MoveBomb (bomb->x - 1, bomb->y, dir); break; case GoDown: MoveBomb (bomb->x, bomb->y + 1, dir); break; case GoRight: MoveBomb (bomb->x + 1, bomb->y, dir); break; } } /* BombClickSnooker */ /* * contact bombs */ void BombClickContact (Explosion * bomb) { bomb->dir = GoStop; bomb->dx = 0; bomb->dy = 0; bomb->count = 0; } /* BombClickContact */ /* * clockwise bombs */ void BombClickClockwise (Explosion * bomb) { static BMDirection turnClockwise[MAX_DIR] = { GoStop, GoRight, GoUp, GoLeft, GoDown, GoDefault }; bomb->dx = 0; bomb->dy = 0; bomb->dir = turnClockwise[bomb->dir]; } /* BombClickClockwise */ /* * anticlockwise bombs */ void BombClickAnticlockwise (Explosion * bomb) { static BMDirection turnAnticlockwise[MAX_DIR] = { GoStop, GoLeft, GoDown, GoRight, GoUp, GoDefault }; bomb->dx = 0; bomb->dy = 0; bomb->dir = turnAnticlockwise[bomb->dir]; } /* BombClickAnticlockwise */ /* * randomdir bombs */ void BombClickRandomdir (Explosion * bomb) { bomb->dx = 0; bomb->dy = 0; bomb->dir = (BMDirection) (GameRandomNumber (4) + 1); } /* BombClickRandomdir */ /*Sky*/ /* Added by Fouf on 09/02/99 22:46:25 */ /* Added by "Belgium Guys" */ /* * BombClickRebound */ void BombClickSplit (Explosion * bomb) { static BMDirection turnOpposite[MAX_DIR] = { GoStop, GoDown, GoRight, GoUp, GoLeft, GoDefault }; static BMDirection turnClockwise[MAX_DIR] = { GoStop, GoRight, GoUp, GoLeft, GoDown, GoDefault }; static BMDirection turnAnticlockwise[MAX_DIR] = { GoStop, GoLeft, GoDown, GoRight, GoUp, GoDefault }; bomb->dir = turnOpposite[bomb->dir]; SpreXDir (bomb->x + 1, bomb->y + 1, bomb->range, defaultBMT, 0, turnClockwise[bomb->dir]); SpreXDir (bomb->x - 1, bomb->y - 1, bomb->range, defaultBMT, 0, turnAnticlockwise[bomb->dir]); } /* BombClickRebound */ /*Sky*/ /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ /* * rebound bombs */ void BombClickRebound (Explosion * bomb) { static BMDirection turnOpposite[MAX_DIR] = { GoStop, GoDown, GoRight, GoUp, GoLeft, GoDefault }; bomb->dir = turnOpposite[bomb->dir]; } /* BombClickRebound */ /* * */ static void HauntBomb (Explosion * ptr) { assert (ptr != NULL); if (ptr->dir == GoStop) { if (!CheckPlayerNear (ptr->x, ptr->y)) { switch (GameRandomNumber (4)) { case 0: ptr->dir = GoUp; ptr->dx = 0; break; case 1: ptr->dir = GoDown; ptr->dx = 0; break; case 2: ptr->dir = GoLeft; ptr->dy = 0; break; case 3: ptr->dir = GoRight; ptr->dy = 0; break; } SND_Play (SND_HAUNT, SOUND_MIDDLE_POSITION); } } } /* HauntKick */ /* * move bomb one step upwards */ static void MoveBombUp (Explosion * ptr) { int tt; assert (ptr != NULL); tt = (ptr->y - 1 + MAZE_H) % MAZE_H; // 02-05-2002 if ((ptr->dy == 0) && !CheckMazeFree (ptr->x, tt)) { (*doWallClick) (ptr); } else if ((ptr->dy <= 0) && CheckBomb (ptr->x, tt)) { // 02-05-2002 (*doBombClick) (ptr); } else { ptr->dy -= BOMB_VY; if (ptr->dy <= -BLOCK_HEIGHT / 2) { SND_Play (SND_SLIDE, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); bombMaze[ptr->x][ptr->y] = NULL; ptr->dy += BLOCK_HEIGHT; ptr->y -= 1; ptr->y = tt; bombMaze[ptr->x][ptr->y] = ptr; } } } /* MoveBombUp */ /* * move bomb one step downwards */ static void MoveBombDown (Explosion * ptr) { int tt; assert (ptr != NULL); tt = (ptr->y + 1 + MAZE_H) % MAZE_H; // 02-05-2002 if ((ptr->dy == 0) && !CheckMazeFree (ptr->x, tt)) { (*doWallClick) (ptr); } else if ((ptr->dy >= 0) && CheckBomb (ptr->x, tt)) { (*doBombClick) (ptr); } else { ptr->dy += BOMB_VY; if (ptr->dy >= BLOCK_HEIGHT / 2) { SND_Play (SND_SLIDE, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); bombMaze[ptr->x][ptr->y] = NULL; ptr->dy -= BLOCK_HEIGHT; ptr->y += 1; ptr->y = tt; bombMaze[ptr->x][ptr->y] = ptr; } } } /* MoveBombDown */ /* * move bomb one step right */ static void MoveBombRight (Explosion * ptr) { int tt; assert (ptr != NULL); tt = (ptr->x + 1 + MAZE_W) % MAZE_W; // 02-05-2002 if ((ptr->dx == 0) && !CheckMazeFree (tt, ptr->y)) { (*doWallClick) (ptr); } else if ((ptr->dx >= 0) && CheckBomb (tt, ptr->y)) { (*doBombClick) (ptr); } else { ptr->dx += BOMB_VX; if (ptr->dx >= BLOCK_WIDTH / 2) { SND_Play (SND_SLIDE, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); bombMaze[ptr->x][ptr->y] = NULL; ptr->dx -= BLOCK_WIDTH; ptr->x += 1; ptr->x = tt; bombMaze[ptr->x][ptr->y] = ptr; } } } /* MoveBombRight */ /* * move bomb one step left */ static void MoveBombLeft (Explosion * ptr) { int tt; assert (ptr != NULL); tt = (ptr->x - 1 + MAZE_W) % MAZE_W; // 02-05-2002 if ((ptr->dx == 0) && !CheckMazeFree (tt, ptr->y)) { (*doWallClick) (ptr); } else if ((ptr->dx <= 0) && CheckBomb (tt, ptr->y)) { (*doBombClick) (ptr); } else { ptr->dx -= BOMB_VX; if (ptr->dx <= -BLOCK_WIDTH / 2) { SND_Play (SND_SLIDE, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); bombMaze[ptr->x][ptr->y] = NULL; ptr->dx += BLOCK_WIDTH; ptr->x -= 1; ptr->x = tt; bombMaze[ptr->x][ptr->y] = ptr; } } } /* MoveBombLeft */ /* * work all bombs in list */ void DoBombs (BMPlayer * ps, int numPlayer) // void changed for search bombs { Explosion *ptr; int bombToHaunt = -1; /* Added by Fouf on 09/14/99 23:55:18 *//* Written by Amilhastre */ int tt, difX, difY, bwX, bwY; /* determine if any bomb is haunted */ if (HAUNT_NONE != hauntFactor) { bombToHaunt = GameRandomNumber (hauntFactor); if (bombToHaunt > 6) { bombToHaunt = -1; } } for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count == 0) { /* Bomb is just exploding */ if (NULL != ptr->sprite) { ptr->anime = MAX_BOMB_ANIME - 1; SetSpriteAnime (ptr->sprite, ptr->anime); SetSpriteMode (ptr->sprite, SPM_MAPPED); MoveSprite (ptr->sprite, ptr->x * BLOCK_WIDTH, ptr->y * BLOCK_HEIGHT); } } else if (ptr->count < 0) { /* Bomb has not yet exploded */ /* haunt bomb */ if (HAUNT_NONE != hauntFactor) { if (0 == bombToHaunt) { HauntBomb (ptr); } bombToHaunt--; } if (ptr->stop && (ptr->dx == 0) && (ptr->dy == 0)) { // fprintf(stderr," stoping!!\n"); /* EPFL STOP ++ */ ptr->dir = GoStop; /* EPFL STOP ++ */ ptr->stop = XBFalse; /* EPFL STOP ++ */ } /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ if (ptr->jump == 1) { ptr->dir = GoStop; } /* Written by Amilhastre *//* new dir for up-going or down-going search bomb */ /* Written by Amilhastre */ if (ptr->type == BMTsearch && ptr->dir != GoStop) { /* Written by Amilhastre */ if (ptr->dir == GoUp || ptr->dir == GoDown) { /* Written by Amilhastre */ if (ptr->dy == 0) { /* Written by Amilhastre */ bwX = ptr->x * BLOCK_WIDTH; /* Written by Amilhastre */ bwY = ((ptr->y) - 1) * BLOCK_HEIGHT; /* Written by Amilhastre */ for (tt = 0; tt < numPlayer; tt++) { /* Written by Amilhastre */ if ((ps[tt].lives) && ((ptr->player != NULL) ? (ps[tt].team != ptr->player->team) : 1)) { /* Written by Amilhastre */ difX = bwX - ps[tt].x; /* Written by Amilhastre */ if ((ABS (difX) <= BOMB_SEARCH_X) && (ABS (bwY - ps[tt].y) < BLOCK_HEIGHT)) { /* Written by Amilhastre */ if (difX > 0 && (CheckMazeFree (ptr->x - 1, ptr->y))) { ptr->dir = GoLeft; break; } /* Written by Amilhastre */ if (difX < 0 && (CheckMazeFree (ptr->x + 1, ptr->y))) { ptr->dir = GoRight; break; } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre *//* new dir for left-going or right-going search bomb */ /* Written by Amilhastre */ else if (ptr->dir == GoLeft || ptr->dir == GoRight) { /* Written by Amilhastre */ if (ptr->dx == 0) { /* Written by Amilhastre */ bwX = ptr->x * BLOCK_WIDTH; /* Written by Amilhastre */ bwY = ((ptr->y) - 1) * BLOCK_HEIGHT; /* Written by Amilhastre */ for (tt = 0; tt < numPlayer; tt++) { /* Written by Amilhastre */ if ((ps[tt].lives) && ((ptr->player != NULL) ? (ps[tt].team != ptr->player->team) : 1)) { /* Written by Amilhastre */ difY = bwY - ps[tt].y; /* Written by Amilhastre */ if ((ABS (difY) <= BOMB_SEARCH_Y) && (ABS (bwX - ps[tt].x) < BLOCK_WIDTH)) { /* Written by Amilhastre */ if (difY > 0 && (CheckMazeFree (ptr->x, ptr->y - 1))) { ptr->dir = GoUp; break; } /* Written by Amilhastre */ if (difY < 0 && (CheckMazeFree (ptr->x, ptr->y + 1))) { ptr->dir = GoDown; break; } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ } /* Written by Amilhastre */ /* old version before skywalker switch(ptr->dir) { case GoUp: MoveBombUp (ptr); break; case GoDown: MoveBombDown (ptr); break; case GoRight: MoveBombRight (ptr); break; case GoLeft: MoveBombLeft (ptr); break; default: break; } */ /** Skywalker **/ if (ptr->isSniping == 0) { /** **/ switch (ptr->dir) { case GoUp: MoveBombUp (ptr); /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ if (ptr-> jump > 0) { ptr->type = BMTshort; if (ptr->dy <= -BLOCK_HEIGHT / 2) { bombMaze[ptr->x][ptr->y] = NULL; ptr->dy += BLOCK_HEIGHT; ptr->y -= 1; bombMaze[ptr->x][ptr->y] = ptr; } ptr->dy -= BOMB_VY; if (ptr->y <= 1) { ptr->dy = 0; } ptr->jump--; } else { break; } break; case GoDown: MoveBombDown (ptr); if (ptr->jump > 0) { ptr->type = BMTshort; if (ptr->dy >= BLOCK_HEIGHT / 2) { bombMaze[ptr->x][ptr->y] = NULL; ptr->dy -= BLOCK_HEIGHT; ptr->y += 1; bombMaze[ptr->x][ptr->y] = ptr; } ptr->dy += BOMB_VY; if (ptr->y >= MAZE_H - 2) { ptr->dy = 0; } ptr->jump--; } else { } break; case GoRight: MoveBombRight (ptr); if (ptr->jump > 0) { if (ptr->dx >= BLOCK_WIDTH / 2) { bombMaze[ptr->x][ptr->y] = NULL; ptr->dx -= BLOCK_WIDTH; ptr->x += 1; bombMaze[ptr->x][ptr->y] = ptr; } ptr->dx += BOMB_VX; if (ptr->x >= MAZE_W - 2) { ptr->dx = 0; } ptr->jump--; } else { } break; case GoLeft: MoveBombLeft (ptr); if (ptr->jump > 0) { if (ptr->dx <= -BLOCK_WIDTH / 2) { bombMaze[ptr->x][ptr->y] = NULL; ptr->dx += BLOCK_WIDTH; ptr->x -= 1; bombMaze[ptr->x][ptr->y] = ptr; } ptr->dx -= BOMB_VX; if (ptr->x <= 1) { ptr->dx = 0; } ptr->jump--; } else { } break; default: break; } /** Skywalker **/ } else { if (NULL != ptr->player) { // ptr->player->x = ptr->dx + ptr->x * BLOCK_WIDTH; // ptr->player->y = ptr->dy + (ptr->y-1) * BLOCK_HEIGHT; // move_sprite (ptr->player->sprite, ptr->player->x, ptr->player->y + BASE_Y); switch (ptr->player->d_soll) { case GoUp: MoveBombUp (ptr); break; case GoDown: MoveBombDown (ptr); break; case GoRight: MoveBombRight (ptr); break; case GoLeft: MoveBombLeft (ptr); break; default: break; } } else { /** **/ switch (ptr->dir) { case GoUp: MoveBombUp (ptr); break; case GoDown: MoveBombDown (ptr); break; case GoRight: MoveBombRight (ptr); break; case GoLeft: MoveBombLeft (ptr); break; default: break; } } } /* move bomb sprite */ if (NULL != ptr->sprite) { MoveSprite (ptr->sprite, ptr->x * BLOCK_WIDTH + ptr->dx, ptr->y * BLOCK_HEIGHT + ptr->dy); } /* if player is morphed */ if (ptr->isMorphed && NULL != ptr->player) { ptr->player->x = ptr->dx + ptr->x * BLOCK_WIDTH; ptr->player->y = ptr->dy + (ptr->y - 1) * BLOCK_HEIGHT; MoveSprite (ptr->player->sprite, ptr->player->x, ptr->player->y + BASE_Y); } /* check if bomb is on an explosion */ if (CheckExplosion (ptr->x, ptr->y)) { ptr->count = 0; } /* handle bomb animation and blinking */ if (ptr->sprite != NULL) { if (ptr->blink + ptr->count == 0) { SetSpriteMode (ptr->sprite, SPM_MAPPED | SPM_MASKED); ptr->blink = ptr->blink >> 1; } else { SetSpriteMode (ptr->sprite, SPM_MAPPED); } if (ptr->count == ptr->nextAnime) { ptr->anime++; ptr->nextAnime += curBombTime / (MAX_BOMB_ANIME - 1); SetSpriteAnime (ptr->sprite, ptr->anime); } } /* Bomb malfunction, random or illness */ if ((ptr->count == -3) && (ptr->malfunction || (GameRandomNumber (BOMB_ERROR_PROB) == 0))) { ptr->malfunction = 0; ptr->count = -BOMB_TIME * (2 + GameRandomNumber (BOMB_DELAY)); ptr->blink = (BOMB_TIME >> 1); } } } } /* DoBombs */ int StopPlayersBombs (BMPlayer * ps) { Explosion *ptr; int numberOfBombs = 0; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count < 0) { /* draw a bomb */ if (ptr->player == ps) { // fprintf(stderr," stoping!!!\n"); ptr->stop = XBTrue; numberOfBombs++; } } } return (numberOfBombs); } /* * ignite all bombs of one given player */ int IgnitePlayersBombs (BMPlayer * ps) { Explosion *ptr; int numberOfBombs = 0; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count < 0) { /* draw a bomb */ if (ptr->player == ps) { ptr->count = 0; numberOfBombs++; } } } return numberOfBombs; } /* IgnitePlayersBombs */ /* * ignite all bombs */ int IgniteAllBombs (BMPlayer * ps) { Explosion *ptr; int numberOfBombs = 0; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count < 0) { ptr->count = 0; numberOfBombs++; } } return numberOfBombs; } /* IgniteAllBombs */ /* * ignite bombs on explosions */ void IgniteBombs (void) { Explosion *ptr; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count < 0) { /* draw a bomb */ if (CheckExplosion (ptr->x, ptr->y)) { ptr->count = 0; } } } } /* IgniteBombs */ /* * handle all explosions in list */ void DoExplosions (void) { Explosion *ptr, *nextPtr; int hilf; ptr = exploList; while (ptr != NULL) { nextPtr = ptr->next; /* check if bomb is exploding */ if (ptr->count >= 0) { /* hide morphed player's eyes */ if (ptr->count == 0 && ptr->isMorphed && ptr->player != NULL) { ptr->player->morphed = 3; } /* check if bomb has burned out */ if ((ptr->burnOut == BO_TOTAL) || (ptr->count >= (2 * ptr->range + 2))) { DelExplosion (ptr); ptr = nextPtr; continue; } else { /* get exploding time */ if ((hilf = ptr->count) == 0) { /* set any free tile to burned */ if (CheckMazeFree (ptr->x, ptr->y)) { SetMazeBlock (ptr->x, ptr->y, BTBurned); } /* play according sound */ if (ptr->range == 1 || ptr->type == BMTfirecracker || ptr->type == BMTfirecracker2) { SND_Play (SND_MINIBOMB, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); } else { SND_Play (SND_EXPL, (ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); } } /* now do the explosion */ OneExplAt (ptr->x, ptr->y, MIN (ptr->range, hilf), MAX (0, ((hilf) - ptr->range)), &(ptr->burnOut)); } } if ((*doSpecialBombFunction[ptr->type]) (ptr)) { if (slowMotionBurst) { if (ptr->count > 0) { ptr->count += ptr->countslower2 % slowMotionBurst == 0; } else { ptr->count++; } ptr->countslower += ptr->countslower2 % slowMotionBurst == 0; ptr->countslower2++; } else { ptr->count++; } if (2 == ptr->count && NULL != ptr->sprite) { DeleteSprite (ptr->sprite); ptr->sprite = NULL; } } else { /* bomb deleted you must set explicitly to NULL (dont ask me why) */ /* if (doSpecialBombFunction[ptr->type]==SpecialBombDestruction|| doSpecialBombFunction[ptr->type]==SpecialBombConstruction){ } */ ptr = NULL; } if (ptr != NULL) { ptr = ptr->next; } else { ptr = nextPtr; } } } /* DoExplosions */ /*------------------------------------------------------------------------* * * Special bomb code (Garth Denley) * *------------------------------------------------------------------------*/ /* * Used to spread an explosion out */ static void SpreadExplosion (int lx, int ly, int range, int type, int typeExtr) { if ((lx < MAZE_W) && (lx > -1) && (ly < MAZE_H) && (ly > -1) && !CheckMazeSolid (lx, ly)) { NewExplosion (NULL, lx, ly, range, XBFalse, XBFalse, type, typeExtr, GoStop); } } /* SpreadExplosion */ /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ static void SpreXDir (int lx, int ly, int range, int type, int type_extr, BMDirection dir) { if ((lx < MAZE_W) && (lx > -1) && (ly < MAZE_H) && (ly > -1) && !CheckMazeSolid (lx, ly)) { NewExplosion (NULL, lx, ly, range, XBFalse, XBFalse, type, type_extr, dir); } } /* * */ static void MoveBlockFromTo (int sx, int sy, int dx, int dy) { if ((sx > 0) && (sx < MAZE_W - 1) && (sy > 0) && (sy < MAZE_H - 1) && (dx > 0) && (dx < MAZE_W - 1) && (dy > 0) && (dy < MAZE_H - 1) && CheckMazeWall (sx, sy) && CheckMazeFree (dx, dy)) { KillPlayerAt (dx, dy); DeleteBombAt (dx, dy); SetMazeBlock (sx, sy, BTFree); SetMazeBlock (dx, dy, BTBlock); } } /* MoveBlockFromTo */ /* * special bomb functions */ /* * */ static XBBool SpecialBombNormal (Explosion * ptr) { return XBTrue; } /* * napalm bomb */ static XBBool SpecialBombNapalm (Explosion * ptr) { int i; // if (ptr->count == -1) { if (ptr->count == 0) { ptr->type = BMTnormal; for (i = -2; i <= 2; i++) { SpreadExplosion (ptr->x + i, ptr->y, ptr->range / (ABS (i) + 1), BMTblastnow, 0); SpreadExplosion (ptr->x, ptr->y + i, ptr->range / (ABS (i) + 1), BMTblastnow, 0); } } return XBTrue; } /* SpecialBombNapalm */ /* * firecracker */ static XBBool SpecialBombFirecracker (Explosion * ptr) { int i; int nasty; if (ptr->count >= 1) { if (ptr->type == BMTfirecracker && GameRandomNumber (10) == 0) { ptr->typeExtr = -5; } nasty = ptr->typeExtr; for (i = -1; i <= 1; i++) { if (nasty < 2 || 0 == GameRandomNumber (1 + nasty)) { SpreadExplosion (ptr->x + i, ptr->y, 1, BMTfirecracker2, nasty + 1); } if (nasty < 2 || 0 == GameRandomNumber (1 + nasty)) { SpreadExplosion (ptr->x, ptr->y + i, 1, BMTfirecracker2, nasty + 1); } } ptr->type = BMTnormal; } return XBTrue; } /* SpecialBombFirecracker */ /* * construction */ static XBBool SpecialBombConstruction (Explosion * ptr) { int x, y; if (ptr->count == 1) { x = ptr->x; y = ptr->y; DelExplosion (ptr); if (!CheckPlayerNear (x, y)) { SetMazeBlock (x, y, BTExtra); SetBlockExtra (x, y, BTFree); } return XBFalse; } return XBTrue; } /* SpecialBombConstruction */ /* * fungus */ static XBBool SpecialBombFungus (Explosion * ptr) { int i, x, y; x = ptr->x; y = ptr->y; if (ptr->count == (-curBombTime) * 3 / 5) { for (i = -1; i <= 1; i++) { SpreadExplosion (x + i, y, 1, BMTfungus, 0); SpreadExplosion (x, y + i, 1, BMTfungus, 0); } } return XBTrue; } /* SpecialBombFungus */ /* * threebombs */ static XBBool SpecialBombThreebombs (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 2, ptr->y, ptr->range, defaultBMT, 0); SpreadExplosion (ptr->x + 2, ptr->y, ptr->range, defaultBMT, 0); } return XBTrue; } /* SpecialBombThreebombs */ /* * grenade */ static XBBool SpecialBombGrenade (Explosion * ptr) { int i, j; if (ptr->range > 0) { if (ptr->count == -1) { if (ptr->range == 1) { SpreadExplosion (ptr->x - 1, ptr->y - 1, 0, BMTblastnow, 0); SpreadExplosion (ptr->x + 1, ptr->y - 1, 0, BMTblastnow, 0); SpreadExplosion (ptr->x - 1, ptr->y + 1, 0, BMTblastnow, 0); SpreadExplosion (ptr->x + 1, ptr->y + 1, 0, BMTblastnow, 0); } else { for (i = -((ptr->range) - 1); i <= ((ptr->range) - 1); i++) { for (j = -((ptr->range) - 1); j <= ((ptr->range) - 1); j++) { SpreadExplosion (ptr->x + i, ptr->y + j, 1, BMTblastnow, 0); } } } } } return XBTrue; } /* SpecialBombGrenade */ /* * trianglebombs */ static XBBool SpecialBombTrianglebombs (Explosion * ptr) { if (ptr->count == -curBombTime + 2) { int i, j; i = GameRandomNumber (2) * 4 - 2; j = GameRandomNumber (2) * 4 - 2; SpreadExplosion (ptr->x + i, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + j, ptr->range, BMTnormal, 0); ptr->type = BMTnormal; } return XBTrue; } /* SpecialBombTrianglebombs */ /* desctruction */ static XBBool SpecialBombDestruction (Explosion * ptr) { int i, x, y; x = ptr->x; y = ptr->y; if (ptr->count == 1) { DelExplosion (ptr); for (i = -1; i <= 1; i++) { if ((x + i < (MAZE_W - 1)) && CheckMaze (x + i, y) && (x + i > 0)) { SetMazeBlock (x + i, y, BTFree); } if ((y + i < (MAZE_H - 1)) && CheckMaze (x, y + i) && (y + i > 0)) { SetMazeBlock (x, y + i, BTFree); } } return XBFalse; } return XBTrue; } /* SpecialBombDestruction */ /* * renovation */ static XBBool SpecialBombRenovation (Explosion * ptr) { int x, y; x = ptr->x; y = ptr->y; if (ptr->count == 1) { MoveBlockFromTo (x - 1, y, x - 2, y); MoveBlockFromTo (x + 1, y, x + 2, y); MoveBlockFromTo (x, y - 1, x, y - 2); MoveBlockFromTo (x, y + 1, x, y + 2); } return XBTrue; } /* SpecialBombdRenovation */ /* * pyro */ static XBBool SpecialBombPyro (Explosion * ptr) { int x, y, k; if (ptr->count == 1) { for (k = 0; k < 5; k++) { x = ptr->x + GameRandomNumber (3) - 1; y = ptr->y + GameRandomNumber (3) - 1; if (!bombMaze[x][y] && CheckMazeFree (x, y)) { SpreadExplosion (x, y, 1, BMTpyro2, 0); break; } } } return XBTrue; } /* SpecialBombPyro */ /* * */ static XBBool NewExplosion (BMPlayer * player, int x, int y, int range, XBBool remote_controlled, XBBool malfunction, BMBombType type, int typeExtr, BMDirection initialdir) { Explosion *newExpl; /* check if there is already a bomb in this tile */ if (NULL != bombMaze[x][y]) { return XBFalse; } /* mark for redraw */ MarkMazeTile (x, y); /* alloc data */ newExpl = (Explosion *) calloc (1, sizeof (Explosion)); /* put in lookup map */ bombMaze[x][y] = newExpl; /* put in explosion list */ numExpl++; if (exploList == NULL) { exploList = newExpl; } else { explEnd->next = newExpl; } explEnd = newExpl; /* set values */ newExpl->next = NULL; newExpl->player = player; newExpl->x = x; newExpl->y = y; newExpl->dx = 0; newExpl->dy = 0; newExpl->malfunction = malfunction; newExpl->isMorphed = (NULL != player) ? player->morphed : XBFalse; /** Skywalker **/ if (NULL != player) { newExpl->isSniping = player->sniping; if (player->sniping) { newExpl->count = -GAME_TIME; } } else { newExpl->isSniping = 0; } /** **/ newExpl->dir = (initialdir == GoDefault) ? initialBombDir : initialdir; /* set type */ switch (type) { case BMTdefault: type = defaultBMT; break; case BMTspecial: type = specialBMT; break; case BMTevil: type = evilBMT; break; default: break; } newExpl->type = type; /* Random bomb ! */ if (newExpl->type == BMTrandom) { switch (GameRandomNumber (5)) { case 0: newExpl->type = BMTnapalm; break; case 1: newExpl->type = BMTfirecracker; break; case 2: newExpl->type = BMTgrenade; break; case 3: newExpl->type = BMTfungus; break; case 4: newExpl->type = BMTpyro; break; } } /* extry type info */ newExpl->typeExtr = typeExtr; /* these are "nasty bombs" */ if (type != BMTclose) { switch (newExpl->dir) { case GoDown: if (CheckMazeFree (newExpl->x, newExpl->y + 1)) { newExpl->dy = BOMB_VY; } break; case GoUp: if (CheckMazeFree (newExpl->x, newExpl->y - 1)) { newExpl->dy = -BOMB_VY; } break; case GoLeft: if (CheckMazeFree (newExpl->x - 1, newExpl->y)) { newExpl->dx = -BOMB_VX; } break; case GoRight: if (CheckMazeFree (newExpl->x + 1, newExpl->y)) { newExpl->dx = BOMB_VX; } break; default: break; } } /* set range according to type */ switch (type) { case BMTfirecracker: case BMTfungus: case BMTpyro: newExpl->range = 1; break; case BMTconstruction: newExpl->range = 0; break; case BMTgrenade: newExpl->range = range / 2; break; default: newExpl->range = range; } /* bomb counter */ newExpl->countslower = -curBombTime; if ((type == BMTblastnow) || (type == BMTfirecracker2) || (type == BMTpyro2)) { /* bombs which explode immediately */ newExpl->count = 0; newExpl->countslower = 0; } else if (remote_controlled) { /* remote controled bombs */ newExpl->count = -GAME_TIME; newExpl->anime = MAX_BOMB_ANIME - 2; newExpl->nextAnime = 1; } else if (type == BMTshort) { /* fast bombs */ newExpl->count = -curBombTime / 4; newExpl->anime = 3 * MAX_BOMB_ANIME / 4; newExpl->nextAnime = 1 + curBombTime / (MAX_BOMB_ANIME - 1) - curBombTime / 4; } else if (newExpl->isSniping != 0) { newExpl->count = -GAME_TIME; } else { /* standard bombs */ newExpl->count = -curBombTime; newExpl->anime = 0; newExpl->nextAnime = 1 + curBombTime / (MAX_BOMB_ANIME - 1) - curBombTime; } /* init blilinking */ newExpl->blink = BOMB_TIME >> 1; /* create bomb sprite */ if ((type == BMTblastnow) || (type == BMTfirecracker2) || (type == BMTpyro2)) { /* instant explosion => no sprite */ newExpl->sprite = NULL; } else if ((range == 1) || (type == BMTfirecracker) || (type == BMTfungus) || (type == BMTpyro)) { /* these bombs are shown as mini bombs */ newExpl->sprite = CreateBombSprite (BB_MINI, newExpl->x * BLOCK_WIDTH, newExpl->y * BLOCK_HEIGHT, newExpl->anime, SPM_MAPPED); } else { /* just the normalbomb sprite */ newExpl->sprite = CreateBombSprite (BB_NORMAL, newExpl->x * BLOCK_WIDTH, newExpl->y * BLOCK_HEIGHT, newExpl->anime, SPM_MAPPED); } return XBTrue; } /* NewExplosion */ /* * */ XBBool NewPlayerBomb (BMPlayer * ps, BMBombType type) { return NewExplosion (ps, (ps->x + BLOCK_WIDTH / 2) / BLOCK_WIDTH, (ps->y + BLOCK_HEIGHT + BLOCK_HEIGHT / 2) / BLOCK_HEIGHT, (ps->illness == IllMini) ? 1 : ps->range, (ps->remote_control > 0), (ps->illness == IllMalfunction), type, 0, GoDefault); } /* NewPlayerBomb */ /* * */ XBBool NewEvilBomb (int x, int y) { return NewExplosion (NULL, x, y, 3, XBFalse, XBFalse, evilBMT, 0, GoDefault); } /* NewEvilBomb */ /* * check if any moving stun (hit) any player */ void StunPlayers (BMPlayer * ps, int numPlayer) { Explosion *ptr; int player; unsigned clickFlags; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { /* only if bomb is moving */ if (ptr->dir != GoStop) { clickFlags = 0; for (player = 0; player < numPlayer; player++) { /* check if any is vulnerable player is in range */ if ((ps[player].invincible == 0) && (ps[player].morphed == 0) && -(ps[player].daleifing == 0) && /* (galatius) Sky */ (ABS (ptr->x * BLOCK_WIDTH + ptr->dx - ps[player].x) < BOMB_STUN_X) && (ABS (ptr->y * BLOCK_HEIGHT + ptr->dy - ps[player].y - BLOCK_HEIGHT) < BOMB_STUN_Y)) { /* we need to correct some graphics here */ if (ptr->dx == 0) { if (ptr->dy < 0) { MarkMazeTile (ptr->x, ptr->y - 1); } if (ptr->dy > 0) { MarkMazeTile (ptr->x, ptr->y + 1); } } if (ptr->dy == 0) { if (ptr->dx < 0) { MarkMazeTile (ptr->x - 1, ptr->y - 1); } if (ptr->dx > 0) { MarkMazeTile (ptr->x + 1, ptr->y - 1); } } /* mark that player has been hit */ clickFlags |= (1 << player); } } /* do player click after all players are checked */ if (clickFlags) { for (player = 0; player < numPlayer; player++) { /* has player been hit ... */ if (clickFlags & (1 << player)) { /* ... stun player */ if (0 == ps[player].stunned) { ps[player].stunned = STUN_TIME; SND_Play (SND_STUN, ps[player].x / (PIXW / MAX_SOUND_POSITION)); } } } /* do bomb-player click */ (*doPlayerClick) (ptr); } } } } /* StunPlayers */ /* * check if there is a bomb on a tile */ XBBool CheckBomb (int x, int y) { return (bombMaze[x][y] != NULL) && (bombMaze[x][y]->count < 0); } /* CheckBomb */ /* * how many bombs and explosions do we have */ int NumberOfExplosions (void) { return numExpl; } /* NumberOfExplosions */ /* * delete a bomb at a given position */ void DeleteBombAt (int x, int y) { if (NULL != bombMaze[x][y]) { DelExplosion (bombMaze[x][y]); } } /* DeleteBombAt */ /* * move a bomb */ void MoveBomb (int x, int y, int dir) { Explosion *ptr; if (NULL != (ptr = bombMaze[x][y])) { if (ptr->dir == GoStop) { ptr->dir = dir; switch (dir) { case GoUp: case GoDown: ptr->dx = 0; break; case GoLeft: case GoRight: ptr->dy = 0; break; } } } } /* MoveBomb */ /* * check where we can savely distribute extras */ int CheckDistribExpl (unsigned *distExtra, int freeBlocks) { Explosion *ptr; int x, y, ra; /* Go through explosions */ for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->count >= 0) { ra = MIN (ptr->range, ptr->count + 1); /* right */ for (x = ptr->x; x <= (ptr->x + ra) && x < MAZE_W; x++) { if (distExtra[ptr->y] & (1 << x)) { freeBlocks--; } distExtra[ptr->y] &= ~(1 << x); } /* left */ for (x = ptr->x; x >= (ptr->x - ra) && x >= 0; x--) { if (distExtra[ptr->y] & (1 << x)) { freeBlocks--; } distExtra[ptr->y] &= ~(1 << x); } /* down */ for (y = ptr->y; y <= (ptr->y + ra) && y < MAZE_H; y++) { if (distExtra[y] & (1 << ptr->x)) { freeBlocks--; } distExtra[y] &= ~(1 << ptr->x); } for (y = ptr->y; y >= (ptr->y - ra) && y >= 0; y--) { if (distExtra[y] & (1 << ptr->x)) { freeBlocks--; } distExtra[y] &= ~(1 << ptr->x); } } } return freeBlocks; } /* CheckDistribExpl */ /* * public function do_air (Garth Denley) * Shoots bombs away if within 2 square radius * Direction based on angle from bomb */ void DoAir (BMPlayer * ps) { Explosion *ptr; int x, y, ex, ey; assert (NULL != ps); for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if (ptr->dir == GoStop) { x = (ptr->x) * BLOCK_WIDTH; y = (ptr->y - 1) * BLOCK_HEIGHT; ex = x - ps->x; ey = y - ps->y; if (ABS (ex) < 2 * BLOCK_WIDTH && ABS (ey) < 2 * BLOCK_HEIGHT && (ex != 0 || ey != 0)) { if (ABS (ex) * BLOCK_HEIGHT >= ABS (ey) * BLOCK_WIDTH) { if (ex < 0) { ptr->dir = GoLeft; if (CheckMaze (ptr->x - 1, ptr->y)) { if (ey < 0) { ptr->dir = GoUp; } else if (ey > 0) { ptr->dir = GoDown; } } } else { ptr->dir = GoRight; if (CheckMaze (ptr->x + 1, ptr->y)) { if (ey < 0) { ptr->dir = GoUp; } else if (ey > 0) { ptr->dir = GoDown; } } } } else { if (ey < 0) { ptr->dir = GoUp; } else { ptr->dir = GoDown; } } } } } } /* DoAir */ /* public function DoSuck (Stephan Natschlaeger) */ /* Shoots bombs away if within 2 square radius */ /* Direction based on angle from bomb */ void DoSuck (BMPlayer * ps) { Explosion *ptr; int x, y, ex, ey; assert (NULL != ps); for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if ((ptr->dir == GoStop)) { x = (ptr->x) * BLOCK_WIDTH; y = (ptr->y - 1) * BLOCK_HEIGHT; ex = x - ps->x; ey = y - ps->y; if ((ABS (ex) < BLOCK_WIDTH * 2) && (ABS (ey) < BLOCK_HEIGHT * 2) && ((ex != 0) || (ey != 0))) { if (ABS (ex) * BLOCK_HEIGHT >= ABS (ey) * BLOCK_WIDTH) { if (ex < 0) { ptr->dir = GoRight; } else { ptr->dir = GoLeft; } } else { if (ey < 0) { ptr->dir = GoDown; } else { ptr->dir = GoUp; } } } } } } /* do suck */ /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ void DoJump (BMPlayer * ps) { Explosion *ptr; int x, y, ex, ey; for (ptr = exploList; ptr != NULL; ptr = ptr->next) { if ((ptr->dir == GoStop)) { x = (ptr->x) * BLOCK_WIDTH; y = (ptr->y - 1) * BLOCK_HEIGHT; ex = x - ps->x; ey = y - ps->y; if ((ABS (ex) < BLOCK_WIDTH * 2) && (ABS (ey) < BLOCK_HEIGHT * 2) && ((ex != 0) || (ey != 0))) { #ifdef SCORE ptr->score_flag |= 1 << (ps->id); #endif ptr->jump = (int)(7 * ps->jump_button); if (ABS (ex) * BLOCK_HEIGHT >= ABS (ey) * BLOCK_WIDTH) { if (ex < 0) { ptr->dir = GoLeft; } else { ptr->dir = GoRight; } } else { if (ey < 0) { ptr->dir = GoUp; } else { ptr->dir = GoDown; } } } } } } /* * */ void DoNastyWalls (int gameTime) { int x, y; int dir = GoStop; if (gameTime >= nextNasty) { if (gameTime >= nextNasty + NASTY_INC) { nextNasty += NASTY_INC * 2; } if (GameRandomNumber (gentleNasty) < gameTime) { if (ceilNasty) { x = GameRandomNumber (MAZE_W - 2) + 1; y = GameRandomNumber (MAZE_H - 2) + 1; dir = GoDown; y = 1; } else { dir = GoUp + GameRandomNumber (4); switch (dir) { case GoUp: x = GameRandomNumber (MAZE_W - 2) + 1; y = MAZE_H - 2; break; case GoLeft: x = MAZE_W - 2; y = GameRandomNumber (MAZE_H - 2) + 1; break; case GoDown: x = GameRandomNumber (MAZE_W - 2) + 1; y = 1; break; case GoRight: x = 1; y = GameRandomNumber (MAZE_H - 2) + 1; break; default: return; } } NewExplosion (NULL, x, y, rangeNasty, XBFalse, XBFalse, BMTclose, 0, dir); } } } /* DoNastyWalls */ /* EPFL SHIT */ static XBBool SpecialBombDiagThree (Explosion * ptr) { int i; if (ptr->count == -curBombTime) { ptr->type = BMTnormal; for (i = 0; i <= 2; i++) { SpreadExplosion (ptr->x + i, ptr->y + i, ptr->range, BMTnormal, 0); } } return XBTrue; } /* scissor *//* added by stn */ static XBBool SpecialBombScissor (Explosion * ptr) { if (ptr->count == -curBombTime) { //fprintf(stderr,"PLACE SCISSOR\n"); SpreadExplosion (ptr->x + 1, ptr->y + 1, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 1, ptr->y - 1, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 2, ptr->y + 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 2, ptr->y - 2, ptr->range, BMTnormal, 0); } return XBTrue; } /* scissor2 *//* added by stn */ static XBBool SpecialBombScissor2 (Explosion * ptr) { if (ptr->count == -curBombTime) { // fprintf(stderr,"PLACE SCISSOR 2\n"); SpreadExplosion (ptr->x - 1, ptr->y + 1, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 1, ptr->y - 1, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 2, ptr->y + 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 2, ptr->y - 2, ptr->range, BMTnormal, 0); ptr->type = BMTnormal; } return XBTrue; } /* parallel *//* added by stn */ static XBBool SpecialBombParallel (Explosion * ptr) { int i; if (ptr->count == -curBombTime) { for (i = -2; i <= 2; i++) { SpreadExplosion (ptr->x + 2 * i, ptr->y - i, ptr->range / (ABS (i) + 1), BMTnormal, 0); } } ptr->type = BMTnormal; return XBTrue; } /* distance *//* added by stn */ static XBBool SpecialBombDistance (Explosion * ptr) { if (ptr->count == -curBombTime) { int i, j; i = 14 - ptr->x; j = 12 - ptr->y; SpreadExplosion (i, j, ptr->range, BMTnormal, 0); } ptr->type = BMTnormal; return XBTrue; } /* lucky *//* added by stn */ static XBBool SpecialBombLucky (Explosion * ptr) { if (ptr->count == -curBombTime) { int i, j; i = ptr->x + GameRandomNumber (6) + 1; j = ptr->y + GameRandomNumber (5) + 1; SpreadExplosion (i, j, ptr->range, defaultBMT, 0); } ptr->type = BMTnormal; return XBTrue; } /* parasol *//* added by stn */ static XBBool SpecialBombParasol (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 2, ptr->y - 1, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 1, ptr->y - 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 3, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 1, ptr->y - 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 2, ptr->y - 1, ptr->range, BMTnormal, 0); } ptr->type = BMTnormal; return XBTrue; } /* comb *//* added by stn */ static XBBool SpecialBombComb (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 2, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 2, ptr->y - 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 1, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 2, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 1, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 2, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 2, ptr->y - 2, ptr->range, BMTnormal, 0); } ptr->type = BMTnormal; return XBTrue; } /* farpyro *//* added by stn */ static XBBool SpecialBombFarpyro (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 2, ptr->y - 2, ptr->range, BMTpyro, 0); SpreadExplosion (ptr->x + 2, ptr->y - 2, ptr->range, BMTpyro, 0); } ptr->type = BMTpyro; return XBTrue; } /* nuclear *//* added by stn */ static XBBool SpecialBombNuclear (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x + 1, ptr->y + 1, ptr->range + 15, BMTgrenade, 0); SpreadExplosion (ptr->x - 1, ptr->y + 1, ptr->range + 15, BMTgrenade, 0); SpreadExplosion (ptr->x + 1, ptr->y - 1, ptr->range + 15, BMTgrenade, 0); SpreadExplosion (ptr->x - 1, ptr->y - 1, ptr->range + 15, BMTgrenade, 0); } ptr->type = BMTgrenade; return XBTrue; } /* Added by x-bresse on 06.04.2000 *//* Ring Of Fire */ /* Added by x-bresse on 06.04.2000 */ static XBBool SpecialBombRingofire (Explosion * ptr) /* Added by x-bresse on 06.04.2000 */ { /* Added by x-bresse on 06.04.2000 */ int x, y, c, r; /* Added by x-bresse on 06.04.2000 */ x = ptr->x; /* Added by x-bresse on 06.04.2000 */ y = ptr->y; /* Added by x-bresse on 06.04.2000 */ c = ptr->count; /* Added by x-bresse on 06.04.2000 */ r = ptr->range; /* Added by x-bresse on 06.04.2000 */ /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 24 / 24 || c == (-curBombTime) * 12 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 1, y - 2, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 23 / 24 || c == (-curBombTime) * 11 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 0, y - 2, 0, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 22 / 24 || c == (-curBombTime) * 10 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x - 1, y - 2, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 21 / 24 || c == (-curBombTime) * 9 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x - 2, y - 1, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 20 / 24 || c == (-curBombTime) * 8 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x - 2, y + 0, 0, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 19 / 24 || c == (-curBombTime) * 7 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x - 2, y + 1, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 18 / 24 || c == (-curBombTime) * 6 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x - 1, y + 2, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 17 / 24 || c == (-curBombTime) * 5 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 0, y + 2, 0, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 16 / 24 || c == (-curBombTime) * 4 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 1, y + 2, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 15 / 24 || c == (-curBombTime) * 3 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 2, y + 1, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 14 / 24 || c == (-curBombTime) * 2 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 2, y + 0, 0, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 13 / 24 || c == (-curBombTime) * 1 / 24) /* Added by x-bresse on 06.04.2000 */ SpreadExplosion (x + 2, y - 1, r, BMTblastnow, 0); /* Added by x-bresse on 06.04.2000 */ /* Added by x-bresse on 06.04.2000 */ if (c == (-curBombTime) * 1 / 24) { /* Added by x-bresse on 06.04.2000 *//* SpreadExplosion (x, y, 0, BMTblastnow,0); */ /* Added by x-bresse on 06.04.2000 */ DelExplosion (ptr); return XBFalse; /* Added by x-bresse on 06.04.2000 */ } /* Added by x-bresse on 06.04.2000 */ return XBTrue; /* Added by x-bresse on 06.04.2000 */ } /* 321 */ /* 4 C --> x */ /* 5 P B | */ /* 6 A \/ y */ /* 789 */ /* Added by x-bresse on 10.04.2000 START HERE*/ /* Mine */ /* this bomb only explodes when a player is near 321 */ /* (5 is also bomb position) 654 */ /* 987 */ static XBBool SpecialBombMine (Explosion * ptr) { int x, y, c, r, player, gridx, gridy, goboom; x = ptr->x; y = ptr->y; c = ptr->count; r = ptr->range; goboom = 0; /* mine is inactive during first 2/3 of normal bomb time */ if (c >= (-curBombTime) * 1 / 3) { /* if a player is near : go BOOM ! *//* should be < num_player, but I can't get it ?? */ for (player = 0; player < MAX_PLAYER; player++) { gridx = (player_stat[player].x + (BLOCK_WIDTH >> 1)) / BLOCK_WIDTH; gridy = (player_stat[player].y + (BLOCK_HEIGHT >> 1)) / BLOCK_HEIGHT + 1; if (player_stat[player].lives && ((x + 1 == gridx && y - 1 == gridy) || (x == gridx && y - 1 == gridy) || (x - 1 == gridx && y - 1 == gridy) || (x + 1 == gridx && y == gridy) || (x == gridx && y == gridy) || (x - 1 == gridx && y == gridy) || (x + 1 == gridx && y + 1 == gridy) || (x == gridx && y + 1 == gridy) || (x - 1 == gridx && y + 1 == gridy))) { goboom++; } } } /* bomb doesn't explode (comme une mouillee en gros) */ if (c == -2 && goboom <= 0) { ptr->count = -3; } if (goboom > 0) { DelExplosion (ptr); SpreadExplosion (x, y, r, BMTblastnow, 0); if (r > 2) { SpreadExplosion (x - 1, y - 1, 0, BMTblastnow, 0); SpreadExplosion (x - 1, y + 1, 0, BMTblastnow, 0); SpreadExplosion (x + 1, y + 1, 0, BMTblastnow, 0); SpreadExplosion (x + 1, y - 1, 0, BMTblastnow, 0); } return XBFalse; } //ptr->type = BMTnormal; return XBTrue; } /* Written by Amilhastre *//* protectbombs */ /* Written by Amilhastre */ static XBBool /* Written by Amilhastre */ SpecialBombProtectbombs (Explosion * ptr) /* Written by Amilhastre */ { /* Written by Amilhastre */ int x, y; x = ptr->x; /* Written by Amilhastre */ y = ptr->y; /* Written by Amilhastre */ DelExplosion (ptr); /* Written by Amilhastre */ /* Written by Amilhastre */ if (x > 0 && CheckMazeFree (x - 1, y) // && CheckPlayerNear(x-1,y)==1 ) { /* Written by Amilhastre */ SetMazeBlock (x - 1, y, BTExtra); /* Written by Amilhastre */ SetBlockExtra (x - 1, y, BTFree); /* Written by Amilhastre */ } /* Written by Amilhastre */ if (x < MAZE_W - 1 //&& CheckPlayerNear(x+1,y) == 1 && CheckMazeFree (x + 1, y)) { /* Written by Amilhastre */ SetMazeBlock (x + 1, y, BTExtra); /* Written by Amilhastre */ SetBlockExtra (x + 1, y, BTFree); /* Written by Amilhastre */ } /* Written by Amilhastre */ if (y > 0 //&& CheckPlayerNear(x,y-1) == 1 && CheckMazeFree (x, y - 1)) { /* Written by Amilhastre */ SetMazeBlock (x, y - 1, BTExtra); /* Written by Amilhastre */ SetBlockExtra (x, y - 1, BTFree); /* Written by Amilhastre */ } /* Written by Amilhastre */ if (y < MAZE_H - 1 //&& CheckPlayerNear(x,y+1) == 1 && CheckMazeFree (x, y + 1)) { /* Written by Amilhastre */ SetMazeBlock (x, y + 1, BTExtra); /* Written by Amilhastre */ SetBlockExtra (x, y + 1, BTFree); /* Written by Amilhastre */ } /* Written by Amilhastre */ /* Written by Amilhastre */ ptr->type = BMTnormal; /* Written by Amilhastre */ return XBFalse; /* Written by Amilhastre */ } /* bomb_row */ static XBBool SpecialBombRow (Explosion * ptr) { if (ptr->player->d_ist == GoUp || ptr->player->d_ist == GoDown) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x, ptr->y - 3, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 5, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 7, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 9, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 11, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 13, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 3, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 5, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 7, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 9, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 11, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 13, ptr->range, BMTnormal, 0); } } if (ptr->player->d_ist == GoLeft || ptr->player->d_ist == GoRight) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 5, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 7, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 9, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 11, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 13, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 5, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 7, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 9, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 11, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 13, ptr->y, ptr->range, BMTnormal, 0); } } ptr->type = BMTnormal; return XBTrue; } /* bomb_column */ static XBBool SpecialBombColumn (Explosion * ptr) { if (ptr->player->d_ist == GoUp || ptr->player->d_ist == GoDown) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 5, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 7, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 9, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 11, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 13, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 5, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 7, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 9, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 11, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 13, ptr->y, ptr->range, BMTnormal, 0); } } if (ptr->player->d_ist == GoLeft || ptr->player->d_ist == GoRight) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x, ptr->y - 3, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 5, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 7, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 9, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 11, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y - 13, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 3, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 5, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 7, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 9, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 11, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x, ptr->y + 13, ptr->range, BMTnormal, 0); } } ptr->type = BMTnormal; return XBTrue; } /* bomb_psycho */ static XBBool SpecialBombPsycho (Explosion * ptr) { if (ptr->count == -curBombTime) { SpreadExplosion (ptr->x - 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x - 5, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 3, ptr->y, ptr->range, BMTnormal, 0); SpreadExplosion (ptr->x + 5, ptr->y, ptr->range, BMTnormal, 0); } ptr->type = BMTnormal; return XBTrue; } /* Added by x-bresse on 23.05.2000 ENDS HERE */ /* bomb_ChangeDirectionAtHalf */ static XBBool SpecialBombChangeDirectionAtHalf (Explosion * ptr) { if ((int)(GAME_TIME) % 2 == 0) { if (initialBombDir == GoStop) { initialBombDir = GoDown; } if (initialBombDir == GoUp) { initialBombDir = GoDown; } else { if (initialBombDir == GoLeft) { initialBombDir = GoRight; } else { if (initialBombDir == GoDown) { initialBombDir = GoUp; } else { initialBombDir = GoLeft; } } } /*fprintf(stderr," bombdir %i %i\n",initialBombDir,ptr->dir); */ } return XBTrue; } /* Added by Skywalker ENDS HERE */ /* * end of file bomb.c */ xblast-2.10.4/bomb.h0000644000175000017500000001376410372731122013311 0ustar rhondaalfie/* bomb.h - bombs and explosions * * $Id: bomb.h,v 1.10 2006/02/09 21:21:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_BOMB_H #define XBLAST_BOMB_H /* * typedef definitions */ /* fuse times */ #define BOMB_TIME 64 #define SHORT_FUSE 32 #define LONG_FUSE 128 #define BOMB_VX (2*BASE_X) #define BOMB_VY (2*BASE_Y) #define BOMB_STUN_X (4*BASE_X) #define BOMB_STUN_Y (4*BASE_Y) /* bomb sprites */ typedef enum { BB_NORMAL = 0, BB_MINI } BMBombSprite; /* bomb types */ typedef enum { BMTevil = -3, /* hidden bomb */ BMTspecial, /* bomb dropped with special key */ BMTdefault, /* bomb dropped with bomb key */ BMTnormal, /* standard bomb */ BMTnapalm, /* napalm bomb, area effect */ BMTblastnow, /* instant explosion */ BMTclose, /* bombs used for "nasty walls" */ BMTfirecracker, /* firecracker */ BMTfirecracker2, /* bombs created by firecracker explosion */ BMTconstruction, /* create a blastable block on explosion */ BMTthreebombs, /* three bombs in a row */ BMTgrenade, /* grenade, another area effect */ BMTtrianglebombs, /* three bombs forming a triangle */ BMTdestruction, /* this bombs destroys walls */ BMTfungus, /* this bomb mulitplies */ BMTrenovation, /* this bomb move blocks */ BMTpyro, /* pyro bomb */ BMTpyro2, /* bombs created by pyro explosion */ BMTrandom, /* random bomb dtermined after drop */ BMTshort, /* bomb with very short fuse */ BMTdiagthreebombs, /* added by stn */ BMTscissor, /* added by stn */ BMTscissor2, /* added by stn */ BMTparallel, /* added by stn */ BMTdistance, /* added by stn */ BMTlucky, /* added by stn */ BMTparasol, /* added by stn */ BMTcomb, /* added by stn */ BMTfarpyro, /* added by stn */ BMTnuclear, /* added by stn */ BMTprotectbombs, BMTringofire, BMTmine, BMTrow, BMTcolumn, BMTpsycho, BMTsearch, BMTchangedirectionathalf, /* Skywalker */ BMTsnipe, /* Skywalker */ NUM_BMT } BMBombType; extern char *bomb_name_choice[]; extern int ChoiceDefaultBomb; /* burn out flags */ typedef enum { BO_RIGHT = (1 << 0), BO_LEFT = (1 << 1), BO_UP = (1 << 2), BO_DOWN = (1 << 3), BO_TOTAL = (1 << 4) - 1 } BMBurnOut; /* bomb and explosion */ typedef struct explosion { BMPlayer *player; /* from which player */ int range; /* blast range */ int x, y; /* grid position */ int dx, dy; /* small deviations from x and y (in pixel) */ BMDirection dir; /* Direction */ XBBool malfunction; /* flag for malfunction illness */ int count; /* time counter */ int countslower; int countslower2; int blink; /* when is bomb due to blick */ BMBombType type; /* what type of bomb do we have */ int typeExtr; /* extra information for type */ BMBurnOut burnOut; /* has bomb already burned out */ Sprite *sprite; /* sprite showing bomb */ int anime; /* current animation phase */ int nextAnime; /* at which count is next animation due */ XBBool isMorphed; /* player has morphed into this bomb */ /** Skywalker **/ int isSniping; int stop; /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ int jump; /** **/ struct explosion *next; /* pointer to next bomb in list */ } Explosion; /* * prototypes */ /* pointer to function when bomb hits player, wall or other bomb */ typedef void (*XBBombClickFunc) (Explosion *); extern XBBool ParseLevelBombs (const DBSection * section, DBSection * warn); extern void ConfigLevelBombs (const DBSection * section); extern void DeleteAllExplosions (void); //extern void DoBombs (void); old extern void DoBombs (BMPlayer * ps, int numPlayer); /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ extern void DoJump (BMPlayer * ps); extern int IgnitePlayersBombs (BMPlayer * ps); extern int IgniteAllBombs (BMPlayer * ps); extern void IgniteBombs (void); extern void DoExplosions (void); extern XBBool NewPlayerBomb (BMPlayer * ps, BMBombType type); extern XBBool NewEvilBomb (int x, int y); extern void StunPlayers (BMPlayer * ps, int numPlayer); extern XBBool CheckBomb (int x, int y); extern int NumberOfExplosions (void); extern void DeleteBombAt (int x, int y); extern void MoveBomb (int x, int y, int dir); extern int CheckDistribExpl (unsigned *distExtra, int freeBlocks); extern void HauntKick (int prob); extern void DoAir (BMPlayer * ps); extern void DoFrog (BMPlayer * ps); extern void DoSuck (BMPlayer * ps); extern void DoNastyWalls (int gameTime); extern XBBombClickFunc doWallClick; extern XBBombClickFunc doBombClick; extern XBBombClickFunc doPlayerClick; extern void BombClickNone (Explosion * bomb); extern int initialBombDir; extern void BombClickInitial (Explosion * bomb); extern void BombClickThru (Explosion * bomb); extern void BombClickSnooker (Explosion * bomb); extern void BombClickContact (Explosion * bomb); extern void BombClickClockwise (Explosion * bomb); extern void BombClickAnticlockwise (Explosion * bomb); extern void BombClickRandomdir (Explosion * bomb); extern void BombClickRebound (Explosion * bomb); extern const char *GetBombName (BMBombType type); extern int StopPlayersBombs (BMPlayer * ps); extern void SetSlowMotionBurst (int flame); extern Explosion *exploList; extern int curBombTime; extern int defaultBMT; #endif /* * end of file bomb.h */ xblast-2.10.4/bot.c0000644000175000017500000011773510372731122013154 0ustar rhondaalfie/* * Programm XBLAST V1.2.14 or higher * (C) by Oliver Vogel (e-mail: vogel@ikp.uni-koeln.de) * May 9th 1996 * started August 1993 * * Bot by Didier PLANTET (e-mail: plantet@info.enserb.u-bordeaux.fr) * and Grégoire ROBERT (e-mail : robert@info.enserb.u-bordeaux.fr) * File: bot.c * Bot IA ... * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public Licences as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Publis License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #define _BOT_C #define BOMB_STEP 2 #define NUM_FUSES 3 #define PROB_POSER 10 #define PROB_SWAP 100 #define BONUS_EXPLOSE 40 #define BONUS_TUE 60 #define BONUS_SIMPLE 100 #define BONUS_EXTRA 200 #define MALUS_MORT -1000 #define SLOW_SPEED 16 #define NORMAL_SPEED 8 #define FAST_SPEED 4 typedef struct coord { short x, y; short temps; short malus; struct coord *suivant; } coord; static int fuse_times[NUM_FUSES] = { SHORT_FUSE, BOMB_TIME, LONG_FUSE }; /* Tableau des bombes */ /*static Explosion *laby_bomb[MAZE_W][MAZE_H];*/ /* Liste des bombes */ static Explosion bombes_tmp[100]; /* Tableau des cases dangereuses : temps avant explosion */ static int laby_perf[MAZE_W][MAZE_H]; /* Nb de points dans chaque direction */ static int vote[NB_DIR]; /* Vaut VRAI si je pose */ static int vote_poser; /* Vaut VRAI si je swappe */ static int vote_swap; /* Vaut VRAI si j'effectue une action spéciale (appui sur +) */ static int vote_action_speciale; /* Tableau des cases visitées (booléen) */ static int laby_visit[MAZE_W][MAZE_H]; /* Tableau des cases disparaissant */ static int laby_shrink[MAZE_W][MAZE_H]; static int perf_max[NB_DIR]; static coord *file; static int gameTime; static BMPlayer *statut_joueurs; /* Mon numéro à moi */ static int num_bot; static int nb_joueurs; static int nb_ennemis_vivants; static int temps_jeu; /* La duree de deplacement entre 2 cases */ static int duree_deplacement; /* Score accordé au bonus du niveau */ static int bonus_extra; int dirige_vers_bonus (int x, int y, int dir); /* Fouf lenteur -- *//* static int trace; */ void SetBotTime (int game_time) { gameTime = game_time; } coord * creer_coord (int x, int y, int temps, int malus) { coord *c = (coord *) malloc (sizeof (coord)); c->x = x; c->y = y; c->temps = temps; c->malus = malus; c->suivant = NULL; return c; } void enfiler (int x, int y, int temps, int malus) { coord *tmpc; coord *c = creer_coord (x, y, temps, malus); if (file == NULL) file = c; else { tmpc = file; while (tmpc->suivant != NULL) tmpc = tmpc->suivant; tmpc->suivant = c; } } coord * defiler (void) { coord *c = file; file = file->suivant; return c; } /* Renvoie le nb de murs m'entourant */ int test_murs (BMPlayer * ps) { int x = ps->x / BLOCK_WIDTH; int y = ps->y / BLOCK_HEIGHT + 1; int nb_murs = 0; if (CheckMaze (x, y - 1)) { vote[UP] = MALUS_MORT; nb_murs++; } if (CheckMaze (x - 1, y)) { vote[LEFT] = MALUS_MORT; nb_murs++; } if (CheckMaze (x, y + 1)) { vote[DOWN] = MALUS_MORT; nb_murs++; } if (CheckMaze (x + 1, y)) { vote[RIGHT] = MALUS_MORT; nb_murs++; } return nb_murs; } /*Explosion * foundBomb (int x, int y) { Explosion *p; for (p = expl_list; p != NULL; p = p->next) if (p->x == x && p->y == y) return p; return NULL; }*/ Explosion * bombe_trouvee_tmp (int x, int y) { int i; for (i = 0; i < 100; i++) if (bombes_tmp[i].range != -1 && bombes_tmp[i].x == x && bombes_tmp[i].y == y) return &bombes_tmp[i]; return NULL; } /*void developpe_bombe (int range, int mazex, int mazey, int type) { Explosion *p; int i,j; // right for (i = 1; (i <= range) && CheckMazeOpen(mazex+i-1,mazey) ; i ++) if (mazex+i < MAZE_W) if (laby_perf[mazex][mazey] + i < laby_perf[mazex+i][mazey]) { laby_perf[mazex+i][mazey] = laby_perf[mazex][mazey] + i; p = CheckBomb (mazex+i, mazey); if (p != NULL && p->dir == GoStop) developpe_bombe (p->range, mazex+i, mazey, BMTnormal); } // Left for (i = 1; (i <= range) && CheckMazeOpen(mazex-i+1,mazey) ; i ++) if (mazex-i >= 0) if (laby_perf[mazex][mazey] + i < laby_perf[mazex-i][mazey]) { laby_perf[mazex-i][mazey] = laby_perf[mazex][mazey] + i; p = CheckBomb (mazex-i, mazey); if (p != NULL && p->dir == GoStop) developpe_bombe (p->range, mazex-i, mazey, BMTnormal); } // Down for (i = 1; (i <= range) && CheckMazeOpen(mazex,mazey+i-1) ; i ++) if (mazey+i < MAZE_H) if (laby_perf[mazex][mazey] + i < laby_perf[mazex][mazey+i]) { laby_perf[mazex][mazey+i] = laby_perf[mazex][mazey] + i; p = CheckBomb (mazex, mazey+i); if (p != NULL && p->dir == GoStop) developpe_bombe (p->range, mazex, mazey+i, BMTnormal); } // Up for (i = 1; (i <= range) && CheckMazeOpen(mazex,mazey-i+1) ; i ++) if (mazey-i >= 0) if (laby_perf[mazex][mazey] + i < laby_perf[mazex][mazey-i]) { laby_perf[mazex][mazey-i] = laby_perf[mazex][mazey] + i; p = CheckBomb (mazex, mazey-i); if (p != NULL && p->dir == GoStop) developpe_bombe (p->range, mazex, mazey-i, BMTnormal); } if (type == BMTnapalm) for (i= -2; i<=2; i++) { if (mazex+i < MAZE_W && mazex+i >= 0) developpe_bombe (range/(ABS(i)+1), mazex+i, mazey, BMTnormal); if (mazey+i < MAZE_H && mazey+i >= 0) developpe_bombe (range/(ABS(i)+1), mazex, mazey+i, BMTnormal); } if (type == BMTgrenade) if (range == 1) { developpe_bombe(0, mazex-1, mazey-1, BMTblastnow); developpe_bombe(0, mazex+1, mazey-1, BMTblastnow); developpe_bombe(0, mazex-1, mazey+1, BMTblastnow); developpe_bombe(0, mazex+1, mazey+1, BMTblastnow); } else { for (i = -((range)-1); i<=((range)-1); i++) { for (j = -((range)-1); j<=((range)-1); j++) { developpe_bombe (1, mazex+i, mazey+j, BMTblastnow); } } } }*/ void developpe_bombe_tmp (int range, int mazex, int mazey, int type, int count) { // Explosion *p; int i, j; /* right */ for (i = 1; (i <= range) && CheckMazeOpen (mazex + i - 1, mazey); i++) if (mazex + i < MAZE_W) if (laby_perf[mazex][mazey] + i < laby_perf[mazex + i][mazey]) laby_perf[mazex + i][mazey] = laby_perf[mazex][mazey] + i * count; /* Left */ for (i = 1; (i <= range) && CheckMazeOpen (mazex - i + 1, mazey); i++) if (mazex - i >= 0) if (laby_perf[mazex][mazey] + i < laby_perf[mazex - i][mazey]) laby_perf[mazex - i][mazey] = laby_perf[mazex][mazey] + i * count; /* Down */ for (i = 1; (i <= range) && CheckMazeOpen (mazex, mazey + i - 1); i++) if (mazey + i < MAZE_H) if (laby_perf[mazex][mazey] + i < laby_perf[mazex][mazey + i]) laby_perf[mazex][mazey + i] = laby_perf[mazex][mazey] + i * count; /* Up */ for (i = 1; (i <= range) && CheckMazeOpen (mazex, mazey - i + 1); i++) if (mazey - i >= 0) if (laby_perf[mazex][mazey] + i < laby_perf[mazex][mazey - i]) laby_perf[mazex][mazey - i] = laby_perf[mazex][mazey] + i * count; if (type == BMTnapalm) for (i = -2; i <= 2; i++) { if (mazex + i < MAZE_W && mazex + i >= 0) developpe_bombe_tmp (range / (ABS (i) + 1), mazex + i, mazey, BMTnormal, count); if (mazey + i < MAZE_H && mazey + i >= 0) developpe_bombe_tmp (range / (ABS (i) + 1), mazex, mazey + i, BMTnormal, count); } if (type == BMTgrenade) { if (range == 1) { developpe_bombe_tmp (0, mazex - 1, mazey - 1, BMTblastnow, count); developpe_bombe_tmp (0, mazex + 1, mazey - 1, BMTblastnow, count); developpe_bombe_tmp (0, mazex - 1, mazey + 1, BMTblastnow, count); developpe_bombe_tmp (0, mazex + 1, mazey + 1, BMTblastnow, count); } else { for (i = -((range) - 1); i <= ((range) - 1); i++) { for (j = -((range) - 1); j <= ((range) - 1); j++) { developpe_bombe_tmp (1, mazex + i, mazey + j, BMTblastnow, count); } } } } } /* Traduit une direction en dx et dy */ void conversion_direction (int dir, int *dx, int *dy) { *dx = 0; *dy = 0; switch (dir) { case UP: *dy = -1; break; case DOWN: *dy = 1; break; case LEFT: *dx = -1; break; case RIGHT: *dx = 1; } } /* Les bonus extras sont-ils positifs ou négatifs ? */ void def_score_extra (BMPlayer * ps) { bonus_extra = BONUS_EXTRA; /* La tortue */ if (specialExtraFunc == SpecialExtraSlow) { if (!ps->iniextra_flags) { bonus_extra = -BONUS_SIMPLE / 2; } else { if (!ps->revextra_flags) bonus_extra = -BONUS_SIMPLE / 2; else bonus_extra = 0; /* Si je suis déjà lent, reprendre une tortue ne change rien */ } } /* Le "bonus" invisible qui fait tourner */ if (specialExtraFunc == SpecialExtraStunOthers) { bonus_extra = -2 * BONUS_SIMPLE; } /* La seringue */ if (specialExtraFunc == SpecialExtraJunkie && ps->junkie == 0) { /* Si j'y ai déjà touché, j'ai intérêt à en reprendre... */ bonus_extra = -5 * BONUS_SIMPLE; } /* La mort immédiate */ if (specialExtraFunc == SpecialExtraPoison) { bonus_extra = -10 * BONUS_SIMPLE; } } /* Un bonus sur la case ? */ int score_bonus (int x, int y) { int bonus; bonus = GetBlockExtra (x, y); if (bonus == BTBomb || bonus == BTRange) bonus = BONUS_SIMPLE + 200; else if (bonus == BTSpecial || bonus == BTExtra) { if (specialExtraFunc != SpecialExtraPoison) { bonus = bonus_extra; } else { bonus = -BONUS_SIMPLE; } } else /* if (bonus == BTSwapper) bonus = BONUS_EXTRA; else */ if (bonus == BTEvil) bonus = -BONUS_SIMPLE; else bonus = 0; return bonus; } /* Est-il intéressant de poser sur cette case ? */ int score_explose (int x, int y, int portee_bombe) { int explose = 0; int dir, dx, dy; int i; for (dir = 1; dir < NB_DIR; dir++) { conversion_direction (dir, &dx, &dy); i = 1; while (CheckMazeFree (x + i * dx, y + i * dy) && i <= portee_bombe) i++; /* Y a-t-il un mur à détruire ? Et sinon, un bonus ? */ if (GetBlockExtra (x + i * dx, y + i * dy) == BTExtra) explose += BONUS_EXPLOSE; else explose -= (score_bonus (x + i * dx, y + i * dy) / 4); } explose += 75; return explose; } /* Est-ce que poser ici va menacer un autre joueur ? */ int score_tue (int x, int y, int portee_bombe) { int tue = 0; int xmin = -1, xmax = -1, ymin = -1, ymax = -1; int j, jx, jy; int points; BMPlayer *ps; /* Quelles cases puis-je atteindre ? */ for (j = 1; j <= portee_bombe; j++) { if (xmin == -1 && (!CheckMazeFree (x - j, y) || j == portee_bombe)) xmin = x - j; if (xmax == -1 && (!CheckMazeFree (x + j, y) || j == portee_bombe)) xmax = x + j; if (ymin == -1 && (!CheckMazeFree (x, y - j) || j == portee_bombe)) ymin = y - j; if (ymax == -1 && (!CheckMazeFree (x, y + j) || j == portee_bombe)) ymax = y + j; } nb_ennemis_vivants = 0; for (j = 0; j < nb_joueurs; j++) { ps = statut_joueurs + j; /* Le joueur n'est pas le bot et vit encore */ if ((j != num_bot) && (ps->lives != 0)) { jx = ps->x / BLOCK_WIDTH; jy = ps->y / BLOCK_HEIGHT + 1; points = BONUS_TUE; /* Si le joueur est mon partenaire.... je vais éviter de le tuer ! */ if (ps->team == (statut_joueurs + num_bot)->team) points = -points; else nb_ennemis_vivants++; /* Je suis sur la même colonne */ if ((x == jx) && ((ymin <= jy) && (jy <= ymax))) tue += points; /* Je suis sur la même ligne (et pas sur la même colonne) */ if ((y == jy) && (x != jx) && ((xmin <= jx) && (jx <= xmax))) tue += points; /* Si le joueur a une mauvaise mort (poseuse, lenteur, mini, non-poseuse, malfunction, teleport, ou *seringue*), je dois l'éviter */ if ((x == jx) && (y == jy)) { if ((ps->illness == IllBomb) || (ps->illness == IllSlow) || (ps->illness == IllMini) || (ps->illness == IllEmpty) || (ps->illness == IllMalfunction) || (ps->illness == IllTeleport) || (ps->junkie)) tue -= BONUS_SIMPLE; } /* sinon, j'essaie toujours de m'en approcher (s'il n'est pas mon partenaire) */ else tue += points; } } return tue; } /* Est-ce que je risque de me faire shrinker sur cette case ? */ int score_shrink (int x, int y, int temps) { int score = 0; temps += temps_jeu; if (laby_shrink[x][y] - temps <= 16) score = MALUS_MORT; else if (laby_shrink[x][y] - temps <= 50) score = -BONUS_EXTRA; else if (laby_shrink[x][y] - temps <= 100) score = -BONUS_SIMPLE; return score; } /* Teste le danger et l'intérêt d'une case... puis poursuit le parcours par niveau */ void teste_case (coord * c, int dir_init, BMPlayer * ps) { int perf = laby_perf[c->x][c->y] - c->temps; int portee_bombe = (ps->illness == IllMini) ? 1 : ps->range; int score, malus; int invincible = ps->invincible - c->temps; int tourne = ps->stunned - c->temps; int dir, dx, dy; if (invincible > 0) perf += invincible; if (tourne < 0) tourne = 0; /* Une bombe explosera sur le passage */ if (perf <= 4) return; /* La case disparaîtra */ if (score_shrink (c->x, c->y, c->temps) == MALUS_MORT) return; score = score_bonus (c->x, c->y); if (score <= -500) return; /* Mise à jour du malus (score négatif le + faible du chemin) */ malus = MIN (c->malus, score); /* Calcul du score de la case */ score += score_explose (c->x, c->y, portee_bombe); score += score_tue (c->x, c->y, portee_bombe); score += score_shrink (c->x, c->y, c->temps); /* Mise à jour de la performance maximale de la direction dir_init */ perf += score; if (perf > 10 * LONG_FUSE) perf += malus; perf_max[dir_init] = MAX (perf_max[dir_init], perf); for (dir = 1; dir < NB_DIR; dir++) { conversion_direction (dir, &dx, &dy); /* Si je ne suis pas déjà passé par là, s'il n'y a ni mur, ni bombe, je place la case dans la file */ if (!laby_visit[c->x + dx][c->y + dy] && !CheckMaze (c->x + dx, c->y + dy) ) { if (!ps->kick) { if (!CheckBomb (c->x + dx, c->y + dy)) { enfiler (c->x + dx, c->y + dy, c->temps + duree_deplacement + tourne, malus); laby_visit[c->x + dx][c->y + dy] = 1; } } else { enfiler (c->x + dx, c->y + dy, c->temps + duree_deplacement + tourne, malus); laby_visit[c->x + dx][c->y + dy] = 1; } } } } /* Remplissage du tableau laby_shrink (en début de niveau) */ void init_laby_shrink () { ShrinkGeneric *shrink_ptr = GetShrinkPtr (); XBScrambleData *scramble = GetScrDraw (); int temps; int x, y; unsigned mask; for (x = 0; x < MAZE_W; x++) for (y = 0; y < MAZE_H; y++) laby_shrink[x][y] = 2 * GAME_TIME; /* La liste pointée par shrink_ptr se termine par une cellule (2 * GAME_TIME, 0, 0) */ while (shrink_ptr->time < 2 * GAME_TIME) { temps = shrink_ptr->time; x = shrink_ptr->x; y = shrink_ptr->y; if (laby_shrink[x][y] > temps) laby_shrink[x][y] = temps; shrink_ptr++; } /* Blocs surgissant sur le plateau */ temps = scramble->time - 4; for (y = 0; y < MAZE_H; y++) { if (0 != scramble->row[y]) { for (x = 0, mask = 1; x < MAZE_W; x++, mask <<= 1) { if (mask & scramble->row[y]) { if (laby_shrink[x][y] > temps) laby_shrink[x][y] = temps; } } } } /* for (y = 0; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) fprintf (stderr, "%d ", laby_shrink[x][y]); fprintf (stderr, "\n"); }*/ } /* Aucune case n'a été visitée (début d'un parcours par niveau) */ void init_laby_visit (int x, int y) { int mazex, mazey; for (mazex = 0; mazex < MAZE_W; mazex++) for (mazey = 0; mazey < MAZE_H; mazey++) laby_visit[mazex][mazey] = 0; /* memset (&laby_visit, 0, MAZE_W * MAZE_H * sizeof (int));*/ laby_visit[x][y] = 1; } static BMDirection turn_clockwise[MAX_DIR] = { GoStop, GoRight, GoUp, GoLeft, GoDown, GoDefault }; static BMDirection turn_anticlockwise[MAX_DIR] = { GoStop, GoLeft, GoDown, GoRight, GoUp, GoDefault }; static BMDirection turn_opposite[MAX_DIR] = { GoStop, GoDown, GoRight, GoUp, GoLeft, GoDefault }; void calc_laby_perf () { int player; int i, j, k; int dx, dy; int temps; Explosion *p; Explosion *p2; /* On traite d'abord les bombes en train d'exploser (count > 0) */ for (i = 0; i < 100; i++) { p = &bombes_tmp[i]; if (p->range == -1) continue; if (p->count < 0) continue; if (laby_perf[p->x][p->y] > -p->count) { laby_perf[p->x][p->y] = -p->count; developpe_bombe_tmp (p->range, p->x, p->y, p->type, -p->count); } else developpe_bombe_tmp (p->range, p->x, p->y, BMTnormal, -p->count); p->range = -1; } for (temps = 0; temps < LONG_FUSE; temps++) { /* On deplace case par case */ for (i = 0; i < 100; i++) { /* Pour chaque bombe */ p = &bombes_tmp[i]; if (p->range == -1) continue; if (temps == -p->count || laby_perf[p->x][p->y] <= temps) { /* On explose la */ if (laby_perf[p->x][p->y] > -p->count) { laby_perf[p->x][p->y] = -p->count; developpe_bombe_tmp (p->range, p->x, p->y, p->type, -p->count); } else developpe_bombe_tmp (p->range, p->x, p->y, BMTnormal, -p->count); p->range = -1; continue; } if (p->dir == GoStop) { continue; } conversion_direction (p->dir, &dx, &dy); /* Si on cogne une bombe */ if (p->dx * dx >= 0 && p->dy * dy >= 0 && bombe_trouvee_tmp (p->x + dx, p->y + dy)) { if (doBombClick == BombClickNone) { p->dir = GoStop; p->dx = 0; p->dy = 0; } else if (doBombClick == BombClickInitial) { p->dir = initialBombDir; conversion_direction (p->dir, (int *)&p->dx, (int *)&p->dy); } else if (doBombClick == BombClickThru) { } else if (doBombClick == BombClickSnooker) { p2 = bombe_trouvee_tmp (p->x + dx, p->y + dy); p2->dir = p->dir; /* On met a 0 l'offset de l'autre direction */ p2->dx = p2->dx * ABS (dx); p2->dy = p2->dy * ABS (dy); /* La bombe qui cogne arrete de bouger */ p->dir = GoStop; p->dx = 0; p->dy = 0; } else if (doBombClick == BombClickContact) { p->dir = GoStop; p->dx = 0; p->dy = 0; if (laby_perf[p->x][p->y] > -p->count) laby_perf[p->x][p->y] = -p->count; developpe_bombe_tmp (p->range, p->x, p->y, p->type, -p->count); bombes_tmp[i].range = -1; } else if (doBombClick == BombClickContact) { p->dir = turn_clockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doBombClick == BombClickAnticlockwise) { p->dir = turn_anticlockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doBombClick == BombClickRandomdir) { p->dir = (int)(((float)rand () / (RAND_MAX + 1.0)) * (4)) + 1; p->dx = 0; p->dy = 0; } else if (doBombClick == BombClickRebound) { p->dir = turn_opposite[p->dir]; } } /* Ou un mur */ else if (p->dx == 0 && p->dy == 0 && !CheckMazeFree (p->x + dx, p->y + dy)) { if (doWallClick == BombClickNone) { p->dir = GoStop; p->dx = 0; p->dy = 0; } else if (doWallClick == BombClickInitial) { p->dir = initialBombDir; conversion_direction (p->dir, (int *)&p->dx, (int *)&p->dy); } else if (doWallClick == BombClickThru) { } else if (doWallClick == BombClickContact) { p->dir = GoStop; p->dx = 0; p->dy = 0; if (laby_perf[p->x][p->y] > -p->count) laby_perf[p->x][p->y] = -p->count; developpe_bombe_tmp (p->range, p->x, p->y, p->type, -p->count); bombes_tmp[i].range = -1; } else if (doWallClick == BombClickContact) { p->dir = turn_clockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doWallClick == BombClickAnticlockwise) { p->dir = turn_anticlockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doWallClick == BombClickRandomdir) { p->dir = (BMDirection) (int)((float)rand () / (RAND_MAX + 1.0)) * MAX_DIR; p->dx = 0; p->dy = 0; } else if (doWallClick == BombClickRebound) { p->dir = turn_opposite[p->dir]; } } /* Un joueur */ else { for (player = 0; player < nb_joueurs; player++) { if ((statut_joueurs[player].invincible == 0) && (ABS (p->x * BLOCK_WIDTH + p->dx - statut_joueurs[player].x) < BOMB_STUN_X) && (ABS (p->y * BLOCK_HEIGHT + p->dy - statut_joueurs[player].y - BLOCK_HEIGHT) < BOMB_STUN_Y)) break; } if (player < nb_joueurs) { if (doPlayerClick == BombClickNone) { p->dir = GoStop; p->dx = 0; p->dy = 0; } else if (doPlayerClick == BombClickInitial) { p->dir = initialBombDir; conversion_direction (p->dir, (int *)&p->dx, (int *)&p->dy); } else if (doPlayerClick == BombClickThru) { } else if (doPlayerClick == BombClickContact) { p->dir = GoStop; p->dx = 0; p->dy = 0; if (laby_perf[p->x][p->y] > -p->count) laby_perf[p->x][p->y] = -p->count; developpe_bombe_tmp (p->range, p->x, p->y, p->type, -p->count); bombes_tmp[i].range = -1; } else if (doPlayerClick == BombClickContact) { p->dir = turn_clockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doPlayerClick == BombClickAnticlockwise) { p->dir = turn_anticlockwise[p->dir]; p->dx = 0; p->dy = 0; } else if (doPlayerClick == BombClickRandomdir) { p->dir = (int)(((float)rand () / (RAND_MAX + 1.0)) * (4)) + 1; p->dx = 0; p->dy = 0; } else if (doPlayerClick == BombClickRebound) { p->dir = turn_opposite[p->dir]; } } } conversion_direction (p->dir, &dx, &dy); p->dy += dy * BOMB_VY; p->dx += dx * BOMB_VX; if (p->dx * dx >= BLOCK_WIDTH / 2) { p->dx -= dx * BLOCK_WIDTH; p->x += dx; } if (p->dy * dy >= BLOCK_HEIGHT / 2) { p->dy -= dy * BLOCK_HEIGHT; p->y += dy; } if (p->x < 0) p->x = 0; if (p->y < 0) p->y = 0; /* On aime pas tres bien etre sur la trajectoire d'une bombe */ laby_perf[p->x][p->y] = MIN (laby_perf[p->x][p->y], 50 * LONG_FUSE - 500 + temps * 4); } for (i = 0; i < 100; i++) { /* Pour chaque bombe */ p = &bombes_tmp[i]; if (p->range == -1) continue; /* Les bombes en train d'exploser ne se repoduisent pas ... */ if (p->count <= 0) continue; if (p->type == BMTfungus) { /* On developpe les bombes fungus ... */ if (p->count == (fuse_times[curBombTime] * 3 / 5)) { for (j = -1; j <= 1; j++) { if ((p->x + j < MAZE_W) && (p->x + j > -1) && !CheckMazeSolid (p->x + j, p->y)) { /* On trouve un emplacement libre ... */ for (k = 0; k < 100; k++) if (bombes_tmp[k].range == -1) break; bombes_tmp[k].x = p->x + j; bombes_tmp[k].y = p->y; bombes_tmp[k].range = p->range; bombes_tmp[k].type = BMTfungus; bombes_tmp[k].dir = GoStop; bombes_tmp[k].count = fuse_times[curBombTime]; } if ((p->y + j < MAZE_H) && (p->y + j > -1) && !CheckMazeSolid (p->x, p->y + j)) { /* On trouve un emplacement libre ... */ for (k = 0; k < 100; k++) if (bombes_tmp[k].range == -1) break; bombes_tmp[k].x = p->x; bombes_tmp[k].y = p->y + j; bombes_tmp[k].range = p->range; bombes_tmp[k].type = BMTfungus; bombes_tmp[k].dir = GoStop; bombes_tmp[k].count = fuse_times[curBombTime]; } } } } } } } void init_laby_perf () { int i; int mazex, mazey; Explosion *p; for (mazex = 0; mazex < MAZE_W; mazex++) for (mazey = 0; mazey < MAZE_H; mazey++) laby_perf[mazex][mazey] = 50 * LONG_FUSE; for (i = 0; i < 100; i++) bombes_tmp[i].range = -1; for (p = exploList, i = 1; p != NULL; p = p->next, i++) bombes_tmp[i] = *p; calc_laby_perf (); } void init_laby_perf_pose (int x, int y, int range, int count, int type) { int i; int mazex, mazey; Explosion *p; for (mazex = 0; mazex < MAZE_W; mazex++) for (mazey = 0; mazey < MAZE_H; mazey++) laby_perf[mazex][mazey] = 50 * LONG_FUSE; for (i = 0; i < 100; i++) bombes_tmp[i].range = -1; for (p = exploList, i = 1; p != NULL; p = p->next, i++) bombes_tmp[i] = *p; bombes_tmp[i].x = x; bombes_tmp[i].y = y; bombes_tmp[i].range = range; bombes_tmp[i].count = -count; bombes_tmp[i].type = type; calc_laby_perf (); } void init_laby_perf_biscotte () { int i; int mazex, mazey; Explosion *p; for (mazex = 0; mazex < MAZE_W; mazex++) for (mazey = 0; mazey < MAZE_H; mazey++) laby_perf[mazex][mazey] = 50 * LONG_FUSE; for (i = 0; i < 100; i++) bombes_tmp[i].range = -1; for (p = exploList, i = 1; p != NULL; p = p->next, i++) { bombes_tmp[i] = *p; if (p->player) if (p->player->id == num_bot) bombes_tmp[i].count = 0; } calc_laby_perf (); } void parcours_par_niveau (BMPlayer * ps) { coord *c; int dir; int x = ps->x / BLOCK_WIDTH; int y = ps->y / BLOCK_HEIGHT + 1; int dx, dy; int malus; int portee_bombe = (ps->illness == IllMini) ? 1 : ps->range; /* for (dir = 0; dir < NB_DIR; dir++) perf_max[dir] = 0; */ perf_max[STOP] = score_shrink (x, y, ps->stunned); /* Ajout de la sécurité et de l'invincibilité du joueur si la case ne se fait pas shrinker immédiatement */ if (perf_max[STOP] > MALUS_MORT) perf_max[STOP] += laby_perf[x][y] + ps->invincible; /* Ajout des bonus explose et tue si la case est sûre */ if (perf_max[STOP] == 50 * LONG_FUSE) { perf_max[STOP] += score_explose (x, y, portee_bombe); perf_max[STOP] += score_tue (x, y, portee_bombe); } perf_max[STOP] += 60; for (dir = 1; dir < NB_DIR; dir++) { conversion_direction (dir, &dx, &dy); init_laby_visit (x, y); /* Eviter mur et shrink immédiat */ if (!CheckMaze (x + dx, y + dy) && score_shrink (x + dx, y + dy, ps->stunned) > MALUS_MORT && (dirige_vers_bonus (x, y, dir) != -1)) if (!CheckBomb (x + dx, y + dy)) { malus = MIN (0, score_bonus (x + dx, y + dy)); enfiler (x + dx, y + dy, duree_deplacement + ps->stunned, malus); while (file) { c = defiler (); teste_case (c, dir, ps); free (c); } } } } /* Renvoie VRAI s'il est possible et intéressant de poser une bombe */ int souhaite_poser_bombe (BMPlayer * ps) { int score; int mazex, mazey; int portee_bombe = (ps->illness == IllMini) ? 1 : ps->range; // int j; mazex = ps->x / BLOCK_WIDTH; mazey = ps->y / BLOCK_HEIGHT + 1; /* Est-il possible de poser ? */ /* Pas de bombe sur la case */ if (CheckBomb (mazex, mazey)) return XBFalse; /* Je n'ai ni la non poseuse, ni la téléporte, ni la mal-function */ if (ps->illness == IllEmpty || ps->illness == IllTeleport || ps->illness == IllMalfunction) return XBFalse; /* Il me reste des bombes... */ if (ps->bombs == 0) return XBFalse; /* Est-il intéressant de poser ? */ score = score_explose (mazex, mazey, portee_bombe) + score_tue (mazex, mazey, portee_bombe); // fprintf(stderr," socre expl %i \n",score); if (score < 0) return XBFalse; /* Aucune raison particulière de poser... au hasard près */ if (score == 0 && (int)(((float)rand () / (RAND_MAX + 1.0)) * (PROB_POSER)) != 0) return XBFalse; /* S'il reste au moins un autre joueur vivant, j'essaie de poser */ return (nb_ennemis_vivants > 0); } /* Renvoie VRAI si je me dirige vers un bonus */ int dirige_vers_bonus (int x, int y, int dir) { int dx, dy; conversion_direction (dir, &dx, &dy); if ((CheckBonuses2 (x + dx, y + dy)) && (specialExtraFunc == SpecialExtraPoison)) { //fprintf(stderr," field poisoned\n"); return -1; // POISON!!! } else { return CheckBonuses (x + dx, y + dy); } } /* Choix de la meilleure direction */ static void choix_direction (int *choix_dir, int *max_perf) { int dir = 0, dir1 = 0; static int old_dir = 0; *choix_dir = STOP; *max_perf = 0; for (dir = 0; dir < NB_DIR; dir++) { /* Ajout d'un petit bonus aléatoire si la case est sûre */ if (perf_max[dir] > 10 * LONG_FUSE) perf_max[dir] += (int)(((float)rand () / (RAND_MAX + 1.0)) * (10)); // // GameRandomNumber1 (10); /* Je choisis la destination ayant la meilleure performance */ // if(dir==old_dir && dir!=0) perf_max[dir]+=50; if (dir == old_dir && dir == 0) perf_max[dir] -= 100; if (perf_max[dir] > *max_perf) { *max_perf = perf_max[dir]; *choix_dir = dir; } else if ((perf_max[dir] == *max_perf) && ((int)((float)rand () / (RAND_MAX + 1.0)) * (5) == dir)) *choix_dir = dir; } for (dir = 0; dir < NB_DIR; dir++) { for (dir1 = 0; dir1 < NB_DIR; dir1++) { if (perf_max[dir] == perf_max[dir1] && dir != dir1) { if (dir < dir1) { if (dir == old_dir) perf_max[dir] += 75; else perf_max[dir]++; } } } } for (dir = 0; dir < NB_DIR; dir++) { // fprintf(stderr,"dir %i prfmax %i olddir %i\n",dir, perf_max[dir],old_dir); if (perf_max[dir] > *max_perf) { *max_perf = perf_max[dir]; *choix_dir = dir; } } for (dir = 0; dir < NB_DIR; dir++) { perf_max[dir] = 0; } old_dir = *choix_dir; } /* Renvoie VRAI si je décide d'utiliser la télécommande MAINTENANT */ int test_biscotte (BMPlayer * ps) { int declenche = XBFalse; int mes_bombes = 0; int securite_init; Explosion *bombe; int x, y; x = ps->x / BLOCK_WIDTH; y = ps->y / BLOCK_HEIGHT + 1; securite_init = laby_perf[x][y]; /* Parcours de toutes les bombes du plateau */ for (bombe = exploList; bombe != NULL; bombe = bombe->next) /* Si cette bombe m'appartient... */ if (bombe->player == ps) { mes_bombes++; /* ... je la fais exploser ! */ /* laby_perf[bombe->x][bombe->y] = 0; developpe_bombe (bombe->range, bombe->x, bombe->y, bombe->type); */ init_laby_perf_biscotte (); } if ((mes_bombes > 0) && ((laby_perf[x][y] == securite_init) || (ps->invincible > 5))) declenche = XBTrue; return declenche; } /* Renvoie VRAI si j'ai envie de swapper MAINTENANT.*/ int test_swap (BMPlayer * ps, int perf) { int vote_swap = XBFalse; int partenaire; int equipe_complete = XBFalse; int joueur; /* Swap aléatoire si j'ai au moins 2 swaps */ /* if (ps->swapposition > 1) vote_swap = (GameRandomNumber1 (PROB_SWAP) == 0); */ /* Si nous jouons par équipe */ if (statut_joueurs->team == (statut_joueurs + 1)->team) { partenaire = ((num_bot) / 2) * 2 + 1 - (num_bot % 2); /* Si mon partenaire est mort */ if ((statut_joueurs + partenaire)->lives == 0) { for (joueur = 0; joueur < nb_joueurs; joueur += 2) /* Si les deux joueurs d'une autre équipe sont encore vivants. */ if (((statut_joueurs + joueur)->team != ps->team) && ((statut_joueurs + joueur)->lives > 0) && ((statut_joueurs + joueur + 1)->lives > 0)) equipe_complete = XBTrue; /* S'il n'y a pas d'équipe complète... je swappe ! */ if (!equipe_complete) vote_swap = XBTrue; } } /* Je swappe si je suis coincé entre 4 murs (et que l'on ne joue pas par équipe) */ else if (ps->teleport == 0 && test_murs (ps) == 4) vote_swap = XBTrue; /* Je swappe si je vais mourir */ if (ps->dying || perf <= duree_deplacement) vote_swap = XBTrue; return vote_swap; } void actions (BMPlayer * ps) { int i; int dx = 0, dy = 0; static int olddx = 0, olddy = 0; int dir; int max_perf; int choix_dir, prec_choix_dir; int x, y; int duree_meche, portee_bombe, type_bombe; x = ps->x / BLOCK_WIDTH; y = ps->y / BLOCK_HEIGHT + 1; portee_bombe = (ps->illness == IllMini) ? 1 : ps->range; type_bombe = BMTdefault; def_score_extra (ps); /* Remplissage du tableau my_maze */ init_laby_perf (); /* Je cherche les cases les plus sûres, en partant dans toutes les directions */ parcours_par_niveau (ps); /* Choix de la meilleure direction */ choix_direction (&choix_dir, &max_perf); prec_choix_dir = choix_dir; /* Et si j'essayais de poser une tit' bombe ? */ vote_poser = XBFalse; if (souhaite_poser_bombe (ps)) { /* Calcul de la durée de mèche */ duree_meche = fuse_times[curBombTime]; /* Calcul des effets de l'explosion de cette bombe */ /* if (laby_perf[x][y] > duree_meche) laby_perf[x][y] = duree_meche; developpe_bombe (portee_bombe, x, y, type_bombe); */ // init_laby_perf_pose (x, y, portee_bombe, duree_meche, type_bombe); /* Je cherche les cases les plus sûres, en partant dans toutes les directions */ parcours_par_niveau (ps); /* Est-ce que poser me laisse la vie sauve ? */ for (dir = 0; dir < NB_DIR; dir++) { if (perf_max[dir] > 10 * LONG_FUSE || duree_meche < ps->invincible) { vote_poser = XBTrue; break; } // fprintf(stderr," perf_max %i ",perf_max[dir]); } // fprintf(stderr," dest %i \n",10 * LONG_FUSE); /* Si oui, je pose... et choisis la direction de départ */ if (vote_poser) { choix_direction (&choix_dir, &max_perf); /* Je ne pose pas si j'ai décidé d'aller vers un bonus (risque de mourir) */ /* Remarque : méthode provisoire à améliorer... */ if (dirige_vers_bonus (x, y, choix_dir)) { // fprintf(stderr, " go for bonus!\n"); vote_poser = XBFalse; // choix_dir = prec_choix_dir; } /*je ne pose pas si il ny a place pour ca (Skywalker) */ if (!(ps->remote_control > 0)) { i = 1; dx = 1; conversion_direction (choix_dir, &dx, &dy); if (!CheckBomb (x - olddx, y - olddy)) i = 0; /* pas verifier si ma position est libre */ if (dx - 1 != 0 && dy != 0) if ( //CheckBomb (x-olddx, y-olddy)&& CheckMazeFree2 (x + dx - 1, y + dy) && !CheckBomb (x + dx - 1, y + dy)) { i = 0; } if (dx != 0 && dy + 1 != 0) if ( //CheckBomb (x-olddx, y-olddy)&& CheckMazeFree2 (x + dx, y + dy + 1) && !CheckBomb (x + dx, y + dy + 1)) { i = 0; } if (dx != 0 && dy - 1 != 0) if ( //CheckBomb (x-olddx, y-olddy)&& CheckMazeFree2 (x + dx, y + dy - 1) && !CheckBomb (x + dx, y + dy - 1)) { i = 0; } if (dx + 1 != 0 && dy != 0) /* verifier si il y a place pour escape de la bomb posee */ if ( //CheckBomb (x-olddx, y-olddy)&& CheckMazeFree2 (x + dx + 1, y + dy) && !CheckBomb (x + dx + 1, y + dy)) { i = 0; } if (i) { vote_poser = XBFalse; } if (olddx == -dx && olddy == -dy) { vote_poser = XBFalse; } if (ps->invincible > 5 && ps->remote_control > 0) { vote_poser = XBTrue; } } // if( } } /* Si je vais mourir, j'essaie de toute façon de poser et de changer de case. */ if (max_perf <= 30) { vote[STOP] -= 300; vote_poser = XBTrue; } /* Est-ce que j'effectue une action spéciale ? */ vote_action_speciale = XBFalse; /* Si j'ai la télécommande (biscotte pour les intimes) */ if (ps->remote_control > 0 && (max_perf > 10 * LONG_FUSE || ps->invincible > 5)) if (test_biscotte (ps)) { vote_action_speciale = XBTrue; choix_dir = STOP; vote_poser = XBFalse; } /* Si je peux morpher, je morphe */ if (ps->num_morph > 0) { vote_action_speciale = XBTrue; } /* Si je peux me téléporter et que je risque de mourir */ if (ps->teleport > 0 && max_perf < 50) { vote_action_speciale = XBTrue; choix_dir = STOP; vote_poser = XBFalse; } /* Si j'ai des bombes spéciales */ if (ps->special_bombs > 0) { /* Si ce sont des bombes explosant immédiatement if (get_current_level ()->bomb.buttonBMT == BMTblastnow) algo simpliste à modifier if (vote_poser && ps->invincible > 5) { vote_action_speciale = XBTrue; vote_poser = XBFalse; } */ } /* Ai-je envie de swapper ? */ vote_swap = XBFalse; /* if (ps->swapper > 0 && test_swap (ps, max_perf)) vote_swap = XBTrue; */ vote[choix_dir] += 200; olddy = dy; olddx = dx; } /* Inversion des directions */ int inversion (int dir) { switch (dir) { case UP: return DOWN; case DOWN: return UP; case LEFT: return RIGHT; case RIGHT: return LEFT; default: return dir; } } /* Mouvement à faire si je suis coincé entre deux cases */ int decoince (int dir) { static int compteur = 0; int nouv_dir = GoDefault; /* Pour éviter de gigoter entre 2 bombes */ compteur++; if (compteur > 4) { compteur = 0; nouv_dir = dir; } return nouv_dir; } /* Retourne VRAI si je peux tuer des ennemis */ int repose_en_mourant (BMPlayer * ps) { int mazex, mazey; int portee_bombe; mazex = (int)(ps->x + 0.5 * BLOCK_WIDTH) / BLOCK_WIDTH; mazey = (int)(ps->y + 0.5 * BLOCK_HEIGHT) / BLOCK_HEIGHT + 1; portee_bombe = (ps->illness == IllMini) ? 1 : ps->range; if (score_tue (mazex, mazey, portee_bombe) >= 0 && nb_ennemis_vivants > 0) return XBTrue; else return XBFalse; } void gestionBot (BMPlayer * player_stat, PlayerAction * player_action, int numero_bot, int num_player) { int i, j; int max = MALUS_MORT; int choice = -1; int mazex, mazey; int inverse; BMPlayer *ps; PlayerAction *pa; /* Fouf lenteur -- *//* trace = 0; */ /* Fouf lenteur ++ *//* fprintf(stderr, "gestionBot\n"); */ /* Fouf lenteur ++ *//* fflush(stderr); */ ps = player_stat + numero_bot; pa = player_action + numero_bot; statut_joueurs = player_stat; num_bot = numero_bot; nb_joueurs = num_player; mazex = ps->x / BLOCK_WIDTH; mazey = ps->y / BLOCK_HEIGHT + 1; /* Suis-je rapide ? */ if (ps->illness == IllRun) duree_deplacement = FAST_SPEED; else /* Suis-je Lent ? */ if (ps->illness == IllSlow) duree_deplacement = SLOW_SPEED; else duree_deplacement = NORMAL_SPEED; temps_jeu = gameTime; /* Début d'un niveau */ if (temps_jeu == 1) init_laby_shrink (); /* Suis-je inversé ? */ if (ps->illness == IllReverse) inverse = XBTrue; else inverse = XBFalse; /* Si je me trouve entre deux cases */ /* Fouf lenteur -- *//* if ((ps->x % BLOCK_WIDTH) != 0 || (ps->y % BLOCK_HEIGHT) != 0) */ /* Fouf lenteur ++ */ if (((ps->x % BLOCK_WIDTH) != 0 || (ps->y % BLOCK_HEIGHT) != 0) || ((ps->d_ist == GoStop) && (temps_jeu % 3))) { switch (ps->d_ist) { case GoUp: /* kick si est possible */ if (CheckBomb (mazex, mazey) && !(ps->kick && CheckMazeFree2 (mazex, mazey - 1))) pa->dir = decoince (GoDown); break; case GoDown: if (CheckBomb (mazex, mazey + 1) && !(ps->kick && CheckMazeFree2 (mazex, mazey + 2))) pa->dir = decoince (GoUp); break; case GoLeft: if (CheckBomb (mazex, mazey) && !(ps->kick && CheckMazeFree2 (mazex - 1, mazey))) pa->dir = decoince (GoRight); break; case GoRight: if (CheckBomb (mazex + 1, mazey) && !(ps->kick && CheckMazeFree2 (mazex + 2, mazey))) pa->dir = decoince (GoLeft); break; default: break; } /* Si je meurs, je pose */ if (ps->dying) pa->bomb = repose_en_mourant (ps); if (inverse) pa->dir = inversion (pa->dir); return; } if (pa->dir == GoStop && !(temps_jeu & 1)) return; /* Initialisation */ for (i = 0; i < NB_DIR; i++) vote[i] = 0; test_murs (ps); /* Don't walk into walls ... */ /* Choix de la bonne direction et des actions à effectuer */ actions (ps); /* getBonuses (ps); putBombs (ps); break the walls ... */ /* randChoice (); */ for (j = 0; j < NB_DIR; j++) if (vote[j] > max) { /* Fouf lenteur -- *//* if (trace) printf ("Ok for %d %d\n", j, vote[j]); */ max = vote[j]; choice = j; } /* Fouf lenteur -- *//* else */ /* Fouf lenteur -- *//* if (trace) printf ("Not ok for %d %d\n", j, vote[j]); */ switch (choice) { case STOP: /* Fouf lenteur -- *//* pa->dir = GoStop; */ /* Fouf lenteur ++ */ if (ps->d_ist == GoStop) { /* Fouf lenteur ++ */ pa->dir = GoDefault; /* Fouf lenteur ++ *//* fprintf(stderr, "GoDefault (already stop)\n"); */ /* Fouf lenteur ++ */ } else { /* Fouf lenteur ++ */ pa->dir = GoStop; /* Fouf lenteur ++ *//* fprintf(stderr, "GoStop (stop NOW *********)\n"); */ /* Fouf lenteur ++ */ } break; case UP: pa->dir = GoUp; /* Fouf lenteur ++ *//* fprintf(stderr, "GoUp\n"); */ break; case LEFT: pa->dir = GoLeft; /* Fouf lenteur ++ *//* fprintf(stderr, "GoLeft\n"); */ break; case DOWN: pa->dir = GoDown; /* Fouf lenteur ++ *//* fprintf(stderr, "GoDown\n"); */ break; case RIGHT: pa->dir = GoRight; /* Fouf lenteur ++ *//* fprintf(stderr, "GoRight\n"); */ break; } /* Fouf lenteur ++ *//* fflush(stderr); */ /* Ai-je décidé de poser ? */ if (vote_poser) pa->bomb = XBTrue; /* Ai-je décidé de faire une action spéciale ? */ if (vote_action_speciale) pa->special = XBTrue; /* Ai-je envie de swapper ? if (vote_swap) pa->swap = XBTrue; */ if (inverse) pa->dir = inversion (pa->dir); } /* BMFuncData : special_init : bonus EXTRA au départ special_game : jeu spécial (bombes hantées, lancées par les murs, ...) special_extra : bonus EXTRA à trouver special_key : action du + */ xblast-2.10.4/bot.h0000644000175000017500000000272010372731123013145 0ustar rhondaalfie/* * Program XBLAST V2.1.8 or higher * (C) by Oliver Vogel (e-mail: vogel@ikp.uni-koeln.de) * September 24th 1996 * started August 1993 * * Bot by Plantet Didier (e-mal: plantet@info.enserb.u-bordeaux.fr) * File: bot.h * include file for bot.c * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public Licences as by published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Publis License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BOT_H #define _BOT_H #define NB_DIR 5 #define STOP 0 #define UP 1 #define LEFT 2 #define DOWN 3 #define RIGHT 4 #define PRIORITY_CANT_WALK 0 #define PRIORITY_SURVIVE 1 #define PRIORITY_KILL_PLAYER 2 #define PRIORITY_GET_BONUSES 3 #define PRIORITY_BREAK_WALL 4 #define PRIORITY_RANDOM 5 #define NB_PRIORITY 6 extern void gestionBot (BMPlayer * player_stat, PlayerAction * player_action, int numero_bot, int num_player); extern void SetBotTime (int game_time); #endif /* * end of file bot.h */ xblast-2.10.4/browse.c0000644000175000017500000001730610377675254013704 0ustar rhondaalfie/* * file browse.c - datatype used in game browsing * * $Id: browse.c,v 1.8 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ const unsigned char magicWord[6] = { 'X', 'B', 'L', 'A', 'S', 'T' }; const unsigned char protocolVersion = 1u; /* * check for query format */ static XBBrowseTeleType ParseQuery (XBBrowseTeleQuery * tele, const unsigned char *buf, size_t len) { return (0 == len) ? XBBT_Query : XBBT_None; } /* ParseQuery */ /* * check for reply format */ static XBBrowseTeleType ParseReply (XBBrowseTeleReply * tele, const unsigned char *buf, size_t len) { size_t i = 0; /* port number */ if (i + 1 >= len) { return XBBT_None; } tele->port = (unsigned short)buf[i] + ((unsigned short)buf[i + 1] << 8); i += 2; /* versions */ if (i + 2 >= len) { return XBBT_None; } tele->version[0] = buf[i++]; tele->version[1] = buf[i++]; tele->version[2] = buf[i++]; /* game */ if (i + sizeof (tele->game) - 1 >= len) { return XBBT_None; } memcpy (tele->game, buf + i, sizeof (tele->game)); i += sizeof (tele->game); memcpy (tele->host, buf + i, sizeof (tele->host)); i += sizeof (tele->host); /* num lives */ if (i >= len) { return XBBT_None; } tele->numLives = buf[i++]; /* num wins */ if (i >= len) { return XBBT_None; } tele->numWins = buf[i++]; /* frame rate */ if (i >= len) { return XBBT_None; } tele->frameRate = buf[i++]; return (i == len) ? XBBT_Reply : XBBT_None; } /* ParseReply */ /* * check for newgame format */ static XBBrowseTeleType ParseNewGame (XBBrowseTeleNewGame * tele, const unsigned char *buf, size_t len) { size_t i = 0; /* port number */ if (i + 1 >= len) { return XBBT_None; } tele->port = (unsigned short)buf[i] + ((unsigned short)buf[i + 1] << 8); i += 2; /* versions */ if (i + 2 >= len) { return XBBT_None; } tele->version[0] = buf[i++]; tele->version[1] = buf[i++]; tele->version[2] = buf[i++]; /* game */ if (i + sizeof (tele->game) - 1 >= len) { return XBBT_None; } memcpy (tele->game, buf + i, sizeof (tele->game)); i += sizeof (tele->game); /* num lives */ if (i + 4 >= len) { return XBBT_None; } tele->gameID = (int)buf[i] + ((int)buf[i + 1] << 8) + ((int)buf[i + 2] << 16) + ((int)buf[i + 3] << 24); i += 4; /* num wins */ if (i >= len) { return XBBT_None; } tele->numLives = buf[i++]; /* num wins */ if (i >= len) { return XBBT_None; } tele->numWins = buf[i++]; /* frame rate */ if (i >= len) { return XBBT_None; } tele->frameRate = buf[i++]; return (i == len) ? XBBT_NewGame : XBBT_None; } /* ParseNewGame */ /* * check for newgameok = close format */ static XBBrowseTeleType ParseNewGameOK (XBBrowseTeleNewGameOK * tele, const unsigned char *buf, size_t len) { size_t i = 0; /* port number */ if (i + 4 > len) { return XBBT_None; } tele->gameID = (int)buf[i] + ((int)buf[i + 1] << 8) + ((int)buf[i + 2] << 16) + ((int)buf[i + 3] << 24); i += 4; return (i == len) ? XBBT_NewGameOK : XBBT_None; } /* ParseNewGameOk */ /* * check browse layer and parse contained data */ XBBrowseTeleType BrowseTele_Parse (XBBrowseTele * tele, const unsigned char *buf, size_t len) { size_t i; assert (NULL != tele); assert (NULL != buf); /* parse magic word */ if (len < sizeof (magicWord)) { return XBBT_None; } if (0 != memcmp (buf, magicWord, sizeof (magicWord))) { return XBBT_None; } i = sizeof (magicWord); /* check protocol version */ if (i >= len) { return XBBT_None; } if (buf[i] != protocolVersion) { return XBBT_None; } i++; /* get telegram type */ if (i >= len) { return XBBT_None; } tele->type = buf[i++]; /* get serial */ if (i >= len) { return XBBT_None; } tele->any.serial = buf[i++]; /* now type specific data */ switch (tele->type) { case XBBT_Query: return ParseQuery (&tele->query, buf + i, len - i); case XBBT_Reply: return ParseReply (&tele->reply, buf + i, len - i); case XBBT_NewGame: return ParseNewGame (&tele->newGame, buf + i, len - i); break; case XBBT_NewGameOK: return ParseNewGameOK (&tele->newGameOK, buf + i, len - i); break; default: return XBBT_None; } } /* BrowseTele_Parse */ /* * write the browse header to buffer */ static size_t WriteAny (const XBBrowseTeleAny * tele, unsigned char *buf) { size_t i; /* magic word */ memcpy (buf, magicWord, sizeof (magicWord)); i = sizeof (magicWord); /* protocol version */ buf[i++] = protocolVersion; /* tele type */ buf[i++] = tele->type; /* serial */ buf[i++] = tele->serial; return i; } /* WriteAny */ /* * write query data to buffer */ static size_t WriteQuery (const XBBrowseTeleQuery * tele, unsigned char *buf) { return 0; } /* WriteQuery */ /* * write reply data to buffer */ static size_t WriteReply (const XBBrowseTeleReply * tele, unsigned char *buf) { size_t i = 0; buf[i++] = tele->port & 0xFF; buf[i++] = (tele->port >> 8) & 0xFF; buf[i++] = tele->version[0]; buf[i++] = tele->version[1]; buf[i++] = tele->version[2]; memcpy (buf + i, tele->game, sizeof (tele->game)); i += sizeof (tele->game); memcpy (buf + i, tele->host, sizeof (tele->host)); i += sizeof (tele->host); buf[i++] = tele->numLives; buf[i++] = tele->numWins; buf[i++] = tele->frameRate; return i; } /* WriteReply */ /* * write NewGame data to buffer */ static size_t WriteNewGame (const XBBrowseTeleNewGame * tele, unsigned char *buf) { size_t i = 0; buf[i++] = tele->port & 0xFF; buf[i++] = (tele->port >> 8) & 0xFF; buf[i++] = tele->version[0]; buf[i++] = tele->version[1]; buf[i++] = tele->version[2]; memcpy (buf + i, tele->game, sizeof (tele->game)); i += sizeof (tele->game); buf[i++] = tele->gameID & 0xFF; buf[i++] = (tele->gameID >> 8) & 0xFF; buf[i++] = (tele->gameID >> 16) & 0xFF; buf[i++] = (tele->gameID >> 24) & 0xFF; buf[i++] = tele->numLives; buf[i++] = tele->numWins; buf[i++] = tele->frameRate; return i; } /* WriteNewGame */ /* * write NewGameOk data to buffer */ static size_t WriteNewGameOK (const XBBrowseTeleNewGameOK * tele, unsigned char *buf) { size_t i = 0; buf[i++] = tele->gameID & 0xFF; buf[i++] = (tele->gameID >> 8) & 0xFF; buf[i++] = (tele->gameID >> 16) & 0xFF; buf[i++] = (tele->gameID >> 24) & 0xFF; return i; } /* WriteNewGameOk */ /* * write complete browse layer to buffer */ size_t BrowseTele_Write (const XBBrowseTeleAny * tele, unsigned char *buf) { size_t nBytes; assert (NULL != tele); assert (NULL != buf); /* write header */ nBytes = WriteAny (tele, buf); switch (tele->type) { case XBBT_Query: nBytes += WriteQuery ((const XBBrowseTeleQuery *) tele, buf + nBytes); break; case XBBT_Reply: nBytes += WriteReply ((const XBBrowseTeleReply *) tele, buf + nBytes); break; case XBBT_NewGame: nBytes += WriteNewGame ((const XBBrowseTeleNewGame *) tele, buf + nBytes); break; case XBBT_NewGameOK: nBytes += WriteNewGameOK ((const XBBrowseTeleNewGameOK *) tele, buf + nBytes); break; default: break; } /* that's all */ return nBytes; } /* BrowseTele_Write */ /* * end of file browse.c */ xblast-2.10.4/browse.h0000644000175000017500000000532710372731123013670 0ustar rhondaalfie/* * file browse.h - datatype used in game browsing * * $Id: browse.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_BROWSE_H #define XBLAST_BROWSE_H /* * type definitions */ typedef enum { XBBT_None, /* invalid data */ XBBT_Query, /* query for games */ XBBT_Reply, /* direct reply from game server */ XBBT_NewGame, /* XBCC inform central of new game */ XBBT_NewGameOK /* XBCC inform central of new game */ } XBBrowseTeleType; typedef struct { XBBrowseTeleType type; unsigned char serial; /* Serial of request */ } XBBrowseTeleAny; typedef struct { XBBrowseTeleAny any; } XBBrowseTeleQuery; typedef struct { XBBrowseTeleAny any; unsigned short port; /* port for game */ unsigned char version[3]; /* version numbers */ char game[48]; /* name of the game */ char host[32]; /* XBCC host address */ unsigned char numLives; /* number of lives */ unsigned char numWins; /* number of matches to win */ unsigned char frameRate; /* frames per second */ } XBBrowseTeleReply; typedef struct { XBBrowseTeleAny any; unsigned short port; /* port for game */ unsigned char version[3]; /* version numbers */ char game[48]; /* name of the game */ //char host[32]; /* XBCC host address */ int gameID; /* XBCC */ unsigned char numLives; /* number of lives */ unsigned char numWins; /* number of matches to win */ unsigned char frameRate; /* frames per second */ } XBBrowseTeleNewGame; typedef struct { XBBrowseTeleAny any; int gameID; /* XBCC ID for game */ } XBBrowseTeleNewGameOK; typedef union { XBBrowseTeleType type; XBBrowseTeleAny any; XBBrowseTeleQuery query; XBBrowseTeleReply reply; XBBrowseTeleNewGame newGame; XBBrowseTeleNewGameOK newGameOK; } XBBrowseTele; /* * global prototypes */ extern XBBrowseTeleType BrowseTele_Parse (XBBrowseTele *, const unsigned char *, size_t len); extern size_t BrowseTele_Write (const XBBrowseTeleAny *, unsigned char *); #endif /* * end of file browse.h */ xblast-2.10.4/central.c0000644000175000017500000003337110412220337014005 0ustar rhondaalfie/* * file central.c - communication interface for the server * * $Id: central.c,v 1.16 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "xblast.h" #define RATING_WEIGTH 1.0 #define RATING_STEP 0.1 #define GJFAC 0.005 #define GJFAC2 1.005 #define SIZE 32 /* * local variables */ static XBComm *listenComm = NULL; static XBComm *centralComm = NULL; /* central statistics */ static int cPlayers; static int cGames; static int cGamesPlayed; static int cTotalGames; static int cLogins; static int connected; static XBAtom adminAtom; CFGPlayerRating adminRating; /* * start to listen for clients */ XBBool Central_StartListen (CFGGameHost * cfg) { int i, j; char tmp[256]; /* prepare database */ Dbg_Central ("Preparing central\n"); LoadPlayerCentral (XBTrue); /* prepare remote game database */ LoadGameConfig (); /* count players in database, minus admin */ cPlayers = GetNumPlayerConfigs (CT_Central) - 1; Dbg_Central ("number of registered players : %d\n", cPlayers); /* init admin data and store back */ adminAtom = GUI_IntToAtom (0); RetrievePlayerRating (CT_Central, adminAtom, &adminRating); adminRating.timeRegister = time (NULL); StorePlayerRating (CT_Central, adminAtom, &adminRating); SavePlayerCentral (); /* init stats for current session */ cGames = 0; cGamesPlayed = 0; cTotalGames = adminRating.gamesPlayed; cLogins = 0; connected = 0; /* setup player atoms for users */ for (i = 0; i < NUM_LOCAL_PLAYER; i++) { Network_SetPlayer (0, i, ATOM_INVALID); } for (i = 1; i < MAX_PLAYER; i++) { j = sprintf (tmp, "tmpPlayer%i", i); tmp[j + 1] = 0; Network_SetPlayer (i, 0, GUI_StringToAtom (tmp)); }; /* listen on tcp-port for clients */ assert (listenComm == NULL); listenComm = CommCreateListen (cfg, XBTrue); /* central */ if (NULL == listenComm) { Dbg_Central ("failed to listen on tcp port %u\n", cfg->port); return XBFalse; } /* allow client to browse for games */ assert (NULL == centralComm); centralComm = C2B_CreateComm (cfg->port); if (NULL == centralComm) { Dbg_Central ("failed to listen on udp port %u\n", cfg->port); return XBFalse; } /* that's all */ printf ("Listening on port %u (tcp, udp) now...\n", cfg->port); return XBTrue; } /* Central_StartListen */ /* * delete port for listening */ void Central_StopListen (void) { Dbg_Central ("Closing down central...\n"); /* delete listen port */ assert (NULL != listenComm); CommDelete (listenComm); listenComm = NULL; /* dlete reply socket */ if (NULL != centralComm) { CommDelete (centralComm); centralComm = NULL; } /* Update administrator with sesssion stats */ adminRating.gamesPlayed = cTotalGames; adminRating.timeUpdate = time (NULL); StorePlayerRating (CT_Central, adminAtom, &adminRating); /* save and close rating DB */ SavePlayerCentral (); FinishPlayerCentral (); /* clean up remote games */ FinishGameConfig (); } /* Central_StopListen */ /* * get data */ /* * central get statistics */ void Central_GetStatistics (int *nPlayers, int *nGames, int *nGamesPlayed, int *nTotalGames, int *nLogins) { *nPlayers = cPlayers; *nGames = C2B_GetOpenGames (); *nGamesPlayed = cGamesPlayed; *nTotalGames = cTotalGames; *nLogins = cLogins; } /* Central_GetStatistics */ /* * return currently connected user */ int Central_Connected (void) { return connected; } /* Central_Connected */ /* * a user has connected */ void Central_Accept (unsigned id, unsigned cnt, const char *hostName, unsigned port) { CFGGameHost cfg; assert (hostName != NULL); assert (id > 0); assert (id < MAX_HOSTS); Dbg_Central ("client adr=%s:%u connected\n", hostName, port); /* clear host entry in database */ DeleteGameConfig (CT_Remote, atomArrayHost0[id]); /* store in database */ memset (&cfg, 0, sizeof (CFGGameHost)); cfg.name = hostName; cfg.port = port; StoreGameHost (CT_Remote, atomArrayHost0[id], &cfg); /* create message */ Network_QueueEvent (XBNW_Accepted, id); cLogins++; connected++; Dbg_Central ("User id=%u count=%u added, open connections %u\n", id, cnt, connected); } /* Central_ClientAccepted */ /* * receive data */ /* * reverse byte order of an int */ static int endian (int x) { char *i, *o; int y; i = (char *)&x; o = (char *)&y; o[0] = i[3]; o[1] = i[2]; o[2] = i[1]; o[3] = i[0]; return y; } /* endian */ /* * game results retrieved from client */ XBGameStatType Central_ReceiveGameStat (const char *line) { /* line = numplayers, pid1, score1, pid2, score2, ... */ int numPlayers, i, j, k, m, endia; int PID[MAX_PLAYER]; int Score[MAX_PLAYER]; int regPl[MAX_PLAYER]; float q, plus[MAX_PLAYER], i1, j1; XBAtom pAtom[MAX_PLAYER]; CFGPlayerRating rating[MAX_PLAYER]; XBBool gamestat; char buffer[SIZE]; time_t curtime; struct tm *loctime; XBGameStatType ret = XBGS_Error; Dbg_Central ("receiving game stat\n"); /* flag for byte order */ endia = 0; /* extract number of players from received data, check both byte orders */ memcpy (&numPlayers, line, 4); if ((numPlayers < 0) || (numPlayers > MAX_PLAYER)) { i = endian (numPlayers); if ((i >= 0) && (i <= MAX_PLAYER)) { Dbg_Central ("entering endian mode\n"); numPlayers = i; endia = 1; } else { Dbg_Central ("illegal player count, ignoring result !\n"); return ret; } } /* extract PIDs and scores */ for (i = 0; i < numPlayers; i++) { memcpy (PID + i, line + 4 + i * 8, 4); memcpy (Score + i, line + 8 + i * 8, 4); if (endia) { PID[i] = endian (PID[i]); Score[i] = endian (Score[i]); } } Dbg_Central ("number of received scores = %hu\n", numPlayers); /* determine rated players (rating>0) */ for (i = 0, k = 0; i < numPlayers; i++) { if (PID[i] > 0) { pAtom[i] = GUI_IntToAtom (PID[i]); if (RetrievePlayerRating (CT_Central, pAtom[i], rating + i)) { if ((rating + i)->rating > 0) { regPl[k] = i; k++; } } else { Dbg_Central ("player pid %hu unrated (rating = %f)\n", PID[i], (rating + i)->rating); } } else { Dbg_Central ("invalid player pid for score %hu\n", i); } } Dbg_Central ("rated players found = %hu\n", k); /* time stamp all rated players, count number m of level winners */ m = 0; gamestat = XBFalse; for (i = 0; i < k; i++) { j = regPl[i]; Dbg_Central ("Player %i, PID = %i, score = %i\n", j, PID[j], Score[j]); (rating + j)->timeUpdate = time (NULL); if (Score[j] < 0) { gamestat = XBTrue; } m += Score[j]; plus[j] = 0.0; } /* at least one player has negative score: match winners, summary update */ if (gamestat) { Dbg_Central ("received Game Result\n"); ret = XBGS_Complete; m = 0; /* empty pool */ cTotalGames++; cGamesPlayed++; sprintf (buffer, "game_%i", cTotalGames); AppendGameResult (CT_Central, atomResults, GUI_StringToAtom (buffer), k, regPl, PID, Score); for (i = 0; i < k; i++) { j = regPl[i]; (rating + j)->gamesPlayed++; if (Score[j] < 0) { (rating + j)->realWins++; Score[j] = 1; } else { Score[j] = 0; } m += Score[j]; } Dbg_Central ("number of winners %hu\n", m); adminRating.gamesPlayed = cTotalGames; adminRating.timeUpdate = time (NULL); StorePlayerRating (CT_Central, adminAtom, &adminRating); } else { ret = XBGS_Level; Dbg_Central ("received Level Result\n+ number of winners %hu\n", m); } /* old scheme for(i=0;irating; for(j=i+1;jrating; if(Score[i0]== Score[j0]) { q=0.5; } else if(Score[i0]>Score[j0]) { q=1.0; (rating+i0)->relativeWins++; } else { q=0.0; (rating+j0)->relativeWins++; } b=1/(1+exp(RATING_WEIGTH*(j1-i1))); plus[i0]+=RATING_STEP*(q-b); plus[j0]-=RATING_STEP*(q-b); } } */ /* update rating if a winner present and at least two rated players */ if ((m > 0) && (k > 1)) { q = 0; j1 = 0; /* each player first spends a fixed fraction of his rating to a pool */ for (i = 0; i < k; i++) { j = regPl[i]; i1 = (rating + j)->rating * GJFAC; plus[j] = -i1; j1 += i1; } /* the pool is blown up with another fixed factor */ j1 *= GJFAC2; Dbg_Central ("total value to distribute = %f points\n", j1); /* pool is evenly distributed among the winners */ for (i = 0; i < k; i++) { j = regPl[i]; plus[j] += (j1 * Score[j]) / m; } /* apply the rating changes */ for (i = 0; i < k; i++) { j = regPl[i]; plus[j] += (rating + j)->rating; Dbg_Central ("Rating change for player %i = %f -> %f\n", PID[j], (rating + j)->rating, plus[j]); (rating + j)->rating = plus[j]; (rating + j)->relativeWins += Score[j]; /* store changes to database if registered */ if (PID[j] > 0) { StorePlayerRating (CT_Central, pAtom[j], rating + j); } } curtime = time (NULL); loctime = localtime (&curtime); strftime (buffer, SIZE, "%H_%d_%m_%Y", loctime); /* store time of the change now */ AppendTimePlayerRating (CT_Central, atomTimeRatings, GUI_StringToAtom (buffer), k, regPl, PID, plus); } else { Dbg_Central ("nothing to distribute\n"); } Dbg_Central ("game stat applied\n"); /* update administrator and save */ SavePlayerCentral (); return ret; } /* Central_ReceiveGameStat */ /* * check passwords, for update request */ static XBBool PasswordCheck (const char *a, const char *b) { if ((NULL == a) && (NULL == b)) { return XBTrue; } if ((NULL != a) || (NULL == b)) { return XBFalse; } return (0 == strcmp (a, b)) ? XBTrue : XBFalse; } /* PasswordCheck */ /* * player config received from client -> registration */ int Central_ReceivePlayerConfig (unsigned id, const char *line) { XBAtom atom, atomID; CFGPlayerEx tmpPlayer, idPlayer; int pid; /* store player for config */ atom = Network_ReceivePlayerConfig (CT_Central, id, 0, line); if (atom == ATOM_INVALID) { return XBPV_Incomplete; } Dbg_Central ("receiving player data\n"); RetrievePlayerEx (CT_Central, atom, &tmpPlayer); pid = tmpPlayer.id.PID; /* register or update */ if (pid > 0) { Dbg_Central ("update request for PID = %i\n", pid); atomID = GUI_IntToAtom (pid); if (RetrievePlayerEx (CT_Central, atomID, &idPlayer)) { Dbg_Central ("PID is registered\n"); if (PasswordCheck (tmpPlayer.id.pass, idPlayer.id.pass)) { Dbg_Central ("Password verified\n"); /* copy rating stuff, do not delete, big mistake */ tmpPlayer.rating.rating = idPlayer.rating.rating; tmpPlayer.rating.gamesPlayed = idPlayer.rating.gamesPlayed; tmpPlayer.rating.realWins = idPlayer.rating.realWins; tmpPlayer.rating.relativeWins = idPlayer.rating.relativeWins; tmpPlayer.rating.timeUpdate = idPlayer.rating.timeUpdate; tmpPlayer.rating.timeRegister = idPlayer.rating.timeRegister; StorePlayerEx (CT_Central, atomID, &tmpPlayer); pid = tmpPlayer.id.PID; Dbg_Central ("User updated\n"); } else { Dbg_Central ("Bad password for update\n"); pid = XBPV_Password; } } else { Dbg_Central ("PID not registered, no update!\n"); pid = XBPV_Unknown; } } else { Dbg_Central ("registration request\n"); if (-1 == FindDoubleName (CT_Central, atom)) { Dbg_Central ("name %s is unique\n", GetPlayerName (CT_Central, atom)); pid = GameRandomNumber (INT_MAX); atomID = GUI_IntToAtom (pid); while (NULL != GetPlayerName (CT_Central, atomID)) { pid = GameRandomNumber (INT_MAX); atomID = GUI_IntToAtom (pid); } tmpPlayer.rating.rating = 1000; tmpPlayer.rating.timeUpdate = 0; tmpPlayer.rating.timeRegister = time (NULL); tmpPlayer.id.PID = (int)pid; StorePlayerEx (CT_Central, atomID, &tmpPlayer); cPlayers++; Dbg_Central ("new player added pid = %i (total = %i)\n", pid, cPlayers); } else { Dbg_Central ("name %s already in use!\n", GetPlayerName (CT_Central, atom)); pid = XBPV_Double; } } /* delete temp data */ DeletePlayerConfig (CT_Central, atom); SavePlayerCentral (); Dbg_Central ("player data handled\n"); return pid; } /* Central_ReceivePlayerConfig */ /* * a user has started disconnect announcement */ void Central_ReceiveDisconnect (unsigned id) { Dbg_Central ("User id=%u disconnected\n", id); } /* Central_ReceiveDisconnect */ /* * a connection has been completely removed */ void Central_ConnectionClosed (unsigned id, unsigned cnt) { connected--; Dbg_Central ("User id=%u cnt=%u removed, remaining connections %u\n", id, cnt, connected); assert (connected >= 0); } /* Central_ConnectionClosed */ /* * queue disconnect */ /* * disconnect from clients */ void Central_QueueDisconnect (unsigned clientID) { assert (clientID > 0); assert (clientID < MAX_HOSTS); /* disconnect from client */ if (C2X_Connected (clientID)) { Dbg_Central ("announcing disconnect to user %u\n", clientID); C2X_QueueDisconnect (clientID); } } /* Central_QueueDisconnect */ /* * disconnect from clients */ void Central_QueueDisconnectAll (void) { unsigned clientID; /* disconnect from client */ for (clientID = 1; clientID < MAX_HOSTS; clientID++) { Central_QueueDisconnect (clientID); } } /* Central_QueueDisconnectAll */ /* * end of file central.c */ xblast-2.10.4/central.h0000644000175000017500000000447210373126076014025 0ustar rhondaalfie/* * file central.h - communication interface for the server * * $Id: central.h,v 1.9 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CENTRAL_H #define XBLAST_CENTRAL_H /* possible game stat types */ typedef enum { XBGS_Error, /* invalid */ XBGS_Level, /* level result */ XBGS_Complete /* game result */ } XBGameStatType; /* special pid values */ typedef enum { XBPV_Password = -1, /* password failed in update */ XBPV_Unknown = -2, /* unknown pid in update */ XBPV_Double = -3, /* name already registered */ XBPV_Incomplete = -255 /* still receiving data */ } XBPidValue; /* * global prototypes */ /* start/stop */ extern XBBool Central_StartListen (CFGGameHost *); extern void Central_StopListen (void); /* accept connection */ extern void Central_Accept (unsigned id, unsigned cnt, const char *host, unsigned port); /* get data */ extern void Central_GetStatistics (int *nPlayers, int *nGames, int *nGamesPlayed, int *nTotalGames, int *nLogins); extern int Central_Connected (void); /* receive data */ extern XBGameStatType Central_ReceiveGameStat (const char *line); extern int Central_ReceivePlayerConfig (unsigned id, const char *line); extern void Central_ReceiveDisconnect (unsigned id); extern void Central_ReceiveFinish (unsigned id); /* receive a close */ extern void Central_ConnectionClosed (unsigned id, unsigned cnt); /* queue signals */ extern void Central_QueueDisconnect (unsigned id); extern void Central_QueueDisconnectAll (void); #endif /* * end of file server.h */ xblast-2.10.4/cfg_control.c0000644000175000017500000003067210412220337014655 0ustar rhondaalfie/* * cfg_control.c - keyboard and joystick configuration data * * $Id: cfg_control.c,v 1.15 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define NUM_GAME_KEYS (10+10) //chat #define NUM_XBLAST_KEYS 3 /* * local variables */ static DBRoot *dbControl = NULL; /* conversion control to event type */ const XBEventCode keyEventType[NUM_KEYB_CONTROLS] = { XBE_KEYB_1, XBE_KEYB_2, }; /* menu key init table */ static CFGKeyTable menuKeyTable[] = { {"Tab", XBE_MENU, XBMK_NEXT}, {"BackSpace", XBE_MENU, XBMK_PREV}, {"Up", XBE_MENU, XBMK_UP}, {"Down", XBE_MENU, XBMK_DOWN}, {"Left", XBE_MENU, XBMK_LEFT}, {"Right", XBE_MENU, XBMK_RIGHT}, {"space", XBE_MENU, XBMK_SELECT}, {"Return", XBE_MENU, XBMK_DEFAULT}, {"Escape", XBE_MENU, XBMK_ABORT}, /* end of data */ {NULL, XBE_NONE, XBMK_NONE}, }; /* game control keys */ static CFGKeyTable xblastKeyTable[] = { {"Escape", XBE_XBLAST, XBXK_EXIT}, {NULL, XBE_NONE, XBXK_NONE}, }; /* fixed chat control keys */ static CFGKeyTable chatKeyTable[] = { {"Escape", XBE_CHAT, XBCE_ESCAPE,}, {"BackSpace", XBE_CHAT, XBCE_BACK}, {"Return", XBE_CHAT, XBCE_ENTER}, {NULL, XBE_NONE, XBCE_NONE}, }; /* * set default config keyboard config (left side) */ static void SetDefaultLeftKeyboard (CFGControlKeyboard * cfg) { assert (NULL != cfg); cfg->keyUp = GUI_StringToAtom ("T"); cfg->keyLeft = GUI_StringToAtom ("F"); cfg->keyDown = GUI_StringToAtom ("B"); cfg->keyRight = GUI_StringToAtom ("H"); cfg->keyStop = GUI_StringToAtom ("G"); cfg->keyBomb = GUI_StringToAtom ("space"); cfg->keySpecial = GUI_StringToAtom ("Tab"); cfg->keyPause = GUI_StringToAtom ("P"); cfg->keyAbort = GUI_StringToAtom ("A"); cfg->keyAbortCancel = GUI_StringToAtom ("Z"); /* Skywalker */ cfg->keyLaola = GUI_StringToAtom ("1"); cfg->keyLooser = GUI_StringToAtom ("2"); cfg->keyBot = GUI_StringToAtom ("3"); cfg->keyChatStart = GUI_StringToAtom ("4"); cfg->keyChatSend = GUI_StringToAtom ("5"); cfg->keyChatCancel = GUI_StringToAtom ("6"); cfg->keyChatChangeReceiver = GUI_StringToAtom ("7"); /* */ } /* SetDefaultLeftKeyboard */ /* * set default config keyboard config (left side) */ static void SetDefaultRightKeyboard (CFGControlKeyboard * cfg) { assert (NULL != cfg); cfg->keyUp = GUI_StringToAtom ("KP_8"); cfg->keyLeft = GUI_StringToAtom ("KP_4"); cfg->keyDown = GUI_StringToAtom ("KP_2"); cfg->keyRight = GUI_StringToAtom ("KP_6"); cfg->keyStop = GUI_StringToAtom ("KP_5"); cfg->keyBomb = GUI_StringToAtom ("KP_0"); cfg->keySpecial = GUI_StringToAtom ("Return"); cfg->keyPause = GUI_StringToAtom ("KP_Subtract"); cfg->keyAbort = GUI_StringToAtom ("KP_Multiply"); cfg->keyAbortCancel = GUI_StringToAtom ("KP_Divide"); /* Skywalker */ cfg->keyLaola = GUI_StringToAtom ("F3"); cfg->keyLooser = GUI_StringToAtom ("F4"); cfg->keyBot = GUI_StringToAtom ("F5"); cfg->keyChatStart = GUI_StringToAtom ("F6"); cfg->keyChatSend = GUI_StringToAtom ("F7"); cfg->keyChatCancel = GUI_StringToAtom ("F8"); cfg->keyChatChangeReceiver = GUI_StringToAtom ("F9"); /* */ } /* SetDefaultLeftKeyboard */ /* * get atom for control type */ static XBAtom AtomType (XBEventCode type) { switch (type) { case XBE_KEYB_1: return atomRightKeyboard; case XBE_KEYB_2: return atomLeftKeyboard; default: return ATOM_INVALID; } } /* AtomType */ /* * store single key entry */ static void StoreEntry (DBSection * section, XBAtom atomEntry, XBAtom atomValue) { if (ATOM_INVALID != atomValue) { DB_CreateEntryString (section, atomEntry, GUI_AtomToString (atomValue)); } else { DB_DeleteEntry (section, atomEntry); } } /* StoreEntry */ /* * store control config */ void StoreControlKeyboard (XBEventCode type, const CFGControlKeyboard * cfg) { XBAtom atom; DBSection *section; /* determine section */ atom = AtomType (type); if (ATOM_INVALID == atom) { return; } /* create section */ section = DB_CreateSection (dbControl, atom); assert (section != NULL); /* store entries */ StoreEntry (section, atomKeyUp, cfg->keyUp); StoreEntry (section, atomKeyLeft, cfg->keyLeft); StoreEntry (section, atomKeyDown, cfg->keyDown); StoreEntry (section, atomKeyRight, cfg->keyRight); StoreEntry (section, atomKeyStop, cfg->keyStop); StoreEntry (section, atomKeyBomb, cfg->keyBomb); StoreEntry (section, atomKeySpecial, cfg->keySpecial); StoreEntry (section, atomKeyPause, cfg->keyPause); StoreEntry (section, atomKeyAbort, cfg->keyAbort); StoreEntry (section, atomKeyAbortCancel, cfg->keyAbortCancel); /* Skywalker */ StoreEntry (section, atomKeyLaola, cfg->keyLaola); StoreEntry (section, atomKeyLooser, cfg->keyLooser); StoreEntry (section, atomKeyBot, cfg->keyBot); StoreEntry (section, atomKeyChatSend, cfg->keyChatSend); StoreEntry (section, atomKeyChatStart, cfg->keyChatStart); StoreEntry (section, atomKeyChatCancel, cfg->keyChatCancel); StoreEntry (section, atomKeyChatChangeReceiver, cfg->keyChatChangeReceiver); /* */ } /* StoreControlKeyboard */ /* * get single key entry */ static void RetrieveEntry (const DBSection * section, XBAtom atomEntry, XBAtom * atomValue) { const char *s; assert (atomValue != NULL); if (DB_GetEntryString (section, atomEntry, &s)) { *atomValue = GUI_StringToAtom (s); } else { *atomValue = ATOM_INVALID; } } /* RetrieveEntry */ /* * get control config from database */ XBBool RetrieveControlKeyboard (XBEventCode type, CFGControlKeyboard * cfg) { XBAtom atom; const DBSection *section; /* determine section */ atom = AtomType (type); if (ATOM_INVALID == atom) { return XBFalse; } /* get section */ section = DB_GetSection (dbControl, atom); if (NULL == section) { return XBFalse; } /* get values */ RetrieveEntry (section, atomKeyUp, &cfg->keyUp); RetrieveEntry (section, atomKeyLeft, &cfg->keyLeft); RetrieveEntry (section, atomKeyDown, &cfg->keyDown); RetrieveEntry (section, atomKeyRight, &cfg->keyRight); RetrieveEntry (section, atomKeyStop, &cfg->keyStop); RetrieveEntry (section, atomKeyBomb, &cfg->keyBomb); RetrieveEntry (section, atomKeySpecial, &cfg->keySpecial); RetrieveEntry (section, atomKeyPause, &cfg->keyPause); RetrieveEntry (section, atomKeyAbort, &cfg->keyAbort); RetrieveEntry (section, atomKeyAbortCancel, &cfg->keyAbortCancel); /* Skywalker */ RetrieveEntry (section, atomKeyLaola, &cfg->keyLaola); RetrieveEntry (section, atomKeyLooser, &cfg->keyLooser); RetrieveEntry (section, atomKeyBot, &cfg->keyBot); RetrieveEntry (section, atomKeyChatSend, &cfg->keyChatSend); RetrieveEntry (section, atomKeyChatStart, &cfg->keyChatStart); RetrieveEntry (section, atomKeyChatCancel, &cfg->keyChatCancel); RetrieveEntry (section, atomKeyChatChangeReceiver, &cfg->keyChatChangeReceiver); /* */ return XBTrue; } /* RetrieveControlKeyboard */ /* * int and load controls config */ void LoadControlConfig (void) { CFGControlKeyboard cfgKeyboard; /* create empty database */ dbControl = DB_Create (DT_Config, atomControl); assert (dbControl != NULL); /* load from file */ Dbg_Config ("loading control configs\n"); if (DB_Load (dbControl)) { return; } Dbg_Config ("failed to load control configs, settting defaults\n"); /* set default values */ SetDefaultRightKeyboard (&cfgKeyboard); StoreControlKeyboard (XBE_KEYB_1, &cfgKeyboard); SetDefaultLeftKeyboard (&cfgKeyboard); StoreControlKeyboard (XBE_KEYB_2, &cfgKeyboard); /* store it */ DB_Store (dbControl); } /* LoadControlConfig */ /* * save control config */ void SaveControlConfig (void) { assert (dbControl != NULL); if (DB_Changed (dbControl)) { Dbg_Config ("storing control configs\n"); DB_Store (dbControl); } } /* SaveControlConfig */ /* * finish control config */ void FinishControlConfig (void) { DB_Delete (dbControl); dbControl = NULL; Dbg_Config ("control config cleared\n"); } /* FinishControlConfig */ /* * put entry into key table */ static int PutEntry (CFGKeyTable * table, XBEventCode type, int key, const DBSection * section, XBAtom atom) { const char *s; assert (table != NULL); if (DB_GetEntryString (section, atom, &s)) { table->keysym = s; table->eventCode = type; table->eventData = key; return 1; } return 0; } /* PutEntry */ /* * get key control table for gui */ const CFGKeyTable * GetGameKeyPressTable (void) { int i, num; XBEventCode type; const DBSection *section; static CFGKeyTable keyTable[2 * NUM_GAME_KEYS + NUM_XBLAST_KEYS + 1]; /* clear old table */ memset (keyTable, 0, sizeof (keyTable)); /* game control keys */ num = 0; for (i = 0; i < NUM_KEYB_CONTROLS; i++) { type = keyEventType[i]; section = DB_GetSection (dbControl, AtomType (type)); if (NULL != section) { num += PutEntry (keyTable + num, type, XBGK_GO_UP, section, atomKeyUp); num += PutEntry (keyTable + num, type, XBGK_GO_LEFT, section, atomKeyLeft); num += PutEntry (keyTable + num, type, XBGK_GO_DOWN, section, atomKeyDown); num += PutEntry (keyTable + num, type, XBGK_GO_RIGHT, section, atomKeyRight); num += PutEntry (keyTable + num, type, XBGK_STOP_ALL, section, atomKeyStop); num += PutEntry (keyTable + num, type, XBGK_BOMB, section, atomKeyBomb); num += PutEntry (keyTable + num, type, XBGK_SPECIAL, section, atomKeySpecial); num += PutEntry (keyTable + num, type, XBGK_PAUSE, section, atomKeyPause); num += PutEntry (keyTable + num, type, XBGK_ABORT, section, atomKeyAbort); num += PutEntry (keyTable + num, type, XBGK_ABORT_CANCEL, section, atomKeyAbortCancel); /* Skywalker */ num += PutEntry (keyTable + num, type, XBGK_LAOLA, section, atomKeyLaola); num += PutEntry (keyTable + num, type, XBGK_LOOSER, section, atomKeyLooser); num += PutEntry (keyTable + num, type, XBGK_BOT, section, atomKeyBot); /* */ } } /* game control keys */ memcpy (keyTable + num, xblastKeyTable, sizeof (xblastKeyTable)); /* that's all */ return keyTable; } /* GetGameKeyPressTable */ /* * get key control table for chat */ const CFGKeyTable * GetChatKeyTable (void) { int i, num; XBEventCode type; const DBSection *section; static CFGKeyTable keyTable[2 * NUM_GAME_KEYS + NUM_XBLAST_KEYS + 1]; /* clear old table */ memset (keyTable, 0, sizeof (keyTable)); /* game control keys */ num = 0; for (i = 0; i < NUM_KEYB_CONTROLS; i++) { type = keyEventType[i]; section = DB_GetSection (dbControl, AtomType (type)); if (NULL != section) { num += PutEntry (keyTable + num, type, XBCE_SEND, section, atomKeyChatSend); num += PutEntry (keyTable + num, type, XBCE_START, section, atomKeyChatStart); num += PutEntry (keyTable + num, type, XBCE_CANCEL, section, atomKeyChatCancel); num += PutEntry (keyTable + num, type, XBCE_CHANGE, section, atomKeyChatChangeReceiver); } } /* fixed chat keys */ memcpy (keyTable + num, chatKeyTable, sizeof (chatKeyTable)); /* that's all */ return keyTable; } /* GetGameKeyPressTable */ /* * get key control table for gui */ const CFGKeyTable * GetGameKeyReleaseTable (void) { int i, num; XBEventCode type; const DBSection *section; static CFGKeyTable keyTable[2 * NUM_GAME_KEYS + 1]; /* clear old table */ memset (keyTable, 0, sizeof (keyTable)); /* build new one */ num = 0; for (i = 0; i < NUM_KEYB_CONTROLS; i++) { type = keyEventType[i]; section = DB_GetSection (dbControl, AtomType (type)); if (NULL != section) { num += PutEntry (keyTable + num, type, XBGK_STOP_UP, section, atomKeyUp); num += PutEntry (keyTable + num, type, XBGK_STOP_LEFT, section, atomKeyLeft); num += PutEntry (keyTable + num, type, XBGK_STOP_DOWN, section, atomKeyDown); num += PutEntry (keyTable + num, type, XBGK_STOP_RIGHT, section, atomKeyRight); } } /* that's all */ return keyTable; } /* GetGameKeyReleaseTable */ /* * get menu key table for gui */ const CFGKeyTable * GetMenuKeyTable (void) { return menuKeyTable; } /* GetMenuKeyTable */ /* * end cfg_control.c */ xblast-2.10.4/cfg_control.h0000644000175000017500000000425410372731123014664 0ustar rhondaalfie/* * cfg_control.h - keyboard and joystick configuration data * * $Id: cfg_control.h,v 1.9 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CFG_CONTROL_H #define _CFG_CONTROL_H /* * type definitions */ #define NUM_KEYB_CONTROLS 2 /* constant assignment of control to event type */ const XBEventCode keyEventType[NUM_KEYB_CONTROLS]; /* ingame controls for editing*/ typedef struct { XBAtom keyUp; XBAtom keyDown; XBAtom keyLeft; XBAtom keyRight; XBAtom keyStop; XBAtom keyBomb; XBAtom keySpecial; XBAtom keyPause; XBAtom keyAbort; XBAtom keyAbortCancel; /* Skywalker */ XBAtom keyLaola; XBAtom keyLooser; XBAtom keyBot; XBAtom keyChatStart; XBAtom keyChatSend; XBAtom keyChatCancel; XBAtom keyChatChangeReceiver; /* */ } CFGControlKeyboard; /* key tables for GUI */ typedef struct { const char *keysym; XBEventCode eventCode; int eventData; } CFGKeyTable; /* * global prototypes */ extern void LoadControlConfig (void); extern void SaveControlConfig (void); extern void FinishControlConfig (void); extern void StoreControlKeyboard (XBEventCode type, const CFGControlKeyboard * ctrl); extern XBBool RetrieveControlKeyboard (XBEventCode type, CFGControlKeyboard * ctrl); extern const CFGKeyTable *GetGameKeyPressTable (void); extern const CFGKeyTable *GetChatKeyTable (void); extern const CFGKeyTable *GetGameKeyReleaseTable (void); extern const CFGKeyTable *GetMenuKeyTable (void); #endif /* * end cfg_control.h */ xblast-2.10.4/cfg_demo.c0000644000175000017500000002052210377675254014140 0ustar rhondaalfie/* * file cfg_demo.c - configuration data for recorded demos * * $Id: cfg_demo.c,v 1.11 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * global variables */ /* current demo */ DBRoot *dbDemo = NULL; /* * local variables */ /* list of all demos */ static DBRoot *dbList = NULL; /* action keys for current demo */ static DBSection *frameSection = NULL; /********************** * managing all demos * **********************/ /* * initialize current demo and list */ void LoadDemoConfig (void) { /* create demo database for current demo */ dbDemo = DB_Create (DT_Demo, atomDemo); assert (NULL != dbDemo); /* load list of recorded demos */ dbList = DB_Create (DT_Config, atomDemo); assert (NULL != dbDemo); Dbg_Config ("loading list of demos\n"); if (DB_LoadDir (dbList, "demo", "dem", DT_Demo, atomTime, atomInfo, NULL, XBFalse)) { SaveDemoConfig (); } else { Dbg_Config ("no changes found\n"); } } /* LoadDemoConfig */ /* * store current list of demos in config */ void SaveDemoConfig (void) { /* list of demos database */ assert (dbList != NULL); if (DB_Changed (dbList)) { Dbg_Config ("saving list of demos\n"); DB_Store (dbList); } } /* SaveDemoConfig */ /* * clear current demo and list */ void FinishDemoConfig (void) { /* remove single demo database */ assert (dbDemo != NULL); DB_Delete (dbDemo); dbDemo = NULL; /* save and remove list of demos database */ SaveDemoConfig (); DB_Delete (dbList); dbList = NULL; Dbg_Config ("demo config cleared\n"); } /* FinishDemoConfig */ /* * compare to demo entries by time */ static int CompareDemoEntries (const void *a, const void *b) { assert (NULL != a); assert (NULL != b); return ((const CFGDemoEntry *) b)->time - ((const CFGDemoEntry *) a)->time; } /* CompareDemoEntries */ /* * create list with all demos available */ CFGDemoEntry * CreateDemoList (size_t * num) { CFGDemoEntry *list; size_t i, j; XBAtom atom; const DBSection *section; /* sanity check */ assert (NULL != dbList); assert (NULL != num); /* alloc data */ *num = DB_NumSections (dbList); if (0 == *num) { return NULL; } list = calloc (*num, sizeof (CFGDemoEntry)); /* build list */ for (i = 0, j = 0; i < *num; i++) { atom = DB_IndexSection (dbList, i); section = DB_GetSection (dbList, atom); assert (NULL != section); list[j].atom = atom; (void)DB_GetEntryAtom (section, atomLevel, &list[j].level); if (NULL == GetLevelNameByAtom (list[j].level)) { continue; } (void)DB_GetEntryInt (section, atomNumPlayers, &list[j].numPlayers); (void)DB_GetEntryTime (section, atomRecorded, &list[j].time); j++; } *num = j; /* sort it */ qsort (list, *num, sizeof (CFGDemoEntry), CompareDemoEntries); return list; } /* CreateDemoList */ /***************************** * current demo from/to file * *****************************/ /* * load current demo from file */ XBBool LoadDemoFromFile (XBAtom atom) { /* clear current demo */ assert (NULL != dbDemo); DB_Delete (dbDemo); /* create new demo */ dbDemo = DB_Create (DT_Demo, atom); assert (NULL != dbDemo); /* load and return success */ return DB_Load (dbDemo); } /* LoadDemoFromFile */ /* * store current demo in file */ void SaveCurrentDemo (const char *filename) { /* set file name for output */ DB_SetAtom (dbDemo, GUI_StringToAtom (filename)); /* single demo */ assert (NULL != dbDemo); DB_Store (dbDemo); /* TODO: add file to demoList !!! */ } /* SaveCurrentDemo */ /*********************** * current demo config * ***********************/ /* * store config data for a demo in current database */ void StoreDemoConfig (const CFGDemoInfo * cfgDemo) { DBSection *section; /* sanity checks */ assert (NULL != cfgDemo); assert (NULL != dbDemo); /* create empty section */ DB_DeleteSection (dbDemo, atomInfo); section = DB_CreateSection (dbDemo, atomInfo); assert (NULL != section); /* store data */ (void)DB_CreateEntryInt (section, atomNumPlayers, cfgDemo->numPlayers); (void)DB_CreateEntryInt (section, atomNumFrames, cfgDemo->numFrames); (void)DB_CreateEntryAtom (section, atomLevel, cfgDemo->level); (void)DB_CreateEntryInt (section, atomRandomSeed, cfgDemo->randomSeed); (void)DB_CreateEntryTime (section, atomRecorded, cfgDemo->time); (void)DB_CreateEntryInt (section, atomLives, cfgDemo->numLives); (void)DB_CreateEntryInt (section, atomFrameRate, cfgDemo->frameRate); (void)DB_CreateEntryBool (section, atomRandomPlayers, cfgDemo->randomPlayers); (void)DB_CreateEntryInt (section, atomWinner, cfgDemo->winner); } /* StoreDemoConfig */ /* * get config data for current demo from database */ XBBool RetrieveDemoConfig (CFGDemoInfo * cfgDemo) { const DBSection *section; /* sanity checks */ assert (NULL != cfgDemo); assert (NULL != dbDemo); /* find section */ if (NULL == (section = DB_GetSection (dbDemo, atomInfo))) { return XBFalse; } /* get data */ if (!DB_GetEntryInt (section, atomNumPlayers, &cfgDemo->numPlayers) || !DB_GetEntryInt (section, atomNumFrames, &cfgDemo->numFrames) || !DB_GetEntryAtom (section, atomLevel, &cfgDemo->level) || !DB_GetEntryInt (section, atomRandomSeed, &cfgDemo->randomSeed) || !DB_GetEntryTime (section, atomRecorded, &cfgDemo->time) || !DB_GetEntryInt (section, atomLives, &cfgDemo->numLives) || !DB_GetEntryInt (section, atomFrameRate, &cfgDemo->frameRate) || !DB_GetEntryBool (section, atomRandomPlayers, &cfgDemo->randomPlayers)) { return XBFalse; } return XBTrue; } /* RetrieveDemoConfig */ /**************************** * current demo: frame data * ****************************/ /* * store data for single frame in current demo database */ void StoreDemoFrame (int gameTime, int numPlayers, const unsigned char *buf) { int i; size_t len = 0; char tmp[3 * MAX_PLAYER + 1] = ""; /* create frame section if needed */ if (NULL == frameSection) { assert (NULL != dbDemo); frameSection = DB_CreateSection (dbDemo, atomFrames); assert (NULL != frameSection); } /* create the entry */ for (i = 0; i < numPlayers; i++) { len += sprintf (tmp + len, "%02X ", (unsigned)buf[i]); } (void)DB_CreateEntryString (frameSection, GUI_IntToAtom (gameTime), tmp); } /* StoreDemoFrame */ /* * copy frames of current demo into a buffer */ XBBool RetrieveDemoFrames (int numPlayers, unsigned char (*buffer)[MAX_PLAYER]) { const DBSection *section; size_t i, j, num; int frame; const char *s; unsigned value; /* sanity check */ assert (numPlayers <= MAX_PLAYER); assert (buffer != NULL); assert (dbDemo != NULL); /* find frames section */ if (NULL == (section = DB_GetSection (dbDemo, atomFrames))) { return XBFalse; } /* get number of entries */ num = DB_NumEntries (section); /* loop through entries */ for (i = 0; i < num; i++) { /* get indexed entry */ XBAtom atom = DB_IndexEntry (section, i); assert (ATOM_INVALID != atom); /* check for valid game time */ frame = GUI_AtomToInt (atom); if (frame < 0 || frame >= GAME_TIME) { return XBFalse; } /* get action string */ if (!DB_GetEntryString (section, atom, &s)) { return XBFalse; } /* validate length */ if (strlen (s) < 2 * numPlayers) { return XBFalse; } /* try to extract keys for each player */ for (j = 0; j < numPlayers; j++) { if (1 != sscanf (s + 3 * j, "%x", &value)) { return XBFalse; } /* store in buffer */ buffer[frame][j] = (unsigned char)value; } } return XBTrue; } /* RetrieveDemoFrames */ /* * clear frame section of current database */ void DeleteDemoFrames (void) { assert (NULL != dbDemo); DB_DeleteSection (dbDemo, atomFrames); frameSection = NULL; } /* ClearDemoFrames */ /* * end of file cfg_demo.c */ xblast-2.10.4/cfg_demo.h0000644000175000017500000000476110372731123014133 0ustar rhondaalfie/* * file cfg_demo.h - configuration data for recorded demos * * $Id: cfg_demo.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CFG_DEMO_H #define XBLAST_CFG_DEMO_H /* * type definitions */ /* demo parameters */ typedef struct { int numPlayers; /* number of players in game */ int numFrames; /* number of frames recorded */ int numLives; /* number of lives */ int frameRate; /* DEMOFIX */ XBBool randomPlayers; /* use random player positions */ XBAtom level; /* atom for level file_name */ int randomSeed; /* seed for random generator */ time_t time; /* start of recording */ int winner; /* winner of game */ } CFGDemoInfo; /* demo entry data for GUI */ typedef struct { XBAtom atom; /* name of demo file */ XBAtom level; /* level played */ int numPlayers; /* # of players */ time_t time; /* recording time */ } CFGDemoEntry; /* * global variables */ /* database for current demo playback/recording */ extern DBRoot *dbDemo; /* * global prototypes */ /* managing all demo data */ extern void LoadDemoConfig (void); extern void SaveDemoConfig (void); extern void FinishDemoConfig (void); extern CFGDemoEntry *CreateDemoList (size_t * num); /* current demo: from/to file */ extern XBBool LoadDemoFromFile (XBAtom atom); extern void SaveCurrentDemo (const char *file); /* current demo: config data */ extern void StoreDemoConfig (const CFGDemoInfo * cfgDemo); extern XBBool RetrieveDemoConfig (CFGDemoInfo * cfgDemo); /* current demo: frame data */ extern void StoreDemoFrame (int gameTime, int numPlayer, const unsigned char *buf); extern XBBool RetrieveDemoFrames (int numPlayer, unsigned char (*buf)[MAX_PLAYER]); extern void DeleteDemoFrames (void); #endif /* * end of file cfg_demo.h */ xblast-2.10.4/cfg_game.c0000644000175000017500000006043510377675254014134 0ustar rhondaalfie/* * cfg_game.c - storing and loading game setups * * $Id: cfg_game.c,v 1.25 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ static DBRoot *dbLocal; static DBRoot *dbRemote; static CFGGame defaultGame = { { 0, /* ifreclives */ 1, /* number of lives */ 9, /* number of victories */ 20, /* frames per seconed */ XBTrue, /* select all levels */ XBTrue, /* random level order */ XBTrue, /* random player positions */ 0, /* level order */ 8, /* info wait time */ XBFalse, /* record demo file */ XBTM_None, /* no team game */ XBTrue, /* XBCC not rated */ XBFalse, /* bot */ XBFalse, /* beep */ XBFalse, /* Music */ 2, /* number of rec lives (of valid if 1. XBTrue) */ 1, /* mask bytes for dgram */ }, { 0, /* num of players */ {ATOM_INVALID,}, /* player name atom */ {XBPC_None,}, /* player control */ {XBPH_None,}, /* player host */ {XBPT_Invalid,}, /* player team */ {COLOR_INVALID,}, /* player team color */ {0,}, /* player PID */ {0,}, /* player id */ }, { "localhost", /* hostname */ 16168, /* tcp-port */ XBFalse, /* fixed udp-port */ XBTrue, /* browse LAN */ XBTrue, /* allow NAT for clients */ XBTrue, /* connect to central */ XBFalse, /* beep if new client */ 0, /* Music */ "unnamed", /* name of the game */ }, { 6, /* max hosts */ 6, /* max players */ 6, /* num local players */ 1, /* max mask bytes */ {0, 0, 0}, /* version */ }, }; /* conversion table for player control (alphanumeric sort by key) */ static DBToInt convControlTable[XBPC_NUM + 1] = { {"Joystick1", XBPC_Joystick1,}, {"Joystick2", XBPC_Joystick2,}, {"Joystick3", XBPC_Joystick3,}, {"Joystick4", XBPC_Joystick4,}, {"LeftKeyboard", XBPC_LeftKeyboard,}, {"None", XBPC_None,}, {"RightKeyboard", XBPC_RightKeyboard,}, /* terminator */ {NULL, XBPC_NUM}, }; /* conversion table for player hosts (alphanumeric sort by key) */ static DBToInt convHostTable[XBPH_NUM + 1] = { {"Central", XBPH_Central,}, {"Client1", XBPH_Client1,}, {"Client2", XBPH_Client2,}, {"Client3", XBPH_Client3,}, {"Client4", XBPH_Client4,}, {"Client5", XBPH_Client5,}, #ifdef SMPF {"Client6", XBPH_Client6,}, {"Client7", XBPH_Client7,}, {"Client8", XBPH_Client8,}, {"Client9", XBPH_Client9,}, {"Client10", XBPH_Client10,}, {"Client11", XBPH_Client11,}, {"Client12", XBPH_Client12,}, {"Client13", XBPH_Client13,}, {"Client14", XBPH_Client14,}, {"Client15", XBPH_Client15,}, #endif {"Demo", XBPH_Demo,}, {"Local", XBPH_Local,}, {"None", XBPH_None,}, {"Server", XBPH_Server,}, /* terminator */ {NULL, XBPH_NUM}, }; /* conversion table for player teams (alphanumeric sort by key) */ static DBToInt convTeamTable[XBPT_NUM + 1] = { {"Blue", XBPT_Blue,}, {"Green", XBPT_Green,}, {"None", XBPT_None,}, {"Red", XBPT_Red,}, /* terminator */ {NULL, XBPT_NUM,}, }; /* conversion table for player teams (alphanumeric sort by key) */ static DBToInt convTeamModeTable[XBTM_NUM + 1] = { {"Hunt", XBTM_Hunt,}, {"None", XBTM_None,}, {"Team", XBTM_Team,}, /* terminator */ {NULL, XBTM_NUM,}, }; /* * convert type to database */ static DBRoot * GetDB (CFGType cfgType) { switch (cfgType) { case CT_Local: return dbLocal; case CT_Remote: return dbRemote; /* case CT_Demo: return dbDemo; */ default: return NULL; } } /* GetDB */ /* * */ static void StoreAnyGameSetup (DBRoot * db, XBAtom atom, const CFGGameSetup * game) { DBSection *section; const char *key; /* sanity check */ assert (db != NULL); assert (ATOM_INVALID != atom); assert (NULL != game); /* create new game section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* other stats */ DB_CreateEntryInt (section, atomLives, game->numLives); DB_CreateEntryInt (section, atomRecLives, game->recLives); DB_CreateEntryBool (section, atomIfRecLives, game->ifRecLives); DB_CreateEntryInt (section, atomWins, game->numWins); DB_CreateEntryInt (section, atomFrameRate, game->frameRate); DB_CreateEntryBool (section, atomAllLevels, game->allLevels); DB_CreateEntryBool (section, atomRandomLevels, game->randomLevels); DB_CreateEntryBool (section, atomRandomPlayers, game->randomPlayers); DB_CreateEntryBool (section, atomRecordDemo, game->recordDemo); DB_CreateEntryBool (section, atomRatedGame, game->rated); DB_CreateEntryBool (section, atomBot, game->bot); DB_CreateEntryBool (section, atomBeep, game->beep); DB_CreateEntryInt (section, atomMusic, game->Music); DB_CreateEntryInt (section, atomInfoTime, game->infoTime); // LRF DB_CreateEntryInt (section, atomLevelOrder, game->levelOrder); DB_CreateEntryInt (section, atomMaskBytes, game->maskBytes); /* team mode */ if (NULL != (key = DB_IntToString (convTeamModeTable, (int)game->teamMode))) { DB_CreateEntryString (section, atomTeamMode, key); } else { DB_DeleteEntry (section, atomTeamMode); } } /* StoreAnyGameSetup */ /* * */ void StoreGameSetup (CFGType cfgType, XBAtom atom, const CFGGameSetup * game) { StoreAnyGameSetup (GetDB (cfgType), atom, game); } /* StoreLocalGameSetup */ /* * store GamePlayers data from struct to any database */ static void StoreAnyGamePlayers (DBRoot * db, XBAtom atom, const CFGGamePlayers * game) { int i; DBSection *section; const char *keyControl; const char *keyHost; const char *keyTeam; /* sanity check */ assert (db != NULL); assert (ATOM_INVALID != atom); assert (NULL != game); /* create new game section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* number of players */ DB_CreateEntryInt (section, atomNumPlayers, game->num); /* players */ for (i = 0; i < game->num; i++) { keyControl = DB_IntToString (convControlTable, (int)game->control[i]); keyHost = DB_IntToString (convHostTable, (int)game->host[i]); keyTeam = DB_IntToString (convTeamTable, (int)game->team[i]); if (NULL != keyHost && NULL != keyControl && NULL != keyTeam) { DB_CreateEntryString (section, atomArrayPlayer0[i], GUI_AtomToString (game->player[i])); DB_CreateEntryString (section, atomArrayControl0[i], keyControl); DB_CreateEntryString (section, atomArrayHost0[i], keyHost); DB_CreateEntryString (section, atomArrayTeam0[i], keyTeam); } else { DB_DeleteEntry (section, atomArrayPlayer0[i]); DB_DeleteEntry (section, atomArrayControl0[i]); DB_DeleteEntry (section, atomArrayHost0[i]); DB_DeleteEntry (section, atomArrayTeam0[i]); } } for (; i < MAX_PLAYER; i++) { DB_DeleteEntry (section, atomArrayPlayer0[i]); DB_DeleteEntry (section, atomArrayControl0[i]); DB_DeleteEntry (section, atomArrayHost0[i]); DB_DeleteEntry (section, atomArrayTeam0[i]); } } /* StoreAnyGamePlayers */ /* * copy GamePlayers data from struct to a config database */ void StoreGamePlayers (CFGType cfgType, XBAtom atom, const CFGGamePlayers * game) { StoreAnyGamePlayers (GetDB (cfgType), atom, game); } /* StoreGamePlayers */ /* * */ static void StoreAnyGameHost (DBRoot * db, XBAtom atom, const CFGGameHost * host) { DBSection *section; /* sanity check */ assert (db != NULL); assert (ATOM_INVALID != atom); assert (NULL != host); /* create new game section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* other stats */ if (NULL != host->name) { DB_CreateEntryString (section, atomHost, host->name); } else { DB_DeleteEntry (section, atomHost); } DB_CreateEntryInt (section, atomPort, host->port); DB_CreateEntryBool (section, atomFixedUdpPort, host->fixedUdpPort); DB_CreateEntryBool (section, atomBrowseLan, host->browseLan); DB_CreateEntryBool (section, atomAllowNat, host->allowNat); DB_CreateEntryBool (section, atomCentral, host->central); DB_CreateEntryBool (section, atomBeep, host->beep); if (NULL != host->game) { DB_CreateEntryString (section, atomGame, host->game); } else { DB_DeleteEntry (section, atomGame); } } /* StoreGameHost */ /* * */ void StoreGameHost (CFGType cfgType, XBAtom atom, const CFGGameHost * host) { StoreAnyGameHost (GetDB (cfgType), atom, host); } /* StoreGameHost */ /* * store version data in any database */ static void StoreAnyGameVersion (DBRoot * db, XBAtom atom, const XBVersion * ver) { DBSection *section; /* sanity check */ assert (db != NULL); assert (ATOM_INVALID != atom); assert (NULL != ver); /* create new game section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* store version data */ DB_CreateEntryInt (section, atomVersionMajor, (int)ver->major); DB_CreateEntryInt (section, atomVersionMinor, (int)ver->minor); DB_CreateEntryInt (section, atomVersionPatch, (int)ver->patch); } /* StoreAnyGameVersion */ /* * copy version data database directory */ void StoreGameVersion (CFGType cfgType, XBAtom atom, const XBVersion * ver) { StoreAnyGameVersion (GetDB (cfgType), atom, ver); } /* StoreGameVersion */ /* * store constants in any database */ static void StoreAnyGameConst (DBRoot * db, XBAtom atom, const CFGGameConst * con) { DBSection *section; /* sanity check */ assert (db != NULL); assert (ATOM_INVALID != atom); assert (NULL != con); /* create new game section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* store version data */ DB_CreateEntryInt (section, atomMaxHosts, con->maxhosts); DB_CreateEntryInt (section, atomMaxPlayers, con->maxplayers); DB_CreateEntryInt (section, atomMaxLocals, con->maxlocals); DB_CreateEntryInt (section, atomMaxMaskBytes, con->maxbytes); DB_CreateEntryInt (section, atomVersionMajor, (int)con->version.major); DB_CreateEntryInt (section, atomVersionMinor, (int)con->version.minor); DB_CreateEntryInt (section, atomVersionPatch, (int)con->version.patch); } /* StoreAnyGameConst */ /* * store constants in config database */ void StoreGameConst (CFGType cfgType, XBAtom atom, const CFGGameConst * con) { StoreAnyGameConst (GetDB (cfgType), atom, con); } /* StoreGameConst */ /* * store local constants in config database */ void StoreGameConstLocal (CFGType cfgType, XBAtom atom) { CFGGameConst con; con.maxhosts = MAX_HOSTS; con.maxplayers = MAX_PLAYER; con.maxlocals = NUM_LOCAL_PLAYER; con.maxbytes = MAX_MASK_BYTES; memcpy (&con.version, &Ver_Local, sizeof (XBVersion)); StoreAnyGameConst (GetDB (cfgType), atom, &con); } /* StoreGameConstLocal */ /* * retrieve game setup from any database */ static XBBool RetrieveAnyGameSetup (const DBRoot * db, XBAtom atom, CFGGameSetup * game) { const DBSection *section; assert (NULL != db); assert (NULL != game); /* set defaults */ memcpy (game, &defaultGame.setup, sizeof (CFGGameSetup)); /* find according db section */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* copy values */ (void)DB_GetEntryInt (section, atomLives, &game->numLives); (void)DB_GetEntryInt (section, atomRecLives, &game->recLives); (void)DB_GetEntryBool (section, atomIfRecLives, &game->ifRecLives); (void)DB_GetEntryInt (section, atomWins, &game->numWins); (void)DB_GetEntryInt (section, atomFrameRate, &game->frameRate); (void)DB_GetEntryBool (section, atomAllLevels, &game->allLevels); (void)DB_GetEntryBool (section, atomRandomLevels, &game->randomLevels); (void)DB_GetEntryBool (section, atomRandomPlayers, &game->randomPlayers); (void)DB_GetEntryBool (section, atomRecordDemo, &game->recordDemo); (void)DB_GetEntryBool (section, atomRatedGame, &game->rated); (void)DB_GetEntryInt (section, atomInfoTime, &game->infoTime); // LRF (void)DB_GetEntryInt (section, atomLevelOrder, &game->levelOrder); (void)DB_GetEntryBool (section, atomBot, &game->bot); (void)DB_GetEntryBool (section, atomBeep, &game->beep); (void)DB_GetEntryInt (section, atomMusic, (int *)&game->Music); (void)DB_GetEntryInt (section, atomMaskBytes, &game->maskBytes); /* team mode */ if (DCR_Okay != DB_ConvertEntryInt (section, atomTeamMode, (int *)&game->teamMode, convTeamModeTable)) { game->teamMode = XBTM_None; } /* that's all */ return XBTrue; } /* RetrieveGameConfig */ /* * retrieve game setup from config database */ XBBool RetrieveGameSetup (CFGType cfgType, XBAtom atom, CFGGameSetup * game) { return RetrieveAnyGameSetup (GetDB (cfgType), atom, game); } /* RetrieveGameSetup */ /* * fill default player data, call only once when accessing game players */ static void DefaultPlayerData (void) { static int init = 0; int p; if (init == 0) { for (p = 1; p < MAX_PLAYER; p++) { defaultGame.players.player[p] = defaultGame.players.player[0]; defaultGame.players.control[p] = defaultGame.players.control[0]; defaultGame.players.host[p] = defaultGame.players.host[0]; defaultGame.players.team[p] = defaultGame.players.team[0]; defaultGame.players.PID[p] = defaultGame.players.PID[0]; defaultGame.players.playerID[p] = defaultGame.players.playerID[0]; } init = 1; } } /* DefaultPlayerData */ /* * copy GamePlayers data from any database to struct */ static XBBool RetrieveAnyGamePlayers (const DBRoot * db, XBAtom atom, CFGGamePlayers * game) { int i; const DBSection *section; const char *s; assert (NULL != db); assert (NULL != game); /* set defaults */ DefaultPlayerData (); memcpy (game, &defaultGame.players, sizeof (CFGGamePlayers)); /* find according db section */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* get num players */ if (!DB_GetEntryInt (section, atomNumPlayers, &game->num)) { game->num = 0; } /* check player max */ if (game->num > MAX_PLAYER) { return XBFalse; } /* get players */ for (i = 0; i < game->num; i++) { if (DB_GetEntryString (section, atomArrayPlayer0[i], &s)) { game->player[i] = GUI_StringToAtom (s); } else { game->player[i] = ATOM_INVALID; } if (DCR_Okay != DB_ConvertEntryInt (section, atomArrayControl0[i], (int *)&game->control[i], convControlTable)) { game->control[i] = XBPC_None; } if (DCR_Okay != DB_ConvertEntryInt (section, atomArrayHost0[i], (int *)&game->host[i], convHostTable)) { game->host[i] = XBPH_None; } if (DCR_Okay != DB_ConvertEntryInt (section, atomArrayTeam0[i], (int *)&game->team[i], convTeamTable)) { game->team[i] = XBPT_Invalid; } switch (game->team[i]) { case XBPT_Red: game->teamColor[i] = COLOR_RED; break; case XBPT_Green: game->teamColor[i] = COLOR_GREEN; break; case XBPT_Blue: game->teamColor[i] = COLOR_BLUE; break; default: game->teamColor[i] = COLOR_INVALID; break; } } return XBTrue; } /* RetrieveGamePlayers */ /* * get local player selection */ XBBool RetrieveGamePlayers (CFGType cfgType, XBAtom atom, CFGGamePlayers * game) { return RetrieveAnyGamePlayers (GetDB (cfgType), atom, game); } /* RetrieveGamePlayers */ /* * */ static XBBool RetrieveAnyGameHost (const DBRoot * db, XBAtom atom, CFGGameHost * game) { const DBSection *section; const char *s; assert (NULL != db); assert (NULL != game); /* find according db section */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* get host data */ memcpy (game, &defaultGame.host, sizeof (CFGGameHost)); if (DB_GetEntryString (section, atomHost, &s)) { game->name = s; } (void)DB_GetEntryInt (section, atomPort, &game->port); (void)DB_GetEntryBool (section, atomFixedUdpPort, &game->fixedUdpPort); (void)DB_GetEntryBool (section, atomBrowseLan, &game->browseLan); (void)DB_GetEntryBool (section, atomAllowNat, &game->allowNat); (void)DB_GetEntryBool (section, atomCentral, &game->central); (void)DB_GetEntryString (section, atomGame, &game->game); (void)DB_GetEntryBool (section, atomBeep, &game->beep); return XBTrue; } /* RetrieveGameHost */ /* * */ XBBool RetrieveGameHost (CFGType cfgType, XBAtom atom, CFGGameHost * game) { return RetrieveAnyGameHost (GetDB (cfgType), atom, game); } /* RetrieveGameHost */ /* * get version data from any database */ static XBBool RetrieveAnyGameVersion (const DBRoot * db, XBAtom atom, XBVersion * ver) { const DBSection *section; int maj, min, pat; assert (NULL != ver); /* find according db section */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } Version_Clear (ver); /* now extract version data */ if (!DB_GetEntryInt (section, atomVersionMajor, &maj)) { return XBFalse; } if (!DB_GetEntryInt (section, atomVersionMinor, &min)) { return XBFalse; } if (!DB_GetEntryInt (section, atomVersionPatch, &pat)) { return XBFalse; } ver->major = maj & 0xFF; ver->minor = min & 0xFF; ver->patch = pat & 0xFF; return XBTrue; } /* RetrieveAnyGameVersion */ /* * get version data from config database */ XBBool RetrieveGameVersion (CFGType cfgType, XBAtom atom, XBVersion * ver) { return RetrieveAnyGameVersion (GetDB (cfgType), atom, ver); } /* RetrieveGameVersion */ /* * get game constants any database */ static XBBool RetrieveAnyGameConst (const DBRoot * db, XBAtom atom, CFGGameConst * con) { const DBSection *section; int maj, min, pat; assert (NULL != con); /* set default */ memcpy (con, &defaultGame.constants, sizeof (CFGGameConst)); /* find according db section */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* extract constants */ (void)DB_GetEntryInt (section, atomMaxHosts, &con->maxhosts); (void)DB_GetEntryInt (section, atomMaxPlayers, &con->maxplayers); (void)DB_GetEntryInt (section, atomMaxLocals, &con->maxlocals); (void)DB_GetEntryInt (section, atomMaxMaskBytes, &con->maxbytes); /* now extract version data */ if (!DB_GetEntryInt (section, atomVersionMajor, &maj)) { return XBTrue; } if (!DB_GetEntryInt (section, atomVersionMinor, &min)) { return XBTrue; } if (!DB_GetEntryInt (section, atomVersionPatch, &pat)) { return XBTrue; } con->version.major = maj & 0xFF; con->version.minor = min & 0xFF; con->version.patch = pat & 0xFF; return XBTrue; } /* RetrieveAnyGameConst */ /* * get game constants from config database */ XBBool RetrieveGameConst (CFGType cfgType, XBAtom atom, CFGGameConst * con) { return RetrieveAnyGameConst (GetDB (cfgType), atom, con); } /* RetrieveGameConst */ /* * save game config at once */ void StoreGame (CFGType cfgType, XBAtom atom, const CFGGame * cfg) { assert (NULL != cfg); StoreGameSetup (cfgType, atom, &cfg->setup); StoreGamePlayers (cfgType, atom, &cfg->players); StoreGameHost (cfgType, atom, &cfg->host); StoreGameConst (cfgType, atom, &cfg->constants); } /* StoreGame */ /* * retrieve game config at once */ XBBool RetrieveGame (CFGType cfgType, XBAtom atom, CFGGame * cfg) { XBBool result = XBTrue; assert (NULL != cfg); if (!RetrieveGameSetup (cfgType, atom, &cfg->setup)) { result = XBFalse; } if (!RetrieveGamePlayers (cfgType, atom, &cfg->players)) { result = XBFalse; } if (!RetrieveGameHost (cfgType, atom, &cfg->host)) { result = XBFalse; } (void)RetrieveGameConst (cfgType, atom, &cfg->constants); return result; } /* RetrieveGame */ /* * load game config from file */ void LoadGameConfig (void) { /* remote database */ dbRemote = DB_Create (DT_Config, atomRemoteGame); assert (dbRemote != NULL); /* local database */ dbLocal = DB_Create (DT_Config, atomGame); assert (dbLocal != NULL); Dbg_Config ("loading local game config\n"); if (DB_Load (dbLocal)) { return; } Dbg_Config ("failed to load local game config, setting defaults\n"); /* set default values */ DefaultPlayerData (); StoreGame (CT_Local, atomLocal, &defaultGame); StoreGame (CT_Local, atomServer, &defaultGame); StoreGame (CT_Local, atomClient, &defaultGame); /* and save it */ DB_Store (dbLocal); } /* LoadGameConfig */ /* * save game config to file */ void SaveGameConfig (void) { assert (dbLocal != NULL); if (DB_Changed (dbLocal)) { Dbg_Config ("saving local game config\n"); DB_Store (dbLocal); } #ifdef DEBUG assert (dbRemote != NULL); if (DB_Changed (dbRemote)) { Dbg_Config ("saving remote game config\n"); DB_Store (dbRemote); } #endif } /* SaveGameConfig */ /* * remove game configs */ void FinishGameConfig (void) { if (NULL != dbLocal) { DB_Delete (dbLocal); dbLocal = NULL; } if (NULL != dbRemote) { DB_Delete (dbRemote); dbRemote = NULL; } Dbg_Config ("game config cleared!\n"); } /* FinishGameConfig */ /* * put game config into telegram send queue */ XBBool SendGameConfig (CFGType cfgType, XBSndQueue * queue, XBTeleCOT cot, XBTeleIOB iob, XBAtom atom) { const DBSection *section; int i; size_t len; XBTelegram *tele; char tmp[256]; assert (queue != NULL); /* get section with game data */ section = DB_GetSection (GetDB (cfgType), atom); if (NULL == section) { return XBFalse; } /* now print and send data */ i = 0; while (0 < (len = DB_PrintEntry (tmp, section, i))) { tele = Net_CreateTelegram (cot, XBT_ID_GameConfig, iob, tmp, len + 1); assert (tele != NULL); Net_SendTelegram (queue, tele); i++; } /* no data means end of section */ tele = Net_CreateTelegram (cot, XBT_ID_GameConfig, iob, NULL, 0); assert (tele != NULL); Net_SendTelegram (queue, tele); return XBTrue; } /* SendGameConfig */ /* * delete a game config */ void DeleteGameConfig (CFGType cfgType, XBAtom atom) { DB_DeleteSection (GetDB (cfgType), atom); } /* DeleteGameConfig */ /* * add entry line to game config */ void AddToGameConfig (CFGType cfgType, XBAtom atom, const char *line) { DBSection *section; /* sanity check */ assert (ATOM_INVALID != atom); /* create new game section */ section = DB_CreateSection (GetDB (cfgType), atom); assert (NULL != section); /* add line */ (void)DB_ParseEntry (section, line); } /* AddToGameConfig */ /* * return hostname and port */ const char * GetHostName (CFGType cfgType, XBAtom atom) { CFGGameHost cfg; static char txt[256]; /* sanity check */ assert (ATOM_INVALID != atom); /* get host config */ if (!RetrieveGameHost (cfgType, atom, &cfg)) { strcpy (txt, "unknown"); } else { sprintf (txt, "%s:%d", cfg.name, cfg.port); } return txt; } /* GetRemoteHostName */ /* * push a single ip into ip history database */ void StoreIpHistory (CFGGameHost * host, XBAtom atom) { DBSection *section; CFGGameHost hist[10]; int i = 0; /* sanity check */ assert (ATOM_INVALID != atom); assert (NULL != host); section = (DBSection *) DB_GetSection (GetDB (CT_Local), atom); /* get old history data */ assert (NULL != section); RetrieveIpHistory (hist, atom); /* push back server data */ for (i = 9; i > 0; i--) { hist[i].name = hist[i - 1].name; hist[i].port = hist[i - 1].port; } /* store latest host data */ hist[0].port = host->port; hist[0].name = host->name; /* store back to database, backwards (important for pointer validity!) */ for (i = 9; i >= 0; i--) { if (NULL != hist[i].name) { DB_CreateEntryString (section, atomGamehis[i], hist[i].name); DB_CreateEntryInt (section, atomPorthis[i], hist[i].port); } else { DB_DeleteEntry (section, atomGamehis[i]); DB_DeleteEntry (section, atomPorthis[i]); } } RetrieveIpHistory (hist, atom); } /* StoreIpHistory */ /* * retrieve all ip history data */ XBBool RetrieveIpHistory (CFGGameHost host[10], XBAtom atom) { const DBSection *section; int i = 0; section = DB_GetSection (GetDB (CT_Local), atom); /* check if there is section with ip history data */ if (NULL == section) { return XBFalse; } /* retrieve data */ for (i = 0; i < 10; i++) { /* first default data for entry */ host[i].name = NULL; host[i].game = NULL; host[i].port = 0; /* now update from database */ (void)DB_GetEntryString (section, atomGamehis[i], &host[i].name); (void)DB_GetEntryInt (section, atomPorthis[i], &host[i].port); } return XBTrue; } /* RetrieveIpHistory */ /* * end of file cfg_game.c */ xblast-2.10.4/cfg_game.h0000644000175000017500000001373110372731123014115 0ustar rhondaalfie/* * cfg_game.h - game configuration data * * $Id: cfg_game.h,v 1.18 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CFG_GAME_H #define XBLAST_CFG_GAME_H /* player controls */ typedef enum { XBPC_None, XBPC_RightKeyboard, XBPC_LeftKeyboard, XBPC_Joystick1, XBPC_Joystick2, XBPC_Joystick3, XBPC_Joystick4, /* no new elements after this line */ XBPC_NUM } XBPlayerControl; /*player hosts */ typedef enum { XBPH_None, XBPH_Demo, /* host watches only */ XBPH_Local, /* local host, either local game or during network game setup */ XBPH_Server, /* server host, in network game only */ XBPH_Client1, /* numbered client host, in network game only */ XBPH_Client2, XBPH_Client3, XBPH_Client4, XBPH_Client5, #ifdef SMPF XBPH_Client6, XBPH_Client7, XBPH_Client8, XBPH_Client9, XBPH_Client10, XBPH_Client11, XBPH_Client12, XBPH_Client13, XBPH_Client14, XBPH_Client15, #endif XBPH_Central, /* no new elements after this line */ XBPH_NUM } XBPlayerHost; /* player teams */ typedef enum { XBPT_Invalid, XBPT_None, XBPT_Red, XBPT_Green, XBPT_Blue, /* no new elements after this line */ XBPT_NUM } XBPlayerTeam; /* game player config */ typedef struct { int num; /* number of players */ XBAtom player[MAX_PLAYER]; /* section atoms for player graphics */ XBPlayerControl control[MAX_PLAYER]; XBPlayerHost host[MAX_PLAYER]; XBPlayerTeam team[MAX_PLAYER]; XBColor teamColor[MAX_PLAYER]; int PID[MAX_PLAYER]; /* pid's for rated games */ int playerID[MAX_PLAYER]; /* ??? */ } CFGGamePlayers; /* team modes */ typedef enum { XBTM_None, /* normal game */ XBTM_Team, /* teams, assignment is random */ XBTM_Hunt, /* all on one (3 to 6 players) */ /* no new elements after this line */ XBTM_NUM } XBTeamMode; /* game parameters */ typedef struct { XBBool ifRecLives; /* should recommended lives for levels be used */ int numLives; /* standard number of lives in levels */ int numWins; /* wins necessary for game end */ int frameRate; /* frame rate */ XBBool allLevels; /* use all levels in game */ XBBool randomLevels; /* random level choice */ XBBool randomPlayers; /* random player positions */ int levelOrder; /* how to sort the levels */ int infoTime; /* time for level info */ XBBool recordDemo; /* should game be saved for demo view */ XBTeamMode teamMode; /* initial team mode */ XBBool rated; /* rated game or not */ XBBool bot; /* start in bot mode (all players) */ XBBool beep; /* beep for new connection, game start */ SND_Id Music; /* background music */ int recLives; /* default recommended lives count */ int maskBytes; /* action mask bytes to use */ } CFGGameSetup; /* connection to host */ typedef struct { const char *name; /* host name */ int port; /* port number for tcp connection */ XBBool fixedUdpPort; /* use fixed udp ports in game */ XBBool browseLan; /* open socket for la broadcasts */ XBBool allowNat; /* allow clients behind NAT */ XBBool central; /* register game at central */ XBBool beep; /* beep for new clients */ SND_Id Music; /* background music */ const char *game; /* game name */ } CFGGameHost; /* host constants */ typedef struct { int maxhosts; /* max number of hosts allowed */ int maxplayers; /* max number of total players allowed */ int maxlocals; /* max number of local players allowed */ int maxbytes; /* max number of mask bytes handled */ XBVersion version; /* version number */ } CFGGameConst; /* all in one */ typedef struct { CFGGameSetup setup; CFGGamePlayers players; CFGGameHost host; CFGGameConst constants; } CFGGame; /* * global prototypes */ /* handle all game configs */ extern void LoadGameConfig (void); extern void SaveGameConfig (void); extern void FinishGameConfig (void); /* handle single game config */ extern void AddToGameConfig (CFGType, XBAtom atom, const char *text); extern XBBool SendGameConfig (CFGType, XBSndQueue * sndQueue, XBTeleCOT cot, XBTeleIOB iob, XBAtom atom); extern void DeleteGameConfig (CFGType, XBAtom); /* retrieve/store in a single game config */ extern XBBool RetrieveGame (CFGType, XBAtom atom, CFGGame *); extern void StoreGame (CFGType, XBAtom atom, const CFGGame *); extern XBBool RetrieveGameHost (CFGType, XBAtom atom, CFGGameHost *); extern const char *GetHostName (CFGType, XBAtom); extern void StoreGameHost (CFGType, XBAtom atom, const CFGGameHost *); extern XBBool RetrieveGameSetup (CFGType, XBAtom atom, CFGGameSetup *); extern void StoreGameSetup (CFGType, XBAtom atom, const CFGGameSetup *); extern XBBool RetrieveGamePlayers (CFGType, XBAtom atom, CFGGamePlayers *); extern void StoreGamePlayers (CFGType, XBAtom atom, const CFGGamePlayers *); extern XBBool RetrieveGameVersion (CFGType cfgType, XBAtom atom, XBVersion * ver); extern void StoreGameVersion (CFGType cfgType, XBAtom atom, const XBVersion * ver); extern XBBool RetrieveGameConst (CFGType cfgType, XBAtom atom, CFGGameConst * con); extern void StoreGameConst (CFGType cfgType, XBAtom atom, const CFGGameConst * con); extern void StoreGameConstLocal (CFGType cfgType, XBAtom atom); extern XBBool RetrieveIpHistory (CFGGameHost game[10], XBAtom atom); extern void StoreIpHistory (CFGGameHost * host, XBAtom atom); #endif /* * end of file cfg_game.h */ xblast-2.10.4/cfg_level.c0000644000175000017500000006102210412220337014275 0ustar rhondaalfie/* * cfg_level.c - managing level data * * $Id: cfg_level.c,v 1.23 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * level info structure */ /* * local marcos */ #define MAX_SHUFFLE (2<<24) #define IOB_INFO 0u #define IOB_PLAYER 1u #define IOB_SHRINK 2u #define IOB_SCRAMBLE_DRAW 3u #define IOB_SCRAMBLE_DEL 4u #define IOB_FUNC 5u #define IOB_BOMBS 6u #define IOB_GRAPHICS 7u #define IOB_MAP 8u #define NUM_IOBS 9u #define IOB_NAME 254u #define IOB_INVALID 255u /* * local types */ typedef struct { union { const char *name; /* name to sort by */ int value; /* random number to sort by */ time_t lastplayed; /* last play date to sort by */ } key; XBAtom level; /* level */ } LevelTable; /* lookup table for shuffled levels */ typedef struct { XBAtom level; /* level */ } LevelShuffled; /* * local variables */ static DBRoot *dbLevel = NULL; static LevelTable *sortedTable = NULL; static LevelTable *shuffledTable = NULL; static LevelTable *timeTable = NULL; /* Better level randomness */ static const char *gameModeString = "R23456STDL"; static unsigned gameMode = 0; static XBBool randomOrder = XBFalse; static int levelOrder = 0; static XBBool allLevels = XBTrue; static int indexSorted = 0; static int indexShuffled = 0; static int indexTime = 0; static DBRoot *levelRemote = NULL; static DBRoot *levelLocal = NULL; /****************** * local routines * ******************/ /* * additional info for new levels files */ static void InsertLevel (DBSection * section) { /* new levels are automatically selected */ DB_CreateEntryBool (section, atomSelect, XBTrue); /* set new value for level shuffling */ (void)DB_CreateEntryTime (section, atomLastPlayed, 0); } /* InsertLevel */ /* * get game mode string for current level, given section */ static unsigned GetLevelGameMode (XBAtom atom) { const DBSection *section; const char *s; int i; unsigned gameMode = 0; if (NULL == (section = DB_GetSection (dbLevel, atom))) { return 0; } if (!DB_GetEntryString (section, atomGameMode, &s)) { return 0; } for (i = 0; s[i] != 0 && gameModeString[i] != 0; i++) { if (s[i] == gameModeString[i]) { gameMode |= (1 << i); } } return gameMode; } /* GetLevelGameMode */ /* * get a level/atom entry from current level */ static const char * GetLevelStringByAtom (XBAtom level, XBAtom atom) { const char *s; const DBSection *section; assert (dbLevel != NULL); section = DB_GetSection (dbLevel, level); if (NULL == section) { return NULL; } if (!DB_GetEntryString (section, atom, &s)) { return NULL; } return s; } /* GetLevelString */ /* * get shuffle index for current level, section atom */ static XBBool GetLevelShuffle (XBAtom level, int *pShuffle) { const DBSection *section; /* sanity checks */ assert (pShuffle != NULL); assert (dbLevel != NULL); /* get entry for level */ section = DB_GetSection (dbLevel, level); if (NULL == section) { return XBFalse; } if (!DB_GetEntryInt (section, atomShuffle, pShuffle)) { return XBFalse; } return XBTrue; } /* GetLevelShuffle */ /* * store shuffle index in current level, section atom */ static void StoreLevelShuffle (XBAtom atom, int shuffle) { DBSection *section; assert (NULL != dbLevel); section = DB_CreateSection (dbLevel, atom); assert (section != NULL); /* we only change data not stored in file */ (void)DB_CreateEntryInt (section, atomShuffle, shuffle); } /* StoreLevelShuffle */ /* * get time from current level, section level */ static XBBool GetLevelTime (XBAtom level, time_t * lpTime) { const DBSection *section; /* sanity checks */ assert (lpTime != NULL); assert (dbLevel != NULL); /* get entry for level */ section = DB_GetSection (dbLevel, level); if (NULL == section) { return XBFalse; } if (!DB_GetEntryTime (section, atomLastPlayed, lpTime)) { return XBFalse; } return XBTrue; } /* GetLevelTime */ /* * store time in current level, section level */ static void StoreLevelTime (XBAtom atom, int lpTime) { DBSection *section; assert (NULL != dbLevel); section = DB_CreateSection (dbLevel, atom); assert (section != NULL); /* we only change data not stored in file */ (void)DB_CreateEntryTime (section, atomLastPlayed, lpTime); } /* StoreLevelTime */ /* * set flag in current level, given section/entry */ static void SetLevelWasLast (XBAtom level, XBAtom entry, XBBool flag) { DBSection *section; section = DB_CreateSection (dbLevel, level); assert (section != NULL); (void)DB_CreateEntryBool (section, entry, flag); } /* SetWasLastLevel */ /* * get flag in current level, given section/entry */ static XBBool GetLevelWasLast (XBAtom level, XBAtom entry) { const DBSection *section; XBBool result; section = DB_GetSection (dbLevel, level); assert (section != NULL); if (!DB_GetEntryBool (section, entry, &result)) { return XBFalse; } return result; } /* GetWasLastLevel */ /* * compare level names by name */ static int CompareSorted (const void *a, const void *b) { return strcmp (((const LevelTable *) a)->key.name, ((const LevelTable *) b)->key.name); } /* CompareSorted */ /* * compare levels by shuffle value */ static int CompareShuffle (const void *a, const void *b) { return ((const LevelTable *) a)->key.value - ((const LevelTable *) b)->key.value; } /* CompareShuffle */ /* * compare levels by time */ static int CompareTime (const void *a, const void *b) { return ((const LevelTable *) a)->key.lastplayed - ((const LevelTable *) b)->key.lastplayed; } /* CompareTime */ /* * return level index after sorting by name */ static int GetLastIndexSorted (void) { int i, numLevels; XBAtom atom; /* allocate table if necessary */ numLevels = GetNumLevels (); if (NULL == sortedTable) { sortedTable = calloc (numLevels, sizeof (LevelTable)); assert (sortedTable != NULL); } /* enter level names */ for (i = 0; i < numLevels; i++) { atom = GetLevelAtom (i); sortedTable[i].level = atom; sortedTable[i].key.name = GetLevelNameByAtom (atom); } /* sort the table */ qsort (sortedTable, numLevels, sizeof (LevelTable), CompareSorted); /* find first level marked as sorted */ for (i = 0; i < numLevels; i++) { if (GetLevelWasLast (sortedTable[i].level, atomLevelSorted)) { Dbg_Level ("last level (sorted) = %s\n", GetLevelNameByAtom (sortedTable[i].level)); return i; } } return numLevels; } /* GetLastIndexSorted */ /* * return level index after sorting by value */ static int GetLastIndexShuffled (void) { int i, miss, max, swap, save, numLevels; /* allocate shuffledTable if necessary */ numLevels = GetNumLevels (); if (NULL == shuffledTable) { shuffledTable = calloc (numLevels, sizeof (LevelTable)); assert (shuffledTable != NULL); } /* build table, count missing values, get next value */ miss = 0; max = 0; for (i = 0; i < numLevels; i++) { shuffledTable[i].level = GetLevelAtom (i); assert (ATOM_INVALID != shuffledTable[i].level); if (!GetLevelShuffle (shuffledTable[i].level, &shuffledTable[i].key.value)) { shuffledTable[i].key.value = -1; miss++; } if (shuffledTable[i].key.value > max) { max = shuffledTable[i].key.value; } } Dbg_Level ("%u missing shuffle values, %u is current max\n", miss, max); /* assign new values to missing */ for (i = 0; i < numLevels; i++) { if (shuffledTable[i].key.value < 0) { shuffledTable[i].key.value = -max; max++; } } Dbg_Level ("update max value to %d\n", max); /* shuffle missing values */ for (i = 0; i < numLevels; i++) { if (shuffledTable[i].key.value < 0) { swap = OtherRandomNumber (numLevels); save = -shuffledTable[i].key.value; shuffledTable[i].key.value = abs (shuffledTable[swap].key.value); shuffledTable[swap].key.value = save; } } /* update shuffle values in database */ for (i = 0; i < numLevels; i++) { StoreLevelShuffle (shuffledTable[i].level, shuffledTable[i].key.value); } /* sort the table by value */ qsort (shuffledTable, numLevels, sizeof (LevelTable), CompareShuffle); /* get last level played from database */ for (i = 0; i < numLevels; i++) { if (GetLevelWasLast (shuffledTable[i].level, atomLevelShuffled)) { Dbg_Level ("last level (shuffled) = %s\n", GetLevelNameByAtom (shuffledTable[i].level)); return i; } } return numLevels; } /* GetLastIndexShuffled */ /* * return last level after sorting by time */ static int GetLastIndexTime (void) { int i, numLevels; /* allocate timeTable if necessary */ numLevels = GetNumLevels (); if (NULL == timeTable) { timeTable = calloc (numLevels, sizeof (LevelTable)); assert (timeTable != NULL); } /* build table */ for (i = 0; i < numLevels; i++) { timeTable[i].level = GetLevelAtom (i); assert (ATOM_INVALID != timeTable[i].level); if (!GetLevelTime (timeTable[i].level, &timeTable[i].key.lastplayed)) { timeTable[i].key.lastplayed = 0; StoreLevelTime (timeTable[i].level, timeTable[i].key.lastplayed); } } /* sort table */ qsort (timeTable, numLevels, sizeof (LevelTable), CompareTime); #ifdef DEBUG_LEVELTIME for (i = 0; i < numLevels; i++) { Dbg_Out ("Lastplayed time of level %s = %s\n", GetLevelNameByAtom (timeTable[i].level), DateString (timeTable[i].key.lastplayed)); } #endif return numLevels; } /* GetLastIndexTime */ /* * reset sorted level */ static void ResortLevels (void) { indexSorted = 0; } /* ResortLevels */ /* * reset level time */ static void ReTimeLevels (void) { indexTime = 0; } /* ReTimeLevels */ /* * recreate shuffle table */ static void ReshuffleLevels (void) { int i, j, k, numLevels; Dbg_Level ("reshuffling levels\n"); numLevels = GetNumLevels (); for (i = 0; i < numLevels; i++) { shuffledTable[i].key.value = i; } for (i = numLevels - 1; i > 0; i--) { j = OtherRandomNumber (i + 1); k = shuffledTable[i].key.value; shuffledTable[i].key.value = shuffledTable[j].key.value; shuffledTable[j].key.value = k; } for (i = 0; i < numLevels; i++) { StoreLevelShuffle (shuffledTable[i].level, shuffledTable[i].key.value); } SaveLevelConfig (); qsort (shuffledTable, numLevels, sizeof (LevelTable), CompareShuffle); indexShuffled = 0; } /* ReshuffleLevels */ /* * get next level from table */ static XBAtom GetNextLevelFromTable (const LevelTable * table, int *pIndex, XBAtom entry, void (*pFunc) (void)) { int numLevels; XBAtom atom; assert (pIndex != NULL); assert (pFunc != NULL); numLevels = GetNumLevels (); /* unmark last level */ if (*pIndex < numLevels) { SetLevelWasLast (table[*pIndex].level, entry, XBFalse); } /* find next level to play */ do { *pIndex = *pIndex + 1; if (*pIndex >= numLevels) { (*pFunc) (); *pIndex = 0; } assert (table != NULL); /* get level */ atom = table[*pIndex].level; assert (ATOM_INVALID != atom); /* check game mode */ } while (gameMode != (gameMode & GetLevelGameMode (atom)) || (!allLevels && !GetLevelSelected (atom))); /* mark as last level */ SetLevelWasLast (atom, entry, XBTrue); StoreLevelTime (timeTable[*pIndex].level, time (NULL)); /* that's all */ return atom; } /* GetNextLevelFromTable */ /* * get next level from table, variant */ static XBAtom GetNextLevelFromTable2 (LevelTable * table, int *pIndex, XBAtom entry, void (*pFunc) (void)) { int numLevels; int i, l, cnt; time_t t0, t1; XBAtom atom = ATOM_INVALID; assert (pIndex != NULL); assert (pFunc != NULL); numLevels = GetNumLevels (); /* find time interval for selected levels matching gamemode */ t0 = 0; t1 = 0; cnt = 0; for (i = 0; i < numLevels; i++) { atom = table[i].level; assert (ATOM_INVALID != atom); if (gameMode == (gameMode & GetLevelGameMode (atom)) && (allLevels || GetLevelSelected (atom))) { if (cnt == 0) { t0 = table[i].key.lastplayed; t1 = t0; } else { if (table[i].key.lastplayed < t0) { t0 = table[i].key.lastplayed; } if (table[i].key.lastplayed > t1) { t1 = table[i].key.lastplayed; } } cnt++; } } Dbg_Level ("There are %i selected levels between [%s", cnt, DateString (t0)); Dbg_Level (", %s]\n", DateString (t1)); assert (cnt > 0); /* look at oldest tenth of time interval */ t1 = t0 + (t1 - t0) / 10; Dbg_Level ("Finding those between [%s", DateString (t0)); Dbg_Level (", %s]\n", DateString (t1)); cnt = 0; for (i = 0; i < numLevels; i++) { atom = table[i].level; assert (ATOM_INVALID != atom); if (gameMode == (gameMode & GetLevelGameMode (atom)) && (allLevels || GetLevelSelected (atom))) { if (table[i].key.lastplayed <= t1) { cnt++; } } } Dbg_Level ("There were %i levels found between [%s", cnt, DateString (t0)); Dbg_Level (", %s]\n", DateString (t1)); assert (cnt > 0); /* choose a random level of those */ l = GameRandomNumber (cnt) + 1; Dbg_Level ("The %ith of %i levels was chosen\n", l, cnt); /* find it in table */ i = 0; while ((i < numLevels) && (l > 0)) { atom = table[i].level; assert (ATOM_INVALID != atom); if (gameMode == (gameMode & GetLevelGameMode (atom)) && (allLevels || GetLevelSelected (atom)) && (table[i].key.lastplayed <= t1)) { l--; } i++; } assert (l == 0); /* update level time */ *pIndex = i - 1; t0 = table[*pIndex].key.lastplayed; Dbg_Level ("Lastplayed time of level %s to %s\n", GetLevelNameByAtom (timeTable[*pIndex].level), DateString (t0)); t0 = time (NULL); table[*pIndex].key.lastplayed = t0; Dbg_Level ("Set lastplayed time of level %s to %s\n", GetLevelNameByAtom (timeTable[*pIndex].level), DateString (t0)); StoreLevelTime (timeTable[*pIndex].level, timeTable[*pIndex].key.lastplayed); DB_Store (dbLevel); /* that's all */ return atom; } /* GetNextLevelFromTable2 */ #if 0 /* * convert level section to iob */ static XBTeleIOB SectionToIOB (XBAtom atom) { if (GUI_CompareAtoms (atom, atomInfo)) { return IOB_INFO; } else if (GUI_CompareAtoms (atom, atomPlayer)) { return IOB_PLAYER; } else if (GUI_CompareAtoms (atom, atomShrink)) { return IOB_SHRINK; } else if (GUI_CompareAtoms (atom, atomScrambleDraw)) { return IOB_SCRAMBLE_DRAW; } else if (GUI_CompareAtoms (atom, atomScrambleDel)) { return IOB_SCRAMBLE_DEL; } else if (GUI_CompareAtoms (atom, atomFunc)) { return IOB_FUNC; } else if (GUI_CompareAtoms (atom, atomBombs)) { return IOB_BOMBS; } else if (GUI_CompareAtoms (atom, atomGraphics)) { return IOB_GRAPHICS; } else if (GUI_CompareAtoms (atom, atomMap)) { return IOB_MAP; } return IOB_INVALID; } /* SectionToIOB */ #endif /* * convert iob to level section */ static XBAtom IOBToSection (XBTeleIOB iob) { switch (iob) { case IOB_INFO: return atomInfo; case IOB_PLAYER: return atomPlayer; case IOB_SHRINK: return atomShrink; case IOB_SCRAMBLE_DRAW: return atomScrambleDraw; case IOB_SCRAMBLE_DEL: return atomScrambleDel; case IOB_FUNC: return atomFunc; case IOB_BOMBS: return atomBombs; case IOB_GRAPHICS: return atomGraphics; case IOB_MAP: return atomMap; default: return ATOM_INVALID; } } /* IOBToSection */ /******************* * shared routines * *******************/ /* * load all level info into database */ void LoadLevelConfig (void) { #ifdef DEBUG Dbg_StartClock (); #endif /* create empty level database */ dbLevel = DB_Create (DT_Config, atomLevel); assert (dbLevel != NULL); /* scan search paths */ Dbg_Config ("loading list of levels\n"); if (DB_LoadDir (dbLevel, GAME_DATADIR "/level", "xal", DT_Level, atomTime, atomInfo, InsertLevel, XBTrue)) { SaveLevelConfig (); } else { Dbg_Config ("no changes found!\n"); } Dbg_Out ("init levels: %lu msec\n", Dbg_FinishClock ()); } /* LoadLevelConfig */ /* * save level info from database to files */ void SaveLevelConfig (void) { assert (dbLevel != NULL); if (DB_Changed (dbLevel)) { Dbg_Config ("saving level list!\n"); DB_Store (dbLevel); } } /* SaveLevelConfig */ /* * clear local level databases */ void FinishLevelConfig (void) { DB_Delete (dbLevel); if (NULL != sortedTable) { free (sortedTable); sortedTable = NULL; } if (NULL != shuffledTable) { free (shuffledTable); shuffledTable = NULL; } if (NULL != timeTable) { free (timeTable); timeTable = NULL; } if (NULL != levelRemote) { DB_Delete (levelRemote); levelRemote = NULL; } if (NULL != levelLocal) { DB_Delete (levelLocal); levelLocal = NULL; } Dbg_Config ("level config clear!\n"); } /* FinishLevelConfig */ /* * number of level info's in database */ int GetNumLevels (void) { return DB_NumSections (dbLevel); } /* GetNumLevels */ /* * get atom for level section with given index */ XBAtom GetLevelAtom (int index) { return DB_IndexSection (dbLevel, index); } /* GetLevelAtom */ /* * get name of level from level atom */ const char * GetLevelNameByAtom (XBAtom level) { return GetLevelStringByAtom (level, atomName); } /* GetLevelName */ /* * return selection flag for current level, given section */ XBBool GetLevelSelected (XBAtom level) { XBBool selected; const DBSection *section; assert (dbLevel != NULL); section = DB_GetSection (dbLevel, level); if (NULL == section) { return XBFalse; } if (!DB_GetEntryBool (section, atomSelect, &selected)) { return XBTrue; } return selected; } /* GetLevelSelected */ /* * set selection flag for given level, given section */ void StoreLevelSelected (XBAtom atom, XBBool select) { DBSection *section; assert (NULL != dbLevel); section = DB_CreateSection (dbLevel, atom); assert (section != NULL); /* we only change data not stored in file */ Dbg_Level ("Level select %s = %d\n", GetLevelNameByAtom (atom), select); (void)DB_CreateEntryBool (section, atomSelect, select); } /* StoreLevelSelection */ /* * load an actual level from file */ const DBRoot * LoadLevelFile (XBAtom atom) { #ifdef DEBUG Dbg_StartClock (); #endif if (NULL != levelLocal) { DB_Delete (levelLocal); } levelLocal = DB_Create (DT_Level, atom); assert (levelLocal != NULL); if (!DB_Load (levelLocal)) { DB_Delete (levelLocal); return NULL; } #ifdef DEBUG Dbg_Out ("load level: %lu msec\n", Dbg_FinishClock ()); #endif return levelLocal; } /* LoadLevelFile */ /* * store level setup locally */ XBBool InitLevels (const CFGGame * cfgGame) { int i; int numSelected; int numLevels; XBAtom level; assert (NULL != cfgGame); /* level order */ randomOrder = cfgGame->setup.randomLevels; levelOrder = cfgGame->setup.levelOrder; allLevels = cfgGame->setup.allLevels; /* game mode selection */ gameMode = 0; /* number of players */ switch (cfgGame->players.num) { #ifdef DEBUG case 1: gameMode |= GM_2_Player; break; #endif case 2: gameMode |= GM_2_Player; break; case 3: gameMode |= GM_3_Player; break; case 4: gameMode |= GM_4_Player; break; case 5: gameMode |= GM_5_Player; break; case 6: gameMode |= GM_6_Player; break; } /* team mode */ gameMode |= GM_Single; /* two players on any one host */ for (i = 0; i + 1 < cfgGame->players.num; i++) { if (cfgGame->players.host[i] == cfgGame->players.host[i + 1]) { gameMode |= GM_LR_Players; } } /* now count levels to play */ numSelected = 0; numLevels = GetNumLevels (); for (i = 0; i < numLevels; i++) { /* get level data */ level = GetLevelAtom (i); assert (ATOM_INVALID != level); /* check game mode */ if (gameMode != (gameMode & GetLevelGameMode (level))) { continue; } /* check selection */ if (!allLevels && !GetLevelSelected (level)) { continue; } numSelected++; } Dbg_Level ("%d levels selected\n", numSelected); /* last levels played ... */ indexSorted = GetLastIndexSorted (); indexShuffled = GetLastIndexShuffled (); indexTime = GetLastIndexTime (); ReshuffleLevels (); return (numSelected != 0); } /* InitLevels */ /* * get next level to play */ XBAtom GetNextLevel (void) { if (levelOrder == 2) { // LRF Dbg_Level ("get next level: shuffled\n"); return GetNextLevelFromTable (shuffledTable, &indexShuffled, atomLevelShuffled, ReshuffleLevels); } else if (levelOrder == 1) { Dbg_Level ("get next level: alfabet\n"); return GetNextLevelFromTable (sortedTable, &indexSorted, atomLevelSorted, ResortLevels); } else { Dbg_Level ("get next level: time based\n"); return GetNextLevelFromTable2 (timeTable, &indexTime, atomLastPlayed, ReTimeLevels); } } /* GetNextLevel */ /* * send level data to host */ void SendLevelConfig (XBSndQueue * queue, XBTeleCOT cot, const DBRoot * level) { XBTeleIOB iob; int j; const DBSection *section; XBTelegram *tele; size_t len; char buffer[256]; /* sanity check */ assert (queue != NULL); assert (level != NULL); /* first send level atom (aka filename) */ len = sprintf (buffer, "%s", GUI_AtomToString (DB_Atom (level))); tele = Net_CreateTelegram (cot, XBT_ID_LevelConfig, IOB_NAME, buffer, len + 1); assert (tele != NULL); Net_SendTelegram (queue, tele); /* iterate sections */ for (iob = 0; iob < NUM_IOBS; iob++) { section = DB_GetSection (level, IOBToSection (iob)); if (NULL != section) { /* iterate entries */ j = 0; while (0 < (len = DB_PrintEntry (buffer, section, j))) { tele = Net_CreateTelegram (cot, XBT_ID_LevelConfig, iob, buffer, len + 1); assert (tele != NULL); Net_SendTelegram (queue, tele); j++; } } } /* no data means end of section */ tele = Net_CreateTelegram (cot, XBT_ID_LevelConfig, iob, NULL, 0); assert (tele != NULL); Net_SendTelegram (queue, tele); } /* SendLevelConfig */ /* * clear remote level config */ void ClearRemoteLevelConfig (void) { XBTeleIOB iob; if (NULL != levelRemote) { DB_Delete (levelRemote); } levelRemote = DB_Create (DT_Level, atomRemote); for (iob = 0; iob < NUM_IOBS; iob++) { (void)DB_CreateSection (levelRemote, IOBToSection (iob)); } } /* ClearRemoteLevelConfig */ /* * add new line to remote level config */ void AddToRemoteLevelConfig (unsigned iob, const char *data) { XBAtom atom; DBSection *section; assert (levelRemote != NULL); if (IOB_NAME == iob) { /* level names received */ DB_SetAtom (levelRemote, GUI_StringToAtom (data)); Dbg_Out ("set remote level file to \"%s\"\n", data); } else { /* possible part of level section */ atom = IOBToSection (iob); if (ATOM_INVALID != atom) { /* create new section */ section = DB_CreateSection (levelRemote, atom); assert (NULL != section); /* add line */ (void)DB_ParseEntry (section, data); } } } /* AddToRemoteLevelConfig */ /* * check local level for version (server) */ XBBool CheckLocalLevelConfig (void) { assert (levelLocal != NULL); return CheckAnyLevelConfig (levelLocal); } /* CheckLocalLevelConfig */ /* * check remote level for version (client) */ XBBool CheckRemoteLevelConfig (void) { assert (levelRemote != NULL); return CheckAnyLevelConfig (levelRemote); } /* CheckRemoteLevelConfig */ /* * check if received level is okay * accept all levels without warnings * warnings: * - unknown features * - incompatible server/client versions for some feature */ XBBool CheckAnyLevelConfig (const DBRoot * level) { if (!ParseLevel (level)) { return XBFalse; } if (GetWarningCount () > 0) { return XBFalse; } return XBTrue; } /* CheckAnyLevelConfig */ /* * check all levels in database */ XBBool CheckAllLevelConfigs (void) { XBAtom atom; const DBRoot *lvl; indexTime = GetLastIndexTime (); indexSorted = GetLastIndexSorted (); indexSorted = 0; do { Dbg_Out ("-------- %i ---------\n", indexSorted); atom = GetNextLevelFromTable (sortedTable, &indexSorted, atomLevelSorted, ResortLevels); Dbg_Out ("+++LEVEL+++ current = %s(%s)!\n", GUI_AtomToString (atom), GetLevelNameByAtom (atom)); lvl = LoadLevelFile (atom); if (!ParseLevel (lvl)) { Dbg_Out ("+++LEVEL+++ Parse failed!\n"); DB_Dump (lvl); return XBFalse; } } while (indexSorted > 0); return XBTrue; } /* CheckAllLevelConfigs */ /* * retrieve remote level config */ const DBRoot * GetRemoteLevelConfig (void) { return levelRemote; } /* GetRemoteLevelConfig */ /* * end of file cfg_level.c */ xblast-2.10.4/cfg_level.h0000644000175000017500000000511610372731123014311 0ustar rhondaalfie/* * cfg_level.c - managing level data * * $Id: cfg_level.h,v 1.11 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CFG_LEVEL_H #define _CFG_LEVEL_H /* * game mode flags for levels */ #define GM_Random (1<<0) #define GM_2_Player (1<<1) #define GM_3_Player (1<<2) #define GM_4_Player (1<<3) #define GM_5_Player (1<<4) #define GM_6_Player (1<<5) #define GM_Single (1<<6) #define GM_Team (1<<7) #define GM_Double (1<<8) #define GM_LR_Players (1<<9) #define GM_234_Player (GM_2_Player|GM_3_Player|GM_4_Player) #define GM_2456_Player (GM_2_Player|GM_4_Player|GM_5_Player|GM_6_Player) #define GM_2345_Player (GM_234_Player|GM_5_Player) #define GM_23456_Player (GM_2345_Player|GM_6_Player) #define GM_All (GM_Single|GM_Team|GM_Double|GM_LR_Players) #define GM_SinglePlayer (GM_Single|GM_Team|GM_Double) #define NUM_GM 11 /* * function prototypes */ extern void LoadLevelConfig (void); extern void SaveLevelConfig (void); extern void FinishLevelConfig (void); extern int GetNumLevels (void); extern XBAtom GetLevelAtom (int index); extern const char *GetLevelNameByAtom (XBAtom atom); extern XBBool GetLevelSelected (XBAtom atom); extern void StoreLevelSelected (XBAtom atom, XBBool value); extern XBBool InitLevels (const CFGGame *); extern XBAtom GetNextLevel (void); extern const DBRoot *LoadLevelFile (XBAtom atom); extern void SendLevelConfig (XBSndQueue * queue, XBTeleCOT cot, const DBRoot * level); extern void ClearRemoteLevelConfig (void); extern void AddToRemoteLevelConfig (unsigned iob, const char *data); extern XBBool CheckLocalLevelConfig (void); extern XBBool CheckRemoteLevelConfig (void); extern XBBool CheckAnyLevelConfig (const DBRoot *); extern XBBool CheckAllLevelConfigs (void); extern const DBRoot *GetRemoteLevelConfig (void); #endif /* * end of file cfg_level.h */ xblast-2.10.4/cfg_main.c0000644000175000017500000000357010372731123014123 0ustar rhondaalfie/* * cfg_main.c - managing configuration files * * $Id: cfg_main.c,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * load all configurations */ void InitConfig (void) { GUI_InitAtoms (); InitDefaultAtoms (); /* load databases */ LoadXBlastConfig (); LoadDemoConfig (); LoadPlayerConfig (); LoadGameConfig (); LoadLevelConfig (); LoadControlConfig (); LoadStatConfig (); GUI_LoadConfig (); } /* InitConfig */ /* * store all configurations */ void SaveConfig (void) { SaveXBlastConfig (); SaveDemoConfig (); SavePlayerConfig (); SaveGameConfig (); SaveLevelConfig (); SaveControlConfig (); SaveStatConfig (); GUI_SaveConfig (); } /* FinishConfig */ /* * check configurations */ XBBool CheckConfig (void) { return CheckAllLevelConfigs (); } /* CheckConfig */ /* * store all configurations */ void FinishConfig (void) { FinishXBlastConfig (); FinishDemoConfig (); FinishPlayerConfig (); FinishGameConfig (); FinishLevelConfig (); FinishControlConfig (); FinishStatConfig (); GUI_FinishConfig (); } /* FinishConfig */ /* * end of file cfg_main.c */ xblast-2.10.4/cfg_main.h0000644000175000017500000000234010372731123014122 0ustar rhondaalfie/* * cfg_main.h - managing configuration files * * $Id: cfg_main.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CFG_MAIN_H #define XBLAST_CFG_MAIN_H /* * global types */ typedef enum { CT_Local = 0, CT_Remote, CT_Demo, CT_Central, NUM_CT } CFGType; /* * global prototypes */ extern void InitConfig (void); extern void SaveConfig (void); extern XBBool CheckConfig (void); extern void FinishConfig (void); #endif /* * end of file cfg_main.h */ xblast-2.10.4/cfg_player.c0000644000175000017500000006666410443243504014510 0ustar rhondaalfie/* * cfg_player.c - player configuration data * * $Id: cfg_player.c,v 1.15 2006/06/12 10:51:48 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * global variables */ static const char *defaultShape[NUM_DEFAULT_PLAYERS] = { "normal", "normal", "normal", "fat", "girl", "tall", }; static CFGPlayerGraphics defaultPlayerGraphics[NUM_DEFAULT_PLAYERS] = { { ATOM_INVALID, COLOR_TURQUOISE, COLOR_LIGHT_SALMON, COLOR_WHITE, COLOR_GRAY_75, COLOR_GRAY_25, COLOR_ROYAL_BLUE, COLOR_WHITE, }, { ATOM_INVALID, COLOR_MIDNIGHT_BLUE, COLOR_LIGHT_SALMON, COLOR_NAVY_BLUE, COLOR_RED, COLOR_ROYAL_BLUE, COLOR_GOLD, COLOR_WHITE, }, { ATOM_INVALID, COLOR_RED, COLOR_LIGHT_SALMON, COLOR_RED, COLOR_FOREST_GREEN, COLOR_INDIAN_RED, COLOR_DARK_SEA_GREEN, COLOR_WHITE, }, { ATOM_INVALID, COLOR_YELLOW, COLOR_LIGHT_SALMON, COLOR_SPRING_GREEN, COLOR_ORANGE_RED, COLOR_LIGHT_YELLOW, COLOR_ROYAL_BLUE, COLOR_WHITE, }, { ATOM_INVALID, COLOR_DEEP_PINK, COLOR_LIGHT_SALMON, COLOR_ORCHID, COLOR_SPRING_GREEN, COLOR_ROYAL_BLUE, COLOR_DEEP_PINK, COLOR_WHITE, }, { ATOM_INVALID, COLOR_BLACK, COLOR_TAN, COLOR_BLACK, COLOR_ORANGE, COLOR_BLACK, COLOR_ORANGE, COLOR_WHITE, }, }; static const char *administratorShape = "normal"; static CFGPlayerGraphics administratorPlayerGraphics = { ATOM_INVALID, COLOR_TURQUOISE, COLOR_LIGHT_SALMON, COLOR_WHITE, COLOR_GRAY_75, COLOR_GRAY_25, COLOR_ROYAL_BLUE, COLOR_WHITE, }; /* * local variables */ static DBRoot *dbLocal = NULL; static DBRoot *dbRemote = NULL; static DBRoot *dbCentral = NULL; // XBCC central database XBBool isCentral; /* default values for new or empty configs */ static CFGPlayerGraphics newGfx = { ATOM_INVALID, COLOR_WHITE, COLOR_LIGHT_SALMON, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, }; static CFGPlayerMessages newMsg = { NULL, NULL, NULL, NULL, NULL, NULL, }; static CFGPlayerMisc newMisc = { XBTrue, 0, 4, }; static CFGPlayerID newID = { -1, NULL }; /* names for default players */ static const char *defaultName[NUM_DEFAULT_PLAYERS] = { "Olli", "Norbert", "Rodi", "Harald", "Alex", "Olaf", }; /* XBCC values for administrator config */ static CFGPlayerMessages administratorMsg = { NULL, NULL, NULL, NULL, NULL, "Welcome", }; static CFGPlayerMisc administratorMisc = { XBTrue, 0, 4, }; static CFGPlayerID administratorID = { 0, "adminpass", }; static CFGPlayerRating newRating = { 0.0, 0, 0, 0, 0, 0, }; static const char *administratorName = "Administrator"; /* * convert type to database */ static DBRoot * GetDB (CFGType cfgType) { switch (cfgType) { case CT_Local: return dbLocal; case CT_Remote: return dbRemote; case CT_Demo: return dbDemo; case CT_Central: return dbCentral; default: return NULL; } } /* GetDB */ /* * */ const CFGPlayerGraphics * DefaultPlayerGraphics (size_t i) { assert (i < NUM_DEFAULT_PLAYERS); if (ATOM_INVALID == defaultPlayerGraphics[i].shape) { defaultPlayerGraphics[i].shape = GUI_StringToAtom (defaultShape[i]); } return defaultPlayerGraphics + i; } /* DefaultPlayerGraphics */ /* * XBCC */ static const CFGPlayerGraphics * AdministratorPlayerGraphics (void) { if (ATOM_INVALID == administratorPlayerGraphics.shape) { administratorPlayerGraphics.shape = GUI_StringToAtom (administratorShape); } return &administratorPlayerGraphics; } /* AdministratorPlayerGraphics */ /* * */ static void StoreAnyPlayerName (DBRoot * db, XBAtom atom, const char *name) { DBSection *section; assert (name != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); /* graphics */ DB_CreateEntryString (section, atomName, name); } /* StorePlayerName */ /* * */ static void StorePlayerName (CFGType cfgType, XBAtom atom, const char *name) { StoreAnyPlayerName (GetDB (cfgType), atom, name); } /* StoreLocalPlayerName */ /* * */ static void StoreAnyPlayerGraphics (DBRoot * db, XBAtom atom, const CFGPlayerGraphics * gfx) { DBSection *section; assert (db != NULL); assert (gfx != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); /* graphics */ (void)DB_CreateEntryAtom (section, atomShape, gfx->shape); (void)DB_CreateEntryColor (section, atomHelmet, gfx->helmet); (void)DB_CreateEntryColor (section, atomFace, gfx->face); (void)DB_CreateEntryColor (section, atomBody, gfx->body); (void)DB_CreateEntryColor (section, atomArmsLegs, gfx->armsLegs); (void)DB_CreateEntryColor (section, atomHandsFeet, gfx->handsFeet); (void)DB_CreateEntryColor (section, atomBackpack, gfx->backpack); } /* StorePlayerGraphics */ /* * */ void StorePlayerGraphics (CFGType cfgType, XBAtom atom, const CFGPlayerGraphics * gfx) { StoreAnyPlayerGraphics (GetDB (cfgType), atom, gfx); } /* StoreLocalPlayerGraphics */ /* * */ static XBBool RetrieveAnyPlayerGraphics (const DBRoot * db, XBAtom atom, XBColor teamColor, CFGPlayerGraphics * gfx) { const DBSection *section; assert (db != NULL); assert (gfx != NULL); /* set to defaults */ *gfx = newGfx; /* find section for player */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } (void)DB_GetEntryAtom (section, atomShape, &gfx->shape); (void)DB_GetEntryColor (section, atomHelmet, &gfx->helmet); (void)DB_GetEntryColor (section, atomFace, &gfx->face); (void)DB_GetEntryColor (section, atomBody, &gfx->body); (void)DB_GetEntryColor (section, atomArmsLegs, &gfx->armsLegs); (void)DB_GetEntryColor (section, atomHandsFeet, &gfx->handsFeet); (void)DB_GetEntryColor (section, atomBackpack, &gfx->backpack); /* set white color */ gfx->white = COLOR_WHITE; /* save original colors */ gfx->bodySave = gfx->body; gfx->handsFeetSave = gfx->handsFeet; /* set team colors */ if (teamColor != COLOR_INVALID) { /* KOEN */ /* gfx->helmet = teamColor; */ gfx->body = teamColor; gfx->handsFeet = teamColor; } /* that's all */ return XBTrue; } /* RetrievePlayerGraphics */ /* * retrieve indexed player graphics */ XBBool RetrievePlayerGraphics (CFGType cfgType, XBAtom atom, XBColor teamColor, CFGPlayerGraphics * gfx) { return RetrieveAnyPlayerGraphics (GetDB (cfgType), atom, teamColor, gfx); } /* RetrievePlayerGraphics */ /* * store a signle message */ static void StoreMessage (DBSection * section, XBAtom atom, const char *text) { if (NULL != text) { DB_CreateEntryString (section, atom, text); } else { DB_DeleteEntry (section, atom); } } /* StoreMessage */ /* * */ static void StoreAnyPlayerMessages (DBRoot * db, XBAtom atom, const CFGPlayerMessages * msg) { DBSection *section; assert (db != NULL); assert (ATOM_INVALID != atom); assert (msg != NULL); section = DB_CreateSection (db, atom); assert (section != NULL); /* messages */ StoreMessage (section, atomMsgWinLevel, msg->msgWinLevel); StoreMessage (section, atomMsgWinGame, msg->msgWinGame); StoreMessage (section, atomMsgLoseLife, msg->msgLoseLife); StoreMessage (section, atomMsgLoseLevel, msg->msgLoseLevel); StoreMessage (section, atomMsgGloat, msg->msgGloat); StoreMessage (section, atomMsgLaola, msg->msgLaola); StoreMessage (section, atomMsgLoser, msg->msgLoser); StoreMessage (section, atomMsgWelcome, msg->msgWelcome); } /* StorePlayerMessages */ /* * */ void StorePlayerMessages (CFGType cfgType, XBAtom atom, const CFGPlayerMessages * msg) { StoreAnyPlayerMessages (GetDB (cfgType), atom, msg); } /* StoreLocalPlayerMessages */ /* * */ static XBBool RetrieveAnyPlayerMessages (const DBRoot * db, XBAtom atom, CFGPlayerMessages * msg) { const DBSection *section; assert (db != NULL); assert (msg != NULL); /* set to defaults */ *msg = newMsg; /* find section for player */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } (void)DB_GetEntryString (section, atomMsgWinLevel, &msg->msgWinLevel); (void)DB_GetEntryString (section, atomMsgWinGame, &msg->msgWinGame); (void)DB_GetEntryString (section, atomMsgLoseLife, &msg->msgLoseLife); (void)DB_GetEntryString (section, atomMsgLoseLevel, &msg->msgLoseLevel); (void)DB_GetEntryString (section, atomMsgGloat, &msg->msgGloat); (void)DB_GetEntryString (section, atomMsgLaola, &msg->msgLaola); (void)DB_GetEntryString (section, atomMsgLoser, &msg->msgLoser); (void)DB_GetEntryString (section, atomMsgWelcome, &msg->msgWelcome); /* that's all */ return XBTrue; } /* RetrievePlayerMessages */ /* * retrieve messages for local players */ XBBool RetrievePlayerMessages (CFGType cfgType, XBAtom atom, CFGPlayerMessages * msg) { return RetrieveAnyPlayerMessages (GetDB (cfgType), atom, msg); } /* RetrievePlayerMessages */ /* * store misc player options */ static void StoreAnyPlayerMisc (DBRoot * db, XBAtom atom, const CFGPlayerMisc * misc) { DBSection *section; assert (db != NULL); assert (misc != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); /* store data */ DB_CreateEntryBool (section, atomUseStopKey, misc->useStopKey); DB_CreateEntryInt (section, atomTurnStepKeyboard, misc->turnStepKeyboard); DB_CreateEntryInt (section, atomTurnStepJoystick, misc->turnStepJoystick); } /* StorePlayerMisc */ /* * store misc player options */ void StorePlayerMisc (CFGType cfgType, XBAtom atom, const CFGPlayerMisc * misc) { StoreAnyPlayerMisc (GetDB (cfgType), atom, misc); } /* StoreLocalPlayerMisc */ /* * retrive misc player data */ static XBBool RetrieveAnyPlayerMisc (const DBRoot * db, XBAtom atom, CFGPlayerMisc * misc) { const DBSection *section; assert (db != NULL); assert (misc != NULL); /* set default values */ *misc = newMisc; /* find section for player */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* store data */ (void)DB_GetEntryBool (section, atomUseStopKey, &misc->useStopKey); (void)DB_GetEntryInt (section, atomTurnStepKeyboard, &misc->turnStepKeyboard); (void)DB_GetEntryInt (section, atomTurnStepJoystick, &misc->turnStepJoystick); return XBTrue; } /* RetrievePlayerMisc */ /* * retrieve misc player data */ XBBool RetrievePlayerMisc (CFGType cfgType, XBAtom atom, CFGPlayerMisc * misc) { return RetrieveAnyPlayerMisc (GetDB (cfgType), atom, misc); } /* RetrieveLocalPlayerMisc */ /* * save player config at once */ void StorePlayer (CFGType cfgType, XBAtom atom, const CFGPlayer * cfg) { assert (NULL != cfg); StorePlayerGraphics (cfgType, atom, &cfg->graphics); StorePlayerMessages (cfgType, atom, &cfg->messages); StorePlayerMisc (cfgType, atom, &cfg->misc); StorePlayerID (cfgType, atom, &cfg->id); StorePlayerName (cfgType, atom, cfg->name); } /* StorePlayer */ /* * load player config at once */ XBBool RetrievePlayer (CFGType cfgType, XBAtom atom, XBColor color, CFGPlayer * cfg) { XBBool result = XBTrue; assert (NULL != cfg); if (!RetrievePlayerGraphics (cfgType, atom, color, &cfg->graphics)) { result = XBFalse; } if (!RetrievePlayerMessages (cfgType, atom, &cfg->messages)) { result = XBFalse; } if (!RetrievePlayerMisc (cfgType, atom, &cfg->misc)) { result = XBFalse; } if (!RetrievePlayerID (cfgType, atom, &cfg->id)) { result = XBFalse; } cfg->name = GetPlayerName (cfgType, atom); return result; } /* RetrievePlayer */ /* * load player config at once */ XBBool RetrievePlayerEx (CFGType cfgType, XBAtom atom, CFGPlayerEx * cfg) { XBBool result = XBTrue; assert (NULL != cfg); if (!RetrievePlayerGraphics (cfgType, atom, COLOR_INVALID, &cfg->graphics)) { result = XBFalse; } if (!RetrievePlayerMessages (cfgType, atom, &cfg->messages)) { result = XBFalse; } if (!RetrievePlayerMisc (cfgType, atom, &cfg->misc)) { result = XBFalse; } if (!RetrievePlayerID (cfgType, atom, &cfg->id)) { result = XBFalse; } if (!RetrievePlayerRating (cfgType, atom, &cfg->rating)) { result = XBFalse; } cfg->name = GetPlayerName (cfgType, atom); return result; } /* RetrievePlayerEx */ /* * XBCC save player EX config at once */ void StorePlayerEx (CFGType cfgType, XBAtom atom, const CFGPlayerEx * cfg) { assert (NULL != cfg); StorePlayerGraphics (cfgType, atom, &cfg->graphics); StorePlayerMessages (cfgType, atom, &cfg->messages); StorePlayerMisc (cfgType, atom, &cfg->misc); StorePlayerID (cfgType, atom, &cfg->id); StorePlayerRating (cfgType, atom, &cfg->rating); StorePlayerName (cfgType, atom, cfg->name); } /* StorePlayerEx */ /* * init and load player config */ void LoadPlayerConfig (void) { int i; XBAtom atom; /* set default values */ newGfx.shape = GUI_StringToAtom ("normal"); /* initialize remote databse */ dbRemote = DB_Create (DT_Config, atomRemotePlayer); assert (dbRemote != NULL); /* initialiaze config database */ dbLocal = DB_Create (DT_Config, atomPlayer); assert (dbLocal != NULL); Dbg_Config ("loading local player configs\n"); if (DB_Load (dbLocal)) { return; } Dbg_Config ("failed to load player config, setting defaults\n"); /* set some useful default values */ for (i = 0; i < NUM_DEFAULT_PLAYERS; i++) { atom = GUI_StringToAtom (defaultName[i]); StorePlayerName (CT_Local, atom, defaultName[i]); StorePlayerGraphics (CT_Local, atom, DefaultPlayerGraphics (i)); StorePlayerMisc (CT_Local, atom, &newMisc); StorePlayerMessages (CT_Local, atom, &newMsg); StorePlayerID (CT_Local, atom, &newID); } DB_Store (dbLocal); } /* InitPlayerConfig */ /* * finish player config */ void SavePlayerConfig (void) { assert (dbLocal != NULL); if (DB_Changed (dbLocal)) { Dbg_Config ("saving local player configs\n"); DB_Store (dbLocal); } #ifdef DEBUG assert (dbRemote != NULL); if (DB_Changed (dbRemote)) { Dbg_Config ("saving remote player configs\n"); DB_Store (dbRemote); } #endif } /* SavePlayerConfig */ /* * */ void FinishPlayerConfig (void) { if (NULL != dbLocal) { DB_Delete (dbLocal); dbLocal = NULL; } if (NULL != dbRemote) { DB_Delete (dbRemote); dbRemote = NULL; } Dbg_Config ("player configs cleared\n"); } /* FinishPlayerConfig */ /* * XBCC init and load player central statistics */ void LoadPlayerCentral (XBBool amCentral) { XBAtom atom; isCentral = amCentral; /* set default values */ newGfx.shape = GUI_StringToAtom ("normal"); if (amCentral) { /* initialiaze config database */ dbCentral = DB_Create (DT_Central, atomCentralLocal); } else { /* initialize remote databse */ dbCentral = DB_Create (DT_Central, atomCentralRemote); } assert (dbCentral != NULL); if (DB_Load (dbCentral)) { return; } /* set administrator defaults */ if (amCentral) { atom = GUI_IntToAtom (administratorID.PID); StorePlayerName (CT_Central, atom, administratorName); StorePlayerGraphics (CT_Central, atom, AdministratorPlayerGraphics ()); StorePlayerMisc (CT_Central, atom, &administratorMisc); StorePlayerMessages (CT_Central, atom, &administratorMsg); StorePlayerID (CT_Central, atom, &administratorID); StorePlayerRating (CT_Central, atom, &newRating); } DB_Store (dbCentral); } /* InitPlayerConfig */ /* * finish player config */ void SavePlayerCentral (void) { assert (dbCentral != NULL); if (DB_Changed (dbCentral)) { DB_Store (dbCentral); } } /* SavePlayerConfig */ /* * */ void FinishPlayerCentral (void) { if (NULL != dbCentral) { DB_Delete (dbCentral); dbCentral = NULL; } } /* FinishPlayerCentral */ void RemoveAllPlayers (CFGType cfgType) { DB_DeleteAll (GetDB (cfgType)); } /* * get number of configs stored */ int GetNumPlayerConfigs (CFGType cfgType) { return DB_NumSections (GetDB (cfgType)); } /* GetNumPlayerConfigs */ /* * index atoms for player config */ XBAtom GetPlayerAtom (CFGType cfgType, int i) { return DB_IndexSection (GetDB (cfgType), i); } /* GetPlayerConfigName */ /* * get name of player */ static const char * GetAnyPlayerName (DBRoot * db, XBAtom atom) { const DBSection *section; const char *s; assert (NULL != db); /*---*/ section = DB_GetSection (db, atom); if (NULL == section) { return NULL; } while (!DB_GetEntryString (section, atomName, &s)) { const char *name = GUI_AtomToString (atom); DB_CreateEntryString (DB_CreateSection (db, atom), atomName, name); } return s; } /* GetPlayerName */ /* * get name of player */ const char * GetPlayerName (CFGType cfgType, XBAtom atom) { return GetAnyPlayerName (GetDB (cfgType), atom); } /* GetLocalPlayerName */ /* * search player names for newplayer name */ int FindDoubleName (CFGType cfgType, XBAtom newplayer) { XBAtom atom; const char *cmp; int j; cmp = GetPlayerName (cfgType, newplayer); for (j = 0; j < GetNumPlayerConfigs (cfgType); j++) { atom = GetPlayerAtom (cfgType, j); if (atom != newplayer) { if (0 == strcmp (cmp, GetPlayerName (cfgType, atom))) { return (j); } } } return (-1); } /* FindDoubleName */ /* * XBCC */ static void StoreAnyPlayerID (DBRoot * db, XBAtom atom, const CFGPlayerID * id) { DBSection *section; assert (db != NULL); assert (id != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); /* graphics */ StoreMessage (section, atomPass, id->pass); (void)DB_CreateEntryInt (section, atomPID, id->PID); } /* StorePlayerGraphics */ /* * */ void StorePlayerID (CFGType cfgType, XBAtom atom, const CFGPlayerID * id) { StoreAnyPlayerID (GetDB (cfgType), atom, id); } /* StoreLocalPlayerGraphics */ /* * */ static XBBool RetrieveAnyPlayerID (const DBRoot * db, XBAtom atom, CFGPlayerID * id) { const DBSection *section; assert (db != NULL); assert (id != NULL); /* set to defaults */ *id = newID; /* find section for player */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* set default PID to invalid */ id->PID = -1; (void)DB_GetEntryString (section, atomPass, &id->pass); (void)DB_GetEntryInt (section, atomPID, &id->PID); /* that's all */ return XBTrue; } /* RetrievePlayerMessages */ /* * retrieve messages for local players */ XBBool RetrievePlayerID (CFGType cfgType, XBAtom atom, CFGPlayerID * id) { return RetrieveAnyPlayerID (GetDB (cfgType), atom, id); } /* RetrievePlayerMessages */ /* * XBCC rating */ static void StoreAnyPlayerRating (DBRoot * db, XBAtom atom, const CFGPlayerRating * rating) { DBSection *section; assert (db != NULL); assert (rating != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); /* graphics */ (void)DB_CreateEntryFloat (section, atomXBCCRating, rating->rating); (void)DB_CreateEntryInt (section, atomXBCCGamesPlayed, rating->gamesPlayed); (void)DB_CreateEntryInt (section, atomXBCCRealWins, rating->realWins); (void)DB_CreateEntryInt (section, atomXBCCRelativeWins, rating->relativeWins); (void)DB_CreateEntryTime (section, atomXBCCTimeUpdate, rating->timeUpdate); (void)DB_CreateEntryTime (section, atomXBCCTimeRegister, rating->timeRegister); } /* StorePlayerRating */ /* * */ void StorePlayerRating (CFGType cfgType, XBAtom atom, const CFGPlayerRating * rating) { StoreAnyPlayerRating (GetDB (cfgType), atom, rating); } /* StoreLocalPlayerRating */ /* * */ static XBBool RetrieveAnyPlayerRating (const DBRoot * db, XBAtom atom, CFGPlayerRating * rating) { const DBSection *section; assert (db != NULL); assert (rating != NULL); /* set to defaults */ *rating = newRating; /* find section for player */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } (void)DB_GetEntryFloat (section, atomXBCCRating, &rating->rating); (void)DB_GetEntryInt (section, atomXBCCGamesPlayed, &rating->gamesPlayed); (void)DB_GetEntryInt (section, atomXBCCRealWins, &rating->realWins); (void)DB_GetEntryInt (section, atomXBCCRelativeWins, &rating->relativeWins); (void)DB_GetEntryTime (section, atomXBCCTimeUpdate, &rating->timeUpdate); (void)DB_GetEntryTime (section, atomXBCCTimeRegister, &rating->timeRegister); /* that's all */ return XBTrue; } /* RetrievePlayerRating */ /* * retrieve messages for local players */ XBBool RetrievePlayerRating (CFGType cfgType, XBAtom atom, CFGPlayerRating * rating) { return RetrieveAnyPlayerRating (GetDB (cfgType), atom, rating); } /* RetrievePlayerRating */ /* XBCC */ /* * delete a new player */ void DeletePlayerConfig (CFGType cfgType, XBAtom atom) { DB_DeleteSection (GetDB (cfgType), atom); } /* DeletePlayerConfig */ /* * create new player config */ static XBAtom CreatePlayerConfig (CFGType cfgType, const char *name, const CFGPlayerGraphics * cfgGfx, const CFGPlayerMessages * cfgMsg, const CFGPlayerMisc * cfgMisc, const CFGPlayerID * cfgID) { XBAtom atom; /* sanity checks */ assert (NULL != name); assert (NULL != cfgGfx); assert (NULL != cfgMsg); assert (NULL != cfgMisc); assert (NULL != cfgID); /* convert name to atom */ atom = GUI_StringToAtom (name); assert (ATOM_INVALID != atom); /* look for config with the same name */ if (NULL != GetPlayerName (cfgType, atom) || strlen (name) == 0) { return ATOM_INVALID; } /* create new dataset */ StorePlayerName (cfgType, atom, name); StorePlayerGraphics (cfgType, atom, cfgGfx); StorePlayerMessages (cfgType, atom, cfgMsg); StorePlayerMisc (cfgType, atom, cfgMisc); StorePlayerID (cfgType, atom, cfgID); /* that's all */ return atom; } /* CopyPlayerConfig */ /* * create a new player */ XBAtom CreateNewPlayerConfig (CFGType cfgType, const char *name) { CFGPlayerGraphics cfgGfx = newGfx; /* use random colors */ cfgGfx.helmet = RandomColor (); cfgGfx.body = RandomColor (); cfgGfx.handsFeet = RandomColor (); cfgGfx.armsLegs = RandomColor (); cfgGfx.backpack = RandomColor (); return CreatePlayerConfig (cfgType, name, &cfgGfx, &newMsg, &newMisc, &newID); } /* CreatePlayerConfig */ /* * rename existing player */ XBAtom RenamePlayerConfig (CFGType cfgType, XBAtom atom, const char *name) { CFGPlayer cfgPlayer; XBAtom newAtom; /* sanity check */ assert (atom != ATOM_INVALID); assert (name != NULL); /* retrieve existing player configs */ (void)RetrievePlayer (cfgType, atom, COLOR_INVALID, &cfgPlayer); /* create new player with it */ newAtom = CreatePlayerConfig (cfgType, name, &cfgPlayer.graphics, &cfgPlayer.messages, &cfgPlayer.misc, &cfgPlayer.id); if (newAtom != atom) { if (newAtom != ATOM_INVALID) { /* if successful, delete old entry */ DB_DeleteSection (dbLocal, atom); } return newAtom; } return atom; } /* RenameLocalPlayerConfig */ /* * compare to graphics sets */ XBBool ComparePlayerGraphics (const CFGPlayerGraphics * a, const CFGPlayerGraphics * b) { assert (a != NULL); assert (b != NULL); return (a->shape == b->shape && a->helmet == b->helmet && a->face == b->face && a->body == b->body && a->handsFeet == b->handsFeet && a->armsLegs == b->armsLegs && a->backpack == b->backpack); } /* ComparePlayerGraphics */ /* * put player config into telegram send queue */ static XBBool SendAnyPlayerConfig (const DBRoot * db, XBSndQueue * queue, XBTeleCOT cot, XBTeleIOB iob, XBAtom atom, XBBool toCentral) { const DBSection *section; int i, k, l; size_t len; XBTelegram *tele; char tmp[256]; char pass[256]; assert (db != NULL); assert (queue != NULL); /* get section with player data */ section = DB_GetSection (db, atom); if (NULL == section) { return XBFalse; } /* now print and send data */ i = 0; l = sprintf (pass, "%s", GUI_AtomToString (atomPass)); // XBCC while (0 < (len = DB_PrintEntry (tmp, section, i))) { k = strncmp (pass, tmp, l) == 0; if ((k && toCentral) || !k) { // XBCC only send password to central tele = Net_CreateTelegram (cot, XBT_ID_PlayerConfig, iob, tmp, len + 1); assert (tele != NULL); Net_SendTelegram (queue, tele); } i++; } /* no data means end of section */ tele = Net_CreateTelegram (cot, XBT_ID_PlayerConfig, iob, NULL, 0); assert (tele != NULL); Net_SendTelegram (queue, tele); return XBTrue; } /* SendAnyPlayerConfig */ /* * put player config into telegram send queue */ XBBool SendPlayerConfig (CFGType cfgType, XBSndQueue * queue, XBTeleCOT cot, XBTeleIOB iob, XBAtom atom, XBBool toCentral) { return SendAnyPlayerConfig (GetDB (cfgType), queue, cot, iob, atom, toCentral); } /* SendLocalPlayerConfig */ /* * add entry line to player config */ void AddToPlayerConfig (CFGType cfgType, XBAtom atom, const char *line) { DBRoot *db; DBSection *section; /* sanity check */ assert (ATOM_INVALID != atom); /* get database */ db = GetDB (cfgType); assert (NULL != db); /* create new player section */ section = DB_CreateSection (db, atom); assert (NULL != section); /* add line */ (void)DB_ParseEntry (section, line); } /* AddToPlayerConfig */ /* * XBST Store game results */ static void StoreAnyGameResult (DBRoot * db, XBAtom atom, int k, int *regPl, int *PID, int *Score) // XBST { DBSection *section; int i, j; assert (db != NULL); assert (PID != NULL); assert (Score != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); for (i = 0; i < k; i++) { j = regPl[i]; (void)DB_CreateEntryGameResult (section, GUI_IntToAtom (PID[j]), abs (Score[j])); } } /* StorePlayerRating */ /* * store game result in database */ void StoreGameResult (CFGType cfgType, XBAtom atom, int k, int *regPl, int *PID, int *Score) { // XBST StoreAnyGameResult (GetDB (cfgType), atom, k, regPl, PID, Score); } /* StoreGameResult */ /* * store game result, append to file and delete in database */ void AppendGameResult (CFGType cfgType, XBAtom fname, XBAtom atom, int k, int *regPl, int *PID, int *Score) { /* XBST */ DBRoot *res; res = DB_Create (cfgType, fname); assert (res != NULL); StoreAnyGameResult (res, atom, k, regPl, PID, Score); DB_Append (res); DB_Delete (res); } /* AppendGameResult */ static void StoreAnyTimePlayerRating (DBRoot * db, XBAtom atom, int k, int *regPl, int *PID, float *rating) // XBST { DBSection *section; int i, j; assert (db != NULL); assert (PID != NULL); assert (rating != NULL); assert (ATOM_INVALID != atom); section = DB_CreateSection (db, atom); assert (section != NULL); for (i = 0; i < k; i++) { j = regPl[i]; (void)DB_CreateEntryFloat (section, GUI_IntToAtom (PID[j]), rating[j]); } } /* StorePlayerRating */ /* * store timed player rating to database */ void StoreTimePlayerRating (CFGType cfgType, XBAtom atom, int k, int *regPl, int *PID, float *rating) { // XBST StoreAnyTimePlayerRating (GetDB (cfgType), atom, k, regPl, PID, rating); } /* StoreGameResult */ /* * store timed player rating, append to file and delete in database */ void AppendTimePlayerRating (CFGType cfgType, XBAtom fname, XBAtom atom, int k, int *regPl, int *PID, float *rating) { /* XBST */ DBRoot *res; res = DB_Create (cfgType, fname); assert (res != NULL); StoreAnyTimePlayerRating (res, atom, k, regPl, PID, rating); DB_Append (res); DB_Delete (res); } /* StoreGameResult */ /* * end of file cfg_player.c */ xblast-2.10.4/cfg_player.h0000644000175000017500000001222510372731123014475 0ustar rhondaalfie/* * cfg_player.h - player configuration data * * $Id: cfg_player.h,v 1.10 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CFG_PLAYER_H #define XBLAST_CFG_PLAYER_H /* * macros */ #define NUM_PLAYER_COLORS 7 #define NUM_DEFAULT_PLAYERS 6 /* * type definitions */ /* player graphics */ typedef struct { XBAtom shape; XBColor helmet; XBColor face; XBColor body; XBColor handsFeet; XBColor armsLegs; XBColor backpack; XBColor white; /* needed for convenience */ XBColor bodySave; XBColor handsFeetSave; } CFGPlayerGraphics; /* player messages */ typedef struct { const char *msgWinLevel; const char *msgWinGame; const char *msgLoseLife; const char *msgLoseLevel; const char *msgLaola; const char *msgLoser; const char *msgGloat; const char *msgWelcome; } CFGPlayerMessages; /* misc player options */ typedef struct { XBBool useStopKey; int turnStepKeyboard; int turnStepJoystick; } CFGPlayerMisc; /* player identity */ typedef struct { int PID; const char *pass; } CFGPlayerID; /* player rating */ typedef struct { double rating; int gamesPlayed; int realWins; int relativeWins; time_t timeUpdate; time_t timeRegister; } CFGPlayerRating; /* all in one */ typedef struct { CFGPlayerGraphics graphics; CFGPlayerMessages messages; CFGPlayerMisc misc; CFGPlayerID id; const char *name; } CFGPlayer; /* all in one */ typedef struct { CFGPlayerGraphics graphics; CFGPlayerMessages messages; CFGPlayerMisc misc; CFGPlayerID id; CFGPlayerRating rating; const char *name; } CFGPlayerEx; /* * function prototypes */ extern void LoadPlayerCentral (XBBool amCentral); /* XBCC */ extern void SavePlayerCentral (void); extern void FinishPlayerCentral (void); extern void LoadPlayerConfig (void); extern void SavePlayerConfig (void); extern void FinishPlayerConfig (void); extern void RemoveAllPlayers (CFGType); extern XBBool ComparePlayerGraphics (const CFGPlayerGraphics *, const CFGPlayerGraphics *); extern int GetNumPlayerConfigs (CFGType); extern XBAtom GetPlayerAtom (CFGType, int index); extern const char *GetPlayerName (CFGType, XBAtom atom); extern int FindDoubleName (CFGType cfgType, XBAtom newplayer); extern void StorePlayer (CFGType, XBAtom, const CFGPlayer *); extern void StorePlayerEx (CFGType, XBAtom, const CFGPlayerEx *); // XBCC extended player format extern void StorePlayerRating (CFGType, XBAtom, const CFGPlayerRating *); // XBCC extended player format extern void StorePlayerID (CFGType, XBAtom, const CFGPlayerID *); // XBCC extern void StorePlayerGraphics (CFGType, XBAtom, const CFGPlayerGraphics *); extern void StorePlayerMessages (CFGType, XBAtom, const CFGPlayerMessages *); extern void StorePlayerMisc (CFGType, XBAtom, const CFGPlayerMisc *); extern XBBool RetrievePlayer (CFGType, XBAtom, XBColor, CFGPlayer *); extern XBBool RetrievePlayerEx (CFGType, XBAtom, CFGPlayerEx *); // XBCC extended player format extern XBBool RetrievePlayerRating (CFGType, XBAtom, CFGPlayerRating *); // XBCC extended player format extern XBBool RetrievePlayerID (CFGType, XBAtom, CFGPlayerID *); // XBCC extern XBBool RetrievePlayerMessages (CFGType, XBAtom, CFGPlayerMessages *); extern XBBool RetrievePlayerGraphics (CFGType, XBAtom, XBColor, CFGPlayerGraphics *); extern XBBool RetrievePlayerMisc (CFGType, XBAtom, CFGPlayerMisc *); extern XBAtom CreateNewPlayerConfig (CFGType, const char *name); extern XBAtom RenamePlayerConfig (CFGType, XBAtom atom, const char *name); extern void DeletePlayerConfig (CFGType, XBAtom atom); extern XBBool SendPlayerConfig (CFGType, XBSndQueue * sndQueue, XBTeleCOT cot, XBTeleIOB iob, XBAtom atom, XBBool toCentral); extern void AddToPlayerConfig (CFGType, XBAtom atom, const char *text); extern XBBool RetrievePlayerID (CFGType cfgType, XBAtom atom, CFGPlayerID *); extern void StorePlayerID (CFGType cfgType, XBAtom atom, const CFGPlayerID *); extern void StoreGameResult (CFGType cfgType, XBAtom atom, int k, int *regPl, int *PID, int *Score); // XBST extern void AppendGameResult (CFGType cfgType, XBAtom fname, XBAtom atom, int k, int *regPl, int *PID, int *Score); extern void StoreTimePlayerRating (CFGType cfgType, XBAtom atom, int k, int *regPl, int *PID, float *rating); // XBST extern void AppendTimePlayerRating (CFGType cfgType, XBAtom fname, XBAtom atom, int k, int *regPl, int *PID, float *rating); /* * global variables */ extern const CFGPlayerGraphics *DefaultPlayerGraphics (size_t); #endif /* * end of file cfg_player.h */ xblast-2.10.4/cfg_stat.c0000644000175000017500000003204010377675254014165 0ustar rhondaalfie/* * file cfg_stat.c - level and game statistics * * $Id: cfg_stat.c,v 1.9 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { int numWon; /* number of games won */ int numTotal; /* number of games played */ double numScore; /* total numbr of points achieved */ } StatEntry; /* * local variables */ static DBRoot *dbLevel = NULL; static DBRoot *dbPlayer = NULL; /* * init stat entry */ static void SetStatEntry (StatEntry * stat, int numWon, int numTotal, double numScore) { assert (NULL != stat); stat->numWon = numWon; stat->numTotal = numTotal; stat->numScore = numScore; } /* SetStatEntry */ /* * add two entry */ static void AddToStatEntry (StatEntry * dst, const StatEntry * src) { assert (NULL != dst); assert (NULL != src); dst->numWon += src->numWon; dst->numTotal += src->numTotal; dst->numScore += src->numScore; } /* AddToStatEntry */ /* * get and parse statitics entry */ static XBBool GetStatEntry (const DBSection * section, XBAtom atom, StatEntry * stat) { const char *s; assert (NULL != section); assert (ATOM_INVALID != atom); assert (NULL != stat); if (!DB_GetEntryString (section, atom, &s)) { return XBFalse; } if (3 != sscanf (s, "%d %d %lf", &stat->numWon, &stat->numTotal, &stat->numScore)) { return XBFalse; } return XBTrue; } /* GetStatEntry */ /* * */ static void SetStatData (XBStatData * data, XBAtom atom, const char *name, const StatEntry * stat) { assert (NULL != data); assert (NULL != stat); data->atom = atom; data->name = name; data->numWon = stat->numWon; data->numTotal = stat->numTotal; data->scoreTotal = stat->numScore; if (stat->numTotal) { data->percent = 100.0 * (double)stat->numWon / (double)stat->numTotal; data->average = stat->numScore / (double)stat->numTotal; } else { data->percent = 0.0; data->average = 0.0; } } /* SetStatData */ /* * create stat entry for existing secton */ static void CreateStatEntry (DBRoot * db, XBAtom sAtom, XBAtom eAtom, const StatEntry * stat) { char tmp[256]; DBSection *section; /* sanity check */ assert (NULL != db); assert (ATOM_INVALID != sAtom); assert (ATOM_INVALID != eAtom); assert (NULL != stat); /* create section */ section = DB_CreateSection (db, sAtom); assert (NULL != section); /* create entry */ sprintf (tmp, "%d %d %f", stat->numWon, stat->numTotal, stat->numScore); DB_CreateEntryString (section, eAtom, tmp); } /* CreateEntryString */ /* * load statistics data */ void LoadStatConfig (void) { size_t i, j; XBAtom player; XBAtom level; const DBSection *section; StatEntry stat; StatEntry sumStat; /* create empty database for level statistics */ dbLevel = DB_Create (DT_Config, atomLevelStat); assert (dbLevel != NULL); /* load from file */ Dbg_Config ("loading level statistics\n"); if (!DB_Load (dbLevel)) { Dbg_Config ("no level statistics found!\n"); } /* create empty database for player statistics */ dbPlayer = DB_Create (DT_Config, atomPlayerStat); assert (dbLevel != NULL); /* calculate player statistics from level statistics */ i = 0; while (ATOM_INVALID != (level = DB_IndexSection (dbLevel, i++))) { /* load section for one level */ section = DB_GetSection (dbLevel, level); assert (section != NULL); j = 0; while (ATOM_INVALID != (player = DB_IndexEntry (section, j++))) { if (GetStatEntry (section, player, &stat)) { CreateStatEntry (dbPlayer, player, level, &stat); } } } /* build totals */ j = 0; while (ATOM_INVALID != (player = DB_IndexSection (dbPlayer, j++))) { SetStatEntry (&sumStat, 0, 0, 0); /* load section for one level */ section = DB_GetSection (dbPlayer, player); assert (NULL != section); i = 0; while (ATOM_INVALID != (level = DB_IndexEntry (section, i++))) { if (GetStatEntry (section, level, &stat)) { AddToStatEntry (&sumStat, &stat); } } CreateStatEntry (dbPlayer, player, atomTotal, &sumStat); } } /* LoadStatConfig */ /* * save data to disk */ void SaveStatConfig (void) { assert (dbLevel != NULL); if (DB_Changed (dbLevel)) { DB_Store (dbLevel); Dbg_Config ("storing level statistics\n"); } #ifdef DEBUG assert (dbPlayer != NULL); DB_Store (dbPlayer); Dbg_Config ("storing player statistics\n"); #endif } /* SaveStatConfig */ /* * clean up */ void FinishStatConfig (void) { if (NULL != dbLevel) { DB_Delete (dbLevel); } if (NULL != dbPlayer) { DB_Delete (dbPlayer); } Dbg_Config ("statistics cleared\n"); } /* FinishStatConfig */ /* * store level result for one player */ void StoreLevelStat (XBAtom level, XBAtom player, XBBool won, double score) { const DBSection *section; StatEntry stat; StatEntry result; /* set level result for player */ SetStatEntry (&result, won ? 1 : 0, 1, score); /* level statistics */ if (NULL == (section = DB_GetSection (dbLevel, level)) || !GetStatEntry (section, player, &stat)) { SetStatEntry (&stat, 0, 0, 0); } /* new standings */ AddToStatEntry (&stat, &result); /* store it */ CreateStatEntry (dbLevel, level, player, &stat); /*player statistics ... */ if (NULL == (section = DB_GetSection (dbPlayer, player)) || !GetStatEntry (section, level, &stat)) { SetStatEntry (&stat, 0, 0, 0); } /* new standings */ AddToStatEntry (&stat, &result); /* store it */ CreateStatEntry (dbPlayer, player, level, &stat); } /* StoreLevelStat */ /* * compare stat-data by percent */ static int CompareStatDataByPercent (const void *a, const void *b) { const XBStatData *pA = a; const XBStatData *pB = b; assert (pA != NULL); assert (pB != NULL); if (pA->percent == pB->percent) { return pB->numTotal - pA->numTotal; } else if (pA->percent > pB->percent) { return -1; } else { return +1; } } /* CompareStatDataByPercent */ #ifdef UNNEEDED /* * compare stat-data by percent */ static int CompareStatDataByAverage (const void *a, const void *b) { const XBStatData *pA = a; const XBStatData *pB = b; assert (pA != NULL); assert (pB != NULL); if (pA->average == pB->average) { return pB->numTotal - pA->numTotal; } else if (pA->average > pB->average) { return -1; } else { return +1; } } /* CompareStatDataByPercent */ #endif /* * compare stat-data by names */ static int CompareStatDataByName (const void *a, const void *b) { const XBStatData *pA = a; const XBStatData *pB = b; int result; assert (pA != NULL); assert (pB != NULL); /* first try to compare by names */ if (pA->name == NULL) { if (pB->name != NULL) { return -1; } } else { if (pB->name == NULL) { return 1; } else { if (0 != (result = strcmp (pA->name, pB->name))) { return result; } } } /* next by percentage */ if (pA->percent == pB->percent) { return pB->numTotal - pA->numTotal; } else if (pA->percent > pB->percent) { return -1; } else { return +1; } } /* CompareStatDataByPercent */ /* * swap given element to front of table */ static XBBool StatDataRise (XBStatData * table, size_t num, XBAtom atom) { size_t i; XBStatData swap; assert (NULL != table); for (i = 0; i < num; i++) { if (table[i].atom == atom) { swap = table[i]; table[i] = table[0]; table[0] = swap; return XBTrue; } } return XBFalse; } /* StatDataRise */ /* * level atom to name */ static const char * LevelAtomToName (XBAtom atom) { if (atomTotal == atom) { return N_("All Levels"); } else { return GetLevelNameByAtom (atom); } } /* LevelAtomToName */ /* * player atom to name */ static const char * PlayerAtomToName (XBAtom atom) { if (atom == atomDrawGame) { return N_("Draw Games"); } else if (atom == atomOutOfTime) { return N_("Out of Time"); } else { return NULL; } } /* PlayerAtomToName */ /* * create stat table a given player */ XBStatData * CreatePlayerSingleStat (XBAtom player, size_t * pNum) { const DBSection *section; XBStatData *table; size_t i, j; StatEntry stat; XBAtom level; assert (ATOM_INVALID != player); assert (NULL != pNum); /* get section for player */ assert (dbPlayer != NULL); section = DB_GetSection (dbPlayer, player); assert (section != NULL); /* alloc data for table */ *pNum = DB_NumEntries (section); table = calloc (*pNum, sizeof (XBStatData)); assert (NULL != table); /* copy data */ for (i = 0, j = 0; i < *pNum; i++) { level = DB_IndexEntry (section, i); if (GetStatEntry (section, level, &stat) && stat.numTotal > 0) { SetStatData (table + j, level, LevelAtomToName (level), &stat); j++; } } *pNum = j; if (*pNum == 0) { free (table); return NULL; } /* find total */ StatDataRise (table, *pNum, atomTotal); /* sort by percent */ qsort (table + 1, *pNum - 1, sizeof (XBStatData), CompareStatDataByPercent); /* that's all */ return table; } /* CreatePlayerStat */ /* * create stat table with all players */ XBStatData * CreatePlayerTotalStat (size_t * pNum) { XBStatData *table; size_t i, j; const DBSection *section; StatEntry stat; XBAtom player; assert (NULL != pNum); /* get number of players */ assert (dbPlayer != NULL); *pNum = DB_NumSections (dbPlayer); if (0 == *pNum) { return NULL; } table = calloc (*pNum, sizeof (XBStatData)); assert (table != NULL); /* insert players */ for (i = 0, j = 0; i < *pNum; i++) { player = DB_IndexSection (dbPlayer, i); assert (ATOM_INVALID != player); section = DB_GetSection (dbPlayer, player); assert (NULL != section); if (GetStatEntry (section, atomTotal, &stat)) { SetStatData (table + j, player, PlayerAtomToName (player), &stat); j++; } } *pNum = j; if (*pNum == 0) { free (table); return NULL; } /* bring draw game und and out of time to the top */ StatDataRise (table, *pNum, atomDrawGame); StatDataRise (table + 1, *pNum - 1, atomOutOfTime); /* sort by percent */ qsort (table + 2, *pNum - 2, sizeof (XBStatData), CompareStatDataByPercent); return table; } /* CreatePlayerTotalStat */ /* * create stat table with all players */ XBStatData * CreateLevelTotalStat (size_t * pNum) { XBStatData *table; size_t i, j; const DBSection *section; StatEntry stat; StatEntry statDrawGame; StatEntry statOutOfTime; XBAtom level; assert (NULL != pNum); /* get number of levels */ assert (dbLevel != NULL); *pNum = DB_NumSections (dbLevel); if (0 == *pNum) { return NULL; } table = calloc (*pNum, sizeof (XBStatData)); assert (table != NULL); /* insert levels */ for (i = 0, j = 0; i < *pNum; i++) { /* init values */ level = DB_IndexSection (dbLevel, i); assert (ATOM_INVALID != level); /* find section for level */ section = DB_GetSection (dbLevel, level); assert (NULL != section); /* get draw games */ if (!GetStatEntry (section, atomDrawGame, &statDrawGame)) { SetStatEntry (&statDrawGame, 0, 0, 0); } if (!GetStatEntry (section, atomDrawGame, &statOutOfTime)) { SetStatEntry (&statOutOfTime, 0, 0, 0); } SetStatEntry (&stat, statDrawGame.numTotal, statDrawGame.numTotal - statDrawGame.numWon - statOutOfTime.numWon, 0.0); if (stat.numTotal > 0) { SetStatData (table + j, level, LevelAtomToName (level), &stat); j++; } } *pNum = j; if (*pNum == 0) { free (table); return NULL; } /* sort by percent */ qsort (table, *pNum, sizeof (XBStatData), CompareStatDataByName); return table; } /* CreateLevelTotalStat */ /* * create stat table a given player */ XBStatData * CreateLevelSingleStat (XBAtom level, size_t * pNum) { const DBSection *section; XBStatData *table; size_t i, j; StatEntry stat; XBAtom player; assert (ATOM_INVALID != level); assert (NULL != pNum); /* get section for level */ assert (dbLevel != NULL); section = DB_GetSection (dbLevel, level); assert (section != NULL); /* alloc data for table */ *pNum = DB_NumEntries (section); table = calloc (*pNum, sizeof (XBStatData)); assert (NULL != table); /* copy data */ for (i = 0, j = 0; i < *pNum; i++) { player = DB_IndexEntry (section, i); if (GetStatEntry (section, player, &stat)) { SetStatData (table + j, player, PlayerAtomToName (player), &stat); j++; } } *pNum = j; if (*pNum == 0) { free (table); return NULL; } /* find draw games and out of time */ StatDataRise (table, *pNum, atomDrawGame); StatDataRise (table + 1, *pNum - 1, atomOutOfTime); /* sort by percent */ qsort (table + 2, *pNum - 2, sizeof (XBStatData), CompareStatDataByPercent); /* that's all */ return table; } /* CreateLevelStat */ /* * end of file cfg_stat.c */ xblast-2.10.4/cfg_stat.h0000644000175000017500000000323310372731123014153 0ustar rhondaalfie/* * file cfg_stat.h - level and game statistics * * $Id: cfg_stat.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _CFG_STAT_H #define _CFG_STAT_H /* * type definitions */ typedef struct { XBAtom atom; const char *name; int numWon; int numTotal; double scoreTotal; double percent; double average; } XBStatData; /* * global prototypes */ extern void LoadStatConfig (void); extern void SaveStatConfig (void); extern void FinishStatConfig (void); extern void StoreLevelStat (XBAtom level, XBAtom player, XBBool won, double points); extern XBStatData *CreateLevelStat (XBAtom level, size_t * num); extern XBStatData *CreatePlayerSingleStat (XBAtom level, size_t * num); extern XBStatData *CreatePlayerTotalStat (size_t * num); extern XBStatData *CreateLevelTotalStat (size_t * num); extern XBStatData *CreateLevelSingleStat (XBAtom level, size_t * num); #endif /* * end of file cfg_stat.h */ xblast-2.10.4/cfg_xblast.c0000644000175000017500000001270210372731123014471 0ustar rhondaalfie/* * file cfg_xblast.c - general xblast configurations * * $Id: cfg_xblast.c,v 1.9 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ /* config database */ static DBRoot *db = NULL; /* default sound */ static const CFGSoundSetup defaultSoundSetup = { XBSM_None, XBTrue, }; /* conversion tables for sound mode (alphanumeric sort by key) */ static DBToInt convSoundModeTable[NUM_XBSM + 1] = { {"Beep", XBSM_Beep}, {"None", XBSM_None}, {"Waveout", XBSM_Waveout}, {NULL, NUM_XBSM}, }; /* default video */ static const CFGVideoSetup defaultVideoSetup = { XBVM_Windowed, }; /* conversion tables for sound mode (alphanumeric sort by key) */ static DBToInt convVideoModeTable[NUM_XBSM + 1] = { {"fullscreen", XBVM_Full}, {"windowed", XBVM_Windowed}, {NULL, NUM_XBSM}, }; /* default central address */ static const CFGCentralSetup defaultCentralSetup = { "xblast.debian.net", 16160, }; /* * load xblast config database */ void LoadXBlastConfig (void) { /* create empty database */ db = DB_Create (DT_Config, atomXblast); assert (db != NULL); /* load it */ Dbg_Config ("loading xblast config\n"); if (DB_Load (db)) { return; } Dbg_Config ("failed to load xblast config, setting defaults\n"); /* set defaults if load failed */ StoreSoundSetup (&defaultSoundSetup); DB_Store (db); } /* LoadXBlastConfig */ /* * save xblast config database to disk */ void SaveXBlastConfig (void) { assert (NULL != db); if (DB_Changed (db)) { Dbg_Config ("saving xblast config\n"); DB_Store (db); } } /* SaveXBlastConfig */ /* * clear xblast config database */ void FinishXBlastConfig (void) { if (NULL != db) { DB_Delete (db); db = NULL; } Dbg_Config ("xblast config cleared\n"); } /* FinishXBlastConfig */ /* * store setup for sound */ void StoreSoundSetup (const CFGSoundSetup * sound) { DBSection *section; const char *key; assert (NULL != sound); assert (NULL != db); /* create section for sound */ section = DB_CreateSection (db, atomSound); assert (NULL != section); /* add setup */ if (NULL != (key = DB_IntToString (convSoundModeTable, sound->mode))) { DB_CreateEntryString (section, atomMode, key); } else { DB_DeleteEntry (section, atomMode); } DB_CreateEntryBool (section, atomStereo, sound->stereo); } /* StoreSoundSetup */ /* * get ound setup from config */ XBBool RetrieveSoundSetup (CFGSoundSetup * sound) { const DBSection *section; assert (NULL != db); assert (NULL != sound); /* set default value */ *sound = defaultSoundSetup; /* find section for sound */ if (NULL == (section = DB_GetSection (db, atomSound))) { return XBFalse; } /* parse section */ DB_ConvertEntryInt (section, atomMode, (int *)&sound->mode, convSoundModeTable); DB_GetEntryBool (section, atomStereo, &sound->stereo); /* that's all */ return XBTrue; } /* RetrieveSoundSetup */ /* * store video setup */ void StoreVideoSetup (const CFGVideoSetup * video) { DBSection *section; const char *key; assert (video); assert (db); section = DB_CreateSection (db, atomVideo); assert (section); /* add setup */ if ((key = DB_IntToString (convVideoModeTable, video->mode))) { DB_CreateEntryString (section, atomMode, key); } else { DB_DeleteEntry (section, atomMode); } } /* * get video setup from config */ XBBool RetrieveVideoSetup (CFGVideoSetup * video) { const DBSection *section; assert (db); assert (video); /* set default value */ *video = defaultVideoSetup; if (NULL == (section = DB_GetSection (db, atomVideo))) { return XBFalse; } DB_ConvertEntryInt (section, atomMode, (int *)&video->mode, convVideoModeTable); return XBTrue; } /* * store central ceonnection parameters */ void StoreCentralSetup (const CFGCentralSetup * central) { DBSection *section; assert (NULL != central); assert (NULL != db); /* create section for central */ section = DB_CreateSection (db, atomCentral); assert (NULL != section); /* store host and port */ DB_CreateEntryString (section, atomCentralJoinName, central->name); DB_CreateEntryInt (section, atomCentralJoinPort, central->port); } /* StoreCentralSetup */ /* * retrieve central connection parameters */ XBBool RetrieveCentralSetup (CFGCentralSetup * central) { const DBSection *section; assert (NULL != db); assert (NULL != central); /* set default value */ *central = defaultCentralSetup; /* find section for central */ if (NULL == (section = DB_GetSection (db, atomCentral))) { return XBFalse; } /* get central host name and port */ DB_GetEntryString (section, atomCentralJoinName, ¢ral->name); DB_GetEntryInt (section, atomCentralJoinPort, ¢ral->port); /* that's all */ return XBTrue; } /* RetrieveCentralSetup */ /* * end of file cfg_xblast.c */ xblast-2.10.4/cfg_xblast.h0000644000175000017500000000377610372731123014511 0ustar rhondaalfie/* * file cfg_xblast.h - general xblast configurations * * $Id: cfg_xblast.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CFG_XBLAST_H #define _CFG_XBLAST_H /* * modes of sound */ typedef enum { XBSM_None, XBSM_Beep, XBSM_Waveout, /* no new elements after this line */ NUM_XBSM } XBSoundMode; /* * Video modes */ typedef enum { XBVM_Windowed, XBVM_Full, NUM_VBSM } XBVideodMode; /* * default central XBCC */ typedef struct { const char *name; int port; } CFGCentralSetup; /* * mode definitions */ typedef struct { XBSoundMode mode; XBBool stereo; } CFGSoundSetup; /* * mode definitions */ typedef struct { XBVideodMode mode; XBBool full; } CFGVideoSetup; /* * global prototypes */ extern void LoadXBlastConfig (void); extern void SaveXBlastConfig (void); extern void FinishXBlastConfig (void); extern void StoreSoundSetup (const CFGSoundSetup *); extern XBBool RetrieveSoundSetup (CFGSoundSetup *); extern void StoreVideoSetup (const CFGVideoSetup * video); extern XBBool RetrieveVideoSetup (CFGVideoSetup * video); extern void SetupVideo (CFGVideoSetup * video); extern void StoreCentralSetup (const CFGCentralSetup *); // XBCC extern XBBool RetrieveCentralSetup (CFGCentralSetup *); #endif /* * end of file cfg_xblast.h */ xblast-2.10.4/chat.c0000755000175000017500000004065510412220337013302 0ustar rhondaalfie/* * file chat.c - manage chat data for both client and server * * $Id: chat.c,v 1.20 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* max size for names */ #define MAX_CHAT_NAME_DISP 4 /* chat description size, at least 5 */ #define CHAT_DESCR_SIZE 5 #if CHAT_DESCR_SIZE<=MAX_CHAT_NAME_SIZE #error "CHAT_DESCR_SIZE must be at least as large as MAX_CHAT_NAME_SIZE!" #endif #if CHAT_DESCR_SIZE<5 #error "CHAT_DESCR_SIZE must be at least 5!" #endif /* chat structure */ struct _xb_chat { XBChat *next; unsigned char fh; /* sending host */ unsigned char fp; /* sending local player */ unsigned char th; /* receiving host */ unsigned char tp; /* receiving local player */ XBChatMode how; /* 0..numofplayers-1 (private), public, team */ char txt[CHAT_LINE_SIZE]; size_t len; XBChatStatus status; }; /* input lines for local players */ static XBChat *input[NUM_LOCAL_PLAYER + 1]; static XBEventCode codes[NUM_LOCAL_PLAYER + 1]; static XBBool initialized = XBFalse; static XBBool listening = XBFalse; static int active = -1; /* list of all chats */ static XBChat *listFirst = NULL; static XBChat *listLast = NULL; /**************************** * initialization, creation * ****************************/ /* * clear all chat data */ void Chat_Clear (void) { XBChat *next; memset (input, 0, sizeof (input)); memset (codes, 0, sizeof (codes)); Dbg_Chat ("clearing\n"); while (listFirst != NULL) { next = listFirst->next; free (listFirst); listFirst = next; } listLast = NULL; initialized = XBTrue; listening = XBFalse; active = -1; } /* Chat_Clear */ /* * listen to chat events */ void Chat_Listen (XBBool flag) { if (!initialized) { Chat_Clear (); } listening = flag; Dbg_Chat ("%s\n", listening ? "active" : "inactive"); } /* Chat_Listen */ /* * return if listening */ XBBool Chat_isListening (void) { if (!initialized) { return XBFalse; } return listening; } /* Chat_isListening */ /* * create a chat structure */ XBChat * Chat_Create (void) { XBChat *dat; Dbg_Chat ("creating\n"); /* get memory */ dat = calloc (1, sizeof (XBChat)); assert (dat != NULL); /* append to list */ if (listLast == NULL) { listFirst = dat; } else { assert (listLast->next == NULL); listLast->next = dat; } listLast = dat; /* set successor */ dat->next = NULL; /* mark as created */ dat->status = XBCS_Created; return dat; } /* Chat_Create */ /* * create a chat structure */ XBChat * Chat_CreateSys (void) { XBChat *chat = Chat_Create (); Chat_Set (chat, Network_LocalHostId (), NUM_LOCAL_PLAYER, 0x00, 0x00, XBCM_System, ""); return chat; } /* Chat_CreateSys */ /* * set chat parameters */ void Chat_Set (XBChat * chat, unsigned char fh, unsigned char fp, unsigned char th, unsigned char tp, unsigned char how, const char *txt) { assert (chat != NULL); /* store sender */ chat->fh = fh; chat->fp = fp; /* store target */ chat->th = th; chat->tp = tp; /* store mode */ chat->how = how; /* mark as set */ chat->status = XBCS_Inactive; /* set text */ Chat_SetText (chat, txt); } /* Chat_Set */ /* * set chat text */ void Chat_SetText (XBChat * chat, const char *txt) { assert (chat != NULL); /* store length of message, truncate if necessary */ chat->len = strlen (txt); if (chat->len > CHAT_LINE_SIZE - 1) { chat->len = CHAT_LINE_SIZE - 1; } /* copy message */ memcpy (chat->txt, txt, chat->len); chat->txt[chat->len] = (char)'\0'; } /* Chat_SetText */ /* * make a chat line visible */ void Chat_Receive (XBChat * chat) { static char buf[CHAT_LINE_SIZE + 2 * CHAT_DESCR_SIZE + 6]; static char snd[20]; static char snd0[CHAT_DESCR_SIZE + 1]; static char sep[3]; static char trg[20]; XBBool own; XBBool any; XBAtom from; XBAtom to; assert (NULL != chat); /* clear strings */ memset (snd, 0, sizeof (snd)); memset (snd0, 0, sizeof (snd0)); memset (trg, 0, sizeof (trg)); /* chat originated on local machine? */ own = (Network_LocalHostId () == chat->fh); /* chat didn't come from a specific player? */ any = (chat->fp == NUM_LOCAL_PLAYER); /* get name atom from sending player */ from = any ? ATOM_INVALID : Network_GetPlayer2 (chat->fh, chat->fp); /* determine sender string */ if (from == ATOM_INVALID) { /* sender is host */ sprintf (snd, "#%u", chat->fh); /* length<=5 */ } else { /* sender is player, truncate full name if necessary */ strncpy (snd, GUI_AtomToString (from), sizeof (snd) - 1); } /* truncate sender for display */ strncpy (snd0, snd, MAX_CHAT_NAME_DISP); /* set separator */ sprintf (sep, "->"); /* now check mode for target string */ switch (chat->how) { case XBCM_Public: sprintf (trg, "%s", "all"); /* length<=5 */ break; case XBCM_Team: sprintf (trg, "%s", "team"); /* length<=5 */ break; case XBCM_Private: to = Network_GetPlayer2 (chat->th, chat->tp); if (to == ATOM_INVALID) { /* target is host */ sprintf (trg, "#%u", chat->th); /* length<=5 */ } else { /* target is player */ strncpy (trg, GUI_AtomToString (to), sizeof (trg) - 1); } break; case XBCM_System: sprintf (snd, "SYS"); sprintf (snd0, "SYS"); sprintf (sep, "-"); sprintf (trg, "#%u", chat->fh); break; } /* full print to stdout */ fprintf (stdout, "CHAT %s%s%s: %s\n", snd, sep, trg, chat->txt); /* truncated display in GUI */ if (chat->how != XBCM_System) { sprintf (buf, "%s:%s", snd0, chat->txt); SetChat (buf, XBTrue); } /* mark as received */ chat->status = XBCS_Received; } /* Chat_Receive */ /* * flush out all messages with status 0 */ static void Chat_Flush (void) { XBChat *next; while (listFirst != NULL) { if (listFirst->status != 0) { return; } next = listFirst->next; free (listFirst); listFirst = next; } if (listFirst == NULL) { listLast = NULL; } } /* Chat_Flush */ /* * remove and return first line */ XBChat * Chat_Pop (void) { XBChat *ret = NULL; Chat_Flush (); if (listFirst != NULL) { ret = listFirst; listFirst = listFirst->next; if (listFirst == NULL) { listLast = NULL; } } return (ret); } /* Chat_Pop */ /********************* * packing/unpacking * *********************/ /* * pack chat data for transmission */ size_t Chat_PackData (XBChat * chat, char **data, unsigned *iob) { static char buf[CHAT_LINE_SIZE + 2]; unsigned char from; assert (chat != NULL); Dbg_Chat ("packing (%u,%u)->(%u,%u)-%u-%s(%lu)\n", chat->fh, chat->fp, chat->th, chat->tp, chat->how, chat->txt, (unsigned long)chat->len); /* redefine local sender */ from = (chat->fp == NUM_LOCAL_PLAYER) ? 0xFF : chat->fp; /* build buffer */ buf[0] = 0xFF & ((chat->fh << 4) + (from & 0x0F)); buf[1] = 0xFF & ((chat->th << 4) + (chat->tp & 0x0F)); memcpy (buf + 2, chat->txt, chat->len); buf[chat->len + 2] = (char)'\0'; /* return data */ *data = buf; *iob = chat->how & 0xFF; return (chat->len + 3); } /* Chat_PackData */ /* * unpack chat data */ XBChat * Chat_UnpackData (const char *data, size_t len, unsigned iob) { XBChat *chat = NULL; unsigned char from; if (len > 2) { chat = Chat_Create (); from = data[0] & 0x0F; if (from == 0x0F) { from = NUM_LOCAL_PLAYER; } Chat_Set (chat, data[0] >> 4, from, data[1] >> 4, data[1] & 0x0F, iob, data + 2); Dbg_Chat ("unpacking (%u,%u)->(%u,%u)-%u-%s(%lu)\n", chat->fh, chat->fp, chat->th, chat->tp, chat->how, chat->txt, (unsigned long)chat->len); } return chat; } /* Chat_UnpackData */ /********* * input * *********/ /* * deactivate all input */ static void Chat_Deactivate (void) { int p; assert (initialized); /* deactivating all input */ for (p = 0; p <= NUM_LOCAL_PLAYER; p++) { if (input[p] != NULL) { input[p]->status = XBCS_Inactive; } } Dbg_Chat ("deactivating all current input\n"); active = -1; } /* Chat_Deactivate */ /* * activate chat input for a player */ static void Chat_ActivateInput (unsigned int local) { assert (local >= 0); assert (local <= NUM_LOCAL_PLAYER); assert (initialized); assert (input[local] != NULL); Chat_Deactivate (); /* activate */ input[local]->status = XBCS_Input; active = local; } /* Chat_Activate */ /* * start chat input for a local player */ static void Chat_StartInput (unsigned int local) { unsigned char id = Network_LocalHostId (); if (id >= MAX_HOSTS) { Dbg_Chat ("cannot start input, no host id\n"); return; } assert (local <= NUM_LOCAL_PLAYER); assert (initialized); /* activating input for local */ if (input[local] == NULL) { input[local] = Chat_Create (); Chat_Set (input[local], id, local, 0, 0, XBCM_Public, ""); Dbg_Chat ("initializing chat input for player %u\n", local); } SetGet ("Start Chatting", XBTrue); Chat_ActivateInput (local); } /* Chat_StartInput */ /* * send input for a local player */ static void Chat_SendInput (unsigned int local) { assert (local <= NUM_LOCAL_PLAYER); assert (initialized); if (input[local] == NULL) { Dbg_Chat ("no chat input for player %u, cannot send\n", local); return; } switch (input[local]->status) { case XBCS_Inactive: Dbg_Chat ("activating chat input for player %u before send\n", local); SetGet (input[local]->txt, XBTrue); Chat_ActivateInput (local); break; case XBCS_Input: Dbg_Chat ("sending chat input #%u\n", local); switch (Network_GetType ()) { case XBNT_Server: Server_ReceiveChat (input[local]); break; case XBNT_Client: Client_SendChat (input[local]); break; default: Dbg_Chat ("failed to send, invalid net type\n"); return; } input[local]->status = XBCS_Sent; SetGet (NULL, XBTrue); input[local] = NULL; active = -1; break; default: Dbg_Chat ("failed to send chat input #%u, invalid status %u\n", local, input[local]->status); break; } } /* Chat_SendInput */ /* * cancel input for local player */ static void Chat_CancelInput (unsigned int local) { assert (local <= NUM_LOCAL_PLAYER); assert (initialized); if (input[local] == NULL) { Dbg_Chat ("no chat input for player %u, cannot cancel\n", local); return; } switch (input[local]->status) { case XBCS_Inactive: Dbg_Chat ("activating chat input for player %u before cancel\n", local); SetGet (input[local]->txt, XBTrue); Chat_ActivateInput (local); break; case XBCS_Input: Dbg_Chat ("canceling chat input #%u\n", local); memset (input[local]->txt, 0, sizeof (input[local]->txt)); input[local]->len = 0; SetGet ("Chat canceled", XBTrue); input[local]->status = XBCS_Inactive; active = -1; break; default: Dbg_Chat ("failed to send chat input #%u, invalid status %u\n", local, input[local]->status); break; } } /* Chat_CancelInput */ /* * choose next target */ static void Chat_NextTarget (unsigned int local) { XBAtom atom; XBChat *chat; assert (local <= NUM_LOCAL_PLAYER); assert (initialized); if (input[local] == NULL) { Chat_StartInput (local); } chat = input[local]; switch (chat->status) { case XBCS_Inactive: Dbg_Chat ("activating chat input #%u\n", local); SetGet (input[local]->txt, XBTrue); Chat_ActivateInput (local); case XBCS_Input: switch (chat->how) { case XBCM_Public: chat->how = XBCM_Team; SetGet ("Team message", XBTrue); return; case XBCM_Team: chat->how = XBCM_Private; if (Network_GetFirstOtherPlayer (chat->fh, local, &chat->th, &chat->tp)) { atom = Network_GetPlayer2 (chat->th, chat->tp); SetGet (GUI_AtomToString (atom), XBTrue); Dbg_Chat ("first other player = %s (%u,%u)\n", GUI_AtomToString (atom), chat->th, chat->tp); } else { Dbg_Chat ("no other players found, skipping private target\n"); Chat_NextTarget (local); } break; case XBCM_Private: if (Network_GetNextOtherPlayer (chat->fh, local, &chat->th, &chat->tp)) { atom = Network_GetPlayer2 (chat->th, chat->tp); SetGet (GUI_AtomToString (atom), XBTrue); Dbg_Chat ("next other player = %s (%u,%u)\n", GUI_AtomToString (atom), chat->th, chat->tp); } else { chat->how = XBCM_Public; SetGet ("Public message", XBTrue); } break; default: break; } Dbg_Chat ("how = %u\n", chat->how); break; default: Dbg_Chat ("failed to change target for input #%u, invalid status %u\n", local, input[local]->status); break; } } /* Chat_NextTarget */ /* * handle backspace for active input */ static void Chat_Backspace (void) { assert (initialized); if (active < 0) { Dbg_Chat ("no active input, backspace failed\n"); return; } assert (active <= NUM_LOCAL_PLAYER); if (input[active] != NULL && input[active]->status == XBCS_Input) { size_t len = input[active]->len; if (len > 0) { input[active]->txt[--len] = (char)0; input[active]->len = len; Dbg_Chat ("backspacing chat input #%u\n", active); SetGet (input[active]->txt, XBTrue); } else { Dbg_Chat ("chat input #%u empty, backspace failed\n", active); } return; } } /* Chat_Backspace */ /* * add a character for active input, return if overflow */ static XBBool Chat_AddAscii (char ascii) { size_t len; assert (initialized); if (active < 0) { Dbg_Chat ("no active input, failed to add char\n"); return XBFalse; } assert (active <= NUM_LOCAL_PLAYER); /* find active input */ len = input[active]->len; if (len < CHAT_LINE_SIZE - 1) { input[active]->txt[len++] = ascii; input[active]->txt[len] = (char)0; input[active]->len = len; SetGet (input[active]->txt, XBTrue); Dbg_Chat ("adding character to chat input #%u, length %lu = %s\n", active, (unsigned long)strlen (input[active]->txt), input[active]->txt); return XBTrue; } else { Dbg_Chat ("ignoring character, line for display #%u too long\n", active); return XBFalse; } } /* Chat_AddAscii */ /**************************** * event checking for menus * ****************************/ /* * add event code */ void Chat_AddEventCode (unsigned local, XBEventCode ev) { assert (initialized); assert (local <= NUM_LOCAL_PLAYER); codes[local] = ev; Dbg_Chat ("assigning event type %u to local player %u\n", ev, local); } /* Chat_AddEventCode */ /* * find display to which event code corresponds to */ unsigned char Chat_FindCode (XBEventCode ev) { unsigned id; if (!initialized || !listening) { return 0xFF; } for (id = 0; id <= NUM_LOCAL_PLAYER; id++) { if (codes[id] == ev) { return id; } } return 0xFF; } /* Chat_FindCode */ /* * get current event code of active chatter */ XBEventCode Chat_GetCurrentCode (void) { if (!initialized || !listening || active < 0) { return XBE_NONE; } return codes[active]; } /* Chat_GetCurrentCode */ /* * chat keys */ XBBool Chat_Event (XBEventCode event, XBEventData data) { unsigned int local; /* check if chat mode active */ if (!listening) { return XBFalse; } /* if so, grab the chat events */ switch (event) { /* a fixed chat key has been entered */ case XBE_CHAT: /* redefine event to currently active */ event = Chat_GetCurrentCode (); /* restart event routine */ assert (event != XBE_CHAT); return Chat_Event (event, data); /* ascii character for current input, if any */ case XBE_ASCII: Chat_AddAscii ((char)data.value); break; /* control characters */ case XBE_CTRL: return XBFalse; /* chat keys */ default: /* TODO: find better solution than +-1000 */ if (data.value < 1000) { return XBFalse; } local = Chat_FindCode (event); if (local > NUM_LOCAL_PLAYER) { return XBFalse; } Dbg_Chat ("chat event %u for display %u\n", data.value, local); switch (data.value - 1000) { case XBCE_START: Chat_StartInput (local); break; case XBCE_ESCAPE: case XBCE_CANCEL: Chat_CancelInput (local); break; case XBCE_CHANGE: Chat_NextTarget (local); break; case XBCE_SEND: case XBCE_ENTER: Chat_SendInput (local); break; case XBCE_BACK: Chat_Backspace (); break; default: return XBFalse; } break; } return XBTrue; } /* * end of file chat.c */ xblast-2.10.4/chat.h0000755000175000017500000000427510377675254013333 0ustar rhondaalfie/* * file chat.h - managing chat data for both client and server * * $Id: chat.h,v 1.11 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CHAT_H #define XBLAST_CHAT_H #define CHAT_LINE_SIZE 50 /* * type declarations */ typedef struct _xb_chat XBChat; typedef enum { XBCM_Public, XBCM_Team, XBCM_Private, XBCM_System, } XBChatMode; typedef enum { XBCS_Created, XBCS_Input, XBCS_Inactive, XBCS_Sent, XBCS_Received, } XBChatStatus; /* * global prototypes */ /* init */ extern void Chat_Clear (void); /* start/stop chat handling */ extern void Chat_Listen (XBBool); extern XBBool Chat_isListening (void); /* create */ extern XBChat *Chat_Create (void); extern XBChat *Chat_CreateSys (void); /* modify */ extern void Chat_Set (XBChat * chat, unsigned char fh, unsigned char fp, unsigned char th, unsigned char tp, unsigned char how, const char *txt); extern void Chat_SetText (XBChat * chat, const char *txt); /* get */ extern void Chat_Receive (XBChat *); extern XBChat *Chat_Pop (void); /* packing/unpacking */ extern size_t Chat_PackData (XBChat * chat, char **data, unsigned *iob); extern XBChat *Chat_UnpackData (const char *data, size_t len, unsigned iob); /* chat events */ extern void Chat_AddEventCode (unsigned local, XBEventCode ev); extern XBEventCode Chat_GetCurrentCode (void); extern unsigned char Chat_FindCode (XBEventCode); extern XBBool Chat_Event (XBEventCode, XBEventData); #endif /* * end of file chat.h */ xblast-2.10.4/client.c0000644000175000017500000007634410412220337013642 0ustar rhondaalfie/* * file client.c - communication interface for clients * * $Id: client.c,v 1.69 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define TIME_POLL_QUERY 5 /* unused */ /* * local types */ /* type for list of network games received, LAN or Central */ typedef struct _xb_network_game_list XBNetworkGameList; struct _xb_network_game_list { XBNetworkGameList *next; XBNetworkGame game; }; /* * local variables */ /* Client connections */ static XBComm *comm = NULL; /* XBCommToServer - TCP connection to server */ static XBComm *dgram = NULL; /* XBCommDgramServer - UDP connection to server */ static XBComm **query = NULL; /* List of XBCommQuery's - UDP connections to LAN/Central */ /* list of received network games, for Search LAN/Central */ static XBNetworkGameList *firstGame = NULL; static XBNetworkGameList *lastGame = NULL; static XBNetworkGameList *nextGame = NULL; static unsigned numGames = 0; /* player actions received for game time and each in-game player */ /* TODO: check player counts when new clients connect ! */ static PlayerAction playerAction[GAME_TIME + 1][MAX_PLAYER]; /* flags for level negotiation status */ static XBBool rejected; static XBBool fixed; /* flag for async level result */ static XBBool async; /* * local prototypes */ static void PollDatagram (const struct timeval *tv); /**************************** * connecting/disconnecting * ****************************/ /* * try to connect to server: join attempt */ XBBool Client_Connect (CFGGameHost * cfg) { /* clear network and chat data */ Dbg_Client ("clearing all network and chat data\n"); Network_Clear (); Chat_Clear (); Chat_Listen (XBTrue); /* create communication */ Dbg_Client ("trying to join game at %s:%u\n", cfg->name, cfg->port); assert (comm == NULL); comm = C2S_CreateComm (cfg); if (NULL == comm) { Dbg_Client ("failed to connect!\n"); return XBFalse; } Dbg_Client ("Connected!\n"); Network_SetType (XBNT_Client); return XBTrue; } /* Client_Connect */ /* * close dgram connection to server */ static void Client_DgramDisconnect (void) { if (dgram != NULL) { Dbg_Client ("disconnecting Dgram to server\n"); /* stop polling */ GUI_SubtractPollFunction (PollDatagram); Dbg_Client ("stopping to poll for pings\n"); /* delete connection */ CommDelete (dgram); dgram = NULL; } } /* Client_DgramDisconnect */ /* * close stream connection to server */ static void Client_StreamDisconnect (void) { if (comm != NULL) { Dbg_Client ("disconnecting Stream to server\n"); CommDelete (comm); comm = NULL; } } /* Client_StreamDisconnect */ /* * close all connections to server */ void Client_Disconnect (void) { Network_Clear (); Network_ClearEvents (); Client_StreamDisconnect (); Client_DgramDisconnect (); Chat_Listen (XBFalse); } /* Client_Disconnect */ /*************************** * poll function for dgram * ***************************/ /* * polling for datagram connections: send pings, disconnect on timeout */ static void PollDatagram (const struct timeval *tv) { if (NULL != dgram && !D2S_Connected (dgram)) { Dbg_Client ("queueing connection ping to server\n"); D2S_SendConnect (dgram); } if (NULL != dgram && D2S_Timeout (dgram, tv)) { /* disconnect from server */ Dbg_Client ("dgram to server timed out\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); GUI_SendEventValue (XBE_SERVER, XBSE_ERROR); } } /* PollDatagram */ /****************** * error handling * ******************/ /* * stream event occurred */ XBBool Client_StreamEvent (XBClientConstants code) { switch (code) { case XBCC_IDInvalid: Dbg_Client ("invalid id received from server, ignoring\n"); return XBFalse; case XBCC_DataInvalid: Dbg_Client ("invalid data received from server, ignoring\n"); return XBFalse; case XBCC_COTInvalid: Dbg_Client ("invalid cot received from server, disconnecting\n"); break; case XBCC_IOError: Dbg_Client ("i/o error on stream to server, disconnecting\n"); break; case XBCC_ExpectedEOF: Dbg_Client ("server finishes disconnect announcement\n"); return XBFalse; case XBCC_UnexpectedEOF: Dbg_Client ("unexpected server disconnect\n"); break; case XBCC_StreamWaiting: /* Dbg_Client("all queued data sent to server\n"); */ return XBFalse; case XBCC_StreamBusy: /* Dbg_Client("data remains to be sent to server\n"); */ return XBFalse; case XBCC_StreamClosed: Dbg_Client ("connection to server removed\n"); comm = NULL; return XBFalse; default: Dbg_Client ("unknown error (%u) on stream to server, disconnecting\n", code); } Client_DgramDisconnect (); Network_Clear (); Network_ClearEvents (); Chat_Listen (XBFalse); /* queue event for GUI display */ Network_QueueEvent (XBNW_Error, 0); GUI_SendEventValue (XBE_SERVER, XBSE_ERROR); return XBTrue; } /* Client_StreamError */ /* * handle events on dgram */ XBBool Client_DgramEvent (XBClientConstants code) { switch (code) { case XBCC_Loss: Dbg_Client ("data loss from server, continuing!\n"); return XBFalse; case XBCC_WriteError: Dbg_Client ("write error on dgram to server, disconnecting\n"); break; case XBCC_ConnFailed: Dbg_Client ("dgram failed to connect to server, disconnecting\n"); break; case XBCC_DgramClosed: Dbg_Client ("dgram to server is removed\n"); dgram = NULL; return XBFalse; default: Dbg_Client ("unknown event (%u) on dgram to server, disconnecting\n", code); } Network_Clear (); Network_ClearEvents (); Chat_Listen (XBFalse); Client_StreamDisconnect (); /* queue event for GUI display */ Network_QueueEvent (XBNW_Error, 0); /* TODO: put in more info here for GUI */ GUI_SendEventValue (XBE_SERVER, XBSE_ERROR); return XBTrue; } /* Client_DgramEvent */ /****************** * receiving data * ******************/ /* * override game config with local options */ static void OverrideGameConfig (void) { CFGGameHost cfgHost; CFGGameSetup cfgLocal; CFGGameSetup cfgRemote; /* set correct server name */ if (RetrieveGameHost (CT_Remote, SERVERGAMECONFIG, &cfgHost)) { cfgHost.name = C2S_ServerName (comm); Dbg_Client ("setting server name to %s\n", cfgHost.name); StoreGameHost (CT_Remote, SERVERGAMECONFIG, &cfgHost); } /* set local overrides to game setup */ if (RetrieveGameSetup (CT_Remote, SERVERGAMECONFIG, &cfgRemote) && RetrieveGameSetup (CT_Local, atomClient, &cfgLocal)) { cfgRemote.recordDemo = cfgLocal.recordDemo; cfgRemote.bot = cfgLocal.bot; cfgRemote.beep = cfgLocal.beep; cfgRemote.Music = cfgLocal.Music; StoreGameSetup (CT_Remote, SERVERGAMECONFIG, &cfgRemote); } } /* OverrideGameConfig */ /* * receive game config from server */ XBBool Client_ReceiveGameConfig (unsigned id, const char *line) { unsigned num; /* receive the data */ switch (Network_ReceiveGameConfig (id, line)) { case XBGC_Unfinished: return XBFalse; case XBGC_HostInvalid: Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); Dbg_Client ("game config for too large host id #%u received, disconnect\n", id); GUI_ErrorMessage ("host id=%u too large, probably SMPF-server\n", id); return XBFalse; case XBGC_Empty: Dbg_Client ("server sent empty game config for host #%u\n", id); num = Network_CreateLocalPlayers (id); if (num != 0) { Dbg_Client ("failed to initialize local game config, disconnect\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; } return XBTrue; case XBGC_TooManyPlayers: Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); Dbg_Client ("too many players received, host id #%u, disconnected\n", id); GUI_ErrorMessage ("too many players received, disconnected\n", id); return XBFalse; case XBGC_NoVersion: Dbg_Client ("server sent no version, disconnect\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; case XBGC_Local: Dbg_Client ("server sent local game config for host #%u\n", id); if (id == 0) { OverrideGameConfig (); } num = Network_CreateLocalPlayers (id); if (num > NUM_LOCAL_PLAYER) { Dbg_Client ("failed to create local players, disconnect\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; } Dbg_Client ("created %u players at host #%u\n", num, id); Network_QueueEvent (XBNW_GameConfig, id); return XBTrue; break; case XBGC_Global: Dbg_Client ("server sent global game config for host #%u\n", id); if (id > 0) { Dbg_Client ("ignoring global game config from client\n"); DeleteGameConfig (CT_Remote, LOCALGAMECONFIG (id)); return XBFalse; } OverrideGameConfig (); num = Network_CreateGlobalPlayers (id); if (num > MAX_PLAYER) { Dbg_Client ("failed to create global players, disconnect\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; } Dbg_Client ("created %u global players from game config #%u\n", num, id); num = Network_GetMaskBytes (); if (num == 0) { Dbg_Client ("failed to set mask bytes, disconnect\n"); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; } D2S_SetMaskBytes (dgram, num); Network_QueueEvent (XBNW_GameConfig, id); return XBTrue; case XBGC_Error: Dbg_Client ("server sent invalid game config for host #%u, disconnect\n", id); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); return XBFalse; default: break; } return XBFalse; } /* Client_ReceiveGameConfig */ /* * receive player config from server */ void Client_ReceivePlayerConfig (unsigned id, unsigned player, const char *data) { /* disconnect on range check error */ if (id >= MAX_HOSTS || player >= NUM_LOCAL_PLAYER) { Dbg_Client ("receiving player config for out of range player #%u(%u), disconnect\n", id, player); Client_Disconnect (); Network_QueueEvent (XBNW_Error, 0); GUI_ErrorMessage ("cannot handle player id %u(%u)\n", id, player); } if (ATOM_INVALID != Network_ReceivePlayerConfig (CT_Remote, id, player, data)) { Dbg_Client ("received player config for #%u(%u)\n", id, player); } } /* Client_ReceivePlayerConfig */ /* * receive dgram port on server */ void Client_ReceiveDgramPort (unsigned id, unsigned short port) { CFGGameHost cfgSrv, cfgLoc; XBBool usingNat = XBFalse; assert (comm != NULL); assert (dgram == NULL); /* this is the first time we learn our id from server */ Network_ReceiveLocalHostId (id); /* first check if we are using NAT to get to the server */ Dbg_Client ("receiving dgram port #%u on server\n", port); if (id != 0 && id < MAX_HOSTS) { RetrieveGameHost (CT_Remote, SERVERGAMECONFIG, &cfgSrv); Dbg_Client ("server is %s\n", cfgSrv.name); RetrieveGameHost (CT_Remote, LOCALGAMECONFIG (id), &cfgLoc); Dbg_Client ("server sees me as %s\n", cfgLoc.name); Dbg_Client ("local ip for stream connection = %s\n", C2S_ClientName (comm)); Dbg_Client ("peer ip for stream connection = %s\n", C2S_ServerName (comm)); if (0 != strcmp (cfgLoc.name, C2S_ClientName (comm))) { Dbg_Client ("server does not see local ip -> NAT detected!\n"); usingNat = XBTrue; } } #ifdef DEBUG_NAT usingNat = XBTrue; Dbg_Client ("forcing NAT by compile flag\n"); #endif dgram = D2S_CreateComm (C2S_ClientName (comm), C2S_ServerName (comm), port); if (NULL == dgram) { Dbg_Client ("failed to open dgram connection\n"); /* disconnect stream */ Client_StreamDisconnect (); return; } Client_SendDgramPort (usingNat); SetHostType (XBPH_Client1 + id - 1); /* poll connection */ Dbg_Client ("starting to poll for pings\n"); GUI_AddPollFunction (PollDatagram); } /* Client_ReceiveDgramPort */ /* * received ping time for one client */ void Client_ReceivePingTime (unsigned id, int ping) { Network_ReceivePing (id, ping); } /* Client_ReceivePingTime */ /* * receive request for game config */ void Client_ReceiveGameConfigReq (unsigned id) { CFGGamePlayers cfgPlayers; CFGGameConst cfgConst; Dbg_Client ("server requests game config\n"); /* copy game players and constants from Local/Client to Remote/Local */ (void)RetrieveGamePlayers (CT_Local, atomClient, &cfgPlayers); StoreGamePlayers (CT_Remote, atomLocal, &cfgPlayers); (void)RetrieveGameConst (CT_Local, atomClient, &cfgConst); StoreGameConst (CT_Remote, atomLocal, &cfgConst); /* send filtered config from database */ if (!C2S_SendGameConfig (comm, CT_Remote, atomLocal)) { Dbg_Client ("failed to queue game config!\n"); C2S_GameDataNotAvailable (comm); return; } Dbg_Client ("successfully queued game config for %u players\n", cfgPlayers.num); } /* Client_ReceiveGameConfigReq */ /* * receive request for game config */ void Client_ReceivePlayerConfigReq (unsigned player) { CFGGamePlayers cfgPlayers; Dbg_Client ("server requests player config for player %u(%u)\n", Network_LocalHostId (), player); /* check player index */ if (player >= NUM_LOCAL_PLAYER) { Dbg_Client ("invalid player number !\n"); C2S_PlayerDataNotAvailable (comm, player); return; } /* get player atom from config */ if (!RetrieveGamePlayers (CT_Local, atomClient, &cfgPlayers)) { Dbg_Client ("no local players !\n"); C2S_PlayerDataNotAvailable (comm, player); return; } /* check player */ if (player >= cfgPlayers.num) { Dbg_Client ("only %u local players !\n", cfgPlayers.num); C2S_PlayerDataNotAvailable (comm, player); return; } if (ATOM_INVALID == cfgPlayers.player[player]) { Dbg_Client ("player config empty !\n"); C2S_PlayerDataNotAvailable (comm, player); return; } /* send config from database */ if (!C2S_SendPlayerConfig (comm, CT_Local, cfgPlayers.player[player], player, XBFalse)) { Dbg_Client ("failed to queue !\n"); C2S_PlayerDataNotAvailable (comm, player); return; } Dbg_Client ("successfully queued player config for %u(%u)\n", Network_LocalHostId (), player); } /* Client_ReceivePlayerConfigReq */ /* * receive host state for a host */ void Client_ReceiveHostState (unsigned id, unsigned state) { if (Network_ReceiveHostState (id, state)) { Dbg_Client ("received host state #%u = %u\n", id, state); } else { Dbg_Client ("received invalid host state\n"); } } /* Client_ReceiveHostState */ /* * receive host state request for a host */ void Client_ReceiveHostStateReq (unsigned who, unsigned id, unsigned state) { if (Network_ReceiveHostStateReq (who, id, state)) { Dbg_Client ("received host state request #%u -> %u by %u\n", id, state, who); } else { Dbg_Client ("received invalid host state request\n"); } } /* Client_ReceiveHostStateReq */ /* * receive team state for a host/player */ void Client_ReceiveTeamState (unsigned host, unsigned player, unsigned team) { if (Network_ReceiveTeamState (host, player, team)) { Dbg_Client ("received team state #%u(%u) = %u\n", host, player, team); } else { Dbg_Client ("received invalid team state\n"); } } /* Client_ReceiveTeamState */ /* * receive team state for a host/player */ void Client_ReceiveTeamStateReq (unsigned who, unsigned host, unsigned player, unsigned team) { if (Network_ReceiveTeamStateReq (who, host, player, team)) { Dbg_Client ("received team state request #%u(%u) -> %u by %u\n", host, player, team, who); } else { Dbg_Client ("received invalid team state request\n"); } } /* Client_ReceiveTeamStateReq */ /* * receive level config from server */ void Client_ReceiveLevelConfig (unsigned iob, const char *data) { if (NULL != data) { AddToRemoteLevelConfig (iob, data); return; } /* yes, all data received */ Dbg_Client ("checking remote level for version\n"); Client_LevelRejection (!CheckRemoteLevelConfig ()); Network_QueueEvent (XBNW_LevelConfig, 0); } /* Client_ReceiveLevelConfig */ /* * receive info about a disconnection */ XBBool Client_ReceiveDisconnect (unsigned id) { if (id == 0) { Dbg_Client ("server announces disconnect, partial shutdown!\n"); /* partial shutdown */ Client_DgramDisconnect (); Network_Clear (); Chat_Listen (XBFalse); Network_QueueEvent (XBNW_Disconnected, id); GUI_SendEventValue (XBE_SERVER, XBSE_ERROR); return XBTrue; } if (id < MAX_HOSTS) { Dbg_Client ("host #%u disconnected\n", id); Network_ClearHost (id); } else { Dbg_Client ("host id too large, ignoring (probably SMPF server)\n"); return XBFalse; } Network_QueueEvent (XBNW_Disconnected, id); return XBFalse; } /* Client_ReceiveDisconnect */ /* * receive chat line */ void Client_ReceiveChat (XBChat * chat) { Chat_Receive (chat); } /* Client_ReceiveChat */ /* * receive game start signal from server */ void Client_ReceiveStart (unsigned id) { Dbg_Out ("received start of game!\n"); Network_QueueEvent (XBNW_StartGame, id); } /* Client_ReceiveStart */ /* * receive seed for random number generator */ void Client_ReceiveRandomSeed (unsigned seed) { Dbg_Out ("receive seed %u\n", seed); SeedRandom (seed); } /* Client_ReceiveRandomSeed */ /* * server notified that all clients reached sync point */ void Client_ReceiveSync (XBNetworkEvent event) { Dbg_Out ("receive sync, raising event %u\n", event); /* TODO filter events */ Network_QueueEvent (event, 0); } /* Client_ReceiveSync */ /* * receive action keys for a gametime */ void Client_ReceivePlayerAction (int gameTime, const PlayerAction * keys) { assert (gameTime <= GAME_TIME); /* inform application */ GUI_SendEventValue (XBE_SERVER, gameTime); /* copy keys (simple version) */ memcpy (&playerAction[gameTime][0], keys, MAX_PLAYER * sizeof (PlayerAction)); } /* Client_ReceivePlayerAction */ /* * receive level finish */ void Client_ReceiveFinish (void) { /* inform application */ Dbg_Client ("receive level finish\n"); GUI_SendEventValue (XBE_SERVER, XBSE_FINISH); } /* Client_ReceiveFinish */ /* * receive async status from server */ void Client_ReceiveAsync (unsigned ev) { /* ev always equal to XBNW_SyncLevelResult */ Dbg_Client ("receiving level result async\n"); async = XBTrue; Network_QueueEvent (ev, XBTrue); } /* Client_ReceiveAsync */ /************************ * local data retrieval * ************************/ /* * retrieve host state for a host */ unsigned Client_GetHostState (unsigned id) { return Network_GetHostState (id); } /* Client_GetHostState */ /* * retrieve host state requests for a host */ unsigned * Client_GetHostStateReq (unsigned id) { return Network_GetHostStateReq (id); } /* Client_GetHostStateReq */ /* * retrieve team state for a host/player */ unsigned Client_GetTeamState (unsigned id, unsigned pl) { return Network_GetTeamState (id, pl); } /* Client_GetHostState */ /* * retrieve team state requests for a host/player */ unsigned * Client_GetTeamStateReq (unsigned id, unsigned pl) { return Network_GetTeamStateReq (id, pl); } /* Client_GetTeamStateReq */ /* * query rejection status for level config */ XBBool Client_RejectsLevel (void) { return rejected; } /* Client_RejectsLevel */ /* * query fixed status for a level config */ XBBool Client_FixedLevel (void) { return fixed; } /* Client_Fixed level */ /* * get actions for given gametime */ void Client_GetPlayerAction (int gameTime, PlayerAction * keys) { assert (gameTime <= GAME_TIME); /* copy keys (simple version) */ memcpy (keys, &playerAction[gameTime][0], MAX_PLAYER * sizeof (PlayerAction)); } /* Client_PlayerAction */ /* * get ping time of server to given host */ int Client_GetPingTime (unsigned clientID) { return Network_GetPingTime (clientID); } /* Client_GetPingTime */ /* * query async status for level */ XBBool Client_LevelAsynced (void) { return async; } /* Client_LevelAsynced */ /********************** * local data setting * **********************/ /* * manually set rejection status for a level config */ void Client_LevelRejection (XBBool rej) { Dbg_Client ("setting level rejection to %u\n", rej); rejected = rej; } /* Client_LevelRejection */ /* * manually set fixed status for a level config */ void Client_LevelFix (XBBool fx) { Dbg_Client ("setting level fix to %u\n", fx); fixed = fx; } /* Client_LevelFix */ /* * reset or fix a level config */ void Client_ActivateLevel (unsigned how) { if (how == 0) { Dbg_Client ("received level reset from server\n"); Client_LevelRejection (XBTrue); /* clear level config in game_client: LevelFromServer */ } else { Dbg_Client ("received level activation from server\n"); Client_LevelFix (XBTrue); } Network_QueueEvent (XBNW_LevelConfig, how); } /* Client_Activate level */ /* * manually set async status for level */ void Client_SetLevelAsync (XBBool as) { Dbg_Client ("setting async to %u\n", as); async = as; } /* Client_SetLevelAsync */ /* * clear all action data */ void Client_ClearPlayerAction (void) { unsigned gt; int player; for (gt = 0; gt < GAME_TIME + 1; gt++) { for (player = 0; player < MAX_PLAYER; player++) { playerAction[gt][player].player = player; playerAction[gt][player].dir = GoDefault; playerAction[gt][player].bomb = XBFalse; playerAction[gt][player].special = XBFalse; playerAction[gt][player].pause = XBFalse; playerAction[gt][player].suicide = XBFalse; playerAction[gt][player].abort = ABORT_NONE; } } /* Dbg_Client("cleared action for all hosts\n"); */ } /* Client_ClearPlayerAction */ /* * reset datagram connection */ void Client_ResetPlayerAction (void) { if (NULL != dgram) { Dbg_Client ("resetting dgram player actions\n"); D2S_Reset (dgram); } } /* Client_ResetPlayerAction */ /****************** * queue data out * ******************/ /* * queue dgram port to server */ void Client_SendDgramPort (XBBool nat) { assert (NULL != comm); if (!nat) { /* send port to server */ C2S_SendDgramPort (comm, D2S_Port (dgram)); } else { /* send "any port" to notify use of n.a.t. */ C2S_SendDgramPort (comm, 0); } Dbg_Client ("queued dgram port to server\n"); } /* Client_SendDgramPort */ /* * queue game config to server */ void Client_SendGameConfig (void) { /* TODO: currently only for completeness, move from com_to_server.c */ } /* Client_SendGameConfig */ /* * queue player configs to server */ void Client_SendPlayerConfigs (void) { /* TODO: currently only for completeness, move from com_to_server.c */ } /* Client_SendPlayerConfigs */ /* * queue a chat to server */ void Client_SendChat (XBChat * chat) { if (NULL != comm) { Dbg_Client ("queueing chat line\n"); C2S_SendChat (comm, chat); } } /* Client_SendChat */ /* * queue sync point */ void Client_SendSync (XBNetworkEvent event) { if (NULL != comm) { Dbg_Client ("queueing sync event #%u on stream\n", event); C2S_Sync (comm, event); } } /* Client_SendSync */ /* * queue local host state * TODO: remove, only temporarily needed for client toggle button */ void Client_SendHostState (unsigned state) { if (NULL != comm) { Dbg_Client ("queueing local host state #%u on stream\n", state); C2S_SendHostState (comm, state); } } /* Client_SendHostState */ /* * queue local host state request */ void Client_SendHostStateReq (unsigned id, unsigned state) { if (NULL != comm) { Dbg_Client ("queueing local host state request #%u->%u on stream\n", id, state); C2S_SendHostStateReq (comm, id, state); } } /* Client_SendHostStateReq */ /* * queue local team state request */ void Client_SendTeamStateReq (unsigned id, unsigned player, unsigned team) { if (NULL != comm) { Dbg_Client ("queueing team state request #%u(%u)->%u on stream\n", id, player, team); C2S_SendTeamStateReq (comm, id, player, team); } } /* Client_SendTeamStateReq */ /* * queue level negotiation status to server */ void Client_SendLevelCheck (void) { if (NULL != comm) { Dbg_Client ("queueing LevelCheck %u on stream\n", rejected); C2S_LevelCheck (comm, rejected); } } /* Client_SendLevelCheck */ /* * queue own action at gametime to server */ void Client_SendPlayerAction (int gameTime, const PlayerAction * keys) { D2S_SendPlayerAction (dgram, gameTime, keys); } /* Client_SendPlayerAction */ /* * queue end of level to server */ void Client_FinishPlayerAction (int gameTime) { Dbg_Client ("queueing finish at %u on dgram\n", gameTime); D2S_SendFinish (dgram, gameTime); } /* Client_FinishPlayerAction */ /* * flush out remaining data */ XBBool Client_FlushPlayerAction (void) { return D2S_Flush (dgram); } /* Client_FlushPlayerAction */ /* * queue winner team to server */ void Client_SendWinner (unsigned team) { if (NULL != comm) { Dbg_Client ("queueing winner team %u\n", team); C2S_SendWinner (comm, team); } } /* Client_SendWinner */ /*------------------------------------------------------------------------* * * query for local and remote games * *------------------------------------------------------------------------*/ /* * delete current list of network games */ static void DeleteGameList (void) { XBNetworkGameList *next; while (firstGame != NULL) { next = firstGame->next; /* delete data */ free (firstGame->game.host); free (firstGame->game.game); free (firstGame->game.version); free (firstGame); firstGame = next; } lastGame = NULL; nextGame = NULL; numGames = 0; } /* DeleteGameList */ /* * Search lan query * try to establish COMM_Query sockets for each interface * send query on all created sockets */ void Client_StartQuery (void) { size_t numInter; const XBSocketInterface *inter; size_t i, j; assert (NULL == query); inter = Socket_GetInterfaces (&numInter); if (NULL == inter) { Dbg_Client ("failed to find network interfaces, cancelling LAN query\n"); return; } /* alloc maximum possible pointers */ query = calloc (1 + numInter, sizeof (XBComm *)); assert (NULL != query); /* start query on each broadcast device */ for (i = 0, j = 0; i < numInter; i++) { if (NULL != inter[i].addrBroadcast && NULL != (query[j] = Query_CreateComm (i, inter[i].addrDevice, inter[i].addrBroadcast, 16168, XBTrue))) { Dbg_Client ("starting LAN query on #%lu to %s\n", (unsigned long)i, inter[i].addrBroadcast); j++; } else { Dbg_Client ("failed to start LAN query on #%lu to %s\n", (unsigned long)i, inter[i].addrBroadcast); } } Client_RestartQuery (); } /* Client_StartQuery */ /* * XBCC Search central query * try to establish COMM_Query sockets for each interface * send query on all created sockets */ void Client_StartCentralQuery (void) { size_t numInter; const XBSocketInterface *inter; #ifdef FULL_CENTRAL_QUERY size_t i, j; #endif CFGCentralSetup centralSetup; assert (NULL == query); inter = Socket_GetInterfaces (&numInter); if (NULL == inter) { Dbg_Client ("failed to find network interfaces, cancelling central query\n"); return; } RetrieveCentralSetup (¢ralSetup); if (NULL == centralSetup.name) { Dbg_Client ("failed to find central data, cancelling central query\n"); return; } #ifdef FULL_CENTRAL_QUERY /* alloc comm for each interface plus a NULL pointer (to central) */ query = calloc (1 + numInter, sizeof (XBComm *)); assert (NULL != query); /* start query on default device */ for (i = 0, j = 0; i < numInter; i++) { if (NULL != (query[j] = Query_CreateComm (i, inter[i].addrDevice, centralSetup.name, centralSetup.port, XBFalse))) { Dbg_Client ("starting central query on #%u to %s\n", i, centralSetup.name); j++; } else { Dbg_Client ("failed to start central query on #%u to %s\n", i, centralSetup.name); } } #else /* alloc comm for default interface plus a NULL pointer (to central) */ query = calloc (1 + 1, sizeof (XBComm *)); assert (NULL != query); /* start query on default device */ if (NULL != (query[0] = Query_CreateComm (0, NULL, centralSetup.name, centralSetup.port, XBFalse))) { Dbg_Client ("starting central query to %s\n", centralSetup.name); } else { Dbg_Client ("failed to start central query to %s\n", centralSetup.name); } #endif Client_RestartQuery (); } /* Client_StartCentralQuery */ /* * send a query on all valid COMM_Query sockets */ void Client_RestartQuery (void) { unsigned cnt = 0; DeleteGameList (); if (NULL != query) { struct timeval tv; int i; gettimeofday (&tv, NULL); for (i = 0; query[i] != NULL; i++) { if (!Query_isDeleted (query[i])) { Query_Send (query[i], &tv); cnt++; } } if (cnt > 0) { Dbg_Client ("requeued %u central/lan queries\n", cnt); } else { Dbg_Client ("no valid queries remaining, freeing memory\n"); Client_StopQuery (); } } } /* Client_RestartQuery */ /* * stop query to central/lan */ void Client_StopQuery (void) { size_t i; DeleteGameList (); /* return if alredy stopped */ if (NULL == query) { return; } /* delete all valid queries */ for (i = 0; query[i] != NULL; i++) { if (!Query_isDeleted (query[i])) { CommDelete (query[i]); } free (query[i]); } /* stop */ free (query); query = NULL; } /* Client_StopQuery */ /* * receive a close event on a query socket */ void Client_ReceiveQueryClose (unsigned id) { Dbg_Client ("query on interface #%u is closed\n", id); /* nothing else to do */ } /* Client_ReceiveQueryClose */ /* * receive reply from a game server on lan or central */ void Client_ReceiveReply (unsigned id, const char *host, unsigned short port, int ping, const char *version, const char *game, int numLives, int numWins, int frameRate) { XBNetworkGameList *ptr; /* alloc data */ ptr = calloc (1, sizeof (*ptr)); assert (NULL != ptr); /* fill in data */ ptr->game.id = id; ptr->game.host = DupString (host); ptr->game.port = port; ptr->game.ping = ping; ptr->game.version = DupString (version); ptr->game.game = DupString (game); ptr->game.numLives = numLives; ptr->game.numWins = numWins; ptr->game.frameRate = frameRate; /* append to list */ if (NULL == lastGame) { firstGame = lastGame = nextGame = ptr; } else { lastGame->next = ptr; lastGame = ptr; } Dbg_Client ("received network game data on interface #%u\n", id); /* inform application */ Network_QueueEvent (XBNW_NetworkGame, numGames++); } /* Client_ReceiveReply */ #ifdef unused /* * game info for application */ static const XBNetworkGame * Client_FirstNetworkGame (unsigned index) { unsigned i; const XBNetworkGame *ptr; /* find index-th game */ nextGame = firstGame; for (i = 0; i < index; i++) { if (nextGame == NULL) { return NULL; } nextGame = nextGame->next; } if (nextGame == NULL) { return NULL; } ptr = &nextGame->game; nextGame = nextGame->next; return ptr; } /* Client_FirstNetworkGame */ #endif /* * game info for application */ const XBNetworkGame * Client_NextNetworkGame (void) { const XBNetworkGame *ptr; if (NULL == nextGame) { return NULL; } ptr = &nextGame->game; nextGame = nextGame->next; return ptr; } /* Client_NextNetworkGame */ /* * end of file client.c */ xblast-2.10.4/client.h0000644000175000017500000001302510373126076013645 0ustar rhondaalfie/* * file client.h - communication interface for clients * * $Id: client.h,v 1.29 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_CLIENT_H #define XBLAST_CLIENT_H /* * global types */ typedef struct _xb_network_game { unsigned id; /* interface id */ char *host; /* address of server */ unsigned short port; /* port for game */ int ping; /* ping time */ char *version; /* version string */ char *game; /* name of the game */ int numLives; /* number of lives */ int numWins; /* number of levels to win */ int frameRate; /* frame per second */ } XBNetworkGame; typedef enum { XBCC_Loss, /* data loss on dgram */ XBCC_IOError, /* i/o error on stream */ XBCC_WriteError, /* write error on dgram */ XBCC_ConnFailed, /* connection failed on dgram */ XBCC_COTInvalid, /* invalid cot received */ XBCC_IDInvalid, /* invalid id received */ XBCC_DataInvalid, /* invalid data received */ XBCC_ExpectedEOF, /* expected close on stream */ XBCC_UnexpectedEOF, /* unexpected server disconnect */ XBCC_StreamWaiting, /* complete send of queued data */ XBCC_StreamBusy, /* partial send of queued data */ XBCC_StreamClosed, /* stream closed */ XBCC_DgramClosed, /* dgram closed */ } XBClientConstants; /* * global prototypes */ /* connecting/disconnecting */ extern XBBool Client_Connect (CFGGameHost *); extern void Client_Disconnect (void); extern void Client_SetDisconnected (XBBool); /* error handling */ extern XBBool Client_StreamEvent (XBClientConstants); extern XBBool Client_DgramEvent (XBClientConstants); /* receiving data */ extern XBBool Client_ReceiveGameConfig (unsigned, const char *data); extern void Client_ReceivePlayerConfig (unsigned, unsigned, const char *data); extern void Client_ReceiveDgramPort (unsigned id, unsigned short); extern void Client_ReceivePingTime (unsigned clientID, int ping); extern void Client_ReceiveGameConfigReq (unsigned); extern void Client_ReceivePlayerConfigReq (unsigned); extern void Client_ReceiveHostState (unsigned id, unsigned state); extern void Client_ReceiveTeamState (unsigned host, unsigned player, unsigned team); extern void Client_ReceiveHostStateReq (unsigned who, unsigned id, unsigned state); extern void Client_ReceiveTeamStateReq (unsigned who, unsigned host, unsigned player, unsigned team); extern void Client_ReceiveChat (XBChat *); extern void Client_ReceiveStart (unsigned); extern void Client_ReceiveSync (XBNetworkEvent); extern void Client_ReceiveLevelConfig (unsigned, const char *data); extern void Client_ReceiveRandomSeed (unsigned); extern void Client_ReceivePlayerAction (int, const PlayerAction *); extern void Client_ReceiveFinish (void); extern void Client_ReceiveAsync (XBBool as); extern XBBool Client_ReceiveDisconnect (unsigned); /* retrieving local data */ extern unsigned Client_GetHostState (unsigned id); extern int Client_GetPingTime (unsigned clientID); extern unsigned Client_GetHostState (unsigned id); extern unsigned *Client_GetHostStateReq (unsigned id); extern unsigned Client_GetTeamState (unsigned id, unsigned pl); extern unsigned *Client_GetTeamStateReq (unsigned id, unsigned pl); extern XBBool Client_RejectsLevel (void); extern XBBool Client_FixedLevel (void); extern void Client_GetPlayerAction (int, PlayerAction *); extern XBBool Client_LevelAsynced (void); /* setting local data */ extern void Client_LevelRejection (XBBool); extern void Client_LevelFix (XBBool); extern void Client_ClearPlayerAction (void); extern void Client_ResetPlayerAction (void); extern void Client_ActivateLevel (unsigned); extern void Client_SetLevelAsync (XBBool); /* queueing data */ extern void Client_SendDgramPort (XBBool nat); extern void Client_SendGameConfig (void); extern void Client_SendPlayerConfigs (void); extern void Client_SendHostState (unsigned state); extern void Client_SendHostStateReq (unsigned id, unsigned state); extern void Client_SendTeamStateReq (unsigned id, unsigned player, unsigned team); extern void Client_SendChat (XBChat * chat); extern void Client_SendSync (XBNetworkEvent); extern void Client_SendLevelCheck (void); extern void Client_SendPlayerAction (int, const PlayerAction *); extern void Client_FinishPlayerAction (int gameTime); extern XBBool Client_FlushPlayerAction (void); extern void Client_SendWinner (unsigned team); /* central queries */ extern void Client_StartQuery (void); extern void Client_StartCentralQuery (void); // XBCC extern void Client_RestartQuery (void); extern void Client_StopQuery (void); extern void Client_ReceiveQueryClose (unsigned); extern void Client_ReceiveReply (unsigned id, const char *host, unsigned short port, int ping, const char *version, const char *game, int numLives, int numWins, int frameRate); extern const XBNetworkGame *Client_NextNetworkGame (void); #endif /* * end of file client.h */ xblast-2.10.4/color.c0000644000175000017500000001403310372731123013472 0ustar rhondaalfie/* * file color.c - color and image manipulation * * $Id: color.c,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * global function: CchToPpm * description: converts ppm pixel data interpreting them as color/color/highlight * parameters: ppm - pixel data in ppm format * width - image width * height - image height * fg - base color (black most of the time) * bg - first color (for red pixels) * add - seconed color (for green pixels) */ void CchToPpm (unsigned char *ppm, int width, int height, XBColor fg, XBColor bg, XBColor add) { int x, y; unsigned red, green, blue; unsigned fgRgb[3]; unsigned bgRgb[3]; unsigned addRgb[3]; /* convert colors */ fgRgb[0] = GET_RED (fg); fgRgb[1] = GET_GREEN (fg); fgRgb[2] = GET_BLUE (fg); bgRgb[0] = GET_RED (bg); bgRgb[1] = GET_GREEN (bg); bgRgb[2] = GET_BLUE (bg); addRgb[0] = GET_RED (add); addRgb[1] = GET_GREEN (add); addRgb[2] = GET_BLUE (add); /* convert pixels */ for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { /* blue is highlight only */ ppm[0] -= ppm[2]; ppm[1] -= ppm[2]; /* calc 16bit colors */ red = 31 * ppm[2] + fgRgb[0] * 255 + bgRgb[0] * ppm[0] - fgRgb[0] * ppm[0] + addRgb[0] * ppm[1]; green = 31 * ppm[2] + fgRgb[1] * 255 + bgRgb[1] * ppm[0] - fgRgb[1] * ppm[0] + addRgb[1] * ppm[1]; blue = 31 * ppm[2] + fgRgb[2] * 255 + bgRgb[2] * ppm[0] - fgRgb[2] * ppm[0] + addRgb[2] * ppm[1]; /* cut off */ if (red > 8191) { red = 8191; } if (green > 8191) { green = 65535; } /* blue */ if (blue > 8191) { blue = 8191; } /* rgb values are 13bit here */ ppm[0] = red >> 5; ppm[1] = green >> 5; ppm[2] = blue >> 5; ppm += 3; } } } /* CchToPpm */ /* * global function: EpmToPpm * description: converts ppm pixel data interpreting them as color/color/highlight * parameters: ppm - pixel data in ppm format * width - image width * height - image height * fg - base color (black most of the time) * bg - first color (for red pixels) * add - seconed color (for green pixels) */ void EpmToPpm (unsigned char *epm, unsigned char *ppm, int width, int height, int ncolors, const XBColor * color) { int i, x, y; unsigned red, green, blue; unsigned *cRed, *cGreen, *cBlue; unsigned char **cEpm; assert (epm != NULL); assert (ppm != NULL); /* alloc temp color arrays */ cRed = malloc (ncolors * sizeof (unsigned)); assert (cRed != NULL); cGreen = malloc (ncolors * sizeof (unsigned)); assert (cGreen != NULL); cBlue = malloc (ncolors * sizeof (unsigned)); assert (cBlue != NULL); cEpm = malloc (ncolors * sizeof (unsigned char *)); assert (cEpm != NULL); /* convert colors */ for (i = 0; i < ncolors; i++) { cRed[i] = GET_RED (color[i]); cGreen[i] = GET_GREEN (color[i]); cBlue[i] = GET_BLUE (color[i]); cEpm[i] = epm + i * width * height; } /* convert pixels */ for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { red = blue = green = 0; for (i = 0; i < ncolors; i++) { red += cEpm[i][0] * cRed[i]; green += cEpm[i][0] * cGreen[i]; blue += cEpm[i][0] * cBlue[i]; cEpm[i]++; } /* cut off */ if (red > 8191) { red = 8191; } if (green > 8191) { green = 8191; } /* blue */ if (blue > 8191) { blue = 8191; } /* rgb values are 13bit here */ ppm[0] = red >> 5; ppm[1] = green >> 5; ppm[2] = blue >> 5; ppm += 3; } } free (cEpm); free (cBlue); free (cGreen); free (cRed); } /* EpmToPpm */ /* * convert color to string */ const char * ColorToString (XBColor color) { static char string[32]; assert (color != COLOR_INVALID); sprintf (string, "#%02x%02x%02x", GET_RED (color) << 3, GET_GREEN (color) << 3, GET_BLUE (color) << 3); return string; } /* ColorToString */ /* * parse color from string */ XBColor StringToColor (const char *string) { char hash; unsigned red, green, blue; assert (string != NULL); if (4 != sscanf (string, "%c%2x%2x%2x", &hash, &red, &green, &blue)) { return COLOR_INVALID; } if ('#' != hash) { return COLOR_INVALID; } return SET_COLOR (red >> 3, green >> 3, blue >> 3); } /* StringToColor */ /* * create lighter version of color */ XBColor LighterColor (XBColor color) { unsigned r, g, b; /* read colors */ r = GET_RED (color); g = GET_GREEN (color); b = GET_BLUE (color); /* convert */ r += r / 4 + XBCOLOR_DEPTH / 4; g += g / 4 + XBCOLOR_DEPTH / 4; b += b / 4 + XBCOLOR_DEPTH / 4; /* that'S all */ return SET_COLOR (r, g, b); } /* LighterColor */ /* * create lighter version of color */ XBColor DarkerColor (XBColor color) { unsigned r, g, b; /* read colors */ r = GET_RED (color); g = GET_GREEN (color); b = GET_BLUE (color); /* convert */ r -= r / 2; g -= g / 2; b -= b / 2; /* that'S all */ return SET_COLOR (r, g, b); } /* LighterColor */ /* * create a random color */ XBColor RandomColor (void) { return SET_COLOR (OtherRandomNumber (3) * XBCOLOR_DEPTH / 2, OtherRandomNumber (3) * XBCOLOR_DEPTH / 2, OtherRandomNumber (3) * XBCOLOR_DEPTH / 2); } /* RandomColor */ /* * end of file color.c */ xblast-2.10.4/color.h0000644000175000017500000000676210372731123013511 0ustar rhondaalfie/* * file color.h - color and image manipulation * * $Id: color.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COLOR_H #define _COLOR_H /* * type definitions */ typedef unsigned short XBColor; /* * macros for color manipulation */ #define XBCOLOR_DEPTH 31 #define SET_COLOR(r,g,b) ((XBColor) (((r) & 0x001F) << 10) | (XBColor) (((g) & 0x001F) << 5) | (XBColor) ((b) & 0x001F) ) #define GET_RED(c) (((c) >> 10) & 0x001F) #define GET_GREEN(c) (((c) >> 5) & 0x001F) #define GET_BLUE(c) ( (c) & 0x001F) /* * predefined colors */ #define COLOR_INVALID 0xFFFF #define COLOR_BLACK 0x0000 #define COLOR_WHITE 0x7FFF #define COLOR_RED SET_COLOR (31, 0, 0) #define COLOR_GREEN SET_COLOR ( 0, 31, 0) #define COLOR_BLUE SET_COLOR ( 0, 0, 31) #define COLOR_DARK_BLUE SET_COLOR ( 0, 0, 17) #define COLOR_DARK_SEA_GREEN SET_COLOR (17, 23, 17) #define COLOR_DARK_SLATE_GRAY_4 SET_COLOR (10, 17, 17) #define COLOR_DEEP_PINK SET_COLOR (31, 2, 18) #define COLOR_FIRE_BRICK_1 SET_COLOR (31, 6, 6) #define COLOR_FOREST_GREEN SET_COLOR ( 4, 17, 4) #define COLOR_GOLD SET_COLOR (31, 26, 0) #define COLOR_GRAY_25 SET_COLOR ( 8, 8, 8) #define COLOR_GRAY_75 SET_COLOR (24, 24, 24) #define COLOR_GREEN_YELLOW SET_COLOR (21, 31, 5) #define COLOR_INDIAN_RED SET_COLOR (25, 11, 11) #define COLOR_LIGHT_GOLDENROD SET_COLOR (29, 27, 16) #define COLOR_LIGHT_SALMON SET_COLOR (31, 20, 15) #define COLOR_LIGHT_STEEL_BLUE SET_COLOR (22, 24, 27) #define COLOR_LIGHT_YELLOW SET_COLOR (31, 31, 28) #define COLOR_MIDNIGHT_BLUE SET_COLOR ( 3, 3, 14) #define COLOR_NAVY_BLUE SET_COLOR ( 0, 0, 16) #define COLOR_ORANGE SET_COLOR (31, 20, 0) #define COLOR_ORANGE_RED SET_COLOR (31, 8, 0) #define COLOR_ORCHID SET_COLOR (27, 14, 26) #define COLOR_ROYAL_BLUE SET_COLOR ( 8, 13, 28) #define COLOR_SADDLE_BROWN SET_COLOR (17, 8, 2) #define COLOR_SPRING_GREEN SET_COLOR ( 0, 31, 15) #define COLOR_TAN SET_COLOR (26, 22, 17) #define COLOR_TURQUOISE SET_COLOR ( 8, 28, 21) #define COLOR_YELLOW SET_COLOR (31, 31, 0) /* * global prototypes */ extern void CchToPpm (unsigned char *ppm, int width, int height, XBColor fg, XBColor bg, XBColor add); extern void EpmToPpm (unsigned char *epm, unsigned char *ppm, int width, int height, int ncolors, const XBColor * color); extern const char *ColorToString (XBColor color); extern XBColor StringToColor (const char *string); extern XBColor LighterColor (XBColor color); extern XBColor DarkerColor (XBColor color); extern XBColor RandomColor (void); #endif /* * end of color.h */ xblast-2.10.4/com.c0000644000175000017500000000404210372731123013131 0ustar rhondaalfie/* * file com.c - toplevel functions for all communications * * $Id: com.c,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * file descriptor becomes writeable */ void CommWriteable (int fd) { /* find associated XBComm */ XBComm *comm = CommFind (fd); if (NULL != comm) { /* call write handler */ assert (NULL != comm->writeFunc); switch ((*comm->writeFunc) (comm)) { case XCR_Finished: case XCR_Error: /* remove on error or finish */ assert (NULL != comm->deleteFunc); (void)(*comm->deleteFunc) (comm); break; default: break; } } } /* CommWriteable */ /* * file descriptor becomes readable */ void CommReadable (int fd) { /* find associated XBComm */ XBComm *comm = CommFind (fd); if (NULL != comm) { /* call read handler */ assert (NULL != comm->readFunc); switch ((*comm->readFunc) (comm)) { case XCR_Finished: case XCR_Error: /* remove on error or finish */ assert (NULL != comm->deleteFunc); (void)(*comm->deleteFunc) (comm); break; default: break; } } } /* CommReadable */ /* * delete given communication */ void CommDelete (XBComm * comm) { assert (NULL != comm); assert (NULL != comm->deleteFunc); (void)(*comm->deleteFunc) (comm); } /* CommDelete */ /* * end of file com.c */ xblast-2.10.4/com.h0000644000175000017500000000240710372705221013141 0ustar rhondaalfie/* * file com.h - toplevel functions for all communications * * $Id: com.h,v 1.4 2006/02/09 18:31:45 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_H #define XBLAST_COM_H /* * type declarations */ typedef struct _xb_comm XBComm; /* types of communication */ typedef enum { XCR_OK = 0, XCR_Error, XCR_Finished, XCR_NoComm } XBCommResult; /* * global prototypes */ extern void CommWriteable (int fd); extern void CommReadable (int fd); extern void CommDelete (XBComm * comm); #endif /* * end of file com.h */ xblast-2.10.4/com_base.c0000644000175000017500000000640210377675254014146 0ustar rhondaalfie/* * file com_base.c - functions needed for all communications * * $Id: com_base.c,v 1.7 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ XBComm *list = NULL; /* * display current XBComm list */ static void CommDisplay (void) { unsigned int cnt = 0; XBComm *comm; for (comm = list; comm != NULL; comm = comm->next) { fprintf (stderr, "(%u,%u) ", comm->type, Socket_Fd (comm->socket)); cnt++; } fprintf (stderr, " - %u active instances\n", cnt); } /* CommDisplay */ /* * add a XBComm */ void CommInit (XBComm * comm, XBCommType type, XBSocket * socket, XBCommFunc readFunc, XBCommFunc writeFunc, XBCommFunc deleteFunc) { /* sanity checks */ assert (NULL != comm); assert (NULL != socket); /* add to list */ Dbg_Comm ("adding XBComm type = %u, fd = %u\n", type, Socket_Fd (socket)); comm->next = list; list = comm; comm->prev = NULL; if (NULL != comm->next) { comm->next->prev = comm; } /* set type */ comm->type = type; /* set socket */ comm->socket = socket; /* set handler */ comm->readFunc = readFunc; comm->writeFunc = writeFunc; comm->deleteFunc = deleteFunc; /* register socket for reading */ Socket_RegisterRead (comm->socket); #ifdef DEBUG_COMM CommDisplay (); #endif } /* CommInit */ /* * remove a XBComm from list, finish socket * does not free allocation for XBComm structure!! */ void CommFinish (XBComm * comm) { assert (comm != NULL); Dbg_Comm ("removing XBComm type = %u, fd = %u\n", comm->type, Socket_Fd (comm->socket)); /* unregister socket for reading */ Socket_UnregisterRead (comm->socket); Socket_UnregisterWrite (comm->socket); /* delete from list */ if (comm->next != NULL) { comm->next->prev = comm->prev; } if (comm->prev != NULL) { comm->prev->next = comm->next; } if (comm == list) { list = list->next; } /* close and free socket */ Net_Close (comm->socket); comm->socket = NULL; #ifdef DEBUG_COMM CommDisplay (); #endif } /* CommFinish */ /* * get socket data for XBComm */ XBSocket * CommSocket (XBComm * comm) { assert (NULL != comm); return comm->socket; } /* CommSocket */ /* * find XBComm associated to file descriptor */ XBComm * CommFind (int fd) { XBComm *comm; int cmp; for (comm = list; comm != NULL; comm = comm->next) { cmp = Socket_Fd (comm->socket); if (cmp < 0) { fprintf (stderr, "undefined socket! type=%u\n", comm->type); CommDisplay (); } if (fd == cmp) { return comm; } } return NULL; } /* CommFind */ /* * end of file com_base.c */ xblast-2.10.4/com_base.h0000644000175000017500000000425610372731123014137 0ustar rhondaalfie/* * file com_base.h * * $Id: com_base.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_BASE_H #define XBLAST_COM_BASE_H /* * type definitions */ /* types of communication */ typedef enum { XCS_Init, XCS_Connected, XCS_Finished, XCS_Start } XBCommStatus; /* types of communications */ typedef enum { COMM_ToServer, /* connection to server */ COMM_ToClient, /* connection to client */ COMM_DgServer, /* datagram link to server */ COMM_DgClient, /* datagram link to client */ COMM_Listen, /* listen for clients to connect */ COMM_Query, /* query for network games */ COMM_Reply, /* reply with network game */ COMM_NewGame, /* XBCC */ COMM_NewGameOK, /* XBCC */ COMM_ToCentral, /* XBCC connection to central */ COMM_FromCentral /* XBCC connection from central */ } XBCommType; /* process functions */ typedef XBCommResult (*XBCommFunc) (XBComm *); /* generic data of communication */ struct _xb_comm { XBCommType type; XBComm *next; XBComm *prev; XBSocket *socket; XBCommFunc readFunc; XBCommFunc writeFunc; XBCommFunc deleteFunc; }; /* * global prototypes */ extern void CommInit (XBComm * comm, XBCommType type, XBSocket * socket, XBCommFunc readFunc, XBCommFunc writeFunc, XBCommFunc deleteFunc); extern void CommFinish (XBComm * comm); extern XBSocket *CommSocket (XBComm * comm); extern XBComm *CommFind (int fd); #endif /* * end of file com_base.h */ xblast-2.10.4/com_browse.c0000644000175000017500000001475010372731123014521 0ustar rhondaalfie/* * file com_browse.c - base communication to browse for network games * * $Id: com_browse.c,v 1.10 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ struct _xb_browse_data { XBBrowseData *next; /* browse data block */ char *hostname; /* where to send the datagram */ unsigned short port; /* which port */ XBBool broadcast; /* broadcast flag */ XBDatagram *dgram; /* datagram to send */ }; /* * create a browse data block to be queued */ static XBBrowseData * CreateBrowseData (const char *hostname, unsigned port, XBBool broadcast, const XBBrowseTeleAny * tele) { XBBrowseData *ptr; size_t len; unsigned char data[MAX_DGRAM_SIZE]; /* write telegram */ assert (NULL != tele); len = BrowseTele_Write (tele, data); /* alloc data */ ptr = calloc (1, sizeof (XBBrowseData)); assert (NULL != ptr); /* set values */ ptr->hostname = (hostname != NULL) ? DupString (hostname) : NULL; ptr->port = port; ptr->broadcast = broadcast; ptr->dgram = Net_CreateDatagram (data, len); /* that's all */ return ptr; } /* CreateBrowseData */ /* * remove browse data, after being sent */ static void DeleteBrowseData (XBBrowseData * ptr) { assert (NULL != ptr); /* free the host name string */ if (NULL != ptr->hostname) { free (ptr->hostname); } /* free the datagram */ Net_DeleteDatagram (ptr->dgram); /* free the browse data itself */ free (ptr); } /* DeleteBrowseData */ /* * send a single queued data block */ static XBCommResult WriteBrowse (XBComm * comm) { XBBrowseData *next; /* get communication */ XBCommBrowse *bComm = (XBCommBrowse *) comm; assert (NULL != bComm); /* send data if any */ if (NULL != bComm->sndFirst) { if (!Net_SendDatagramTo (bComm->sndFirst->dgram, comm->socket, bComm->sndFirst->hostname, bComm->sndFirst->port, bComm->sndFirst->broadcast)) { Dbg_Browse ("failed to send datagram, closing the socket\n"); return XCR_Error; } Dbg_Browse ("successfully sent datagram to %s:%u %s\n", bComm->sndFirst->hostname, bComm->sndFirst->port, bComm->sndFirst->broadcast ? "broadcast" : ""); /* remove sent datagram from queue */ next = bComm->sndFirst->next; DeleteBrowseData (bComm->sndFirst); bComm->sndFirst = next; if (NULL == bComm->sndFirst) { bComm->sndLast = NULL; } } /* if queue empty, unregister for writing */ if (NULL == bComm->sndFirst) { Dbg_Browse ("write queue emptied!\n"); Socket_UnregisterWrite (CommSocket (comm)); assert (NULL != bComm->eventFunc); return (*bComm->eventFunc) (bComm, XBBE_Wait) ? XCR_Error : XCR_OK; } return XCR_OK; } /* WriteBrowse */ /* * browse socket has new data */ static XBCommResult ReadBrowse (XBComm * comm) { XBDatagram *rcv; const char *host; unsigned short port; const void *data; size_t len; XBBrowseTele tele; /* get communication */ XBCommBrowse *bComm = (XBCommBrowse *) comm; assert (NULL != bComm); /* try to get datagram and sender */ rcv = Net_ReceiveDatagramFrom (bComm->comm.socket, &host, &port); if (NULL == rcv) { Dbg_Browse ("failed to strip datagram layer, ignoring datagram\n"); assert (NULL != bComm->eventFunc); return (*bComm->eventFunc) (bComm, XBBE_Dgram) ? XCR_Error : XCR_OK; return XCR_OK; } /* get actual data from datagram */ data = Net_DgramData (rcv, &len); if (NULL == data) { Dbg_Browse ("no browse data, ignoring datagram\n"); assert (NULL != bComm->eventFunc); return (*bComm->eventFunc) (bComm, XBBE_Browse) ? XCR_Error : XCR_OK; return XCR_OK; } /* try to strip browse layer */ if (XBBT_None != BrowseTele_Parse (&tele, data, len)) { Net_DeleteDatagram (rcv); Dbg_Browse ("data extracted successfully, passing to parser!\n"); assert (NULL != bComm->receiveFunc); (*bComm->receiveFunc) (bComm, &tele, host, port); } else { Net_DeleteDatagram (rcv); Dbg_Browse ("no browse layer or unknown browse data, ignoring datagram\n"); assert (NULL != bComm->eventFunc); return (*bComm->eventFunc) (bComm, XBBE_Browse) ? XCR_Error : XCR_OK; } return XCR_OK; } /* ReadBrowse */ /* * intialize data structure */ XBComm * Browse_CommInit (XBCommBrowse * bComm, XBCommType commType, XBSocket * pSocket, BrowseReceiveFunc receiveFunc, BrowseEventFunc eventFunc, XBCommFunc deleteFunc) { assert (NULL != bComm); assert (NULL != receiveFunc); assert (NULL != eventFunc); /* set values */ CommInit (&bComm->comm, commType, pSocket, ReadBrowse, WriteBrowse, deleteFunc); bComm->sndFirst = NULL; bComm->receiveFunc = receiveFunc; bComm->eventFunc = eventFunc; Dbg_Browse ("created comm instance\n"); /* that's all */ return &bComm->comm; } /* Browse_CommInit */ /* * queue a browse datagram */ void Browse_Send (XBCommBrowse * bComm, const char *hostname, unsigned port, XBBool broadcast, const XBBrowseTeleAny * tele) { XBBrowseData *ptr; assert (NULL != bComm); /* append data to queue */ ptr = CreateBrowseData (hostname, port, broadcast, tele); if (NULL != bComm->sndLast) { bComm->sndLast->next = ptr; } else { bComm->sndFirst = ptr; } bComm->sndLast = ptr; Socket_RegisterWrite (CommSocket (&bComm->comm)); Dbg_Browse ("queued browse signal\n"); assert (NULL != bComm->eventFunc); (void)(*bComm->eventFunc) (bComm, XBBE_Write); } /* Browse_Send */ /* * remove a browse communication */ void Browse_Finish (XBCommBrowse * bComm) { XBBrowseData *next; /* clean up send queue */ while (NULL != bComm->sndFirst) { next = bComm->sndFirst->next; DeleteBrowseData (bComm->sndFirst); bComm->sndFirst = next; } /* clean up base communication */ CommFinish (&bComm->comm); Dbg_Browse ("finishing comm instance\n"); /* trigger close event */ assert (NULL != bComm->eventFunc); (void)(*bComm->eventFunc) (bComm, XBBE_Close); } /* Browse_Finish */ /* * end of file com_browse.c */ xblast-2.10.4/com_browse.h0000644000175000017500000000364410372731123014526 0ustar rhondaalfie/* * file com_browse.h - base communication to browse for network games * * $Id: com_browse.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_BROWSE_H #define XBLAST_COM_BROWSE_H /* * type definitions */ typedef struct _xb_comm_browse XBCommBrowse; typedef struct _xb_browse_data XBBrowseData; typedef enum { XBBE_Wait, XBBE_Write, XBBE_Dgram, XBBE_Browse, XBBE_Close, } XBBrowseEvent; /* receive handler */ typedef void (*BrowseReceiveFunc) (XBCommBrowse *, const XBBrowseTele * tele, const char *, unsigned short); /* activity handler */ typedef XBBool (*BrowseEventFunc) (XBCommBrowse *, XBBrowseEvent); struct _xb_comm_browse { XBComm comm; XBBrowseData *sndFirst; XBBrowseData *sndLast; BrowseReceiveFunc receiveFunc; BrowseEventFunc eventFunc; }; /* * global prototypes */ extern XBComm *Browse_CommInit (XBCommBrowse *, XBCommType, XBSocket *, BrowseReceiveFunc, BrowseEventFunc, XBCommFunc); extern void Browse_Send (XBCommBrowse * bComm, const char *hostname, unsigned port, XBBool broadcast, const XBBrowseTeleAny * tele); extern void Browse_Finish (XBCommBrowse *); #endif /* * end of file com_browse.h */ xblast-2.10.4/com_central.c0000644000175000017500000003132310412220337014636 0ustar rhondaalfie/* * file com_central.c - server answers to broadcasts by clients * * $Id: com_central.c,v 1.17 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ #define MAX_GAMES 256 #define DEAD_GAME_TIME 30 /* local XBComm data */ typedef struct { XBCommBrowse browse; unsigned short port; unsigned char serial; char *addrBroadcast; struct timeval tvSend; } XBCommCentral; /* entry types for game table */ typedef enum { EntryFree, EntryMess, EntryGame } XBEntryType; /* an entry */ typedef struct { XBEntryType type; unsigned short port; char game[48]; char host[32]; unsigned char version[3]; /* version numbers */ int gameID; int numLives; int numWins; int frameRate; time_t time; } XBEntry; /* game table and entry count */ XBEntry entries[MAX_GAMES]; unsigned int used = 0; /* state of games.html */ XBBool html = XBFalse; /******************** * manage game data * ********************/ /* * clear game table */ static void ClearGameTable (void) { unsigned int i; for (i = 0; i < MAX_GAMES; i++) { entries[i].type = EntryFree; } Dbg_C2B ("game table cleared\n"); used = 0; } /* ClearGameTable */ /* * find free slot */ static XBBool FindFreeEntry (unsigned int *i) { assert (NULL != i); /* check entry count first */ if (used == MAX_GAMES) { return XBFalse; } /* loop through table */ for (*i = 0; *i < MAX_GAMES; *i += 1) { if (entries[*i].type == EntryFree) { return XBTrue; } } /* should never be reached */ return XBFalse; } /* FindFreeEntry */ /* * add a message */ static XBBool AddMessage (char *txt, unsigned int len) { unsigned int i; /* find free entry */ if (!FindFreeEntry (&i)) { return XBFalse; } /* message */ entries[i].type = EntryMess; entries[i].port = 0; entries[i].version[0] = VERSION_MAJOR; entries[i].version[1] = VERSION_MINOR; entries[i].version[2] = VERSION_PATCH; entries[i].numLives = 0; entries[i].numWins = 0; entries[i].frameRate = 0; entries[i].time = time (NULL); memset (entries[i].game, 0, sizeof (entries[i].game)); if (len > sizeof (entries[i].game) - 1) { len = sizeof (entries[i].game) - 1; } memcpy (entries[i].game, txt, len); memset (entries[i].host, 0, sizeof (entries[i].host)); used++; Dbg_C2B ("adding message at #%u =%s=\n", i, entries[i].game); return XBTrue; } /* AddMessage */ /* * add a game entry, return index to fill in details */ static XBBool AddGame (unsigned int *i) { assert (NULL != i); /* find free entry */ if (!FindFreeEntry (i)) { return XBFalse; } /* game */ entries[*i].type = EntryGame; used++; return XBTrue; } /* AddGame */ /* * clear a single slot */ static void ClearEntry (unsigned int i) { assert (i < MAX_GAMES); Dbg_C2B ("clearing entry #%u, was type %u\n", i, entries[i].type); entries[i].type = EntryFree; used--; } /* ClearEntry */ /* * create a html file with current game entries */ static void MakeGameHtml (void) { FILE *f; time_t ltime; unsigned int i; unsigned int cnt = 0; html = XBFalse; f = fopen ("games.html", "w"); if (NULL == f) { Dbg_C2B ("failed to write games.html, trying later\n"); return; } fprintf (f, ""); for (i = 0; i < MAX_GAMES; i++) { switch (entries[i].type) { case EntryMess: fprintf (f, "", entries[i].game); break; case EntryGame: fprintf (f, "", entries[i].game); fprintf (f, "", entries[i].host, entries[i].port); fprintf (f, "", entries[i].numLives); fprintf (f, "", entries[i].numWins); fprintf (f, "", entries[i].frameRate); fprintf (f, "", entries[i].version[0], entries[i].version[1], entries[i].version[2]); fprintf (f, "", ctime (&entries[i].time)); cnt++; break; default: break; } } ltime = time (NULL); fprintf (f, "", cnt, ctime (<ime)); fclose (f); html = XBTrue; } /* MakeGameTextFile */ /* * create html file with shutdown message */ static void MakeShutdownHtml (void) { FILE *f; time_t ltime; f = fopen ("games.html", "w"); ltime = time (NULL); fprintf (f, "Game Central was shutdown at %s", ctime (<ime)); fclose (f); } /* MakeShutDownHtml */ /* * init game table */ static void InitGameTable (void) { char s[1024]; int l[16]; unsigned int n; unsigned int i; /* clear it first */ ClearGameTable (); /* read messages */ n = ReadMessageOfTheDay (1024, s, l); fprintf (stderr, "--CENTRAL MESSAGE OF THE DAY (%d)--\n", n); /* enter messages */ for (i = 0; i < n; i++) { assert (l[i + 1] >= l[i]); AddMessage (s + l[i], l[i + 1] - l[i]); } MakeGameHtml (); } /* InitGameTable */ /**************** * get/set data * ****************/ /* * return number of open games */ int C2B_GetOpenGames (void) { return used; } /* C2B_GetOpenGames */ /* * check all game entries for last update and delete dead games */ void C2B_ClearOldGames (void) { int n = 0, i; time_t now; now = time (NULL); for (i = 0; i < MAX_GAMES; i++) { switch (entries[i].type) { case EntryGame: if ((now - entries[i].time) > DEAD_GAME_TIME) { ClearEntry (i); n++; } break; default: break; } } if (n > 0 || !html) { Dbg_C2B ("%i dead game(s) removed, updating html\n", n); MakeGameHtml (); } } /* C2B_ClearOldGames */ /************************ * XBCommBrowse handler * ************************/ /* * Handle incoming request for games */ static void HandleQuery (XBCommCentral * rComm, const XBBrowseTeleQuery * query, const char *host, unsigned short port) { XBBrowseTeleReply tele; int i, n = 0; Dbg_C2B ("receiving query from %s:%u\n", host, port); memset (&tele, 0, sizeof (XBBrowseTeleReply)); /* build central */ tele.any.type = XBBT_Reply; tele.any.serial = query->any.serial; for (i = 0; i < MAX_GAMES; i++) { switch (entries[i].type) { case EntryMess: case EntryGame: tele.port = entries[i].port; tele.version[0] = entries[i].version[0]; tele.version[1] = entries[i].version[1]; tele.version[2] = entries[i].version[2]; tele.numLives = entries[i].numLives; tele.numWins = entries[i].numWins; tele.frameRate = entries[i].frameRate; strncpy (tele.game, entries[i].game, sizeof (tele.game)); strncpy (tele.host, entries[i].host, sizeof (tele.host)); Dbg_C2B ("queueing game data: %s %s:%u\n", entries[i].game, entries[i].host, entries[i].port); /* send it */ Browse_Send (&rComm->browse, host, port, XBFalse, &tele.any); n++; break; default: break; } } Dbg_C2B ("%i games queued\n", n); } /* HandleQuery */ /* * find a game entry matching host:port */ static XBBool FindHostEntry (const char *host, unsigned int *i) { assert (NULL != i); for (*i = 0; *i < MAX_GAMES; *i += 1) { switch (entries[*i].type) { case EntryGame: if (0 == strcmp (entries[*i].host, host)) { return XBTrue; } break; default: break; } } return XBFalse; } /* FindHostEntry */ /* * validate a received game ID */ static XBBool ValidateGameID (const char *host, unsigned int i) { /* is it valid game id? */ if (i >= MAX_GAMES || entries[i].type != EntryGame) { return XBFalse; } /* does host name match? */ if (0 != strcmp (entries[i].host, host)) { return XBFalse; } return XBTrue; } /* ValidateGameID */ /* * update game entry */ static void UpdateGameEntry (unsigned int i, const XBBrowseTeleNewGame * query, const char *host) { assert (i < MAX_GAMES); entries[i].port = query->port; entries[i].version[0] = query->version[0]; entries[i].version[1] = query->version[1]; entries[i].version[2] = query->version[2]; entries[i].numLives = query->numLives; entries[i].numWins = query->numWins; entries[i].frameRate = query->frameRate; entries[i].time = time (NULL); sprintf (entries[i].host, "%s", host); sprintf (entries[i].game, "%s", query->game); Dbg_C2B ("New game %s at %s:%i\n", entries[i].game, entries[i].host, entries[i].port); MakeGameHtml (); } /* UpdateGameEntry */ /* * Handle incoming game configs */ static void HandleNewGame (XBCommCentral * rComm, const XBBrowseTeleNewGame * query, const char *host, unsigned short port) { XBBrowseTeleNewGameOK tele; unsigned int i = query->gameID;; Dbg_C2B ("receiving new game from %s:%u\n", host, port); tele.any.type = XBBT_NewGameOK; tele.any.serial = query->any.serial; /* determine entry to write */ if (ValidateGameID (host, i)) { Dbg_C2B ("received valid game id = %u\n", i); UpdateGameEntry (i, query, host); } else if (FindHostEntry (host, &i)) { Dbg_C2B ("found other game from same host at id = %u, overwriting\n", i); UpdateGameEntry (i, query, host); } else if (AddGame (&i)) { Dbg_C2B ("adding a new game entry at %u\n", i); UpdateGameEntry (i, query, host); } else { Dbg_C2B ("failed to add, game table is full!\n"); } /* queue game id back to game server */ tele.gameID = i; Browse_Send (&rComm->browse, host, port, XBFalse, &tele.any); Dbg_C2B ("queued game ID = %i\n", i); /* update local html file with game entries */ MakeGameHtml (); } /* HandleNewGame */ /* * Handle incoming close requests */ static void HandleCloseGame (XBCommCentral * rComm, const XBBrowseTeleNewGameOK * query, const char *host, unsigned short port) { int i = query->gameID; Dbg_C2B ("receiving game close from %s:%u\n", host, port); if (ValidateGameID (host, i)) { Dbg_C2B ("received valid game id = %u, removing\n", i); ClearEntry (i); MakeGameHtml (); } else { Dbg_C2B ("failed to close game id = %u, invalid\n", i); } } /* HandleCloseGame */ /* * receive central data */ static void ReceiveCentral (XBCommBrowse * bComm, const XBBrowseTele * tele, const char *host, unsigned short port) { assert (NULL != bComm); assert (NULL != tele); assert (NULL != host); switch (tele->type) { case XBBT_Query: HandleQuery ((XBCommCentral *) bComm, &tele->query, host, port); break; case XBBT_NewGame: HandleNewGame ((XBCommCentral *) bComm, &tele->newGame, host, port); break; case XBBT_NewGameOK: HandleCloseGame ((XBCommCentral *) bComm, &tele->newGameOK, host, port); break; default: break; } } /* ReceiveCentral */ /* * handle browse event */ static XBBool EventCentral (XBCommBrowse * bComm, XBBrowseEvent ev) { switch (ev) { case XBBE_Wait: Dbg_C2B ("all datagrams sent\n"); break; case XBBE_Dgram: Dbg_C2B ("received invalid datagram, ignoring\n"); break; case XBBE_Browse: Dbg_C2B ("received invalid browse, ignoring\n"); break; case XBBE_Write: /* Dbg_C2B("datagrams wait to be sent\n"); */ break; case XBBE_Close: Dbg_C2B ("browse shutdown complete\n"); /* safe to free the XBComm structure now */ free (&bComm->comm); break; default: Dbg_C2B ("unknown browse event, ignoring!\n"); break; } return XBFalse; } /* EventCentral */ /* * XBComm delete handler for i/o errors */ static XBCommResult DeleteCentral (XBComm * comm) { XBCommCentral *rComm = (XBCommCentral *) comm; assert (NULL != rComm); /* remove the XBCommBrowse, trigger XBBE_Close */ Browse_Finish (&rComm->browse); /* clear */ ClearGameTable (); /* shutdown notice in games.html */ MakeShutdownHtml (); return XCR_OK; } /* DeleteCentral */ /* * create udp socket waiting for client queries */ XBComm * C2B_CreateComm (unsigned short port) { XBSocket *pSocket; XBCommCentral *rComm; /* create socket */ pSocket = Net_BindUdp (NULL, port); if (NULL == pSocket) { Dbg_C2B ("failed to create udp socket on port %u\n", port); return NULL; } Dbg_C2B ("listening on udp port %u\n", port); /* init game data */ InitGameTable (); /* create communication data structure */ rComm = calloc (1, sizeof (XBCommCentral)); assert (NULL != rComm); /* set handlers */ Browse_CommInit (&rComm->browse, COMM_NewGameOK, pSocket, ReceiveCentral, EventCentral, DeleteCentral); return &rComm->browse.comm; } /* C2B_CreateComm */ /* * end of file com_central.c */ xblast-2.10.4/com_central.h0000644000175000017500000000233510373126076014657 0ustar rhondaalfie/* * file com_central.h - central answers to browse from clients * * $Id: com_central.h,v 1.7 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_CENTRAL_H #define XBLAST_COM_CENTRAL_H /* * type definitions */ /* * global prototypes */ extern int C2B_GetOpenGames (void); extern void C2B_ClearOldGames (void); extern XBComm *C2B_CreateComm (unsigned short centralPort); #endif /* * end of file com_central.h */ xblast-2.10.4/com_dg_client.c0000644000175000017500000002477610375712062015165 0ustar rhondaalfie/* * file com_dg_client.c - send datagrams to client * * $Id: com_dg_client.c,v 1.17 2006/02/18 21:40:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define CLIENT_UDP_PORT(id) (16168+(id)) /* * local types */ typedef struct { XBCommDgram dgram; unsigned id; long ping; } XBCommDgramClient; /* * local variables */ static XBCommDgramClient *commList[MAX_HOSTS] = { /* this entry is never used (server) */ NULL, /* up to 5 clients can connect */ NULL, NULL, NULL, NULL, NULL, }; static int commCount = 0; /******************* * local functions * *******************/ /* * calculate difference for two timevals */ static void DiffTimeVal (struct timeval *diff, const struct timeval *a, const struct timeval *b) { assert (NULL != diff); assert (NULL != a); assert (NULL != b); diff->tv_sec = a->tv_sec - b->tv_sec; if (a->tv_usec < b->tv_usec) { diff->tv_usec = 1000000 + a->tv_usec - b->tv_usec; diff->tv_sec--; } else { diff->tv_usec = a->tv_usec - b->tv_usec; } } /* DiffTimeVal */ /******************** * polling function * ********************/ /* * polling for datagram connections */ static void PollDatagram (const struct timeval *tv) { int i, j; struct timeval dtSnd; struct timeval dtRcv; XBBool initPingTime = XBFalse; int pingTime[MAX_HOSTS]; assert (NULL != tv); for (i = 1; i < MAX_HOSTS; i++) { if (NULL != commList[i] && commList[i]->dgram.connected) { /* when was last datagram send */ DiffTimeVal (&dtSnd, tv, &commList[i]->dgram.lastSnd); DiffTimeVal (&dtRcv, tv, &commList[i]->dgram.lastRcv); /* send a ping to client, when no datagram was send for over 500ms */ if (dtSnd.tv_sec >= 1 || dtSnd.tv_usec > 500000) { if (!initPingTime) { pingTime[0] = -1; for (j = 1; j < MAX_HOSTS; j++) { pingTime[j] = commList[j] ? commList[j]->ping : -1; } initPingTime = XBTrue; } Dgram_SendPingData (&commList[i]->dgram, pingTime); } /* check last chance to send datagram */ if (0 != commList[i]->dgram.lastRcv.tv_sec && dtRcv.tv_sec > LINK_LOST) { /* inform application */ Dbg_D2C ("client %u timed out\n", i); Server_DgramEvent (i, XBSC_Timeout); } } } } /* PollDatagram */ /************ * handlers * ************/ /* * server received ping or times from client (times are ignored) */ static void ReceivePing (XBCommDgram * dgram, unsigned clientID, unsigned short pingTime) { struct timeval tvPing; XBCommDgramClient *dComm = (XBCommDgramClient *) dgram; /* server reacts to empty pings only */ if (0 == clientID) { assert (dComm != NULL); DiffTimeVal (&tvPing, &dgram->lastRcv, &dgram->lastSnd); dComm->ping = 1000L * tvPing.tv_sec + (tvPing.tv_usec) / 1000L; Dbg_D2C ("ping from client %u = %lu ms\n", dComm->id, dComm->ping); /* inform application */ Server_ReceivePing (dComm->id, dComm->ping); } } /* ReceivePing */ /* * server encountered some event while parsing * return XBTrue will trigger delete handler */ static XBBool ReceiveInfo (XBCommDgram * dgram, XBDgramInfo info) { XBCommDgramClient *dComm = (XBCommDgramClient *) dgram; assert (dComm != NULL); switch (info) { case XBDI_LOSS: Dbg_D2C ("future frames from client %u\n", dComm->id); return (Server_DgramEvent (dComm->id, XBSC_GameTime)); case XBDI_PARSED: Dbg_D2C ("Frames parsed [%lu,%lu]\n", (unsigned long)dgram->rcvfirst, (unsigned long)dgram->rcvnext); dgram->queue = dgram->rcvnext; return XBFalse; case XBDI_IGNORE: Dbg_D2C ("gametime %lu from client %u ignored\n", (unsigned long)dgram->ignore, dComm->id); return XBFalse; case XBDI_FINISH: Dbg_D2C ("Receiving FINISH from client %u\n", dComm->id); Server_ReceiveFinish (dComm->id); return XBFalse; case XBDI_CONSUCC: Dbg_D2C ("udp connection established to client %u\n", dComm->id); return XBFalse; case XBDI_CONFAIL: Dbg_D2C ("failed to connect to client %u\n", dComm->id); return (Server_DgramEvent (dComm->id, XBSC_ConnFailed)); case XBDI_WRITEERR: Dbg_D2C ("write error to client %u\n", dComm->id); return (Server_DgramEvent (dComm->id, XBSC_WriteError)); case XBDI_CLOSE: Dbg_D2C ("udp to client %u removed\n", dComm->id); D2C_Clear (dComm->id); return (Server_DgramEvent (dComm->id, XBSC_DgramClosed)); default: Dbg_D2C ("ignoring unknown dgram event (%u)\n", info); return XBFalse; } } /* ReceiveInfo */ /* * server received action from client */ static void ReceivePlayerAction (XBCommDgram * dgram, int gameTime, const PlayerAction * playerAction) { XBCommDgramClient *dComm = (XBCommDgramClient *) dgram; assert (dComm != NULL); Dbg_D2C ("Receiving action from client %u at gt=%u\n", dComm->id, gameTime); Server_ReceivePlayerAction (dComm->id, gameTime, playerAction); } /* ReceivePlayerAction */ /*************** * constructor * ***************/ /* * create datagram connection to a game client */ XBComm * D2C_CreateComm (unsigned id, const char *localname, XBBool fixedPort) { XBSocket *pSocket; /* sanity checks */ assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] == NULL); /* create socket */ pSocket = Net_BindUdp (localname, fixedPort ? CLIENT_UDP_PORT (id) : 0); if (NULL == pSocket) { Dbg_D2C ("failed to create socket to client %u\n", id); return NULL; } Dbg_D2C ("created socket to client %u on port %u\n", id, fixedPort ? CLIENT_UDP_PORT (id) : 0); /* create communication data structure */ commList[id] = calloc (1, sizeof (*commList[id])); assert (NULL != commList[id]); /* set values */ Dgram_CommInit (&commList[id]->dgram, COMM_DgClient, pSocket, ReceivePing, ReceiveInfo, ReceivePlayerAction); commList[id]->id = id; /* setup polling */ if (0 == commCount) { GUI_AddPollFunction (PollDatagram); } commCount++; /* that's all */ Dbg_D2C ("established handlers for client %u (poll #%u)\n", id, commCount); return &commList[id]->dgram.comm; } /* D2C_CreateComm */ /********************** * connect/disconnect * **********************/ /* * connect to game client port */ XBBool D2C_Connect (unsigned id, const char *host, unsigned short port) { /* sanity checks */ assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->dgram.comm.socket != NULL); /* connect socket */ if (port != 0) { /* connect to client address and port */ commList[id]->dgram.connected = Net_ConnectUdp (commList[id]->dgram.comm.socket, host, port); Dbg_D2C ("connecting to client %u (%s:%u) : %s\n", id, host, port, commList[id]->dgram.connected ? "ok" : "failed"); return commList[id]->dgram.connected; } else { /* client uses NAT we wait for his first datagram */ Dbg_D2C ("(NAT) setting expected host for client %u to %s\n", id, host); commList[id]->dgram.host = host; return XBTrue; } } /* D2C_Connect */ /* * clear connection data */ void D2C_Clear (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); commList[id] = NULL; /* disable polling */ commCount--; if (0 == commCount) { GUI_SubtractPollFunction (PollDatagram); } Dbg_D2C ("Cleared connection to client %u\n", id); } /* ClearConnection */ /* * disconnect given client */ void D2C_Disconnect (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* we only need to shutdown the socket */ Dbg_D2C ("disconnecting client %u\n", id); CommDelete (&commList[id]->dgram.comm); } /* D2C_Disconnect */ /****************** * get local data * ******************/ /* * get port for game client */ unsigned short D2C_Port (unsigned id) { return Dgram_Port (&commList[id]->dgram); } /* D2C_Port */ /* * is client connected ? */ XBBool D2C_Connected (unsigned id) { assert (id < MAX_HOSTS); return (commList[id] != NULL); } /* D2C_Connected */ /* * last ping time */ long D2C_LastPing (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (NULL != commList[id]); return commList[id]->ping; } /* D2C_Connected */ /****************** * set local data * ******************/ /* * reset communication after level start */ void D2C_Reset (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Dbg_D2C ("resetting frames for client %u\n", id); Dgram_Reset (&commList[id]->dgram); } /* D2C_Reset */ /* * set mask bytes for all client connections */ void D2C_SetMaskBytes (unsigned num) { unsigned id; assert (num < MAX_MASK_BYTES); for (id = 1; id < MAX_HOSTS; id++) { if (D2C_Connected (id)) { Dgram_SetMaskBytes (&commList[id]->dgram, num); } } Dbg_D2C ("setting mask bytes to %u\n", num); } /* D2C_SetMaskBytes */ /************** * queue data * **************/ /* * send player action to game client */ void D2C_SendPlayerAction (unsigned id, int gameTime, const PlayerAction * playerAction) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Dbg_D2C ("queueing actions for client %u at gt=%u\n", id, gameTime); Dgram_SendPlayerAction (&commList[id]->dgram, gameTime, playerAction); } /* D2C_SendPlayerAction */ /* * send finish level to game client */ void D2C_SendFinish (unsigned id, int gameTime) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Dbg_D2C ("queueing FINISH to client %u at gt=%u\n", id, gameTime); Dgram_SendFinish (&commList[id]->dgram, gameTime); } /* D2C_SendFinish */ /* * flush remaining datagrams */ XBBool D2C_Flush (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* for server, last send acknowledged if last receive equals last sent */ if (commList[id]->dgram.rcvnext == commList[id]->dgram.sndnext) { return XBFalse; } Dbg_D2C ("resending frames to client %u\n", id); return Dgram_Flush (&commList[id]->dgram); } /* D2C_Flush */ /* * end of file com_dg_client.c */ xblast-2.10.4/com_dg_client.h0000644000175000017500000000336610372731123015156 0ustar rhondaalfie/* * file com_dg_client.h - send datagrams to client * * $Id: com_dg_client.h,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_DG_CLIENT_H #define XBLAST_COM_DG_CLIENT_H /* * global prototypes */ /* constructor */ extern XBComm *D2C_CreateComm (unsigned id, const char *localname, XBBool fixedPort); /* connect/disconnect */ extern XBBool D2C_Connect (unsigned id, const char *host, unsigned short port); extern void D2C_Clear (unsigned id); extern void D2C_Disconnect (unsigned id); /* get local data */ extern unsigned short D2C_Port (unsigned id); extern XBBool D2C_Connected (unsigned id); extern long D2C_LastPing (unsigned id); /* set local data */ extern void D2C_Reset (unsigned id); extern void D2C_SetMaskBytes (unsigned bytes); /* queue data */ extern void D2C_SendPlayerAction (unsigned id, int gameTime, const PlayerAction * data); extern void D2C_SendFinish (unsigned id, int gameTime); extern XBBool D2C_Flush (unsigned id); #endif /* * end of file com_dg_client.h */ xblast-2.10.4/com_dg_server.c0000644000175000017500000001507510375712062015205 0ustar rhondaalfie/* * file com_dg_server.c - send ingame datagrams to server * * $Id: com_dg_server.c,v 1.16 2006/02/18 21:40:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * locals typedefs */ typedef struct { XBCommDgram dgram; } XBCommDgramServer; /*********** * handler * ***********/ /* * client received ping or times from server */ static void ReceivePing (XBCommDgram * dComm, unsigned clientID, unsigned short pingTime) { if (0 == clientID) { /* server wants a reply */ Dbg_D2S ("server requests ping, queueing ping\n"); Dgram_SendPing (dComm); } else { /* we have received the ping time of a client */ if (pingTime < 0xFFFE) { Client_ReceivePingTime (clientID, (int)((unsigned)pingTime)); Dbg_D2S ("server sends pingtime for client %u (%u)\n", clientID, pingTime); } else { Client_ReceivePingTime (clientID, -1); } } dComm->connected = XBTrue; } /* ReceivePing */ /* * client encountered some event while parsing * return XBTrue will trigger delete handler */ static XBBool ReceiveInfo (XBCommDgram * dgram, XBDgramInfo info) { assert (dgram != NULL); switch (info) { case XBDI_CONFAIL: Dbg_D2S ("failed to connect to server!\n"); return (Client_DgramEvent (XBCC_ConnFailed)); case XBDI_CONSUCC: Dbg_D2S ("udp connection established to server!\n"); return (Client_DgramEvent (XBCC_ConnFailed)); case XBDI_LOSS: Dbg_D2S ("data loss from server!\n"); return (Client_DgramEvent (XBCC_Loss)); case XBDI_FINISH: Dbg_D2S ("receive FINISH from server!\n"); Client_ReceiveFinish (); return XBFalse; case XBDI_IGNORE: Dbg_D2S ("gametime %lu from server ignored\n", (unsigned long)dgram->ignore); return XBFalse; case XBDI_PARSED: Dbg_D2S ("Frames parsed [%lu,%lu]\n", (unsigned long)dgram->rcvfirst, (unsigned long)dgram->rcvnext - 1); dgram->queue = dgram->rcvfirst; return XBFalse; case XBDI_WRITEERR: Dbg_D2S ("write error to server!\n"); return (Client_DgramEvent (XBCC_WriteError)); case XBDI_CLOSE: Dbg_D2C ("udp to server removed\n"); return (Client_DgramEvent (XBCC_DgramClosed)); default: Dbg_D2S ("unrecognized dgram info!\n"); return XBFalse; } } /* ReceiveInfo */ /* * client received player actions from server */ static void ReceivePlayerAction (XBCommDgram * dComm, int gameTime, const PlayerAction * playerAction) { Dbg_D2S ("actions for gt=%u received from server\n", gameTime); Client_ReceivePlayerAction (gameTime, playerAction); } /* ReceivePlayerAction */ /*************** * constructor * ***************/ /* * create datagram connection server */ XBComm * D2S_CreateComm (const char *localname, const char *hostname, unsigned short port) { XBCommDgramServer *dComm; XBSocket *pSocket; /* create socket */ pSocket = Net_BindUdp (localname, 0); if (NULL == pSocket) { Dbg_D2S ("failed to create udp to server\n"); return NULL; } Dbg_D2S ("created udp to server\n"); /* connect it */ if (!Net_ConnectUdp (pSocket, hostname, port)) { Net_Close (pSocket); Dbg_D2S ("failed to connect udp to server %s:%u\n", hostname, port); return NULL; } Dbg_D2S ("connected to server %s:%u\n", hostname, port); /* create communication data structure */ dComm = calloc (1, sizeof (*dComm)); assert (NULL != dComm); /* set values */ Dgram_CommInit (&dComm->dgram, COMM_DgServer, pSocket, ReceivePing, ReceiveInfo, ReceivePlayerAction); /* that's all */ return &dComm->dgram.comm; } /* D2C_CreateComm */ /****************** * get local data * ******************/ /* * get port for client */ unsigned short D2S_Port (const XBComm * comm) { return Dgram_Port ((const XBCommDgram *) comm); } /* D2C_Port */ /****************** * set local data * ******************/ /* * reset datagram connection */ void D2S_Reset (XBComm * comm) { Dbg_D2S ("resetting frames for server\n"); Dgram_Reset ((XBCommDgram *) comm); } /* D2S_Reset */ /* * set mask bytes */ void D2S_SetMaskBytes (XBComm * comm, unsigned num) { Dbg_D2S ("setting mask bytes to %u\n", num); Dgram_SetMaskBytes ((XBCommDgram *) comm, num); } /* D2S_SetMaskBytes */ /* * check for datagram timeout */ XBBool D2S_Timeout (const XBComm * comm, const struct timeval *tv) { const XBCommDgram *dgram = (const XBCommDgram *) comm; assert (NULL != dgram); assert (NULL != tv); return (0 != dgram->lastSnd.tv_sec && tv->tv_sec - dgram->lastSnd.tv_sec > LINK_LOST); } /* D2S_Timeout */ /* * check if server is already connected (i.e. has send a datagram) */ XBBool D2S_Connected (const XBComm * comm) { const XBCommDgram *dgram = (const XBCommDgram *) comm; assert (NULL != dgram); return dgram->connected; } /* D2S_Connected */ /************** * queue data * **************/ /* * send connect datagram to server */ void D2S_SendConnect (XBComm * comm) { if (comm != NULL) { Dgram_SendPing ((XBCommDgram *) comm); } } /* D2S_SendConnect */ /* * send player action to client */ void D2S_SendPlayerAction (XBComm * comm, int gameTime, const PlayerAction * playerAction) { if (comm != NULL) { Dbg_D2S ("queueing action for gt=%u to server\n", gameTime); Dgram_SendPlayerAction ((XBCommDgram *) comm, gameTime, playerAction); } } /* D2C_SendPlayerAction */ /* * acknowledge level finish */ void D2S_SendFinish (XBComm * comm, int gameTime) { if (comm != NULL) { Dbg_D2S ("queueing FINISH for server\n"); Dgram_SendFinish ((XBCommDgram *) comm, gameTime); } } /* D2S_SendFinish */ /* * flush data - resend last send unless acknowledged by remote */ XBBool D2S_Flush (XBComm * comm) { XBCommDgram *dgram = (XBCommDgram *) comm; assert (NULL != dgram); /* for client, last send acknowledged if last receive larger than last sent */ if (dgram->rcvnext > dgram->sndnext) { return XBFalse; } Dbg_D2S ("resending frames to server\n"); return Dgram_Flush (dgram); } /* D2S_Flush */ /* * end of file com_dg_server.c */ xblast-2.10.4/com_dg_server.h0000644000175000017500000000325410372731123015202 0ustar rhondaalfie/* * file com_dg_server.h - send ingame datagrams to server * * $Id: com_dg_server.h,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_DG_SERVER_H #define XBLAST_COM_DG_SERVER_H /* * global prototypes */ /* constructor */ extern XBComm *D2S_CreateComm (const char *local, const char *host, unsigned short port); /* get local data */ extern unsigned short D2S_Port (const XBComm *); extern XBBool D2S_Timeout (const XBComm *, const struct timeval *tv); extern XBBool D2S_Connected (const XBComm *); /* set local data */ extern void D2S_Reset (XBComm * comm); extern void D2S_SetMaskBytes (XBComm * comm, unsigned); /* queue data */ extern void D2S_SendConnect (XBComm * comm); extern void D2S_SendPlayerAction (XBComm * comm, int gameTime, const PlayerAction * data); extern void D2S_SendFinish (XBComm * comm, int gameTime); extern XBBool D2S_Flush (XBComm * comm); #endif /* * end of file com_dg_server.h */ xblast-2.10.4/com_dgram.c0000644000175000017500000003645310377675254014337 0ustar rhondaalfie/* * file com_dgram.c - base struct und functions for datagram connections * * $Id: com_dgram.c,v 1.20 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define GAME_TIME_PING 0xFFFF #define GAME_TIME_RESERVED 0xFFFE /* finish player mask as char array */ static unsigned char PLAYER_MASK_FINISH[MAX_MASK_BYTES] = { 0xFF, 0xFF, 0xFF, 0xFF }; /* * local variables */ static unsigned char buffer[MAX_DGRAM_SIZE]; /* * pack player action with given number of mask bytes */ static size_t PackPlayerAction (PackedPlayerAction * dst, const PlayerAction * src, size_t mbytes) { size_t i, j; unsigned char action; unsigned int intmask; assert (NULL != dst); assert (NULL != src); /* create packed action data and integer mask */ intmask = 0; for (i = 0, j = 0; i < MAX_PLAYER; i++) { action = PlayerActionToByte (src + i); if (0 != action) { intmask |= (1u << i); dst->action[j] = action; j++; } } /* number of actions byte to send */ dst->numBytes = j; /* convert integer mask to char array, low to high */ for (i = 0, j = 0; i < mbytes; i++, j += 8) { dst->mask[i] = 0xFF & (intmask >> j); } return dst->numBytes + mbytes; } /* PackPlayerAction */ /* * unpack player action, assume given number of mask bytes */ static size_t UnpackPlayerAction (PlayerAction * dst, const unsigned char *buf, size_t mbytes) { size_t i, j; unsigned int test, intmask; assert (NULL != dst); assert (NULL != buf); /* get integer mask from buffer */ intmask = 0; for (i = 0, j = 0; j < mbytes; i += 8, j++) { intmask += (buf[j] << i); } /* extract player actions using integer mask */ for (i = 0, j = mbytes, test = 1; i < MAX_PLAYER; i++, test <<= 1u) { if (intmask & test) { PlayerActionFromByte (dst + i, buf[j]); j++; } else { PlayerActionFromByte (dst + i, 0x00); } } /* return number of parsed bytes */ return j; } /* UnpackPlayerAction */ /* * show current status */ static void CurrentStatus (XBCommDgram * dComm) { assert (NULL != dComm); Dbg_Dgram ("rcv=(%lu,%lu), buf=(%lu,%lu), snd=(%lu,%lu), exp=%lu, queue=%lu\n", dComm->rcvfirst, (unsigned long)dComm->rcvfirst ? (unsigned long)dComm->rcvnext - 1 : 0, dComm->buffirst, (unsigned long)dComm->buffirst ? (unsigned long)dComm->bufnext - 1 : 0, dComm->sndfirst, (unsigned long)dComm->sndfirst ? (unsigned long)dComm->sndnext - 1 : 0, (unsigned long)dComm->expect, (unsigned long)dComm->queue); } /* CurrentStatus */ /* * handle a received ping time */ static void HandlePing (XBCommDgram * dComm, const unsigned char *data, size_t len) { size_t i, j; assert (NULL != dComm); /* call pingFunc once for each received time */ if (len > 0) { assert (NULL != data); for (i = 1, j = 0; i < MAX_HOSTS && j < len; i++, j += 2) { (*dComm->pingFunc) (dComm, i, (data[j + 1] << 8) + data[j]); } } /* call pingFunc for empty ping */ (*dComm->pingFunc) (dComm, 0, 0); Dbg_Dgram ("handle pings, len=%lu\n", (unsigned long)len); } /* HandlePing */ /* * handle received frames data */ static void HandleFrames (XBCommDgram * dComm, unsigned gameTime, const unsigned char *data, size_t len) { size_t i; XBBool ignored; static PlayerAction playerAction[MAX_PLAYER]; /* this frame is in the future ... */ assert (NULL != dComm->infoFunc); if (gameTime > dComm->expect) { Dbg_Out ("DGRAM: handle frames %ld-%d lost\n", (unsigned long)dComm->expect, gameTime - 1); if ((*dComm->infoFunc) (dComm, XBDI_LOSS)) { return; } } /* set first frame to send for client */ /* TODO: why is that needed? if needed, move to com_dg_server.c! if (! dComm->primary) { dComm->queue = gameTime; } */ dComm->rcvfirst = gameTime; i = 0; while (i + dComm->maskbytes - 1 < len) { ignored = XBFalse; /* extract finish or player action */ if (memcmp (PLAYER_MASK_FINISH, data + i, dComm->maskbytes) == 0) { Dbg_Dgram ("FINISH received for gt=%u\n", gameTime); (void)((*dComm->infoFunc) (dComm, XBDI_FINISH)); i += dComm->maskbytes; } else { i += UnpackPlayerAction (playerAction, data + i, dComm->maskbytes); if (gameTime != dComm->expect) { Dbg_Dgram ("ignoring action for gt=%u, expected gt=%lu\n", gameTime, (unsigned long)dComm->expect); dComm->ignore = gameTime; (void)((*dComm->infoFunc) (dComm, XBDI_IGNORE)); ignored = XBTrue; } else { Dbg_Dgram ("accepting action for gt=%u\n", gameTime); assert (dComm->actionFunc != NULL); (*dComm->actionFunc) (dComm, gameTime, playerAction); } } /* adjust datagrams to send */ if (!ignored) { dComm->expect++; } /* ready for next frame */ gameTime++; } if (len > i) { Dbg_Dgram ("ignoring %lu of received bytes\n", (unsigned long)(len - i)); } dComm->rcvnext = gameTime; (void)((*dComm->infoFunc) (dComm, XBDI_PARSED)); /* if (dComm->primary) { dComm->queue = gameTime; } */ } /* HandleFrames */ /* * receive datagram from readable socket */ static XBCommResult ReadDgram (XBComm * comm) { XBDatagram *rcv; const unsigned char *data; size_t len; unsigned gameTime; const char *host; unsigned short port; XBCommDgram *dComm = (XBCommDgram *) comm; assert (NULL != dComm); if (NULL == dComm->host) { /* get datagram for connected socket */ rcv = Net_ReceiveDatagram (comm->socket); if (rcv == NULL) { Dbg_Dgram ("failed to parse datagram, ignoring\n"); return XCR_OK; } Dbg_Dgram ("rcv datagram on connected socket\n"); } else { /* get datagram plus sender for unconnected socket */ rcv = Net_ReceiveDatagramFrom (comm->socket, &host, &port); if (rcv == NULL) { Dbg_Dgram ("failed to parse datagram, ignoring\n"); return XCR_OK; } Dbg_Dgram ("rcv datagram from %s:%u\n", host, port); /* match hosts */ if (0 == strcmp (host, dComm->host)) { dComm->connected = Net_ConnectUdp (comm->socket, host, port); if (dComm->connected) { Dbg_Dgram ("successfully connected!\n"); /* no further hostname checking */ dComm->host = NULL; (void)(*dComm->infoFunc) (dComm, XBDI_CONSUCC); } else { Dbg_Dgram ("failed to connect!\n"); assert (NULL != dComm->infoFunc); if ((*dComm->infoFunc) (dComm, XBDI_CONFAIL)) { Net_DeleteDatagram (rcv); return XCR_Error; } } } else { Dbg_Dgram ("datagram from unexpected host, ignoring!\n"); Net_DeleteDatagram (rcv); return XCR_OK; } } assert (NULL != rcv); /* save reception time for ping calculation */ gettimeofday (&dComm->lastRcv, NULL); /* copy data for application */ data = Net_DgramData (rcv, &len); if (len == 0) { /* no data -> empty ping */ HandlePing (dComm, data, 0); } else if (len >= 2) { /* first two bytes determine type otherwise */ gameTime = (data[1] << 8) + data[0]; if (GAME_TIME_PING == gameTime) { /* list of ping times */ HandlePing (dComm, data + 2, len - 2); } else if (GAME_TIME_RESERVED == gameTime) { /* reserved type for future extensions */ } else { /* frame data for given gametime */ HandleFrames (dComm, gameTime, data + 2, len - 2); } } /* received datagram is parsed now */ Net_DeleteDatagram (rcv); CurrentStatus (dComm); return XCR_OK; } /* ReadDgram */ /* * write current datagram to writeable socket */ static XBCommResult WriteDgram (XBComm * comm) { XBCommDgram *dComm = (XBCommDgram *) comm; assert (NULL != comm); /* unregister for next socket loop */ Socket_UnregisterWrite (CommSocket (comm)); /* buffer should be non-NULL, but assert fails occasionally */ /* assert(NULL != dComm->snd); */ if (NULL != dComm->snd) { /* try to send */ if (!Net_SendDatagram (dComm->snd, comm->socket)) { Dbg_Dgram ("failed to send datagram!\n"); assert (NULL != dComm->infoFunc); return (*dComm->infoFunc) (dComm, XBDI_WRITEERR) ? XCR_Error : XCR_OK; } /* success, update send info for frames */ dComm->sndfirst = dComm->buffirst; dComm->sndnext = dComm->bufnext; /* clear buffer */ Net_DeleteDatagram (dComm->snd); dComm->snd = NULL; dComm->buffirst = 0; dComm->bufnext = 0; /* store send time for ping calculations */ gettimeofday (&dComm->lastSnd, NULL); if (dComm->sndfirst < dComm->sndnext) { Dbg_Dgram ("sent frames [%lu,%lu]\n", (unsigned long)dComm->sndfirst,(unsigned long) dComm->sndnext - 1); } else { Dbg_Dgram ("sent pings\n"); } } CurrentStatus (dComm); return XCR_OK; } /* WriteDgram */ /* * free the XBComm structure */ static XBCommResult DeleteDgram (XBComm * comm) { XBCommDgram *dgram = (XBCommDgram *) comm; assert (dgram != NULL); CurrentStatus (dgram); if (NULL != dgram->snd) { Net_DeleteDatagram (dgram->snd); } (void)(dgram->infoFunc) (dgram, XBDI_CLOSE); CommFinish (&dgram->comm); free (dgram); Dbg_Dgram ("instance removed\n"); return XCR_OK; } /* DeleteDgram */ /* * create datagram communication structure */ XBComm * Dgram_CommInit (XBCommDgram * dComm, XBCommType commType, XBSocket * pSocket, DgramPingFunc pingFunc, DgramInfoFunc infoFunc, DgramActionFunc actionFunc) { assert (NULL != dComm); assert (NULL != pingFunc); assert (NULL != infoFunc); assert (NULL != actionFunc); /* set values */ CommInit (&dComm->comm, commType, pSocket, ReadDgram, WriteDgram, DeleteDgram); dComm->snd = NULL; dComm->port = Net_LocalPort (pSocket); dComm->host = NULL; dComm->connected = XBFalse; dComm->maskbytes = 1; dComm->rcvfirst = 0; dComm->rcvnext = 0; dComm->buffirst = 0; dComm->bufnext = 0; dComm->sndfirst = 0; dComm->sndnext = 0; dComm->ignore = 0; dComm->queue = 0; dComm->expect = 0; dComm->pingFunc = pingFunc; dComm->infoFunc = infoFunc; dComm->actionFunc = actionFunc; dComm->lastSnd.tv_sec = 0; dComm->lastSnd.tv_usec = 0; dComm->lastRcv.tv_sec = 0; dComm->lastRcv.tv_usec = 0; memset (dComm->ppa, 0, sizeof (dComm->ppa)); /* that's all */ Dbg_Dgram ("created at local port %u\n", dComm->port); CurrentStatus (dComm); return &dComm->comm; } /* D2C_CreateComm */ /* * get port for client */ unsigned short Dgram_Port (const XBCommDgram * dComm) { /* sanity checks */ assert (dComm != NULL); /* get value */ return dComm->port; } /* D2C_Port */ /* * reset read/write parameters */ void Dgram_Reset (XBCommDgram * dComm) { assert (dComm != NULL); Dbg_Dgram ("resetting\n"); /* clear any old datagrams */ if (NULL != dComm->snd) { Dbg_Dgram ("clear buffer [%lu:%lu]\n", (unsigned long)dComm->buffirst, (unsigned long)dComm->bufnext - 1); Net_DeleteDatagram (dComm->snd); dComm->snd = NULL; } dComm->buffirst = 0; dComm->bufnext = 0; dComm->rcvfirst = 0; dComm->rcvnext = 0; dComm->sndfirst = 0; dComm->sndnext = 0; dComm->expect = 1; dComm->queue = 1; memset (dComm->ppa, 0, sizeof (dComm->ppa)); CurrentStatus (dComm); } /* Dgram_Reset */ /* * set mask bytes */ void Dgram_SetMaskBytes (XBCommDgram * dComm, unsigned num) { assert (dComm != NULL); assert (num > 0); assert (num < MAX_MASK_BYTES); dComm->maskbytes = num; Dbg_Dgram ("setting mask bytes to %u\n", num); } /* Dgram_SetMaskBytes */ /* * write a ping to buffer unless buffer is occupied */ void Dgram_SendPing (XBCommDgram * dComm) { if (NULL == dComm->snd) { dComm->snd = Net_CreateDatagram (NULL, 0); Socket_RegisterWrite (CommSocket (&dComm->comm)); Dbg_Dgram ("Queueing ping\n"); } else { Dbg_Dgram ("Buffer occupied, discarding ping\n"); } } /* Dgram_SendPing */ /* * write ping data to buffer unless buffer is occupied */ void Dgram_SendPingData (XBCommDgram * dComm, const int pingTime[]) { size_t i; unsigned char pingData[2 * MAX_HOSTS]; if (NULL == dComm->snd) { assert (NULL != pingTime); /* setup buffer with ping times */ pingData[0] = 0xFF & (GAME_TIME_PING); pingData[1] = 0xFF & (GAME_TIME_PING >> 8); for (i = 1; i < MAX_HOSTS; i++) { pingData[2 * i] = 0xFF & ((unsigned)pingTime[i]); pingData[2 * i + 1] = 0xFF & ((unsigned)pingTime[i] >> 8); } dComm->snd = Net_CreateDatagram (pingData, 2 * MAX_HOSTS); Socket_RegisterWrite (dComm->comm.socket); Dbg_Dgram ("Queued ping times\n"); } else { Dbg_Dgram ("Buffer occupied, discarding ping times\n"); } } /* Dgram_SendPingData */ /* * queue player actions or finish to buffer */ static void CreateBuffer (XBCommDgram * dComm, int first, int next) { int i; size_t len; /* sanity check */ assert (dComm != NULL); /* clear any old datagrams */ if (NULL != dComm->snd) { Dbg_Dgram ("update buffer [%lu:%lu]\n", (unsigned long)dComm->buffirst, (unsigned long)dComm->bufnext - 1); Net_DeleteDatagram (dComm->snd); dComm->snd = NULL; } /* set time stamp */ memset (buffer, 0, sizeof (buffer)); buffer[0] = 0xFF & first; buffer[1] = 0xFF & (first >> 8); /* fill buffer */ len = 2; for (i = first; i < next; i++) { /* check if next action would overflow the buffer */ if (dComm->ppa[i].numBytes + dComm->maskbytes + len > sizeof (buffer)) { break; } /* copy action mask to buffer */ memcpy (buffer + len, dComm->ppa[i].mask, dComm->maskbytes); len += dComm->maskbytes; /* copy action data, if present */ if (dComm->ppa[i].numBytes > 0) { memcpy (buffer + len, dComm->ppa[i].action, dComm->ppa[i].numBytes); len += dComm->ppa[i].numBytes; } } /* store current buffer parameters */ dComm->buffirst = first; dComm->bufnext = i; /* prepare sending */ Socket_RegisterWrite (dComm->comm.socket); assert (dComm->snd == NULL); dComm->snd = Net_CreateDatagram (buffer, len); CurrentStatus (dComm); } /* Dgram_SendPlayerAction */ /* * send player action to client */ void Dgram_SendPlayerAction (XBCommDgram * dComm, int gameTime, const PlayerAction * playerAction) { /* sanity check */ assert (dComm != NULL); assert (gameTime < NUM_PLAYER_ACTION - 1); assert (playerAction != NULL); Dbg_Dgram ("queueing data for gt=%u\n", gameTime); /* pack data */ PackPlayerAction (dComm->ppa + gameTime, playerAction, dComm->maskbytes); /* update buffer */ CreateBuffer (dComm, dComm->queue, gameTime + 1); } /* Dgram_SendPlayerAction */ /* * acknowledge level finish */ void Dgram_SendFinish (XBCommDgram * dComm, int gameTime) { /* sanity check */ assert (dComm != NULL); assert (gameTime < NUM_PLAYER_ACTION); Dbg_Dgram ("queueing finish for gt=%u\n", gameTime); /* pack data */ dComm->ppa[gameTime].numBytes = 0; memcpy (dComm->ppa[gameTime].mask, PLAYER_MASK_FINISH, dComm->maskbytes); /* try to send it */ CreateBuffer (dComm, dComm->queue, gameTime + 1); } /* Dgram_SendFinish */ /* * flush - resend last batch of data */ XBBool Dgram_Flush (XBCommDgram * dComm) { assert (dComm != NULL); Dbg_Dgram ("flushing\n"); /* requeue last send */ CreateBuffer (dComm, dComm->sndfirst, dComm->sndnext); return XBTrue; } /* Dgram_Flush */ /* * end of file com_dgram.c */ xblast-2.10.4/com_dgram.h0000644000175000017500000000726710372731123014324 0ustar rhondaalfie/* * file com_dgram.h - base struct und functions for datagram connections * * $Id: com_dgram.h,v 1.14 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. */ #ifndef XBLAST_COM_DGRAM_H #define XBLAST_COM_DGRAM_H /* * macros */ #define MAX_DGRAM_BUFFER 32 #define LINK_LOST 10L #define NUM_PLAYER_ACTION (GAME_TIME+3) /* * type definitions */ typedef struct _xb_comm_dgram XBCommDgram; typedef enum { XBDI_LOSS, /* dataloss occurred */ XBDI_CONSUCC, /* connection success */ XBDI_CONFAIL, /* connection failure */ XBDI_PARSED, /* data is completely parsed */ XBDI_FINISH, /* FINISH received */ XBDI_WRITEERR, /* write error */ XBDI_IGNORE, /* data for a game time has been ignored */ XBDI_CLOSE, /* structure removed */ } XBDgramInfo; typedef void (*DgramPingFunc) (XBCommDgram *, unsigned, unsigned short); typedef void (*DgramFinishFunc) (XBCommDgram *); typedef void (*DgramActionFunc) (XBCommDgram *, int, const PlayerAction *); typedef XBBool (*DgramInfoFunc) (XBCommDgram *, XBDgramInfo); /* * local types */ typedef struct packed { size_t numBytes; unsigned char mask[MAX_MASK_BYTES]; unsigned char action[MAX_PLAYER]; unsigned char pad; } PackedPlayerAction; struct _xb_comm_dgram { XBComm comm; unsigned port; /* target port for connect */ const char *host; /* expected host name for unconnected */ XBBool connected; /* connect called or not */ /* extra data for frames */ size_t maskbytes; /* byte count for action mask */ size_t rcvfirst; /* first game time for last rcv */ size_t rcvnext; /* next game time for last rcv */ size_t buffirst; /* first game time in buffer */ size_t bufnext; /* next game time to add in buffer */ size_t sndfirst; /* first game time for last send */ size_t sndnext; /* next game time for last send */ size_t ignore; /* ignored gametime, for XBDI_IGNORE */ size_t queue; /* first game time for next queuing */ size_t expect; /* expected game time for next receive */ /* datagram to send on next writeability */ XBDatagram *snd; /* queued datagram for next send */ /* ping data */ struct timeval lastSnd; /* time of last send */ struct timeval lastRcv; /* time of last receive */ /* handlers */ DgramPingFunc pingFunc; /* ping handling */ DgramActionFunc actionFunc; /* action handling */ DgramInfoFunc infoFunc; /* info handling */ /* received player actions per game time */ PackedPlayerAction ppa[NUM_PLAYER_ACTION]; }; /* * global prototypes */ extern XBComm *Dgram_CommInit (XBCommDgram *, XBCommType, XBSocket *, DgramPingFunc, DgramInfoFunc, DgramActionFunc); extern unsigned short Dgram_Port (const XBCommDgram *); extern void Dgram_Reset (XBCommDgram *); extern void Dgram_SetMaskBytes (XBCommDgram *, unsigned); extern void Dgram_SendPing (XBCommDgram *); extern void Dgram_SendPingData (XBCommDgram *, const int pingData[]); extern void Dgram_SendPlayerAction (XBCommDgram *, int, const PlayerAction *); extern void Dgram_SendFinish (XBCommDgram *, int gameTime); extern void Dgram_SendChat (XBCommDgram *, unsigned, unsigned, const char *); extern XBBool Dgram_Flush (XBCommDgram * dgram); #endif /* * end of file com_dgram.h */ xblast-2.10.4/com_from_central.c0000644000175000017500000002717710372731123015702 0ustar rhondaalfie/* * file com_from_central.c - handle communications with clients * * $Id: com_from_central.c,v 1.9 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommStream stream; unsigned serial; unsigned cnt; } XBCommFromCentral; /* * local variables */ static XBCommFromCentral *commList[MAX_HOSTS] = { /* this entry is never used (server) */ NULL, /* up to 5 clients can connect */ NULL, NULL, NULL, NULL, NULL, }; /* total user count */ static unsigned usercount = 0; /* * handle registration request */ static void HandleRegistration (unsigned id, const char *data) { int pid; pid = Central_ReceivePlayerConfig (id, data); switch (pid) { case XBPV_Incomplete: break; default: C2X_QueueUserPID (id, pid); } } /* HandleRegistration */ /* * handle game stat */ static void HandleGameStat (unsigned id, const char *data) { switch (Central_ReceiveGameStat (data)) { case XBGS_Error: Dbg_C2X ("invalid game stat\n"); C2X_QueueDisconnect (id); break; case XBGS_Complete: Dbg_C2X ("game stat complete\n"); C2X_QueueDisconnect (id); break; case XBGS_Level: Dbg_C2X ("level stat applied\n"); break; default: break; } } /* HandleGameStat */ /* * user requests data */ static XBCommResult HandleRequestData (XBCommFromCentral * fromCentral, const XBTelegram * tele) { switch (Net_TeleID (tele)) { case XBT_ID_PlayerConfig: /* user requests rankings */ Dbg_C2X ("User %i requests player rankings\n", fromCentral->serial); C2X_QueuePlayerRankings (fromCentral->serial); break; default: Dbg_C2X ("User %i sent unknown request\n", fromCentral->serial); break; } return XCR_OK; } /* HandleRequestData */ /* * user sends data */ static XBCommResult HandleSendData (XBCommFromCentral * fromCentral, const XBTelegram * tele) { const char *data; size_t len; XBTeleIOB iob; /* get pointer to data */ data = Net_TeleData (tele, &len); /* get iob */ iob = Net_TeleIOB (tele); switch (Net_TeleID (tele)) { case XBT_ID_PlayerConfig: /* user sends player data to register */ /* Dbg_C2X("user %u registers player\n", fromCentral->serial); */ HandleRegistration (fromCentral->serial, data); break; case XBT_ID_GameStat: /* user sends level/game result */ Dbg_C2X ("user %u sends game stat\n", fromCentral->serial); HandleGameStat (fromCentral->serial, data); break; default: /* user sends unknown data */ Dbg_C2X ("user %u sends unknown data\n", fromCentral->serial); return XCR_OK; } return XCR_OK; } /* HandleSendData */ /* * user sends command */ static XBCommResult HandleActivate (XBCommFromCentral * fromCentral, const XBTelegram * tele) { const void *data; size_t len; /* unsigned value; */ data = Net_TeleData (tele, &len); switch (Net_TeleID (tele)) { case XBT_ID_RequestDisconnect: /* user has shutdown, expects eof */ Dbg_C2X ("user %u requests disconnect\n", fromCentral->serial); return XCR_Finished; default: /* user sends other command */ Dbg_C2X ("user %u sends unknown command\n", fromCentral->serial); break; } return XCR_OK; } /* HandleActivate */ /* * user sends spontaneous event */ static XBCommResult HandleSpontaneous (XBCommFromCentral * fromCentral, const XBTelegram * tele) { switch (Net_TeleID (tele)) { case XBT_ID_HostDisconnected: Dbg_C2X ("user %u starts disconnect announcement\n", fromCentral->serial); Central_ReceiveDisconnect (fromCentral->serial); return XCR_OK; default: Dbg_C2X ("user %u sends unknown event\n", fromCentral->serial); break; } return XCR_OK; } /* HandleSpontaneous */ /* * handle telegrams from users */ static XBCommResult HandleTelegram (XBCommStream * stream, const XBTelegram * tele) { XBCommFromCentral *fromCentral = (XBCommFromCentral *) stream; assert (fromCentral != NULL); switch (Net_TeleCOT (tele)) { case XBT_COT_RequestData: /* user requests data from central */ return HandleRequestData (fromCentral, tele); case XBT_COT_SendData: /* user sends data to central */ return HandleSendData (fromCentral, tele); case XBT_COT_Activate: /* server activate command on client */ return HandleActivate (fromCentral, tele); case XBT_COT_Spontaneous: /* server send spontaneous status change */ return HandleSpontaneous (fromCentral, tele); default: Dbg_C2X ("user %u sends unknown signal, disconnect\n", fromCentral->serial); return XCR_Error; } } /* HandleTelegram */ /* * XBComm delete handler */ static XBCommResult DeleteFromCentral (XBComm * comm) { XBCommFromCentral *fromcentral = (XBCommFromCentral *) comm; assert (comm != NULL); assert (fromcentral == commList[fromcentral->serial]); /* unmark client */ commList[fromcentral->serial] = NULL; /* clean comm stream, triggers close event */ Stream_CommFinish (&fromcentral->stream); return XCR_OK; } /* DeleteFromCentral */ /* * XBCommStream event handler */ static XBBool EventFromCentral (XBCommStream * comm, const XBStreamEvent ev) { XBCommFromCentral *fromcentral = (XBCommFromCentral *) comm; switch (ev) { case XBST_IOREAD: Dbg_C2X ("Read error to user %u, removing\n", fromcentral->serial); return XBTrue; case XBST_IOWRITE: Dbg_C2X ("Write error to user %u, removing\n", fromcentral->serial); return XBTrue; case XBST_EOF: Dbg_C2X ("Unexpected eof to user %u, removing\n", fromcentral->serial); return XBTrue; case XBST_WAIT: Dbg_C2X ("send queue to user %u emptied\n", fromcentral->serial); return XBFalse; case XBST_BUSY: /* Dbg_C2X("data remains to be sent to user %u\n", fromcentral->serial); */ return XBFalse; case XBST_CLOSE: /* inform parent layer of close */ Central_ConnectionClosed (fromcentral->serial, fromcentral->cnt); /* now XBComm memory can be safely freed */ free (comm); return XBFalse; default: Dbg_C2X ("unknown stream event to user %u\n", fromcentral->serial); return XBFalse; } } /* EventFromCentral */ /* * accept a TCP connection from a listen socket */ XBComm * C2X_CreateComm (const XBSocket * socket) { unsigned serial; XBSocket *pSocket; XBCommFromCentral *fromcentral; assert (socket != NULL); Dbg_C2X ("attempted connection, accepting\n"); /* accept tcp socket first */ pSocket = Net_Accept (socket); if (NULL == pSocket) { Dbg_C2X ("failed to accept connection, user disconnected\n"); return NULL; } /* get free serial */ for (serial = 1; serial < MAX_HOSTS; serial++) { if (NULL == commList[serial]) { break; } } /* check validity of serial */ if (serial >= MAX_HOSTS) { Dbg_C2X ("no free serial, disconnecting user\n"); Net_Close (pSocket); return NULL; } Dbg_C2X ("serial #%u assigned, counter %u\n", serial, usercount); /* create communication data structure */ fromcentral = calloc (1, sizeof (XBCommFromCentral)); assert (NULL != fromcentral); /* create XBCommStream */ Stream_CommInit (&fromcentral->stream, COMM_FromCentral, pSocket, HandleTelegram, EventFromCentral, DeleteFromCentral); /* set XBCommFromCentral specific data */ fromcentral->serial = serial; fromcentral->cnt = usercount; /* add to list of current connections */ commList[serial] = fromcentral; /* inform parent layer */ Central_Accept (serial, usercount++, Net_RemoteName (pSocket), Net_RemotePort (pSocket)); /* that's all */ return &fromcentral->stream.comm; } /* C2X_CreateComm */ /************ * get data * ************/ /* * check if client is connected */ XBBool C2X_Connected (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); return (commList[id] != NULL); } /* C2X_Connected */ /* * host address of user */ const char * C2X_HostName (unsigned id) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); /* get name from socket */ return Net_RemoteName (commList[id]->stream.comm.socket); } /* C2X_HostName */ /* * local address to user */ const char * C2X_LocalName (unsigned id) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); /* get name from socket */ return Net_LocalName (commList[id]->stream.comm.socket); } /* C2X_LocalName */ /************** * queue data * **************/ /* * queue player rankings to user */ void C2X_QueuePlayerRankings (unsigned id) { XBAtom atom; unsigned int count; unsigned int pid; unsigned int sent = 0; unsigned int i; /* sanity checks */ assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* get player count in database and check validity of atoms */ count = GetNumPlayerConfigs (CT_Central); for (i = 0; i < count; i++) { /* get pid atom */ atom = GetPlayerAtom (CT_Central, i); if (atom == ATOM_INVALID) { Dbg_C2X ("database player %u has no valid pid\n", i); continue; } /* extract position */ pid = GUI_AtomToInt (atom); if (pid > 0) { Dbg_C2X ("Sending player config pid %u\n", pid); if (!SendPlayerConfig (CT_Central, commList[id]->stream.sndQueue, XBT_COT_DataAvailable, 0, atom, XBFalse)) { Dbg_C2X ("Unable to queue player data pid %u\n", pid); } else { sent++; } } } Dbg_C2X ("%u players queued\n", sent); /* queue end of data */ Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_DataNotAvailable, XBT_ID_PlayerConfig, 0, NULL, 0)); /* mark socket for writing */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); return; } /* HandleRequestPlayerConfig */ /* * queue pid to user */ void C2X_QueueUserPID (unsigned id, int PID) { char tmp[16]; /* sanity check */ assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send pid as ascii */ sprintf (tmp, "%i", PID); /* queue data */ Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_DataAvailable, XBT_ID_PID, 0, tmp, strlen (tmp) + 1)); Dbg_C2X ("pid = %i queued to user %u\n", PID, id); /* mark socket for writing */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); } /* C2X_SendUserPID */ /* * send request for disconnect to given client */ void C2X_QueueDisconnect (unsigned id) { assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* queue disconnect announcement */ Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_HostDisconnected, 0, NULL, 0)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_RequestDisconnect, 0, NULL, 0)); Dbg_C2X ("disconnect announcement queued to user %u\n", id); /* mark socket for writing */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); /* remove socket when queue empty */ commList[id]->stream.prepFinish = XBTrue; /* socket can be cleared already */ commList[id] = NULL; Dbg_C2X ("user slot %u available again\n", id); } /* C2X_QueueDisconnect */ /* * end of file com_from_central.c */ xblast-2.10.4/com_from_central.h0000644000175000017500000000267610372731123015704 0ustar rhondaalfie/* * file com_to_central.h - handle communications with clients * * $Id: com_from_central.h,v 1.7 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COM_FROM_CENTRAL_H #define _COM_FROM_CENTRAL_H /* * global prototypes */ extern XBComm *C2X_CreateComm (const XBSocket * socket); /* get data */ extern XBBool C2X_Connected (unsigned id); extern const char *C2X_HostName (unsigned id); extern const char *C2X_LocalName (unsigned id); /* queue data */ extern void C2X_QueuePlayerRankings (unsigned id); extern void C2X_QueueUserPID (unsigned id, int PID); extern void C2X_QueueDisconnect (unsigned id); #endif /* * end of file com_to_central.h */ xblast-2.10.4/com_listen.c0000644000175000017500000000625510372731123014517 0ustar rhondaalfie/* * file com_listen.c - listen for client to connect * * $Id: com_listen.c,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBComm comm; XBBool shutdown; XBBool central; } XBCommListen; /* * handle readability = connection on listen socket */ static XBCommResult ReadListen (XBComm * comm) { XBCommListen *lComm = (XBCommListen *) comm; if (lComm->central) { if (NULL != (C2X_CreateComm (comm->socket))) { Dbg_Listen ("central user has connected\n"); } } else { if (NULL != (S2C_CreateComm (comm->socket))) { Dbg_Listen ("client has connected\n"); } } return XCR_OK; } /* ReadListen */ /* * handle writeability */ static XBCommResult WriteListen (XBComm * comm) { return XCR_OK; } /* WriteListen */ /* * handle delete */ static XBCommResult DeleteListen (XBComm * comm) { XBCommListen *lComm = (XBCommListen *) comm; Dbg_Listen ("removing listen socket on port %u, %s\n", Net_LocalPort (comm->socket), (lComm->shutdown) ? "expected" : "unexpected"); if (lComm->central) { /* implement this to catch errors on listen socket! User_ReceiveListenClose(lComm->shutdown); */ } else { Server_ReceiveListenClose (lComm->shutdown); } CommFinish (comm); free (comm); return XCR_OK; } /* DeleteListen */ /* * create listening tcp socket */ XBComm * CommCreateListen (const CFGGameHost * cfg, XBBool central) { XBSocket *pSocket; XBCommListen *lComm; assert (cfg != NULL); /* create listen socket */ pSocket = Net_ListenInet (cfg->port); if (NULL == pSocket) { Dbg_Listen ("failed to create socket on port %u\n", cfg->port); return NULL; } /* create communication data structure */ lComm = calloc (1, sizeof (XBCommListen)); assert (NULL != lComm); /* set values */ CommInit (&lComm->comm, COMM_Listen, pSocket, ReadListen, WriteListen, DeleteListen); /* store type of listen socket, shutdown flag */ lComm->central = central; lComm->shutdown = XBFalse; /* that's all */ Dbg_Listen ("listening on port %u now (%s)\n", Net_LocalPort (pSocket), central ? "central" : "server"); return &lComm->comm; } /* CommCreateListen */ /* * finish listen socket regularly */ void CommFinishListen (XBComm * comm) { XBCommListen *lComm = (XBCommListen *) comm; /* mark for shutdown */ lComm->shutdown = XBTrue; /* now delete */ DeleteListen (comm); } /* CommFinishListen */ /* * end of file com_listen.c */ xblast-2.10.4/com_listen.h0000644000175000017500000000220010372731123014506 0ustar rhondaalfie/* * file com_listen.h - listen for client to connect * * $Id: com_listen.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COM_LISTEN_H #define _COM_LISTEN_H /* * type definitions */ /* * global prototypes */ extern XBComm *CommCreateListen (const CFGGameHost *, XBBool central); extern void CommFinishListen (XBComm *); #endif /* * end of file com_listen.h */ xblast-2.10.4/com_newgame.c0000644000175000017500000001742110377675254014662 0ustar rhondaalfie/* * file com_newGame.c - client newGamees for local network game * * $Id: com_newgame.c,v 1.20 2006/02/24 21:29:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommBrowse browse; char *addrBroadcast; /* ip of receiver */ unsigned short port; /* port of receiver */ unsigned char serial; /* serial */ unsigned short gameport; /* server port */ int gameID; /* game id at central, initially -1 */ char *game; /* game name */ int numLives; /* number of lives */ int numWins; /* numberof wins */ int frameRate; /* frame rate, =0 for running games */ struct timeval tvSend; /* time of last queueing */ XBBool shutdown; /* flag for shutdown when queue emptied */ unsigned int replies; /* counter for replies */ } XBCommNewGame; /* * central sent Reply */ static void HandleReply (XBCommNewGame * qComm, const XBBrowseTeleNewGameOK * tele, const char *host) { long msec; struct timeval tv; /* calculate sping time */ gettimeofday (&tv, NULL); msec = (tv.tv_sec - qComm->tvSend.tv_sec) * 1000L + (tv.tv_usec - qComm->tvSend.tv_usec) / 1000L; /* update received id and reply counter */ qComm->gameID = tele->gameID; qComm->replies++; Dbg_Out ("NEWGAME: receive id=%i from %s (%ld msec, cnt=%u)\n", tele->gameID, host, msec, qComm->replies); } /* HandleReply */ /* * handle received data */ static void ReceiveNewGame (XBCommBrowse * bComm, const XBBrowseTele * tele, const char *host, unsigned short port) { assert (NULL != bComm); assert (NULL != tele); assert (NULL != host); switch (tele->type) { case XBBT_NewGameOK: HandleReply ((XBCommNewGame *) bComm, &tele->newGameOK, host); break; default: Dbg_Newgame ("ignoring invalid response\n"); break; } } /* ReceiveNewGame */ /* * handle event */ static XBBool EventNewGame (XBCommBrowse * bComm, XBBrowseEvent ev) { XBCommNewGame *qComm = (XBCommNewGame *) bComm; switch (ev) { case XBBE_Wait: Dbg_Newgame ("all data sent, %s\n", qComm->shutdown ? "shutting down" : "continuing"); return qComm->shutdown; case XBBE_Dgram: Dbg_Newgame ("received invalid datagram, ignoring\n"); break; case XBBE_Browse: Dbg_Newgame ("received invalid browse, ignoring\n"); break; case XBBE_Write: Dbg_Newgame ("new data waits to be sent\n"); break; case XBBE_Close: Dbg_Newgame ("browse shutdown complete\n"); break; default: Dbg_Newgame ("unknown browse event, ignoring!\n"); } return XBFalse; } /* EventNewGame */ /* * handle delete */ static XBCommResult DeleteNewGame (XBComm * comm) { XBCommNewGame *qComm = (XBCommNewGame *) comm; assert (NULL != qComm); Browse_Finish (&qComm->browse); assert (NULL != qComm->addrBroadcast); free (qComm->addrBroadcast); assert (NULL != qComm->game); free (qComm->game); free (qComm); Dbg_Newgame ("comm instance removed\n"); /* tell server to null query socket */ Server_ReceiveNewGameClose (); return XCR_OK; } /* DeleteNewGame */ /* * create NewGame communication to central on given device */ XBComm * NewGame_CreateComm (const char *addrDevice, unsigned short port, const char *addrBroadcast, const CFGGameHost * cfg, const CFGGameSetup * setup) { XBSocket *pSocket; XBCommNewGame *cComm; assert (NULL != addrBroadcast); /* create socket and bind to given interface */ pSocket = Net_BindUdp (addrDevice, 0); if (NULL == pSocket) { Dbg_Newgame ("failed to open udp socket on device %s\n", (addrDevice == NULL) ? "(auto)" : addrDevice); return NULL; } #ifndef sun /* some sun's don't like connected udp sockets and sendto */ if (!Net_ConnectUdp (pSocket, addrBroadcast, port)) { Socket_Close (pSocket); Dbg_Newgame ("failed to connect UDP socket to central %s:%u\n", addrBroadcast, port); return NULL; } #endif Dbg_Newgame ("created udp socket on %s:%u to central %s:%u\n", Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse), Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); /* create communication data structure */ cComm = calloc (1, sizeof (*cComm)); assert (NULL != cComm); /* set values */ Browse_CommInit (&cComm->browse, COMM_NewGame, pSocket, ReceiveNewGame, EventNewGame, DeleteNewGame); cComm->port = port; cComm->serial = 0; cComm->gameID = -1; cComm->addrBroadcast = DupString (addrBroadcast); cComm->tvSend.tv_sec = 0; cComm->tvSend.tv_usec = 0; cComm->gameport = cfg->port; cComm->game = DupString (cfg->game); cComm->numLives = setup->numLives; cComm->numWins = setup->numWins; cComm->frameRate = setup->frameRate; cComm->shutdown = XBFalse; cComm->replies = 0; /* that's all ? */ return &cComm->browse.comm; } /* NewGame_CreateComm */ /* * prepend waiting/scores to game name */ static void PrependData (int num, const char *score, char *name) { char tempString[48]; int len; /* create string to prepend */ if (num > 0) { /* server is waiting */ sprintf (tempString, "%d:", num); } else { /* game is busy */ if (strlen (score) < 48) { strcpy (tempString, score); } } /* append base name, max 48 bytes */ len = strlen (tempString); strncpy (tempString + len, name, 48 - len); /* ensure that new string is null-terminated */ tempString[47] = (char)'\0'; /* set as new basename */ strncpy (name, tempString, 48); } /* PrependData */ /* * queue current game data to central */ void NewGame_Send (XBComm * comm, const struct timeval *tv, int num, const char *score) { XBBrowseTeleNewGame tele; XBCommNewGame *qComm = (XBCommNewGame *) comm; assert (NULL != qComm); assert (NULL != tv); /* create browse telegram */ tele.any.type = XBBT_NewGame; tele.any.serial = ++qComm->serial; tele.gameID = qComm->gameID; tele.port = qComm->gameport; tele.version[0] = VERSION_MAJOR; tele.version[1] = VERSION_MINOR; tele.version[2] = VERSION_PATCH; tele.numLives = qComm->numLives; tele.numWins = qComm->numWins; tele.frameRate = (num > 0) ? qComm->frameRate : 0; strncpy (tele.game, qComm->game, sizeof (tele.game)); PrependData (num, score, tele.game); /* queue data */ Browse_Send (&qComm->browse, qComm->addrBroadcast, qComm->port, XBFalse, &tele.any); /* mark time */ qComm->tvSend = *tv; Dbg_Newgame ("queued new game data #%u to central %s:%hu\n", qComm->serial, qComm->addrBroadcast, qComm->port); } /* NewGame_Send */ /* * queue close request to central */ void NewGame_Close (XBComm * comm, const struct timeval *tv) { XBBrowseTeleNewGameOK tele; XBCommNewGame *qComm = (XBCommNewGame *) comm; assert (NULL != qComm); assert (NULL != tv); /* create browse telegram */ tele.any.type = XBBT_NewGameOK; tele.any.serial = ++qComm->serial; tele.gameID = qComm->gameID; /* queue data */ Browse_Send (&qComm->browse, qComm->addrBroadcast, qComm->port, XBFalse, &tele.any); /* mark time */ qComm->tvSend = *tv; /* mark for shutdown */ qComm->shutdown = XBTrue; Dbg_Newgame ("queued close #%u to central at %s:%hu, marking for shutdown\n", qComm->serial, qComm->addrBroadcast, qComm->port); } /* NewGame_Poll */ /* * end of file com_newGame.c */ xblast-2.10.4/com_newgame.h0000644000175000017500000000264010372731123014643 0ustar rhondaalfie/* * file com_newgame.h - client newGamees for local network game * * $Id: com_newgame.h,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_NEWGAME_H #define XBLAST_COM_NEWGAME_H /* * global prototypes */ extern XBComm *NewGame_CreateComm (const char *deviceAddress, unsigned short port, const char *broadcastAddress, const CFGGameHost * cfg, const CFGGameSetup * setup); extern void NewGame_Send (XBComm * qComm, const struct timeval *tv, int num, const char *score); extern void NewGame_Close (XBComm * comm, const struct timeval *tv); #endif /* * end of file com_newGame.h */ xblast-2.10.4/com_query.c0000644000175000017500000001617710375424577014411 0ustar rhondaalfie/* * file com_query.c - client queryes for local network game * * $Id: com_query.c,v 1.19 2006/02/17 19:52:31 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommBrowse browse; char *addrRemote; /* address to connect to */ unsigned short port; /* port of remote address */ unsigned char serial; /* datagram id */ struct timeval tvSend; /* time of last send */ unsigned id; /* interface id */ XBBool broadcast; /* broadcast flag */ XBBool deleted; /* deletion flag */ } XBCommQuery; /* * handle replies, from either a server or from central */ static void HandleReply (XBCommQuery * qComm, const XBBrowseTeleReply * tele, const char *host) { long msec; struct timeval tv; char version[32]; /* calculate ping time */ gettimeofday (&tv, NULL); msec = (tv.tv_sec - qComm->tvSend.tv_sec) * 1000L + (tv.tv_usec - qComm->tvSend.tv_usec) / 1000L; /* create remote version string */ sprintf (version, "V%u.%u.%u", (unsigned)tele->version[0], (unsigned)tele->version[1], (unsigned)tele->version[2]); /* check if it is response to latest query */ if (tele->any.serial != qComm->serial) { Dbg_Query ("received reply ignored, got serial %u, expected serial %u\n", tele->any.serial, qComm->serial); return; } /* check version and source, inform client */ if (((tele->version[0] == VERSION_MAJOR) && (tele->version[1] == VERSION_MINOR)) || (tele->frameRate == 0)) { /* versions match or message */ if (strlen (tele->host) <= 0) { /* server reply: host entry is empty/NULL */ Dbg_Query ("received reply for #%u - game \"%s\" at %s:%hu (%ld msec)\n", tele->any.serial, tele->game, host, tele->port, msec); Client_ReceiveReply (qComm->id, host, tele->port, msec, version, tele->game, tele->numLives, tele->numWins, tele->frameRate); } else { /* central reply: host entry not empty */ Dbg_Query ("received reply for #%u - game \"%s\" at %s:%hu (from central %ld msec)\n", tele->any.serial, tele->game, tele->host, tele->port, msec); Client_ReceiveReply (qComm->id, tele->host, tele->port, msec, version, tele->game, tele->numLives, tele->numWins, tele->frameRate); } } else { /* versions don't match and not message */ if (strlen (tele->host) <= 0) { /* server reply */ Dbg_Query ("received reply for #%u - game \"%s\" at %s:%hu (%ld msec), WRONG VERSION %s\n", tele->any.serial, tele->game, host, tele->port, msec, version); } else { /* central reply */ Dbg_Query ("received reply for #%u - game \"%s\" at %s:%hu (from central %ld msec), WRONG VERSION %s\n", tele->any.serial, tele->game, tele->host, tele->port, msec, version); } } } /* HandleReply */ /* * handle received data */ static void ReceiveQuery (XBCommBrowse * bComm, const XBBrowseTele * tele, const char *host, unsigned short port) { assert (NULL != bComm); assert (NULL != tele); assert (NULL != host); switch (tele->type) { case XBBT_Reply: HandleReply ((XBCommQuery *) bComm, &tele->reply, host); break; default: Dbg_Query ("receiving invalid signal %u, ignoring\n", tele->type); break; } } /* ReceiveQuery */ /* * handle browse event */ static XBBool EventQuery (XBCommBrowse * bComm, XBBrowseEvent ev) { #if defined(DEBUG_QUERY) || defined(WMS) XBCommQuery *qComm = (XBCommQuery *) bComm; unsigned id = qComm->id; #endif switch (ev) { case XBBE_Wait: Dbg_Query ("all data sent on #%u\n", id); break; case XBBE_Dgram: Dbg_Query ("received invalid datagram on #%u, ignoring\n", id); break; case XBBE_Browse: Dbg_Query ("received invalid browse on #%u, ignoring\n", id); break; case XBBE_Write: Dbg_Query ("new data waits to be sent on #%u\n", id); break; case XBBE_Close: Dbg_Query ("browse shutdown complete for #%u\n", id); break; default: Dbg_Query ("unknown browse event on #%u, ignoring!\n", ev); } return XBFalse; } /* EventQuery */ /* * Delete handler for COMM_Query sockets * frees contents of structure but not the structure itself * deleted entry indicates state of the structure */ static XBCommResult DeleteQuery (XBComm * comm) { XBCommQuery *qComm = (XBCommQuery *) comm; assert (NULL != qComm); assert (!qComm->deleted); Browse_Finish (&qComm->browse); assert (NULL != qComm->addrRemote); free (qComm->addrRemote); /* mark as deleted, do *not* free qComm yet */ qComm->deleted = XBTrue; /* inform client */ Client_ReceiveQueryClose (qComm->id); return XCR_OK; } /* DeleteQuery */ /* * create broadcast socket to query for network games/central games */ XBComm * Query_CreateComm (unsigned id, const char *local, const char *remote, unsigned short port, XBBool broadcast) { XBSocket *pSocket; XBCommQuery *qComm; assert (NULL != remote); /* create socket */ pSocket = Net_BindUdp (local, 0); if (NULL == pSocket) { Dbg_Query ("failed to establish query socket on %s to %s:%u\n", (local == NULL) ? "auto" : local, remote, port); return NULL; } Dbg_Query ("established udp socket on %s:%u\n", Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); /* create communication data structure */ qComm = calloc (1, sizeof (*qComm)); assert (NULL != qComm); /* set values */ Browse_CommInit (&qComm->browse, COMM_Query, pSocket, ReceiveQuery, EventQuery, DeleteQuery); qComm->addrRemote = DupString (remote); qComm->port = port; qComm->serial = 0; qComm->tvSend.tv_sec = 0; qComm->tvSend.tv_usec = 0; qComm->id = id; qComm->broadcast = broadcast; qComm->deleted = XBFalse; /* that's all ? */ return &qComm->browse.comm; } /* Query_CreateComm */ /* * return deletion flag */ XBBool Query_isDeleted (XBComm * comm) { XBCommQuery *qComm = (XBCommQuery *) comm; assert (comm->type == COMM_Query); assert (NULL != qComm); return qComm->deleted; } /* Query_isDeleted */ /* * query central/lan for games */ void Query_Send (XBComm * comm, const struct timeval *tv) { XBBrowseTeleQuery tele; XBCommQuery *qComm = (XBCommQuery *) comm; assert (NULL != qComm); assert (NULL != tv); /* create browse datagram */ tele.any.type = XBBT_Query; tele.any.serial = ++qComm->serial; /* queue data */ Browse_Send (&qComm->browse, qComm->addrRemote, qComm->port, qComm->broadcast, &tele.any); /* mark time */ qComm->tvSend = *tv; Dbg_Query ("queued query #%u to %s:%hu\n", qComm->serial, qComm->addrRemote, qComm->port); } /* Query_Send */ /* * end of file com_query.c */ xblast-2.10.4/com_query.h0000644000175000017500000000250310372731123014363 0ustar rhondaalfie/* * file com_query.h - client queryes for local network game * * $Id: com_query.h,v 1.9 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_QUERY_H #define XBLAST_COM_QUERY_H /* * global prototypes */ extern XBComm *Query_CreateComm (unsigned id, const char *local, const char *remote, unsigned short port, XBBool broadcast); extern void Query_Send (XBComm * qComm, const struct timeval *tv); extern void Query_NewGame (XBComm * qComm, const struct timeval *tv); extern XBBool Query_isDeleted (XBComm * qComm); #endif /* * end of file com_query.h */ xblast-2.10.4/com_reply.c0000644000175000017500000001046010372731123014345 0ustar rhondaalfie/* * file com_reply.c - server answers to broadcasts by clients * * $Id: com_reply.c,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommBrowse browse; unsigned short port; /* server port */ char *game; /* game name */ int numLives; /* number of lives */ int numWins; /* number of wins */ int frameRate; /* frame rate */ } XBCommReply; /* * received a query from a client */ static void HandleQuery (XBCommReply * rComm, const XBBrowseTeleQuery * query, const char *host, unsigned short port) { XBBrowseTeleReply tele; memset (&tele, 0, sizeof (tele)); /* build reply */ tele.any.type = XBBT_Reply; tele.any.serial = query->any.serial; tele.port = rComm->port; tele.version[0] = VERSION_MAJOR; tele.version[1] = VERSION_MINOR; tele.version[2] = VERSION_PATCH; tele.numLives = rComm->numLives; tele.numWins = rComm->numWins; tele.frameRate = rComm->frameRate; strncpy (tele.game, rComm->game, sizeof (tele.game)); strncpy (tele.host, "", sizeof (tele.host)); /* queue data */ Browse_Send (&rComm->browse, host, port, XBFalse, &tele.any); /* --- */ Dbg_Reply ("query from %s:%hu, queued reply\n", host, port); } /* HandleQuery */ /* * handle received data */ static void ReceiveReply (XBCommBrowse * bComm, const XBBrowseTele * tele, const char *host, unsigned short port) { assert (NULL != bComm); assert (NULL != tele); assert (NULL != host); switch (tele->type) { case XBBT_Query: HandleQuery ((XBCommReply *) bComm, &tele->query, host, port); break; default: Dbg_Reply ("ignoring invalid query from %s:%u\n", host, port); break; } } /* ReceiveReply */ /* * handle browse events */ static XBBool EventReply (XBCommBrowse * bComm, XBBrowseEvent ev) { /* XBCommReply *rComm = (XBCommReply *) bComm; */ switch (ev) { case XBBE_Wait: Dbg_Reply ("all data sent\n"); break; case XBBE_Dgram: Dbg_Reply ("received invalid datagram, ignoring\n"); break; case XBBE_Browse: Dbg_Reply ("received invalid browse, ignoring\n"); break; case XBBE_Write: Dbg_Reply ("new data waits to be sent\n"); break; case XBBE_Close: Dbg_Reply ("browse shutdown complete\n"); break; default: Dbg_Newgame ("unknown browse event, ignoring!\n"); } return XBFalse; } /* EventReply */ /* * handle delete */ static XBCommResult DeleteReply (XBComm * comm) { XBCommReply *rComm = (XBCommReply *) comm; assert (NULL != rComm); Browse_Finish (&rComm->browse); assert (NULL != rComm->game); free (rComm->game); free (rComm); Dbg_Reply ("comm instance removed\n"); return XCR_OK; } /* DeleteReply */ /* * create udp socket waiting for clients' queries */ XBComm * Reply_CreateComm (unsigned short port, const CFGGameHost * cfg, const CFGGameSetup * setup) { XBSocket *pSocket; XBCommReply *rComm; assert (NULL != cfg); assert (NULL != setup); /* create socket */ pSocket = Net_BindUdp (NULL, port); if (NULL == pSocket) { Dbg_Reply ("failed to create listening udp socket!\n"); return NULL; } Dbg_Reply ("listening udp socket created\n"); /* create communication data structure */ rComm = calloc (1, sizeof (*rComm)); assert (NULL != rComm); /* set values */ Browse_CommInit (&rComm->browse, COMM_Reply, pSocket, ReceiveReply, EventReply, DeleteReply); rComm->port = cfg->port; rComm->game = DupString (cfg->game); rComm->numLives = setup->numLives; rComm->numWins = setup->numWins; rComm->frameRate = setup->frameRate; /* that's all ? */ return &rComm->browse.comm; } /* Reply_CreateComm */ /* * end of file com_reply.c */ xblast-2.10.4/com_reply.h0000644000175000017500000000222610372731123014353 0ustar rhondaalfie/* * file com_reply.h - server answers to broadcasts by clients * * $Id: com_reply.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_REPLY_H #define XBLAST_COM_REPLY_H /* * type definitions */ /* * global prototypes */ extern XBComm *Reply_CreateComm (unsigned short replyPort, const CFGGameHost * cfg, const CFGGameSetup *); #endif /* * end of file com_reply.h */ xblast-2.10.4/com_stream.c0000644000175000017500000001322210372731123014504 0ustar rhondaalfie/* * file com_stream.c - base struct und functions for stream connections * * $Id: com_stream.c,v 1.12 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * try to read telegrams from server */ static XBCommResult ReadStream (XBComm * comm) { XBTeleResult result; XBTelegram *tele; XBCommResult cResult; XBCommStream *stream = (XBCommStream *) comm; unsigned fd; assert (NULL != stream); /* get file descriptor for debug output */ fd = Socket_Fd (stream->comm.socket); /* read data into queue */ result = Net_Receive (stream->rcvQueue, stream->comm.socket); if (stream->prepFinish) { /* reading while waiting for eof */ switch (result) { case XBT_R_EndOfFile: Dbg_Stream ("expected end of file on fd=%u\n", fd); break; case XBT_R_IOError: Dbg_Stream ("read error on fd=%u while waiting for eof\n", fd); break; default: Dbg_Stream ("successful read on fd=%u while waiting for eof\n", fd); break; } /* only stream remains to be removed, sends close to parent layer */ Stream_CommFinish (stream); return XCR_OK; } else { /* active mode */ switch (result) { case XBT_R_EndOfFile: Dbg_Stream ("unexpected end of file on fd=%u\n", fd); /* eof event to parent layer */ (void)(*stream->eventFunc) (stream, XBST_EOF); return XCR_Finished; case XBT_R_IOError: Dbg_Stream ("read error on fd=%u\n", fd); /* state change to parent layer */ assert (stream->eventFunc != NULL); (void)(*stream->eventFunc) (stream, XBST_IOREAD); return XCR_Error; default: Dbg_Stream ("successful read on fd=%u\n", fd); } } /* data in rcv queue, handle as much as possible */ assert (stream->handleFunc != NULL); while (NULL != (tele = Net_ReceiveTelegram (stream->rcvQueue))) { /* handle a single message */ cResult = (*stream->handleFunc) (stream, tele); /* message not needed anymore */ Net_DeleteTelegram (tele); /* return if handling fails, otherwise continue */ if (cResult != XCR_OK) { Dbg_Stream ("parse error on fd=%u, shutting down\n", fd); return cResult; } } return XCR_OK; } /* ReadStream */ /* * XBComm write handler for XBCommStream */ static XBCommResult WriteStream (XBComm * comm) { XBTeleResult result; XBCommStream *stream = (XBCommStream *) comm; unsigned fd; assert (NULL != stream); /* get file descriptor for debug output */ fd = Socket_Fd (stream->comm.socket); /* send top element of send queue */ result = Net_Send (stream->sndQueue, stream->comm.socket); switch (result) { case XBT_R_Complete: /* queue has been emptied */ Dbg_Stream ("sent all telegrams on fd=%u\n", fd); /* no more writing needed */ Socket_UnregisterWrite (CommSocket (&stream->comm)); /* state change to parent layer */ assert (stream->eventFunc != NULL); (void)(*stream->eventFunc) (stream, XBST_WAIT); /* shutdown for empty queue, if asked for */ if (stream->prepFinish) { Socket_ShutdownWrite (CommSocket (&stream->comm)); Dbg_Stream ("socket shutdown for writing\n"); } return XCR_OK; case XBT_R_IOError: /* error while sending telegram */ Dbg_Stream ("i/o-error write to fd=%u, shutting down\n", fd); /* state change to parent layer */ assert (stream->eventFunc != NULL); (void)(*stream->eventFunc) (stream, XBST_IOWRITE); /* return error, deletes XBComm */ return XCR_Error; default: /* anything else */ Dbg_Stream ("partial send on fd=%u\n", fd); /* state to parent layer */ assert (stream->eventFunc != NULL); (void)(*stream->eventFunc) (stream, XBST_BUSY); return XCR_OK; } } /* WriteStream */ /* * add a XBCommStream */ void Stream_CommInit (XBCommStream * stream, XBCommType commType, XBSocket * pSocket, StreamHandleFunc handleFunc, StreamEventFunc eventFunc, XBCommFunc deleteFunc) { assert (stream != NULL); /* add the underlying XBComm to internal list */ CommInit (&stream->comm, commType, pSocket, ReadStream, WriteStream, deleteFunc); /* set stream specific handlers */ stream->handleFunc = handleFunc; stream->eventFunc = eventFunc; /* flag: shutdown when send queue empty */ stream->prepFinish = XBFalse; /* create queues */ stream->sndQueue = Net_CreateSndQueue (commType == COMM_ToClient); stream->rcvQueue = Net_CreateRcvQueue (commType == COMM_ToClient); assert (NULL != stream->sndQueue); assert (NULL != stream->rcvQueue); } /* Stream_CommInit */ /* * remove a XBCommStream * does not free allocated XBComm memory!! */ void Stream_CommFinish (XBCommStream * stream) { /* debug output before socket is freed */ Dbg_Stream ("removing stream on fd=%u\n", Socket_Fd (stream->comm.socket)); /* remove XBComm from internal list, socket is freed */ CommFinish (&stream->comm); /* free up queues */ Net_DeleteSndQueue (stream->sndQueue); Net_DeleteRcvQueue (stream->rcvQueue); /* close event to parent layer */ assert (stream->eventFunc != NULL); (void)(*stream->eventFunc) (stream, XBST_CLOSE); } /* Stream_CommFinish */ /* * end of file com_stream.c */ xblast-2.10.4/com_stream.h0000644000175000017500000000353210372731123014514 0ustar rhondaalfie/* * file com_stream.h - base struct und functions for stream connections * * $Id: com_stream.h,v 1.8 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_STREAM_H #define XBLAST_COM_STREAM_H /* * type definitions */ /* forward declaration */ typedef struct _xb_comm_stream XBCommStream; /* stream events */ typedef enum { XBST_IOREAD, XBST_IOWRITE, XBST_EOF, XBST_BUSY, XBST_WAIT, XBST_CLOSE } XBStreamEvent; /* callback for handling incoming telegrams */ typedef XBCommResult (*StreamHandleFunc) (XBCommStream *, const XBTelegram * tele); typedef XBBool (*StreamEventFunc) (XBCommStream *, const XBStreamEvent); /* base structure for all stream bases communications */ struct _xb_comm_stream { XBComm comm; XBBool prepFinish; XBSndQueue *sndQueue; XBRcvQueue *rcvQueue; StreamHandleFunc handleFunc; StreamEventFunc eventFunc; }; /* * global prototypes */ extern void Stream_CommInit (XBCommStream *, XBCommType, XBSocket *, StreamHandleFunc, StreamEventFunc, XBCommFunc); extern void Stream_CommFinish (XBCommStream * stream); #endif /* * end of file com_stream.h */ xblast-2.10.4/com_to_central.c0000644000175000017500000001667010372731123015355 0ustar rhondaalfie/* * file com_to_central.c - handle communications with centrals * * $Id: com_to_central.c,v 1.7 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommStream stream; } XBCommToCentral; /* * local variables */ /* * central sends data */ static XBCommResult HandleDataAvailable (XBCommStream * toCentral, const XBTelegram * tele) { const void *data; size_t len; assert (toCentral != NULL); /* get telegramm data */ data = Net_TeleData (tele, &len); switch (Net_TeleID (tele)) { case XBT_ID_PlayerConfig: /* Dbg_X2C("receiving player config from central\n"); */ User_ReceivePlayerConfig (data); break; case XBT_ID_PID: Dbg_X2C ("receiving pid from central\n"); User_ReceivePlayerPID (data); break; default: Dbg_X2C ("unsupported ID received for DataAvailable\n"); return User_EventToCentral (XBE2C_InvalidID);; } return XCR_OK; } /* HandleDataAvailable */ /* * central sends end of data */ static XBCommResult HandleDataNotAvailable (XBCommStream * toCentral, const XBTelegram * tele) { switch (Net_TeleID (tele)) { case XBT_ID_PlayerConfig: Dbg_X2C ("No more players, disconnecting\n"); User_NoMorePlayers (); break; case XBT_ID_PID: break; default: Dbg_X2C ("unsupported ID received for DataNotAvailable\n"); return User_EventToCentral (XBE2C_InvalidID);; } return XCR_OK; } /* HandleDataAvailable */ /* * handle telegrams from central */ static XBCommResult HandleTelegram (XBCommStream * stream, const XBTelegram * tele) { assert (stream != NULL); switch (Net_TeleCOT (tele)) { /* central sends requested data */ case XBT_COT_DataAvailable: return HandleDataAvailable (stream, tele); /* central has not requested data */ case XBT_COT_DataNotAvailable: return HandleDataNotAvailable (stream, tele); default: Dbg_X2C ("unsupported CoT received\n"); return User_EventToCentral (XBE2C_InvalidCot);; } } /* HandleTelegram */ /* * delete handler */ static XBCommResult DeleteToCentral (XBComm * comm) { /* delete stream */ Stream_CommFinish ((XBCommStream *) comm); /* delete structure */ free (comm); Dbg_X2C ("tcp connection to central removed\n"); return XCR_OK; } /* DeleteToCentral */ /* * handle stream events */ static XBBool EventToCentral (XBCommStream * comm, const XBStreamEvent ev) { switch (ev) { case XBST_IOREAD: Dbg_X2C ("read error from central\n"); return User_EventToCentral (XBE2C_IORead); case XBST_IOWRITE: Dbg_X2C ("write error to central\n"); return User_EventToCentral (XBE2C_IOWrite); case XBST_EOF: Dbg_X2C ("eof from central\n"); return User_EventToCentral (XBE2C_UnexpectedEOF); case XBST_WAIT: Dbg_X2C ("all data sent to central\n"); return User_EventToCentral (XBE2C_StreamWaiting); case XBST_BUSY: /* Dbg_X2C("data waits to be sent to central\n"); */ return User_EventToCentral (XBE2C_StreamBusy); case XBST_CLOSE: Dbg_X2C ("connection to central has been removed\n"); (void)User_EventToCentral (XBE2C_StreamClosed); return XBFalse; default: Dbg_X2C ("unknown stream event on socket to central, ignoring\n"); return XBFalse; } } /* EventToCentral */ /* * create a tcp connection to central */ XBComm * X2C_CreateComm (const CFGCentralSetup * cfg) { XBSocket *pSocket; XBCommToCentral *toCentral; assert (cfg != NULL); /* create connection to server */ pSocket = Net_ConnectInet (cfg->name, cfg->port); if (NULL == pSocket) { Dbg_X2C ("failed to create tcp socket\n"); return NULL; } Dbg_X2C ("tcp connection to central %s:%u established\n", cfg->name, cfg->port); /* create communication data structure */ toCentral = calloc (1, sizeof (*toCentral)); assert (NULL != toCentral); /* set values */ Stream_CommInit (&toCentral->stream, COMM_ToCentral, pSocket, HandleTelegram, EventToCentral, DeleteToCentral); /* that's all */ return &toCentral->stream.comm; } /* CommCreateToServer */ /************** * local data * **************/ /* * return remote address in dot-representation */ const char * X2C_CentralName (XBComm * comm) { return Net_RemoteName (comm->socket); } /* X2C_CentralName */ /* * return local address in dot-representation */ const char * X2C_LocalName (XBComm * comm) { return Net_LocalName (comm->socket); } /* X2C_LocalName */ /************** * queue data * **************/ /* * query player config from central */ void X2C_QueryPlayerConfig (XBComm * comm) { XBCommStream *stream = (XBCommStream *) comm; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send data */ Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_RequestData, XBT_ID_PlayerConfig, 0, NULL, 0)); Dbg_X2C ("queued player query to central\n"); } /* X2C_QueryPlayerConfig */ /* * send game config to central */ void X2C_SendPlayerConfig (XBComm * comm, XBAtom atom) { XBCommStream *stream = (XBCommStream *) comm; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send database section */ Socket_RegisterWrite (CommSocket (&stream->comm)); SendPlayerConfig (CT_Local, stream->sndQueue, XBT_COT_SendData, 0, atom, XBTrue); Dbg_X2C ("queued player config to central\n"); } /* X2C_SendPlayerConfig */ /* * send game config to central */ void X2C_SendGameStat (XBComm * comm, int numPlayers, int *PID, int *Score) { XBCommStream *stream = (XBCommStream *) comm; char tmp[256]; int i; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* queue data */ memcpy (tmp, &numPlayers, 4); for (i = 0; i < numPlayers; i++) { memcpy (tmp + 4 + i * 8, PID + i, 4); memcpy (tmp + 8 + i * 8, Score + i, 4); } Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_SendData, XBT_ID_GameStat, 0, tmp, 4 + numPlayers * 8)); Dbg_X2C ("queued game stat to central\n"); } /* X2C_SendGameStat */ /* * send request for disconnect to central */ void X2C_SendDisconnect (XBComm * comm) { XBCommStream *stream = (XBCommStream *) comm; /* inform host about disconnect request */ Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_HostDisconnected, 0, NULL, 0)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_RequestDisconnect, 0, NULL, 0)); /* clear the communication, prepare for automatic shutdown */ stream->prepFinish = XBTrue; Dbg_X2C ("queued disconnect sequence to central\n"); } /* X2C_SendDisconnect */ /* * end of file com_to_central.c */ xblast-2.10.4/com_to_central.h0000644000175000017500000000367510372731123015363 0ustar rhondaalfie/* * file com_to_central.h - handle communications with centrals * * $Id: com_to_central.h,v 1.6 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COM_TO_CENTRAL_H #define _COM_TO_CENTRAL_H /* * event codes */ typedef enum { XBE2C_IORead, /* read error occurred */ XBE2C_IOWrite, /* write error occurred */ XBE2C_UnexpectedEOF, /* eof received */ XBE2C_StreamWaiting, /* all queued data sent on stream */ XBE2C_StreamBusy, /* queued data on stream partially sent */ XBE2C_StreamClosed, /* stream has been removed */ XBE2C_InvalidCot, /* invalid telegram cot */ XBE2C_InvalidID, /* invalid telegram id */ } XBEventToCentral; /* * global prototypes */ extern XBComm *X2C_CreateComm (const CFGCentralSetup *); extern const char *X2C_CentralName (XBComm *); extern const char *X2C_LocalName (XBComm *); extern void X2C_Disconnect (XBComm * comm); extern void X2C_SendDisconnect (XBComm * comm); extern void X2C_QueryPlayerConfig (XBComm * comm); extern void X2C_SendPlayerConfig (XBComm * comm, XBAtom); extern void X2C_SendGameStat (XBComm * comm, int numPlayers, int *PID, int *Score); #endif /* * end of file com_to_central.h */ xblast-2.10.4/com_to_client.c0000644000175000017500000005303510372731123015177 0ustar rhondaalfie/* * file com_to_client.c - handle communications with clients * * $Id: com_to_client.c,v 1.19 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommStream stream; unsigned serial; } XBCommToClient; /* * local variables */ /* streams to clients */ static XBCommToClient *commList[MAX_HOSTS] = { /* this entry is never used (server) */ NULL, /* up to 5 clients can connect */ NULL, NULL, NULL, NULL, NULL, }; /************ * handlers * ************/ /* * data received from a client */ static XBCommResult HandleDataAvailable (XBCommToClient * toClient, const XBTelegram * tele) { const void *data; size_t len; assert (toClient != NULL); /* get telegramm data */ data = Net_TeleData (tele, &len); switch (Net_TeleID (tele)) { case XBT_ID_GameConfig: Dbg_S2C ("received game config line\n"); Server_ReceiveGameConfig (toClient->serial, data); break; case XBT_ID_PlayerConfig: Dbg_S2C ("received player config line\n"); Server_ReceivePlayerConfig (toClient->serial, (int)Net_TeleIOB (tele), data); break; default: Dbg_S2C ("received game config line\n"); return Server_StreamEvent (toClient->serial, XBSC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleDataAvailable */ /* * data not available on client */ static XBCommResult HandleDataNotAvailable (XBCommToClient * toClient, const XBTelegram * tele) { switch (Net_TeleID (tele)) { case XBT_ID_GameConfig: Dbg_S2C ("host #%u has no game config data!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_MissingData) ? XCR_Error : XCR_OK; default: Dbg_S2C ("host #%u has no data of unrecognized type!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleDataAvailable */ /* * received client request */ static XBCommResult HandleActivate (XBCommToClient * toClient, const XBTelegram * tele) { const char *data; size_t len; unsigned iob; unsigned value; assert (toClient != NULL); assert (tele != NULL); /* get telegramm data */ data = Net_TeleData (tele, &len); iob = Net_TeleIOB (tele); switch (Net_TeleID (tele)) { case XBT_ID_DgramPort: /* inform application */ if (NULL != data && 1 == sscanf (data, "%u", &value)) { Server_ReceiveDgramPort (toClient->serial, value); Dbg_S2C ("received dgram port ftrom host #%u\n", toClient->serial); } else { Dbg_S2C ("host #%u has no data of unrecognized type!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_DataInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; case XBT_ID_LevelConfig: Dbg_S2C ("receive level check from host #%u\n", toClient->serial); Server_ReceiveLevelCheck (toClient->serial, iob); return XCR_OK; case XBT_ID_WinnerTeam: Dbg_S2C ("receive winner team from host #%u\n", toClient->serial); Server_ReceiveWinnerTeam (toClient->serial, iob); return XCR_OK; case XBT_ID_HostChangeReq: if (len == 2) { Dbg_S2C ("host #%u requests host state change\n", toClient->serial); Server_ReceiveHostStateReq (toClient->serial, data[0], data[1]); } else { Dbg_S2C ("host #%u sends invalid host request data!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_DataInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; case XBT_ID_TeamChangeReq: if (len == 3) { Dbg_S2C ("host #%u requests team state change\n", toClient->serial); Server_ReceiveTeamStateReq (toClient->serial, data[0], data[1], data[2]); } else { Dbg_S2C ("host #%u sends invalid team request data!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_DataInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; default: Dbg_S2C ("unrecognized request from host #%u!\n", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleActivate */ /* * client sends info */ static XBCommResult HandleSpontaneous (XBCommToClient * toClient, const XBTelegram * tele) { const char *data; size_t len; XBTeleIOB iob; XBChat *chat; unsigned value; assert (toClient != NULL); data = Net_TeleData (tele, &len); iob = Net_TeleIOB (tele); /* get telegramm data */ switch (Net_TeleID (tele)) { case XBT_ID_Sync: Dbg_S2C ("receiving sync from host #%u\n", toClient->serial); Server_ReceiveSync (toClient->serial, iob); return XCR_OK; case XBT_ID_HostChange: if (NULL != data && 1 == sscanf (data, "%u", &value)) { Dbg_S2C ("REMOVE! receiving host change from host #%u\n", toClient->serial); /* Server_ReceiveHostState (toClient->serial, value ); */ } return XCR_OK; case XBT_ID_Chat: chat = Chat_UnpackData (data, len, iob); if (NULL != chat) { Dbg_S2C ("receiving chat from host #%u", toClient->serial); Server_ReceiveChat (chat); } else { Dbg_S2C ("invalid chat received from host #%u", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; default: Dbg_S2C ("invalid info received from host #%u", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleSpontaneous */ /* * handle telegrams from server */ static XBCommResult HandleTelegram (XBCommStream * stream, const XBTelegram * tele) { XBCommToClient *toClient = (XBCommToClient *) stream; assert (toClient != NULL); switch (Net_TeleCOT (tele)) { /* client sends requested data */ case XBT_COT_DataAvailable: return HandleDataAvailable (toClient, tele); /* client has not requested data */ case XBT_COT_DataNotAvailable: return HandleDataNotAvailable (toClient, tele); /* client command has arrived */ case XBT_COT_Activate: return HandleActivate (toClient, tele); /* client message has arrived */ case XBT_COT_Spontaneous: return HandleSpontaneous (toClient, tele); default: Dbg_S2C ("invalid cot received from host #%u", toClient->serial); return Server_StreamEvent (toClient->serial, XBSC_COTInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleTelegram */ /* * delete handler: triggered by eof and parse errors * always called from com_base.c */ static XBCommResult DeleteToClient (XBComm * comm) { XBCommToClient *toClient = (XBCommToClient *) comm; assert (comm != NULL); /* unmark client */ commList[toClient->serial] = NULL; /* clean up */ Stream_CommFinish (&toClient->stream); free (comm); return XCR_OK; } /* DeleteToClient */ /* * handle stream events */ static XBBool EventToClient (XBCommStream * comm, const XBStreamEvent ev) { XBCommToClient *toClient = (XBCommToClient *) comm; XBServerConstants code; assert (toClient != NULL); switch (ev) { case XBST_IOREAD: code = XBSC_IOError; break; case XBST_IOWRITE: code = XBSC_IOError; break; case XBST_EOF: code = XBSC_UnexpectedEOF; break; case XBST_WAIT: code = XBSC_StreamWaiting; break; case XBST_BUSY: code = XBSC_StreamBusy; break; case XBST_CLOSE: code = XBSC_StreamClosed; break; default: return XBFalse; } return Server_StreamEvent (toClient->serial, code); } /* EventToClient */ /*************** * constructor * ***************/ /* * create stream to client on valid socket */ XBComm * S2C_CreateComm (const XBSocket * socket) { unsigned serial; XBSocket *pSocket; XBCommToClient *toClient; assert (socket != NULL); Dbg_S2C ("client connected to listen socket!\n"); /* get free serial */ for (serial = 1; serial < MAX_HOSTS; serial++) { if (NULL == commList[serial]) { break; } } if (serial >= MAX_HOSTS) { Dbg_S2C ("failed to assign valid id, disconnecting\n"); return NULL; } Dbg_S2C ("Assigned id #%u\n", serial); /* create listen socket */ pSocket = Net_Accept (socket); if (NULL == pSocket) { Dbg_S2C ("failed to create reply socket\n"); return NULL; } /* create communication data structure */ toClient = calloc (1, sizeof (XBCommToClient)); assert (NULL != toClient); /* set values */ Stream_CommInit (&toClient->stream, COMM_ToClient, pSocket, HandleTelegram, EventToClient, DeleteToClient); toClient->serial = serial; /* add to internal list */ commList[serial] = toClient; Dbg_S2C ("stream to host #%u accepted\n", serial); /* inform application */ Server_Accept (serial, Net_RemoteName (pSocket), Net_RemotePort (pSocket)); /* that's all */ return &toClient->stream.comm; } /* S2C_CreateComm */ /****************** * get local data * ******************/ /* * check if client is connected */ XBBool S2C_Connected (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); return (commList[id] != NULL); } /* S2C_Connected */ /* * output all connected clients */ void S2C_ShowConnected (void) { unsigned id; Dbg_S2C ("Connected client id's: "); for (id = 1; id < MAX_HOSTS; id++) { if (S2C_Connected (id)) { Dbg_Out ("%i ", id); } } Dbg_Out ("\n"); } /* S2C_Connected */ /* * hostname of client */ const char * S2C_HostName (unsigned id) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); /* get name from socket */ return Net_RemoteName (commList[id]->stream.comm.socket); } /* S2C_HostName */ /* * hostname of client */ const char * S2C_LocalName (unsigned id) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); /* get name from socket */ return Net_LocalName (commList[id]->stream.comm.socket); } /* S2C_LocalName */ /************** * queue data * **************/ /* * queue game config to client */ void S2C_SendGameConfig (unsigned id, unsigned hostID, XBAtom atom) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send database section */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); SendGameConfig (CT_Remote, commList[id]->stream.sndQueue, XBT_COT_SendData, (XBTeleIOB) hostID, atom); Dbg_S2C ("queued game config to host #%u\n", id); } /* S2C_SendGameConfig */ /* * queue player config to client */ void S2C_SendPlayerConfig (unsigned id, unsigned hostId, int player, XBAtom atom) { XBTeleIOB iob; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* convert id and player to iob */ iob = ((XBTeleIOB) hostId << 4) + (XBTeleIOB) player; /* send database section */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); SendPlayerConfig (CT_Remote, commList[id]->stream.sndQueue, XBT_COT_SendData, iob, atom, XBFalse); Dbg_S2C ("queued single player config to host #%u\n", id); } /* S2C_SendPlayerConfig */ /* * queue dgram port to client */ void S2C_SendDgramPort (unsigned id, unsigned short port) { char tmp[16]; /* sanity check */ assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send seed as ascii */ sprintf (tmp, "%hu", port); /* send data */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_DgramPort, id, tmp, strlen (tmp) + 1)); Dbg_S2C ("queued dgram port to host #%u\n", id); } /* S2C_SendDgramPort */ /* * queue game config request to client */ void S2C_QueryGameConfig (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send request */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_RequestData, XBT_ID_GameConfig, 0, NULL, 0)); Dbg_S2C ("queued game config request to host #%u\n", id); } /* S2C_QueryGameConfig */ /* * queue player config request to client */ void S2C_QueryPlayerConfig (unsigned id, int player) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); assert (player < NUM_LOCAL_PLAYER); /* send request */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_RequestData, XBT_ID_PlayerConfig, (XBTeleIOB) player, NULL, 0)); Dbg_S2C ("queued player config request to host #%u\n", id); } /* S2C_QueryPlayerConfig */ /* * queue host state to client */ void S2C_SendHostState (unsigned id, unsigned hostID, unsigned state) { char tmp[16]; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); sprintf (tmp, "%hu", state); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_HostChange, (XBTeleIOB) hostID, tmp, strlen (tmp) + 1)); Dbg_S2C ("queued host state to host #%u:%u to host #%u\n", hostID, state, id); } /* S2C_SendHostState */ /* * queue team state to client */ void S2C_SendTeamState (unsigned id, unsigned host, unsigned player, XBTeamState team) { char tmp[16]; unsigned hpid; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* version <2_10_2 cannot handle XBTS_Out, send invalid */ if (team == XBTS_Out && !Version_AtLeast (id, &Ver_2_10_2)) { team = XBTS_Invalid; } sprintf (tmp, "%hu", team); hpid = (host * NUM_LOCAL_PLAYER) + (player & 0xFF); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_TeamChange, (XBTeleIOB) hpid, tmp, strlen (tmp) + 1)); Dbg_S2C ("queued team state to host #%u\n", id); } /* S2C_SendTeamState */ /* * queue host state request to client */ void S2C_SendHostStateReq (unsigned id, unsigned who, unsigned hostID, unsigned state) { unsigned char tmp[2]; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); tmp[0] = hostID & 0xff; tmp[1] = state & 0xff; Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_HostChangeReq, (XBTeleIOB) who & 0xFF, tmp, sizeof (tmp))); Dbg_S2C ("queued host state request #%u:#%u->%u to host #%u\n", who, hostID, state, id); } /* S2C_SendHostStateReq */ /* * queue team state to client */ void S2C_SendTeamStateReq (unsigned id, unsigned who, unsigned hostID, unsigned player, XBTeamState team) { unsigned char tmp[3]; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* version < 2_10_2 cannot handle XBTS_Out, send invalid */ if (team == XBTS_Out && !Version_AtLeast (id, &Ver_2_10_2)) { team = XBTS_Invalid; } Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); tmp[0] = hostID & 0xff; tmp[1] = player & 0xff; tmp[2] = team & 0xff; Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_TeamChangeReq, (XBTeleIOB) who & 0xFF, tmp, sizeof (tmp))); Dbg_S2C ("queued team state request to host #%u:#%u(%u)->%u to host #%u\n", who, hostID, player, team, id); } /* S2C_SendTeamStateReq */ /* * send a chat line to th:tp from fh:fp */ void S2C_SendChat (unsigned id, XBChat * chat) { unsigned iob; char *data; size_t len; /* sanity check */ assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); assert (chat != NULL); /* pack chat data */ len = Chat_PackData (chat, &data, &iob); /* prepare for writing */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_SendData, XBT_ID_Chat, iob, data, len)); Dbg_S2C ("queued chat to host #%u\n", id); } /* S2C_SendChat */ /* * queue disconnect message to client */ void S2C_HostDisconnected (unsigned id, unsigned hostID) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_HostDisconnected, hostID, NULL, 0)); Dbg_S2C ("queued disconnect info to host #%u\n", id); } /* S2C_HostDisconnected */ /* * queue request for disconnect to given client */ void S2C_Disconnect (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); /* inform host about disconnect request */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_HostDisconnected, 0, NULL, 0)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_RequestDisconnect, 0, NULL, 0)); Dbg_S2C ("queued disconnect sequence to host #%u\n", id); /* free slot, prepare to finish */ commList[id]->stream.prepFinish = XBTrue; commList[id] = NULL; } /* S2C_Disconnect */ /* * queue start game signal to client */ void S2C_StartGame (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_StartGame, (XBTeleIOB) id, NULL, 0)); Dbg_S2C ("queued start of game to host #%u\n", id); } /* S2C_StartGame */ /* * queue sync to client */ void S2C_Sync (unsigned id, XBNetworkEvent event) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_Sync, (XBTeleIOB) event, NULL, 0)); Dbg_S2C ("queued sync #%u to host #%u\n", event, id); } /* S2C_Sync */ /* * queue random seed to client */ void S2C_SendRandomSeed (unsigned id, unsigned seed) { char tmp[16]; /* sanity check */ assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send seed as ascii */ sprintf (tmp, "%u", seed); /* send data */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_RandomSeed, 0, tmp, strlen (tmp) + 1)); Dbg_S2C ("queued random seed to host #%u\n", id); } /* S2C_SendRandomSeed */ /* * queue level data to client */ void S2C_SendLevelConfig (unsigned id, const DBRoot * level) { assert (id > 0); assert (id <= MAX_HOSTS); assert (commList[id] != NULL); assert (commList[id]->stream.sndQueue != NULL); /* send database section */ Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); SendLevelConfig (commList[id]->stream.sndQueue, XBT_COT_SendData, level); Dbg_S2C ("queued level config to host #%u\n", id); } /* S2C_SendLevelConfig */ /* * queue level activation to client */ void S2C_SendLevelActivate (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_LevelConfig, (XBTeleIOB) 1, NULL, 0)); Dbg_S2C ("queued level activation to host #%u\n", id); } /* S2C_SendLevelActivate */ /* * queue level reset to client */ void S2C_SendLevelReset (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_LevelConfig, (XBTeleIOB) 0, NULL, 0)); Dbg_S2C ("queued level reset to host #%u\n", id); } /* S2C_SendLevelReset */ /* * queue async notification to client */ void S2C_SendLevelAsync (unsigned id) { XBNetworkEvent ev = XBNW_SyncLevelResult; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_Async, (XBTeleIOB) ev, NULL, 0)); Dbg_S2C ("queued level async to host #%u\n", id); } /* S2C_SendLevelAsync */ /* * queue level sync to client */ void S2C_SendLevelSync (unsigned id) { XBNetworkEvent ev = XBNW_SyncLevelResult; assert (id > 0); assert (id < MAX_HOSTS); assert (commList[id] != NULL); Socket_RegisterWrite (CommSocket (&commList[id]->stream.comm)); Net_SendTelegram (commList[id]->stream.sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_Sync, (XBTeleIOB) ev, NULL, 0)); Dbg_S2C ("queued level sync to host #%u\n", id); } /* S2C_SendLevelSync */ /* * end of file com_to_client.c */ xblast-2.10.4/com_to_client.h0000644000175000017500000000510310372731123015175 0ustar rhondaalfie/* * file com_to_client.h - handle communications with clients * * $Id: com_to_client.h,v 1.11 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COM_TO_CLIENT_H #define _COM_TO_CLIENT_H /* * global prototypes */ /* constructor */ extern XBComm *S2C_CreateComm (const XBSocket * socket); /* get local data */ extern XBBool S2C_Connected (unsigned id); extern void S2C_ShowConnected (void); extern const char *S2C_HostName (unsigned id); extern const char *S2C_LocalName (unsigned id); /* queue data */ extern void S2C_SendGameConfig (unsigned id, unsigned hostId, XBAtom atom); extern void S2C_SendPlayerConfig (unsigned id, unsigned hostId, int player, XBAtom); extern void S2C_SendDgramPort (unsigned id, unsigned short port); extern void S2C_QueryGameConfig (unsigned id); extern void S2C_QueryPlayerConfig (unsigned id, int player); extern void S2C_SendHostState (unsigned id, unsigned hostId, unsigned state); extern void S2C_SendTeamState (unsigned id, unsigned host, unsigned player, XBTeamState team); extern void S2C_SendHostStateReq (unsigned id, unsigned who, unsigned hostId, unsigned state); extern void S2C_SendTeamStateReq (unsigned id, unsigned who, unsigned hostId, unsigned player, XBTeamState team); extern void S2C_SendChat (unsigned id, XBChat * chat); extern void S2C_HostDisconnected (unsigned id, unsigned hostID); extern void S2C_Disconnect (unsigned id); extern void S2C_StartGame (unsigned id); extern void S2C_SendRandomSeed (unsigned id, unsigned seed); extern void S2C_Sync (unsigned id, XBNetworkEvent event); extern void S2C_SendLevelConfig (unsigned id, const DBRoot * db); extern void S2C_SendLevelActivate (unsigned id); extern void S2C_SendLevelReset (unsigned id); extern void S2C_SendLevelAsync (unsigned id); extern void S2C_SendLevelSync (unsigned id); #endif /* * end of file com_to_client.h */ xblast-2.10.4/com_to_server.c0000644000175000017500000003773610372731123015241 0ustar rhondaalfie/* * file com_to_server.c - client's communication with server * * $Id: com_to_server.c,v 1.24 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBCommStream stream; XBBool expect; /* flag for expected disconnect request */ } XBCommToServer; /************ * handlers * ************/ /* * server requests data */ static XBCommResult HandleRequestData (XBCommStream * stream, const XBTelegram * tele) { switch (Net_TeleID (tele)) { case XBT_ID_PlayerConfig: Dbg_C2S ("receiving player config request from server\n"); Client_ReceivePlayerConfigReq (Net_TeleIOB (tele)); break; case XBT_ID_GameConfig: Dbg_C2S ("receiving game config request from server\n"); (void)Client_ReceiveGameConfigReq (Net_TeleIOB (tele)); break; default: Dbg_C2S ("server sends unrecognized data !!!\n"); return Client_StreamEvent (XBCC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleRequestData */ /* * server sends data */ static XBCommResult HandleSendData (XBCommStream * stream, const XBTelegram * tele) { const char *data; size_t len; XBTeleIOB iob; XBChat *chat; data = Net_TeleData (tele, &len); iob = Net_TeleIOB (tele); switch (Net_TeleID (tele)) { case XBT_ID_GameConfig: Dbg_C2S ("receiving game config from server\n"); Client_ReceiveGameConfig (iob, data); break; case XBT_ID_PlayerConfig: Dbg_C2S ("receiving player config from server\n"); Client_ReceivePlayerConfig (iob >> 4, iob & 0x0F, data); break; case XBT_ID_LevelConfig: Dbg_C2S ("receiving level config from server\n"); Client_ReceiveLevelConfig (iob, data); break; case XBT_ID_Chat: chat = Chat_UnpackData (data, len, iob); if (NULL != chat) { Dbg_C2S ("receiving chat from server\n"); Client_ReceiveChat (chat); } else { Dbg_C2S ("receiving invalid chat data\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; default: Dbg_C2S ("server sent unrecognized data\n"); return Client_StreamEvent (XBCC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleSendData */ /* * server sends a command */ static XBCommResult HandleActivate (XBCommStream * stream, const XBTelegram * tele) { XBCommToServer *toServer = (XBCommToServer *) stream; const char *data; size_t len; unsigned value; unsigned tmp; data = Net_TeleData (tele, &len); switch (Net_TeleID (tele)) { case XBT_ID_RequestDisconnect: if (toServer->expect) { Dbg_C2S ("server finishes disconnect announcement, shutting down stream\n"); (void)Client_StreamEvent (XBCC_ExpectedEOF); return XCR_Finished; } else { Dbg_C2S ("server unexpectedly requests disconnect\n"); (void)Client_StreamEvent (XBCC_UnexpectedEOF); return XCR_Error; } case XBT_ID_StartGame: Dbg_C2S ("server has started the game!\n"); Client_ReceiveStart (Net_TeleIOB (tele)); break; case XBT_ID_RandomSeed: if (NULL != data && 1 == sscanf (data, "%u", &value)) { Dbg_C2S ("server has sent random seed\n"); Client_ReceiveRandomSeed (value); } else { Dbg_C2S ("server send invalid seed!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_DgramPort: if (NULL != data && 1 == sscanf (data, "%u", &value)) { Dbg_C2S ("server has sent dgram port\n"); Client_ReceiveDgramPort (Net_TeleIOB (tele), value); } else { Dbg_C2S ("server has sent invalid dgram port!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_Sync: Dbg_C2S ("server has sent sync\n"); Client_ReceiveSync (Net_TeleIOB (tele)); break; case XBT_ID_Async: Dbg_C2S ("server has sent async!\n"); Client_ReceiveAsync (Net_TeleIOB (tele)); break; case XBT_ID_HostChange: if (NULL != data && 1 == sscanf (data, "%u", &value)) { Dbg_C2S ("server has sent host state\n"); Client_ReceiveHostState (Net_TeleIOB (tele), value); } else { Dbg_C2S ("server has sent invalid host state!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_TeamChange: if (NULL != data && 1 == sscanf (data, "%u", &value)) { Dbg_C2S ("server has sent team state!\n"); tmp = Net_TeleIOB (tele); Client_ReceiveTeamState (tmp / NUM_LOCAL_PLAYER, tmp % NUM_LOCAL_PLAYER, value); } else { Dbg_C2S ("server has sent invalid team state!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_HostChangeReq: if (len == 2) { Dbg_C2S ("server has sent host state\n"); Client_ReceiveHostStateReq (Net_TeleIOB (tele), data[0], data[1]); } else { Dbg_C2S ("server has sent invalid host state!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_TeamChangeReq: if (len == 3) { Dbg_C2S ("server has sent team state request!\n"); Client_ReceiveTeamStateReq (Net_TeleIOB (tele), data[0], data[1], data[2]); } else { Dbg_C2S ("server has sent invalid team state!\n"); return Client_StreamEvent (XBCC_DataInvalid) ? XCR_Error : XCR_OK; } break; case XBT_ID_LevelConfig: Dbg_C2S ("server sends level activation\n"); Client_ActivateLevel (Net_TeleIOB (tele)); break; default: Dbg_C2S ("server sends unrecognized command !!!\n"); return Client_StreamEvent (XBCC_IDInvalid) ? XCR_Error : XCR_OK; } return XCR_OK; } /* HandleSendData */ /* * handle infos from server */ static XBCommResult HandleSpontaneous (XBCommStream * stream, const XBTelegram * tele) { XBCommToServer *toServer = (XBCommToServer *) stream; switch (Net_TeleID (tele)) { case XBT_ID_HostDisconnected: Dbg_C2S ("server sends disconnect info\n"); toServer->expect = Client_ReceiveDisconnect (Net_TeleIOB (tele)); return XCR_OK; default: Dbg_C2S ("server sends unrecognized info !!!\n"); return Client_StreamEvent (XBCC_IDInvalid) ? XCR_Error : XCR_OK; } } /* HandleSpontaneous */ /* * handle telegrams from server */ static XBCommResult HandleTelegram (XBCommStream * stream, const XBTelegram * tele) { switch (Net_TeleCOT (tele)) { /* server requests data from client */ case XBT_COT_RequestData: return HandleRequestData (stream, tele); /* server sends data to client */ case XBT_COT_SendData: return HandleSendData (stream, tele); /* server activate command on client */ case XBT_COT_Activate: return HandleActivate (stream, tele); /* server send spontaneous status change */ case XBT_COT_Spontaneous: return HandleSpontaneous (stream, tele); /* unknown cause of transmission */ default: Dbg_C2S ("server sends invalid COT !\n"); return Client_StreamEvent (XBCC_COTInvalid) ? XCR_Error : XCR_OK; } } /* HandleTelegram */ /* * handle delete: triggered by eof on com_stream, local parse errors */ static XBCommResult DeleteToServer (XBComm * comm) { XBCommStream *stream = (XBCommStream *) comm; /* delete communication */ Stream_CommFinish (stream); free (comm); Dbg_C2S ("removed stream to server\n"); return XCR_OK; } /* DeleteToServer */ /* * handle stream events */ static XBBool EventToServer (XBCommStream * comm, const XBStreamEvent ev) { XBCommToServer *toServer = (XBCommToServer *) comm; XBClientConstants code; assert (toServer != NULL); switch (ev) { case XBST_IOREAD: code = XBCC_IOError; break; case XBST_IOWRITE: code = XBCC_IOError; break; case XBST_EOF: code = XBCC_UnexpectedEOF; break; case XBST_WAIT: code = XBCC_StreamWaiting; break; case XBST_BUSY: code = XBCC_StreamBusy; break; case XBST_CLOSE: code = XBCC_StreamClosed; break; default: return XBFalse; } return Client_StreamEvent (code); } /* EventToServer */ /*************** * constructor * ***************/ /* * create a stream to server */ XBComm * C2S_CreateComm (const CFGGameHost * cfg) { XBSocket *pSocket; XBCommToServer *toServer; assert (cfg != NULL); /* create connection to server */ pSocket = Net_ConnectInet (cfg->name, cfg->port); if (NULL == pSocket) { Dbg_C2S ("failed to connect stream to server!\n"); return NULL; } Dbg_C2S ("connected stream to server!\n"); /* create communication data structure */ toServer = calloc (1, sizeof (*toServer)); assert (NULL != toServer); /* set values */ Stream_CommInit (&toServer->stream, COMM_ToServer, pSocket, HandleTelegram, EventToServer, DeleteToServer); toServer->expect = XBFalse; /* that'S all */ Dbg_C2S ("handlers established!\n"); return &toServer->stream.comm; } /* CommCreateToServer */ /****************** * get local data * ******************/ /* * return address of server in dot-representation */ const char * C2S_ServerName (XBComm * comm) { return Net_RemoteName (comm->socket); } /* C2S_ServerName */ /* * return address of client (local host) in dot-representation */ const char * C2S_ClientName (XBComm * comm) { return Net_LocalName (comm->socket); } /* C2S_ClientName */ /************** * queue data * **************/ /* * queue random seed to client */ void C2S_SendDgramPort (XBComm * comm, unsigned short port) { XBCommStream *stream = (XBCommStream *) comm; char tmp[16]; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send seed as ascii */ sprintf (tmp, "%hu", port); /* send data */ Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_DgramPort, 0, tmp, strlen (tmp) + 1)); Dbg_C2S ("queued dgram port to server!\n"); } /* C2S_SendDgramPort */ /* * queue a DataNotAvailable response, local */ static void DataNotAvailable (XBComm * comm, XBTeleID id, XBTeleIOB iob) { XBCommStream *stream = (XBCommStream *) comm; Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_DataNotAvailable, id, iob, NULL, 0)); Dbg_C2S ("queued data not available to server\n"); } /* DataNotAvailable */ /* * queue game config not available */ void C2S_GameDataNotAvailable (XBComm * comm) { DataNotAvailable (comm, XBT_ID_GameConfig, 0); } /* C2S_PlayerDataNotAvailable */ /* * queue game config to client */ XBBool C2S_SendGameConfig (XBComm * comm, CFGType cfgType, XBAtom atom) { XBCommStream *stream = (XBCommStream *) comm; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send data */ if (!SendGameConfig (cfgType, stream->sndQueue, XBT_COT_DataAvailable, 0, atom)) { Dbg_C2S ("failed to queue game config!\n"); return XBFalse; } Socket_RegisterWrite (CommSocket (&stream->comm)); Dbg_C2S ("queued game config to server!\n"); return XBTrue; } /* C2S_SendGameConfig */ /* * queue player config not available */ void C2S_PlayerDataNotAvailable (XBComm * comm, unsigned id) { DataNotAvailable (comm, XBT_ID_PlayerConfig, id); } /* C2S_PlayerDataNotAvailable */ /* * queue player config to client */ XBBool C2S_SendPlayerConfig (XBComm * comm, CFGType cfgType, XBAtom atom, unsigned player, XBBool how) { XBCommStream *stream = (XBCommStream *) comm; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send data */ if (!SendPlayerConfig (cfgType, stream->sndQueue, XBT_COT_DataAvailable, player, atom, how)) { Dbg_C2S ("failed to queue player config!\n"); return XBFalse; } Socket_RegisterWrite (CommSocket (&stream->comm)); Dbg_C2S ("queued game config to server!\n"); return XBTrue; } /* C2S_SendPlayerConfig */ /* * queue host state to server * TODO: replace with requests below */ void C2S_SendHostState (XBComm * comm, unsigned state) { XBCommStream *stream = (XBCommStream *) comm; char tmp[16]; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); /* send state as ascii */ sprintf (tmp, "%hu", state); Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_HostChange, 0, tmp, strlen (tmp) + 1)); Dbg_C2S ("queued host state to server!\n"); } /* C2S_SendHostState */ /* * queue host state request to server */ void C2S_SendHostStateReq (XBComm * comm, unsigned host, unsigned state) { XBCommStream *stream = (XBCommStream *) comm; char tmp[2]; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); tmp[0] = host & 0xff; tmp[1] = state & 0xff; Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_HostChangeReq, 0, tmp, sizeof (tmp))); Dbg_C2S ("queued host state request host #%u->%u to server!\n", host, state); } /* C2S_SendHostStateReq */ /* * queue team state request to server */ void C2S_SendTeamStateReq (XBComm * comm, unsigned host, unsigned player, unsigned team) { XBCommStream *stream = (XBCommStream *) comm; char tmp[3]; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); tmp[0] = host & 0xff; tmp[1] = player & 0xff; tmp[2] = team & 0xff; Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_TeamChangeReq, 0, tmp, sizeof (tmp))); Dbg_C2S ("queued team state request host #%u(%u)->%u to server!\n", host, player, team); } /* C2S_SendHostStateReq */ /* * send a chat line to server */ void C2S_SendChat (XBComm * comm, XBChat * chat) { XBCommStream *stream = (XBCommStream *) comm; unsigned iob; char *data; size_t len; /* sanity check */ assert (stream != NULL); assert (stream->sndQueue != NULL); assert (chat != NULL); /* pack chat data */ len = Chat_PackData (chat, &data, &iob); /* prepare for writing */ Socket_RegisterWrite (CommSocket (&stream->comm)); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_Chat, iob, data, len)); Dbg_C2S ("queued chat to server\n"); } /* C2S_SendChat */ /* * queue sync to server */ void C2S_Sync (XBComm * comm, XBNetworkEvent event) { XBCommStream *stream = (XBCommStream *) comm; assert (stream != NULL); assert (stream->sndQueue != NULL); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Spontaneous, XBT_ID_Sync, (XBTeleIOB) event, NULL, 0)); Socket_RegisterWrite (CommSocket (&stream->comm)); Dbg_C2S ("queued sync #%u to server!\n", event); } /* C2S_Sync */ /* * queue level check result to server */ void C2S_LevelCheck (XBComm * comm, XBBool rej) { XBCommStream *stream = (XBCommStream *) comm; assert (stream != NULL); assert (stream->sndQueue != NULL); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_LevelConfig, rej ? 0 : 1, NULL, 0)); Socket_RegisterWrite (CommSocket (&stream->comm)); Dbg_C2S ("queued level check result to server = %s\n", rej ? "reject" : "accept"); } /* C2S_LevelCheck */ /* * queue level winner to server */ void C2S_SendWinner (XBComm * comm, unsigned team) { XBCommStream *stream = (XBCommStream *) comm; assert (stream != NULL); assert (stream->sndQueue != NULL); Net_SendTelegram (stream->sndQueue, Net_CreateTelegram (XBT_COT_Activate, XBT_ID_WinnerTeam, team, NULL, 0)); Socket_RegisterWrite (CommSocket (&stream->comm)); Dbg_C2S ("queued level winner to server = %u\n", team); } /* C2S_SendWinner */ /* * end of file com_to_server.c */ xblast-2.10.4/com_to_server.h0000644000175000017500000000417210372731123015232 0ustar rhondaalfie/* * file com_to_server.c - client's communication with server * * $Id: com_to_server.h,v 1.12 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_COM_TO_SERVER_C #define XBLAST_COM_TO_SERVER_C /* * global prototypes */ /* constructor */ extern XBComm *C2S_CreateComm (const CFGGameHost *); /* get local data */ extern const char *C2S_ServerName (XBComm *); extern const char *C2S_ClientName (XBComm *); /* set local data */ extern void C2S_MarkEOF (XBComm * comm, XBBool flag); /* queue data */ extern void C2S_SendDgramPort (XBComm *, unsigned short); extern void C2S_GameDataNotAvailable (XBComm * comm); extern XBBool C2S_SendGameConfig (XBComm * comm, CFGType cfgType, XBAtom atom); extern void C2S_PlayerDataNotAvailable (XBComm * comm, unsigned id); extern XBBool C2S_SendPlayerConfig (XBComm * comm, CFGType cfgType, XBAtom atom, unsigned player, XBBool how); extern void C2S_SendHostState (XBComm * comm, unsigned state); extern void C2S_SendHostStateReq (XBComm * comm, unsigned host, unsigned state); extern void C2S_SendTeamStateReq (XBComm * comm, unsigned host, unsigned player, unsigned state); extern void C2S_SendChat (XBComm * comm, XBChat * chat); extern void C2S_Sync (XBComm *, XBNetworkEvent); extern void C2S_LevelCheck (XBComm * comm, XBBool rej); extern void C2S_SendWinner (XBComm * comm, unsigned team); #endif /* * end of file com_to_server.h */ xblast-2.10.4/config-mingw.h0000644000175000017500000001263710376072217014763 0ustar rhondaalfie/* config.h. Generated by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if translation of program messages to the user's native language is requested. */ /* #undef ENABLE_NLS */ /* for packed */ /* #undef GAME_DATADIR */ /* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ /* #undef HAVE_CFLOCALECOPYCURRENT */ /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ /* Define if the GNU dcgettext() function is already present or preinstalled. */ #define HAVE_DCGETTEXT 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if the GNU gettext() function is already present or preinstalled. */ #define HAVE_GETTEXT 1 /* Define to 1 if you have the `gettimeofday' function. */ /* #undef HAVE_GETTIMEOFDAY */ /* Define if you have the iconv() function. */ #define HAVE_ICONV 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `ICE' library (-lICE). */ #define HAVE_LIBICE 1 /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 /* Define to 1 if you have the `SDL_gfx' library (-lSDL_gfx). */ /* #undef HAVE_LIBSDL_GFX */ /* Define to 1 if you have the `SDL_image' library (-lSDL_image). */ /* #undef HAVE_LIBSDL_IMAGE */ /* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */ /* #undef HAVE_LIBSDL_MIXER */ /* Define to 1 if you have the `SDL_net' library (-lSDL_net). */ /* #undef HAVE_LIBSDL_NET */ /* Define to 1 if you have the `SDL_ttf' library (-lSDL_ttf). */ /* #undef HAVE_LIBSDL_TTF */ /* Define to 1 if you have the `X11' library (-lX11). */ #define HAVE_LIBX11 1 /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_LINUX_SOUNDCARD_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_MACHINE_SOUNDCARD_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkdir' function. */ /* #undef HAVE_MKDIR */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the `select' function. */ /* #undef HAVE_SELECT */ /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strftime' function. */ /* #undef HAVE_STRFTIME */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strstr' function. */ /* #undef HAVE_STRSTR */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_AUDIO_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOUNDCARD_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have that is POSIX.1 compatible. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `vprintf' function. */ /* #undef HAVE_VPRINTF */ /* Name of package */ #define PACKAGE "xblast" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE int /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ /* #undef TIME_WITH_SYS_TIME */ /* Define to 1 if your declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ #define VERSION "2.10.3" /* Define to 1 if the X Window System is missing or not being used. */ /* #undef X_DISPLAY_MISSING */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `unsigned' if does not define. */ /* #undef size_t */ xblast-2.10.4/config.guess0000755000175000017500000012605110444637130014537 0ustar rhondaalfie#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2006-02-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS_NT-*:*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[345]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xblast-2.10.4/config.h.in0000644000175000017500000001213110444626004014231 0ustar rhondaalfie/* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* for packed */ #undef GAME_DATADIR /* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYCURRENT /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define if you have the iconv() function. */ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `ICE' library (-lICE). */ #undef HAVE_LIBICE /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `SDL_gfx' library (-lSDL_gfx). */ #undef HAVE_LIBSDL_GFX /* Define to 1 if you have the `SDL_image' library (-lSDL_image). */ #undef HAVE_LIBSDL_IMAGE /* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */ #undef HAVE_LIBSDL_MIXER /* Define to 1 if you have the `SDL_net' library (-lSDL_net). */ #undef HAVE_LIBSDL_NET /* Define to 1 if you have the `SDL_ttf' library (-lSDL_ttf). */ #undef HAVE_LIBSDL_TTF /* Define to 1 if you have the `X11' library (-lX11). */ #undef HAVE_LIBX11 /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_SOUNDCARD_H /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_SOUNDCARD_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIO_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t xblast-2.10.4/config.rpath0000755000175000017500000003502510372735174014536 0ustar rhondaalfie#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2005 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file 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. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` cc_basename=`echo "$CC" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; darwin*) case "$cc_basename" in xlc*) wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux*) case $cc_basename in icc* | ecc*) wl='-Wl,' ;; pgcc | pgf77 | pgf90) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; como) wl='-lopt=' ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; sco3.2v5*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) wl='-Wl,' ;; sysv4*MP*) ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then case "$host_os" in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we cannot use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sunos4*) hardcode_direct=yes ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if test "$GCC" = yes ; then : else case "$cc_basename" in xlc*) ;; *) ld_shlibs=no ;; esac fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | kfreebsd*-gnu | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10* | hpux11*) if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=no ;; ia64*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; *) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; sco3.2v5*) ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4.2uw2*) hardcode_direct=yes hardcode_minus_L=no ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) ;; sysv5*) hardcode_libdir_flag_spec= ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. libname_spec='lib$name' case "$host_os" in aix3*) ;; aix4* | aix5*) ;; amigaos*) ;; beos*) ;; bsdi[45]*) ;; cygwin* | mingw* | pw32*) shrext=.dll ;; darwin* | rhapsody*) shrext=.dylib ;; dgux*) ;; freebsd1*) ;; kfreebsd*-gnu) ;; freebsd*) ;; gnu*) ;; hpux9* | hpux10* | hpux11*) case "$host_cpu" in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac ;; irix5* | irix6* | nonstopux*) case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux*) ;; knetbsd*-gnu) ;; netbsd*) ;; newsos6) ;; nto-qnx*) ;; openbsd*) ;; os2*) libname_spec='$name' shrext=.dll ;; osf3* | osf4* | osf5*) ;; sco3.2v5*) ;; solaris*) ;; sunos4*) ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; sysv4*MP*) ;; uts4*) ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m32c) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; m32c-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xblast-2.10.4/configure0000755000175000017500000123755310444626004014137 0ustar rhondaalfie#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59d. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells which exist, to save several forks. if test -f $as_shell && { ($as_shell) 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { $as_shell 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (dirname -- /) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # Find out whether ``test -x'' works. Don't use a zero-byte file, as # systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then as_executable_p="test -x" else as_executable_p=: fi rm -f conf$$.file # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="action.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #endif #if HAVE_STDINT_H # include #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB XMKMF CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GREP EGREP SDL_TRUE SDL_FALSE SDL_CONFIG SDL_CFLAGS SDL_LIBS game_datadir XBSNDSRV_TRUE XBSNDSRV_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS XMKMF CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --enable-sdl, enable compilation with SDL --disable-sdltest Do not try to compile and run a test SDL program --enable-admin, data will be installed (and can be only started from) $prefix/share/games/XBlast-TNT/ --enable-sound, enable compilation of xbsndsrv! --enable-mini, enable compilation with -DMINI! --enable-nat, enable compilation with -DDEBUG_NAT! --enable-SMPF, enable compilation with -DSMPF (for 16 players)! Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir --with-x use the X Window System --with-sdl-prefix=PFX Prefix where SDL is installed (optional) --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) --with-otherdatadir=OTHERDATADIR If you dont want that the data go to: $prefix/share/games/XBlast-TNT/ Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory XMKMF Path to xmkmf, Makefile generator for X Window System CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f $ac_srcdir/configure.gnu; then echo && $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo && $SHELL $ac_srcdir/configure --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.59d Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59d. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$ac_config_guess` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$ac_config_sub $host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$ac_config_sub $target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version >&5\"") >&5 (eval $ac_compiler --version >&5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v >&5\"") >&5 (eval $ac_compiler -v >&5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V >&5\"") >&5 (eval $ac_compiler -V >&5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } # List of possible output files. We want to start from the most likely, # but we have to check foo.exe before foo, because Cygwin `test -f' looks # also for foo.exe. b.out is created by i960 compilers. # As a last resort, we also try wildcards: `conftest.*' and `a.*'. # But we are not allowed to rm a.*, and we do not want always remove # conftest.*, so we will list them literally, when appropriate. ac_outfiles="a_out.exe a.out conftest.exe conftest a.exe b.out" # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. rm -f $ac_outfiles conftest.* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $ac_outfiles" # The following tests should remove their output except files matching conftest.*. # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in $ac_outfiles a.* conftest.* NO do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) break;; esac done if test "$ac_file" = NO; then { { echo "$as_me:$LINENO: error: no output file found See \`config.log' for more details." >&5 echo "$as_me: error: no output file found See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } # Clean up; list also $ac_file, in case it matched a wildcard entry. rm -f $ac_outfiles $ac_file { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if test "${ac_cv_exeext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable), # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with `rm'. for ac_file in conftest.exe conftest conftest.* NO; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done if test "$ac_file" = NO; then { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: no output file found See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: no output file found See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi # Clean up; list also $ac_file, in case it matched conftest.*. rm -f $ac_outfiles $ac_file else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT ac_clean_files=$ac_clean_files_save { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT rm -f conftest.* { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo 'ac_maketemp=X"$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test "$ac_maketemp" != X ; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=xblast VERSION=2.10.3 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_config_headers="$ac_config_headers config.h" MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; esac fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi { echo "$as_me:$LINENO: checking whether NLS is requested" >&5 echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { echo "$as_me:$LINENO: result: $USE_NLS" >&5 echo "${ECHO_T}$USE_NLS" >&6; } # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { echo "$as_me:$LINENO: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_GMSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { echo "$as_me:$LINENO: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { echo "$as_me:$LINENO: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f messages.po # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_MSGMERGE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { echo "$as_me:$LINENO: result: $MSGMERGE" >&5 echo "${ECHO_T}$MSGMERGE" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "$GMSGFMT" != ":"; then if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` { echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6; } GMSGFMT=":" fi fi if test "$XGETTEXT" != ":"; then if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else { echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6; } XGETTEXT=":" fi rm -f messages.po fi ac_config_commands="$ac_config_commands default-1" if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { echo "$as_me:$LINENO: checking for ld used by GCC" >&5 echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } fi if test "${acl_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$acl_cv_path_LD" if test -n "$LD"; then { echo "$as_me:$LINENO: result: $LD" >&5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { echo "$as_me:$LINENO: checking for shared library run path origin" >&5 echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6; } if test "${acl_cv_rpath+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 echo "${ECHO_T}$acl_cv_rpath" >&6; } wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then enableval=$enable_rpath; : else enable_rpath=yes fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi fi LIBICONV= LTLIBICONV= INCICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi { echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6; } if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_CFPreferencesCopyAppValue=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi { echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFPREFERENCESCOPYAPPVALUE 1 _ACEOF fi { echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6; } if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_CFLocaleCopyCurrent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFLocaleCopyCurrent=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi { echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFLOCALECOPYCURRENT 1 _ACEOF fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi { echo "$as_me:$LINENO: checking whether NLS is requested" >&5 echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { echo "$as_me:$LINENO: result: $USE_NLS" >&5 echo "${ECHO_T}$USE_NLS" >&6; } LIBINTL= LTLIBINTL= POSUB= if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no { echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6; } if test "${gt_cv_func_gnugettext1_libc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main () { bindtextdomain ("", ""); return (gettext ("") != 0) + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_gnugettext1_libc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext1_libc=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6; } if test "$gt_cv_func_gnugettext1_libc" != "yes"; then am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { echo "$as_me:$LINENO: checking for iconv" >&5 echo $ECHO_N "checking for iconv... $ECHO_C" >&6; } if test "${am_cv_func_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_lib_iconv=yes am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 echo "${ECHO_T}$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ICONV 1 _ACEOF fi if test "$am_cv_lib_iconv" = yes; then { echo "$as_me:$LINENO: checking how to link with libiconv" >&5 echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $LIBICONV" >&5 echo "${ECHO_T}$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libintl-prefix was given. if test "${with_libintl_prefix+set}" = set; then withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi fi LIBINTL= LTLIBINTL= INCINTL= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" else : fi else found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6; } if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return (gettext ("") != 0) + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_gnugettext1_libintl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext1_libintl=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return (gettext ("") != 0) + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext1_libintl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi { echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6; } fi if test "$gt_cv_func_gnugettext1_libc" = "yes" \ || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then cat >>confdefs.h <<\_ACEOF #define ENABLE_NLS 1 _ACEOF else USE_NLS=no fi fi { echo "$as_me:$LINENO: checking whether to use NLS" >&5 echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $USE_NLS" >&5 echo "${ECHO_T}$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { echo "$as_me:$LINENO: result: $gt_source" >&5 echo "${ECHO_T}$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then { echo "$as_me:$LINENO: checking how to link with libintl" >&5 echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $LIBINTL" >&5 echo "${ECHO_T}$LIBINTL" >&6; } for element in $INCINTL; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done fi cat >>confdefs.h <<\_ACEOF #define HAVE_GETTEXT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_DCGETTEXT 1 _ACEOF fi POSUB=po fi INTLLIBS="$LIBINTL" CPPFLAGS="$CPPFLAGS -Wall " if test "${ac_cv_c_compiler_gnu}" = "yes"; then CFLAGS="$CFLAGS \ -ggdb \ -Wall \ -Wcast-align \ -Wcast-qual \ -Wmissing-declarations \ -Wmissing-prototypes \ -Wpointer-arith \ -Wreturn-type \ -Wstrict-prototypes \ " fi # ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6; } ac_path_x_has_been_run=yes # Check whether --with-x was given. if test "${with_x+set}" = set; then withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libX11.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" # It might be that x_includes is empty (headers are found in the # standard search path. Then output the corresponding message ac_out_x_includes=$x_includes test "x$x_includes" = x && ac_out_x_includes="in standard search path" { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6; } fi if test "x$ac_path_x_has_been_run" != xyes; then { echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6; } ac_path_x_has_been_run=yes # Check whether --with-x was given. if test "${with_x+set}" = set; then withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libX11.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" # It might be that x_includes is empty (headers are found in the # standard search path. Then output the corresponding message ac_out_x_includes=$x_includes test "x$x_includes" = x && ac_out_x_includes="in standard search path" { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6; } fi fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) { echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else { echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6; } fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6; } if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6; } if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. { echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6; } if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_gethostbyname || defined __stub___gethostbyname choke me #endif int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6; } if test $ac_cv_func_gethostbyname = no; then { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; } if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6; } if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. { echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6; } if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_connect || defined __stub___connect choke me #endif int main () { return connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6; } if test $ac_cv_func_connect = no; then { echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6; } if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. { echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6; } if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_remove || defined __stub___remove choke me #endif int main () { return remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6; } if test $ac_cv_func_remove = no; then { echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6; } if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); int main () { return remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6; } if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. { echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6; } if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_shmat || defined __stub___shmat choke me #endif int main () { return shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6; } if test $ac_cv_func_shmat = no; then { echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6; } if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); int main () { return shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6; } if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; } if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test x$have_x = xyes ; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" fi if test x$build_cpu = xsparc ; then CPPFLAGS="$CPPFLAGS -Dsparc" fi case "${target_os}" in solaris*) LDFLAGS="$LDFLAGS -lX11 -lsocket -lnsl" ;; cygwin*) LIBS="$LIBS $LIBINTL" ;; esac { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.*;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.*;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef pid_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef size_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6; } if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !x[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi # Check whether --enable-sdl was given. if test "${enable_sdl+set}" = set; then enableval=$enable_sdl; case "${enableval}" in yes) sdl=true CFLAGS="$CFLAGS -DSDL `sdl-config --cflags`" LDFLAGS="$LDFLAGS " LIBS="$LIBS `sdl-config --libs`";; no) sdl=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-sdl" >&5 echo "$as_me: error: bad value ${enableval} for --enable-sdl" >&2;} { (exit 1); exit 1; }; } ;; esac else sdl=false fi if test x$sdl = xtrue; then SDL_TRUE= SDL_FALSE='#' else SDL_TRUE='#' SDL_FALSE= fi if test x$sdl = xfalse ; then { echo "$as_me:$LINENO: checking for main in -lICE" >&5 echo $ECHO_N "checking for main in -lICE... $ECHO_C" >&6; } if test "${ac_cv_lib_ICE_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_main" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_main" >&6; } if test $ac_cv_lib_ICE_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBICE 1 _ACEOF LIBS="-lICE $LIBS" fi { echo "$as_me:$LINENO: checking for main in -lX11" >&5 echo $ECHO_N "checking for main in -lX11... $ECHO_C" >&6; } if test "${ac_cv_lib_X11_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_X11_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_X11_main" >&5 echo "${ECHO_T}$ac_cv_lib_X11_main" >&6; } if test $ac_cv_lib_X11_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBX11 1 _ACEOF LIBS="-lX11 $LIBS" fi else SDL_VERSION=1.2.0 # Check whether --with-sdl-prefix was given. if test "${with_sdl_prefix+set}" = set; then withval=$with_sdl_prefix; sdl_prefix="$withval" else sdl_prefix="" fi # Check whether --with-sdl-exec-prefix was given. if test "${with_sdl_exec_prefix+set}" = set; then withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" else sdl_exec_prefix="" fi # Check whether --enable-sdltest was given. if test "${enable_sdltest+set}" = set; then enableval=$enable_sdltest; else enable_sdltest=yes fi if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi PATH="$prefix/bin:$prefix/usr/bin:$PATH" # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_SDL_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SDL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" ;; esac fi SDL_CONFIG=$ac_cv_path_SDL_CONFIG if test -n "$SDL_CONFIG"; then { echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 echo "${ECHO_T}$SDL_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi min_sdl_version=$SDL_VERSION { echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6; } no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_sdl=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_CXXFLAGS="" SDL_LIBS="" { { echo "$as_me:$LINENO: error: *** SDL version $SDL_VERSION not found!" >&5 echo "$as_me: error: *** SDL version $SDL_VERSION not found!" >&2;} { (exit 1); exit 1; }; } fi rm -f conf.sdltest { echo "$as_me:$LINENO: checking for main in -lSDL_image" >&5 echo $ECHO_N "checking for main in -lSDL_image... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_image_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_image $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SDL_image_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_image_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_image_main" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_image_main" >&6; } if test $ac_cv_lib_SDL_image_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSDL_IMAGE 1 _ACEOF LIBS="-lSDL_image $LIBS" else { { echo "$as_me:$LINENO: error: Cannot find required library SDL-image." >&5 echo "$as_me: error: Cannot find required library SDL-image." >&2;} { (exit 1); exit 1; }; } exit 1; fi { echo "$as_me:$LINENO: checking for main in -lSDL_ttf" >&5 echo $ECHO_N "checking for main in -lSDL_ttf... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_ttf_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_ttf $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SDL_ttf_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_ttf_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_ttf_main" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_ttf_main" >&6; } if test $ac_cv_lib_SDL_ttf_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSDL_TTF 1 _ACEOF LIBS="-lSDL_ttf $LIBS" else { { echo "$as_me:$LINENO: error: Cannot find required library SDL-ttf." >&5 echo "$as_me: error: Cannot find required library SDL-ttf." >&2;} { (exit 1); exit 1; }; } exit 1; fi { echo "$as_me:$LINENO: checking for main in -lSDL_mixer" >&5 echo $ECHO_N "checking for main in -lSDL_mixer... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_mixer_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_mixer $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SDL_mixer_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_mixer_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_mixer_main" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_mixer_main" >&6; } if test $ac_cv_lib_SDL_mixer_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSDL_MIXER 1 _ACEOF LIBS="-lSDL_mixer $LIBS" else { { echo "$as_me:$LINENO: error: Cannot find required library SDL-mixer." >&5 echo "$as_me: error: Cannot find required library SDL-mixer." >&2;} { (exit 1); exit 1; }; } exit 1; fi { echo "$as_me:$LINENO: checking for main in -lSDL_net" >&5 echo $ECHO_N "checking for main in -lSDL_net... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_net_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_net $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SDL_net_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_net_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_net_main" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_net_main" >&6; } if test $ac_cv_lib_SDL_net_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSDL_NET 1 _ACEOF LIBS="-lSDL_net $LIBS" fi { echo "$as_me:$LINENO: checking for main in -lSDL_gfx" >&5 echo $ECHO_N "checking for main in -lSDL_gfx... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_gfx_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_gfx $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SDL_gfx_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_gfx_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_gfx_main" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_gfx_main" >&6; } if test $ac_cv_lib_SDL_gfx_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSDL_GFX 1 _ACEOF LIBS="-lSDL_gfx $LIBS" else { { echo "$as_me:$LINENO: error: Cannot find required library SDL-gfx." >&5 echo "$as_me: error: Cannot find required library SDL-gfx." >&2;} { (exit 1); exit 1; }; } exit 1; fi fi { echo "$as_me:$LINENO: checking for main in -lm" >&5 echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6; } if test "${ac_cv_lib_m_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_m_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 echo "${ECHO_T}$ac_cv_lib_m_main" >&6; } if test $ac_cv_lib_m_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi { echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi for ac_header in fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/audio.h sys/soundcard.h linux/soundcard.h machine/soundcard.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done game_datadir= # Check whether --enable-admin was given. if test "${enable_admin+set}" = set; then enableval=$enable_admin; game_datadir="$datadir" game_datadir=`( test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" eval echo \""$game_datadir"/games/XBlast-TNT/\" )` fi # Check whether --with-otherdatadir was given. if test "${with_otherdatadir+set}" = set; then withval=$with_otherdatadir; game_datadir="$with_otherdatadir" else if test x$game_datadir = x ; then game_datadir="./" fi fi datadir=$game_datadir; CFLAGS="$CFLAGS -DGAME_DATADIR=\\\"$datadir\\\"" # Check whether --enable-sound was given. if test "${enable_sound+set}" = set; then enableval=$enable_sound; case "${enableval}" in yes) xbsndsrv=true CFLAGS="$CFLAGS -DXBLAST_SOUND";; no) xbsndsrv=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-sound" >&5 echo "$as_me: error: bad value ${enableval} for --enable-sound" >&2;} { (exit 1); exit 1; }; } ;; esac else xbsndsrv=false fi if test x$xbsndsrv = xtrue; then XBSNDSRV_TRUE= XBSNDSRV_FALSE='#' else XBSNDSRV_TRUE='#' XBSNDSRV_FALSE= fi # Check whether --enable-mini was given. if test "${enable_mini+set}" = set; then enableval=$enable_mini; case "${enableval}" in yes) CFLAGS="$CFLAGS -DMINI_XBLAST" mini=true;; no) mini=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-mini" >&5 echo "$as_me: error: bad value ${enableval} for --enable-mini" >&2;} { (exit 1); exit 1; }; } ;; esac else mini=false fi # Check whether --enable-nat was given. if test "${enable_nat+set}" = set; then enableval=$enable_nat; case "${enableval}" in yes) CFLAGS="$CFLAGS -DDEBUG_NAT" nat=true;; no) nat=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-nat" >&5 echo "$as_me: error: bad value ${enableval} for --enable-nat" >&2;} { (exit 1); exit 1; }; } ;; esac else nat=false fi # Check whether --enable-SMPF was given. if test "${enable_SMPF+set}" = set; then enableval=$enable_SMPF; case "${enableval}" in yes) CFLAGS="$CFLAGS -DSMPF" smpf=true;; no) smpf=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-smpf" >&5 echo "$as_me: error: bad value ${enableval} for --enable-smpf" >&2;} { (exit 1); exit 1; }; } ;; esac else smpf=false fi { echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { echo "$as_me:$LINENO: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; } if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac { echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=int else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in strftime do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { echo "$as_me:$LINENO: checking for strftime in -lintl" >&5 echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; } if test "${ac_cv_lib_intl_strftime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_intl_strftime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_strftime=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; } if test $ac_cv_lib_intl_strftime = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRFTIME 1 _ACEOF LIBS="-lintl $LIBS" fi fi done for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF { echo "$as_me:$LINENO: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; } if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ #define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _doprnt /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _doprnt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__doprnt || defined __stub____doprnt choke me #endif int main () { return _doprnt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6; } if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 _ACEOF fi fi done for ac_func in gettimeofday mkdir select socket strstr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile po/Makefile.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${SDL_TRUE}" && test -z "${SDL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"SDL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"SDL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${XBSNDSRV_TRUE}" && test -z "${XBSNDSRV_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"XBSNDSRV\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"XBSNDSRV\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (dirname -- /) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # Find out whether ``test -x'' works. Don't use a zero-byte file, as # systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then as_executable_p="test -x" else as_executable_p=: fi rm -f conf$$.file # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.59d. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59d, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0" $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim MKINSTALLDIRS!$MKINSTALLDIRS$ac_delim USE_NLS!$USE_NLS$ac_delim MSGFMT!$MSGFMT$ac_delim GMSGFMT!$GMSGFMT$ac_delim XGETTEXT!$XGETTEXT$ac_delim MSGMERGE!$MSGMERGE$ac_delim INTL_MACOSX_LIBS!$INTL_MACOSX_LIBS$ac_delim LIBICONV!$LIBICONV$ac_delim LTLIBICONV!$LTLIBICONV$ac_delim INTLLIBS!$INTLLIBS$ac_delim LIBINTL!$LIBINTL$ac_delim _ACEOF if test `grep -c "$ac_delim\$" conf$$subs.sed` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof= if grep '^CEOF$' conf$$subs.sed >/dev/null; then ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF//p' conf$$subs.sed | sort -nru | sed 1q` ac_eof=`expr 0$ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF LTLIBINTL!$LTLIBINTL$ac_delim POSUB!$POSUB$ac_delim XMKMF!$XMKMF$ac_delim CPP!$CPP$ac_delim X_CFLAGS!$X_CFLAGS$ac_delim X_PRE_LIBS!$X_PRE_LIBS$ac_delim X_LIBS!$X_LIBS$ac_delim X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim SDL_TRUE!$SDL_TRUE$ac_delim SDL_FALSE!$SDL_FALSE$ac_delim SDL_CONFIG!$SDL_CONFIG$ac_delim SDL_CFLAGS!$SDL_CFLAGS$ac_delim SDL_LIBS!$SDL_LIBS$ac_delim game_datadir!$game_datadir$ac_delim XBSNDSRV_TRUE!$XBSNDSRV_TRUE$ac_delim XBSNDSRV_FALSE!$XBSNDSRV_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `grep -c "$ac_delim\$" conf$$subs.sed` = 20; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof= if grep '^CEOF$' conf$$subs.sed >/dev/null; then ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF//p' conf$$subs.sed | sort -nru | sed 1q` ac_eof=`expr 0$ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. # ac_dA='s,^\([ ]*#[ ]*\)[^ ]*\([ ][ ]*' ac_dB='\)[ (].*$,\1define\2' ac_dC=' ' ac_dD=' ,' ac_word_regexp=[_$as_cr_Letters][_$as_cr_alnum]* _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/[\\$`]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/${ac_dA}\1$ac_dB\2${ac_dC}\3$ac_dD/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/${ac_dA}\1$ac_dB${ac_dC}\2$ac_dD/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=96 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: echo ' # First, check the format of the line: cat >"$tmp/defines.sed" <>$CONFIG_STATUS sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| . 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; "default-1":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi echo "--------------------------------" if test "${sdl}" = "true"; then echo "selected GUI is SDL" else echo "selected GUI is X11" echo "sound compilation $xbsndsrv" fi echo "mini compilation: $mini" echo "nat compilation: $nat" echo "SMPF compilation: $smpf" echo "datadir: $game_datadir" echo "--------------------------------" xblast-2.10.4/configure.in0000644000175000017500000001134210443242444014523 0ustar rhondaalfiednl Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([action.c]) dnl Checks for programs. AC_CANONICAL_TARGET([]) AC_PROG_CC AM_INIT_AUTOMAKE([xblast], 2.10.3 ) AC_CONFIG_HEADER(config.h) AM_GNU_GETTEXT([external]) CPPFLAGS="$CPPFLAGS -Wall " XBLAST_CC_SET_CFLAGS() AC_PROG_INSTALL AC_PATH_X AC_PATH_XTRA if test x$have_x = xyes ; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" fi if test x$build_cpu = xsparc ; then CPPFLAGS="$CPPFLAGS -Dsparc" fi case "${target_os}" in solaris*) LDFLAGS="$LDFLAGS -lX11 -lsocket -lnsl" ;; cygwin*) LIBS="$LIBS $LIBINTL" ;; esac AC_TYPE_PID_T AC_TYPE_SIZE_T AC_C_CONST dnl AC_DEFINE_UNQUOTED(DATADIR, "$datadir") dnl Check whether we want X11 or SDL AC_ARG_ENABLE([sdl],[ --enable-sdl, enable compilation with SDL], [ case "${enableval}" in yes) sdl=true CFLAGS="$CFLAGS -DSDL `sdl-config --cflags`" LDFLAGS="$LDFLAGS " LIBS="$LIBS `sdl-config --libs`";; no) sdl=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-sdl) ;; esac],[sdl=false]) AM_CONDITIONAL(SDL, test x$sdl = xtrue) if test x$sdl = xfalse ; then dnl Replace `main' with a function in -lICE: AC_CHECK_LIB(ICE, main) dnl Replace `main' with a function in -lX11: AC_CHECK_LIB(X11, main) else SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, : , AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])) AC_CHECK_LIB(SDL_image, main,, [ AC_MSG_ERROR(Cannot find required library SDL-image.) exit 1; ] ) AC_CHECK_LIB(SDL_ttf, main,, [ AC_MSG_ERROR(Cannot find required library SDL-ttf.) exit 1; ] ) AC_CHECK_LIB(SDL_mixer, main,, [ AC_MSG_ERROR(Cannot find required library SDL-mixer.) exit 1; ] ) AC_CHECK_LIB(SDL_net, main)dnl,, dnl [ dnl AC_MSG_ERROR(Cannot find required library SDL-net.) dnl exit 1; dnl ] dnl ) AC_CHECK_LIB(SDL_gfx, main,, [ AC_MSG_ERROR(Cannot find required library SDL-gfx.) exit 1; ] ) fi dnl Checks for libraries. AC_CHECK_LIB(m, main) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/audio.h sys/soundcard.h linux/soundcard.h machine/soundcard.h) AH_TEMPLATE([GAME_DATADIR], [for packed]) game_datadir= AC_ARG_ENABLE([admin],[ --enable-admin, data will be installed (and can be only started from) $prefix/share/games/XBlast-TNT/], MY_EXPAND_DIR(game_datadir, "$datadir")) AC_ARG_WITH([otherdatadir],[ --with-otherdatadir=OTHERDATADIR If you dont want that the data go to: $prefix/share/games/XBlast-TNT/], game_datadir="$with_otherdatadir", if test x$game_datadir = x ; then game_datadir="./" fi ) dnl AC_DEFINE_UNQUOTED( [GAME_DATADIR] , ["$game_datadir"] , ["a comment here"] ) datadir=$game_datadir; CFLAGS="$CFLAGS -DGAME_DATADIR=\\\"$datadir\\\"" AC_SUBST(datadir) AC_SUBST(game_datadir) AC_ARG_ENABLE([sound],[ --enable-sound, enable compilation of xbsndsrv!], [ case "${enableval}" in yes) xbsndsrv=true CFLAGS="$CFLAGS -DXBLAST_SOUND";; no) xbsndsrv=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-sound) ;; esac],[xbsndsrv=false]) AM_CONDITIONAL(XBSNDSRV, test x$xbsndsrv = xtrue) AC_ARG_ENABLE([mini],[ --enable-mini, enable compilation with -DMINI!], [ case "${enableval}" in yes) CFLAGS="$CFLAGS -DMINI_XBLAST" mini=true;; no) mini=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-mini) ;; esac],mini=false) AC_ARG_ENABLE([nat],[ --enable-nat, enable compilation with -DDEBUG_NAT!], [ case "${enableval}" in yes) CFLAGS="$CFLAGS -DDEBUG_NAT" nat=true;; no) nat=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-nat) ;; esac],nat=false) AC_ARG_ENABLE([SMPF],[ --enable-SMPF, enable compilation with -DSMPF (for 16 players)!], [ case "${enableval}" in yes) CFLAGS="$CFLAGS -DSMPF" smpf=true;; no) smpf=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-smpf) ;; esac],smpf=false) dnl AC_DEFINE_UNQUOTED(XBSNDSRV, "$xbsndsrv") dnl CFLAGS="$(CFLAGS)" -DDATADIR="$(datadir)" dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS(gettimeofday mkdir select socket strstr) AC_CONFIG_FILES([Makefile po/Makefile.in]) AC_OUTPUT dnl Display final configuration echo "--------------------------------" if test "${sdl}" = "true"; then echo "selected GUI is SDL" else echo "selected GUI is X11" echo "sound compilation $xbsndsrv" fi echo "mini compilation: $mini" echo "nat compilation: $nat" echo "SMPF compilation: $smpf" echo "datadir: $game_datadir" echo "--------------------------------" xblast-2.10.4/dat_rating.c0000644000175000017500000001105610372731123014472 0ustar rhondaalfie/* * file dat_rating.c - level and game statistics * * $Id: dat_rating.c,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ /* * compare stat-data by percent */ static int CompareCentralDataByScore (const void *a, const void *b) { const XBCentralData *pA = a; const XBCentralData *pB = b; assert (pA != NULL); assert (pB != NULL); if (pA->score == pB->score) { return pB->numTotal - pA->numTotal; } else if (pA->score > pB->score) { return -1; } else { return +1; } } /* CompareStatDataByScore */ XBCentralData * CreateCentralStat (size_t * num) { XBAtom atom; CFGPlayerEx player; XBCentralData *table; size_t i, j; assert (NULL != num); /* alloc data for table */ *num = GetNumPlayerConfigs (CT_Central); table = calloc (*num, sizeof (XBCentralData)); assert (NULL != table); /* copy data */ for (i = 0, j = 0; i < *num; i++) { atom = GetPlayerAtom (CT_Central, i); if (RetrievePlayerEx (CT_Central, atom, &player)) { (table + j)->atom = atom; (table + j)->name = player.name; (table + j)->score = player.rating.rating; (table + j)->numTotal = player.rating.gamesPlayed; (table + j)->numWon = player.rating.realWins; if (player.rating.gamesPlayed > 0) { (table + j)->percent = player.rating.realWins; (table + j)->percent /= player.rating.gamesPlayed; (table + j)->percent *= 100.0; } else { (table + j)->percent = 0; } j++; } } *num = j; if (*num == 0) { free (table); return NULL; } /* sort by score */ qsort (table, *num, sizeof (XBCentralData), CompareCentralDataByScore); for (i = 0; i < *num; i++) { (table + i)->rank = i + 1; } /* that's all */ return table; } XBCentralInfo * CreateCentralInfo (XBAtom atom, XBCentralData data) // TODO pass *centralData (for rating, rank, ..) { XBCentralInfo *table; CFGPlayerEx player; char d[MAX_MENU_INFO][256]; int i; table = calloc (MAX_MENU_INFO, sizeof (XBCentralInfo)); for (i = 0; i < MAX_MENU_INFO; i++) { (table + i)->name = ""; (table + i)->value = ""; } if (RetrievePlayerEx (CT_Central, atom, &player)) { (table + 0)->name = "Name"; (table + 0)->value = player.name; sprintf (d[0], "%d", data.rank); (table + 1)->name = "Rank"; (table + 1)->value = d[0]; sprintf (d[1], "%0.1f", data.score); (table + 2)->name = "Rating"; (table + 2)->value = d[1]; (table + 3)->name = "Winnings"; if (data.numTotal > 0) { sprintf (d[2], "%d won of %d (%0.1f%%)", data.numWon, data.numTotal, data.percent); (table + 3)->value = d[2]; } else { (table + 3)->value = "No games played yet"; } sprintf (d[3], "%d", player.rating.relativeWins); (table + 4)->name = "Total number of levels won"; (table + 4)->value = d[3]; (table + 6)->name = "Registration date"; sprintf (d[4], "%s", DateString (player.rating.timeRegister)); (table + 6)->value = d[4]; (table + 7)->name = "Last game played"; if (player.rating.timeUpdate > 0) { sprintf (d[5], "%s", DateString (player.rating.timeUpdate)); (table + 7)->value = d[5]; } else { (table + 7)->value = "No games played yet"; } (table + 9)->name = "Win game message"; (table + 9)->value = player.messages.msgWinGame; (table + 10)->name = "Win level message"; (table + 10)->value = player.messages.msgWinLevel; (table + 11)->name = "Lose level message"; (table + 11)->value = player.messages.msgLoseLevel; (table + 12)->name = "Lose life message"; (table + 12)->value = player.messages.msgLoseLife; (table + 13)->name = "Welcome message"; (table + 13)->value = player.messages.msgWelcome; (table + 14)->name = "Gloat"; (table + 14)->value = player.messages.msgGloat; for (i = 9; i < 15; i++) { if ((table + i)->value == NULL) { (table + i)->value = "[None]"; } } } return table; } xblast-2.10.4/dat_rating.h0000644000175000017500000000262410372731123014500 0ustar rhondaalfie/* * file dat_rating.h - level and game statistics * * $Id: dat_rating.h,v 1.5 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _DAT_RATING_H #define _DAT_RATING_H #define MAX_MENU_INFO 15 /* * global prototypes */ typedef struct { XBAtom atom; const char *name; int numWon; int numTotal; double score; double percent; int rank; } XBCentralData; typedef struct { const char *name; const char *value; } XBCentralInfo; extern XBCentralData *CreateCentralStat (size_t * num); extern XBCentralInfo *CreateCentralInfo (XBAtom atom, XBCentralData data); #endif /* * end of file dat_rating.h */ xblast-2.10.4/debug.c0000644000175000017500000003302710375712062013452 0ustar rhondaalfie/* * file debug.c - debugging routines * * $Id: debug.c,v 1.37 2006/02/18 21:40:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #ifdef DEBUG_ALLOC #undef malloc #undef calloc #undef free #endif /* * local macros */ /* size of alloc tracking table */ #define TABLE_SIZE 20000 /* * local types */ /* data structure for tracking allocs */ typedef struct { const void *ptr; size_t bytes; const char *file; int line; } AllocData; /* * local variables */ #ifdef DEBUG /* start value for timer */ static struct timeval timeStart; #endif #ifdef DEBUG_ALLOC #define USETABLE #undef USETABLE static int count = 0; static FILE *fout = NULL; static const char *outFile = NULL; #ifdef USETABLE static AllocData *table = NULL; #endif static size_t currentAlloc = 0; static size_t maxAlloc = 0; #endif #if defined(DEBUG) || !defined(__GNUC__) /* * global function: Dbg_StartClock * description: start millisec for profiling */ void Dbg_StartClock (void) { #ifdef DEBUG gettimeofday (&timeStart, NULL); #endif } /* Dbg_StartClock */ /* * global function: Dbg_FinishClock * description: stop millisec for profiling */ time_t Dbg_FinishClock (void) { #ifdef DEBUG struct timeval timeEnd; gettimeofday (&timeEnd, NULL); return (timeEnd.tv_sec - timeStart.tv_sec) * 1000 + (timeEnd.tv_usec - timeStart.tv_usec) / 1000; #endif } /* Dbg_FinishClock */ /* * global function: Dbg_Out * description: formatted debug output to stderr * parameters: fmt - format string as in printf * ... - variable args as in printf */ void Dbg_Out (const char *fmt, ...) { #ifdef DEBUG va_list argList; #ifdef W32 static int init = 1; static FILE *fp; fp = stderr; if (init) { fp = fopen ("error.log", "w+"); init = 0; } #endif va_start (argList, fmt); #ifdef W32 vfprintf (fp, fmt, argList); #else vfprintf (stderr, fmt, argList); #endif va_end (argList); #endif } /* Dbg_Out */ #endif /* * debug outputs for certain sections * for gcc: use of variadic macro to define away, use -std=c99 with -pedantic * for other: use empty routines which should be optimized away */ #if defined(DEBUG_CONFIG) || !defined(__GNUC__) void Dbg_Config (const char *fmt, ...) { #ifdef DEBUG_CONFIG va_list argList; va_start (argList, fmt); fprintf (stderr, "CONFIG: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_FILE) || !defined(__GNUC__) void Dbg_File (const char *fmt, ...) { #ifdef DEBUG_FILE va_list argList; va_start (argList, fmt); fprintf (stderr, "FILE: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_LEVEL) || !defined(__GNUC__) void Dbg_Level (const char *fmt, ...) { #ifdef DEBUG_LEVEL va_list argList; va_start (argList, fmt); fprintf (stderr, "LEVEL: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_GAME) || !defined(__GNUC__) void Dbg_Game (const char *fmt, ...) { #ifdef DEBUG_GAME va_list argList; va_start (argList, fmt); fprintf (stderr, "GAME: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_ACTION) || !defined(__GNUC__) void Dbg_Action (const char *fmt, ...) { #ifdef DEBUG_ACTION va_list argList; va_start (argList, fmt); fprintf (stderr, "ACTION: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_NETWORK) || !defined(__GNUC__) void Dbg_Network (const char *fmt, ...) { #ifdef DEBUG_NETWORK va_list argList; va_start (argList, fmt); fprintf (stderr, "NETWORK: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_SERVER) || !defined(__GNUC__) void Dbg_Server (const char *fmt, ...) { #ifdef DEBUG_SERVER va_list argList; va_start (argList, fmt); fprintf (stderr, "SERVER: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_CLIENT) || !defined(__GNUC__) void Dbg_Client (const char *fmt, ...) { #ifdef DEBUG_CLIENT va_list argList; va_start (argList, fmt); fprintf (stderr, "CLIENT: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_USER) || !defined(__GNUC__) void Dbg_User (const char *fmt, ...) { #ifdef DEBUG_USER va_list argList; va_start (argList, fmt); fprintf (stderr, "USER: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_LISTEN) || !defined(__GNUC__) void Dbg_Listen (const char *fmt, ...) { #ifdef DEBUG_LISTEN va_list argList; va_start (argList, fmt); fprintf (stderr, "LISTEN: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_STREAM) || !defined(__GNUC__) void Dbg_Stream (const char *fmt, ...) { #ifdef DEBUG_STREAM va_list argList; va_start (argList, fmt); fprintf (stderr, "STREAM: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_S2C) || !defined(__GNUC__) void Dbg_S2C (const char *fmt, ...) { #ifdef DEBUG_S2C va_list argList; va_start (argList, fmt); fprintf (stderr, "S2C: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_C2S) || !defined(__GNUC__) void Dbg_C2S (const char *fmt, ...) { #ifdef DEBUG_C2S va_list argList; va_start (argList, fmt); fprintf (stderr, "C2S: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_X2C) || !defined(__GNUC__) void Dbg_X2C (const char *fmt, ...) { #ifdef DEBUG_X2C va_list argList; va_start (argList, fmt); fprintf (stderr, "X2C: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_C2X) || !defined(__GNUC__) void Dbg_C2X (const char *fmt, ...) { #ifdef DEBUG_C2X va_list argList; va_start (argList, fmt); fprintf (stderr, "C2X: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_C2B) || !defined(__GNUC__) void Dbg_C2B (const char *fmt, ...) { #ifdef DEBUG_C2B va_list argList; va_start (argList, fmt); fprintf (stderr, "C2B: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_DGRAM) || !defined(__GNUC__) void Dbg_Dgram (const char *fmt, ...) { #ifdef DEBUG_DGRAM va_list argList; va_start (argList, fmt); fprintf (stderr, "DGRAM: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_D2C) || !defined(__GNUC__) void Dbg_D2C (const char *fmt, ...) { #ifdef DEBUG_D2C va_list argList; va_start (argList, fmt); fprintf (stderr, "D2C: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_D2S) || !defined(__GNUC__) void Dbg_D2S (const char *fmt, ...) { #ifdef DEBUG_D2S va_list argList; va_start (argList, fmt); fprintf (stderr, "D2S: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_BROWSE) || !defined(__GNUC__) void Dbg_Browse (const char *fmt, ...) { #ifdef DEBUG_BROWSE va_list argList; va_start (argList, fmt); fprintf (stderr, "BROWSE: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_NEWGAME) || !defined(__GNUC__) void Dbg_Newgame (const char *fmt, ...) { #ifdef DEBUG_NEWGAME va_list argList; va_start (argList, fmt); fprintf (stderr, "NEWGAME: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_REPLY) || !defined(__GNUC__) void Dbg_Reply (const char *fmt, ...) { #ifdef DEBUG_REPLY va_list argList; va_start (argList, fmt); fprintf (stderr, "REPLY: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_QUERY) || !defined(__GNUC__) void Dbg_Query (const char *fmt, ...) { #ifdef DEBUG_QUERY va_list argList; va_start (argList, fmt); fprintf (stderr, "QUERY: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_CENTRAL) || !defined(__GNUC__) void Dbg_Central (const char *fmt, ...) { #ifdef DEBUG_CENTRAL va_list argList; va_start (argList, fmt); fprintf (stderr, "CENTRAL: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_COMM) || !defined(__GNUC__) void Dbg_Comm (const char *fmt, ...) { #ifdef DEBUG_COMM va_list argList; va_start (argList, fmt); fprintf (stderr, "COMM: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_SOCKET) || !defined(__GNUC__) void Dbg_Socket (const char *fmt, ...) { #ifdef DEBUG_SOCKET va_list argList; va_start (argList, fmt); fprintf (stderr, "SOCKET: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_VERSION) || !defined(__GNUC__) void Dbg_Version (const char *fmt, ...) { #ifdef DEBUG_VERSION va_list argList; va_start (argList, fmt); fprintf (stderr, "VERSION: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #if defined(DEBUG_CHAT) || !defined(__GNUC__) void Dbg_Chat (const char *fmt, ...) { #ifdef DEBUG_CHAT va_list argList; va_start (argList, fmt); fprintf (stderr, "CHAT: "); vfprintf (stderr, fmt, argList); va_end (argList); #endif } #endif #ifdef DEBUG_ALLOC /* * */ void Dbg_FinishAlloc (void) { #ifdef USETABLE int i, j; size_t sumBytes = 0; size_t sumAlloc = 0; size_t sumTotal = 0; char *ptr; for (i = 0; i < count; i++) { if (table[i].ptr != NULL) { fprintf (fout, "[%d] unfreed memory at 0x%08lX (%s:%d)", i, (unsigned long)table[i].ptr, table[i].file, table[i].line); sumAlloc++; sumBytes += table[i].bytes; /* output */ fputc ('\"', fout); for (ptr = table[i].ptr, j = 0; j < table[i].bytes && j < 16; j++, ptr++) { if (isprint (*ptr)) { fputc (*ptr, fout); } else { fprintf (fout, "\\%03o", (unsigned)*ptr); } } fputs ("\"\n", fout); } sumTotal += table[i].bytes; } fprintf (stderr, "%u/%u unfree memory segments with total %u/%u/%u bytes\n", sumAlloc, count, sumBytes, maxAlloc, sumTotal); #else fprintf (stderr, "count=%u current=%lu bytes max=%lu bytes\n", count, (unsigned long)currentAlloc, (unsigned long)maxAlloc); #endif } /* Finish */ /* * replacement for malloc */ void * Dbg_Malloc (const char *file, int line, size_t nBytes) { void *result = malloc (nBytes); #ifdef USETABLE assert (count < TABLE_SIZE); if (NULL == table) { table = calloc (TABLE_SIZE, sizeof (*table)); assert (NULL != table); } table[count].ptr = result; table[count].bytes = nBytes; table[count].file = file; table[count].line = line; #endif /* statistics */ currentAlloc += nBytes; if (currentAlloc > maxAlloc) { maxAlloc = currentAlloc; } /* log it */ if (NULL == fout) { fout = (outFile == NULL) ? stderr : fopen (outFile, "w"); } fprintf (fout, "[%d] 0x%08lX = malloc (%lu); %s:%d\n", count, (unsigned long)result,(unsigned long)nBytes, file, line); count++; return result; } /* Malloc */ /* * replacement for calloc */ void * Dbg_Calloc (const char *file, int line, size_t nElem, size_t sElem) { void *result = calloc (nElem, sElem); #ifdef USETABLE assert (count < TABLE_SIZE); if (NULL == table) { table = calloc (TABLE_SIZE, sizeof (*table)); assert (NULL != table); } table[count].ptr = result; table[count].bytes = nElem * sElem; table[count].file = file; table[count].line = line; #endif /* statistics */ currentAlloc += nElem * sElem; if (currentAlloc > maxAlloc) { maxAlloc = currentAlloc; } /* log it */ if (NULL == fout) { fout = (outFile == NULL) ? stderr : fopen (outFile, "w"); } /* hook in clean up function */ fprintf (fout, "[%d] 0x%08lX = calloc (%lu,%lu); %s:%d\n", count, (unsigned long)result, (unsigned long)nElem, (unsigned long)sElem, file, line); count++; return result; } /* Calloc */ /* * replacement for free */ void Dbg_Free (const char *file, int line, void *ptr) { int index = 0; #ifdef USETABLE for (index = 0; index < count; index++) { if (table[index].ptr == ptr) { break; } } table[index].ptr = NULL; /* statistics */ currentAlloc -= table[index].bytes; /* log it */ if (index == count) { fprintf (stderr, "[?] free (0x%08lX); %s:%d\n", (unsigned long)ptr, file, line); return; } #endif if (NULL == fout) { fout = (outFile == NULL) ? stderr : fopen (outFile, "w"); } fprintf (fout, "[%d] free (0x%08lX); %s:%d\n", index, (unsigned long)ptr, file, line); free (ptr); } /* Free */ /* * replacement for free */ void Dbg_Vfree (const char *file, int line, void *ptr) { int index = 0; #ifdef USETABLE for (index = 0; index < count; index++) { if (table[index].ptr == ptr) { break; } } table[index].ptr = NULL; /* statistics */ currentAlloc -= table[index].bytes; /* log it */ if (index == count) { fprintf (stderr, "[?] unlock (0x%08lX); %s:%d\n", (unsigned long)ptr, file, line); return; } #endif if (NULL == fout) { fout = (outFile == NULL) ? stderr : fopen (outFile, "w"); } fprintf (fout, "[%d] unlock (0x%08lX); %s:%d\n", index, (unsigned long)ptr, file, line); } /* Free */ #endif /* * end of file alloc. */ xblast-2.10.4/debug.h0000644000175000017500000001515310372731123013453 0ustar rhondaalfie/* * file debug.h - memory debugging * * $Id: debug.h,v 1.32 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_DEBUG_H #define XBLAST_DEBUG_H //#define DEBUG //#define DEBUG_FILE //#define DEBUG_CONFIG //#define DEBUG_LEVEL //#define DEBUG_GAME //#define DEBUG_ACTION //#define DEBUG_NETWORK //#define DEBUG_SERVER //#define DEBUG_CLIENT //#define DEBUG_USER //#define DEBUG_LISTEN //#define DEBUG_STREAM //#define DEBUG_S2C //#define DEBUG_C2S //#define DEBUG_X2C //#define DEBUG_C2X //#define DEBUG_C2B //#define DEBUG_DGRAM //#define DEBUG_D2C //#define DEBUG_D2S //#define DEBUG_BROWSE //#define DEBUG_NEWGAME //#define DEBUG_REPLY //#define DEBUG_QUERY //#define DEBUG_CENTRAL //#define DEBUG_COMM //#define DEBUG_SOCKET //#define DEBUG_VERSION //#define DEBUG_CHAT /* * global macros */ #if defined(__GNUC__) && !defined(DEBUG) #define Dbg_Out(fmt, ...) (void)0 #define DBGATTR #else #ifdef __GNUC__ #define DBGATTR __attribute__ ((format (printf, 1, 2))); #endif extern void Dbg_StartClock (void); extern time_t Dbg_FinishClock (void); extern void Dbg_Out (const char *fmt, ...) DBGATTR; #endif #ifdef DEBUG_ALLOC #define malloc(a) Dbg_Malloc (__FILE__,__LINE__,a) #define calloc(a,b) Dbg_Calloc (__FILE__,__LINE__,a,b) #define free(a) Dbg_Free (__FILE__,__LINE__,a) #endif /* * global prototypes */ #if defined(__GNUC__) && !defined(DEBUG_FILE) #define Dbg_File(fmt,...) (void)0 #else extern void Dbg_File (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_CONFIG) #define Dbg_Config(fmt,...) (void)0 #else extern void Dbg_Config (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_LEVEL) #define Dbg_Level(fmt,...) (void)0 #else extern void Dbg_Level (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_GAME) #define Dbg_Game(fmt,...) (void)0 #else extern void Dbg_Game (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_ACTION) #define Dbg_Action(fmt,...) (void)0 #else extern void Dbg_Action (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_NETWORK) #define Dbg_Network(fmt,...) (void)0 #else extern void Dbg_Network (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_SERVER) #define Dbg_Server(fmt,...) (void)0 #else extern void Dbg_Server (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_CLIENT) #define Dbg_Client(fmt,...) (void)0 #else extern void Dbg_Client (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_USER) #define Dbg_User(fmt,...) (void)0 #else extern void Dbg_User (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_LISTEN) #define Dbg_Listen(fmt,...) (void)0 #else extern void Dbg_Listen (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_STREAM) #define Dbg_Stream(fmt,...) (void)0 #else extern void Dbg_Stream (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_S2C) #define Dbg_S2C(fmt,...) (void)0 #else extern void Dbg_S2C (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_C2S) #define Dbg_C2S(fmt,...) (void)0 #else extern void Dbg_C2S (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_X2C) #define Dbg_X2C(fmt,...) (void)0 #else extern void Dbg_X2C (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_C2X) #define Dbg_C2X(fmt,...) (void)0 #else extern void Dbg_C2X (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_C2B) #define Dbg_C2B(fmt,...) (void)0 #else extern void Dbg_C2B (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_DGRAM) #define Dbg_Dgram(fmt,...) (void)0 #else extern void Dbg_Dgram (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_D2C) #define Dbg_D2C(fmt,...) (void)0 #else extern void Dbg_D2C (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_D2S) #define Dbg_D2S(fmt,...) (void)0 #else extern void Dbg_D2S (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_BROWSE) #define Dbg_Browse(fmt,...) (void)0 #else extern void Dbg_Browse (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_NEWGAME) #define Dbg_Newgame(fmt,...) (void)0 #else extern void Dbg_Newgame (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_REPLY) #define Dbg_Reply(fmt,...) (void)0 #else extern void Dbg_Reply (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_QUERY) #define Dbg_Query(fmt,...) (void)0 #else extern void Dbg_Query (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_CENTRAL) #define Dbg_Central(fmt,...) (void)0 #else extern void Dbg_Central (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_COMM) #define Dbg_Comm(fmt,...) (void)0 #else extern void Dbg_Comm (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_SOCKET) #define Dbg_Socket(fmt,...) (void)0 #else extern void Dbg_Socket (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_VERSION) #define Dbg_Version(fmt,...) (void)0 #else extern void Dbg_Version (const char *fmt, ...) DBGATTR; #endif #if defined(__GNUC__) && !defined(DEBUG_CHAT) #define Dbg_Chat(fmt,...) (void)0 #else extern void Dbg_Chat (const char *fmt, ...) DBGATTR; #endif #ifdef DEBUG_ALLOC extern void *Dbg_Malloc (const char *file, int line, size_t nBytes); extern void *Dbg_Calloc (const char *file, int line, size_t nElem, size_t sElem); extern void Dbg_Free (const char *file, int line, void *ptr); extern void Dbg_Vfree (const char *file, int line, void *ptr); extern void Dbg_FinishAlloc (void); #endif #endif /* * end of file alloc.h */ xblast-2.10.4/demo.c0000644000175000017500000001312710412220337013276 0ustar rhondaalfie/* * file demo.c - recording and playback of xblast games * * $Id: demo.c,v 1.8 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "xblast.h" /* * local variables */ static unsigned char buffer[GAME_TIME + 1][MAX_PLAYER]; static CFGDemoInfo cfgDemo; /* * initialize demo recording */ void DemoInitGame (CFGType cfgType, const CFGGame * cfgGame) { int i; CFGPlayer cfg; /* sanity check */ assert (NULL != cfgGame); /* remove old demo players form database */ for (i = 0; i < MAX_PLAYER; i++) { DeletePlayerConfig (CT_Demo, atomArrayPlayer0[i + 1]); } /* store current players */ for (i = 0; i < cfgGame->players.num; i++) { /* get player data, ignore failures */ (void)RetrievePlayer (cfgType, cfgGame->players.player[i], cfgGame->players.teamColor[i], &cfg); /* store it */ StorePlayer (CT_Demo, atomArrayPlayer0[i + 1], &cfg); } /* setup demo info */ cfgDemo.numPlayers = cfgGame->players.num; cfgDemo.numLives = cfgGame->setup.numLives; cfgDemo.randomPlayers = cfgGame->setup.randomPlayers; cfgDemo.frameRate = cfgGame->setup.frameRate; cfgDemo.numFrames = 0; cfgDemo.randomSeed = 0; cfgDemo.level = ATOM_INVALID; cfgDemo.time = 0; cfgDemo.winner = 0; /* draw */ } /* DemoInit */ /* * finish demo recordings */ void DemoFinishGame (void) { } /* DemoFinishGame */ /* * record single frame for demo */ void DemoRecordFrame (int gameTime, const PlayerAction * pa) { int i; /* sanity check */ assert (gameTime <= GAME_TIME); assert (pa != NULL); /* store in buffer */ for (i = 0; i < cfgDemo.numPlayers; i++) { buffer[gameTime][i] = PlayerActionToByte (pa + i); } } /* DemoRecordFrame */ /* * initialize level recording */ void DemoInitLevel (XBAtom level) { /* level data */ cfgDemo.randomSeed = (int)GetRandomSeed (); cfgDemo.level = level; cfgDemo.time = time (NULL); /* clear any old frames from database */ DeleteDemoFrames (); } /* DemoInitLevel */ /* * copy buffered keys to file */ static void StorePlayerActions (int gameTime) { int i, j; /* sanity check */ assert (gameTime <= GAME_TIME + 1); for (i = 0; i < gameTime; i++) { for (j = 0; j < cfgDemo.numPlayers; j++) { if (buffer[i][j] != 0) { StoreDemoFrame (i, cfgDemo.numPlayers, buffer[i]); break; } } } } /* StorePlayerActions */ /* * finish level recording */ void DemoFinishLevel (int gameTime, int winner, const char *type) { struct tm *tm; char tmp[256]; /* store buffered keys */ StorePlayerActions (gameTime); /* complete level info */ cfgDemo.numFrames = gameTime; cfgDemo.winner = winner; /* store level info */ StoreDemoConfig (&cfgDemo); /* create file name */ tm = localtime (&cfgDemo.time); assert (NULL != tm); sprintf (tmp, "%s_%04d_%02d_%02d_%02d%02d_%02d_%s", type, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, GUI_AtomToString (cfgDemo.level)); /* save it to disk */ SaveCurrentDemo (tmp); } /* DemoFinishLevel */ /* * get game config for demo playback */ XBBool DemoPlaybackConfig (CFGGame * cfgGame) { int i; /* sanity check */ assert (NULL != cfgGame); /* get demo config from database */ if (!RetrieveDemoConfig (&cfgDemo)) { return XBFalse; } /* clear game config */ memset (cfgGame, 0, sizeof (*cfgGame)); /* set game config */ cfgGame->setup.numLives = cfgDemo.numLives; cfgGame->setup.numWins = 0; cfgGame->setup.frameRate = cfgDemo.frameRate; cfgGame->setup.allLevels = XBFalse; cfgGame->setup.randomLevels = XBFalse; cfgGame->setup.randomPlayers = cfgDemo.randomPlayers; cfgGame->setup.recordDemo = XBFalse; /* set player configs */ cfgGame->players.num = cfgDemo.numPlayers; for (i = 0; i < cfgGame->players.num; i++) { cfgGame->players.player[i] = atomArrayPlayer0[i + 1]; cfgGame->players.control[i] = XBPC_None; cfgGame->players.host[i] = XBPH_Demo; cfgGame->players.team[i] = XBPT_None; cfgGame->players.teamColor[i] = COLOR_INVALID; } return XBTrue; } /* DemoPlaybackConfig */ /* * get level name of demo, set seed */ XBAtom DemoPlaybackLevel (void) { /* set random seed properly */ SeedRandom (cfgDemo.randomSeed); return cfgDemo.level; } /* DemoPlaybackLevel */ /* * load demo player actions into buffer */ XBBool DemoPlaybackStart (void) { /* clear buffer */ memset (buffer, 0, sizeof (buffer)); /* get frames data */ return RetrieveDemoFrames (cfgDemo.numPlayers, buffer); } /* DemoPlaybackStart */ /* * get single frame for playback */ XBBool DemoPlaybackFrame (int gameTime, PlayerAction * pa) { int i; assert (NULL != pa); assert (gameTime <= GAME_TIME); /* check for level end */ if (gameTime >= cfgDemo.numFrames) { return XBFalse; } /* load player actions from buffer */ for (i = 0; i < cfgDemo.numPlayers; i++) { PlayerActionFromByte (pa + i, buffer[gameTime][i]); } return XBTrue; } /* DemoPlaybackFrame */ /* * end of file demo.c */ xblast-2.10.4/demo.h0000644000175000017500000000325210372731123013306 0ustar rhondaalfie/* * file demo.h - recording and playback of xblast games * * $Id: demo.h,v 1.7 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _DEMO_H #define _DEMO_H /* * type definitions */ /* * global prototypes */ /* initialize recording */ extern void DemoInitGame (CFGType cfgType, const CFGGame * cfgGame); extern void DemoInitLevel (XBAtom level); /* game recording */ extern void DemoRecordFrame (int gameTime, const PlayerAction * pa); /* finish recording */ extern void DemoFinishLevel (int gameTime, int winner, const char *type); extern void DemoFinishGame (void); /* get game config for playback */ extern XBBool DemoPlaybackConfig (CFGGame *); /* get level name for playback */ extern XBAtom DemoPlaybackLevel (void); /* load actions for playback */ extern XBBool DemoPlaybackStart (void); /* get action for playback */ extern XBBool DemoPlaybackFrame (int gameTime, PlayerAction * pa); #endif /* * end of file demo.h */ xblast-2.10.4/depcomp0000755000175000017500000003710010370762703013573 0ustar rhondaalfie#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xblast-2.10.4/event.c0000644000175000017500000001104710372731123013477 0ustar rhondaalfie/* * file event.h - xblast event queue * * $Id: event.c,v 1.10 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define EVENT_QUEUE_SIZE 128 /* * local types */ typedef struct { XBEventCode code; XBEventData data; } XBEvent; /* * local variables */ static int eventPut = 0; static int eventGet = 0; static XBEvent eventQueue[EVENT_QUEUE_SIZE]; #ifdef DEBUG_XBEVENT /* * */ static const char * EventName (XBEventCode eCode) { switch (eCode) { case XBE_NONE: return "XBE_NONE"; case XBE_POLL: return "XBE_POLL"; case XBE_TIMER: return "XBE_TIMER"; case XBE_SOCKET_READ: return "XBE_SOCKET_READ"; case XBE_SOCKET_WRITE: return "XBE_SOCKET_WRITE"; case XBE_MENU: return "XBE_MENU"; case XBE_ASCII: return "XBE_ASCII"; case XBE_CTRL: return "XBE_CTRL"; case XBE_CHAT: return "XBE_CHAT"; case XBE_KEYSYM: return "XBE_KEYSYM"; case XBE_XBLAST: return "XBE_XBLAST"; case XBE_KEYB_1: return "XBE_KEYB_1"; case XBE_KEYB_2: return "XBE_KEYB_2"; case XBE_JOYST_1: return "XBE_JOYST_1"; case XBE_JOYST_2: return "XBE_JOYST_2"; case XBE_MOUSE_1: return "XBE_MOUSE_1"; case XBE_MOUSE_2: return "XBE_MOUSE_2"; case XBE_MOUSE_3: return "XBE_MOUSE_3"; case XBE_MOUSE_MOVE: return "XBE_MOUSE_MOVE"; case XBE_SERVER: return "XBE_SERVER"; default: return "XBE_?"; } } /* EventName */ #endif /* * Get next event from queue */ XBEventCode NextEvent (XBEventData * data) { XBEventCode ecode; if (eventPut == eventGet) { ecode = XBE_NONE; } else { ecode = eventQueue[eventGet].code; *data = eventQueue[eventGet].data; eventGet++; if (eventGet >= EVENT_QUEUE_SIZE) { eventGet = 0; } } #ifdef DEBUG_XBEVENT if (ecode != XBE_NONE && ecode != XBE_TIMER) Dbg_Out ("next event %s\n", EventName (ecode), data); #endif return ecode; } /* NextEvent */ /* * Put event in queue */ static XBBool QueueEvent (XBEventCode ecode, XBEventData data) { int newPut; newPut = eventPut + 1; if (newPut >= EVENT_QUEUE_SIZE) { newPut = 0; } if (newPut == eventGet) { /* queue overflow abort */ return XBFalse; } eventQueue[eventPut].code = ecode; eventQueue[eventPut].data = data; eventPut = newPut; /* that's all */ #ifdef DEBUG_XBEVENT if (ecode != XBE_NONE && ecode != XBE_TIMER) Dbg_Out ("queue event %s-%c\n", EventName (ecode), data); #endif return XBTrue; } /* QueueEvent */ /* * Queue Event with no argument */ XBBool QueueEventVoid (XBEventCode code) { XBEventData data; data.value = 0; return QueueEvent (code, data); } /* QueueEventVoid */ /* * Queue Event with integer argument */ XBBool QueueEventValue (XBEventCode code, int value) { XBEventData data; data.value = value; #ifdef DEBUG_XBEVENT if (code != XBE_NONE && code != XBE_TIMER) Dbg_Out ("queue event value %s %c,\n", EventName (code), data.value); #endif return QueueEvent (code, data); } /* QueueEventValue */ /* * Queue Event with integer argument */ XBBool QueueEventPointer (XBEventCode code, void *ptr) { XBEventData data; data.ptr = ptr; #ifdef DEBUG_XBEVENT if (code != XBE_NONE && code != XBE_TIMER) Dbg_Out ("queue event pointer %s %c,\n", EventName (code), data.value); #endif return QueueEvent (code, data); } /* QueueEventPointer */ /* * Queue Event with integer argument */ XBBool QueueEventPos (XBEventCode code, short x, short y) { XBEventData data; data.pos.x = x; data.pos.y = y; return QueueEvent (code, data); } /* QueueEventValue */ /* * Queue Event with integer argument */ XBBool QueueEventAtom (XBEventCode code, XBAtom atom) { XBEventData data; data.atom = atom; #ifdef DEBUG_XBEVENT if (code != XBE_NONE && code != XBE_TIMER) Dbg_Out ("queue event atom %s %c,\n", EventName (code), data.value); #endif return QueueEvent (code, data); } /* QueueEventValue */ xblast-2.10.4/event.h0000644000175000017500000001301210372731123013476 0ustar rhondaalfie/* * file event.h - xblast event queue * * $Id: event.h,v 1.14 2006/02/09 21:21:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_EVENT_H #define XBLAST_EVENT_H /* * atoms for faster and secure string handling */ typedef int XBAtom; /* value for invalid atom */ #define ATOM_INVALID 0 /* * types of events xblast knows */ typedef enum { XBE_NONE, /* no event */ XBE_TIMER, /* timer event */ XBE_POLL, /* it was undefined... */ XBE_SOCKET_READ, /* socket has become readable */ XBE_SOCKET_WRITE, /* socket has become writable */ XBE_MENU, /* menu key was pressed */ XBE_ASCII, /* ASCII character has been entered */ XBE_CTRL, /* Control character has been entered */ XBE_CHAT, /* Chat key has been entered */ XBE_KEYSYM, /* Key with given name has been pressed */ XBE_XBLAST, /* Special game has been pressed (exit/pause) */ XBE_KEYB_1, /* XBlast game key from keyboard 1 has been pressed/released */ XBE_KEYB_2, /* XBlast game key from keyboard 2 has been pressed/released */ XBE_JOYST_1, /* XBlast game key from joystick 1 has been pressed/released */ XBE_JOYST_2, /* XBlast game key from joystick 2 has been pressed/released */ XBE_JOYST_3, /* XBlast game key from joystick 3 has been pressed/released */ XBE_JOYST_4, /* XBlast game key from joystick 4 has been pressed/released */ XBE_MOUSE_1, /* Mouse Button 1 has been pressed */ XBE_MOUSE_2, /* Mouse Button 2 has been pressed */ XBE_MOUSE_3, /* Mouse Button 3 has been pressed */ XBE_RMOUSE_1, /* Mouse Button 1 has been released */ XBE_RMOUSE_2, /* Mouse Button 2 has been released */ XBE_RMOUSE_3, /* Mouse Button 3 has been released */ XBE_MOUSE_MOVE, /* Mouse has been moved */ XBE_SERVER, /* server has send data for next frame */ NUM_XBE } XBEventCode; /* * menu key events */ typedef enum { XBMK_NONE, /* nothing */ XBMK_PREV, /* goto to previous field */ XBMK_NEXT, /* goto to next field */ XBMK_LEFT, /* goto left field */ XBMK_RIGHT, /* goto right field */ XBMK_UP, /* goto upper field */ XBMK_DOWN, /* goto lower field */ XBMK_SELECT, /* select current field */ XBMK_DEFAULT, /* select default button */ XBMK_ABORT, /* abort current menu */ NUM_XBMENUKEY } XBMenuKey; /* * control key events */ typedef enum { XBCK_NONE, /* nothing */ XBCK_RETURN, /* return key or similar */ XBCK_ESCAPE, /* escape key or similar */ XBCK_BACKSPACE, /* backspace key or similar */ XBCK_INSERT, /* INSERT key or similar */ XBCK_END, /* END key or similar */ XBCK_DELETE, /* DELETE key or similar */ XBCK_HOME, /* HOME key or similar */ } XBCtrlKey; typedef enum { XBXK_NONE, XBXK_EXIT /* leave game immediately */ } XBXBlastKey; /* * game key events */ typedef enum { XBGK_NONE, /* nothing */ XBGK_GO_UP, /* start moving upwards */ XBGK_GO_LEFT, /* start moving left */ XBGK_GO_DOWN, /* start moving downwards */ XBGK_GO_RIGHT, /* start moving right */ XBGK_STOP_UP, /* stop moving upwards (when not using stop key) */ XBGK_STOP_LEFT, /* stop moving left (when not using stop key) */ XBGK_STOP_DOWN, /* stop moving downwards (when not using stop key) */ XBGK_STOP_RIGHT, /* stop moving right (when not using stop key) */ XBGK_STOP_ALL, /* stop moving (only when using sttop key) */ XBGK_BOMB, /* drop a bomb */ XBGK_SPECIAL, /* activate special extra */ XBGK_PAUSE, /* activate game pause */ XBGK_ABORT, /* activate abort */ XBGK_ABORT_CANCEL, /* cancel abort */ /* Skywalker */ XBGK_LAOLA, /* activate laola */ XBGK_LOOSER, /* activate looser */ XBGK_BOT, /* activate looser */ NUM_XBGK /* */ } XBGameKey; /* * chat key events */ typedef enum { XBCE_NONE, /* no chat event */ XBCE_START, /* start chatting */ XBCE_SEND, /* send line */ XBCE_CANCEL, /* cancel line */ XBCE_CHANGE, /* change target */ XBCE_BACK, /* backspace a character */ XBCE_ESCAPE, /* escape pressed in chat */ XBCE_ENTER, /* enter pressed in chat */ NUM_XBCE } XBChatEvent; /* * server events */ typedef enum { XBSE_FINISH = -2, /* finish level */ XBSE_ERROR = -1, /* error in communication */ XBSE_NONE /* nothing */ } XBServerEvent; /* * additional data for events */ typedef union { int value; void *ptr; XBAtom atom; struct { short x; short y; } pos; } XBEventData; /* * global prototypes */ extern XBEventCode NextEvent (XBEventData * data); extern XBBool QueueEventVoid (XBEventCode code); extern XBBool QueueEventValue (XBEventCode code, int value); extern XBBool QueueEventPointer (XBEventCode code, void *ptr); extern XBBool QueueEventPos (XBEventCode code, short x, short y); extern XBBool QueueEventAtom (XBEventCode code, XBAtom atom); #endif /* * end of file event.h */ xblast-2.10.4/func.c0000644000175000017500000005301210412600063013300 0ustar rhondaalfie/* * func.c - function pointers for special extras * * $Id: func.c,v 1.22 2006/03/29 21:46:27 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * global variables */ void (*specialExtraFunc) (BMPlayer *); void (*specialKeyFunc) (BMPlayer *); /* * local types */ typedef void (*SpecialExtraFunc) (BMPlayer *); typedef void (*SpecialKeyFunc) (BMPlayer *); static char *seVoidName = N_("No Special Extra"); static char *skVoidName = N_("No Special Key"); /* * void functions */ void SpecialExtraVoid (BMPlayer * ps) { } void SpecialKeyVoid (BMPlayer * ps) { } /* * Invincible */ static void SpecialExtraInvincible (BMPlayer * ps) { SND_Play (SND_INVINC, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->illtime = 0; ps->illness = ps->health; ps->invincible += EXTRA_INVINCIBLE; } /* SpecialExtraInvincible */ /* * Kicking */ static void SpecialExtraKick (BMPlayer * ps) { SND_Play (SND_NEWKICK, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->kick = XBTrue; } /* SpecialExtraKick */ /* * Remote Control */ static void SpecialExtraRC (BMPlayer * ps) { SND_Play (SND_NEWRC, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->remote_control = XBTrue; } /* SpecialExtraRC */ static void SpecialKeyRC (BMPlayer * ps) { if (ps->remote_control > 0) { if (IgnitePlayersBombs (ps)) { SND_Play (SND_SHOOT, ps->x / (PIXW / MAX_SOUND_POSITION)); } } } /* SpecialKeyRC */ /* * bombs choice extra */ static void SpecialExtraChoice (BMPlayer * ps) { char tutu[40]; if (ps->choice_bomb_type == NUM_BMT) { int i; for (i = ChoiceDefaultBomb; bomb_name_choice[i] == NULL; i = ((i + 1) % NUM_BMT)) ; ps->choice_bomb_type = i; if (ps->local) { sprintf (tutu, "%s : ", p_string[ps->id].name); strcat (tutu, bomb_name_choice[(ps->choice_bomb_type)]); SetMessage (tutu, XBTrue); } } } static void SpecialKeyChoice (BMPlayer * ps) { if (ps->choice_bomb_type != NUM_BMT) { char tutu[40]; int i; i = ps->choice_bomb_type; for (i = ((i + 1) % NUM_BMT); bomb_name_choice[i] == NULL; i = ((i + 1) % NUM_BMT)) ; ps->choice_bomb_type = i; if (ps->local) { sprintf (tutu, "%s : ", p_string[ps->id].name); strcat (tutu, bomb_name_choice[(ps->choice_bomb_type)]); SetMessage (tutu, XBTrue); } } } /* Written by VVL */ static void SpecialKeyThrough (BMPlayer * ps) { if ((ps->throughCount > 0) && (ps->lives > 0)) { if (ps->through) { ps->through = 0; } else { ps->through = EXTRA_THROUGH_TIME; ps->throughCount--; } } } /**/ /* Walk through bomb Mode */ /**/ static void SpecialExtraThrough (BMPlayer * ps) { ps->throughCount += 1; } /* * Teleport */ static void SpecialExtraTeleport (BMPlayer * ps) { SND_Play (SND_NEWTELE, ps->x / (PIXW / MAX_SOUND_POSITION)); if (ps->teleport == 0) { ps->teleport = 1; } } /* SpecialExtraTeleport */ static void SpecialKeyTeleport (BMPlayer * ps) { if (ps->teleport == 1) { ps->teleport = TELEPORT_TIME; } } /* SpecialKeyTeleport */ /* * Frogger extra (galatius(skywalker)) */ static void SpecialExtraFrogger (BMPlayer * ps) { // SND_Play (SND_NEWTELE, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->frogger++; } /* SpecialExtraFrogger */ static void SpecialKeyFrogger (BMPlayer * ps) { if ((ps->lives > 0) && (ps->frogger) && (!ps->dying)) { /* do_bell(); */ DoFrog (ps); } } /* SpecialKeyFrogger */ /* * Daleif Illness (galatius(skywalker)) * Note that picking up this extra gets you *rid* of the daleif illness * */ static void SpecialExtraDaleif (BMPlayer * ps) { ps->daleif = 0; } /* SpecialExtraDalif */ /* * Extra Ignite All */ static void SpecialExtraIgniteAll (BMPlayer * ps) { SND_Play (SND_BUTT, ps->x / (PIXW / MAX_SOUND_POSITION)); IgniteAllBombs (ps); } /* SpecialExtraIgniteAll */ static void SpecialKeySpecialBomb (BMPlayer * ps) { DropBomb (ps, BMTspecial); } /* SpecialKeySpecialBomb */ static void SpecialExtraSpecialBomb (BMPlayer * ps) { SND_Play (SND_SPBOMB, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->special_bombs += 3; } /* SpecialextraSpecialBomb */ /* * Junkie (Garth again) */ void SpecialExtraJunkie (BMPlayer * ps) { SND_Play (SND_INJ, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->junkie = MAX_JUNKIE_TIME; } /* SpecialExtraJunkie */ /* * Air Pump (Garth Denley) */ static void SpecialExtraAir (BMPlayer * ps) { SND_Play (SND_NEWPUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->air_button = XBTrue; } /* SpecialExtraAir */ static void SpecialKeyAir (BMPlayer * ps) { if ((ps->air_button > 0) && (ps->lives > 0)) { SND_Play (SND_PUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); DoAir (ps); } } /* SpecialKeyAir */ /* * Sucker (Stephan Natschlaeger) */ static void SpecialExtraSuck (BMPlayer * ps) { SND_Play (SND_NEWPUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->suck_button = XBTrue; } /* SpecialExtraSuck */ /* * Ghost (Belgium Guys) */ void SpecialExtraGhost (BMPlayer * ps) { SND_Play (SND_NEWPUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->ghost = EXTRA_GHOST_TIME; } /* SpecialExtraGhost */ static void SpecialKeySuck (BMPlayer * ps) { if ((ps->suck_button > 0) && (ps->lives > 0)) { SND_Play (SND_PUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); DoSuck (ps); } } /* SpecialKeySuck */ /* * poison extra */ void SpecialExtraPoison (BMPlayer * ps) { if (!ps->invincible) { ps->dying = DEAD_TIME; } } /* SpecialExtraPoison */ /* * spinner extra (long stunned ) */ static void SpecialExtraLongStunned (BMPlayer * ps) { SND_Play (SND_STUN, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->stunned = STUN_TIME * 4; } /* SpecialExtraLongStunned */ /* * speed extra */ static void SpecialExtraSpeed (BMPlayer * ps) { SND_Play (SND_FAST, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->illness = IllRun; ps->health = IllRun; ps->illtime = 0; } /* SpecialExtraSpeed */ /* * speed extra */ static void SpecialExtraSpeed2 (BMPlayer * ps) { SND_Play (SND_FAST, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->illness = IllRun; ps->health = IllRun; ps->illtime = 0; ps->speed++; } /* SpecialExtraSpeed */ /* * slow extra */ void SpecialExtraSlow (BMPlayer * ps) { SND_Play (SND_SLOW, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->illness = IllSlow; ps->health = IllSlow; ps->illtime = 0; } /* SpecialExtraSlow */ /* * mayhem extra */ static void SpecialExtraMayhem (BMPlayer * ps) { SND_Play (SND_SLAY, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->kick = XBTrue; ps->illness = IllRun; ps->health = IllRun; ps->illtime = 0; } /* SpecialExtraMayhem */ /* * holy grail extra */ static void SpecialExtraHolyGrail (BMPlayer * ps) { SND_Play (SND_HOLY, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->lives += KillOtherPlayers (ps->team); if (ps->lives > 9) { ps->lives = 9; } ps->invincible = NEW_INVINCIBLE; ps->dying = DEAD_TIME; } /* SpecialExtraHolyGrail */ /* Added by "Belgium Guys" */ /* steal extra */ /**/ static void SpecialExtraSteal (BMPlayer * ps) { ps->bombs += StealBombsOtherPlayers (ps->team); ps->range += StealRangeOtherPlayers (ps->team); } /* * multiple extra */ static void SpecialExtraLife (BMPlayer * ps) { SND_Play (SND_LIFE, ps->x / (PIXW / MAX_SOUND_POSITION)); if (ps->lives < 9) { ps->lives++; } } /* SpecialExtraLife */ /* * multiple extra */ static void SpecialExtraMultiple (BMPlayer * ps) { switch (GameRandomNumber (11)) { case 0: case 1: SpecialExtraSpeed (ps); break; case 2: case 3: SpecialExtraPoison (ps); break; case 4: case 5: SpecialExtraInvincible (ps); break; case 6: case 7: SpecialExtraLongStunned (ps); break; case 8: case 9: SpecialExtraAir (ps); break; case 10: SpecialExtraLife (ps); break; } } /* SpecialExtraMultiple */ /*Skywalker epfl */ /* Written by VVL */ /* Electrify */ static void SpecialExtraElectrify (BMPlayer * ps) { ps->electrify = EXTRA_ELECTRIFY_COUNT; } static void SpecialKeyElectrify (BMPlayer * ps) { if ((ps->lives > 0) && (ps->electrify)) { if (ElectrifyOtherPlayers (ps->id)) { /* Success ... another player is hit! :-) */ ps->electrify = 0; } else { /* Failure ... just try again! :-( */ ps->electrify--; } } } static void SpecialExtraFarter (BMPlayer * ps) { ps->farter = 1; } static void SpecialKeyFarter (BMPlayer * ps) { if (ps != NULL) { if ((ps->lives > 0) && (ps->farter)) { /* do_bell(); */ FartOnOtherPlayers (ps); } } } /* Fart on players and bombs (galatius) */ static void SpecialExtraBfarter (BMPlayer * ps) { if (ps != NULL) { ps->bfarter = 1; } } /* Fart on players and bombs (galatius) */ static void SpecialKeyBfarter (BMPlayer * ps) { if ((ps->lives > 0) && (ps->bfarter) && ps != NULL) { /* do_bell(); */ FartOnOtherPlayers (ps); DoAir (ps); } } static void SpecialExtraSwapColor (BMPlayer * ps) { SwapColorOtherPlayers (ps->team); } static void SpecialExtraSwapPosition (BMPlayer * ps) { SwapPositionOtherPlayers (ps->team); } /* */ /* * cloaking device */ static void SpecialExtraCloak (BMPlayer * ps) { int w = 1; if (ps->cloaking < 0) { ps->cloaking *= -1; w = -1; } ps->cloaking += 2 * EXTRA_INVINCIBLE; ps->cloaking *= w; SND_Play (SND_NEWCLOAK, ps->x / (PIXW / MAX_SOUND_POSITION)); } /* SpecialExtraCloak */ static void SpecialKeyCloak (BMPlayer * ps) { ps->cloaking *= -1; if (ps->cloaking > 0) { SND_Play (SND_DECLOAK, ps->x / (PIXW / MAX_SOUND_POSITION)); } else if (ps->cloaking < 0) { SND_Play (SND_ENCLOAK, ps->x / (PIXW / MAX_SOUND_POSITION)); } } /* SpecialKeyCloak */ /* * pow extra (stun others) */ void SpecialExtraStunOthers (BMPlayer * ps) { StunOtherPlayers (ps->team, STUN_TIME * 4); } /* * morphing extra (player becomes a bomb) */ static void SpecialExtraMorph (BMPlayer * ps) { ps->num_morph++; } static void SpecialKeyMorph (BMPlayer * ps) { if ((0 < ps->num_morph) && (0 < ps->bombs) && (!ps->morphed)) { #ifdef DEBUG fprintf (stderr, "Player %d morphs", ps->id); #endif ps->morphed = 1; DropBomb (ps, BMTdefault); } } /* SpecialKeyMorph */ static void SpecialExtraStop (BMPlayer * ps) { ps->stop = XBTrue; } static void SpecialKeyStop (BMPlayer * ps) { if (ps->stop > 0) { StopPlayersBombs (ps); } } /* Written by Amilhastre */ static void SpecialExtraEvilGrail (BMPlayer * ps) { ps->evilill = ILLDEATHTIME; } /* phantom extra */ /* Written by Amilhastre */ static void SpecialExtraPhantom (BMPlayer * ps) { if (!ps->phantom) ps->phantom = 3 * EXTRA_INVISIBLE; else ps->phantom += EXTRA_INVISIBLE; } /* revive extra */ /* Written by Amilhastre */ static void SpecialExtraRevive (BMPlayer * ps) { ps->revive++; } /* ** Skywalker ** * sniping extra (player moves the bomb) */ static void SpecialExtraSnipe (BMPlayer * ps) { ps->num_snipe++; } static void SpecialKeySnipe (BMPlayer * ps) { if ((0 < ps->num_snipe) && (0 < ps->bombs) && (ps->sniping == 0)) { ps->sniping = 2; DropBomb (ps, BMTdefault); ps->sniping = 1; } else { if (ps->sniping == 1) { if (IgnitePlayersBombs (ps)) { ps->sniping = 1; ps->d_soll = GoStop; } } } } /* SpecialKeySnipe */ /* EPFL */ static void SpecialExtraJump (BMPlayer * ps) { SND_Play (SND_NEWPUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->jump_button += 1; } static void SpecialKeyJump (BMPlayer * ps) { if ((ps->jump_button > 0) && (ps->lives > 0)) { SND_Play (SND_PUMP, ps->x / (PIXW / MAX_SOUND_POSITION)); DoJump (ps); } } /* END EPFL */ /* * conversion tables */ /* extra pickup functions */ static DBToData extraTable[] = { {"air", (void *)SpecialExtraAir}, {"bfarter", (void *)SpecialExtraBfarter}, /* skywalker */ {"choicebombtype", (void *)SpecialExtraChoice}, /* skywalker */ {"cloak", (void *)SpecialExtraCloak}, {"daleif", (void *)SpecialExtraDaleif}, {"electrify", (void *)SpecialExtraElectrify}, {"evilgrail", (void *)SpecialExtraEvilGrail}, {"farter", (void *)SpecialExtraFarter}, /* skywalker */ {"frogger", (void *)SpecialExtraFrogger}, /* skywalker */ {"ghost", (void *)SpecialExtraGhost}, /* skywalker */ {"holyGrail", (void *)SpecialExtraHolyGrail}, {"igniteAll", (void *)SpecialExtraIgniteAll}, {"invincible", (void *)SpecialExtraInvincible}, {"jump", (void *)SpecialExtraJump}, /* skywalker */ {"junkie", (void *)SpecialExtraJunkie}, {"kick", (void *)SpecialExtraKick}, {"life", (void *)SpecialExtraLife}, {"longStunned", (void *)SpecialExtraLongStunned}, {"mayhem", (void *)SpecialExtraMayhem}, {"morph", (void *)SpecialExtraMorph}, {"multiple", (void *)SpecialExtraMultiple}, {"phantom", (void *)SpecialExtraPhantom}, {"poison", (void *)SpecialExtraPoison}, {"rc", (void *)SpecialExtraRC}, {"revive", (void *)SpecialExtraRevive}, {"slow", (void *)SpecialExtraSlow}, {"snipe", (void *)SpecialExtraSnipe}, /* skywalker */ {"specialBomb", (void *)SpecialExtraSpecialBomb}, {"speed", (void *)SpecialExtraSpeed}, {"speed2", (void *)SpecialExtraSpeed2}, {"steal", (void *)SpecialExtraSteal}, {"stop", (void *)SpecialExtraStop}, {"stunOthers", (void *)SpecialExtraStunOthers}, {"sucker", (void *)SpecialExtraSuck}, {"swapcolor", (void *)SpecialExtraSwapColor}, /* skywalker */ {"swapposition", (void *)SpecialExtraSwapPosition}, /* skywalker */ {"teleport", (void *)SpecialExtraTeleport}, {"through", (void *)SpecialExtraThrough}, {"void", (void *)SpecialExtraVoid}, {NULL, NULL} }; /* extra key functions */ static DBToData keyTable[] = { {"air", (void *)SpecialKeyAir}, {"bfarter", (void *)SpecialKeyBfarter}, {"choicebombtype", (void *)SpecialKeyChoice}, /* skywalker */ {"cloak", (void *)SpecialKeyCloak}, {"electrify", (void *)SpecialKeyElectrify}, {"farter", (void *)SpecialKeyFarter}, /* skywalker */ {"frogger", (void *)SpecialKeyFrogger}, /* skywalker */ {"jump", (void *)SpecialKeyJump}, /* skywalker */ {"morph", (void *)SpecialKeyMorph}, {"rc", (void *)SpecialKeyRC}, {"snipe", (void *)SpecialKeySnipe}, /* skywalker */ {"specialBomb", (void *)SpecialKeySpecialBomb}, {"stop", (void *)SpecialKeyStop}, {"sucker", (void *)SpecialKeySuck}, {"teleport", (void *)SpecialKeyTeleport}, {"through", (void *)SpecialKeyThrough}, {"void", (void *)SpecialKeyVoid}, {NULL, NULL} }; /* * parse func section of level data */ XBBool ParseLevelFunc (const DBSection * section, DBSection * warn) { void *ptr; /* check if section exists */ if (NULL == section) { Dbg_Out ("LEVEL: func section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* Extra has default */ switch (DB_ConvertEntryData (section, atomExtra, &ptr, extraTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomExtra)); specialExtraFunc = SpecialExtraVoid; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomExtra)); specialExtraFunc = SpecialExtraVoid; DB_CreateEntryString (warn, atomExtra, DB_DataToString (extraTable, specialExtraFunc)); break; default: assert (ptr != NULL); specialExtraFunc = (SpecialExtraFunc) ptr; break; } /* check for swap extras, buggy for < 2.10.2 */ if (!Version_AtLeast (VERSION_JOINT, &Ver_2_10_2)) { if (specialExtraFunc == SpecialExtraSwapColor) { /* add warning and reject level */ DB_CreateEntryString (warn, atomExtra, DB_DataToString (extraTable, specialExtraFunc)); return XBFalse; } } /* Key has default */ switch (DB_ConvertEntryData (section, atomKey, &ptr, keyTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomKey)); specialKeyFunc = SpecialKeyVoid; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomKey)); specialKeyFunc = SpecialKeyVoid; DB_CreateEntryString (warn, atomExtra, DB_DataToString (keyTable, specialKeyFunc)); break; default: assert (ptr != NULL); specialKeyFunc = (SpecialKeyFunc) ptr; break; } return XBTrue; } /* * config section [FUNC] */ void ConfigLevelFunc (const DBSection * section) { /* set extra info */ if (specialExtraFunc == SpecialExtraAir) { AddExtraInfo (N_("Airpump as an extra")); } else if (specialExtraFunc == SpecialExtraBfarter) { /* skywalker */ AddExtraInfo (N_("Bfarter as an extra")); } else if (specialExtraFunc == SpecialExtraChoice) { /* skywalker */ AddExtraInfo (N_("Choice as an extra")); } else if (specialExtraFunc == SpecialExtraCloak) { AddExtraInfo (N_("Cloak as an extra")); } else if (specialExtraFunc == SpecialExtraDaleif) { AddExtraInfo (N_("Daleif as an extra")); } else if (specialExtraFunc == SpecialExtraElectrify) { AddExtraInfo (N_("Electrify as an extra")); } else if (specialExtraFunc == SpecialExtraFarter) { /* skywalker */ AddExtraInfo (N_("Farter as an extra")); } else if (specialExtraFunc == SpecialExtraFrogger) { /* skywalker */ AddExtraInfo (N_("Frogger as an extra")); } else if (specialExtraFunc == SpecialExtraGhost) { /* skywalker */ AddExtraInfo (N_("Ghost as an extra")); } else if (specialExtraFunc == SpecialExtraHolyGrail) { AddExtraInfo (N_("The Holy Grail as an extra")); } else if (specialExtraFunc == SpecialExtraIgniteAll) { AddExtraInfo (N_("Button as an extra")); } else if (specialExtraFunc == SpecialExtraInvincible) { AddExtraInfo (N_("Invincibility as an extra")); } else if (specialExtraFunc == SpecialExtraJump) { AddExtraInfo (N_("Jump as an extra")); } else if (specialExtraFunc == SpecialExtraJunkie) { AddExtraInfo (N_("Junkie virus as an extra")); } else if (specialExtraFunc == SpecialExtraKick) { AddExtraInfo (N_("Kick as an extra")); } else if (specialExtraFunc == SpecialExtraLife) { AddExtraInfo (N_("Free life as an extra")); } else if (specialExtraFunc == SpecialExtraLongStunned) { AddExtraInfo (N_("Spinner as an extra")); } else if (specialExtraFunc == SpecialExtraMayhem) { AddExtraInfo (N_("Mayhem (Kick & Run) as an extra")); } else if (specialExtraFunc == SpecialExtraMorph) { AddExtraInfo (N_("Morphing as an extra")); } else if (specialExtraFunc == SpecialExtraMultiple) { AddExtraInfo (N_("Random special extra")); } else if (specialExtraFunc == SpecialExtraPhantom) { AddExtraInfo (N_("Phantom as an extra")); } else if (specialExtraFunc == SpecialExtraPoison) { AddExtraInfo (N_("Poison as an extra")); } else if (specialExtraFunc == SpecialExtraRC) { AddExtraInfo (N_("Remote control as an extra")); } else if (specialExtraFunc == SpecialExtraRevive) { AddExtraInfo (N_("Revive control as an extra")); } else if (specialExtraFunc == SpecialExtraSnipe) { /* skywalker */ AddExtraInfo (N_("Snipe as an extra")); } else if (specialExtraFunc == SpecialExtraStop) { /* skywalker */ AddExtraInfo (N_("Stop as an extra")); } else if (specialExtraFunc == SpecialExtraSuck) { /* skywalker */ AddExtraInfo (N_("Sucker as an extra")); } else if (specialExtraFunc == SpecialExtraSwapColor) { /* skywalker */ AddExtraInfo (N_("Swapcolor as an extra")); } else if (specialExtraFunc == SpecialExtraSwapPosition) { /* skywalker */ AddExtraInfo (N_("Swapposition as an extra")); } else if (specialExtraFunc == SpecialExtraSlow) { AddExtraInfo (N_("Slowdown as an extra")); } else if (specialExtraFunc == SpecialExtraSpeed) { AddExtraInfo (N_("Speed as an extra")); } else if (specialExtraFunc == SpecialExtraSpeed2) { AddExtraInfo (N_("SpeedII as an extra")); } else if (specialExtraFunc == SpecialExtraStop) { AddExtraInfo (N_("Stop as an extra")); } else if (specialExtraFunc == SpecialExtraStunOthers) { AddExtraInfo (N_("Stunner as an extra")); } else if (specialExtraFunc == SpecialExtraTeleport) { AddExtraInfo (N_("Teleporter as an extra")); } else if (specialExtraFunc == SpecialExtraThrough) { AddExtraInfo (N_("Through as an extra")); } } /* ConfigLevelFunc */ /* * */ XBBool HasSpecialBombs (void) { return (specialExtraFunc == SpecialExtraSpecialBomb); } /* HasSpecialBombs */ /* * return the name of the extra type */ const char * GetExtraNameFunc (void *type) { int i; if (type == SpecialExtraVoid) return seVoidName; for (i = 0; extraTable[i].value != NULL; ++i) if (extraTable[i].value == type) return extraTable[i].key; return seVoidName; } const char * GetExtraNameInt (int type) { int i; for (i = 0; extraTable[i].value != NULL; ++i) if (i == type) return extraTable[i].key; return seVoidName; } /* * return the name of the key type */ const char * GetKeyNameFunc (void *type) { int i; if (type == SpecialKeyVoid) return skVoidName; for (i = 0; keyTable[i].value != NULL; ++i) if (keyTable[i].value == type) return keyTable[i].key; return skVoidName; } const char * GetKeyNameInt (int type) { int i; for (i = 0; keyTable[i].value != NULL; ++i) if (i == type) return keyTable[i].key; return skVoidName; } /* * return the number of the key type */ int GetNumberOfKeys (void) { int i; for (i = 0; keyTable[i].value != NULL; ++i) ; return i; } /* * return the number of the extra type */ int GetNumberOfExtras (void) { int i; for (i = 0; extraTable[i].value != NULL; ++i) ; return i; } /* * end of file func.c */ xblast-2.10.4/func.h0000644000175000017500000000351110372731124013314 0ustar rhondaalfie/* * func.h - special ingame function (pointers) * * $Id: func.h,v 1.9 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_FUNC_H #define XBLAST_FUNC_H /* * global variables */ extern void (*specialExtraFunc) (BMPlayer *); extern void (*specialKeyFunc) (BMPlayer *); /* * prototypes */ extern void SpecialExtraJunkie (BMPlayer * ps); extern void SpecialExtraSlow (BMPlayer * ps); extern void SpecialExtraStunOthers (BMPlayer * ps); extern void SpecialExtraPoison (BMPlayer * ps); extern void SpecialExtraGhost (BMPlayer * ps); extern XBBool ParseLevelFunc (const DBSection * section, DBSection *); extern void ConfigLevelFunc (const DBSection * section); extern XBBool HasSpecialBombs (void); extern const char *GetKeyNameFunc (void *type); extern const char *GetExtraNameFunc (void *type); extern const char *GetKeyNameInt (int type); extern const char *GetExtraNameInt (int type); extern int GetNumberOfKeys (void); extern int GetNumberOfExtras (void); extern void SpecialExtraVoid (BMPlayer * ps); extern void SpecialKeyVoid (BMPlayer * ps); #endif /* * end of file func.h */ xblast-2.10.4/game.c0000644000175000017500000004604710443516537013310 0ustar rhondaalfie/* * file game.c - play the game * * $Id: game.c,v 1.42 2006/06/13 11:11:27 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ /* player input */ static PlayerAction *actionTable[NUM_XBE]; static XBBool useStopKey[NUM_XBE]; static BMPlayer *localPlayer[NUM_XBE]; static int turnX[MAX_PLAYER]; static int turnY[MAX_PLAYER]; static int numOfPlayers; /* sounds to play */ static SND_Id levelSounds[] = { SND_BAD, SND_DROP, SND_NEWBOMB, SND_NEWKICK, SND_NEWPUMP, SND_NEWRC, SND_MOREFIRE, SND_DEAD, SND_EXPL, SND_KICK, SND_PUMP, SND_OUCH, SND_BUTT, SND_SHOOT, SND_INVIS, SND_INVINC, SND_NEWTELE, SND_TELE, SND_INJ, SND_MINIBOMB, SND_HAUNT, SND_SPIRAL, SND_SPBOMB, SND_SLIDE, SND_STUN, SND_WARN, SND_COMPOUND, SND_TELE1, SND_TELE2, SND_HOLY, SND_ENCLOAK, SND_DECLOAK, SND_FAST, SND_SLOW, SND_SLAY, SND_LIFE, SND_NEWCLOAK, SND_BOMBMORPH, SND_APPL, SND_APPL2, SND_WON, SND_STEP1, SND_STEP2, SND_STEP3, SND_STEP4, SND_STEP5, SND_STEP6, SND_MAX }; /* * init ingame sound */ static void InitSounds (void) { SND_Id *pSnd; for (pSnd = levelSounds; *pSnd != SND_MAX; pSnd++) { SND_Load (*pSnd); } } /* InitSounds */ /* * finish ingame sound */ static void FinishSounds (void) { SND_Id *pSnd; for (pSnd = levelSounds; *pSnd != SND_MAX; pSnd++) { SND_Stop (*pSnd); SND_Unload (*pSnd); } } /* FinishSounds */ /* * init player input (keybord and joystick) */ static void InitPlayerInput (XBPlayerHost hostType, const CFGGamePlayers * gamePlayers, const CFGPlayer * cfgPlayer, PlayerAction * playerAction) { int i; XBEventCode code; XBBool stopkey; assert (NULL != gamePlayers); assert (NULL != cfgPlayer); /* clear data */ memset (actionTable, 0, sizeof (actionTable)); memset (useStopKey, 0, sizeof (useStopKey)); memset (localPlayer, 0, sizeof (localPlayer)); /* set controls for each player */ for (i = 0; i < gamePlayers->num; i++) { assert (ATOM_INVALID != gamePlayers->player[i]); /* local player? */ if (hostType == gamePlayers->host[i]) { /* default stopkey value, joysticks override */ stopkey = cfgPlayer[i].misc.useStopKey; /* assign event codes for local */ switch (gamePlayers->control[i]) { case XBPC_RightKeyboard: code = XBE_KEYB_1; break; case XBPC_LeftKeyboard: code = XBE_KEYB_2; break; case XBPC_Joystick1: code = XBE_JOYST_1; stopkey = XBTrue; break; case XBPC_Joystick2: code = XBE_JOYST_2; stopkey = XBTrue; break; default: fprintf (stderr, "player %u (local) with unsupported control %u\n", i, gamePlayers->control[i]); code = XBE_NONE; break; } /* set values, if event code was assigned */ if (code != XBE_NONE) { actionTable[code] = &playerAction[i]; useStopKey[code] = stopkey; localPlayer[code] = player_stat + i; } } /* assign turn step values for all players */ turnX[i] = cfgPlayer[i].misc.turnStepKeyboard * BASE_X; turnY[i] = cfgPlayer[i].misc.turnStepKeyboard * BASE_Y; } } /* InitPlayerInput */ /* * clear player action data */ void ClearPlayerAction (PlayerAction * playerAction) { int player; for (player = 0; player < MAX_PLAYER; player++) { playerAction[player].player = player; playerAction[player].dir = GoDefault; playerAction[player].bomb = XBFalse; playerAction[player].special = XBFalse; playerAction[player].pause = XBFalse; playerAction[player].suicide = XBFalse; playerAction[player].abort = ABORT_NONE; playerAction[player].laola = XBFalse; playerAction[player].looser = XBFalse; playerAction[player].bot = XBFalse; } } /* ClearPlayerAction */ /* * update game display */ void GameUpdateWindow (void) { /* update sound */ SND_Flush (); /* shuffle sprites and mark them */ ShuffleAllSprites (); /* set rectangles to be redrawn */ SetRedrawRectangles (); /* shuffle sprites and mark them */ MarkAllSprites (); /* update maze pixmap */ UpdateMaze (); /* draw sprites into pixmap */ DrawAllSprites (); /* update window from pixmap */ GUI_FlushPixmap (XBTrue); /* clear the redraw map */ ClearRedrawMap (); } /* GameUpdateWindow */ /* * evaluate events for game until wait event */ static XBBool GameEvent (XBEventCode waitCode, XBEventData * data) { XBEventCode code; BMPlayer *ps; static unsigned int target = 0, init = 0; assert (data != NULL); /* wait for specific event */ if (init == 0) { target = numOfPlayers; init = 1; } GUI_SetMouseMode (XBTrue); while (waitCode != (code = GUI_WaitEvent (data))) { /* return if escape */ if (code == XBE_XBLAST) { return XBTrue; } ps = localPlayer[code]; /* test chat event */ if (!Chat_Event (code, *data) && NULL != ps) { /* check for player action */ if (NULL != actionTable[code]) { switch (data->value) { case XBGK_GO_UP: Player_ActivateBot (ps, XBFalse); actionTable[code]->dir = GoUp; break; case XBGK_GO_DOWN: Player_ActivateBot (ps, XBFalse); actionTable[code]->dir = GoDown; break; case XBGK_GO_LEFT: Player_ActivateBot (ps, XBFalse); actionTable[code]->dir = GoLeft; break; case XBGK_GO_RIGHT: Player_ActivateBot (ps, XBFalse); actionTable[code]->dir = GoRight; break; case XBGK_BOMB: Player_ActivateBot (ps, XBFalse); actionTable[code]->bomb = XBTrue; break; case XBGK_SPECIAL: Player_ActivateBot (ps, XBFalse); actionTable[code]->special = XBTrue; break; case XBGK_PAUSE: Player_ActivateBot (ps, XBFalse); actionTable[code]->pause = XBTrue; break; case XBGK_ABORT: Player_ActivateBot (ps, XBFalse); actionTable[code]->abort = ABORT_TRUE; break; case XBGK_ABORT_CANCEL: Player_ActivateBot (ps, XBFalse); actionTable[code]->abort = ABORT_CANCEL; break; case XBGK_LAOLA: Player_ActivateBot (ps, XBFalse); actionTable[code]->laola = XBTrue; SetMsgLaola (ps->id); break; case XBGK_LOOSER: Player_ActivateBot (ps, XBFalse); actionTable[code]->looser = XBTrue; SetMsgLoser (ps->id); break; case XBGK_BOT: Player_ActivateBot (ps, !ps->bot); break; case XBGK_STOP_ALL: Player_ActivateBot (ps, XBFalse); if (useStopKey[code]) { actionTable[code]->dir = GoStop; } break; case XBGK_STOP_UP: case XBGK_STOP_DOWN: case XBGK_STOP_LEFT: case XBGK_STOP_RIGHT: Player_ActivateBot (ps, XBFalse); if (!useStopKey[code]) { actionTable[code]->dir = GoStop; } break; } } } } return XBFalse; } /* GameEvent */ /* * event loop for game */ XBBool GameEventLoop (XBEventCode eCode, XBEventData * eData) { assert (NULL != eData); while (GameEvent (eCode, eData)) { if (XBXK_EXIT == eData->value) { return XBFalse; } } return XBTrue; } /* GameEventLoop */ /* * Evaluate player action in pause */ XBBool PauseEvalAction (int numPlayer, PlayerAction * playerAction, int pauseStatus) { int player; for (player = 0; player < numPlayer; player++) { /* check if player has deactivated pause mode */ if (player == pauseStatus && player_stat[player].lives > 0 && playerAction[player].pause) { return XBTrue; } } return XBFalse; } /* PauseEvalAction */ /* * Evaluate player action in game */ int GameEvalAction (int numPlayer, PlayerAction * playerAction) { int player; int result = -1; XBBool checkAbort = XBFalse; for (player = 0; player < numPlayer; player++) { BMPlayer *ps = player_stat + player; PlayerAction *pa = playerAction + player; /* if player lives */ if (ps->lives > 0) { /* suicide, unless already dying */ if (pa->suicide && !ps->dying) { ps->dying = DEAD_TIME; ps->lives = 1; } /* toggle pause mode */ if (pa->pause) { result = player; } /* drop bomb if needed */ if (pa->bomb) { DropBomb (ps, BMTdefault); } /* execute special key function */ if (pa->special) { (*specialKeyFunc) (ps); } /* do laola */ if (pa->laola) { ps->laola = 6; SetMsgLaola (player); } /* activate bot */ if (pa->bot) { ps->bot = XBTrue; } /* do the loser */ if (pa->looser) { SetMsgLoser (player); ps->looser = 10; } /* try to abort game if needed */ if (pa->abort == ABORT_CANCEL) { if (ps->abort != ABORT_NONE) { SetMessage (p_string[player].abortcancel, XBFalse); } ps->abort = ABORT_NONE; } else if (pa->abort == ABORT_TRUE) { SetMessage (p_string[player].abort, XBFalse); ps->abort = ABORT_TRUE; checkAbort = XBTrue; } /* get direction */ if (pa->dir != GoDefault) { /* reverse direction if needed */ if (ps->illness == IllReverse) { switch (pa->dir) { case GoUp: pa->dir = GoDown; break; case GoDown: pa->dir = GoUp; break; case GoLeft: pa->dir = GoRight; break; case GoRight: pa->dir = GoLeft; break; default: break; } } /* reverse2 direction, if needed */ if (ps->illness == IllReverse2) { switch (pa->dir) { case GoDown: pa->dir = GoLeft; break; case GoUp: pa->dir = GoRight; break; case GoLeft: pa->dir = GoUp; break; case GoRight: pa->dir = GoDown; break; default: break; } } /* set new course */ ps->d_soll = pa->dir; /* check if player changes course */ switch (ps->d_ist) { case GoUp: if (((GoRight == ps->d_soll || GoLeft == ps->d_soll) && ps->y % BLOCK_HEIGHT >= BLOCK_HEIGHT - turnY[player]) || GoDown == ps->d_soll) { ps->d_ist = GoDown; } break; case GoDown: if (((GoRight == ps->d_soll || GoLeft == ps->d_soll) && ps->y % BLOCK_HEIGHT <= turnY[player]) || GoUp == ps->d_soll) { ps->d_ist = GoUp; } break; case GoRight: if (((GoUp == ps->d_soll || GoDown == ps->d_soll) && ps->x % BLOCK_WIDTH <= turnX[player]) || GoLeft == ps->d_soll) { ps->d_ist = GoLeft; } break; case GoLeft: if (((GoUp == ps->d_soll || GoDown == ps->d_soll) && ps->x % BLOCK_WIDTH >= BLOCK_WIDTH - turnX[player]) || GoRight == ps->d_soll) { ps->d_ist = GoRight; } break; default: break; } } } } /* abort check if one player requested */ if (checkAbort) { XBBool doAbort = XBTrue; for (player = 0; player < numPlayer; player++) { if (player_stat[player].lives > 0) { if (player_stat[player].abort == ABORT_NONE) { doAbort = XBFalse; break; } } } if (doAbort) { /* Only if everyone has agreed */ SetMessage ("* * Level Aborted * *", XBTrue); for (player = 0; player < numPlayer; player++) { if (player_stat[player].lives > 0) { player_stat[player].lives = 1; player_stat[player].dying = DEAD_TIME; } } } } return result; } /* GameEvalAction */ /* * just before one level */ void LevelBegin (const char *name) { /* Set status bar to new level */ ResetStatusBar (player_stat, name, XBTrue); /* Show welcome message */ WelcomePlayers (); /* draw it */ DrawMaze (); /* fade in */ DoFade (XBFM_IN, PIXH + 1); GUI_FlushPixmap (XBFalse); } /* LevelBegin */ /* * after one level */ const char * LevelResult (int gameTime, int *lastTeam, int numPlayers, const DBRoot * level, XBBool store) { int i, j; XBBool won[MAX_PLAYER]; XBBool outOfTime = XBFalse; XBBool drawGame = XBFalse; int numWinners = 0; int numLoosers = 0; double pointWinner = 0.0; double pointLooser = 0.0; const char *msg; /* sanity check */ assert (lastTeam != NULL); *lastTeam = TEAM_NOWINNER; /* check each player */ for (i = 0; i < numPlayers; i++) { /* let dying players die */ if (player_stat[i].dying) { player_stat[i].dying = 0; player_stat[i].lives--; } /* still alive, then local winner */ won[i] = (player_stat[i].lives > 0); Dbg_Game (" player %i, team %i -> %s\n", i, player_stat[i].team, won[i] ? "won" : "lost"); /* update winner counts */ if (won[i]) { numWinners++; switch (*lastTeam) { case TEAM_NOWINNER: *lastTeam = player_stat[i].team; break; case TEAM_LOCALASYNC: break; default: if (*lastTeam != player_stat[i].team) { *lastTeam = TEAM_LOCALASYNC; } } } else { numLoosers++; } } Dbg_Game ("num of winners = %i\n", numWinners); /* determine message */ msg = "Test"; if (gameTime >= (GAME_TIME - 1)) { Dbg_Game ("game timed out\n"); msg = "Out of Time"; outOfTime = XBTrue; } else if (*lastTeam == TEAM_NOWINNER) { Dbg_Game ("draw game\n"); msg = _("Draw Game"); drawGame = XBTrue; } else if (*lastTeam == TEAM_LOCALASYNC) { Dbg_Game ("game asynced locally\n"); msg = "Local async"; } else { assert (numWinners > 0); /* update player victories, if store requested */ if (store) { for (i = 0; i < numPlayers; i++) { if (*lastTeam == player_stat[i].team) { player_stat[i].victories++; } } } Dbg_Game ("winner team = %u\n", *lastTeam); if (numWinners == 1) { /* one player/team has won */ for (i = 0; i < numPlayers; i++) { if (won[i]) { Dbg_Game ("Only player %i won: %s\n", i, p_string[i].name); msg = p_string[i].winlevel; } } } else { /* multiple winner, random win msg */ j = OtherRandomNumber (numWinners) + 1; for (i = 0; j > 0 && i < numPlayers; i++) { if (won[i]) { j--; if (j == 0) { Dbg_Game ("random win msg, player %i = %s\n", i, msg); msg = p_string[i].winlevel; } } } } pointWinner = numLoosers / numWinners; pointLooser = -1; } /* store level statistics if requested */ if (store) { /* log player result */ for (i = 0; i < numPlayers; i++) { StoreLevelStat (DB_Atom (level), GUI_StringToAtom (p_string[i].name), won[i], won[i] ? pointWinner : pointLooser); } /* log result for draws and out of time */ StoreLevelStat (DB_Atom (level), atomOutOfTime, outOfTime, 0.0); StoreLevelStat (DB_Atom (level), atomDrawGame, drawGame, 0.0); } /* that's all */ return msg; } /* LevelResult */ #if 0 /* * after one level */ void LevelEnd (int numPlayers, int lastTeam, const char *msg, XBBool timeOut) { BMPlayer *ps; XBEventData eData; XBBool flag; int count; XBBool done = XBFalse; BMSpriteAnimation anime; SND_Play (SND_WON, SOUND_MIDDLE_POSITION); /* setup animations */ flag = XBTrue; count = 0; /* setup event handling */ SetMessage (msg, XBTrue); GUI_SetTimer (FRAME_TIME, XBTrue); GUI_SetKeyboardMode (KB_MENU); GUI_SetMouseMode (XBFalse); while (!done) { /* update window */ GameUpdateWindow (); /* wait for next event */ switch (GUI_WaitEvent (&eData)) { case XBE_TIMER: if (0 == count % 16) { /* toggle message */ SetMessage (flag ? msg : "Press Space or Return", XBTrue); flag = !flag; } /* animate winner sprites */ anime = winnerAnime[count % NUM_WINNER_ANIMES]; if (lastTeam <= MAX_PLAYER) { for (ps = player_stat; ps < player_stat + numPlayers; ps++) { if (ps->team == lastTeam) { SetSpriteMode (ps->sprite, SPM_MAPPED); SetSpriteAnime (ps->sprite, anime); } } } /* check for timeout */ if (timeOut && count > 1000 * TIMEOUT_LEVEL_END / FRAME_TIME) { done = XBTrue; } /* --- */ count++; break; case XBE_MENU: if (eData.value == XBMK_SELECT || eData.value == XBMK_DEFAULT) { done = XBTrue; } break; case XBE_MOUSE_1: case XBE_MOUSE_2: case XBE_MOUSE_3: done = XBTrue; break; default: break; } } /* clear the redraw map */ ClearRedrawMap (); /* fade out image */ DoFade (XBFM_BLACK_OUT, PIXH + 1); } /* LevelEnd */ #endif /* * play a turn */ void GameTurn (int gameTime, int numPlayer, int *numActive) { #ifdef DEBUG_RANDOM int newSeed; static int oldSeed = 0; #endif /* set bot time */ SetBotTime (gameTime); /* handle players */ DoAllPlayers (gameTime, numActive); /* Shrink functions */ DoShrink (gameTime); /* Scramble blocks */ DoScramble (gameTime); /* Game functions */ DoNastyWalls (gameTime); /* check bombs */ DoBombs (player_stat, numPlayer); /* check explosions */ DoExplosions (); /* check if bombs are ignited by other bombs */ IgniteBombs (); /* stun players hit by other bombs */ StunPlayers (player_stat, numPlayer); /* check if and Virus or Junkie infects another player */ InfectOtherPlayers (numActive); /*evil grail */ DoEvilIll (); /* do junkie countdown */ DoJunkie (); /* check if player was hit by any explosions */ CheckPlayerHit (); /* update status bar */ UpdateStatusBar (player_stat, gameTime); #ifdef DEBUG_RANDOM newSeed = GetRandomSeed (); if (newSeed != oldSeed) { Dbg_Out ("time=%d seed=%u\n", gameTime, newSeed); oldSeed = newSeed; } #endif } /* GameTurn */ /* * return number of players in game */ int GetNumOfPlayers (void) { return numOfPlayers; } /* GetNumOfPlayers */ /* * initialize game data */ XBBool InitGame (XBPlayerHost hostType, CFGType cfgType, const CFGGame * cfgGame, PlayerAction * playerAction) { int i; CFGPlayer cfgPlayer[MAX_PLAYER]; /* sanity check */ assert (XBPH_None != hostType); assert (NULL != cfgGame); assert (NULL != playerAction); numOfPlayers = cfgGame->players.num; /* get player graphics */ for (i = 0; i < cfgGame->players.num; i++) { if (!RetrievePlayer (cfgType, cfgGame->players.player[i], cfgGame->players.teamColor[i], &cfgPlayer[i])) { return XBFalse; } } /* check for demo recording */ if (cfgGame->setup.recordDemo) { DemoInitGame (cfgType, cfgGame); } /* init player graphics */ if (!InitPlayerSprites (cfgGame->players.num, cfgPlayer)) { return XBFalse; } /* init players sprites and status icons */ InitPlayers (hostType, cfgGame, cfgPlayer); /* init status bar at bottom of screen */ InitStatusBar (cfgGame->players.num); /* setup scorboard (between levels ) */ InitScoreBoard (cfgGame->players.num, cfgGame->setup.numWins); /* setup key mappings */ InitPlayerInput (hostType, &cfgGame->players, cfgPlayer, playerAction); /* load sounds needed */ InitSounds (); /* that's all */ return XBTrue; } /* InitGame */ /* * clean up game data */ void FinishGame (const CFGGame * cfgGame) { /* sanity check */ assert (NULL != cfgGame); /* shutdown demo recorded if needed */ if (cfgGame->setup.recordDemo) { DemoFinishGame (); } /* some cleaning up */ FinishSounds (); DeletePlayerSprites (); FinishPlayers (); } /* FinishGame */ /* * end of file game.c */ xblast-2.10.4/game.h0000644000175000017500000000347610372731124013304 0ustar rhondaalfie/* * file game.h - rin the game * * $Id: game.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GAME_H #define XBLAST_GAME_H /* * global macrors */ #define PAUSE_DELAY (TIME_STEP/2) /* * global types */ typedef struct { CFGGame game; CFGPlayer player[MAX_PLAYER]; } XBGameConfig; /* * global prototypes */ extern void ClearPlayerAction (PlayerAction *); extern XBBool GameEventLoop (XBEventCode eCode, XBEventData * eData); extern XBBool PauseEvalAction (int numPlayer, PlayerAction * playerAction, int pauseStatus); extern void GameTurn (int gameTime, int numPlayer, int *numActive); extern int GameEvalAction (int numPlayer, PlayerAction * playerAction); extern void GameUpdateWindow (void); extern void LevelBegin (const char *name); extern const char *LevelResult (int gameTime, int *lastTeam, int numPlayers, const DBRoot * level, XBBool store); extern XBBool InitGame (XBPlayerHost, CFGType, const CFGGame *, PlayerAction *); extern void FinishGame (const CFGGame *); extern int GetNumOfPlayers (void); #endif /* * end of file game.h */ xblast-2.10.4/game_client.c0000644000175000017500000003533210377702067014642 0ustar rhondaalfie/* * file game_client.c - run game as client * * $Id: game_client.c,v 1.45 2006/02/24 22:09:59 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ static CFGGame clientGame; static PlayerAction clientAction[MAX_PLAYER]; static XBBool playerLinked[MAX_PLAYER]; static int pa[MAX_PLAYER]; static int teamActive; static int numActive; static XBBool autoPress; static char exitMsg[100]; /* * initialize linked players */ static void InitPlayerLink (void) { int i; assert (clientGame.players.num <= MAX_PLAYER); for (i = 0; i < clientGame.players.num; i++) { playerLinked[i] = XBTrue; } for (; i < MAX_PLAYER; i++) { playerLinked[i] = XBFalse; } } /* InitPlayerLink */ /* * set unlinked active players to inactive */ static XBBool UpdatePlayerLink (void) { int i; XBBool result = XBFalse; for (i = 0; i < clientGame.players.num; i++) { if (!playerLinked[i] && !player_stat[i].in_active) { player_stat[i].in_active = XBTrue; player_stat[i].lives = 0; result = XBTrue; } } return result; } /* UpdatePlayerLink */ /* * determine active players and counts */ static void GetActivePlayers (int *pa, int *pl, int *tm) { int i, reinco; *pl = 0; *tm = 0; reinco = 0; for (i = 0; i < clientGame.players.num; i++) { pa[i] = !player_stat[i].in_active; if (!player_stat[i].in_active) { *pl = *pl + 1; if (clientGame.setup.teamMode) { if (!(reinco & (1 << player_stat[i].team))) { reinco |= 1 << player_stat[i].team; *tm = *tm + 1;; } } else { *tm = *tm + 1;; } } } Dbg_Game ("%i active player, %i active teams (%s mode)\n", *pl, *tm, clientGame.setup.teamMode ? "team" : "chaos"); } /* GetActivePlayers */ /* * wait for an event from server */ static XBBool WaitForServerEvent (XBNetworkEvent waitEvent, XBBool needFlush) { XBEventCode xbEvent; XBEventData eData; XBNetworkEvent netEvent; unsigned id; XBPlayerHost host; int i; /* set timer */ GUI_SetTimer (FRAME_TIME, XBTrue); /* no keys/mouse */ GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBFalse); /* get events */ while (1) { /* update window */ GameUpdateWindow (); /* wait for xblast event */ xbEvent = GUI_WaitEvent (&eData); switch (xbEvent) { case XBE_XBLAST: /* check for escape */ if (eData.value == XBXK_EXIT) { return XBFalse; } break; case XBE_TIMER: /* try to flush udp connections */ if (needFlush) { needFlush = Client_FlushPlayerAction (); } /* loop through all network events that accumulated */ while (XBNW_None != (netEvent = Network_GetEvent (&id))) { if (netEvent == waitEvent) { /* event waited for, return success */ return XBTrue; } else { /* otherwise check for disconnect */ switch (netEvent) { case XBNW_Disconnected: if (id == 0 && waitEvent != XBNW_None) { /* server disconnected, but client still waiting, return failure */ sprintf (exitMsg, "server disconnected"); Dbg_Game ("exit - %s\n", exitMsg); return XBFalse; } else { /* another client disconnected, unlike its players */ Dbg_Game ("client #%u disconnected\n", id); host = XBPH_Client1 + id - 1; for (i = 0; i < clientGame.players.num; i++) { if (clientGame.players.host[i] == host) { playerLinked[i] = XBFalse; Dbg_Game ("unlink player %d\n", i); } } } break; case XBNW_Error: /* network error, return failure */ sprintf (exitMsg, "network error to server"); Dbg_Game ("exit - %s\n", exitMsg); return XBFalse; default: break; } } /* network queue is now emptied, check if that was waited for */ if (waitEvent == XBNW_None) { return XBTrue; } break; default: /* check for chat event */ (void)Chat_Event (xbEvent, eData); break; } } } return XBFalse; } /* WaitForServerEvent */ /* * send sync signal to server and wait for acknowledgement */ static XBBool SyncWithServer (XBNetworkEvent syncEvent, XBBool needFlush, XBBool showMsg) { Dbg_Game ("waiting for others \n"); if (showMsg) { SetMessage ("Waiting for others ...", XBTrue); } Client_SendSync (syncEvent); if (!WaitForServerEvent (syncEvent, XBFalse)) { return XBFalse; } return XBTrue; } /* SyncWithServer */ /* * wait for level data from server */ static const DBRoot * LevelFromServer (void) { int cnt = 0; do { Dbg_Game ("level negotiations running\n"); if (!WaitForServerEvent (XBNW_LevelConfig, XBFalse)) { Dbg_Game ("%i level proposals processed\n", cnt / 2); return NULL; } cnt++; if (!Client_FixedLevel ()) { Dbg_Game ("received level data from server\n"); if (Client_RejectsLevel ()) { Dbg_Game ("rejecting level, resetting\n"); ClearRemoteLevelConfig (); } else { Dbg_Game ("accepting level proposal from server\n"); } Client_SendLevelCheck (); } } while (!Client_FixedLevel ()); Dbg_Game ("received level activation by server\n"); if (Client_RejectsLevel ()) { sprintf (exitMsg, "rejected activated level, protocol error!"); Dbg_Game ("exit - %s\n", exitMsg); return NULL; } Dbg_Game ("level negotiations successful\n"); return GetRemoteLevelConfig (); } /* LevelFromServer */ /* * run a level as client */ static int ClientRunLevel (int numActive, const DBRoot * level) { int gameTime; int pauseStatus; int lastTeam, winner; const char *msg; XBEventData data; /* sanity check */ assert (NULL != level); /* necesary inits */ winner = -1; gameTime = 0; pauseStatus = -1; lastTeam = -1; /* start demo recording if requested */ if (clientGame.setup.recordDemo) { DemoInitLevel (DB_Atom (level)); } /* Config level */ if (!ConfigLevel (level)) { Dbg_Game ("level config failed!\n"); } /* clear async flag */ Client_SetLevelAsync (XBFalse); /* clear action array of client */ Client_ClearPlayerAction (); Dbg_Game ("cleared client game data\n"); /* show level info */ if (!LevelIntro (clientGame.players.num, level, autoPress ? -1 : clientGame.setup.infoTime)) { Dbg_Game ("game aborted in level intro\n"); goto Exit; } /* sync with server */ Dbg_Game ("syncing level-intro with server\n"); if (!SyncWithServer (XBNW_SyncLevelIntro, XBFalse, XBTrue)) { Dbg_Game ("sync failed, disconnecting\n"); goto Exit; } Dbg_Game ("received level-intro sync\n"); /* reset dgram socket after sync, so that early server data triggers no events */ Client_ResetPlayerAction (); /* update active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); /* show level map */ LevelBegin (GetLevelName (level)); /* set status bar to new level */ ResetStatusBar (player_stat, GetLevelName (level), XBTrue); /* init events */ GUI_SetTimer (0, XBFalse); GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBTrue); /* play music if requested */ if (clientGame.setup.Music) { SND_Load (clientGame.setup.Music); SND_Play (clientGame.setup.Music, SOUND_MIDDLE_POSITION); } /* now start level */ do { /* increment game clock */ gameTime++; Dbg_Action ("----------\n"); /* clear input data */ ClearPlayerAction (clientAction); Wait: /* get events */ Dbg_Action ("waiting for server event at gt=%u\n", gameTime); if (!GameEventLoop (XBE_SERVER, &data)) { Dbg_Game ("game aborted in game event loop\n"); goto Exit; } /* handle vents */ switch ((XBServerEvent) data.value) { case XBSE_FINISH: Dbg_Action ("server sent level finish\n"); goto Finish; case XBSE_ERROR: sprintf (exitMsg, "server error received during level"); Dbg_Game ("exit - %s\n", exitMsg); goto Exit; default: /* show next frame */ Dbg_Action ("received action for gt=%u, current=%u\n", data.value, gameTime); if (gameTime < data.value) { /* requeue event, for accelerated processing of intermediate game times */ Dbg_Action ("requeue %u\n", data.value); GUI_SendEventValue (XBE_SERVER, data.value); } else if (gameTime == data.value) { Dbg_Action ("expected\n"); } else { Dbg_Action ("repeat\n"); goto Wait; } break; } Dbg_Action ("do game stuff for gt=%u\n", gameTime); /* bot */ Player_BotAction (clientAction); /* handle game turn */ GameTurn (gameTime, clientGame.players.num, &numActive); /* send own keys to server */ Client_SendPlayerAction (gameTime, clientAction); /* insert keys from server */ Client_GetPlayerAction (gameTime, clientAction); /* record demo if needed */ if (clientGame.setup.recordDemo) { DemoRecordFrame (gameTime, clientAction); } /* evaluate input data */ (void)GameEvalAction (clientGame.players.num, clientAction); /* update window */ GameUpdateWindow (); } while (1); Finish: Dbg_Game ("level ended\n"); /* stop music if necessary */ if (clientGame.setup.Music) { SND_Stop (clientGame.setup.Music); } /* activate bot if client was idle */ Player_CheckLocalAway (); /* now update autoPress */ autoPress = Player_CheckLocalBot (); if (autoPress) { Dbg_Out ("AUTOPRESS!!!\n"); } /* send finish message */ Dbg_Game ("sending level finish\n"); Client_FinishPlayerAction (gameTime); /* determine last team, don't store */ LevelResult (gameTime, &lastTeam, clientGame.players.num, level, XBFalse); /* finish demo file if needed */ if (clientGame.setup.recordDemo) { DemoFinishLevel (gameTime, winner, "c"); } /* send winner team */ Dbg_Game ("sending winner team %u\n", lastTeam); Client_SendWinner (lastTeam); /* wait for server to send response */ Dbg_Game ("waiting for server level-result sync\n"); if (!WaitForServerEvent (XBNW_SyncLevelResult, XBFalse)) { Dbg_Game ("sync failed\n"); goto Exit; } Dbg_Game ("level-result sync received\n"); /* check if async was responded */ if (Client_LevelAsynced ()) { Dbg_Game ("level async received, ignoring result\n"); GUI_ErrorMessage ("Async level, making it a draw\n"); lastTeam = MAX_PLAYER; } else { Dbg_Game ("level was sync\n"); /* now store result */ msg = LevelResult (gameTime, &lastTeam, clientGame.players.num, level, XBTrue); /* show message and winner Animation */ if (!LevelEnd (clientGame.players.num, lastTeam, msg, autoPress ? -1 : 1)) { Dbg_Game ("aborted game during winner animation\n"); lastTeam = -1; } } /* clean up */ Exit: /* stop music if necessary */ if (clientGame.setup.Music) { SND_Stop (clientGame.setup.Music); } DeleteAllExplosions (); FinishLevel (); /* fade out image */ DoFade (XBFM_BLACK_OUT, PIXH + 1); /* that's all */ return lastTeam; } /* ClientRunLevel */ /* * run game as client */ void RunClientGame (XBPlayerHost hostType) { const DBRoot *level; int lastTeam; int i, maxNumWins; /* clear exit message */ memset (exitMsg, 0, sizeof (exitMsg)); /* get game configs */ if (!RetrieveGame (CT_Remote, SERVERGAMECONFIG, &clientGame)) { Dbg_Game ("failed to get game config!\n"); sprintf (exitMsg, "game config error"); Dbg_Game ("exit - %s\n", exitMsg); goto Disconnect; } /* common inits */ if (!InitGame (hostType, CT_Remote, &clientGame, clientAction)) { sprintf (exitMsg, "game init error"); Dbg_Game ("exit - %s\n", exitMsg); goto Disconnect; } /* init local data */ maxNumWins = 0; numActive = 0; teamActive = 0; autoPress = Player_CheckLocalBot (); /* init player link flags */ InitPlayerLink (); /* clear level data for next run */ ClearRemoteLevelConfig (); Client_LevelFix (XBFalse); Client_LevelRejection (XBTrue); /* beep once if requested */ if (clientGame.setup.beep) { SND_Beep (); } /* sync with server */ Dbg_Game ("waiting for server end-of-init sync\n"); if (!SyncWithServer (XBNW_SyncEndOfInit, XBFalse, XBFalse)) { Dbg_Game ("sync failed\n"); goto Exit; } Dbg_Game ("end-of-init sync received\n"); /* update active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); GUI_ShowCursor(XBFalse); /* start the game */ do { /* load and run next level */ if (NULL == (level = LevelFromServer ())) { Dbg_Game ("level negotiations failed, exiting\n"); goto Exit; } /* update active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); /* run the level */ Dbg_Game ("starting level\n"); lastTeam = ClientRunLevel (teamActive, level); /* check for quick exit */ if (-1 == lastTeam) { Dbg_Game ("game aborted during level\n"); goto Exit; } /* update current winner */ for (i = 0; i < clientGame.players.num; i++) { if (player_stat[i].victories > maxNumWins) { maxNumWins = player_stat[i].victories; } } /* sync before showing score board */ Dbg_Game ("waiting for server sync level-end\n"); if (!SyncWithServer (XBNW_SyncLevelEnd, XBFalse, XBTrue)) { Dbg_Game ("sync failed!\n"); goto Exit; } Dbg_Game ("level-end sync received\n"); /* show scores */ if (!ShowScoreBoard (lastTeam, maxNumWins, clientGame.players.num, player_stat, autoPress ? -1 : 1)) { Dbg_Game ("game aborted during scoreboard\n"); goto Exit; } /* clear level data for next run, must be before scoreboard sync */ ClearRemoteLevelConfig (); Client_LevelFix (XBFalse); Client_LevelRejection (XBTrue); Dbg_Game ("reset level data, now waiting for server sync scoreboard\n"); if (!SyncWithServer (XBNW_SyncScoreboard, XBFalse, XBTrue)) { Dbg_Game ("sync failed!\n"); goto Exit; } /* determine active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); } while (numActive > 1 && teamActive > 1 && maxNumWins < clientGame.setup.numWins); GUI_ShowCursor(XBTrue); Dbg_Game ("game ended\n"); SetMessage ("Waiting for server", XBTrue); /* show winner */ InitWinner (clientGame.players.num); ShowWinner (lastTeam, clientGame.players.num, player_stat); /* wait till network queue is cleared */ Dbg_Game ("waiting for server to shutdown!\n"); (void)WaitForServerEvent (XBNW_None, XBFalse); Exit: GUI_ShowCursor(XBTrue); FinishGame (&clientGame); Disconnect: Client_Disconnect (); if (strlen (exitMsg) > 0) { GUI_ErrorMessage (exitMsg); } return; } /* RunClientGame */ /* * end of file game_client.c */ xblast-2.10.4/game_client.h0000644000175000017500000000205610372731124014633 0ustar rhondaalfie/* * file game_client.h - run game as client * * $Id: game_client.h,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GAME_CLIENT_H #define XBLAST_GAME_CLIENT_H /* * global prototypes */ extern void RunClientGame (XBPlayerHost hostType); #endif /* * end of file game_client.h */ xblast-2.10.4/game_demo.c0000644000175000017500000000600710372731124014274 0ustar rhondaalfie/* * file game_demo.c - playback demo game * * $Id: game_demo.c,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ static CFGGame demoGame; static PlayerAction demoAction[MAX_PLAYER]; /* * */ static int DemoRunLevel (int numActive, const DBRoot * level) { int gameTime; int pauseStatus; int lastTeam; int frameTime; const char *msg; XBEventData eData; /* sanity check */ assert (level != NULL); /* necesary inits */ gameTime = 0; pauseStatus = -1; lastTeam = -1; frameTime = demoGame.setup.frameRate ? 1000 / demoGame.setup.frameRate : 0; /* load all frame data */ DemoPlaybackStart (); /* Config level */ ConfigLevel (level); /* init level display */ LevelBegin (GetLevelName (level)); /* inti events */ GUI_SetTimer (frameTime, XBTrue); GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBFalse); /* now start */ do { /* check input */ ClearPlayerAction (demoAction); if (!GameEventLoop (XBE_TIMER, &eData)) { goto Exit; } /* increment game clock */ gameTime++; /* do the game */ GameTurn (gameTime, demoGame.players.num, &numActive); /* get player action from file */ DemoPlaybackFrame (gameTime, demoAction); (void)GameEvalAction (demoGame.players.num, demoAction); /* update window */ GameUpdateWindow (); } while (gameTime < GAME_TIME && numActive > 0 && (numActive > 1 || NumberOfExplosions () != 0)); /* calc result etc */ msg = LevelResult (gameTime, &lastTeam, demoGame.players.num, level, XBFalse); /* show message and winner Animation */ if (!LevelEnd (demoGame.players.num, lastTeam, msg, 1)) { return -1; } /* clean up */ Exit: FinishLevel (); DeleteAllExplosions (); /* fade out image */ DoFade (XBFM_BLACK_OUT, PIXH + 1); /* that´s all */ return lastTeam; } /* DemoRunLevel */ /* * */ void RunDemoGame (void) { const DBRoot *level; /* retrieve config */ if (!DemoPlaybackConfig (&demoGame)) { return; } /* standard inits */ if (!InitGame (XBPH_Demo, CT_Demo, &demoGame, demoAction)) { return; } /* load level */ if (NULL != (level = LoadLevelFile (DemoPlaybackLevel ()))) { /* run single demo */ (void)DemoRunLevel (demoGame.players.num, level); } FinishGame (&demoGame); } /* StartDemoGame */ /* * end of file game_demo.c */ xblast-2.10.4/game_demo.h0000644000175000017500000000202110051114301014253 0ustar rhondaalfie/* * file game_demo.h - playback demo game * * $Id: game_demo.h,v 1.3 2004/05/14 10:00:33 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GAME_DEMO_H #define XBLAST_GAME_DEMO_H /* * global prototypes */ extern void RunDemoGame (void); #endif /* * end of file game_demo.h */ xblast-2.10.4/game_local.c0000644000175000017500000001536610377702116014456 0ustar rhondaalfie/* * file game_local.c - run a local game * * $Id: game_local.c,v 1.17 2006/02/24 22:10:22 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ static CFGGame localGame; static PlayerAction localAction[MAX_PLAYER]; /* * */ static int LocalRunLevel (int numActive, const DBRoot * level) { int gameTime; int pauseStatus; int lastTeam; int frameTime; int oldaction; int winner, counter; BMPlayer *ps = NULL; const char *msg; int away = 1; XBEventData eData; /* sanity check */ assert (level != NULL); /* necesary inits */ Dbg_Out ("Level playing is: %s\n", GetLevelName (level)); winner = -1; gameTime = 0; pauseStatus = -1; lastTeam = -1; frameTime = localGame.setup.frameRate ? 1000 / localGame.setup.frameRate : 0; /* start demo recording */ SeedRandom (time (NULL)); if (localGame.setup.recordDemo) { DemoInitLevel (DB_Atom (level)); } /* Config level */ if (!ConfigLevel (level)) { goto Exit; } /* show level info */ if (!LevelIntro (localGame.players.num, level, 0)) { goto Exit; } /* init level display */ LevelBegin (GetLevelName (level)); /* init events */ GUI_SetTimer (frameTime, XBTrue); GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBFalse); if (localGame.setup.Music) { SND_Load (localGame.setup.Music); SND_Play (localGame.setup.Music, SOUND_MIDDLE_POSITION); } ClearPlayerAction (localAction); oldaction = PlayerActionToByte (&localAction[0]); /* now start */ do { if (pauseStatus != -1) { /* * PAUSE mode */ /* check if pause is to end */ if (pauseStatus < 0) { pauseStatus++; if (-1 == pauseStatus) { GUI_Bell (); ResetMessage (); } } /* check input */ ClearPlayerAction (localAction); if (!GameEventLoop (XBE_TIMER, &eData)) { goto Exit; } /* check if player has ended pause mode */ if (PauseEvalAction (localGame.players.num, localAction, pauseStatus)) { pauseStatus = -PAUSE_DELAY; SetMessage ("Continue", XBTrue); GUI_Bell (); } } else { /* * INGAME mode */ /* check input */ // fprintf(stderr,"action1 %i \n",localAction[0]); ClearPlayerAction (localAction); if (!GameEventLoop (XBE_TIMER, &eData)) { goto Exit; } /* increment game clock */ gameTime++; /* bot */ counter = 0; for (ps = player_stat, counter = 1; ps < player_stat + localGame.players.num; ps++, counter++) { if (ps->local) { break; } } if (ps->bot == XBTrue) { gestionBot (player_stat, localAction, counter - 1, localGame.players.num); } /* do the game */ GameTurn (gameTime, localGame.players.num, &numActive); if (localGame.setup.bot) { gestionBot (player_stat, localAction, 1, localGame.players.num); } /* record actions for demo data */ if (localGame.setup.recordDemo) { DemoRecordFrame (gameTime, localAction); } /* evaluate player actions */ if (PlayerActionToByte (&localAction[0]) != oldaction) { oldaction = PlayerActionToByte (&localAction[0]); away = 0; ps->bot = XBFalse; } if (-1 != (pauseStatus = GameEvalAction (localGame.players.num, localAction))) { /* pause was activated */ assert (pauseStatus < localGame.players.num); SetMessage (p_string[pauseStatus].pause, XBTrue); } } /* update window */ GameUpdateWindow (); } while (gameTime < GAME_TIME && numActive > 0 && (numActive > 1 || NumberOfExplosions () != 0)); if (away == 1) { ps->bot = XBTrue; } LevelResult (gameTime, &lastTeam, localGame.players.num, level, XBFalse); if (lastTeam <= MAX_PLAYER) { for (ps = player_stat, counter = 1; ps < player_stat + localGame.players.num; ps++, counter++) { if (ps->team == lastTeam) { winner = counter; } } } /* finish demo file if needed */ if (localGame.setup.recordDemo) { DemoFinishLevel (gameTime, winner, "l"); } /* calc result etc */ msg = LevelResult (gameTime, &lastTeam, localGame.players.num, level, XBTrue); /* show message and winner Animation */ if (!LevelEnd (localGame.players.num, lastTeam, msg, 0)) { /* abort */ lastTeam = -1; } if (localGame.setup.Music) { SND_Stop (localGame.setup.Music); } /* clean up */ Exit: if (localGame.setup.Music) { SND_Stop (localGame.setup.Music); } FinishLevel (); DeleteAllExplosions (); /* fade out image */ DoFade (XBFM_BLACK_OUT, PIXH + 1); /* that´s all */ return lastTeam; } /* LocalRunLevel */ /* * */ void RunLocalGame (void) { const DBRoot *level; int lastTeam; int i, maxNumWins; int numActive; XBBool initDone = XBFalse; /* retrieve game configs */ if (!RetrieveGame (CT_Local, atomLocal, &localGame)) { goto Exit; } /* select levels to plays */ if (!InitLevels (&localGame)) { goto Exit; } /* init rest of data */ if (!InitGame (XBPH_Local, CT_Local, &localGame, localAction)) { goto Exit; } initDone = XBTrue; GUI_ShowCursor(XBFalse); /* game loop */ maxNumWins = 0; numActive = localGame.players.num; do { /* load and run next level */ level = LoadLevelFile (GetNextLevel ()); lastTeam = LocalRunLevel (numActive, level); /* check for quick exit */ if (-1 == lastTeam) { goto Exit; } /* calculate new maxmium # of victories */ for (i = 0; i < localGame.players.num; i++) { if (player_stat[i].victories > maxNumWins) { maxNumWins = player_stat[i].victories; } } /* show scores */ if (!ShowScoreBoard (lastTeam, maxNumWins, localGame.players.num, player_stat, 0)) { goto Exit; } /* determine number of active players */ numActive = 0; for (i = 0; i < localGame.players.num; i++) { if (!player_stat[i].in_active) { numActive++; } } Dbg_Out ("%d active players\n", numActive); } while (numActive > 1 && maxNumWins < localGame.setup.numWins); GUI_ShowCursor(XBTrue); /* end screen */ InitWinner (localGame.players.num); ShowWinner (lastTeam, localGame.players.num, player_stat); /* that's all */ FinishGame (&localGame); return; Exit: GUI_ShowCursor(XBTrue); if (initDone) { FinishGame (&localGame); } return; } /* StartLocalGame */ /* * end of file game_local.c */ xblast-2.10.4/game_local.h0000644000175000017500000000206110372705221014442 0ustar rhondaalfie/* * file game_local.h - run a local game * * $Id: game_local.h,v 1.4 2006/02/09 18:31:45 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GAME_LOCAL_H #define XBLAST_GAME_LOCAL_H /* * type definitions */ /* * global prototypes */ extern void RunLocalGame (void); #endif /* * end of file game_local.h */ xblast-2.10.4/game_server.c0000644000175000017500000004721510375712062014667 0ustar rhondaalfie/* * file game_server.c - run game as server * * $Id: game_server.c,v 1.49 2006/02/18 21:40:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #ifndef MAX_REJECTS #define MAX_REJECTS 50 #endif /* * local variables */ typedef struct { BMPlayer *ps; /* player stat pointer */ int cnt; /* player stat index */ } BotData; static CFGGame serverGame; static PlayerAction serverAction[MAX_PLAYER]; static XBBool playerLinked[MAX_PLAYER]; static int pa[MAX_PLAYER]; static int numActive; static int teamActive; static XBBool away; /* * mark all external hosts */ static void InitPlayerLink (void) { int i; assert (serverGame.players.num <= MAX_PLAYER); for (i = 0; i < serverGame.players.num; i++) { playerLinked[i] = (serverGame.players.host[i] != XBPH_Server && serverGame.players.host[i] != XBPH_Local && serverGame.players.host[i] != XBPH_Demo); } for (; i < MAX_PLAYER; i++) { playerLinked[i] = XBFalse; } } /* InitPlayerLink */ /* * set unlinked active external players to inactive */ static XBBool UpdatePlayerLink (void) { int i; XBBool result = XBFalse; for (i = 0; i < serverGame.players.num; i++) { if (serverGame.players.host[i] != XBPH_Server && serverGame.players.host[i] != XBPH_Local && !playerLinked[i] && !player_stat[i].in_active) { player_stat[i].in_active = XBTrue; player_stat[i].lives = 0; result = XBTrue; } } return result; } /* UpdatePlayerLink */ /* * determine number of potentially available players/teams */ static void GetActivePlayers (int *pa, int *pl, int *tm) { int i, reinco; *pl = 0; *tm = 0; reinco = 0; for (i = 0; i < serverGame.players.num; i++) { pa[i] = !player_stat[i].in_active; if (!player_stat[i].in_active) { *pl = *pl + 1; if (serverGame.setup.teamMode) { if (!(reinco & (1 << player_stat[i].team))) { reinco |= 1 << player_stat[i].team; *tm = *tm + 1;; } } else { *tm = *tm + 1;; } } } Dbg_Game ("%i active player, %i active teams (%s mode)\n", *pl, *tm, serverGame.setup.teamMode ? "team" : "chaos"); } /* GetActivePlayers */ /* * update the central game with current result */ static void UpdateCentralGame (void) { int i; static char res[20]; memset (res, 0, sizeof (res)); for (i = 0; i < serverGame.players.num; i++) { sprintf (&res[i], "%i", player_stat[i].victories); } res[i] = '-'; Dbg_Game ("updating central game entry, current result %s\n", res); Server_RestartNewGame (0, res); } /* UpdateCentralGame */ /* * check connections */ static void CheckConnections (void) { int pl, id; for (pl = 0; pl < serverGame.players.num; pl++) { /* get host id of player */ id = serverGame.players.host[pl] + 1 - XBPH_Client1; /* only check remote host players */ if (serverGame.players.host[pl] != XBPH_Server && serverGame.players.host[pl] != XBPH_Local) { /* check if host disconnect has to be registered */ if (playerLinked[pl] && Network_GetHostState (id) == XBHS_None) { /* unlink disconnected players */ playerLinked[pl] = XBFalse; Dbg_Game ("player %u at host %u disconnected\n", pl, id); } /* override player action as suicide, if unlinked */ serverAction[pl].suicide = !playerLinked[pl]; } } } /* CheckConnections */ #ifdef DEBUG_GAME /* * output flag array (obsolete) */ static char * ShowPlayerFlags (XBBool * arr) { static char tmp[MAX_PLAYER + 1]; int i; memset (tmp, 0, sizeof (tmp)); for (i = 0; i < serverGame.players.num; i++) { tmp[i] = arr[i] ? 'x' : '-'; } return tmp; } /* ShowPlayerFlags */ #endif /* * server waits until all clients sent given event */ static XBBool WaitForClientEvent (XBNetworkEvent waitEvent, XBBool needFlush) { int i; long num; unsigned id; XBEventCode xbEvent; XBEventData eData; XBNetworkEvent netEvent; XBBool playerWait[MAX_PLAYER]; /* determine for which players we have to wait */ memcpy (playerWait, playerLinked, sizeof (playerWait)); Dbg_Game ("linked players |%s|\n", ShowPlayerFlags (playerLinked)); /* set timer, disable keys/mouse */ GUI_SetTimer (FRAME_TIME, XBTrue); GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBFalse); /* loop until all clients have reported back */ do { /* determine how many player are not ready */ num = 0; for (i = 0; i < serverGame.players.num; i++) { if (playerWait[i]) { num++; } } Dbg_Game ("waiting for players |%s|, remaining = %lu\n", ShowPlayerFlags (playerWait), (unsigned long)num); /* update window */ GameUpdateWindow (); /* get next event */ xbEvent = GUI_WaitEvent (&eData); /* check for network events when timer triggers */ switch (xbEvent) { case XBE_XBLAST: /* check for escape */ if (eData.value == XBXK_EXIT) { return XBFalse; } break; case XBE_TIMER: /* try to flush udp connections, if requested */ if (needFlush) { needFlush = Server_FlushPlayerAction (); } /* get single network event */ netEvent = Network_GetEvent (&id); /* check for sync, error or disconnect */ if (netEvent == waitEvent || netEvent == XBNW_Error || netEvent == XBNW_Disconnected) { if (id < MAX_HOSTS) { /* calculate host type */ XBPlayerHost host = XBPH_Client1 + id - 1; /* loop through all players on that host */ for (i = 0; i < serverGame.players.num; i++) { if (serverGame.players.host[i] == host) { /* mark as having responded */ playerWait[i] = XBFalse; /* unlink if disconnected */ switch (netEvent) { case XBNW_Error: Dbg_Game ("unlinked player %i (host %i), network error\n", i, id); playerLinked[i] = XBFalse; break; case XBNW_Disconnected: Dbg_Game ("unlinked player %i, (host %i), disconnected\n", i, id); playerLinked[i] = XBFalse; break; default: break; } } } } else { Dbg_Game ("network event %i on central connection \n", id); } } break; default: /* check for chat event */ (void)Chat_Event (xbEvent, eData); break; } /* TODO: limit timer events and disconnect all non-responding hosts */ } while (num > 0); return XBTrue; } /* WaitForClientEvent */ /* * server waits for specific event from all clients and acknowledges */ static XBBool SyncWithClients (XBNetworkEvent syncEvent, XBBool needFlush, XBBool showMsg) { if (showMsg) { SetMessage ("Waiting for others ...", XBTrue); } WaitForClientEvent (syncEvent, needFlush); /* acknowledge receiving all syncs and go on */ Server_SendSync (syncEvent); return XBTrue; } /* SyncWithClients */ /* * insert keys from clients */ static void InsertClientAction (const CFGGamePlayers * cfgPlayers, PlayerAction * serverAction) { int i; assert (NULL != cfgPlayers); assert (NULL != serverAction); for (i = 0; i < cfgPlayers->num; i++) { switch (cfgPlayers->host[i]) { case XBPH_Client1: Server_GetPlayerAction (1, i, serverAction + i); break; case XBPH_Client2: Server_GetPlayerAction (2, i, serverAction + i); break; case XBPH_Client3: Server_GetPlayerAction (3, i, serverAction + i); break; case XBPH_Client4: Server_GetPlayerAction (4, i, serverAction + i); break; case XBPH_Client5: Server_GetPlayerAction (5, i, serverAction + i); break; #ifdef SMPF case XBPH_Client6: Server_GetPlayerAction (6, i, serverAction + i); break; case XBPH_Client7: Server_GetPlayerAction (7, i, serverAction + i); break; case XBPH_Client8: Server_GetPlayerAction (8, i, serverAction + i); break; case XBPH_Client9: Server_GetPlayerAction (9, i, serverAction + i); break; case XBPH_Client10: Server_GetPlayerAction (10, i, serverAction + i); break; case XBPH_Client11: Server_GetPlayerAction (11, i, serverAction + i); break; case XBPH_Client12: Server_GetPlayerAction (12, i, serverAction + i); break; case XBPH_Client13: Server_GetPlayerAction (13, i, serverAction + i); break; case XBPH_Client14: Server_GetPlayerAction (14, i, serverAction + i); break; case XBPH_Client15: Server_GetPlayerAction (15, i, serverAction + i); break; #endif default: break; } } Server_ClearPlayerAction (); } /* InsertClientAction */ /* * run a level */ static int ServerRunLevel (int numActive, const DBRoot * level) { int gameTime; int pauseStatus; int lastTeam, counter, winner; int remainingTeams; int frameTime; BMPlayer *ps; XBBool async; const char *msg; XBEventData eData; /* sanity check */ assert (level != NULL); /* necessary inits */ winner = -1; gameTime = 0; pauseStatus = -1; lastTeam = -1; frameTime = serverGame.setup.frameRate ? 1000 / serverGame.setup.frameRate : 0; /* start demo recording if requested */ if (serverGame.setup.recordDemo) { DemoInitLevel (DB_Atom (level)); } /* post level name on chat */ Server_SysChat (TempString ("playing level [%s]", GetLevelName (level))); /* Config level */ if (!ConfigLevel (level)) { Dbg_Game ("level config failed!\n"); goto Exit; } /* prepare async check at end of level */ Server_ClearLevelWinners (); /* clean up player actions */ Server_ClearPlayerAction (); Server_ResetPlayerAction (); /* level intro */ if (!LevelIntro (serverGame.players.num, level, away ? -1 : serverGame.setup.infoTime)) { Dbg_Game ("abort in level intro\n"); goto Exit; } /* wait for clients to show level info */ Dbg_Game ("waiting for clients to show level intro\n"); SyncWithClients (XBNW_SyncLevelIntro, XBFalse, XBTrue); Dbg_Game ("clients show level intro\n"); /* determine active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); if (teamActive <= 1) { GUI_ErrorMessage ("Only one team left after level-intro sync!"); goto Exit; } remainingTeams = teamActive; /* show level map */ LevelBegin (GetLevelName (level)); /* set timer for frames */ GUI_SetTimer (frameTime, XBTrue); /* process key events */ GUI_SetKeyboardMode (KB_XBLAST); GUI_SetMouseMode (XBFalse); /* play music, if requested */ if (serverGame.setup.Music) { SND_Load (serverGame.setup.Music); SND_Play (serverGame.setup.Music, SOUND_MIDDLE_POSITION); } Dbg_Game ("starting level!\n"); /* update central entry */ UpdateCentralGame (); /* now start level */ do { /* ready input */ ClearPlayerAction (serverAction); /* handle all event until timer triggers */ if (!GameEventLoop (XBE_TIMER, &eData)) { Dbg_Game ("game aborted during level\n"); goto Exit; } /* increment game clock */ gameTime++; /* update game entry occasionally */ if (serverGame.host.central && (gameTime % 1024) == 0) { UpdateCentralGame (); } /* server bot */ Player_BotAction (serverAction); /* handle game turn */ GameTurn (gameTime, serverGame.players.num, &remainingTeams); /* insert any data received from clients */ InsertClientAction (&serverGame.players, serverAction); /* trigger suicides for disconnected clients */ CheckConnections (); /* send all data on player actions to clients */ Server_SendPlayerAction (gameTime, serverAction); /* record demo data if requested */ if (serverGame.setup.recordDemo) { DemoRecordFrame (gameTime, serverAction); } /* evaluate player action */ (void)GameEvalAction (serverGame.players.num, serverAction); /* update window */ GameUpdateWindow (); } while (gameTime < GAME_TIME && remainingTeams > 0 && (remainingTeams > 1 || NumberOfExplosions () != 0)); /* tell client game is over */ Server_FinishPlayerAction (gameTime + 1); /* check/reset away flags, make away bots */ Player_CheckLocalAway (); /* now update away flag for local players */ away = Player_CheckLocalBot (); /* calc last team for async check, do not store yet */ LevelResult (gameTime, &lastTeam, serverGame.players.num, level, XBFalse); /* count number of players in winner team */ if (lastTeam <= MAX_PLAYER) { for (ps = player_stat, counter = 1; ps < player_stat + serverGame.players.num; ps++, counter++) { if (ps->team == lastTeam) { winner = counter; } } } /* finish demo file if requested */ if (serverGame.setup.recordDemo) { DemoFinishLevel (gameTime, winner, "s"); } Dbg_Game ("waiting for clients to send winner\n"); Server_ReceiveWinnerTeam (0, lastTeam); WaitForClientEvent (XBNW_SyncLevelResult, XBTrue); /* determine active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); if (teamActive <= 1) { GUI_ErrorMessage ("Only one team left after async check!"); goto Exit; } async = Server_LevelAsync (); if (async) { Dbg_Game ("async result determined, informing clients!\n"); Server_SendLevelAsync (); GUI_ErrorMessage ("Async level, making it a draw\n"); lastTeam = MAX_PLAYER; } else { Dbg_Game ("results sync, informing clients!\n"); Server_SendLevelSync (); /* now store the level result */ msg = LevelResult (gameTime, &lastTeam, serverGame.players.num, level, XBTrue); if (!LevelEnd (serverGame.players.num, lastTeam, msg, away ? -1 : 1)) { lastTeam = -1; } } Exit: /* stop music if necessary */ if (serverGame.setup.Music) { SND_Stop (serverGame.setup.Music); } FinishLevel (); DeleteAllExplosions (); /* fade out image */ DoFade (XBFM_BLACK_OUT, PIXH + 1); /* that's all */ return lastTeam; } /* ServerRunLevel */ /* * send level data to clients */ static XBBool SendLevelToClients (const DBRoot ** level) { int okay = MAX_REJECTS; /* send level data to clients */ while (okay > 0) { *level = LoadLevelFile (GetNextLevel ()); Dbg_Game ("Proposed level is: %s\n", GetLevelName (*level)); Server_SendLevel (*level); Server_ClearLevelStatus (); Server_SetLevelStatus (0, XBTrue); WaitForClientEvent (XBNW_LevelConfig, XBTrue); if (Server_LevelApproved ()) { Dbg_Game ("Level accepted by all clients\n"); /* now set and send fresh random seed so that it arrives before the activate */ SeedRandom (time (NULL)); Server_SendRandomSeed (); Server_SendLevelActivate (); Dbg_Game ("negotiations finished, proceeding\n"); return (0); } else { okay--; Dbg_Game ("Level rejected (%i attempt(s) remaining)\n", okay); Server_SendLevelReset (); } } Dbg_Game ("negotiations failed!\n"); return (-1); } /* SendLevelToClients */ /* * run the game as server */ void RunServerGame (void) { const DBRoot *level; int lastTeam, winner, maxNumWins; int i; CFGCentralSetup central; /* get setup */ if (!RetrieveGame (CT_Remote, SERVERGAMECONFIG, &serverGame)) { Dbg_Game ("failed to get game setup!\n"); goto Disconnect; } /* select levels to play */ if (!InitLevels (&serverGame)) { Dbg_Game ("failed to initialize levels!\n"); goto Disconnect; } /* common inits */ if (!InitGame (XBPH_Server, CT_Remote, &serverGame, serverAction)) { Dbg_Game ("failed to initialize game!\n"); goto Disconnect; } /* local data */ maxNumWins = 0; winner = -1; numActive = 0; teamActive = 0; away = Player_CheckLocalBot (); Dbg_Game ("server game initialized\n"); /* mark external hosts */ InitPlayerLink (); /* wait for clients to initialize game */ Dbg_Game ("waiting for clients to init game\n"); SyncWithClients (XBNW_SyncEndOfInit, XBFalse, XBFalse); Dbg_Game ("clients have initialized game\n"); /* determine active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); if (teamActive <= 1) { GUI_ErrorMessage ("Only one team left after game init!"); goto Disconnect; } /* Connect to central */ if (serverGame.setup.rated) { SetMessage ("Connecting to central...", XBTrue); Dbg_Game ("rated game requested\n"); RetrieveCentralSetup (¢ral); if (User_Connect (¢ral)) { Dbg_Game ("Connection to central established\n"); } else { Dbg_Game ("failed to establish connection to central, unrated game\n"); } } else { Dbg_Game ("unrated game requested\n"); } /* play levels */ do { /* negotiate next level */ if (SendLevelToClients (&level) == -1) { GUI_ErrorMessage ("Level negotiations failed!"); goto Exit; } /* update active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); if (teamActive <= 1) { GUI_ErrorMessage ("Only one team left after level negotiation!"); goto Exit; } /* play level */ lastTeam = ServerRunLevel (teamActive, level); /* check for quick exit */ if (-1 == lastTeam) { Dbg_Game ("server aborted game\n"); goto Exit; } /* update current winner */ Dbg_Game ("team #%i won the level\n", lastTeam); for (i = 0; i < serverGame.players.num; i++) { if (player_stat[i].victories > maxNumWins) { maxNumWins = player_stat[i].victories; winner = i; } } /* wait for clients to reach level end */ Dbg_Game ("waiting for clients to show level end\n"); SyncWithClients (XBNW_SyncLevelEnd, XBFalse, XBTrue); Dbg_Game ("waiting for clients to show level end\n"); /* update active players/teams */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); if (teamActive <= 1) { GUI_ErrorMessage ("Only one team left after level-end sync!"); goto Exit; } /* send level stats to central if rated game */ if (User_Connected ()) { Dbg_Game ("sending level results to central\n"); User_SendGameStat (serverGame.players.num, player_stat, pa); } else { Dbg_Game ("connection to central has broken down, no more ratings will be sent\n"); } /* show scores */ if (!ShowScoreBoard (lastTeam, maxNumWins, serverGame.players.num, player_stat, away ? -1 : 1)) { Dbg_Game ("game exit during Scoreboard\n"); goto Exit; } /* wait for clients to show scoreboard */ Dbg_Game ("waiting for clients to show score\n"); SyncWithClients (XBNW_SyncScoreboard, XBFalse, XBTrue); Dbg_Game ("clients show score\n"); /* determine number of active players */ UpdatePlayerLink (); GetActivePlayers (pa, &numActive, &teamActive); } while (numActive > 1 && teamActive > 1 && maxNumWins < serverGame.setup.numWins); /* and the winner is ... */ if (maxNumWins >= serverGame.setup.numWins) { Dbg_Game ("team #%i won the game!\n", winner); if (User_Connected ()) { Dbg_Game ("Sending final game result to central\n"); for (i = 0; i < serverGame.players.num; i++) { pa[i] = 1; if (player_stat[i].victories == serverGame.setup.numWins) { player_stat[i].lives = -player_stat[i].victories; } else { player_stat[i].lives = player_stat[i].victories; } } User_SendGameStat (-serverGame.players.num, player_stat, pa); } /* determine and show winner */ InitWinner (serverGame.players.num); ShowWinner (lastTeam, serverGame.players.num, player_stat); } else { Dbg_Game ("game finished, too few players - current winner %i\n", winner); GUI_ErrorMessage ("Not enough players/teams left in the game"); } Exit: FinishGame (&serverGame); Disconnect: Dbg_Game ("disconnecting all clients\n"); Server_SendDisconnectAll (); if (User_Connected ()) { Dbg_Game ("disconnecting result link to central\n"); User_SendDisconnect (); User_Disconnect (); } Dbg_Game ("closing game entry in central\n"); Server_CloseNewGame (); return; } /* StartServerGame */ /* * end of file game_server.c */ xblast-2.10.4/game_server.h0000644000175000017500000000203510051114301014642 0ustar rhondaalfie/* * file game_server.h - run game as server * * $Id: game_server.h,v 1.3 2004/05/14 10:00:33 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GAME_SERVER_H #define XBLAST_GAME_SERVER_H /* * global prototypes */ extern void RunServerGame (void); #endif /* * end of file game_server.h */ xblast-2.10.4/geom.h0000644000175000017500000000317210372731124013313 0ustar rhondaalfie/* * file geom.h - * * $Id: geom.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GEOM_H #define _GEOM_H #ifdef MINI_XBLAST #define BASE_X 4 #define BASE_Y 3 #endif /* Base Step in X direction */ #ifndef BASE_X #define BASE_X 8 #endif /* Base Step in Y direction */ #ifndef BASE_Y #define BASE_Y 6 #endif /* size of map tiles */ #define BLOCK_WIDTH (8*BASE_X) #define BLOCK_HEIGHT (8*BASE_Y) /* size of elements in status */ #define STAT_WIDTH (6*BASE_X) #define STAT_HEIGHT (8*BASE_Y) /* size of leds in status displays */ #define LED_WIDTH (2*BASE_X) #define LED_HEIGHT (8*BASE_Y/3) /* some window dimensions */ #define PIXW (MAZE_W * BLOCK_WIDTH) #define PIXH (MAZE_H * BLOCK_HEIGHT) #ifdef SMPF #define SCOREH (STAT_HEIGHT*3+LED_HEIGHT) // SMPF chat #else #define SCOREH (STAT_HEIGHT*2+LED_HEIGHT) // chat #endif #endif /* * */ xblast-2.10.4/gui.h0000644000175000017500000001253110377700543013155 0ustar rhondaalfie/* * file gui.h - interface for system dependent graphics engine * * $Id: gui.h,v 1.10 2006/02/24 21:57:55 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_GUI_H #define XBLAST_GUI_H /* * constants */ /* font flags */ #define FF_Large 0x00 #define FF_Medium 0x01 #define FF_Small 0x02 #define FF_Black 0x00 #define FF_White 0x04 #define FF_Boxed 0x08 #define FF_Transparent 0x10 #define FF_Outlined 0x20 #define FF_Center 0x00 #define FF_Left 0x40 #define FF_Right 0x80 #define FF_Vertical 0x100 #define FF_Cursor 0x200 /* font flag mask */ #define FM_Size 0x03 #define FM_Color 0x04 #define FM_Boxed 0x08 #define FM_Transparent 0x10 #define FM_Outlined 0x20 #define FM_Align 0xC0 /* * types */ typedef enum { KB_NONE, /* no keyboard events are generated */ KB_CHAT, /* uses chat keymapping */ KB_MENU, /* uses XBlast chat+menu keymapping */ KB_XBLAST, /* uses XBlast chat+game keymapping */ KB_KEYSYM, /* return string with keysymbol name (for text editor) */ KB_ASCII /* return ascii-value or control key (for keyboard config ) */ } XBKeyboardMode; typedef enum { XBFM_IN, /* blend in current pixmap */ XBFM_BLACK_OUT, /* fade out current image to black */ XBFM_WHITE_OUT /* fade out current image to white */ } XBFadeMode; typedef void (*XBPollFunction) (const struct timeval *); typedef void (*XBQuitFunction) (void); /* * prototypes */ /* init */ extern XBBool GUI_Init (int argc, char *argv[]); extern void GUI_Finish (void); extern void GUI_OnQuit (XBQuitFunction quitFunc); /* event */ extern void GUI_UpdateKeyTables (void); extern void GUI_SetTimer (long msec, XBBool periodic); extern void GUI_SetKeyboardMode (XBKeyboardMode _mode); extern void GUI_SetMouseMode (XBBool _enable); extern XBEventCode GUI_WaitEvent (XBEventData * data); extern XBEventCode GUI_PeekEvent (XBEventData * data); extern void GUI_SendEventValue (XBEventCode code, int value); extern void GUI_SendEventPointer (XBEventCode code, void *pointer); extern void GUI_Sync (void); extern void GUI_Bell (void); extern int GUI_NumJoysticks (void); extern void GUI_AddPollFunction (XBPollFunction func); extern void GUI_SubtractPollFunction (XBPollFunction func); extern void GUI_ShowCursor(XBBool enable); /* pixmap */ extern void GUI_AddMazeRectangle (int x, int y); extern void GUI_AddStatRectangle (int x, int y); extern void GUI_AddChatRectangle (int x, int y); extern void GUI_AddTilesRectangle (int x, int y); extern void GUI_FlushPixmap (XBBool flag); extern void GUI_FlushScoreBoard (void); extern void GUI_ClearPixmap (void); extern void GUI_InitFade (XBFadeMode mode, int maxLines); extern XBBool GUI_DoFade (void); /* sprite */ extern XBBool GUI_LoadPlayerSprite (int player, int anime, const CFGPlayerGraphics * config); extern void GUI_LoadIconSprite (int index, XBColor color); extern void GUI_DrawExplosionSprite (int x, int y, int block); extern void GUI_DrawPlayerSprite (const Sprite * spl); extern void GUI_DrawBombSprite (const Sprite * spl); extern void GUI_DrawIconSprite (const Sprite * spl); extern void GUI_DrawTextSprite (const Sprite * spl); /* text */ extern void GUI_DrawSimpleTextbox (const char *text, unsigned flags, const BMRectangle * rect); extern void GUI_DrawTextbox (const char *text, unsigned flags, const BMRectangle * rect); extern void GUI_DrawPolygon (int x, int y, int w, int h, int lw, const BMPoint * points, int npoints, XBBool black_white); /* tile */ extern void GUI_DrawBlock (int x, int y, int block); extern void GUI_DrawExplosion (int x, int y, int block); extern void GUI_FlushBlocks (void); extern void GUI_InitExplosionBlocks (void); extern void GUI_LoadBlockRgb (int id, const char *name); extern void GUI_LoadBlockCch (int id, const char *name, XBColor fg, XBColor bg, XBColor add); extern void GUI_FreeBlock (int block); extern void GUI_FreeExplosionBlocks (void); extern void GUI_LoadPlayerScoreTiles (int player, const CFGPlayerGraphics * config); extern void GUI_DrawScoreBlock (int x, int y, int block); extern void GUI_DrawTimeLed (int x, int block); /* atoms */ extern XBBool GUI_InitAtoms (void); extern XBAtom GUI_StringToAtom (const char *); extern XBAtom GUI_FormatToAtom (const char *, ...); extern XBAtom GUI_IntToAtom (int); extern const char *GUI_AtomToString (XBAtom); extern int GUI_AtomToInt (XBAtom); /* config */ extern void GUI_LoadConfig (void); extern void GUI_SaveConfig (void); extern void GUI_FinishConfig (void); /* message boxes */ extern void GUI_ErrorMessage (const char *fmt, ...); /* images */ extern XBColor GUI_ParseColor (const char *name); #endif /* * end of file gui.h */ xblast-2.10.4/image.c0000644000175000017500000002426210372731124013444 0ustar rhondaalfie/* * file image.c - maige filenames and sizes * * $Id: image.c,v 1.10 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct _shape_list ShapeList; struct _shape_list { char *name; XBBool valid; ShapeList *next; }; /* * global variables */ /* search paths */ #ifdef WMS #define GAME_DATADIR "." #endif const char *imgPathBlock = GAME_DATADIR "/image/block"; const char *imgPathExpl = GAME_DATADIR "/image/explosion"; const char *imgPathMisc = GAME_DATADIR "/image/misc"; const char *imgPathScore = GAME_DATADIR "/image/score"; const char *imgPathSprite = GAME_DATADIR "/image/sprite"; /* background pixmaps */ const char *imgFileTitle = "title"; const char *imgFileTextBg = "text_bg"; const char *imgFileTextFg = "text_fg"; /* score board leds */ const char *imgFileScoreLed[] = { "led_off", "led_on", }; /* score board tiles */ const char *imgFileScoreTile[] = { "tile_void", "text_left", "text_middle", "text_right", }; /* score player stats */ const char *imgFileScorePlayer[] = { "player_dead", "player_sick", "player", "player_abort", "player_sick_abort", }; /* bomb images */ const char *imgFileBomb[MAX_BOMBS][MAX_BOMB_ANIME] = { { "bomb_0", "bomb_1", "bomb_2", "bomb_3", "bomb_4", "bomb_5", "bomb_6", "bomb_7", "bomb_8", "bomb_9", "bomb_10", "bomb_11", "bomb_12", "bomb_13", "bomb_14", "bomb_15", "bomb_x", }, { "mini_0", "mini_1", "mini_2", "mini_3", "mini_4", "mini_5", "mini_6", "mini_7", "mini_8", "mini_9", "mini_10", "mini_11", "mini_12", "mini_13", "mini_14", "mini_15", "mini_x", }, }; /* explosions image */ const char *imgFileExpl[MAX_EXPLOSION] = { "expl00", "expl01", "expl02", "expl03", "expl04", "expl05", "expl06", "expl07", "expl08", "expl09", "expl0a", "expl0b", "expl0c", "expl0d", "expl0e", "expl0f", }; /* * offset and size data for sprites */ const BMRectangle imgRectSprite[MAX_ANIME] = { /* down */ {0, 3 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 3 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 3 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 3 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 3 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, /* up */ {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, /* right */ {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, /* left */ {0, 4 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, /* damaged */ {0, (4 - 1) * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, {1 * BASE_X, 6 * BASE_Y, 8 * BASE_X, 10 * BASE_Y}, {0, (7 + 1) * BASE_Y, 8 * BASE_X, 8 * BASE_Y}, {-1 * BASE_X, 6 * BASE_Y, 8 * BASE_X, 10 * BASE_Y}, /* looser */ {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 4 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, /* winner */ {0, 2 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 2 * BASE_Y, 8 * BASE_X, 13 * BASE_Y}, {0, 3 * BASE_Y, 8 * BASE_X, 12 * BASE_Y}, /* big winner */ {-4 * BASE_X, (-8 + 5) * BASE_Y, 16 * BASE_X, 25 * BASE_Y}, /* skeleton */ {0, 5 * BASE_Y, 8 * BASE_X, 10 * BASE_Y}, {0, 5 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, {0, 5 * BASE_Y, 8 * BASE_X, 9 * BASE_Y}, {0, 5 * BASE_Y, 8 * BASE_X, 11 * BASE_Y}, /* morphed eyes */ {0, 7 * BASE_Y, 8 * BASE_X, 8 * BASE_Y}, {0, 5 * BASE_Y, 8 * BASE_X, 10 * BASE_Y}, /* zombie */ }; /* epm file formats */ static const char *imgFileSpriteEpm[MAX_ANIME_EPM] = { /* looking down */ "%s_D_S", "%s_D_0", "%s_D_1", "%s_D_2", "%s_D_3", /* looking up */ "%s_U_S", "%s_U_0", "%s_U_1", "%s_U_2", "%s_U_3", /* looking right */ "%s_R_S", "%s_R_0", "%s_R_1", "%s_R_2", "%s_R_3", /* looking left */ "%s_L_S", "%s_L_0", "%s_L_1", "%s_L_2", "%s_L_3", /* damaged player */ "%s_DD", "%s_DL", "%s_DU", "%s_DR", /* loosing player */ "%s_L", "%s_L1", "%s_L2", /* winning player */ "%s_W", "%s_W2", "%s_W3", /* big winning player */ "%s_B", }; const char *imgFileSpritePpm[MAX_ANIME_PPM] = { /* skeleton */ "skel_D", "skel_L", "skel_U", "skel_R", /* morphed player (eyes only) */ "morph", "zombie", }; /* icon sprites */ const char *imgFileIcon[MAX_ICON_SPRITES] = { /* 6 color sprites */ "icon_color", "icon_color", "icon_color", "icon_color", "icon_color", "icon_color", /* other icons */ "icon_led_on", "icon_led_off", "icon_abort", "icon_default", /* team icons */ "icon_led_off", "icon_led_on", "icon_led_on", "icon_led_on", }; const BMRectangle imgRectIcon[MAX_ICON_SPRITES] = { /* 6 color sprite */ {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, {BASE_X, BASE_Y, 6 * BASE_X, 6 * BASE_Y,}, /* other icons */ {5 * BASE_X / 2, 3 * BASE_Y, 3 * BASE_X, 3 * BASE_Y,}, {5 * BASE_X / 2, 3 * BASE_Y, 3 * BASE_X, 3 * BASE_Y,}, {BASE_X, 2 * BASE_Y, 6 * BASE_X, 5 * BASE_Y,}, {BASE_X, 2 * BASE_Y, 6 * BASE_X, 5 * BASE_Y,}, }; /* * local variables */ /* shapes */ static int numShapes = 0; static XBAtom *shapeTable = NULL; /* * create list with possible shapes */ static ShapeList * CreateShapeList (const XBDir * epmList) { const char *s; int len; const XBDir *ptr; ShapeList *item; ShapeList *list = NULL; for (ptr = epmList; ptr != NULL; ptr = ptr->next) { s = strstr (ptr->name, "_B"); if (NULL != s) { len = s - ptr->name; /* found big player sprite */ item = calloc (1, sizeof (ShapeList)); assert (item != NULL); item->valid = XBTrue; item->name = calloc (len + 1, sizeof (char)); strncpy (item->name, ptr->name, len); /* add to list */ item->next = list; list = item; } } return list; } /* CreateShapeList */ /* * check for invalid items in shape list */ static void CheckShapeList (ShapeList * list, const XBDir * epmList) { int i; const XBDir *ptr; ShapeList *item; char fileName[80]; XBBool valid; for (item = list; item != NULL; item = item->next) { for (i = 0; i < MAX_ANIME_EPM; i++) { sprintf (fileName, imgFileSpriteEpm[i], item->name); valid = XBFalse; for (ptr = epmList; ptr != NULL; ptr = ptr->next) { if (0 == strcmp (fileName, ptr->name)) { valid = XBTrue; break; } } if (!valid) { item->valid = XBFalse; break; } } } } /* CheckShapeList */ /* * */ static XBAtom * CreateShapeArray (const ShapeList * list, int *pNum) { int i; XBAtom *table; const ShapeList *item; assert (pNum != NULL); *pNum = 0; for (item = list; item != NULL; item = item->next) { if (item->valid) { *pNum = *pNum + 1; } } if (0 == *pNum) { return NULL; } table = calloc (*pNum, sizeof (XBAtom)); assert (table != NULL); i = 0; #ifdef DEBUG fprintf (stderr, "found shape:"); #endif for (item = list; item != NULL; item = item->next) { if (item->valid) { #ifdef DEBUG fputc (' ', stderr); fputs (item->name, stderr); #endif table[i] = GUI_StringToAtom (item->name); } i++; } #ifdef DEBUG fputc ('\n', stderr); #endif return table; } /* CreateShapeArray */ /* * Delete shape list */ static void DeleteShapeList (ShapeList * list) { ShapeList *item, *itemNext; for (item = list; item != NULL; item = itemNext) { itemNext = item->next; free (item->name); free (item); } } /* DeleteShapeList */ /* * inititalize valid player shapes */ static XBAtom * InitShapes (int *pNum) { XBDir *epmList; XBDir *pbmList; ShapeList *list = NULL; XBAtom *table; #ifdef DEBUG Dbg_StartClock (); #endif epmList = CreateFileList (GAME_DATADIR "/image/sprite", "epm", XBFalse); pbmList = CreateFileList (GAME_DATADIR "/image/sprite", "pbm", XBFalse); /* find possible shapes */ list = CreateShapeList (epmList); /* check them */ CheckShapeList (list, epmList); CheckShapeList (list, pbmList); /* create array and delete list */ table = CreateShapeArray (list, pNum); /* delete list */ DeleteShapeList (list); /* delete file list */ DeleteFileList (epmList); DeleteFileList (pbmList); #ifdef DEBUG fprintf (stderr, "load shapes: %lu msec\n", Dbg_FinishClock ()); #endif return table; } /* InitShapes */ /* * convert shape name to existing shape */ static const char * ShapeToName (XBAtom shape) { int i; if (NULL == shapeTable) { shapeTable = InitShapes (&numShapes); } assert (shapeTable != NULL); for (i = 0; i < numShapes; i++) { if (shape == shapeTable[i]) { return GUI_AtomToString (shape); } } return "normal"; } /* NameToShape */ /* * create name for sprite */ const char * ImgFileSpriteEpm (XBAtom shape, int anime) { static char tmp[80]; assert (shape != ATOM_INVALID); assert (anime >= 0); assert (anime < MAX_ANIME_EPM); sprintf (tmp, imgFileSpriteEpm[anime], ShapeToName (shape)); return tmp; } /* ImgFileSpriteEpm */ /* * list all shapes */ const XBAtom * GetShapeList (int *pNum) { if (NULL == shapeTable) { shapeTable = InitShapes (&numShapes); } assert (shapeTable != NULL); *pNum = numShapes; return shapeTable; } /* GetShapeList */ /* * delete shape list */ void ClearShapeList (void) { if (NULL != shapeTable) { free (shapeTable); shapeTable = NULL; numShapes = 0; } } /* ClearShapeList */ /* * end of file x11c_data.c */ xblast-2.10.4/image.h0000644000175000017500000000362510372731124013451 0ustar rhondaalfie/* * file image.h - sprite image siizes etc * * $Id: image.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _IMAGE_H #define _IMAGE_H /* * some constants */ #define MAX_BOMBS 2 /* * external variables */ /* search path */ extern const char *imgPathBlock; extern const char *imgPathExpl; extern const char *imgPathMisc; extern const char *imgPathScore; extern const char *imgPathSprite; /* file names */ extern const char *imgFileTitle; extern const char *imgFileTextBg, *imgFileTextFg; extern const char *imgFileScoreLed[2]; extern const char *imgFileScoreTile[]; extern const char *imgFileScorePlayer[]; extern const char *imgFileExpl[MAX_EXPLOSION]; extern const char *imgFileBomb[MAX_BOMBS][MAX_BOMB_ANIME]; extern const char *imgFileSpritePpm[MAX_ANIME_PPM]; extern const char *imgFileIcon[MAX_ICON_SPRITES]; /* sprite regions */ extern const BMRectangle imgRectSprite[MAX_ANIME]; extern const BMRectangle imgRectIcon[MAX_ICON_SPRITES]; /* * global prototypes */ extern const char *ImgFileSpriteEpm (XBAtom shape, int anime); extern const XBAtom *GetShapeList (int *pNum); extern void ClearShapeList (void); #endif /* * end of file image.h */ xblast-2.10.4/info.c0000644000175000017500000001222510412220337013303 0ustar rhondaalfie/* * file info.c - display info at level start * * $Id: info.c,v 1.11 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define MAX_INFO 7 #define INFO_LENGTH 256 /* * local variables */ static int levelCount; static int extraCount; static int playerCount; static char **levelInfo = NULL; static char **extraInfo = NULL; static char **playerInfo = NULL; static unsigned gameMode; /* * allocate space for info entries */ static char ** AllocInfo (void) { char **ptr; int i; ptr = (char **)calloc (MAX_INFO, sizeof (char *)); assert (NULL != ptr); for (i = 0; i < MAX_INFO; i++) { ptr[i] = calloc (INFO_LENGTH, sizeof (char)); assert (NULL != ptr[i]); } return ptr; } /* AllocInfo */ /* * free info memory */ static void FreeInfo (char **ptr) { int i; assert (ptr != NULL); for (i = 0; i < MAX_INFO; i++) { assert (ptr[i] != NULL); free (ptr[i]); } free (ptr); } /* FreeInfo */ /* * clear alloc info data */ void ClearInfo (void) { if (NULL != extraInfo) { FreeInfo (extraInfo); extraInfo = NULL; } if (NULL != levelInfo) { FreeInfo (levelInfo); levelInfo = NULL; } if (NULL != playerInfo) { FreeInfo (playerInfo); playerInfo = NULL; } } /* ClearInfo */ /* * reset info strings */ void ResetInfo (void) { int i; /* alloc data if needed */ if (NULL == extraInfo) { extraInfo = AllocInfo (); assert (NULL != extraInfo); } if (NULL == levelInfo) { levelInfo = AllocInfo (); assert (NULL != levelInfo); } if (NULL == playerInfo) { playerInfo = AllocInfo (); assert (NULL != playerInfo); } /* set first strings to zero length ones */ for (i = 0; i < MAX_INFO; i++) { levelInfo[i][0] = '\0'; extraInfo[i][0] = '\0'; playerInfo[i][0] = '\0'; } levelCount = 0; extraCount = 0; playerCount = 0; } /* ResetInfo */ /* * parse level info section */ XBBool ParseLevelInfo (const DBSection * section, DBSection * warn) { const char *g; unsigned i; static const char *gameModeString = "R23456STDL"; /* reseting */ ResetInfo (); /* check if section exists */ if (NULL == section) { Dbg_Out ("LEVEL: info section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* extract gameMode */ gameMode = 0; /* game mode entry is required */ if (!DB_GetEntryString (section, atomGameMode, &g)) { Dbg_Out ("LEVEL: game mode is missing!\n"); DB_CreateEntryString (warn, atomGameMode, "missing!"); return XBFalse; } /* convert to unsigned */ for (i = 0; g[i] != 0 && gameModeString[i] != 0; i++) { if (g[i] == gameModeString[i]) { gameMode |= (1 << i); } } Dbg_Level ("gameMode = %s, converted to %u\n", g, gameMode); return XBTrue; } /* ParseLevelInfo */ /* * add a generic info line */ static void AddInfo (char **info, int *count, const char *fmt, va_list argList) { /* sanity check */ assert (count != NULL); assert (info != NULL); /* do we have any space left */ /* BUGFIX1 */ if (*count >= MAX_INFO) { return; } /* 1BUGFIX */ assert (info[*count] != NULL); assert (fmt != NULL); /* add text */ vsprintf (info[*count], gettext(fmt), argList); /* next line */ *count = *count + 1; } /* AddInfo */ /* * add player info */ void AddPlayerInfo (const char *fmt, ...) { va_list argList; va_start (argList, fmt); AddInfo (playerInfo, &playerCount, fmt, argList); va_end (argList); } /* AddPlayerInfo */ /* * add level info */ void AddLevelInfo (const char *fmt, ...) { va_list argList; va_start (argList, fmt); AddInfo (levelInfo, &levelCount, fmt, argList); va_end (argList); } /* AddLevelInfo */ /* * add extra info */ void AddExtraInfo (const char *fmt, ...) { va_list argList; va_start (argList, fmt); AddInfo (extraInfo, &extraCount, fmt, argList); va_end (argList); } /* AddExtraInfo */ /* * */ const char ** GetPlayerInfo (int *pNum) { assert (pNum != NULL); *pNum = playerCount; return (const char **)playerInfo; } /* GetPlayerInfo */ /* * */ const char ** GetLevelInfo (int *pNum) { assert (pNum != NULL); *pNum = levelCount; return (const char **)levelInfo; } /* GetLevelInfo */ /* * */ const char ** GetExtraInfo (int *pNum) { assert (pNum != NULL); *pNum = extraCount; return (const char **)extraInfo; } /* GetExtraInfo */ /* * get current gamemode */ unsigned GetGameModeInfo (void) { return gameMode; } /* GetGameModeInfo */ /* * end of file info.c */ xblast-2.10.4/info.h0000644000175000017500000000263210373126076013324 0ustar rhondaalfie/* * file info.h - display info at level start * * $Id: info.h,v 1.9 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INFO_H #define _INFO_H /* * prototypes */ extern void ResetInfo (void); extern XBBool ParseLevelInfo (const DBSection * section, DBSection * warn); extern void ClearInfo (void); extern void AddPlayerInfo (const char *fmt, ...); extern void AddLevelInfo (const char *fmt, ...); extern void AddExtraInfo (const char *fmt, ...); extern const char **GetPlayerInfo (int *pNum); extern const char **GetLevelInfo (int *pNum); extern const char **GetExtraInfo (int *pNum); extern unsigned GetGameModeInfo (void); #endif /* * end of file info.h */ xblast-2.10.4/ini_file.c0000644000175000017500000010137310416756320014143 0ustar rhondaalfie/* * file ini_file.h - parsing ini-file into a database * * $Id: ini_file.c,v 1.25 2006/04/11 16:44:00 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ /* single entry */ struct _db_entry { XBAtom atom; /* atom for entry key */ char *value; /* string value of key */ struct _db_entry *next; /* next entry for this section */ }; /* one complete section */ struct _db_section { XBAtom atom; /* name atom of section -> [...] line in file */ XBBool changed; /* flag for unsaved changes in section */ DBEntry *entry; /* list of entries */ struct _db_section *next; /* next section in this database */ }; /* one database */ struct _db_root { DBType type; /* in which list is database stored -> dirname */ XBAtom atom; /* name atom for database -> filename */ XBBool changed; /* flag for changes */ DBSection *section; /* pointer to sections */ DBRoot *next; /* next database of this type */ }; /* * local variables */ /* database lists */ static DBRoot *db_list[NUM_DT] = { NULL, NULL, NULL, NULL, }; /* paths for database file */ static const char *db_path[NUM_DT] = { "config", GAME_DATADIR "/level", "demo", "central", }; /* file extensions */ static const char *db_ext[NUM_DT] = { "cfg", "xal", "dem", "dat", }; /******************* * local functions * *******************/ /* free memory of defined structures */ /* * free memory of an entry */ static void FreeEntry (DBEntry * entry) { assert (entry != NULL); assert (entry->value != NULL); free (entry->value); free (entry); } /* FreeEntry */ /* * free memory of a section and all its entries */ static void FreeSection (DBSection * section) { DBEntry *entry; DBEntry *nextEntry; assert (NULL != section); /* clear all entries */ for (entry = section->entry; entry != NULL; entry = nextEntry) { nextEntry = entry->next; FreeEntry (entry); } free (section); } /* FreeSection */ /* * free memory of a given database */ static void FreeRoot (DBRoot * db) { DBSection *section; DBSection *nextSection; assert (db != NULL); /* clear all sections */ for (section = db->section; section != NULL; section = nextSection) { nextSection = section->next; FreeSection (section); } free (db); } /* DB_Delete */ /* parse input lines */ /* * parse section name from given line */ static const char * ParseSection (const char *line) { const char *left; char *dst; static char result[256]; /* check left side */ for (left = line; *left != 0 && isspace ((unsigned char)*left); left++) continue; if (*left != '[') { return NULL; } left++; dst = result; while (*left != ']') { if ('\0' == *left) { /* premature end of line */ return NULL; } *dst = *left; dst++; left++; } *dst = '\0'; return result; } /* ParseSection */ /* * parse key part from a given line */ static const char * ParseEntryName (const char *line) { const char *src; char *dst; static char result[256]; src = line; dst = result; while (*src != '=') { if ('\0' == *src) { /* premature end of line */ return NULL; } *dst = *src; dst++; src++; } *dst = '\0'; return result; } /* ParseEntryName */ /* * return pointer to a named entry in given section */ static const DBEntry * GetEntry (const DBSection * section, XBAtom atom) { const DBEntry *ptr; assert (section != NULL); /* find entry */ for (ptr = section->entry; ptr != NULL; ptr = ptr->next) { if (ptr->atom == atom) { return ptr; } } return NULL; } /* GetEntry */ /* * return if character is eol * External level files could also come from windows environment, * where '\r' can be considered an EOL char for ini-file purposes. */ static int XB_iniEOL (char c) { switch (c) { case '\n': /* FALLTHRU */ case '\r': return 1; default: return 0; } } /* XB_iniEOL */ /* * parse the entry value part of a line */ static const char * ParseEntryValue (const char *line) { const char *src; char *dst; static char result[256]; dst = result; src = strchr (line, '='); if (NULL == src) { return NULL; } src++; while (isspace ((unsigned char)*src)) { src++; } while ((!XB_iniEOL (*src)) && (*src != '\0')) { *dst = *src; dst++; src++; } while (isspace ((unsigned char)*(dst - 1))) { --dst; } *dst = 0; return result; } /* ParseEntryValue */ /* file operations */ /* * open file corresponding to given database */ static FILE * OpenDBFile (const DBRoot * db, const char *mode) { char db_name[320]; assert (NULL != db); assert (NULL != mode); /* add index for demos */ sprintf (db_name, "%s", GUI_AtomToString (db->atom)); return FileOpen (db_path[db->type], db_name, db_ext[db->type], mode); } /* OpenDBFile */ /* * check if file directory database must be updated */ static XBBool CheckInsertFile (const DBRoot * db, const char *name, XBAtom timeAtom, time_t mtime) { const DBSection *section; time_t ltime; /* does file exist as section name in database */ section = DB_GetSection (db, GUI_StringToAtom (name)); if (NULL == section) { return XBFalse; } /* has the file been modified */ if (!DB_GetEntryTime (section, timeAtom, <ime) || ltime != mtime) { return XBFalse; } /* file entry exists and is up-to-date */ return XBTrue; } /* CheckInsertFile */ /* * insert file into database */ static XBBool InsertFile (DBRoot * db, DBType type, const char *name, XBAtom timeAtom, time_t mtime, XBAtom fromAtom, DBLoadDirFunc func) { DBRoot *dbFile = NULL; DBSection *toSection = NULL; const DBSection *fromSection = NULL; const DBEntry *entry = NULL; XBAtom toAtom = GUI_StringToAtom (name); /* try to load file type/name.ext into a temp database */ dbFile = DB_Create (type, toAtom); assert (dbFile != NULL); if (!DB_Load (dbFile)) { goto Error; } /* try to find given section */ fromSection = DB_GetSection (dbFile, fromAtom); if (NULL == fromSection) { goto Error; } /* create new section for file data */ toSection = DB_CreateSection (db, toAtom); assert (NULL != toSection); /* create entry for file modification time */ DB_CreateEntryTime (toSection, timeAtom, mtime); /* now copy section */ for (entry = fromSection->entry; NULL != entry; entry = entry->next) { (void)DB_CreateEntryString (toSection, entry->atom, entry->value); } /* call user function if any */ if (NULL != func) { (*func) (toSection); } /* clean up */ DB_Delete (dbFile); return XBTrue; Error: if (NULL != dbFile) { DB_Delete (dbFile); } if (NULL != toSection) { DB_DeleteSection (db, toAtom); } return XBFalse; } /* CheckInsertFile */ /* * create named section in given database and mark it changed */ static void UpdateFile (DBRoot * db, const char *name) { DBSection *section = DB_CreateSection (db, GUI_StringToAtom (name)); assert (NULL != section); section->changed = XBTrue; } /* UpdateFile */ /* * delete any unchanged sections */ static XBBool DeleteUnchangedSections (DBRoot * db) { DBSection *ptr; DBSection *next; XBBool deleted = XBFalse; assert (NULL != db); /* delete first section, while unchanged */ while (NULL != db->section && !db->section->changed) { next = db->section->next; FreeSection (db->section); db->section = next; deleted = XBTrue; #ifdef DEBUG putchar ('-'); #endif } /* now proceed with the rest */ if (NULL != db->section) { for (ptr = db->section; ptr != NULL && ptr->next != NULL; ptr = ptr->next) { while (NULL != ptr->next && !ptr->next->changed) { next = ptr->next->next; FreeSection (ptr->next); ptr->next = next; deleted = XBTrue; #ifdef DEBUG putchar ('-'); #endif } } } #ifdef DEBUG fflush (stdout); #endif return deleted; } /* DeleteUnchangedSections */ /************************* * get/set database info * *************************/ /* * create a new database of given type and name */ DBRoot * DB_Create (DBType type, XBAtom atom) { DBRoot *db; assert (ATOM_INVALID != atom); /* create new database */ db = calloc (1, sizeof (DBRoot)); assert (NULL != db); db->atom = atom; db->type = type; db->changed = XBTrue; /* store in list */ db->next = db_list[type]; db_list[type] = db; /* that´s all */ return db; } /* DB_Create */ /* * return pointer of an existing database */ const DBRoot * DB_Get (DBType type, XBAtom atom) { const DBRoot *db; assert (ATOM_INVALID != atom); for (db = db_list[type]; db != NULL; db = db->next) { if (db->atom == atom) { return db; } } return NULL; } /* DB_Get */ /* * get name atom of database (filename) */ XBAtom DB_Atom (const DBRoot * db) { assert (NULL != db); return db->atom; } /* DB_Changed */ /* * check if database has changed */ XBBool DB_Changed (const DBRoot * db) { const DBSection *section; if (db->changed) { return XBTrue; } for (section = db->section; section != NULL; section = section->next) { if (section->changed) { return XBTrue; } } return XBFalse; } /* DB_Changed */ /* * set name atom of given database (filename) */ void DB_SetAtom (DBRoot * db, XBAtom atom) { db->atom = atom; db->changed = XBTrue; } /* DB_SetAtom */ /* * mark given database as unchanged */ static void MarkUnchanged (DBRoot * db) { DBSection *section; /* mark all as unchanged */ db->changed = XBFalse; for (section = db->section; section != NULL; section = section->next) { section->changed = XBFalse; } } /* MarkUnchanged */ /* * delete a given database */ void DB_Delete (DBRoot * db) { DBRoot *ptr; assert (db_list[db->type] != NULL); /* check if first element in list */ if (db_list[db->type] == db) { db_list[db->type] = db_list[db->type]->next; } else { for (ptr = db_list[db->type]; ptr->next != NULL; ptr = ptr->next) { if (db == ptr->next) { ptr->next = db->next; break; } } } FreeRoot (db); } /* DB_Delete */ /************************ * get/set section info * ************************/ /* * create a new section in a given database */ DBSection * DB_CreateSection (DBRoot * db, XBAtom atom) { DBSection *section; /* create new data structure */ assert (NULL != db); assert (ATOM_INVALID != atom); /* try to find section first */ for (section = db->section; section != NULL; section = section->next) { if (section->atom == atom) { return section; } } /* create new section */ db->changed = XBTrue; section = calloc (1, sizeof (DBSection)); assert (NULL != section); section->atom = atom; section->changed = XBTrue; /* store in database */ section->next = db->section; db->section = section; /* that´s all */ return section; } /* DB_CreateSection */ /* * return pointer to a named section in given database */ DBSection * DB_GetSection (const DBRoot * db, XBAtom atom) { DBSection *ptr; assert (NULL != db); assert (ATOM_INVALID != atom); /* find section */ for (ptr = db->section; ptr != NULL; ptr = ptr->next) { if (ptr->atom == atom) { return ptr; } } return NULL; } /* DB_GetSection */ /* * get section atom */ XBAtom DB_SectionAtom (const DBSection * section) { assert (section != NULL); return section->atom; } /* DB_SectionAtom */ /* * get the name of the nth section in given database */ XBAtom DB_IndexSection (const DBRoot * db, int index) { const DBSection *ptr; int num = 0; assert (NULL != db); /* find section */ for (ptr = db->section; ptr != NULL; ptr = ptr->next) { if (num == index) { return ptr->atom; } num++; } return ATOM_INVALID; } /* DB_IndexSection */ /* * number of sections in a given database */ int DB_NumSections (const DBRoot * db) { const DBSection *ptr; int num = 0; assert (NULL != db); /* find section */ for (ptr = db->section; ptr != NULL; ptr = ptr->next) { num++; } return num; } /* DB_NumSections */ /* * delete a section in a given database */ void DB_DeleteSection (DBRoot * db, XBAtom atom) { DBSection *save, *ptr; assert (db != NULL); db->changed = XBTrue; /* do we have any sections ? */ if (NULL == db->section) { return; } assert (ATOM_INVALID != atom); /* it is the first section ? */ if (db->section->atom == atom) { save = db->section; db->section = db->section->next; FreeSection (save); } else { for (ptr = db->section; ptr->next != NULL; ptr = ptr->next) { if (ptr->next->atom == atom) { save = ptr->next; ptr->next = ptr->next->next; FreeSection (save); break; } } } } /* DB_DeleteSection */ /* * delete all sections in a given database */ void DB_DeleteAll (DBRoot * db) { DBSection *save; assert (db != NULL); db->changed = XBTrue; /* do we have any sections ? */ if (NULL == db->section) { return; } while (db->section != NULL) { save = db->section; db->section = db->section->next; FreeSection (save); } } /* DB_DeleteAll */ /************************* * get entry information * *************************/ /* * create a string entry in a given section */ XBBool DB_CreateEntryString (DBSection * section, XBAtom atom, const char *value) { DBEntry *entry; assert (ATOM_INVALID != atom); assert (NULL != section); /* mark as changed */ section->changed = XBTrue; /* try to find entry first */ for (entry = section->entry; entry != NULL; entry = entry->next) { if (entry->atom == atom) { if (NULL != entry->value) { free (entry->value); } entry->value = DupString (value); assert (NULL != entry->value); return XBTrue; } } /* create new data strutcure */ entry = calloc (1, sizeof (DBEntry)); assert (NULL != entry); entry->atom = atom; entry->value = DupString (value); assert (NULL != entry->value); /* store in database */ entry->next = section->entry; section->entry = entry; /* that's all */ return XBTrue; } /* DB_CreateEntryString */ /* * create an atom entry in a given section */ XBBool DB_CreateEntryAtom (DBSection * section, XBAtom atom, XBAtom value) { return DB_CreateEntryString (section, atom, GUI_AtomToString (value)); } /* DB_CreateEntryAtom */ /* * create an integer entry in a given section */ XBBool DB_CreateEntryInt (DBSection * section, XBAtom atom, int value) { char tmp[32]; sprintf (tmp, "%d", value); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryInt */ /* * create a game result entry in a given section */ XBBool DB_CreateEntryGameResult (DBSection * section, XBAtom atom, int score) { char tmp[32]; sprintf (tmp, "%d", score); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntry */ /* * create a player rating entry in a given section */ XBBool DB_CreateEntryPlayerRating (DBSection * section, XBAtom atom, int PID, float rating) { char tmp[32]; sprintf (tmp, "%d %f", PID, rating); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryPlayerRating */ /* * create a bool entry in given section */ XBBool DB_CreateEntryBool (DBSection * section, XBAtom atom, XBBool value) { return DB_CreateEntryString (section, atom, value ? "true" : "false"); } /* DB_CreateEntryBool */ /* * create a color entry in given section */ XBBool DB_CreateEntryColor (DBSection * section, XBAtom atom, XBColor color) { char tmp[32]; sprintf (tmp, "#%02x%02x%02x", GET_RED (color) << 3, GET_GREEN (color) << 3, GET_BLUE (color) << 3); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryColor */ /* * create a time entry in given section */ XBBool DB_CreateEntryTime (DBSection * section, XBAtom atom, time_t value) { char tmp[64]; size_t len; len = sprintf (tmp, "%lu ; %s", value, ctime (&value)); /* cut trailing newline */ tmp[len - 1] = 0; return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryTime */ /* * create a float entry in given section */ XBBool DB_CreateEntryFloat (DBSection * section, XBAtom atom, double value) { char tmp[32]; sprintf (tmp, "%f", value); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryFloat */ /* * create a position entry in given section */ XBBool DB_CreateEntryPos (DBSection * section, XBAtom atom, BMPosition * pValue) { char tmp[64]; sprintf (tmp, "%d %d", pValue->x, pValue->y); return DB_CreateEntryString (section, atom, tmp); } /* DB_CreateEntryPos */ /* * create entry in given section, defined by given key=value line */ XBBool DB_ParseEntry (DBSection * section, const char *line) { const char *entryName; assert (NULL != section); assert (NULL != line); /* parse entry */ if (NULL == (entryName = ParseEntryName (line))) { return XBFalse; } return DB_CreateEntryString (section, GUI_StringToAtom (entryName), ParseEntryValue (line)); } /* DB_ParseEntry */ /* * copy name section/entry from given section to given database */ XBBool DB_CopyEntry (DBRoot * db, const DBSection * section, const XBAtom atom) { DBSection *sec; const DBEntry *ptr; assert (NULL != db); assert (NULL != section); assert (NULL != db); /* try to create section in database */ sec = DB_CreateSection (db, section->atom); if (NULL == sec) { return XBFalse; } /* try to get entry */ ptr = GetEntry (section, atom); if (NULL == ptr) { return XBFalse; } /* now duplicate entry */ return DB_CreateEntryString (sec, atom, ptr->value); } /* DB_CopyEntry */ /* * get the name of the nth entry in given section */ XBAtom DB_IndexEntry (const DBSection * section, int index) { const DBEntry *ptr; int num = 0; assert (NULL != section); /* find section */ for (ptr = section->entry; ptr != NULL; ptr = ptr->next) { if (num == index) { return ptr->atom; } num++; } return ATOM_INVALID; } /* DB_IndexSection */ /* * number of entries in given database */ int DB_NumAllEntries (const DBRoot * db) { const DBSection *sec; int num = 0; assert (NULL != db); for (sec = db->section; sec != NULL; sec = sec->next) { num += DB_NumEntries (sec); } return num; } /* DB_NumAllEntries */ /* * number of entries in given section */ int DB_NumEntries (const DBSection * section) { const DBEntry *ptr; int num = 0; assert (NULL != section); /* find section */ for (ptr = section->entry; ptr != NULL; ptr = ptr->next) { num++; } return num; } /* DB_NumEntries */ /* * get string value for named entry in given section */ XBBool DB_GetEntryString (const DBSection * section, XBAtom atom, const char **pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (entry->value != NULL); *pValue = entry->value; return XBTrue; } /* DB_GetEntryString */ /* * get atom value for named entry in given section */ XBBool DB_GetEntryAtom (const DBSection * section, XBAtom atom, XBAtom * pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); *pValue = GUI_StringToAtom (entry->value); return (ATOM_INVALID != *pValue); } /* DB_GetEntryAtom */ /* * get int value for named entry in given section */ XBBool DB_GetEntryInt (const DBSection * section, XBAtom atom, int *pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); return (1 == sscanf (entry->value, "%d", pValue)) ? XBTrue : XBFalse; } /* DB_GetEntryInt */ /* * get bool value for named entry in given section */ XBBool DB_GetEntryBool (const DBSection * section, XBAtom atom, XBBool * pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); if (0 == strcmp (entry->value, "true")) { *pValue = XBTrue; } else if (0 == strcmp (entry->value, "false")) { *pValue = XBFalse; } else { return XBFalse; } return XBTrue; } /* DB_GetEntryBool */ /* * get color value for named entry in given section */ XBBool DB_GetEntryColor (const DBSection * section, XBAtom atom, XBColor * pValue) { const DBEntry *entry; unsigned red, green, blue; char hash; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); if (4 != sscanf (entry->value, "%c%2X%2X%2X", &hash, &red, &green, &blue)) { return XBFalse; } if (hash != '#') { return XBFalse; } *pValue = SET_COLOR (red >> 3, green >> 3, blue >> 3); return XBTrue; } /* DB_GetEntryColor */ /* * get time value for named entry in given sectiong */ XBBool DB_GetEntryTime (const DBSection * section, XBAtom atom, time_t * pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); return (1 == sscanf (entry->value, "%lu", pValue)) ? XBTrue : XBFalse; } /* DB_GetEntryTime */ /* * get float value for named entry in given section */ XBBool DB_GetEntryFloat (const DBSection * section, XBAtom atom, double *pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); return (1 == sscanf (entry->value, "%lf", pValue)) ? XBTrue : XBFalse; } /* DB_GetEntryFloat */ /* * get position value for named entry in given section */ XBBool DB_GetEntryPos (const DBSection * section, XBAtom atom, BMPosition * pValue) { const DBEntry *entry; assert (pValue != NULL); entry = GetEntry (section, atom); if (NULL == entry) { return XBFalse; } assert (NULL != entry->value); return (2 == sscanf (entry->value, "%hd%hd", &pValue->x, &pValue->y)) ? XBTrue : XBFalse; } /* DB_GetEntryPos */ /* * get string value for named entry in given section and convert to integer */ DBConversionResult DB_ConvertEntryInt (const DBSection * section, XBAtom atom, int *pValue, const DBToInt * convTable) { const DBEntry *entry; const DBToInt *ptr; int cmp; if (NULL == (entry = GetEntry (section, atom))) { return DCR_NoSuchEntry; } assert (convTable != NULL); for (ptr = convTable; ptr->key != NULL; ptr++) { cmp = strcmp (ptr->key, entry->value); if (0 == cmp) { /* match */ assert (pValue != NULL); *pValue = ptr->value; return DCR_Okay; } else if (cmp > 0) { return DCR_Failure; } } return DCR_Failure; } /* DB_ConvertEntryInt */ /* * get string value for named entry in given section and convert to a generic pointer */ DBConversionResult DB_ConvertEntryData (const DBSection * section, XBAtom atom, void **pValue, const DBToData * convTable) { const DBEntry *entry; const DBToData *ptr; int cmp; if (NULL == (entry = GetEntry (section, atom))) { return DCR_NoSuchEntry; } assert (convTable != NULL); for (ptr = convTable; ptr->key != NULL; ptr++) { cmp = strcmp (ptr->key, entry->value); if (0 == cmp) { /* match */ assert (pValue != NULL); *pValue = ptr->value; return DCR_Okay; } else if (cmp > 0) { return DCR_Failure; } } return DCR_Failure; } /* DB_ConvertEntryData */ /* * get string value for named entry in given section and convert to an entry flag number */ DBConversionResult DB_ConvertEntryFlags (const DBSection * section, XBAtom atom, unsigned *pValue, const DBToInt * convTable) { const DBEntry *entry; const DBToInt *ptr; int cmp; int i, argc; char **argv; if (NULL == (entry = GetEntry (section, atom))) { return DCR_NoSuchEntry; } assert (convTable != NULL); assert (pValue != NULL); *pValue = 0; /* split value string */ argv = SplitString (entry->value, &argc); assert (NULL != argv); /* parse list */ for (i = 0; i < argc; i++) { for (ptr = convTable; ptr->key != NULL; ptr++) { cmp = strcmp (ptr->key, argv[i]); if (0 == cmp) { /* match */ *pValue |= ptr->value; break; } else if (cmp > 0) { free ((char *)argv); return DCR_Failure; } } } free ((char *)argv); return DCR_Okay; } /* DB_ConvertEntryFlag */ /* * create a string line for n-th entry in given section, return length */ size_t DB_PrintEntry (char *buffer, const DBSection * section, int index) { const DBEntry *ptr; int num = 0; assert (NULL != buffer); assert (NULL != section); /* find entry */ for (ptr = section->entry; ptr != NULL; ptr = ptr->next) { if (num == index) { return sprintf (buffer, "%s=%s", GUI_AtomToString (ptr->atom), ptr->value); } num++; } /* entry not found */ buffer[0] = 0; return 0; } /* DB_PrintEntry */ /* * add string to sized buffer, fill with x if added string does not fit */ static XBBool AddStringToBuffer (char *buf, size_t len, const char *add) { int i, nul, write; /* sanity checks */ assert (NULL != buf); assert (NULL != add); /* find first null byte */ nul = -1; for (i = 0; (i < len) && (nul < 0); i++) { if (0 == *(buf + i)) { nul = i; } } /* check if buffer is full */ if (nul == len - 1) { return XBFalse; } /* check if there is a null byte */ if (nul < 0) { Dbg_Out ("Buffer has no null byte!\n"); memset (buf + len - 1, 0, 1); return XBFalse; } /* check if add string fits */ write = strlen (add); if (nul + write < len) { memcpy (buf + nul, add, write + 1); return XBTrue; } /* no, does not fit */ memset (buf + nul, (unsigned char)"x", len - nul - 1); memset (buf + len - 1, 0, 1); return XBFalse; } /* AddStringToBuffer */ /* * return a string for entry in given section */ char * DB_SectionEntryString (const DBSection * section, XBAtom atom) { static char buffer[100]; const char *tmp; const DBEntry *ptr; /* init buffer */ memset (buffer, 0, 1); /* get section name */ AddStringToBuffer (buffer, sizeof (buffer), "["); assert (NULL != section); tmp = GUI_AtomToString (section->atom); if (NULL == tmp) { tmp = "???"; } AddStringToBuffer (buffer, sizeof (buffer), tmp); AddStringToBuffer (buffer, sizeof (buffer), "] "); /* get entry name */ tmp = GUI_AtomToString (atom); if (NULL == tmp) { tmp = "???"; } AddStringToBuffer (buffer, sizeof (buffer), tmp); AddStringToBuffer (buffer, sizeof (buffer), "="); /* find entry value */ ptr = GetEntry (section, atom); if (NULL == ptr) { tmp = ""; } else { tmp = ptr->value; } AddStringToBuffer (buffer, sizeof (buffer), tmp); return buffer; } /* DB_PrintEntry */ /* * delete an entry from section */ void DB_DeleteEntry (DBSection * section, XBAtom atom) { DBEntry *save, *ptr; assert (section != NULL); section->changed = XBTrue; /* do we have any entries ? */ if (NULL == section->entry) { return; } assert (ATOM_INVALID != atom); /* it is the first entry ? */ if (section->entry->atom == atom) { save = section->entry; section->entry = section->entry->next; FreeEntry (save); } else { for (ptr = section->entry; ptr->next != NULL; ptr = ptr->next) { if (ptr->next->atom == atom) { save = ptr->next; ptr->next = ptr->next->next; FreeEntry (save); break; } } } } /* DB_DeleteEntry */ /************************ * conversion functions * ************************/ /* * translate an integer value into its conversion string */ const char * DB_IntToString (const DBToInt * table, int value) { const DBToInt *ptr; assert (NULL != table); for (ptr = table; ptr->key != NULL; ptr++) { if (ptr->value == value) { return ptr->key; } } return NULL; } /* DB_IntToString */ /* * translate a data pointer into its conversion string */ const char * DB_DataToString (const DBToData * table, void *pValue) { const DBToData *ptr; assert (NULL != table); for (ptr = table; ptr->key != NULL; ptr++) { if (ptr->value == pValue) { return ptr->key; } } return NULL; } /* DB_DataToString */ /******************* * file operations * *******************/ /* * load given database from file */ XBBool DB_Load (DBRoot * db) { FILE *fp; DBSection *section; char line[256]; const char *sectionName; const char *entryName; assert (db != NULL); assert (ATOM_INVALID != db->atom); /* try to open file for reading */ if (NULL == (fp = OpenDBFile (db, "r"))) { return XBFalse; } /* parse it */ section = NULL; while (NULL != fgets (line, sizeof (line), fp)) { if (NULL != (sectionName = ParseSection (line))) { section = DB_CreateSection (db, GUI_StringToAtom (sectionName)); } else if (NULL != section && NULL != (entryName = ParseEntryName (line))) { (void)DB_CreateEntryString (section, GUI_StringToAtom (entryName), ParseEntryValue (line)); } } /* mark all as unchanged */ MarkUnchanged (db); /* that's all */ fclose (fp); return XBTrue; } /* DB_Load */ /* * store database in file */ XBBool DB_Store (DBRoot * db) { FILE *fp; const DBSection *section; const DBEntry *entry; /* try to open file for writing */ if (NULL == (fp = OpenDBFile (db, "w"))) { return XBFalse; } /* now write it */ for (section = db->section; section != NULL; section = section->next) { fprintf (fp, "[%s]\n", GUI_AtomToString (section->atom)); for (entry = section->entry; entry != NULL; entry = entry->next) { fprintf (fp, "%s=%s\n", GUI_AtomToString (entry->atom), entry->value); } fprintf (fp, "\n"); } /* mark all as unchanged */ MarkUnchanged (db); /* that's all */ fclose (fp); return XBTrue; } /* DB_Store */ /* * append database to file */ XBBool DB_Append (DBRoot * db) { FILE *fp; const DBSection *section; const DBEntry *entry; /* try to open for appending */ if (NULL == (fp = OpenDBFile (db, "a"))) { return XBFalse; } /* now write it */ for (section = db->section; section != NULL; section = section->next) { fprintf (fp, "[%s]\n", GUI_AtomToString (section->atom)); for (entry = section->entry; entry != NULL; entry = entry->next) { fprintf (fp, "%s=%s\n", GUI_AtomToString (entry->atom), entry->value); } fprintf (fp, "\n"); } /* mark all as unchanged */ MarkUnchanged (db); /* that's all */ fclose (fp); return XBTrue; } /* DB_Append */ /* * dump database to stderr */ XBBool DB_Dump (const DBRoot * db) { const DBSection *section; const DBEntry *entry; /* now write it */ fprintf (stderr, "---database dump----\n"); for (section = db->section; section != NULL; section = section->next) { fprintf (stderr, "[%s]\n", GUI_AtomToString (section->atom)); for (entry = section->entry; entry != NULL; entry = entry->next) { fprintf (stderr, "%s=%s\n", GUI_AtomToString (entry->atom), entry->value); } fprintf (stderr, "\n"); } fprintf (stderr, "---end of database dump---\n"); /* that's all */ return XBTrue; } /* DB_Dump */ /* * load complete directory of files into database, */ XBBool DB_LoadDir (DBRoot * db, const char *path, const char *ext, DBType type, XBAtom timeAtom, XBAtom section, DBLoadDirFunc func, XBBool rec) { XBBool changed; XBDir *fileList; XBDir *ptr; /* sanity checks */ assert (NULL != db); assert (NULL != path); assert (NULL != ext); /* load database from file */ DB_Load (db); /* now compare with current directory contents */ changed = XBFalse; fileList = CreateFileList (path, ext, rec); for (ptr = fileList; NULL != ptr; ptr = ptr->next) { if (!CheckInsertFile (db, ptr->name, timeAtom, ptr->mtime)) { InsertFile (db, type, ptr->name, timeAtom, ptr->mtime, section, func); changed = XBTrue; #ifdef DEBUG putchar ('*'); #endif } else { UpdateFile (db, ptr->name); #ifdef DEBUG putchar ('.'); #endif } #ifdef DEBUG fflush (stdout); #endif } /* now delete "unchanged section", because they do not have any related files */ if (DeleteUnchangedSections (db)) { changed = XBTrue; } if (NULL != fileList) { DeleteFileList (fileList); #ifdef DEBUG putchar ('\n'); #endif } return changed; } /* DB_LoadDir */ /* * read message of the day, return line count */ int ReadMessageOfTheDay (int m, char *s, int *l) { FILE *fp; int i; char *c, *d; i = 0; /* try to open the file */ fp = FileOpen (db_path[3], "message", "txt", "r"); if (NULL != fp) { c = s; i = 0; l[i] = 0; while (1) { /* get character */ d = fgets (c, m - l[i], fp); if (d == NULL) { break; } i++; l[i] = strlen (s) - 1; c = s + strlen (s) - 1; } l[i + 1] = strlen (s); } return i; } /* ReadmessageOfTheDay */ /* * clean up databases */ void DB_Finish (void) { DBType t; for (t = DT_Config; t < NUM_DT; t++) { while (NULL != db_list[t]) { DB_Delete (db_list[t]); } db_list[t] = NULL; } } /* FinishControl */ /* * end of file ini_file.c */ xblast-2.10.4/ini_file.h0000644000175000017500000001264510416756320014153 0ustar rhondaalfie/* * file ini_file.h - parsing ini-file into a database * * $Id: ini_file.h,v 1.17 2006/04/11 16:44:00 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INI_FILE_H #define _INI_FILE_H /* * type definitions */ /* struct for string to int conversions */ typedef struct { const char *key; int value; } DBToInt; /* struct for string to data conversions */ typedef struct { const char *key; void *value; } DBToData; /* type of database */ typedef enum { DT_Config, DT_Level, DT_Demo, DT_Central, NUM_DT } DBType; /* conversion results */ typedef enum { DCR_Okay = 0, DCR_NoSuchEntry, DCR_Failure, } DBConversionResult; /* declarations of db elements */ typedef struct _db_entry DBEntry; typedef struct _db_section DBSection; typedef struct _db_root DBRoot; /* callback for DB_LoadDir */ typedef void (*DBLoadDirFunc) (DBSection *); /* * prototypes */ /* databases */ extern DBRoot *DB_Create (DBType type, XBAtom atom); extern const DBRoot *DB_Get (DBType type, XBAtom atom); extern XBBool DB_Changed (const DBRoot * db); extern XBAtom DB_Atom (const DBRoot *); extern void DB_SetAtom (DBRoot *, XBAtom); extern void DB_Delete (DBRoot * db); /* sections */ extern DBSection *DB_CreateSection (DBRoot * db, XBAtom atom); extern DBSection *DB_GetSection (const DBRoot * db, XBAtom atom); extern XBAtom DB_SectionAtom (const DBSection * section); extern int DB_NumSections (const DBRoot * db); extern XBAtom DB_IndexSection (const DBRoot * db, int index); extern void DB_DeleteAll (DBRoot * db); extern void DB_DeleteSection (DBRoot * db, XBAtom atom); /* entries */ extern XBBool DB_CreateEntryString (DBSection * section, XBAtom atom, const char *value); extern XBBool DB_CreateEntryAtom (DBSection * section, XBAtom atom, XBAtom value); extern XBBool DB_CreateEntryInt (DBSection * section, XBAtom atom, int value); extern XBBool DB_CreateEntryColor (DBSection * section, XBAtom atom, XBColor value); extern XBBool DB_CreateEntryBool (DBSection * section, XBAtom atom, XBBool value); extern XBBool DB_CreateEntryTime (DBSection * section, XBAtom atom, time_t value); extern XBBool DB_CreateEntryFloat (DBSection * section, XBAtom atom, double value); extern XBBool DB_CreateEntryGameResult (DBSection * section, XBAtom atom, int score); extern XBBool DB_CreateEntryPlayerRating (DBSection * section, XBAtom atom, int PID, float rating); extern XBBool DB_CreateEntryPos (DBSection * section, XBAtom atom, BMPosition * pValue); extern XBBool DB_ParseEntry (DBSection * db, const char *line); extern XBBool DB_CopyEntry (DBRoot * db, const DBSection * section, XBAtom atom); extern XBBool DB_GetEntryString (const DBSection * section, XBAtom atom, const char **pString); extern XBBool DB_GetEntryAtom (const DBSection * section, XBAtom atom, XBAtom * pAtom); extern XBBool DB_GetEntryInt (const DBSection * section, XBAtom atom, int *pValue); extern XBBool DB_GetEntryColor (const DBSection * section, XBAtom atom, XBColor * pValue); extern XBBool DB_GetEntryBool (const DBSection * section, XBAtom atom, XBBool * pValue); extern XBBool DB_GetEntryTime (const DBSection * section, XBAtom atom, time_t * pValue); extern XBBool DB_GetEntryFloat (const DBSection * section, XBAtom atom, double *pValue); extern XBBool DB_GetEntryPos (const DBSection * section, XBAtom atom, BMPosition * pValue); extern DBConversionResult DB_ConvertEntryInt (const DBSection * section, XBAtom atom, int *pValue, const DBToInt * convTable); extern DBConversionResult DB_ConvertEntryData (const DBSection * section, XBAtom atom, void **pValue, const DBToData * convTable); extern DBConversionResult DB_ConvertEntryFlags (const DBSection * section, XBAtom atom, unsigned *pValue, const DBToInt * convTable); extern int DB_NumAllEntries (const DBRoot * db); extern int DB_NumEntries (const DBSection * section); extern XBAtom DB_IndexEntry (const DBSection * section, int index); extern size_t DB_PrintEntry (char *buffer, const DBSection * section, int index); extern char *DB_SectionEntryString (const DBSection * section, XBAtom atom); extern void DB_DeleteEntry (DBSection * section, XBAtom atom); /* conversion */ extern const char *DB_IntToString (const DBToInt * table, int value); extern const char *DB_DataToString (const DBToData * table, void *pValue); /* file operations */ extern XBBool DB_Store (DBRoot * db); extern XBBool DB_Append (DBRoot * db); extern XBBool DB_Load (DBRoot * db); extern XBBool DB_Dump (const DBRoot * db); extern XBBool DB_LoadDir (DBRoot * db, const char *path, const char *ext, DBType type, XBAtom mtime, XBAtom section, DBLoadDirFunc func, XBBool rec); extern int ReadMessageOfTheDay (int m, char *s, int *l); /* clear all data */ extern void DB_Finish (void); #endif /* * end of file ini_file.h */ xblast-2.10.4/install-sh0000755000175000017500000002202110370762703014216 0ustar rhondaalfie#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xblast-2.10.4/intro.c0000644000175000017500000007000410443245274013515 0ustar rhondaalfie/* * File intro.c - misc. intros and inbetween screens * * $Id: intro.c,v 1.21 2006/06/12 11:06:36 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #ifdef WMS #ifdef SMPF #define M_PI 3.14159265358979323846f #endif #endif #define TIMEOUT_GAME_INTRO 10 #define TIMEOUT_LEVEL_INTRO 15 #define TIMEOUT_SCOREBOARD 6 #define TIMEOUT_LEVEL_END 3 #define MAX_AUDIENCE (3*(MAZE_W+1))+100 #define SCORE_NAME_WIDTH (2*BLOCK_WIDTH+4*BASE_X) #define SCORE_NAME_HEIGHT (5*BASE_Y) /* * local types */ typedef struct { int xPos; int yPos; Sprite *sprite; int team; int numData; int phase; const BMSpriteAnimation *data; } BMAudience; /* * local variables */ static BMPosition scorePos[MAX_PLAYER]; #ifndef SMPF static BMPosition namePos[MAX_PLAYER]; #endif /* audience */ static int numAudience = 0; static BMAudience audience[MAX_AUDIENCE]; static const int audienceSpriteAnime[] = { SpriteStopDown, SpriteLooser, SpriteLooser1, SpriteLooser2, SpriteWinner, SpriteWinner2, SpriteWinner3, MAX_ANIME }; /* animation for winner at level end*/ static int winnerCount; //static int winnerTeam; static int winnerNum; static Sprite *winnerSprite[MAX_PLAYER]; /* * draw intro text box */ static void DrawIntroTextBoxes (const IntroTextBox * box) { assert (box != NULL); while (box->text != NULL) { GUI_DrawTextbox (box->text, box->flags, &box->rect); box++; } } /* DrawIntroTextBoxes */ /* * fade screen */ void DoFade (XBFadeMode fadeMode, int maxLine) { XBEventData eData; /* inits */ GUI_SetTimer (FRAME_TIME, XBTrue); GUI_InitFade (fadeMode, maxLine); /* do it */ while (GUI_DoFade ()) { /* fade finished, wait for timer event */ while (XBE_TIMER != GUI_WaitEvent (&eData)) continue; } GUI_SetTimer (0, XBTrue); } /* DoFade */ /* * wait for user input, return XBFalse if user wants to quit */ static XBBool DoWait (int sec, XBBool countdown, PFV func) { XBEventCode code; XBEventData data; int count = sec * 20; GUI_SetKeyboardMode (KB_MENU); GUI_SetMouseMode (XBTrue); GUI_SetTimer (50, XBTrue); /* wait for events */ for (;;) { code = GUI_WaitEvent (&data); switch (code) { /* timeout and countdown handling */ case XBE_TIMER: /* exec user function */ if (NULL != func) { (*func) (); } if (0 == sec) { break; } /* handle countdown */ count--; if (count <= 0) { return XBTrue; } if (!countdown) { break; } /* display countdown */ switch (count) { case 61: SetMessage ("3", XBTrue); break; case 41: SetMessage ("2", XBTrue); break; case 21: SetMessage ("1", XBTrue); break; case 1: SetMessage ("0", XBTrue); break; default: break; } break; /* keypresses and joystick ... */ case XBE_MENU: switch (data.value) { case XBMK_SELECT: /* space or button */ case XBMK_DEFAULT: /* return */ return XBTrue; case XBMK_ABORT: /* escape */ return XBFalse; default: break; } break; /* any mouse button press */ case XBE_MOUSE_1: case XBE_MOUSE_2: case XBE_MOUSE_3: return XBTrue; default: /* check for chatting */ Chat_Event (code, data); break; } } return XBFalse; } /* DoWait */ /* * show intro */ void DoIntro (void) { XBEventData data; BMRectangle rect; XBEventCode event; double pfactor; int count; int x, y, w, h, lw; rect.x = BLOCK_WIDTH * 6; rect.y = BLOCK_HEIGHT * 5; rect.w = BLOCK_WIDTH * 3; rect.h = BLOCK_HEIGHT; /* clear pixmap with default bitmap */ GUI_ClearPixmap (); /* standard init text */ DrawIntroTextBoxes (introBox); /* Flush graphics */ GUI_FlushPixmap (0); /* Syn to Display */ GUI_Sync (); /* load sounds for intro */ SND_Load (SND_EXPL); SND_Load (SND_INTRO); /* wait for kb event */ GUI_SetTimer (FRAME_TIME, XBTrue); GUI_SetKeyboardMode (KB_MENU); GUI_SetMouseMode (XBTrue); for (count = 0; count < INTRO_LENGTH; count++) { if (!(count % CHAR_ANIME)) { SND_Play (SND_EXPL, (count / CHAR_ANIME) * 3 + 1); } /* draw growing poly */ pfactor = (double)(count + 1) / INTRO_LENGTH; x = (int)(0.5 + (7.5 - pfactor * 4.5) * BLOCK_WIDTH); y = (int)(0.5 + (7.5 - pfactor * 6.0) * BLOCK_HEIGHT); w = (int)(0.5 + pfactor * 9.0 * BLOCK_WIDTH); h = (int)(0.5 + pfactor * 12.0 * BLOCK_HEIGHT); lw = (int)(0.5 + pfactor * 8); GUI_DrawPolygon (x, y, w, h, lw, pointx, SIZE_OF_X, XBTrue); MarkMazeRect (x - lw / 2, y - lw / 2, w + lw, h + lw); if (count < CHAR_ANIME) { CopyExplBlock (0, 5, blockB[count]); } else if (count < (CHAR_ANIME * 2)) { CopyExplBlock (0, 5, blockB[CHAR_ANIME - 1]); CopyExplBlock (3, 5, blockL[count - CHAR_ANIME]); } else if (count < (CHAR_ANIME * 3)) { CopyExplBlock (0, 5, blockB[CHAR_ANIME - 1]); CopyExplBlock (3, 5, blockL[CHAR_ANIME - 1]); CopyExplBlock (6, 5, blockA[count - CHAR_ANIME * 2]); } else if (count < (CHAR_ANIME * 4)) { CopyExplBlock (0, 5, blockB[CHAR_ANIME - 1]); CopyExplBlock (3, 5, blockL[CHAR_ANIME - 1]); CopyExplBlock (6, 5, blockA[CHAR_ANIME - 1]); CopyExplBlock (9, 5, blockS[count - CHAR_ANIME * 3]); } else { CopyExplBlock (0, 5, blockB[CHAR_ANIME - 1]); CopyExplBlock (3, 5, blockL[CHAR_ANIME - 1]); CopyExplBlock (6, 5, blockA[CHAR_ANIME - 1]); CopyExplBlock (9, 5, blockS[CHAR_ANIME - 1]); CopyExplBlock (12, 5, blockT[count - CHAR_ANIME * 4]); } /* update sound */ SND_Flush (); /* set rectangles to redrawn */ SetRedrawRectangles (); /* redraw all blocks */ GUI_FlushBlocks (); /* update explosions animations */ UpdateExpl (); /* copyright text */ if (count == INTRO_LENGTH - 1) { DrawIntroTextBoxes (creditsBox); } /* update window from pixmap */ GUI_FlushPixmap (XBTrue); /* clear the redraw map */ ClearRedrawMap (); /* check event */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { switch (event) { case XBE_MENU: case XBE_MOUSE_1: case XBE_MOUSE_2: case XBE_MOUSE_3: if (count < INTRO_LENGTH - 2) { count = INTRO_LENGTH - 3; } break; default: break; } } } SND_Play (SND_INTRO, SOUND_MIDDLE_POSITION); /* wait for keystroke or timer */ DoWait (TIMEOUT_GAME_INTRO, XBFalse, NULL); /* unload sounds */ SND_Stop (SND_INTRO); SND_Stop (SND_EXPL); SND_Unload (SND_EXPL); SND_Unload (SND_INTRO); /* fade out screen */ DoFade (XBFM_BLACK_OUT, PIXH + SCOREH); } /* DoIntro */ /* * redraw screen? */ static void LoadUpdateWindow (void) { /* shuffle sprites and mark them */ ShuffleAllSprites (); /* set rectangles to be redrawn */ SetRedrawRectangles (); /* shuffle sprites and mark them */ MarkAllSprites (); /* update maze pixmap */ UpdateMaze (); /* draw sprites into pixmap */ DrawAllSprites (); /* update window from pixmap */ GUI_FlushPixmap (XBTrue); /* clear the redraw map */ ClearRedrawMap (); } /* LoadUpdateWindow */ /* * poll events */ static XBBool LoadPoll (void) { XBEventCode eCode; XBEventData eData; while (XBE_NONE != (eCode = (GUI_PeekEvent (&eData)))) { /* check for escape */ if (XBE_MENU == eCode && XBMK_ABORT == eData.value) { return XBFalse; } } return XBTrue; } /* LoadPoll */ /* * show player sprites in intro */ XBBool InitPlayerSprites (int numPlayers, const CFGPlayer * cfgPlayer) { int i, j, x; XBBool ok; Sprite *sprite[MAX_PLAYER + 1]; assert (cfgPlayer != NULL); /* inits */ memset (&sprite, 0, sizeof (sprite)); /* setup background graphics */ ConfigScoreGraphics (graphicsLoadSprite); ConfigScoreMap (mapLoadSprite); ClearStatusBar (BTFree, BTFree); /* only escape-key to poll */ GUI_SetTimer (0, XBTrue); GUI_SetMouseMode (XBFalse); GUI_SetKeyboardMode (KB_MENU); /* load sounds for intro */ SND_Load (SND_WHIRL); SND_Play (SND_WHIRL, SOUND_MIDDLE_POSITION); /* text message */ sprite[MAX_PLAYER] = CreateTextSprite (N_("Loading ..."), PIXW / 2 - 3 * BLOCK_WIDTH, PIXH / 2 + BLOCK_HEIGHT, 6 * BLOCK_WIDTH, BLOCK_HEIGHT, FF_White | FF_Large | FF_Outlined, SPM_MAPPED); assert (sprite[MAX_PLAYER] != NULL); #ifdef DEBUG Dbg_StartClock (); #endif ok = XBFalse; /* show first animation for each player */ x = (PIXW - numPlayers * BLOCK_WIDTH) / 2; for (i = 0; i < numPlayers; i++) { GUI_LoadPlayerSprite (i, 0, &cfgPlayer[i].graphics); if (!LoadPoll ()) { goto Finish; } sprite[i] = CreatePlayerSprite (i, x, PIXH / 2 - BLOCK_HEIGHT, SpriteStopDown, SPM_MAPPED); assert (sprite[i] != NULL); x += BLOCK_WIDTH; } LoadUpdateWindow (); /* load rest of animation */ for (i = 0; i < numPlayers; i++) { for (j = 1; j < MAX_ANIME_EPM; j++) { GUI_LoadPlayerSprite (i, j, &cfgPlayer[i].graphics); if (!LoadPoll ()) { goto Finish; } } GUI_LoadPlayerScoreTiles (i, &cfgPlayer[i].graphics); SetSpriteAnime (sprite[i], SpriteWinner); LoadUpdateWindow (); if (!LoadPoll ()) { goto Finish; } } /* successful ;-) */ Dbg_Out ("%d sprites loaded in %lu msec\n", numPlayers, Dbg_FinishClock ()); ok = XBTrue; Finish: /* delete old sprites */ for (i = 0; i <= MAX_PLAYER; i++) { if (NULL != sprite[i]) { DeleteSprite (sprite[i]); } } FinishLevelGraphics (); /* stop sound */ SND_Stop (SND_WHIRL); SND_Unload (SND_WHIRL); /* that's all */ return ok; } /* LoadPlayerSprites */ /* * show level intro */ XBBool LevelIntro (int numPlayers, const DBRoot * level, int timeOut) { int i, player; BMPlayer *ps; int numInfo; const char **info; static char tmp[128]; ResetStatusBar (player_stat, N_("Press Space or Return"), XBFalse); /* draw player positions */ for (player = 0, ps = player_stat; player < numPlayers; player++, ps++) { MoveSprite (ps->sprite, ps->x, ps->y); SetSpriteMode (ps->sprite, ps->in_active ? SPM_UNMAPPED : SPM_MAPPED); SetSpriteAnime (ps->sprite, SpriteStopDown); } /* Update Window */ DrawMaze (); DrawAllSprites (); /* draw level title und hint */ titleBox[1].text = GetLevelName (level); sprintf (tmp, "created by %s", GetLevelAuthor (level)); titleBox[2].text = tmp; titleBox[3].text = GetLevelHint (level); DrawIntroTextBoxes (titleBox); /* player info */ info = GetPlayerInfo (&numInfo); for (i = 0; i < numInfo; i++) { playerInfoBox[2 + i].text = info[i]; } playerInfoBox[2 + i].text = NULL; DrawIntroTextBoxes (playerInfoBox); /* level info */ info = GetLevelInfo (&numInfo); for (i = 0; i < numInfo; i++) { levelInfoBox[2 + i].text = info[i]; } levelInfoBox[2 + i].text = NULL; DrawIntroTextBoxes (levelInfoBox); /* extra info */ info = GetExtraInfo (&numInfo); for (i = 0; i < numInfo; i++) { extraInfoBox[2 + i].text = info[i]; } extraInfoBox[2 + i].text = NULL; DrawIntroTextBoxes (extraInfoBox); /* update window from pixmap */ DoFade (XBFM_IN, PIXH + SCOREH); GUI_FlushPixmap (XBFalse); /* clear the redraw map */ ClearRedrawMap (); /* negative timeout, simulate keypress */ if (timeOut < 0) { return XBTrue; } /* now wait for select */ Dbg_Out ("Gonna wait %i seconds\n", timeOut); return DoWait (timeOut, XBTrue, LoadUpdateWindow); } /* LevelIntro */ /* * show winner animation */ static void LevelAnimateWinner (void) { int i; /* animate winner sprites */ for (i = 0; i < winnerNum; i++) { SetSpriteMode (winnerSprite[i], SPM_MAPPED); SetSpriteAnime (winnerSprite[i], winnerAnime[winnerCount]); } /* next frames */ winnerCount++; if (winnerCount >= NUM_WINNER_ANIME) { winnerCount = 0; } /* graphics update etc */ LoadUpdateWindow (); } /* LevelAnimateWinner */ /* * show level end */ XBBool LevelEnd (int numPlayers, int lastTeam, const char *msg, int timeOut) { int i; int player; for (player = 0; player < numPlayers; player++) { ((player_stat[player].sprite)->player).player = player_stat[player].id; } /* counter for winner animation */ winnerCount = 0; /* which sprites do we animate */ winnerNum = 0; for (i = 0; i < numPlayers; i++) { if (lastTeam == player_stat[i].team) { winnerSprite[winnerNum] = player_stat[i].sprite; winnerNum++; } } /* show level result */ SetMessage (msg, XBTrue); /* player applause */ if (lastTeam >= 0) { SND_Stop(STOP_ALL_SOUNDS); SND_Play (SND_WON, SOUND_MIDDLE_POSITION); } /* negative timeout, just return */ if (timeOut < 0) { return XBTrue; } /* zero timeout: wait space, otherwise space or timeout */ return DoWait (timeOut ? TIMEOUT_LEVEL_END : 0, XBFalse, LevelAnimateWinner); } /* LevelEnd */ /* * prepare scoreboard */ void InitScoreBoard (int numPlayers, int numWins) { int i, j, x, y; #ifndef SMPF int yStart, yStep; #endif int yAudience, xStart; /* determine start pos */ #ifdef SMPF yAudience = 3; #else switch (numPlayers) { case 2: yStart = 5; yStep = 4; yAudience = 3; break; case 3: yStart = 4; yStep = 3; yAudience = 3; break; case 4: yStart = 4; yStep = 2; yAudience = 3; break; case 5: yStart = 3; yStep = 2; yAudience = 3; break; default: yStart = 1; yStep = 2; yAudience = 1; break; } #endif /* fill map */ for (y = 0; y < yAudience; y++) { for (x = 0; x < MAZE_W; x++) { mapScoreBoard[x][y] = 7; } } /* clear the rest */ for (; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { mapScoreBoard[x][y] = 6; } } #ifndef SMPF /* draw podests */ for (i = 0; i < numPlayers; i++) { /* higher part */ for (x = 0; x < 3; x++) { mapScoreBoard[x][yStart + yStep * i] = 0; mapScoreBoard[x][yStart + yStep * i + 1] = 1; } /* steps */ mapScoreBoard[x][yStart + yStep * i] = 2; mapScoreBoard[x][yStart + yStep * i + 1] = 3; x++; /* lower part */ for (; x < MAZE_W && x < (6 + numWins); x++) { mapScoreBoard[x][yStart + yStep * i] = 4; mapScoreBoard[x][yStart + yStep * i + 1] = 5; } } /* set player positions */ for (i = 0; i < numPlayers; i++) { scorePos[i].x = BLOCK_WIDTH * 4; scorePos[i].y = (yStart + yStep * i - 1) * BLOCK_HEIGHT + 4 * BASE_Y; namePos[i].x = BLOCK_WIDTH / 4; namePos[i].y = (yStart + yStep * i + 1) * BLOCK_HEIGHT + 3 * BASE_Y / 2; } #endif /* load additional sprites for audience */ for (i = numPlayers; i < NUM_DEFAULT_PLAYERS; i++) { const CFGPlayerGraphics *gfx = DefaultPlayerGraphics (i); for (j = 0; audienceSpriteAnime[j] != MAX_ANIME; j++) { GUI_LoadPlayerSprite (i, audienceSpriteAnime[j], gfx); } } /* set audience positions and sprite */ numAudience = 0; for (y = 0; y < BLOCK_HEIGHT * yAudience; y += BLOCK_HEIGHT) { xStart = (y == BLOCK_HEIGHT) ? -BLOCK_WIDTH / 2 : 0; for (x = xStart; x < PIXW; x += BLOCK_WIDTH) { audience[numAudience].xPos = x + OtherRandomNumber (BASE_X) - BASE_X / 2; audience[numAudience].yPos = y - OtherRandomNumber (BASE_Y) - 4 * BLOCK_HEIGHT / 3; audience[numAudience].team = OtherRandomNumber (MAX (NUM_DEFAULT_PLAYERS, numPlayers)); numAudience++; } } #if 0 /* SMPF circle test */ for (i = 0; i < 16; i++) { audience[numAudience].xPos = (int)floor (3 * PIXW * cos (M_PI + (2 * M_PI * i / 16)) / 12 + PIXW / 2 - BLOCK_WIDTH / 2); audience[numAudience].yPos = (int)floor (3 * PIXH * sin (M_PI + (2 * M_PI * i / 16)) / 12 + PIXH / 2 - BLOCK_HEIGHT / 2); audience[numAudience].team = OtherRandomNumber (MAX (NUM_DEFAULT_PLAYERS, numPlayers)); numAudience++; } #endif } /* InitScoreBoard */ /* * initialize winner screen */ void InitWinner (int numPlayers) { int i, x, y; int xStart, xStep; int yAudience; /* determine start pos */ yAudience = 3; switch (numPlayers) { case 2: xStart = 7; xStep = 4; break; case 3: xStart = 5; xStep = 4; break; case 4: xStart = 3; xStep = 4; break; case 5: xStart = 1; xStep = 4; break; default: xStart = 1; xStep = 3; break; } /* audience */ for (y = 1; y <= yAudience; y++) { for (x = 0; x < MAZE_W; x++) { mapScoreBoard[x][y] = 7; } } for (x = 0; x < MAZE_W; x++) { mapScoreBoard[x][0] = 1; mapScoreBoard[x][y] = 8; } y++; /* clear the rest */ for (; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { mapScoreBoard[x][y] = 6; } } /* winner */ for (x = MAZE_W / 2 - 1; x < MAZE_W / 2 + 2; x++) { scorePos[0].x = (PIXW - BLOCK_WIDTH) / 2; scorePos[0].y = 4 * BLOCK_HEIGHT + 6 * BASE_Y; } /* other players */ for (i = 1, x = xStart; i < numPlayers; i++) { scorePos[i].x = x * BLOCK_WIDTH;; scorePos[i].y = 9 * BLOCK_HEIGHT + 4 * BASE_Y; x += xStep; } /* set audience positions and sprite */ numAudience = 0; for (y = BLOCK_HEIGHT; y <= BLOCK_HEIGHT * yAudience; y += BLOCK_HEIGHT) { xStart = (y == 2 * BLOCK_HEIGHT) ? -BLOCK_WIDTH / 2 : 0; for (x = xStart; x < PIXW; x += BLOCK_WIDTH) { audience[numAudience].xPos = x + OtherRandomNumber (BASE_X) - BASE_X / 2; audience[numAudience].yPos = y - OtherRandomNumber (BASE_Y) - 4 * BLOCK_HEIGHT / 3; audience[numAudience].team = OtherRandomNumber (MAX (numPlayers, NUM_DEFAULT_PLAYERS)); numAudience++; } } /* SMPF circle test */ #if 0 for (i = 0; i < 16; i++) { audience[numAudience].xPos = (int)floor (3 * PIXW * cos (M_PI + (2 * M_PI * i / 16)) / 12 + PIXW / 2 - BLOCK_WIDTH / 2); audience[numAudience].yPos = (int)floor (3 * PIXH * sin (M_PI + (2 * M_PI * i / 16)) / 12 + PIXH / 2 + BLOCK_HEIGHT); audience[numAudience].team = OtherRandomNumber (MAX (NUM_DEFAULT_PLAYERS, numPlayers)); numAudience++; } #endif } /* InitScoreBoard */ /* * show audience */ static void ShowAudience (int numPlayers, int lastTeam) { int i; BMAudience *ptr; for (i = 0, ptr = audience; i < numAudience; i++, ptr++) { /* set animation */ if (ptr->team < numPlayers) { if ((1 << ptr->team) & lastTeam) { /* his team has won the game */ ptr->data = winnerAnime; ptr->numData = NUM_WINNER_ANIME; } else { /* his team has lost the game */ ptr->data = looserAnime; ptr->numData = NUM_LOOSER_ANIME; } } else { if (MAX_PLAYER == lastTeam) { /* draw game or timeout */ ptr->data = otherLooserAnime; ptr->numData = NUM_OTHER_LOOSER_ANIME; } else { /* some has won */ ptr->data = otherWinnerAnime; ptr->numData = NUM_OTHER_WINNER_ANIME; } } ptr->phase = OtherRandomNumber (ptr->numData); /* create sprite */ ptr->sprite = CreatePlayerSprite (ptr->team, ptr->xPos, ptr->yPos, ptr->data[ptr->phase], SPM_MAPPED); } } /* ShowAudience */ /* * show laola in audience */ static void ShowLaOla (void) { int i; BMAudience *ptr; for (i = 0, ptr = audience; i < numAudience; i++, ptr++) { /* set animation */ ptr->data = laOlaAnime; ptr->numData = NUM_LAOLA_ANIME; ptr->phase = (2 * NUM_LAOLA_ANIME - 2 * ptr->xPos / BLOCK_WIDTH + OtherRandomNumber (5)) % NUM_LAOLA_ANIME; /* create sprite */ ptr->sprite = CreatePlayerSprite (ptr->team, ptr->xPos, ptr->yPos, ptr->data[ptr->phase], SPM_MAPPED); } } /* ShowLaOla */ /* * animate audience */ static void AnimateAudience (void) { int i; BMAudience *ptr; /* create audience sprites */ for (i = 0, ptr = audience; i < numAudience; i++, ptr++) { /* set new animation frame */ SetSpriteAnime (ptr->sprite, ptr->data[ptr->phase]); /* increment frame counter */ ptr->phase++; if (ptr->phase >= ptr->numData) { ptr->phase = 0; } } } /* AnimateAudience */ /* * remove audience sprites */ static void HideAudience (void) { int i; for (i = 0; i < numAudience; i++) { assert (audience[i].sprite != NULL); DeleteSprite (audience[i].sprite); } } /* HideAudience */ /* * update score window */ static void ScoreUpdateWindow (void) { /* sprite animations */ AnimateAudience (); /* shuffle sprites and mark them */ ShuffleAllSprites (); /* set rectangles to be redrawn */ SetRedrawRectangles (); /* shuffle sprites and mark them */ MarkAllSprites (); /* update maze pixmap */ UpdateMaze (); /* draw sprites into pixmap */ DrawAllSprites (); /* update window from pixmap */ GUI_FlushPixmap (XBTrue); /* clear the redraw map */ ClearRedrawMap (); } /* ScoreUpdateWindow */ /* * show the scoreboard after level */ XBBool ShowScoreBoard (int lastTeam, int maxNumWins, int numPlayers, BMPlayer * playerStat, int timeOut) { int i, j, n = 0; BMPlayer *ps; int numTrophies = 0; XBBool result = XBTrue; Sprite *trophy[MAX_PLAYER * MAX_VICTORIES]; #ifndef SMPF Sprite *name[MAX_PLAYER]; #endif int winningTeam = 0; /* load score board map */ ResetInfo (); ConfigScoreGraphics (graphicsScoreBoard); ConfigScoreMap (mapScoreBoard); /* draw maze in pximap */ DrawMaze (); ResetStatusBar (playerStat, N_("Scoreboard"), XBFalse); for (i = 0, ps = playerStat; i < numPlayers; i++, ps++) { #ifdef SMPF ps->x = (int)floor (3 * PIXW * cos (M_PI + (2 * M_PI * i / numPlayers)) / 12 + PIXW / 2 - BLOCK_WIDTH / 2); ps->y = (int)floor (3 * PIXH * sin (M_PI + (2 * M_PI * i / numPlayers)) / 12 + PIXH / 2 - BLOCK_HEIGHT / 2); #else ps->x = scorePos[i].x; ps->y = scorePos[i].y; #endif /* draw player sprites */ MoveSprite (ps->sprite, ps->x, ps->y); SetSpriteMode (ps->sprite, SPM_MAPPED); if (ps->in_active) { SetSpriteAnime (ps->sprite, SpriteStopUp); } else if (ps->team == lastTeam) { SetSpriteAnime (ps->sprite, SpriteWinner); } else if (ps->victories == maxNumWins) { SetSpriteAnime (ps->sprite, SpriteStopDown); } else { SetSpriteAnime (ps->sprite, SpriteLooser); } n = (n > ps->victories) ? n : ps->victories; /* draw "score" bombs */ #ifndef SMPF for (j = 0; j < ps->victories; j++) { trophy[numTrophies++] = CreateBombSprite (BB_NORMAL, (6 + j) * BLOCK_WIDTH, ps->y + BLOCK_HEIGHT, 0, SPM_MAPPED); } /* draw player names */ name[i] = CreateTextSprite (p_string[i].name, namePos[i].x, namePos[i].y, SCORE_NAME_WIDTH, SCORE_NAME_HEIGHT, FF_White | FF_Medium | FF_Boxed, SPM_MAPPED); #endif } #ifdef SMPF for (j = 0; j < n; j++) { trophy[numTrophies++] = CreateBombSprite (BB_NORMAL, (j - n / 2) * BLOCK_WIDTH + BLOCK_WIDTH * MAZE_W / 2, BLOCK_HEIGHT * (MAZE_H - 2) + BLOCK_HEIGHT / 2, 0, SPM_MAPPED); } #endif /* now show audience */ for (i = 0, ps = playerStat; i < numPlayers; i++, ps++) { if (ps->team == lastTeam) { winningTeam |= 1 << i; } } Dbg_Out ("The players that won are: %i\n", winningTeam); ShowAudience (numPlayers, winningTeam); /* draw it */ DrawAllSprites (); /* update window */ GUI_FlushScoreBoard (); DoFade (XBFM_IN, PIXH); GUI_FlushPixmap (XBFalse); /* applause */ SND_Play (SND_APPL, SOUND_MIDDLE_POSITION); /* non-negative timeout, wait till keypress or timeout */ if (timeOut >= 0) { result = DoWait (timeOut ? TIMEOUT_SCOREBOARD : 0, XBTrue, ScoreUpdateWindow); } /* fade out screen */ DoFade (XBFM_BLACK_OUT, PIXH); /* clean up */ for (i = 0; i < numTrophies; i++) { assert (trophy[i] != NULL); DeleteSprite (trophy[i]); } #ifndef SMPF for (i = 0; i < numPlayers; i++) { assert (name[i] != NULL); DeleteSprite (name[i]); } #endif HideAudience (); FinishLevelGraphics (); ClearRedrawMap (); return result; } /* ShowScoreBoard */ /* * show winner after game */ void ShowWinner (int lastTeam, int numPlayers, BMPlayer * playerStat) { int i, j, k, x, n, s; BMPlayer *ps; Sprite *name = NULL; char *msg = NULL; int xStart, xStep; char totalName[256]; int nTeamPlayers[MAX_HOSTS]; int teamStart[MAX_HOSTS]; int nTeamPlayersSet[MAX_HOSTS]; int teams = 0; /* clear team size arrays */ for (i = 0; i < MAX_HOSTS; i++) { nTeamPlayers[i] = 0; nTeamPlayersSet[i] = 0; } /* count teams and sizes */ for (i = 0, ps = playerStat; i < numPlayers; ps++, i++) { nTeamPlayers[ps->team]++; if (nTeamPlayers[ps->team] == 1) { teams++; } } /* calculate step length */ if ((numPlayers - nTeamPlayers[lastTeam]) >= 5) { xStep = 2; } else { xStep = 3; } /* output results */ Dbg_Out ("Team configuration:\n"); s = 0; for (i = 0; i < MAX_HOSTS; i++) { if (i == lastTeam) { Dbg_Out ("Winning team %i, %i players:\n", i, nTeamPlayers[i]); } else { Dbg_Out ("Loosing team %i, %i players:\n", i, nTeamPlayers[i]); teamStart[i] = s; if (nTeamPlayers[i] > 0) { s = s + 2 * nTeamPlayers[i] - 1 + xStep; } } } s = s - 3; n = nTeamPlayers[lastTeam]; switch (n) { case 1: xStart = 7; xStep = 2; break; case 2: xStart = 6; xStep = 2; break; case 3: xStart = 5; xStep = 2; break; case 4: xStart = 4; xStep = 2; break; case 5: xStart = 3; xStep = 2; break; default: xStart = 3; xStep = 1; break; } /* winners */ #ifndef SMPF for (x = xStart - 1; x <= xStart + xStep * (n - 1) + 1; x++) { /* winner position */ mapScoreBoard[x][6] = 0; mapScoreBoard[x][7] = 0; mapScoreBoard[x][8] = 1; } #endif for (x = xStart, i = 0; i < n; i++) { /* draw big podests */ scorePos[i].x = x * BLOCK_WIDTH; #ifdef SMPF scorePos[i].y = 7 * BLOCK_HEIGHT + 0 * BASE_Y; #else scorePos[i].y = 4 * BLOCK_HEIGHT + 6 * BASE_Y; #endif x += xStep; } #ifdef SMPF for (i = 0, j = 0, ps = playerStat; i < numPlayers; ps++, i++) { if (ps->team != lastTeam) { scorePos[j + n].x = (int)floor (3 * PIXW * cos (M_PI + (2 * M_PI * j / (numPlayers - n))) / 12 + PIXW / 2 - BLOCK_WIDTH / 2); scorePos[j + n].y = (int)floor (3 * PIXH * sin (M_PI + (2 * M_PI * j / (numPlayers - n))) / 12 + PIXH / 2 + BLOCK_HEIGHT); j++; } } #else s = s / 2; for (i = 0, j = 0, ps = playerStat; i < numPlayers; ps++, i++) { if (ps->team != lastTeam) { x = 7 + teamStart[ps->team] - s + nTeamPlayersSet[ps->team] * 2; Dbg_Out ("x = %d\n", x); nTeamPlayersSet[ps->team]++; mapScoreBoard[x][10] = 4; mapScoreBoard[x][11] = 5; if (nTeamPlayersSet[ps->team] < nTeamPlayers[ps->team]) { mapScoreBoard[x + 1][10] = 4; mapScoreBoard[x + 1][11] = 5; } scorePos[j + n].x = x * BLOCK_WIDTH; scorePos[j + n].y = 9 * BLOCK_HEIGHT + 4 * BASE_Y; j++; } } #endif ResetInfo (); ConfigScoreGraphics (graphicsScoreBoard); ConfigScoreMap (mapScoreBoard); /* draw maze in pixmap */ DrawMaze (); /* init */ for (i = 0; i < 256; i++) { totalName[i] = 0; } for (i = 0, j = 0, k = 0, ps = playerStat; i < numPlayers; i++, ps++) { if (ps->team == lastTeam) { /* show winner sprite */ ps->x = scorePos[k].x; ps->y = scorePos[k].y; SetSpriteAnime (ps->sprite, SpriteBigWinner); /* show winner name */ if (k > 0) { strcat (totalName, " & "); } strcat (totalName, p_string[i].name); /* set winning message */ msg = p_string[i].wingame; k++; } else { ps->x = scorePos[j + n].x; ps->y = scorePos[j + n].y; if (ps->in_active) { SetSpriteAnime (ps->sprite, SpriteStopUp); } else if (ps->victories == 0) { SetSpriteAnime (ps->sprite, SpriteDamagedDown); } else { SetSpriteAnime (ps->sprite, SpriteLooser); } j++; } /* draw player sprites */ MoveSprite (ps->sprite, ps->x, ps->y); SetSpriteMode (ps->sprite, SPM_MAPPED); } #ifndef SMPF name = CreateTextSprite (totalName, (30 - (n * 3)) * BLOCK_WIDTH / 4, 49 * BLOCK_HEIGHT / 6, n * 3 * BLOCK_WIDTH / 2, 2 * BLOCK_HEIGHT / 3, FF_White | FF_Medium | FF_Boxed, SPM_MAPPED); #endif /* display message */ assert (msg != NULL); ResetStatusBar (playerStat, msg, XBFalse); /* now show audience */ ShowLaOla (); /* draw it */ DrawAllSprites (); /* update window */ GUI_FlushScoreBoard (); DoFade (XBFM_IN, PIXH); GUI_FlushPixmap (XBFalse); /* sound */ SND_Load (SND_FINALE); SND_Play (SND_FINALE, SOUND_MIDDLE_POSITION); /* wait for select key to continue */ DoWait (0, XBFalse, ScoreUpdateWindow); /* fade out screen */ DoFade (XBFM_WHITE_OUT, PIXH + SCOREH); /* clean up */ if (NULL != name) { DeleteSprite (name); } HideAudience (); FinishLevelGraphics (); SND_Stop (SND_FINALE); SND_Unload (SND_FINALE); } /* ShowWinner */ /* * end of file intro.c */ xblast-2.10.4/intro.h0000644000175000017500000000307210372731124013516 0ustar rhondaalfie/* * file intro.h - intro and inbetween screens * * $Id: intro.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_INTRO_H #define XBLAST_INTRO_H /* * global prototypes */ extern void DoFade (XBFadeMode fadeMode, int maxLine); extern void DoIntro (void); extern XBBool InitPlayerSprites (int numPlayers, const CFGPlayer *); extern void InitScoreBoard (int numPlayers, int numWins); extern void InitWinner (int numPlayers); extern XBBool LevelIntro (int numPlayers, const DBRoot * level, int timeOut); extern XBBool LevelEnd (int numPlayers, int lastTeam, const char *msg, int timeOut); extern XBBool ShowScoreBoard (int lastTeam, int maxNumWins, int numPlayers, BMPlayer * ps, int timeOut); extern void ShowWinner (int lastTeam, int numPlayers, BMPlayer * ps); #endif /* * end of file intro.h */ xblast-2.10.4/introdat.c0000644000175000017500000004372210443243737014217 0ustar rhondaalfie/* * file introdat.c - animation and layouts for intro and inbetween screens * * $Id: introdat.c,v 1.10 2006/06/12 10:54:23 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * text for first screen */ const IntroTextBox introBox[] = { { N_("On a Workstation not far away"), FF_Large | FF_Black | FF_Outlined, {0, 0, PIXW, BLOCK_HEIGHT}, }, { N_("Press Space or Return"), FF_Large | FF_White | FF_Boxed, {4 * BLOCK_WIDTH, PIXH + 30, 7 * BLOCK_WIDTH, 2 * BLOCK_HEIGHT / 3,}, }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * Coypright notice for first screen */ const IntroTextBox creditsBox[] = { { "", FF_Large | FF_Boxed | FF_Black, {35 * BASE_X, 38 * BASE_Y, 50 * BASE_X, 44 * BASE_Y,}, }, { "", FF_Large | FF_Boxed | FF_White, {36 * BASE_X, 39 * BASE_Y, 48 * BASE_X, 42 * BASE_Y,}, }, { "XBlast TNT " VERSION_STRING, FF_Large | FF_White, {36 * BASE_X, 39 * BASE_Y, 48 * BASE_X, 8 * BASE_Y,}, }, { "Copyright \251 " COPYRIGHT_YEAR " Oliver Vogel", FF_Medium | FF_White, {36 * BASE_X, 47 * BASE_Y, 48 * BASE_X, 6 * BASE_Y,}, }, { "(m.vogel@ndh.net)", FF_Small | FF_White, {36 * BASE_X, 53 * BASE_Y, 48 * BASE_X, 4 * BASE_Y,}, }, { N_("Coauthor Garth Denley"), FF_Medium | FF_White, {36 * BASE_X, 57 * BASE_Y, 48 * BASE_X, 6 * BASE_Y,}, }, { "(garthy@cs.adelaide.edu.au)", FF_Small | FF_White, {36 * BASE_X, 63 * BASE_Y, 48 * BASE_X, 4 * BASE_Y,}, }, { N_("Sound by Norbert Nicolay"), FF_Medium | FF_White, {36 * BASE_X, 67 * BASE_Y, 48 * BASE_X, 6 * BASE_Y,}, }, { "(nicolay@ikp.uni-koeln.de)", FF_Small | FF_White, {36 * BASE_X, 73 * BASE_Y, 48 * BASE_X, 4 * BASE_Y,}, }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * level title boxes */ IntroTextBox titleBox[] = { { "", FF_White | FF_Boxed, {13 * BLOCK_WIDTH / 4, BLOCK_HEIGHT / 2 - 2, 17 * BLOCK_WIDTH / 2, BLOCK_HEIGHT + 4,}, }, { NULL, FF_White | FF_Large, {13 * BLOCK_WIDTH / 4, BLOCK_HEIGHT / 2 - 2, 17 * BLOCK_WIDTH / 2, 2 * BLOCK_HEIGHT / 3,}, }, { NULL, FF_White | FF_Small, {13 * BLOCK_WIDTH / 4, 7 * BLOCK_HEIGHT / 6 - 2, 17 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 3,}, }, { NULL, FF_White | FF_Boxed | FF_Large, {5 * BLOCK_WIDTH / 2, 67 * BLOCK_HEIGHT / 6, 10 * BLOCK_WIDTH, 2 * BLOCK_HEIGHT / 3,} }, { N_("visit http://xblast.sf.net/"), FF_White | FF_Boxed | FF_Small, {8 * BLOCK_WIDTH / 2, 73 * BLOCK_HEIGHT / 6, 7 * BLOCK_WIDTH, 2 * BLOCK_HEIGHT / 3,} }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * player info boxes */ IntroTextBox playerInfoBox[] = { /* frame */ { "", FF_White | FF_Boxed | FF_Transparent, {3 * BLOCK_WIDTH / 8, 5 * BLOCK_HEIGHT / 2, 17 * BLOCK_WIDTH / 4, 95 * BLOCK_HEIGHT / 12,}, }, /* header */ { N_("Player Info"), FF_Black | FF_Boxed | FF_Medium, {BLOCK_WIDTH / 2, 8 * BLOCK_HEIGHT / 3, 4 * BLOCK_WIDTH, 2 * BLOCK_HEIGHT / 3,}, }, /* info 1-7 */ { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 15 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 19 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 23 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 27 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 31 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 35 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {BLOCK_WIDTH / 2, 39 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * level info boxes */ IntroTextBox levelInfoBox[] = { /* frame */ { "", FF_White | FF_Boxed | FF_Transparent, {41 * BLOCK_WIDTH / 8, 5 * BLOCK_HEIGHT / 2, 19 * BLOCK_WIDTH / 4, 95 * BLOCK_HEIGHT / 12,}, }, /* header */ { N_("Level Info"), FF_Black | FF_Boxed | FF_Medium, {21 * BLOCK_WIDTH / 4, 8 * BLOCK_HEIGHT / 3, 9 * BLOCK_WIDTH / 2, 2 * BLOCK_HEIGHT / 3,}, }, /* info 1-7 */ { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 15 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 19 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 23 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 27 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 31 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 35 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {21 * BLOCK_WIDTH / 4, 39 * BLOCK_HEIGHT / 4, 9 * BLOCK_WIDTH / 2, BLOCK_HEIGHT / 2,}, }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * extra info boxes */ IntroTextBox extraInfoBox[] = { /* frame */ { "", FF_White | FF_Boxed | FF_Transparent, {83 * BLOCK_WIDTH / 8, 5 * BLOCK_HEIGHT / 2, 17 * BLOCK_WIDTH / 4, 95 * BLOCK_HEIGHT / 12,}, }, /* header */ { N_("Extra Info"), FF_Black | FF_Boxed | FF_Medium, {42 * BLOCK_WIDTH / 4, 8 * BLOCK_HEIGHT / 3, 4 * BLOCK_WIDTH, 2 * BLOCK_HEIGHT / 3,}, }, /* info 1-6 */ { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 15 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 19 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 23 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 27 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 31 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 35 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, { NULL, FF_White | FF_Boxed | FF_Small, {42 * BLOCK_WIDTH / 4, 39 * BLOCK_HEIGHT / 4, 4 * BLOCK_WIDTH, BLOCK_HEIGHT / 2,}, }, /* end of array */ { NULL, 0, {0, 0, 0, 0}, }, }; /* * data points for X-polygon */ const BMPoint pointx[SIZE_OF_X] = { {0.000000, 0.000000}, {0.166667, 0.000000}, {0.500000, 0.333333}, {0.833333, 0.000000}, {1.000000, 0.000000}, {1.000000, 0.166667}, {0.666667, 0.500000}, {1.000000, 0.833333}, {1.000000, 1.000000}, {0.833333, 1.000000}, {0.500000, 0.666667}, {0.166667, 1.000000}, {0.000000, 1.000000}, {0.000000, 0.833333}, {0.333333, 0.500000}, {0.000000, 0.166667}, }; /* * explosion data for letter animations */ /* Letter A */ const int blockA[CHAR_ANIME][CHARH][CHARW] = { { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x10, 0x00, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x11, 0x00, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, }, { {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x17, 0x18, 0x00}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x17, 0x1a, 0x18}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, }, { {0x16, 0x18, 0x00}, {0x15, 0x00, 0x14}, {0x17, 0x1a, 0x1d}, {0x15, 0x00, 0x11}, {0x11, 0x00, 0x00}, }, { {0x16, 0x1a, 0x1c}, {0x15, 0x00, 0x15}, {0x17, 0x1a, 0x1d}, {0x15, 0x00, 0x15}, {0x11, 0x00, 0x11}, }, }; /* letter B */ const int blockB[CHAR_ANIME][CHARH][CHARW] = { { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x10, 0x00, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x1b, 0x18, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x1b, 0x1a, 0x18}, }, { {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x17, 0x18, 0x00}, {0x15, 0x00, 0x14}, {0x1b, 0x1a, 0x19}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x17, 0x1a, 0x1c}, {0x15, 0x00, 0x15}, {0x1b, 0x1a, 0x19}, }, { {0x1e, 0x18, 0x00}, {0x15, 0x00, 0x14}, {0x17, 0x1a, 0x1d}, {0x15, 0x00, 0x15}, {0x1b, 0x1a, 0x19}, }, { {0x1e, 0x1a, 0x1c}, {0x15, 0x00, 0x15}, {0x17, 0x1a, 0x1d}, {0x15, 0x00, 0x15}, {0x1b, 0x1a, 0x19} } }; /* letter L */ const int blockL[CHAR_ANIME][CHARH][CHARW] = { { {0x10, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x11, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x11, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x13, 0x18, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x18}, }, }; /* Letter S */ const int blockS[CHAR_ANIME][CHARH][CHARW] = { { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x10, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x00, 0x00, 0x00}, {0x14, 0x00, 0x00}, {0x13, 0x18, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x14, 0x00, 0x00}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x18}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, }, { {0x16, 0x18, 0x00}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x1c}, {0x00, 0x00, 0x11}, {0x00, 0x00, 0x00}, }, { {0x16, 0x1a, 0x18}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x1c}, {0x00, 0x00, 0x15}, {0x00, 0x00, 0x11}, }, { {0x16, 0x1a, 0x18}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x1c}, {0x00, 0x00, 0x15}, {0x00, 0x12, 0x19}, }, { {0x16, 0x1a, 0x18}, {0x15, 0x00, 0x00}, {0x13, 0x1a, 0x1c}, {0x00, 0x00, 0x15}, {0x12, 0x1a, 0x19}, }, }; /* Letter T */ const int blockT[CHAR_ANIME][CHARH][CHARW] = { { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x10, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x14, 0x00}, {0x00, 0x11, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x00, 0x00}, {0x00, 0x14, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x11, 0x00}, }, { {0x00, 0x00, 0x00}, {0x00, 0x14, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x11, 0x00}, }, { {0x00, 0x14, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x11, 0x00}, }, { {0x12, 0x1e, 0x18}, {0x00, 0x15, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x15, 0x00}, {0x00, 0x11, 0x00}, }, }; /* * level data for generic scorebaord */ const XBScoreGraphics graphicsScoreBoard = { {"score_right_up", COLOR_BLACK, COLOR_LIGHT_STEEL_BLUE, COLOR_BLACK}, {"score_right_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_BLACK}, {"score_mid_up", COLOR_BLACK, COLOR_SPRING_GREEN, COLOR_LIGHT_STEEL_BLUE}, {"score_mid_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_STEEL_BLUE}, {"score_left_up", COLOR_BLACK, COLOR_SPRING_GREEN, COLOR_LIGHT_STEEL_BLUE}, {"score_left_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_STEEL_BLUE}, {"score_floor", COLOR_BLACK, COLOR_SPRING_GREEN, COLOR_BLACK}, {"score_step", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_STEEL_BLUE}, {"score_drop", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_SPRING_GREEN}, {"score_floor", COLOR_BLACK, COLOR_BLACK, COLOR_BLACK}, {"score_floor", COLOR_ROYAL_BLUE, COLOR_ROYAL_BLUE, COLOR_ROYAL_BLUE}, }; XBScoreMap mapScoreBoard = { {7, 7, 7, 6, 0, 1, 0, 1, 0, 1, 0, 1, 6,}, {7, 7, 7, 6, 0, 1, 0, 1, 0, 1, 0, 1, 6,}, {7, 7, 7, 6, 0, 1, 0, 1, 0, 1, 0, 1, 6,}, {7, 7, 7, 6, 2, 3, 2, 3, 2, 3, 2, 3, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, {7, 7, 7, 6, 4, 5, 4, 5, 4, 5, 4, 5, 6,}, }; const XBScoreMap mapWinGame = { {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, {7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,}, }; /* * level data for load player screen */ const XBScoreGraphics graphicsLoadSprite = { {"score_floor", COLOR_WHITE, COLOR_WHITE, COLOR_WHITE}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, {NULL, COLOR_INVALID, COLOR_INVALID, COLOR_INVALID}, }; const XBScoreMap mapLoadSprite = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, }; /* * audience for score board */ const BMSpriteAnimation winnerAnime[NUM_WINNER_ANIME] = { SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, SpriteWinner, SpriteWinner2, SpriteWinner3, SpriteStopDown, }; const BMSpriteAnimation looserAnime[NUM_LOOSER_ANIME] = { SpriteLooser, SpriteLooser, SpriteLooser1, SpriteLooser1, SpriteLooser, SpriteLooser, SpriteLooser, SpriteLooser2, SpriteLooser2, SpriteLooser, }; const BMSpriteAnimation otherWinnerAnime[NUM_OTHER_WINNER_ANIME] = { SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, SpriteWinner, SpriteWinner2, SpriteWinner3, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, }; const BMSpriteAnimation otherLooserAnime[NUM_OTHER_LOOSER_ANIME] = { SpriteLooser, SpriteLooser, SpriteLooser1, SpriteLooser1, SpriteLooser, SpriteLooser, SpriteLooser, SpriteLooser2, SpriteLooser2, SpriteLooser, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, }; const BMSpriteAnimation laOlaAnime[NUM_LAOLA_ANIME] = { SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, SpriteWinner, SpriteWinner, SpriteWinner, SpriteWinner2, SpriteWinner3, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, }; /* * end of file introdat.h */ xblast-2.10.4/introdat.h0000644000175000017500000000526010372731124014210 0ustar rhondaalfie/* * file introdat.h - animation and layouts for intro and inbetween screens * * $Id: introdat.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_INTRODAT_H #define XBLAST_INTRODAT_H /* * type definitions */ typedef struct { const char *text; unsigned flags; BMRectangle rect; } IntroTextBox; /* * constants */ #define INTRO_LENGTH 35 #define SIZE_OF_X 16 #define CHAR_ANIME 7 #define NUM_WINNER_ANIME 8 #define NUM_LOOSER_ANIME 10 #define NUM_OTHER_WINNER_ANIME 40 #define NUM_OTHER_LOOSER_ANIME 42 #define NUM_LAOLA_ANIME 32 /* * global variables */ /* text for first screen */ extern const IntroTextBox introBox[]; /* text with copyright notice */ extern const IntroTextBox creditsBox[]; /* Big X for intro screen */ extern const BMPoint pointx[SIZE_OF_X]; /* explosion data for letter animations */ extern const int blockB[CHAR_ANIME][CHARH][CHARW]; extern const int blockL[CHAR_ANIME][CHARH][CHARW]; extern const int blockA[CHAR_ANIME][CHARH][CHARW]; extern const int blockS[CHAR_ANIME][CHARH][CHARW]; extern const int blockT[CHAR_ANIME][CHARH][CHARW]; /* title box for level intro */ extern IntroTextBox titleBox[]; extern IntroTextBox playerInfoBox[]; extern IntroTextBox levelInfoBox[]; extern IntroTextBox extraInfoBox[]; /* level data for scoreboard */ extern const XBScoreGraphics graphicsScoreBoard; extern XBScoreMap mapScoreBoard; /* level data for load sprite screen */ extern const XBScoreGraphics graphicsLoadSprite; extern const XBScoreMap mapLoadSprite; /* audience for score board */ extern const BMSpriteAnimation winnerAnime[NUM_WINNER_ANIME]; extern const BMSpriteAnimation looserAnime[NUM_LOOSER_ANIME]; extern const BMSpriteAnimation otherWinnerAnime[NUM_OTHER_WINNER_ANIME]; extern const BMSpriteAnimation otherLooserAnime[NUM_OTHER_LOOSER_ANIME]; extern const BMSpriteAnimation laOlaAnime[NUM_LAOLA_ANIME]; #endif /* * end of file intro_dat.h */ xblast-2.10.4/level.c0000644000175000017500000001517610412220337013467 0ustar rhondaalfie/* * file level.c - Setting up level given in database * * $Id: level.c,v 1.14 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" static DBRoot *warnings = NULL; /* * initialize level problem database */ static void InitLevelWarnings (void) { if (warnings != NULL) { DB_DeleteAll (warnings); } else { warnings = DB_Create (DT_Level, GUI_StringToAtom ("levelwarn!")); assert (warnings != NULL); } } /* InitLevelWarnings */ /* * get number of warnings found in last parse */ unsigned GetWarningCount (void) { unsigned cnt = DB_NumAllEntries (warnings); Dbg_Out ("warnings = %u\n", cnt); return cnt; } /* GetWarningCount */ /* * parse a new level */ XBBool ParseLevel (const DBRoot * level) { DBSection *sec, *sec1, *sec2; #ifdef DEBUG Dbg_StartClock (); #endif Dbg_Level ("start parsing\n"); /* sanity check */ assert (level != NULL); InitLevelWarnings (); /* TODO: disallow random positions in some levels */ /* create info section in warnings, then parse */ Dbg_Level ("parsing section [%s]\n", GUI_AtomToString (atomInfo)); sec = DB_CreateSection (warnings, atomInfo); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } if (!ParseLevelInfo (DB_GetSection (level, atomInfo), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* create player section in warning, then parse */ sec = DB_CreateSection (warnings, atomPlayer); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } Dbg_Level ("parsing section [%s]\n", GUI_AtomToString (atomPlayer)); if (!ParseLevelPlayers (DB_GetSection (level, atomPlayer), GetGameModeInfo (), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* setup shrink pattern */ sec = DB_CreateSection (warnings, atomShrink); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } Dbg_Level ("parsing section [%s]\n", GUI_AtomToString (atomShrink)); if (!ParseLevelShrink (DB_GetSection (level, atomShrink), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* setup scrambling blocks */ sec1 = DB_CreateSection (warnings, atomScrambleDraw); if (NULL == sec1) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } sec2 = DB_CreateSection (warnings, atomScrambleDel); if (NULL == sec2) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } Dbg_Level ("parsing sections [%s] and [%s]\n", GUI_AtomToString (atomScrambleDraw), GUI_AtomToString (atomScrambleDel)); if (!ParseLevelScramble (DB_GetSection (level, atomScrambleDraw), DB_GetSection (level, atomScrambleDel), sec1, sec2)) { Dbg_Level ("sections invalid!\n"); return XBFalse; } /* setup function pointers */ sec = DB_CreateSection (warnings, atomFunc); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } Dbg_Level ("parsing section [%s]\n", GUI_AtomToString (atomFunc)); if (!ParseLevelFunc (DB_GetSection (level, atomFunc), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* setup bombs */ sec = DB_CreateSection (warnings, atomBombs); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } Dbg_Level ("parsing section [%s]\n", GUI_AtomToString (atomBombs)); if (!ParseLevelBombs (DB_GetSection (level, atomBombs), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* setup graphics */ sec = DB_CreateSection (warnings, atomGraphics); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } if (!ParseLevelGraphics (DB_GetSection (level, atomGraphics), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } /* setup map layout */ sec = DB_CreateSection (warnings, atomMap); if (NULL == sec) { Dbg_Level ("failed to create warning section\n"); return XBFalse; } if (!ParseLevelMap (DB_GetSection (level, atomMap), sec)) { Dbg_Level ("section invalid!\n"); return XBFalse; } Dbg_Level ("parsed in %lu msec\n", Dbg_FinishClock ()); /* show all warnings */ if (GetWarningCount ()) { DB_Dump (warnings); } return XBTrue; } /* ParseLevel */ /* * Configure new level */ XBBool ConfigLevel (const DBRoot * level) { /* sanity check */ assert (level != NULL); /* parse first */ if (!ParseLevel (level)) { return XBFalse; } #ifdef DEBUG Dbg_StartClock (); #endif Dbg_Level ("start configuring\n"); ConfigLevelPlayers (DB_GetSection (level, atomPlayer), XBTrue, GetGameModeInfo ()); ConfigLevelShrink (DB_GetSection (level, atomShrink)); ConfigLevelFunc (DB_GetSection (level, atomFunc)); ConfigLevelBombs (DB_GetSection (level, atomBombs)); ConfigLevelGraphics (DB_GetSection (level, atomGraphics)); ConfigLevelMap (DB_GetSection (level, atomMap)); Dbg_Level ("configured in %lu msec\n", Dbg_FinishClock ()); return XBTrue; } /* ConfigLevel */ /* * clean up after level */ void FinishLevel (void) { /* shrinking */ FinishLevelShrink (); /* graphics */ FinishLevelGraphics (); /* explosions */ DeleteAllExplosions (); } /* FinishLevel */ /* * get string of level */ static const char * GetLevelString (const DBRoot * level, XBAtom atom) { const char *s; const DBSection *section; assert (level != NULL); section = DB_GetSection (level, atomInfo); if (NULL == section) { return NULL; } if (!DB_GetEntryString (section, atom, &s)) { return NULL; } return s; } /* GetLevelString */ /* * get name of level */ const char * GetLevelName (const DBRoot * level) { return GetLevelString (level, atomName); } /* GetLevelName */ /* * get author of level */ const char * GetLevelAuthor (const DBRoot * level) { return GetLevelString (level, atomAuthor); } /* GetLevelAuthor */ /* * get hint for level */ const char * GetLevelHint (const DBRoot * level) { return GetLevelString (level, atomHint); } /* GetLevelHint */ /* * end of file level.c */ xblast-2.10.4/level.h0000644000175000017500000000246510373126076013504 0ustar rhondaalfie/* * file level.h - Setting up level given in database * * $Id: level.h,v 1.8 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LEVEL_H #define _LEVEL_H /* * global prototypes */ extern XBBool ParseLevel (const DBRoot * level); extern XBBool ConfigLevel (const DBRoot * level); extern void FinishLevel (void); extern const char *GetLevelName (const DBRoot * level); extern const char *GetLevelAuthor (const DBRoot * level); extern const char *GetLevelHint (const DBRoot * level); extern unsigned GetWarningCount (void); #endif /* * end of file level.h */ xblast-2.10.4/makew32.bat0000644000175000017500000000030710047640427014155 0ustar rhondaalfie@echo off del xblast.exe copy makefile.w32 makefile cmake clean cmake strip xblast.exe copy xblast.exe c:\d\games\xblast\xeblast.exe zip -9 ..\XB300104.zip xblast.exe cmake clean sweep del xblast.exexblast-2.10.4/makewxs.sh0000644000175000017500000001520210175441254014226 0ustar rhondaalfieecho ' '>xblast.wxs cd level list=`ls *xal` for i in $list ; do if [ ${#i} -gt 8 ]; then k=`expr substr $i 1 6`~1.xal else k=$i fi echo \ >../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs done; cd .. echo ' '> tmp cat xblast.wxs tmp > tmp2 mv tmp2 xblast.wxs cd image echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs cd explosion list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../../tmp cat ../../xblast.wxs ../../tmp > ../../tmp2 mv ../../tmp2 ../../xblast.wxs done; cd .. echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs cd sprite list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../../tmp cat ../../xblast.wxs ../../tmp > ../../tmp2 mv ../../tmp2 ../../xblast.wxs done; cd .. echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs cd block list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../../tmp cat ../../xblast.wxs ../../tmp > ../../tmp2 mv ../../tmp2 ../../xblast.wxs done; cd .. echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs cd score list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../../tmp cat ../../xblast.wxs ../../tmp > ../../tmp2 mv ../../tmp2 ../../xblast.wxs done; cd .. echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs cd misc list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../../tmp cat ../../xblast.wxs ../../tmp > ../../tmp2 mv ../../tmp2 ../../xblast.wxs done; cd .. cd .. cd sounds echo ' '> ../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs list=`ls` for i in $list ; do if [ ${#i} -gt 8 ]; then j=${#i} h=`expr $j - 2` k=`expr substr $i 1 6`~1.`expr substr $i $h 3` else k=$i fi echo \ >../tmp cat ../xblast.wxs ../tmp > ../tmp2 mv ../tmp2 ../xblast.wxs done; cd .. echo ' '> tmp cat xblast.wxs tmp > tmp2 mv tmp2 xblast.wxs xblast-2.10.4/map.c0000644000175000017500000006353110377702425013150 0ustar rhondaalfie/* * file map.c - handling the level tile map * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * $Id: map.c,v 1.34 2006/02/24 22:13:41 fzago Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ /* extra distribution */ enum BMExtraDistribution { DEnone = 0, DEsingle, DEall, DEspecial, DEget, DEdouble }; /* one maze column */ typedef unsigned short col[MAZE_H]; /* extra probabilities */ typedef struct { int bomb; int range; int ill; int invinc; int evil; } BMExtraProb; /* * local variables */ static col em1[MAZE_W]; static col em2[MAZE_W]; static col *explMaze = em1; static col *oldExplMaze = em2; static col em3[MAZE_W]; // KOEN static col *kexplMaze = em3; // KOEN static unsigned explDirty; static unsigned explOldDirty; static unsigned redrawMaze[MAZE_H]; static unsigned redrawStat[STAT_H + 1]; static BMMapTile maze[MAZE_W + 1][MAZE_H + 1]; static BMMapTile extra[MAZE_W][MAZE_H]; static Sprite *bombSprite[MAZE_W][MAZE_H]; static XBBool tilesInitialized = XBFalse; static BMBlockTile tile[MAX_BLOCK]; /* Added by VVL (Chat) 12/11/99 */ static unsigned redrawChat; static unsigned redrawTiles; static XBBool mapMode = XBFalse; static int distribExtras; static BMExtraProb extraProb; /* conversion table for level parsing */ static DBToInt distribExtraTable[] = { {"all", (int)DEall}, {"double", (int)DEdouble}, {"get", (int)DEget}, {"none", (int)DEnone}, {"single", (int)DEsingle}, {"special", (int)DEspecial}, {NULL, -1}, }; /* * compare to tile graphics */ static XBBool CompareTile (const BMBlockTile * a, const BMBlockTile * b) { return (0 == strcmp (a->name, b->name) && a->fg == b->fg && a->bg == b->bg && a->add == b->add); } /* CompareTile */ void SetXBMapMode (XBBool mode) { mapMode = mode; } XBBool GetXBMapMode (void) { return mapMode; } /* * parse level data for graphics */ XBBool ParseLevelGraphics (const DBSection * section, DBSection * warn) { int i; const char *s; char **argv[MAX_BLOCK]; int argc; /* check if section exists */ if (NULL == section) { Dbg_Out ("LEVEL: graphics section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* set tile names to NULL if called for first time */ if (!tilesInitialized) { for (i = 0; i < MAX_BLOCK; i++) { tile[i].name = NULL; } tilesInitialized = XBTrue; } /* parse each entry */ for (i = 0; i < MAX_BLOCK; i++) { if (!DB_GetEntryString (section, atomArrayBlock00[i], &s)) { Dbg_Out ("LEVEL: critical failure, %s is missing\n", GUI_AtomToString (atomArrayBlock00[i])); DB_CreateEntryString (warn, atomArrayBlock00[i], "missing"); return XBFalse; } argv[i] = SplitString (s, &argc); assert (NULL != argv[i]); if (NULL != tile[i].name) { free ((void *)tile[i].name); tile[i].name = NULL; } /* check block type */ if (1 == argc) { /* simple rgb pixmap */ tile[i].name = DupString (argv[i][0]); tile[i].fg = COLOR_INVALID; tile[i].bg = COLOR_INVALID; tile[i].add = COLOR_INVALID; } else if (4 == argc) { /* layered ppm pixmap */ tile[i].name = DupString (argv[i][0]); if (COLOR_INVALID == (tile[i].fg = StringToColor (argv[i][1])) || COLOR_INVALID == (tile[i].bg = StringToColor (argv[i][2])) || COLOR_INVALID == (tile[i].add = StringToColor (argv[i][3]))) { free ((char *)argv[i]); Dbg_Out ("LEVEL: critical failure, invalid value for %s\n", GUI_AtomToString (atomArrayBlock00[i])); DB_CreateEntryString (warn, atomArrayBlock00[i], "invalid"); return XBFalse; } } else { free ((char *)argv[i]); Dbg_Out ("LEVEL: critical failure, invalid value for %s\n", GUI_AtomToString (atomArrayBlock00[i])); DB_CreateEntryString (warn, atomArrayBlock00[i], "invalid"); return XBFalse; } free ((char *)argv[i]); } return XBTrue; } /* * configure after parsing */ void ConfigLevelGraphics (const DBSection * section) { int i; assert (section != NULL); /* load blocks */ Dbg_Out ("checking graphics\n"); for (i = 0; i < MAX_BLOCK; i++) { if (tile[i].fg != COLOR_INVALID) { GUI_LoadBlockCch (i, tile[i].name, tile[i].fg, tile[i].bg, tile[i].add); } else { GUI_LoadBlockRgb (i, tile[i].name); } } GUI_InitExplosionBlocks (); /* set level info */ if (CompareTile (tile + BTFree, tile + BTBlock)) { AddLevelInfo (N_("Walls are invisible")); } if (CompareTile (tile + BTBomb, tile + BTRange) && CompareTile (tile + BTBomb, tile + BTSick) && CompareTile (tile + BTBomb, tile + BTSpecial)) { AddLevelInfo (N_("Extras all look the same")); } if (CompareTile (tile + BTExtra, tile + BTBlock)) { AddLevelInfo (N_("Some walls are blastable")); } Dbg_Out ("checked graphics\n"); /* that's all */ } /* ConfigLevelGraphics */ /* * string for extra prob */ static const char * ExtraProbString (int val) { if (val <= 0) { return NULL; } else if (val <= 4) { return N_("scarce"); } else if (val <= 8) { return N_("rare"); } else if (val <= 16) { return N_("uncommon"); } else if (val <= 32) { return N_("common"); } else { return N_("plentiful"); } } /* ExtraProbName */ /* * clean up graphics allocated by level */ void FinishLevelGraphics (void) { int i; for (i = 0; i < MAX_BLOCK; i++) { if (NULL != tile[i].name) { free ((void *)tile[i].name); tile[i].name = NULL; } } for (i = 0; i < MAX_TILE; i++) { GUI_FreeBlock (i); } GUI_FreeExplosionBlocks (); } /* UnloadBlocks */ /* * parse level data */ XBBool ParseLevelMap (const DBSection * section, DBSection * warn) { int prob, slowFlame; int x, y; const char *s; /* check if section exists */ if (NULL == section) { Dbg_Out ("LEVEL: map section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* ExtraDistribution has default */ switch (DB_ConvertEntryInt (section, atomExtraDistribution, (int *)&distribExtras, distribExtraTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomExtraDistribution)); distribExtras = DEnone; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomExtraDistribution)); distribExtras = DEnone; DB_CreateEntryString (warn, atomExtraDistribution, DB_IntToString (distribExtraTable, distribExtras)); break; default: break; } /* ProbBomb has default */ if (DB_GetEntryInt (section, atomProbBomb, &prob)) { extraProb.bomb = 64 * prob / 100; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomProbBomb)); extraProb.bomb = 0; } /* ProbRange has default */ if (DB_GetEntryInt (section, atomProbRange, &prob)) { extraProb.range = extraProb.bomb + 64 * prob / 100; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomProbRange)); extraProb.range = extraProb.bomb; } /* ProbVirus has default */ if (DB_GetEntryInt (section, atomProbVirus, &prob)) { extraProb.ill = extraProb.range + 64 * prob / 100; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomProbVirus)); extraProb.ill = extraProb.range; } /* ProbSpecial has default */ if (DB_GetEntryInt (section, atomProbSpecial, &prob)) { extraProb.invinc = extraProb.ill + 64 * prob / 100; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomProbSpecial)); extraProb.invinc = extraProb.ill; } /* ProbHidden has default */ if (DB_GetEntryInt (section, atomProbHidden, &prob)) { extraProb.evil = extraProb.invinc + 64 * prob / 100; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomProbHidden)); extraProb.evil = extraProb.invinc; } if (Version_AtLeast (VERSION_JOINT, &Ver_2_10_1)) { /* SlowMotionBurst has default, since 2.10.1 */ if (DB_GetEntryInt (section, atomSlowFlame, &prob)) { slowFlame = prob; } else { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomSlowFlame)); slowFlame = 1; } SetSlowMotionBurst (slowFlame); } /* the layout */ for (y = 0; y < MAZE_H; y++) { if (!DB_GetEntryString (section, atomArrayRow00[y], &s)) { Dbg_Out ("LEVEL: critical failure, missing %s!\n", DB_SectionEntryString (section, atomArrayRow00[y])); DB_CreateEntryString (warn, atomArrayRow00[y], "missing"); return XBFalse; } for (x = 0; x < MAZE_W; x++) { switch (s[x]) { case '_': case 'B': case 'R': case 'X': case 'b': case 'r': case 's': case 'q': case 'v': case 'e': case 'V': break; default: Dbg_Out ("LEVEL: critical failure, invalid entry %s!\n", DB_SectionEntryString (section, atomArrayRow00[y])); DB_CreateEntryString (warn, atomArrayRow00[y], "invalid"); return XBFalse; } } } return XBTrue; } /* * configure level map layout */ void ConfigLevelMap (const DBSection * section) { int x, y; const char *s; XBBool okay; assert (section != NULL); /* set level info */ if (NULL != (s = ExtraProbString (extraProb.bomb))) { AddExtraInfo (N_("Bomb extras are %s"), gettext(s)); } if (NULL != (s = ExtraProbString (extraProb.range - extraProb.bomb))) { AddExtraInfo (N_("Rang extras are %s"), gettext(s)); } if (NULL != (s = ExtraProbString (extraProb.ill - extraProb.range))) { AddExtraInfo (N_("Infections are %s"), gettext(s)); } if (NULL != (s = ExtraProbString (extraProb.invinc - extraProb.ill))) { AddExtraInfo (N_("Special extras are %s"), gettext(s)); } if (NULL != (s = ExtraProbString (extraProb.evil - extraProb.invinc))) { AddExtraInfo (N_("Hidden bombs are %s"), gettext(s)); } /* the layout */ for (y = 0; y < MAZE_H; y++) { okay = DB_GetEntryString (section, atomArrayRow00[y], &s); assert (okay); for (x = 0; x < MAZE_W; x++) { switch (s[x]) { case '_': SetMazeBlock (x, y, BTFree); break; case 'B': SetMazeBlock (x, y, BTBlock); break; case 'R': SetMazeBlock (x, y, BTBlockRise); break; case 'X': SetMazeBlock (x, y, BTExtra); break; case 'b': SetMazeBlock (x, y, BTBomb); break; case 'r': SetMazeBlock (x, y, BTRange); break; case 's': SetMazeBlock (x, y, BTSick); break; case 'q': SetMazeBlock (x, y, BTSpecial); break; case 'v': SetMazeBlock (x, y, BTVoid); break; case 'e': SetMazeBlock (x, y, BTEvil); break; case 'V': SetMazeBlock (x, y, BTBackground); break; default: break; } explMaze[x][y] = 0; oldExplMaze[x][y] = 0; redrawMaze[y] &= ~(1 << x); } } /* that's all */ } /* ConfigLevelMap */ /* * public function: setup_graphics */ void ConfigScoreGraphics (const XBScoreGraphics data) { int i; for (i = 0; i < MAX_BLOCK; i++) { if (NULL != data[i].name) { if (data[i].fg == COLOR_INVALID) { GUI_LoadBlockRgb (i, data[i].name); } else { GUI_LoadBlockCch (i, data[i].name, data[i].fg, data[i].bg, data[i].add); } } else { GUI_FreeBlock (i); } } GUI_InitExplosionBlocks (); } /* ConfigScoreGraphics */ /* * public function setup_map */ void ConfigScoreMap (const XBScoreMap data) { int x, y; for (x = 0; x < MAZE_W; x++) { for (y = 0; y < MAZE_H; y++) { explMaze[x][y] = 0; oldExplMaze[x][y] = 0; redrawMaze[y] &= ~(1 << x); SetMazeBlock (x, y, data[x][y]); } } } /* ConfigScoreMap */ /* * */ void DrawMaze (void) { int x, y; ClearRedrawMap (); for (x = 0; x < MAZE_W; x++) { for (y = 0; y < MAZE_H; y++) { GUI_DrawBlock (x, y, maze[x][y]); } } /* if(mapMode){ for (x = 0; x < MAZE_W; x ++) { GUI_DrawBlock (x, MAZE_H, maze[x][MAZE_H]); } } */ GUI_FlushBlocks (); } /* DrawMaze */ /* * create list of rectangles to be redrawn */ void SetRedrawRectangles (void) { int x, y; for (y = 0; y < MAZE_H; y++) { if ((explDirty | explOldDirty) & (1 << y)) { for (x = 0; x < MAZE_W; x++) { if (redrawMaze[y] & (1 << x)) { GUI_AddMazeRectangle (x, y); } else if (explMaze[x][y] != oldExplMaze[x][y]) { GUI_AddMazeRectangle (x, y); redrawMaze[y] |= (1 << x); } } } else if (redrawMaze[y]) { for (x = 0; x < MAZE_W; x++) { if (redrawMaze[y] & (1 << x)) { GUI_AddMazeRectangle (x, y); } } } } for (y = 0; y < STAT_H; y++) { if (redrawStat[y]) { for (x = 0; x < STAT_W; x++) { if (redrawStat[y] & (1 << x)) { GUI_AddStatRectangle (x, y); } } } } if (redrawTiles) { for (x = 0; x < STAT_W; x++) { if (redrawTiles & (1 << x)) { GUI_AddTilesRectangle (x, 0); } } } /* Added by VVL (Chat) 12/11/99 : Begin */ if (redrawTiles) { for (x = 0; x < STAT_W; x++) { if (redrawTiles & (1 << x)) { GUI_AddTilesRectangle (x, 0); } } } /* Added by VVL (Chat) 12/11/99 : Begin */ if (redrawChat) { for (x = 0; x < STAT_W; x++) { if (redrawChat & (1 << x)) { GUI_AddChatRectangle (x, STAT_H); } } } /* Added by VVL (Chat) 12/11/99 : End */ } /* SetRedrawRectangles */ /* * mark region of tiles as to be redrawn */ void MarkMaze (int x1, int y1, int x2, int y2) { int x, y; #ifdef SMPF for (y = MAX (y1, 0); y <= MIN (y2, MAZE_H + 3); y++) { #else for (y = MAX (y1, 0); y <= MIN (y2, MAZE_H + 2); y++) { #endif if (y < MAZE_H) { for (x = MAX (x1, 0); x <= MIN (x2, MAZE_W - 1); x++) { redrawMaze[y] |= (1 << x); } } #ifdef SMPF /* Added by VVL (Chat) 12/11/99 : Begin */ else if (y == MAZE_H + 3) { #else else if (y == MAZE_H + 2) { #endif for (x = MAX (x1, 0); x <= MIN (x2, STAT_W - 1); x++) { redrawChat |= (1 << x); // redrawStat[y-MAZE_H] |= (1< PIXH) { MarkMaze (x / STAT_WIDTH, y / BLOCK_HEIGHT, (x + w - 1) / STAT_WIDTH, (y + h - 1) / BLOCK_HEIGHT); } else { MarkMaze (x / BLOCK_WIDTH, y / BLOCK_HEIGHT, (x + w - 1) / BLOCK_WIDTH, MAZE_H - 1); MarkMaze (x / STAT_WIDTH, MAZE_H, (x + w - 1) / STAT_WIDTH, (y + h - 1) / BLOCK_HEIGHT); } } /* MarkMazeRect */ /* * */ XBBool SpriteMarked (const Sprite * spr) { int left, right, top, bottom; const BMRectangle *r; int x, y; unsigned mask; /* get sprite drawing rectangle */ r = SpriteRectangle (spr); /* get borders of rectangle */ left = (r->x) / BLOCK_WIDTH; right = (r->x + r->w - 1) / BLOCK_WIDTH; top = (r->y) / BLOCK_HEIGHT; bottom = (r->y + r->h - 1) / BLOCK_HEIGHT; /* set redraw x test-mask */ mask = 0; for (x = left; x <= right; x++) { mask |= (1 << x); } /* check if any rectangle under sprite must be redrawn */ for (y = top; y <= bottom; y++) { /* check for blocks under sprite to be redrawn */ if (redrawMaze[y] & mask) { return XBTrue; } } return XBFalse; } /* SpriteMarked */ /* * */ void ClearRedrawMap (void) { col *swap; swap = oldExplMaze; oldExplMaze = explMaze; explMaze = swap; explOldDirty = explDirty; explDirty = 0; /* Added by VVL (Chat) 12/11/99 */ redrawChat = 0; redrawTiles = 0; memset (explMaze, 0, MAZE_W * sizeof (col)); memset (redrawMaze, 0, sizeof (redrawMaze)); memset (redrawStat, 0, sizeof (redrawStat)); } /* ClearRedrawMap */ /* * */ void UpdateMaze (void) { int x, y; /*if(mapMode){ height=MAZE_H+1; } else{ height=MAZE_H; } */ for (y = 0; y < MAZE_H; y++) { if (redrawMaze[y]) { /* check if explosions are needed in this row */ if (explDirty & (1 << y)) { for (x = 0; x < MAZE_W; x++) { if (redrawMaze[y] & (1 << x)) { if (explMaze[x][y] & 0x10) { GUI_DrawExplosion (x, y, explMaze[x][y] & 0xf); } else { GUI_DrawBlock (x, y, (int)maze[x][y]); } } } } else { /* only blocks are needed */ for (x = 0; x < MAZE_W; x++) { if (redrawMaze[y] & (1 << x)) { GUI_DrawBlock (x, y, (int)maze[x][y]); } } } } } GUI_FlushBlocks (); } /* UpdateMaze */ /* * */ void UpdateExpl (void) { int x, y; for (y = 0; y < MAZE_H; y++) { if (redrawMaze[y]) { for (x = 0; x < MAZE_W; x++) { if ((redrawMaze[y] & (1 << x)) && (explMaze[x][y] & 0x10)) { GUI_DrawExplosionSprite (x, y, explMaze[x][y] & 0xf); } } } } } /* UpdateExpl */ /* * */ XBBool CheckMaze (int x, int y) { return (maze[x][y] == BTBlock || maze[x][y] == BTBlockRise || maze[x][y] == BTExtra || maze[x][y] == BTExtraOpen || maze[x][y] == BTVoid || maze[x][y] < 0); } /* CheckMaze */ /* * */ XBBool CheckMazeFree (int x, int y) { return (maze[x][y] == BTFree || maze[x][y] == BTBurned); } /* CheckMazeFree */ /* * */ XBBool CheckMazeFree2 (int x, int y) { return (maze[x][y] == BTFree || maze[x][y] == BTVoid || // koen maze[x][y] == BTBurned); } /* CheckMazeFree */ /* * */ XBBool CheckMazeWall (int x, int y) { return (maze[x][y] == BTBlock || maze[x][y] == BTBlockRise); } /* CheckMazeWall */ /* public function check_maze_phantom_wall */ /* Written by Amilhastre */ int /* Written by Amilhastre */ CheckMazePhantomWall (int x, /* Written by Amilhastre */ int y) /* Written by Amilhastre */ { /* Written by Amilhastre */ return ((maze[x][y] == BTBlock) || (maze[x][y] == BTBlockRise) || (maze[x][y] == BTVoid)); /* Written by Amilhastre */ } /* Skywalker go through walls*/ int CheckMazeGhost (int ghost, int x, int y) { if (!ghost) { return CheckMaze (x, y); } return ((maze[x][y] == BTVoid) || (maze[x][y] < 0) || (x <= 0) || (y <= 0) || (x > MAZE_H) || (y > MAZE_W - 4) ); } XBBool CheckMazeSolid (int x, int y) { return (maze[x][y] == BTBlock || maze[x][y] == BTBlockRise || maze[x][y] == BTExtra || maze[x][y] == BTExtraOpen); } /* CheckMazeSolid */ /* * */ XBBool CheckMazeOpen (int x, int y) { return (maze[x][y] == BTFree || maze[x][y] == BTBurned || maze[x][y] == BTVoid); } /* CheckMazeOpen */ /* * */ XBBool CheckMazeExtra (int x, int y) { return (maze[x][y] == BTExtra); } /* CheckMazeExtra */ /* * */ XBBool CheckExplosion (int x, int y) { return (0 != explMaze[x][y]); } /* CheckExplosion */ /* * */ void SetExplBlock (int x, int y, int value) { if ((x >= 0) && (y >= 0) && (x < MAZE_W) && (y < MAZE_H)) { explMaze[x][y] |= value; kexplMaze[x][y] = !(explMaze[x][y] == 20); // KOEN explDirty |= (1 << y); } } /* SetExplBlock */ /* * */ void SetBlockExtra (int x, int y, BMMapTile value) { extra[x][y] = value; } /* SetBlockExtra */ /* * */ BMMapTile GetBlockExtra (int x, int y) { return extra[x][y]; } /* SetBlockExtra */ BMMapTile CheckBonuses (int x, int y) { return ((maze[x][y] == BTBomb) || (maze[x][y] == BTRange) || (maze[x][y] == BTSpecial) // || (maze[x][y]==BTExtra) ); } BMMapTile CheckBonuses2 (int x, int y) { return ((maze[x][y] == BTSpecial) // || (maze[x][y]==BTExtra) ); } void DeleteAllMapBombSprites (void) { int x, y; for (x = 0; x < MAZE_W; x++) { for (y = 0; y < MAZE_H; y++) { if (bombSprite[x][y]) { DeleteAllBombSprites (); bombSprite[x][y] = NULL; } } } } /* * */ void SetMazeBlock (int x, int y, BMMapTile block) { int rnd; #ifdef DEBUG_MAP Dbg_Out ("SetMazeBlock (%2d,%2d,%2d)\n", x, y, block); #endif MarkMazeTile (x, y); switch (block) { case BTExtra: if (mapMode) { if (bombSprite[x][y] != NULL) { DeleteSprite (bombSprite[x][y]); bombSprite[x][y] = NULL; } } rnd = GameRandomNumber (64); if (rnd < extraProb.bomb) { extra[x][y] = BTBomb; } else if (rnd < extraProb.range) { extra[x][y] = BTRange; } else if (rnd < extraProb.ill) { extra[x][y] = BTSick; } else if (rnd < extraProb.invinc) { extra[x][y] = BTSpecial; } else if (rnd < extraProb.evil) { extra[x][y] = BTEvil; } else { extra[x][y] = BTFree; } maze[x][y] = block; break; case BTEvil: if (mapMode) { if (x == 1 && y == 13) { maze[x][y] = BTBlock; } else { maze[x][y] = BTFree; } if (bombSprite[x][y] == NULL) { bombSprite[x][y] = CreateBombSprite (BB_NORMAL, x * BLOCK_WIDTH, y * BLOCK_HEIGHT, 0, SPM_MAPPED); fprintf (stderr, " creating sprite \n"); GUI_FlushBlocks (); } } else { maze[x][y] = BTFree; extra[x][y] = BTFree; NewEvilBomb (x, y); } break; case BTExtraOpen: if (mapMode) { if (bombSprite[x][y] != NULL) { DeleteSprite (bombSprite[x][y]); bombSprite[x][y] = NULL; } } maze[x][y] = block; break; default: if (mapMode) { if (bombSprite[x][y]) { DeleteSprite (bombSprite[x][y]); bombSprite[x][y] = NULL; } } maze[x][y] = block; extra[x][y] = BTFree; break; } } /* SetMazeBlock */ /* * */ BMMapTile GetMazeBlock (int x, int y) { return maze[x][y]; } /* * get extra on position (x,y) */ int GetExtra (int invincible, int x, int y) { int extraBlock; extraBlock = (maze[x][y] <= BTExtraOpen) ? 0 : maze[x][y]; if ((invincible > 0) && (extraBlock == BTSick)) { extraBlock = 0; } // if((x==1) && (y==4)) { Dbg_Out(" +++++++++++ %i %i \n", maze[x][y], extraBlock);} if (extraBlock != 0) { if (maze[x][y] != BTVoid) { SetMazeBlock (x, y, BTFree); } } /* check if special extras is distributed immediately */ if ((extraBlock == BTSpecial) && ((distribExtras == DEget) || (distribExtras == DEdouble))) { DistributeExtras (0, 0, -1, 0); } return extraBlock; } /* GetExtra */ /* * check if special extra are distributed */ XBBool DistribSpecial (void) { return (distribExtras == DEspecial); } /* DistribSpecial */ /* * */ static int PutExtras (int freeBlocks, BMPosition * distPos, BMMapTile tile, int numExtras) { int i, where; BMPosition swap; for (i = 0; (freeBlocks > 0) && (i < numExtras); i++) { where = GameRandomNumber (freeBlocks); SetMazeBlock (distPos[where].x, distPos[where].y, tile); freeBlocks--; /* this position is used */ if (where != freeBlocks) { swap = distPos[where]; distPos[where] = distPos[freeBlocks]; distPos[freeBlocks] = swap; } } return freeBlocks; } /* PutExtras */ /* * */ void DistributeExtras (int bombs, int range, int extras, int specials) { int x, y; int i; int freeBlocks = 0; int numExtras = 0; static unsigned distExtra[MAZE_H]; static BMPosition distPos[MAZE_W * MAZE_H]; /* are there extras to distribute */ if (bombs + range + extras + specials == 0) { return; } /* Create Extra Distribution Map */ memset (distExtra, 0, sizeof (distExtra)); /* First check for free Blocks */ for (x = 0; x < MAZE_W; x++) { for (y = 0; y < MAZE_H; y++) { if (maze[x][y] == BTBurned || maze[x][y] == BTFree) { distExtra[y] |= (1 << x); freeBlocks++; } } } freeBlocks = CheckDistribExpl (distExtra, freeBlocks); if (freeBlocks <= 0) { return; } /* fill dist_koord array */ i = 0; for (x = 0; x < MAZE_W; x++) { for (y = 0; y < MAZE_H; y++) { if (distExtra[y] & (1 << x)) { distPos[i].x = x; distPos[i].y = y; i++; } } } /* Distribute special extras */ /* use -1 for direct distribution on get extra */ switch (distribExtras) { case DEnone: numExtras = 0; break; case DEsingle: numExtras = (extras > 0) ? 1 : 0; break; case DEall: numExtras = (extras > 0) ? extras : 0; break; case DEspecial: numExtras = (specials + 2) / 3; break; case DEget: numExtras = (extras < 0) ? 1 : 0; break; case DEdouble: numExtras = (extras < 0) ? 2 : 0; break; } freeBlocks = PutExtras (freeBlocks, distPos, BTSpecial, numExtras); if (freeBlocks <= 0) { return; } /* distribute range extras */ freeBlocks = PutExtras (freeBlocks, distPos, BTRange, range); if (freeBlocks <= 0) { return; } /* distribute bombs */ freeBlocks = PutExtras (freeBlocks, distPos, BTBomb, bombs); if (freeBlocks <= 0) { return; } } /* DistributeExtras */ /* * */ void BlastExtraBlock (int x, int y) { switch (maze[x][y]) { /* open extra block */ case BTExtraOpen: SetMazeBlock (x, y, extra[x][y]); break; /* special extras are redistributed in DEget mode */ case BTSpecial: if (DEget == distribExtras || DEdouble == distribExtras) { DistributeExtras (0, 0, -1, 0); } /* blast away extra and correct shadow */ case BTSick: case BTBomb: case BTRange: SetMazeBlock (x, y, BTFree); break; default: break; } } /* BlastExtraBlock */ /* * */ void CopyExplBlock (int x, int y, const int block[CHARH][CHARW]) { int xp, yp; for (xp = x; xp < x + CHARW; xp++) { for (yp = y; yp < y + CHARH; yp++) { explMaze[xp][yp] = block[yp - y][xp - x]; explDirty |= (1 << yp); redrawMaze[yp] |= (1 << xp); } } } /* CopyExplBlock */ /* * end of file map.c */ xblast-2.10.4/map.h0000644000175000017500000000754710372731124013153 0ustar rhondaalfie/* * file map.h - managing the level tile map * * $Id: map.h,v 1.12 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MAP_H #define XBLAST_MAP_H /* * type definitions */ /* tiles used in game */ typedef enum { BTEvil = -2, /* virtual tile: free space with bomb */ BTBackground = -1, /* virtual tile: don't draw this block */ BTFree = 0, /* free tile */ BTBurned, /* burned, free tile */ BTBlock, /* solid wall */ BTBlockRise, /* solid wall (rising) */ BTExtra, /* extra block */ BTExtraOpen, /* extras block (cracked/opening) */ BTBomb, /* bomb extra */ BTRange, /* range extra */ BTSick, /* illness extra */ BTSpecial, /* special extra */ BTVoid, /* empty space for decoration */ BTNUM } BMMapTile; /* graphics definition for single tile */ typedef struct { const char *name; XBColor fg; XBColor bg; XBColor add; } BMBlockTile; /* graphics definition for tile */ typedef BMBlockTile XBScoreGraphics[MAX_BLOCK]; /* layout for score board */ typedef BMMapTile XBScoreMap[MAZE_W][MAZE_H]; /* * prototypes */ extern XBBool ParseLevelGraphics (const DBSection * section, DBSection * warn); extern void ConfigLevelGraphics (const DBSection * section); extern XBBool ParseLevelMap (const DBSection * section, DBSection * warn); extern void ConfigLevelMap (const DBSection * section); extern void ConfigScoreGraphics (const XBScoreGraphics data); extern void ConfigScoreMap (const XBScoreMap data); extern void FinishLevelGraphics (void); extern void DrawMaze (void); extern void SetRedrawRectangles (void); extern void MarkMaze (int x1, int y1, int x2, int y2); extern void MarkMazeTile (int x, int y); extern void MarkMazeRect (int x, int y, int w, int h); extern XBBool SpriteMarked (const Sprite * spr); extern void ClearRedrawMap (void); extern void UpdateMaze (void); extern void UpdateExpl (void); extern XBBool CheckMaze (int x, int y); extern XBBool CheckMazeFree (int x, int y); extern XBBool CheckMazeFree2 (int x, int y); extern XBBool CheckMazeOpen (int x, int y); extern XBBool CheckMazeWall (int x, int y); extern XBBool CheckMazeSolid (int x, int y); extern XBBool CheckMazeExtra (int x, int y); extern XBBool CheckExplosion (int x, int y); extern void SetBlockExtra (int x, int y, BMMapTile extra); extern void SetMazeBlock (int x, int y, BMMapTile block); extern void SetExplBlock (int x, int y, int value); extern int GetExtra (int invincible, int x, int y); extern XBBool DistribSpecial (void); extern void DistributeExtras (int bombs, int range, int extras, int specials); extern void BlastExtraBlock (int x, int y); extern void CopyExplBlock (int x, int y, const int block[CHARH][CHARW]); extern BMMapTile GetBlockExtra (int x, int y); extern BMMapTile CheckBonuses (int x, int y); extern BMMapTile CheckBonuses2 (int x, int y); extern int CheckMazePhantomWall (int x, int y); extern int CheckMazeGhost (int ghost, int x, int y); extern BMMapTile GetMazeBlock (int x, int y); extern void DeleteAllBombSprites (void); extern void DeleteAllMapBombSprites (void); extern void SetXBMapMode (XBBool mode); extern XBBool GetXBMapMode (void); #endif /* * end of file map.h */ xblast-2.10.4/menu.c0000644000175000017500000002717210373111603013324 0ustar rhondaalfie/* * file menu.c - user interface for game setup * * $Id: menu.c,v 1.13 2006/02/10 13:22:11 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define ANIME_WAVE 9 #define ANIME_HOLD 12 #define ANIME_LENGTH (ANIME_WAVE+ANIME_HOLD) static CFGCentralSetup centralSetup; #define MSG_LENGTH 80 static char centralname[MSG_LENGTH]; /* * local variables */ static int defaultCentral; static XBAtom gameType; static const CFGPlayerGraphics *audience_ptr[MAX_PLAYER]; static BMSpriteAnimation player_anime[ANIME_WAVE + 2 * ANIME_HOLD] = { SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, SpriteWinner, SpriteWinner, SpriteWinner2, SpriteWinner3, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, SpriteStopDown, }; /* combo entries for sound mode */ static XBComboEntryList soundModeList[] = { {N_("None"), XBSM_None, NULL, ATOM_INVALID,}, {N_("Beep"), XBSM_Beep, NULL, ATOM_INVALID,}, {N_("Waveout"), XBSM_Waveout, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; /* combo entries for video mode */ static XBComboEntryList videoModeList[] = { {N_("No"), XBVM_Windowed, NULL, ATOM_INVALID,}, {N_("Yes"), XBVM_Full, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList centralList[] = { {"xblast.debian.net (default)", 0, NULL, ATOM_INVALID,}, {"Koen's Central", 1, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList centralList1[] = { {"xblast.debian.net", 0, NULL, ATOM_INVALID,}, {"129.125.51.134", 1, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBBool CreateDefaultCentralMenu (void *par); /* * start local game */ static XBBool ButtonStartLocal (void *par) { gameType = atomLocal; return CreateLocalGameMenu (&gameType); } /* ButtonStartLocal */ /* * start central server XBCC */ static XBBool ButtonStartCentral (void *par) { gameType = atomCentral; return CreateCentralGameMenu (&gameType); } /* ButtonStartLocal */ /* * create a network game */ static XBBool ButtonCreateNet (void *par) { gameType = atomServer; return CreateStartNetGameMenu (&gameType); } /* ButtonStartLocal */ /* * join a network game */ static XBBool ButtonJoinNet (void *par) { gameType = atomClient; return CreateJoinNetGameMenu (&gameType); } /* ButtonJoinNet */ /* * quit xblast menu */ static XBBool ButtonMainQuit (void *par) { MenuClear (); return XBFalse; } /* ButtonMenuQuit */ /* * create the main menu */ XBBool CreateMainMenu (void *par) { int i; gameType = ATOM_INVALID; /* setup menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("XBlast Main Menu")); /* Buttons */ (void)MenuAddHButton (MENU_LEFT, MENU_TOP, MENU_WIDTH, N_("Start Local Game"), ButtonStartLocal, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_TOP + 1 * CELL_H, MENU_WIDTH, N_("Create Network Game"), ButtonCreateNet, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_TOP + 2 * CELL_H, MENU_WIDTH, N_("Join Network Game"), ButtonJoinNet, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_TOP + 3 * CELL_H, MENU_WIDTH, N_("Options"), CreateOptionsMenu, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_TOP + 4 * CELL_H, MENU_WIDTH, N_("Extras"), CreateExtrasMenu, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_TOP + 6 * CELL_H, MENU_WIDTH, N_("Start Central"), ButtonStartCentral, NULL); /* exit game */ MenuAddLabel1 (10, 79, TITLE_WIDTH + 60, N_("to talk to others go to http://xblast.sf.net/irc/")); MenuAddLabel1 (10, 63, TITLE_WIDTH + 60, N_("visit http://xblast.sf.net/")); MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, N_("Quit"), ButtonMainQuit, NULL)); /* audience */ for (i = 0; i < NUM_DEFAULT_PLAYERS; i++) { audience_ptr[i] = DefaultPlayerGraphics (i % NUM_DEFAULT_PLAYERS); MenuAddPlayer (PLAYER_LEFT (i, NUM_DEFAULT_PLAYERS), PLAYER_TOP, PLAYER_WIDTH, i, audience_ptr + i, ANIME_LENGTH, player_anime + ANIME_HOLD - 2 * i - 2); } /* return and escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateMainMenu */ /* * save changed sound setup */ static XBBool ButtonSaveSound (void *par) { assert (NULL != par); /* store setup */ StoreSoundSetup (par); /* reactivate sound setup */ SND_Finish (); RetrieveSoundSetup (par); SND_Init (par); /* back to options */ return CreateOptionsMenu (NULL); } /* ButtonSaveSoundSetup */ /* * save changed central setup */ static XBBool ButtonSaveCentral (void *par) { assert (NULL != par); /* store setup */ centralSetup.name = (0 != centralname[0]) ? centralname : NULL; StoreCentralSetup (par); /* back to options */ return CreateOptionsMenu (NULL); } /* ButtonSaveSoundSetup */ /* * save changed central setup */ static XBBool ButtonSaveDefaultCentral (void *par) { assert (NULL != par); /* store setup */ // centralSetup.name = (0 != centralname[0]) ? centralname : NULL; centralSetup.name = centralList1[defaultCentral].text; centralSetup.port = 16160; StoreCentralSetup (¢ralSetup); /* back to options */ return CreateOptionsMenu (NULL); } /* ButtonSaveSoundSetup */ /* * menu for sound setup */ static XBBool CreateSoundMenu (void *par) { static CFGSoundSetup soundSetup; RetrieveSoundSetup (&soundSetup); /* --- */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Sound Setup")); /* Buttons */ MenuAddComboInt (5 * CELL_W, MENU_ROW (0), 5 * CELL_W, N_("Mode:"), 3 * CELL_W, (int *)&soundSetup.mode, soundModeList); MenuAddComboBool (5 * CELL_W, MENU_ROW (1), 5 * CELL_W, N_("Stereo:"), 3 * CELL_W, &soundSetup.stereo); /* leave menu */ /* ok and cancel */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Cancel"), CreateOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), ButtonSaveSound, &soundSetup)); /* escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateSoundMenu */ #ifdef SDL /* * save changed video setup */ static XBBool ButtonSaveVideo (void *par) { assert (NULL != par); StoreVideoSetup (par); SetupVideo (par); /* back to options */ return CreateOptionsMenu (NULL); } /* * menu for video setup */ static XBBool CreateVideoMenu (void *par) { static CFGVideoSetup videoSetup; RetrieveVideoSetup (&videoSetup); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Screen Setup")); MenuAddComboInt (5 * CELL_W, MENU_ROW (0), 5 * CELL_W, N_("Fullscreen:"), 3 * CELL_W, (int *)&videoSetup.mode, videoModeList); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Cancel"), CreateOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), ButtonSaveVideo, &videoSetup)); /* escape */ MenuSetLinks (); return XBFalse; } #endif /* * menu for central setup XBCC */ static XBBool CreateCentralSetupMenu (void *par) { RetrieveCentralSetup (¢ralSetup); /* --- */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Central Setup")); /* Buttons */ if (NULL != centralSetup.name) { strncpy (centralname, centralSetup.name, MSG_LENGTH); } MenuAddString (DLG_LEFT, MSG_TOP, DLG_WIDTH, N_("Hostname:"), 4 * CELL_W, centralname, MSG_LENGTH); MenuAddInteger (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("TCP-Port:"), 4 * CELL_W, ¢ralSetup.port, 4096, 65535); /* leave menu */ /* ok and cancel */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Cancel"), CreateOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), ButtonSaveCentral, ¢ralSetup)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Select Central"), CreateDefaultCentralMenu, NULL); /* escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateSoundMenu */ /* * menu for central setup XBCC */ static XBBool CreateDefaultCentralMenu (void *par) { RetrieveCentralSetup (¢ralSetup); /* --- */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Central Setup")); /* Buttons */ if (NULL != centralSetup.name) { strncpy (centralname, centralSetup.name, MSG_LENGTH); } MenuAddCombo (DLG_LEFT, MSG_TOP, DLG_WIDTH + CELL_W, N_("Hostname List:"), 5 * CELL_W, &defaultCentral, NULL, NULL, (void *)centralList); MenuAddInteger (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("TCP-Port:"), 4 * CELL_W, ¢ralSetup.port, 4096, 65535); // MenuAddString (DLG_LEFT, MSG_TOP, DLG_WIDTH, N_("Hostname:"), 4*CELL_W, centralname, MSG_LENGTH); /* leave menu */ /* ok and cancel */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Cancel"), CreateOptionsMenu, NULL)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Enter Manually"), CreateCentralSetupMenu, NULL); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), ButtonSaveDefaultCentral, ¢ralSetup)); /* escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateSoundMenu */ /* * create the options menu */ XBBool CreateOptionsMenu (void *par) { MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("XBlast Options Menu")); /* Buttons */ MenuAddHButton (MENU_LEFT, MENU_ROW (0), MENU_WIDTH, N_("Players"), CreatePlayerOptionsMenu, NULL); MenuAddHButton (MENU_LEFT, MENU_ROW (1), MENU_WIDTH, N_("Controls"), CreateConfigControlMenu, NULL); MenuAddHButton (MENU_LEFT, MENU_ROW (2), MENU_WIDTH, N_("Sound"), CreateSoundMenu, NULL); #ifdef SDL MenuAddHButton (MENU_LEFT, MENU_ROW (3), MENU_WIDTH, N_("Video"), CreateVideoMenu, NULL); #endif MenuAddHButton (MENU_LEFT, MENU_ROW (4), MENU_WIDTH, N_("Central"), CreateDefaultCentralMenu, NULL); // XBCC /* leave menu */ MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, N_("Main Menu"), CreateMainMenu, NULL)); /* escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateOptionsMenu */ /* * */ XBPlayerHost //DoMenu (void) DoMenu (XBBool autoCentral) { int result; GUI_ClearPixmap (); /* create main menu */ setAutoCentral (autoCentral); if (autoCentral) { (void)ButtonStartCentral (NULL); } else { (void)CreateMainMenu (NULL); } /* run menu */ result = MenuEventLoop (); /* fade out */ if (result) { DoFade (XBFM_WHITE_OUT, PIXH + SCOREH); } else { DoFade (XBFM_BLACK_OUT, PIXH + SCOREH); } /* that´s all */ return result ? GetHostType () : XBPH_None; } /* DoMenu */ /* * end of file menu.c */ xblast-2.10.4/menu.h0000644000175000017500000000214710372731124013331 0ustar rhondaalfie/* * file menu.h - * * $Id: menu.h,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MENU_H #define _MENU_H /* * global prototypes */ //extern XBPlayerHost DoMenu (void); extern XBPlayerHost DoMenu (XBBool autoCentral); extern XBBool CreateMainMenu (void *par); extern XBBool CreateOptionsMenu (void *par); #endif /* * end of file menu.h */ xblast-2.10.4/menu_control.c0000644000175000017500000001500010373111603015047 0ustar rhondaalfie/* * file menu_control.h - edit control settings * * $Id: menu_control.c,v 1.10 2006/02/10 13:22:11 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define PLAYER_KEYB_1 0 #define PLAYER_KEYB_2 1 #define PLAYER_JOY_1 2 #define PLAYER_JOY_2 3 #define PLAYER_JOY_3 4 #define PLAYER_JOY_4 5 /* * local variables */ /* player controls */ static const char *joystickString[4] = { "Joystick 1", "Joystick 2", "Joystick 3", "Joystick 4", }; static XBBool CreateConfigKeyboardMenu1 (void *par); /* controls code */ static XBEventCode ctrl[NUM_LOCAL_PLAYER] = { XBE_KEYB_1, XBE_KEYB_2, XBE_JOYST_1, XBE_JOYST_2, XBE_JOYST_3, XBE_JOYST_4, }; /* local copy od keybaord control */ static CFGControlKeyboard cfgKeyboard; /* * store keyboard configuration */ static XBBool ButtonSaveKeyboard (void *par) { XBEventCode *pCtrl = par; assert (pCtrl != NULL); StoreControlKeyboard (*pCtrl, &cfgKeyboard); GUI_UpdateKeyTables (); return CreateConfigControlMenu (NULL); } /* ButtonSaveKeyboard */ /* * menu to configure keyboard */ static XBBool CreateConfigKeyboardMenu (void *par) { XBEventCode *pCtrl = par; int row; assert (pCtrl != NULL); /* retrieve controls */ if (!RetrieveControlKeyboard (*pCtrl, &cfgKeyboard)) { memset (&cfgKeyboard, 0, sizeof (cfgKeyboard)); } MenuClear (); /* title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Configure Keyboard")); /* Buttons */ row = MENU_TOP; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Go up:"), &cfgKeyboard.keyUp); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Drop Bomb:"), &cfgKeyboard.keyBomb); row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Go down:"), &cfgKeyboard.keyDown); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Special extra:"), &cfgKeyboard.keySpecial); row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Go left:"), &cfgKeyboard.keyLeft); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Pause game:"), &cfgKeyboard.keyPause); row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Go right:"), &cfgKeyboard.keyRight); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Abort level:"), &cfgKeyboard.keyAbort); /* Skywalker */ row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Laola:"), &cfgKeyboard.keyLaola); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Looser:"), &cfgKeyboard.keyLooser); /* */ row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Stop:"), &cfgKeyboard.keyStop); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Cancel abort:"), &cfgKeyboard.keyAbortCancel); row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Bot:"), &cfgKeyboard.keyBot); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Chat Send:"), &cfgKeyboard.keyChatSend); row += CELL_H; MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, N_("Chat Start:"), &cfgKeyboard.keyChatStart); MenuAddKeysym (8 * CELL_W, row, 5 * CELL_W, N_("Chat Cancel:"), &cfgKeyboard.keyChatCancel); /* ok and cancel */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Cancel"), CreateConfigControlMenu, NULL)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Next"), CreateConfigKeyboardMenu1, par); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Ok"), ButtonSaveKeyboard, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateConfigKeyboardMenu */ /* * store keyboard configuration */ static XBBool BackToCreateConfigKeyboard (void *par) { XBEventCode *pCtrl = par; assert (pCtrl != NULL); StoreControlKeyboard (*pCtrl, &cfgKeyboard); GUI_UpdateKeyTables (); return CreateConfigKeyboardMenu (par); } /* BackToCreateConfigKeyboard */ /* * menu to configure keyboard */ static XBBool CreateConfigKeyboardMenu1 (void *par) { XBEventCode *pCtrl = par; int row; assert (pCtrl != NULL); /* retrieve controls */ StoreControlKeyboard (*pCtrl, &cfgKeyboard); GUI_UpdateKeyTables (); if (!RetrieveControlKeyboard (*pCtrl, &cfgKeyboard)) { memset (&cfgKeyboard, 0, sizeof (cfgKeyboard)); } MenuClear (); /* title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Configure Keyboard")); /* Buttons */ row = MENU_TOP; /* ok and cancel */ MenuAddKeysym (2 * CELL_W, row, 5 * CELL_W, "Chatmsg Rec.:", &cfgKeyboard.keyChatChangeReceiver); MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Cancel"), CreateConfigControlMenu, NULL)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Last"), BackToCreateConfigKeyboard, par); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Ok"), ButtonSaveKeyboard, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateConfigKeyboardMenu */ /* * menu to select input device to configure */ XBBool CreateConfigControlMenu (void *par) { int i, row; int numJoysticks = GUI_NumJoysticks (); MENU_ID id; MenuClear (); /* title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Configure Controls")); /* Buttons */ row = MENU_TOP; MenuAddHButton (MENU_LEFT, row, MENU_WIDTH, N_("Right Keyboard"), CreateConfigKeyboardMenu, ctrl + PLAYER_KEYB_1); row += CELL_H; MenuAddHButton (MENU_LEFT, row, MENU_WIDTH, N_("Left Keyboard"), CreateConfigKeyboardMenu, ctrl + PLAYER_KEYB_2); row += CELL_H; for (i = 0; i < numJoysticks; i++) { id = MenuAddHButton (MENU_LEFT, row, MENU_WIDTH, joystickString[i], NULL, NULL); MenuSetActive (id, XBFalse); row += CELL_H; } MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, N_("Options Menu"), CreateOptionsMenu, NULL)); row += CELL_H; MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateConfigControlMenu */ /* * end of file menu_control.c */ xblast-2.10.4/menu_control.h0000644000175000017500000000205110372731124015063 0ustar rhondaalfie/* * file menu_control.h - edit control settings * * $Id: menu_control.h,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MENU_CONTROL_H #define _MENU_CONTROL_H /* * global prototypes */ extern XBBool CreateConfigControlMenu (void *); #endif /* * end of file menu_control.h */ xblast-2.10.4/menu_edit.c0000644000175000017500000014452310416756320014342 0ustar rhondaalfie/* * file menu_edit.c - user interface for editing levels * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This file (C) Lars Luthman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #define TEXT_ATTR_NORMAL (FF_Medium|FF_White|FF_Boxed) #define FF_Scroll 0x40 /* * external variables */ extern DBToInt *shrinkTable; static char fileName[STRING_LENGTH]; static char title[STRING_LENGTH]; static char author[STRING_LENGTH]; static char hint[STRING_LENGTH]; static int specialKeyDefaultComboValue; static int specialExtraDefaultComboValue; static int specialInitExtraDefaultComboValue; static int specialRevExtraDefaultComboValue; static XBBool useInitKick = XBFalse; static XBBool useRevKick = XBFalse; static int bombDefaultComboValue; static int bombSpecialComboValue; static int bombHiddenComboValue; static int bombsNumBombs = 0; static int bombsNumSpecials = 0; static int bombsRange = 0; static long block = 0; static int loadedCreateSpecialExtrasMenu = 0; static XBBool bombsNastyWalls; static int bombsNastyGentle; static int bombsNastyRange; static XBComboEntryList *xbcel, *xbcel1; static int shrinkComboValue; static XBBool shrinkUseDraw; static int scrambleDrawTime = 66; static XBBool shrinkUseDelete; static int scrambleDeleteTime = 33; static int blockSelected; static DBRoot *level; static BMMapTile mazeSave[MAZE_H][MAZE_W]; static XBBool mazeSaveEvil[MAZE_H][MAZE_W]; static char mazeSaveChar[MAZE_H + 1][MAZE_W + 1]; static XBBool mazeScrambleDraw[MAZE_H][MAZE_W]; static XBBool mazeScrambleDelete[MAZE_H][MAZE_W]; static int numShDrBlocks = 0; static int numShDeBlocks = 0; static int init = 1; static int tempBlock; static int gameTime; static XBDir *dirBlockName; static XBBool useFg[BTNUM]; static XBRgbValue rgbs[BTNUM][3]; static char *blockName[BTNUM]; static XBBool recreate; static char *graphics[] = { "sphere_half #000000 #FF7F50 #4682B4", "sphere_half_X #000000 #FF7F50 #4682B4", "sphere_dark #000000 #4682B4 #000000", "sphere_light #000000 #B0C4DE #000000", "sphere_light #000000 #4682B4 #000000", "sphere_light_O #000000 #4682B4 #000000", "bomb", "range", "trap", "invincible", "score_floor #4169E1 #4169E1 #4169E1" }; static MENU_ID drawButton; static MENU_ID deleteButton; static XBDir *ppmList; /*static const char *buttons[13]={"bo","ra","fs","so","bb","vb","se","il", "sb","sd","sl","",""};*/ static XBBool SetExtras (void *par); static XBBool SaveGraphics (void *par); static XBBool FreeBlockMenu (void *par); static XBBool CreateGraphicsMenu (void *par); static XBBool BuildColorsMenu (void *par); static XBBool SaveLevel (void *par); static XBBool ReturnFromMap (void *par); static XBBool SetBombs (void *par); static XBBool CreateLevel (void *par); static XBBool CreateLevelMainMenu (void *par); static XBBool CreateBombsMenu (void *par); static XBBool CreateBombsGSMenu (void *par); static XBBool CreateSpecialExtrasMenu (void *par); static XBBool LoadExtras (void); /* * Save a level file using a new name */ static XBBool CreateSaveAsMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Save Level")); MenuAddString (DLG_LEFT, MENU_ROW (5), DLG_WIDTH, N_("Name:"), 4 * CELL_W, fileName, STRING_LENGTH); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateEditMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Save"), SaveLevel, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Save a level file */ static XBBool SaveLevel (void *par) { DBSection *section; int i; section = DB_GetSection (level, atomInfo); recreate = XBTrue; // if(recreate){ ReturnFromMap (NULL); section = DB_CreateSection (level, atomGraphics); SaveGraphics (NULL); SetBombs (NULL); if (loadedCreateSpecialExtrasMenu == 0) LoadExtras (); else loadedCreateSpecialExtrasMenu = 0; SetExtras (NULL); section = DB_CreateSection (level, atomPlayer); for (i = 0; i < MAX_PLAYER; ++i) DB_CreateEntryString (section, atomArrayPos0[i + 1], "7 6"); //section = DB_CreateSection(level,atomFunc); //DB_CreateEntryString(section,atomExtra, "invincibility"); section = DB_CreateSection (level, atomInfo); DB_CreateEntryString (section, atomName, title); DB_CreateEntryString (section, atomAuthor, author); DB_CreateEntryString (section, atomHint, hint); DB_CreateEntryString (section, atomGameMode, "R23456STDL"); recreate = XBFalse; if (fileName[0] == '\0') return CreateSaveAsMenu (par); else { DB_CreateEntryString (section, atomName, (char *)fileName); if (!DB_Store (level)) return XBFalse; return CreateEditMenu (par); // } } } /* ButtonSave */ /* * Set the level info in the level database. */ static XBBool SetInfo (void *par) { DBSection *infoSection; char temp[STRING_LENGTH]; int i, j; /* copy values to database */ strcpy (fileName, title); i = 0; j = 0; while (fileName[i] != 0 && i < STRING_LENGTH) { fprintf (stderr, " %s : %s : %i \n", fileName, temp, i); if (isspace ((unsigned char)fileName[i])) { } else { temp[j] = fileName[i]; j++; } i++; } temp[j] = 0; DB_Delete (level); strcpy (fileName, temp); fprintf (stderr, "T %s : %s : %i \n", fileName, temp, i); level = DB_Create (DT_Level, GUI_StringToAtom (fileName)); recreate = XBTrue; CreateLevel (par); infoSection = DB_GetSection (level, atomInfo); if (infoSection == NULL) infoSection = DB_CreateSection (level, atomInfo); DB_CreateEntryString (infoSection, atomName, title); DB_CreateEntryString (infoSection, atomAuthor, author); DB_CreateEntryString (infoSection, atomHint, hint); DB_CreateEntryString (infoSection, atomGameMode, "R23456STDL"); recreate = XBFalse; /* back to edit level menu */ return CreateLevelMainMenu (par); } /* ButtonSetInfo */ /* * Edit the level info (title, author, hint). */ static XBBool CreateInfoMenu (void *par) { const DBSection *infoSection; const char *tmp; /* Get info from the db. */ infoSection = DB_GetSection (level, atomInfo); DB_GetEntryString (infoSection, atomName, &tmp); strcpy (title, tmp); DB_GetEntryString (infoSection, atomAuthor, &tmp); strcpy (author, tmp); DB_GetEntryString (infoSection, atomHint, &tmp); strcpy (hint, tmp); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Level Info")); MenuAddString (DLG_LEFT, MENU_ROW (1), DLG_WIDTH + 2 * CELL_W, N_("Title:"), 7 * CELL_W, title, STRING_LENGTH); MenuAddString (DLG_LEFT, MENU_ROW (2), DLG_WIDTH + 2 * CELL_W, N_("Author:"), 7 * CELL_W, author, STRING_LENGTH); MenuAddString (DLG_LEFT, MENU_ROW (3), DLG_WIDTH + 2 * CELL_W, N_("Hint:"), 7 * CELL_W, hint, STRING_LENGTH); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateLevelMainMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), SetInfo, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Set the level info in the level database. */ static XBBool SetBombs (void *par) { DBSection *section; char bombType[STRING_LENGTH]; /* copy values to database */ section = DB_GetSection (level, atomBombs); if (section == NULL) section = DB_CreateSection (level, atomBombs); fprintf (stderr, " %p %i %i %i \n", section, bombsNumSpecials, bombsRange, bombsNumBombs); DB_CreateEntryInt (section, atomSpecialBombs, bombsNumSpecials); /* copy values to database */ strcpy (bombType, GetBombName ((bombDefaultComboValue))); DB_CreateEntryString (section, atomDefault, bombType); section = DB_GetSection (level, atomPlayer); if (section == NULL) section = DB_CreateSection (level, atomPlayer); DB_CreateEntryInt (section, atomRange, bombsRange); DB_CreateEntryInt (section, atomBombs, bombsNumBombs); /* back to edit level menu */ if (recreate) { return XBTrue; } else { return CreateBombsMenu (NULL); } } /* ButtonSetInfo */ /* * Edit the general bomb settings */ static XBBool CreateBombsGSMenu (void *par) { const DBSection *bombSection; const char *currentDefaultBomb; const char *currentSpecialBomb; const char *currentHiddenBomb; int i; bombSection = DB_GetSection (level, atomBombs); if (!DB_GetEntryString (bombSection, atomType, ¤tDefaultBomb)) currentDefaultBomb = GetBombName (BMTnormal); if (currentDefaultBomb == NULL) currentDefaultBomb = GetBombName (BMTnormal); bombSection = DB_GetSection (level, atomBombs); if (!DB_GetEntryString (bombSection, atomSpecial, ¤tSpecialBomb)) currentSpecialBomb = GetBombName (BMTnormal); if (currentSpecialBomb == NULL) currentSpecialBomb = GetBombName (BMTnormal); bombSection = DB_GetSection (level, atomBombs); if (!DB_GetEntryString (bombSection, atomHidden, ¤tHiddenBomb)) currentHiddenBomb = GetBombName (BMTnormal); if (currentHiddenBomb == NULL) currentHiddenBomb = GetBombName (BMTnormal); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Bomb Settings")); xbcel = (XBComboEntryList *) calloc (NUM_BMT + 1, sizeof (XBComboEntryList)); memset (xbcel, 0, (NUM_BMT + 1) * sizeof (XBComboEntryList)); for (i = 0; i < NUM_BMT; ++i) { xbcel[i].text = GetBombName ((BMBombType) (i)); xbcel[i].value = (BMBombType) (i); if (!strcmp (xbcel[i].text, currentDefaultBomb)) { bombDefaultComboValue = i; } if (!strcmp (xbcel[i].text, currentSpecialBomb)) { bombSpecialComboValue = i; } if (!strcmp (xbcel[i].text, currentHiddenBomb)) { bombHiddenComboValue = i; } } xbcel[i].text = NULL; MenuAddCombo (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, N_("Default Bomb Type"), 3 * CELL_W, &bombDefaultComboValue, NULL, NULL, (void *)xbcel); MenuAddInteger (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("Initial Range"), 4 * CELL_W, &bombsRange, 0, 255); MenuAddInteger (DLG_LEFT, MENU_ROW (2), DLG_WIDTH, N_("Initial Bombs"), 4 * CELL_W, &bombsNumBombs, 0, 255); MenuAddInteger (DLG_LEFT, MENU_ROW (3), DLG_WIDTH, N_("Special Bombs"), 4 * CELL_W, &bombsNumSpecials, 0, 255); MenuAddCombo (DLG_LEFT, MENU_ROW (4), DLG_WIDTH, N_("Special Bomb Type"), 3 * CELL_W, &bombSpecialComboValue, NULL, NULL, (void *)xbcel); MenuAddCombo (DLG_LEFT, MENU_ROW (5), DLG_WIDTH, N_("Hidden Bomb Type"), 3 * CELL_W, &bombHiddenComboValue, NULL, NULL, (void *)xbcel); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateBombsMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), SetBombs, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Set the level info in the level database. */ static XBBool SetExtras (void *par) { DBSection *section; char type[STRING_LENGTH]; /* copy values to database */ section = DB_GetSection (level, atomFunc); if (section == NULL) section = DB_CreateSection (level, atomFunc); /* copy values to database */ strcpy (type, GetKeyNameInt ((specialKeyDefaultComboValue))); if (strcmp (type, "No Special Key") == 0) { } else { DB_CreateEntryString (section, atomKey, type); } fprintf (stderr, " %s key name %i specialKeyDefaultComboValue \n", type, specialKeyDefaultComboValue); strcpy (type, GetExtraNameInt ((specialExtraDefaultComboValue))); fprintf (stderr, " %s extra name %i specialExtraDefaultComboValue \n", type, specialExtraDefaultComboValue); DB_CreateEntryString (section, atomExtra, type); section = DB_GetSection (level, atomPlayer); if (section == NULL) section = DB_CreateSection (level, atomPlayer); strcpy (type, GetExtraNameInt ((specialRevExtraDefaultComboValue))); fprintf (stderr, " %s extra name %i specialRevExtraDefaultComboValue \n", type, specialRevExtraDefaultComboValue); if (useRevKick) { strcat (type, " kick"); } DB_CreateEntryString (section, atomReviveExtra, type); strcpy (type, GetExtraNameInt ((specialInitExtraDefaultComboValue))); fprintf (stderr, " %s extra name %i specialInitExtraDefaultComboValue \n", type, specialInitExtraDefaultComboValue); if (useInitKick) { strcat (type, " kick"); } DB_CreateEntryString (section, atomInitExtra, type); /* back to edit level menu */ if (recreate) { return XBTrue; } else { return CreateLevelMainMenu (NULL); } } /* ButtonSetInfo */ static XBBool LoadExtras (void) { int i, num; const DBSection *specialSection; const char *currentDefaultSpecialInitExtra; const char *currentDefaultSpecialRevExtra; const char *currentDefaultSpecialExtra; const char *currentDefaultSpecialKey; specialSection = DB_GetSection (level, atomPlayer); if (!DB_GetEntryString (specialSection, atomInitExtra, ¤tDefaultSpecialInitExtra)) currentDefaultSpecialInitExtra = GetExtraNameFunc (specialExtraFunc); fprintf (stderr, " cur nin extra %s \n", currentDefaultSpecialInitExtra); if (currentDefaultSpecialInitExtra == NULL) currentDefaultSpecialInitExtra = GetExtraNameFunc (SpecialExtraVoid); fprintf (stderr, " cur ini extra %s \n", currentDefaultSpecialInitExtra); if (!DB_GetEntryString (specialSection, atomReviveExtra, ¤tDefaultSpecialRevExtra)) currentDefaultSpecialRevExtra = GetExtraNameFunc (specialExtraFunc); fprintf (stderr, " cur rev extra %s \n", currentDefaultSpecialRevExtra); if (currentDefaultSpecialRevExtra == NULL) currentDefaultSpecialRevExtra = GetExtraNameFunc (SpecialExtraVoid); fprintf (stderr, " cur rev extra %s \n", currentDefaultSpecialRevExtra); specialSection = DB_GetSection (level, atomFunc); if (!DB_GetEntryString (specialSection, atomKey, ¤tDefaultSpecialKey)) currentDefaultSpecialKey = GetKeyNameFunc (specialKeyFunc); fprintf (stderr, " cur key %s \n", currentDefaultSpecialKey); if (currentDefaultSpecialKey == NULL) currentDefaultSpecialKey = GetKeyNameFunc (SpecialKeyVoid); fprintf (stderr, " cur key %s \n", currentDefaultSpecialKey); if (!DB_GetEntryString (specialSection, atomExtra, ¤tDefaultSpecialExtra)) currentDefaultSpecialExtra = GetExtraNameFunc (specialExtraFunc); fprintf (stderr, " cur extra %s \n", currentDefaultSpecialExtra); if (currentDefaultSpecialExtra == NULL) currentDefaultSpecialExtra = GetExtraNameFunc (SpecialExtraVoid); fprintf (stderr, " cur extra %s \n", currentDefaultSpecialExtra); num = GetNumberOfKeys (); xbcel = (XBComboEntryList *) calloc (num + 1, sizeof (XBComboEntryList)); memset (xbcel, 0, (num + 1) * sizeof (XBComboEntryList)); for (i = 0; i < num; ++i) { xbcel[i].text = GetKeyNameInt ((i)); xbcel[i].value = (int)(i); if (!strcmp (xbcel[i].text, currentDefaultSpecialKey)) { specialKeyDefaultComboValue = i; } } num = GetNumberOfExtras (); xbcel1 = (XBComboEntryList *) calloc (num + 1, sizeof (XBComboEntryList)); memset (xbcel1, 0, (num + 1) * sizeof (XBComboEntryList)); for (i = 0; i < num; ++i) { xbcel1[i].text = GetExtraNameInt ((i)); xbcel1[i].value = (int)(i); if (!strcmp (xbcel1[i].text, currentDefaultSpecialExtra)) { specialExtraDefaultComboValue = i; } if (!strcmp (xbcel1[i].text, currentDefaultSpecialRevExtra)) { specialRevExtraDefaultComboValue = i; } if (!strcmp (xbcel1[i].text, currentDefaultSpecialInitExtra)) { specialInitExtraDefaultComboValue = i; } } xbcel1[i].text = NULL; return XBTrue; } /* * Edit the general special extra settings */ static XBBool CreateSpecialExtrasMenu (void *par) { loadedCreateSpecialExtrasMenu = 1; LoadExtras (); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Extras Settings")); MenuAddCombo (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, N_("Extra Type"), 3 * CELL_W, &specialExtraDefaultComboValue, NULL, NULL, (void *)xbcel1); MenuAddCombo (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("Key Type"), 3 * CELL_W, &specialKeyDefaultComboValue, NULL, NULL, (void *)xbcel); MenuAddCombo (DLG_LEFT, MENU_ROW (2), DLG_WIDTH, N_("Init Extra"), 3 * CELL_W, &specialInitExtraDefaultComboValue, NULL, NULL, (void *)xbcel1); MenuAddCombo (DLG_LEFT, MENU_ROW (3), DLG_WIDTH, N_("Revive Extra"), 3 * CELL_W, &specialRevExtraDefaultComboValue, NULL, NULL, (void *)xbcel1); MenuAddComboBool (DLG_LEFT, MENU_ROW (4), DLG_WIDTH, N_("Init Kick"), 2 * CELL_W, &useInitKick); MenuAddComboBool (DLG_LEFT, MENU_ROW (5), DLG_WIDTH, N_("Rev Kick"), 2 * CELL_W, &useRevKick); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateLevelMainMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), SetExtras, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Set the level info in the level database. */ static XBBool SetNasty (void *par) { DBSection *section; /* copy values to database */ section = DB_GetSection (level, atomBombs); if (section == NULL) section = DB_CreateSection (level, atomBombs); if (bombsNastyWalls) { DB_CreateEntryInt (section, atomNastyGentle, bombsNumSpecials); DB_CreateEntryInt (section, atomNastyRange, bombsRange); } // DB_CreateEntryString(level,atomBombs,bombsNumBombs ); /* back to edit level menu */ if (recreate) { return XBTrue; } else { return CreateBombsMenu (NULL); } } /* ButtonSetInfo */ /* * Edit the nasty walls settings */ static XBBool CreateNastyWallsMenu (void *par) { const DBSection *bombSection; bombSection = DB_GetSection (level, atomBombs); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Nasty Walls")); MenuAddComboBool (DLG_LEFT, MENU_ROW (1), 5 * CELL_W, N_("Nasty Walls:"), 2 * CELL_W, &bombsNastyWalls); MenuAddInteger (DLG_LEFT, MENU_ROW (2), DLG_WIDTH, N_("Intensity"), 4 * CELL_W, &bombsNastyGentle, 1, 255); MenuAddInteger (DLG_LEFT, MENU_ROW (3), DLG_WIDTH, N_("Range"), 4 * CELL_W, &bombsNastyRange, 1, 255); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateBombsMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), SetNasty, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Edit the bomb settings */ static XBBool CreateBombsMenu (void *par) { const DBSection *bombSection; bombSection = DB_GetSection (level, atomBombs); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Bombs")); MenuAddHButton (9 * CELL_W / 2, MENU_TOP, 4 * CELL_W, N_("General Settings"), CreateBombsGSMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 1 * CELL_H, 4 * CELL_W, N_("Nasty Walls"), CreateNastyWallsMenu, par); MenuSetDefault (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Back"), CreateLevelMainMenu, par)); // MenuSetDefault (MenuAddHButton (17 * CELL_W/2, MENU_BOTTOM, 4*CELL_W, N_("Save"), SaveLevel, par) ); // ci->push(new ButtonItem("Hidden Bombs")); // ci->push(new ButtonItem("Bomb Behaviour")); MenuSetLinks (); /* that's all */ return XBFalse; } /* * Set the shrink info in the level database. */ static XBBool SetShrink (void *par) { DBSection *section; char shrinkType[STRING_LENGTH]; BMPosition pValue; int x, y, numTemp = 0; /* copy values to database */ section = DB_GetSection (level, atomShrink); strcpy (shrinkType, GetShrinkName ((XBShrinkType) (shrinkComboValue))); if (section == NULL) section = DB_CreateSection (level, atomShrink); if (strcmp (shrinkType, "No Shrink") == 0) { // DB_CreateEntryString(section,atomType, " " ); } else { DB_CreateEntryString (section, atomType, shrinkType); } fprintf (stderr, " use draw %i\n", numShDrBlocks); if (shrinkUseDraw) { if (numShDrBlocks > -1) { section = DB_GetSection (level, atomScrambleDraw); if (section == NULL) section = DB_CreateSection (level, atomScrambleDraw); /* time for scramble */ section = DB_GetSection (level, atomScrambleDraw); numTemp = numShDrBlocks; for (y = 0; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { if (mazeScrambleDraw[y][x]) { pValue.x = x; pValue.y = y; numShDrBlocks--; if (numShDrBlocks > -1) DB_CreateEntryPos (section, atomArrayPos000[numShDrBlocks], &pValue); } } } DB_CreateEntryInt (section, atomNumBlocks, numTemp); numShDrBlocks = numTemp; DB_CreateEntryFloat (section, atomTime, 1 - (float)scrambleDrawTime / 100); } else { if (numShDrBlocks < 0) DB_GetEntryInt (section, atomNumBlocks, &numShDrBlocks); numTemp = numShDrBlocks; for (y = 0; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { if (mazeScrambleDraw[y][x]) { pValue.x = x; pValue.y = y; numShDrBlocks--; if (numShDrBlocks > -1) DB_CreateEntryPos (section, atomArrayPos000[numShDrBlocks], &pValue); } } } DB_CreateEntryInt (section, atomNumBlocks, numTemp); DB_CreateEntryFloat (section, atomTime, 1 - (float)scrambleDrawTime / 100); } } if (shrinkUseDelete) { fprintf (stderr, "1 num %i %i \n", numShDeBlocks, numTemp); if (numShDeBlocks > -1) { section = DB_GetSection (level, atomScrambleDel); if (section == NULL) section = DB_CreateSection (level, atomScrambleDel); /* time for scramble */ section = DB_GetSection (level, atomScrambleDel); numTemp = numShDeBlocks; for (y = 0; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { if (mazeScrambleDelete[y][x]) { pValue.x = x; pValue.y = y; numShDeBlocks--; if (numShDeBlocks > -1) DB_CreateEntryPos (section, atomArrayPos000[numShDeBlocks], &pValue); } } } fprintf (stderr, "2 num %i %i \n", numShDeBlocks, numTemp); DB_CreateEntryInt (section, atomNumBlocks, numTemp); numShDeBlocks = numTemp; DB_CreateEntryFloat (section, atomTime, 1 - (float)scrambleDeleteTime / 100); } else { if (numShDeBlocks < 0) DB_GetEntryInt (section, atomNumBlocks, &numShDeBlocks); numTemp = numShDeBlocks; for (y = 0; y < MAZE_H; y++) { for (x = 0; x < MAZE_W; x++) { if (mazeScrambleDelete[y][x]) { pValue.x = x; pValue.y = y; numShDeBlocks--; if (numShDeBlocks > -1) DB_CreateEntryPos (section, atomArrayPos000[numShDeBlocks], &pValue); } } } DB_CreateEntryInt (section, atomNumBlocks, numTemp); DB_CreateEntryFloat (section, atomTime, 1 - (float)scrambleDeleteTime / 100); } } /* back to edit level menu */ if (recreate) { return XBTrue; } else { return CreateLevelMainMenu (par); } } /* ButtonSetShrink */ /* * Edit the shrink */ static XBBool CreateShrinkMenu (void *par) { int i; const DBSection *shrinkSection; const char *currentShrink; shrinkSection = DB_GetSection (level, atomShrink); if (shrinkSection == NULL) shrinkSection = DB_CreateSection (level, atomShrink); if (!DB_GetEntryString (shrinkSection, atomType, ¤tShrink)) currentShrink = GetShrinkName (ST_Void); if (currentShrink == NULL) currentShrink = GetShrinkName (ST_Void); fflush (stdout); MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Shrink")); xbcel = (XBComboEntryList *) calloc (NUM_ST + 1, sizeof (XBComboEntryList)); memset (xbcel, 0, (NUM_ST + 1) * sizeof (XBComboEntryList)); for (i = 0; i < NUM_ST; ++i) { xbcel[i].text = GetShrinkName ((XBShrinkType) (i)); xbcel[i].value = (XBShrinkType) (i); if (!strcmp (xbcel[i].text, currentShrink)) shrinkComboValue = i; } xbcel[i].text = NULL; MenuAddCombo (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, N_("Shrink Type"), 3 * CELL_W, &shrinkComboValue, NULL, NULL, (void *)xbcel); MenuAddComboBool (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("Use Scramble Draw"), 2 * CELL_W, &shrinkUseDraw); MenuAddInteger (DLG_LEFT, MENU_ROW (2), DLG_WIDTH, N_("Scramble Draw Time (%)"), 2 * CELL_W, &scrambleDrawTime, 0, GAME_TIME); MenuAddComboBool (DLG_LEFT, MENU_ROW (3), DLG_WIDTH, N_("Use Scramble Delete"), 2 * CELL_W, &shrinkUseDelete); MenuAddInteger (DLG_LEFT, MENU_ROW (4), DLG_WIDTH, N_("Scramble DeleteTime (%)"), 2 * CELL_W, &scrambleDeleteTime, 0, GAME_TIME); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateLevelMainMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), SetShrink, par)); MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateShrinkMenu */ /* * This is called when the user presses the abort button in the map editor */ static XBBool ReturnFromMap (void *par) { int x, y; DBSection *section; blockSelected = 0; // section = DB_GetSection(level,atomMap); section = DB_CreateSection (level, atomMap); if (!recreate) { for (y = 0; y < MAZE_H - 1; y++) { for (x = 0; x < MAZE_W; x++) { //mazeSave[y][x]=GetMazeBlock(x,y); if (mazeSaveEvil[y][x]) { mazeSaveChar[y][x] = 'e'; } else { switch (mazeSave[y][x]) { case BTFree: mazeSaveChar[y][x] = '_'; break; case BTBlock: mazeSaveChar[y][x] = 'B'; break; case BTBlockRise: mazeSaveChar[y][x] = 'R'; break; case BTExtra: mazeSaveChar[y][x] = 'X'; break; case BTBomb: mazeSaveChar[y][x] = 'b'; break; case BTRange: mazeSaveChar[y][x] = 'r'; break; case BTSick: mazeSaveChar[y][x] = 's'; break; case BTSpecial: mazeSaveChar[y][x] = 'q'; break; case BTVoid: mazeSaveChar[y][x] = 'v'; break; case BTEvil: mazeSaveChar[y][x] = 'e'; break; case BTBackground: mazeSaveChar[y][x] = 'V'; break; case BTBurned: mazeSaveChar[y][x] = '_'; break; case BTExtraOpen: mazeSaveChar[y][x] = '_'; break; case BTNUM: mazeSaveChar[y][x] = '_'; break; default: mazeSaveChar[y][x] = '_'; break; } } fprintf (stderr, "%c", mazeSaveChar[y][x]); } fprintf (stderr, "\nfrom get\n"); DB_CreateEntryString (section, atomArrayRow00[y], mazeSaveChar[y]); } DB_CreateEntryString (section, atomArrayRow00[MAZE_H - 1], "BBBBBBBBBBBBBBB"); // } } if (recreate) { SetShrink (NULL); return XBTrue; } else { recreate = XBTrue; SetShrink (NULL); recreate = XBFalse; DeleteAllMapBombSprites (); DeleteAllBombSprites (); SetXBEditMapMode (XBFalse); SetXBMapMode (XBFalse); FinishLevel (); MenuLoadTiles (); DeleteAllBombSprites (); return CreateLevelMainMenu (par); } } /* ButtonReturnFromMap */ XBBool SetToBlockFree (void) { tempBlock = blockSelected; blockSelected = 0; return XBTrue; } static XBBool SetBlockGraphics (int block) { tempBlock = blockSelected; blockSelected = block; return XBTrue; } XBBool SetOldBlock (void) { blockSelected = tempBlock; return XBTrue; } /* * This is called when the user presses a tool button in the map editor */ static XBBool MapToolClicked (void *par) { if ((long)par == 1) { blockSelected = -2; } else { blockSelected = (long)par - 2; } printf ("Tool %ld selected block %i\n", (long)par, blockSelected); return XBTrue; } /* ButtonMapTool */ /* * This is called when the user presses a tool button in the map editor */ static void ChangeBlock (char *name) { XBColor fg, bg, add; Dbg_Out (" block Selected %i \n", blockSelected); GUI_FreeBlock (blockSelected); if (useFg[blockSelected]) { fg = SET_COLOR (rgbs[blockSelected][0].red, rgbs[blockSelected][0].green, rgbs[blockSelected][0].blue); bg = SET_COLOR (rgbs[blockSelected][1].red, rgbs[blockSelected][1].green, rgbs[blockSelected][1].blue); add = SET_COLOR (rgbs[blockSelected][2].red, rgbs[blockSelected][2].green, rgbs[blockSelected][2].blue); GUI_LoadBlockCch (blockSelected, name, fg, bg, add); } else { GUI_LoadBlockRgb (blockSelected, name); } GUI_DrawBlock (10, 9, blockSelected); GUI_FlushBlocks (); GUI_FlushPixmap (XBFalse); } static XBBool BlockGraphicToolClicked (void *par) { block = block + 1; if (dirBlockName == NULL) dirBlockName = ppmList; dirBlockName = dirBlockName->next; if (dirBlockName == NULL) dirBlockName = ppmList; ChangeBlock (dirBlockName->name); if (blockName[blockSelected] == NULL) { blockName[blockSelected] = malloc (strlen (dirBlockName->name) + 1); strcpy (blockName[blockSelected], dirBlockName->name); } else { free (blockName[blockSelected]); blockName[blockSelected] = malloc (strlen (dirBlockName->name) + 1); strcpy (blockName[blockSelected], dirBlockName->name); } return XBTrue; } /* ButtonMapTool */ static XBBool ApplyGraphics (void *par) { if (dirBlockName != NULL) { ChangeBlock (dirBlockName->name); if (blockName[blockSelected] == NULL) { blockName[blockSelected] = malloc (strlen (dirBlockName->name) + 1); strcpy (blockName[blockSelected], dirBlockName->name); } else { free (blockName[blockSelected]); blockName[blockSelected] = malloc (strlen (dirBlockName->name) + 1); strcpy (blockName[blockSelected], dirBlockName->name); } } return XBTrue; } #ifdef unused /* * This is called when the user presses a map square */ static XBBool MapSquareClicked (void *par) { printf ("Square %ld clicked\n", (long)par); return XBTrue; } /* ButtonMapSquare */ #endif /* static XBBool RedrawMapMaze(void){ int i,j; for (i = 0; i < MAZE_H-1; i++) { for (j = 0; j < MAZE_W; j++) { SetMazeBlock(j,i,mazeSave[i][j]); } } UpdateMaze (); return XBTrue; }*/ static void RedMapEditMaze0 (void) { int x, y; static int oldTime = 0; if (oldTime == 0) oldTime = gameTime; // fprintf(stderr,"updating maz time %i %i\n",gameTime,oldTime); if (oldTime != gameTime) { for (y = 1; y < MAZE_H - 1; y++) { for (x = 1; x < MAZE_W - 1; x++) { SetMazeBlock (x, y, mazeSave[y][x]); } } oldTime = gameTime; } } static void RedMapEditMaze1 (void) { int x, y; static int oldTime = 0; if (oldTime == 0) oldTime = gameTime; fprintf (stderr, "updating maz time %i %i\n", gameTime, oldTime); // if(oldTime==gameTime){ for (y = 1; y < MAZE_H - 1; y++) { for (x = 1; x < MAZE_W - 1; x++) { // mazeSave[y][x]=GetMazeBlock(x,y); fprintf (stderr, "deletetime %i %i \n", scrambleDeleteTime, gameTime); if (gameTime <= scrambleDeleteTime) { fprintf (stderr, "block1 %i \n", mazeScrambleDelete[y][x]); if (mazeScrambleDelete[y][x]) { SetMazeBlock (x, y, 0); SetMazeBlock (x, y, 1); GUI_DrawBlock (x, y, 0); GUI_DrawBlock (x, y, 1); fprintf (stderr, "block %i \n", GetMazeBlock (x, y)); } } if (gameTime <= scrambleDrawTime) { if (mazeScrambleDraw[y][x]) { GUI_DrawBlock (x, y, 5); } } } } oldTime = gameTime; // } } /* * */ void SetEditMapBlock (int x, int y) { char timeString[3]; int p, i; BMRectangle get_box = { 69 * CELL_W, 79 * CELL_H, STAT_WIDTH * 13, 2 * STAT_HEIGHT / 3, }; if ((y / CELL_H) < 12 && (x / CELL_W) != 0 && (x / CELL_W) != 14 && (y / CELL_H) != 0) { if (blockSelected == 1) { sprintf (timeString, "%2i", scrambleDeleteTime); timeString[2] = 0; GUI_DrawBlock ((BTNUM + 2), 13, 2); GUI_DrawBlock (x / CELL_W, y / CELL_H, blockSelected); mazeSave[y / CELL_H][x / CELL_W] = BTFree; for (p = 0; p < (4 * MAZE_W * scrambleDeleteTime) / 100; p++) { GUI_DrawTimeLed (p, 1); } for (; p < (4 * MAZE_W); p++) { GUI_DrawTimeLed (p, 0); } GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDrawTime / 100, 3); GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDeleteTime / 100, 4); GUI_DrawTextbox (timeString, FF_Medium | FF_Black, &get_box); gameTime = scrambleDeleteTime; shrinkUseDelete = XBTrue; if (!mazeScrambleDelete[y / CELL_H][x / CELL_W]) { mazeScrambleDelete[y / CELL_H][x / CELL_W] = XBTrue; numShDeBlocks++; } // RedrawMapMaze(); RedMapEditMaze0 (); DoShrinkMapEdit ((GAME_TIME) - (GAME_TIME * scrambleDeleteTime) / 100); RedMapEditMaze1 (); UpdateMaze (); MarkMazeRect (13, MAZE_H, CELL_W, CELL_H); GUI_FlushPixmap (XBFalse); } else if (blockSelected == 5) { sprintf (timeString, "%2i", scrambleDrawTime); timeString[2] = 0; GUI_DrawBlock ((BTNUM + 2), 13, 2); GUI_DrawBlock (x / CELL_W, y / CELL_H, blockSelected); mazeSave[y / CELL_H][x / CELL_W] = BTFree; for (p = 0; p < (4 * MAZE_W * scrambleDrawTime) / 100; p++) { GUI_DrawTimeLed (p, 1); } for (; p < (4 * MAZE_W); p++) { GUI_DrawTimeLed (p, 0); } GUI_DrawTimeLed ((4 * MAZE_W * scrambleDrawTime) / 100, 3); GUI_DrawTimeLed ((4 * MAZE_W * scrambleDeleteTime) / 100, 4); GUI_DrawTextbox (timeString, FF_Small | FF_White, &get_box); if (!mazeScrambleDraw[y / CELL_H][x / CELL_W]) { mazeScrambleDraw[y / CELL_H][x / CELL_W] = XBTrue; numShDrBlocks++; } shrinkUseDraw = XBTrue; gameTime = scrambleDrawTime; RedMapEditMaze0 (); DoShrinkMapEdit ((GAME_TIME) - (GAME_TIME * scrambleDrawTime) / 100); UpdateMaze (); RedMapEditMaze1 (); MarkMazeRect (13, MAZE_H, CELL_W, CELL_H); //GUI_FlushBlocks (); GUI_FlushPixmap (XBFalse); } else { if (blockSelected == -2) { mazeSaveEvil[y / CELL_H][x / CELL_W] = XBTrue; } if (mazeScrambleDraw[y / CELL_H][x / CELL_W]) { mazeScrambleDraw[y / CELL_H][x / CELL_W] = XBFalse; numShDrBlocks--; } if (mazeScrambleDelete[y / CELL_H][x / CELL_W]) { mazeScrambleDelete[y / CELL_H][x / CELL_W] = XBFalse; numShDeBlocks--; } mazeSave[y / CELL_H][x / CELL_W] = blockSelected; SetMazeBlock (x / CELL_W, y / CELL_H, blockSelected); } } else { if (y > 111 && y < 115) { for (p = 0; p < x / 2; p++) { GUI_DrawTimeLed (p, 1); } for (; p < (4 * MAZE_W); p++) { GUI_DrawTimeLed (p, 0); } gameTime = (x * 50) / (4 * MAZE_W); fprintf (stderr, "seeting led %i %i %i \n", y, x, gameTime); GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDeleteTime / 100, 4); GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDrawTime / 100, 3); // RedrawMapMaze0(); RedMapEditMaze0 (); DoShrinkMapEdit ((GAME_TIME) - ((GAME_TIME * gameTime) / (100))); p = -1; while (p != 0) { p = getShrinkTimes (p); if (p != 0) { if ((p >= 0) && (p < GAME_TIME)) { i = 4 * MAZE_W - (p / TIME_STEP); // inverse GUI_DrawTimeLed (i, 2); } } } UpdateMaze (); RedMapEditMaze1 (); MarkMazeRect (13, MAZE_H, CELL_W, CELL_H); GUI_FlushPixmap (XBFalse); } } } static XBBool ExitGraphicsMenu (void *par) { MenuUnloadTiles (); MenuLoadTiles (); return CreateLevelMainMenu (par); } /* * create color value list */ static XBComboEntryList * CreateColorValueList (void) { XBComboEntryList *list; int i; char tmp[8]; list = calloc (XBCOLOR_DEPTH + 2, sizeof (XBComboEntryList)); assert (list != NULL); for (i = 0; i <= XBCOLOR_DEPTH; i++) { sprintf (tmp, "%3d", 255 * i / XBCOLOR_DEPTH); list[i].text = (char *)DupString ((char *)tmp); list[i].value = i; } return list; } /* CreateColorValueList */ #ifdef notused static XBBool SetFg (void *par) { useFg[blockSelected] = !useFg[blockSelected]; printf ("Isefg %i\n", useFg[blockSelected]); return XBTrue; } #endif static XBBool SaveGraphics (void *par) { DBSection *section; int temp; char tempString[256]; temp = blockSelected; section = DB_GetSection (level, atomGraphics); if (section == NULL) section = DB_CreateSection (level, atomGraphics); for (blockSelected = 0; blockSelected < BTNUM; blockSelected++) { if (blockName[blockSelected]) { if (useFg[blockSelected]) { sprintf (tempString, "%s\t #%02x%02x%02x #%02x%02x%02x #%02x%02x%02x", blockName[blockSelected], rgbs[blockSelected][0].red, rgbs[blockSelected][0].green, rgbs[blockSelected][0].blue, rgbs[blockSelected][1].red, rgbs[blockSelected][1].green, rgbs[blockSelected][1].blue, rgbs[blockSelected][2].red, rgbs[blockSelected][2].green, rgbs[blockSelected][2].blue); } else { sprintf (tempString, "%s", blockName[blockSelected]); } DB_DeleteEntry (section, atomArrayBlock00[blockSelected]); DB_CreateEntryString (section, atomArrayBlock00[blockSelected], (char *)&tempString); } } blockSelected = temp; if (recreate) { return XBTrue; } else { return ExitGraphicsMenu (par); } } /* * Edit the graphics */ static XBBool FreeBlockMenu (void *par) { //MenuUnloadTiles (); MenuClear (); SetBlockGraphics (0); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Free Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool ShawdowedBlockMenu (void *par) { //MenuUnloadTiles (); MenuClear (); SetBlockGraphics (1); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Burned Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool SolidBlockMenu (void *par) { //MenuUnloadTiles (); MenuClear (); SetBlockGraphics (2); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Solid Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool RisingBlockMenu (void *par) { //MenuUnloadTiles (); MenuClear (); SetBlockGraphics (3); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Rising Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool BlastableBlockMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (4); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Blastable Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool BlastedBlockMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (5); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Void Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool ExtraBlockBombMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (6); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Bomb Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool ExtraBlockRangeMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (7); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Range Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool BlockTrapMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (8); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Trap Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool ExtraBlockSpecialMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (9); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Special Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool VoidBlockMenu (void *par) { // MenuUnloadTiles (); MenuClear (); SetBlockGraphics (10); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Void Block")); BuildColorsMenu (par); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool CreateGraphicsMenu (void *par) { static XBComboEntryList *colorValueList = NULL; // MenuUnloadTiles (); // MenuLoadTiles (); MenuClear (); SetOldBlock (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Select Block")); if (NULL == colorValueList) { colorValueList = CreateColorValueList (); } MenuAddHButton (2 * CELL_W, MENU_ROW (0), 4 * CELL_W, N_("Free Block"), FreeBlockMenu, par); MenuAddHButton (9 * CELL_W, MENU_ROW (0), 4 * CELL_W, N_("Shadowed Block"), ShawdowedBlockMenu, par); MenuAddHButton (2 * CELL_W, MENU_ROW (1), 4 * CELL_W, N_("Solid Block"), SolidBlockMenu, par); MenuAddHButton (9 * CELL_W, MENU_ROW (1), 4 * CELL_W, N_("Rising Block"), RisingBlockMenu, par); MenuAddHButton (2 * CELL_W, MENU_ROW (2), 4 * CELL_W, N_("Blastable Block"), BlastableBlockMenu, par); MenuAddHButton (9 * CELL_W, MENU_ROW (2), 4 * CELL_W, N_("Blasted Block"), BlastedBlockMenu, par); MenuAddHButton (2 * CELL_W, MENU_ROW (3), 4 * CELL_W, N_("Extra Bomb"), ExtraBlockBombMenu, par); MenuAddHButton (9 * CELL_W, MENU_ROW (3), 4 * CELL_W, N_("Extra Range"), ExtraBlockRangeMenu, par); MenuAddHButton (2 * CELL_W, MENU_ROW (4), 4 * CELL_W, N_("Trap"), BlockTrapMenu, par); MenuAddHButton (9 * CELL_W, MENU_ROW (4), 4 * CELL_W, N_("Special Extra"), ExtraBlockSpecialMenu, par); MenuAddHButton (2 * CELL_W, MENU_ROW (5), 4 * CELL_W, N_("Void Block"), VoidBlockMenu, par); MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Abort"), ExitGraphicsMenu, par)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Apply"), ApplyGraphics, par); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Save"), SaveGraphics, par)); MenuSetLinks (); /* that's all */ return XBFalse; } static XBBool BuildColorsMenu (void *par) { static XBComboEntryList *colorValueList = NULL; if (NULL == colorValueList) { colorValueList = CreateColorValueList (); } MenuAddComboInt (2 * CELL_W, MENU_ROW (1), 3 * CELL_W, "FG R", 3 * CELL_W / 2, &rgbs[blockSelected][0].red, colorValueList); MenuAddComboInt (8 * CELL_W, MENU_ROW (1), 3 * CELL_W, "FG G", 3 * CELL_W / 2, &rgbs[blockSelected][0].green, colorValueList); MenuAddComboInt (2 * CELL_W, MENU_ROW (2), 3 * CELL_W, "FG B", 3 * CELL_W / 2, &rgbs[blockSelected][0].blue, colorValueList); MenuAddComboInt (8 * CELL_W, MENU_ROW (2), 3 * CELL_W, "BG R", 3 * CELL_W / 2, &rgbs[blockSelected][1].red, colorValueList); MenuAddComboInt (2 * CELL_W, MENU_ROW (3), 3 * CELL_W, "BG G", 3 * CELL_W / 2, &rgbs[blockSelected][1].green, colorValueList); MenuAddComboInt (8 * CELL_W, MENU_ROW (3), 3 * CELL_W, "BG B", 3 * CELL_W / 2, &rgbs[blockSelected][1].blue, colorValueList); MenuAddComboInt (2 * CELL_W, MENU_ROW (4), 3 * CELL_W, "Add R", 3 * CELL_W / 2, &rgbs[blockSelected][2].red, colorValueList); MenuAddComboInt (8 * CELL_W, MENU_ROW (4), 3 * CELL_W, "Add G", 3 * CELL_W / 2, &rgbs[blockSelected][2].green, colorValueList); MenuAddComboInt (2 * CELL_W, MENU_ROW (5), 3 * CELL_W, "Add B", 3 * CELL_W / 2, &rgbs[blockSelected][2].blue, colorValueList); MenuSetDefault (MenuAddHButton (2 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Return"), CreateGraphicsMenu, par)); ppmList = CreateFileList (GAME_DATADIR "/image/block/", "ppm", XBFalse); MenuAddHButton (3 * CELL_W, MENU_ROW (6), CELL_W * 6, N_("Change Block"), BlockGraphicToolClicked, (void *)block); MenuAddComboBool (3 * CELL_W, MENU_ROW (7), 5 * CELL_W, N_("Change Colors"), 2 * CELL_W, &useFg[blockSelected]); GUI_DrawBlock (10, 9, blockSelected); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("Apply"), ApplyGraphics, par); return XBFalse; } /* * Edit the map */ static XBBool CreateMapMenu (void *par) { long i; int j, p; BMRectangle get_box = { 2 * STAT_WIDTH / 12, #ifdef SMPF 93 * STAT_HEIGHT / 6, #else 87 * STAT_HEIGHT / 6, #endif STAT_WIDTH * 16, 2 * STAT_HEIGHT / 3, }; char *msg = "Select a block above and put on the maze!"; // unload menu bg tiles, load map tiles SetXBEditMapMode (XBTrue); MenuUnloadTiles (); MenuClear (); SetPressed (XBFalse); SetXBMapMode (XBTrue); ConfigLevel (level); // InitButtonsMap() // tool buttons ClearStatusBar (0, 0); DrawMaze (); SetMazeBlock (0, 13, (BMMapTile) 2); SetMazeBlock (1, 13, (BMMapTile) - 2); for (i = 2; i < BTNUM; ++i) { SetMazeBlock (i, 13, (BMMapTile) i - 2); MarkMazeTile (i, 13); GUI_DrawBlock (i, 13, i - 2); } /* for (i =BTNUM ; i <= 14; ++i) SetMazeBlock(i, 13,(BMMapTile)1); SetMazeBlock(0, 13,(BMMapTile)1); */ MarkMaze (0, MAZE_H, MAZE_W, MAZE_H + 1); for (i = 1; i < BTNUM + 1; ++i) { if (i == 3) { deleteButton = MenuAddHButton (i * CELL_W, MENU_ROW (10), CELL_W, "de", MapToolClicked, (void *)i); } else if (i == 7) { drawButton = MenuAddHButton (i * CELL_W, MENU_ROW (10), CELL_W, "dr", MapToolClicked, (void *)i); } else { MenuAddHButton (i * CELL_W, MENU_ROW (10), CELL_W, "", MapToolClicked, (void *)i); } } MenuAddHButton ((BTNUM + 1) * CELL_W, MENU_ROW (10), CELL_W, N_("exit"), ReturnFromMap, NULL); DrawMaze (); GUI_DrawBlock (0, 13, 2); GUI_DrawBlock (1, 13, 2); GUI_DrawBlock (14, 13, 2); GUI_DrawBlock (13, 13, 2); GUI_DrawBlock (12, 13, 2); if (init) { for (i = 0; i < MAZE_H; i++) { for (j = 0; j < MAZE_W; j++) { mazeSave[i][j] = GetMazeBlock (j, i); mazeSaveEvil[i][j] = XBFalse; } } init = 0; } else { for (i = 0; i < MAZE_H - 1; i++) { for (j = 0; j < MAZE_W; j++) { if (mazeSaveEvil[i][j]) { fprintf (stderr, " evil %li %i \n", i, j); SetMazeBlock (j, i, (BMMapTile) - 2); } } } } SetMazeBlock (1, 13, (BMMapTile) - 2); for (i = 2; i < BTNUM + 1; ++i) { SetMazeBlock (i, 13, (BMMapTile) i - 2); GUI_DrawBlock (i, 13, (BMMapTile) i - 2); } for (i = BTNUM + 1; i <= 14; ++i) SetMazeBlock (i, 13, (BMMapTile) 2); SetMazeBlock (0, 13, (BMMapTile) 2); for (i = 0; i < (4 * MAZE_W); i++) { GUI_DrawTimeLed (i, 1); } p = -1; while (p != 0) { p = getShrinkTimes (p); if (p != 0) { if ((p >= 0) && (p < GAME_TIME)) { i = 4 * MAZE_W - (p / TIME_STEP); // inverse GUI_DrawTimeLed (i, 2); } } } GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDeleteTime / 100, 4); GUI_DrawTimeLed ((4 * MAZE_W) * scrambleDrawTime / 100, 3); GUI_DrawTextbox (msg, TEXT_ATTR_NORMAL | FF_Scroll, &get_box); MarkMaze (0, MAZE_H + STAT_H - 1, 20, MAZE_H + STAT_H); // for (i =0 ; i <= 14; ++i) // GUI_DrawBlock (MAZE_H+2,14,(BMMapTile) 2); /* for (i =0 ; i <= 14; ++i) SetMazeBlock(i, 13,(BMMapTile) BTVoid); */ /* for (i =0 ; i <= 14; ++i) SetMazeBlock(i, 13,(BMMapTile) 1); */ MenuSetLinks (); return XBFalse; } /* * Create the Edit Level menu */ static XBBool CreateLevelMainMenu (void *par) { MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Level")); MenuAddHButton (9 * CELL_W / 2, MENU_TOP, 6 * CELL_W, N_("Edit Level Info"), CreateInfoMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 1 * CELL_H, 6 * CELL_W, N_("Edit Shrink"), CreateShrinkMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 2 * CELL_H, 6 * CELL_W, N_("Edit Special Extras"), CreateSpecialExtrasMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 3 * CELL_H, 6 * CELL_W, N_("Edit Bombs"), CreateBombsMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 4 * CELL_H, 6 * CELL_W, N_("Edit Graphics"), CreateGraphicsMenu, par); MenuAddHButton (9 * CELL_W / 2, MENU_TOP + 5 * CELL_H, 6 * CELL_W, N_("Edit Map"), CreateMapMenu, par); MenuSetDefault (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Save", SaveLevel, par)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Save as ..."), CreateSaveAsMenu, par); MenuSetAbort (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Cancel"), CreateEditMenu, par)); MenuSetLinks (); return XBFalse; } /* CreateEditLevelMenu */ /* * Load a level file */ static XBBool LoadLevel (void *par) { level = DB_Create (DT_Level, GUI_StringToAtom (fileName)); if (!DB_Load (level)) { DB_Delete (level); return XBFalse; } return CreateLevelMainMenu (par); } /* ButtonLoadLevel */ /* * Create a new level */ static XBBool CreateLevel (void *par) { DBSection *section; int i; if (strlen (fileName) == 0) strcpy (fileName, "tempLevel"); level = DB_Create (DT_Level, GUI_StringToAtom (fileName)); /* map */ section = DB_CreateSection (level, atomMap); strcpy (mazeSaveChar[0], "BBBBBBBBBBBBBBB"); DB_CreateEntryString (section, atomArrayRow00[0], mazeSaveChar[0]); for (i = 1; i < MAZE_H - 1; ++i) { strcpy (mazeSaveChar[i], "B_____________B"); DB_CreateEntryString (section, atomArrayRow00[i], mazeSaveChar[i]); } strcpy (mazeSaveChar[MAZE_H - 1], "BBBBBBBBBBBBBBB"); DB_CreateEntryString (section, atomArrayRow00[MAZE_H - 1], mazeSaveChar[MAZE_H - 1]); /* graphics */ section = DB_CreateSection (level, atomGraphics); for (i = 0; i < MAX_BLOCK; ++i) DB_CreateEntryString (section, atomArrayBlock00[i], graphics[i]); /* bombs */ section = DB_CreateSection (level, atomBombs); /* player */ section = DB_CreateSection (level, atomPlayer); DB_CreateEntryInt (section, atomBombs, 3); DB_CreateEntryInt (section, atomRange, 3); for (i = 0; i < MAX_PLAYER; ++i) DB_CreateEntryString (section, atomArrayPos0[i + 1], "7 6"); /* func */ section = DB_CreateSection (level, atomFunc); DB_CreateEntryString (section, atomExtra, "invincible"); /* shrink */ section = DB_CreateSection (level, atomShrink); /* info */ section = DB_CreateSection (level, atomInfo); DB_CreateEntryString (section, atomGameMode, "R23456STDL"); DB_CreateEntryString (section, atomHint, _("Write something clever here")); DB_CreateEntryString (section, atomAuthor, _("My name")); DB_CreateEntryString (section, atomName, _("My new level")); DB_Store (level); memset (mazeSave, 0, MAZE_H * MAZE_W); init = 1; memset (mazeScrambleDraw, 0, MAZE_H * MAZE_W); memset (mazeScrambleDelete, 0, MAZE_H * MAZE_W); if (recreate) { return XBTrue; } else { return CreateLevelMainMenu(par); } } /* ButtonCreateLevel */ /* * Create the Load Level menu */ static XBBool CreateLoadLevelMenu (void *par) { MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Load Level")); MenuAddString (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, N_("Level File:"), 4 * CELL_W, fileName, STRING_LENGTH); MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Abort"), CreateEditMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Ok"), LoadLevel, par)); MenuSetLinks (); /* that's all */ return XBFalse; } XBBool CreateEditMenu (void *par) { MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Edit Levels")); MenuAddHButton (9 * CELL_W / 2, MENU_ROW (0), 6 * CELL_W, N_("Create New Level"), CreateLevel, par); MenuAddHButton (9 * CELL_W / 2, MENU_ROW (1), 6 * CELL_W, N_("Load Existing Level"), CreateLoadLevelMenu, par); MenuSetAbort (MenuAddHButton (9 * CELL_W / 2, MENU_BOTTOM, 6 * CELL_W, N_("Extras Menu"), CreateExtrasMenu, par)); /* return and escape */ MenuSetLinks (); /* that's all */ return XBFalse; } xblast-2.10.4/menu_edit.h0000644000175000017500000000216410372731124014335 0ustar rhondaalfie/* * file menu_edit.h - user interface for editing levels * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This file (C) Lars Luthman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef MENU_EDIT_H #define MENU_EDIT_H #define STRING_LENGTH 200 extern XBBool CreateEditMenu (void *par); extern void SetEditMapBlock (int x, int y); extern XBBool SetToBlockFree (void); extern XBBool SetOldBlock (void); // class variables #endif xblast-2.10.4/menu_extras.c0000644000175000017500000003653310412220337014712 0ustar rhondaalfie/* * file menu_extras.c - user interface for extras like demo playback and statistics * * $Id: menu_extras.c,v 1.17 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local vriables */ static XBStatData *datStat = NULL; static XBCentralData *datCentral = NULL; static size_t numStat = 0; #ifdef W32 static long firstStat = 0; static long lastStat = 0; static long firstDemo = 0; static long lastDemo = 0; #else static ssize_t firstStat = 0; static ssize_t lastStat = 0; static ssize_t firstDemo = 0; static ssize_t lastDemo = 0; #endif static MIC_button exitFunc = NULL; static MIC_button selectFunc = NULL; static CFGDemoEntry *demoList = NULL; static size_t numDemos = 0; static CFGPlayerGraphics gfxPlayer[4]; // XBCC static const CFGPlayerGraphics *pGfxPlayer[4] = { NULL, NULL, NULL, NULL, }; static BMSpriteAnimation allAnime[4] = { // XBCC SpriteStopLeft, SpriteStopUp, SpriteStopDown, SpriteStopRight }; static BMSpriteAnimation bigAnime[1] = { SpriteWinner }; // XBCC static XBBool centralDat; static int received; /*************************** * generic statistics menu * ***************************/ /* needed prototype*/ static XBBool CreateStatMenu (void *par); /* * forward in selection */ static XBBool ButtonForward (void *par) { if (lastStat < numStat) { firstStat = lastStat; } return CreateStatMenu (par); } /* ButtonForward */ /* * backward in selection */ static XBBool ButtonBackward (void *par) { firstStat -= 2 * MAX_GSTAT_ROWS; if (firstStat < 0) { firstStat = 0; } return CreateStatMenu (par); } /* ButtonBackward */ /* * back to extras menu */ static XBBool ButtonBack (void *par) { MIC_button func = (MIC_button) par; assert (func != NULL); assert (datStat != NULL); /* --- */ free (datStat); datStat = NULL; numStat = 0; firstStat = 0; lastStat = 0; exitFunc = NULL; selectFunc = NULL; /* */ return (*func) (NULL); } /* ButtonBack */ /* * draw generic statistics menu */ static XBBool CreateStatMenu (void *par) { size_t i, j; MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Player Statistics")); /* list buttons */ MenuSetActive (MenuAddStatHeader (GSTAT_LEFT, GSTAT_TOP, GSTAT_WIDTH, par), XBFalse); for (i = 0, j = firstStat; j < numStat && i < MAX_GSTAT_ROWS; i++, j++) { MenuSetActive (MenuAddStatEntry (GSTAT_LEFT, GSTAT_ROW (i), GSTAT_WIDTH, datStat + j, selectFunc, datStat + j), (selectFunc != NULL)); } lastStat = j; /* Buttons */ MenuSetActive (MenuAddHButton (GSTAT_BACK_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, "<<<", ButtonBackward, par), (firstStat > 0)); MenuSetAbort (MenuAddHButton (GSTAT_ESCAPE_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, N_("Up"), ButtonBack, (void *)exitFunc)); MenuSetActive (MenuAddHButton (GSTAT_FORW_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, ">>>", ButtonForward, par), (lastStat < numStat)); /* */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateStatMenu */ /********************* * Player Statistics * *********************/ /* * create menu with info for selected player */ static XBBool CreateSinglePlayerStatMenu (void *par) { XBStatData *ptr = par; XBAtom player = ptr->atom; /* delete old list */ assert (datStat != NULL); free (datStat); /* get play list */ datStat = CreatePlayerSingleStat (player, &numStat); if (NULL == datStat) { return CreatePlayerStatMenu (NULL); } firstStat = 0; exitFunc = CreatePlayerStatMenu; selectFunc = NULL; return CreateStatMenu (N_("Level")); } /* CreatePlayerStatMenu */ /* * create player statistics menu */ XBBool CreatePlayerStatMenu (void *par) { /* get play list */ datStat = CreatePlayerTotalStat (&numStat); if (NULL == datStat) { return CreateExtrasMenu (NULL); } firstStat = 0; exitFunc = CreateExtrasMenu; selectFunc = CreateSinglePlayerStatMenu; return CreateStatMenu (N_("Player")); } /* CreatePlayerStatMenu */ /******************** * level statistics * ********************/ /* * create menu with info for a selected level */ static XBBool CreateSingleLevelStatMenu (void *par) { XBStatData *ptr = par; XBAtom level = ptr->atom; /* delete old list */ assert (datStat != NULL); free (datStat); /* get play list */ datStat = CreateLevelSingleStat (level, &numStat); if (NULL == datStat) { return CreateLevelStatMenu (NULL); } firstStat = 0; exitFunc = CreateLevelStatMenu; selectFunc = NULL; return CreateStatMenu (N_("Player")); } /* CreateLevelStatMenu */ /* * create level statistics menu */ XBBool CreateLevelStatMenu (void *par) { /* get play list */ datStat = CreateLevelTotalStat (&numStat); if (NULL == datStat) { return CreateExtrasMenu (NULL); } firstStat = 0; exitFunc = CreateExtrasMenu; selectFunc = CreateSingleLevelStatMenu; return CreateStatMenu (N_("Level")); } /* CreateLevelStatMenu */ /********************** * central statistics * **********************/ /* needed prototypes */ static XBBool CreateCentralMenu2 (void *par); /* * XBCC Forward in selection */ static XBBool ButtonCentralForward (void *par) { if (lastStat < numStat) { firstStat = lastStat; } return CreateCentralMenu2 (par); } /* ButtonForward */ /* * Forward in selection */ static XBBool ButtonCentralBackward (void *par) { firstStat -= MAX_GSTAT_ROWS; if (firstStat < 0) { firstStat = 0; } return CreateCentralMenu2 (par); } /* ButtonForward */ /* * back to extras menu */ static XBBool ButtonCentralBack (void *par) { MIC_button func = (MIC_button) par; assert (func != NULL); assert (datCentral != NULL); /* --- */ free (datCentral); datCentral = NULL; numStat = 0; firstStat = 0; lastStat = 0; exitFunc = NULL; selectFunc = NULL; /* */ return (*func) (NULL); } /* ButtonBack */ /* * draw menu with player info from central */ static XBBool CreatePlayerInfoMenu (void *par) { XBCentralData *ptr = par; XBAtom player = ptr->atom; XBCentralInfo *infoCentral = NULL; int i; MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Player Info")); /* list buttons */ infoCentral = CreateCentralInfo (player, *ptr); MenuSetActive (MenuAddInfoHeader (GSTAT_LEFT, GSTAT_TOP, GSTAT_WIDTH, NULL), XBFalse); for (i = 0; i < MAX_MENU_INFO; i++) { MenuSetActive (MenuAddInfoEntry (GSTAT_LEFT, GSTAT_ROW (i), GSTAT_WIDTH, infoCentral + i, NULL, infoCentral + i), 0); } /* Buttons */ RetrievePlayerGraphics (CT_Central, player, COLOR_INVALID, gfxPlayer); for (i = 0; i < 4; i++) { pGfxPlayer[i] = gfxPlayer; MenuAddPlayer (PLAYER_LEFT (i, 4), PLAYER_TOP, PLAYER_WIDTH, i, pGfxPlayer + i, 1, allAnime + i); } MenuSetAbort (MenuAddHButton (GSTAT_ESCAPE_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, N_("Back"), CreateCentralStatMenu, NULL)); return XBFalse; } /* CreatePlayerInfoMenu */ /* * draw the central statistics menu */ static XBBool CreateCentralMenu2 (void *par) { size_t i, j; MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Player Statistics")); /* list buttons */ MenuSetActive (MenuAddCentralHeader (GSTAT_LEFT, GSTAT_TOP, GSTAT_WIDTH, par), XBFalse); for (i = 0, j = firstStat; j < numStat && i < MAX_GSTAT_ROWS; i++, j++) { MenuSetActive (MenuAddCentralEntry (GSTAT_LEFT, GSTAT_ROW (i), GSTAT_WIDTH, datCentral + j, selectFunc, datCentral + j), (selectFunc != NULL)); } lastStat = j; /* Buttons */ MenuSetActive (MenuAddHButton (GSTAT_BACK_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, "<<<", ButtonCentralBackward, par), (firstStat > 0)); MenuSetAbort (MenuAddHButton (GSTAT_ESCAPE_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, N_("Up"), ButtonCentralBack, (void *)exitFunc)); MenuSetActive (MenuAddHButton (GSTAT_FORW_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, ">>>", ButtonCentralForward, par), (lastStat < numStat)); if (RetrievePlayerGraphics (CT_Central, datCentral->atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateStatList */ /* * XBCC create central statistics menu */ XBBool CreateCentralStatMenu (void *par) { /* get play list */ if (!centralDat) { datCentral = CreateCentralStat (&numStat); firstStat = 0; } if (NULL == datCentral) { return CreateExtrasMenu (NULL); } centralDat = XBTrue; exitFunc = CreateExtrasMenu; selectFunc = CreatePlayerInfoMenu; return CreateCentralMenu2(N_("Players")); } /* CreateLevelStatMenu */ /***************** * demo playback * *****************/ /* needed prototypes */ static XBBool CreateDemoMenu (void *par); /* * demo button */ static XBBool ButtonDemoStart (void *par) { XBAtom *atom = par; assert (NULL != par); /* load demo */ LoadDemoFromFile (*atom); /* start game in demo mode */ SetHostType (XBPH_Demo); /* clean up */ if (NULL != demoList) { free (demoList); demoList = NULL; } MenuClear (); /* let's go */ return XBTrue; } /* ButtonDemoStart */ /* * Forward in selection */ static XBBool ButtonDemoForward (void *par) { if (lastDemo < numDemos) { firstDemo = lastDemo; } return CreateDemoMenu (par); } /* ButtonForward */ /* * Forward in selection */ static XBBool ButtonDemoBackward (void *par) { firstDemo -= MAX_GSTAT_ROWS; if (firstDemo < 0) { firstDemo = 0; } return CreateDemoMenu (par); } /* ButtonForward */ /* * show demo playback menu */ static XBBool CreateDemoMenu (void *par) { size_t i, j; /* create demo list if needed */ if (NULL == demoList) { demoList = CreateDemoList (&numDemos); firstDemo = 0; } /* no demos >= back to extras */ if (NULL == demoList) { return CreateExtrasMenu (NULL); } MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Demo Playback")); /* list buttons */ MenuSetActive (MenuAddDemoHeader (GSTAT_LEFT, GSTAT_TOP, GSTAT_WIDTH), XBFalse); for (i = 0, j = firstDemo; j < numDemos && i < MAX_GSTAT_ROWS; i++, j++) { (void)MenuAddDemoEntry (GSTAT_LEFT, GSTAT_ROW (i), GSTAT_WIDTH, demoList + j, ButtonDemoStart, &demoList[j].atom); } lastDemo = j; /* Buttons */ MenuSetActive (MenuAddHButton (GSTAT_BACK_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, "<<<", ButtonDemoBackward, NULL), (firstDemo > 0)); MenuSetAbort (MenuAddHButton (GSTAT_ESCAPE_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, N_("Extras"), CreateExtrasMenu, NULL)); MenuSetActive (MenuAddHButton (GSTAT_FORW_LEFT, MENU_BOTTOM, GSTAT_B_WIDTH, ">>>", ButtonDemoForward, NULL), (lastDemo < numDemos)); /* */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateDemoMenu */ /***************************** * update central statistics * *****************************/ /* * back to extras */ static XBBool ButtonAbortUpdate (void *par) { if (User_Connected ()) { User_Disconnect (); } return CreateExtrasMenu (NULL); } /* ButtonAbortUpdate */ /* * polling for network events */ static void PollNetwork (void *par) { XBNetworkEvent msg; unsigned int id; unsigned int cnt = 0; static char buf[25]; /* check network events */ while (XBNW_None != (msg = Network_GetEvent (&id))) { switch (msg) { case XBNW_RightPlayerConfig: case XBNW_LeftPlayerConfig: case XBNW_Joy1PlayerConfig: case XBNW_Joy2PlayerConfig: cnt++; break; case XBNW_Disconnected: MenuAddLabel (5 * CELL_W / 2, MENU_ROW (5), 10 * CELL_W, N_("Update finished!")); SavePlayerCentral (); break; case XBNW_Error: sprintf (buf, "network error = %i", id); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (5), 10 * CELL_W, buf); /* restoring old data */ LoadPlayerCentral (XBFalse); break; default: /* anything else */ fprintf (stderr, "unexpected network event %u, %u\n", msg, id); break; } } /* update player config count */ if (cnt > 0) { Dbg_Out ("%u player configs received\n", cnt); received = User_Received (); } } /* PollNetwork */ /* * create the update menu */ static XBBool CreateCentralUpdateMenu (void *par) { CFGCentralSetup central; /* clear menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Update statistics")); /* connect to central */ RetrieveCentralSetup (¢ral); if (User_Connect (¢ral)) { /* request update from central */ User_RequestUpdate (); /* build menu items */ received = 0; MenuAddLabel (5 * CELL_W / 2, MENU_ROW (2), 10 * CELL_W, N_("Connected...")); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (3), 10 * CELL_W, N_("Receiving players...")); MenuAddIntTag (12 * CELL_W / 2, MENU_ROW (4), 6 * CELL_W / 2, &received); MenuSetAbort (MenuAddHButton (8 * CELL_W / 2, MENU_BOTTOM, 7 * CELL_W, N_("Back"), ButtonAbortUpdate, par)); /* poll function */ MenuAddCyclic (PollNetwork, par); } else { MenuAddLabel (5 * CELL_W / 2, MENU_ROW (2), 10 * CELL_W, N_("Unable to connect to central.")); MenuSetAbort (MenuAddHButton (8 * CELL_W / 2, MENU_BOTTOM, 7 * CELL_W, N_("Damn"), CreateExtrasMenu, par)); } /* */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateCentralUpdateMenu */ /*************** * extras menu * ***************/ /* * exit button */ static XBBool ButtonExitExtras (void *par) { FinishPlayerCentral (); return CreateMainMenu (NULL); } /* ButtonExitExtras */ /* * create the extras menu */ XBBool CreateExtrasMenu (void *par) { MenuClear (); // LoadDemoConfig(); LoadPlayerCentral (XBFalse); centralDat = XBFalse; /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Extras Menu")); /* Buttons */ (void)MenuAddHButton (MENU_LEFT, MENU_ROW (0), MENU_WIDTH, N_("Player Statistics"), CreatePlayerStatMenu, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_ROW (1), MENU_WIDTH, N_("Level Statistics"), CreateLevelStatMenu, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_ROW (2), MENU_WIDTH, N_("Demo Playback"), CreateDemoMenu, NULL); (void)MenuAddHButton (MENU_LEFT, MENU_ROW (3), MENU_WIDTH, N_("Edit Levels"), CreateEditMenu, NULL); // XBCC (void)MenuAddHButton (MENU_LEFT, MENU_ROW (5), MENU_WIDTH, N_("Central Statistics"), CreateCentralStatMenu, NULL); // XBCC (void)MenuAddHButton (MENU_LEFT, MENU_ROW (6), MENU_WIDTH, N_("Update Central Statistics"), CreateCentralUpdateMenu, NULL); // XBCC /* leave menu */ // MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, N_("Main Menu"), CreateMainMenu, NULL) ); MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, N_("Main Menu"), ButtonExitExtras, par)); // XBCC close central DB /* escape */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateExtrasMenu */ /* * end of file menu_extras.c */ xblast-2.10.4/menu_extras.h0000644000175000017500000000232610372731124014716 0ustar rhondaalfie/* * file menu_extras.h - user interface for extras like demo playback and statistics * * $Id: menu_extras.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MENU_EXTRAS_H #define _MENU_EXTRAS_H /* * global prototypes */ extern XBBool CreateExtrasMenu (void *par); extern XBBool CreatePlayerStatMenu (void *par); extern XBBool CreateLevelStatMenu (void *par); extern XBBool CreateCentralStatMenu (void *par); #endif /* * end of file menu_extras.h */ xblast-2.10.4/menu_game.c0000644000175000017500000004603110443516456014325 0ustar rhondaalfie/* * file menu_game.c - menus for setting up game parameters * * $Id: menu_game.c,v 1.17 2006/06/13 11:10:38 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define ANIME_LENGTH 4 /* * local variables */ static XBPlayerHost hostType; static XBMenuLevelPar mlp; /* game config */ static CFGGameSetup gameSetup = { XBFalse, /* respect the number of lives dictated by level */ 1, /* number of lives */ 9, /* number victories */ 30, /* frame rate */ XBTrue, /* select all levels */ XBTrue, /* random level order */ XBTrue, /* random player positions */ 0, /* level order */ 15, /* info wait time */ XBFalse, /* demo on DEMOFIX */ XBTM_None, /* team mode */ XBTrue, /* XBCC not rated */ XBFalse, /* bot */ 2, /* number of rec lives (valid if 1. XBTrue) */ }; static MENU_ID idButtonCentral; static MENU_ID idButtonStart; static MENU_ID idButtonLevels; /* player controls */ static XBAtom _gamePlayers[NUM_LOCAL_PLAYER]; static const XBPlayerControl _gameControl[NUM_LOCAL_PLAYER] = { XBPC_RightKeyboard, XBPC_LeftKeyboard, XBPC_Joystick1, XBPC_Joystick2, XBPC_Joystick3, XBPC_Joystick4, }; static const char *playerControl[NUM_LOCAL_PLAYER] = { N_("Right Keyboard:"), N_("Left Keyboard:"), N_("Joystick 1:"), N_("Joystick 2:"), N_("Joystick 3:"), N_("Joystick 4:"), }; /* local player selection */ static XBComboEntryList *playerList = NULL; /* number of lives */ static XBComboEntryList numLivesList[] = { {"1", 1, NULL, ATOM_INVALID,}, {"2", 2, NULL, ATOM_INVALID,}, {"3", 3, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList numWinsList[] = { {"1", 1, NULL}, {"2", 2, NULL}, {"3", 3, NULL}, {"4", 4, NULL}, {"5", 5, NULL}, {"6", 6, NULL}, {"7", 7, NULL}, {"8", 8, NULL}, {"9", 9, NULL}, {NULL, 0, NULL}, }; static XBComboEntryList waitInfoList[] = { // LRF {"1", 1, NULL, ATOM_INVALID,}, {"2", 2, NULL, ATOM_INVALID,}, {"3", 3, NULL, ATOM_INVALID,}, {"4", 4, NULL, ATOM_INVALID,}, {"5", 5, NULL, ATOM_INVALID,}, {"7", 7, NULL, ATOM_INVALID,}, {"10", 10, NULL, ATOM_INVALID,}, {"15", 15, NULL, ATOM_INVALID,}, {"20", 20, NULL, ATOM_INVALID,}, {"30", 30, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList levelOrderList[] = { // LRF {N_("Alphabetic"), 1, NULL, ATOM_INVALID,}, {N_("Random"), 2, NULL, ATOM_INVALID,}, {N_("Time"), 3, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList musicList[] = { // LRF {"None", 0, NULL, ATOM_INVALID,}, {"Song1", SND_SNG1, NULL, ATOM_INVALID,}, {"Song2", SND_SNG2, NULL, ATOM_INVALID,}, {"Song3", SND_SNG3, NULL, ATOM_INVALID,}, {"Song4", SND_SNG4, NULL, ATOM_INVALID,}, {"Song5", SND_SNG5, NULL, ATOM_INVALID,}, {"Song6", SND_SNG6, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; static XBComboEntryList frameRateList[] = { {"10", 10, NULL, ATOM_INVALID,}, {"12", 12, NULL, ATOM_INVALID,}, {"14", 14, NULL, ATOM_INVALID,}, {"16", 16, NULL, ATOM_INVALID,}, {"18", 18, NULL, ATOM_INVALID,}, {"20", 20, NULL, ATOM_INVALID,}, {"22", 22, NULL, ATOM_INVALID,}, {"24", 24, NULL, ATOM_INVALID,}, {"26", 26, NULL, ATOM_INVALID,}, {"28", 28, NULL, ATOM_INVALID,}, {"30", 30, NULL, ATOM_INVALID,}, {"32", 32, NULL, ATOM_INVALID,}, {"34", 35, NULL, ATOM_INVALID,}, {"36", 36, NULL, ATOM_INVALID,}, {"40", 40, NULL, ATOM_INVALID,}, {"45", 45, NULL, ATOM_INVALID,}, {"50", 50, NULL, ATOM_INVALID,}, {"60", 60, NULL, ATOM_INVALID,}, {"72", 72, NULL, ATOM_INVALID,}, {"85", 85, NULL, ATOM_INVALID,}, {"100", 100, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; #ifdef DEBUG_TEAM static XBComboEntryList teamModeList[] = { {N_("None"), XBTM_None, NULL}, {N_("Team"), XBTM_Team, NULL}, {NULL, 0, NULL}, }; #endif static BMSpriteAnimation playerAnime[ANIME_LENGTH] = { SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, }; XBBool autoCentral = XBFalse; /* * delete player confiug array for combo box */ static void DeletePlayerConfigList (XBComboEntryList * list) { int i; assert (list != NULL); i = 0; while (list[i].text != NULL) { if (NULL != list[i].data) { free (list[i].data); } i++; } free (list); } /* DeletePlayerConfigList */ /* * Convert player config array to combo list */ static XBComboEntryList * CreatePlayerConfigList (void) { XBComboEntryList *list; int i, num; CFGPlayerGraphics *gfx; num = GetNumPlayerConfigs (CT_Local); /* alloc list */ list = calloc (2 + num, sizeof (XBComboEntryList)); assert (list != NULL); /* fill list */ for (i = 0; i < num; i++) { XBAtom atom = GetPlayerAtom (CT_Local, i); list[i].atom = atom; list[i].text = GetPlayerName (CT_Local, atom); gfx = calloc (1, sizeof (CFGPlayerGraphics)); if (RetrievePlayerGraphics (CT_Local, atom, COLOR_INVALID, gfx)) { list[i].data = gfx; } else { free (gfx); } } list[i].atom = ATOM_INVALID; list[i].text = "none"; list[i].data = NULL; return list; } /* CreatePlayerConfigList */ /* * */ static XBBool ButtonMainMenu (void *par) { /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* call main menu */ return CreateMainMenu (par); } /* ButtonMainMenu */ /* * */ static XBBool ButtonStartLocalGame (void *par) { /* clean up */ MenuClear (); return XBTrue; } /* set game config */ #ifdef DEBUG_TEAM /* * */ static void AssignRandomTeams (XBTeamMode mode, int num, XBPlayerTeam * team) { int i, j; XBPlayerTeam swap; assert (NULL != team); GUI_ErrorMessage ("in assign 0"); switch (mode) { case XBTM_RandomTwo: GUI_ErrorMessage ("in assign 1"); for (i = 0; i < num; i++) { team[i] = XBPT_None + 1 + (i % 2); } break; case XBTM_RandomThree: for (i = 0; i < num; i++) { team[i] = XBPT_None + 1 + (i % 3); } break; default: return; } /* shuffle teams */ GUI_ErrorMessage ("in assign 3"); for (i = 0; i < num; i++) { GUI_ErrorMessage ("in assign 3.5"); j = OtherRandomNumber (i + 1); GUI_ErrorMessage ("in assign 4"); if (j >= i) { j++; } GUI_ErrorMessage ("in assign 5"); swap = team[i]; team[i] = team[j]; team[j] = swap; } for (i = 0; i < num; i++) { GUI_ErrorMessage ("Player %i is of team %i", i, team[i]); } } /* AssignRandomTeams */ #endif /* * store game config */ static void StoreGameConfig (XBAtom atom) { int i, j; CFGGamePlayers gamePlayers; /* copy players */ for (i = 0, j = 0; i < NUM_LOCAL_PLAYER; i++) { if (ATOM_INVALID != _gamePlayers[i]) { gamePlayers.player[j] = _gamePlayers[i]; gamePlayers.control[j] = _gameControl[i]; gamePlayers.host[j] = XBPH_Local; gamePlayers.team[j] = XBPT_None; j++; } } gamePlayers.num = j; #ifdef DEBUG_TEAM gameSetup.teamMode = XBTM_None; AssignRandomTeams (gameSetup.teamMode, gamePlayers.num, gamePlayers.team); #else gameSetup.teamMode = XBTM_None; #endif /* set and store game config */ StoreGameSetup (CT_Local, atom, &gameSetup); StoreGamePlayers (CT_Local, atom, &gamePlayers); StoreGameConstLocal (CT_Local, atom); } /* StoreGameConfig */ /* * */ static XBBool ButtonAllLevels (void *par) { XBAtom *atom = par; /* level selection */ gameSetup.allLevels = XBTrue; /* store it */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* leave menu */ MenuClear (); return XBTrue; } /* ButtonAllLevels */ /* * */ static XBBool ButtonSelectLevels (void *par) { XBAtom *atom = par; /* level selection */ gameSetup.allLevels = XBFalse; /* store it */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* select levels ? */ return CreateLevelMenu (&mlp); } /* ButtonSelectLevels */ /* * */ static XBBool ButtonStartClient (void *par) { XBAtom *atom = par; /* level selection */ gameSetup.allLevels = XBTrue; /* set and store game config */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* next menu screen */ return CreateClientMenu (par); } /* ButtonSelectLevels */ /* * join screen for central XBCC */ static XBBool ButtonSearchCentral (void *par) { XBAtom *atom = par; /* level selection */ gameSetup.allLevels = XBTrue; /* set and store game config */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* next menu screen */ // return CreateCentralJoinMenu (par); return CreateSearchCentralMenu (par); } /* ButtonSelectLevels */ /* * */ static XBBool ButtonSearchLan (void *par) { XBAtom *atom = par; /* level selection */ gameSetup.allLevels = XBTrue; /* set and store game config */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* next menu screen */ return CreateSearchLanMenu (par); } /* ButtonSelectLevels */ /* * */ static XBBool ButtonStartServer (void *par) { XBAtom *atom = par; if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* level selection */ gameSetup.allLevels = XBTrue; /* set and store game config */ assert (atom != NULL); StoreGameConfig (*atom); /* clear player list */ if (NULL != playerList) { DeletePlayerConfigList (playerList); playerList = NULL; } /* goto next screen */ return CreateServerMenu (par); } /* ButtonSelectLevels */ /* * check if enough players are selected for playing */ static void PollStartGame (void *par) { int i, j, numPlayers; XBBool uniq, numOK, newState; XBAtom *atom = par; static XBBool oldState = XBTrue; assert (atom != NULL); uniq = XBTrue; numPlayers = 0; for (i = 0; i < NUM_LOCAL_PLAYER; i++) { if (ATOM_INVALID != _gamePlayers[i]) { for (j = i + 1; j < NUM_LOCAL_PLAYER; j++) { if (_gamePlayers[i] == _gamePlayers[j]) { uniq = XBFalse; break; } } numPlayers++; } if (!uniq) { break; } } /* check number of players .. */ if (*atom == atomLocal) { /* for local games */ switch (gameSetup.teamMode) { case XBTM_Hunt: numOK = (numPlayers >= 3); break; default: numOK = (numPlayers >= 2); break; } } else { numOK = (numPlayers >= 1); } /* check current state */ newState = uniq && numOK; if (newState != oldState) { MenuSetActive (idButtonStart, newState); MenuSetActive (idButtonLevels, newState); oldState = newState; } } /* PollStartGame */ /* * create items for gamePlayers */ static void CreatePlayerItems (int x) { int i, numJoy; static const CFGPlayerGraphics *localPlayerGraphics[NUM_LOCAL_PLAYER]; /* load player configs */ if (NULL != playerList) { DeletePlayerConfigList (playerList); } playerList = CreatePlayerConfigList (); numJoy = GUI_NumJoysticks (); for (i = 0; i < 2 + numJoy; i++) { MenuAddCombo (x, MENU_ROW (i), 5 * CELL_W, playerControl[i], 2 * CELL_W, NULL, (void **)&localPlayerGraphics[i], &_gamePlayers[i], playerList); MenuAddPlayer (PLAYER_LEFT (i, numJoy + 2), PLAYER_TOP, PLAYER_WIDTH, i, &localPlayerGraphics[i], -ANIME_LENGTH, playerAnime); } } /* CreatePlayerItems */ /* * create items for game parameters */ static void CreateSetupItems (int x, CFGGameSetup * gameSetup, XBBool networkGame) { assert (gameSetup != NULL); MenuAddComboInt (x, MENU_ROW (0), 5 * CELL_W, N_("Lives:"), 2 * CELL_W, &gameSetup->numLives, numLivesList); MenuAddComboInt (x, MENU_ROW (1), 5 * CELL_W, N_("Victories:"), 2 * CELL_W, &gameSetup->numWins, numWinsList); MenuAddComboInt (x, MENU_ROW (2), 5 * CELL_W, N_("Frame Rate:"), 2 * CELL_W, &gameSetup->frameRate, frameRateList); //MenuAddComboBool (x, MENU_ROW (3), 5*CELL_W, N_("Random Levels:"), 2*CELL_W, &gameSetup->randomLevels); //MenuAddComboBool (x, MENU_ROW (4), 5*CELL_W, N_("Random Position:"), 2*CELL_W, &gameSetup->randomPlayers); MenuAddComboInt (x, MENU_ROW (3), 5 * CELL_W, N_("Level Order:"), 2 * CELL_W, &gameSetup->levelOrder, levelOrderList); MenuAddComboInt (x, MENU_ROW (4), 5 * CELL_W, N_("Info screen:"), 2 * CELL_W, &gameSetup->infoTime, waitInfoList); MenuAddComboBool (x, MENU_ROW (5), 5 * CELL_W, N_("Record Demo:"), 2 * CELL_W, &gameSetup->recordDemo); MenuAddComboBool (x, MENU_ROW (6), 5 * CELL_W, N_("Bot:"), 2 * CELL_W, &gameSetup->bot); MenuAddComboBool (x - 6 * CELL_W, MENU_ROW (5), 5 * CELL_W, N_("Recom. Lives:"), 2 * CELL_W, &gameSetup->ifRecLives); MenuAddComboInt (x - 6 * CELL_W, MENU_ROW (6), 5 * CELL_W, N_("Music:"), 2 * CELL_W, (int *)&gameSetup->Music, musicList); if (networkGame) { MenuAddComboBool (x, MENU_ROW (7), 5 * CELL_W, N_("Rated Game:"), 2 * CELL_W, &gameSetup->rated); // XBCC } } /* CreateSetupItems */ static void RetrieveGameConfig (XBAtom atom) { size_t i; size_t numJoy; CFGGamePlayers gamePlayers; numJoy = GUI_NumJoysticks (); /* load game configs */ (void)RetrieveGameSetup (CT_Local, atom, &gameSetup); (void)RetrieveGamePlayers (CT_Local, atom, &gamePlayers); /* copy to edit data */ memset (&_gamePlayers, 0, sizeof (_gamePlayers)); for (i = 0; i < gamePlayers.num; i++) { switch (gamePlayers.control[i]) { case XBPC_RightKeyboard: _gamePlayers[0] = gamePlayers.player[i]; break; case XBPC_LeftKeyboard: _gamePlayers[1] = gamePlayers.player[i]; break; case XBPC_Joystick1: if (numJoy >= 1) { _gamePlayers[2] = gamePlayers.player[i]; } break; case XBPC_Joystick2: if (numJoy >= 2) { _gamePlayers[3] = gamePlayers.player[i]; } break; case XBPC_Joystick3: if (numJoy >= 3) { _gamePlayers[4] = gamePlayers.player[i]; } break; case XBPC_Joystick4: if (numJoy >= 4) { _gamePlayers[5] = gamePlayers.player[i]; } break; default: break; } } } /* RetrieveGameConfig */ /* * create local game */ XBBool CreateLocalGameMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* --- */ hostType = XBPH_Local; RetrieveGameConfig (*atom); /* setup level selection */ mlp.textAbort = N_("Back"); mlp.funcAbort = CreateLocalGameMenu; mlp.parAbort = par; mlp.textDefault = N_("Start"); mlp.funcDefault = ButtonStartLocalGame; mlp.parDefault = NULL; /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Setup Local Game")); /* create player selection */ CreatePlayerItems (2 * CELL_W); /* --- */ CreateSetupItems (8 * CELL_W, &gameSetup, XBFalse); /* Buttons */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Back"), ButtonMainMenu, NULL)); idButtonLevels = MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Select Levels"), ButtonSelectLevels, par); idButtonStart = MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Start"), ButtonAllLevels, par); MenuSetDefault (idButtonStart); /* polling */ MenuAddCyclic (PollStartGame, par); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateLocalGameMenu */ /* * create network game */ XBBool CreateStartNetGameMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* --- */ hostType = XBPH_Server; RetrieveGameConfig (*atom); /* setup level selection */ mlp.textAbort = N_("Back"); mlp.funcAbort = CreateStartNetGameMenu; mlp.parAbort = par; mlp.textDefault = N_("Cont."); mlp.funcDefault = CreateServerMenu; mlp.parDefault = par; /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Start Network Game")); /* create player selection */ CreatePlayerItems (2 * CELL_W); /* --- */ CreateSetupItems (8 * CELL_W, &gameSetup, XBTrue); /* Buttons */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Back"), ButtonMainMenu, NULL)); idButtonLevels = MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Select Levels"), ButtonSelectLevels, par); idButtonStart = MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, N_("Continue"), ButtonStartServer, par); MenuSetDefault (idButtonStart); /* polling */ MenuAddCyclic (PollStartGame, par); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateStartNetGameMenu */ /* * create the options menu */ XBBool CreateJoinNetGameMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* --- */ hostType = XBPH_None; RetrieveGameConfig (*atom); /* build menu */ MenuClear (); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Join Network Game")); /* create player selection */ CreatePlayerItems (2 * CELL_W); /* demo recording */ MenuAddComboBool (8 * CELL_W, MENU_ROW (0), 5 * CELL_W, N_("Record Demo:"), 2 * CELL_W, &gameSetup.recordDemo); /* bot */ MenuAddComboBool (8 * CELL_W, MENU_ROW (1), 5 * CELL_W, N_("bot:"), 2 * CELL_W, &gameSetup.bot); MenuAddComboBool (8 * CELL_W, MENU_ROW (2), 5 * CELL_W, N_("Beep at start:"), 2 * CELL_W, &gameSetup.beep); MenuAddComboInt (8 * CELL_W, MENU_ROW (3), 5 * CELL_W, N_("Music:"), 2 * CELL_W, (int *)&gameSetup.Music, musicList); /* Buttons */ MenuSetAbort (MenuAddHButton (4 * CELL_W / 2, MENU_BOTTOM, 5 * CELL_W, N_("Back"), ButtonMainMenu, NULL)); idButtonCentral = MenuAddHButton (17 * CELL_W / 2, MENU_ROW (6), 5 * CELL_W, N_("Search Central"), ButtonSearchCentral, par); idButtonStart = MenuAddHButton (17 * CELL_W / 2, MENU_ROW (7), 5 * CELL_W, N_("Connect ..."), ButtonStartClient, par); idButtonLevels = MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 5 * CELL_W, N_("Search LAN"), ButtonSearchLan, par); MenuSetDefault (idButtonLevels); /* polling */ MenuAddCyclic (PollStartGame, par); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateJoinNetGameMenu */ /* * create the central menu ( empty just redirect ) XBCC */ void setAutoCentral (XBBool set) { autoCentral = set; setAutoCentral2 (autoCentral); } XBBool CreateCentralGameMenu (void *par) { return CreateCentralMenu (par); } /* ButtonSelectLevels */ /* * */ XBPlayerHost GetHostType (void) { return hostType; } /* GetHostType */ /* * */ void SetHostType (XBPlayerHost _hostType) { hostType = _hostType; } /* SetHostType */ /* * end of file menu_game.c */ xblast-2.10.4/menu_game.h0000644000175000017500000000257010372731124014322 0ustar rhondaalfie/* * file menu_game.h - menus for setting up game parameters * * $Id: menu_game.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MENU_GAME_H #define _MENU_GAME_H /* * prototypes */ extern XBBool CreateLocalGameMenu (void *par); extern XBBool CreateStartNetGameMenu (void *par); extern XBBool CreateJoinNetGameMenu (void *par); extern void setAutoCentral (XBBool set); // XBCC extern XBBool CreateCentralGameMenu (void *par); // XBCC extern XBBool CreateCentralJoinMenu (void *par); // XBCC extern XBPlayerHost GetHostType (void); extern void SetHostType (XBPlayerHost); #endif /* * end of file menu_game.h */ xblast-2.10.4/menu_layout.h0000644000175000017500000000471210372705221014725 0ustar rhondaalfie/* * file menu_layout.h - macros for menu layouts * * $Id: menu_layout.h,v 1.4 2006/02/09 18:31:45 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MENU_LAYOUT_H #define XBLAST_MENU_LAYOUT_H /* * global macros */ #define TITLE_WIDTH (5*CELL_W) #define TITLE_LEFT (5*CELL_W) #define TITLE_TOP (2*CELL_H) #define MENU_WIDTH (6*CELL_W) #define MENU_LEFT (9*CELL_W/2) #define MENU_TOP (3*CELL_H) #define MENU_ROW(y) (MENU_TOP+(y)*CELL_H) #define MENU_BOTTOM (11*CELL_H) #define MENU_LEVEL_TOP (0*CELL_H) #define DLG_TOP (3*CELL_H) #define DLG_ROW(y) (DLG_TOP+(y)*CELL_H) #define DLG_WIDTH (7*CELL_W) #define DLG_LEFT (4*CELL_W) #define PLAYER_TOP (0*CELL_W) #define PLAYER_LEFT(i,n) ((2*(i) - (n) + 16)*CELL_W/2) #define PLAYER_WIDTH (2*CELL_W) #define GSTAT_TOP ( 3*CELL_H) #define GSTAT_ROW(i) (GSTAT_TOP+((i)+1)*CELL_H/2) #define GSTAT_WIDTH (10*CELL_W) #define GSTAT_LEFT ( 5*CELL_W/2) #define GSTAT_B_WIDTH ( 4*CELL_W) #define GSTAT_BACK_LEFT ( 3*CELL_W/2) #define GSTAT_ESCAPE_LEFT (11*CELL_W/2) #define GSTAT_FORW_LEFT (19*CELL_W/2) #define MAX_GSTAT_ROWS 15 #define SEARCH_LEFT ( 3*CELL_W/2) #define SEARCH_WIDTH (24*CELL_W/2) #define SEARCH_TOP ( 3*CELL_H) #define SEARCH_ROW(i) (SEARCH_TOP+((i)+1)*CELL_H/2) #define NUM_SEARCH_ROWS 15 #define MSG_LEFT (3*CELL_W) #define MSG_WIDTH (9*CELL_W) #define MSG_EDIT (6*CELL_W) #define MSG_TOP (TITLE_TOP+CELL_H) #define COLOR_LEFT ( 3*CELL_W) #define COLOR_RIGHT ( 8*CELL_W) #define COLOR_WIDTH ( 4*CELL_W) #define LEVEL_COLS 4 #define LEVEL_ROWS 16 #endif /* * end of file menu_layout.h */ xblast-2.10.4/menu_level.c0000644000175000017500000001270110412220337014502 0ustar rhondaalfie/* * file menu_level.c - level selection menu * * $Id: menu_level.c,v 1.9 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBAtom atom; const char *name; XBBool newSelect; XBBool oldSelect; } XBLevelSelection; /* * local variables */ static int numLevels = 0; static XBLevelSelection *selectList = NULL; static int levelFirst = 0; static int levelLast = 0; /* * compare to level selection elments by name */ static int CompareLevelSelections (const void *a, const void *b) { return strcmp (((const XBLevelSelection *) a)->name, ((const XBLevelSelection *) b)->name); } /* CompareLevelSelections */ /* * create list with all levels configs */ static XBLevelSelection * CreateLevelSelection (int *pNumLevels) { XBLevelSelection *list; int i; XBAtom atom; assert (pNumLevels != NULL); /* how many levels do we have */ *pNumLevels = GetNumLevels (); /* alloc data field */ list = calloc (*pNumLevels, sizeof (XBLevelSelection)); assert (list != NULL); /* store levels */ for (i = 0; i < *pNumLevels; i++) { /* get level data */ atom = GetLevelAtom (i); assert (ATOM_INVALID != atom); /* set selection data */ list[i].atom = atom; list[i].name = GetLevelNameByAtom (atom); list[i].newSelect = list[i].oldSelect = GetLevelSelected (atom); } /* sort list */ qsort (list, *pNumLevels, sizeof (XBLevelSelection), CompareLevelSelections); /* that's all */ return list; } /* CreateLevelList */ /* * select all levels */ static XBBool ButtonLevelSelectAll (void *par) { int i; for (i = 0; i < numLevels; i++) { selectList[i].newSelect = XBTrue; } return XBFalse; } /* ButtonLevelSelectAll */ /* * deselect all levels */ static XBBool ButtonLevelSelectNone (void *par) { int i; for (i = 0; i < numLevels; i++) { selectList[i].newSelect = XBFalse; } return XBFalse; } /* ButtonLevelSelectNone */ /* * Forward in selection */ static XBBool ButtonLevelForward (void *par) { if (levelLast < numLevels) { levelFirst = levelLast; } return CreateLevelMenu (par); } /* ButtonLevelForward */ /* * Continue with game setup */ static XBBool ButtonContinue (void *par) { int i; XBMenuLevelPar *mlp = par; assert (mlp != NULL); /* store level selection */ for (i = 0; i < numLevels; i++) { if (selectList[i].newSelect != selectList[i].oldSelect) { StoreLevelSelected (selectList[i].atom, selectList[i].newSelect); selectList[i].oldSelect = selectList[i].newSelect; /* KOEN 26-06-2002 */ } } /* call start game funtion */ return (*mlp->funcDefault) (mlp->parDefault); } /* ButtonContinue */ /* * Forward in selection */ static XBBool ButtonLevelBackward (void *par) { levelFirst -= LEVEL_ROWS * LEVEL_COLS; if (levelFirst < 0) { levelFirst = 0; } return CreateLevelMenu (par); } /* ButtonLevelForward */ /* * create level selection menu */ XBBool CreateLevelMenu (void *par) { int i, c, r; XBMenuLevelPar *mlp = par; /* get parameter */ assert (mlp != NULL); /* init level selection */ if (NULL == selectList) { selectList = CreateLevelSelection (&numLevels); assert (selectList != NULL); levelFirst = 0; } MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, N_("Level Selection")); /* levels */ c = 0; r = 0; for (i = levelFirst; i < numLevels; i++) { MenuAddToggle ((c * 6 + 3) * CELL_W / 2, MENU_TOP + r * CELL_H / 2, 13 * CELL_W / 4, selectList[i].name, &selectList[i].newSelect); r++; if (r >= LEVEL_ROWS) { r = 0; c++; if (c >= LEVEL_COLS) { break; } } } levelLast = i + 1; /* backwards and forwards */ MenuSetActive (MenuAddVButton (0, 3 * CELL_H, LEVEL_ROWS * CELL_H / 2, N_("Backward"), ButtonLevelBackward, mlp), (levelFirst > 0)); MenuSetActive (MenuAddVButton (14 * CELL_W, 3 * CELL_H, LEVEL_ROWS * CELL_H / 2, N_("Forward"), ButtonLevelForward, mlp), (levelLast < numLevels)); /* selection buttons */ MenuAddHButton (9 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("All"), ButtonLevelSelectAll, mlp); MenuAddHButton (15 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, N_("None"), ButtonLevelSelectNone, mlp); /* cancel & ok */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, mlp->textAbort, mlp->funcAbort, mlp->parAbort)); MenuSetDefault (MenuAddHButton (21 * CELL_W / 2, MENU_BOTTOM, 3 * CELL_W, mlp->textDefault, ButtonContinue, mlp)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateLevelMenu */ /* * finish list with all levels configs */ void FinishLevelSelection (void) { if (NULL != selectList) { free (selectList); selectList = NULL; } } /* FinishLevelSelection */ /* * end of file menu_level.h */ xblast-2.10.4/menu_level.h0000644000175000017500000000241610373126076014524 0ustar rhondaalfie/* * file menu_level.c - level selection menu * * $Id: menu_level.h,v 1.7 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MENU_LEVEL_H #define XBLAST_MENU_LEVEL_H /* * type defintions */ typedef struct { const char *textAbort; MIC_button funcAbort; void *parAbort; const char *textDefault; MIC_button funcDefault; void *parDefault; } XBMenuLevelPar; /* * global prototypes */ extern XBBool CreateLevelMenu (void *par); extern void FinishLevelSelection (void); #endif /* * end of file menu_level.h */ xblast-2.10.4/menu_network.c0000644000175000017500000013750010443516537015107 0ustar rhondaalfie/* * file menu_network.c - user interface for setting up networks games * * $Id: menu_network.c,v 1.62 2006/06/13 11:11:27 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * shared data for all menus */ /* * local constants */ #define ANIME_LENGTH 4 /* * local variables */ /* server configuration */ static char serverName[128]; static int serverPort; static char serverGame[48]; static CFGGameHost cfgServer; static CFGGameHost cfgServerhis[10]; /* host data */ static char *hostName[MAX_HOSTS]; static unsigned hostComplete[MAX_HOSTS]; static MENU_ID hostItem[MAX_HOSTS]; /* player data */ static const char *playerName[MAX_HOSTS][NUM_LOCAL_PLAYER]; static XBBool playerValid[MAX_HOSTS][NUM_LOCAL_PLAYER]; static CFGPlayerGraphics playerGfx[MAX_HOSTS][NUM_LOCAL_PLAYER]; static const CFGPlayerGraphics *pPlayerGfx[NUM_LOCAL_PLAYER]; static BMSpriteAnimation playerAnime[ANIME_LENGTH] = { SpriteStopDown, SpriteWinner3, SpriteWinner2, SpriteWinner, }; /* team data */ static int teamMode = 0; static MENU_ID teamItem[MAX_HOSTS][NUM_LOCAL_PLAYER]; /* network games */ static const XBNetworkGame *networkGame[NUM_SEARCH_ROWS]; static XBNetworkGame **networkGamehis = NULL; static MENU_ID networkItem[NUM_SEARCH_ROWS]; static XBAtom networkAtom; /* data for central */ char title[256]; char stat0[256]; char stat1[256]; char stat2[256]; char stat3[256]; char stat4[256]; XBBool autoCentral2 = XBFalse; /**************************************************** * shared functions for client and server wait menu * ****************************************************/ static XBBool ButtonRefreshSearchCentral (void *par); /* * free hostnames, only use after ServerInit or ClientInit */ static void ClearHostNames (void) { int i; for (i = 0; i < MAX_HOSTS; i++) { if (NULL != hostName[i]) { free (hostName[i]); hostName[i] = NULL; } } } /* ClearHostNames */ /* * send a host state request, client or server */ static void SendHostStateReq (unsigned id, unsigned state) { switch (Network_GetType ()) { case XBNT_Server: Server_ReceiveHostStateReq (0, id, state); break; case XBNT_Client: Client_SendHostStateReq (id, state); break; default: Dbg_Out ("failed to queue host state request, unsupported network type\n"); } } /* SendHostStateReq */ #ifdef UNNEEDED /* * send a team state request, client or server */ static void SendTeamStateReq (unsigned id, unsigned player, unsigned team) { switch (Network_GetType ()) { case XBNT_Server: Server_ReceiveTeamStateReq (0, id, player, team); break; case XBNT_Client: Client_SendTeamStateReq (id, player, team); break; default: Dbg_Out ("failed to queue team state request, unsupported network type\n"); } } /* SendTeamStateReq */ #endif /* * update display pointer for player sprite */ static void UpdatePlayerDisplay (unsigned id, unsigned player) { switch (Network_GetTeamState (id, player)) { case XBTS_Invalid: case XBTS_Out: pPlayerGfx[player] = NULL; break; default: pPlayerGfx[player] = &playerGfx[id][player]; break; } } /* UpdatePlayerDisplay */ #ifdef REQUESTS /* detailed requests info in menu, experimental request handling */ /* * team change handler - handle local changes of team states */ static XBBool TeamChangeLocal (unsigned id, unsigned player, XBTeamState * cur) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); /* TODO: filtering, some host states might not be sensible */ switch (Network_GetType ()) { case XBNT_Server: *cur = (*cur == NUM_XBTS - 1) ? XBTS_None : *cur + 1; Server_ReceiveTeamStateReq (0, id, player, *cur); return XBTrue; case XBNT_Client: *cur = (*cur == NUM_XBTS - 1) ? XBTS_None : *cur + 1; Client_SendTeamStateReq (id, player, *cur); return XBTrue; default: Dbg_Out ("local team change failed, unsupported network type\n"); return XBFalse; } } /* TeamChangeLocal */ /* * team update handler - handle external changes of team states */ static XBBool TeamStateUpdate (unsigned id, unsigned player, XBTeamState * cur, XBTeamState * req) { XBHostState newteam; XBHostState *newreq; unsigned i; XBBool chg = XBFalse; assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); newteam = Network_GetTeamState (id, player); newreq = Network_GetTeamStateReq (id, player); /* set team colors for player if teamchange */ if (*cur != newteam) { *cur = newteam; switch (newteam) { case XBTS_None: playerGfx[id][player].body = playerGfx[id][player].bodySave; playerGfx[id][player].handsFeet = playerGfx[id][player].handsFeetSave; break; default: playerGfx[id][player].body = teamColors[newteam]; playerGfx[id][player].handsFeet = teamColors[newteam]; break; } chg = XBTrue; } /* check requests */ for (i = 0; i < MAX_HOSTS; i++) { if (req[i] != newreq[i]) { req[i] = newreq[i]; chg = XBTrue; } } return chg; } /* TeamStateUpdate */ /* * handle host state changes - local changes */ static XBBool HostChangeLocal (unsigned id, XBHostState * cur) { assert (id < MAX_HOSTS); switch (Network_GetType ()) { case XBNT_Server: switch (*cur) { case XBHS_None: return XBFalse; case XBHS_Wait: *cur = XBHS_Out; break; case XBHS_Server: *cur = XBHS_Ready; break; case XBHS_In: *cur = (id == 0) ? XBHS_Server : XBHS_Out; break; case XBHS_Out: *cur = (id == 0) ? XBHS_Server : XBHS_In; break; case XBHS_Ready: *cur = (id == 0) ? XBHS_Server : XBHS_Out; break; default: break; } Server_ReceiveHostStateReq (0, id, *cur); return XBTrue; case XBNT_Client: switch (*cur) { case XBHS_None: return XBFalse; case XBHS_Wait: *cur = XBHS_Out; break; case XBHS_Server: *cur = XBHS_Out; break; case XBHS_In: *cur = (id == Network_LocalHostId ())? XBHS_Ready : XBHS_Out; break; case XBHS_Out: *cur = XBHS_In; break; case XBHS_Ready: *cur = (id == Network_LocalHostId ())? XBHS_In : XBHS_Out; break; default: break; } Client_SendHostStateReq (id, *cur); return XBTrue; default: Dbg_Out ("local host change failed, unsupported network type\n"); return XBFalse; } } /* HostChangeLocal */ /* * handle host state update requests */ static XBBool HostStateUpdate (unsigned id, XBHostState * cur, XBHostState * req, int *ping) { XBHostState newstate; XBHostState *newreq; int newping = -1; unsigned i; XBBool chg = XBFalse; assert (id < MAX_HOSTS); newping = Network_GetPingTime (id); newstate = Network_GetHostState (id); newreq = Network_GetHostStateReq (id); /* check state change */ if (*cur != newstate) { *cur = newstate; chg = XBTrue; } /* check ping change */ if (newping != *ping) { *ping = newping; chg = XBTrue; } /* check requests change */ for (i = 0; i < MAX_HOSTS; i++) { if (req[i] != newreq[i]) { req[i] = newreq[i]; chg = XBTrue; } } return chg; } /* HostStateUpdate */ #else /* classic display and request handling */ /* * team change handler - handle local changes of team states */ static XBBool TeamChangeLocal (unsigned id, unsigned player, XBTeamState * cur) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); switch (Network_GetType ()) { case XBNT_Server: /* cycle to next team, invalid sets player out */ *cur = (*cur == NUM_XBTS - 1) ? XBTS_None : *cur + 1; Server_ReceiveTeamStateReq (0, id, player, *cur); return XBTrue; default: /* do not allow team change for clients */ return XBFalse; } } /* TeamChangeLocal */ /* * team update handler - handle team state receive */ static XBBool TeamStateUpdate (unsigned id, unsigned player, XBTeamState * cur, XBTeamState * req) { XBTeamState newteam; XBTeamState *newreq; assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); /* get team and requests */ newteam = Network_GetTeamState (id, player); newreq = Network_GetTeamStateReq (id, player); /* set correct colors for player if team changed */ if (*cur != newteam) { *cur = newteam; switch (newteam) { case XBTS_None: /* restore original colors */ playerGfx[id][player].body = playerGfx[id][player].bodySave; playerGfx[id][player].handsFeet = playerGfx[id][player].handsFeetSave; break; default: /* team colors */ playerGfx[id][player].body = teamColors[newteam]; playerGfx[id][player].handsFeet = teamColors[newteam]; break; } return XBTrue; } return XBFalse; } /* TeamStateUpdate */ /* * handle host state changes - local changes */ static XBBool HostChangeLocal (unsigned id, XBHostState * cur) { assert (id < MAX_HOSTS); switch (Network_GetType ()) { case XBNT_Server: /* server menu */ switch (Network_GetHostState (id)) { case XBHS_Server: /* request for host marked as server */ assert (id == 0); switch (*cur) { case XBHS_Ready: *cur = XBHS_None; break; default: *cur = XBHS_Ready; break; } break; case XBHS_In: /* request for host marked in */ assert (id > 0); switch (*cur) { case XBHS_Out: *cur = XBHS_None; break; default: *cur = XBHS_Out; break; } break; case XBHS_Ready: /* request for host marked ready */ switch (*cur) { case XBHS_Server: *cur = XBHS_None; break; case XBHS_Out: *cur = XBHS_None; break; default: *cur = (id == 0) ? XBHS_Server : XBHS_Out; break; } break; case XBHS_Out: /* request for host marked out */ assert (id > 0); switch (*cur) { case XBHS_In: *cur = XBHS_None; break; default: *cur = (hostComplete[id] == 0) ? XBHS_In : XBHS_Wait; break; } break; case XBHS_Wait: /* request for host marked waiting */ assert (id > 0); switch (*cur) { case XBHS_Out: *cur = XBHS_None; break; default: *cur = XBHS_Out; break; } break; default: return XBFalse; } Server_ReceiveHostStateReq (0, id, *cur); return XBTrue; case XBNT_Client: if (id == Network_LocalHostId ()) { /* request for local host item */ switch (Network_GetHostState (id)) { case XBHS_In: assert (id > 0); switch (*cur) { case XBHS_Ready: *cur = XBHS_None; break; default: *cur = XBHS_Ready; break; } break; case XBHS_Ready: switch (*cur) { case XBHS_In: *cur = XBHS_None; break; default: *cur = XBHS_In; break; } break; case XBHS_Out: switch (*cur) { case XBHS_In: *cur = XBHS_Ready; break; case XBHS_Ready: *cur = XBHS_None; break; default: *cur = XBHS_In; break; } break; default: return XBFalse; } Client_SendHostStateReq (id, *cur); return XBTrue; } return XBFalse; default: Dbg_Out ("local host change failed, unsupported network type\n"); return XBFalse; } } /* HostChangeLocal */ /* * handle host state update requests */ static XBBool HostStateUpdate (unsigned id, XBHostState * cur, XBHostState * req, int *ping) { XBHostState newstate; XBHostState *newreq; int newping = -1; unsigned i; XBBool chg = XBFalse; assert (id < MAX_HOSTS); newping = Network_GetPingTime (id); newstate = Network_GetHostState (id); newreq = Network_GetHostStateReq (id); /* check state change */ if (*cur != newstate) { *cur = newstate; chg = XBTrue; } /* check ping change */ if (newping != *ping) { *ping = newping; chg = XBTrue; } /* check requests change if necessary */ for (i = 0; i < MAX_HOSTS; i++) { if (req[i] != newreq[i]) { req[i] = newreq[i]; chg = XBTrue; } } return chg; } /* HostStateUpdate */ #endif /* * count valid players for a specific host */ static unsigned CountHostPlayers (unsigned id) { unsigned p, cnt = 0; assert (id < MAX_HOSTS); for (p = 0; p < NUM_LOCAL_PLAYER; p++) { if (playerValid[id][p]) { cnt += 1; } } return cnt; } /* CountPlayers */ /* * count valid players */ static unsigned CountPlayers (void) { unsigned i, cnt = 0; for (i = 0; i < MAX_HOSTS; i++) { cnt += CountHostPlayers (i); } return cnt; } /* CountPlayers */ #ifdef UNNEEDED /* * count accepted teams by state only */ static unsigned CountTeamsByState () { unsigned id, pl, p, t, mask; mask = 0x00; for (id = 0; id < MAX_HOSTS; id++) { if (HostIsIn (id)) { for (pl = 0; pl < NUM_LOCAL_PLAYER; pl++) { TeamMaskUpdate (&mask, &p, &t, Network_GetTeamState (id, pl)); } } } assert (t == 0 || p == 0); return (t + p); } /* CountTeamsByState */ #endif /* * create player graphics in menu for client and server */ static void CreatePlayerItems (void) { int i; for (i = 0; i < NUM_LOCAL_PLAYER; i++) { MenuAddPlayer (PLAYER_LEFT (i, NUM_LOCAL_PLAYER), PLAYER_TOP, PLAYER_WIDTH, i, pPlayerGfx + i, -ANIME_LENGTH, playerAnime); } } /* CreatePlayerItems */ /* * team focus handler - focus changed to id(player) */ static void TeamFocus (unsigned id, unsigned player) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); memset (pPlayerGfx, 0, sizeof (pPlayerGfx)); UpdatePlayerDisplay (id, player); } /* TeamFocus */ #ifdef SMPF /* * create SMPF team items in menu */ static void CreateTeamItems () { int client = 0; int c = MENU_TOP; int r = MENU_TOP; int p; r -= CELL_H; for (client = 0; client < MAX_PLAYER; client++) { if (client % 3 == 0) { c = 5 * CELL_W / 2; r += CELL_H; } else { c += 4 * CELL_W; } for (p = 0; p < 2; p++) { teamItem[client][p] = MenuAddTeam (c + 1 * CELL_W, r + (2 + p) * CELL_H / 2, 2 * CELL_W, client, p, TeamFocus, TeamChangeLocal, TeamStateUpdate); if (!playerValid[client][p]) { MenuSetActive (teamItem[client][p], XBFalse); } } } } /* CreateTeamItems */ /* * create SMPF host items in menu */ static void CreateHostItems (XBBool server) { int client = 0; int c = MENU_TOP; int r = MENU_TOP; r -= CELL_H; for (client = 0; client < MAX_PLAYER; client++) { if (client % 3 == 0) { c = 5 * CELL_W / 2; r += CELL_H; } else { c += 4 * CELL_W; } MenuAddTag (c - 2 * CELL_W / 2, r + 2 * CELL_H / 2, 2 * CELL_W, &playerName[client][0]); MenuAddTag (c - 2 * CELL_W / 2, r + 3 * CELL_H / 2, 2 * CELL_W, &playerName[client][1]); } CreateTeamItems (); } /* CreateHostItems */ #else /* * create team items in menu, non-SMPF */ static void CreateTeamItems (void) { int x, y; int client = 0; int p, c, r = MENU_TOP; for (y = 0; y < 3; y++) { c = 3 * CELL_W / 2; for (x = 0; x < 2; x++) { /* host */ for (p = 0; p < 2; p++) { teamItem[client][p] = MenuAddTeam (c + 2 * CELL_W, r + (2 + p) * CELL_H / 2, 3 * CELL_W, client, p, TeamFocus, TeamChangeLocal, TeamStateUpdate); if (!playerValid[client][p]) { MenuSetActive (teamItem[client][p], XBFalse); } } client++; c += 6 * CELL_W; } r += 2 * CELL_H; } } /* CreateTeamItems */ /* * focus changed to host item, non-SMPF */ static void HostFocus (unsigned id) { /* show players on host */ unsigned player; assert (id < MAX_HOSTS); memset (pPlayerGfx, 0, sizeof (pPlayerGfx)); for (player = 0; player < NUM_LOCAL_PLAYER; player++) { UpdatePlayerDisplay (id, player); } } /* HostFocus */ /* * create host items in menu, non-SMPF */ static void CreateHostItems (XBBool server) { int x, y; unsigned client = 0; int c, r = MENU_TOP; for (y = 0; y < MAX_PLAYER / 2; y++) { c = 3 * CELL_W / 2; for (x = 0; x < 2; x++) { hostItem[client] = MenuAddHost (c + 1 * CELL_W, r, 4 * CELL_W, client, (const char **)hostName, HostFocus, HostChangeLocal, HostStateUpdate); if (CountHostPlayers (client) == 0) { MenuSetActive (hostItem[client], XBFalse); } MenuAddTag (c, r + 2 * CELL_H / 2, 2 * CELL_W, &playerName[client][0]); MenuAddTag (c, r + 3 * CELL_H / 2, 2 * CELL_W, &playerName[client][1]); client++; c += 6 * CELL_W; } r += 2 * CELL_H; } CreateTeamItems (); } /* CreateHostItems */ #endif /* * handle network event "game config", client or server */ static void HandleGameConfig (unsigned clientID) { int i; CFGGamePlayers cfgPlayers; assert (clientID < MAX_HOSTS); Dbg_Out ("host #%u sent game config\n", clientID); /* free old host name, if necessary */ if (NULL != hostName[clientID]) { free (hostName[clientID]); } /* set host name from Remote Database */ hostName[clientID] = DupString (GetHostName (CT_Remote, LOCALGAMECONFIG (clientID))); fprintf (stderr, "hostname %u= %s\n", clientID, hostName[clientID]); /* retrieve config data */ if (RetrieveGamePlayers (CT_Remote, LOCALGAMECONFIG (clientID), &cfgPlayers)) { Dbg_Out ("expecting %u players at host #%u\n", cfgPlayers.num, clientID); /* set up completeness check */ hostComplete[clientID] = (1 << 0); for (i = 0; i < cfgPlayers.num && i < NUM_LOCAL_PLAYER; i++) { if (ATOM_INVALID == cfgPlayers.player[i]) { break; } hostComplete[clientID] |= (1 << (i + 1)); } SendHostStateReq (clientID, XBHS_Wait); MenuSetActive (hostItem[clientID], XBTrue); } else { Dbg_Out ("game config error for host %u\n", clientID); SendHostStateReq (clientID, XBHS_None); } } /* HandleGameConfig */ /* * handle network event "player config", client or server */ static void HandlePlayerConfig (unsigned clientID, int player) { XBAtom playerAtom; assert (clientID < MAX_HOSTS); assert (player >= 0); assert (player < NUM_LOCAL_PLAYER); /* get player atom */ playerAtom = Network_GetPlayer (clientID, player); /* host still connected? */ if (playerAtom == ATOM_INVALID) { Dbg_Out ("player config event ignored for host %u\n", clientID); return; } Dbg_Out ("receiving player config for %u(%u)\n", clientID, player); /* get player data */ playerName[clientID][player] = GetPlayerName (CT_Remote, playerAtom); playerValid[clientID][player] = XBTrue; RetrievePlayerGraphics (CT_Remote, playerAtom, COLOR_INVALID, &playerGfx[clientID][player]); MenuSetActive (teamItem[clientID][player], XBTrue); /* check completeness and ping */ hostComplete[clientID] &= ~(1 << (1 + player)); if (0 == hostComplete[clientID]) { SendHostStateReq (clientID, XBHS_In); } } /* HandlePlayerConfig */ /* * handle ping event */ static void HandlePing (unsigned clientID) { if (1 == hostComplete[clientID]) { SendHostStateReq (clientID, XBHS_In); } hostComplete[clientID] &= ~(1 << 0); } /* HandlePing */ /* * handle network events "disconnected", "error", client or server */ static void HandleShutdown (unsigned clientID) { int j; assert (clientID < MAX_HOSTS); /* clear host entry */ if (NULL != hostName[clientID]) { free (hostName[clientID]); hostName[clientID] = NULL; } /* clear player data */ memset (playerValid[clientID], 0, sizeof (playerValid[clientID])); memset (playerName[clientID], 0, sizeof (playerName[clientID])); /* disable host button */ MenuSetActive (hostItem[clientID], XBFalse); /* disable team button */ for (j = 0; j < NUM_LOCAL_PLAYER; j++) { MenuSetActive (teamItem[clientID][j], XBFalse); } /* exit menu if server has disconnected */ if (0 == clientID) { MenuExecFunc (CreateMainMenu, NULL); } } /* HandleShutdown */ /* prototypes for start button handlers */ static XBBool ButtonClientStart (void *par); static XBBool ButtonServerStart (void *par); /* * Handle network event "start game" */ static void HandleStartGame (unsigned clientID) { assert (clientID < MAX_HOSTS); if (Network_GetType () == XBNT_Server) { MenuExecFunc (ButtonServerStart, NULL); } else { SetHostType (XBPH_Client1 + clientID - 1); MenuExecFunc (ButtonClientStart, NULL); } } /* HandleStartGame */ /******************** * server wait menu * ********************/ /* * polling for server wait */ static void PollServerWaitMenu (void *par) { XBNetworkEvent msg; unsigned clientID; static char skip = 1; XBAtom *atom = par; assert (atom != NULL); /* check network events */ while (XBNW_None != (msg = Network_GetEvent (&clientID))) { switch (msg) { case XBNW_Accepted: /* client has connected */ break; case XBNW_GameConfig: HandleGameConfig (clientID); break; /* game config received */ case XBNW_RightPlayerConfig: HandlePlayerConfig (clientID, 0); break; /* player data received */ case XBNW_LeftPlayerConfig: HandlePlayerConfig (clientID, 1); break; /* player data received */ case XBNW_Joy1PlayerConfig: HandlePlayerConfig (clientID, 2); break; /* player data received */ case XBNW_Joy2PlayerConfig: HandlePlayerConfig (clientID, 3); break; /* player data received */ case XBNW_PingReceived: HandlePing (clientID); break; /* received a ping for client */ case XBNW_Disconnected: HandleShutdown (clientID); break; /* one host has disconnected */ case XBNW_Error: HandleShutdown (clientID); break; /* error in connection to host */ case XBNW_StartGame: HandleStartGame (clientID); break; /* start game has been triggered by requests */ default: /* anything else */ break; } } /* retransmit newgame with current player number */ if (cfgServer.central && (skip++ == 0)) { Dbg_Out ("players=%u\n", CountPlayers ()); Server_RestartNewGame (CountPlayers () & 0xFF, ""); } } /* PollNetwork */ /* * init display variables for server */ static void ServerInit (void) { unsigned player; CFGGamePlayers cfgGame; CFGGameSetup cfgSetup; /* clear all data */ memset (hostName, 0, sizeof (hostName)); memset (hostComplete, 0, sizeof (hostComplete)); memset (playerValid, 0, sizeof (playerValid)); memset (playerGfx, 0, sizeof (playerGfx)); memset (playerName, 0, sizeof (playerName)); /* determine local name for server */ hostName[0] = DupString ("localhost"); /* determine local player */ if (RetrieveGamePlayers (CT_Local, atomServer, &cfgGame)) { Dbg_Out ("found %u local players\n", cfgGame.num); assert (cfgGame.num < NUM_LOCAL_PLAYER); for (player = 0; player < cfgGame.num; player++) { assert (ATOM_INVALID != cfgGame.player[player]); RetrievePlayerGraphics (CT_Local, cfgGame.player[player], COLOR_INVALID, &playerGfx[0][player]); playerValid[0][player] = XBTrue; playerName[0][player] = GetPlayerName (CT_Local, cfgGame.player[player]); } } else { Dbg_Out ("no local players on server!\n"); } /* determine initial teammode */ RetrieveGameSetup (CT_Remote, atomLocal, &cfgSetup); } /* ServerInit */ /* * start button activated */ static XBBool ButtonServerStart (void *par) { CFGGame cfg; unsigned id; unsigned fail = 0; unsigned max; /* get previous server game config */ if (!RetrieveGame (CT_Remote, SERVERGAMECONFIG, &cfg)) { GUI_ErrorMessage ("error retrieving server game config, please report\n"); return XBFalse; } /* try to update to complete game config */ switch (Network_CreateGlobalGameConfig (&cfg)) { case XBGC_Error: GUI_ErrorMessage ("error when creating game config, please report\n"); return XBFalse; case XBGC_SingleTeam: GUI_ErrorMessage ("Need at least two teams/players!\n"); return XBFalse; case XBGC_TooManyPlayers: GUI_ErrorMessage ("Too many players, kick some!\n"); return XBFalse; case XBGC_Global: for (id = 1; id < MAX_HOSTS; id++) { if (Network_HostIsIn (id)) { max = Network_HostPlayerMax (id); if (max < cfg.players.num) { #ifndef SMPF Server_ReceiveHostStateReq (0, id, XBHS_Out); #endif fprintf (stdout, "host #%u handles at most %u players\n", id, max); fail++; } } } if (fail > 0) { Dbg_Out ("%u hosts fail to handle %u players\n", fail, cfg.players.num); GUI_ErrorMessage ("hosts unable to handle all players!\n"); return XBFalse; } break; default: GUI_ErrorMessage ("invalid result of game config, please report\n"); return XBFalse; } /* store manually, then receive */ StoreGamePlayers (CT_Remote, SERVERGAMECONFIG, &cfg.players); StoreGameSetup (CT_Remote, SERVERGAMECONFIG, &cfg.setup); if (!Server_ReceiveGameConfig (0, NULL)) { GUI_ErrorMessage ("error receiving global game config, please report\n"); return XBFalse; } /* success, start */ Server_SendStart (); /* clean up */ ClearHostNames (); MenuClear (); return XBTrue; } /* ButtonServerStart */ /* * disconnect button activated */ static XBBool ButtonServerDisconnect (void *par) { Dbg_Out ("stopping server\n"); Server_StopListen (); Dbg_Out ("disconnecting clients\n"); Server_SendDisconnectAll (); Dbg_Out ("cleaning up\n"); ClearHostNames (); return CreateServerMenu (par); } /* ButtonServerDisconnect */ /* * kickout button activated */ static XBBool ButtonServerKickOut (void *par) { int i; /* disconnect unwanted clients */ for (i = 1; i < MAX_HOSTS; i++) { if (Server_GetHostState (i) == (unsigned)XBHS_Out) { Dbg_Out ("kicking host %u\n", i); Server_SendDisconnect (i); } } return XBFalse; } /* ButtonServerKickOut */ /* * build server wait menu */ static XBBool CreateServerWaitMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); Dbg_Out ("---- creating server wait menu ---\n"); /* init server data */ ServerInit (); /* build menu */ MenuClear (); /* poll function */ MenuAddCyclic (PollServerWaitMenu, par); /* build player shapes for menu */ CreatePlayerItems (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Waiting for Clients"); MenuAddLabel1 (10, 79, TITLE_WIDTH + 60, "Chat with lamer Rado and others in http://xblast.sf.net/irc/"); /* build host slots */ CreateHostItems (XBTrue); /* Buttons */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, _("Disconnect"), ButtonServerDisconnect, par)); (void)MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, _("Kick out"), ButtonServerKickOut, par); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, _("Start"), ButtonServerStart, NULL)); /* directional item linking */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateServerWaitMenu */ /******************** * client wait menu * ********************/ /* * polling for server wait */ static void PollClientWaitMenu (void *par) { XBNetworkEvent msg; unsigned clientID; static char skip = 1; XBAtom *atom = par; assert (atom != NULL); /* check network events */ while (XBNW_None != (msg = Network_GetEvent (&clientID))) { switch (msg) { case XBNW_GameConfig: HandleGameConfig (clientID); break; /* game config received */ case XBNW_RightPlayerConfig: HandlePlayerConfig (clientID, 0); break; /* player data received */ case XBNW_LeftPlayerConfig: HandlePlayerConfig (clientID, 1); break; /* player data received */ case XBNW_Joy1PlayerConfig: HandlePlayerConfig (clientID, 2); break; /* player data received */ case XBNW_Joy2PlayerConfig: HandlePlayerConfig (clientID, 3); break; /* player data received */ case XBNW_Disconnected: HandleShutdown (clientID); break; /* one host has disconnected */ case XBNW_Error: HandleShutdown (clientID); break; /* received start game */ case XBNW_StartGame: HandleStartGame (clientID); break; /* error in connection to host */ default: /* anything else */ break; } } /* retransmit newgame with current player number */ if (cfgServer.central && (skip++ == 0)) { Dbg_Network ("players=%u\n", CountPlayers ()); Server_RestartNewGame (CountPlayers () & 0xFF, ""); } } /* PollNetwork */ /* * init display variables for client */ static void ClientInit (void) { /* clear all data */ memset (hostName, 0, sizeof (hostName)); memset (hostComplete, 0, sizeof (hostComplete)); memset (playerValid, 0, sizeof (playerValid)); memset (playerGfx, 0, sizeof (playerGfx)); memset (playerName, 0, sizeof (playerName)); } /* ClientInit */ /* * start network game as client */ static XBBool ButtonClientStart (void *par) { ClearHostNames (); /* clean up */ MenuClear (); return XBTrue; } /* ButtonClientStart */ /* * disconnect button activated */ static XBBool ButtonClientDisconnect (void *par) { Dbg_Out ("disconnecting from server\n"); Client_Disconnect (); /* back to connection menu */ return CreateJoinNetGameMenu (par); } /* ButtonDisconnect */ /* * build client wait menu */ static XBBool CreateClientWaitMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* needed inits */ ClientInit (); /* build menu */ MenuClear (); /* poll function */ MenuAddCyclic (PollClientWaitMenu, par); /* players */ CreatePlayerItems (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Game Setup by Server"); /* hosts */ teamMode = 0; CreateHostItems (XBFalse); MenuAddLabel1 (10, 79, TITLE_WIDTH + 60, _("Chat with lamer Rado and others in http://xblast.sf.net/irc/")); /* Buttons */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, _("Disconnect"), ButtonClientDisconnect, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateClientWaitMenu */ /********************* * server setup menu * *********************/ /* * start the server */ static XBBool ButtonServerListen (void *par) { XBAtom *atom = par; assert (atom != NULL); /* set server connection */ cfgServer.name = NULL; cfgServer.port = serverPort; cfgServer.game = serverGame; /* store in database */ StoreGameHost (CT_Local, *atom, &cfgServer); /* get game setup */ /* now try connection */ if (!Server_StartListen (&cfgServer)) { /* connection failed */ GUI_ErrorMessage ("Failed to listen on port %hu", serverPort); return CreateServerMenu (par); } return CreateServerWaitMenu (par); } /* ButtonServerListen */ /* * back button activated */ static XBBool ButtonServerBack (void *par) { return CreateStartNetGameMenu (par); } /* ButtonServerBack */ /* * setup xblast server */ XBBool CreateServerMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get old server from database */ if (!RetrieveGameHost (CT_Local, *atom, &cfgServer)) { serverPort = 16168; serverGame[0] = 0; } else { serverPort = cfgServer.port; strncpy (serverGame, cfgServer.game, sizeof (serverGame)); serverGame[sizeof (serverGame) - 1] = 0; } /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Setup Server"); /* parameters */ MenuAddInteger (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, "TCP-Port:", 2 * CELL_W, &serverPort, 4096, 65535); MenuAddComboBool (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, "Use fixed UDP-ports", 2 * CELL_W, &cfgServer.fixedUdpPort); MenuAddComboBool (DLG_LEFT, MENU_ROW (2), DLG_WIDTH, "Allow clients using NAT", 2 * CELL_W, &cfgServer.allowNat); MenuAddComboBool (DLG_LEFT, MENU_ROW (3), DLG_WIDTH, "Visible in LAN:", 2 * CELL_W, &cfgServer.browseLan); MenuAddComboBool (DLG_LEFT, MENU_ROW (4), DLG_WIDTH, "Visible in central:", 2 * CELL_W, &cfgServer.central); // XBCC MenuAddString (DLG_LEFT, MENU_ROW (5), DLG_WIDTH, "Name:", 4 * CELL_W, serverGame, sizeof (serverGame)); MenuAddComboBool (DLG_LEFT, MENU_ROW (6), DLG_WIDTH, "Beep for new clients:", 2 * CELL_W, &cfgServer.beep); /* Buttons */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonServerBack, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Continue", ButtonServerListen, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateServerMenu */ /********************* * central wait menu * *********************/ /* forward declaration */ static XBBool CreateCentralWaitMenu (void *par); /* * stop button activated */ static XBBool ButtonCentralStop (void *par) { /* finish communication to server */ Central_StopListen (); /* finish communication with clients */ Central_QueueDisconnectAll (); /* back to connection menu */ return CreateCentralMenu (par); } /* ButtonDisconnect */ /* * update button activated */ static XBBool ButtonCentralUpdate (void *par) { return CreateCentralWaitMenu (par); } /* ButtonCentralUpdate */ /* * poll function for central */ static void PollCentral (void *par) { static char i = 0; XBAtom *atom = par; assert (atom != NULL); /* clear old games every 256th time */ if (i++ == 0) { C2B_ClearOldGames (); } } /* PollCentral */ /* * build central wait menu */ static XBBool CreateCentralWaitMenu (void *par) { XBAtom *atom = par; int nPlayers = 0, nGames = 0, nGamesPlayed = 0, nTotalGames = 0, nLogins = 0; Central_GetStatistics (&nPlayers, &nGames, &nGamesPlayed, &nTotalGames, &nLogins); assert (atom != NULL); MenuClear (); /* poll function */ MenuAddCyclic (PollCentral, par); // func has to be void mi_tool.h:46 /* Title */ sprintf (title, "Central: %s", serverGame); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); sprintf (stat0, "Number of known players: %i", nPlayers); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (1), 10 * CELL_W, stat0); sprintf (stat1, "Number of open games: %i", nGames); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (2), 10 * CELL_W, stat1); sprintf (stat2, "Number of played games: %i", nGamesPlayed); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (3), 10 * CELL_W, stat2); sprintf (stat3, "Total number of games played: %i", nTotalGames); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (4), 10 * CELL_W, stat3); sprintf (stat4, "Total number of logins: %i", nLogins); MenuAddLabel (5 * CELL_W / 2, MENU_ROW (5), 10 * CELL_W, stat4); /* Buttons */ MenuSetDefault (MenuAddHButton (16 * CELL_W / 2, MENU_BOTTOM, 5 * CELL_W, "Update now", ButtonCentralUpdate, par)); MenuSetAbort (MenuAddHButton (4 * CELL_W / 2, MENU_BOTTOM, 5 * CELL_W, "Stop", ButtonCentralStop, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateClientWaitMenu */ /********************** * setup central menu * **********************/ /* * setup central connection XBCC * used in menu_game.c, why ?? */ void setAutoCentral2 (XBBool set) { autoCentral2 = set; } /* setAutoCentral2 */ /* * start central button activated */ static XBBool ButtonCentralListen (void *par) { XBAtom *atom = par; assert (atom != NULL); /* set server connection */ cfgServer.name = NULL; cfgServer.port = serverPort; cfgServer.game = serverGame; /* store in database */ StoreGameHost (CT_Local, *atom, &cfgServer); /* get game setup */ /* now try connection */ if (!Central_StartListen (&cfgServer)) { /* connection failed */ GUI_ErrorMessage ("Failed to listen on port %hu", serverPort); return CreateCentralMenu (par); } return CreateCentralWaitMenu (par); } /* ButtonServerListen */ /* * back button activated */ static XBBool ButtonMainMenu (void *par) { /* call main menu */ return CreateMainMenu (par); } /* ButtonMainMenu */ /* * build setup central menu */ XBBool CreateCentralMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get old server from database */ if (!RetrieveGameHost (CT_Local, *atom, &cfgServer)) { serverGame[0] = 0; serverPort = 16168; } else { strncpy (serverGame, cfgServer.game, sizeof (serverGame)); serverGame[sizeof (serverGame) - 1] = 0; serverPort = cfgServer.port; } if (autoCentral2) { return ButtonCentralListen (par); } else { /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Create a central"); /* parameters */ MenuAddString (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, "Central name:", 4 * CELL_W, serverGame, sizeof (serverGame)); MenuAddInteger (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, "TCP-Port:", 4 * CELL_W, &serverPort, 4096, 65535); /* Buttons */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonMainMenu, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Start", ButtonCentralListen, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } } /* CreateCentralMenu */ /******************* * ip history menu * *******************/ XBBool CreateHistoryNetGameMenu (void *par); /* * reset history data */ static void ResetHistoryData (void) { int i; /* check if something to do */ if (networkGamehis == NULL) { return; } /* free network games */ for (i = 0; i < NUM_SEARCH_ROWS; i++) { if (networkGamehis[i] != NULL) { free (networkGamehis[i]); networkGamehis[i] = NULL; } } /* free pointer list */ free (networkGamehis); networkGamehis = NULL; } /* ResetHistoryData */ /* * history entry activated */ static XBBool ButtonStartLanGamehis (void *par) { const XBNetworkGame **ptr = par; XBBool connect; assert (NULL != ptr); /* check if entry data is valid */ if (NULL == *ptr) { return XBFalse; } /* get server connection */ cfgServer.name = (*ptr)->host; cfgServer.port = (*ptr)->port; /* store in database */ StoreGameHost (CT_Local, networkAtom, &cfgServer); /* now try connection */ connect = Client_Connect (&cfgServer); if (!connect) { /* connection failed */ GUI_ErrorMessage ("Connection to %s:%hu failed", serverName, serverPort); return CreateHistoryNetGameMenu (&networkAtom); } /* clean up */ ResetHistoryData (); /* eter client wait menu */ return CreateClientWaitMenu (&networkAtom); } /* ButtonStartLanGamehis */ /* * back button activated */ static XBBool ButtonBackLanGamehis (void *par) { /* clean up */ ResetHistoryData (); /* back to join menu */ return CreateJoinNetGameMenu (par); } /* ButtonBackLanGamehis */ /* * build history menu */ XBBool CreateHistoryNetGameMenu (void *par) { XBAtom *atom = par; int i; assert (NULL != atom); networkAtom = *atom; /* reset network ip data */ ResetHistoryData (); /* get ip history */ if (RetrieveIpHistory (cfgServerhis, networkAtom) == XBFalse) { fprintf (stderr, "failed to find history data!\n"); return XBFalse; } /* allocate pointer memory for each row */ networkGamehis = calloc (NUM_SEARCH_ROWS, sizeof (*networkGame)); assert (networkGamehis != NULL); for (i = 0; i < NUM_SEARCH_ROWS && i < 10 && cfgServerhis[i].name != NULL; i++) { /* allocate network game struct for each valid row */ networkGamehis[i] = malloc (sizeof (networkGame)); assert (networkGamehis[i] != NULL); networkGamehis[i]->port = cfgServerhis[i].port; networkGamehis[i]->host = (char *)cfgServerhis[i].name; networkGamehis[i]->game = "connect"; networkGamehis[i]->version = "???"; networkGamehis[i]->ping = 1; networkGamehis[i]->numLives = 1; networkGamehis[i]->numWins = 1; networkGamehis[i]->frameRate = 1; } MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "History Ips"); /* list of games */ MenuSetActive (MenuAddGameHeader (SEARCH_LEFT, SEARCH_TOP, SEARCH_WIDTH), XBFalse); for (i = 0; i < 10 && networkGamehis[i] != NULL; i++) { networkItem[i] = MenuAddGameEntry (SEARCH_LEFT, SEARCH_ROW (i), SEARCH_WIDTH, (const XBNetworkGame **)(networkGamehis) + i, ButtonStartLanGamehis); MenuSetActive (networkItem[i], XBTrue); } /* Buttons */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonBackLanGamehis, par)); MenuSetLinks (); // should work infinite loop ?? /* that's all */ return XBFalse; } /* CreateHistoryNetGameMenu */ /*********************** * client connect menu * ***********************/ /* * connect button activated */ static XBBool ButtonClientConnect (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get server connection */ cfgServer.name = serverName; cfgServer.port = serverPort; /* store in database */ StoreIpHistory (&cfgServer, *atom); StoreGameHost (CT_Local, *atom, &cfgServer); /* now try connection */ if (!Client_Connect (&cfgServer)) { /* connection failed */ GUI_ErrorMessage ("Connection to %s:%hu failed", serverName, serverPort); return CreateClientMenu (par); } return CreateClientWaitMenu (par); } /* ButtonClientConnect */ /* * history button activated */ static XBBool ButtonClientHistory (void *par) { return CreateHistoryNetGameMenu (par); } /* ButtonClientHistory */ /* * history button activated */ static XBBool ButtonClientBack (void *par) { return CreateJoinNetGameMenu (par); } /* ButtonClientBack */ /* * setup connection to server */ XBBool CreateClientMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get old server from database */ if (!RetrieveGameHost (CT_Local, *atom, &cfgServer)) { serverName[0] = 0; serverPort = 16168; } else { strncpy (serverName, cfgServer.name, sizeof (serverName)); serverName[sizeof (hostName) - 1] = 0; serverPort = cfgServer.port; } /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Connect to Server"); /* parameters */ MenuAddString (DLG_LEFT, MENU_ROW (0), DLG_WIDTH, "Hostname:", 4 * CELL_W, serverName, sizeof (serverName)); MenuAddInteger (DLG_LEFT, MENU_ROW (1), DLG_WIDTH, "TCP-Port:", 4 * CELL_W, &serverPort, 4096, 65535); /* Buttons */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonClientBack, par)); MenuAddHButton (11 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "History", ButtonClientHistory, par); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Connect", ButtonClientConnect, par)); /* --- */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateClientMenu */ /**************** * search menus * ****************/ /* * poll incoming network games - for all search menus */ static void PollNetworkGame (void *par) { unsigned gameID; XBNetworkEvent msg; #ifdef W32 #else static struct timeval old; struct timeval tv; gettimeofday (&tv, NULL); if (tv.tv_sec - old.tv_sec >= 10) { ButtonRefreshSearchCentral (NULL); old = tv; } #endif while (XBNW_None != (msg = Network_GetEvent (&gameID))) { if (msg == XBNW_NetworkGame) { const XBNetworkGame *game = Client_NextNetworkGame (); if (gameID < NUM_SEARCH_ROWS) { networkGame[gameID] = game; MenuSetActive (networkItem[gameID], ((NULL != game) && (game->frameRate != 0) && (game->frameRate != 255))); } } } } /* PollNetworkGame */ /******************* * search LAN menu * *******************/ /* * LAN entry activated */ static XBBool ButtonStartLanGame (void *par) { const XBNetworkGame **ptr = par; XBBool connect; assert (NULL != ptr); if (NULL == *ptr) { return XBFalse; } /* get server connection */ cfgServer.name = (*ptr)->host; cfgServer.port = (*ptr)->port; /* store in database */ StoreGameHost (CT_Local, networkAtom, &cfgServer); /* now try connection */ connect = Client_Connect (&cfgServer); /* clean up */ Client_StopQuery (); memset (networkGame, 0, sizeof (networkGame)); if (!connect) { /* connection failed */ GUI_ErrorMessage ("Connection to %s:%hu failed", serverName, serverPort); return CreateSearchLanMenu (&networkAtom); } return CreateClientWaitMenu (&networkAtom); } /* ButtonStartLanGame */ /* * refresh button activated */ static XBBool ButtonRefreshSearchLan (void *par) { unsigned i; /* delete old games */ teamMode = 0; memset (networkGame, 0, sizeof (networkGame)); for (i = 0; i < NUM_SEARCH_ROWS; i++) { MenuSetActive (networkItem[i], XBFalse); } /* starts new query */ Client_RestartQuery (); return XBFalse; } /* ButtonRefreshSearchLam */ /* * exit button activated */ static XBBool ButtonExitSearchLan (void *par) { /* stop network search */ Client_StopQuery (); teamMode = 0; /* back to client menu */ return CreateJoinNetGameMenu (par); } /* ButtonExitSearchLan */ /* * build search LAN menu */ XBBool CreateSearchLanMenu (void *par) { XBAtom *atom = par; int i; assert (NULL != atom); networkAtom = *atom; /* setup */ memset (networkGame, 0, sizeof (networkGame)); (void)RetrieveGameHost (CT_Local, networkAtom, &cfgServer); /* build menu */ MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Search LAN for Games"); /* list of games */ MenuSetActive (MenuAddGameHeader (SEARCH_LEFT, SEARCH_TOP, SEARCH_WIDTH), XBFalse); for (i = 0; i < NUM_SEARCH_ROWS; i++) { networkItem[i] = MenuAddGameEntry (SEARCH_LEFT, SEARCH_ROW (i), SEARCH_WIDTH, (const XBNetworkGame **)networkGame + i, ButtonStartLanGame); MenuSetActive (networkItem[i], XBFalse); } /* Buttons */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonExitSearchLan, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Refresh", ButtonRefreshSearchLan, par)); /* add polling routine */ MenuAddCyclic (PollNetworkGame, NULL); /* query for local games */ Client_StartQuery (); // MenuSetLinks (); should work infinite loop ?? /* that's all */ return XBFalse; } /* CreateSearchLanMenu */ /*********************** * search central menu * ***********************/ /* * central entry activated */ static XBBool ButtonStartCentralGame (void *par) { const XBNetworkGame **ptr = par; XBBool connect; assert (NULL != ptr); if (NULL == *ptr) { return XBFalse; } /* get server connection */ cfgServer.name = (*ptr)->host; cfgServer.port = (*ptr)->port; /* store in database */ StoreGameHost (CT_Local, networkAtom, &cfgServer); /* now try connection */ connect = Client_Connect (&cfgServer); /* clean up */ Client_StopQuery (); memset (networkGame, 0, sizeof (networkGame)); if (!connect) { /* connection failed */ GUI_ErrorMessage ("Connection to %s:%hu failed", serverName, serverPort); return CreateSearchCentralMenu (&networkAtom); } return CreateClientWaitMenu (&networkAtom); } /* ButtonStartCentralGame */ /* * refresh button activated */ XBBool ButtonRefreshSearchCentral (void *par) { unsigned i; /* delete old games */ teamMode = 0; memset (networkGame, 0, sizeof (networkGame)); for (i = 0; i < NUM_SEARCH_ROWS; i++) { MenuSetActive (networkItem[i], XBFalse); } /* starts new query */ Client_RestartQuery (); return XBFalse; } /* ButtonRefreshSearchCentral */ /* * exit button activated */ static XBBool ButtonExitSearchCentral (void *par) { /* stop network search */ Client_StopQuery (); teamMode = 0; /* back to client menu */ return CreateJoinNetGameMenu (par); } /* ButtonExitSearchCentral */ /* * search CENTRAL for network games XBCC */ XBBool CreateSearchCentralMenu (void *par) { XBAtom *atom = par; int i; assert (NULL != atom); networkAtom = *atom; /* setup */ memset (networkGame, 0, sizeof (networkGame)); (void)RetrieveGameHost (CT_Local, networkAtom, &cfgServer); /* build menu */ MenuClear (); /* Title */ MenuAddLabel2 (TITLE_LEFT - 25, TITLE_TOP - 15, TITLE_WIDTH + 50, "Lamer Rado waits for you in http://xblast.sf.net/irc/"); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Central Games"); /* list of games */ MenuSetActive (MenuAddGameHeader (SEARCH_LEFT, SEARCH_TOP, SEARCH_WIDTH), XBFalse); for (i = 0; i < NUM_SEARCH_ROWS; i++) { networkItem[i] = MenuAddGameEntry (SEARCH_LEFT, SEARCH_ROW (i), SEARCH_WIDTH, (const XBNetworkGame **)networkGame + i, ButtonStartCentralGame); MenuSetActive (networkItem[i], XBFalse); } /* Buttons */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Back", ButtonExitSearchCentral, par)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Refresh", ButtonRefreshSearchCentral, par)); /* add polling routine */ MenuAddCyclic (PollNetworkGame, NULL); /* query for local games */ Client_StartCentralQuery (); // MenuSetLinks (); should work infinite loop ?? /* that's all */ return XBFalse; } /* CreateSearchCentralMenu */ /* * end of file menu_network.c */ xblast-2.10.4/menu_network.h0000644000175000017500000000245510372731124015104 0ustar rhondaalfie/* * file menu_network.h - user interface for setting up networks games * * $Id: menu_network.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef XBLAST_MENU_NETWORK_H #define XBLAST_MENU_NETWORK_H /* * global prototypes */ extern XBBool CreateServerMenu (void *par); extern XBBool CreateCentralMenu (void *par); // XBCC extern XBBool CreateClientMenu (void *par); extern XBBool CreateSearchLanMenu (void *par); extern XBBool CreateSearchCentralMenu (void *par); // XBCC extern void setAutoCentral2 (XBBool set); #endif /* * end of file menu_network.h */ xblast-2.10.4/menu_player.c0000644000175000017500000007014410372731124014702 0ustar rhondaalfie/* * file menu_player.c - edit player settings * * $Id: menu_player.c,v 1.15 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define NUM_EDIT_PLAYERS 6 #define MSG_LENGTH 80 /* * local prototypes */ static XBBool CreateEditPlayerMenu (void *par); static XBBool CreatePlayerColorsMenu (void *par); static XBBool CreateNewPlayerMenu (void *par); static XBBool CreateRenamePlayerMenu (void *par); /* * local variables */ static int firstPlayer = 0; static XBAtom atomPlayers[NUM_EDIT_PLAYERS]; static CFGPlayerGraphics gfxPlayer[NUM_EDIT_PLAYERS]; static const CFGPlayerGraphics *pGfxPlayer[NUM_EDIT_PLAYERS] = { NULL, NULL, NULL, NULL, }; static BMSpriteAnimation playerAnime[1] = { SpriteStopDown }; static BMSpriteAnimation allAnime[4] = { SpriteStopLeft, SpriteStopUp, SpriteStopDown, SpriteStopRight }; static BMSpriteAnimation bigAnime[1] = { SpriteWinner }; static BMSpriteAnimation delAnime[1] = { SpriteDamagedDown }; static BMSpriteAnimation renameAnime[1] = { SpriteLooser }; /* player graphics */ static XBRgbValue rgb; /* player messages */ static CFGPlayerMessages playerMsg; static char msgWinLevel[MSG_LENGTH]; static char msgWinGame[MSG_LENGTH]; static char msgLoseLife[MSG_LENGTH]; static char msgLoseLevel[MSG_LENGTH]; static char msgLaola[MSG_LENGTH]; static char msgLoser[MSG_LENGTH]; static char msgGloat[MSG_LENGTH]; static char msgWelcome[MSG_LENGTH]; /* misc player options */ static CFGPlayerMisc playerMisc; static XBComboEntryList turnStepTable[] = { {"0", 0, NULL, ATOM_INVALID,}, {"1", 1, NULL, ATOM_INVALID,}, {"2", 2, NULL, ATOM_INVALID,}, {"3", 3, NULL, ATOM_INVALID,}, {"4", 4, NULL, ATOM_INVALID,}, {"5", 5, NULL, ATOM_INVALID,}, {"6", 6, NULL, ATOM_INVALID,}, {"7", 7, NULL, ATOM_INVALID,}, {NULL, 0, NULL, ATOM_INVALID,}, }; /* title with player name */ static char title[256]; /* * menu table for color boxes */ static XBComboEntryList *colorValueList = NULL; static XBComboEntryList *shapeList = NULL; /* * name for renaming */ static char newName[16]; static char newPass[16]; static CFGPlayerID playerID; XBBool gotPID = XBFalse; // XBCC /***************** * graphics menu * *****************/ /* * create color value list */ static XBComboEntryList * CreateColorValueList (void) { XBComboEntryList *list; int i; char tmp[8]; list = calloc (XBCOLOR_DEPTH + 2, sizeof (XBComboEntryList)); assert (list != NULL); for (i = 0; i <= XBCOLOR_DEPTH; i++) { sprintf (tmp, "%3d", 255 * i / XBCOLOR_DEPTH); list[i].text = DupString (tmp); list[i].value = i; } return list; } /* CreateColorValueList */ /* * create list with shapes */ static XBComboEntryList * CreateShapeList (void) { const XBAtom *shape; XBComboEntryList *list; int i, num; shape = GetShapeList (&num); assert (shape != NULL); list = calloc (num + 1, sizeof (*list)); for (i = 0; i < num; i++) { list[i].text = DupString (GUI_AtomToString (shape[i])); list[i].atom = shape[i]; } /* that's all */ return list; } /* CreateShapeList */ /* * clear list with shapes */ static void DeleteList (XBComboEntryList * list) { int i; assert (NULL != list); for (i = 0; list[i].text != NULL; i++) { free ((void *)list[i].text); } free (list); } /* DeleteList */ /* * save player graphics */ static XBBool ButtonSaveGraphics (void *par) { XBAtom *atom = par; assert (atom != NULL); /* store it */ StorePlayerGraphics (CT_Local, *atom, gfxPlayer + 0); /* clean up */ DeleteList (shapeList); shapeList = NULL; DeleteList (colorValueList); colorValueList = NULL; return CreateEditPlayerMenu (par); } /* ButtonSaveGraphics */ /* * cancel button */ static XBBool ButtonEditPlayerMenu (void *par) { if (NULL != shapeList) { DeleteList (shapeList); shapeList = NULL; } if (NULL != colorValueList) { DeleteList (colorValueList); colorValueList = NULL; } return CreateEditPlayerMenu (par); } /* ButtonEditPlayerMenu */ /* /\* */ /* * apply colors */ /* *\/ */ /* static XBBool */ /* ButtonApplyColors (void *par) */ /* { */ /* XBAtom *atom = par; */ /* assert (atom != NULL); */ /* /\* store it *\/ */ /* StorePlayerGraphics (CT_Local, *atom, gfxPlayer + 0); */ /* return CreatePlayerColorsMenu (par); */ /* } /\* ButtonApplyColors *\/ */ /* * parse color name */ static void CheckColorName (void *par) { char *colorName = par; XBColor color; assert (NULL != colorName); if (0 != colorName[0]) { color = GUI_ParseColor (colorName); if (COLOR_INVALID != color) { rgb.red = GET_RED (color); rgb.green = GET_GREEN (color); rgb.blue = GET_BLUE (color); colorName[0] = 0; } } } /* CheckColorName */ /* * draw colors menu */ static XBBool CreatePlayerColorsMenu (void *par) { int i; XBAtom *atom = par; static char colorName[48]; assert (atom != NULL); /* get player graphics */ RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer); /* create list with color values */ if (NULL == colorValueList) { colorValueList = CreateColorValueList (); } assert (colorValueList != NULL); /* create list with shapes */ if (NULL == shapeList) { shapeList = CreateShapeList (); } assert (shapeList != NULL); /* set color name editor to empty */ colorName[0] = 0; /* build menu */ MenuClear (); /* Title */ sprintf (title, "Colors for %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* string for rgb value */ if (COLOR_INVALID != GUI_ParseColor ("Black")) { MenuAddString (MSG_LEFT, MENU_ROW (5), MSG_WIDTH, "Colorname:", MSG_EDIT, colorName, sizeof (colorName)); MenuAddCyclic (CheckColorName, colorName); } /* shape */ MenuAddComboAtom (5 * CELL_W, MENU_ROW (0), 5 * CELL_W, "Shape:", 2 * CELL_W, &gfxPlayer[0].shape, shapeList); /* set rgb value */ memset (&rgb, 0, sizeof (rgb)); MenuAddComboInt (2 * CELL_W, MENU_ROW (4), 3 * CELL_W, "Red:", 3 * CELL_W / 2, &rgb.red, colorValueList); MenuAddComboInt (6 * CELL_W, MENU_ROW (4), 3 * CELL_W, "Green:", 3 * CELL_W / 2, &rgb.green, colorValueList); MenuAddComboInt (10 * CELL_W, MENU_ROW (4), 3 * CELL_W, "Blue:", 3 * CELL_W / 2, &rgb.blue, colorValueList); /* colors windows */ MenuSelect (MenuAddColor (COLOR_LEFT, MENU_ROW (1), COLOR_WIDTH, "Helmet:", &gfxPlayer[0].helmet, &rgb)); MenuAddColor (COLOR_RIGHT, MENU_ROW (1), COLOR_WIDTH, "Arms & Legs:", &gfxPlayer[0].armsLegs, &rgb); MenuAddColor (COLOR_LEFT, MENU_ROW (2), COLOR_WIDTH, "Face:", &gfxPlayer[0].face, &rgb); MenuAddColor (COLOR_RIGHT, MENU_ROW (2), COLOR_WIDTH, "Hands & Feet:", &gfxPlayer[0].handsFeet, &rgb); MenuAddColor (COLOR_LEFT, MENU_ROW (3), COLOR_WIDTH, "Body:", &gfxPlayer[0].body, &rgb); MenuAddColor (COLOR_RIGHT, MENU_ROW (3), COLOR_WIDTH, "Backpack:", &gfxPlayer[0].backpack, &rgb); /* sprite */ for (i = 0; i < 4; i++) { pGfxPlayer[i] = gfxPlayer; MenuAddConfigPlayer (PLAYER_LEFT (i, 4), PLAYER_TOP, PLAYER_WIDTH, i, pGfxPlayer + i, -1, allAnime + i, &rgb); } /* ok, cancel or cancel */ MenuSetAbort (MenuAddHButton (3 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", ButtonEditPlayerMenu, atom)); MenuSetDefault (MenuAddHButton (19 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonSaveGraphics, atom)); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreatePlayerColorsMenu */ /***************** * messages menu * *****************/ /* * save player messages */ static XBBool ButtonSaveMessages (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get player messages */ playerMsg.msgWinLevel = (0 != msgWinLevel[0]) ? msgWinLevel : NULL; playerMsg.msgWinGame = (0 != msgWinGame[0]) ? msgWinGame : NULL; playerMsg.msgLoseLife = (0 != msgLoseLife[0]) ? msgLoseLife : NULL; playerMsg.msgLoseLevel = (0 != msgLoseLevel[0]) ? msgLoseLevel : NULL; playerMsg.msgGloat = (0 != msgGloat[0]) ? msgGloat : NULL; playerMsg.msgLaola = (0 != msgLaola[0]) ? msgLaola : NULL; playerMsg.msgLoser = (0 != msgLoser[0]) ? msgLoser : NULL; playerMsg.msgWelcome = (0 != msgWelcome[0]) ? msgWelcome : NULL; /* store it */ StorePlayerMessages (CT_Local, *atom, &playerMsg); return CreateEditPlayerMenu (par); } /* ButtonSaveMessages */ /* * draw player messages menu */ static XBBool CreatePlayerMessageMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); /* get player messages */ memset (&playerMsg, 0, sizeof (playerMsg)); RetrievePlayerMessages (CT_Local, *atom, &playerMsg); if (NULL != playerMsg.msgWinLevel) { strncpy (msgWinLevel, playerMsg.msgWinLevel, MSG_LENGTH); } else { msgWinLevel[0] = 0; } if (NULL != playerMsg.msgWinGame) { strncpy (msgWinGame, playerMsg.msgWinGame, MSG_LENGTH); } else { msgWinGame[0] = 0; } if (NULL != playerMsg.msgLoseLife) { strncpy (msgLoseLife, playerMsg.msgLoseLife, MSG_LENGTH); } else { msgLoseLife[0] = 0; } if (NULL != playerMsg.msgLoseLevel) { strncpy (msgLoseLevel, playerMsg.msgLoseLevel, MSG_LENGTH); } else { msgLoseLevel[0] = 0; } if (NULL != playerMsg.msgGloat) { strncpy (msgGloat, playerMsg.msgGloat, MSG_LENGTH); } else { msgGloat[0] = 0; } if (NULL != playerMsg.msgLaola) { strncpy (msgLaola, playerMsg.msgLaola, MSG_LENGTH); } else { msgLaola[0] = 0; } if (NULL != playerMsg.msgLoser) { strncpy (msgLoser, playerMsg.msgLoser, MSG_LENGTH); } else { msgLoser[0] = 0; } if (NULL != playerMsg.msgWelcome) { strncpy (msgWelcome, playerMsg.msgWelcome, MSG_LENGTH); } else { msgWelcome[0] = 0; } /* build menu */ MenuClear (); /* Title */ sprintf (title, "Messages for %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* message windows */ MenuAddString (MSG_LEFT, MSG_TOP, MSG_WIDTH, "Welcome:", MSG_EDIT, msgWelcome, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 1 * CELL_H, MSG_WIDTH, "Win Level:", MSG_EDIT, msgWinLevel, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 2 * CELL_H, MSG_WIDTH, "Win Game:", MSG_EDIT, msgWinGame, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 3 * CELL_H, MSG_WIDTH, "Lose Life:", MSG_EDIT, msgLoseLife, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 4 * CELL_H, MSG_WIDTH, "Lose Level:", MSG_EDIT, msgLoseLevel, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 5 * CELL_H, MSG_WIDTH, "Gloat:", MSG_EDIT, msgGloat, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 6 * CELL_H, MSG_WIDTH, "Laola:", MSG_EDIT, msgLaola, MSG_LENGTH); MenuAddString (MSG_LEFT, MSG_TOP + 7 * CELL_H, MSG_WIDTH, "Loser:", MSG_EDIT, msgLoser, MSG_LENGTH); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* ok or cancel */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreateEditPlayerMenu, atom)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonSaveMessages, atom)); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreatePlayerMessageMenu */ /************************ * control options menu * ************************/ /* * save control options */ static XBBool ButtonSaveMisc (void *par) { XBAtom *atom = par; assert (atom != NULL); /* store it */ StorePlayerMisc (CT_Local, *atom, &playerMisc); return CreateEditPlayerMenu (par); } /* ButtonSaveGraphics */ /* * draw menu for misc. player options */ static XBBool CreatePlayerMiscMenu (void *par) { XBAtom *atom = par; assert (NULL != atom); /* get options */ memset (&playerMisc, 0, sizeof (playerMisc)); RetrievePlayerMisc (CT_Local, *atom, &playerMisc); /* build menu */ MenuClear (); /* Title */ sprintf (title, "Other Options for %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* options */ /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* options */ MenuAddComboBool (DLG_LEFT, DLG_ROW (0), DLG_WIDTH, "Use stop key:", 2 * CELL_W, &playerMisc.useStopKey); MenuAddComboInt (DLG_LEFT, DLG_ROW (1), DLG_WIDTH, "Backtrack for turns (keyboard):", 2 * CELL_W, &playerMisc.turnStepKeyboard, turnStepTable); MenuAddComboInt (DLG_LEFT, DLG_ROW (2), DLG_WIDTH, "Backtrack for turns (joystick):", 2 * CELL_W, &playerMisc.turnStepJoystick, turnStepTable); /* ok or cancel */ MenuSetAbort (MenuAddHButton (5 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreateEditPlayerMenu, atom)); MenuSetDefault (MenuAddHButton (17 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonSaveMisc, atom)); return XBFalse; } /* CreatePlayerMenu */ /********************** * delete player menu * **********************/ /* * delete a player */ static XBBool ButtonDeletePlayer (void *par) { XBAtom *atom = par; assert (atom != NULL); DeletePlayerConfig (CT_Local, *atom); return CreatePlayerOptionsMenu (NULL); } /* ButtonDeletePlayer */ /* * draw delete player menu */ static XBBool CreateDeletePlayerMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); MenuClear (); /* Title */ sprintf (title, "Delete Player %s?", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* edit options */ MenuSetDefault (MenuAddHButton (MENU_LEFT, MENU_TOP, MENU_WIDTH, "Yes, delete player!", ButtonDeletePlayer, atom)); /* back to previous menu */ MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, "No, just kidding.", CreateEditPlayerMenu, atom)); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, delAnime); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateEditPlayerMenu */ /********************** * rename player menu * **********************/ /* * rename a player */ static XBBool ButtonRenamePlayer (void *par) { static XBAtom newPlayer; XBAtom *oldPlayer; /* get player to rename */ assert (par != NULL); oldPlayer = par; /* create new player */ newPlayer = RenamePlayerConfig (CT_Local, *oldPlayer, newName); if (ATOM_INVALID != newPlayer) { return CreateEditPlayerMenu (&newPlayer); } else { return CreateEditPlayerMenu (par); } } /* ButtonNewPlayer */ /* * menu for renaming a player */ static XBBool CreateRenamePlayerMenu (void *par) { XBAtom *atom = par; MenuClear (); /* Title */ assert (NULL != atom); sprintf (newName, "%s", GetPlayerName (CT_Local, *atom)); sprintf (title, "Rename Player %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* message windows */ MenuAddString (DLG_LEFT, DLG_TOP, DLG_WIDTH, "New Name:", 3 * CELL_W, newName, sizeof (newName)); /* ok and cancel button */ MenuSetAbort (MenuAddHButton (7 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreatePlayerOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (15 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonRenamePlayer, par)); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, renameAnime); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateRenamePlayerMenu */ /************************** * unregister player menu * **************************/ /* * abort the registration process */ static XBBool ButtonAbortRegistration (void *par) { User_Disconnect (); return CreatePlayerOptionsMenu (NULL); } /* ButtonAbortRegistration */ /* * cyclic function checking if PID arrived */ static void PollForPID (void *par) { XBAtom *atom = par; int PID; PID = User_GetPID (); if (PID > -1000) { if (!gotPID) { switch (PID) { case -3: MenuAddLabel (5 * CELL_W / 2, MENU_ROW (4), 10 * CELL_W, "Error in central, press OK."); break; case -2: MenuAddLabel (5 * CELL_W / 2, MENU_ROW (4), 10 * CELL_W, "Bad user ID, press OK."); break; case -1: MenuAddLabel (5 * CELL_W / 2, MENU_ROW (4), 10 * CELL_W, "Wrong password, press OK."); break; default: MenuAddLabel (5 * CELL_W / 2, MENU_ROW (4), 10 * CELL_W, "Registered, press OK to continue."); break; } MenuSetDefault (MenuAddHButton (8 * CELL_W / 2, MENU_ROW (7), 7 * CELL_W, "OK", ButtonAbortRegistration, par)); gotPID = XBTrue; if (PID > 0) { if (RetrievePlayerID (CT_Local, *atom, &playerID)) { playerID.PID = PID; if (NULL != playerID.pass) { strncpy (newPass, playerID.pass, 16); } else { newPass[0] = 0; } playerID.pass = (0 != newPass[0]) ? newPass : NULL; StorePlayerID (CT_Local, *atom, &playerID); SavePlayerConfig (); } } User_SendDisconnect (); } } } /* PollForPID */ /* * register a player */ static XBBool ButtonRegisterPlayer (void *par) { XBAtom *atom = par; CFGCentralSetup central; assert (atom != NULL); /* store it */ playerID.pass = (0 != newPass[0]) ? newPass : NULL; StorePlayerID (CT_Local, *atom, &playerID); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuClear (); sprintf (title, "Registering %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* connect to central */ RetrieveCentralSetup (¢ral); if (User_Connect (¢ral)) { MenuAddLabel (5 * CELL_W / 2, MENU_ROW (3), 10 * CELL_W, "Please wait..."); MenuSetAbort (MenuAddHButton (8 * CELL_W / 2, MENU_BOTTOM, 7 * CELL_W, "Abort registration", ButtonAbortRegistration, par)); MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* poll function */ gotPID = XBFalse; User_SendRegisterPlayer (*atom); MenuAddCyclic (PollForPID, par); } else { MenuAddLabel (5 * CELL_W / 2, MENU_ROW (3), 10 * CELL_W, "Unable to connect to central."); MenuSetAbort (MenuAddHButton (8 * CELL_W / 2, MENU_BOTTOM, 7 * CELL_W, "Damn", CreatePlayerOptionsMenu, NULL)); MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, renameAnime); } /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* ButtonRegisterPlayer */ /* * menu for registering a player XBCC */ static XBBool CreateRegisterPlayerMenu (void *par) { XBAtom *atom = par; assert (NULL != atom); /* get options */ memset (&playerID, 0, sizeof (playerID)); RetrievePlayerID (CT_Local, *atom, &playerID); if (NULL != playerID.pass) { strncpy (newPass, playerID.pass, 16); } else { newPass[0] = 0; } /* build menu */ MenuClear (); sprintf (title, "Register Player %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* message windows */ MenuAddString (DLG_LEFT, DLG_TOP, DLG_WIDTH, "Password:", 3 * CELL_W, newPass, sizeof (newPass)); /* ok and cancel button */ MenuSetAbort (MenuAddHButton (7 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreatePlayerOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (15 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonRegisterPlayer, par)); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateRenamePlayerMenu */ /************************** * unregister player menu * **************************/ /* * button to unregister a player */ static XBBool ButtonUnregisterPlayer (void *par) { XBAtom *atom = par; /* CFGCentralSetup central; DOES NOT SEND TO CENRAL */ assert (atom != NULL); /* store it */ playerID.PID = -1; playerID.pass = NULL; StorePlayerID (CT_Local, *atom, &playerID); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuClear (); sprintf (title, "Unregistered (locally)"); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* connect to central */ MenuSetDefault (MenuAddHButton (8 * CELL_W / 2, MENU_BOTTOM, 7 * CELL_W, "OK", CreatePlayerOptionsMenu, NULL)); MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* message windows */ /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; return CreateEditPlayerMenu (par); } /* ButtonUnregisterPlayer */ /* * draw menu for unregistering a player */ static XBBool CreateUnregisterPlayerMenu (void *par) { XBAtom *atom = par; assert (NULL != atom); /* get options */ memset (&playerID, 0, sizeof (playerID)); RetrievePlayerID (CT_Local, *atom, &playerID); if (NULL != playerID.pass) { strncpy (newPass, playerID.pass, 16); } else { newPass[0] = 0; } /* build menu */ MenuClear (); sprintf (title, "Unregister Player %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* ok and cancel button */ MenuSetAbort (MenuAddHButton (7 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreatePlayerOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (15 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonUnregisterPlayer, par)); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateRenamePlayerMenu */ /******************** * edit player menu * ********************/ /* * draw edit player menu */ static XBBool CreateEditPlayerMenu (void *par) { XBAtom *atom = par; assert (atom != NULL); MenuClear (); /* Title */ sprintf (title, "Edit Player %s", GetPlayerName (CT_Local, *atom)); MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, title); /* edit options */ MenuAddHButton (MENU_LEFT, MENU_ROW (0), MENU_WIDTH, "Edit Graphics", CreatePlayerColorsMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (1), MENU_WIDTH, "Edit Messages", CreatePlayerMessageMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (2), MENU_WIDTH, "Control Options", CreatePlayerMiscMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (3), MENU_WIDTH, "Rename Player", CreateRenamePlayerMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (4), MENU_WIDTH, "Delete Player", CreateDeletePlayerMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (5), MENU_WIDTH, "Register Player", CreateRegisterPlayerMenu, atom); MenuAddHButton (MENU_LEFT, MENU_ROW (6), MENU_WIDTH, "Unregister Player", CreateUnregisterPlayerMenu, atom); /* back to previous menu */ MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, "Player Options Menu", CreatePlayerOptionsMenu, NULL)); /* sprite */ if (RetrievePlayerGraphics (CT_Local, *atom, COLOR_INVALID, gfxPlayer)) { pGfxPlayer[0] = gfxPlayer; } else { pGfxPlayer[0] = NULL; } MenuAddPlayer (PLAYER_LEFT (0, 1), PLAYER_TOP, PLAYER_WIDTH, 0, &pGfxPlayer[0], 1, bigAnime); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateEditPlayerMenu */ /*********************** * add new player menu * ***********************/ /* * button to create a new player */ static XBBool ButtonNewPlayer (void *par) { static XBAtom player; assert (par != NULL); player = CreateNewPlayerConfig (CT_Local, par); if (ATOM_INVALID != player) { return CreateEditPlayerMenu (&player); } else { return CreateNewPlayerMenu (NULL); } } /* ButtonNewPlayer */ /* * draw new player menu */ static XBBool CreateNewPlayerMenu (void *par) { static char name[16]; MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Create a New Player"); /* message windows */ MenuAddString (DLG_LEFT, DLG_TOP, DLG_WIDTH, "Player Name:", 3 * CELL_W, name, sizeof (name)); /* ok and cancel button */ MenuSetAbort (MenuAddHButton (7 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "Cancel", CreatePlayerOptionsMenu, NULL)); MenuSetDefault (MenuAddHButton (15 * CELL_W / 2, MENU_BOTTOM, 4 * CELL_W, "OK", ButtonNewPlayer, name)); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateNewPlayerMenu */ /*********************** * player options menu * ***********************/ /* * get next player list */ static XBBool ButtonPlayerForward (void *par) { int newFirst = firstPlayer + NUM_EDIT_PLAYERS; if (newFirst < GetNumPlayerConfigs (CT_Local)) { firstPlayer = newFirst; } return CreatePlayerOptionsMenu (par); } /* ButtonPlayerForward */ /* * get previous player list */ static XBBool ButtonPlayerBackward (void *par) { int newFirst = firstPlayer - NUM_EDIT_PLAYERS; if (newFirst > 0) { firstPlayer = newFirst; } else { firstPlayer = 0; } return CreatePlayerOptionsMenu (par); } /* ButtonPlayerForward */ /* * draw player main menu */ XBBool CreatePlayerOptionsMenu (void *par) { int row; int player, numPlayers; int button; XBBool odd; MENU_ID id; MenuClear (); /* Title */ MenuAddLabel (TITLE_LEFT, TITLE_TOP, TITLE_WIDTH, "Player Options Menu"); /* Buttons */ row = MENU_TOP; MenuAddHButton (MENU_LEFT, row, MENU_WIDTH, "Create New Player", CreateNewPlayerMenu, NULL); row += CELL_H; /* List players */ numPlayers = GetNumPlayerConfigs (CT_Local); for (player = firstPlayer, button = 0; player < numPlayers && button < NUM_EDIT_PLAYERS; player++, button++) { atomPlayers[button] = GetPlayerAtom (CT_Local, player); odd = (1 == (button % 2)); /* button */ MenuAddHButton (MENU_LEFT + odd * MENU_WIDTH / 2, row, MENU_WIDTH / 2, GetPlayerName (CT_Local, atomPlayers[button]), CreateEditPlayerMenu, atomPlayers + button); if (odd) { row += CELL_H; } /* sprite */ if (RetrievePlayerGraphics (CT_Local, atomPlayers[button], COLOR_INVALID, gfxPlayer + button)) { pGfxPlayer[button] = gfxPlayer + button; } else { pGfxPlayer[button] = NULL; } // MenuAddPlayer (PLAYER_LEFT(button,MAX_PLAYER), PLAYER_TOP, PLAYER_WIDTH, button, &pGfxPlayer[button], 1, playerAnime); MenuAddPlayer (PLAYER_LEFT (button, NUM_EDIT_PLAYERS), PLAYER_TOP, PLAYER_WIDTH, button, &pGfxPlayer[button], 1, playerAnime); } /* forward backward buttons */ row = MENU_TOP + (1 + NUM_EDIT_PLAYERS / 2) * CELL_H; id = MenuAddHButton (MENU_LEFT, row, MENU_WIDTH / 2, "Back", ButtonPlayerBackward, par); MenuSetActive (id, (firstPlayer > 0)); id = MenuAddHButton (MENU_LEFT + MENU_WIDTH / 2, row, MENU_WIDTH / 2, "More", ButtonPlayerForward, par); MenuSetActive (id, (player < numPlayers)); /* escape to toplevel menu */ MenuSetAbort (MenuAddHButton (MENU_LEFT, MENU_BOTTOM, MENU_WIDTH, "Options Menu", CreateOptionsMenu, NULL)); /* link items */ MenuSetLinks (); /* that's all */ return XBFalse; } /* CreateMenuPlayer */ /* * end of file menu_player.c */ xblast-2.10.4/menu_player.h0000644000175000017500000000204310372731124014700 0ustar rhondaalfie/* * file menu_player.h - edit player settings * * $Id: menu_player.h,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MENU_PLAYER_H #define _MENU_PLAYER_H /* * global prototypes */ extern XBBool CreatePlayerOptionsMenu (void *); #endif /* * end of file menu_player.h */ xblast-2.10.4/mi_base.c0000644000175000017500000001010710372731124013752 0ustar rhondaalfie/* * file mi_base.c - base functions for all menu items * * $Id: mi_base.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define MENU_COLS ((PIXW+BASE_X-1)/BASE_X) #define MENU_ROWS ((PIXH+SCOREH+BASE_Y - 1)/BASE_Y) /* * local variables */ static MENU_ID currentID = 0; static XBMenuItem *mouseMap[MENU_COLS][MENU_ROWS]; /* * reset id counter */ void MenuResetBase (void) { currentID = 0; memset (mouseMap, 0, sizeof (mouseMap)); } /* MenuResetId */ /* * set value for generic menu_item */ void MenuSetItem (XBMenuItem * ptr, XBMenuItemType type, int x, int y, int w, int h, MIC_focus focus, MIC_select select, MIC_mouse mouse, MIC_poll poll) { int xPos, yPos; assert (ptr != NULL); /* fill structure */ ptr->type = type; ptr->id = ++currentID; ptr->x = x; ptr->y = y; ptr->w = w; ptr->h = h; ptr->focus = focus; ptr->select = select; ptr->mouse = mouse; ptr->poll = poll; /* set mouse mapping */ if (NULL != ptr->mouse) { for (xPos = x; xPos < x + w; xPos++) { for (yPos = y; yPos < y + h; yPos++) { assert (xPos < MENU_COLS); assert (yPos < MENU_ROWS); mouseMap[xPos][yPos] = ptr; } } } } /* menu_create_item */ /* * find left neighbour of menu item */ XBMenuItem * MenuFindLeftItem (const XBMenuItem * item) { int x, y; assert (item != NULL); assert (item == mouseMap[item->x][item->y]); x = item->x; while (1) { x--; if (x < 0) { x = MENU_COLS - 1; } for (y = item->y; y < item->y + item->h; y++) { if (NULL != mouseMap[x][y]) { return mouseMap[x][y]; } } } return NULL; } /* FindLeftItem */ /* * find left neighbour of menu item */ XBMenuItem * MenuFindRightItem (const XBMenuItem * item) { int x, y; assert (item != NULL); assert (item == mouseMap[item->x][item->y]); x = item->x + item->w; while (1) { if (x >= MENU_COLS) { x = 0; } for (y = item->y; y < item->y + item->h; y++) { if (NULL != mouseMap[x][y]) { return mouseMap[x][y]; } } x++; } return NULL; } /* FindRightItem */ /* * find left neighbour of menu item */ XBMenuItem * MenuFindUpperItem (const XBMenuItem * item) { int x, y; assert (item != NULL); assert (item == mouseMap[item->x][item->y]); y = item->y; while (1) { y--; if (y < 0) { y = MENU_ROWS - 1; } for (x = item->x; x < item->x + item->w; x++) { if (NULL != mouseMap[x][y]) { return mouseMap[x][y]; } } } return NULL; } /* FindUpperItem */ /* * find left neighbour of menu item */ XBMenuItem * MenuFindLowerItem (const XBMenuItem * item) { int x, y; assert (item != NULL); assert (item == mouseMap[item->x][item->y]); y = item->y + item->h; while (1) { if (y >= MENU_ROWS) { y = 0; } for (x = item->x; x < item->x + item->w; x++) { if (NULL != mouseMap[x][y]) { return mouseMap[x][y]; } } y++; } return NULL; } /* FindLowerItem */ /* * */ XBMenuItem * MenuGetMouseItem (int x, int y) { /* on which item are we */ /* assert (x >= 0); assert (x < MENU_COLS); assert (y >= 0); assert (y < MENU_ROWS); return mouseMap[x][y]; */ /* CHANGED TO MAKE X-BRESSE HAPPY */ if ((x >= 0) && (x < MENU_COLS) && (y >= 0) && (y < MENU_ROWS)) { return mouseMap[x][y]; } else { return NULL; } } /* SetMousePosition */ /* * end of file mi_base.c */ xblast-2.10.4/mi_base.h0000644000175000017500000000466310372731124013771 0ustar rhondaalfie/* * file mi_base.h * * $Id: mi_base.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_BASE_H #define _MI_BASE_H /* * global macros */ #define MIF_SELECTED 0x01 #define MIF_FOCUS 0x02 #define MIF_DEACTIVATED 0x04 /* known menu item types */ typedef enum { MIT_Button, MIT_Toggle, MIT_Label, MIT_Combo, MIT_Player, MIT_String, MIT_Color, MIT_Keysym, MIT_Cyclic, MIT_Integer, MIT_Host, MIT_Tag, MIT_Table, MIT_Team } XBMenuItemType; struct _menu_item; /* function pointers for item specific behaviour */ typedef void (*MIC_focus) (struct _menu_item *, XBBool); typedef void (*MIC_select) (struct _menu_item *); typedef void (*MIC_mouse) (struct _menu_item *, XBEventCode); typedef void (*MIC_poll) (struct _menu_item *); /* generic item data */ typedef struct _menu_item { XBMenuItemType type; MENU_ID id; struct _menu_item *next; struct _menu_item *prev; struct _menu_item *left; struct _menu_item *right; struct _menu_item *up; struct _menu_item *down; int x; int y; int w; int h; unsigned flags; MIC_focus focus; MIC_select select; MIC_mouse mouse; MIC_poll poll; } XBMenuItem; /* * prototypes */ extern void MenuResetBase (void); extern void MenuSetItem (XBMenuItem * item, XBMenuItemType type, int x, int y, int w, int h, MIC_focus focus, MIC_select select, MIC_mouse mouse, MIC_poll poll); extern XBMenuItem *MenuFindLeftItem (const XBMenuItem * item); extern XBMenuItem *MenuFindRightItem (const XBMenuItem * item); extern XBMenuItem *MenuFindUpperItem (const XBMenuItem * item); extern XBMenuItem *MenuFindLowerItem (const XBMenuItem * item); extern XBMenuItem *MenuGetMouseItem (int x, int y); #endif /* * end of file mi_base.h */ xblast-2.10.4/mi_button.c0000644000175000017500000001370210372731124014357 0ustar rhondaalfie/* * file mi_button.c - buttons for menu * * $Id: mi_button.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ /* text sprite flags */ #define FF_H_BUTTON_FOCUS (FF_Large | FF_Black | FF_Center | FF_Outlined ) #define FF_H_BUTTON_NO_FOCUS (FF_Large | FF_White | FF_Center ) #define FF_V_BUTTON_FOCUS (FF_Medium | FF_Black | FF_Vertical | FF_Outlined) #define FF_V_BUTTON_NO_FOCUS (FF_Medium | FF_White | FF_Vertical) /* * local types */ typedef struct { XBMenuItem item; const char *text; Sprite *sprite; Sprite *iconSprite; XBBool horizontal; MIC_button func; void *funcData; } XBMenuButtonItem; /* * local variables */ static MIC_button nextExec = NULL; static void *nextExecData = NULL; /* * determine current text flags */ static void SetTextFlags (XBMenuButtonItem * button) { assert (button != NULL); assert (button->sprite != NULL); if (button->horizontal) { if (button->item.flags & MIF_FOCUS) { SetSpriteAnime (button->sprite, FF_Large | FF_Black | FF_Center | FF_Outlined); } else if (button->item.flags & MIF_DEACTIVATED) { SetSpriteAnime (button->sprite, FF_Large | FF_Black | FF_Center); } else { SetSpriteAnime (button->sprite, FF_Large | FF_White | FF_Center); } } else { if (button->item.flags & MIF_FOCUS) { SetSpriteAnime (button->sprite, FF_Medium | FF_Black | FF_Vertical | FF_Outlined); } else if (button->item.flags & MIF_DEACTIVATED) { SetSpriteAnime (button->sprite, FF_Medium | FF_Black | FF_Vertical); } else { SetSpriteAnime (button->sprite, FF_Medium | FF_White | FF_Vertical); } } } /* ButtonTextFlags */ /* * button has changed activation */ void MenuActivateButton (XBMenuItem * ptr, XBBool flag) { SetTextFlags ((XBMenuButtonItem *) ptr); } /* MenuActivateButton */ /* * a horizontal button receives the focus */ static void MenuButtonFocus (XBMenuItem * ptr, XBBool flag) { SetTextFlags ((XBMenuButtonItem *) ptr); } /* MenuHButtonFocus */ /* * a button is selected */ static void MenuButtonSelect (XBMenuItem * ptr) { XBMenuButtonItem *button = (XBMenuButtonItem *) ptr; assert (ptr != NULL); nextExec = button->func; nextExecData = button->funcData; } /* MenuButtonSelect */ /* * button was selected by mouse */ static void MenuButtonMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuButtonSelect (ptr); } } /* MenuButtonMouse */ /* * */ XBMenuItem * MenuCreateHButton (int x, int y, int w, const char *text, MIC_button func, void *funcData) { /* create item */ XBMenuButtonItem *button = calloc (1, sizeof (XBMenuButtonItem)); assert (button != NULL); MenuSetItem (&button->item, MIT_Button, x, y, w, CELL_H, MenuButtonFocus, MenuButtonSelect, MenuButtonMouse, NULL); /* set item specific values */ button->text = text; button->sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_H_BUTTON_NO_FOCUS, SPM_MAPPED); button->func = func; button->funcData = funcData; button->horizontal = XBTrue; /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); /* --- */ return &button->item; } /* CreateMenuButton */ /* * */ XBMenuItem * MenuCreateVButton (int x, int y, int h, const char *text, MIC_button func, void *funcData) { /* create item */ XBMenuButtonItem *button = calloc (1, sizeof (XBMenuButtonItem)); assert (button != NULL); MenuSetItem (&button->item, MIT_Button, x, y, CELL_W, h, MenuButtonFocus, MenuButtonSelect, MenuButtonMouse, NULL); button->text = text; button->sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (CELL_W - 2) * BASE_X, (h - 2) * BASE_Y, FF_V_BUTTON_NO_FOCUS, SPM_MAPPED); button->func = func; button->funcData = funcData; button->horizontal = XBFalse; /* graphics */ MenuAddVerticalFrame (x / CELL_W, y / CELL_H, (y + h - 1) / CELL_W); /* --- */ return &button->item; } /* CreateMenuButton */ /* * delete a button */ void MenuDeleteButton (XBMenuItem * item) { XBMenuButtonItem *button = (XBMenuButtonItem *) item; assert (button->sprite != NULL); DeleteSprite (button->sprite); if (NULL != button->iconSprite) { DeleteSprite (button->iconSprite); } } /* DeleteButtonItem */ /* * button is default button */ void MenuSetButtonIcon (XBMenuItem * item, IconSpriteAnimation anime) { XBMenuButtonItem *button = (XBMenuButtonItem *) item; assert (button != NULL); assert (button->item.type == MIT_Button); /* create sprite if needed */ assert (button->iconSprite == NULL); button->iconSprite = CreateIconSprite ((button->item.x + 1) * BASE_X, button->item.y * BASE_Y, anime, SPM_MAPPED); assert (NULL != button->iconSprite); } /* MenuSetButtonIcon */ /* * exec function of button */ XBBool MenuExecButton (void) { XBBool result = XBFalse; if (NULL != nextExec) { result = (*nextExec) (nextExecData); nextExec = NULL; nextExecData = NULL; } return result; } /* * set next exec to external function */ void MenuButtonSetNextExec (MIC_button func, void *data) { nextExec = func; nextExecData = data; } /* MenuButtonSetNextExec */ /* * end of file mi_button.c */ xblast-2.10.4/mi_button.h0000644000175000017500000000272110373126076014370 0ustar rhondaalfie/* * file mi_button.h - * * $Id: mi_button.h,v 1.6 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_BUTTON_H #define _MI_BUTTON_H extern XBMenuItem *MenuCreateHButton (int x, int y, int w, const char *text, MIC_button func, void *funcData); extern XBMenuItem *MenuCreateVButton (int x, int y, int h, const char *text, MIC_button func, void *funcData); extern void MenuSetButtonIcon (XBMenuItem * item, IconSpriteAnimation anime); extern void MenuDeleteButton (XBMenuItem * item); extern void MenuActivateButton (XBMenuItem * ptr, XBBool flag); extern XBBool MenuExecButton (void); extern void MenuButtonSetNextExec (MIC_button func, void *data); #endif /* * end of file mi_button.h */ xblast-2.10.4/mi_color.c0000644000175000017500000001165410372731124014166 0ustar rhondaalfie/* * file mi_color.c - color editor for menus * * $Id: mi_color.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define FF_COLOR_TEXT_FOCUS (FF_Medium | FF_Black | FF_Left | FF_Outlined) #define FF_COLOR_TEXT_NO_FOCUS (FF_Medium | FF_White | FF_Left) /* * local types */ /* color editor */ typedef struct { XBMenuItem item; const char *text; Sprite *tSprite; XBColor *pointer; XBColor current; XBRgbValue *pRgb; int index; Sprite *cSprite; Sprite *sSprite; } XBMenuColorItem; /* * local variables */ static int colorCount = 0; XBMenuColorItem *itemTable[MAX_COLOR_SPRITES] = { NULL, NULL, NULL, NULL, NULL, NULL, }; /* * a color item has received the focus */ static void MenuColorFocus (XBMenuItem * ptr, XBBool flag) { XBMenuColorItem *color = (XBMenuColorItem *) ptr; assert (color != NULL); assert (color->tSprite != NULL); SetSpriteAnime (color->tSprite, flag ? FF_COLOR_TEXT_FOCUS : FF_COLOR_TEXT_NO_FOCUS); } /* MenuColorFocus */ /* * Menu Color Item */ static void MenuColorSelect (XBMenuItem * ptr) { int i; XBMenuColorItem *color = (XBMenuColorItem *) ptr; assert (color != NULL); /* delete other color selections */ for (i = 0; i < colorCount; i++) { XBMenuColorItem *item = itemTable[i]; assert (item != NULL); item->item.flags &= ~MIF_SELECTED; SetSpriteAnime (item->sSprite, ISA_LedOff); } /* mark as selected */ color->item.flags |= MIF_SELECTED; SetSpriteAnime (color->sSprite, ISA_LedOn); /* set rgb value */ assert (color->pRgb != NULL); color->pRgb->red = GET_RED (color->current); color->pRgb->green = GET_GREEN (color->current); color->pRgb->blue = GET_BLUE (color->current); } /* MenuColorSelect */ /* * mouse click */ static void MenuColorMouse (XBMenuItem * ptr, XBEventCode code) { if (XBE_MOUSE_1 == code) { MenuColorSelect (ptr); } } /* MenuColorMouse */ /* * Menu Color Item */ static void MenuColorPoll (XBMenuItem * ptr) { XBMenuColorItem *color = (XBMenuColorItem *) ptr; assert (NULL != color); assert (NULL != color->pRgb); assert (NULL != color->cSprite); assert (NULL != color->pointer); if (color->item.flags & MIF_SELECTED) { /* check for color changes */ XBColor tmp = SET_COLOR (color->pRgb->red, color->pRgb->green, color->pRgb->blue); if (tmp != color->current) { /* store new value */ color->current = tmp; *color->pointer = tmp; SetSpriteColor (color->cSprite, color->current); } } } /* MenuColorPoll */ /* * */ XBMenuItem * MenuCreateColor (int x, int y, int w, const char *text, XBColor * pColor, XBRgbValue * pRgb) { XBMenuColorItem *color; assert (pColor != NULL); assert (colorCount < MAX_COLOR_SPRITES); /* create item */ color = calloc (1, sizeof (*color)); assert (color != NULL); MenuSetItem (&color->item, MIT_Color, x, y, w, CELL_H, MenuColorFocus, MenuColorSelect, MenuColorMouse, MenuColorPoll); /* set label */ color->text = text; color->tSprite = CreateTextSprite (text, (x + 3) * BASE_X, (y + 1) * BASE_Y, (w - CELL_W - 4) * BASE_X, (CELL_H - 2) * BASE_Y, FF_COLOR_TEXT_NO_FOCUS, SPM_MAPPED); /* get color */ color->pointer = pColor; color->current = *pColor; color->pRgb = pRgb; color->index = colorCount++; color->cSprite = CreateIconSprite ((x + w - CELL_W) * BASE_X, y * BASE_Y, ISA_Color1 + color->index, SPM_MAPPED); SetSpriteColor (color->cSprite, color->current); /* marker for selection */ color->sSprite = CreateIconSprite ((x - 4) * BASE_X, y * BASE_Y, ISA_LedOff, SPM_MAPPED); /* store in table */ itemTable[color->index] = color; /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); /* that's all */ return &color->item; } /* CreateMenuColor */ /* * delete color editor */ void MenuDeleteColor (XBMenuItem * item) { XBMenuColorItem *color = (XBMenuColorItem *) item; assert (color != NULL); assert (color->tSprite != NULL); assert (color->cSprite != NULL); assert (color->sSprite != NULL); DeleteSprite (color->tSprite); DeleteSprite (color->cSprite); DeleteSprite (color->sSprite); itemTable[color->index] = NULL; colorCount--; } /* DeleteColorItem */ /* * end of file mi_color.c */ xblast-2.10.4/mi_color.h0000644000175000017500000000213310372731124014163 0ustar rhondaalfie/* * file mi_color.h - * * $Id: mi_color.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_COLOR_H #define _MI_COLOR_H extern XBMenuItem *MenuCreateColor (int x, int y, int w, const char *text, XBColor * color, XBRgbValue * pRgb); extern void MenuDeleteColor (XBMenuItem * item); #endif /* * end of file mi_color.h */ xblast-2.10.4/mi_combo.c0000644000175000017500000001645410372731124014152 0ustar rhondaalfie/* * file mi_combo.c - simple box box * * $Id: mi_combo.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define FF_COMBO_TEXT_FOCUS (FF_Medium | FF_Black | FF_Left | FF_Outlined) #define FF_COMBO_TEXT_NO_FOCUS (FF_Medium | FF_White | FF_Left) #define FF_COMBO_VALUE_SELECT (FF_Medium | FF_Black | FF_Center | FF_Boxed ) #define FF_COMBO_VALUE_NO_SELECT (FF_Medium | FF_White | FF_Center | FF_Boxed ) /* * local types */ /* simple combo box */ typedef struct { XBMenuItem item; const char *text; int *value; void **data; XBAtom *atom; XBComboEntryList *table; int index; Sprite *t_sprite; Sprite *v_sprite; } XBMenuComboItem; /* * a combo item receives the focus */ static void MenuComboFocus (XBMenuItem * ptr, XBBool flag) { XBMenuComboItem *combo = (XBMenuComboItem *) ptr; assert (combo != NULL); assert (combo->t_sprite != NULL); SetSpriteAnime (combo->t_sprite, flag ? FF_COMBO_TEXT_FOCUS : FF_COMBO_TEXT_NO_FOCUS); } /* MenuComboFocus */ /* * Menu Combo Item */ static void MenuComboPoll (XBMenuItem * ptr) { int index = 0; XBMenuComboItem *combo = (XBMenuComboItem *) ptr; assert (combo != NULL); assert (combo->table != NULL); assert (combo->v_sprite != NULL); /* find current value in table */ if (combo->value != NULL) { for (index = 0; combo->table[index].text != NULL; index++) { if (combo->table[index].value == *combo->value) { break; } } } if (combo->data != NULL) { for (index = 0; combo->table[index].text != NULL; index++) { if (combo->table[index].data == *combo->data) { break; } } } if (combo->atom != NULL) { for (index = 0; combo->table[index].text != NULL; index++) { if (combo->table[index].atom == *combo->atom) { break; } } } /* check if index has changed */ if (index != combo->index) { combo->index = index; /* set values according entry */ if (combo->value != NULL) { *combo->value = combo->table[index].value; } if (combo->data != NULL) { *combo->data = combo->table[index].data; } if (combo->atom != NULL) { *combo->atom = combo->table[index].atom; } /* change value display */ SetSpriteText (combo->v_sprite, combo->table[index].text); } } /* MenuComboPoll */ /* * combo item: select new element */ static void SetCombo (XBMenuComboItem * combo, XBBool next) { if (next) { /* go forward in table */ combo->index++; if (NULL == combo->table[combo->index].text) { /* reched end of table */ combo->index = 0; } } else { /* go backward in table */ if (combo->index <= 0) { /* search for last entry */ for (combo->index = 0; combo->table[combo->index].text != NULL; combo->index++) continue; } combo->index--; } /* set new text for sprite */ SetSpriteText (combo->v_sprite, combo->table[combo->index].text); /* set new value */ if (NULL != combo->value) { *combo->value = combo->table[combo->index].value; } if (NULL != combo->data) { *combo->data = combo->table[combo->index].data; } if (NULL != combo->atom) { *combo->atom = combo->table[combo->index].atom; } } /* SetCombo */ /* * */ static void MenuComboMouse (XBMenuItem * ptr, XBEventCode code) { switch (code) { case XBE_MOUSE_1: SetCombo ((XBMenuComboItem *) ptr, XBTrue); break; case XBE_MOUSE_2: SetCombo ((XBMenuComboItem *) ptr, XBFalse); break; default: break; } } /* MenuComboMouse */ /* * event handling whiule combo is selected */ static void ComboEventLoop (XBMenuItem * ptr) { XBEventCode event; XBEventData data; XBMenuComboItem *combo = (XBMenuComboItem *) ptr; assert (combo != NULL); assert (combo->v_sprite != NULL); SetSpriteAnime (combo->v_sprite, FF_COMBO_VALUE_SELECT); /* event loop */ while (1) { /* update window contents */ MenuUpdateWindow (); /* get event from gui */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { if (event == XBE_MENU) { switch (data.value) { case XBMK_PREV: case XBMK_UP: SetCombo (combo, XBFalse); break; case XBMK_NEXT: case XBMK_DOWN: SetCombo (combo, XBTrue); break; case XBMK_SELECT: case XBMK_ABORT: SetSpriteAnime (combo->v_sprite, FF_COMBO_VALUE_NO_SELECT); return; default: break; } } } } } /* ComboEventLoop */ /* * */ XBMenuItem * MenuCreateCombo (int x, int y, int w, const char *text, int w_val, int *value, void **data, XBAtom * atom, XBComboEntryList * table) { XBMenuComboItem *combo; assert (w - w_val > 0); combo = calloc (1, sizeof (*combo)); assert (combo != NULL); MenuSetItem (&combo->item, MIT_Combo, x, y, w, CELL_H, MenuComboFocus, ComboEventLoop, MenuComboMouse, MenuComboPoll); /* set label */ combo->text = text; combo->t_sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - w_val - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_COMBO_TEXT_NO_FOCUS, SPM_MAPPED); /* find index of value in table */ combo->value = value; combo->data = data; combo->atom = atom; combo->table = table; combo->index = 0; /* find valid entry in table */ if (combo->value != NULL) { for (combo->index = 0; table[combo->index].text != NULL; combo->index++) { if (table[combo->index].value == *value) { break; } } } if (combo->data != NULL) { for (combo->index = 0; table[combo->index].text != NULL; combo->index++) { if (table[combo->index].data == *data) { break; } } } if (combo->atom != NULL) { for (combo->index = 0; table[combo->index].text != NULL; combo->index++) { if (table[combo->index].atom == *atom) { break; } } } if (NULL == table[combo->index].text) { combo->index = 0; } /* set values according entry */ if (combo->value != NULL) { *combo->value = table[combo->index].value; } if (combo->data != NULL) { *combo->data = table[combo->index].data; } if (combo->atom != NULL) { *combo->atom = table[combo->index].atom; } /* create sprite */ combo->v_sprite = CreateTextSprite (table[combo->index].text, (x + w - w_val + 1) * BASE_X, (y + 2) * BASE_Y, (w_val - 2) * BASE_X, (CELL_H - 4) * BASE_Y, FF_COMBO_VALUE_NO_SELECT, SPM_MAPPED); /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); return &combo->item; } /* * delete a combo */ void MenuDeleteCombo (XBMenuItem * item) { XBMenuComboItem *combo = (XBMenuComboItem *) item; assert (combo != NULL); assert (combo->t_sprite != NULL); assert (combo->v_sprite != NULL); DeleteSprite (combo->t_sprite); DeleteSprite (combo->v_sprite); } /* DeleteComboItem */ /* * end of file mi_bombo.c */ xblast-2.10.4/mi_combo.h0000644000175000017500000000221610372731124014146 0ustar rhondaalfie/* * file mi_combo.h - * * $Id: mi_combo.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_COMBO_H #define _MI_COMBO_H extern XBMenuItem *MenuCreateCombo (int x, int y, int w_text, const char *text, int w, int *value, void **data, XBAtom * atom, XBComboEntryList * table); extern void MenuDeleteCombo (XBMenuItem * item); #endif /* * end of file mi_combo.h */ xblast-2.10.4/mi_cyclic.c0000644000175000017500000000351010372731124014306 0ustar rhondaalfie/* * file mi_cyclic.c - menu item which periodically calls a given function * * $Id: mi_cyclic.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBMenuItem item; MIC_cyclic func; void *par; } XBMenuCyclicItem; /* * cyclic function */ static void MenuPollCyclic (XBMenuItem * item) { XBMenuCyclicItem *cyclic = (XBMenuCyclicItem *) item; assert (cyclic != NULL); (*cyclic->func) (cyclic->par); } /* MenuCyclicCyclic */ /* * create new item */ XBMenuItem * MenuCreateCyclic (MIC_cyclic func, void *par) { XBMenuCyclicItem *cyclic; assert (func != NULL); /* create item */ cyclic = calloc (1, sizeof (*cyclic)); assert (NULL != cyclic); MenuSetItem (&cyclic->item, MIT_Cyclic, 0, 0, 0, 0, NULL, NULL, NULL, MenuPollCyclic); /* set item specific values */ cyclic->func = func; cyclic->par = par; /* that's all */ return &cyclic->item; } /* MenuCreateCyclic */ /* * delete item */ void MenuDeleteCyclic (XBMenuItem * item) { } /* MenuDeleteCyclic */ /* * end of file mi_cyclic.c */ xblast-2.10.4/mi_cyclic.h0000644000175000017500000000217310372731124014317 0ustar rhondaalfie/* * file mi_cyclic.h - menu item which peridically calls a given function * * $Id: mi_cyclic.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_CYCLIC_H #define _MI_CYCLIC_H /* * global prototypes */ extern XBMenuItem *MenuCreateCyclic (MIC_cyclic func, void *par); extern void MenuDeleteCyclic (XBMenuItem * item); #endif /* * end of file mi_cyclic.h */ xblast-2.10.4/mi_host.c0000644000175000017500000006067110372731124014030 0ustar rhondaalfie/* * file mi_host.c - Menu item for host selection in networked games * * $Id: mi_host.c,v 1.25 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macors */ #define FF_HOST_NAME_FOCUS (FF_Small | FF_Black | FF_Center | FF_Outlined) #define FF_HOST_NAME_NO_FOCUS (FF_Small | FF_White | FF_Center) #define FF_HOST_STATE_FOCUS (FF_Large | FF_Black | FF_Center | FF_Outlined) #define FF_HOST_STATE_NO_FOCUS (FF_Large | FF_White | FF_Center) /* * local types */ typedef struct { XBMenuItem item; /* generic item data */ /* host name */ const char **pText; /* link to current host name string */ const char *cText; /* displayed host name string */ Sprite *tSprite; /* host name text sprite */ /* host state */ XBHostState *pState; /* link to current host state */ XBHostState cState; /* displayed host state */ Sprite *sSprite; /* host state text sprite */ /* host ping */ const int *pPing; /* link to current ping time */ int cPing; /* currently displayed ping value */ char tPing[16]; /* currently displayer ping string */ Sprite *pSprite; /* host ping text sprite */ /* host state requests */ unsigned id; /* host id */ XBHSFocusFunc focusFunc; /* handler for state focus changes */ XBHSChangeFunc chgFunc; /* handler for local state changes */ XBHSUpdateFunc upFunc; /* handler for ping/state updates */ /* locally requested state */ XBHostState lState; /* current local requested state */ Sprite *lSprite; /* local request text sprite */ /* requests known to server */ XBHostState cStateReq[MAX_HOSTS]; /* displayed externak requests */ char tRequests[MAX_HOSTS + 1]; /* displayed requests string */ Sprite *rSprite; /* requests text sprite */ } XBMenuHostItem; typedef struct { XBMenuItem item; /* generic item data */ /* team state */ XBTeamState *pTeam; /* link to current team state */ XBTeamState cTeam; /* displayed team state */ Sprite *sSprite; /* team state text sprite */ /* team state requests */ unsigned id; /* host id */ unsigned player; /* player id */ XBTSFocusFunc focusFunc; /* handler for team focus changes */ XBTSChangeFunc chgFunc; /* handler for local team changes */ XBTSUpdateFunc upFunc; /* handler for team updates */ /* locally requested team */ XBTeamState lTeam; /* currently requested team */ Sprite *lSprite; /* state request text sprite */ /* requests known to server */ XBTeamState cTeamReq[MAX_HOSTS]; /* display team requests */ char tRequests[MAX_HOSTS + 1]; /* displayed requests string */ Sprite *rSprite; /* requests text sprite */ } XBMenuTeamItem; /* * local variables */ static XBHostState serverState = XBHS_Server; static const char *stateText[NUM_XBHS] = { "?", /* XBHS_None */ "...", /* XBHS_Wait */ "In", /* XBHS_In */ "Out", /* XBHS_Out */ "Srv", /* XBHS_Server */ "Go!", /* XBHS_Ready */ }; static const char *teamText[NUM_XBTS] = { "", /* XBTS_Invalid */ "None", /* XBTS_None */ "Red", /* XBTS_Red */ "Green", /* XBTS_Green */ "Blue", /* XBTS_Blue */ "Out", /* XBTS_Out */ }; /******************* * shared routines * *******************/ /* * shared host focus handler */ static void MenuHostFocusShared (XBMenuItem * ptr, XBBool flag) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; assert (NULL != host); assert (NULL != host->tSprite); assert (NULL != host->sSprite); SetSpriteAnime (host->tSprite, flag ? FF_HOST_NAME_FOCUS : FF_HOST_NAME_NO_FOCUS); SetSpriteAnime (host->sSprite, flag ? FF_HOST_STATE_FOCUS : FF_HOST_STATE_NO_FOCUS); if (NULL != host->pSprite) { SetSpriteAnime (host->pSprite, flag ? FF_HOST_NAME_FOCUS : FF_HOST_NAME_NO_FOCUS); } } /* MenuHostFocusShared */ /* * polling a host item */ static void MenuHostPollShared (XBMenuItem * ptr) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; assert (NULL != host); assert (NULL != host->tSprite); assert (NULL != host->sSprite); /* check state change, old style: link to array in menu_network.c */ if (*host->pState != host->cState) { host->cState = *host->pState; assert (host->cState < NUM_XBHS); SetSpriteText (host->sSprite, stateText[host->cState]); } /* check name change */ if (*host->pText != host->cText) { host->cText = *host->pText; SetSpriteText (host->tSprite, host->cText); } /* update ping, old style: link to array in menu_network.c */ if (NULL != host->pPing && *host->pPing != host->cPing) { host->cPing = *host->pPing; if (host->cPing < 0) { host->tPing[0] = 0; } else { sprintf (host->tPing, "%u ms", host->cPing); } SetSpriteText (host->pSprite, host->tPing); } } /* MenuSharedPoll */ /* * shared team focus handler */ static void MenuTeamFocusShared (XBMenuItem * ptr, XBBool flag) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team); assert (NULL != team->sSprite); SetSpriteAnime (team->sSprite, flag ? FF_HOST_NAME_FOCUS : FF_HOST_NAME_NO_FOCUS); } /* MenuTeamFocusShared */ /* * polling a team item */ static void MenuTeamPollShared (XBMenuItem * ptr) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team); /* state */ if (*team->pTeam != team->cTeam) { team->cTeam = *team->pTeam; assert (team->cTeam < NUM_XBTS); SetSpriteText (team->sSprite, teamText[team->cTeam]); } } /* MenuTeamPollShared */ /********************* * generic host item * *********************/ /* * host item receives focus */ static void MenuHostFocus (XBMenuItem * ptr, XBBool flag) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; assert (NULL != host->focusFunc); (*host->focusFunc) (host->id); MenuHostFocusShared (ptr, flag); } /* MenuHostFocus */ /* * host item selected */ static void MenuHostSelect (XBMenuItem * ptr) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; assert (NULL != host); assert (NULL != host->chgFunc); assert (host->id < MAX_HOSTS); if ((*host->chgFunc) (host->id, &host->lState)) { /* update the local request sprite */ if (host->lState == host->cState || host->lState == XBHS_None) { SetSpriteText (host->lSprite, ""); } else { SetSpriteText (host->lSprite, stateText[host->lState]); } } } /* MenuHostSelect */ /* * host item mouse event */ static void MenuHostMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuHostSelect (ptr); } } /* MenuHostMouse */ /* * host item polling */ static void MenuHostPoll (XBMenuItem * ptr) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; #ifdef REQUESTS unsigned i; #endif assert (NULL != host); assert (NULL != host->tSprite); assert (NULL != host->sSprite); if ((*host->upFunc) (host->id, &host->cState, &host->cStateReq[0], &host->cPing)) { assert (host->cState < NUM_XBHS); /* create requests and ping */ if (host->cState == XBHS_None) { host->tRequests[0] = (char)0; host->tPing[0] = (char)0; } else { #ifdef REQUESTS /* update requests text */ for (i = 0; i < MAX_HOSTS; i++) { host->tRequests[i] = *stateText[host->cStateReq[i]]; } host->tRequests[MAX_HOSTS] = (char)0; #endif /* update ping text */ if (host->cPing < 0) { host->tPing[0] = (char)0; /* ping undefined, display nothing */ } else { sprintf (host->tPing, "%u ms", host->cPing); } } /* display requests, ping, current */ #ifdef REQUESTS SetSpriteText (host->rSprite, host->tRequests); #endif SetSpriteText (host->sSprite, stateText[host->cState]); SetSpriteText (host->pSprite, host->tPing); } /* clear local request sprite if it coincides with current state or not set */ if (host->lState == XBHS_None || host->lState == host->cState) { SetSpriteText (host->lSprite, ""); } /* check name change, direct link */ if (*(host->pText + host->id) != host->cText) { host->cText = *(host->pText + host->id); SetSpriteText (host->tSprite, host->cText); } } /* MenuHostPoll */ /* * create generic host button */ XBMenuItem * MenuCreateHost (int x, int y, int w, unsigned client, const char **pText, XBHSFocusFunc focusFunc, XBHSChangeFunc chgFunc, XBHSUpdateFunc upFunc) { /* create item */ XBMenuHostItem *host = calloc (1, sizeof (*host)); assert (host != NULL); MenuSetItem (&host->item, MIT_Host, x, y, w, CELL_H, MenuHostFocus, MenuHostSelect, MenuHostMouse, MenuHostPoll); /* remember host id */ host->id = client; /* set handlers */ host->focusFunc = focusFunc; host->chgFunc = chgFunc; host->upFunc = upFunc; /* set initial state info */ host->cState = XBHS_None; host->sSprite = CreateTextSprite (stateText[host->cState], (x + 1) * BASE_X, (y + 1) * BASE_Y, (w / 4) * BASE_X, CELL_H / 2 * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* set initial local request info */ host->lState = XBHS_None; host->lSprite = CreateTextSprite ("", (x + w / 5) * BASE_X, (y + 1) * BASE_Y, (w / 4) * BASE_X, CELL_H / 2 * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* set initial requests info */ memset (host->cStateReq, 0, sizeof (host->cStateReq)); host->rSprite = CreateTextSprite (host->tRequests, (x + 1) * BASE_X, (y + CELL_H / 2) * BASE_Y, (w / 2) * BASE_X, (CELL_H / 2 - 1) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* set initial ping info */ host->cPing = -1; host->tPing[0] = (char)0; host->pSprite = CreateTextSprite (host->tPing, (x + w / 2) * BASE_X, (y + CELL_H / 2) * BASE_Y, (w / 2 - 1) * BASE_X, (CELL_H / 2 - 1) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* link host name */ assert (pText != NULL); host->pText = pText; host->cText = *(pText + host->id); host->tSprite = CreateTextSprite (host->cText, (x + 2 * w / 5) * BASE_X, (y + 1) * BASE_Y, (3 * w / 5 - 1) * BASE_X, CELL_H / 2 * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* graphics */ MenuAddLargeFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); /* poll once */ MenuHostPoll (&host->item); return &host->item; } /* MenuCreateServer */ /******************** * server host item * ********************/ /* * host item has focus */ static void MenuServerFocus (XBMenuItem * ptr, XBBool flag) { MenuHostFocusShared (ptr, flag); } /* MenuServerFocus */ /* * host item selected */ static void MenuServerSelect (XBMenuItem * ptr) { } /* MenuServerSelect */ /* * host item mouse event */ static void MenuServerMouse (XBMenuItem * ptr, XBEventCode code) { } /* MenuServerMouse */ /* * polling */ static void MenuServerPoll (XBMenuItem * ptr) { MenuHostPollShared (ptr); } /* MenuServerPoll */ /* * create server button */ XBMenuItem * MenuCreateServer (int x, int y, int w, const char **pText) { /* create item */ XBMenuHostItem *host = calloc (1, sizeof (*host)); assert (host != NULL); MenuSetItem (&host->item, MIT_Host, x, y, w, CELL_H, MenuServerFocus, MenuServerSelect, MenuServerMouse, MenuServerPoll); /* set server specific data */ assert (pText != NULL); host->pText = pText; host->cText = *pText; host->pState = &serverState; host->cState = XBHS_None; /* sprite with host name */ host->tSprite = CreateTextSprite (*pText, (x + 11) * BASE_X, y * BASE_Y, (w - 12) * BASE_X, CELL_H * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* sprite with host state */ host->sSprite = CreateTextSprite (stateText[0], (x + 1) * BASE_X, y * BASE_Y, 9 * BASE_X, CELL_H * BASE_Y, FF_HOST_STATE_NO_FOCUS, SPM_MAPPED); /* sprite with state request */ host->lSprite = NULL; /* sprite with requests */ host->rSprite = NULL; /* graphics */ MenuAddLargeFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &host->item; } /* MenuCreateServer */ /******************** * client host item * ********************/ /* * host item has focus */ static void MenuClientFocus (XBMenuItem * ptr, XBBool flag) { MenuHostFocusShared (ptr, flag); } /* MenuClientFocus */ /* * host item selected */ static void MenuClientSelect (XBMenuItem * ptr) { XBMenuHostItem *host = (XBMenuHostItem *) ptr; assert (NULL != host); assert (NULL != host->pState); switch (*host->pState) { case XBHS_In: *host->pState = XBHS_Out; break; case XBHS_Out: *host->pState = XBHS_In; break; default: break; } } /* MenuClientSelect */ /* * host item mouse event */ static void MenuClientMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuClientSelect (ptr); } } /* MenuClientMouse */ /* * polling */ static void MenuClientPoll (XBMenuItem * ptr) { MenuHostPollShared (ptr); } /* MenuClientPoll */ /* * create server button */ XBMenuItem * MenuCreateClient (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing) { /* create item */ XBMenuHostItem *host = calloc (1, sizeof (*host)); assert (host != NULL); MenuSetItem (&host->item, MIT_Host, x, y, w, CELL_H, MenuClientFocus, MenuClientSelect, MenuClientMouse, MenuClientPoll); /* set server specific data */ assert (pText != NULL); assert (pState != NULL); host->pText = pText; host->cText = *pText; host->pState = pState; host->cState = *pState; host->pPing = pPing; host->cPing = -1; host->rSprite = NULL; /* sprite with host name */ host->tSprite = CreateTextSprite (*pText, (x + 11) * BASE_X, (y + 1) * BASE_Y, (w - 12) * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* sprite with ping to host */ host->pSprite = CreateTextSprite (host->tPing, (x + 11) * BASE_X, (y + CELL_H / 2) * BASE_Y, (w - 12) * BASE_X, (CELL_H / 2 - 1) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* sprite with host state */ host->sSprite = CreateTextSprite (stateText[*pState], (x + 1) * BASE_X, y * BASE_Y, 9 * BASE_X, CELL_H * BASE_Y, FF_HOST_STATE_NO_FOCUS, SPM_MAPPED); /* sprite with state request */ host->lSprite = NULL; /* sprite with requests */ host->rSprite = NULL; /* graphics */ MenuAddLargeFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &host->item; } /* MenuCreateServer */ /****************** * peer host item * ******************/ /* * host item has focus */ static void MenuPeerFocus (XBMenuItem * ptr, XBBool flag) { MenuHostFocusShared (ptr, flag); } /* MenuPeerFocus */ /* * host item is selected */ static void MenuPeerSelect (XBMenuItem * ptr) { } /* MenuPeerSelect */ /* * host item under mouse */ static void MenuPeerMouse (XBMenuItem * ptr, XBEventCode code) { } /* MenuPeerMouse */ /* * polling */ static void MenuPeerPoll (XBMenuItem * ptr) { MenuHostPollShared (ptr); } /* MenuPeerPoll */ /* * create peer item */ XBMenuItem * MenuCreatePeer (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing) { /* create item */ XBMenuHostItem *host = calloc (1, sizeof (*host)); assert (host != NULL); MenuSetItem (&host->item, MIT_Host, x, y, w, CELL_H, MenuPeerFocus, MenuPeerSelect, MenuPeerMouse, MenuPeerPoll); /* set server specific data */ assert (pText != NULL); assert (pState != NULL); host->pText = pText; host->cText = *pText; host->pState = pState; host->cState = *pState; host->pPing = pPing; host->cPing = -1; host->rSprite = NULL; /* sprite with host name */ host->tSprite = CreateTextSprite (*pText, (x + 11) * BASE_X, (y + 1) * BASE_Y, (w - 12) * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* sprite with ping to host */ host->pSprite = CreateTextSprite (host->tPing, (x + 11) * BASE_X, (y + CELL_H / 2) * BASE_Y, (w - 12) * BASE_X, (CELL_H / 2 - 1) * BASE_Y, FF_HOST_NAME_NO_FOCUS, SPM_MAPPED); /* sprite with host state */ host->sSprite = CreateTextSprite (stateText[*pState], (x + 1) * BASE_X, y * BASE_Y, 9 * BASE_X, CELL_H * BASE_Y, FF_HOST_STATE_NO_FOCUS, SPM_MAPPED); /* sprite with state request */ host->lSprite = NULL; /* sprite with requests */ host->rSprite = NULL; /* graphics */ MenuAddLargeFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &host->item; } /* MenuCreateServer */ /********************* * generic team item * *********************/ /* * team receives focus */ static void MenuTeamFocus (XBMenuItem * ptr, XBBool flag) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team->focusFunc); (*team->focusFunc) (team->id, team->player); MenuTeamFocusShared (ptr, flag); } /* MenuTeamFocus */ /* * team item is selected */ static void MenuTeamSelect (XBMenuItem * ptr) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team); /* first local request, init to current, if necessary */ if (team->lTeam == XBTS_Invalid) { team->lTeam = team->cTeam; } /* get next reasonable local request */ if ((*team->chgFunc) (team->id, team->player, &team->lTeam)) { assert (team->lTeam < NUM_XBTS); /* no display if equal to current or invalid */ #ifdef REQUESTS if (team->cTeam == team->lTeam || team->lTeam == XBTS_Invalid) { SetSpriteText (team->lSprite, ""); } else { SetSpriteText (team->lSprite, teamText[team->lTeam]); } #endif } } /* MenuTeamSelect */ /* * team item mouse event */ static void MenuTeamMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuTeamSelect (ptr); } } /* MenuTeamMouse */ /* * polling a team item */ static void MenuTeamPoll (XBMenuItem * ptr) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; #ifdef REQUESTS unsigned i; #endif assert (NULL != team); assert (NULL != team->upFunc); /* update team data */ if ((*team->upFunc) (team->id, team->player, &team->cTeam, team->cTeamReq)) { assert (team->cTeam < NUM_XBTS); /* reset local request if state invalid */ if (team->cTeam == XBTS_Invalid) { team->lTeam = XBTS_Invalid; } /* update state */ SetSpriteText (team->sSprite, teamText[team->cTeam]); /* check if local request needs to be cleared */ if (team->cTeam == team->lTeam) { SetSpriteText (team->lSprite, ""); } /* update requests */ #ifdef REQUESTS for (i = 0; i < MAX_HOSTS; i++) { team->tRequests[i] = *teamText[team->cTeamReq[i]]; } team->tRequests[MAX_HOSTS] = (char)0; SetSpriteText (team->rSprite, team->tRequests); #endif } } /* MenuTeamPoll */ /* * create team item */ XBMenuItem * MenuCreateTeam (int x, int y, int w, unsigned id, unsigned player, XBTSFocusFunc focusFunc, XBTSChangeFunc chgFunc, XBTSUpdateFunc upFunc) { /* create item */ XBMenuTeamItem *team = calloc (1, sizeof (*team)); assert (team != NULL); MenuSetItem (&team->item, MIT_Team, x, y, w, CELL_H, MenuTeamFocus, MenuTeamSelect, MenuTeamMouse, MenuTeamPoll); /* store id, player */ team->id = id; team->player = player; /* set handler */ team->focusFunc = focusFunc; team->chgFunc = chgFunc; team->upFunc = upFunc; /* team state */ team->cTeam = XBTS_Invalid; team->sSprite = CreateTextSprite (teamText[team->cTeam], (x + 1) * BASE_X, y * BASE_Y, w / 4 * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_FOCUS, SPM_MAPPED); /* team state request */ team->lTeam = XBTS_Invalid; team->lSprite = CreateTextSprite (teamText[team->lTeam], (x + w / 4) * BASE_X, y * BASE_Y, w / 4 * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_FOCUS, SPM_MAPPED); /* team requests */ memset (team->cTeamReq, 0, sizeof (team->cTeamReq)); team->tRequests[0] = (char)0; team->rSprite = CreateTextSprite (team->tRequests, (x + w / 2) * BASE_X, y * BASE_Y, (w / 2 - 1) * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_FOCUS, SPM_MAPPED); /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); /* poll once */ MenuTeamPoll (&team->item); return &team->item; } /* MenuCreateTeam */ /************************ * team item for a peer * ************************/ /* * team receives focus */ static void MenuPeerTeamFocus (XBMenuItem * ptr, XBBool flag) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team); assert (NULL != team->sSprite); SetSpriteAnime (team->sSprite, flag ? FF_HOST_NAME_FOCUS : FF_HOST_NAME_NO_FOCUS); } /* MenuPeerTeamFocus */ /* * peer team item selcted */ static void MenuPeerTeamSelect (XBMenuItem * ptr) { } /* MenuPeerTeamSelect */ /* * peer team item mouse event */ static void MenuPeerTeamMouse (XBMenuItem * ptr, XBEventCode code) { } /* MenuPeerTeamMouse */ /* * polling a team item */ static void MenuPeerTeamPoll (XBMenuItem * ptr) { MenuTeamPollShared (ptr); } /* MenuPeerTeamPoll */ /* * create team item for a peer */ XBMenuItem * MenuCreatePeerTeam (int x, int y, int w, XBTeamState * pTeam) { /* create item */ XBMenuTeamItem *team = calloc (1, sizeof (*team)); assert (team != NULL); MenuSetItem (&team->item, MIT_Team, x, y, w, CELL_H, MenuPeerTeamFocus, MenuPeerTeamSelect, MenuPeerTeamMouse, MenuPeerTeamPoll); /* set server specific data */ assert (pTeam != NULL); team->pTeam = pTeam; team->cTeam = *pTeam; /* sprite with team state */ team->sSprite = CreateTextSprite (teamText[*pTeam], (x + 1) * BASE_X, y * BASE_Y, (w - 2) * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_FOCUS, SPM_MAPPED); /* sprite with team requests */ team->lSprite = NULL; /* sprite with team requests */ team->rSprite = NULL; /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &team->item; } /* MenuCreateTeam */ /************************ * team item for server * ************************/ /* * team receives focus */ static void MenuServerTeamFocus (XBMenuItem * ptr, XBBool flag) { MenuTeamFocusShared (ptr, flag); } /* MenuServerTeamFocus */ /* * team item is selected */ static void MenuServerTeamSelect (XBMenuItem * ptr) { XBMenuTeamItem *team = (XBMenuTeamItem *) ptr; assert (NULL != team); assert (NULL != team->pTeam); if (*team->pTeam < NUM_XBTS - 1) { *team->pTeam = *team->pTeam + 1; } else { *team->pTeam = 2; } } /* MenuTeamSelect */ /* * team item mouse event */ static void MenuServerTeamMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuServerTeamSelect (ptr); } } /* MenuTeamMouse */ /* * polling a team item */ static void MenuServerTeamPoll (XBMenuItem * ptr) { MenuTeamPollShared (ptr); } /* MenuServerTeamPoll */ /* * create team item for server */ XBMenuItem * MenuCreateServerTeam (int x, int y, int w, XBTeamState * pTeam) { /* create item */ XBMenuTeamItem *team = calloc (1, sizeof (*team)); assert (team != NULL); MenuSetItem (&team->item, MIT_Team, x, y, w, CELL_H, MenuServerTeamFocus, MenuServerTeamSelect, MenuServerTeamMouse, MenuServerTeamPoll); /* set server specific data */ assert (pTeam != NULL); team->pTeam = pTeam; team->cTeam = *pTeam; /* sprite with team state */ team->sSprite = CreateTextSprite (teamText[*pTeam], (x + 1) * BASE_X, y * BASE_Y, (w - 2) * BASE_X, (CELL_H / 2) * BASE_Y, FF_HOST_NAME_FOCUS, SPM_MAPPED); /* sprite with current team request */ team->lSprite = NULL; /* sprite with team requests */ team->rSprite = NULL; /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &team->item; } /* MenuCreateTeam */ /*************** * destructors * ***************/ /* * delete a host item */ void MenuDeleteHost (XBMenuItem * item) { XBMenuHostItem *host = (XBMenuHostItem *) item; assert (NULL != host); assert (NULL != host->tSprite); assert (NULL != host->sSprite); DeleteSprite (host->tSprite); DeleteSprite (host->sSprite); if (NULL != host->pSprite) { DeleteSprite (host->pSprite); } if (NULL != host->rSprite) { DeleteSprite (host->rSprite); } if (NULL != host->lSprite) { DeleteSprite (host->lSprite); } } /* MenuDeleteHost */ /* * delete a team item */ void MenuDeleteTeam (XBMenuItem * item) { XBMenuTeamItem *team = (XBMenuTeamItem *) item; assert (NULL != team); assert (NULL != team->sSprite); DeleteSprite (team->sSprite); if (NULL != team->rSprite) { DeleteSprite (team->rSprite); } if (NULL != team->lSprite) { DeleteSprite (team->lSprite); } } /* MenuDeleteTeam */ /* * end of file mi_host.c */ xblast-2.10.4/mi_host.h0000644000175000017500000000371510372731124014031 0ustar rhondaalfie/* * file mi_host.h - Menu item for host selection in networked games * * $Id: mi_host.h,v 1.9 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MI_HOST_H #define XBLAST_MI_HOST_H /* * global prototypes */ extern XBMenuItem *MenuCreateHost (int x, int y, int w, unsigned client, const char **pText, XBHSFocusFunc focusFunc, XBHSChangeFunc chgFunc, XBHSUpdateFunc upFunc); extern XBMenuItem *MenuCreateServer (int x, int y, int w, const char **pText); extern XBMenuItem *MenuCreateClient (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing); extern XBMenuItem *MenuCreatePeer (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing); extern XBMenuItem *MenuCreateTeam (int x, int y, int w, unsigned id, unsigned player, XBTSFocusFunc focusFunc, XBTSChangeFunc chgFunc, XBTSUpdateFunc upFunc); extern XBMenuItem *MenuCreateServerTeam (int x, int y, int w, XBTeamState * pTeam); extern XBMenuItem *MenuCreatePeerTeam (int x, int y, int w, XBTeamState * pTeam); extern void MenuDeleteHost (XBMenuItem * item); extern void MenuDeleteTeam (XBMenuItem * item); #endif /* * end of file mi_host.h */ xblast-2.10.4/mi_int.c0000644000175000017500000001327610372731124013644 0ustar rhondaalfie/* * file mi_int.c - Mmenu item for editing integers * * $Id: mi_int.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define BLINK_RATE 8 #define FF_TEXT_FOCUS (FF_Medium | FF_Black | FF_Left | FF_Outlined) #define FF_TEXT_NO_FOCUS (FF_Medium | FF_White | FF_Left) #define FF_VALUE_SELECT (FF_Medium | FF_Black | FF_Left | FF_Boxed) #define FF_VALUE_NO_SELECT (FF_Medium | FF_White | FF_Left | FF_Boxed) /* * local types */ typedef struct { XBMenuItem item; const char *text; int *pValue; int min; int max; char work[20]; size_t pos; Sprite *lSprite; Sprite *eSprite; int pollCount; } XBMenuIntegerItem; /* * a string item receives the focus */ static void MenuIntegerFocus (XBMenuItem * ptr, XBBool flag) { XBMenuIntegerItem *string = (XBMenuIntegerItem *) ptr; assert (string != NULL); assert (string->lSprite != NULL); SetSpriteAnime (string->lSprite, flag ? FF_TEXT_FOCUS : FF_TEXT_NO_FOCUS); } /* MenuIntegerFocus */ /* * Menu Integer Item */ static void MenuIntegerPoll (XBMenuItem * ptr) { XBMenuIntegerItem *string = (XBMenuIntegerItem *) ptr; assert (string != NULL); string->pollCount++; if ((string->item.flags & MIF_SELECTED) && (0 == (string->pollCount % BLINK_RATE))) { if (0 == (string->pollCount % (2 * BLINK_RATE))) { SetSpriteAnime (string->eSprite, FF_VALUE_SELECT | FF_Cursor); } else { SetSpriteAnime (string->eSprite, FF_VALUE_SELECT); } } } /* MenuIntegerPoll */ /* * event handling while string is selected */ static void IntegerEventLoop (XBMenuItem * ptr) { XBEventCode event; XBEventData data; XBMenuIntegerItem *integer = (XBMenuIntegerItem *) ptr; assert (integer != NULL); assert (integer->eSprite != NULL); integer->item.flags |= MIF_SELECTED; SetSpriteAnime (integer->eSprite, FF_VALUE_SELECT); GUI_SetKeyboardMode (KB_ASCII); /* event loop */ while (1) { /* update window contents */ MenuUpdateWindow (); /* get event from gui */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { if (event == XBE_ASCII) { /* add a character if it a digit */ if (isdigit (data.value) && integer->pos < sizeof (integer->work) - 1) { integer->work[integer->pos++] = (char)data.value; integer->work[integer->pos] = 0; } SetSpriteText (integer->eSprite, integer->work); } else if (event == XBE_CTRL) { /* control key */ switch (data.value) { /* delete last character */ case XBCK_BACKSPACE: if (integer->pos > 0) { integer->work[--integer->pos] = 0; SetSpriteText (integer->eSprite, integer->work); } break; /* accept value if correct */ case XBCK_RETURN: if (1 == sscanf (integer->work, "%d", integer->pValue) && *integer->pValue >= integer->min && *integer->pValue <= integer->max) { goto Finish; } break; /* reject value */ case XBCK_ESCAPE: sprintf (integer->work, "%d", *integer->pValue); integer->pos = strlen (integer->work); goto Finish; default: break; } } } } Finish: integer->item.flags &= ~MIF_SELECTED; SetSpriteText (integer->eSprite, integer->work); SetSpriteAnime (integer->eSprite, FF_VALUE_NO_SELECT); GUI_SetKeyboardMode (KB_MENU); return; } /* IntegerEventLoop */ /* * mouse click */ static void MenuIntegerMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { IntegerEventLoop (ptr); } } /* MenuIntegerMouse */ /* * */ XBMenuItem * MenuCreateInteger (int x, int y, int w, const char *text, int wEdit, int *pValue, int min, int max) { XBMenuIntegerItem *integer; assert (w - wEdit > 0); assert (pValue != NULL); /* create item */ integer = calloc (1, sizeof (*integer)); assert (NULL != integer); MenuSetItem (&integer->item, MIT_Integer, x, y, w, CELL_H, MenuIntegerFocus, IntegerEventLoop, MenuIntegerMouse, MenuIntegerPoll); /* set label */ integer->text = text; integer->lSprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - wEdit - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_TEXT_NO_FOCUS, SPM_MAPPED); /* create work buffer */ sprintf (integer->work, "%d", *pValue); integer->pValue = pValue; integer->min = min; integer->max = max; integer->pos = strlen (integer->work); /* create editor */ integer->eSprite = CreateTextSprite (integer->work, (x + w - wEdit + 1) * BASE_X, (y + 2) * BASE_Y, (wEdit - 2) * BASE_X, (CELL_H - 4) * BASE_Y, FF_VALUE_NO_SELECT, SPM_MAPPED); /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); /* that's all */ return &integer->item; } /* CreateMenuInteger */ /* * delete a integer */ void MenuDeleteInteger (XBMenuItem * item) { XBMenuIntegerItem *integer = (XBMenuIntegerItem *) item; assert (integer->lSprite != NULL); assert (integer->eSprite != NULL); DeleteSprite (integer->lSprite); DeleteSprite (integer->eSprite); } /* DeleteComboItem */ /* * end of file mi_int.c */ xblast-2.10.4/mi_int.h0000644000175000017500000000222510372731124013641 0ustar rhondaalfie/* * file mi_int.h - Mmenu item for editing integers * * $Id: mi_int.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_INT_H #define _MI_INT_H /* * global prototypes */ extern XBMenuItem *MenuCreateInteger (int x, int y, int w_text, const char *text, int w, int *pValue, int min, int max); extern void MenuDeleteInteger (XBMenuItem *); #endif /* * end of file mi_int.h */ xblast-2.10.4/mi_keysym.c0000644000175000017500000001161310372731124014364 0ustar rhondaalfie/* * file mi_keysym.c - menu item for configuring key controls * * $Id: mi_keysym.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define FF_TEXT_FOCUS (FF_Medium | FF_Black | FF_Left | FF_Outlined) #define FF_TEXT_NO_FOCUS (FF_Medium | FF_White | FF_Left) #define FF_VALUE_SELECT (FF_Medium | FF_Black | FF_Center | FF_Boxed ) #define FF_VALUE_NO_SELECT (FF_Medium | FF_White | FF_Center | FF_Boxed ) /* * local types */ typedef struct { XBMenuItem item; const char *text; char *keyText; XBAtom key; XBAtom *pKey; Sprite *textSprite; Sprite *keySprite; } XBMenuKeysymItem; /* * a combo item receives the focus */ static void MenuKeysymFocus (XBMenuItem * ptr, XBBool flag) { XBMenuKeysymItem *keysym = (XBMenuKeysymItem *) ptr; assert (keysym != NULL); assert (keysym->textSprite != NULL); SetSpriteAnime (keysym->textSprite, flag ? FF_TEXT_FOCUS : FF_TEXT_NO_FOCUS); } /* MenuKeysymFocus */ /* * event handling whiule combo is selected */ static void KeysymEventLoop (XBMenuItem * ptr) { XBEventCode event; XBEventData data; XBMenuKeysymItem *keysym = (XBMenuKeysymItem *) ptr; assert (keysym != NULL); assert (keysym->keySprite != NULL); SetSpriteAnime (keysym->keySprite, FF_VALUE_SELECT); SetSpriteText (keysym->keySprite, "???"); /* event loop */ GUI_SetKeyboardMode (KB_KEYSYM); while (1) { /* update window contents */ MenuUpdateWindow (); /* get event from gui */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { if (event == XBE_KEYSYM) { if (ATOM_INVALID == data.atom) { /* delete symbol */ keysym->key = ATOM_INVALID; *keysym->pKey = ATOM_INVALID; if (NULL != keysym->keyText) { free (keysym->keyText); keysym->keyText = NULL; } } else if (data.atom != keysym->key) { /* get new keysym */ keysym->key = data.atom; *keysym->pKey = data.atom; if (NULL != keysym->keyText) { free (keysym->keyText); } keysym->keyText = DupString (GUI_AtomToString (keysym->key)); } /* leave edit mode */ GUI_SetKeyboardMode (KB_MENU); SetSpriteAnime (keysym->keySprite, FF_VALUE_NO_SELECT); SetSpriteText (keysym->keySprite, keysym->keyText); return; } } } } /* ComboEventLoop */ /* * handle mouse click */ static void MenuKeysymMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { KeysymEventLoop (ptr); } } /* MenuKeysymMouse */ /* * create menu item */ XBMenuItem * MenuCreateKeysym (int x, int y, int w, const char *text, XBAtom * pKey) { XBMenuKeysymItem *keysym; assert (pKey != NULL); /* create item */ keysym = calloc (1, sizeof (*keysym)); assert (keysym != NULL); MenuSetItem (&keysym->item, MIT_Keysym, x, y, w, CELL_H, MenuKeysymFocus, KeysymEventLoop, MenuKeysymMouse, NULL); /* set specific data */ keysym->text = text; keysym->pKey = pKey; keysym->key = *pKey; if (ATOM_INVALID != *pKey) { keysym->keyText = DupString (GUI_AtomToString (*pKey)); assert (keysym->keyText != NULL); } else { keysym->keyText = NULL; } /* create sprites */ keysym->textSprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - 5 * CELL_W / 2 - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_TEXT_NO_FOCUS, SPM_MAPPED); assert (keysym->textSprite); keysym->keySprite = CreateTextSprite (keysym->keyText, (x + w - 5 * CELL_W / 2 + 1) * BASE_X, (y + 2) * BASE_Y, (5 * CELL_W / 2 - 2) * BASE_X, (CELL_H - 4) * BASE_Y, FF_VALUE_NO_SELECT, SPM_MAPPED); assert (keysym->keySprite); /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); /* that's all */ return &keysym->item; } /* MenuCreateKeysym */ /* * delete item */ void MenuDeleteKeysym (XBMenuItem * item) { XBMenuKeysymItem *keysym = (XBMenuKeysymItem *) item; assert (NULL != keysym); assert (NULL != keysym->textSprite); assert (NULL != keysym->keySprite); DeleteSprite (keysym->textSprite); DeleteSprite (keysym->keySprite); if (NULL != keysym->keyText) { free (keysym->keyText); } } /* MenuDeleteKeysym */ /* * end of file mi_keysym.h */ xblast-2.10.4/mi_keysym.h0000644000175000017500000000221010372731124014362 0ustar rhondaalfie/* * file mi_keysym.h - menu item for configuring key controls * * $Id: mi_keysym.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_KEYSYM_H #define _MI_KEYSYM_H /* * global prototypes */ extern XBMenuItem *MenuCreateKeysym (int x, int y, int w, const char *text, XBAtom * pKey); extern void MenuDeleteKeysym (XBMenuItem * item); #endif /* * end of file mi_keysym.h */ xblast-2.10.4/mi_label.c0000644000175000017500000000627010372731124014125 0ustar rhondaalfie/* * file mi_label.c - menu title * * $Id: mi_label.c,v 1.8 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define FF_LABEL (FF_Large | FF_White | FF_Center | FF_Boxed ) #define FF_LABEL1 (FF_Small | FF_White | FF_Center ) #define FF_LABEL2 (FF_Small | FF_White | FF_Center | FF_Boxed ) /* * local types */ typedef struct { XBMenuItem item; const char *text; Sprite *sprite; } XBMenuLabelItem; /* * standard label, boxed, large */ XBMenuItem * MenuCreateLabel (int x, int y, int w, const char *text) { /* create item */ XBMenuLabelItem *label = calloc (1, sizeof (XBMenuLabelItem)); assert (label != NULL); MenuSetItem (&label->item, MIT_Label, x, y, w, CELL_H, NULL, NULL, NULL, NULL); /* set item specific data */ label->text = text; label->sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_LABEL, SPM_MAPPED); return &label->item; } /* MenuCreateLabel */ /* * variant label, framed. small */ XBMenuItem * MenuCreateLabel1 (int x, int y, int w, const char *text) { /* create item */ XBMenuLabelItem *label = calloc (1, sizeof (XBMenuLabelItem)); assert (label != NULL); MenuSetItem (&label->item, MIT_Label, x, y, w, CELL_H, NULL, NULL, NULL, NULL); /* set item specific data */ label->text = text; label->sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y + 6, (w - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_LABEL1, SPM_MAPPED); /* add frame */ MenuAddLargeFrame (x / CELL_W, (x + w - 1) / CELL_W, (y + 1) / CELL_H); return &label->item; } /* MenuCreateLabel1 */ /* * variant label, boxed, small */ XBMenuItem * MenuCreateLabel2 (int x, int y, int w, const char *text) { /* create item */ XBMenuLabelItem *label = calloc (1, sizeof (XBMenuLabelItem)); assert (label != NULL); MenuSetItem (&label->item, MIT_Label, x, y, w, CELL_H, NULL, NULL, NULL, NULL); /* set item specific data */ label->text = text; label->sprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y + 6, (w - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_LABEL2, SPM_MAPPED); return &label->item; } /* MenuCreateLabel2 */ /* * delete a label */ void MenuDeleteLabel (XBMenuItem * item) { XBMenuLabelItem *label = (XBMenuLabelItem *) item; assert (label != NULL); assert (label->sprite != NULL); DeleteSprite (label->sprite); } /* MenuDeleteLabel */ /* * end of file mi_label.c */ xblast-2.10.4/mi_label.h0000644000175000017500000000234610372731124014132 0ustar rhondaalfie/* * file mi_label.h - titles for menus * * $Id: mi_label.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MI_LABEL_H #define XBLAST_MI_LABEL_H extern XBMenuItem *MenuCreateLabel (int x, int y, int w, const char *text); extern XBMenuItem *MenuCreateLabel1 (int x, int y, int w, const char *text); extern XBMenuItem *MenuCreateLabel2 (int x, int y, int w, const char *text); extern void MenuDeleteLabel (XBMenuItem * item); #endif /* * end of file mi_label.h */ xblast-2.10.4/mi_map.c0000644000175000017500000001417210372731124013623 0ustar rhondaalfie/* * file mi_map.c - background for menus * * $Id: mi_map.c,v 1.7 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ /* graphics */ static BMBlockTile menuBlockTile[MENU_MAX_TILE] = { /* 0 */ {"score_floor", COLOR_BLACK, COLOR_SPRING_GREEN, COLOR_BLACK}, /* 1 */ {"score_right_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_BLACK}, /* 2 */ {"menu_left_up", COLOR_BLACK, COLOR_LIGHT_STEEL_BLUE, COLOR_SPRING_GREEN}, /* 3 */ {"menu_right_up", COLOR_BLACK, COLOR_LIGHT_STEEL_BLUE, COLOR_SPRING_GREEN}, /* 4 */ {"score_pipe_end", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_SPRING_GREEN}, /* 5 */ {"menu_left_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_STEEL_BLUE}, /* 6 */ {"menu_right_down", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_STEEL_BLUE}, /* 7 */ {"score_right_up", COLOR_BLACK, COLOR_LIGHT_STEEL_BLUE, COLOR_BLACK}, /* 8 */ {"score_pipe_mid", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_BLACK}, /* 9 */ {"score_pipe_begin", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_BLACK}, /* 10 */ {"menu_left", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 11 */ {"menu_center", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 12 */ {"menu_right", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 13 */ {"menu_list_center", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 14 */ {"menu_list_join", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 15 */ {"menu_list_left", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 16 */ {"menu_list_right", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 17 */ {"menu_join", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 18 */ {"menu_top", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 19 */ {"menu_vertical", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, /* 20 */ {"menu_bottom", COLOR_BLACK, COLOR_FIRE_BRICK_1, COLOR_LIGHT_GOLDENROD}, }; /* default layout for menu */ static int map[MAZE_H + 1][MAZE_W]; static int defaultMap[MAZE_H][MAZE_W] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 2, 7, 7, 7, 7, 7, 3, 0, 0, 0, 0,}, {7, 7, 7, 7, 5, 1, 1, 1, 1, 1, 6, 7, 7, 7, 7,}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,}, {9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,}, {8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,}, }; /* * load graphics for menu */ void MenuLoadTiles (void) { int i; for (i = 0; i < MENU_MAX_TILE; i++) { GUI_LoadBlockCch (i, menuBlockTile[i].name, menuBlockTile[i].fg, menuBlockTile[i].bg, menuBlockTile[i].add); } } /* MenuUnloadTiles */ /* * unload graphics for menu */ void MenuUnloadTiles (void) { int i; for (i = 0; i < MENU_MAX_TILE; i++) { GUI_FreeBlock (i); } } /* MenuUnloadTiles */ /* * clear current map for menus */ void MenuClearMap (void) { int x, y; /* copy default for(y=0;ycntAnime >= 0) { /* get next animation phase */ int anime = player->anime[player->cntAnime++]; /* load if not yet loaded */ if (0 == (player->animeMask & (1 << anime))) { GUI_LoadPlayerSprite (player->id, anime, player->oldConfig); player->animeMask |= (1 << anime); } /* choose sprite */ SetSpriteAnime (player->sprite, anime); if (player->numAnime > 0) { /* loop animation for positive num count */ if (player->cntAnime >= player->numAnime) { player->cntAnime = 0; } } else { /* single animation for negative num ocunt */ if (player->cntAnime >= -player->numAnime) { player->cntAnime = -1; } } } } /* AnimatePlayerItem */ /* * polling a player item */ static void MenuPlayerPoll (XBMenuItem * ptr) { XBMenuPlayerItem *player = (XBMenuPlayerItem *) ptr; assert (player != NULL); /* check if player data defined at all */ if (*(player->ptrConfig) == NULL) { SetSpriteMode (player->sprite, SPM_UNMAPPED); player->oldConfig = NULL; player->cntAnime = -1; return; } /* check if pointer to graphics data changed */ if (*(player->ptrConfig) != player->oldConfig) { SetSpriteMode (player->sprite, SPM_UNMAPPED); player->oldConfig = *(player->ptrConfig); player->oldTeam = player->oldConfig->bodySave; player->animeMask = 0; player->cntAnime = 0; SetSpriteMode (player->sprite, SPM_MAPPED); } /* check if body color has changed */ if (player->oldConfig->body != player->oldTeam) { SetSpriteMode (player->sprite, SPM_UNMAPPED); player->oldTeam = player->oldConfig->body; player->animeMask = 0; player->cntAnime = 0; if (player->oldTeam != COLOR_INVALID) { SetSpriteMode (player->sprite, SPM_MAPPED); } } AnimatePlayerItem (ptr); } /* MenuPlayerPoll */ /* * polling a config player item */ static void MenuConfigPlayerPoll (XBMenuItem * ptr) { XBMenuPlayerItem *player = (XBMenuPlayerItem *) ptr; assert (player != NULL); /* check if rgb has changed */ if (memcmp (player->pRgb, &player->currentRgb, sizeof (XBRgbValue)) != 0 || player->oldConfig->shape != player->currentShape) { SetSpriteMode (player->sprite, SPM_UNMAPPED); player->currentRgb = *(player->pRgb); player->currentShape = player->oldConfig->shape; player->animeMask = 0; player->cntAnime = 0; SetSpriteMode (player->sprite, SPM_MAPPED); } AnimatePlayerItem (ptr); } /* MenuConfigPlayerPoll */ /* * create a player item */ XBMenuItem * MenuCreatePlayer (int x, int y, int w, int id, const CFGPlayerGraphics ** ptrConfig, int numAnime, BMSpriteAnimation * anime) { XBMenuPlayerItem *player; assert (ptrConfig != NULL); assert (anime != NULL); /* create item */ player = calloc (1, sizeof (*player)); assert (player != NULL); MenuSetItem (&player->item, MIT_Player, x, y, w, 2 * CELL_H, NULL, NULL, NULL, MenuPlayerPoll); /* set player specific data */ player->id = id; player->ptrConfig = ptrConfig; player->oldConfig = NULL; player->oldTeam = COLOR_INVALID; player->sprite = CreatePlayerSprite (id, (x + (CELL_W - w) / 2) * BASE_X, (y - 1) * BASE_Y, SpriteStopDown, SPM_UNMAPPED); player->cntAnime = -1; player->numAnime = numAnime; player->anime = anime; player->animeMask = 0; /* that's all */ return &player->item; } /* MenuCreateMenuPlayer */ /* * create a config player item */ XBMenuItem * MenuCreateConfigPlayer (int x, int y, int w, int id, const CFGPlayerGraphics ** ptrConfig, int numAnime, BMSpriteAnimation * anime, XBRgbValue * pRgb) { XBMenuPlayerItem *player; assert (ptrConfig != NULL); assert (anime != NULL); /* create item */ player = calloc (1, sizeof (*player)); assert (player != NULL); MenuSetItem (&player->item, MIT_Player, x, y, w, 2 * CELL_H, NULL, NULL, NULL, MenuConfigPlayerPoll); /* set player specific data */ player->id = id; player->currentRgb = *pRgb; player->currentRgb.red += 1; player->pRgb = pRgb; player->currentShape = ATOM_INVALID; player->ptrConfig = ptrConfig; player->oldConfig = *ptrConfig; player->oldTeam = COLOR_INVALID; player->sprite = CreatePlayerSprite (id, (x + (CELL_W - w) / 2) * BASE_X, (y - 1) * BASE_Y, SpriteStopDown, SPM_UNMAPPED); player->cntAnime = -1; player->numAnime = numAnime; player->anime = anime; player->animeMask = 0; /* that's all */ return &player->item; } /* MenuCreateConfigPlayer */ /* * delete a player */ void MenuDeletePlayer (XBMenuItem * item) { XBMenuPlayerItem *player = (XBMenuPlayerItem *) item; assert (player->sprite != NULL); DeleteSprite (player->sprite); } /* DeletePlayerItem */ /* * end of file mi_player.c */ xblast-2.10.4/mi_player.h0000644000175000017500000000254710372731124014352 0ustar rhondaalfie/* * file mi_player.h - * * $Id: mi_player.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_PLAYER_H #define _MI_PLAYER_H /* * global prototypes */ extern XBMenuItem *MenuCreatePlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int nAnime, BMSpriteAnimation * anime); extern XBMenuItem *MenuCreateConfigPlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int nAnime, BMSpriteAnimation * anime, XBRgbValue * pRgb); extern void MenuDeletePlayer (XBMenuItem * item); #endif /* * end of file mi_player.h */ xblast-2.10.4/mi_stat.c0000644000175000017500000003545410374175532014036 0ustar rhondaalfie/* * file mi_stat.c - menu item for displaying game table * * $Id: mi_stat.c,v 1.10 2006/02/13 21:34:18 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* text sprite flags */ #define FF_TABLE_FOCUS (FF_Small | FF_Black | FF_Outlined ) #define FF_TABLE_NO_FOCUS (FF_Small | FF_White ) #define FF_TABLE_INACTIVE (FF_Small | FF_Black ) /* * local types */ typedef struct { char *text; /* text to be displayed */ Sprite *sprite; /* sprite for it */ unsigned align; /* text alignment */ } TableCell; typedef struct _xb_menu_table_item XBMenuTableItem; typedef void (*TablePollFunc) (XBMenuTableItem *, const void *); struct _xb_menu_table_item { XBMenuItem item; size_t numCells; TableCell *cell; MIC_button func; void *funcData; TablePollFunc pollFunc; const void **pollPtr; const void *pollData; }; /* * determine current text flags */ static void SetTextFlags (XBMenuTableItem * table) { size_t i; unsigned flags; /* sanity check */ assert (NULL != table); assert (NULL != table->cell); /* get new flags */ if (table->item.flags & MIF_FOCUS) { flags = FF_TABLE_FOCUS; } else if (table->item.flags & MIF_DEACTIVATED) { flags = FF_TABLE_INACTIVE; } else { flags = FF_TABLE_NO_FOCUS; } /* change in all cells */ for (i = 0; i < table->numCells; i++) { assert (table->cell[i].sprite != NULL); SetSpriteAnime (table->cell[i].sprite, table->cell[i].align | flags); } } /* SetTextFlags */ /* * table has changed activation */ void MenuActivateTable (XBMenuItem * ptr, XBBool flag) { SetTextFlags ((XBMenuTableItem *) ptr); } /* MenuActivateTable */ /* * a horizontal table receives the focus */ static void MenuTableFocus (XBMenuItem * ptr, XBBool flag) { SetTextFlags ((XBMenuTableItem *) ptr); } /* MenuHTableFocus */ /* * a table is selected */ static void MenuTableSelect (XBMenuItem * ptr) { XBMenuTableItem *table = (XBMenuTableItem *) ptr; assert (ptr != NULL); MenuExecFunc (table->func, table->funcData); } /* MenuTableSelect */ /* * table was selected by mouse */ static void MenuTableMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuTableSelect (ptr); } } /* MenuTableMouse */ /* * poll function */ static void MenuTablePoll (XBMenuItem * ptr) { XBMenuTableItem *table = (XBMenuTableItem *) ptr; /* check if poll data has changed */ if (table->pollPtr != NULL && *table->pollPtr != table->pollData) { assert (table->pollFunc != NULL); table->pollData = *table->pollPtr; (*table->pollFunc) (table, table->pollData); } } /* MenuTablePoll */ /* * genric constructor for table item */ static XBMenuTableItem * CreateTableItem (int x, int y, int w, MIC_button func, void *funcData, TablePollFunc pollFunc, const void **pollPtr, int num) { /* create item */ XBMenuTableItem *table = calloc (1, sizeof (XBMenuTableItem)); assert (table != NULL); MenuSetItem (&table->item, MIT_Table, x, y, w, CELL_H, MenuTableFocus, MenuTableSelect, MenuTableMouse, (NULL != pollFunc) ? MenuTablePoll : NULL); /* cell sprites */ table->numCells = num; table->cell = calloc (num, sizeof (TableCell)); assert (NULL != table->cell); /* callback */ table->func = func; table->funcData = funcData; /* polling */ table->pollFunc = pollFunc; table->pollPtr = pollPtr; table->pollData = NULL; /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); /* that's all */ return table; } /* CreateTableItem */ /* * update table cell */ static void UpdateTableCell (XBMenuTableItem * table, size_t cell, const char *fmt, ...) { va_list argList; char tmp[512]; /* sanity checks */ assert (NULL != table); assert (NULL != table->cell); assert (cell < table->numCells); assert (NULL != table->cell[cell].text); assert (NULL != table->cell[cell].sprite); assert (NULL != fmt); /* format string */ va_start (argList, fmt); vsprintf (tmp, fmt, argList); va_end (argList); /* set values */ free (table->cell[cell].text); table->cell[cell].text = DupString (tmp); assert (NULL != table->cell[cell].text); SetSpriteText (table->cell[cell].sprite, table->cell[cell].text); } /* UpdateTableCell */ /* * set table cell */ static void SetTableCell (XBMenuTableItem * table, size_t cell, unsigned align, int x, int w, const char *fmt, ...) { va_list argList; char tmp[256]; /* sanity checks */ assert (NULL != table); assert (NULL != table->cell); assert (cell < table->numCells); assert (NULL != fmt); assert (0 == (align & ~(FM_Align | FM_Boxed))); /* format string */ va_start (argList, fmt); vsprintf (tmp, fmt, argList); va_end (argList); /* set values */ table->cell[cell].text = DupString (tmp); table->cell[cell].align = align; table->cell[cell].sprite = CreateTextSprite (table->cell[cell].text, BASE_X * (table->item.x + x), BASE_Y * table->item.y, BASE_X * w, (CELL_H / 2) * BASE_Y, FF_TABLE_NO_FOCUS | align, SPM_MAPPED); /* checks */ assert (NULL != table->cell[cell].text); assert (NULL != table->cell[cell].sprite); } /* SetTableCell */ /* * poll routine for game entries */ static void PollGameEntry (XBMenuTableItem * table, const void *ptr) { const XBNetworkGame *game = ptr; /* update cell texts */ if (NULL != game) { UpdateTableCell (table, 0, "%s", game->game); UpdateTableCell (table, 1, "%s:%hu", game->host, game->port); UpdateTableCell (table, 2, "%d ms", game->ping); UpdateTableCell (table, 3, "%s", game->version); UpdateTableCell (table, 4, "%d", game->numLives); UpdateTableCell (table, 5, "%d", game->numWins); UpdateTableCell (table, 6, "%d", game->frameRate); } else { size_t i; for (i = 0; i < table->numCells; i++) { UpdateTableCell (table, i, ""); } } } /* PollGameEntry */ /* * create a score stat entry */ XBMenuItem * MenuCreateStatEntry (int x, int y, int w, const XBStatData * data, MIC_button func, void *funcData) { XBMenuTableItem *table = CreateTableItem (x, y, w, func, funcData, NULL, NULL, 6); /* set cells ... */ assert (data != NULL); if (data->name != NULL) { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), data->name); } else { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), GUI_AtomToString (data->atom)); } SetTableCell (table, 1, FF_Right, w - 1 - 12 * CELL_W / 2, CELL_W, "%6.1f", data->scoreTotal); SetTableCell (table, 2, FF_Right, w - 1 - 10 * CELL_W / 2, 3 * CELL_W / 2, "%6.3f", data->average); SetTableCell (table, 3, FF_Right, w - 1 - 7 * CELL_W / 2, CELL_W, "%d", data->numWon); SetTableCell (table, 4, FF_Right, w - 1 - 5 * CELL_W / 2, 3 * CELL_W / 2, "%5.2f%%", data->percent); SetTableCell (table, 5, FF_Right, w - 1 - 2 * CELL_W / 2, CELL_W, "%d", data->numTotal); /* --- */ return &table->item; } /* MenuCreateStatEntry */ /* * create header for stat entry table */ XBMenuItem * MenuCreateStatHeader (int x, int y, int w, const char *title) { XBMenuTableItem *table = CreateTableItem (x, y, w, NULL, NULL, NULL, NULL, 6); /* set cells ... */ SetTableCell (table, 0, FF_Boxed | FF_Left, 1, w - 6 * CELL_W - 2, title); SetTableCell (table, 1, FF_Boxed | FF_Right, w - 1 - 12 * CELL_W / 2, CELL_W, N_("Score")); SetTableCell (table, 2, FF_Boxed | FF_Right, w - 1 - 10 * CELL_W / 2, 3 * CELL_W / 2, N_("Avg. Score")); SetTableCell (table, 3, FF_Boxed | FF_Right, w - 1 - 7 * CELL_W / 2, CELL_W, N_("# Won")); SetTableCell (table, 4, FF_Boxed | FF_Right, w - 1 - 5 * CELL_W / 2, 3 * CELL_W / 2, N_("%% Won")); SetTableCell (table, 5, FF_Boxed | FF_Right, w - 1 - 2 * CELL_W / 2, CELL_W, N_("# Total")); /* --- */ return &table->item; } /* MenuCreateStatHeader */ /* * create entry for rankings table */ XBMenuItem * MenuCreateCentralEntry (int x, int y, int w, const XBCentralData * data, MIC_button func, void *funcData) { XBMenuTableItem *table = CreateTableItem (x, y, w, func, funcData, NULL, NULL, 6); /* set cells ... */ assert (data != NULL); if (data->name != NULL) { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), data->name); } else { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), GUI_AtomToString (data->atom)); } SetTableCell (table, 1, FF_Right, w - 1 - 12 * CELL_W / 2, 3 * CELL_W / 2, "%6.1f", data->score); SetTableCell (table, 2, FF_Right, w - 1 - 9 * CELL_W / 2, CELL_W, "%d", data->rank); SetTableCell (table, 3, FF_Right, w - 1 - 7 * CELL_W / 2, CELL_W, "%d", data->numWon); SetTableCell (table, 4, FF_Right, w - 1 - 5 * CELL_W / 2, 3 * CELL_W / 2, "%5.2f%%", data->percent); SetTableCell (table, 5, FF_Right, w - 1 - 2 * CELL_W / 2, CELL_W, "%d", data->numTotal); /* --- */ return &table->item; } /* MenuCreateCentralEntry */ /* * create header for rankings table */ XBMenuItem * MenuCreateCentralHeader (int x, int y, int w, const char *title) { XBMenuTableItem *table = CreateTableItem (x, y, w, NULL, NULL, NULL, NULL, 6); /* set cells ... */ SetTableCell (table, 0, FF_Boxed | FF_Left, 1, w - 6 * CELL_W - 2, title); SetTableCell (table, 1, FF_Boxed | FF_Right, w - 1 - 12 * CELL_W / 2, 3 * CELL_W / 2, N_("Rating")); SetTableCell (table, 2, FF_Boxed | FF_Right, w - 1 - 9 * CELL_W / 2, CELL_W, N_("Rank")); SetTableCell (table, 3, FF_Boxed | FF_Right, w - 1 - 7 * CELL_W / 2, CELL_W, N_("# Won")); SetTableCell (table, 4, FF_Boxed | FF_Right, w - 1 - 5 * CELL_W / 2, 3 * CELL_W / 2, N_("%% Won")); SetTableCell (table, 5, FF_Boxed | FF_Right, w - 1 - 2 * CELL_W / 2, CELL_W, N_("# Total")); /* --- */ return &table->item; } /* MenuCreateCentralHeader */ /* * create player info entry */ XBMenuItem * MenuCreateInfoEntry (int x, int y, int w, const XBCentralInfo * data, MIC_button func, void *funcData) { XBMenuTableItem *table = CreateTableItem (x, y, w, func, funcData, NULL, NULL, 2); /* set cells ... */ assert (data != NULL); if (data->name != NULL) { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), data->name); } else { SetTableCell (table, 0, FF_Left, 1, (w - 3 * CELL_W - 2), ""); } SetTableCell (table, 1, FF_Left, w - 1 - 12 * CELL_W / 2, 12 * CELL_W / 2, "%s", data->value); /* --- */ return &table->item; } /* MenuCreateInfoEntry */ /* * create header for player info table */ XBMenuItem * MenuCreateInfoHeader (int x, int y, int w, const char *title) { XBMenuTableItem *table = CreateTableItem (x, y, w, NULL, NULL, NULL, NULL, 2); /* set cells ... */ SetTableCell (table, 0, FF_Boxed | FF_Left, 1, w - 6 * CELL_W - 2, N_("Parameter")); SetTableCell (table, 1, FF_Boxed | FF_Left, w - 1 - 12 * CELL_W / 2, 12 * CELL_W / 2, N_("Value")); /* --- */ return &table->item; } /* MenuCreateInfoHeader */ /* * create a demo game entry */ XBMenuItem * MenuCreateDemoEntry (int x, int y, int w, const CFGDemoEntry * data, MIC_button func, void *funcData) { XBMenuTableItem *table = CreateTableItem (x, y, w, func, funcData, NULL, NULL, 3); /* set cells ... */ assert (data != NULL); /* set cells */ SetTableCell (table, 0, FF_Left, 1, 5 * CELL_W / 2, DateString (data->time)); SetTableCell (table, 1, FF_Left, 1 + 5 * CELL_W / 2, (w - 4 * CELL_W - 2), GetLevelNameByAtom (data->level)); SetTableCell (table, 2, FF_Center, w - 1 - 3 * CELL_W / 2, 3 * CELL_W / 2, "%d", data->numPlayers); /* --- */ return &table->item; } /* MenuCreateDemoEntry */ /* * create header for demo game table */ XBMenuItem * MenuCreateDemoHeader (int x, int y, int w) { XBMenuTableItem *table = CreateTableItem (x, y, w, NULL, NULL, NULL, NULL, 3); /* set cells */ SetTableCell (table, 0, FF_Boxed | FF_Left, 1, 5 * CELL_W / 2, N_("Date & Time")); SetTableCell (table, 1, FF_Boxed | FF_Left, 1 + 5 * CELL_W / 2, (w - 4 * CELL_W - 2), N_("Level")); SetTableCell (table, 2, FF_Boxed | FF_Center, w - 1 - 3 * CELL_W / 2, 3 * CELL_W / 2, N_("#players")); /* --- */ return &table->item; } /* MenuCreateDemoHeader */ /* * create entry for game data */ XBMenuItem * MenuCreateGameEntry (int x, int y, int w, const XBNetworkGame ** game, MIC_button func) { XBMenuTableItem *table = CreateTableItem (x, y, w, func, game, PollGameEntry, (const void **)game, 7); /* set cells */ SetTableCell (table, 0, FF_Left, 1, w - 2 - 16 * CELL_W / 2, ""); SetTableCell (table, 1, FF_Center, w - 1 - 16 * CELL_W / 2, 11 * CELL_W / 4, ""); SetTableCell (table, 2, FF_Center, w - 1 - 21 * CELL_W / 4, 2 * CELL_W / 2, ""); SetTableCell (table, 3, FF_Center, w - 1 - 17 * CELL_W / 4, 5 * CELL_W / 4, ""); SetTableCell (table, 4, FF_Center, w - 1 - 6 * CELL_W / 2, 2 * CELL_W / 2, ""); SetTableCell (table, 5, FF_Center, w - 1 - 4 * CELL_W / 2, 2 * CELL_W / 2, ""); SetTableCell (table, 6, FF_Center, w - 1 - 2 * CELL_W / 2, 2 * CELL_W / 2, ""); /* --- */ return &table->item; } /* MenuCreateGameEntry */ /* * create header for game table */ XBMenuItem * MenuCreateGameHeader (int x, int y, int w) { XBMenuTableItem *table = CreateTableItem (x, y, w, NULL, NULL, NULL, NULL, 7); /* set cells */ SetTableCell (table, 0, FF_Boxed | FF_Left, 1, w - 2 - 16 * CELL_W / 2, N_("Game")); SetTableCell (table, 1, FF_Boxed | FF_Center, w - 1 - 16 * CELL_W / 2, 11 * CELL_W / 4, N_("Host")); SetTableCell (table, 2, FF_Boxed | FF_Center, w - 1 - 21 * CELL_W / 4, 2 * CELL_W / 2, N_("Ping")); SetTableCell (table, 3, FF_Boxed | FF_Center, w - 1 - 17 * CELL_W / 4, 5 * CELL_W / 4, N_("Version")); SetTableCell (table, 4, FF_Boxed | FF_Center, w - 1 - 6 * CELL_W / 2, 2 * CELL_W / 2, N_("#lives")); SetTableCell (table, 5, FF_Boxed | FF_Center, w - 1 - 4 * CELL_W / 2, 2 * CELL_W / 2, N_("#wins")); SetTableCell (table, 6, FF_Boxed | FF_Center, w - 1 - 2 * CELL_W / 2, 2 * CELL_W / 2, N_("FPS")); /* --- */ return &table->item; } /* MenuCreateGameHeader */ /* * delete a table */ void MenuDeleteTable (XBMenuItem * item) { XBMenuTableItem *table = (XBMenuTableItem *) item; size_t i; /* sanity check */ assert (NULL != table); assert (MIT_Table == table->item.type); assert (NULL != table->cell); /* clean up cells */ for (i = 0; i < table->numCells; i++) { assert (NULL != table->cell[i].text); assert (NULL != table->cell[i].sprite); free (table->cell[i].text); DeleteSprite (table->cell[i].sprite); } free (table->cell); } /* MenuDeleteTable */ /* * end of file mi_stat.c */ xblast-2.10.4/mi_stat.h0000644000175000017500000000412210372731124014020 0ustar rhondaalfie/* * file mi_stat.h - menu item for displaying game table * * $Id: mi_stat.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MI_STAT_H #define XBLAST_MI_STAT_H extern XBMenuItem *MenuCreateStatEntry (int x, int y, int w, const XBStatData * stat, MIC_button func, void *funcPar); extern XBMenuItem *MenuCreateStatHeader (int x, int y, int w, const char *title); extern XBMenuItem *MenuCreateDemoEntry (int x, int y, int w, const CFGDemoEntry * demo, MIC_button func, void *funcPar); extern XBMenuItem *MenuCreateDemoHeader (int x, int y, int w); extern XBMenuItem *MenuCreateGameEntry (int x, int y, int w, const XBNetworkGame **, MIC_button func); extern XBMenuItem *MenuCreateGameHeader (int x, int y, int w); extern XBMenuItem *MenuCreateCentralEntry (int x, int y, int w, const XBCentralData * data, MIC_button func, void *funcData); // XBCC extern XBMenuItem *MenuCreateCentralHeader (int x, int y, int w, const char *title); // XBCC extern XBMenuItem *MenuCreateInfoEntry (int x, int y, int w, const XBCentralInfo * data, MIC_button func, void *funcData); // XBCC extern XBMenuItem *MenuCreateInfoHeader (int x, int y, int w, const char *title); // XBCC extern void MenuDeleteTable (XBMenuItem * item); extern void MenuActivateTable (XBMenuItem * ptr, XBBool flag); #endif /* * end of file mi_stat.h */ xblast-2.10.4/mi_string.c0000644000175000017500000001403410372731124014351 0ustar rhondaalfie/* * file mi_string.c - string ediotr for menus * * $Id: mi_string.c,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define BLINK_RATE 8 #define FF_STRING_TEXT_FOCUS (FF_Medium | FF_Black | FF_Left | FF_Outlined) #define FF_STRING_TEXT_NO_FOCUS (FF_Medium | FF_White | FF_Left) #define FF_STRING_VALUE_SELECT (FF_Medium | FF_Black | FF_Left | FF_Boxed) #define FF_STRING_VALUE_NO_SELECT (FF_Medium | FF_White | FF_Left | FF_Boxed) /* * local types */ typedef struct { XBMenuItem item; const char *text; char *buffer; size_t len; char *work; size_t pos; Sprite *lSprite; Sprite *eSprite; int pollCount; } XBMenuStringItem; /* * a string item receives the focus */ static void MenuStringFocus (XBMenuItem * ptr, XBBool flag) { XBMenuStringItem *string = (XBMenuStringItem *) ptr; assert (string != NULL); assert (string->lSprite != NULL); SetSpriteAnime (string->lSprite, flag ? FF_STRING_TEXT_FOCUS : FF_STRING_TEXT_NO_FOCUS); } /* MenuStringFocus */ /* * Menu String Item */ static void MenuStringPoll (XBMenuItem * ptr) { XBMenuStringItem *string = (XBMenuStringItem *) ptr; assert (string != NULL); string->pollCount++; if ((string->item.flags & MIF_SELECTED) && (0 == (string->pollCount % BLINK_RATE))) { if (0 == (string->pollCount % (2 * BLINK_RATE))) { SetSpriteAnime (string->eSprite, FF_STRING_VALUE_SELECT | FF_Cursor); } else { SetSpriteAnime (string->eSprite, FF_STRING_VALUE_SELECT); } } } /* MenuStringPoll */ /* * event handling while string is selected */ static void StringEventLoop (XBMenuItem * ptr) { XBEventCode event; XBEventData data; XBMenuStringItem *string = (XBMenuStringItem *) ptr; assert (string != NULL); assert (string->eSprite != NULL); string->item.flags |= MIF_SELECTED; SetSpriteAnime (string->eSprite, FF_STRING_VALUE_SELECT); GUI_SetKeyboardMode (KB_ASCII); /* event loop */ while (1) { /* update window contents */ MenuUpdateWindow (); /* get event from gui */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { if (event == XBE_ASCII) { // Dbg_Out(" mi_string %c \n",data.value); /* add a character */ if (string->pos < string->len - 1) { string->work[string->pos++] = (char)data.value; string->work[string->pos] = 0; } SetSpriteText (string->eSprite, string->work); } else if (event == XBE_CTRL) { /* control key */ switch (data.value) { /* delete last character */ case XBCK_BACKSPACE: if (string->pos > 0) { string->work[--string->pos] = 0; SetSpriteText (string->eSprite, string->work); } break; /* accept value */ case XBCK_RETURN: memcpy (string->buffer, string->work, string->len); goto Finish; /* reject value */ case XBCK_ESCAPE: memcpy (string->work, string->buffer, string->len); string->pos = strlen (string->buffer); goto Finish; default: break; } } else if (event == XBE_MOUSE_1) { /* accept value */ memcpy (string->buffer, string->work, string->len); goto Finish; } else if (event == XBE_MOUSE_2) { /* reject value */ memcpy (string->work, string->buffer, string->len); string->pos = strlen (string->buffer); goto Finish; } } } Finish: string->item.flags &= ~MIF_SELECTED; SetSpriteText (string->eSprite, string->work); SetSpriteAnime (string->eSprite, FF_STRING_VALUE_NO_SELECT); GUI_SetKeyboardMode (KB_MENU); return; } /* StringEventLoop */ /* * mouse click */ static void MenuStringMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { StringEventLoop (ptr); } } /* MenuStringMouse */ /* * */ XBMenuItem * MenuCreateString (int x, int y, int w, const char *text, int wEdit, char *buffer, size_t len) { XBMenuStringItem *string; assert (w - wEdit > 0); assert (buffer != NULL); assert (len > 0); /* create item */ string = calloc (1, sizeof (*string)); assert (NULL != string); MenuSetItem (&string->item, MIT_String, x, y, w, CELL_H, MenuStringFocus, StringEventLoop, MenuStringMouse, MenuStringPoll); /* set label */ string->text = text; string->lSprite = CreateTextSprite (text, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - wEdit - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_STRING_TEXT_NO_FOCUS, SPM_MAPPED); /* create work buffer */ string->len = len; string->buffer = buffer; string->work = calloc (1, len); assert (NULL != string->work); memcpy (string->work, buffer, len); string->pos = strlen (buffer); assert (string->pos < string->len); /* create editor */ string->eSprite = CreateTextSprite (string->work, (x + w - wEdit + 1) * BASE_X, (y + 2) * BASE_Y, (wEdit - 2) * BASE_X, (CELL_H - 4) * BASE_Y, FF_STRING_VALUE_NO_SELECT, SPM_MAPPED); /* graphics */ MenuAddLargeFrame ((x - CELL_W / 2) / CELL_W, (x + w + CELL_W / 2 - 1) / CELL_W, y / CELL_H); /* that's all */ return &string->item; } /* CreateMenuString */ /* * delete a string */ void MenuDeleteString (XBMenuItem * item) { XBMenuStringItem *string = (XBMenuStringItem *) item; assert (string->lSprite != NULL); assert (string->eSprite != NULL); assert (string->work != NULL); DeleteSprite (string->lSprite); DeleteSprite (string->eSprite); free (string->work); } /* DeleteComboItem */ /* * end of file mi_string.c */ xblast-2.10.4/mi_string.h0000644000175000017500000000214510372731124014356 0ustar rhondaalfie/* * file mi_string.h - * * $Id: mi_string.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_STRING_H #define _MI_STRING_H extern XBMenuItem *MenuCreateString (int x, int y, int w_text, const char *text, int w, char *buffer, size_t len); extern void MenuDeleteString (XBMenuItem * item); #endif /* * end of file mi_string.h */ xblast-2.10.4/mi_tag.c0000644000175000017500000000702310372731124013616 0ustar rhondaalfie/* * file mi_tag.c - Display a volatile string (const char *) * * $Id: mi_tag.c,v 1.7 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct { XBMenuItem item; const char **pText; const char *cText; int *pNr; int cNr; Sprite *sprite; } XBMenuTagItem; /* temporary buffer */ static char buf[10]; /* * polling a tag item */ static void MenuTagPoll (XBMenuItem * ptr) { XBMenuTagItem *tag = (XBMenuTagItem *) ptr; /* sanity check */ assert (NULL != tag); assert (NULL != tag->pText); assert (NULL != tag->sprite); /* check for changed string */ if (*tag->pText != tag->cText) { tag->cText = *tag->pText; SetSpriteText (tag->sprite, tag->cText); } } /* MenuTagPoll */ /* * polling an int tag item */ static void MenuIntTagPoll (XBMenuItem * ptr) { XBMenuTagItem *tag = (XBMenuTagItem *) ptr; /* sanity check */ assert (NULL != tag); assert (NULL != tag->pNr); assert (NULL != tag->sprite); /* check for changed string */ if (*tag->pNr != tag->cNr) { tag->cNr = *tag->pNr; sprintf (buf, "%i", tag->cNr); SetSpriteText (tag->sprite, buf); } } /* MenuIntTagPoll */ /* * create standard tag, framed, small */ XBMenuItem * MenuCreateTag (int x, int y, int w, const char **pText) { /* create item */ XBMenuTagItem *tag = calloc (1, sizeof (XBMenuTagItem)); assert (tag != NULL); MenuSetItem (&tag->item, MIT_Tag, x, y, w, CELL_H / 2, NULL, NULL, NULL, MenuTagPoll); /* set item specific values */ assert (pText != NULL); tag->pText = pText; tag->cText = *pText; /* sprite showing text */ tag->sprite = CreateTextSprite (tag->cText, (x + 1) * BASE_X, y * BASE_Y, (w - 2) * BASE_X, (CELL_H / 2) * BASE_Y, FF_Small | FF_White | FF_Center, SPM_MAPPED); /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &tag->item; } /* MenuCreateTag */ /* * create integer tag, boxed, large */ XBMenuItem * MenuCreateIntTag (int x, int y, int w, int *pNr) { /* create item */ XBMenuTagItem *tag = calloc (1, sizeof (XBMenuTagItem)); assert (tag != NULL); MenuSetItem (&tag->item, MIT_Tag, x, y, w, CELL_H, NULL, NULL, NULL, MenuIntTagPoll); /* set item specific values */ assert (pNr != NULL); tag->pNr = pNr; tag->cNr = *pNr; /* sprite showing text */ sprintf (buf, "%i", *pNr); tag->sprite = CreateTextSprite (buf, (x + 1) * BASE_X, (y + 1) * BASE_Y, (w - 2) * BASE_X, (CELL_H - 2) * BASE_Y, FF_Large | FF_White | FF_Center | FF_Boxed, SPM_MAPPED); return &tag->item; } /* MenuCreateIntTag */ /* * delete a "tag" */ void MenuDeleteTag (XBMenuItem * item) { XBMenuTagItem *tag = (XBMenuTagItem *) item; assert (NULL != tag); assert (NULL != tag->sprite); DeleteSprite (tag->sprite); } /* MenuDeleteTag */ /* * end of file mi_tag.c */ xblast-2.10.4/mi_tag.h0000644000175000017500000000224510372731124013624 0ustar rhondaalfie/* * file mi_tag.h - Display a volatile string (const char *) * * $Id: mi_tag.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_TAG_H #define _MI_TAG_H /* * global prototypes */ extern XBMenuItem *MenuCreateTag (int x, int y, int w, const char **pText); extern XBMenuItem *MenuCreateIntTag (int x, int y, int w, int *pNr); extern void MenuDeleteTag (XBMenuItem *); #endif /* * end of file mi_tag.h */ xblast-2.10.4/mi_toggle.c0000644000175000017500000000721410372731124014326 0ustar rhondaalfie/* * file mi_toggle.c - checkbuttons for menus * * $Id: mi_toggle.c,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macors */ #define FF_TOGGLE_FOCUS (FF_Small | FF_Black | FF_Left | FF_Outlined) #define FF_TOGGLE_NO_FOCUS (FF_Small | FF_White | FF_Left) /* * local types */ typedef struct { XBMenuItem item; const char *text; Sprite *textSprite; Sprite *ledSprite; XBBool *pState; XBBool state; } XBMenuToggleItem; /* * a toggle item receives the focus */ static void MenuToggleFocus (XBMenuItem * ptr, XBBool flag) { XBMenuToggleItem *toggle = (XBMenuToggleItem *) ptr; assert (toggle != NULL); assert (toggle->textSprite != NULL); SetSpriteAnime (toggle->textSprite, flag ? FF_TOGGLE_FOCUS : FF_TOGGLE_NO_FOCUS); } /* MenuToggleFocus */ /* * a toggle is selected */ static void MenuToggleSelect (XBMenuItem * ptr) { XBMenuToggleItem *toggle = (XBMenuToggleItem *) ptr; assert (toggle != NULL); if (NULL != toggle->pState) { *toggle->pState = !*toggle->pState; } } /* MenuToggleSelect */ /* * mouse click */ static void MenuToggleMouse (XBMenuItem * ptr, XBEventCode code) { if (code == XBE_MOUSE_1) { MenuToggleSelect (ptr); } } /* MenuToggleMouse */ /* * polling a toggle item */ static void MenuTogglePoll (XBMenuItem * ptr) { XBMenuToggleItem *toggle = (XBMenuToggleItem *) ptr; assert (toggle != NULL); assert (toggle->ledSprite != NULL); if (*toggle->pState != toggle->state) { toggle->state = *toggle->pState; SetSpriteAnime (toggle->ledSprite, toggle->state ? ISA_LedOn : ISA_LedOff); } } /* MenuTogglePoll */ /* * */ XBMenuItem * MenuCreateToggle (int x, int y, int w, const char *text, XBBool * pState) { /* create item */ XBMenuToggleItem *toggle = calloc (1, sizeof (*toggle)); assert (NULL != toggle); MenuSetItem (&toggle->item, MIT_Toggle, x, y, w, CELL_H / 2, MenuToggleFocus, MenuToggleSelect, MenuToggleMouse, MenuTogglePoll); /* set toggle specific data */ toggle->text = text; toggle->pState = pState; toggle->state = (NULL != pState) ? *pState : XBFalse; /* sprite with text label */ toggle->textSprite = CreateTextSprite (text, (x + 3) * BASE_X, y * BASE_Y, (w - 4) * BASE_X, (CELL_H / 2) * BASE_Y, FF_TOGGLE_NO_FOCUS, SPM_MAPPED); /* sprite with marker */ toggle->ledSprite = CreateIconSprite ((x - 2) * BASE_X, (y - CELL_H / 4) * BASE_Y, toggle->state ? ISA_LedOn : ISA_LedOff, SPM_MAPPED); /* graphics */ MenuAddSmallFrame (x / CELL_W, (x + w - 1) / CELL_W, y / CELL_H); return &toggle->item; } /* CreateMenuToggle */ /* * delete a toggle */ void MenuDeleteToggle (XBMenuItem * item) { XBMenuToggleItem *toggle = (XBMenuToggleItem *) item; assert (toggle->textSprite != NULL); assert (toggle->ledSprite != NULL); DeleteSprite (toggle->textSprite); DeleteSprite (toggle->ledSprite); } /* DeleteButtonItem */ /* * end of file mi_toggle.c */ xblast-2.10.4/mi_toggle.h0000644000175000017500000000210610372731124014326 0ustar rhondaalfie/* * file mi_toggle.h - * * $Id: mi_toggle.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MI_TOGGLE_H #define _MI_TOGGLE_H extern XBMenuItem *MenuCreateToggle (int x, int y, int w, const char *text, XBBool * pState); extern void MenuDeleteToggle (XBMenuItem * item); #endif /* * end of file mi_toggle.h */ xblast-2.10.4/mi_tool.c0000644000175000017500000005214610373111604014022 0ustar rhondaalfie/* * file mi_tool.c - toolkit for xblast menus * * $Id: mi_tool.c,v 1.33 2006/02/10 13:22:12 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ static XBMenuItem *itemFirst = NULL; static XBMenuItem *itemLast = NULL; static XBMenuItem *itemFocus = NULL; static XBBool execFlag = XBTrue; static XBBool fadeFlag = XBFalse; static XBMenuItem *defaultItem = NULL; static XBMenuItem *abortItem = NULL; static XBBool mapMode = 0; static int setPressed = 0; static XBComboEntryList yesNoTable[] = { {N_("no"), 0, NULL}, {N_("yes"), 1, NULL}, {NULL, 0, NULL}, }; /* * delete any menu item */ static void DeleteMenuItem (XBMenuItem * item) { assert (item != NULL); switch (item->type) { case MIT_Button: MenuDeleteButton (item); break; case MIT_Color: MenuDeleteColor (item); break; case MIT_Combo: MenuDeleteCombo (item); break; case MIT_Cyclic: MenuDeleteCyclic (item); break; case MIT_Keysym: MenuDeleteKeysym (item); break; case MIT_Label: MenuDeleteLabel (item); break; case MIT_Player: MenuDeletePlayer (item); break; case MIT_String: MenuDeleteString (item); break; case MIT_Toggle: MenuDeleteToggle (item); break; case MIT_Integer: MenuDeleteInteger (item); break; case MIT_Tag: MenuDeleteTag (item); break; case MIT_Host: MenuDeleteHost (item); break; case MIT_Table: MenuDeleteTable (item); break; case MIT_Team: MenuDeleteTeam (item); break; default: break; } free (item); } /* DeleteMenuItem */ /***************** * mouse buttons * *****************/ /* * store press status of mouse */ void SetPressed (XBBool mode) { setPressed = mode; } /* SetPressed */ /* * get press status of mouse */ XBBool GetPressed (void) { return setPressed; } /* GetPressed */ /*************** * editor mode * ***************/ /* * set editor mode */ void SetXBEditMapMode (XBBool mode) { mapMode = mode; } /* SetXBEditMapMode */ /* * get editor mode */ XBBool GetXBEditMapMode (void) { return mapMode; } /* GetXBEditMapMode */ /*************** * local tools * ***************/ /* * find item by id */ static XBMenuItem * FindItem (MENU_ID id) { XBMenuItem *item; for (item = itemFirst; item != NULL; item = item->next) { if (item->id == id) { return item; } } return NULL; } /* FindItem */ /************** * menu tools * **************/ /* * an menu item was selected (i.e Space was pressed) */ static void SelectItem (XBMenuItem * item) { if (item != NULL && item->select != NULL) { (*item->select) (item); } } /* SelectItem */ /* * clear all menu items */ void MenuClear (void) { XBMenuItem *item_next; while (itemFirst != NULL) { item_next = itemFirst->next; DeleteMenuItem (itemFirst); itemFirst = item_next; } itemLast = itemFocus = NULL; fadeFlag = XBTrue; defaultItem = NULL; abortItem = NULL; MenuResetBase (); MenuClearMap (); } /* MenuClear */ /* * set directional links between items for arrow keys */ void MenuSetLinks (void) { XBMenuItem *ptr; for (ptr = itemFirst; ptr != NULL; ptr = ptr->next) { if (NULL != ptr->mouse) { ptr->left = MenuFindLeftItem (ptr); ptr->right = MenuFindRightItem (ptr); ptr->up = MenuFindUpperItem (ptr); ptr->down = MenuFindLowerItem (ptr); } } } /* MenuSetLinks */ /* * select item */ void MenuSelect (MENU_ID id) { SelectItem (FindItem (id)); } /* MenuSelect */ /* * set default item */ void MenuSetDefault (MENU_ID id) { defaultItem = FindItem (id); if (NULL != defaultItem && MIT_Button == defaultItem->type) { MenuSetButtonIcon (defaultItem, ISA_Default); } } /* MenuSetDefault */ /* * set abort item */ void MenuSetAbort (MENU_ID id) { abortItem = FindItem (id); if (NULL != abortItem && MIT_Button == abortItem->type) { MenuSetButtonIcon (abortItem, ISA_Abort); } } /* MenuSetDefault */ /* * async execution of function */ void MenuExecFunc (MIC_button func, void *data) { execFlag = XBTrue; MenuButtonSetNextExec (func, data); } /* MenuExecFunc */ /* * activate/deactivate item */ void MenuSetActive (MENU_ID id, XBBool active) { XBMenuItem *item = FindItem (id); if (NULL != item) { /* set flags */ if (active) { item->flags &= ~MIF_DEACTIVATED; } else { item->flags |= MIF_DEACTIVATED; } switch (item->type) { case MIT_Button: MenuActivateButton (item, active); break; case MIT_Table: MenuActivateTable (item, active); break; default: break; } } } /* MenuSetActive */ /* * get item id with focus */ MENU_ID MenuGetFocus (void) { return (NULL != itemFocus) ? itemFocus->id : 0; } /* MenuGetFocus */ /*------------------------------------------------------------------------* * * add items to menu * *------------------------------------------------------------------------*/ /* * add a generic item to the menu */ static MENU_ID MenuAdd (XBMenuItem * item) { if (itemLast == NULL) { itemFirst = item; } if (itemLast != NULL) { itemLast->next = item; item->prev = itemLast; } itemLast = item; itemLast->next = NULL; if (itemFocus == NULL && item->focus != NULL) { item->flags |= MIF_FOCUS; itemFocus = item; (*item->focus) (item, XBTrue); } return item->id; } /* MenuAdd */ /* * add horizontal button to menu */ MENU_ID MenuAddHButton (int x, int y, int w, const char *text, MIC_button func, void *funcData) { return MenuAdd (MenuCreateHButton (x, y, w, text, func, funcData)); } /* MenuAddHButton */ /* * add vertical button to menu */ MENU_ID MenuAddVButton (int x, int y, int h, const char *text, MIC_button func, void *funcData) { return MenuAdd (MenuCreateVButton (x, y, h, text, func, funcData)); } /* MenuAddVButton */ /* * add a checkbox item to menu */ MENU_ID MenuAddToggle (int x, int y, int w, const char *text, XBBool * pState) { return MenuAdd (MenuCreateToggle (x, y, w, text, pState)); } /* MenuAddToggle */ /* * add a label/title to menu */ MENU_ID MenuAddLabel (int x, int y, int w, const char *text) { return MenuAdd (MenuCreateLabel (x, y, w, text)); } /* MenuAddLabel */ /* * add label variant 1 to menu */ MENU_ID MenuAddLabel1 (int x, int y, int w, const char *text) { return MenuAdd (MenuCreateLabel1 (x, y, w, text)); } /* MenuAddLabel1 */ /* * add label variant 2 to menu */ MENU_ID MenuAddLabel2 (int x, int y, int w, const char *text) { return MenuAdd (MenuCreateLabel2 (x, y, w, text)); } /* MenuAddLabel2 */ /* * add a combobox to menu, check only integer keys */ MENU_ID MenuAddComboInt (int x, int y, int w_text, const char *text, int w, int *value, XBComboEntryList * table) { return MenuAdd (MenuCreateCombo (x, y, w_text, text, w, value, NULL, NULL, table)); } /* MenuAddComboInt */ /* * a simple yes/no combobox to menu */ MENU_ID MenuAddComboBool (int x, int y, int w_text, const char *text, int w, XBBool * value) { return MenuAdd (MenuCreateCombo (x, y, w_text, text, w, (int *)value, NULL, NULL, yesNoTable)); } /* MenuAddComboInt */ /* * add a combobox to menu, check only data entry */ MENU_ID MenuAddComboData (int x, int y, int w_text, const char *text, int w, void **data, XBComboEntryList * table) { return MenuAdd (MenuCreateCombo (x, y, w_text, text, w, NULL, data, NULL, table)); } /* MenuAddComboData */ /* * add a combobox to menu, check only atom entry */ MENU_ID MenuAddComboAtom (int x, int y, int w_text, const char *text, int w, XBAtom * atom, XBComboEntryList * table) { return MenuAdd (MenuCreateCombo (x, y, w_text, text, w, NULL, NULL, atom, table)); } /* MenuAddComboAtom */ /* * add a combobox to menu, check all entries */ MENU_ID MenuAddCombo (int x, int y, int w_text, const char *text, int w, int *value, void **data, XBAtom * atom, XBComboEntryList * table) { return MenuAdd (MenuCreateCombo (x, y, w_text, text, w, value, data, atom, table)); } /* MenuAddCombo */ /* * add a player graphics to menu */ MENU_ID MenuAddPlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int n_anime, BMSpriteAnimation * anime) { return MenuAdd (MenuCreatePlayer (x, y, w, sprite, cfg, n_anime, anime)); } /* MenuAddPlayer */ /* * add a player graphics to menu */ MENU_ID MenuAddConfigPlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int n_anime, BMSpriteAnimation * anime, XBRgbValue * pRgb) { return MenuAdd (MenuCreateConfigPlayer (x, y, w, sprite, cfg, n_anime, anime, pRgb)); } /* MenuAddPlayer */ /* * add an item for string input to menu */ MENU_ID MenuAddString (int x, int y, int w_text, const char *text, int w, char *buffer, size_t len) { return MenuAdd (MenuCreateString (x, y, w_text, text, w, buffer, len)); } /* MenuAddString */ /* * add an item for changing a color to menu */ MENU_ID MenuAddColor (int x, int y, int w, const char *text, XBColor * color, XBRgbValue * pRgb) { return MenuAdd (MenuCreateColor (x, y, w, text, color, pRgb)); } /* MenuAddColor */ /* * add an item for assigning a key to menu */ MENU_ID MenuAddKeysym (int x, int y, int w, const char *text, XBAtom * pKey) { return MenuAdd (MenuCreateKeysym (x, y, w, text, pKey)); } /* MenuAddKeysym */ /* * add an invisble item for a poll function */ MENU_ID MenuAddCyclic (MIC_cyclic func, void *par) { return MenuAdd (MenuCreateCyclic (func, par)); } /* MenuAddCyclic */ /* * add an item for integer input to menu */ MENU_ID MenuAddInteger (int x, int y, int w_text, const char *text, int w, int *pValue, int min, int max) { return MenuAdd (MenuCreateInteger (x, y, w_text, text, w, pValue, min, max)); } /* MenuAddInteger */ /* * add a name tag for players */ MENU_ID MenuAddTag (int x, int y, int w, const char **pText) { return MenuAdd (MenuCreateTag (x, y, w, pText)); } /* MenuAddTag */ /* * add integer tag (counter) */ MENU_ID MenuAddIntTag (int x, int y, int w, int *pNr) { return MenuAdd (MenuCreateIntTag (x, y, w, pNr)); } /* MenuAddIntTag */ /******************************************* * host items for server/client wait menus * *******************************************/ /* * add a generic host button */ MENU_ID MenuAddHost (int x, int y, int w, unsigned client, const char **pText, XBHSFocusFunc focusFunc, XBHSChangeFunc chgFunc, XBHSUpdateFunc upFunc) { return MenuAdd (MenuCreateHost (x, y, w, client, pText, focusFunc, chgFunc, upFunc)); } /* MenuAddHost */ /* * host button (server) */ MENU_ID MenuAddServer (int x, int y, int w, const char **pText) { return MenuAdd (MenuCreateServer (x, y, w, pText)); } /* MenuAddServer */ /* * host button (client) */ MENU_ID MenuAddClient (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing) { return MenuAdd (MenuCreateClient (x, y, w, pText, pState, pPing)); } /* MenuAddClient */ /* * host button (peer) */ MENU_ID MenuAddPeer (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing) { return MenuAdd (MenuCreatePeer (x, y, w, pText, pState, pPing)); } /* MenuAddPeer */ /******************************************* * team items for server/client wait menus * *******************************************/ /* * team button (generic) */ MENU_ID MenuAddTeam (int x, int y, int w, unsigned id, unsigned player, XBTSFocusFunc focusFunc, XBTSChangeFunc chgFunc, XBTSUpdateFunc upFunc) { return MenuAdd (MenuCreateTeam (x, y, w, id, player, focusFunc, chgFunc, upFunc)); } /* MenuAddTeam */ /* * team button (server) */ MENU_ID MenuAddServerTeam (int x, int y, int w, XBTeamState * pTeam) { return MenuAdd (MenuCreateServerTeam (x, y, w, pTeam)); } /* MenuAddServerTeam */ /* * team button (peeer) */ MENU_ID MenuAddPeerTeam (int x, int y, int w, XBTeamState * pTeam) { return MenuAdd (MenuCreatePeerTeam (x, y, w, pTeam)); } /* MenuAddPeerTeam */ /* * add statitics header to menu */ MENU_ID MenuAddStatHeader (int x, int y, int w, const char *title) { return MenuAdd (MenuCreateStatHeader (x, y, w, title)); } /* MenuAddHButton */ /* * add table entry to menu */ MENU_ID MenuAddStatEntry (int x, int y, int w, const XBStatData * stat, MIC_button func, void *funcData) { return MenuAdd (MenuCreateStatEntry (x, y, w, stat, func, funcData)); } /* MenuAddHButton */ /* * add table entry to menu */ MENU_ID MenuAddDemoEntry (int x, int y, int w, const CFGDemoEntry * demo, MIC_button func, void *funcData) { return MenuAdd (MenuCreateDemoEntry (x, y, w, demo, func, funcData)); } /* MenuAddHButton */ /* * add statitics header to menu */ MENU_ID MenuAddDemoHeader (int x, int y, int w) { return MenuAdd (MenuCreateDemoHeader (x, y, w)); } /* MenuAddHButton */ /* * add statitics header to menu */ MENU_ID MenuAddGameEntry (int x, int y, int w, const XBNetworkGame ** game, MIC_button func) { return MenuAdd (MenuCreateGameEntry (x, y, w, game, func)); } /* MenuAddHButton */ /* * add statitics header to menu */ MENU_ID MenuAddGameHeader (int x, int y, int w) { return MenuAdd (MenuCreateGameHeader (x, y, w)); } /* MenuAddHButton */ /* * XBCC add statitics header to menu */ MENU_ID MenuAddCentralHeader (int x, int y, int w, const char *title) { return MenuAdd (MenuCreateCentralHeader (x, y, w, title)); } /* MenuAddHButton */ /* * XBCC add table entry to menu */ MENU_ID MenuAddCentralEntry (int x, int y, int w, const XBCentralData * stat, MIC_button func, void *funcData) { return MenuAdd (MenuCreateCentralEntry (x, y, w, stat, func, funcData)); } /* MenuAddHButton */ /* * XBCC add info header to menu */ MENU_ID MenuAddInfoHeader (int x, int y, int w, const char *title) { return MenuAdd (MenuCreateInfoHeader (x, y, w, title)); } /* MenuAddHButton */ /* * XBCC add table entry to menu */ MENU_ID MenuAddInfoEntry (int x, int y, int w, const XBCentralInfo * stat, MIC_button func, void *funcData) { return MenuAdd (MenuCreateInfoEntry (x, y, w, stat, func, funcData)); } /* MenuAddHButton */ /*------------------------------------------------------------------------ * * Event handling * *------------------------------------------------------------------------*/ /* * redraw routine for menu (used after timer event) */ void MenuUpdateWindow (void) { XBMenuItem *item; XBEventData eData; /* call poll routines for all objects */ for (item = itemFirst; item != NULL; item = item->next) { if (NULL != item->poll) { (*item->poll) (item); } } /* shuffle sprites and mark them */ ShuffleAllSprites (); /* set rectangles to be redrawn */ SetRedrawRectangles (); /* shuffle sprites and mark them */ MarkAllSprites (); /* update maze pixmap */ UpdateMaze (); /* draw sprites into pixmap */ DrawAllSprites (); /* fade in if neccessary */ if (fadeFlag) { fadeFlag = XBFalse; /* inits */ GUI_InitFade (XBFM_IN, PIXH + SCOREH); /* do it */ while (GUI_DoFade ()) { while (XBE_TIMER != GUI_WaitEvent (&eData)) continue; } } /* update window from pixmap */ GUI_FlushPixmap (XBTrue); /* clear the redraw map */ ClearRedrawMap (); } /* MenuUpdateWindow */ /* * move focus to next item in list */ static void MoveFocus (XBMenuKey dir) { if (itemFocus != NULL) { XBMenuItem *newFocus; switch (dir) { /* arrow keys */ case XBMK_LEFT: newFocus = itemFocus->left; while (newFocus && newFocus->flags & MIF_DEACTIVATED) { newFocus = newFocus->left; } break; case XBMK_RIGHT: newFocus = itemFocus->right; while (newFocus && newFocus->flags & MIF_DEACTIVATED) { newFocus = newFocus->right; } break; case XBMK_UP: newFocus = itemFocus->up; while (newFocus && newFocus->flags & MIF_DEACTIVATED) { newFocus = newFocus->up; } break; case XBMK_DOWN: newFocus = itemFocus->down; while (newFocus && newFocus->flags & MIF_DEACTIVATED) { newFocus = newFocus->down; } break; /* next in list */ case XBMK_NEXT: newFocus = itemFocus->next; while (newFocus != NULL) { if (newFocus->focus != NULL && !(newFocus->flags & MIF_DEACTIVATED)) { break; } newFocus = newFocus->next; } break; /* previous in list */ case XBMK_PREV: newFocus = itemFocus->prev; while (newFocus != NULL) { if (newFocus->focus != NULL && !(newFocus->flags & MIF_DEACTIVATED)) { break; } newFocus = newFocus->prev; } break; default: return; } if (NULL != newFocus) { itemFocus->flags &= ~MIF_FOCUS; newFocus->flags |= MIF_FOCUS; (*itemFocus->focus) (itemFocus, XBFalse); (*newFocus->focus) (newFocus, XBTrue); itemFocus = newFocus; } } } /* MoveFocus */ /* * set mouse to position */ static void SetMousePosition (int x, int y) { XBMenuItem *newItem = MenuGetMouseItem (x, y); /* set new focus if needed */ if (NULL != newItem && !(newItem->flags & MIF_DEACTIVATED) && newItem != itemFocus) { /* take back old focus */ if (NULL != itemFocus) { itemFocus->flags &= ~MIF_FOCUS; assert (NULL != itemFocus->focus); (*itemFocus->focus) (itemFocus, XBFalse); } /* set new focus */ itemFocus = newItem; itemFocus->flags |= MIF_FOCUS; assert (NULL != itemFocus->focus); (*itemFocus->focus) (itemFocus, XBTrue); } } /* SetMousePosition */ /* * determine item under mouse */ static void MouseItem (XBEventCode button, int x, int y) { if (itemFocus != NULL && itemFocus == MenuGetMouseItem (x, y) && itemFocus->mouse != NULL) { (*itemFocus->mouse) (itemFocus, button); } } /* MouseItem */ /* * edit events */ static XBBool EditEvent (XBEventCode event, XBEventData data) { if (!mapMode) { return XBFalse; } switch (event) { case XBE_RMOUSE_2: SetOldBlock (); case XBE_RMOUSE_1: case XBE_RMOUSE_3: setPressed = 0; break; case XBE_MOUSE_2: SetToBlockFree (); case XBE_MOUSE_1: case XBE_MOUSE_3: setPressed = 1; fprintf (stderr, "mouse 1/3 pressed on %i %i \n", data.pos.x, data.pos.y); SetEditMapBlock (data.pos.x, data.pos.y); return XBFalse; /* pass mouse buttons on to default */ /* mouse motion event */ case XBE_MOUSE_MOVE: if (setPressed) { SetEditMapBlock (data.pos.x, data.pos.y); } UpdateMaze (); return XBFalse; /* pass mouse move to default */ default: return XBFalse; } return XBTrue; } /* EditEvent */ /* * default events */ static XBBool DefaultEvent (XBEventCode event, XBEventData data) { switch (event) { /* menu keys */ case XBE_MENU: switch (data.value) { case XBMK_PREV: case XBMK_NEXT: case XBMK_LEFT: case XBMK_RIGHT: case XBMK_UP: case XBMK_DOWN: MoveFocus (data.value); break; case XBMK_SELECT: SelectItem (itemFocus); break; case XBMK_ABORT: SelectItem (abortItem); break; case XBMK_DEFAULT: SelectItem (defaultItem); break; default: break; } break; /* mouse events */ case XBE_MOUSE_1: case XBE_MOUSE_2: case XBE_MOUSE_3: SetMousePosition (data.pos.x, data.pos.y); MouseItem (event, data.pos.x, data.pos.y); break; /* mouse motion event */ case XBE_MOUSE_MOVE: SetMousePosition (data.pos.x, data.pos.y); break; default: return XBFalse; } return XBTrue; } /* DefaultEvent */ /* * event handling for menus */ XBBool MenuEventLoop (void) { int result; XBEventCode event; XBEventData data; /* load background graphics */ MenuLoadTiles (); /* wait for kb event */ GUI_SetTimer (FRAME_TIME, XBTrue); GUI_SetKeyboardMode (KB_MENU); GUI_SetMouseMode (XBTrue); /* event loop */ while (1) { /* update window contents */ MenuUpdateWindow (); /* exec any delayed functions */ if (execFlag) { execFlag = XBFalse; result = MenuExecButton (); /* no menu left start (or quit) game */ if (NULL == itemFirst) { /* unload background graphics */ MenuUnloadTiles (); return result; } } /* get event from gui */ while (XBE_TIMER != (event = GUI_WaitEvent (&data))) { if (!Chat_Event (event, data) && !EditEvent (event, data) && !DefaultEvent (event, data)) { continue; } result = MenuExecButton (); /* no menu left start (or quit) game */ if (NULL == itemFirst) { /* unload background graphics */ MenuUnloadTiles (); return result; } } } /* unload background graphics */ MenuUnloadTiles (); return XBTrue; } /* MenuEventLoop */ /* * set default item */ void MenuDeleteItemById (MENU_ID id) { XBMenuItem *itemTemp; XBMenuItem *item_next; itemTemp = FindItem (id); if (itemTemp == NULL) { return; } item_next = itemTemp->next; DeleteMenuItem (itemTemp); itemTemp = item_next; } /* MenuDeleteItemById */ /* * end of file mi_tool.c */ xblast-2.10.4/mi_tool.h0000644000175000017500000001467210372731124014035 0ustar rhondaalfie/* * file mi_tool.h * * $Id: mi_tool.h,v 1.21 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_MI_TOOL_H #define XBLAST_MI_TOOL_H /* * macros */ #define CELL_W 8 #define CELL_H 8 #define CELL_MAX_X (PIXW/CELL_W) /* * type defintions */ /* unique identifier for each created menu item */ typedef unsigned MENU_ID; /* callback function for buttons */ typedef XBBool (*MIC_button) (void *); typedef void (*MIC_cyclic) (void *); /* data input for combo items */ typedef struct { const char *text; int value; void *data; XBAtom atom; } XBComboEntryList; /* rgb storage for color editors */ typedef struct { int red; int green; int blue; } XBRgbValue; /* host item handler */ typedef void (*XBHSFocusFunc) (unsigned); typedef XBBool (*XBHSChangeFunc) (unsigned, XBHostState *); typedef XBBool (*XBHSUpdateFunc) (unsigned, XBHostState *, XBHostState *, int *); /* team item handler */ typedef void (*XBTSFocusFunc) (unsigned, unsigned); typedef XBBool (*XBTSChangeFunc) (unsigned, unsigned, XBTeamState *); typedef XBBool (*XBTSUpdateFunc) (unsigned, unsigned, XBTeamState *, XBTeamState *); /* * global prototypes */ extern void MenuClear (void); extern void MenuFocus (MENU_ID); extern void MenuSelect (MENU_ID); extern void MenuSetAbort (MENU_ID); extern void MenuSetDefault (MENU_ID); extern void MenuExecFunc (MIC_button func, void *data); extern void MenuSetActive (MENU_ID, XBBool active); void MenuDeleteItemById (MENU_ID id); extern void MenuSetLinks (void); extern void MenuUpdateWindow (void); extern MENU_ID MenuGetFocus (void); extern XBBool MenuEventLoop (void); extern MENU_ID MenuAddHButton (int x, int y, int w, const char *text, MIC_button func, void *funcData); extern MENU_ID MenuAddVButton (int x, int y, int h, const char *text, MIC_button func, void *funcData); extern MENU_ID MenuAddToggle (int x, int y, int w, const char *text, XBBool * pState); extern MENU_ID MenuAddLabel (int x, int y, int w, const char *text); extern MENU_ID MenuAddLabel1 (int x, int y, int w, const char *text); extern MENU_ID MenuAddLabel2 (int x, int y, int w, const char *text); extern MENU_ID MenuAddComboInt (int x, int y, int w_text, const char *text, int w, int *value, XBComboEntryList * table); extern MENU_ID MenuAddComboBool (int x, int y, int w_text, const char *text, int w, XBBool * value); extern MENU_ID MenuAddComboData (int x, int y, int w_text, const char *text, int w, void **value, XBComboEntryList * table); extern MENU_ID MenuAddComboAtom (int x, int y, int w_text, const char *text, int w, XBAtom * value, XBComboEntryList * table); extern MENU_ID MenuAddCombo (int x, int y, int w_text, const char *text, int w, int *value, void **data, XBAtom * atom, XBComboEntryList * table); extern MENU_ID MenuAddPlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int n_anime, BMSpriteAnimation * anime); extern MENU_ID MenuAddConfigPlayer (int x, int y, int w, int sprite, const CFGPlayerGraphics ** cfg, int n_anime, BMSpriteAnimation * anime, XBRgbValue * pRgb); extern MENU_ID MenuAddString (int x, int y, int w_text, const char *text, int w, char *buffer, size_t len); extern MENU_ID MenuAddColor (int x, int y, int w, const char *text, XBColor * color, XBRgbValue * pRgb); extern MENU_ID MenuAddKeysym (int x, int y, int w, const char *text, XBAtom * pKey); extern MENU_ID MenuAddCyclic (MIC_cyclic func, void *par); extern MENU_ID MenuAddInteger (int x, int y, int w_text, const char *text, int w, int *pValue, int min, int max); extern MENU_ID MenuAddTag (int x, int y, int w, const char **pText); extern MENU_ID MenuAddIntTag (int x, int y, int w, int *pNr); /* host items for server/client wait menus */ extern MENU_ID MenuAddHost (int x, int y, int w, unsigned client, const char **pText, XBHSFocusFunc focusFunc, XBHSChangeFunc chgFunc, XBHSUpdateFunc upFunc); extern MENU_ID MenuAddServer (int x, int y, int w, const char **pText); extern MENU_ID MenuAddClient (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing); extern MENU_ID MenuAddPeer (int x, int y, int w, const char **pText, XBHostState * pState, const int *pPing); /* team items for server/client wait menus */ extern MENU_ID MenuAddTeam (int x, int y, int w, unsigned id, unsigned player, XBTSFocusFunc focusFunc, XBTSChangeFunc chgFunc, XBTSUpdateFunc upFunc); extern MENU_ID MenuAddServerTeam (int x, int y, int w, XBTeamState * pTeam); extern MENU_ID MenuAddPeerTeam (int x, int y, int w, XBTeamState * pTeam); extern MENU_ID MenuAddStatHeader (int x, int y, int w, const char *title); extern MENU_ID MenuAddStatEntry (int x, int y, int w, const XBStatData * pStat, MIC_button func, void *funcData); extern MENU_ID MenuAddDemoEntry (int x, int y, int w, const CFGDemoEntry * pDemo, MIC_button func, void *funcData); extern MENU_ID MenuAddDemoHeader (int x, int y, int w); extern MENU_ID MenuAddGameEntry (int x, int y, int w, const XBNetworkGame **, MIC_button func); extern MENU_ID MenuAddGameHeader (int x, int y, int w); extern MENU_ID MenuAddCentralHeader (int x, int y, int w, const char *title); // XBCC extern MENU_ID MenuAddCentralEntry (int x, int y, int w, const XBCentralData * stat, MIC_button func, void *funcData); // XBCC extern MENU_ID MenuAddInfoHeader (int x, int y, int w, const char *title); // XBCC extern MENU_ID MenuAddInfoEntry (int x, int y, int w, const XBCentralInfo * stat, MIC_button func, void *funcData); // XBCC extern void SetPressed (XBBool mode); extern XBBool GetPressed (void); extern void SetXBEditMapMode (XBBool mode); extern XBBool GetXBEditMapMode (void); extern int GetChatMode (void); extern void SetChatMode (int mode); #endif /* * end of file mi_tool.h */ xblast-2.10.4/missing0000755000175000017500000002540610370762703013623 0ustar rhondaalfie#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xblast-2.10.4/mkinstalldirs0000755000175000017500000000662210370762703015031 0ustar rhondaalfie#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xblast-2.10.4/net_dgram.c0000644000175000017500000001223010372731124014312 0ustar rhondaalfie/* * file net_dgram.c - Datagrams for in game messages * * $Id: net_dgram.c,v 1.12 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local structures */ struct _xb_datagram { void *data; size_t len; }; /* * local const */ #define DGRAM_START 0x68 #define DGRAM_STOP 0x16 /* * local variables */ static unsigned char buffer[MAX_DGRAM_SIZE + 3]; /* * create a datagram */ XBDatagram * Net_CreateDatagram (const void *data, size_t len) { XBDatagram *ptr; assert (len <= MAX_DGRAM_SIZE); /* alloc data */ ptr = calloc (1, sizeof (XBDatagram)); assert (NULL != ptr); /* alloc buffer */ ptr->data = calloc (len + 1, 1); assert (NULL != ptr->data); /* set values */ ptr->len = len; if (NULL != data) { memcpy (ptr->data, data, len); } /* that's all */ return ptr; } /* Net_CreateDatagram */ /* * delete datagram */ void Net_DeleteDatagram (XBDatagram * ptr) { assert (ptr != NULL); assert (ptr->data != NULL); free (ptr->data); free (ptr); } /* Net_DeleteDatagram */ /* * write datagram to local buffer */ static void MakeDatagram (const XBDatagram * ptr) { assert (ptr != NULL); /* write buffer */ buffer[0] = DGRAM_START; buffer[1] = ptr->len; memcpy (buffer + 2, ptr->data, ptr->len); buffer[ptr->len + 2] = DGRAM_STOP; /* send it */ #ifdef DEBUG_TELE { int i; Dbg_Out ("snd dgram "); for (i = 0; i < ptr->len; i++) { Dbg_Out ("%02x ", (unsigned)(buffer[i + 2])); } Dbg_Out ("(%u bytes)\n", ptr->len); } #endif } /* MakeDatagram */ /* * send datagram on a socket */ XBBool Net_SendDatagram (const XBDatagram * ptr, const XBSocket * pSocket) { int result; /* fill buffer */ MakeDatagram (ptr); #ifdef DEBUG_UDP /* simulate heavy data loss */ if (rand () % 2) { Dbg_Dgram ("dgram discarded, simulated data loss\n"); return XBTrue; } #endif result = Socket_Send (pSocket, buffer, ptr->len + 3); switch (result) { case XB_SOCKET_END_OF_FILE: case XB_SOCKET_ERROR: return XBFalse; case XB_SOCKET_WOULD_BLOCK: return XBTrue; default: return (ptr->len + 3 == (size_t) result); } } /* Net_SendDatagram */ /* * send datagram to specified peer with given broadcast option */ XBBool Net_SendDatagramTo (const XBDatagram * ptr, XBSocket * pSocket, const char *host, unsigned short port, XBBool broadcast) { int result; /* fill buffer */ MakeDatagram (ptr); /* enable broadcast if needed */ if (broadcast && !Socket_SetBroadcast (pSocket, broadcast)) { Dbg_Out ("failed to set broadcast flag on socket!\n"); return XBFalse; } result = Socket_SendTo (pSocket, buffer, ptr->len + 3, host, port); switch (result) { case XB_SOCKET_END_OF_FILE: case XB_SOCKET_ERROR: return XBFalse; case XB_SOCKET_WOULD_BLOCK: return XBTrue; default: return (ptr->len + 3 == (size_t) result); } } /* Net_SendDatagram */ /* * parse datagram in read buffer */ static XBDatagram * ParseDatagram (size_t len) { switch (len) { case XB_SOCKET_END_OF_FILE: case XB_SOCKET_WOULD_BLOCK: case XB_SOCKET_ERROR: return NULL; } /* length check */ if (len < 3) { return NULL; } /* check start */ if (buffer[0] != DGRAM_START) { return NULL; } /* check length stop */ if (buffer[1] + 3 != (unsigned char)len) { return NULL; } /* check stop */ if (buffer[len - 1] != DGRAM_STOP) { return NULL; } #ifdef DEBUG_TELE { size_t i; Dbg_Out ("rcv dgram "); for (i = 0; i < buffer[1]; i++) { Dbg_Out ("%02x ", (unsigned)buffer[i + 2]); } Dbg_Out ("(%u bytes)\n", (unsigned)buffer[1]); } #endif /* datagram is correct */ return Net_CreateDatagram (buffer + 2, buffer[1]); } /* ParseDatagram */ /* * receive datagram */ XBDatagram * Net_ReceiveDatagram (const XBSocket * pSocket) { #ifdef W32 long len; #else ssize_t len; #endif len = Socket_Receive (pSocket, buffer, sizeof (buffer)); return ParseDatagram (len); } /* Net_ReceiveDatagram */ /* * receive datagram */ XBDatagram * Net_ReceiveDatagramFrom (XBSocket * pSocket, const char **host, unsigned short *port) { #ifdef W32 long len; #else ssize_t len; #endif len = Socket_ReceiveFrom (pSocket, buffer, sizeof (buffer), host, port); return ParseDatagram (len); } /* Net_ReceiveDatagram */ /* * contents of datagram */ const void * Net_DgramData (const XBDatagram * dgram, size_t * len) { assert (NULL != dgram); assert (NULL != len); *len = dgram->len; return dgram->data; } /* Net_DgramData* */ /* * end of file net_dgram.c */ xblast-2.10.4/net_dgram.h0000644000175000017500000000333310372731124014323 0ustar rhondaalfie/* * file net_dgram.h - Datagrams for in game messages * * $Id: net_dgram.h,v 1.5 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_NET_DGRAM_H #define XBLAST_NET_DGRAM_H /* * global constants */ #define MAX_DGRAM_SIZE 255 /* * type definitions */ typedef struct _xb_datagram XBDatagram; /* * global prototypes */ extern XBDatagram *Net_CreateDatagram (const void *data, size_t len); extern void Net_DeleteDatagram (XBDatagram *); extern XBBool Net_SendDatagram (const XBDatagram * dgram, const XBSocket * pSocket); extern XBBool Net_SendDatagramTo (const XBDatagram * dgram, XBSocket * pSocket, const char *host, unsigned short port, XBBool broadcast); extern XBDatagram *Net_ReceiveDatagram (const XBSocket * pSocket); extern XBDatagram *Net_ReceiveDatagramFrom (XBSocket * pSocket, const char **host, unsigned short *port); extern const void *Net_DgramData (const XBDatagram * dgram, size_t * len); #endif /* * end of file net_dgram.h */ xblast-2.10.4/net_socket.c0000644000175000017500000001370310412220337014510 0ustar rhondaalfie/* * net_socket.c - low level functions to network communication * * $Id: net_socket.c,v 1.10 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* make sure that port range defines are in place */ #ifndef USER_MINPORT #define USER_MINPORT 0 #endif #ifndef USER_MAXPORT #define USER_MAXPORT 0 #endif /* * close and delete socket structure */ void Net_Close (XBSocket * pSocket) { assert (NULL != pSocket); Socket_Close (pSocket); Socket_Free (pSocket); } /* Net_Close */ /* * bind a socket to a user port on given interface */ static XBBool Net_BindUserPort (XBSocket * pSocket, const char *localname) { unsigned short port; /* make sure user requests a port range */ assert (USER_MINPORT < USER_MAXPORT); /* find a free port */ for (port = USER_MINPORT; port <= USER_MAXPORT; port++) { if (Socket_SetAddressInet (pSocket, XBFalse, localname, port) && Socket_Bind (pSocket)) { return XBTrue; } } Dbg_Out ("NET: failed to bind to user port range\n"); return XBFalse; } /* Net_BindUserPort */ /* * try to connect to server (via TCP/IP) */ XBSocket * Net_ConnectInet (const char *hostName, unsigned short port) { XBSocket *pSocket = NULL; /* create socket structure */ pSocket = Socket_Alloc (AF_INET); /* create socket */ if (!Socket_Open (pSocket, SOCK_STREAM)) { goto Error; } if (!Socket_SetAddressInet (pSocket, XBTrue, hostName, port)) { goto Error; } /* bind to user port range locally, if requested */ if (USER_MINPORT < USER_MAXPORT && !Net_BindUserPort (pSocket, NULL)) { goto Error; } /* now try to connect */ if (!Socket_Connect (pSocket)) { goto Error; } /* that's all */ return pSocket; /* * Error handling */ Error: Net_Close (pSocket); return NULL; } /* Net_ConnectInet */ /* * listen for client to connect */ XBSocket * Net_ListenInet (unsigned short port) { XBSocket *pSocket = NULL; /* alloc socket data structure */ pSocket = Socket_Alloc (AF_INET); /* create socket */ if (!Socket_Open (pSocket, SOCK_STREAM)) { goto Error; } /* set socket address structure */ if (!Socket_SetAddressInet (pSocket, XBFalse, NULL, port)) { goto Error; } /* enable reuse */ if (!Socket_SetReuse (pSocket)) { goto Error; } /* bind to set address */ if (!Socket_Bind (pSocket)) { goto Error; } /* now activate listen socket */ if (!Socket_Listen (pSocket)) { goto Error; } /* that's all */ return pSocket; /* * Error handling */ Error: Net_Close (pSocket); return NULL; } /* Net_ListenInet */ /* * accept client connection */ XBSocket * Net_Accept (const XBSocket * pListen) { XBSocket *pSocket; /* alloc Socket data structure */ pSocket = Socket_Alloc (Socket_Family (pListen)); assert (pSocket != NULL); /* try to accept client */ if (!Socket_Accept (pSocket, pListen)) { goto Error; } /* that's all */ return pSocket; /* * Error handling */ Error: Net_Close (pSocket); return NULL; } /* Net_AcceptInet */ /* * create datagram socket for host */ XBSocket * Net_BindUdp (const char *localname, unsigned port) { XBSocket *pSocket; /* create socket structure */ pSocket = Socket_Alloc (AF_INET); assert (pSocket != NULL); /* create socket */ if (!Socket_Open (pSocket, SOCK_DGRAM)) { goto Error; } /* bind socket */ if (USER_MINPORT < USER_MAXPORT && port == 0) { /* any port, use user port range */ if (!Net_BindUserPort (pSocket, localname)) { goto Error; } } else { /* bind with given port, let system choose, if necessary */ if (!Socket_SetAddressInet (pSocket, XBFalse, localname, port)) { goto Error; } if (!Socket_Bind (pSocket)) { goto Error; } } /* that's all */ return pSocket; /* * Error handling */ Error: Net_Close (pSocket); return NULL; } /* Net_BindInet */ /* * connect datagram socket to port */ XBBool Net_ConnectUdp (XBSocket * pSocket, const char *hostName, unsigned short port) { /* set it */ if (!Socket_SetAddressInet (pSocket, XBTrue, hostName, port)) { return XBFalse; } /* now try to connect */ if (!Socket_Connect (pSocket)) { return XBFalse; } return XBTrue; } /* Net_ConnectUdp */ /* * get local host name of socket */ const char * Net_LocalName (const XBSocket * pSocket) { const char *name; static char hostName[32]; assert (pSocket != NULL); if (NULL == (name = Socket_HostName (pSocket, XBFalse))) { return NULL; } assert (sizeof (hostName) > strlen (name)); strcpy (hostName, name); return hostName; } /* Net_Hostname */ /* * get remote host name of socket */ const char * Net_RemoteName (const XBSocket * pSocket) { const char *name; static char hostName[32]; assert (pSocket != NULL); if (NULL == (name = Socket_HostName (pSocket, XBTrue))) { return NULL; } assert (sizeof (hostName) > strlen (name)); strcpy (hostName, name); return hostName; } /* Net_RemoteName */ /* * get local port of socket */ unsigned Net_LocalPort (const XBSocket * pSocket) { assert (pSocket != NULL); return Socket_HostPort (pSocket, XBFalse); } /* Net_LocalPort */ /* * get remote port of socket */ unsigned Net_RemotePort (const XBSocket * pSocket) { assert (pSocket != NULL); return Socket_HostPort (pSocket, XBTrue); } /* Net_RemotePort */ /* * end of file net_socket.c */ xblast-2.10.4/net_socket.h0000644000175000017500000000321410372731124014517 0ustar rhondaalfie/* * net_socket.h - low level functions to network communication * * $Id: net_socket.h,v 1.11 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_NET_SOCKET_H #define XBLAST_NET_SOCKET_H /* * global prototypes */ extern void Net_Init (void); extern XBSocket *Net_ConnectInet (const char *hostname, unsigned short port); extern XBSocket *Net_ListenInet (unsigned short port); extern XBSocket *Net_Accept (const XBSocket * pSocket); extern XBSocket *Net_BindUdp (const char *device, unsigned port); extern XBBool Net_ConnectUdp (XBSocket *, const char *, unsigned short); extern void Net_Close (XBSocket * socket); extern const char *Net_LocalName (const XBSocket * pSocket); extern const char *Net_RemoteName (const XBSocket * pSocket); extern unsigned Net_LocalPort (const XBSocket * pSocket); extern unsigned Net_RemotePort (const XBSocket * pSocket); #endif /* * end of file net_socket.h */ xblast-2.10.4/net_tele.c0000644000175000017500000003553310372731124014164 0ustar rhondaalfie/* * net_tele.c - telegrams for cleint/server communication * * $Id: net_tele.c,v 1.11 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define MAX_HEADER_SIZE 5 #define MAX_DATA_SIZE 255 #define MAX_TAIL_SIZE 1 #define MAX_TOTAL_SIZE (MAX_HEADER_SIZE + MAX_DATA_SIZE + MAX_TAIL_SIZE) #define START_BYTE 0x68 #define STOP_BYTE 0x16 /* * local types */ typedef int (*WriteFunc) (const XBSocket *, const void *, size_t); typedef int (*ReadFunc) (const XBSocket *, void *, size_t); /* details the parse state of a telegram */ typedef enum { PS_Start, PS_Len, PS_COT, PS_ID, PS_IOB, PS_Data, PS_Stop } ParseState; /* extracted telegram information */ struct _xb_telegram { XBTeleCOT cot; XBTeleID id; unsigned char iob; void *data; size_t len; XBTelegram *next; }; /* telegram queue */ typedef struct _xb_any_queue { XBTelegram *first; XBTelegram *last; } XBAnyQueue; /* for sending */ struct _xb_snd_queue { XBAnyQueue any; size_t wIndex; /* next byte to write */ size_t wLen; /* bytes to write */ char wBuf[MAX_TOTAL_SIZE]; /* data to write */ }; /* for receiving */ struct _xb_rcv_queue { XBAnyQueue any; size_t rIndex; /* next byte to read */ size_t rLen; /* length to be read */ XBBool rFlag; /* flag to read more data */ ParseState rState; /* current state of reading */ size_t dCount; /* length of read data block */ char rBuf[MAX_TOTAL_SIZE]; /* buffer read from socket */ char tBuf[MAX_TOTAL_SIZE]; /* extracted telegram */ }; /*------------------------------------------------------------------------* * * Debugoutput * *------------------------------------------------------------------------*/ #ifdef DEBUG_TELE /* * translate COT codes */ const char * StringCOT (XBTeleCOT cot) { switch (cot) { case XBT_COT_Activate: return "act"; case XBT_COT_Spontaneous: return "spont"; case XBT_COT_SendData: return "snd_dat"; case XBT_COT_RequestData: return "req_dat"; case XBT_COT_DataNotAvailable: return "dat_not"; case XBT_COT_DataAvailable: return "dat_ava"; default: return "???"; } } /* StringCOT */ /* * translate ID codes */ const char * StringID (XBTeleID id) { switch (id) { case XBT_ID_GameConfig: return "gam_cfg"; case XBT_ID_PlayerConfig: return "plr_cfg"; case XBT_ID_RequestDisconnect: return "req_dis"; case XBT_ID_HostDisconnected: return "hst_dis"; case XBT_ID_StartGame: return "sta_gam"; case XBT_ID_RandomSeed: return "rnd_sed"; case XBT_ID_LevelConfig: return "lvl_cfg"; case XBT_ID_DgramPort: return "dgm_prt"; case XBT_ID_Sync: return "sync"; case XBT_ID_HostIsIn: return "hst_in"; case XBT_ID_HostIsOut: return "hst_out"; case XBT_ID_TeamChange: return "tm_cng"; case XBT_ID_GameStat: return "gm_stat"; case XBT_ID_PID: , return "pid"; case XBT_ID_WinnerTeam: , return "win_tm"; case XBT_ID_Async: return "async"; case XBT_ID_Chat: return "chat"; case XBT_ID_HostChange: return "hst_chg"; case XBT_ID_HostChangeReq: return "hst_req"; case XBT_ID_TeamChangeReq: return "tm_req"; default: return "???"; } } /* StringID */ /* * output telegram */ static void DebugTelegram (FILE * fout, const XBTelegram * tele) { fprintf (fout, "%s %s %03u (%03u Bytes)", StringID (tele->id), StringCOT (tele->cot), (unsigned)tele->iob, (unsigned)tele->len); if (tele->len > 0) { size_t i; const char *s = tele->data; fputs (" \"", fout); for (i = 0; i < tele->len; i++) { if (isprint (s[i])) { fputc (s[i], fout); } else { fprintf (fout, "\\%03o", (unsigned)s[i]); } } fputc ('\"', fout); } } /* DebugTelegram */ #endif /*------------------------------------------------------------------------* * * XBTelegram * *------------------------------------------------------------------------*/ /* * create a new telegram from given data */ XBTelegram * Net_CreateTelegram (XBTeleCOT cot, XBTeleID id, XBTeleIOB iob, const void *buf, size_t len) { XBTelegram *tele; assert (len < MAX_DATA_SIZE); tele = calloc (1, sizeof (XBTelegram)); assert (tele != NULL); tele->cot = cot; tele->id = id; tele->iob = iob; /* copy buffer if needed */ if (buf != NULL && len != 0) { tele->len = len; tele->data = malloc (len); assert (tele->data != NULL); memcpy (tele->data, buf, len); } return tele; } /* Net_CreateTelegram */ /* * delete a telegram */ void Net_DeleteTelegram (XBTelegram * tele) { assert (tele != NULL); if (NULL != tele->data) { free (tele->data); } free (tele); } /* Net_DeleteTelegram */ /* * write telegram to a given buffer, return size */ static size_t WriteTelegram (const XBTelegram * tele, char *buf) { char *ptr = buf; /* write header */ *ptr++ = START_BYTE; *ptr++ = tele->len; *ptr++ = (char)tele->cot; *ptr++ = (char)tele->id; *ptr++ = (char)tele->iob; /* write data */ assert (tele->len < MAX_DATA_SIZE); if (tele->len > 0) { assert (tele->data != NULL); memcpy (ptr, tele->data, tele->len); ptr += tele->len; } /* write tail */ *ptr++ = STOP_BYTE; /* return len */ return ptr - buf; } /* WriteTelegram */ /*------------------------------------------------------------------------* * * XBAnyQueue * *------------------------------------------------------------------------*/ /* * delete a queue completely */ static void DeleteAnyQueue (XBAnyQueue * list) { XBTelegram *teleNext; for (; list->first != NULL; list->first = teleNext) { teleNext = list->first->next; Net_DeleteTelegram (list->first); } } /* DeleteAnyQueue */ /* * add telegram to to a queue */ static void AddTelegram (XBAnyQueue * list, XBTelegram * tele) { assert (list != NULL); assert (tele != NULL); if (NULL == list->last) { list->first = tele; } else { list->last->next = tele; } list->last = tele; #ifdef DEBUG_TELE fputs ("add tele:", stderr); DebugTelegram (stderr, tele); fputc ('\n', stderr); #endif } /* AddTelegram */ /* * get first telegram from queue */ static XBTelegram * GetTelegram (XBAnyQueue * list) { XBTelegram *tele; assert (list != NULL); /* first element from list */ tele = list->first; /* update list if needed */ if (list->first != NULL) { list->first = list->first->next; } if (list->first == NULL) { list->last = NULL; } return tele; } /* GetTelegram */ /*------------------------------------------------------------------------* * * XBSndQueue * *------------------------------------------------------------------------*/ /* * create a snd queue */ XBSndQueue * Net_CreateSndQueue (XBBool server) { XBSndQueue *list = calloc (1, sizeof (XBSndQueue)); assert (list != NULL); return list; } /* Net_CreateSndQueue */ /* * delete a sndqueue */ void Net_DeleteSndQueue (XBSndQueue * list) { DeleteAnyQueue (&list->any); free (list); } /* Net_DeleteSndQueue */ /* * write a first telegram fro queue to socket */ XBTeleResult Net_Send (XBSndQueue * list, const XBSocket * pSocket) { int result; XBTelegram *tele; assert (list != NULL); /* check if new telegram must be written to buffer */ if (0 == list->wLen && NULL != (tele = GetTelegram (&list->any))) { #ifdef DEBUG_TELE Dbg_Out ("wrt tele %d (%03u bytes)\n", Socket_Fd (pSocket), tele->len); #endif list->wLen = WriteTelegram (tele, list->wBuf); list->wIndex = 0; Net_DeleteTelegram (tele); } /* check if any unwritten bytes are left in the buffer */ if (list->wIndex < list->wLen) { result = Socket_Send (pSocket, list->wBuf + list->wIndex, list->wLen - list->wIndex); switch (result) { case XB_SOCKET_ERROR: Dbg_Out ("ERROR while writing\n"); return XBT_R_IOError; case XB_SOCKET_END_OF_FILE: Dbg_Out ("END_OF_FILE while writing\n"); return XBT_R_IOError; case XB_SOCKET_WOULD_BLOCK: return XBT_R_Continue; default: break; } list->wIndex += result; /* mark as complete send */ if (list->wIndex == list->wLen) { list->wLen = list->wIndex = 0; } } /* check if we need to call write again */ if (list->wLen > 0 || list->any.first != NULL) { return XBT_R_Continue; } else { return XBT_R_Complete; } } /* Net_Send */ /* * add a telegram to the send queue */ void Net_SendTelegram (XBSndQueue * list, XBTelegram * tele) { #ifdef DEBUG_TELE Dbg_Out (" > snd "); #endif AddTelegram (&list->any, tele); } /* Net_SendTelegram */ /*------------------------------------------------------------------------* * * XBRcvQueue * *------------------------------------------------------------------------*/ /* * create rcv queue */ XBRcvQueue * Net_CreateRcvQueue (XBBool server) { XBRcvQueue *list = calloc (1, sizeof (XBRcvQueue)); assert (list != NULL); list->rState = PS_Start; list->rFlag = XBTrue; return list; } /* Net_CreateRcvQueue */ /* * delete rcv queue */ void Net_DeleteRcvQueue (XBRcvQueue * list) { DeleteAnyQueue (&list->any); free (list); } /* Net_DeleteRcvQueue */ /* * fill read buffer from socket */ static XBTeleResult ReadBuffer (XBRcvQueue * list, const XBSocket * pSocket) { #ifdef W32 long result; #else ssize_t result; #endif result = Socket_Receive (pSocket, list->rBuf, MAX_TOTAL_SIZE); switch (result) { case XB_SOCKET_ERROR: return XBT_R_IOError; case XB_SOCKET_END_OF_FILE: return XBT_R_EndOfFile; case XB_SOCKET_WOULD_BLOCK: result = 0; break; } list->rLen = result; list->rIndex = 0; return XBT_R_Continue; } /* ReadBuffer */ /* * fetch byte from internal read buffer */ static XBBool GetByte (XBRcvQueue * list, size_t tIndex) { if (list->rIndex < list->rLen) { list->tBuf[tIndex] = list->rBuf[list->rIndex++]; return XBTrue; } else { return XBFalse; } } /* GetByte */ /* * read telegram data from socket */ XBTeleResult Net_Receive (XBRcvQueue * list, const XBSocket * pSocket) { size_t i, len; XBTelegram *tele; assert (list != NULL); /* check if more input is needed */ if (list->rFlag) { XBTeleResult result; /* try tp read from socket into buffer */ if (XBT_R_Continue != (result = ReadBuffer (list, pSocket))) { return result; } /* assume we will complete the telegram */ list->rFlag = XBFalse; } /* parse read buffer until empty or parse error */ while (1) { switch (list->rState) { case PS_Start: /* we need a start byte */ do { /* try to get first start byte in buffer */ if (!GetByte (list, 0)) { /* failed, mark for input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('{', stderr); #endif } while (list->tBuf[0] != START_BYTE); /* restart loop needing length byte */ list->rState = PS_Len; break; case PS_Len: /* we need a length byte */ /* try to get len byte */ if (!GetByte (list, 1)) { /* failed, mark for more input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('L', stderr); #endif /* restart loop needing COT */ list->rState = PS_COT; break; case PS_COT: /* we need COT */ /* try to read COT */ if (!GetByte (list, 2)) { /* failed, mark for more input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('C', stderr); #endif /* need signal id now */ list->rState = PS_ID; break; case PS_ID: /* need signal id */ /* try to read id byte */ if (!GetByte (list, 3)) { /* failed, mark for more input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('I', stderr); #endif /* need IOB now */ list->rState = PS_IOB; break; case PS_IOB: /* need IOB */ /* try to get IOB byte */ if (!GetByte (list, 4)) { /* failed, mark for more input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('i', stderr); #endif /* need data now, no data so far */ list->rState = PS_Data; list->dCount = 0; break; case PS_Data: /* need data */ /* data length needed */ len = list->tBuf[1]; /* try to read data byte by byte */ for (i = list->dCount; i < len; i++) { /* try to get it */ if (!GetByte (list, MAX_HEADER_SIZE + i)) { /* failed, mark for more input, update data count so far and return */ list->rFlag = XBTrue; list->dCount = i; return XBT_R_Continue; } #ifdef DEBUG_TELE fputc ('.', stderr); #endif } #ifdef DEBUG_TELE fputc ('D', stderr); #endif /* need stop now */ list->rState = PS_Stop; break; case PS_Stop: /* need stop */ /* try to read stop byte */ len = list->tBuf[1]; if (!GetByte (list, MAX_HEADER_SIZE + len)) { /* failed, mark for more input and return */ list->rFlag = XBTrue; return XBT_R_Continue; } /* we will need start byte next, in any case */ list->rState = PS_Start; /* check stop byte */ if (STOP_BYTE != list->tBuf[MAX_HEADER_SIZE + len]) { /* wrong byte, return parse error */ return XBT_R_TeleError; } #ifdef DEBUG_TELE Dbg_Out ("}\n"); #endif /* telegram is now complete, create the structurre */ tele = Net_CreateTelegram (list->tBuf[2], list->tBuf[3], list->tBuf[4], list->tBuf + MAX_HEADER_SIZE, len); assert (NULL != tele); #ifdef DEBUG_TELE Dbg_Out (" < rcv "); #endif /* add it to the queue */ AddTelegram (&list->any, tele); /* continue to parse buffer for more telegrams */ } } return XBT_R_TeleError; } /* Net_Receive */ /* * get first telegram in receive queue */ XBTelegram * Net_ReceiveTelegram (XBRcvQueue * list) { return GetTelegram (&list->any); } /* Net_ReceiveTelegram */ /* * get cause of telegram transmission */ XBTeleCOT Net_TeleCOT (const XBTelegram * tele) { assert (tele != NULL); return tele->cot; } /* Net_TeleCOT */ /* * get id of telegram */ XBTeleID Net_TeleID (const XBTelegram * tele) { assert (tele != NULL); return tele->id; } /* Net_TeleID */ /* * get iob of telegram */ XBTeleIOB Net_TeleIOB (const XBTelegram * tele) { assert (tele != NULL); return tele->iob; } /* Net_TeleIOB */ /* * get telegram data */ const void * Net_TeleData (const XBTelegram * tele, size_t * len) { assert (tele != NULL); assert (len != NULL); *len = tele->len; return tele->data; } /* Net_TeleData */ /* * end of file net_tele.c */ xblast-2.10.4/net_tele.h0000644000175000017500000000763510372731124014173 0ustar rhondaalfie/* * net_tele.h - telegrams for cleint/server communication * * $Id: net_tele.h,v 1.12 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _NET_TELE_H #define _NET_TELE_H /* * type declarations */ typedef struct _xb_telegram XBTelegram; typedef struct _xb_snd_queue XBSndQueue; typedef struct _xb_rcv_queue XBRcvQueue; /* * type definitions */ /* cause of transmission */ typedef enum { XBT_COT_Activate, /* server demands activation */ XBT_COT_Spontaneous, /* client message */ XBT_COT_SendData, /* send data to client */ XBT_COT_RequestData, /* request data from client */ XBT_COT_DataNotAvailable, /* client does not have data */ XBT_COT_DataAvailable, /* client has data */ /* --- */ NUM_XBT_COT } XBTeleCOT; /* telegram object id */ typedef enum { XBT_ID_GameConfig, /* game data */ XBT_ID_PlayerConfig, /* player data */ XBT_ID_RequestDisconnect, /* host wants disconnect */ XBT_ID_HostDisconnected, /* message host has disconnected */ XBT_ID_StartGame, /* server starts the game */ XBT_ID_RandomSeed, /* seed for random numer generator */ XBT_ID_LevelConfig, /* level data */ XBT_ID_DgramPort, /* port for datagram connection */ XBT_ID_Sync, /* synchronisation between client and server */ XBT_ID_HostIsIn, /* host is in game */ XBT_ID_HostIsOut, /* host is out of game */ XBT_ID_TeamChange, /* Team Change */ XBT_ID_GameStat, /* Host sends game statistics */ XBT_ID_PID, /* Central sends PID */ XBT_ID_WinnerTeam, /* Client sends winner team for level */ XBT_ID_Async, /* client and server asynced */ XBT_ID_Chat, /* Server/Client sends chat line */ XBT_ID_HostChange, /* host state change by server */ XBT_ID_HostChangeReq, /* host change request */ XBT_ID_TeamChangeReq, /* team change request */ /* --- */ NUM_XBT_ID } XBTeleID; /* result of i/o operations */ typedef enum { XBT_R_IOError, /* an error has occured during i/o operation */ XBT_R_TeleError, /* an error has occured during parsing */ XBT_R_Continue, /* telegram has been partially send/received */ XBT_R_Complete, /* telegram has been completely send/received */ XBT_R_EndOfFile /* stream was closed */ } XBTeleResult; /* information object adress */ typedef unsigned char XBTeleIOB; /* * global prototypes */ extern XBTelegram *Net_CreateTelegram (XBTeleCOT cot, XBTeleID id, XBTeleIOB iob, const void *data, size_t len); extern void Net_DeleteTelegram (XBTelegram * tele); extern XBSndQueue *Net_CreateSndQueue (XBBool server); extern void Net_DeleteSndQueue (XBSndQueue * list); extern XBTeleResult Net_Send (XBSndQueue * list, const XBSocket * pSocket); extern void Net_SendTelegram (XBSndQueue * list, XBTelegram * tele); extern XBRcvQueue *Net_CreateRcvQueue (XBBool server); extern void Net_DeleteRcvQueue (XBRcvQueue * list); extern XBTeleResult Net_Receive (XBRcvQueue * list, const XBSocket * pSocket); extern XBTelegram *Net_ReceiveTelegram (XBRcvQueue * list); extern XBTeleCOT Net_TeleCOT (const XBTelegram *); extern XBTeleID Net_TeleID (const XBTelegram *); extern XBTeleIOB Net_TeleIOB (const XBTelegram *); extern const void *Net_TeleData (const XBTelegram *, size_t * len); #endif /* * end of file net_tele.h */ xblast-2.10.4/network.c0000644000175000017500000006216010412220337014044 0ustar rhondaalfie/* * file network.c - shared functions for server and clients * * $Id: network.c,v 1.42 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ typedef struct _network_event { struct _network_event *next; XBNetworkEvent msg; unsigned id; } XBNetworkEventQueue; typedef struct { unsigned char host; unsigned char player; } XBHostPlayerId; /* * local variables */ /* events */ static XBNetworkEventQueue *queueFirst = NULL; static XBNetworkEventQueue *queueLast = NULL; /* network type */ static XBNetworkType nettype = XBNT_None; static unsigned char localId = MAX_HOSTS; /* player atoms and player count */ static unsigned players = 0; static XBAtom hostPlayer[MAX_HOSTS][NUM_LOCAL_PLAYER]; static XBAtom hostPlayer2[MAX_HOSTS][NUM_LOCAL_PLAYER]; /* local player counts */ static unsigned localPlayers[MAX_HOSTS]; /* global config and conversion to local */ static XBBool global = XBFalse; static CFGGame globalcfg; static XBHostPlayerId s2l[MAX_PLAYER]; static unsigned char l2s[MAX_HOSTS][NUM_LOCAL_PLAYER]; /* ping times */ static unsigned hostPing[MAX_HOSTS]; /* host/team states per host */ static XBHostState hostState[MAX_HOSTS]; static XBTeamState teamState[MAX_HOSTS][NUM_LOCAL_PLAYER]; /* default team states */ static XBTeamState defTeam[MAX_HOSTS][NUM_LOCAL_PLAYER]; /* requested raw host/team states received for each host */ static XBHostState hostStateReq[MAX_HOSTS][MAX_HOSTS]; static XBTeamState teamStateReq[MAX_HOSTS][NUM_LOCAL_PLAYER][MAX_HOSTS]; /* constant team color assignment for team states */ const XBColor teamColors[NUM_XBTS] = { COLOR_INVALID, COLOR_INVALID, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_INVALID, }; /*************** * local stuff * ***************/ /* * reset host data */ static void ClearHostLocalData (unsigned id) { unsigned host; unsigned pl; /* update total player count first */ players -= localPlayers[id]; /* clear data for host id */ hostPing[id] = -1; hostState[id] = XBHS_None; localPlayers[id] = 0; for (pl = 0; pl < NUM_LOCAL_PLAYER; pl++) { hostPlayer[id][pl] = ATOM_INVALID; hostPlayer2[id][pl] = ATOM_INVALID; teamState[id][pl] = XBTS_Invalid; } for (host = 0; host < MAX_HOSTS; host++) { hostStateReq[id][host] = XBHS_None; hostStateReq[host][id] = XBHS_None; for (pl = 0; pl < NUM_LOCAL_PLAYER; pl++) { defTeam[id][pl] = XBTS_Red; teamStateReq[id][pl][host] = XBTS_Invalid; teamStateReq[host][pl][id] = XBTS_Invalid; } } } /* ClearHostLocalData */ /****************** * initialization * ******************/ /* * clear all host data */ void Network_ClearHost (unsigned id) { ClearHostLocalData (id); Version_Remove (id); DeleteGameConfig (CT_Remote, LOCALGAMECONFIG (id)); Dbg_Network ("cleared host data #%u\n", id); } /* Network_ClearHost */ /* * clear all host, event, chat and version data */ void Network_Clear (void) { unsigned id, pl; /* clear data */ localId = MAX_HOSTS; players = 0; memset (hostPlayer, 0, sizeof (hostPlayer)); memset (hostPlayer2, 0, sizeof (hostPlayer2)); memset (localPlayers, 0, sizeof (localPlayers)); memset (hostPing, -1, sizeof (hostPing)); memset (hostState, 0, sizeof (hostState)); memset (hostStateReq, 0, sizeof (hostStateReq)); memset (teamState, 0, sizeof (teamState)); memset (teamStateReq, 0, sizeof (teamStateReq)); /* clear remote game configs and versions in database */ for (id = 0; id < MAX_HOSTS; id++) { DeleteGameConfig (CT_Remote, LOCALGAMECONFIG (id)); for (pl = 0; pl < NUM_LOCAL_PLAYER; pl++) { defTeam[id][pl] = XBTS_Red; } } /* clear global game config and links */ global = XBFalse; DeleteGameConfig (CT_Remote, SERVERGAMECONFIG); memset (s2l, 0xFF, sizeof (s2l)); memset (l2s, 0xFF, sizeof (l2s)); /* reset version management */ Version_Reset (); Network_SetType (XBNT_None); #ifdef DEBUG_NETWORK Dbg_Network ("cleared all host data\n"); #endif } /* Network_Clear */ /************************************ * network events for client/server * ************************************/ #ifdef DEBUG_NETWORK /* * network event to string */ static const char * NWEventName (XBNetworkEvent msg) { switch (msg) { case XBNW_None: return "None"; case XBNW_Accepted: return "Accepted"; case XBNW_GameConfig: return "GameConfig"; case XBNW_RightPlayerConfig: return "RightPlayerConfig"; case XBNW_LeftPlayerConfig: return "LeftPlayerConfig"; case XBNW_Joy1PlayerConfig: return "Joy1PlayerConfig"; case XBNW_Joy2PlayerConfig: return "Joy2PlayerConfig"; case XBNW_Disconnected: return "Disconnected"; case XBNW_StartGame: return "StartGame"; case XBNW_EndOfInit: return "EndOfInit"; case XBNW_LevelConfig: return "LevelConfig"; case XBNW_SyncEndOfInit: return "SyncEndOfInit"; case XBNW_SyncLevelIntro: return "SyncLevelIntro"; case XBNW_SyncLevelResult: return "SyncLevelResult"; case XBNW_SyncLevelEnd: return "SyncLevelEnd"; case XBNW_SyncScoreboard: return "SyncScoreboard"; case XBNW_HostIsIn: return "HostIsIn"; case XBNW_HostIsOut: return "HostIsOut"; case XBNW_Error: return "Error"; case XBNW_PingReceived: return "PingReceived"; case XBNW_NetworkGame: return "NetworkGame"; case XBNW_TeamChange: return "TeamChange"; case XBNW_TeamChangeData: return "TeamChangeData"; case XBNW_HostChange: return "HostChange"; default: return "unknown"; } } /* EventName */ #endif /* * clear event queue */ void Network_ClearEvents (void) { unsigned id; while (NULL != queueFirst) { (void)Network_GetEvent (&id); } #ifdef DEBUG_NETWORK Dbg_Network ("clearing all network events\n"); #endif } /* Network_ClearEvents */ /* * add event to queue */ void Network_QueueEvent (XBNetworkEvent msg, unsigned id) { /* alloc data */ XBNetworkEventQueue *ptr = calloc (1, sizeof (XBNetworkEventQueue)); assert (ptr != NULL); /* set values */ ptr->msg = msg; ptr->id = id; /* put in queue */ if (queueLast != NULL) { queueLast->next = ptr; } else { queueFirst = ptr; } queueLast = ptr; #ifdef DEBUG_NETWORK Dbg_Network ("queue network event %s %u\n", NWEventName (msg), id); #endif } /* QueueEvent */ /* * check for event in queue */ XBNetworkEvent Network_GetEvent (unsigned *pId) { XBNetworkEventQueue *ptr; XBNetworkEvent msg; assert (NULL != pId); if (NULL == queueFirst) { return XBNW_None; } /* take element from list */ ptr = queueFirst; queueFirst = queueFirst->next; if (NULL == queueFirst) { queueLast = NULL; } /* set results */ msg = ptr->msg; *pId = ptr->id; #ifdef DEBUG_NETWORK Dbg_Network ("get network event %s %u\n", NWEventName (msg), *pId); #endif /* free element */ free (ptr); /* that's all */ return msg; } /* Network_GetEvent */ /******************* * type of network * *******************/ /* * get network type */ XBNetworkType Network_GetType (void) { return nettype; } /* Network_GetType */ /* * set network type */ void Network_SetType (XBNetworkType type) { nettype = type; #ifdef DEBUG_NETWORK Dbg_Network ("setting type to %u\n", type); #endif } /* Network_SetType */ /************ * local id * ************/ /* * receive local host id */ void Network_ReceiveLocalHostId (unsigned id) { Dbg_Network ("receiving local host id = %u\n", id); localId = id & 0xFF; } /* Network_ReceiveLocalHostId */ /* * get local host id */ unsigned char Network_LocalHostId (void) { return localId; } /* Network_LocalHostId */ /************** * ping times * **************/ /* * get ping time of host */ int Network_GetPingTime (unsigned id) { assert (id < MAX_HOSTS); return hostPing[id]; } /* Network_GetPingTime */ /* * ping received */ void Network_ReceivePing (unsigned id, int ping) { assert (id < MAX_HOSTS); if (hostPing[id] != ping) { Network_QueueEvent (XBNW_PingReceived, id); } hostPing[id] = ping; } /* Network_ReceivePing */ /**************** * player atoms * ****************/ /* * get player atom */ XBAtom Network_GetPlayer (unsigned id, int player) { assert (id < MAX_HOSTS); assert (player < MAX_PLAYER); return hostPlayer[id][player]; } /* Network_GetPlayer */ /* * get player atom */ XBAtom Network_GetPlayer2 (unsigned id, int player) { assert (id < MAX_HOSTS); assert (player < MAX_PLAYER); return hostPlayer2[id][player]; } /* Network_GetPlayer2 */ /* * set player atom */ void Network_SetPlayer (unsigned id, int player, XBAtom atom) { assert (id < MAX_HOSTS); assert (player < MAX_PLAYER); hostPlayer[id][player] = atom; if (atom != ATOM_INVALID) { players += 1; localPlayers[id] += 1; } } /* Network_SetPlayer */ /* * set player atom */ void Network_SetPlayer2 (unsigned id, int player, XBAtom atom) { assert (id < MAX_HOSTS); assert (player < MAX_PLAYER); hostPlayer2[id][player] = atom; } /* Network_SetPlayer2 */ /* * get first player different from given one */ XBBool Network_GetFirstOtherPlayer (unsigned char id, unsigned char pl, unsigned char *h, unsigned char *p) { *h = 0; *p = 0; if (hostPlayer2[0][0] != ATOM_INVALID) { if (id != 0 || pl < NUM_LOCAL_PLAYER) { return XBTrue; } } return Network_GetNextOtherPlayer (id, pl, h, p); } /* Network_GetFirstOtherPlayer */ /* * get next player different from given one */ XBBool Network_GetNextOtherPlayer (unsigned char id, unsigned char pl, unsigned char *h, unsigned char *p) { *p += 1; while (*h < MAX_HOSTS) { if (id != *h || pl < NUM_LOCAL_PLAYER) { while (*p < NUM_LOCAL_PLAYER) { if ((hostPlayer2[*h][*p] != ATOM_INVALID) && (*h != id || *p != pl)) { Dbg_Chat ("next = %s (%u,%u)\n", GUI_AtomToString (hostPlayer2[*h][*p]), *h, *p); return XBTrue; } *p += 1; } } *h += 1; *p = 0; } return XBFalse; } /* Network_GetNextOtherPlayer */ /************* * host data * *************/ /* * return player max for host, for check against global game config */ unsigned Network_HostPlayerMax (unsigned id) { CFGGameConst con; unsigned max = -1; assert (id < MAX_HOSTS); (void)RetrieveGameConst (CT_Remote, LOCALGAMECONFIG (id), &con); max = 8 * con.maxbytes - 1; max = (max < con.maxplayers) ? max : con.maxplayers; return max; } /* Network_HostPlayerMax */ /*************** * game config * ***************/ /* * create global game config from current setup */ XBGameConfigResult Network_CreateGlobalGameConfig (CFGGame * cfg) { CFGGamePlayers localcfg; unsigned char t[NUM_XBTS]; unsigned char p, save; XBTeamState team = XBTS_Invalid; unsigned char id, pl, host; assert (cfg != NULL); Dbg_Network ("creating global game config\n"); memset (t, 0, sizeof (t)); p = 0; for (id = 0, host = XBPH_Server; id < MAX_HOSTS; id++, host++) { /* first check if host is allowed to take part */ if (!Network_HostIsIn (id)) { Dbg_Network ("host #%u ignored, is out\n", id); continue; } /* now get player data for host */ if (!RetrieveGamePlayers (CT_Remote, LOCALGAMECONFIG (id), &localcfg)) { Dbg_Network ("failed to get players for host #%u, failure\n", id); return XBGC_Error; } /* check number of players */ if (localcfg.num == 0) { Dbg_Network ("no players for host #%u, failure\n", id); return XBGC_Error; } /* add each player */ save = p; for (pl = 0; pl < localcfg.num; pl++) { team = Network_GetTeamState (id, pl); if (team == XBTS_Out) { Dbg_Network ("player %u(%u) is out, ignoring\n", id, pl); continue; } if (p >= MAX_PLAYER) { Dbg_Network ("more players than I can handle (=%u)!\n", MAX_PLAYER); return XBGC_TooManyPlayers; } cfg->players.player[p] = Network_GetPlayer (id, pl); if (ATOM_INVALID == cfg->players.player[p]) { Dbg_Network ("player #%u(%u) has no name, failure\n", id, pl); return XBGC_Error; } cfg->players.control[p] = localcfg.control[pl]; if (XBPC_None == cfg->players.control[p]) { Dbg_Network ("warning, player #%u(%u) has no control\n", id, pl); } cfg->players.playerID[p] = localcfg.playerID[pl]; cfg->players.host[p] = host; cfg->players.team[p] = team; Dbg_Network ("adding player #%u(%u)=%s, team %u\n", id, pl, GUI_AtomToString (cfg->players.player[p]), team); p += 1; t[team] += 1; } if (save == p) { Dbg_Network ("host %u has no active players, will only watch/chat!\n", id); } } cfg->players.num = p; cfg->setup.maskBytes = (int)(1 + p / 8); Dbg_Network ("--- Results of game config creation ---\n"); /* check for invalid teams */ if (t[XBTS_Invalid] > 0) { Dbg_Network ("%u invalid teams were assigned, failure", t[XBTS_Invalid]); return XBGC_Error; } /* check player count */ if (p <= 1) { Dbg_Network ("at least two players are required!\n"); return XBGC_SingleTeam; } /* check for chaos mode */ if (t[XBTS_None] == p) { Dbg_Network ("created game config with %u players, chaos mode\n", p); cfg->setup.teamMode = XBTM_None; return XBGC_Global; } else if (t[XBTS_None] > 0) { Dbg_Network ("invalid team mode, failure\n"); return XBGC_Error; } /* check for multiple teams */ for (team = XBTS_Red; team < NUM_XBTS; team++) { if (t[team] < p) { Dbg_Network ("%u players assigned to team %u\n", t[team], team); } else { Dbg_Network ("all players assigned to team %u\n", team); return XBGC_SingleTeam; } } Dbg_Network ("created game config with %u players, team mode\n", p); cfg->setup.teamMode = XBTM_Team; return XBGC_Global; } /* Network_CreateGameConfig */ /* * store game config from server or client in database */ XBGameConfigResult Network_ReceiveGameConfig (unsigned id, const char *data) { XBAtom atom; CFGGamePlayers cfg; CFGGameConst con; XBVersion ver; XBBool loc; unsigned char p; /* check if valid id was received */ if (id >= MAX_HOSTS) { return XBGC_HostInvalid; } /* set section atom to write to */ atom = (id == 0) ? SERVERGAMECONFIG : LOCALGAMECONFIG (id); if (NULL != data) { /* write data and return */ AddToGameConfig (CT_Remote, atom, data); return XBGC_Unfinished; } /* game config complete */ Dbg_Network ("received game config from host #%u\n", id); /* extract player data in struct, shouldn't fail */ if (!RetrieveGamePlayers (CT_Remote, atom, &cfg)) { Dbg_Network ("error in game config\n"); return XBGC_Error; } /* check if empty */ if (cfg.num == 0) { Dbg_Network ("no players found\n"); return XBGC_Empty; } Dbg_Network ("game config contains %u players\n", cfg.num); /* check for too many players */ if (cfg.num > MAX_PLAYER) { Dbg_Network ("too many players found\n"); return XBGC_TooManyPlayers; } /* extract constants, should not fail */ if (!RetrieveGameConst (CT_Remote, atom, &con)) { Dbg_Network ("failed to get constants\n"); return XBGC_Error; } /* check for existing version */ if (!Version_isDefined (&con.version)) { Dbg_Network ("no version sent\n"); return XBGC_NoVersion; } Dbg_Network ("remote constants: MH=%u, MP=%u, ML=%u, MB=%u\n", con.maxhosts, con.maxplayers, con.maxlocals, con.maxbytes); /* register version */ if (Version_Join (id & 0xFF, &con.version)) { Version_Get (VERSION_JOINT, &ver); Dbg_Network ("joint version updated to %s\n", Version_ToString (&ver)); } /* check type, at least one player has been sent */ loc = (cfg.host[0] == XBPH_Local); for (p = 0; p < cfg.num; p++) { if (ATOM_INVALID == cfg.player[p]) { Dbg_Network ("player #%u has no name, error\n", p); return XBGC_Error; } if (loc != (cfg.host[p] == XBPH_Local)) { Dbg_Network ("error in game config\n"); return XBGC_Error; } } Dbg_Network ("game config type = %s\n", loc ? "local" : "global"); return loc ? XBGC_Local : XBGC_Global; } /* Network_ReceiveGameConfig */ /* * create local players from game config id */ unsigned Network_CreateLocalPlayers (unsigned id) { CFGGame cfg; XBVersion ver; XBAtom atom; unsigned p; char name[256]; assert (id < MAX_HOSTS); /* get remote atom with received data */ atom = (id == 0) ? SERVERGAMECONFIG : LOCALGAMECONFIG (id); /* extract data in struct, shouldn't fail */ if (!RetrieveGame (CT_Remote, atom, &cfg)) { Dbg_Network ("error in game config!?\n"); return NUM_LOCAL_PLAYER; } /* check local player max */ if (cfg.players.num > NUM_LOCAL_PLAYER) { Dbg_Network ("create failed, too many local players\n"); return NUM_LOCAL_PLAYER; } /* clear local data */ ClearHostLocalData (id); /* for server data, store as local game config */ if (id == 0) { StoreGame (CT_Remote, LOCALGAMECONFIG (0), &cfg); if (RetrieveGameVersion (CT_Remote, atom, &ver)) { StoreGameVersion (CT_Remote, LOCALGAMECONFIG (0), &ver); } } /* add players from game config */ for (p = 0; p < cfg.players.num; p++) { /* first add name atom, must be valid */ assert (ATOM_INVALID != cfg.players.player[p]); Network_SetPlayer2 (id, p, cfg.players.player[p]); /* use plain name as section name for server */ atom = cfg.players.player[p]; /* add @host:port for non-server, to make it unique */ if (id != 0) { sprintf (name, "%s@%s:%d", GUI_AtomToString (atom), cfg.host.name, cfg.host.port); atom = GUI_StringToAtom (name); } /* now store player section atom */ Network_SetPlayer (id, p, atom); Dbg_Network ("hostPlayer[%u][%d] = %s\n", id, p, GUI_AtomToString (atom)); /* set chat controls */ if (localId == id) { switch (cfg.players.control[p]) { case XBPC_RightKeyboard: Dbg_Network ("local player #%u on right keyboard, enabling chat\n", id); Chat_AddEventCode (p, XBE_KEYB_1); break; case XBPC_LeftKeyboard: Dbg_Network ("local player #%u on left keyboard, enabling chat\n", id); Chat_AddEventCode (p, XBE_KEYB_2); break; default: Dbg_Network ("local player #%u has no keyboard control, no chatting\n", id); break; } } } Dbg_Network ("created %u players, total %u\n", cfg.players.num, players); return cfg.players.num; } /* Network_CreateLocalPlayers */ /* * create global players from game config, only allowed from server */ unsigned Network_CreateGlobalPlayers (unsigned id) { unsigned h, p, pl; assert (id == 0); /* extract data in struct, shouldn't fail */ if (!RetrieveGame (CT_Remote, SERVERGAMECONFIG, &globalcfg)) { Dbg_Network ("error in game config!?\n"); return MAX_PLAYER; } /* check max player */ if (globalcfg.players.num > MAX_PLAYER) { Dbg_Network ("create failed, too many global players\n"); return MAX_PLAYER; } /* check mask bytes */ if (globalcfg.setup.maskBytes > MAX_MASK_BYTES) { Dbg_Network ("create failed, too many mask bytes\n"); return MAX_PLAYER; } /* now link with local */ memset (s2l, 0xFF, sizeof (s2l)); memset (l2s, 0xFF, sizeof (l2s)); for (pl = 0; pl < globalcfg.players.num; pl++) { for (h = 0; h < MAX_HOSTS; h++) { for (p = 0; p < localPlayers[h]; p++) { if (globalcfg.players.player[pl] == hostPlayer[h][p]) { Dbg_Network ("linking global player %u with local player #%u(%u)\n", pl, h, p); s2l[pl].host = h; s2l[pl].player = p; l2s[h][p] = pl; break; } } } if (s2l[pl].host >= MAX_HOSTS) { Dbg_Network ("failed to match global player with local\n"); return MAX_PLAYER; } } /* success */ global = XBTrue; return globalcfg.players.num; } /* Network_CreateGlobalPlayers */ /* * getting current mask bytes */ unsigned Network_GetMaskBytes (void) { /* no mask bytes if no global game config */ if (!global) { return 0; } return globalcfg.setup.maskBytes; } /* Network_GetMaskBytes */ /***************** * player config * *****************/ /* * player config received from client */ XBAtom Network_ReceivePlayerConfig (CFGType cfgType, unsigned id, int player, const char *line) { XBAtom atom; assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); /* get player for config */ atom = Network_GetPlayer (id, player); if (ATOM_INVALID == atom) { return ATOM_INVALID; } /* check if there is any data */ if (NULL != line) { AddToPlayerConfig (cfgType, atom, line); /* ok that's all for now */ return ATOM_INVALID; } /* all data received */ Dbg_Network ("received player config for %u(%u)\n", id, player); switch (player) { case 0: Network_QueueEvent (XBNW_RightPlayerConfig, id); break; case 1: Network_QueueEvent (XBNW_LeftPlayerConfig, id); break; case 2: Network_QueueEvent (XBNW_Joy1PlayerConfig, id); break; case 3: Network_QueueEvent (XBNW_Joy2PlayerConfig, id); break; default: break; } return atom; } /* Network_ReceivePlayerConfig */ /****************** * state requests * ******************/ /* * receive host state for a host */ XBBool Network_ReceiveHostState (unsigned id, XBHostState state) { if (id < MAX_HOSTS) { hostState[id] = state; Network_QueueEvent (XBNW_HostChange, id); return XBTrue; } return XBFalse; } /* Network_ReceiveHostState */ /* * receive host state request for a host */ XBBool Network_ReceiveHostStateReq (unsigned who, unsigned id, XBHostState state) { if (who < MAX_HOSTS && id < MAX_HOSTS) { hostStateReq[id][who] = state; return XBTrue; } return XBFalse; } /* Network_ReceiveHostStateReq */ /* * receive team state for a host/player */ XBBool Network_ReceiveTeamState (unsigned host, unsigned player, XBTeamState team) { if (host < MAX_HOSTS && player < MAX_PLAYER) { teamState[host][player] = team; return XBTrue; } return XBFalse; } /* Network_ReceiveTeamState */ /* * receive team state for a host/player */ XBBool Network_ReceiveTeamStateReq (unsigned who, unsigned host, unsigned player, XBTeamState team) { if (who < MAX_HOSTS && host < MAX_HOSTS && player < MAX_PLAYER) { teamStateReq[host][player][who] = team; return XBTrue; } return XBFalse; } /* Network_ReceiveTeamStateReq */ /* * return host state */ XBHostState Network_GetHostState (unsigned id) { assert (id < MAX_HOSTS); return hostState[id]; } /* Network_GetHostState */ /* * return if host is in */ XBBool Network_HostIsIn (unsigned id) { switch (Network_GetHostState (id)) { case XBHS_Server: case XBHS_In: case XBHS_Ready: return XBTrue; default: return XBFalse; } } /* Network_HostIsIn */ /* * store current teams as default */ void Network_SetDefaultTeams (unsigned host, unsigned player) { unsigned id, pl; for (id = 0; id < MAX_HOSTS; id++) { for (pl = 0; pl < NUM_LOCAL_PLAYER; pl++) { if (teamState[id][pl] > XBTS_None) { defTeam[id][pl] = teamState[id][pl]; } } } defTeam[host][player] = XBTS_Red; } /* Network_SetDefaultTeams */ /* * return default team state */ XBTeamState Network_GetDefaultTeam (unsigned id, unsigned player) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); return defTeam[id][player]; } /* Network_GetTeamState */ /* * return team state */ XBTeamState Network_GetTeamState (unsigned id, unsigned player) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); return teamState[id][player]; } /* Network_GetTeamState */ /* * return host state requests */ XBHostState * Network_GetHostStateReq (unsigned id) { assert (id < MAX_HOSTS); return &hostStateReq[id][0]; } /* Network_GetHostStateReq */ /* * return team state requests */ XBTeamState * Network_GetTeamStateReq (unsigned id, unsigned player) { assert (id < MAX_HOSTS); assert (player < NUM_LOCAL_PLAYER); return &teamStateReq[id][player][0]; } /* Network_GetTeamStateReq */ /* * check if all clients agree on a state for a host (at least two) */ XBBool Network_HostReqClientsAgree (unsigned host, XBHostState state) { unsigned id; unsigned count = 0; for (id = 1; id < MAX_HOSTS; id++) { if (id != host) { switch (hostState[id]) { case XBHS_In: case XBHS_Ready: if (state != hostStateReq[host][id]) { return XBFalse; } count++; break; default: break; } } } return (count > 1); } /* Network_HostReqClientsAgree */ /* * check if all clients are ready (at least one) */ XBBool Network_ClientsReady (void) { unsigned id; unsigned count = 0; for (id = 1; id < MAX_HOSTS; id++) { switch (hostState[id]) { case XBHS_Ready: count++; case XBHS_None: break; default: return XBFalse; } } return (count > 0); } /* Network_ClientsReady */ /* * check if clients agree on team state (at least two) */ XBBool Network_TeamReqClientsAgree (unsigned host, unsigned player, unsigned state) { unsigned id; unsigned count = 0; for (id = 1; id < MAX_HOSTS; id++) { if (id != host) { switch (hostState[id]) { case XBHS_In: case XBHS_Ready: if (state != teamStateReq[host][player][id]) { return XBFalse; } count++; break; default: break; } } } return (count > 1); } /* Network_TeamReqClientsAgree */ /* * end of file network.c */ xblast-2.10.4/network.h0000644000175000017500000001527710373126076014073 0ustar rhondaalfie/* * file network.h - shared functions for server and clients * * $Id: network.h,v 1.36 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef XBLAST_NETWORK_H #define XBLAST_NETWORK_H /* * game config atoms in remote database */ #define LOCALGAMECONFIG(id) atomArrayHost0[id] #define SERVERGAMECONFIG atomServer /* * type definition for network events */ typedef enum { XBNW_None = 0, XBNW_Accepted, /* connection to client accepted */ XBNW_GameConfig, /* client has send game config */ XBNW_RightPlayerConfig, /* client has send player config */ XBNW_LeftPlayerConfig, /* client has send player config */ XBNW_Joy1PlayerConfig, /* client has send player config */ XBNW_Joy2PlayerConfig, /* client has send player config */ XBNW_Disconnected, /* connection to client accepted */ XBNW_StartGame, /* server wants to start game */ XBNW_EndOfInit, /* client is initialized */ XBNW_LevelConfig, /* server has sent level data 10 */ XBNW_SyncEndOfInit, /* sync after level intro */ XBNW_SyncLevelIntro, /* sync after level intro */ XBNW_SyncLevelResult, /* sync before level results are calculated */ XBNW_SyncLevelEnd, /* sync after level end */ XBNW_SyncScoreboard, /* sync after scoreboard 15 */ XBNW_HostIsIn, /* host is in game */ XBNW_HostIsOut, /* host is out of game */ XBNW_TeamChange, /* Team Change */ XBNW_TeamChangeData, /* Team Change Data */ XBNW_Error, /* error while writing to host */ XBNW_PingReceived, /* received ping from client */ XBNW_NetworkGame, /* a new network game was added to the list */ XBNW_HostChange, /* host state changed */ /* no new message behind this line */ XBNW_MAX } XBNetworkEvent; /* * type definition for network events */ typedef enum { XBNT_None = 0, /* no networking going on */ XBNT_Server, /* acting as server */ XBNT_Client, /* acting as client */ XBNT_MAX } XBNetworkType; /* client state */ typedef enum { XBHS_None, XBHS_Wait, /* waiting for client to send player data */ XBHS_In, /* client is in the game */ XBHS_Out, /* client is out of the game */ XBHS_Server, /* host is server */ XBHS_Ready, /* host is ready to start */ /*---*/ NUM_XBHS } XBHostState; /* team state */ typedef enum { XBTS_Invalid, /* invalid team tag */ XBTS_None, /* no team tag */ XBTS_Red, /* unknown if this is good */ XBTS_Green, XBTS_Blue, XBTS_Out, /*---*/ NUM_XBTS } XBTeamState; /* special codes for winning team */ #define TEAM_NOWINNER 255 #define TEAM_LOCALASYNC 254 #define TEAM_ASYNC 253 #define TEAM_UNDEF 252 /* team color assignment */ const XBColor teamColors[NUM_XBTS]; /* results of game config receive/create */ typedef enum { XBGC_Unfinished, /* still waiting for data */ XBGC_HostInvalid, /* invalid host id */ XBGC_Empty, /* game config with no players received */ XBGC_TooManyPlayers, /* game config contains too many players to handle */ XBGC_NoVersion, /* no version found */ XBGC_Local, /* local game config received */ XBGC_Global, /* global game config with all players received */ XBGC_Error, /* game config received is invalid */ XBGC_SingleTeam, /* single team for all players when creating */ } XBGameConfigResult; /* * global prototypes */ /* init */ extern void Network_ClearHost (unsigned id); extern void Network_Clear (void); /* events */ extern void Network_ClearEvents (void); extern XBNetworkEvent Network_GetEvent (unsigned *pId); extern void Network_QueueEvent (XBNetworkEvent msg, unsigned id); /* type of network */ extern XBNetworkType Network_GetType (void); extern void Network_SetType (XBNetworkType type); /* local host id */ extern void Network_ReceiveLocalHostId (unsigned id); extern unsigned char Network_LocalHostId (void); /* ping times */ extern int Network_GetPingTime (unsigned id); extern void Network_ReceivePing (unsigned id, int ping); /* player atoms */ extern XBAtom Network_GetPlayer (unsigned id, int player); extern XBAtom Network_GetPlayer2 (unsigned id, int player); extern void Network_SetPlayer (unsigned id, int player, XBAtom atom); extern void Network_SetPlayer2 (unsigned id, int player, XBAtom atom); extern XBBool Network_GetFirstOtherPlayer (unsigned char id, unsigned char pl, unsigned char *host, unsigned char *player); extern XBBool Network_GetNextOtherPlayer (unsigned char id, unsigned char pl, unsigned char *host, unsigned char *player); /* host data */ extern unsigned Network_HostPlayerMax (unsigned); /* game configs */ extern XBGameConfigResult Network_CreateGlobalGameConfig (CFGGame * cfg); extern XBGameConfigResult Network_ReceiveGameConfig (unsigned id, const char *data); extern unsigned Network_CreateLocalPlayers (unsigned); extern unsigned Network_CreateGlobalPlayers (unsigned); extern unsigned Network_GetMaskBytes (void); /* player configs */ extern XBAtom Network_ReceivePlayerConfig (CFGType cfgType, unsigned id, int player, const char *line); /* state requests */ extern XBBool Network_ReceiveHostState (unsigned id, XBHostState state); extern XBBool Network_ReceiveTeamState (unsigned host, unsigned player, XBTeamState team); extern XBBool Network_ReceiveHostStateReq (unsigned who, unsigned id, XBHostState state); extern XBBool Network_ReceiveTeamStateReq (unsigned who, unsigned host, unsigned player, XBTeamState team); extern void Network_SetDefaultTeams (unsigned host, unsigned player); extern XBTeamState Network_GetDefaultTeam (unsigned id, unsigned player); extern XBHostState Network_GetHostState (unsigned id); extern XBBool Network_HostIsIn (unsigned id); extern XBHostState *Network_GetHostStateReq (unsigned id); extern XBTeamState Network_GetTeamState (unsigned id, unsigned pl); extern XBTeamState *Network_GetTeamStateReq (unsigned id, unsigned pl); extern XBBool Network_HostReqClientsAgree (unsigned host, XBHostState state); extern XBBool Network_ClientsReady (void); extern XBBool Network_TeamReqClientsAgree (unsigned host, unsigned player, unsigned state); #endif /* * end of file network.h */ xblast-2.10.4/player.c0000644000175000017500000020050710443516537013664 0ustar rhondaalfie/* * file player.c - ingame player mangment * * $Id: player.c,v 1.48 2006/06/13 11:11:27 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define BOMB_STEP 2 #define STEP_HORI BASE_X #define STEP_VERT BASE_Y #define MAX_RANGE 10 #define ILLTIME 256 #define ILL_X (4*BASE_X) #define ILL_Y (5*BASE_Y) #define JUNKIE_ILL_TIME (ILLTIME) #define JUNKIE_STUN_TIME 12 #define JUNKIE_TIME_1 360 #define JUNKIE_TIME_2 210 #define JUNKIE_TIME_3 60 /* Speed */ #define NUM_TELE_TRIES 25 /* * init flags for extras * LF_ level start flag * RF_ revive flag * IF_ both of the above */ #define IF_None 0 /* kick extra */ #define LF_Kick (1<<29) #define RF_Kick (1<<30) #define IF_Kick (RF_Kick|LF_Kick) /* remote control */ #define LF_RC 1 #define RF_RC 2 //#define IF_RC 3 /* teleporter */ #define LF_Teleport 4 #define RF_Teleport 5 //#define IF_Teleport 6 /* airpump */ #define LF_Airpump 7 #define RF_Airpump 8 //#define IF_Airpump 9 /* cloak extra */ #define LF_Cloak 10 #define RF_Cloak 11 //#define IF_Cloak 12 /* morph extra */ #define LF_Morph 13 #define RF_Morph 14 //#define IF_Morph 15 /** Skywalker **/ #define LF_Snipe 16 #define RF_Snipe 17 //#define IF_Snipe 18 #define LF_Frogger 19 #define RF_Frogger 20 //#define IF_Frogger 21 #define LF_Fart 22 #define RF_Fart 23 //#define IF_Fart 24 #define LF_Bfart 25 #define RF_Bfart 26 //#define IF_Bfart 27 #define LF_Choice 28 #define RF_Choice 29 //#define IF_Choice 30 #define LF_Stop 31 #define RF_Stop 32 //#define IF_Stop 33 #define LF_Phantom 34 #define RF_Phantom 35 //#define IF_Phantom 36 #define LF_Electrify 37 #define RF_Electrify 38 //#define IF_Electrify 39 #define LF_Daleif 40 #define RF_Daleif 41 //#define IF_Daleif 42 #define LF_Suck 43 #define RF_Suck 44 //#define IF_Suck 45 /* revive extra */ #define LF_Revive 46 #define RF_Revive 47 //#define IF_Revive (RF_Revive|LF_Revive) #define LF_Jump 48 #define RF_Jump 49 //#define IF_Revive (RF_Revive|LF_Revive) #define LF_Reverse2 50 #define RF_Reverse2 51 #define LF_Through 52 #define RF_Through 53 /** **/ #define NUM_IF 12 /* * global variables */ BMPlayer player_stat[2 * MAX_PLAYER]; PlayerStrings p_string[2 * MAX_PLAYER]; /* * extern variables */ extern void (*special_extra_function) (void); /* * local variables - retrieved from level data */ static int minRange; static int minBombs; static int recLives; static int specialBombs; static int reviveHealth; static int initHealth; static unsigned initFlags; static unsigned revFlags; static BMPosition pos0[MAX_PLAYER]; static int pos0Shuffle[MAX_PLAYER]; static int pos0Cnt; static int playersAllowed; /* * local variables - defined by game data */ static XBBool randomPlayerPos; static XBBool ifRecLives; static int maxLives; static int numPlayer; /* * local variables - for final setup */ static BMPosition pos[MAX_PLAYER]; static unsigned iniplayerflags; static unsigned revplayerflags; #if 0 static int game_mode; #endif /* conversion tables */ static DBToInt healthTable[] = { {"bomb", (int)IllBomb}, {"empty", (int)IllEmpty}, {"healthy", (int)Healthy}, {"invisible", (int)IllInvisible}, {"malfunction", (int)IllMalfunction}, {"mini", (int)IllMini}, {"reverse", (int)IllReverse}, {"reverse2", (int)IllReverse2}, {"run", (int)IllRun}, {"slow", (int)IllSlow}, {"teleport", (int)IllTeleport}, {NULL, -1}, }; static DBToInt initFlagsTable[] = { {"airpump", LF_Airpump}, {"bfarter", LF_Bfart}, {"choicebombtype", LF_Choice}, /* skywalker */ {"cloak", LF_Cloak}, {"daleif", LF_Daleif}, {"electrify", LF_Electrify}, {"farter", LF_Fart}, /* skywalker */ {"frogger", LF_Frogger}, /* skywalker */ {"jump", LF_Jump}, /* skywalker */ {"kick", LF_Kick}, {"morph", LF_Morph}, {"none", 0}, {"phantom", LF_Phantom}, {"rc", LF_RC}, {"revive", LF_Revive}, {"snipe", LF_Snipe}, /** Skywalker **/ {"stop", LF_Stop}, {"sucker", LF_Suck}, {"teleport", LF_Teleport}, {"through", LF_Through}, {NULL, -1}, }; static DBToInt reviveFlagsTable[] = { {"airpump", RF_Airpump}, {"bfarter", RF_Bfart}, {"choicebombtype", RF_Choice}, /* skywalker */ {"cloak", RF_Cloak}, {"daleif", RF_Daleif}, {"electrify", RF_Electrify}, {"farter", RF_Fart}, /* skywalker */ {"frogger", RF_Frogger}, /* skywalker */ {"jump", RF_Jump}, /* skywalker */ {"kick", RF_Kick}, {"morph", RF_Morph}, {"none", 0}, {"phantom", RF_Phantom}, {"rc", RF_RC}, {"revive", RF_Revive}, {"snipe", RF_Snipe}, /** Skywalker **/ {"stop", RF_Stop}, {"sucker", RF_Suck}, {"teleport", RF_Teleport}, {"through", RF_Through}, {NULL, -1}, }; /* info text data */ static const char *permHealthInfo[MAX_ILL] = { NULL, N_("Permanent random bombing"), N_("Permanent slowdown"), N_("Permanent running"), N_("Permanent mini bombs"), N_("No bomb while healthy"), N_("Permanent invisibility"), N_("Permanent malfunctions"), N_("Permanent reverse controls"), N_("Permanent reverse(2) controls"), N_("Permanent random teleporting"), }; static const char *initHealthInfo[MAX_ILL] = { NULL, N_("Initial random bombing"), N_("Initial slowdown"), N_("Initial running"), N_("Initial mini bombs"), N_("No bomb while healthy"), N_("Initial invisibility"), N_("Initial malfunctions"), N_("Initial reverse controls"), N_("Initial reverse(2) controls"), N_("Initial random teleporting"), }; static const char *reviveHealthInfo[MAX_ILL] = { NULL, N_("Revived with random bombing"), N_("Revived with slowdown"), N_("Revived with running"), N_("Revived with mini bombs"), N_("Revived with bombs while healthy"), N_("Revived with invisibility"), N_("Revived with malfunctions"), N_("Revived with reverse controls"), N_("Revived with reverse(2) controls"), N_("Revived with random teleporting"), }; /* * parse player section in level data */ XBBool ParseLevelPlayers (const DBSection * section, unsigned gameMode, DBSection * warn) { int i, k; /* check existence of section */ if (NULL == section) { Dbg_Out ("LEVEL: player section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* Bombs entry is required */ if (!DB_GetEntryInt (section, atomBombs, &minBombs)) { Dbg_Out ("LEVEL: critical failure, %s\n", DB_SectionEntryString (section, atomBombs)); DB_CreateEntryString (warn, atomBombs, "missing!"); return XBFalse; } /* Range entry is required */ if (!DB_GetEntryInt (section, atomRange, &minRange)) { Dbg_Out ("LEVEL: critical failure, %s\n", DB_SectionEntryString (section, atomRange)); DB_CreateEntryString (warn, atomRange, "missing!"); return XBFalse; } /* RecLives has default */ if (!DB_GetEntryInt (section, atomRecLives, &recLives)) { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomRecLives)); recLives = 0; } /* SpecialBombs has default */ if (!DB_GetEntryInt (section, atomSpecialBombs, &specialBombs)) { Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomSpecialBombs)); specialBombs = 0; } /* ReviveVirus has default */ switch (DB_ConvertEntryInt (section, atomReviveVirus, (int *)&reviveHealth, healthTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomReviveVirus)); reviveHealth = Healthy; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomReviveVirus)); reviveHealth = Healthy; DB_CreateEntryString (warn, atomReviveVirus, DB_IntToString (healthTable, reviveHealth)); break; default: break; } /* InitVirus has default */ switch (DB_ConvertEntryInt (section, atomInitVirus, (int *)&initHealth, healthTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomInitVirus)); initHealth = Healthy; break; case DCR_Failure: Dbg_Out ("LEVEL: warning %s\n", DB_SectionEntryString (section, atomInitVirus)); initHealth = Healthy; DB_CreateEntryString (warn, atomInitVirus, DB_IntToString (healthTable, initHealth)); break; default: break; } /* InitExtra has default */ switch (DB_ConvertEntryFlags (section, atomInitExtra, &initFlags, initFlagsTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomInitExtra)); initFlags = 0; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomInitExtra)); initFlags = 0; DB_CreateEntryString (warn, atomInitExtra, DB_IntToString (initFlagsTable, initFlags)); break; default: break; } /* ReviveExtra has default */ switch (DB_ConvertEntryFlags (section, atomReviveExtra, &revFlags, reviveFlagsTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomReviveExtra)); revFlags = 0; break; case DCR_Failure: Dbg_Out ("LEVEL: warning for %s\n", DB_SectionEntryString (section, atomReviveExtra)); revFlags = 0; DB_CreateEntryString (warn, atomReviveExtra, DB_IntToString (reviveFlagsTable, revFlags)); break; default: break; } /* retrieve all player positions, count them */ k = 0; for (i = 0; i < MAX_PLAYER; i++) { if (DB_GetEntryPos (section, atomArrayPos0[k + 1], pos0 + k)) { if ((pos0[k].x > 0) && (pos0[k].y > 0) && (pos0[k].x <= MAZE_W) && (pos0[k].y <= MAZE_H)) { pos0Shuffle[k] = k; k++; } } } pos0Cnt = k; /* check if there are player positions */ if (pos0Cnt == 0) { Dbg_Out ("LEVEL: critical failure, no player positions found!\n"); DB_CreateEntryString (warn, atomArrayPos0[0], "missing!"); return XBFalse; } Dbg_Level ("%u player positions found\n", pos0Cnt); /* retrieve number of allowed players from gameMode */ k = 0; for (i = 5; (i > 0) && (k == 0); i--) { if ((gameMode & (1 << i)) != 0) { k = i + 1; } } playersAllowed = k; /* check if players are allowed at all */ if (playersAllowed == 0) { Dbg_Out ("LEVEL: critical failure, no players allowed!\n"); return XBFalse; } Dbg_Level ("%u players allowed\n", playersAllowed); return XBTrue; } /* ParseLevelPlayers */ /* * configure players for game */ void ConfigLevelPlayers (const DBSection * section, XBBool allowRandomPos, unsigned gameMode) { BMPlayer *ps; int i, j, k, m; int pl[MAX_PLAYER]; int numActive; const char *s; assert (section != NULL); revplayerflags = 0; iniplayerflags = 0; /* min of allowed players and defined positions */ k = MIN (pos0Cnt, playersAllowed); assert (k > 0); /* determine number of active players and shuffle list */ numActive = 0; for (i = 0; i < numPlayer; i++) { if (!player_stat[i].in_active) { pl[numActive] = i; numActive++; } } Dbg_Level ("%u of %u players are active, %u defined positions - assigning positions...\n", numActive, numPlayer, pos0Cnt); /* shuffle active players */ for (i = numActive - 1; i > 0; i--) { j = GameRandomNumber (i + 1); j = (j >= 0) ? j : 0; j = (j >= i + 1) ? i : j; m = pl[j]; pl[j] = pl[i]; pl[i] = m; } /* shuffle retrieved positions */ for (i = k - 1; i > 0; i--) { j = GameRandomNumber (i + 1); j = (j >= 0) ? j : 0; j = (j >= i + 1) ? i : j; m = pos0Shuffle[j]; pos0Shuffle[j] = pos0Shuffle[i]; pos0Shuffle[i] = m; } /* setup shuffled player positions */ for (i = 0; i < numActive; i++) { if (i < k) { pos[pl[i]] = pos0[pos0Shuffle[i]]; Dbg_Level ("active player %i on defined position %i (%i, %i)\n", pl[i], pos0Shuffle[i], pos[pl[i]].x, pos[pl[i]].y); } else { j = GameRandomNumber (k); j = (j >= 0) ? j : 0; j = (j >= k) ? k - 1 : j; pos[pl[i]] = pos0[j]; Dbg_Level ("active player %i on random position %i (%i, %i)\n", pl[i], j, pos[pl[i]].x, pos[pl[i]].y); } } /* store positions in player stats */ j = 0; for (i = 0; i < numPlayer; i++) { ps = player_stat + i; if (ps->in_active) { ps->x = 0; ps->y = i * BLOCK_HEIGHT; SetSpriteMode (ps->sprite, SPM_UNMAPPED); } else { ps->x = pos[i].x * BLOCK_WIDTH; ps->y = (pos[i].y - 1) * BLOCK_HEIGHT; j++; } } /* setup other player attributes */ for (i = 0; i < numPlayer; i++) { ps = player_stat + i; /* Added by VVL (Chat) 12/11/99 : Begin */ ps->chatmode = 0; ps->chatstring[0] = '\0'; ps->chatlen = 0; /* Added by VVL (Chat) 12/11/99 : End */ ps->iniextra_flags = initFlags; ps->revextra_flags = revFlags; iniplayerflags = (ps->iniextra_flags & ((0xffffff) >> 2)); revplayerflags = (ps->revextra_flags & ((0xffffff) >> 2)); ps->kick = (LF_Kick & ps->iniextra_flags) ? XBTrue : XBFalse; ps->invincible = NEW_INVINCIBLE; ps->illness = initHealth; ps->health = initHealth; ps->illtime = 0; ps->junkie = 0; ps->ghost = 0; ps->dying = 0; ps->stunned = 0; if (ifRecLives && recLives) { ps->lives = ps->in_active ? 0 : recLives; } else { ps->lives = ps->in_active ? 0 : maxLives; } ps->range = minRange; ps->bombs = minBombs; ps->special_bombs = specialBombs; ps->jump_button = (LF_Jump == iniplayerflags) ? XBTrue : XBFalse; ps->remote_control = (LF_RC == iniplayerflags) ? XBTrue : XBFalse; ps->teleport = (LF_Teleport == iniplayerflags) ? XBTrue : XBFalse; ps->air_button = (LF_Airpump == iniplayerflags) ? XBTrue : XBFalse; ps->cloaking = (LF_Cloak == iniplayerflags) ? -GAME_TIME : 0; ps->stop = (LF_Stop == iniplayerflags) ? XBTrue : XBFalse; ps->phantom = (LF_Phantom == iniplayerflags) ? GAME_TIME : XBFalse; ps->electrify = (LF_Electrify == iniplayerflags) ? EXTRA_ELECTRIFY_COUNT : XBFalse; ps->revive = (LF_Revive == iniplayerflags) ? XBTrue : XBFalse; ps->suck_button = (LF_Suck == iniplayerflags) ? XBTrue : XBFalse; ps->num_extras = (LF_Snipe == iniplayerflags) ? 1000 : ((LF_Morph == iniplayerflags) ? 1000 : 0); ps->speed = 0; ps->daleif = (LF_Daleif == iniplayerflags) ? XBTrue : XBFalse; /* Daleif illness (galatius) */ ps->farted = (LF_Fart == iniplayerflags) ? XBTrue : XBFalse; /* Fart counter (galatius) */ ps->bfarter = (LF_Bfart == iniplayerflags) ? XBTrue : XBFalse; /* Fart counter (galatius) */ ps->num_snipe = (LF_Snipe == iniplayerflags) ? 1000 : 0; ps->num_morph = (LF_Morph == iniplayerflags) ? 1000 : 0; ps->daleifing = 0; ps->abort = ABORT_NONE; ps->d_ist = GoStop; ps->d_soll = GoStop; ps->d_look = GoDown; ps->morphed = XBFalse; /* Written by VVL */ ps->through = (LF_Through == iniplayerflags) ? XBTrue : XBFalse; ps->throughCount = ps->through ? 255 : 0; ps->evilill = 0; /** Skywalker **/ ps->sniping = 0; ps->frogger = (LF_Frogger == iniplayerflags) ? XBTrue : XBFalse; /** **/ if (LF_Choice == iniplayerflags) { char tutu[40]; int h; for (h = ChoiceDefaultBomb; bomb_name_choice[h] == NULL; h = ((h + 1) % NUM_BMT)) ; ps->choice_bomb_type = h; if (ps->local) { sprintf (tutu, "%s : ", p_string[ps->id].name); strcat (tutu, bomb_name_choice[(ps->choice_bomb_type)]); SetMessage (tutu, XBTrue); } } else { ps->choice_bomb_type = NUM_BMT; /* fprintf(stderr," bomb typ1 %i\n", ps->choice_bomb_type); */ } } /* set text for info screen */ switch (minBombs) { case 0: AddPlayerInfo (N_("No bomb")); break; case 1: AddPlayerInfo (N_("1 bomb")); break; default: /* TRANSLATORS: %d > 1 (multiple bombs only) */ AddPlayerInfo (N_("%d bombs"), minBombs); break; } switch (minRange) { case 0: AddPlayerInfo (N_("No initial range")); break; case 1: AddPlayerInfo (N_("Only mini bombs")); break; default: AddPlayerInfo (N_("Initial range %d"), minRange); break; } if (initHealth == reviveHealth) { if (NULL != (s = permHealthInfo[initHealth])) { AddPlayerInfo (s); } } else { if (NULL != (s = initHealthInfo[initHealth])) { AddPlayerInfo (s); } if (NULL != (s = reviveHealthInfo[reviveHealth])) { AddPlayerInfo (s); } } if (iniplayerflags == LF_Daleif) { if (revplayerflags == RF_Daleif) { AddPlayerInfo (N_("Daleif as default")); } else { AddPlayerInfo (N_("Initial Daleif")); } } else if ((revplayerflags == RF_Daleif)) { AddPlayerInfo (N_("Revived with Daleif")); } if (iniplayerflags == LF_RC) { if (revplayerflags == RF_RC) { AddPlayerInfo (N_("Remote control as default")); } else { AddPlayerInfo (N_("Initial remote control")); } } else if ((revplayerflags == RF_RC)) { AddPlayerInfo (N_("Revived with remote control")); } if (iniplayerflags == LF_Jump) { if (revplayerflags == RF_Jump) { AddPlayerInfo (N_("Jump as default")); } else { AddPlayerInfo (N_("Initial Jump")); } } else if ((revplayerflags == RF_Jump)) { AddPlayerInfo (N_("Revived with Jump")); } if (iniplayerflags == LF_Airpump) { if (revplayerflags == RF_Airpump) { AddPlayerInfo (N_("Airpump as default")); } else { AddPlayerInfo (N_("Initial airpump")); } } else if (revplayerflags == RF_Airpump) { AddPlayerInfo (N_("Revived with airpump")); } if (iniplayerflags == LF_Cloak) { if (revplayerflags == RF_Cloak) { AddPlayerInfo (N_("Cloak as default")); } else { AddPlayerInfo (N_("Initial cloak")); } } else if (revplayerflags == RF_Cloak) { AddPlayerInfo (N_("Revived with cloak")); } if (iniplayerflags & LF_Kick) { if (revplayerflags == RF_Kick) { AddPlayerInfo (N_("Initial kick")); } else { AddPlayerInfo (N_("Initial kick")); } } else if (revplayerflags == RF_Kick) { AddPlayerInfo (N_("Revived with kick")); } if (iniplayerflags == LF_Morph) { if (revplayerflags == RF_Morph) { AddPlayerInfo (N_("Morphing as default")); } else { AddPlayerInfo (N_("Initial morphing")); } } else if (revplayerflags == RF_Morph) { AddPlayerInfo (N_("Revived with morphing")); } if (iniplayerflags == LF_Through) { if (revplayerflags == RF_Through) { AddPlayerInfo (N_("Throughing as default")); } else { AddPlayerInfo (N_("Initial throughing")); } } else if (revplayerflags == RF_Through) { AddPlayerInfo (N_("Revived with throughing")); } if (iniplayerflags == LF_Suck) { if (revplayerflags == RF_Suck) { AddPlayerInfo (N_("Sucker as default")); } else { AddPlayerInfo (N_("Initial sucker")); } } else if (revplayerflags == RF_Suck) { AddPlayerInfo (N_("Revived with sucker")); } /* that's all folks */ } /* ConfigLevelPlayers */ /* * Create Welcome messages for players at start of level */ void WelcomePlayers (void) { int i, j, num; const char *list[MAX_PLAYER]; const char *swap; /* get messages */ for (i = 0, num = 0; i < numPlayer; i++) { if (NULL != p_string[i].welcome && !player_stat[i].in_active) { list[num++] = p_string[i].welcome; } } /* shuffle them */ for (i = 0; i < num; i++) { j = OtherRandomNumber (num); swap = list[i]; list[i] = list[j]; list[j] = swap; } /* show them */ for (i = 0; i < num; i++) { SetMessage (list[i], XBFalse); } } /* WelcomePlayers */ /* * */ int NumSpecialBombs (void) { return specialBombs; } /* NumSpecialBombs */ /* * set player stat to default values */ static void InitPlayerStat (BMPlayer * ps, int player, int ctrl, XBPlayerTeam team, int PID, XBBool local) // XBCC { /* set default values */ ps->victories = 0; ps->PID = PID; // XBCC ps->id = player; ps->disp = local ? SPM_MAPPED : SPM_UNMAPPED; ps->local = local; ps->sprite = CreatePlayerSprite (ps->id, 0, 0, 0, SPM_UNMAPPED); Dbg_Out (" sprite player %i %i", ((ps->sprite)->player).player, ps->id); ((ps->sprite)->player).player = ps->id; Dbg_Out (" new sprite player %i %i\n", ((ps->sprite)->player).player, ps->id); ps->in_active = XBFalse; /* evaluate team mode */ if (team == XBPT_None) { ps->team = ps->id; } else { ps->team = team - XBPT_None - 1; } } /* InitPlayerStat */ /* * set all messages for given player */ static void InitPlayerMessages (PlayerStrings * str, const CFGPlayer * cfgPlayer) { char tmp[128]; /* player name */ str->name = DupString (cfgPlayer->name); assert (NULL != str->name); str->tag = DupString (cfgPlayer->name); assert (NULL != str->tag); /* pause string */ sprintf (tmp, "Game paused by %s", str->name); str->pause = DupString (tmp); assert (NULL != str->pause); /* win a level */ if (NULL != cfgPlayer->messages.msgWinLevel) { str->winlevel = DupString (cfgPlayer->messages.msgWinLevel); } else { sprintf (tmp, _("%s wins"), str->name); str->winlevel = DupString (tmp); } assert (NULL != str->winlevel); /* win the game */ if (NULL != cfgPlayer->messages.msgWinGame) { str->wingame = DupString (cfgPlayer->messages.msgWinGame); } else { str->wingame = DupString (N_("CONGRATULATIONS!")); } assert (NULL != str->wingame); /* request abort */ sprintf (tmp, "Abort requested by %s", str->tag); str->abort = DupString (tmp); assert (NULL != str->abort); /* cancel abort */ sprintf (tmp, "%s cancels abort", str->tag); str->abortcancel = DupString (tmp); assert (str->abortcancel != NULL); /* loosing a life */ if (NULL != cfgPlayer->messages.msgLoseLife) { str->loselife = DupString (cfgPlayer->messages.msgLoseLife); } else { str->loselife = NULL; } /* loosing a level */ if (NULL != cfgPlayer->messages.msgLoseLevel) { str->loselevel = DupString (cfgPlayer->messages.msgLoseLevel); } else { str->loselevel = NULL; } /* gloating */ if (NULL != cfgPlayer->messages.msgGloat) { str->gloat = DupString (cfgPlayer->messages.msgGloat); } else { str->gloat = NULL; } /* laola */ if (NULL != cfgPlayer->messages.msgLaola) { str->laola = DupString (cfgPlayer->messages.msgLaola); } else { str->laola = NULL; } /* looser */ if (NULL != cfgPlayer->messages.msgLoser) { str->loser = DupString (cfgPlayer->messages.msgLoser); } else { str->loser = NULL; } /* welcome to the game */ if (NULL != cfgPlayer->messages.msgWelcome) { str->welcome = DupString (cfgPlayer->messages.msgWelcome); } else { str->welcome = NULL; } } /* InitPlayerMessages */ /* * */ void InitPlayers (XBPlayerHost host, const CFGGame * cfgGame, const CFGPlayer * cfgPlayer) { int i, j, cnt; XBBool local; BMPlayer *ps; assert (NULL != cfgGame); assert (NULL != cfgPlayer); /* global settings */ numPlayer = cfgGame->players.num; maxLives = cfgGame->setup.numLives; ifRecLives = cfgGame->setup.ifRecLives; randomPlayerPos = cfgGame->setup.randomPlayers; cnt = 0; /* player settings */ for (ps = player_stat, i = 0; i < cfgGame->players.num; ps++, i++) { assert (ATOM_INVALID != cfgGame->players.player[i]); local = (host == cfgGame->players.host[i]); if (local) { ps->localDisplay = cnt; cnt++; ps->bot = cfgGame->setup.bot; } else { ps->localDisplay = -1; ps->bot = XBFalse; if (XBPT_None != cfgGame->players.team[i]) { for (j = 0; j < cfgGame->players.num; j++) { if (i != j && host == cfgGame->players.host[j]) { local = local || (cfgGame->players.team[i] == cfgGame->players.team[j]); } } } } ps->away = XBTrue; InitPlayerStat (player_stat + i, i, i, cfgGame->players.team[i], (cfgPlayer + i)->id.PID, local); // XBCC InitPlayerMessages (p_string + i, cfgPlayer + i); } } /* InitPlayers */ /* * */ void FinishPlayers (void) { int i; PlayerStrings *str; for (i = 0; i < numPlayer; i++) { str = p_string + i; if (NULL != str->name) { free (str->name); } if (NULL != str->tag) { free (str->tag); } if (NULL != str->pause) { free (str->pause); } if (NULL != str->winlevel) { free (str->winlevel); } if (NULL != str->wingame) { free (str->wingame); } if (NULL != str->loselife) { free (str->loselife); } if (NULL != str->loselevel) { free (str->loselevel); } if (NULL != str->gloat) { free (str->gloat); } if (NULL != str->laola) { free (str->laola); } if (NULL != str->loser) { free (str->loser); } if (NULL != str->welcome) { free (str->welcome); } if (NULL != str->abort) { free (str->abort); } if (NULL != str->abortcancel) { free (str->abortcancel); } } numPlayer = 0; } /* FinishPlayers */ /* * */ void DeletePlayerSprites (void) { int player; for (player = 0; player < numPlayer; player++) { DeleteSprite (player_stat[player].sprite); } } /* DeletePlayerSprites */ /* * */ void DropBomb (BMPlayer * ps, int type) { if ((ps->bombs != 0) && (ps->sniping != 1) && /* skywalker / koen */ (ps->illness != IllEmpty) && (ps->morphed < 2) && (type == BMTdefault || ps->special_bombs > 0 || ps->choice_bomb_type != NUM_BMT)) { if (ps->lives > 0) { if (ps->choice_bomb_type != NUM_BMT) type = ps->choice_bomb_type; if (NewPlayerBomb (ps, type)) { SND_Play (SND_DROP, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->bombs--; if (ps->morphed) { ps->morphed = 2; ps->num_morph--; } /** Skywalker **/ if (ps->sniping) { ps->num_snipe--; } /** **/ if (type != BMTdefault && ps->choice_bomb_type == NUM_BMT) { ps->special_bombs--; } } else { if (ps->morphed) { ps->morphed = 0; } } } } } /* DropBomb */ /* * */ static void WalkStop (BMPlayer * ps, int flag, int mazex, int mazey) { if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { switch (ps->d_look) { case GoDown: SetSpriteAnime (ps->sprite, SpriteStopLeft); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteStopRight); break; case GoLeft: SetSpriteAnime (ps->sprite, SpriteStopDown); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteStopUp); break; default: break; } } else { switch (ps->d_look) { case GoDown: SetSpriteAnime (ps->sprite, SpriteStopDown); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteStopUp); break; case GoLeft: SetSpriteAnime (ps->sprite, SpriteStopLeft); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteStopRight); break; default: break; } } } else { switch (ps->d_look) { case GoDown: SetSpriteAnime (ps->sprite, SpriteStopUp); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteStopDown); break; case GoLeft: SetSpriteAnime (ps->sprite, SpriteStopRight); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteStopLeft); break; default: break; } } } /* WalkStop */ /* * */ static void WalkUp (BMPlayer * ps, int flag, int mazex, int mazey) { if (!(flag && CheckMazeGhost (ps->ghost, mazex, mazey - 1)) || (!((ps->phantom) ? CheckMazePhantomWall (mazex, mazey - 1) : CheckMaze (mazex, mazey - 1)) && (mazey > 1))) { ps->y -= STEP_VERT; if (ps->y < 0) ps->y = PIXH - BLOCK_HEIGHT * 2; // 02-05-2002 mazey = ps->y / BLOCK_HEIGHT + 1; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteWalkLeft0 + ((ps->y / STEP_VERT) % 4)); } else { SetSpriteAnime (ps->sprite, SpriteWalkUp0 + ((ps->y / STEP_VERT) % 4)); } } else { SetSpriteAnime (ps->sprite, SpriteWalkDown0 + ((ps->y / STEP_VERT) % 4)); } } else { ps->d_ist = GoStop; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteStopLeft); } else { SetSpriteAnime (ps->sprite, SpriteStopUp); } } else { SetSpriteAnime (ps->sprite, SpriteStopDown); } } /* try a kick */ if (CheckBomb (mazex, mazey) && ((ps->y % BLOCK_HEIGHT) == (STEP_VERT * BOMB_STEP) && (!ps->through)) && (!ps->through)) { if (ps->kick) { SND_Play (SND_KICK, ps->x / (PIXW / MAX_SOUND_POSITION)); /* added by Galatius */ switch (ps->daleif & GameRandomNumber (2)) { case 0: MoveBomb (mazex, mazey, GoUp); break; case 1: ps->daleifing = DALEIF_TIME; MoveBomb (mazex, mazey, GoDown); break; } /* end added by Galatius */ ps->d_soll = GoStop; } ps->y += STEP_VERT; ps->y = (ps->y + PIXH) % PIXH; } // if(oldy!=ps->y)SND_Play (SND_STEP4, ps->x / (PIXW / MAX_SOUND_POSITION)); } /* WalkUp */ /* * local function walk_left */ static void WalkLeft (BMPlayer * ps, int flag, int mazex, int mazey) { if (!(flag && CheckMazeGhost (ps->ghost, mazex - 1, mazey)) || (!((ps->phantom) ? CheckMazePhantomWall (mazex - 1, mazey) : CheckMaze (mazex - 1, mazey)) && (mazex > 1))) { ps->x -= STEP_HORI; if (ps->x < 0) ps->x = PIXW; // 02-05-2002 mazex = ps->x / BLOCK_WIDTH; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteWalkDown0 + ((ps->x / STEP_VERT) % 4)); } else { SetSpriteAnime (ps->sprite, SpriteWalkLeft0 + ((ps->x / STEP_HORI) % 4)); } } else { SetSpriteAnime (ps->sprite, SpriteWalkRight0 + ((ps->x / STEP_HORI) % 4)); } } else { ps->d_ist = GoStop; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteStopDown); } else { SetSpriteAnime (ps->sprite, SpriteStopLeft); } } else { SetSpriteAnime (ps->sprite, SpriteStopRight); } } /* try a kick */ if (CheckBomb (mazex, mazey) && ((ps->x % BLOCK_WIDTH) == (STEP_HORI * BOMB_STEP)) && (!ps->through)) { if (ps->kick) { SND_Play (SND_KICK, ps->x / (PIXW / MAX_SOUND_POSITION)); /* added by Galatius */ switch (ps->daleif & GameRandomNumber (2)) { case 0: MoveBomb (mazex, mazey, GoLeft); break; case 1: ps->daleifing = DALEIF_TIME; MoveBomb (mazex, mazey, GoRight); break; default: break; } ps->d_soll = GoStop; /* end added by Galatius */ } ps->x += STEP_HORI; } // if(oldx!=ps->x)SND_Play (SND_STEP1, ps->x / (PIXW / MAX_SOUND_POSITION)); } /* WalkLeft */ /* * */ static void WalkDown (BMPlayer * ps, int flag, int mazex, int mazey) { if (!(flag && CheckMazeGhost (ps->ghost, mazex, mazey + 1)) || (!((ps->phantom) ? CheckMazePhantomWall (mazex, mazey + 1) : CheckMaze (mazex, mazey + 1)) && (mazey < (MAZE_H - 2)))) { ps->y += STEP_VERT; if (ps->y >= (PIXH - BLOCK_HEIGHT * 2)) ps->y = 0; // 02-05-2002 mazey = ps->y / BLOCK_HEIGHT + 1; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteWalkRight0 + ((ps->y / STEP_VERT) % 4)); } else { SetSpriteAnime (ps->sprite, SpriteWalkDown0 + ((ps->y / STEP_VERT) % 4)); } } else { SetSpriteAnime (ps->sprite, SpriteWalkUp0 + ((ps->y / STEP_VERT) % 4)); } } else { ps->d_ist = GoStop; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteStopRight); } else { SetSpriteAnime (ps->sprite, SpriteStopDown); } } else { SetSpriteAnime (ps->sprite, SpriteStopUp); } } /* try a kick */ if (CheckBomb (mazex, mazey + 1) && ((ps->y % BLOCK_HEIGHT) == (BLOCK_HEIGHT - STEP_VERT * BOMB_STEP)) && (!ps->through) ) { if (ps->kick) { SND_Play (SND_KICK, ps->x / (PIXW / MAX_SOUND_POSITION)); /* added by Galatius */ switch (ps->daleif & GameRandomNumber (2)) { case 0: MoveBomb (mazex, mazey + 1, GoDown); break; case 1: ps->daleifing = DALEIF_TIME; MoveBomb (mazex, mazey + 1, GoUp); break; } /* end added by Galatius */ ps->d_soll = GoStop; } ps->y -= STEP_VERT; } //if(oldy!=ps->y) SND_Play (SND_STEP2, ps->x / (PIXW / MAX_SOUND_POSITION)); } /* WalkDown */ /* * */ static void WalkRight (BMPlayer * ps, int flag, int mazex, int mazey) { if (!(flag && CheckMazeGhost (ps->ghost, mazex + 1, mazey)) || (!((ps->phantom) ? CheckMazePhantomWall (mazex + 1, mazey) : CheckMaze (mazex + 1, mazey)) && (mazex < (MAZE_W - 2)))) { ps->x += STEP_HORI; if (ps->x >= PIXW - BLOCK_WIDTH) ps->x = 0; // 02-05-2002 mazex = ps->x / BLOCK_WIDTH; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteWalkUp0 + ((ps->x / STEP_VERT) % 4)); } else { SetSpriteAnime (ps->sprite, SpriteWalkRight0 + ((ps->x / STEP_HORI) % 4)); } } else { SetSpriteAnime (ps->sprite, SpriteWalkLeft0 + ((ps->x / STEP_HORI) % 4)); } } else { ps->d_ist = GoStop; if (ps->illness != IllReverse) { if (ps->illness == IllReverse2) { SetSpriteAnime (ps->sprite, SpriteStopUp); } else { SetSpriteAnime (ps->sprite, SpriteStopRight); } } else { SetSpriteAnime (ps->sprite, SpriteStopLeft); } } /* try kick */ if (CheckBomb (mazex + 1, mazey) && ((ps->x % BLOCK_WIDTH) == (BLOCK_WIDTH - STEP_HORI * BOMB_STEP)) && (!ps->through)) { if (ps->kick) { SND_Play (SND_KICK, ps->x / (PIXW / MAX_SOUND_POSITION)); /* added by Galatius */ switch (ps->daleif & GameRandomNumber (2)) { case 0: MoveBomb (mazex + 1, mazey, GoRight); break; case 1: ps->daleifing = DALEIF_TIME; MoveBomb (mazex + 1, mazey, GoLeft); break; } /* end added by Galatius */ ps->d_soll = GoStop; } ps->x -= STEP_HORI; } // if(oldx!=ps->x)SND_Play (SND_STEP3, ps->x / (PIXW / MAX_SOUND_POSITION)); } /* WalkRight */ /* * try to teleport player */ static XBBool TeleportPlayer (BMPlayer * ps, int mazeX, int mazeY) { int newMazeX, newMazeY; int i, j, n; int fs[MAZE_W * MAZE_H]; n = 0; for (i = 0; i < MAZE_W; i++) { for (j = 0; j < MAZE_H; j++) { if (!CheckMaze (i, j)) { fs[n] = i + j * MAZE_W; n++; } } } if (n > 0) { i = fs[GameRandomNumber (n)]; newMazeX = i % MAZE_W; newMazeY = i / MAZE_W; if (((ps-> phantom) ? (!CheckMazePhantomWall (newMazeX, newMazeY)) : (!CheckMaze (newMazeX, newMazeY))) && ((mazeX != newMazeX) || (mazeY != newMazeY))) { SND_Play (SND_TELE1, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->x = newMazeX * BLOCK_WIDTH; ps->y = (newMazeY - 1) * BLOCK_HEIGHT; ps->d_soll = GoStop; ps->d_look = GoDown; SND_Play (SND_TELE2, ps->x / (PIXW / MAX_SOUND_POSITION)); return XBTrue; } } return XBFalse; } /* TeleportPlayer */ /* * local function do_walk */ static void DoWalk (BMPlayer * ps, int gameTime) { XBBool flag; int mazeX, mazeY; int i; int xalt, yalt; int spm_mode; xalt = ps->x; yalt = ps->y; if (ps->illness != IllSlow || 0 == gameTime % 2) { for (i = 0; i <= (ps->illness == IllRun) * ((ps->speed == 0) ? 1 : ps->speed); i++) { flag = XBFalse; mazeX = ps->x / BLOCK_WIDTH; mazeY = ps->y / BLOCK_HEIGHT + 1; if (0 == (ps->x % BLOCK_WIDTH) && 0 == (ps->y % BLOCK_HEIGHT)) { flag = XBTrue; /* check if player has deliberately teleported */ if (ps->teleport == TELEPORT_TIME) { if (TeleportPlayer (ps, mazeX, mazeY)) { ps->teleport--; } } /* change direction if needed */ ps->d_ist = ps->d_soll; if (ps->d_ist != GoStop) { ps->d_look = ps->d_ist; } } /* random teleporting */ if ((ps->illness == IllTeleport) && (0 == GameRandomNumber (32))) { TeleportPlayer (ps, mazeX, mazeY); ps->d_ist = GoStop; ps->d_soll = GoStop; } /* let the player walk */ if (ps->sniping != 1) { /* skywalker / koen */ switch (ps->d_ist) { case GoStop: WalkStop (ps, flag, mazeX, mazeY); break; case GoLeft: WalkLeft (ps, flag, mazeX, mazeY); break; case GoRight: WalkRight (ps, flag, mazeX, mazeY); break; case GoDown: WalkDown (ps, flag, mazeX, mazeY); break; case GoUp: WalkUp (ps, flag, mazeX, mazeY); break; default: break; } } MoveSprite (ps->sprite, ps->x, ps->y); /* insert get _extra here */ if ((ps->x % BLOCK_WIDTH == 0) && (ps->y % BLOCK_HEIGHT == 0)) { switch (GetExtra (ps->invincible, ps->x / BLOCK_WIDTH, ps->y / BLOCK_HEIGHT + 1)) { case BTBomb: SND_Play (SND_NEWBOMB, ps->x / (PIXW / MAX_SOUND_POSITION)); ps->bombs++; break; case BTRange: SND_Play (SND_MOREFIRE, ps->x / (PIXW / MAX_SOUND_POSITION)); if (ps->range < MAX_RANGE) { ps->range++; } break; case BTSick: ps->illtime = ILLTIME; ps->illness = GameRandomNumber (MAX_ILL) + 1; if (ps->illness == IllInvisible) { SND_Play (SND_INVIS, ps->x / (PIXW / MAX_SOUND_POSITION)); } else { SND_Play (SND_BAD, ps->x / (PIXW / MAX_SOUND_POSITION)); } if (ps->illness == IllReverse) { switch (ps->d_ist) { case GoDown: ps->d_ist = GoUp; break; case GoUp: ps->d_ist = GoDown; break; case GoLeft: ps->d_ist = GoRight; break; case GoRight: ps->d_ist = GoLeft; break; default: break; } } if (ps->illness == IllReverse2) { switch (ps->d_ist) { case GoDown: ps->d_ist = GoLeft; break; case GoUp: ps->d_ist = GoRight; break; case GoLeft: ps->d_ist = GoUp; break; case GoRight: ps->d_ist = GoDown; break; default: break; } } break; case BTSpecial: ps->num_extras++; (*specialExtraFunc) (ps); break; } } } } /*decrement phantom time */ /* Written by Amilhastre */ if (ps->phantom > 0) { ps->phantom--; } /* Added by "Belgium Guys" */ if (ps->through) { ps->through--; } if (ps->ghost) { ps->ghost--; /* Written by VVL */ if ((ps->ghost == 0) && (ps->lives > 0)) { if (CheckMaze ((ps->x / BLOCK_WIDTH), (ps->y / BLOCK_HEIGHT) + 1)) { ps->lives = 1; ps->dying = DEAD_TIME; } } } /* Skywalker */ if (ps->laola) { static BMSpriteAnimation laola_animation[6] = { SpriteWinner3, SpriteWinner2, SpriteWinner, SpriteWinner, SpriteWinner2, SpriteWinner3 }; SetSpriteAnime (ps->sprite, laola_animation[ps->laola - 1]); ps->laola--; } else { if (ps->looser) { static BMSpriteAnimation looser_animation[10] = { SpriteLooser, SpriteLooser, SpriteLooser1, SpriteLooser1, SpriteLooser, SpriteLooser, SpriteLooser, SpriteLooser2, SpriteLooser2, SpriteLooser, }; SetSpriteAnime (ps->sprite, looser_animation[ps->looser - 1]); ps->looser--; } } /* */ // 02-05-2002, reinco BUG fixed if (ps->invincible > 0) { ps->invincible--; } else if (ps->teleport > 1) { ps->teleport--; } /* draw player if not totally invisible or morphed */ if (ps->in_active) { spm_mode = SPM_UNMAPPED; } else if (ps->illness != IllInvisible) { /* set default mode */ spm_mode = SPM_MAPPED; /* first check for cloak */ if (ps->cloaking < 0) { ps->cloaking++; if (ps->cloaking & 0x01) { spm_mode = ps->disp; } else { spm_mode = SPM_UNMAPPED; } } /* Added by "Belgium Guys" *//* blinking if gost_time < 64 */ if ((ps->ghost < 64) && (ps->ghost)) { if (ps->ghost & 0x01) { spm_mode |= SPM_MASKED; } } /* blinking if invincible */ if (ps->invincible > 0) { if (ps->invincible & 0x01) { spm_mode |= SPM_MASKED; } /* or slower blinking if arrived from teleport */ } else if (ps->teleport > 1) { if ((ps->teleport >> 1) & 0x01) { spm_mode |= SPM_MASKED; } } } else { spm_mode = SPM_UNMAPPED; } SetSpriteMode (ps->sprite, spm_mode); /* is player still sick? */ if (ps->illness != ps->health) { /* decrement illness timer */ if ((ps->illtime--) == 0) { /* heal if time is over */ ps->illness = ps->health; } } /* drop random bombs if needed */ if ((ps->x % BLOCK_WIDTH == 0) && (ps->y % BLOCK_HEIGHT == 0)) { if (ps->illness == IllBomb) { if (GameRandomNumber (4) != 0) { if (ps->choice_bomb_type != NUM_BMT) DropBomb (ps, ps->choice_bomb_type); else DropBomb (ps, BMTdefault); } } } } /* DoWalk */ /* * */ static void DoMorph (BMPlayer * ps) { SetSpriteAnime (ps->sprite, SpriteMorphed); SetSpriteMode (ps->sprite, (ps->morphed == 2) ? SPM_MAPPED : SPM_UNMAPPED); if (ps->d_soll != GoStop) { MoveBomb (ps->x / BLOCK_WIDTH, ps->y / BLOCK_HEIGHT + 1, ps->d_soll); ps->d_soll = GoStop; } } /* DoMorph */ /* * */ void DoJunkie (void) { BMPlayer *ps1; /* Junkie countdown */ for (ps1 = player_stat; ps1 < player_stat + numPlayer; ps1++) { if ((ps1->lives) && (ps1->junkie)) { /* Junkie sickness */ switch (--(ps1->junkie)) { case JUNKIE_TIME_1: case JUNKIE_TIME_2: /* Give a random illness */ ps1->illtime = JUNKIE_ILL_TIME; ps1->illness = GameRandomNumber (MAX_ILL) + 1; break; case JUNKIE_TIME_3: /* Stun player and give speed */ ps1->stunned += JUNKIE_STUN_TIME; ps1->illtime = JUNKIE_ILL_TIME; ps1->illness = IllRun; break; case 0: /* Too long! Take a hit. */ ps1->dying = DEAD_TIME; ps1->junkie = MAX_JUNKIE_TIME; break; } } } } /* DoJunkie */ /**/ /* public function Electrify_other_players */ /**/ int ElectrifyOtherPlayers (int nplayer) { int player; int count = 0; for (player = 0; player < numPlayer; player++) { if (nplayer != player) { if (player_stat[player].lives) { if ((ABS (player_stat[player].x - player_stat[nplayer].x) < (BLOCK_WIDTH * 3 / 4)) && (ABS (player_stat[player].y - player_stat[nplayer].y) < (BLOCK_HEIGHT * 3 / 4))) { player_stat[player].dying = DEAD_TIME; player_stat[player].electrify = 0; count++; } } } } return (count > 0); } /* * */ void InfectOtherPlayers (int *active_player) { BMPlayer *ps1, *ps2; BMPlayer *ptr; int i, team_alive, equipe; for (ps1 = player_stat; ps1 < player_stat + numPlayer; ps1++) { for (ps2 = ps1 + 1; ps2 < player_stat + numPlayer; ps2++) { if ((ABS (ps1->x - ps2->x) < ILL_X) && (ABS (ps1->y - ps2->y) < ILL_Y)) { if (ps1->lives && ps2->lives) { /* infection with "evil grail" virus */ if (ps1->evilill && (!ps2->invincible)) { ps1->illtime = ps1->evilill = 0; ps1->illness = ps1->health = IllRun; ps1->kick = XBTrue; ps1->invincible += BONUSEVIL; ps1->phantom += BONUSEVIL; if (ps1->cloaking > 0) ps1->cloaking = -(ps1->cloaking + BONUSEVIL); else ps1->cloaking -= BONUSEVIL; ps1->revive += 1; ps2->evilill = ILLDEATHTIME; } else if (ps2->evilill && (!ps1->invincible)) { ps2->illtime = ps2->evilill = 0; ps2->illness = ps2->health = IllRun; ps2->kick = XBTrue; ps2->invincible += BONUSEVIL; ps2->phantom += BONUSEVIL; if (ps2->cloaking > 0) ps2->cloaking = -(ps2->cloaking + BONUSEVIL); else ps2->cloaking -= BONUSEVIL; ps2->revive += 1; ps1->evilill = ILLDEATHTIME; } /* infection with "normal" viruses */ if (ps1->illness != ps2->illness) { if ((!ps2->invincible) && (ps1->illtime > ps2->illtime)) { ps2->illness = ps1->illness; ps2->illtime = ILLTIME; } else if ((!ps1->invincible) && (ps2->illtime > ps1->illtime)) { ps1->illness = ps2->illness; ps1->illtime = ILLTIME; } } /* infection with junkie virus */ if (((ps2->junkie) && (!ps1->invincible)) || (ps1->junkie)) { ps1->junkie = MAX_JUNKIE_TIME; } if (((ps1->junkie) && (!ps2->invincible)) || (ps2->junkie)) { ps2->junkie = MAX_JUNKIE_TIME; } } else { if ((ps2->lives) && (ps1->revive)) { equipe = -1; team_alive = XBFalse; for (i = 0, ptr = player_stat; i < numPlayer; i++, ptr++) { if (ptr->team == ps1->team) { team_alive |= (ptr->lives != 0); equipe++; } } if (!team_alive) (*active_player)++; ps1->lives = 1; ps1->revive--; } if ((ps1->lives) && (ps2->revive)) { equipe = -1; team_alive = XBFalse; for (i = 0, ptr = player_stat; i < numPlayer; i++, ptr++) { if (ptr->team == ps2->team) { team_alive |= (ptr->lives != 0); equipe++; } } if (!team_alive) (*active_player)++; ps2->lives = 1; ps2->revive--; } } } } } } /* InfectOtherPlayers */ /* * */ static void HaveAGloat (int player) { int g, gloatpl, gloatpltt; gloatpl = -1; for (g = 0; g < 6; g++) { gloatpltt = OtherRandomNumber (numPlayer); if (gloatpltt != player && player_stat[gloatpltt].lives > 0) { gloatpl = gloatpltt; break; } } if (gloatpl > -1) { SetMessage (p_string[gloatpl].gloat, XBFalse); } } /* HaveAGloat */ void SetMsgLaola (int player) { SetMessage (p_string[player].laola, XBFalse); } void SetMsgLoser (int player) { SetMessage (p_string[player].loser, XBFalse); } /* Added by Fouf on 09/02/99 22:46:25 *//* Added by "Belgium Guys" */ /**/ /* local function kill_player_at_ghost */ /**/ void KillPlayerAtGhost (int block, int x, int y) { BMPlayer *ps; int player; for (player = 0; player < numPlayer; player++) { ps = player_stat + player; if (!ps->ghost || block == BTVoid) { if (ps->lives > 0) { if ((ps->x < (x + 1) * BLOCK_WIDTH) && (ps->x > (x - 1) * BLOCK_WIDTH) && (ps->y < (y) * BLOCK_HEIGHT) && (ps->y > (y - 2) * BLOCK_HEIGHT)) { ps->lives = 1; ps->dying = DEAD_TIME; } } } } } /* * */ void KillPlayerAt (int x, int y) { BMPlayer *ps; int player; for (player = 0; player < numPlayer; player++) { ps = player_stat + player; /* Added by "Belgium Guys" */ if (!ps->ghost) { if (ps->lives > 0) { if ((ps->x < (x + 1) * BLOCK_WIDTH) && (ps->x > (x - 1) * BLOCK_WIDTH) && (ps->y < (y) * BLOCK_HEIGHT) && (ps->y > (y - 2) * BLOCK_HEIGHT)) { ps->lives = 1; ps->dying = DEAD_TIME; } } } } } /* KillPlayerAt */ /* * */ int KillOtherPlayers (int team) { int count = 0; int player; for (player = 0; player < numPlayer; player++) { if ((player_stat[player].team != team) && (player_stat[player].lives > 0)) { player_stat[player].dying = DEAD_TIME; count++; } } return count; } /* KillOtherPlayers */ /* * */ int StunOtherPlayers (int team, int time) { int count = 0; int player; for (player = 0; player < numPlayer; player++) { if ((player_stat[player].team != team) && (!player_stat[player].invincible > 0)) { SND_Play (SND_STUN, player_stat[player].x / (PIXW / MAX_SOUND_POSITION)); player_stat[player].stunned = time; count++; } } return count; } /* StunOtherPlayers */ /*Skywalker */ /**/ /* public function fart_on_other_players (galatius) */ /**/ int FartOnOtherPlayers (BMPlayer * ps) { BMPlayer *ps1; int ex, ey; int count = 0; /* do_bell(); */ if (ps->stunned || ps->smelly) { return (count > 0); } ps->smelly = SMELLY_TIME; for (ps1 = player_stat; ps1 < player_stat + numPlayer; ps1++) { if ((ps1->lives == 0) || (ps1->invincible) || ((ps->x == ps1->x) && (ps->y == ps1->y)) || (ABS (ps1->x - ps->x) >= (BLOCK_WIDTH * 2)) || (ABS (ps1->y - ps->y) >= (BLOCK_HEIGHT * 2))) { continue; } /* Now ps will fart ps1 */ ps1->farted = 20; /* Fart counter */ ex = (ps1->x - ps->x) * BLOCK_HEIGHT; ey = (ps1->y - ps->y) * BLOCK_WIDTH; switch (ps1->d_ist) { case GoStop: if (ABS (ex) >= ABS (ey)) { ps1->d_soll = (ex < 0 ? GoLeft : GoRight); } else { ps1->d_soll = (ey < 0 ? GoUp : GoDown); } break; case GoRight: case GoLeft: ps1->d_soll = (ex < 0 ? GoLeft : GoRight); break; case GoUp: case GoDown: ps1->d_soll = (ey < 0 ? GoUp : GoDown); break; default: break; } ps1->illness = IllRun; ps1->illtime = 20; ps1->stunned = 20; count++; } return (count > 0); } /**/ /* public function Swap_color_other_players */ /**/ void SwapColorOtherPlayers (int team) { int count = 0; int D[MAX_PLAYER]; int RR; int player; if (numPlayer == 2) { RR = ((player_stat[0].sprite)->player).player; ((player_stat[0].sprite)->player).player = ((player_stat[1].sprite)->player).player; ((player_stat[1].sprite)->player).player = RR; MarkMazeSprite (player_stat[0].sprite); MarkMazeSprite (player_stat[1].sprite); } else { for (player = 0; player < numPlayer; player++) { if (((player_stat[player].team) != team) && player_stat[player].lives) { D[count] = player; count++; } } if (count > 2) { RR = ((player_stat[D[0]].sprite)->player).player; for (player = 0; player < count - 1; player++) { ((player_stat[D[player]].sprite)->player).player = ((player_stat[D[player + 1]].sprite)->player).player; MarkMazeSprite (player_stat[D[player]].sprite); } ((player_stat[D[count - 1]].sprite)->player).player = RR; MarkMazeSprite (player_stat[D[count - 1]].sprite); } else { if (count == 2) { RR = ((player_stat[D[0]].sprite)->player).player; ((player_stat[D[0]].sprite)->player).player = ((player_stat[D[1]].sprite)->player).player; ((player_stat[D[1]].sprite)->player).player = RR; MarkMazeSprite ((player_stat[D[0]].sprite)); MarkMazeSprite ((player_stat[D[1]].sprite)); } } } } #if unused /**/ /* public function Swap_color_other_players2 */ /**/ void SwapColorOtherPlayers2 (int team) { int count = 0; int D[MAX_PLAYER]; int RR; int player; int swapper = 0; fprintf (stderr, "count %i \n", count); if (numPlayer == 2) { RR = ((player_stat[0].sprite)->player).player; ((player_stat[0].sprite)->player).player = ((player_stat[1].sprite)->player).player; ((player_stat[1].sprite)->player).player = RR; MarkMazeSprite (player_stat[0].sprite); MarkMazeSprite (player_stat[1].sprite); } else { for (player = 0; player < numPlayer; player++) { if (player_stat[player].lives) { if (((player_stat[player].team) != team)) { D[count] = player; count++; } else { swapper = player; } } } if (count > 2) { RR = ((player_stat[D[0]].sprite)->player).player; for (player = 0; player < count - 1; player++) { ((player_stat[D[player]].sprite)->player).player = ((player_stat[D[player + 1]].sprite)->player).player; MarkMazeSprite (player_stat[D[player]].sprite); } ((player_stat[D[count - 1]].sprite)->player).player = RR; MarkMazeSprite (player_stat[D[count - 1]].sprite); } /* 2 or 3 players, count 1 or 2 */ else { if (count > 0) { fprintf (stderr, "count %i numPlayer %i\n", count, numPlayer); if (count == 1) D[1] = swapper; RR = ((player_stat[D[0]].sprite)->player).player; ((player_stat[D[0]].sprite)->player).player = ((player_stat[D[1]].sprite)->player).player; ((player_stat[D[1]].sprite)->player).player = RR; MarkMazeSprite ((player_stat[D[0]].sprite)); MarkMazeSprite ((player_stat[D[1]].sprite)); } } } } #endif /*Skywalker */ /**/ /* public function steal_bombs_other_players */ /**/ int StealBombsOtherPlayers (int team) { int count = 0; int player; for (player = 0; player < numPlayer; player++) { if (player_stat[player].team != team) { if (player_stat[player].bombs > 0) { player_stat[player].bombs--; count++; } } } return count; } /**/ /* public function steal_range_other_players */ /**/ int StealRangeOtherPlayers (int team) { int count = 0; int player; for (player = 0; player < numPlayer; player++) { if (player_stat[player].team != team) { if (player_stat[player].range > 1) { player_stat[player].range--; count++; } } } return count; } /**/ /* public function Swap_position_other_players */ /**/ void SwapPositionOtherPlayers (int team) { int x = 0, y = 0; int first = -1; int player; int count = 0; for (player = 0; player < numPlayer; player++) { if ((player_stat[player].team) != team) { count++; if (player_stat[player].lives) { if (first > -1) { player_stat[first].x = (player_stat[player].x / BLOCK_WIDTH) * BLOCK_WIDTH; player_stat[first].y = (player_stat[player].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; first = player; } else { first = player; x = (player_stat[player].x / BLOCK_WIDTH) * BLOCK_WIDTH;; y = (player_stat[player].y / BLOCK_HEIGHT) * BLOCK_HEIGHT;; } } } } if (count > 1) { if (first > -1) { player_stat[first].x = x; player_stat[first].y = y; } } if (numPlayer == 2) { x = (player_stat[0].x / BLOCK_WIDTH) * BLOCK_WIDTH; y = (player_stat[0].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; player_stat[0].x = (player_stat[1].x / BLOCK_WIDTH) * BLOCK_WIDTH; player_stat[0].y = (player_stat[1].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; player_stat[1].x = x; player_stat[1].y = y; } } #ifdef unused /**/ /* public function Swap_position_other_players2 */ /**/ void SwapPositionOtherPlayers2 (int team) { int x = 0, y = 0; int first = -1; int player, swapper = 0; int count = 0; for (player = 0; player < numPlayer; player++) { if (player_stat[player].lives) { if ((player_stat[player].team) != team) { count++; if (first > -1) { player_stat[first].x = (player_stat[player].x / BLOCK_WIDTH) * BLOCK_WIDTH; player_stat[first].y = (player_stat[player].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; first = player; } else { first = player; x = (player_stat[player].x / BLOCK_WIDTH) * BLOCK_WIDTH;; y = (player_stat[player].y / BLOCK_HEIGHT) * BLOCK_HEIGHT;; } } else { swapper = player; } } } if (count > 1) { if (first > -1) { player_stat[first].x = x; player_stat[first].y = y; } } /* count==1 */ else { if (first > -1) { player_stat[first].x = (player_stat[swapper].x / BLOCK_WIDTH) * BLOCK_WIDTH; player_stat[first].y = (player_stat[swapper].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; player_stat[swapper].x = x; player_stat[swapper].y = y; } } if (numPlayer == 2) { x = (player_stat[0].x / BLOCK_WIDTH) * BLOCK_WIDTH; y = (player_stat[0].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; player_stat[0].x = (player_stat[1].x / BLOCK_WIDTH) * BLOCK_WIDTH; player_stat[0].y = (player_stat[1].y / BLOCK_HEIGHT) * BLOCK_HEIGHT; player_stat[1].x = x; player_stat[1].y = y; } } #endif /* added by Skywalker */ /**/ /* public function do_frog (galatius) */ /**/ void DoFrog (BMPlayer * ps) { int ex, ey; int frogs = ps->frogger; if (!ps->d_ist == GoStop) { /* If you are already moving: */ ex = ps->x % BLOCK_WIDTH; ey = ps->y % BLOCK_HEIGHT; switch (ps->d_ist) { case GoDown: case GoUp: ps->y -= ey + ((ps->d_ist == GoUp) - 1) * BLOCK_HEIGHT; break; case GoRight: case GoLeft: ps->x -= ex + ((ps->d_ist == GoLeft) - 1) * BLOCK_WIDTH; break; default: break; } frogs--; } ex = 0; ey = 0; switch (ps->d_look) { case GoDown: ey = 1; break; case GoUp: ey = -1; break; case GoRight: ex = 1; break; case GoLeft: ex = -1; break; default: break; } ps->x += ex * BLOCK_WIDTH * frogs; ps->y += ey * BLOCK_HEIGHT * frogs; ps->x = MAX (0, MIN (14 * BLOCK_WIDTH, ps->x)); ps->y = MAX (-BLOCK_HEIGHT, MIN (11 * BLOCK_HEIGHT, ps->y)); if (CheckMaze (ps->x / BLOCK_WIDTH, ps->y / BLOCK_HEIGHT + 1)) { MoveSprite (ps->sprite, ps->x, ps->y); ps->lives = 1; ps->dying = DEAD_TIME; } ps->d_soll = GoStop; } /* end added by Skywalker */ /* * */ static void RevivePlayer (BMPlayer * ps, int *active_player) { BMPlayer *ptr; PlayerStrings *st; int i, team_alive; int playerflags; st = p_string + ps->id; ps->lives--; /* check if player has lost all lives? */ if (ps->lives == 0) { SetSpriteMode (ps->sprite, SPM_UNMAPPED); SND_Play (SND_DEAD, ps->x / (PIXW / MAX_SOUND_POSITION)); team_alive = XBFalse; for (i = 0, ptr = player_stat; i < numPlayer; i++, ptr++) { if (ptr->team == ps->team) { team_alive |= (ptr->lives != 0); } } if (!team_alive) { (*active_player)--; } DistributeExtras (ps->bombs - minBombs, ps->range - minRange, ps->num_extras, ps->special_bombs); SetMessage (st->loselevel, XBFalse); } else { SND_Play (SND_OUCH, ps->x / (PIXW / MAX_SOUND_POSITION)); DistributeExtras (0, 0, ps->num_extras, ps->special_bombs); SetMessage (st->loselife, XBFalse); } HaveAGloat (ps->id); /* reset values */ playerflags = (ps->revextra_flags & ((0xffffff) >> 2)); ps->invincible = NEW_INVINCIBLE; ps->dying = 0; ps->stunned = 0; ps->illness = reviveHealth; ps->health = reviveHealth; ps->illtime = 0; ps->teleport = 0; ps->cloaking = XBFalse; ps->morphed = XBFalse; ps->num_morph = 0; ps->evilill = 0; ps->phantom = 0; ps->through = 0; ps->throughCount = 0; ps->farted = (RF_Fart == playerflags) ? XBTrue : XBFalse; /* (galatius) */ ps->smelly = 0; /* (galatius) */ ps->bfarter = (RF_Bfart == playerflags) ? XBTrue : XBFalse; /* (galatius) */ if (!ps->revive) ps->cloaking = 0; /* Note that junkie ISN'T reset (not a bug) */ /* very important */ if (ps->remote_control > 0) { IgnitePlayersBombs (ps); } ps->daleifing = 0; /* (galatius) */ ps->daleif = (RF_Daleif == playerflags) ? XBTrue : XBFalse; /* (galatius) */ ps->remote_control = XBFalse; ps->kick = XBFalse; ps->air_button = XBFalse; ps->frogger = (RF_Frogger == playerflags) ? XBTrue : XBFalse; /*Skywalker */ ps->jump_button = (RF_Jump == playerflags) ? XBTrue : XBFalse; /*Skywalker */ ps->evilill = 0; ps->stop = (RF_Stop == playerflags) ? XBTrue : XBFalse; /*Skywalker */ ps->suck_button = (RF_Suck == playerflags) ? XBTrue : XBFalse; /*Skywalker */ ps->phantom = (RF_Phantom == playerflags) ? GAME_TIME : XBFalse; /*Skywalker */ ps->electrify = (RF_Electrify == playerflags) ? EXTRA_ELECTRIFY_COUNT : XBFalse; /*Skywalker */ /* If special bombs are distributed, then zero the count */ if (DistribSpecial ()) { ps->special_bombs = 0; } /* Reset extra pickup count */ ps->num_extras = 0; /* reset inital extras */ if (RF_RC == playerflags) { ps->remote_control = 1; } if (RF_Teleport == playerflags) { ps->teleport = 1; } if (RF_Kick & ps->revextra_flags) { ps->kick = 1; } if (RF_Morph == playerflags) { ps->num_morph = 1000; } if (RF_Through == playerflags) { ps->through = XBTrue; ps->throughCount = 255; } if (RF_Snipe == playerflags) { ps->num_snipe = 1000; } ps->speed = 0; if (RF_Revive == playerflags) { ps->revive = 1; } ps->choice_bomb_type = NUM_BMT; if (ps->local) ResetMessage (); if (RF_Choice == playerflags) { int h; for (h = ChoiceDefaultBomb; bomb_name_choice[h] == NULL; h = ((h + 1) % NUM_BMT)) ; ps->choice_bomb_type = h; if (ps->local && ps->lives) { char tutu[40]; sprintf (tutu, "%s : ", p_string[ps->id].name); strcat (tutu, bomb_name_choice[(ps->choice_bomb_type)]); SetMessage (tutu, XBTrue); } } if (RF_Airpump == playerflags) { ps->air_button = 1; } if (RF_Cloak == playerflags) { ps->cloaking = -GAME_TIME; } /* if revived ignite the bombs! */ if (ps->sniping == 1) { if (IgnitePlayersBombs (ps)) { ps->sniping = 1; ps->d_soll = GoStop; } } } /* RevivePlayer */ /* * */ static void DoStunned (BMPlayer * ps) { switch ((ps->d_look + ps->stunned - 1) % 4 + GoStop + 1) { case GoDown: SetSpriteAnime (ps->sprite, SpriteStopDown); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteStopUp); break; case GoLeft: SetSpriteAnime (ps->sprite, SpriteStopLeft); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteStopRight); break; } ps->stunned--; } /* DoStunned */ void DoEvilIll (void) { BMPlayer *ps1; /* evil-ill countdown */ for (ps1 = player_stat; ps1 < player_stat + numPlayer; ps1++) { if ((ps1->lives) && (ps1->evilill)) { if (ps1->evilill == 1) /* Too long! Take a hit. */ ps1->dying = DEAD_TIME; ps1->evilill--; } } } /* * */ static void DoDie (BMPlayer * ps) { if (ps->dying == DEAD_TIME) { SetSpriteMode (ps->sprite, SPM_MAPPED); } ps->dying--; if (ps->lives > 1) { switch (ps->d_look) { case GoLeft: SetSpriteAnime (ps->sprite, SpriteDamagedLeft); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteDamagedUp); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteDamagedRight); break; default: SetSpriteAnime (ps->sprite, SpriteDamagedDown); break; } } else { switch (ps->d_look) { case GoLeft: SetSpriteAnime (ps->sprite, SpriteDeadLeft); break; case GoUp: SetSpriteAnime (ps->sprite, SpriteDeadUp); break; case GoRight: SetSpriteAnime (ps->sprite, SpriteDeadRight); break; default: SetSpriteAnime (ps->sprite, SpriteDeadDown); break; } } } /* DoDie */ /* * */ XBBool CheckPlayerNear (int x, int y) { int player; for (player = 0; player < numPlayer; player++) { if ((ABS (x * BLOCK_WIDTH - player_stat[player].x) < BLOCK_WIDTH) && (ABS (y * BLOCK_HEIGHT - BLOCK_HEIGHT - player_stat[player].y) < BLOCK_HEIGHT)) { return XBTrue; } } return XBFalse; } /* CheckPlayerNear */ /* * */ void DoAllPlayers (int game_time, int *active_player) { int spm_mode; int i, p, player; int plist[MAX_PLAYER]; // SMPF /* if time is over, kill them all */ if (game_time == (GAME_TIME - DEAD_TIME + 1)) { for (player = 0; player < numPlayer; player++) { if (player_stat[player].lives > 0) { player_stat[player].lives = 1; player_stat[player].dying = DEAD_TIME; } } } for (i = 0; i < numPlayer; i++) { plist[i] = i; } for (i = numPlayer - 1; i > 0; i--) { p = GameRandomNumber (i + 1); player = plist[p]; plist[p] = plist[i]; plist[i] = player; } /* check player status */ for (p = 0; p < numPlayer; p++) { /* to permute player when drawing and stunning */ /* quick and dirty but hopefully it solves some problems */ player = plist[p]; if (player_stat[player].lives != 0) { switch (player_stat[player].dying) { case 0: /* player is alive and ... */ if (player_stat[player].morphed) { /* ... or morphed */ DoMorph (player_stat + player); } else if (player_stat[player].stunned) { if (player_stat[player].farted) { /* (galatius) */ DoWalk (player_stat + player, game_time); DoStunned (player_stat + player); player_stat[player].farted--; } else { /* ... and stunned */ DoStunned (player_stat + player); } } else { /* ... walks around */ DoWalk (player_stat + player, game_time); } /* added by Galatius */ if (player_stat[player].smelly) { player_stat[player].smelly--; } if (player_stat[player].daleifing) { player_stat[player].daleifing--; } break; case 1: /* try to revive player */ RevivePlayer (player_stat + player, active_player); break; default: /* player is dying */ DoDie (player_stat + player); break; } } else { if (player_stat[player].revive) { if (player_stat[player].cloaking < 0) { player_stat[player].cloaking++; if (player_stat[player].cloaking & 0x01) { spm_mode = player_stat[player].disp; } else { spm_mode = SPM_UNMAPPED; } } else spm_mode = SPM_MAPPED; SetSpriteMode (player_stat[player].sprite, spm_mode); SetSpriteAnime (player_stat[player].sprite, SpriteZombie); } } } } /* DoAllPlayers */ /* * */ void CheckPlayerHit (void) { int player; int gridx, gridy; for (player = 0; player < numPlayer; player++) { gridx = (player_stat[player].x + (BLOCK_WIDTH >> 1)) / BLOCK_WIDTH; gridy = (player_stat[player].y + (BLOCK_HEIGHT >> 1)) / BLOCK_HEIGHT + 1; if (0 != player_stat[player].lives && 0 == player_stat[player].invincible && 0 == player_stat[player].morphed && 0 == player_stat[player].dying && CheckExplosion (gridx, gridy)) { player_stat[player].dying = DEAD_TIME; } } } /* CheckPlayerHit */ /* * check if local players are away, make them bot, reset away flag */ void Player_CheckLocalAway (void) { BMPlayer *ps; for (ps = player_stat; ps < player_stat + numPlayer; ps++) { if (ps->localDisplay >= 0) { if (ps->away) { ps->bot = XBTrue; } else { ps->away = XBTrue; } } } } /* Player_CheckLocalAway */ /* * check if all local players are bots */ XBBool Player_CheckLocalBot (void) { BMPlayer *ps; for (ps = player_stat; ps < player_stat + numPlayer; ps++) { if (ps->localDisplay >= 0 && !ps->bot) { return XBFalse; } } return XBTrue; } /* Player_CheckLocalBot */ /* * determine action for all (local) bots */ void Player_BotAction (PlayerAction * pa) { BMPlayer *ps; for (ps = player_stat; ps < player_stat + numPlayer; ps++) { if (ps->bot && ps->localDisplay >= 0) { gestionBot (player_stat, pa, ps->id, numPlayer); } } } /* Player_BotAction */ /* * de/activate bot */ void Player_ActivateBot (BMPlayer * ps, XBBool activate) { assert (ps != NULL); ps->away = activate; if (ps->bot == activate) { return; } ps->bot = activate; if (activate) { SetMessage (N_("Bot Activated"), XBFalse); } else { SetMessage (N_("Bot Deactivated"), XBFalse); } } /* Player_ActivateBot */ /* * return if player is local bot */ XBBool Player_isLocalBot (BMPlayer * ps) { assert (ps != NULL); return (ps->bot && ps->localDisplay >= 0); } /* Player_isLocalBot */ /* * end of file player.c */ xblast-2.10.4/player.h0000644000175000017500000001216010373126076013662 0ustar rhondaalfie/* * file player.c - ingame player mangment * * $Id: player.h,v 1.20 2006/02/10 15:07:42 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_PLAYER_H #define XBLAST_PLAYER_H /* * global macros */ #define TELEPORT_TIME 20 /* Define > 1 */ #define EXTRA_GHOST_TIME 256 #define EXTRA_THROUGH_TIME 64 #define MAX_JUNKIE_TIME (384 + GameRandomNumber(31)) #define NEW_INVINCIBLE 64 #define EXTRA_INVINCIBLE 160 #define EXTRA_INVISIBLE 256 #define STUN_TIME 16 #define SMELLY_TIME 30 #define DALEIF_TIME 5 /* (galatius) Sky */ #define BONUSEVIL (2*EXTRA_INVISIBLE) #define ILLDEATHTIME (GAME_TIME/8) #define EXTRA_ELECTRIFY_COUNT 4 /* * player health */ typedef enum { Healthy = 0, IllBomb, IllSlow, IllRun, IllMini, IllEmpty, IllInvisible, IllMalfunction, IllReverse, IllReverse2, IllTeleport, MAX_ILL } BMHealth; typedef enum { PM_Same = 0, PM_Polar, PM_Right, PM_Inner, PM_LeftRight, PM_Below, PM_Horizontal, PM_Vertical, PM_Circle, MAX_PM } BMPosMod; extern int Original; /* * type definitions */ typedef struct _bmplayer { int y, x; int id, team; int local; int localDisplay; /* Added by VVL (Chat) 12/11/99 : Begin */ char chatstring[CHAT_LEN]; int chatlen; int chatmode; /* Added by VVL (Chat) 12/11/99 : End */ Sprite *sprite; int disp; BMDirection d_soll, d_ist, d_look; int invincible; int dying; int stunned; BMHealth health; BMHealth illness; int speed; int illtime; int junkie; int lives; int stop; int evilill; int score; int range; int choice_bomb_type; int bombs; int PID; // XBCC int suck_button; unsigned int iniextra_flags; unsigned int revextra_flags; int special_bombs; XBBool remote_control; XBBool kick; int air_button; int victories; XBBool teleport; int cloaking; int num_extras; PlayerAbort abort; XBBool morphed; int num_morph; XBBool in_active; int jump_button; /* EPFL */ /* Skywalker */ int revive; int frogger; int laola; int looser; int ghost; XBBool bot; XBBool away; int num_snipe; int sniping; int daleif; /* Player will daleif (galatius,sky) */ int daleifing; /* Player has daleifed (galatius,sky) */ /* farter (galatius) */ int farted; /* player has been farted on */ int farter; /* player has the farter */ int bfarter; /* player can fart bombs and others */ int smelly; /* Just farted others */ int electrify; int throughCount; int through; int phantom; /* */ } BMPlayer; typedef struct { char *name; char *tag; char *pause; char *winlevel; char *wingame; char *loselife; char *loselevel; char *gloat; char *loser; char *laola; char *welcome; char *abort; char *abortcancel; } PlayerStrings; /* * global variables */ extern BMPlayer player_stat[2 * MAX_PLAYER]; extern PlayerStrings p_string[2 * MAX_PLAYER]; /* * prototypes */ extern XBBool ParseLevelPlayers (const DBSection * section, unsigned gameMode, DBSection * warn); extern void ConfigLevelPlayers (const DBSection * section, XBBool allowRandomPos, unsigned gameMode); extern void WelcomePlayers (void); extern int NumSpecialBombs (void); extern void InitPlayers (XBPlayerHost, const CFGGame *, const CFGPlayer *); extern void FinishPlayers (void); extern void DeletePlayerSprites (void); extern void DropBomb (BMPlayer * ps, int type); extern void DoJunkie (void); extern void InfectOtherPlayers (int *active_player); extern void KillPlayerAtGhost (int block, int x, int y); extern void KillPlayerAt (int x, int y); extern int KillOtherPlayers (int team); extern void SetMsgLaola (int player); extern void SetMsgLaola (int player); extern int StunOtherPlayers (int team, int time); extern XBBool CheckPlayerNear (int x, int y); extern void DoAllPlayers (int game_time, int *active_player); extern void CheckPlayerHit (void); extern void DoEvilIll (void); extern int ElectrifyOtherPlayers (int nplayer); extern int StealBombsOtherPlayers (int team); extern int StealRangeOtherPlayers (int team); extern void SetMsgLoser (int player); extern void SetMsgLaola (int player); extern int FartOnOtherPlayers (BMPlayer * ps); extern void SwapColorOtherPlayers (int team); extern void SwapPositionOtherPlayers (int team); /* bot related stuff */ extern void Player_CheckLocalAway (void); extern XBBool Player_CheckLocalBot (void); extern void Player_BotAction (PlayerAction * pa); extern void Player_ActivateBot (BMPlayer * ps, XBBool activate); extern XBBool Player_isLocalBot (BMPlayer * ps); #endif /* * end of file player.h */ xblast-2.10.4/random.c0000644000175000017500000002040410373126075013640 0ustar rhondaalfie/* * file random.c - generator * * $Id: random.c,v 1.8 2006/02/10 15:07:41 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local Variables */ /* seeds for both random generators */ static unsigned gRand; static unsigned oRand; /* This Random Number Generator is based on the algorithm in a FORTRAN version published by George Marsaglia and Arif Zaman, Florida State University; ref.: see original comments below. At the fhw (Fachhochschule Wiesbaden, W.Germany), Dept. of Computer Science, we have written sources in further languages (C, Modula-2 Turbo-Pascal(3.0, 5.0), Basic and Ada) to get exactly the same test results compared with the original FORTRAN version. April 1989 Karl-L. Noell and Helmut Weber This random number generator originally appeared in "Toward a Universal Random Number Generator" by George Marsaglia and Arif Zaman. Florida State University Report: FSU-SCRI-87-50 (1987) It was later modified by F. James and published in "A Review of Pseudo- random Number Generators" THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE. (However, a newly discovered technique can yield a period of 10^600. But that is still in the development stage.) It passes ALL of the tests for random number generators and has a period of 2^144, is completely portable (gives bit identical results on all machines with at least 24-bit mantissas in the floating point representation). The algorithm is a combination of a Fibonacci sequence (with lags of 97 and 33, and operation "subtraction plus one, modulo one") and an "arithmetic sequence" (using subtraction). Use IJ = 1802 & KL = 9373 to test the random number generator. The subroutine RANMAR should be used to generate 20000 random numbers. Then display the next six random numbers generated multiplied by 4096*4096 If the random number generator is working properly, the random numbers should be: 6533892.0 14220222.0 7275067.0 6172232.0 8354498.0 10633180.0 */ /* Globals */ double u[97], c, cd, cm; int i97, j97; int test = 0; /* This is the initialization routine for the random number generator. NOTE: The seed variables can have values between: 0 <= IJ <= 31328 0 <= KL <= 30081 The random number sequences created by these two seeds are of sufficient length to complete an entire calculation with. For example, if sveral different groups are working on different parts of the same calculation, each group could be assigned its own IJ seed. This would leave each group with 30000 choices for the second seed. That is to say, this random number generator can create 900 million different subsequences -- with each subsequence having a length of approximately 10^30. */ static void RandomInitialise (int ij, int kl) { double s, t; int ii, i, j, k, l, jj, m; /* Handle the seed range errors First random number seed must be between 0 and 31328 Second seed must have a value between 0 and 30081 */ if (ij < 0 || ij > 31328) { ij = 1802; } if (kl < 0 || kl > 30081) { kl = 9373; } i = (ij / 177) % 177 + 2; j = (ij % 177) + 2; k = (kl / 169) % 178 + 1; l = (kl % 169); for (ii = 0; ii < 97; ii++) { s = 0.0; t = 0.5; for (jj = 0; jj < 24; jj++) { m = (((i * j) % 179) * k) % 179; i = j; j = k; k = m; l = (53 * l + 1) % 169; if (((l * m % 64)) >= 32) s += t; t *= 0.5; } u[ii] = s; } c = 362436.0 / 16777216.0; cd = 7654321.0 / 16777216.0; cm = 16777213.0 / 16777216.0; i97 = 97; j97 = 33; test = 1; } /* RandomInitialize */ /* This is the random number generator proposed by George Marsaglia in Florida State University Report: FSU-SCRI-87-50 */ static double RandomUniform (void) { double uni; /* Make sure the initialisation routine has been called */ if (!test) RandomInitialise (1802, 9373); uni = u[i97 - 1] - u[j97 - 1]; if (uni <= 0.0) uni++; u[i97 - 1] = uni; i97--; if (i97 == 0) i97 = 97; j97--; if (j97 == 0) j97 = 97; c -= cd; if (c < 0.0) c += cm; uni -= c; if (uni < 0.0) uni++; return (uni); } /* RandomUniform */ #ifdef unused /* ALGORITHM 712, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 18, NO. 4, DECEMBER, 1992, PP. 434-435. The function returns a normally distributed pseudo-random number with a given mean and standard devaiation. Calls are made to a function subprogram which must return independent random numbers uniform in the interval (0,1). The algorithm uses the ratio of uniforms method of A.J. Kinderman and J.F. Monahan augmented with quadratic bounding curves. */ static double RandomGaussian (double mean, double stddev) { double q, u, v, x, y; /* Generate P = (u,v) uniform in rect. enclosing acceptance region Make sure that any random numbers <= 0 are rejected, since gaussian() requires uniforms > 0, but RandomUniform() delivers >= 0. */ do { u = RandomUniform (); v = RandomUniform (); if (u <= 0.0 || v <= 0.0) { u = 1.0; v = 1.0; } v = 1.7156 * (v - 0.5); /* Evaluate the quadratic form */ x = u - 0.449871; y = fabs (v) + 0.386595; q = x * x + y * (0.19600 * y - 0.25472 * x); /* Accept P if inside inner ellipse */ if (q < 0.27597) break; /* Reject P if outside outer ellipse, or outside acceptance region */ } while ((q > 0.27846) || (v * v > -4.0 * log (u) * u * u)); /* Return ratio of P's coordinates as the normal deviate */ return (mean + stddev * v / u); } /* RandomGaussian */ #endif /* Return random integer within a range, lower -> upper INCLUSIVE */ static int RandomInt (int lower, int upper) { return ((int)(RandomUniform () * (upper - lower + 1)) + lower); } /* RandomInt */ #ifdef unused /* Return random float within a range, lower -> upper */ static double RandomDouble (double lower, double upper) { return ((upper - lower) * RandomUniform () + lower); } /* RandomDouble */ #endif /* * seeds both random number generators */ void SeedRandom (unsigned seed) { int i; gRand = oRand = seed; RandomInitialise (seed % 31328, (seed / 313) % 30081); for (i = 0; i < 100; i++) { GameRandomNumber (100); } } /* SeedRandom */ /* * get the seed of the random number generator */ unsigned GetRandomSeed (void) { return gRand; } /* GetRandomSeed */ /* * creates a 32 Bit pseudo random number */ static unsigned GameRandom (void) { gRand = 1664525L * gRand + 1013904223L; return gRand; } /* GameRandom */ /* * creates a 32 Bit pseudo random number */ /* static unsigned OtherRandom (void) { oRand = 1664525L * oRand + 1013904223L; return oRand; } */ /* MyRandom */ /* * creates an integer random number between 0 and maxVal-1; */ int GameRandomNumber1 (int maxVal) { /* return (int)(GameRandom () % maxVal); */ /* fprintf(stderr,"new gamerandom\n"); */ return RandomInt (0, maxVal - 1); } /* RandomNumber */ /* * creates an integer random number between 0 and maxVal-1; */ int GameRandomNumber2 (int maxVal, const char *file, int line) { int result = (int)(GameRandom () % maxVal); fprintf (stderr, "%s:%d: GameRandomNumber() = %d/%d (%u)\n", file, line, result, maxVal, gRand); return result; } /* RandomNumber */ /* * creates an integer random number between 0 and maxVal-1; */ int OtherRandomNumber (int maxVal) { /* return (int) (OtherRandom () % maxVal); */ /* printf("new otherrandom\n"); */ return RandomInt (0, maxVal - 1); } /* RandomNumber */ /* * end of file random.c */ xblast-2.10.4/random.h0000644000175000017500000000260410372705221013642 0ustar rhondaalfie/* * file random.h - generator * * $Id: random.h,v 1.4 2006/02/09 18:31:45 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _RANDOM_H #define _RANDOM_H /* * global macros */ /* needed for debugging */ #ifdef DEBUG_RANDOM #define GameRandomNumber(a) GameRandomNumber2(a, __FILE__, __LINE__) #else #define GameRandomNumber(a) GameRandomNumber1(a) #endif /* * global prototypes */ extern int GameRandomNumber1 (int maxVal); extern int GameRandomNumber2 (int maxVal, const char *file, int line); extern void SeedRandom (unsigned seed); extern unsigned GetRandomSeed (void); extern int OtherRandomNumber (int maxVal); #endif /* * end of file random.h */ xblast-2.10.4/randomlib.c0000644000175000017500000001320110372705221014317 0ustar rhondaalfie#define FALSE 0 #define TRUE 1 /* This Random Number Generator is based on the algorithm in a FORTRAN version published by George Marsaglia and Arif Zaman, Florida State University; ref.: see original comments below. At the fhw (Fachhochschule Wiesbaden, W.Germany), Dept. of Computer Science, we have written sources in further languages (C, Modula-2 Turbo-Pascal(3.0, 5.0), Basic and Ada) to get exactly the same test results compared with the original FORTRAN version. April 1989 Karl-L. Noell and Helmut Weber This random number generator originally appeared in "Toward a Universal Random Number Generator" by George Marsaglia and Arif Zaman. Florida State University Report: FSU-SCRI-87-50 (1987) It was later modified by F. James and published in "A Review of Pseudo- random Number Generators" THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE. (However, a newly discovered technique can yield a period of 10^600. But that is still in the development stage.) It passes ALL of the tests for random number generators and has a period of 2^144, is completely portable (gives bit identical results on all machines with at least 24-bit mantissas in the floating point representation). The algorithm is a combination of a Fibonacci sequence (with lags of 97 and 33, and operation "subtraction plus one, modulo one") and an "arithmetic sequence" (using subtraction). Use IJ = 1802 & KL = 9373 to test the random number generator. The subroutine RANMAR should be used to generate 20000 random numbers. Then display the next six random numbers generated multiplied by 4096*4096 If the random number generator is working properly, the random numbers should be: 6533892.0 14220222.0 7275067.0 6172232.0 8354498.0 10633180.0 */ /* Globals */ double u[97], c, cd, cm; int i97, j97; int test = FALSE; /* This is the initialization routine for the random number generator. NOTE: The seed variables can have values between: 0 <= IJ <= 31328 0 <= KL <= 30081 The random number sequences created by these two seeds are of sufficient length to complete an entire calculation with. For example, if sveral different groups are working on different parts of the same calculation, each group could be assigned its own IJ seed. This would leave each group with 30000 choices for the second seed. That is to say, this random number generator can create 900 million different subsequences -- with each subsequence having a length of approximately 10^30. */ void RandomInitialise (int ij, int kl) { double s, t; int ii, i, j, k, l, jj, m; /* Handle the seed range errors First random number seed must be between 0 and 31328 Second seed must have a value between 0 and 30081 */ if (ij < 0 || ij > 31328) { ij = 1802; } if (kl < 0 || kl > 30081) { kl = 9373; } i = (ij / 177) % 177 + 2; j = (ij % 177) + 2; k = (kl / 169) % 178 + 1; l = (kl % 169); for (ii = 0; ii < 97; ii++) { s = 0.0; t = 0.5; for (jj = 0; jj < 24; jj++) { m = (((i * j) % 179) * k) % 179; i = j; j = k; k = m; l = (53 * l + 1) % 169; if (((l * m % 64)) >= 32) s += t; t *= 0.5; } u[ii] = s; } c = 362436.0 / 16777216.0; cd = 7654321.0 / 16777216.0; cm = 16777213.0 / 16777216.0; i97 = 97; j97 = 33; test = TRUE; } /* This is the random number generator proposed by George Marsaglia in Florida State University Report: FSU-SCRI-87-50 */ double RandomUniform (void) { double uni; /* Make sure the initialisation routine has been called */ if (!test) RandomInitialise (1802, 9373); uni = u[i97 - 1] - u[j97 - 1]; if (uni <= 0.0) uni++; u[i97 - 1] = uni; i97--; if (i97 == 0) i97 = 97; j97--; if (j97 == 0) j97 = 97; c -= cd; if (c < 0.0) c += cm; uni -= c; if (uni < 0.0) uni++; return (uni); } /* ALGORITHM 712, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 18, NO. 4, DECEMBER, 1992, PP. 434-435. The function returns a normally distributed pseudo-random number with a given mean and standard devaiation. Calls are made to a function subprogram which must return independent random numbers uniform in the interval (0,1). The algorithm uses the ratio of uniforms method of A.J. Kinderman and J.F. Monahan augmented with quadratic bounding curves. */ double RandomGaussian (double mean, double stddev) { double q, u, v, x, y; /* Generate P = (u,v) uniform in rect. enclosing acceptance region Make sure that any random numbers <= 0 are rejected, since gaussian() requires uniforms > 0, but RandomUniform() delivers >= 0. */ do { u = RandomUniform (); v = RandomUniform (); if (u <= 0.0 || v <= 0.0) { u = 1.0; v = 1.0; } v = 1.7156 * (v - 0.5); /* Evaluate the quadratic form */ x = u - 0.449871; y = fabs (v) + 0.386595; q = x * x + y * (0.19600 * y - 0.25472 * x); /* Accept P if inside inner ellipse */ if (q < 0.27597) break; /* Reject P if outside outer ellipse, or outside acceptance region */ } while ((q > 0.27846) || (v * v > -4.0 * log (u) * u * u)); /* Return ratio of P's coordinates as the normal deviate */ return (mean + stddev * v / u); } /* Return random integer within a range, lower -> upper INCLUSIVE */ int RandomInt (int lower, int upper) { return ((int)(RandomUniform () * (upper - lower + 1)) + lower); } /* Return random float within a range, lower -> upper */ double RandomDouble (double lower, double upper) { return ((upper - lower) * RandomUniform () + lower); } xblast-2.10.4/randomlib.h0000644000175000017500000000024710372705221014332 0ustar rhondaalfievoid RandomInitialise (int, int); double RandomUniform (void); double RandomGaussian (double, double); int RandomInt (int, int); double RandomDouble (double, double); xblast-2.10.4/rating.h0000644000175000017500000000163310051114303013634 0ustar rhondaalfie/* * file rating.h - rating system * * $Id: rating.h,v 1.3 2004/05/14 10:00:35 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Author: Koen De Raedt (k.de.raedt@wing.rug.nl) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ xblast-2.10.4/scramble.c0000644000175000017500000001023710412220337014141 0ustar rhondaalfie/* * file scramble.c - scrambling blocks * * $Id: scramble.c,v 1.9 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define SCRAMBLE_RAISE 4 /* * local types */ /* * local variables - retrieved from level config */ XBScrambleData scrambleDraw; XBScrambleData scrambleDel; int getScrambleTimes (int p_time) { static int i; if (p_time < 0) { i = 0; } switch (i++) { case 0: return -scrambleDel.time; // first delete in case they are on the same time case 1: return scrambleDraw.time; default: return 0; } } /* * set scramble data */ static XBBool SetScrambleData (XBScrambleData * scramble, const DBSection * section, DBSection * warn) { double fTime; int i, numBlocks; BMPosition pos; assert (scramble != NULL); /* set default values */ scramble->time = GAME_TIME + SCRAMBLE_RAISE + 1; memset (scramble->row, 0, sizeof (scramble->row)); /* check if any scramble is defined */ if (NULL == section) { return XBTrue; } /* time for scramble */ if (!DB_GetEntryFloat (section, atomTime, &fTime)) { return XBTrue; } scramble->time = fTime * GAME_TIME; /* number of blocks */ if (!DB_GetEntryInt (section, atomNumBlocks, &numBlocks)) { Dbg_Out ("LEVEL: critical failure, %s\n", DB_SectionEntryString (section, atomNumBlocks)); DB_CreateEntryString (warn, atomNumBlocks, "missing!"); return XBFalse; } for (i = 0; i < numBlocks; i++) { if (!DB_GetEntryPos (section, atomArrayPos000[i], &pos)) { Dbg_Out ("LEVEL: critical failure, %s\n", DB_SectionEntryString (section, atomArrayPos000[i])); DB_CreateEntryString (warn, atomArrayPos000[i], "missing!"); return XBFalse; } if (pos.x < 0 || pos.x >= MAZE_W || pos.y < 0 || pos.y >= MAZE_H) { Dbg_Out ("+++LEVEL+++ invalid block pos x=%hd y=%hd\n", pos.x, pos.y); return XBFalse; } scramble->row[pos.y] |= (1 << pos.x); } return XBTrue; } /* SetScrambleData */ XBScrambleData * GetScrDel (void) { return &scrambleDel; } XBScrambleData * GetScrDraw (void) { return &scrambleDraw; } /* * parse level data */ XBBool ParseLevelScramble (const DBSection * sectionDraw, const DBSection * sectionDel, DBSection * warn1, DBSection * warn2) { if (!SetScrambleData (&scrambleDraw, sectionDraw, warn1)) { return XBFalse; } if (!SetScrambleData (&scrambleDel, sectionDel, warn2)) { return XBFalse; } return XBTrue; } /* ParseLevelScramble */ /* * work a single scramble pattern */ static void DoSingleScramble (const XBScrambleData * scramble, BMMapTile block) { int x, y; unsigned mask; assert (NULL != scramble); /* --- */ for (y = 0; y < MAZE_H; y++) { if (0 != scramble->row[y]) { for (x = 0, mask = 1; x < MAZE_W; x++, mask <<= 1) { if (mask & scramble->row[y]) { SetMazeBlock (x, y, block); if (block != BTFree) { KillPlayerAt (x, y); } if (block == BTBlockRise) { SND_Play (SND_SPIRAL, x); } } } } } } /* DoSingleScramble */ /* * ingame polling function */ void DoScramble (int gameTime) { /* check for raising blocks */ if (gameTime == (scrambleDraw.time - 4)) { DoSingleScramble (&scrambleDraw, BTBlockRise); /* check for drawing blocks */ } else if (gameTime == scrambleDraw.time) { DoSingleScramble (&scrambleDraw, BTBlock); } /* check for deleting blocks */ if (gameTime == scrambleDel.time) { DoSingleScramble (&scrambleDel, BTFree); } } /* DoScramble */ /* * end of scramble.c */ xblast-2.10.4/scramble.h0000644000175000017500000000270410373126075014160 0ustar rhondaalfie/* * file scramble.h - scrambling blocks * * $Id: scramble.h,v 1.8 2006/02/10 15:07:41 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SCRAMBLE_H #define __SCRAMBLE_H /* * global prototypes */ extern XBBool ParseLevelScramble (const DBSection * sectionDraw, const DBSection * sectionDel, DBSection * warn1, DBSection * warn2); extern void DoScramble (int gameTime); extern int getScrambleTimes (int p_time); // XBCC /* Scramble Structure */ typedef struct { int time; unsigned row[MAZE_H]; } XBScrambleData; extern XBScrambleData scrambleDraw; extern XBScrambleData scrambleDel; extern XBScrambleData *GetScrDel (void); extern XBScrambleData *GetScrDraw (void); #endif /* * end of file scramble.h */ xblast-2.10.4/sdl_atom.c0000644000175000017500000000652010377676650014202 0ustar rhondaalfie/* * x11_atom.h - atoms (aka XrmQuark) for faster database handling * * $Id: sdl_atom.c,v 1.7 2006/02/24 21:42:00 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" #define MAX_ATOMS 5000 typedef struct { XBAtom atom; const char *name; } AtomsTableStr; static AtomsTableStr atomsTable[MAX_ATOMS]; static int atomsCount; static int AtomsTableCompare (const void *a, const void *b) { /* printf("comparing %s with %s\n", ((AtomsTableStr *)a)->name, ((AtomsTableStr *)b)->name); */ return strcmp (((const AtomsTableStr *) a)->name, ((const AtomsTableStr *) b)->name); } /* * Initialize Atoms */ XBBool GUI_InitAtoms (void) { /* atomsTable = calloc( MAX_ATOMS, sizeof(AtomsTableStr *) ); */ /* if(atomsTable == NULL) { */ /* return XBFalse; */ /* } */ atomsCount = 0; return XBTrue; } /* InitAtoms */ /* * conversion string to atom */ XBAtom GUI_StringToAtom (const char *string) { AtomsTableStr key; XBAtom atom; AtomsTableStr **atom_ptr; assert (NULL != string); key.name = string; /* printf("bsearch(%s) cnt = %d\n", string, atomsCount); */ atom_ptr = bsearch (&key, atomsTable, atomsCount, sizeof (AtomsTableStr), AtomsTableCompare); if (atom_ptr) { atom = ((AtomsTableStr *) atom_ptr)->atom; } else { /* printf("failed!!!!!!\n"); */ atom = atomsCount + 1; key.atom = atom; atomsTable[atomsCount].atom = atom; atomsTable[atomsCount].name = strdup (string); atomsCount++; qsort (atomsTable, atomsCount, sizeof (AtomsTableStr), AtomsTableCompare); } return atom; } /* GUI_StringToAtom */ /* * formatted string to atom */ XBAtom GUI_FormatToAtom (const char *fmt, ...) { XBAtom atom; char tmp[256]; va_list argList; assert (NULL != fmt); /* formatting */ va_start (argList, fmt); vsprintf (tmp, fmt, argList); va_end (argList); /* conversion */ atom = GUI_StringToAtom (tmp); return atom; } /* GUI_FormatToAtom */ /* * convert int to atom */ XBAtom GUI_IntToAtom (int value) { return GUI_FormatToAtom ("%d", value); } /* GUI_IntToAtom */ /* * conversion atom to string */ const char * GUI_AtomToString (XBAtom atom) { int i; for (i = 0; i < atomsCount; i++) { if (atomsTable[i].atom == atom) { return atomsTable[i].name; } } return NULL; /* return atomsTable[atom]; */ } /* GUI_StringToAtom */ /* * convert atom int or -1 */ int GUI_AtomToInt (XBAtom atom) { const char *s; int value; s = GUI_AtomToString (atom); if (NULL == s) { return -1; } if (1 != sscanf (s, "%d", &value)) { return -1; } return value; } /* GUI_AtomToInt */ /* * end of file x11_atom.c */ xblast-2.10.4/sdl_common.c0000644000175000017500000000211510372731124014505 0ustar rhondaalfie/* * file SDL_common.c - global variables for Win32 engine * * $Id: sdl_common.c,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * global variables */ SDL_Surface *screen = NULL; SDL_Surface *pix = NULL; const char *xblastClass = "XBlast"; /* * end of file SDL_common.c */ xblast-2.10.4/sdl_common.h0000644000175000017500000000330010412221266014503 0ustar rhondaalfie/* * file SDL_common.h - global variables for Win32 engine * * $Id: sdl_common.h,v 1.7 2006/03/28 11:49:10 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_COMMON_H #define XBLAST_SDL_COMMON_H #include #include #include #include #include #include "sdl_event.h" #include "sdl_keysym.h" #include "sdl_joystick.h" #include "sdl_image.h" #include "sdl_config.h" #include "sdl_text.h" #include "sdl_sprite.h" #include "sdl_socket.h" #include "sdl_tile.h" #include "sdl_pixmap.h" #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define RMASK 0x0000FF #define GMASK 0x00FF00 #define BMASK 0xFF0000 #else #define RMASK 0xFF0000 #define GMASK 0x00FF00 #define BMASK 0x0000FF #endif /* * global constants */ #define NUM_FONTS 3 /* * global variables */ extern SDL_Surface *screen; extern SDL_Surface *pix; extern const char *xblastClass; #endif /* * end of file SDL_common.h */ xblast-2.10.4/sdl_config.c0000644000175000017500000001146310372731124014470 0ustar rhondaalfie/* * file x11_config.c - x11 specific configuration * * $Id: sdl_config.c,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_config.h" /* * local variables */ static DBRoot *dbGui = NULL; /* default font config */ static CFGFont defaultFontConfig = { 14, 18, 24 }; /* default colors */ static CFGColor defaultColorConfig = { COLOR_GRAY_75, COLOR_MIDNIGHT_BLUE, COLOR_BLACK, COLOR_MIDNIGHT_BLUE, COLOR_GOLD, COLOR_YELLOW, COLOR_LIGHT_GOLDENROD, COLOR_SADDLE_BROWN, COLOR_SPRING_GREEN, }; static void StoreFontConfig (const CFGFont * cfgFont) { DBSection *section; /* sanity check */ assert (NULL != cfgFont); /* create new section */ #ifdef MINI_XBLAST section = DB_CreateSection (dbGui, atomFontMini); #else section = DB_CreateSection (dbGui, atomFont); #endif assert (section != NULL); /* set values */ DB_CreateEntryInt (section, atomSmall, cfgFont->small); DB_CreateEntryInt (section, atomMedium, cfgFont->medium); DB_CreateEntryInt (section, atomLarge, cfgFont->large); } /* * retrieve font config */ const CFGFont * GetFontConfig (void) { const DBSection *section; static CFGFont cfgFont; memcpy (&cfgFont, &defaultFontConfig, sizeof (CFGFont)); /* get database entrry */ #ifdef MINI_XBLAST section = DB_GetSection (dbGui, atomFontMini); #else section = DB_GetSection (dbGui, atomFont); #endif if (NULL != section) { DB_GetEntryInt (section, atomSmall, &cfgFont.small); DB_GetEntryInt (section, atomMedium, &cfgFont.medium); DB_GetEntryInt (section, atomLarge, &cfgFont.large); } return &cfgFont; } /* GetFontConfig */ /* * store color settings */ static void StoreColorConfig (const CFGColor * cfgColor) { DBSection *section; /* sanity check */ assert (NULL != cfgColor); /* create new section */ section = DB_CreateSection (dbGui, atomColor); assert (section != NULL); /* set values */ DB_CreateEntryColor (section, atomTitleFg, cfgColor->titleFg); DB_CreateEntryColor (section, atomTitleBg, cfgColor->titleBg); DB_CreateEntryColor (section, atomDarkText1, cfgColor->darkText1); DB_CreateEntryColor (section, atomDarkText2, cfgColor->darkText2); DB_CreateEntryColor (section, atomLightText1, cfgColor->lightText1); DB_CreateEntryColor (section, atomLightText2, cfgColor->lightText2); DB_CreateEntryColor (section, atomStatusFg, cfgColor->statusFg); DB_CreateEntryColor (section, atomStatusBg, cfgColor->statusBg); DB_CreateEntryColor (section, atomStatusLed, cfgColor->statusLed); } /* StoreColorConfig */ /* * getgcolor settings */ const CFGColor * GetColorConfig (void) { const DBSection *section; static CFGColor cfgColor; memcpy (&cfgColor, &defaultColorConfig, sizeof (CFGColor)); /* get database entrry */ if (NULL != (section = DB_GetSection (dbGui, GUI_StringToAtom ("color")))) { DB_GetEntryColor (section, atomTitleFg, &cfgColor.titleFg); DB_GetEntryColor (section, atomTitleBg, &cfgColor.titleBg); DB_GetEntryColor (section, atomDarkText1, &cfgColor.darkText1); DB_GetEntryColor (section, atomDarkText2, &cfgColor.darkText2); DB_GetEntryColor (section, atomLightText1, &cfgColor.lightText1); DB_GetEntryColor (section, atomLightText2, &cfgColor.lightText2); DB_GetEntryColor (section, atomStatusFg, &cfgColor.statusFg); DB_GetEntryColor (section, atomStatusBg, &cfgColor.statusBg); DB_GetEntryColor (section, atomStatusLed, &cfgColor.statusLed); } return &cfgColor; } /* GetColorConfig */ /* * load gui database */ void GUI_LoadConfig (void) { dbGui = DB_Create (DT_Config, atomX11); assert (dbGui != NULL); if (DB_Load (dbGui)) { return; } /* set default values */ StoreFontConfig (&defaultFontConfig); StoreColorConfig (&defaultColorConfig); /* and save it */ DB_Store (dbGui); } /* GUI_LoadConfig */ /* * store gui database */ void GUI_SaveConfig (void) { assert (dbGui != NULL); if (!DB_Changed (dbGui)) { DB_Store (dbGui); } } /* GUI_SaveConfig */ /* * finish config */ void GUI_FinishConfig (void) { assert (dbGui != NULL); DB_Delete (dbGui); dbGui = NULL; } /* GUI_FinishConfig */ /* * end of file x11_config.c */ xblast-2.10.4/sdl_config.h0000644000175000017500000000264210373126075014500 0ustar rhondaalfie/* * file sdl_config.h - x11 specific configuration * * $Id: sdl_config.h,v 1.5 2006/02/10 15:07:41 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_CONFIG_H #define XBLAST_SDL_CONFIG_H /* * type defintions */ /* font configuration */ typedef struct { int small; int medium; int large; } CFGFont; /* colors */ typedef struct { XBColor titleFg; XBColor titleBg; XBColor darkText1; XBColor darkText2; XBColor lightText1; XBColor lightText2; XBColor statusFg; XBColor statusBg; XBColor statusLed; } CFGColor; /* * prototypes */ extern const CFGFont *GetFontConfig (void); extern const CFGColor *GetColorConfig (void); #endif /* * end of file sdl_config.h */ xblast-2.10.4/sdl_event.c0000644000175000017500000003644110377700543014355 0ustar rhondaalfie/* * file x11_event.c - event handling * * $Id: sdl_event.c,v 1.11 2006/02/24 21:57:55 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * local constants */ #define BELL_VOLUME 80 /* * local types */ typedef enum { TM_NONE, TM_ONCE, TM_PERIODIC } TimerMode; typedef struct { SDLKey key; XBEventCode code; int value; } GameKeyEvent; typedef struct _game_key_list { GameKeyEvent gke; struct _game_key_list *next; } GameKeyList; typedef struct _poll_func_list { XBPollFunction func; struct _poll_func_list *next; } PollFuncList; /* * local variables */ /* Timeout */ static TimerMode timerMode = TM_NONE; static struct timeval nextTimer; static struct timeval timerIncr; /* polling */ static PollFuncList *pollList = NULL; static struct timeval nextPoll; /* keyboard mode */ static XBKeyboardMode keyboardMode = KB_NONE; /* keyboard lookup tables */ static int numKeyMenu = 0; static int numKeyPress = 0; static int numKeyChat = 0; static int numKeyRelease = 0; static GameKeyEvent *keyMenuTable = NULL; static GameKeyEvent *keyPressTable = NULL; static GameKeyEvent *keyReleaseTable = NULL; static GameKeyEvent *keyChatTable = NULL; static void HandleAsciiKey (SDL_KeyboardEvent * KbEvent); static XBBool HandleChatKey (SDL_KeyboardEvent * KbEvent); /* * Set keyboard mode */ void GUI_SetKeyboardMode (XBKeyboardMode Mode) { keyboardMode = Mode; } /* GUI_SetKeyboardMode */ /* * Set mouse mode */ void GUI_SetMouseMode (XBBool enable) { /* TODO?: Enable or disable mouse events. We probably don't care. */ } /* * Show/Hide cursor */ void GUI_ShowCursor(XBBool enable) { if (enable) { SDL_ShowCursor(SDL_ENABLE); } else { SDL_ShowCursor(SDL_DISABLE); } } /* * Compare to GameKeyCode */ static int CompareKeyCode (const void *a, const void *b) { return (*(const SDLKey *) a) - (*(const SDLKey *) b); } /* CompareKeyCode */ /* * create keyboard lookup table from init table */ static GameKeyEvent * CreateGameKeyTable (const CFGKeyTable * init, int *nelem) { const CFGKeyTable *ptr; GameKeyList *list = NULL; GameKeyList *elem; GameKeyEvent *table = NULL; SDLKey keySym; int i; assert (nelem != NULL); *nelem = 0; /* create list with with all keymappings (part one) */ for (ptr = init; ptr->keysym != NULL; ptr++) { /* convert keysymbol name to keycode */ keySym = StringToVirtualKey (ptr->keysym); if (SDLK_UNKNOWN == keySym) { Dbg_Out ("unknown keysymbol %s.\n", ptr->keysym); continue; } /* create new list element */ elem = calloc (1, sizeof (GameKeyList)); assert (elem != NULL); elem->gke.key = keySym; elem->gke.code = ptr->eventCode; elem->gke.value = ptr->eventData; /* put it into list */ elem->next = list; list = elem; /* increment counter */ *nelem += 1; } /* create lookup table */ table = malloc (*nelem * sizeof (GameKeyEvent)); assert (table != NULL); /* store list in array and delete it */ i = 0; while (list != NULL) { /* store next one */ elem = list->next; /* copy data */ assert (i < *nelem); memcpy (table + i, &list->gke, sizeof (GameKeyEvent)); i++; /* next one */ free (list); list = elem; } /* now sort it with quciksort */ qsort (table, *nelem, sizeof (GameKeyEvent), CompareKeyCode); /* now check for double entries */ for (i = 1; i < *nelem; i++) { if (table[i - 1].key == table[i].key) { // GUI_ErrorMessage ("Multiple bindings for key \"%s\".", XKeysymToString (XKeycodeToKeysym (dpy, table[i].key, 0))); break; } } /* that's all */ return table; } /* CreateGameKeyTable */ /* * reinitialize key tables */ void GUI_UpdateKeyTables (void) { /* game key presses */ if (NULL != keyPressTable) { free (keyPressTable); } keyPressTable = CreateGameKeyTable (GetGameKeyPressTable (), &numKeyPress); assert (keyPressTable != NULL); /* game key releases */ if (NULL != keyReleaseTable) { free (keyReleaseTable); } keyReleaseTable = CreateGameKeyTable (GetGameKeyReleaseTable (), &numKeyRelease); assert (keyReleaseTable != NULL); /* menu keys */ if (NULL != keyMenuTable) { free (keyMenuTable); } keyMenuTable = CreateGameKeyTable (GetMenuKeyTable (), &numKeyMenu); assert (keyMenuTable != NULL); /* chat keys */ if (NULL != keyChatTable) { free (keyChatTable); } keyChatTable = CreateGameKeyTable (GetChatKeyTable (), &numKeyChat); assert (keyChatTable != NULL); } /* GUI_UpdateKeyTables */ /* * Init Event routine */ XBBool InitEvent (void) { /* setup keyboard */ GUI_UpdateKeyTables (); /* register display for socket polling */ // RegisterDisplay (ConnectionNumber (dpy)); /* that's all */ return XBTrue; } /* InitEvent */ /* * finish event handling */ void FinishEvent (void) { /* clean up key tables */ if (NULL != keyMenuTable) { free (keyMenuTable); keyMenuTable = NULL; } if (NULL != keyPressTable) { free (keyPressTable); keyPressTable = NULL; } if (NULL != keyReleaseTable) { free (keyReleaseTable); keyReleaseTable = NULL; } if (NULL != keyChatTable) { free (keyChatTable); keyChatTable = NULL; } } /* FinishEvent */ /* * Set timer for event */ void GUI_SetTimer (long msec, XBBool periodic) { if (0 == msec) { timerMode = TM_NONE; } else { /* get current time */ gettimeofday (&nextTimer, NULL); /* set next timeout */ timerIncr.tv_sec = msec / 1000; timerIncr.tv_usec = 1000 * (msec % 1000); /* --- */ nextTimer.tv_sec += timerIncr.tv_sec; nextTimer.tv_usec += timerIncr.tv_usec; if (nextTimer.tv_usec > 1000000L) { nextTimer.tv_usec -= 1000000L; nextTimer.tv_sec++; } /* periodic ? */ if (!periodic) { timerMode = TM_ONCE; } else { timerMode = TM_PERIODIC; } } } /* * */ static int CheckTimer (struct timeval *a, struct timeval *b) { if (a->tv_sec < b->tv_sec) { return XBTrue; } if (a->tv_sec > b->tv_sec) { return XBFalse; } return (a->tv_usec < b->tv_usec); } /* CheckTimer */ /* * Calc difference between timvals */ static void DeltaTimer (struct timeval *delta, struct timeval *a, struct timeval *b) { delta->tv_sec = a->tv_sec - b->tv_sec; delta->tv_usec = a->tv_usec - b->tv_usec; if (delta->tv_usec < 0) { delta->tv_usec += 1000000; delta->tv_sec--; } } /* DeltaTimer */ /* * insert poll function */ void GUI_AddPollFunction (XBPollFunction func) { PollFuncList *ptr; /* set timeout */ if (NULL == pollList) { gettimeofday (&nextPoll, NULL); nextPoll.tv_sec++; } /* create new element */ ptr = calloc (1, sizeof (*ptr)); assert (NULL != ptr); ptr->func = func; ptr->next = pollList; pollList = ptr; } /* GUI_AddPollFunction */ /* * subtract poll function */ void GUI_SubtractPollFunction (XBPollFunction func) { assert (pollList != NULL); if (pollList->func == func) { pollList = pollList->next; } else { PollFuncList *ptr; for (ptr = pollList; ptr->next != NULL; ptr = ptr->next) { if (ptr->next->func == func) { PollFuncList *save = ptr->next; ptr->next = save->next; free (save); } } } } /* GUI_SubtractPollFunction */ static GameKeyEvent * LookupKeyTable (const SDLKey keyCode, const int numKey, const GameKeyEvent * keyTable) { return bsearch (&keyCode, keyTable, numKey, sizeof (GameKeyEvent), CompareKeyCode); } /* * Handle Keyboard-Event by looking up Menu Event */ static void HandleMenuKey (SDL_KeyboardEvent * KbEvent) { SDLKey keyCode; keyCode = KbEvent->keysym.sym; if (!HandleChatKey (KbEvent)) { GameKeyEvent *key; key = LookupKeyTable (keyCode, numKeyMenu, keyMenuTable); if (key) { QueueEventValue (key->code, key->value); } } } /* * Handle Keyboard-Event by looking XBlast Event */ static void HandleXBlastKey (SDL_KeyboardEvent * KbEvent) { GameKeyEvent *key_table; int num_key; SDLKey keyCode; GameKeyEvent *key; /* which table to loopkup */ if (KbEvent->state == SDL_PRESSED) { key_table = keyPressTable; num_key = numKeyPress; if (HandleChatKey (KbEvent)) { return; } } else { key_table = keyReleaseTable; num_key = numKeyRelease; } /* search for key */ keyCode = KbEvent->keysym.sym; key = LookupKeyTable (keyCode, num_key, key_table); if (key) { QueueEventValue (key->code, key->value); } } /* HandleXBlastKey */ /* * handle chat key event */ static XBBool HandleChatKey (SDL_KeyboardEvent * KbEvent) { SDLKey keyCode; GameKeyEvent *key; keyCode = KbEvent->keysym.sym; key = LookupKeyTable (keyCode, numKeyChat, keyChatTable); if (key && Chat_isListening ()) { if ((keyCode == SDLK_BACKSPACE || keyCode == SDLK_ESCAPE || keyCode == SDLK_RETURN) && Chat_GetCurrentCode () == XBE_NONE) { return XBFalse; } QueueEventValue (key->code, key->value + 1000); return XBTrue; } /* if chat input is active, expect character event */ if (Chat_GetCurrentCode () != XBE_NONE) { HandleAsciiKey (KbEvent); return XBTrue; } return XBFalse; } /* * Handle Keyboard-Event by looking up ascii value of key */ static void HandleAsciiKey (SDL_KeyboardEvent * KbEvent) { SDLKey keyCode; keyCode = KbEvent->keysym.sym; if (isprint (keyCode)) { /* printable character */ QueueEventValue (XBE_ASCII, keyCode); } else { /* control key */ switch (keyCode) { case SDLK_BACKSPACE: QueueEventValue (XBE_CTRL, XBCK_BACKSPACE); break; case SDLK_ESCAPE: QueueEventValue (XBE_CTRL, XBCK_ESCAPE); break; case SDLK_RETURN: QueueEventValue (XBE_CTRL, XBCK_RETURN); break; default: break; } } } /* * Handle Keyboard-Event by looking up keysymbol name */ static void HandleKeysymKey (SDL_KeyboardEvent * KbEvent) { SDLKey keyCode; keyCode = KbEvent->keysym.sym; if (keyCode == SDLK_ESCAPE) { QueueEventAtom (XBE_KEYSYM, ATOM_INVALID); } else { XBAtom atom = VirtualKeyToAtom (keyCode); if (ATOM_INVALID != atom) { QueueEventAtom (XBE_KEYSYM, atom); } } } /* * Handle SDL Events */ static void HandleSDLEvent (SDL_Event * event) { switch (event->type) { case SDL_KEYDOWN: switch (keyboardMode) { case KB_CHAT: (void)HandleChatKey (&event->key); break; case KB_MENU: HandleMenuKey (&event->key); break; case KB_XBLAST: HandleXBlastKey (&event->key); break; case KB_ASCII: HandleAsciiKey (&event->key); break; case KB_KEYSYM: HandleKeysymKey (&event->key); break; default: break; } break; case SDL_KEYUP: switch (keyboardMode) { case KB_XBLAST: HandleXBlastKey (&event->key); break; default: break; } break; case SDL_MOUSEMOTION: QueueEventPos (XBE_MOUSE_MOVE, event->motion.x / BASE_X, event->motion.y / BASE_Y); break; case SDL_MOUSEBUTTONUP: break; case SDL_MOUSEBUTTONDOWN: switch (event->button.button) { case SDL_BUTTON_LEFT: QueueEventPos (XBE_MOUSE_1, event->button.x / BASE_X, event->button.y / BASE_Y); break; case SDL_BUTTON_RIGHT: QueueEventPos (XBE_MOUSE_2, event->button.x / BASE_X, event->button.y / BASE_Y); break; case SDL_BUTTON_MIDDLE: QueueEventPos (XBE_MOUSE_3, event->button.x / BASE_X, event->button.y / BASE_Y); break; default: break; } break; case SDL_JOYAXISMOTION: case SDL_JOYBALLMOTION: case SDL_JOYHATMOTION: case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: if (keyboardMode == KB_MENU) HandleMenuJoystick (event); else HandleXBlastJoystick (event); break; case SDL_QUIT: exit (1); default: GUI_FlushPixmap (XBFalse); break; }; } /* * check application and poll timer */ static struct timeval * HandleTimeout (XBBool peek) { struct timeval now; struct timeval *timeout; static struct timeval dTimer; static struct timeval dPoll; static struct timeval dPeek; /* application timer */ if (timerMode == TM_NONE) { timeout = NULL; } else { gettimeofday (&now, NULL); if (CheckTimer (&nextTimer, &now)) { /* timer has triggered */ if (timerMode == TM_ONCE) { /* this timer will only fire once */ timerMode = TM_NONE; } else { /* set new timer value */ nextTimer.tv_sec += timerIncr.tv_sec; nextTimer.tv_usec += timerIncr.tv_usec; if (nextTimer.tv_usec > 1000000L) { nextTimer.tv_usec -= 1000000L; nextTimer.tv_sec++; } } /* create new timer event */ QueueEventVoid (XBE_TIMER); dTimer.tv_sec = 0; dTimer.tv_usec = 0; timeout = &dTimer; } else { /* no timeout yet , calc time to timeout */ DeltaTimer (&dTimer, &nextTimer, &now); /* link to timeout */ timeout = &dTimer; } } /* polling (once per second) */ if (pollList != NULL) { gettimeofday (&now, NULL); if (CheckTimer (&nextPoll, &now)) { PollFuncList *poll; for (poll = pollList; poll != NULL; poll = poll->next) { (*poll->func) (&now); } nextPoll.tv_sec = now.tv_sec + 1; nextPoll.tv_usec = now.tv_usec; #ifdef DEBUG_EVENT Dbg_Out ("poll\n"); #endif } /* calc time for next polling */ DeltaTimer (&dPoll, &nextPoll, &now); if (NULL == timeout || CheckTimer (&dPoll, timeout)) { timeout = &dPoll; } } /* only peeking */ if (peek) { dPeek.tv_sec = 0; dPeek.tv_usec = 0; timeout = &dPeek; } return timeout; } /* CheckTimer */ /* * xblast main event routine */ XBEventCode GUI_WaitEvent (XBEventData * data) { XBEventCode ecode; SDL_Event event; /* Event structure */ // XEvent xev; struct timeval *timeout; /* only if there are no events in our xblast event queue */ while (XBE_NONE == (ecode = NextEvent (data))) { /* wird sind schon Timeout */ timeout = HandleTimeout (XBFalse); /* are their any X11-Events in the Queue */ SelectSockets (timeout); /* Check for events */ /* Loop until there are no events left on the queue */ while (SDL_PollEvent (&event)) { HandleSDLEvent (&event); } } /* we have an event, return it */ return ecode; } /* WaitEvent */ /* * xblast main event routine */ XBEventCode GUI_PeekEvent (XBEventData * data) { XBEventCode ecode; SDL_Event event; /* Event structure */ struct timeval *timeout; /* only if there are no events in our xblast event queue */ if (XBE_NONE != (ecode = NextEvent (data))) { return ecode; } /* wird sind schon Timeout */ timeout = HandleTimeout (XBTrue); /* are their any X11-Events in the Queue */ SelectSockets (timeout); /* Check for events */ /* Loop until there are no events left on the queue */ while (SDL_PollEvent (&event)) { HandleSDLEvent (&event); } return NextEvent (data); } /* WaitEvent */ /* * */ void GUI_Sync (void) { //That was easy. } /* GUI_Sync */ /* * */ void GUI_Bell (void) { #ifdef WIN32 // #include "windows.h" MessageBeep (0); #else fputc ('\a', stderr); fflush (stderr); #endif } /* GUI_Bell */ /* * send event */ void GUI_SendEventValue (XBEventCode code, int value) { QueueEventValue (code, value); } /* GUI_SendEventValue */ /* * end of file x11_event.c */ xblast-2.10.4/sdl_event.h0000644000175000017500000000200610377702537014355 0ustar rhondaalfie/* * file sdl_event.h - * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * July 15, 1999 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: sdl_event.h,v 1.4 2006/02/24 22:14:55 fzago Exp $ */ #ifndef XBLAST_SDL_EVENT_H #define XBLAST_SDL_EVENT_H /* * prototypes */ extern XBBool InitEvent (void); extern void FinishEvent (void); #endif xblast-2.10.4/sdl_image.c0000644000175000017500000002140010412221162014264 0ustar rhondaalfie/* * file SDL_image.c - image conversion (rgb to pixel) * * $Id: sdl_image.c,v 1.10 2006/03/28 11:48:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * library function: InitImages * description: initializes data structure neede for image conversion * parameters: none * return value: 0 on success, -1 on failure */ XBBool InitImages (void) { // Nothing to do! return XBTrue; } /* InitImages */ /* * */ void FinishImages (void) { // Nothing to do! } /* FinishImages */ /* * library function: CatPathAndFilename * description: Concatenate path and filename in single string. * parameters: path - relative path for image * filename - name of image file * return value: Absolute filename. */ static char * CatPathAndFilename (const char *path, const char *filename) { char *absPath; size_t pathLength, filenameLength; /* Check if last character is a path separator "/" */ pathLength = strlen (path); filenameLength = strlen (filename); /* 1 seperator "/" char + 1 string terminating NULL = 2 */ absPath = (char *)calloc (pathLength + filenameLength + 2, sizeof (char)); if (!absPath) { fprintf (stderr, "Could not allocate memory in CatPathAndFile(%s, %s)\n", path, filename); return NULL; }; strcat (absPath, path); strcat (absPath, "/"); strcat (absPath, filename); return absPath; }; /* * library function: AddExtension * description: Add specified extension to filename. * parameters: - Filename (without extension) * - Extension (duh!) * return value: Filename + Extension. */ static char * AddExtension (const char *Filename, const char *Extension) { char *result; size_t FilenameLength, ExtensionLength; /* Check if last character is a path separator "/" */ FilenameLength = strlen (Filename); ExtensionLength = strlen (Extension); /* 1 "." char + 1 string terminating NULL = 2 */ result = calloc (FilenameLength + ExtensionLength + 2, sizeof (char)); if (!result) { fprintf (stderr, "Could not allocate memory in AddExtension(%s, %s)\n", Filename, Extension); return NULL; }; strcat (result, Filename); strcat (result, "."); strcat (result, Extension); return result; }; /* * local function: BitmapFromRGBPixel * description: creates bitmap from pixel data in 24 bit RGB format * parameters: data - 24 bit pixel data (b,g,r!) * width - width of bitmap * height - height of bitmap * return value: handle of bitmap, or NULL on failure */ static SDL_Surface * BitmapFromRGBPixel (unsigned char *data, int width, int height) { SDL_Surface *temp; SDL_Surface *bitmap; unsigned char *pixels; int i; // Create new empty surface with correct dimensions temp = SDL_CreateRGBSurface (screen->flags, width, height, 24, RMASK, GMASK, BMASK, 0); // Copy all pixels from data to surface. SDL_LockSurface (temp); pixels = (unsigned char *)temp->pixels; for (i = 0; i < (3 * width * height); i++) { *(pixels + i) = *(data + i); }; SDL_UnlockSurface (temp); bitmap = SDL_DisplayFormat (temp); SDL_FreeSurface (temp); return bitmap; } /* BitmapFromRGBPixel */ /* * library function: ReadPbmBitmap * description: create a bitmap from a given pbm-file * parameters: path - relative path for image * filename - name of image file * return value: handle of bitmap, or NULL on failure */ SDL_Surface * ReadPbmBitmap (const char *path, const char *filename) { SDL_Surface *temp, *bitmap; char *tempAbsFilename, *absFilename; tempAbsFilename = CatPathAndFilename (path, filename); absFilename = AddExtension (tempAbsFilename, "pbm"); temp = IMG_Load (absFilename); if (!temp) { fprintf (stderr, "Could not create bitmap (%s)\n", SDL_GetError ()); return NULL; }; bitmap = SDL_DisplayFormat (temp); free (tempAbsFilename); free (absFilename); SDL_FreeSurface (temp); return bitmap; } /* ReadPbmBitmap */ /* * library function: ReadRgbPixmap * description: create a bitmap from a ppm file (using rgb values) * parameters: path - relative path for image * filename - name of image file * return value: handle of bitmap, or NULL on failure */ SDL_Surface * ReadRgbPixmap (const char *path, const char *filename) { SDL_Surface *temp, *bitmap; char *tempAbsFilename, *absFilename; tempAbsFilename = CatPathAndFilename (path, filename); absFilename = AddExtension (tempAbsFilename, "ppm"); temp = IMG_Load (absFilename); if (!temp) { fprintf (stderr, "Could not create bitmap (%s)\n", SDL_GetError ()); return NULL; }; bitmap = SDL_DisplayFormat (temp); assert (bitmap); free (tempAbsFilename); free (absFilename); SDL_FreeSurface (temp); return bitmap; } /* ReadRgbPixmap */ /* * library function: ReadCchPixmap * description: create a bitmap from a ppm file (using red as bg, green as add * and white as highlight) * parameters: path - relative path for image * filename - name of image file * fg - base color (black most of the time) * bg - first color (for red pixels) * add - seconed color (for green pixels) * return value: handle of bitmap, or NULL on failure */ SDL_Surface * ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add) { int width; int height; unsigned char *ppm; SDL_Surface *bitmap; /* load ppm file */ if (NULL == (ppm = ReadPpmFile (path, filename, &width, &height))) { fprintf (stderr, "ReadPpmFile(%s, %d) failed\n", path, width); return NULL; } /* convert color */ CchToPpm (ppm, width, height, fg, bg, add); /* now create bitmap */ bitmap = BitmapFromRGBPixel (ppm, width, height); if (!bitmap) { fprintf (stderr, "Could not create bitmap (%s)\n", SDL_GetError ()); return NULL; }; free (ppm); return bitmap; } /* ReadCchPixmap */ /** * library function: ReadEpmPixmap * description: create a bitmap from a ppm file (using red as bg, green as add * and white as highlight) * parameters: path - relative path for image * filename - name of image file * n_colors - number of color layers * color - arrays with colors foreach layer * return value: handle of bitmap, or NULL on failure */ SDL_Surface * ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color) { int width; int height; int depth; unsigned char *epm; unsigned char *ppm; SDL_Surface *bitmap, *mask; char *tempAbsFilename, *absFilename; /* assert (NULL != color); */ assert (NULL != path); assert (NULL != filename); /* load ppm file */ if (NULL == (epm = ReadEpmFile (path, filename, &width, &height, &depth))) { fprintf (stderr, "ReadEpmFile(%s, %s) failed.\n", path, filename); return NULL; } /* check depth */ if (depth < n_colors) { n_colors = depth; } /* create ppm array */ ppm = malloc (width * height * 3); assert (ppm != NULL); /* convert color */ EpmToPpm (epm, ppm, width, height, n_colors, color); bitmap = BitmapFromRGBPixel (ppm, width, height); tempAbsFilename = CatPathAndFilename (path, filename); absFilename = AddExtension (tempAbsFilename, "pbm"); mask = IMG_Load (absFilename); /* Some epm files dont have a companion mask file */ if (NULL != mask) { SDL_SetColorKey (mask, SDL_SRCCOLORKEY, 1); SDL_BlitSurface (mask, NULL, bitmap, NULL); } SDL_SetColorKey (bitmap, SDL_SRCCOLORKEY, SDL_MapRGB (bitmap->format, 0xFF, 0xFF, 0xFF)); free (tempAbsFilename); free (absFilename); free (epm); free (ppm); if (NULL != mask) { SDL_FreeSurface (mask); } if (!bitmap) { fprintf (stderr, "Could not create bitmap (%s)\n", SDL_GetError ()); return NULL; }; return bitmap; } /* ReadEpmPixmap */ /* * convert colorname to value (not supported for win32) */ XBColor GUI_ParseColor (const char *name) { return COLOR_INVALID; } /* GUI_ParseColor */ /* * end of file SDL_image.c */ xblast-2.10.4/sdl_image.h0000644000175000017500000000256210372731124014312 0ustar rhondaalfie/* * file SDL_image.h - * * $Id: sdl_image.h,v 1.6 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_IMAGE_H #define XBLAST_SDL_IMAGE_H extern XBBool InitImages (void); extern void FinishImages (void); extern SDL_Surface *ReadPbmBitmap (const char *path, const char *filename); extern SDL_Surface *ReadRgbPixmap (const char *path, const char *filename); extern SDL_Surface *ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add); extern SDL_Surface *ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color); #endif xblast-2.10.4/sdl_init.c0000644000175000017500000002147010426434671014174 0ustar rhondaalfie /* Test out the window manager interaction functions */ #include "xblast.h" #include "sdl_common.h" #include "sdl_image.h" #include "sdl_keysym.h" #include "sdl_event.h" #include "sdl_pixmap.h" #include "sdl_sprite.h" #include "sdl_text.h" #include "sdl_tile.h" static Uint8 video_bpp; static Uint32 video_flags = 0; #ifdef unused static SDL_Surface * LoadIconSurface (char *file, Uint8 ** maskp) { SDL_Surface *icon; Uint8 *pixels; Uint8 *mask; int mlen, i, j; *maskp = NULL; /* Load the icon surface */ icon = SDL_LoadBMP (file); if (icon == NULL) { fprintf (stderr, "Couldn't load %s: %s\n", file, SDL_GetError ()); return (NULL); } /* Check width and height if ( (icon->w%8) != 0 ) { fprintf(stderr, "Icon width must be a multiple of 8!\n"); SDL_FreeSurface(icon); return(NULL); } */ if (icon->format->palette == NULL) { fprintf (stderr, "Icon must have a palette!\n"); SDL_FreeSurface (icon); return (NULL); } /* Set the colorkey */ SDL_SetColorKey (icon, SDL_SRCCOLORKEY, *((Uint8 *) icon->pixels)); /* Create the mask */ pixels = (Uint8 *) icon->pixels; Dbg_Out ("Transparent pixel: (%d,%d,%d)\n", icon->format->palette->colors[*pixels].r, icon->format->palette->colors[*pixels].g, icon->format->palette->colors[*pixels].b); mlen = (icon->w * icon->h + 7) / 8; mask = (Uint8 *) malloc (mlen); if (mask == NULL) { fprintf (stderr, "Out of memory!\n"); SDL_FreeSurface (icon); return (NULL); } memset (mask, 0, mlen); for (i = 0; i < icon->h; i++) for (j = 0; j < icon->w; j++) { int pindex = i * icon->pitch + j; int mindex = i * icon->w + j; if (pixels[pindex] != *pixels) mask[mindex >> 3] |= 1 << (7 - (mindex & 7)); } *maskp = mask; return (icon); } #endif void SetupVideo (CFGVideoSetup * video) { SDL_Surface *surface; surface = SDL_GetVideoSurface (); if (((surface->flags & SDL_FULLSCREEN) && video->mode == XBVM_Windowed) || ((surface->flags & SDL_FULLSCREEN) == 0 && video->mode == XBVM_Full)) SDL_WM_ToggleFullScreen (screen); } static void HotKey_ToggleFullScreen (void) { SDL_Surface *screen; screen = SDL_GetVideoSurface (); if (SDL_WM_ToggleFullScreen (screen)) { Dbg_Out ("Toggled fullscreen mode - now %s\n", (screen->flags & SDL_FULLSCREEN) ? "fullscreen" : "windowed"); } else { Dbg_Out ("Unable to toggle fullscreen mode\n"); } } static void HotKey_ToggleGrab (void) { SDL_GrabMode mode; Dbg_Out ("Ctrl-G: toggling input grab!\n"); mode = SDL_WM_GrabInput (SDL_GRAB_QUERY); if (mode == SDL_GRAB_ON) { Dbg_Out ("Grab was on\n"); } else { Dbg_Out ("Grab was off\n"); } mode = SDL_WM_GrabInput (mode ? SDL_GRAB_OFF : SDL_GRAB_ON); if (mode == SDL_GRAB_ON) { Dbg_Out ("Grab is now on\n"); } else { Dbg_Out ("Grab is now off\n"); } } static void HotKey_Iconify (void) { Dbg_Out ("Ctrl-Z: iconifying window!\n"); SDL_WM_IconifyWindow (); } static void HotKey_Quit (void) { SDL_Event event; Dbg_Out ("Posting internal quit request\n"); event.type = SDL_USEREVENT; SDL_PushEvent (&event); } static int FilterEvents (const SDL_Event * event) { switch (event->type) { case SDL_ACTIVEEVENT: /* See what happened */ Dbg_Out ("App %s ", event->active.gain ? "gained" : "lost"); if (event->active.state & SDL_APPACTIVE) Dbg_Out ("active "); if (event->active.state & SDL_APPMOUSEFOCUS) Dbg_Out ("mouse "); if (event->active.state & SDL_APPINPUTFOCUS) Dbg_Out ("input "); Dbg_Out ("focus\n"); /* See if we are iconified or restored */ if (event->active.state & SDL_APPACTIVE) { Dbg_Out ("App has been %s\n", event->active.gain ? "restored" : "iconified"); } return (0); /* Pass various input events */ case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: case SDL_MOUSEMOTION: case SDL_KEYUP: return (1); case SDL_KEYDOWN: if (event->key.keysym.sym == SDLK_ESCAPE) { HotKey_Quit (); return(1); } if ((event->key.keysym.sym == SDLK_g) && (event->key.keysym.mod & KMOD_CTRL)) { HotKey_ToggleGrab (); return(0); } if ((event->key.keysym.sym == SDLK_z) && (event->key.keysym.mod & KMOD_CTRL)) { HotKey_Iconify (); return(0); } if ((event->key.keysym.sym == SDLK_RETURN) && (event->key.keysym.mod & KMOD_ALT)) { HotKey_ToggleFullScreen (); return(0); } return (1); /* Pass the video resize event through .. */ case SDL_VIDEORESIZE: return (1); /* This is important! Queue it if we want to quit. */ case SDL_QUIT: Dbg_Out ("Quit demanded\n"); return (1); /* Drop all other events */ default: return (0); } } static int SetVideoMode (int w, int h) { /* screen is a global variable defined in sdl_common.c */ screen = SDL_SetVideoMode (w, h, video_bpp, video_flags); if (screen == NULL) { Dbg_Out (stderr, "Couldn't set %dx%dx%d video mode: %s\n", w, h, video_bpp, SDL_GetError ()); return (-1); } if (!screen->flags) { Dbg_Out ("No hardware support.\n"); } Dbg_Out ("Running in %s mode\n", screen->flags & SDL_FULLSCREEN ? "fullscreen" : "windowed"); return (0); } static XBBool InitDisplay (void) { char *title; int parsed; int w, h; const SDL_VideoInfo *videoInfo; CFGVideoSetup video; if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) { fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); exit (1); } atexit (SDL_Quit); videoInfo = SDL_GetVideoInfo (); Dbg_Out ("Hardware available:...............................%s\n", videoInfo->hw_available ? "yes" : "no"); Dbg_Out ("Window manager_available:.........................%s\n", videoInfo->wm_available ? "yes" : "no"); Dbg_Out ("Hardware to hardware blits accelerated?:..........%s\n", videoInfo->blit_hw ? "yes" : "no"); Dbg_Out ("Hardware to hardware colorkey blits accelerated?:.%s\n", videoInfo->blit_hw_CC ? "yes" : "no"); Dbg_Out ("Hardware to hardware alpha blits accelerated?:....%s\n", videoInfo->blit_hw_A ? "yes" : "no"); Dbg_Out ("Software to hardware blits accelerated?:..........%s\n", videoInfo->blit_sw ? "yes" : "no"); Dbg_Out ("Software to hardware colorkey blits accelerated?:.%s\n", videoInfo->blit_sw_CC ? "yes" : "no"); Dbg_Out ("Software to hardware alpha blits accelerated?:....%s\n", videoInfo->blit_sw_A ? "yes" : "no"); Dbg_Out ("Color fills accelerated?:.........................%s\n", videoInfo->blit_fill ? "yes" : "no"); Dbg_Out ("Total amount of video memory in Kilobytes:........%d\n", videoInfo->video_mem); Dbg_Out ("Display pixel format:\n"); Dbg_Out (" Bits per pixel:.%d\n", videoInfo->vfmt->BitsPerPixel); Dbg_Out (" Rmask:..........%08x\n", videoInfo->vfmt->Rmask); Dbg_Out (" Gmask:..........%08x\n", videoInfo->vfmt->Gmask); Dbg_Out (" Bmask:..........%08x\n", videoInfo->vfmt->Bmask); Dbg_Out (" Amask:..........%08x\n", videoInfo->vfmt->Amask); Dbg_Out (" Colorkey:.......%08x\n", videoInfo->vfmt->colorkey); Dbg_Out (" Alpha:..........%08x\n", videoInfo->vfmt->alpha); /* Try Hardware surfaces if available. */ video_flags |= (videoInfo->hw_available ? SDL_HWSURFACE : SDL_SWSURFACE); video_flags |= (videoInfo->hw_available ? SDL_DOUBLEBUF : 0); /* RLE encoding increases speed when blitting transparent surfaces. */ video_flags |= SDL_RLEACCEL; /* Use current videomode for resolution. This is the idel format. */ video_bpp = videoInfo->vfmt->BitsPerPixel; /* Check command line arguments */ w = PIXW; h = PIXH + SCOREH; parsed = 1; /* Set the icon -- this must be done before the first mode set */ /* icon = LoadIconSurface("icon.bmp", &icon_mask); if ( icon != NULL ) { SDL_WM_SetIcon(icon, icon_mask); } if ( icon_mask != NULL ) free(icon_mask); */ /* Set the title bar */ title = "XBlast TNT " VERSION_STRING; SDL_WM_SetCaption (title, "XBlast TNT"); /* See if it's really set */ SDL_WM_GetCaption (&title, NULL); if (RetrieveVideoSetup (&video)) { if (video.mode == XBVM_Full) { video_flags |= SDL_FULLSCREEN; } } /* Initialize the display */ if (SetVideoMode (w, h) < 0) { return (1); } /* Set the color key. Experimental. */ /* TODO: Test effects of SDL_SRCCOLORKEY flag */ SDL_SetColorKey (screen, SDL_RLEACCEL, SDL_MapRGB (screen->format, 0xFF, 0xFF, 0xFF)); /* Set an event filter. */ SDL_SetEventFilter(FilterEvents); return XBTrue; } XBBool GUI_Init (int argc, char *argv[]) { if (!InitDisplay ()) { return XBFalse; } /* now setup image loading */ /* if (! InitImage () ) { return XBFalse; } */ if (!InitKeysym ()) { return XBFalse; } if (!InitEvent ()) { return XBFalse; } /* now create pixmap for double bufferung */ if (!InitPixmap ()) { return XBFalse; } /* now create pixmap for double bufferung */ if (!InitSprites ()) { return XBFalse; } if (!InitFonts ()) { return XBFalse; } /* initalisize tile drawing and scoreboard */ if (!InitTiles ()) { return XBFalse; } return XBTrue; } void GUI_Finish (void) { } /* GUI_Finish */ void GUI_OnQuit (XBQuitFunction _quitFunc) { } /* GUI_OnQuit */ xblast-2.10.4/sdl_joystick.c0000644000175000017500000001532210412221162015047 0ustar rhondaalfie/* * file x11_joystick.c - joystick support for linux * * $Id: sdl_joystick.c,v 1.5 2006/03/28 11:48:02 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include #include "sdl_joystick.h" #define JOYDIR_NONE 0x00 #define JOYDIR_UP 0x01 #define JOYDIR_DOWN 0x02 #define JOYDIR_Y 0x03 #define JOYDIR_LEFT 0x04 #define JOYDIR_RIGHT 0x08 #define JOYDIR_X 0x0C #define THRESHOLD 4096 // old value: 8192 /* * local types */ typedef struct { SDL_Joystick *joy; XBEventCode event; unsigned dir; } XBJoystick; /* * local variables */ /* #ifndef NO_JOYSTICK static const char *joyDevice[NUM_JOYSTICKS] = { "/dev/js0", "/dev/js1", "/dev/input/js0", "/dev/input/js1", "/dev/input/js2", "/dev/input/js3", }; */ static XBJoystick joystick[NUM_JOYSTICKS] = { {NULL, XBE_NONE, 0}, {NULL, XBE_NONE, 0}, {NULL, XBE_NONE, 0}, {NULL, XBE_NONE, 0}, {NULL, XBE_NONE, 0}, {NULL, XBE_NONE, 0}, }; //#endif /* * global function: GUI_NumJoysticks * description: Query number of connected joysticks * return value: # joysticks */ int GUI_NumJoysticks (void) { return SDL_NumJoysticks (); } /* GUI_NumJoysticks */ /* * Initialize */ XBBool InitJoystick (void) { int i; if (SDL_InitSubSystem (SDL_INIT_JOYSTICK) == -1) { fprintf (stderr, "Error: Could not initializate joystick!\n" "Reason: %s\n", SDL_GetError ()); return XBFalse; } for (i = 0; i < SDL_NumJoysticks () && i < NUM_JOYSTICKS; i++) { joystick[i].joy = SDL_JoystickOpen (i); if (joystick[i].joy) { printf ("Using joysitck %d\n", i); i++; } else printf ("Couldn't open joystick %d\n", i); } return XBTrue; } /* InitJoystick */ /* * shutdown */ void FinishJoystick (void) { int i; for (i = 0; i < NUM_JOYSTICKS; i++) { if (joystick[i].joy != NULL) { printf ("Closing joystick %d\n", i); SDL_JoystickClose (joystick[i].joy); } } } /* FinishJoystick */ #ifndef NO_JOYSTICK /* * calculate new joystick direction from axis-event */ static unsigned EvalJoystickMove (unsigned dir, unsigned axis, int value) { unsigned newDir = dir; switch (axis) { /* x-Axis */ case 0: newDir &= ~JOYDIR_X; if (value > THRESHOLD) newDir |= JOYDIR_RIGHT; else if (value < -THRESHOLD) newDir |= JOYDIR_LEFT; break; /* y-axis */ case 1: newDir &= ~JOYDIR_Y; if (value > THRESHOLD) newDir |= JOYDIR_DOWN; else if (value < -THRESHOLD) newDir |= JOYDIR_UP; break; default: break; } #ifdef DEBUG_JOYSTICK Dbg_Out ("joy move: axis=%u value=%d => %02x\n", axis, value, newDir); #endif return newDir; } /* EvalJoystickMove */ #endif /* * handle new joystick event during game */ void HandleXBlastJoystick (SDL_Event * event) { unsigned newDir; int value; switch (event->type) { case SDL_JOYAXISMOTION: newDir = EvalJoystickMove (joystick[event->jaxis.which].dir, event->jaxis.axis, event->jaxis.value); switch (newDir) { case JOYDIR_UP: value = XBGK_GO_UP; break; case JOYDIR_DOWN: value = XBGK_GO_DOWN; break; case JOYDIR_LEFT: value = XBGK_GO_LEFT; break; case JOYDIR_RIGHT: value = XBGK_GO_RIGHT; break; case JOYDIR_NONE: value = XBGK_STOP_ALL; break; default: value = XBGK_NONE; break; } if (value != XBGK_NONE && newDir != joystick[event->jaxis.which].dir) { QueueEventValue (joystick[event->jaxis.which].event, value); joystick[event->jaxis.which].dir = newDir; } break; case SDL_JOYHATMOTION: if (event->jhat.value & SDL_HAT_UP) { QueueEventValue (joystick[event->jaxis.which].event, XBGK_GO_UP); joystick[event->jaxis.which].dir |= JOYDIR_UP; } if (event->jhat.value & SDL_HAT_DOWN) { QueueEventValue (joystick[event->jaxis.which].event, XBGK_GO_DOWN); joystick[event->jaxis.which].dir |= JOYDIR_DOWN; } if (event->jhat.value & SDL_HAT_RIGHT) { QueueEventValue (joystick[event->jaxis.which].event, XBGK_GO_RIGHT); joystick[event->jaxis.which].dir |= JOYDIR_RIGHT; } if (event->jhat.value & SDL_HAT_LEFT) { QueueEventValue (joystick[event->jaxis.which].event, XBGK_GO_LEFT); joystick[event->jaxis.which].dir |= JOYDIR_LEFT; } if (event->jhat.value & XBGK_STOP_ALL) { QueueEventValue (joystick[event->jaxis.which].event, XBGK_STOP_ALL); joystick[event->jaxis.which].dir = JOYDIR_NONE; } break; case SDL_JOYBUTTONDOWN: if (event->jbutton.button == 0) QueueEventValue (joystick[event->jbutton.which].event, XBGK_BOMB); if (event->jbutton.button == 1) QueueEventValue (joystick[event->jbutton.which].event, XBGK_SPECIAL); break; } } /* HandleJoystick */ /* * handle new joystick event in menus */ void HandleMenuJoystick (SDL_Event * event) { unsigned newDir; switch (event->type) { case SDL_JOYAXISMOTION: newDir = EvalJoystickMove (joystick[event->jaxis.which].dir, event->jaxis.axis, event->jaxis.value); /* test changes in y dir */ if ((newDir & JOYDIR_Y) != (joystick[event->jaxis.which].dir & JOYDIR_Y)) { switch (newDir & JOYDIR_Y) { case JOYDIR_UP: QueueEventValue (XBE_MENU, XBMK_UP); break; case JOYDIR_DOWN: QueueEventValue (XBE_MENU, XBMK_DOWN); break; default: break; } } /* test changes in x dir */ if ((newDir & JOYDIR_X) != (joystick[event->jaxis.which].dir & JOYDIR_X)) { switch (newDir & JOYDIR_X) { case JOYDIR_LEFT: QueueEventValue (XBE_MENU, XBMK_LEFT); break; case JOYDIR_RIGHT: QueueEventValue (XBE_MENU, XBMK_RIGHT); break; default: break; } } joystick[event->jaxis.which].dir = newDir; break; case SDL_JOYHATMOTION: if (event->jhat.value & SDL_HAT_UP) QueueEventValue (XBE_MENU, XBMK_UP); if (event->jhat.value & SDL_HAT_DOWN) QueueEventValue (XBE_MENU, XBMK_DOWN); if (event->jhat.value & SDL_HAT_RIGHT) QueueEventValue (XBE_MENU, XBMK_RIGHT); if (event->jhat.value & SDL_HAT_LEFT) QueueEventValue (XBE_MENU, XBMK_LEFT); break; case SDL_JOYBUTTONUP: QueueEventValue (XBE_MENU, XBMK_SELECT); break; } } /* HandleMenuJoystick */ /* * end of file x11_joystick.c */ xblast-2.10.4/sdl_joystick.h0000644000175000017500000000235410372731124015066 0ustar rhondaalfie/* * file sdl_joystick.h - joystick support for linux * * $Id: sdl_joystick.h,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_JOYSTICK_H #define XBLAST_SDL_JOYSTICK_H /* * global macros */ #define NUM_JOYSTICKS 6 /* * global prototypes */ extern XBBool InitJoystick (void); extern void FinishJoystick (void); extern void HandleMenuJoystick (SDL_Event * event); extern void HandleXBlastJoystick (SDL_Event * event); #endif /* * end of file sdl_joystick.h */ xblast-2.10.4/sdl_keysym.c0000644000175000017500000001272010373126075014545 0ustar rhondaalfie/* * file w32_keysym.c - create X11 like keysmbol names for virtual keys * * $Id: sdl_keysym.c,v 1.5 2006/02/10 15:07:41 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * local types */ typedef struct { SDLKey code; const char *name; } KeyNameTable; typedef struct { XBAtom atom; SDLKey code; } AtomCodeTable; /* * local variables */ static int numKeys = 0; static AtomCodeTable *atomTable = NULL; static AtomCodeTable *codeTable = NULL; static KeyNameTable keyTable[] = { {SDLK_BACKSPACE, "BackSpace"}, {SDLK_TAB, "Tab"}, {SDLK_RETURN, "Return"}, {KMOD_SHIFT, "Shift"}, {KMOD_CTRL, "Control"}, {SDLK_PAUSE, "Pause"}, {SDLK_CAPSLOCK, "Caps_Lock"}, {SDLK_ESCAPE, "Escape"}, {SDLK_SPACE, "space"}, {SDLK_PAGEUP, "Prior"}, {SDLK_PAGEDOWN, "Next"}, {SDLK_END, "End"}, {SDLK_HOME, "Home"}, {SDLK_LEFT, "Left"}, {SDLK_UP, "Up"}, {SDLK_RIGHT, "Right"}, {SDLK_DOWN, "Down"}, {SDLK_PRINT, "Print"}, {SDLK_INSERT, "Insert"}, {SDLK_DELETE, "Delete"}, {SDLK_0, "0"}, {SDLK_1, "1"}, {SDLK_2, "2"}, {SDLK_3, "3"}, {SDLK_4, "4"}, {SDLK_5, "5"}, {SDLK_6, "6"}, {SDLK_7, "7"}, {SDLK_8, "8"}, {SDLK_9, "9"}, {SDLK_a, "A"}, {SDLK_b, "B"}, {SDLK_c, "C"}, {SDLK_d, "D"}, {SDLK_e, "E"}, {SDLK_f, "F"}, {SDLK_g, "G"}, {SDLK_h, "H"}, {SDLK_i, "I"}, {SDLK_k, "J"}, {SDLK_k, "K"}, {SDLK_l, "L"}, {SDLK_m, "M"}, {SDLK_n, "N"}, {SDLK_o, "O"}, {SDLK_p, "P"}, {SDLK_q, "Q"}, {SDLK_r, "R"}, {SDLK_s, "S"}, {SDLK_t, "T"}, {SDLK_u, "U"}, {SDLK_v, "V"}, {SDLK_w, "W"}, {SDLK_x, "X"}, {SDLK_y, "Y"}, {SDLK_z, "Z"}, {SDLK_a, "a"}, {SDLK_b, "b"}, {SDLK_c, "c"}, {SDLK_d, "d"}, {SDLK_e, "e"}, {SDLK_f, "f"}, {SDLK_g, "g"}, {SDLK_h, "h"}, {SDLK_i, "i"}, {SDLK_k, "j"}, {SDLK_k, "k"}, {SDLK_l, "l"}, {SDLK_m, "m"}, {SDLK_n, "n"}, {SDLK_o, "o"}, {SDLK_p, "p"}, {SDLK_q, "q"}, {SDLK_r, "r"}, {SDLK_s, "s"}, {SDLK_t, "t"}, {SDLK_u, "u"}, {SDLK_v, "v"}, {SDLK_w, "w"}, {SDLK_x, "x"}, {SDLK_y, "y"}, {SDLK_z, "z"}, {SDLK_KP0, "KP_0"}, {SDLK_KP1, "KP_1"}, {SDLK_KP2, "KP_2"}, {SDLK_KP3, "KP_3"}, {SDLK_KP4, "KP_4"}, {SDLK_KP5, "KP_5"}, {SDLK_KP6, "KP_6"}, {SDLK_KP7, "KP_7"}, {SDLK_KP8, "KP_8"}, {SDLK_KP9, "KP_9"}, {SDLK_KP_MULTIPLY, "KP_Multiply"}, {SDLK_KP_PLUS, "KP_Add"}, {SDLK_KP_MINUS, "KP_Subtract"}, {SDLK_KP_PERIOD, "KP_Decimal"}, {SDLK_KP_DIVIDE, "KP_Divide"}, {SDLK_F1, "F1"}, {SDLK_F2, "F2"}, {SDLK_F3, "F3"}, {SDLK_F4, "F4"}, {SDLK_F5, "F5"}, {SDLK_F6, "F6"}, {SDLK_F7, "F7"}, {SDLK_F8, "F8"}, {SDLK_F9, "F9"}, {SDLK_F10, "F10"}, {SDLK_F11, "F11"}, {SDLK_F12, "F12"}, {SDLK_F13, "F13"}, {SDLK_F14, "F14"}, {SDLK_F15, "F15"}, /* terminator */ {0, NULL}, }; /* * compare by code */ static int CompareByCode (const void *a, const void *b) { return ((const AtomCodeTable *) a)->code - ((const AtomCodeTable *) b)->code; } /* CompareByCode */ /* * compare by atom */ static int CompareByAtom (const void *a, const void *b) { return ((const AtomCodeTable *) a)->atom - ((const AtomCodeTable *) b)->atom; } /* CompareByAtom */ /* * init keysyms */ XBBool InitKeysym (void) { int i; /* count keys */ for (numKeys = 0; keyTable[numKeys].name != NULL; numKeys++) continue; /* alloc tables */ atomTable = calloc (numKeys, sizeof (AtomCodeTable)); assert (NULL != atomTable); codeTable = calloc (numKeys, sizeof (AtomCodeTable)); assert (NULL != codeTable); /* fill tables */ for (i = 0; i < numKeys; i++) { XBAtom atom = GUI_StringToAtom (keyTable[i].name); atomTable[i].code = codeTable[i].code = keyTable[i].code; atomTable[i].atom = codeTable[i].atom = atom; } /* sort tables */ qsort (atomTable, numKeys, sizeof (AtomCodeTable), CompareByAtom); qsort (codeTable, numKeys, sizeof (AtomCodeTable), CompareByCode); /* that's all */ return XBTrue; } /* InitKeysym */ /* * */ void FinishKeysym (void) { if (NULL != atomTable) { free (atomTable); atomTable = NULL; } if (NULL != codeTable) { free (codeTable); codeTable = NULL; } } /* FinishKeysym */ /* * convert string to keycode */ SDLKey StringToVirtualKey (const char *name) { AtomCodeTable key; AtomCodeTable *result; XBAtom atom; atom = GUI_StringToAtom (name); key.atom = atom; result = bsearch (&key, atomTable, numKeys, sizeof (AtomCodeTable), CompareByAtom); if (NULL == result) { return SDLK_UNKNOWN; } return result->code; } /* StringToVirtualKey */ /* * convert keycode to string */ XBAtom VirtualKeyToAtom (SDLKey code) { AtomCodeTable key; AtomCodeTable *result; XBAtom atom; key.code = code; result = bsearch (&key, codeTable, numKeys, sizeof (AtomCodeTable), CompareByCode); if (NULL == result) { return ATOM_INVALID; } atom = result->atom; return atom; } /* StringToVirtualKey */ /* * end of file w32_keysym.c */ xblast-2.10.4/sdl_keysym.h0000644000175000017500000000206210372731124014544 0ustar rhondaalfie/* * file w32_keysym.h * * $Id: sdl_keysym.h,v 1.3 2006/02/09 21:21:24 fzago Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SDL_KEYSYM_H #define SDL_KEYSYM_H /* * global prototypes */ extern XBBool InitKeysym (void); extern void FinishKeysym (void); extern SDLKey StringToVirtualKey (const char *name); extern XBAtom VirtualKeyToAtom (SDLKey code); #endif /* * end of file sdl_keysym.h */ xblast-2.10.4/sdl_msgbox.c0000644000175000017500000000226210372731124014517 0ustar rhondaalfie/* * file x11_msgbox.c - * * $Id: sdl_msgbox.c,v 1.4 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "xblast.h" /* * not yet implemented */ void GUI_ErrorMessage (const char *fmt, ...) { va_list argList; GUI_Bell (); fputs ("*** ", stderr); va_start (argList, fmt); vfprintf (stderr, fmt, argList); va_end (argList); fputs (" ***\n", stderr); } /* GUI_ErrorMessage */ /* * end of file x11_msgbox.c */ xblast-2.10.4/sdl_pixmap.c0000644000175000017500000001526610412221401014511 0ustar rhondaalfie/* * file x11c_pixmap.c - double buffer for drawing * * $Id: sdl_pixmap.c,v 1.5 2006/03/28 11:50:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #include "sdl_common.h" #include "sdl_image.h" /* * local constants */ #define CLEAR_WIDTH (24*BASE_X) #define CLEAR_HEIGHT (24*BASE_Y) #define FADE_STEP 16 /* * local variables */ /* Changed by VVL (Chat) 12/11/99 */ #ifdef SMPF static SDL_Rect xrec[MAZE_W * (MAZE_H + 3) + STAT_W * 4]; #else static SDL_Rect xrec[MAZE_W * (MAZE_H + 2) + STAT_W * 4]; #endif int counter = 0; static SDL_Rect *xrecMax = xrec; /* fading */ static XBFadeMode fadeMode; static int fadeMax; /* maximum y coordinate */ static int fadeStep; /* step width between lines */ /* GC to use*/ static Uint32 fadeColor; static SDL_Surface *clearPix; /* This SDL_Surface is used as a work around to blit back the screen after a fading. The right fix would be to force an entire drawing after fading. TODO: remove this hack and force entire drawing where needed. */ static SDL_Surface *screen_copy; /* * */ XBBool InitPixmap (void) { SDL_Surface *temp; temp = ReadCchPixmap (imgPathMisc, imgFileTitle, COLOR_BLACK, COLOR_GRAY_75, COLOR_MIDNIGHT_BLUE); if (!temp) { fprintf (stderr, "Error: file not found.\n"); return XBFalse; } clearPix = SDL_DisplayFormat (temp); SDL_FreeSurface (temp); if (clearPix == NULL) { fprintf (stderr, "ReadCchPixmap Failed in InitPixmap\n"); return XBFalse; }; screen_copy = SDL_CreateRGBSurface (screen->flags, screen->w, screen->h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); if (screen_copy == NULL) { fprintf (stderr, "Error: failed to init screen_copy. Reason: %s\n", SDL_GetError ()); return XBFalse; }; return XBTrue; } /* InitPixmap */ /* * Clear screen with clearpix */ void GUI_ClearPixmap (void) { int x; int y; SDL_Rect DstRect; DstRect.x = 0; DstRect.y = 0; DstRect.w = PIXW; for (DstRect.x = 0; DstRect.x < PIXW; x += CLEAR_WIDTH) { for (DstRect.y = 0; DstRect.y < PIXH + SCOREH; y += CLEAR_HEIGHT) { SDL_BlitSurface (clearPix, NULL, screen, &DstRect); DstRect.y += clearPix->h; } DstRect.x += clearPix->w; } SDL_Flip (screen); } /* GUI_ClearPixmap */ /* * */ void GUI_AddMazeRectangle (int x, int y) { xrecMax->x = BLOCK_WIDTH * x; xrecMax->y = BLOCK_HEIGHT * y; xrecMax->w = BLOCK_WIDTH; xrecMax->h = BLOCK_HEIGHT; if (xrecMax != xrec) { SDL_Rect *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->w)) { prev->w += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* GUI_AddMazeRectangle */ /* * */ void GUI_AddStatRectangle (int x, int y) { xrecMax->x = x * STAT_WIDTH; xrecMax->y = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT; xrecMax->w = STAT_WIDTH; xrecMax->h = (y < STAT_H) ? STAT_HEIGHT : LED_HEIGHT; if (xrecMax != xrec) { SDL_Rect *prev = xrecMax - 1; /* try to join rectangles */ if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->w)) { prev->w += BLOCK_WIDTH; xrecMax = prev; counter--; } } xrecMax++; } /* GUI_AddStatRectangle */ /* Added by VVL (Chat) 12/11/99 : Begin */ /* Added by VVL (Chat) 12/11/99 : Begin */ void GUI_AddChatRectangle (int x, int y) { #ifdef SMPF int i = 2; #else int i = 1; #endif int j; j = MAZE_W * (MAZE_H + 1) + STAT_W * 4; xrecMax->h = i * STAT_HEIGHT + BLOCK_HEIGHT + 8; xrecMax->x = x * STAT_WIDTH; xrecMax->y = (MAZE_H + i) * BLOCK_HEIGHT; xrecMax->w = STAT_WIDTH; if (xrecMax != xrec) { SDL_Rect *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->w)) { prev->w += BLOCK_WIDTH; xrecMax = prev; } } if (xrec + MAZE_W * (MAZE_H + 1) + STAT_W * 4 == xrecMax) { return; } xrecMax++; } /* Added by VVL (Chat) 12/11/99 : End */ /* Added by VVL (Chat) 12/11/99 : End */ /* Added by VVL (Chat) 12/11/99 : Begin */ /* void AddTilesRectangle (int x, int y) { } */ void GUI_AddTilesRectangle (int x, int y) { #ifdef SMPF int i = 0; #else int i = 0; #endif xrecMax->h = i * STAT_HEIGHT; xrecMax->x = x * STAT_WIDTH; xrecMax->y = (MAZE_H + i) * BLOCK_HEIGHT; xrecMax->w = STAT_WIDTH; if (xrecMax != xrec) { SDL_Rect *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->w)) { prev->w += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* Added by VVL (Chat) 12/11/99 : End */ /* * */ void GUI_FlushPixmap (XBBool flag) { SDL_Flip (screen); if (flag) { counter = 0; xrecMax = xrec; } } /* GUI_FlushPixmap */ /* * */ void GUI_FlushScoreBoard (void) { } /* GUI_FlushScoreBoard */ /* * */ // maxLines are not used in this SDL implementation. void GUI_InitFade (XBFadeMode mode, int maxLines) { fadeMax = maxLines; fadeStep = FADE_STEP; fadeMode = mode; switch (mode) { case XBFM_BLACK_OUT: fadeColor = SDL_MapRGB (screen->format, 0, 0, 0); break; case XBFM_WHITE_OUT: fadeColor = SDL_MapRGB (screen->format, 0xFF, 0xFF, 0xFF); break; case XBFM_IN: // just to keep compiler happy break; } if (mode != XBFM_IN) // save a copy of the current screen (before fade) { SDL_BlitSurface (screen, NULL, screen_copy, NULL); } } /* GUI_InitFade */ /* * */ XBBool GUI_DoFade (void) { int y; SDL_Rect r; if (fadeStep <= 0) { if (fadeMode != XBFM_IN) SDL_FillRect (screen, NULL, fadeColor); SDL_Flip (screen); SDL_Delay (200); if (fadeMode != XBFM_IN) SDL_BlitSurface (screen_copy, NULL, screen, NULL); return XBFalse; } r.x = 0; r.w = screen->w; r.h = (FADE_STEP + 1) - fadeStep; for (y = 0; y < screen->h; y += FADE_STEP) { r.y = y; if (fadeMode == XBFM_IN) SDL_UpdateRect (screen, r.x, r.y, r.w, r.h); else // fade out SDL_FillRect (screen, &r, fadeColor); } if (fadeMode != XBFM_IN) SDL_Flip (screen); /* preparing next fade. */ fadeStep -= 2; /* thats all */ return XBTrue; } /* GUI_FadeOut */ /* * end of file x11c_pixmap.c */ xblast-2.10.4/sdl_pixmap.h0000644000175000017500000000176510372731124014532 0ustar rhondaalfie/* * file sdl_pixmap.h - * * $Id: sdl_pixmap.h,v 1.3 2006/02/09 21:21:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_COLOR_PIXMAP_H #define XBLAST_SDL_COLOR_PIXMAP_H extern XBBool InitPixmap (void); #endif /* * ende of file sdl_pixmap.h */ xblast-2.10.4/sdl_ppm.c0000644000175000017500000003126510372705221014020 0ustar rhondaalfie/* SDL - Simple DirectMedia Layer Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Sam Lantinga slouken@libsdl.org */ #ifdef SAVE_RCSID static char rcsid = "@(#) $Id: sdl_ppm.c,v 1.3 2006/02/09 18:31:45 fzago Exp $"; #endif #ifndef DISABLE_FILE /* Code to load and save surfaces in Windows BMP format. Why support BMP format? Well, it's a native format for Windows, and most image processing programs can read and write it. It would be nice to be able to have at least one image format that we can natively load and save, and since PNG is so complex that it would bloat the library, BMP is a good alternative. This code currently supports Win32 DIBs in uncompressed 8 and 24 bpp. */ #include #include "SDL_error.h" #include "SDL_video.h" #include "SDL_endian.h" /* Compression encodings for BMP files */ #ifndef BI_RGB #define BI_RGB 0 #define BI_RLE8 1 #define BI_RLE4 2 #define BI_BITFIELDS 3 #endif SDL_Surface * SDL_LoadPPM (const char *file, int freesrc) { int was_error; long fp_offset; int bmpPitch; int i, pad; SDL_Surface *surface; Uint32 Rmask; Uint32 Gmask; Uint32 Bmask; SDL_Palette *palette; Uint8 *bits; int ExpandBMP; /* The Win32 BMP file header (14 bytes) */ char magic[2]; Uint32 bfSize; Uint16 bfReserved1; Uint16 bfReserved2; Uint32 bfOffBits; SDL_RWops *src; /* The Win32 BITMAPINFOHEADER struct (40 bytes) */ Uint32 biSize; Sint32 biWidth; Sint32 biHeight; Uint16 biPlanes; Uint16 biBitCount; Uint32 biCompression; Uint32 biSizeImage; Sint32 biXPelsPerMeter; Sint32 biYPelsPerMeter; Uint32 biClrUsed; Uint32 biClrImportant; SDL_RWFromFile (file, "rb"); /* Make sure we are passed a valid data source */ surface = NULL; was_error = 0; if (src == NULL) { was_error = 1; goto done; } /* Read in the BMP file header */ fp_offset = SDL_RWtell (src); SDL_ClearError (); if (SDL_RWread (src, magic, 1, 2) != 2) { SDL_Error (SDL_EFREAD); was_error = 1; goto done; } if (strncmp (magic, "BM", 2) != 0) { SDL_SetError ("File is not a Windows BMP file"); was_error = 1; goto done; } bfSize = SDL_ReadLE32 (src); bfReserved1 = SDL_ReadLE16 (src); bfReserved2 = SDL_ReadLE16 (src); bfOffBits = SDL_ReadLE32 (src); /* Read the Win32 BITMAPINFOHEADER */ biSize = SDL_ReadLE32 (src); if (biSize == 12) { biWidth = (Uint32) SDL_ReadLE16 (src); biHeight = (Uint32) SDL_ReadLE16 (src); biPlanes = SDL_ReadLE16 (src); biBitCount = SDL_ReadLE16 (src); biCompression = BI_RGB; biSizeImage = 0; biXPelsPerMeter = 0; biYPelsPerMeter = 0; biClrUsed = 0; biClrImportant = 0; } else { biWidth = SDL_ReadLE32 (src); biHeight = SDL_ReadLE32 (src); biPlanes = SDL_ReadLE16 (src); biBitCount = SDL_ReadLE16 (src); biCompression = SDL_ReadLE32 (src); biSizeImage = SDL_ReadLE32 (src); biXPelsPerMeter = SDL_ReadLE32 (src); biYPelsPerMeter = SDL_ReadLE32 (src); biClrUsed = SDL_ReadLE32 (src); biClrImportant = SDL_ReadLE32 (src); } /* Check for read error */ if (strcmp (SDL_GetError (), "") != 0) { was_error = 1; goto done; } /* Expand 1 and 4 bit bitmaps to 8 bits per pixel */ switch (biBitCount) { case 1: case 4: ExpandBMP = biBitCount; biBitCount = 8; break; default: ExpandBMP = 0; break; } /* We don't support any BMP compression right now */ Rmask = Gmask = Bmask = 0; switch (biCompression) { case BI_RGB: /* If there are no masks, use the defaults */ if (bfOffBits == (14 + biSize)) { /* Default values for the BMP format */ switch (biBitCount) { case 15: case 16: Rmask = 0x7C00; Gmask = 0x03E0; Bmask = 0x001F; break; case 24: #if SDL_BYTEORDER == SDL_BIG_ENDIAN Rmask = 0x000000FF; Gmask = 0x0000FF00; Bmask = 0x00FF0000; break; #endif case 32: Rmask = 0x00FF0000; Gmask = 0x0000FF00; Bmask = 0x000000FF; break; default: break; } break; } /* Fall through -- read the RGB masks */ case BI_BITFIELDS: switch (biBitCount) { case 15: case 16: case 32: Rmask = SDL_ReadLE32 (src); Gmask = SDL_ReadLE32 (src); Bmask = SDL_ReadLE32 (src); break; default: break; } break; default: SDL_SetError ("Compressed BMP files not supported"); was_error = 1; goto done; } /* Create a compatible surface, note that the colors are RGB ordered */ surface = SDL_CreateRGBSurface (SDL_SWSURFACE, biWidth, biHeight, biBitCount, Rmask, Gmask, Bmask, 0); if (surface == NULL) { was_error = 1; goto done; } /* Load the palette, if any */ palette = (surface->format)->palette; if (palette) { if (biClrUsed == 0) { biClrUsed = 1 << biBitCount; } if (biSize == 12) { for (i = 0; i < (int)biClrUsed; ++i) { SDL_RWread (src, &palette->colors[i].b, 1, 1); SDL_RWread (src, &palette->colors[i].g, 1, 1); SDL_RWread (src, &palette->colors[i].r, 1, 1); palette->colors[i].unused = 0; } } else { for (i = 0; i < (int)biClrUsed; ++i) { SDL_RWread (src, &palette->colors[i].b, 1, 1); SDL_RWread (src, &palette->colors[i].g, 1, 1); SDL_RWread (src, &palette->colors[i].r, 1, 1); SDL_RWread (src, &palette->colors[i].unused, 1, 1); } } palette->ncolors = biClrUsed; } /* Read the surface pixels. Note that the bmp image is upside down */ if (SDL_RWseek (src, fp_offset + bfOffBits, SEEK_SET) < 0) { SDL_Error (SDL_EFSEEK); was_error = 1; goto done; } bits = (Uint8 *) surface->pixels + (surface->h * surface->pitch); switch (ExpandBMP) { case 1: bmpPitch = (biWidth + 7) >> 3; pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0); break; case 4: bmpPitch = (biWidth + 1) >> 1; pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0); break; default: pad = ((surface->pitch % 4) ? (4 - (surface->pitch % 4)) : 0); break; } while (bits > (Uint8 *) surface->pixels) { bits -= surface->pitch; switch (ExpandBMP) { case 1: case 4:{ Uint8 pixel = 0; int shift = (8 - ExpandBMP); for (i = 0; i < surface->w; ++i) { if (i % (8 / ExpandBMP) == 0) { if (!SDL_RWread (src, &pixel, 1, 1)) { SDL_SetError ("Error reading from BMP"); was_error = 1; goto done; } } *(bits + i) = (pixel >> shift); pixel <<= ExpandBMP; } } break; default: if (SDL_RWread (src, bits, 1, surface->pitch) != surface->pitch) { SDL_Error (SDL_EFREAD); was_error = 1; goto done; } #if SDL_BYTEORDER == SDL_BIG_ENDIAN /* Byte-swap the pixels if needed. Note that the 24bpp case has already been taken care of above. */ switch (biBitCount) { case 15: case 16:{ Uint16 *pix = (Uint16 *) bits; for (i = 0; i < surface->w; i++) pix[i] = SDL_Swap16 (pix[i]); break; } case 32:{ Uint32 *pix = (Uint32 *) bits; for (i = 0; i < surface->w; i++) pix[i] = SDL_Swap32 (pix[i]); break; } } #endif break; } /* Skip padding bytes, ugh */ if (pad) { Uint8 padbyte; for (i = 0; i < pad; ++i) { SDL_RWread (src, &padbyte, 1, 1); } } } done: if (was_error) { if (surface) { SDL_FreeSurface (surface); } surface = NULL; } if (freesrc && src) { SDL_RWclose (src); } return (surface); } int SDL_SaveBMP_RW (SDL_Surface * saveme, SDL_RWops * dst, int freedst) { long fp_offset; int i, pad; SDL_Surface *surface; Uint8 *bits; /* The Win32 BMP file header (14 bytes) */ char magic[2] = { 'B', 'M' }; Uint32 bfSize; Uint16 bfReserved1; Uint16 bfReserved2; Uint32 bfOffBits; /* The Win32 BITMAPINFOHEADER struct (40 bytes) */ Uint32 biSize; Sint32 biWidth; Sint32 biHeight; Uint16 biPlanes; Uint16 biBitCount; Uint32 biCompression; Uint32 biSizeImage; Sint32 biXPelsPerMeter; Sint32 biYPelsPerMeter; Uint32 biClrUsed; Uint32 biClrImportant; /* Make sure we have somewhere to save */ surface = NULL; if (dst) { if (saveme->format->palette) { if (saveme->format->BitsPerPixel == 8) { surface = saveme; } else { SDL_SetError ("%d bpp BMP files not supported", saveme->format->BitsPerPixel); } } else if ((saveme->format->BitsPerPixel == 24) && #if SDL_BYTEORDER == SDL_LIL_ENDIAN (saveme->format->Rmask == 0x00FF0000) && (saveme->format->Gmask == 0x0000FF00) && (saveme->format->Bmask == 0x000000FF) #else (saveme->format->Rmask == 0x000000FF) && (saveme->format->Gmask == 0x0000FF00) && (saveme->format->Bmask == 0x00FF0000) #endif ) { surface = saveme; } else { SDL_Rect bounds; /* Convert to 24 bits per pixel */ surface = SDL_CreateRGBSurface (SDL_SWSURFACE, saveme->w, saveme->h, 24, #if SDL_BYTEORDER == SDL_LIL_ENDIAN 0x00FF0000, 0x0000FF00, 0x000000FF, #else 0x000000FF, 0x0000FF00, 0x00FF0000, #endif 0); if (surface != NULL) { bounds.x = 0; bounds.y = 0; bounds.w = saveme->w; bounds.h = saveme->h; if (SDL_LowerBlit (saveme, &bounds, surface, &bounds) < 0) { SDL_FreeSurface (surface); SDL_SetError ("Couldn't convert image to 24 bpp"); surface = NULL; } } } } if (surface && (SDL_LockSurface (surface) == 0)) { /* Set the BMP file header values */ bfSize = 0; /* We'll write this when we're done */ bfReserved1 = 0; bfReserved2 = 0; bfOffBits = 0; /* We'll write this when we're done */ /* Write the BMP file header values */ fp_offset = SDL_RWtell (dst); SDL_ClearError (); SDL_RWwrite (dst, magic, 2, 1); SDL_WriteLE32 (dst, bfSize); SDL_WriteLE16 (dst, bfReserved1); SDL_WriteLE16 (dst, bfReserved2); SDL_WriteLE32 (dst, bfOffBits); /* Set the BMP info values */ biSize = 40; biWidth = surface->w; biHeight = surface->h; biPlanes = 1; biBitCount = surface->format->BitsPerPixel; biCompression = BI_RGB; biSizeImage = surface->h * surface->pitch; biXPelsPerMeter = 0; biYPelsPerMeter = 0; if (surface->format->palette) { biClrUsed = surface->format->palette->ncolors; } else { biClrUsed = 0; } biClrImportant = 0; /* Write the BMP info values */ SDL_WriteLE32 (dst, biSize); SDL_WriteLE32 (dst, biWidth); SDL_WriteLE32 (dst, biHeight); SDL_WriteLE16 (dst, biPlanes); SDL_WriteLE16 (dst, biBitCount); SDL_WriteLE32 (dst, biCompression); SDL_WriteLE32 (dst, biSizeImage); SDL_WriteLE32 (dst, biXPelsPerMeter); SDL_WriteLE32 (dst, biYPelsPerMeter); SDL_WriteLE32 (dst, biClrUsed); SDL_WriteLE32 (dst, biClrImportant); /* Write the palette (in BGR color order) */ if (surface->format->palette) { SDL_Color *colors; int ncolors; colors = surface->format->palette->colors; ncolors = surface->format->palette->ncolors; for (i = 0; i < ncolors; ++i) { SDL_RWwrite (dst, &colors[i].b, 1, 1); SDL_RWwrite (dst, &colors[i].g, 1, 1); SDL_RWwrite (dst, &colors[i].r, 1, 1); SDL_RWwrite (dst, &colors[i].unused, 1, 1); } } /* Write the bitmap offset */ bfOffBits = SDL_RWtell (dst) - fp_offset; if (SDL_RWseek (dst, fp_offset + 10, SEEK_SET) < 0) { SDL_Error (SDL_EFSEEK); } SDL_WriteLE32 (dst, bfOffBits); if (SDL_RWseek (dst, fp_offset + bfOffBits, SEEK_SET) < 0) { SDL_Error (SDL_EFSEEK); } /* Write the bitmap image upside down */ bits = (Uint8 *) surface->pixels + (surface->h * surface->pitch); pad = ((surface->pitch % 4) ? (4 - (surface->pitch % 4)) : 0); while (bits > (Uint8 *) surface->pixels) { bits -= surface->pitch; if (SDL_RWwrite (dst, bits, 1, surface->pitch) != surface->pitch) { SDL_Error (SDL_EFWRITE); break; } if (pad) { const Uint8 padbyte = 0; for (i = 0; i < pad; ++i) { SDL_RWwrite (dst, &padbyte, 1, 1); } } } /* Write the BMP file size */ bfSize = SDL_RWtell (dst) - fp_offset; if (SDL_RWseek (dst, fp_offset + 2, SEEK_SET) < 0) { SDL_Error (SDL_EFSEEK); } SDL_WriteLE32 (dst, bfSize); if (SDL_RWseek (dst, fp_offset + bfSize, SEEK_SET) < 0) { SDL_Error (SDL_EFSEEK); } /* Close it up.. */ SDL_UnlockSurface (surface); if (surface != saveme) { SDL_FreeSurface (surface); } } if (freedst && dst) { SDL_RWclose (dst); } return ((strcmp (SDL_GetError (), "") == 0) ? 0 : -1); } #endif /* ENABLE_FILE */ xblast-2.10.4/sdl_socket.c0000644000175000017500000005425010377676130014526 0ustar rhondaalfie/* * file x11_socket.c - true bsd sockets for xblast * * $Id: sdl_socket.c,v 1.8 2006/02/24 21:36:24 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "socket.h" #include "sdl_socket.h" //#include "x11_common.h" #include #include #include #ifdef HAVE_FCNTL_H #include #else #include #endif #include #include #include #include #include #if defined (sun) #include #endif /* * local constants */ #define CONNECT_TIMEOUT 60 #define ACCEPT_TIMEOUT 30 #define LISTENQ 5 #ifndef SHUT_WR #define SHUT_WR 1 #endif #ifndef MSG_DONTWAIT #define MSG_DONTWAIT 0 #endif /* * type definitions */ /* socket address */ typedef struct _xb_socket_address { socklen_t len; struct sockaddr *addr; } XBSocketAddress; /* fix for suns */ #ifdef sun typedef uint32_t u_int32_t; #endif /* socket data */ struct _xb_socket { int fd; /* file descriptor of socket */ XBSocketAddress sock; /* local address */ XBSocketAddress peer; /* remote address */ XBBool shutDown; /* shutodwn flag */ }; /* * local variables */ static int socketMax = 0; /* current max */ static fd_set socketReadSet; /* current read set */ static fd_set socketWriteSet; /* current write set */ /* interface list */ static XBSocketInterface *inter = NULL; static size_t numInter = 0; /* * local stuff */ /* * delete list with all interfaces */ static void DeleteInterfaces (void) { if (NULL != inter) { int i; for (i = 0; i < numInter; i++) { if (NULL != inter[i].name) { free (inter[i].name); } if (NULL != inter[i].addrDevice) { free (inter[i].addrDevice); } if (NULL != inter[i].addrBroadcast) { free (inter[i].addrBroadcast); } } free (inter); } inter = NULL; numInter = 0; } /* DeleteInterfaces */ /* * get inet address */ static u_int32_t GetAddressInet (const char *hostName) { int32_t addr; struct hostent *serverEnt; assert (hostName != NULL); /* check if ip string */ if (-1L != (addr = inet_addr (hostName))) { return ntohl (addr); } /* lookup hostname if not an ip string */ if (NULL != (serverEnt = gethostbyname (hostName))) { return ntohl (*(int32_t *) serverEnt->h_addr_list[0]); } /* lookup failed */ return 0L; } /* GetAddressInet */ /* * handler for SIGCHLD */ static void HandleSigChld (int sig_num) { int stat; pid_t child; while (0 < (child = waitpid (-1, &stat, WNOHANG))) { Dbg_Out ("child %d terminated\n", child); } } /* HandleSigChld */ /************************** * local socket debugging * **************************/ #ifdef DEBUG_SOCKET /* * print out an fdset */ static void DebugFdSet (const char *header, fd_set * set) { int i; Dbg_Socket ("%s:", header); for (i = 0; i <= socketMax; i++) { if (FD_ISSET (i, set)) { fprintf (stderr, " %d", i); } } fprintf (stderr, "\n"); } /* DebugFdSet */ /* * print out interface config */ static void DebugInterfaceData (const struct ifconf *ifConf) { size_t i; Dbg_Socket ("Interface Config (%u bytes)", ifConf->ifc_len); for (i = 0; i < ifConf->ifc_len; i++) { if (i % 8 == 0) { fprintf (stderr, "\n"); } fprintf (stderr, "%02x ", (unsigned)(unsigned char)ifConf->ifc_buf[i]); } fprintf (stderr, "\n"); } /* DebugInterfaceData */ #endif /********************* * socket management * *********************/ /* * initialisation routine */ XBBool Socket_Init (void) { static XBBool initDone = XBFalse; if (!initDone) { signal (SIGCHLD, HandleSigChld); signal (SIGPIPE, SIG_IGN); signal (SIGALRM, SIG_IGN); initDone = XBTrue; } /* clear fd_Set for sockets */ FD_ZERO (&socketReadSet); FD_ZERO (&socketWriteSet); Dbg_Socket ("initializing socket management\n"); return XBTrue; } /* Socket_Init */ /* * cleaning up */ void Socket_Finish (void) { } /* Socket_Finish */ /*************** * socket data * ***************/ /* * return file descriptor for socket */ int Socket_Fd (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->fd; } /* Socket_Fd */ /* * return adress family for socket */ int Socket_Family (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->sock.addr->sa_family; } /* Socket_Family */ /* * get host name of client */ const char * Socket_HostName (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); inetAddr = (struct sockaddr_in *)sa->addr; return inet_ntoa (inetAddr->sin_addr); } /* Socket_HostName */ /* * get port of host */ unsigned Socket_HostPort (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); inetAddr = (struct sockaddr_in *)sa->addr; return ntohs (inetAddr->sin_port); } /* Socket_HostPort */ /******************* * socket creation * *******************/ /* * create socket structure */ XBSocket * Socket_Alloc (int family) { int len; XBSocket *pSocket; /* require AF_INET */ switch (family) { case AF_INET: len = sizeof (struct sockaddr_in); break; default: Dbg_Socket ("AF_INET family required, socket not created\n"); return NULL; } /* alloc socket data structure */ pSocket = calloc (1, sizeof (XBSocket)); assert (NULL != pSocket); pSocket->fd = -1; /* out address */ pSocket->sock.len = len; pSocket->sock.addr = calloc (1, len); assert (NULL != pSocket->sock.addr); pSocket->sock.addr->sa_family = family; /* other addresse */ pSocket->peer.len = len; pSocket->peer.addr = calloc (1, len); assert (NULL != pSocket->peer.addr); pSocket->peer.addr->sa_family = family; /* set shutdown flags to false */ pSocket->shutDown = XBFalse; /* that's all */ return pSocket; } /* Socket_Alloc */ /* * free socket structure memory */ void Socket_Free (XBSocket * pSocket) { assert (NULL != pSocket); if (NULL != pSocket->sock.addr) { free (pSocket->sock.addr); } if (NULL != pSocket->peer.addr) { free (pSocket->peer.addr); } free (pSocket); } /* Socket_Free */ /* * set socket adress */ XBBool Socket_SetAddressInet (XBSocket * pSocket, XBBool peer, const char *hostName, unsigned short port) { XBSocketAddress *sa; u_int32_t addr; struct sockaddr_in *serverAddr; assert (NULL != pSocket); /* determine address structure to set */ sa = peer ? &pSocket->peer : &pSocket->sock; /* get host name in host byte order */ if (NULL != hostName) { if (0 == (addr = GetAddressInet (hostName))) { Dbg_Socket ("failed to set address %s:%u for fd=%u\n", hostName, port, pSocket->fd); return XBFalse; } } else { addr = INADDR_ANY; } /* now set the address */ assert (NULL != sa); memset (sa->addr, 0, sa->len); serverAddr = (struct sockaddr_in *)sa->addr; serverAddr->sin_family = AF_INET; serverAddr->sin_addr.s_addr = htonl (addr); serverAddr->sin_port = htons (port); Dbg_Socket ("set %s address %s:%u for fd=%u\n", peer ? "remote" : "local", hostName, port, pSocket->fd); return XBTrue; } /* Socket_SetAddressInet */ /* * enable or disable broadcast */ XBBool Socket_SetBroadcast (XBSocket * pSocket, XBBool enable) { int flag = enable ? 1 : 0; if (0 == setsockopt (pSocket->fd, SOL_SOCKET, SO_BROADCAST, &flag, sizeof (flag))) { Dbg_Socket ("successfully %s broadcast flag on socket fd=%u\n", enable ? "set" : "cleared", pSocket->fd); return XBTrue; } else { perror ("Socket_SetBroadcast"); Dbg_Socket ("failed to %s broadcast flag on socket fd=%u\n", enable ? "set" : "cleared", pSocket->fd); return XBFalse; } } /* Socket_SetBroadcast */ /* * set socket option reuse */ XBBool Socket_SetReuse (XBSocket * pSocket) { int so_reuseaddr = 1; if (-1 == setsockopt (pSocket->fd, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof (so_reuseaddr))) { return XBFalse; } /* that's all */ return XBTrue; } /* Socket_SetReuse */ /* * register socket for reading */ void Socket_RegisterRead (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd > socketMax) { socketMax = pSocket->fd; } FD_SET (pSocket->fd, &socketReadSet); #ifdef DEBUG_SOCKET DebugFdSet ("read fd_set", &socketReadSet); #endif } /* Socket_RegisterRead */ /* * register socket for writing */ void Socket_RegisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd > socketMax) { socketMax = pSocket->fd; } FD_SET (pSocket->fd, &socketWriteSet); #ifdef DEBUG_SOCKET DebugFdSet ("Socket_RegisterWrite write fd_set", &socketWriteSet); #endif } /* Socket_RegisterWrite */ /* * unregister socket for reading */ void Socket_UnregisterRead (XBSocket * pSocket) { assert (NULL != pSocket); FD_CLR (pSocket->fd, &socketReadSet); #ifdef DEBUG_SOCKET DebugFdSet ("read fd_set", &socketReadSet); #endif } /* socket_UnregisterRead */ /* * register socket for writing */ void Socket_UnregisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); FD_CLR (pSocket->fd, &socketWriteSet); #ifdef DEBUG_SOCKET DebugFdSet ("Socket_UnregisterWrite write fd_set", &socketWriteSet); #endif } /* Socket_UnregisterWrite */ /************* * BSD calls * *************/ /* * open socket */ XBBool Socket_Open (XBSocket * pSocket, int type) { assert (pSocket != NULL); /* now create a stream socket */ if (-1 == (pSocket->fd = socket (pSocket->sock.addr->sa_family, type, 0))) { perror ("Socket_Open"); Dbg_Socket ("failed to open socket of type=%i", type); return XBFalse; } Dbg_Socket ("open socket fd=%u (type=%i)\n", pSocket->fd, type); return XBTrue; } /* Socket_Open */ /* * close socket */ void Socket_Close (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd < 0 || pSocket->shutDown) { return; } if (0 != close (pSocket->fd)) { perror ("Socket_Close"); Dbg_Socket ("error while closing socket fd=%u\n", pSocket->fd); } else { pSocket->shutDown = XBTrue; Dbg_Socket ("socket fd=%u closed\n", pSocket->fd); } } /* Socket_Close */ /* * close write access */ void Socket_ShutdownWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd < 0 || pSocket->shutDown) { return; } if (0 != shutdown (pSocket->fd, SHUT_WR)) { perror ("Socket_ShutdownWrite"); Dbg_Socket ("error while shutting down socket fd=%u: ", pSocket->fd); } else { Dbg_Socket ("socket fd=%u shutdown write\n", pSocket->fd); pSocket->shutDown = XBTrue; } } /* Socket_ShutdownWrite */ /* * connect a socket */ XBBool Socket_Connect (XBSocket * pSocket) { assert (pSocket != NULL); /* try to connect, set timeout */ alarm (CONNECT_TIMEOUT); if (-1 == connect (pSocket->fd, pSocket->peer.addr, pSocket->peer.len)) { perror ("Socket_Connect"); alarm (0); Dbg_Socket ("failed to connect socket fd=%u to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); return XBFalse; } alarm (0); /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Connect(getsockname)"); Dbg_Socket ("failed to get local address of socket fd=%u after connecting\n", pSocket->fd); return XBFalse; } Dbg_Socket ("socket fd=%u connected to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); return XBTrue; } /* Socket_Connect */ /* * bind a socket */ XBBool Socket_Bind (XBSocket * pSocket) { /* bind to port */ if (-1 == bind (pSocket->fd, pSocket->sock.addr, pSocket->sock.len)) { perror ("Socket_Bind"); Dbg_Socket ("failed to bind socket fd=%u\n", pSocket->fd); return XBFalse; } /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Bind(getsockname)"); Dbg_Socket ("failed to get local address of socket fd=%u after binding\n", pSocket->fd); return XBFalse; } /* that's all */ Dbg_Socket ("socket fd=%u bound to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBTrue; } /* Socket_Bind */ /* * accept a socket */ XBBool Socket_Accept (XBSocket * pSocket, const XBSocket * pListen) { assert (pSocket != NULL); assert (pListen != NULL); /* try to accept, set timeout */ alarm (ACCEPT_TIMEOUT); if (-1 == (pSocket->fd = accept (pListen->fd, pSocket->peer.addr, (void *)&pSocket->peer.len))) { perror ("Socket_Accept"); alarm (0); Dbg_Socket ("failed to accept from socket fd=%u\n", pListen->fd); return XBFalse; } alarm (0); /* now retrieve local adresse */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Accept(getsockname)"); Dbg_Socket ("failed to get local address from accepted socket fd=%u\n", pListen->fd); return XBFalse; } /* that's all */ Dbg_Out ("accepted socket fd=%u from socket fd=%u\n", pSocket->fd, pListen->fd); return XBTrue; } /* Socket_Accept */ /* * listen on socket */ XBBool Socket_Listen (XBSocket * pSocket) { assert (pSocket != NULL); /* now listen for client to connect */ if (0 != listen (pSocket->fd, LISTENQ)) { perror ("Socket_Listen"); Dbg_Socket ("failed to listen on socket fd=%u (%s:%u)\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBFalse; } Dbg_Socket ("listening on socket fd=%u (%s:%u)\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBTrue; } /* Socket_Listen */ /* * write to socket, non blocking i/o assumed */ int Socket_Send (const XBSocket * pSocket, const void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to write */ result = send (pSocket->fd, buf, len, MSG_DONTWAIT); if (result < 0) { perror ("Socket_Send"); if (EAGAIN == errno) { Dbg_Socket ("send on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("send error on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Send */ /* * write to socket, given target, non blocking i/o assumed */ int Socket_SendTo (XBSocket * pSocket, const void *buf, size_t len, const char *host, unsigned short port) { int result; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* convert destination adress */ if (!Socket_SetAddressInet (pSocket, XBTrue, host, port)) { Dbg_Socket ("failed to send on fd=%u - failed to resolve %s:%u", pSocket->fd, host, port); return -1; } /* now try to write data */ result = sendto (pSocket->fd, buf, len, MSG_DONTWAIT, pSocket->peer.addr, pSocket->peer.len); if (result < 0) { perror ("Socket_SendTo"); if (EAGAIN == errno) { Dbg_Socket ("sendto on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("sendto error on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u to %s:%u\n", result, pSocket->fd, host, port); return result; } /* Socket_SendTo */ /* * read from socket */ int Socket_Receive (const XBSocket * pSocket, void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to read */ result = recv (pSocket->fd, buf, len, 0); if (result < 0) { perror ("Socket_Receive"); if (EAGAIN == errno) { Dbg_Socket ("receive on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receive on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("received %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Receive */ /* * read from socket, get sender */ int Socket_ReceiveFrom (XBSocket * pSocket, void *buf, size_t len, const char **host, unsigned short *port) { ssize_t numRead; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* try to read */ numRead = recvfrom (pSocket->fd, buf, len, 0, pSocket->peer.addr, (void *)&pSocket->peer.len); if (numRead > 0) { *host = Socket_HostName (pSocket, XBTrue); *port = Socket_HostPort (pSocket, XBTrue); } else { perror ("Socket_ReceiveFrom"); *host = NULL; *port = 0; if (numRead < 0) { if (EAGAIN == errno) { Dbg_Socket ("receivefrom on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receivefrom on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } } Dbg_Socket ("received %lu bytes on fd=%u from %s:%u\n", (unsigned long)numRead, pSocket->fd, *host, *port); return numRead; } /* Socket_ReceiveFrom */ /************** * interfaces * **************/ /* * Get list of all network interfaces */ static struct ifconf * GetInterfaceConfig (int fd) { size_t len, lastLen; char *buf = NULL; struct ifconf *ifconf; ifconf = malloc (sizeof (struct ifconf)); assert (ifconf); lastLen = 0; for (len = 10 * sizeof (struct ifreq);; len += 10 * sizeof (struct ifreq)) { /* alloc buffer to receive data */ buf = calloc (1, len); assert (NULL != buf); ifconf->ifc_len = len; ifconf->ifc_buf = buf; /* query list of interfaces */ if (-1 == ioctl (fd, SIOCGIFCONF, ifconf)) { if (errno != EINVAL || lastLen != 0) { free (buf); free (ifconf); return NULL; } } else if (ifconf->ifc_len == lastLen) { /* success */ return ifconf; } else { /* net new length */ lastLen = ifconf->ifc_len; } /* next guess */ free (buf); } free (ifconf); return NULL; } /* GetInterfaceConfig */ /* * check if single interface is acceptable */ static XBBool GetSingleInterface (int fd, XBSocketInterface * pInter, const char *ifname) { struct sockaddr_in inetDevice; struct sockaddr_in inetBroadcast; struct ifreq ifreq; short flags; /* TODO: the previous code seemed to think we could get AF_INET6 * addresses. In that case, ifreq might be too small to hold IPv6 * addresses on some platforms. */ strcpy (ifreq.ifr_name, ifname); ifreq.ifr_addr.sa_family = AF_INET; if (ioctl (fd, SIOCGIFADDR, &ifreq) == -1) { Dbg_Out ("SIOCGIFADDR failed for interface %s, rejecting\n", ifname); return XBFalse; } inetDevice = *(struct sockaddr_in *)&ifreq.ifr_addr; /* get flags */ strcpy (ifreq.ifr_name, ifname); ifreq.ifr_addr.sa_family = AF_INET; if (ioctl (fd, SIOCGIFFLAGS, &ifreq) == -1) { Dbg_Out ("failed to get flags for interface %s, rejecting\n", ifname); return XBFalse; } flags = ifreq.ifr_flags; /* try to get broadcast adress */ if (IFF_BROADCAST & flags) { strcpy (ifreq.ifr_name, ifname); ifreq.ifr_addr.sa_family = AF_INET; if (-1 != (ioctl (fd, SIOCGIFBRDADDR, &ifreq))) { inetBroadcast = *(struct sockaddr_in *)&ifreq.ifr_broadaddr; } else { flags &= ~IFF_BROADCAST; } } /* show data so far */ Dbg_Out ("IP = %s\n", inet_ntoa (inetDevice.sin_addr)); Dbg_Out ("BC = %s\n", flags & IFF_BROADCAST ? inet_ntoa (inetBroadcast.sin_addr) : "n/a"); /* check if interface is down */ if (!(IFF_UP & flags)) { Dbg_Out ("interface is down, rejecting\n"); return XBFalse; } Dbg_Out ("interface is up\n"); /* store data */ pInter->name = DupString (ifname); pInter->addrDevice = DupString (inet_ntoa (inetDevice.sin_addr)); pInter->addrBroadcast = flags & IFF_BROADCAST ? DupString (inet_ntoa (inetBroadcast.sin_addr)) : NULL; return XBTrue; } /* GetSingleInterface */ /* * list available interfaces */ const XBSocketInterface * Socket_GetInterfaces (size_t * pNum) { int fd; int maxInter; int cur; struct ifconf *ifconf = NULL; assert (pNum != NULL); /* clean up */ DeleteInterfaces (); /* open UDP socket for testing */ fd = socket (AF_INET, SOCK_DGRAM, 0); if (fd == -1) { Dbg_Socket ("failed to get socket for interface detection\n"); goto Error; } /* get config */ ifconf = GetInterfaceConfig (fd); if (ifconf == NULL) { Dbg_Socket ("failed to get interface data\n"); goto Error; } /* alloc result buffer */ numInter = 0; maxInter = ifconf->ifc_len / sizeof (struct ifreq); inter = calloc (maxInter, sizeof (XBSocketInterface)); if (inter == NULL) { Dbg_Socket ("failed to allocate inter buffer\n"); goto Error; } /* now walk through buffer */ for (cur = 0; cur < maxInter; cur++) { struct ifreq *ifreq = &ifconf->ifc_req[cur]; Dbg_Out ("### interface %s ###\n", ifreq->ifr_name); if (GetSingleInterface (fd, &inter[numInter], ifreq->ifr_name)) { numInter++; } } /* clean up */ free (ifconf->ifc_buf); free (ifconf); close (fd); /* that's all */ *pNum = numInter; return inter; Error: if (ifconf) { if (ifconf->ifc_buf) free (ifconf->ifc_buf); free (ifconf); } if (-1 != fd) { close (fd); } DeleteInterfaces (); *pNum = 0; return NULL; } /* Socket_GetInterfaces */ /***************** * socket events * *****************/ /* * handle select */ void SelectSockets (struct timeval *timeout) { int fd; fd_set rdfs; fd_set wrfs; /* poll network sockets */ rdfs = socketReadSet; wrfs = socketWriteSet; select (socketMax + 1, &rdfs, &wrfs, NULL, timeout); /* check each socket */ for (fd = 0; fd <= socketMax; fd++) { /* socket is readable */ if (FD_ISSET (fd, &rdfs)) { CommReadable (fd); } if (FD_ISSET (fd, &wrfs)) { CommWriteable (fd); } } } xblast-2.10.4/sdl_socket.h0000644000175000017500000000206410375621557014530 0ustar rhondaalfie/* * file sdl_socket.h - true bsd sockets for xblast * * $Id: sdl_socket.h,v 1.5 2006/02/18 13:38:55 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_SOCKET_H #define XBLAST_SDL_SOCKET_H /* * global prototypes */ extern void SelectSockets (struct timeval *timeout); #endif /* * end of file sdl_socket.h */ xblast-2.10.4/sdl_sound.c0000644000175000017500000002670710443517466014374 0ustar rhondaalfie/* * file x11_sound.c - sound via xbsndsrv or bell * * $Id: sdl_sound.c,v 1.9 2006/06/13 11:19:18 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "SDL_mixer.h" /* * local constants */ /* values to be used in acknowledge pipe */ #define SND_ACK_OK 0 #define SND_ACK_ERROR 1 typedef short s16; static struct _sound_name { int sound_id; /* the sound's id to refer to it */ const char *name; /* raw samples data file name */ uint8_t *samples; /* pointer to samples memory */ int length; /* length in samples of the sound */ int repeat; /* repeat flag to play sound endlessly */ int mono; /* mono flag indicating mono sounds */ } sound_name[] = { { SND_BAD, "xb_bad.raw", NULL, 0, XBFalse, XBFalse}, /* got a skull */ { SND_DROP, "xb_drop.raw", NULL, 0, XBFalse, XBTrue}, /* dropped a bomb */ { SND_NEWBOMB, "xbnbmb.raw", NULL, 0, XBFalse, XBTrue}, /* got an extra bomb */ { SND_NEWKICK, "xbnkick.raw", NULL, 0, XBFalse, XBTrue}, /* got kick extra */ { SND_NEWPUMP, "xbnpmp.raw", NULL, 0, XBFalse, XBTrue}, /* got pump extra */ { SND_NEWRC, "xbnrc.raw", NULL, 0, XBFalse, XBTrue}, /* got rem. control */ { SND_MOREFIRE, "xbfire.raw", NULL, 0, XBFalse, XBTrue}, /* got more range */ { SND_DEAD, "xb_dead.raw", NULL, 0, XBFalse, XBFalse}, /* player died */ { SND_EXPL, "xb_expl.raw", NULL, 0, XBFalse, XBTrue}, /* normal explosion */ { SND_KICK, "xb_kick.raw", NULL, 0, XBFalse, XBTrue}, /* kick a bomb */ { SND_PUMP, "xb_pump.raw", NULL, 0, XBFalse, XBTrue}, /* pump a bomb */ { SND_OUCH, "xb_ouch.raw", NULL, 0, XBFalse, XBFalse}, /* player lost life */ { SND_INTRO, "xb_intro.raw", NULL, 0, XBFalse, XBFalse}, /* intro fanfare */ { SND_APPL, "xb_appl.raw", NULL, 0, XBFalse, XBFalse}, /* applause */ { SND_APPL2, "xb_app2.raw", NULL, 0, XBFalse, XBFalse}, /* applause */ { SND_BUTT, "xb_butt.raw", NULL, 0, XBFalse, XBTrue}, /* triggered button */ { SND_SHOOT, "xb_shoot.raw", NULL, 0, XBFalse, XBFalse}, /* using rem. ctrl. */ { SND_INVIS, "xb_nvis.raw", NULL, 0, XBFalse, XBFalse}, /* player invisible */ { SND_INVINC, "xb_nvnc.raw", NULL, 0, XBFalse, XBFalse}, /* player invincible */ { SND_NEWTELE, "xbntel.raw", NULL, 0, XBFalse, XBTrue}, /* player got telep. */ { SND_TELE, "xbtele.raw", NULL, 0, XBFalse, XBTrue}, /* player uses tele. */ { SND_INJ, "xbinj.raw", NULL, 0, XBFalse, XBFalse}, /* player got junkie */ { SND_MINIBOMB, "xbmbmb.raw", NULL, 0, XBFalse, XBTrue}, /* small bomb expl. */ { SND_WON, "xb_won.raw", NULL, 0, XBFalse, XBFalse}, /* player won */ { SND_HAUNT, "xb_haunt.raw", NULL, 0, XBFalse, XBFalse}, /* haunting bomb */ { SND_SPIRAL, "xb_spir.raw", NULL, 0, XBFalse, XBTrue}, /* spiral shrinking */ { SND_SPBOMB, "xb_spbmb.raw", NULL, 0, XBFalse, XBTrue}, /* got special bomb */ { SND_SLIDE, "xbslide.raw", NULL, 0, XBFalse, XBTrue}, /* bomb slide sound */ { SND_FINALE, "xbfin.raw", NULL, 0, XBFalse, XBFalse}, /* final fanfare */ { SND_WARN, "xb_warn.raw", NULL, 0, XBFalse, XBFalse}, /* shrink warn sound */ { SND_STUN, "xb_stun.raw", NULL, 0, XBFalse, XBFalse}, /* player stun sound */ { SND_WHIRL, "xb_whrl.raw", NULL, 0, XBTrue, XBFalse}, /* intro whirl */ { SND_COMPOUND, "xb_cmpnd.raw", NULL, 0, XBFalse, XBFalse}, /* compound shrink */ { SND_TELE1, "xbtele1.raw", NULL, 0, XBFalse, XBTrue}, /* teleport start */ { SND_TELE2, "xbtele2.raw", NULL, 0, XBFalse, XBTrue}, /* teleport end */ { SND_HOLY, "xbholy.raw", NULL, 0, XBFalse, XBFalse}, /* holy grail extra */ { SND_ENCLOAK, "xbcloak.raw", NULL, 0, XBFalse, XBTrue}, /* encloak sound */ { SND_DECLOAK, "xbdcloak.raw", NULL, 0, XBFalse, XBTrue}, /* decloak sound */ { SND_FAST, "xbfast.raw", NULL, 0, XBFalse, XBTrue}, /* speed up extra */ { SND_SLOW, "xbslow.raw", NULL, 0, XBFalse, XBTrue}, /* slow down extra */ { SND_SLAY, "xbslay.raw", NULL, 0, XBFalse, XBTrue}, /* slay extra */ { SND_LIFE, "xblife.raw", NULL, 0, XBFalse, XBTrue}, /* extra life */ { SND_NEWCLOAK, "xbcloakx.raw", NULL, 0, XBFalse, XBTrue}, /* new cloak extra */ { SND_BOMBMORPH, "xb_bombmorph.raw", NULL, 0, XBFalse, XBTrue}, /* bomb morph */ { SND_STEP1, "xbstep1.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #1 */ { SND_STEP2, "xbstep2.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #2 */ { SND_STEP3, "xbstep3.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #3 */ { SND_STEP4, "xbstep4.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #4 */ { SND_STEP5, "xbstep5.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #5 */ { SND_STEP6, "xbstep6.raw", NULL, 0, XBFalse, XBTrue}, /* Backgr. song #6 */ { SND_SNG1, "xbsng1.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #1 */ { SND_SNG2, "xbsng2.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #2 */ { SND_SNG3, "xbsng3.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #3 */ { SND_SNG4, "xbsng4.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #4 */ { SND_SNG5, "xbsng5.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #5 */ { SND_SNG6, "xbsng6.raw", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #6 */ { SND_MAX, NULL, NULL, 0} }; static Mix_Chunk *sound_chunk[SND_MAX]; static int sound_channel[SND_MAX]; /* SUBSIZE small so no delay for playing... maybe a better solution should be there, since it is not nice sending all and dont using the buffer. */ #define SUBSIZE 128 #define SOUND_DEVICE "/dev/dsp" #define SAMPLE_RATE 22050 /* SDL_Mixer doesn't allow one channel with left and right, so we need 2 output channels */ #define SAMPLE_CHANNELS 2 #define SAMPLE_SIZE AUDIO_U8 static int mono_mode = XBFalse; /* * local variables */ static XBBool isActive = XBFalse; static XBBool boom = XBFalse; static XBBool soundInitialized = XBFalse; /* * Open Audio */ XBBool SND_Init (const CFGSoundSetup * setup) { int i; assert (NULL != setup); /* mode selection */ switch (setup->mode) { case XBSM_Waveout: isActive = XBTrue; break; case XBSM_Beep: isActive = XBTrue; return XBTrue; case XBSM_None: /* no sound at all */ isActive = XBFalse; return XBTrue; default: return XBFalse; } /* Initialize SDL_mixer stuff */ /* init audio */ if (Mix_OpenAudio (SAMPLE_RATE, SAMPLE_SIZE, SAMPLE_CHANNELS, SUBSIZE) != 0) { fprintf (stderr, "Error: Couldn't initializate audio\n" "Possible reason: %s\n", Mix_GetError ()); return XBFalse; } /* Add more mixing channels. The default of MIX_CHANNELS (8) is * not enough when there is many bombs. Is the new number too big * for slow machines? */ Mix_AllocateChannels(20); /* reset sound stuff */ for (i = 0; i < SND_MAX; i++) { sound_chunk[i] = NULL; sound_channel[i] = -1; } soundInitialized = XBTrue; return XBTrue; } /* SND_Init */ /* * Stop Audio */ XBBool SND_Stop (SND_Id id) { if (soundInitialized) { if (id == STOP_ALL_SOUNDS) { Mix_HaltChannel (-1); } else // stop specific sound { if (sound_channel[id] != -1) Mix_HaltChannel (sound_channel[id]); sound_channel[id] = -1; } } return XBTrue; } /* SND_Stop */ /* * Play sound and set right position, */ XBBool SND_Play (SND_Id id, int position) { if (soundInitialized) { // do a stereo effect int col1 = 255 - ((position * 255) / MAX_SOUND_POSITION); int col2 = (position * 255) / MAX_SOUND_POSITION; /* When there is too many bombs on the screen, * this function will fails. */ sound_channel[id] = Mix_PlayChannel (-1, sound_chunk[id], 0); if (sound_channel[id] != -1) { /* Panning must be after the channel opened, * since we dont know the channel before */ if (!Mix_SetPanning (sound_channel[id], col2, col1)) { fprintf (stderr, "Mix_SetPanning(%d, %d, %d) failed!\n", sound_channel[id], col1, col2); fprintf (stderr, "Reason: [%s].\n", Mix_GetError ()); } } } else { /* beep at next frame */ if (SND_MINIBOMB == id || SND_EXPL == id) { boom = XBTrue; } } return XBTrue; } /* SND_Play */ /* * beep once */ void SND_Beep (void) { /* TODO XBell (dpy, 80); */ } /* SND_Beep */ /* * Load sound */ XBBool SND_Load (SND_Id id) { if (soundInitialized) { /* First load RAW into memory */ char fname[1000]; int i, f; static char *path_list[3] = { NULL, GAME_DATADIR "/", ".", }; /* check environment for xblast search path */ path_list[0] = getenv ("XBLASTDIR"); for (i = 0; i < 3; i++) { if (path_list[i] != NULL) { sprintf (fname, "%s/%s/%s", path_list[i], "sounds", sound_name[id].name); if ((f = open (fname, O_RDONLY)) >= 0) { int sound_size; uint8_t *sb, *sb1; struct stat snd_stat; #ifdef DEBUG fprintf (stderr, "Opened file \"%s\".\n", fname); #endif (void)fstat (f, &snd_stat); sound_size = snd_stat.st_size / sizeof (uint8_t); if (sound_name[id].samples != NULL) { free (sound_name[id].samples); sound_name[id].samples = NULL; sound_name[id].length = 0; } if ((sb = malloc (sound_size * sizeof (uint8_t))) == NULL) { close (f); return (-1); } else { read (f, sb, sound_size * sizeof (uint8_t)); close (f); #if defined(SERVER_STATISTICS) total_loaded++; #endif /* make sound Stereo although mono... blame SDL_mixer same problem as the 2 channels issue */ if (mono_mode != XBTrue && sound_name[id].mono == XBTrue) { if ((sb1 = malloc (2 * sound_size * sizeof (uint8_t))) == NULL) { free (sb); return (-1); } for (i = 0; i < sound_size; i++) { sb1[2*i] = sb1[2*i + 1] = sb[i]; } /* we free sb afterwards so we need to pass sb1 to sb */ free (sb); sb = sb1; sound_size *= 2; } sound_name[id].samples = sb; sound_name[id].length = sound_size; /* * convert stereo samples to mono if running in mono mode */ if (mono_mode == XBTrue && sound_name[id].mono == XBFalse) { int i; uint8_t *m, *s; s16 sum; m = s = sound_name[id].samples; sound_name[id].length >>= 1; for (i = 0; i < sound_name[id].length; i++) { sum = *s + *(s + 1); *m++ = sum >> 1; s += 2; } } if (!(sound_chunk[id] = Mix_QuickLoad_RAW (sb, sound_name[id].length))) fprintf (stderr, "Warning: Could not open RAW from memory: %s\n", Mix_GetError ()); break; } } else { fprintf (stderr, "Couldnt open file \"%s\".\n", fname); } } } } return XBTrue; } /* SND_Load */ /* * */ XBBool SND_Unload (SND_Id id) { if (soundInitialized) { Mix_FreeChunk (sound_chunk[id]); } return XBTrue; } /* SND_Unload */ /* * */ void SND_Flush (void) { if (isActive && boom) { boom = XBFalse; } } /* SND_Flush */ /* * */ void SND_Finish (void) { Mix_CloseAudio (); soundInitialized = XBFalse; } /* SND_Finish */ xblast-2.10.4/sdl_sound.h0000644000175000017500000000202510370736746014367 0ustar rhondaalfie/* * file sdl_sound.h - sound support for linux * * $Id: sdl_sound.h,v 1.2 2006/02/03 20:32:38 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_SOUND_H #define XBLAST_SDL_SOUND_H /* * global prototypes */ extern void HandleSound (int); #endif /* * end of file sdl_sound.h */ xblast-2.10.4/sdl_sprite.c0000644000175000017500000002616710373126075014544 0ustar rhondaalfie/* * file x11c_sprite.c - drawing sprites under X11 * * $Id: sdl_sprite.c,v 1.6 2006/02/10 15:07:41 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * local variables */ static SDL_Surface *SpriteBits; static SDL_Surface *pixBombMask[MAX_BOMBS][MAX_BOMB_ANIME]; static SDL_Surface *pixBombBits[MAX_BOMBS][MAX_BOMB_ANIME]; static SDL_Surface *pixExplMask[MAX_EXPLOSION]; static SDL_Surface *pixExplBits[MAX_EXPLOSION]; static SDL_Surface *pixEpmSpriteBits[MAX_PLAYER][MAX_ANIME_EPM]; static SDL_Surface *pixEpmSpriteMask[MAX_PLAYER][MAX_ANIME_EPM]; static SDL_Surface *pixPpmSpriteBits[MAX_ANIME_PPM]; static SDL_Surface *pixPpmSpriteMask[MAX_ANIME_PPM]; static SDL_Surface *pixIconBits[MAX_ICON_SPRITES]; static SDL_Surface *pixIconMask[MAX_ICON_SPRITES]; static CFGPlayerGraphics gfxPlayer[MAX_PLAYER]; static const XBColor colorIcon[MAX_ICON_SPRITES] = { COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_RED, COLOR_SPRING_GREEN, COLOR_GRAY_75, COLOR_RED, COLOR_GREEN, COLOR_BLUE, }; static void InvertBlackAndWhiteSurface (SDL_Surface * mask) { int x, y; Uint32 pixel; for (y = 0; y < mask->h; y++) { for (x = 0; x < mask->w; x++) { pixel = getpixel (mask, x, y); putpixel (mask, x, y, !pixel * 0xffffffff); } } SDL_SetColorKey (mask, SDL_SRCCOLORKEY | SDL_RLEACCEL, 0); SDL_UpdateRect (mask, 0, 0, 0, 0); GUI_FlushPixmap (XBFalse); } /** * Apply the mask over the sprite image and set the * transparent colorkey to specified sdl_color. * sdl_color should respect the format specified * in sprite's surface->format. * ie. If sprite is 8bpp, keep sdl_color < 256. */ static void MaskSprite (SDL_Surface * mask, SDL_Surface * sprite, Uint32 sdl_color) { SDL_Color colors[2] = { {0, 0, 0, 0}, {0xFF, 0xFF, 0xFF, 0} }; SDL_Color dst_colors[2] = { {0, 0, 0, 0}, {0xFF, 0xFF, 0xFF, 0} }; SDL_Palette palette = { 2, colors }; SDL_PixelFormat format = { &palette, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; SDL_Surface *temp; Uint8 red, green, blue; temp = SDL_ConvertSurface (mask, &format, SDL_SRCCOLORKEY); assert (temp); SDL_GetRGB (sdl_color, sprite->format, &red, &green, &blue); dst_colors[1].r = red; dst_colors[1].g = green; dst_colors[1].b = blue; SDL_SetColors (temp, dst_colors, 0, 2); SDL_SetColorKey (temp, SDL_SRCCOLORKEY | SDL_RLEACCEL, mask->format->colorkey); SDL_SetColorKey (sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, sdl_color); SDL_BlitSurface (temp, NULL, sprite, NULL); SDL_FreeSurface (temp); } /* does the same as above but tries to avoid the problems of ppm has black and pbm has also black so letting some parts of the bomb be invisible like the shadow... */ static void MaskBombSprite (SDL_Surface * mask, SDL_Surface * sprite, Uint32 sdl_color) { int i, j; Uint32 bla, scolor; bla = SDL_MapRGB (mask->format, 0, 0, 0); scolor = SDL_MapRGB (sprite->format, 0xff, 0, 0); for (j = 0; j < mask->h; j++) { for (i = 0; i < mask->w; i++) { if (getpixel (mask, i, j) > bla) { putpixel (sprite, i, j, scolor); } } } SDL_SetColorKey (sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, scolor); } /* * local function init_sprites_color */ XBBool InitSprites (void) { int i, j; // TODO: Choose a different ColorKey for transparency. // all whites are transparent :( SpriteBits = screen; /* bomb sprites */ for (i = 0; i < MAX_BOMBS; i++) { for (j = 0; j < MAX_BOMB_ANIME; j++) { pixBombMask[i][j] = ReadPbmBitmap (imgPathExpl, imgFileBomb[i][j]); pixBombBits[i][j] = ReadRgbPixmap (imgPathExpl, imgFileBomb[i][j]); //MaskSprite(pixBombMask[i][j], pixBombBits[i][j], SDL_MapRGB(pixBombBits[i][j]->format, 1, 1, 0)); MaskBombSprite (pixBombMask[i][j], pixBombBits[i][j], SDL_MapRGB (pixBombBits[i][j]->format, 1, 1, 0)); InvertBlackAndWhiteSurface (pixBombMask[i][j]); if ((NULL == pixBombBits[i][j]) || (NULL == pixBombMask[i][j])) { return XBFalse; } } } /* create explosion sprites */ for (i = 0; i < MAX_EXPLOSION; i++) { /* mask */ pixExplMask[i] = ReadPbmBitmap (imgPathExpl, imgFileExpl[i]); pixExplBits[i] = ReadRgbPixmap (imgPathExpl, imgFileExpl[i]); MaskSprite (pixExplMask[i], pixExplBits[i], SDL_MapRGB (pixExplBits[i]->format, 0, 1, 0)); if ((NULL == pixExplBits[i]) || (NULL == pixExplMask[i])) { return XBFalse; } } /* set default value for player sprites */ for (i = 0; i < MAX_PLAYER; i++) { for (j = 0; j < MAX_ANIME_EPM; j++) { pixEpmSpriteBits[i][j] = pixEpmSpriteMask[i][j] = NULL; gfxPlayer[i].shape = ATOM_INVALID; gfxPlayer[i].helmet = COLOR_INVALID; gfxPlayer[i].face = COLOR_INVALID; gfxPlayer[i].body = COLOR_INVALID; gfxPlayer[i].handsFeet = COLOR_INVALID; gfxPlayer[i].armsLegs = COLOR_INVALID; gfxPlayer[i].white = COLOR_INVALID; } } /* create shared players sprites */ for (j = 0; j < MAX_ANIME_PPM; j++) { pixPpmSpriteBits[j] = ReadRgbPixmap (imgPathSprite, imgFileSpritePpm[j]); pixPpmSpriteMask[j] = ReadPbmBitmap (imgPathSprite, imgFileSpritePpm[j]); MaskSprite (pixPpmSpriteMask[j], pixPpmSpriteBits[j], SDL_MapRGB (pixPpmSpriteBits[j]->format, 1, 1, 1)); InvertBlackAndWhiteSurface (pixPpmSpriteMask[j]); if ((NULL == pixPpmSpriteBits[j]) || (NULL == pixPpmSpriteMask[j])) { return XBFalse; } } /* load all icons soprites */ for (i = 0; i < MAX_ICON_SPRITES; i++) { pixIconBits[i] = ReadCchPixmap (imgPathMisc, imgFileIcon[i], COLOR_BLACK, colorIcon[i], COLOR_LIGHT_GOLDENROD); pixIconMask[i] = ReadPbmBitmap (imgPathMisc, imgFileIcon[i]); MaskSprite (pixIconMask[i], pixIconBits[i], SDL_MapRGB (pixIconBits[i]->format, 1, 1, 1)); } /* that's all */ return XBTrue; } /* Init Sprites */ /* * load a single player sprite animation */ XBBool GUI_LoadPlayerSprite (int player, int anime, const CFGPlayerGraphics * config) { int i; const char *epmName; assert (player < MAX_PLAYER); assert (config != NULL); if (!ComparePlayerGraphics (config, gfxPlayer + player)) { /* graphics has changed => delete all loaded pixmaps */ for (i = 0; i < MAX_ANIME_EPM; i++) { if (NULL != pixEpmSpriteBits[player][i]) { SDL_FreeSurface (pixEpmSpriteBits[player][i]); pixEpmSpriteBits[player][i] = NULL; } if (NULL != pixEpmSpriteMask[player][i]) { SDL_FreeSurface (pixEpmSpriteMask[player][i]); pixEpmSpriteMask[player][i] = NULL; } } gfxPlayer[player] = *config; } /* check if loading of pixmap is needed */ if (ATOM_INVALID == config->shape) { pixEpmSpriteBits[player][anime] = NULL; pixEpmSpriteMask[player][anime] = NULL; } else { epmName = ImgFileSpriteEpm (config->shape, anime); if (NULL == pixEpmSpriteBits[player][anime]) { pixEpmSpriteBits[player][anime] = ReadEpmPixmap (imgPathSprite, epmName, NUM_PLAYER_COLORS, &config->helmet); if (NULL == pixEpmSpriteBits[player][anime]) { return XBFalse; } } if (NULL == pixEpmSpriteMask[player][anime]) { pixEpmSpriteMask[player][anime] = ReadPbmBitmap (imgPathSprite, epmName); InvertBlackAndWhiteSurface (pixEpmSpriteMask[player][anime]); if (NULL == pixEpmSpriteMask[player][anime]) { return XBFalse; } } } return XBTrue; } /* GUI_LoadPlayerSprite */ /* * */ void GUI_LoadIconSprite (int index, XBColor color) { assert (index >= 0); assert (index < MAX_COLOR_SPRITES); /* load sprite */ if (pixIconBits[index] != NULL) { SDL_FreeSurface (pixIconBits[index]); } if (pixIconMask[index] != NULL) { SDL_FreeSurface (pixIconMask[index]); } pixIconBits[index] = ReadCchPixmap (imgPathMisc, imgFileIcon[index], COLOR_BLACK, color, COLOR_LIGHT_GOLDENROD); pixIconMask[index] = ReadPbmBitmap (imgPathMisc, imgFileIcon[index]); } /* GUI_LoadColorSprite */ /* * draw a masked sprite */ static void DrawSprite (const BMRectangle * rect, SDL_Surface * bits, SDL_Surface * mask) { SDL_Rect r; /* test values */ assert (rect != NULL); assert (mask != NULL); assert (bits != NULL); /* draw it */ r.x = rect->x; r.y = rect->y; r.w = rect->w; r.h = rect->h; SDL_BlitSurface (bits, NULL, screen, &r); } /* DrawSprite */ /* * draw mask of sprite */ static void DrawMask (const BMRectangle * rect, SDL_Surface * mask) { SDL_Rect r; assert (rect != NULL); assert (mask != NULL); r.x = rect->x; r.y = rect->y; r.w = rect->w; r.h = rect->h; SDL_BlitSurface (mask, NULL, screen, &r); } /* DrawMask */ /* * */ void CopyExplosion (SDL_Surface * pix_tile, int i) { SDL_BlitSurface (pixExplBits[i], NULL, pix_tile, NULL); } /* CopyExplosion */ /* * public function : draw_explosion */ void GUI_DrawExplosionSprite (int x, int y, int block) { BMRectangle rect; assert (block < MAX_EXPLOSION); rect.x = x * BLOCK_WIDTH; rect.y = y * BLOCK_HEIGHT; rect.w = BLOCK_WIDTH; rect.h = BLOCK_HEIGHT; DrawSprite (&rect, pixExplBits[block], pixExplMask[block]); } /* GUI_DrawExplosionSprite */ /* * draw bomb */ void GUI_DrawBombSprite (const Sprite * ptr) { int anime = SpriteAnime (ptr); int bomb = SpriteBomb (ptr); assert (anime < MAX_BOMB_ANIME); assert (bomb < MAX_BOMBS); if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), pixBombMask[bomb][anime]); } else { DrawSprite (SpriteRectangle (ptr), pixBombBits[bomb][anime], pixBombMask[bomb][anime]); } } /* GUI_DrawBombSprite */ /* * */ void GUI_DrawPlayerSprite (const Sprite * ptr) { SDL_Surface *bits; SDL_Surface *mask; int anime = SpriteAnime (ptr); int player = SpritePlayer (ptr); assert (anime < MAX_ANIME); assert (player < MAX_PLAYER); if (anime >= MAX_ANIME_EPM) { bits = pixPpmSpriteBits[anime - MAX_ANIME_EPM]; mask = pixPpmSpriteMask[anime - MAX_ANIME_EPM]; } else { bits = pixEpmSpriteBits[player][anime]; mask = pixEpmSpriteMask[player][anime]; } if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), mask); } else { DrawSprite (SpriteRectangle (ptr), bits, mask); } } /* GUI_DrawPlayerSprite */ /* * */ void GUI_DrawIconSprite (const Sprite * ptr) { int anime = SpriteAnime (ptr); assert (anime < MAX_ICON_SPRITES); if (!SpriteIsMasked (ptr)) { DrawSprite (SpriteRectangle (ptr), pixIconBits[anime], pixIconMask[anime]); } } /* GUI_DrawColorSprite */ /* * draw sprite routine for text sprites */ void GUI_DrawTextSprite (const Sprite * ptr) { GUI_DrawTextbox (SpriteText (ptr), SpriteAnime (ptr), SpriteRectangle (ptr)); } /* GUI_DrawTextSprite */ /* * end of x11c_sprite.h */ xblast-2.10.4/sdl_sprite.h0000644000175000017500000000214710372731125014536 0ustar rhondaalfie/* * file sdl_sprite.h - draw ing sprites under x11 * * $Id: sdl_sprite.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_COLOR_SPRITE_H #define XBLAST_SDL_COLOR_SPRITE_H /* * global prototypes */ extern XBBool InitSprites (void); extern void CopyExplosion (SDL_Surface * pix_tile, int i); #endif /* * end of file sdl_sprite.h */ xblast-2.10.4/sdl_text.c0000644000175000017500000004370110412220337014201 0ustar rhondaalfie/* * file x11c_text.c - draw text strings * * $Id: sdl_text.c,v 1.12 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #include "sdl_common.h" static const SDL_Color SDL_COLOR_WHITE = { 0xFF, 0xFF, 0xFF }; static const SDL_Color SDL_COLOR_BLACK = { 0x00, 0x00, 0x00 }; static const SDL_Color SDL_COLOR_RED = { 0xFF, 0x00, 0x00 }; static const SDL_Color SDL_COLOR_GREEN = { 0x00, 0xFF, 0x00 }; static const SDL_Color SDL_COLOR_BLUE = { 0x00, 0x00, 0xFF }; static const SDL_Color SDL_COLOR_YELLOW = { 0xFF, 0xFF, 0x00 }; static const SDL_Color SDL_COLOR_MAGENTA = { 0xFF, 0x00, 0xFF }; static const SDL_Color SDL_COLOR_CYAN = { 0x00, 0xFF, 0xFF }; /* * local variables */ static TTF_Font *fontStruct[NUM_FONTS]; static SDL_Surface *bgTextSurface; static SDL_Surface *fgTextSurface; //static Uint32 darkTextColor1; //static Uint32 darkTextColor2; //static Uint32 lightTextColor1; //static Uint32 lightTextColor2; SDL_Surface *RenderSolidText (TTF_Font * font, const char *text, SDL_Color textColor); SDL_Surface *RenderOutlineText (TTF_Font * font, const char *text, SDL_Color textColor, SDL_Color outlineColor, int length); /* * load fonts struct by font name */ static TTF_Font * LoadFont (const char *fontName, int fontSize) { TTF_Font *font; /* Workaround SDL_ttf bug. TTF_OpenFont segfaults if the font doesn't exist. */ if (access(fontName, R_OK) == -1) { fprintf (stderr, "xblast: font \"%s\" doesn't exist or isn't readable\n", fontName); return NULL; } font = TTF_OpenFont (fontName, fontSize); if (NULL == font) { fprintf (stderr, "xblast: %s:%d:%s: TTF_OpenFont(fontName, fontSize) failed: %s\n", __FILE__, __LINE__, __FUNCTION__, TTF_GetError ()); }; return font; } /* LoadFont */ /* * */ XBBool InitFonts (void) { const CFGFont *cfgFont; const CFGColor *cfgColor; char *fontName = "Vera.ttf"; /* * Initialize SDL_ttf library */ Dbg_Out ("Initialising font..."); /* Initialize the TTF library */ if (TTF_Init () != 0) { fprintf (stderr, "xblast: %s:%d:%s: TTF_Init() failed: %s\n", __FILE__, __LINE__, __FUNCTION__, TTF_GetError ()); return (XBFalse); } Dbg_Out ("OK!\n"); atexit (TTF_Quit); /* get config */ cfgFont = GetFontConfig (); assert (cfgFont != NULL); cfgColor = GetColorConfig (); assert (cfgColor != NULL); bgTextSurface = ReadCchPixmap (imgPathMisc, imgFileTextBg, COLOR_BLACK, cfgColor->darkText1, cfgColor->darkText2); assert (bgTextSurface != NULL); fgTextSurface = ReadCchPixmap (imgPathMisc, imgFileTextFg, COLOR_BLACK, cfgColor->lightText1, cfgColor->lightText2); assert (fgTextSurface != NULL); fontStruct[FF_Large] = LoadFont (fontName, 24); if (fontStruct[FF_Large] == NULL) { fprintf (stderr, "Error: unable to load font.\n" "Possible reason: %s\n", TTF_GetError ()); return XBFalse; } fontStruct[FF_Medium] = LoadFont (fontName, 18); if (fontStruct[FF_Medium] == NULL) { fprintf (stderr, "Error: unable to load font.\n" "Possible reason: %s\n", TTF_GetError ()); return XBFalse; } fontStruct[FF_Small] = LoadFont (fontName, 12); if (fontStruct[FF_Small] == NULL) { fprintf (stderr, "Error: unable to load font.\n" "Possible reason: %s\n", TTF_GetError ()); return XBFalse; } return XBTrue; } /* InitFonts */ /* * draw simple textbox (in game) */ void GUI_DrawSimpleTextbox (const char *text_in, unsigned flags, const BMRectangle * rect) { SDL_Surface *text_surface = NULL; SDL_Surface *surface = NULL; TTF_Font *font = NULL; SDL_Rect rects; int ret, x, y; const char *text; SDL_Color fgColor, bgColor; if (strlen (text_in) == 0) return; // SDL_ttf doesn't like rendering 0 width text text = gettext (text_in); font = fontStruct[FM_Size & flags]; if (flags & FM_Color) { fgColor = SDL_COLOR_WHITE; bgColor = SDL_COLOR_BLACK; } else { fgColor = SDL_COLOR_BLACK; bgColor = SDL_COLOR_WHITE; } text_surface = TTF_RenderUTF8_Solid (font, text, SDL_COLOR_YELLOW); surface = SDL_CreateRGBSurface (screen->flags, rect->w, rect->h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); // text_surface = RenderOutlineText(font, text, fgColor, bgColor, 3); if (text_surface == NULL) { fprintf (stderr, "GUI_DrawSimpleTextbox error: %s\n", TTF_GetError ()); } SDL_FillRect (surface, NULL, SDL_MapRGB (surface->format, 0x0, 0x0, 0x0)); TTF_SizeUTF8 (font, text, (int *)&(rects.x), (int *)&(rects.w)); rects.x = (surface->w - text_surface->w) / 2; rects.y = (surface->h - text_surface->h) / 2; rects.w = 0; rects.h = 0; ret = SDL_BlitSurface (text_surface, NULL, surface, &rects); if (ret == -1) { fprintf (stderr, "Error: could blit!\n" "Reason: %s\n", SDL_GetError ()); } // SDL_SetColorKey(surface, SDL_SRCCOLORKEY, SDL_MapRGB(surface->format, 0xf, 0xf, 0xf)); for (y = 0; y < surface->h; y++) { putpixel (surface, 0, y, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, 1, y, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, surface->w - 1, y, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, surface->w - 2, y, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); } for (x = 0; x < surface->w; x++) { putpixel (surface, x, 0, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, x, 1, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, x, surface->h - 1, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); putpixel (surface, x, surface->h - 2, SDL_MapRGB (surface->format, 0xff, 0xff, 0x0)); } rects.x = rect->x; rects.y = rect->y; SDL_BlitSurface (surface, NULL, screen, &rects); SDL_UpdateRect (screen, rects.x, rects.y, surface->w, surface->h); SDL_FreeSurface (text_surface); SDL_FreeSurface (surface); } /* GUI_DrawSimpleTextbox */ /* * */ static void DrawAlignedText (const char *text, unsigned flags, SDL_Rect * rect, TTF_Font * font, const SDL_Color * fgColor, const SDL_Color * bgColor) { SDL_Surface *text_surface = NULL; SDL_Rect rects; if (strlen (text) == 0) return; // SDL_ttf doesn't like rendering 0 width text rects.y = rect->y; if (bgColor == NULL) { text_surface = RenderSolidText (font, text, *fgColor); rects.y += 3; } else text_surface = RenderOutlineText (font, text, *fgColor, *bgColor, 3); if (text_surface == NULL) { fprintf (stderr, "xblast: %s:%d:%s: TTF_RenderUTF8_Solid failed: %s\n", __FILE__, __LINE__, __FUNCTION__, TTF_GetError ()); return; }; switch (flags & FM_Align) { case FF_Left: rects.x = rect->x; break; case FF_Right: rects.x = rect->x + rect->w - text_surface->w; break; default: rects.x = (rect->w - text_surface->w); if (rects.x < 0) { rects.x = -rects.x; } rects.x = (rects.x >> 1) + rect->x; break; } if (rect->w < text_surface->w) ; rect->w = 2 * rect->w - text_surface->w; rect->x = 0; rect->y = 0; SDL_BlitSurface (text_surface, rect, screen, &rects); SDL_UpdateRect (screen, rects.x, rects.y, rects.w, rects.h); SDL_FreeSurface (text_surface); } /* DrawAlignedText */ /* * */ void GUI_DrawTextbox (const char *text, unsigned flags, const BMRectangle * rect) { TTF_Font *font; int offset, i; SDL_Surface *rect_surface; const SDL_Color *fgColor, *bgColor; SDL_Surface *TextImage; Uint32 BackGround; SDL_Rect rects; if (text == NULL) return; if (flags & FM_Color) { offset = 2; TextImage = bgTextSurface; fgColor = &SDL_COLOR_YELLOW; bgColor = &SDL_COLOR_BLACK; } else { offset = 3; TextImage = fgTextSurface; fgColor = &SDL_COLOR_BLACK; bgColor = &SDL_COLOR_YELLOW; } assert (((unsigned)(FM_Size & flags)) < NUM_FONTS); font = fontStruct[FM_Size & flags]; assert (font != NULL); assert (text != NULL); rects.x = rect->x; rects.y = rect->y; rects.w = rect->w; rects.h = rect->h; if (flags & FM_Boxed) { SDL_Rect rect1; rect_surface = SDL_CreateRGBSurface (screen->flags, rect->w, rect->h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); BackGround = SDL_MapRGB (rect_surface->format, fgColor->r, fgColor->g, fgColor->b); SDL_FillRect (rect_surface, NULL, BackGround); rect1.y = offset; rect1.x = offset; rect1.w = rect_surface->w - 2 * offset; rect1.h = rect_surface->h - 2 * offset; SDL_FillRect (rect_surface, &rect1, SDL_MapRGB (rect_surface->format, 0xFF, 0xFF, 0xFF)); if (!(flags & FM_Transparent)) { int line, col; SDL_Rect bgImgRect; bgImgRect.w = TextImage->w; bgImgRect.h = TextImage->h; for (line = offset; line < rects.h - offset; line += TextImage->h) { bgImgRect.y = line; for (col = offset; col < rects.w - offset; col += TextImage->w) { bgImgRect.x = col; SDL_BlitSurface (TextImage, NULL, rect_surface, &bgImgRect); } } for (line = offset; line < rects.w; line++) { for (i = 1; i <= offset; i++) putpixel (rect_surface, line, rect_surface->h - i, BackGround); } for (col = offset; col < rects.h; col++) { for (i = 1; i <= offset; i++) putpixel (rect_surface, rect_surface->w - i, col, BackGround); } } else { int x, y; SDL_SetColorKey (rect_surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB (rect_surface->format, 0xFF, 0xFF, 0xFF)); for (y = 2; y < rect_surface->h - 2; y++) { for (x = 2; x < rect_surface->w - 2; x++) { if (y % 2 == 0) putpixel (rect_surface, x, y, SDL_MapRGB (rect_surface->format, 0x0, 0x0, 0x0)); } } } SDL_BlitSurface (rect_surface, NULL, screen, &rects); SDL_UpdateRect (screen, rects.x, rects.y, rects.w, rects.h); SDL_FreeSurface (rect_surface); } if (*text != 0) { if (flags & FM_Color) DrawAlignedText (gettext (text), flags, &rects, font, fgColor, NULL); else DrawAlignedText (gettext (text), flags, &rects, font, fgColor, bgColor); } else { if (flags & FM_Color) DrawAlignedText ("", flags, &rects, font, fgColor, NULL); else DrawAlignedText ("", flags, &rects, font, fgColor, bgColor); } } /* GUI_DrawTextbox */ /* * returns a surface with plain solid rendered text * */ SDL_Surface * RenderSolidText (TTF_Font * font, const char *text, SDL_Color textColor) { SDL_Surface *text_surface; SDL_Surface *surface; text_surface = TTF_RenderUTF8_Solid (font, text, textColor); if (text_surface == NULL) { fprintf (stderr, "Error: TTF could not render font!\n" "Reason: %s\n", TTF_GetError ()); return NULL; } surface = SDL_CreateRGBSurface (SDL_SWSURFACE, text_surface->w, text_surface->h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, 0); SDL_BlitSurface (text_surface, NULL, surface, NULL); SDL_SetColorKey (surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, 0); SDL_FreeSurface (text_surface); // the reason why we create a new blit is to make pallete just like the // screen, so that the colors from both text rendered by RenderSolidText() // and RenderOutlineText() looks the same. // It should be possible to make this more elegant and fast. return surface; } /* RenderSolidText */ /* * returns a surface with outline rendered text * */ SDL_Surface * RenderOutlineText (TTF_Font * font, const char *text, SDL_Color textColor, SDL_Color outlineColor, int length) { int x, y, l, ret; SDL_Surface *text_surface = NULL; SDL_Surface *surface = NULL; SDL_Rect rect; // color cannot be exactly 0, since that's the colorkey if (textColor.r == 0 && textColor.g == 0 && textColor.b == 0) textColor.r = textColor.g = textColor.b = 1; if (outlineColor.r == 0 && outlineColor.g == 0 && outlineColor.b == 0) outlineColor.r = outlineColor.g = outlineColor.b = 1; text_surface = TTF_RenderUTF8_Solid (font, text, textColor); if (text_surface == NULL) { fprintf (stderr, "Error: TTF could not render font!\n" "Reason: %s\n", TTF_GetError ()); return NULL; } rect.x = rect.y = length; surface = SDL_CreateRGBSurface (SDL_SWSURFACE, text_surface->w + 2 * length, text_surface->h + 2 * length, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); if (surface == NULL) { fprintf (stderr, "Error: could not create surface!\n" "Reason: %s\n", SDL_GetError ()); return NULL; } /* make grey transparent */ SDL_FillRect (surface, NULL, SDL_MapRGB (surface->format, 0xf, 0xf, 0xf)); ret = SDL_BlitSurface (text_surface, NULL, surface, &rect); if (ret == -1) { fprintf (stderr, "Error: could blit!\n" "Reason: %s\n", SDL_GetError ()); } SDL_SetColorKey (surface, SDL_SRCCOLORKEY, SDL_MapRGB (surface->format, 0xf, 0xf, 0xf)); SDL_FreeSurface (text_surface); if (length > 0) { Uint32 tcolor = SDL_MapRGB (surface->format, textColor.r, textColor.g, textColor.b); Uint32 ocolor = SDL_MapRGB (surface->format, outlineColor.r, outlineColor.g, outlineColor.b); if (SDL_MUSTLOCK (surface)) SDL_LockSurface (surface); for (y = 0; y < surface->h; y++) for (x = 0; x < surface->w; x++) { if (getpixel (surface, x, y) == tcolor) { // filling pixels to the right for (l = 0; l < length && x + l < surface->w; l++) if (getpixel (surface, x + l, y) != tcolor) putpixel (surface, x + l, y, ocolor); // filling pixels to the left for (l = 0; l < length && x - l > 0; l++) if (getpixel (surface, x - l, y) != tcolor) putpixel (surface, x - l, y, ocolor); // filling pixels to down for (l = 0; l < length && y + l < surface->h; l++) if (getpixel (surface, x, y + l) != tcolor) putpixel (surface, x, y + l, ocolor); // filling pixels to up for (l = 0; l < length && y - l > 0; l++) if (getpixel (surface, x, y - l) != tcolor) putpixel (surface, x, y - l, ocolor); } } if (SDL_MUSTLOCK (surface)) SDL_UnlockSurface (surface); } return surface; } /* RenderOutlineText */ /* * draw a filled and outlined polygon */ void GUI_DrawPolygon (int x, int y, int w, int h, int lw, const BMPoint * points, int npoints, XBBool black_white) { int i; /* convert and scale to xpoints */ Sint16 xv[npoints + 1], yv[npoints + 1]; for (i = 0; i < npoints; i++) { xv[i] = (int)(x + w * points[i].x); yv[i] = (int)(y + h * points[i].y); } xv[npoints] = xv[0]; yv[npoints] = yv[0]; /* now draw it */ filledPolygonRGBA (screen, xv, yv, npoints, SDL_COLOR_BLACK.r, SDL_COLOR_BLACK.g, SDL_COLOR_BLACK.b, 255); if (!black_white) { int w; for (i = 0; i < npoints; i++) { for (w = 0; w < lw; w++) lineRGBA (screen, xv[i] + w, yv[i], xv[i + 1] + w, yv[i + 1], SDL_COLOR_YELLOW.r, SDL_COLOR_YELLOW.g, SDL_COLOR_YELLOW.b, 255); for (w = 0; w < lw; w++) lineRGBA (screen, xv[i], yv[i] + w, xv[i + 1], yv[i + 1] + w, SDL_COLOR_YELLOW.r, SDL_COLOR_YELLOW.g, SDL_COLOR_YELLOW.b, 255); } } /* that's all */ #if 0 // old X11 XPoint *xp; int i; XGCValues xgcv; /* convert and scale to xpoints */ xp = (XPoint *) calloc (sizeof (XPoint), npoints + 1); for (i = 0; i < npoints; i++) { xp[i].x = (int)(x + w * points[i].x); xp[i].y = (int)(y + h * points[i].y); } xp[npoints] = xp[0]; /* set line width */ xgcv.line_width = lw; /* now draw it */ if (black_white) { XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); XFillPolygon (dpy, pix, gcTextBlack, xp, npoints, Complex, CoordModeOrigin); XDrawLines (dpy, pix, gcTextWhite, xp, npoints + 1, CoordModeOrigin); xgcv.line_width = 2; XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); } else { XChangeGC (dpy, gcTextBlack, GCLineWidth, &xgcv); XFillPolygon (dpy, pix, gcTextWhite, xp, npoints, Complex, CoordModeOrigin); XDrawLines (dpy, pix, gcTextBlack, xp, npoints + 1, CoordModeOrigin); xgcv.line_width = 2; XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); } /* that's all */ free (xp); #endif /* */ } /* GUI_DrawPolygon */ /* Follows a couple of SDL functions to get and put pixels */ /* * Return the pixel value at (x, y) * NOTE: The surface must be locked before calling this! * * Taken from SDL documentation. */ Uint32 getpixel (SDL_Surface * surface, int x, int y) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ Uint8 *p = (Uint8 *) surface->pixels + y * surface->pitch + x * bpp; switch (bpp) { case 1: return *p; case 2: return *(Uint16 *) p; case 3: if (SDL_BYTEORDER == SDL_BIG_ENDIAN) return p[0] << 16 | p[1] << 8 | p[2]; else return p[0] | p[1] << 8 | p[2] << 16; case 4: return *(Uint32 *) p; default: return 0; /* shouldn't happen, but avoids warnings */ } } /* * Set the pixel at (x, y) to the given value * NOTE: The surface must be locked before calling this! * * Taken from SDL documentation. */ void putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to set */ Uint8 *p = (Uint8 *) surface->pixels + y * surface->pitch + x * bpp; switch (bpp) { case 1: *p = pixel; break; case 2: *(Uint16 *) p = pixel; break; case 3: if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { p[0] = (pixel >> 16) & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = pixel & 0xff; } else { p[0] = pixel & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = (pixel >> 16) & 0xff; } break; case 4: *(Uint32 *) p = pixel; break; } } /* * end of file sdl_text.c */ xblast-2.10.4/sdl_text.h0000644000175000017500000000213210372731125014206 0ustar rhondaalfie/* * file sdl_text.h - * * $Id: sdl_text.h,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_COLOR_TEXT_H #define XBLAST_SDL_COLOR_TEXT_H extern XBBool InitFonts (void); extern Uint32 getpixel (SDL_Surface * surface, int x, int y); extern void putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel); #endif /* * */ xblast-2.10.4/sdl_tile.c0000644000175000017500000002174310412220337014154 0ustar rhondaalfie/* * file x11c_tile.c - draw map tiles * * $Id: sdl_tile.c,v 1.6 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "sdl_common.h" /* * local variables */ #define MAX_LEDS 5 // 2+3 XBCC SDL_Surface *ClearPix; static SDL_Surface *pixBlock[MAX_TILE]; static SDL_Surface *pixLeds[MAX_LEDS]; static SDL_Surface *pixScore[MAX_SCORE_TILES]; static SDL_Surface *pixExplBlock[MAX_EXPLOSION]; static SDL_Rect voidList[MAZE_W * (MAZE_H + 2)]; static SDL_Rect blockList[MAX_TILE][MAZE_W * (MAZE_H + 2)]; static SDL_Rect explList[MAX_EXPLOSION][MAZE_W * (MAZE_H + 2)]; static SDL_Rect *voidLast = voidList; static SDL_Rect *blockLast[MAX_TILE]; static SDL_Rect *explLast[MAX_EXPLOSION] = { explList[0], explList[1], explList[2], explList[3], explList[4], explList[5], explList[6], explList[7], explList[8], explList[9], explList[10], explList[11], explList[12], explList[13], explList[14], explList[15], }; /* * */ XBBool InitTiles (void) { const CFGColor *cfgColor; int i; SDL_Surface *temp; /* load config */ cfgColor = GetColorConfig (); assert (cfgColor != NULL); /* init led tiles */ i = 0; pixLeds[0] = ReadCchPixmap (imgPathScore, imgFileScoreLed[i++], COLOR_BLACK, cfgColor->statusFg, cfgColor->statusLed); pixLeds[1] = ReadCchPixmap (imgPathScore, imgFileScoreLed[i++], COLOR_BLACK, cfgColor->statusFg, cfgColor->statusLed); pixLeds[2] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_RED); pixLeds[3] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_ORANGE); pixLeds[4] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_BLUE); /* init other score tiles */ for (i = 0; i < SBDead; i++) { pixScore[i] = ReadCchPixmap (imgPathScore, imgFileScoreTile[i], COLOR_BLACK, cfgColor->statusFg, cfgColor->statusBg); if (NULL == pixScore[i]) { return XBFalse; } } /* init drawing lists */ for (i = 0; i < MAX_TILE; i++) { pixBlock[i] = NULL; blockLast[i] = &blockList[i][0]; } for (i = 0; i < MAX_EXPLOSION; i++) { explLast[i] = explList[i]; } temp = ReadCchPixmap (imgPathMisc, imgFileTitle, COLOR_BLACK, COLOR_GRAY_75, COLOR_MIDNIGHT_BLUE); ClearPix = SDL_DisplayFormat (temp); SDL_FreeSurface (temp); return XBTrue; } /* InitTiles */ /* * */ void GUI_DrawBlock (int x, int y, int block) { assert (x >= 0); assert (x < MAZE_W); assert (y >= 0); #ifdef SMPF assert (y < MAZE_H + 4); #else assert (y < MAZE_H + 3); #endif assert (block >= -1); assert (block < MAX_TILE); if (block >= 0) { // fprintf(stderr," block %i %i %i %p %i %i\n",x,y,block,blockLast[block], // x*BLOCK_WIDTH,y*BLOCK_HEIGHT); (blockLast[block])->x = x * BLOCK_WIDTH; (blockLast[block])->y = y * BLOCK_HEIGHT; (blockLast[block])->w = BLOCK_WIDTH; (blockLast[block])->h = BLOCK_HEIGHT; (blockLast[block])++; } else { (voidLast)->x = x * BLOCK_WIDTH; (voidLast)->y = y * BLOCK_HEIGHT; (voidLast)->w = BLOCK_WIDTH; (voidLast)->h = BLOCK_HEIGHT; (voidLast)++; } } /* GUI_DrawBlock */ /* * */ void GUI_DrawExplosion (int x, int y, int block) { assert (block >= 0); assert (block < MAX_EXPLOSION); (explLast[block])->x = x * BLOCK_WIDTH; (explLast[block])->y = y * BLOCK_HEIGHT; (explLast[block])->w = BLOCK_WIDTH; (explLast[block])->h = BLOCK_HEIGHT; (explLast[block])++; } /* GUI_DrawExplosion */ /* * */ static void MultiBlt (SDL_Surface * img, SDL_Rect * rect, int n_rect) { int i; for (i = 0; i < n_rect; i++) { SDL_BlitSurface (img, NULL, screen, &rect[i]); } } /* MultiBlt */ /* * */ void GUI_FlushBlocks (void) { int i; /* void blocks */ if (voidLast != voidList) { MultiBlt (ClearPix, voidList, voidLast - voidList); voidLast = voidList; } /* normal blocks */ for (i = 0; i < MAX_TILE; i++) { if (pixBlock[i] != NULL && blockLast[i] != blockList[i]) { MultiBlt (pixBlock[i], blockList[i], blockLast[i] - blockList[i]); } blockLast[i] = blockList[i]; } /* explosion blocks */ for (i = 0; i < MAX_EXPLOSION; i++) { if (pixExplBlock[i] != NULL) { if (explLast[i] != explList[i]) { MultiBlt (pixExplBlock[i], explList[i], explLast[i] - explList[i]); explLast[i] = explList[i]; } } } } /* GUI_FlushBlocks */ /* * */ void GUI_LoadBlockRgb (int id, const char *name) { assert (id >= 0); assert (id < MAX_TILE); assert (pixBlock[id] == NULL); pixBlock[id] = ReadRgbPixmap (imgPathBlock, name); if (pixBlock[id] == NULL) { Dbg_Out (" Faile to load rgb Block %s.ppm \n", name); pixBlock[id] = ReadRgbPixmap (imgPathBlock, "unknown-file"); } Dbg_Out (" loaded rgb Block %s.ppm \n", name); } /* GUI_LoadBlock */ /* * */ void GUI_LoadBlockCch (int id, const char *name, XBColor fg, XBColor bg, XBColor add) { assert (id >= 0); assert (id < MAX_TILE); assert (pixBlock[id] == NULL); pixBlock[id] = ReadCchPixmap (imgPathBlock, name, fg, bg, add); if (pixBlock[id] == NULL) { Dbg_Out (" Faile to load Block %s.ppm \n", name); pixBlock[id] = ReadCchPixmap (imgPathBlock, "unknown-file", fg, bg, add); } Dbg_Out (" loaded cch Block %s.ppm %i\n", name, id); } /* GUI_LoadBlock */ /* * */ void GUI_InitExplosionBlocks (void) { int i; for (i = 0; i < MAX_EXPLOSION; i++) { pixExplBlock[i] = SDL_CreateRGBSurface (screen->flags, BLOCK_WIDTH, BLOCK_HEIGHT, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); SDL_BlitSurface (pixBlock[0], NULL, pixExplBlock[i], NULL); /* now copy explosion into it */ CopyExplosion (pixExplBlock[i], i); } } /* GUI_InitExplosionBlocks */ /* * */ void GUI_FreeBlock (int in_pix) { assert (in_pix >= 0); assert (in_pix < MAX_TILE); /* free pixmap */ if (NULL != pixBlock[in_pix]) { SDL_FreeSurface (pixBlock[in_pix]); pixBlock[in_pix] = NULL; } } /* GUI_FreeBlock */ /* * */ void GUI_FreeExplosionBlocks (void) { int i; for (i = 0; i < MAX_EXPLOSION; i++) { SDL_FreeSurface (pixExplBlock[i]); } } /* GUI_FreeExplosionBlocks */ /* * */ void GUI_LoadPlayerScoreTiles (int player, const CFGPlayerGraphics * config) { const CFGColor *cfgColor; XBColor scoreColors[NUM_PLAYER_COLORS]; assert (player < MAX_PLAYER); assert (config != NULL); /* get colors */ cfgColor = GetColorConfig (); assert (NULL != cfgColor); /* copy colors */ scoreColors[0] = config->helmet; scoreColors[1] = config->face; scoreColors[2] = config->handsFeet; scoreColors[3] = config->armsLegs; scoreColors[4] = cfgColor->statusFg; scoreColors[5] = cfgColor->statusBg; scoreColors[6] = COLOR_WHITE; /* load pixmap */ pixScore[SBDead + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[0], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSick + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[1], NUM_PLAYER_COLORS, scoreColors); pixScore[SBPlayer + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[2], NUM_PLAYER_COLORS, scoreColors); pixScore[SBAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[3], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSickAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[4], NUM_PLAYER_COLORS, scoreColors); } /* GUI_LoadPlayerScoreTile */ /* * */ void GUI_DrawScoreBlock (int x, int y, int block) // SMPF { SDL_Rect Rect; assert (block < MAX_SCORE_TILES); assert (pixScore[block] != NULL); Rect.x = x * STAT_WIDTH; #ifdef SMPF Rect.y = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT; #else Rect.y = MAZE_H * BLOCK_HEIGHT; #endif Rect.w = pixScore[block]->w; Rect.h = pixScore[block]->h; SDL_BlitSurface (pixScore[block], NULL, screen, &Rect); } /* GUI_DrawScoreBlock */ /* * */ void GUI_DrawTimeLed (int x, int block) { SDL_Rect Rect; assert (block >= 0); assert (block < 5); assert (pixLeds[block] != NULL); Rect.x = x * LED_WIDTH; #ifdef SMPF Rect.y = MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT * 2; #else Rect.y = MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT; #endif Rect.w = pixLeds[block]->w; Rect.h = pixLeds[block]->h; SDL_BlitSurface (pixLeds[block], NULL, screen, &Rect); } /* GUI_DrawTimeLed */ /* * end of file x11c_tile.c */ xblast-2.10.4/sdl_tile.h0000644000175000017500000000172210372731125014163 0ustar rhondaalfie/* * file sdl_tile.h - * * $Id: sdl_tile.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SDL_COLOR_TILE_H #define XBLAST_SDL_COLOR_TILE_H extern XBBool InitTiles (void); #endif /* * */ xblast-2.10.4/server.c0000644000175000017500000012260310412220337013660 0ustar rhondaalfie/* * file server.c - communication interface for the server * * $Id: server.c,v 1.79 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local variables */ /* Server connections */ static XBComm *listenComm = NULL; /* XBCommListen - TCP listen for clients */ static XBComm *replyComm = NULL; /* XBCommReply - UDP LAN reply */ static XBComm **query = NULL; /* XBCommNewGame - UDP connection to central */ /* default server options */ static CFGGame cfgGame; /* player actions received for expected gametime */ static PlayerAction playerAction[MAX_HOSTS][MAX_PLAYER]; /* level negotiation states per host */ static unsigned levelStatus[MAX_HOSTS]; /* levelwinners per host */ static unsigned levelWinner[MAX_HOSTS]; static char levelWinnerStr[3 * MAX_HOSTS + 1]; static unsigned currentWinner = TEAM_UNDEF; /* server flag, unneeded ? */ static XBBool isServer = XBFalse; /*************************** * starting/closing server * ***************************/ /* * start listening for clients * * should always be start for server! */ XBBool Server_StartListen (CFGGameHost * cfg) { unsigned char p; /* init network/chat */ Dbg_Server ("clearing all network and chat data\n"); Network_Clear (); Network_ClearEvents (); Chat_Clear (); /* listen on tcp-port for clients */ assert (listenComm == NULL); listenComm = CommCreateListen (cfg, XBFalse); if (NULL == listenComm) { Dbg_Server ("failed to listen for clients on TCP port %u\n", cfg->port); return XBFalse; } Dbg_Server ("listening for clients on port %u\n", cfg->port); /* receive local host id */ Network_ReceiveLocalHostId (0); /* get game config data from database Local/Server */ if (!RetrieveGame (CT_Local, atomServer, &cfgGame)) { Dbg_Server ("failed to get local game config!\n"); Network_Clear (); Network_ClearEvents (); return XBFalse; } /* simulate game config receive from network */ StoreGame (CT_Remote, SERVERGAMECONFIG, &cfgGame); /* now receive terminator like client */ if (!Server_ReceiveGameConfig (0, NULL)) { Dbg_Server ("listen failed, local game config error\n"); Network_Clear (); Network_ClearEvents (); return XBFalse; } /* receive local player configs */ for (p = 0; p < cfgGame.players.num; p++) { if (!Server_ReceivePlayerConfig (0, p, NULL)) { Dbg_Server ("failed to setup local player #%u\n", p); Network_Clear (); Network_ClearEvents (); return XBFalse; } } /* receive ping */ Server_ReceivePing (0, 0); /* allow clients to browse for games */ if (cfg->browseLan) { assert (NULL == replyComm); replyComm = Reply_CreateComm (16168, cfg, &cfgGame.setup); if (NULL == replyComm) { Dbg_Server ("failed to open reply socket, not visible in LAN\n"); } } Dbg_Server ("listening for LAN queries on UDP port %u\n", 16168); /* force stop on old query sockets - unlikely that they are still active, but not impossible */ if (query != NULL) { Dbg_Server ("removing old query sockets\n"); Server_StopNewGame (); } /* registering game at central */ if (cfg->central) { Dbg_Server ("attempting to register game\n"); Server_StartCentralNewGame (cfg, &cfgGame.setup); } Dbg_Server ("marking as server\n"); isServer = XBTrue; /* needed for old code, remove some time */ assert (XBNT_None == Network_GetType ()); Network_SetType (XBNT_Server); /* listen for local chat keys */ Chat_Listen (XBTrue); /* that's all */ return XBTrue; } /* Server_StartListen */ /* * remove listen ports */ void Server_StopListen (void) { /* delete listen port */ assert (NULL != listenComm); CommFinishListen (listenComm); /* should trigger Server_ReceiveListenClose() */ assert (listenComm == NULL); /* delete reply socket */ if (NULL != replyComm) { CommDelete (replyComm); replyComm = NULL; Dbg_Server ("stopped listening for LAN queries\n"); } } /* Server_StopListen */ /* * listen socket is closed down */ void Server_ReceiveListenClose (XBBool exp) { listenComm = NULL; if (exp) { Dbg_Server ("stopped listening for clients\n"); } else { Dbg_Server ("unexpected shutdown of listen socket\n"); /* do something appropriate */ } } /* Server_ReceiveListenClose */ /**************************** * connecting/disconnecting * ****************************/ /* * a client has connected to server */ void Server_Accept (unsigned id, const char *hostName, unsigned port) { CFGGameHost cfg; time_t ltime; assert (hostName != NULL); assert (id > 0); assert (id < MAX_HOSTS); /* produce beep if wanted */ time (<ime); if (cfgGame.host.beep) { SND_Beep (); } fprintf (stderr, "\n%s client adr=%s:%u id=%u connected\n", ctime (<ime), hostName, port, id); /* store in database */ Dbg_Server ("setting up initial game config for host #%u\n", id); memset (&cfg, 0, sizeof (cfg)); cfg.name = hostName; cfg.port = port; StoreGameHost (CT_Remote, LOCALGAMECONFIG (id), &cfg); /* attempt to start dgram */ if (NULL == D2C_CreateComm (id, S2C_LocalName (id), cfgGame.host.fixedUdpPort)) { Dbg_Server ("failed to create udp socket for host #%u, disconnecting !!\n", id); Server_StreamDisconnect (id); return; } Dbg_Server ("created udp socket for host #%u on port %u\n", id, D2C_Port (id)); /* respond to client now */ Server_SendAllConfigs (id); Server_SendDgramPort (id); Server_QueryGameConfig (id); Network_QueueEvent (XBNW_Accepted, id); } /* Server_Accept */ /* * initiate stream shut down - send the disconnect signal and mark waiting EOF * the stream and its host slot will be freed on receivng eof/error */ void Server_StreamDisconnect (unsigned clientID) { assert (clientID > 0); assert (clientID < MAX_HOSTS); if (S2C_Connected (clientID)) { Dbg_Server ("queueing TCP disconnect sequence to host #%u\n", clientID); S2C_Disconnect (clientID); } } /* Server_StreamDisconnect */ /* * makes dgram slot available for new clients * the dgram data structure is completely removed */ void Server_DgramDisconnect (unsigned clientID) { assert (clientID > 0); assert (clientID < MAX_HOSTS); if (D2C_Connected (clientID)) { Dbg_Server ("disconnecting UDP to host #%u\n", clientID); D2C_Disconnect (clientID); } } /* Server_DgramDisconnect */ /* * active freeing of the client slot * informs other clients and local GUI */ void Server_SendDisconnect (unsigned clientID) { if (clientID > 0) { Server_StreamDisconnect (clientID); Server_DgramDisconnect (clientID); Server_SendDisconnectInfo (clientID); Network_ClearHost (clientID); Network_QueueEvent (XBNW_Disconnected, clientID); } else { Server_SendDisconnectAll (); } } /* Server_SendDisconnect */ /* * active shutdown of server * all slots are cleared */ void Server_SendDisconnectAll (void) { unsigned clientID; /* disconnect from clients */ for (clientID = 1; clientID < MAX_HOSTS; clientID++) { Server_StreamDisconnect (clientID); Server_DgramDisconnect (clientID); } if (NULL != query) { Dbg_Server ("queuing close to central, mark for shutdown after send\n"); Server_CloseNewGame (); } if (listenComm == NULL) { Network_SetType (XBNT_None); } Network_Clear (); Network_ClearEvents (); Dbg_Server ("*** all data completely cleared ***\n"); Chat_Listen (XBFalse); } /* Server_SendDisconnectAll */ /* * disconnect all clients that are out */ static void Server_SendDisconnectOut (void) { unsigned id; for (id = 1; id < MAX_HOSTS; id++) { if (!Network_HostIsIn (id)) { Dbg_Server ("disconnecting host #%i, is out\n", id); Server_SendDisconnect (id); } } } /* Server_SendDisconnectOut */ /*************** * comm events * ***************/ /* * handle event on stream */ XBBool Server_StreamEvent (unsigned clientID, XBServerConstants code) { assert (clientID > 0); assert (clientID < MAX_HOSTS); switch (code) { case XBSC_IDInvalid: Dbg_Server ("invalid id received from host #%u, ignoring\n", clientID); return XBFalse; case XBSC_DataInvalid: Dbg_Server ("invalid data received from host #%u, ignoring\n", clientID); return XBFalse; case XBSC_COTInvalid: Dbg_Server ("invalid cot received from host #%u, sending disconnect\n", clientID); Server_StreamDisconnect (clientID); Server_SendDisconnectInfo (clientID); return XBFalse; case XBSC_MissingData: Dbg_Server ("host #%u has not requested data\n", clientID); return XBFalse; case XBSC_IOError: Dbg_Server ("i/o error on stream to host #%u, disconnecting\n", clientID); Server_SendDisconnectInfo (clientID); break; case XBSC_UnexpectedEOF: Dbg_Server ("unexpected eof on stream to host #%u, disconnecting\n", clientID); Server_SendDisconnectInfo (clientID); break; case XBSC_StreamWaiting: Dbg_Server ("all queued data sent to host #%u\n", clientID); return XBFalse; case XBSC_StreamBusy: /* Dbg_Server("data waits to be sent to host #%u\n", clientID); */ return XBFalse; case XBSC_StreamClosed: Dbg_Server ("stream to host #%u fully disconnected\n", clientID); return XBFalse; default: Dbg_Server ("unknown event (%u) on stream to host #%u, disconnecting\n", code, clientID); } /* remove dgram if still there */ Server_DgramDisconnect (clientID); /* clear host data */ Network_ClearHost (clientID); /* queue event for GUI display */ Network_QueueEvent (XBNW_Error, clientID); /* more info for GUI */ return XBTrue; } /* Server_StreamEvent */ /* * handle event on dgram */ XBBool Server_DgramEvent (unsigned clientID, XBServerConstants code) { assert (clientID > 0); assert (clientID < MAX_HOSTS); switch (code) { case XBSC_GameTime: Dbg_Server ("future gametimes from host #%u received, ignoring\n", clientID); return XBFalse; case XBSC_WriteError: Dbg_Server ("write error on dgram to host #%u, disconnecting\n", clientID); break; case XBSC_ConnFailed: Dbg_Server ("dgram failed to connect to host #%u, disconnecting\n", clientID); break; case XBSC_Timeout: Dbg_Server ("dgram to host #%u timed out, disconnecting\n", clientID); Server_DgramDisconnect (clientID); break; case XBSC_DgramClosed: Dbg_Server ("dgram to host #%u removed\n", clientID); return XBFalse; default: Dbg_Server ("unknown event (%u) on dgram to host #%u, disconnecting\n", code, clientID); } /* initiate disconnection of stream */ Server_StreamDisconnect (clientID); Server_SendDisconnectInfo (clientID); /* clear host data */ Network_ClearHost (clientID); /* queue event for GUI display */ Network_QueueEvent (XBNW_Error, clientID); return XBTrue; } /* Server_DgramDisconnect */ /****************** * receiving data * ******************/ /* * game config received from host */ XBBool Server_ReceiveGameConfig (unsigned id, const char *line) { unsigned num; assert (id < MAX_HOSTS); /* receive the data */ switch (Network_ReceiveGameConfig (id, line)) { case XBGC_Unfinished: return XBFalse; case XBGC_Empty: Dbg_Server ("host #%u sent empty game config, disconnect\n", id); Server_SendDisconnect (id); return XBFalse; case XBGC_TooManyPlayers: Dbg_Server ("host #%u sent too many players, disconnect\n", id); Server_SendDisconnect (id); return XBFalse; case XBGC_NoVersion: Dbg_Server ("host #%u sent no version, disconnect\n", id); Server_SendDisconnect (id); return XBFalse; case XBGC_Local: Dbg_Server ("host #%u sent local game config\n", id); num = Network_CreateLocalPlayers (id); if (num >= NUM_LOCAL_PLAYER) { Dbg_Server ("failed to create local players, disconnect\n"); Server_SendDisconnect (id); return XBFalse; } Dbg_Server ("created %u players at host #%u\n", num, id); Server_SendGameConfig (id); Server_QueryPlayerConfigs (id, num); Server_ReceiveHostStateReq (0, id, XBHS_Wait); Network_QueueEvent (XBNW_GameConfig, id); return XBTrue; case XBGC_Global: Dbg_Server ("host #%u sent global game config\n", id); if (id > 0) { Dbg_Server ("ignoring global game config from client\n"); DeleteGameConfig (CT_Remote, LOCALGAMECONFIG (id)); return XBFalse; } num = Network_CreateGlobalPlayers (id); if (num > MAX_PLAYER) { Dbg_Server ("failed to create global players, stop\n"); Server_SendDisconnect (id); Network_QueueEvent (XBNW_Error, id); return XBFalse; } num = Network_GetMaskBytes (); if (num == 0) { Dbg_Server ("failed to set mask bytes, stop\n"); Server_SendDisconnect (id); Network_QueueEvent (XBNW_Error, id); return XBFalse; } D2C_SetMaskBytes (num); Dbg_Server ("created %u global players from game config #%u\n", num, id); return XBTrue; case XBGC_Error: Dbg_Server ("host #%u sent invalid game config, disconnect\n", id); Server_SendDisconnect (id); return XBFalse; default: break; } return XBFalse; } /* Server_ReceiveGameConfig */ /* * player config received from client */ XBBool Server_ReceivePlayerConfig (unsigned id, int player, const char *line) { XBAtom atom, name, full; CFGPlayer cfgPlayer; if (id == 0) { Dbg_Server ("local player config transfer #%u\n", player); full = Network_GetPlayer (0, player); if (full == ATOM_INVALID) { Dbg_Server ("local player #%u not registered\n", player); return XBFalse; } name = Network_GetPlayer2 (0, player); if (name == ATOM_INVALID) { Dbg_Server ("local player name #%u not registered\n", player); return XBFalse; } if (!RetrievePlayer (CT_Local, name, cfgGame.players.teamColor[player], &cfgPlayer)) { Dbg_Server ("incomplete data for player #%u\n", player); return XBFalse; } StorePlayer (CT_Remote, full, &cfgPlayer); line = NULL; } /* store player for config */ atom = Network_ReceivePlayerConfig (CT_Remote, id, player, line); /* if atom is valid, data is complete */ if (ATOM_INVALID != atom) { Dbg_Server ("player config for host #%u(%u) received\n", id, player); /* send player config of id to other clients */ Server_SendPlayerConfig (id, player); /* initial team state */ Server_ReceiveTeamStateReq (0, id, player, cfgGame.setup.teamMode ? XBTS_Red : XBTS_None); return XBTrue; } return XBFalse; } /* Server_ReceivePlayerConfig */ /* * client has sent dgram port */ void Server_ReceiveDgramPort (unsigned id, unsigned short port) { /* set port for datagram conection */ if (0 != port || cfgGame.host.allowNat) { if (port == 0) { Dbg_Server ("client at %s reports NAT, setting up dgram\n", S2C_HostName (id)); } else { Dbg_Server ("received dgram port %u for host #%u, connecting dgram\n", port, id); } if (!D2C_Connect (id, S2C_HostName (id), port)) { Dbg_Server ("failed to connect dgram\n"); Server_SendDisconnect (id); } } else { Dbg_Server ("client has NAT, disallowed\n"); Server_SendDisconnect (id); } } /* Server_ReceiveDgramPort */ /* * receive and resend host state changes, local use only */ static void Server_ReceiveHostState (unsigned id, XBHostState state) { if (Network_ReceiveHostState (id, state)) { Server_SendHostState (id, state); } else { Dbg_Server ("received invalid host state\n"); } } /* Server_ReceiveHostState */ /* * return if host state request from id for host to state is granted */ static XBBool Server_GrantsHostRequest (unsigned id, unsigned host, XBHostState state) { /* never grant the None request */ if (state == XBHS_None) { return XBFalse; } /* distinguish server and client requests */ if (id == 0) { /* grant any server request unless request equals current */ return (Network_GetHostState (host) != state); } else if (id == host) { /* grant certain client requests for self */ switch (Network_GetHostState (host)) { case XBHS_Ready: return (state == XBHS_In); case XBHS_In: return (state == XBHS_Ready); default: return XBFalse; } } return XBFalse; } /* Server_GrantsHostRequest */ /* * receive host state request from id for host to state */ void Server_ReceiveHostStateReq (unsigned id, unsigned host, XBHostState state) { XBHostState *req; /* translate In to Srv for server */ if (host == 0 && state == XBHS_In) { state = XBHS_Server; } /* check if request is valid */ if (Network_ReceiveHostStateReq (id, host, state)) { /* first send request data to all clients */ Server_SendHostStateReq (id, host, state); /* check if request is granted */ if (Server_GrantsHostRequest (id, host, state)) { Dbg_Server ("granting host request #%u->%u from #%u\n", host, state, id); Server_ReceiveHostState (host, state); } /* reprocess host's request */ req = Network_GetHostStateReq (host); if (Server_GrantsHostRequest (host, host, req[host])) { Dbg_Server ("granting reprocessed host request #%u->%u from #%u\n", host, req[host], host); Server_ReceiveHostState (host, req[host]); } /* clients agree on a host state */ if (Network_HostReqClientsAgree (host, state)) { /* all clients!=host request out for host, grant unless host = server */ if (state == XBHS_Out && id != 0) { Dbg_Server ("granting disconnect request of clients for host #%u!!\n", host); Server_SendDisconnect (host); return; } } /* check if all clients are ready */ if (Network_ClientsReady () && Network_GetHostState (0) == XBHS_Ready) { Dbg_Server ("all hosts are ready, starting game!!\n"); Network_QueueEvent (XBNW_StartGame, 0); } } else { Dbg_Server ("received invalid host state request\n"); } } /* Server_ReceiveHostStateReq */ /* * receive and resend team state change, local use only */ static void Server_ReceiveTeamState (unsigned id, unsigned player, XBTeamState state) { if (Network_ReceiveTeamState (id, player, state)) { Server_SendTeamState (id, player, state); } else { Dbg_Server ("received invalid team state\n"); } } /* Server_ReceiveTeamState */ /* * return if team request from id for host to state is granted */ static XBBool Server_GrantsTeamRequest (unsigned id, unsigned host, unsigned player, XBTeamState state) { if (id == 0) { /* grant any server request for server */ Dbg_Server ("granting team request #%u: #%u(%u)->%u\n", id, host, player, state); return XBTrue; } else if (Network_TeamReqClientsAgree (host, player, state)) { /* grant client request if they agree */ Dbg_Server ("granting joint team request #%u(%u)->%u\n", host, player, state); return XBTrue; } return XBFalse; } /* Server_GrantsTeamRequest */ /* * receive team state request from id for host:player to state */ void Server_ReceiveTeamStateReq (unsigned id, unsigned host, unsigned player, XBTeamState state) { unsigned i, p; /* first check for valid request */ if (!Network_ReceiveTeamStateReq (id, host, player, state)) { Dbg_Server ("received invalid team state request\n"); } /* send valid request data to all hosts */ Server_SendTeamStateReq (id, host, player, state); /* process request */ if (!Server_GrantsTeamRequest (id, host, player, state)) { Dbg_Server ("team request #%u: #%u(%u)->%u denied\n", id, host, player, state); return; } /* check if player is requested out, no mode change */ if (state == XBTS_Out) { Dbg_Server ("setting player %u(%u) out\n", host, player); Server_ReceiveTeamState (host, player, state); return; } /* check for change to chaos mode */ if (cfgGame.setup.teamMode && (state == XBTS_None)) { /* change to chaos, first set new team defaults */ Network_SetDefaultTeams (host, player); /* set requested host/player explicitly to none */ Server_ReceiveTeamState (host, player, XBTS_None); /* set all players with valid team to none */ for (i = 0; i < MAX_HOSTS; i++) { for (p = 0; p < NUM_LOCAL_PLAYER; p++) { state = Network_GetTeamState (i, p); if (state > XBTS_None && state < XBTS_Out) { Server_ReceiveTeamState (i, p, XBTS_None); } } } Dbg_Server ("changed to chaos mode!\n"); cfgGame.setup.teamMode = XBFalse; return; } /* check for change to team mode */ if (!cfgGame.setup.teamMode && (state > XBTS_None)) { /* change to default teams */ for (i = 0; i < MAX_HOSTS; i++) { for (p = 0; p < NUM_LOCAL_PLAYER; p++) { if (Network_GetTeamState (i, p) == XBTS_None) { Server_ReceiveTeamState (i, p, Network_GetDefaultTeam (i, p)); } } } Dbg_Server ("changed to team mode!\n"); cfgGame.setup.teamMode = XBTrue; return; } /* no team mode change */ Dbg_Server ("setting player %u(%u) = %u\n", host, player, state); Server_ReceiveTeamState (host, player, state); } /* Server_ReceiveTeamStateReq */ /* * server received chat from a client */ void Server_ReceiveChat (XBChat * chat) { Chat_Receive (chat); Server_SendChat (chat); } /* Server_ReceiveChat */ /* * ping received, tell network */ void Server_ReceivePing (unsigned id, int ping) { Dbg_Server ("received ping from host #%u\n", id); Network_ReceivePing (id, ping); } /* Server_ReceivePing */ /* * client has reached a sync point */ void Server_ReceiveSync (unsigned id, XBNetworkEvent event) { /* inform application */ Dbg_Server ("host #%u reached sync point %u\n", id, event); Network_QueueEvent (event, id); } /* Server_ReceiveSync */ /* * receive a level check result from a client */ void Server_ReceiveLevelCheck (unsigned id, unsigned stat) { Dbg_Server ("receiving level status at %u = %u\n", id, stat); levelStatus[id] = stat; Network_QueueEvent (XBNW_LevelConfig, id); } /* Server_ReceiveLevelCheck */ /* * received keys from one client */ void Server_ReceivePlayerAction (unsigned id, int gameTime, const PlayerAction * keys) { int i; assert (id > 0); assert (id < MAX_HOSTS); assert (playerAction != NULL); /* Dbg_Server("received action from host #%u\n", id); */ for (i = 0; i < MAX_PLAYER; i++) { if (keys[i].dir != GoDefault) { playerAction[id][i].dir = keys[i].dir; } if (keys[i].bomb) { playerAction[id][i].bomb = XBTrue; } if (keys[i].special) { playerAction[id][i].special = XBTrue; } if (keys[i].pause) { playerAction[id][i].pause = XBTrue; } if (keys[i].abort != ABORT_NONE) { playerAction[id][i].abort = keys[i].abort; } if (keys[i].suicide) { playerAction[id][i].suicide = XBTrue; } /* Skywalker */ if (keys[i].laola) { playerAction[id][i].laola = XBTrue; } else { playerAction[id][i].laola = XBFalse; if (keys[i].looser) { playerAction[id][i].looser = XBTrue; } else { playerAction[id][i].looser = XBFalse; } } /* */ } } /* Server_ReceivePlayerAction */ /* * received level finish from clients */ void Server_ReceiveFinish (unsigned id) { Dbg_Server ("FINISH from host #%u\n", id); } /* Server_ReceiveFinish */ /* * receive the winner team from a client */ void Server_ReceiveWinnerTeam (unsigned id, unsigned team) { assert (id < MAX_HOSTS); Dbg_Server ("receiving winner at %u = %u\n", id, team); /* update winner table */ levelWinner[id] = team; /* update string */ switch (team) { case TEAM_NOWINNER: memcpy (levelWinnerStr + 3 * id, "DR", 2); break; case TEAM_LOCALASYNC: memcpy (levelWinnerStr + 3 * id, "LA", 2); break; default: memcpy (levelWinnerStr + 3 * id, TempString ("%2x", team), 2); break; } /* update current winner */ if (currentWinner == TEAM_UNDEF) { currentWinner = team; } else if (currentWinner != team) { currentWinner = TEAM_ASYNC; } /* queue event for game_server sync */ Network_QueueEvent (XBNW_SyncLevelResult, id); } /* Server_ReceiveWinnerTeam */ /************************ * local data retrieval * ************************/ /* * get server flag */ XBBool GetIsServer (void) { return isServer; } /* GetIsServer */ /* * set server flag */ void SetIsServer (XBBool value) { isServer = value; } /* SetIsServer */ /* * retrieve host state from client */ XBHostState Server_GetHostState (unsigned id) { return Network_GetHostState (id); } /* Server_GetHostState */ /* * retrieve host state requests for client */ XBHostState * Server_GetHostStateReq (unsigned id) { return Network_GetHostStateReq (id); } /* Server_GetHostStateReq */ /* * retrieve team state form client, player */ XBTeamState Server_GetTeamState (unsigned id, unsigned player) { return Network_GetTeamState (id, player); } /* Server_GetTeamState */ /* * retrieve host state requests from client */ XBTeamState * Server_GetTeamStateReq (unsigned id, unsigned player) { return Network_GetTeamStateReq (id, player); } /* Server_GetTeamStateReq */ /* * last ping time of client */ int Server_GetPingTime (unsigned clientID) { return Network_GetPingTime (clientID); } /* Server_GetPingTime */ /* * check level status list for rejections */ XBBool Server_LevelApproved (void) { unsigned i; for (i = 0; i < MAX_HOSTS; i++) { if (levelStatus[i] != 255) { if (levelStatus[i] == 0) { Dbg_Server ("level rejected by clients\n"); return XBFalse; } } } Dbg_Server ("level approved by clients\n"); return XBTrue; } /* Server_LevelApproved */ /* * read player keys from local buffer */ void Server_GetPlayerAction (unsigned id, int player, PlayerAction * action) { assert (id > 0); assert (id < MAX_HOSTS); assert (player < MAX_PLAYER); assert (playerAction != NULL); /* copy data */ *action = playerAction[id][player]; } /* Server_GetPlayerAction */ /* * check winner list for async */ XBBool Server_LevelAsync (void) { if (currentWinner != TEAM_ASYNC) { Dbg_Server ("level results match!\n"); return XBFalse; } else { Dbg_Server ("level results asynced (%s)!\n", levelWinnerStr); return XBTrue; } } /* Server_LevelAsync */ /********************** * local data setting * **********************/ /* * clear level status list for level checking */ void Server_ClearLevelStatus (void) { unsigned i; Dbg_Server ("clearing level negotiation status\n"); for (i = 0; i < MAX_HOSTS; i++) { levelStatus[i] = 255; } /* undefined value */ } /* Server_ClearLevelStatus */ /* * set the level status for a single client */ void Server_SetLevelStatus (unsigned id, XBBool val) { assert (id < MAX_HOSTS); levelStatus[id] = val ? 1 : 0; Dbg_Server ("level is %s by %u\n", val ? "accepted" : "rejected", id); } /* Server_SetLevelStatus */ /* * reset datagrams connections for new level */ void Server_ResetPlayerAction (void) { unsigned client; for (client = 1; client < MAX_HOSTS; client++) { if (D2C_Connected (client)) { D2C_Reset (client); } } Dbg_Server ("reset frames for all hosts\n"); } /* Server_ResetPlayerAction */ /* * clear player action data */ void Server_ClearPlayerAction (void) { unsigned id; int player; for (id = 0; id < MAX_HOSTS; id++) { for (player = 0; player < MAX_PLAYER; player++) { playerAction[id][player].player = player; playerAction[id][player].dir = GoDefault; playerAction[id][player].bomb = XBFalse; playerAction[id][player].special = XBFalse; playerAction[id][player].pause = XBFalse; playerAction[id][player].suicide = XBFalse; playerAction[id][player].abort = ABORT_NONE; } } /* Dbg_Server("cleared action for all hosts\n"); */ } /* Server_ClearPlayerAction */ /* * clear the winner list for async checking */ void Server_ClearLevelWinners (void) { unsigned i; Dbg_Server ("clearing winner list\n"); for (i = 0; i < MAX_HOSTS; i++) { levelWinner[i] = TEAM_UNDEF; currentWinner = TEAM_UNDEF; sprintf (levelWinnerStr + 3 * i, "-- "); } } /* Server_ClearLevelWinners */ /****************** * queue data out * ******************/ /* * queue all current game configs to client */ void Server_SendAllConfigs (unsigned id) { unsigned client; unsigned player; unsigned rclient; XBHostState *hReq; XBTeamState *tReq; XBAtom atom; assert (id > 0); assert (id < MAX_HOSTS); for (client = 0; client < MAX_HOSTS; client++) { if (client == 0 || S2C_Connected (client)) { /* send game configs to client */ S2C_SendGameConfig (id, client, LOCALGAMECONFIG (client)); S2C_SendHostState (id, client, Network_GetHostState (client)); hReq = Network_GetHostStateReq (client); for (rclient = 0; rclient < MAX_HOSTS; rclient++) { if (rclient == 0 || S2C_Connected (rclient)) { S2C_SendHostStateReq (id, rclient, client, hReq[rclient]); } } /* send player configs to client */ for (player = 0; player < NUM_LOCAL_PLAYER; player++) { atom = Network_GetPlayer (client, player); if (ATOM_INVALID != atom) { S2C_SendPlayerConfig (id, client, player, atom); S2C_SendTeamState (id, client, player, Network_GetTeamState (client, player)); tReq = Network_GetTeamStateReq (client, player); for (rclient = 0; rclient < MAX_HOSTS; rclient++) { if (rclient == 0 || S2C_Connected (rclient)) { S2C_SendTeamStateReq (id, rclient, client, player, tReq[rclient]); } } } } Dbg_Server ("Queued data for host #%u to %u\n", client, id); } } } /* Server_SendAllConfigs */ /* * queue dgram port to client */ void Server_SendDgramPort (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); S2C_SendDgramPort (id, D2C_Port (id)); Dbg_Server ("queueing dgram port number to host #%u\n", id); } /* Server_SendDgramPort */ /* * queue request for game config to client */ void Server_QueryGameConfig (unsigned id) { assert (id > 0); assert (id < MAX_HOSTS); S2C_QueryGameConfig (id); Dbg_Server ("queueing game config request to host #%u\n", id); } /* Server_QueryGameConfig */ /* * queue game config of client to all hosts */ void Server_SendGameConfig (unsigned id) { unsigned client; XBAtom atom; assert (id < MAX_HOSTS); atom = (id == 0) ? SERVERGAMECONFIG : LOCALGAMECONFIG (id); for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_SendGameConfig (client, id, atom); } } Dbg_Server ("queueing game config #%u to clients\n", id); } /* Server_SendGameConfig */ /* * queue request for player config to client */ void Server_QueryPlayerConfigs (unsigned id, unsigned cnt) { unsigned player; assert (id < MAX_HOSTS); if (id > 0) { for (player = 0; player < cnt; player++) { DeletePlayerConfig (CT_Demo, Network_GetPlayer (id, player)); S2C_QueryPlayerConfig (id, player); } Dbg_Server ("queueing %u player config requests to host #%u\n", cnt, id); } } /* Server_QueryPlayerConfigs */ /* * queue player config of client id:player to all hosts */ void Server_SendPlayerConfig (unsigned id, unsigned player) { unsigned client; XBAtom atom; assert (id < MAX_HOSTS); atom = Network_GetPlayer (id, player); assert (ATOM_INVALID != atom); for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_SendPlayerConfig (client, id, player, atom); } } Dbg_Server ("queueing player config #%u:%u to hosts\n", id, player); } /* Server_SendPlayerConfig */ /* * requeue a received chat to connected clients */ void Server_SendChat (XBChat * chat) { unsigned client; for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_SendChat (client, chat); } } Dbg_Server ("requeuing chat to clients\n"); } /* Server_SendChat */ /* * server system message on chat */ void Server_SysChat (const char *txt) { XBChat *chat = Chat_CreateSys (); assert (NULL != txt); Chat_SetText (chat, txt); Server_ReceiveChat (chat); } /* Server_SysChat */ /* * queue host state to all clients and sync local data */ void Server_SendHostState (unsigned id, XBHostState state) { unsigned clientID; assert (id < MAX_HOSTS); Network_ReceiveHostState (id, state); for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendHostState (clientID, id, state); } } Dbg_Server ("queued host state for host #%u=%u to hosts\n", id, state); } /* Server_SendHostState */ /* * queue team state to all clients and sync local data */ void Server_SendTeamState (unsigned id, unsigned player, XBTeamState team) { unsigned clientID; assert (id < MAX_HOSTS); assert (player < MAX_HOSTS); Network_ReceiveTeamState (id, player, team); for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendTeamState (clientID, id, player, team); } } Dbg_Server ("queued team state for host #%u(%u)=%u to hosts\n", id, player, team); } /* Server_SendTeamState */ /* * queue host state request from id for host to state and sync local data */ void Server_SendHostStateReq (unsigned id, unsigned host, XBHostState state) { unsigned clientID; assert (id < MAX_HOSTS); assert (host < MAX_HOSTS); for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendHostStateReq (clientID, id, host, state); } } Dbg_Server ("queued host request #%u->%u by #%u to hosts\n", host, state, id); } /* Server_SendHostStateReq */ /* * queue team state request from id for host:player to state and sync local data */ void Server_SendTeamStateReq (unsigned id, unsigned host, unsigned player, XBTeamState team) { unsigned clientID; assert (id < MAX_HOSTS); assert (host < MAX_HOSTS); assert (player < MAX_HOSTS); for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendTeamStateReq (clientID, id, host, player, team); } } Dbg_Server ("queued requested team state for player #%u(%u)->%u by #%u to hosts\n", host, player, team, id); } /* Server_SendTeamStateReq */ /* * queue disconnect info to clients */ void Server_SendDisconnectInfo (unsigned clientID) { unsigned id; unsigned cnt = 0; for (id = 1; id < MAX_HOSTS; id++) { if (S2C_Connected (id)) { cnt++; S2C_HostDisconnected (id, clientID); } } if (cnt) { Dbg_Server ("queued disconnect of host #%u to %u hosts\n", clientID, cnt); } } /* SendDisconnectInfo */ /* * queue start game to single client */ void Server_SendStart (void) { unsigned client; Server_StopListen (); Server_SendDisconnectOut (); Dbg_Server ("disconnecting all hosts that are out\n"); Server_SendGameConfig (0); for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_StartGame (client); Dbg_Server ("queued start to host #%u\n", client); } } } /* Server_SendStart */ /* * queue random seed to clients */ void Server_SendRandomSeed (void) { unsigned client; unsigned seed = GetRandomSeed (); for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_SendRandomSeed (client, seed); } } Dbg_Server ("queued random seed %u to hosts\n", seed); } /* Server_SendRandomSeed */ /* * queue level data to all clients */ void Server_SendLevel (const DBRoot * level) { unsigned client; for (client = 1; client < MAX_HOSTS; client++) { if (S2C_Connected (client)) { S2C_SendLevelConfig (client, level); } } Dbg_Server ("queued level data to hosts\n"); } /* Server_SendLevel */ /* * queue level activation to all clients */ void Server_SendLevelActivate (void) { unsigned clientID; /* to all connected client */ for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendLevelActivate (clientID); } } Dbg_Server ("queued level activation to hosts\n"); } /* Server_SendLevelActivate */ /* * queue level reset to all clients */ void Server_SendLevelReset (void) { unsigned clientID; /* to all connected client */ for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_SendLevelReset (clientID); } } Dbg_Server ("queued level reset to hosts\n"); } /* Server_SendLevelReset */ /* * queue player action to client */ void Server_SendPlayerAction (int gameTime, const PlayerAction * playerAction) { unsigned client; for (client = 1; client < MAX_HOSTS; client++) { if (D2C_Connected (client)) { D2C_SendPlayerAction (client, gameTime, playerAction); } } /* Dbg_Server("queued actions for gt=%u to hosts\n", gameTime); */ } /* Server_SendPlayerAction */ /* * queue finish player actions (= end of level) to clients */ void Server_FinishPlayerAction (int gameTime) { unsigned client; for (client = 1; client < MAX_HOSTS; client++) { if (D2C_Connected (client)) { D2C_SendFinish (client, gameTime); } } Dbg_Server ("queued FINISH to hosts\n"); } /* Server_FinishPlayerAction */ /* * flush last player actions */ XBBool Server_FlushPlayerAction (void) { XBBool result; unsigned client; result = XBTrue; for (client = 1; client < MAX_HOSTS; client++) { if (D2C_Connected (client)) { if (!D2C_Flush (client)) { result = XBFalse; } } } Dbg_Server ("flushing actions: (%s needed)\n", result ? "not" : ""); return result; } /* Server_FlushPlayerAction */ /* * tell clients that all clients have reached sync point */ void Server_SendSync (XBNetworkEvent event) { unsigned clientID; /* to all connected client */ for (clientID = 1; clientID < MAX_HOSTS; clientID++) { if (S2C_Connected (clientID)) { S2C_Sync (clientID, event); } } Dbg_Server ("queued sync %u to hosts\n", event); } /* Server_SendSync */ /* * queue a level sync result to all clients */ void Server_SendLevelSync (void) { unsigned id; /* to all connected client */ for (id = 1; id < MAX_HOSTS; id++) { if (S2C_Connected (id)) { S2C_SendLevelSync (id); } } Dbg_Server ("queued LevelSync to clients\n"); } /* Server_SendLevelSync */ /* * queue a level async signal to all clients */ void Server_SendLevelAsync (void) { unsigned id; /* to all connected client */ for (id = 1; id < MAX_HOSTS; id++) { if (S2C_Connected (id)) { S2C_SendLevelAsync (id); } } Server_SysChat (TempString ("level async ! (%s)", levelWinnerStr)); Dbg_Server ("queued LevelAsync to clients\n"); } /* Server_SendLevelAsync */ /*********************** * central connections * ***********************/ /* * create connection to central for game info */ void Server_StartCentralNewGame (const CFGGameHost * cfg, const CFGGameSetup * setup) { #ifdef OLDIFCODE size_t numInter; const XBSocketInterface *inter; size_t i, j; #endif CFGCentralSetup centralSetup; assert (NULL == query); Dbg_Server ("attempting to register game\n"); #ifndef OLDIFCODE RetrieveCentralSetup (¢ralSetup); if (NULL == centralSetup.name) { Dbg_Server ("no central defined!\n"); return; } /* alloc a single communication to central */ query = calloc (2, sizeof (XBComm *)); assert (NULL != query); /* let system choose the interface to central */ Dbg_Server ("connecting to central %s:%u\n", centralSetup.name, centralSetup.port); query[0] = NewGame_CreateComm (NULL, centralSetup.port, centralSetup.name, cfg, setup); if (NULL == query[0]) { Dbg_Server ("failed to establish socket to central, game not visible in central\n"); free (query); return; } Dbg_Server ("socket to central established\n"); #else inter = Socket_GetInterfaces (&numInter); if (NULL == inter) { Dbg_Server ("no interfaces found!\n"); return; } Dbg_Server ("interfaces found = %u\n", numInter); RetrieveCentralSetup (¢ralSetup); if (NULL == centralSetup.name) { Dbg_Server ("no central defined!\n"); return; } /* alloc 1 pointer (to central) */ query = calloc (1 + numInter, sizeof (XBComm *)); assert (NULL != query); Dbg_Server ("connecting to central %s:%u\n", centralSetup.name, centralSetup.port); /* start query on at most one device */ /* FIXXX used to be i=1 worked on linux */ #ifdef W32 Dbg_Server ("W32\n"); #ifdef CYG for (i = 0, j = 0; (j == 0) && (i < numInter); i++) { #else for (i = 1, j = 0; (j == 0) && (i < numInter); i++) { #endif #else Dbg_Server ("Linux\n"); for (i = 1, j = 0; (j == 0) && (i < numInter); i++) { #endif if (NULL != (query[j] = NewGame_CreateComm (inter[i].addrDevice, centralSetup.port, centralSetup.name, cfg, setup))) { Dbg_Server ("established query to %s on interface %u\n", centralSetup.name, i); j++; } } /* make sure not more than one device is used, would clash with close routines */ assert (j == 1); #endif /* queue initial data to central */ Server_RestartNewGame (1, ""); } /* Server_StartCentralNewGame */ /* * queue game info to central */ /* GAMEONFIX */ void Server_RestartNewGame (int num, const char *score) { if (NULL != query) { struct timeval tv; int i; gettimeofday (&tv, NULL); for (i = 0; query[i] != NULL; i++) { NewGame_Send (query[i], &tv, num, score); Dbg_Server ("queued game data to central\n"); } } } /* Server_RestartQuery */ /* GAMEONFIX */ /* * queue request to central for removing game info */ void Server_CloseNewGame (void) { if (NULL != query) { struct timeval tv; int i; gettimeofday (&tv, NULL); for (i = 0; query[i] != NULL; i++) { NewGame_Close (query[i], &tv); Dbg_Server ("queued game close to central\n"); } } } /* Server_CloseNewGame */ /* * delete open connection to central */ void Server_StopNewGame (void) { size_t i; /* delete communications */ assert (NULL != query); for (i = 0; query[i] != NULL; i++) { assert (i == 0); Dbg_Server ("forcing stop of previous newgame\n"); CommDelete (query[i]); } } /* Server_StopQuery */ /* * receive close event from query */ void Server_ReceiveNewGameClose (void) { assert (NULL != query); free (query); query = NULL; Dbg_Server ("removed newgame sockets to central\n"); } /**/ /* * end of file server.c */ xblast-2.10.4/server.h0000644000175000017500000001367410373126067013707 0ustar rhondaalfie/* * file server.h - communication interface for the server * * $Id: server.h,v 1.33 2006/02/10 15:07:35 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SERVER_H #define XBLAST_SERVER_H /* * global enums */ typedef enum { XBSC_GameTime, /* future actions received, client is async */ XBSC_IOError, /* i/o error on stream */ XBSC_WriteError, /* write error on dgram */ XBSC_ConnFailed, /* connection failed on dgram */ XBSC_Timeout, /* timeout on dgram */ XBSC_COTInvalid, /* invalid cot received */ XBSC_IDInvalid, /* invalid id received */ XBSC_DataInvalid, /* invalid data received */ XBSC_MissingData, /* client has not requested data */ XBSC_UnexpectedEOF, /* client shut down unexpectedly */ XBSC_ExpectedEOF /* expected eof, possibly due to i/o or parse error */ , XBSC_StreamWaiting, /* all queued data sent on stream */ XBSC_StreamBusy, /* queued data on stream partially sent */ XBSC_StreamClosed, /* stream has been removed */ XBSC_DgramClosed, /* dgram has been removed */ } XBServerConstants; /* * global prototypes */ /* starting/closing server */ extern XBBool Server_StartListen (CFGGameHost *); extern void Server_StopListen (void); extern void Server_ReceiveListenClose (XBBool); /* connecting/disconnecting */ extern void Server_Accept (unsigned id, const char *host, unsigned port); extern void Server_StreamDisconnect (unsigned id); extern void Server_DgramDisconnect (unsigned id); extern void Server_SendDisconnect (unsigned id); extern void Server_SendDisconnectAll (void); /* error handling */ extern XBBool Server_StreamEvent (unsigned id, XBServerConstants code); extern XBBool Server_DgramEvent (unsigned id, XBServerConstants code); /* receiving data */ extern XBBool Server_ReceiveGameConfig (unsigned id, const char *line); extern XBBool Server_ReceivePlayerConfig (unsigned id, int player, const char *line); extern void Server_ReceiveDisconnect (unsigned id); extern void Server_ReceiveDgramPort (unsigned id, unsigned short port); extern void Server_ReceiveHostStateReq (unsigned id, unsigned host, XBHostState state); extern void Server_ReceiveTeamStateReq (unsigned id, unsigned host, unsigned player, XBTeamState state); extern void Server_ReceiveChat (XBChat *); extern void Server_ReceivePing (unsigned id, int ping); extern void Server_ReceiveSync (unsigned id, XBNetworkEvent); extern void Server_ReceiveLevelCheck (unsigned id, unsigned stat); extern void Server_ReceivePlayerAction (unsigned id, int gameTime, const PlayerAction * playerAction); extern void Server_ReceiveFinish (unsigned id); extern void Server_ReceiveWinnerTeam (unsigned id, unsigned team); /* retrieving local data */ extern XBBool GetIsServer (void); extern void SetIsServer (XBBool value); extern int Server_GetPingTime (unsigned id); extern XBHostState Server_GetHostState (unsigned id); extern XBTeamState Server_GetTeamState (unsigned id, unsigned player); extern XBHostState *Server_GetHostStateReq (unsigned id); extern XBTeamState *Server_GetTeamStateReq (unsigned id, unsigned player); extern XBBool Server_LevelApproved (void); extern void Server_GetPlayerAction (unsigned id, int player, PlayerAction * action); extern XBBool Server_LevelAsync (void); /* setting local data */ extern void Server_ClearLevelStatus (void); extern void Server_SetLevelStatus (unsigned id, XBBool val); extern void Server_ResetPlayerAction (void); extern void Server_ClearPlayerAction (void); extern void Server_ClearLevelWinners (void); extern void Server_SetLevelWinners (unsigned id, unsigned team); /* queueing out data */ extern void Server_SendAllConfigs (unsigned id); extern void Server_SendDgramPort (unsigned id); extern void Server_QueryGameConfig (unsigned id); extern void Server_SendGameConfig (unsigned id); extern void Server_QueryPlayerConfigs (unsigned id, unsigned cnt); extern void Server_SendPlayerConfig (unsigned id, unsigned player); extern void Server_SendHostState (unsigned id, XBHostState state); extern void Server_SendTeamState (unsigned id, unsigned player, XBTeamState team); extern void Server_SendHostStateReq (unsigned id, unsigned host, XBHostState state); extern void Server_SendTeamStateReq (unsigned id, unsigned host, unsigned player, XBTeamState state); extern void Server_SendDisconnectInfo (unsigned clientID); extern void Server_SendChat (XBChat * chat); extern void Server_SysChat (const char *); extern void Server_SendStart (void); extern void Server_SendRandomSeed (void); extern void Server_SendLevel (const DBRoot * level); extern void Server_SendLevelActivate (void); extern void Server_SendLevelReset (void); extern void Server_SendSync (XBNetworkEvent); extern void Server_SendPlayerAction (int gameTime, const PlayerAction * action); extern void Server_FinishPlayerAction (int gameTime); extern XBBool Server_FlushPlayerAction (void); extern void Server_SendLevelSync (void); extern void Server_SendLevelAsync (void); /* connection to central */ extern void Server_StartCentralNewGame (const CFGGameHost * cfg, const CFGGameSetup * setup); extern void Server_RestartNewGame (int num, const char *score); extern void Server_CloseNewGame (void); extern void Server_StopNewGame (void); extern void Server_ReceiveNewGameClose (void); #endif /* * end of file server.h */ xblast-2.10.4/shrink.c0000644000175000017500000004061210412220337013647 0ustar rhondaalfie/* * file shrink.c - level shrink and scrambling blocks * * $Id: shrink.c,v 1.18 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local constants */ #define SHRINK_WARN_OFFSET 55 /* * shrink element structure */ /* generic shrink data typedef struct { int time; BMMapTile block; short x,y; } ShrinkGeneric; */ /* gd shrink data */ typedef struct { int x, y; int offset; int level; } shri_data; typedef int shri_xoff_data; typedef struct { int offset; int level; int block; } shri_style2; typedef struct { int num; shri_style2 *styl; } shri_style; /* Scramble Structure */ typedef struct { int time; int num_blocks; BMPosition *blocks; } ScrambleStruct; /* * local variables - retrieved from level data */ static int shrinkType; static char *stVoidName = "No Shrink"; /* * other local variables */ static SND_Id shrinkSound = SND_SPIRAL; static XBBool soundFlipflop = XBTrue; static XBBool playShrink = XBTrue; static ShrinkGeneric *shrink_ptr = NULL; static ShrinkGeneric *shrink_ptr1 = NULL; static ShrinkGeneric *shrink_data = NULL; static ShrinkGeneric shrink_data_none[] = { /* terminator */ {2 * GAME_TIME, 0, 0, 0}, }; /* conversion table */ static DBToInt shrinkTable[] = { {"circle", ST_Circle}, {"compound", ST_Compound}, {"compound2F", ST_Compound2F}, {"compoundExtra", ST_CompoundExtra}, {"compoundF", ST_CompoundF}, {"compoundSolid", ST_CompoundSolid}, {"constrictWave", ST_ConstrictWave}, {"diag", ST_Diag}, {"down", ST_Down}, {"downF", ST_DownF}, {"earlySpiral", ST_EarlySpiral}, {"horizontal", ST_Horiz}, {"istyCompound2F", ST_IstyCompound2F}, {"istySpiral", ST_IstySpiral3}, {"lazyCompoundF", ST_LazyCompoundF}, {"move", ST_Move}, {"outwardExtra", ST_OutwardExtra}, {"outwardSpiral", ST_OutwardSpiral}, {"quad", ST_Quad}, {"savageCompound", ST_SavageCompound}, {"speedSpiral", ST_SpeedSpiral}, {"spiral", ST_Spiral}, {"spiral23", ST_Spiral23}, {"spiral3", ST_Spiral3}, {"spiral5", ST_Spiral5}, {"spiralLego", ST_SpiralLego}, {"spiralPlus", ST_SpiralPlus}, {"void", ST_Void}, {NULL, -1}, }; /* shrink info text */ static const char *shrinkName[NUM_ST] = { NULL, "Spiral shrinking at half time", "Fast spiral shrinking at half time", "Spiral shrinking at half time", "3 level spiral shrinking at half time", "Fast spiral shrinking at half time", "1 level spiral shrinking at three quarter of time", "Spiral shrinking just before half time", "Continuous compound shrinking", "Continuous compound shrinking", "2 level compound shrinking", "Lazy compound shrinking", "Continuous compound shrinking", "Double continous compound shrinking", "Compound shrinking with blastables", "Continuous downward shrinking", "Continuous downward shrinking", "Quad shrinking at half time", "3 level wave shrink at half time", "Anticlockwise outward spiralling shrink", "Early Horizontal shrink ", "Cirlcle shrink (rephrase)", "Moving shrink (rephrase)", "Isty spiral 3 (rephrase)", "Isty compound 2F (rephrase)", "Diagonal shrink (rephrase)", "Outward compound extra (rephrase)", "Spiral5 (rephrase)" }; /* * include shrinkdata */ #include "shrinkdat.h" /* XBCC */ int getShrinkTimes (int p_time) { static ShrinkGeneric *s_ptr = NULL; if (p_time < 0) { s_ptr = shrink_data; } if (s_ptr == NULL) { return 0; } while (p_time == s_ptr->time) { s_ptr++; } if (s_ptr->time == 2 * GAME_TIME) { return 0; } else { return s_ptr->time; } } /* * */ static int CmpShrink (const void *a, const void *b) { return (((const ShrinkGeneric *) a)->time - ((const ShrinkGeneric *) b)->time); } /* CmpShrink */ /* * */ static void SortShrinkArray (ShrinkGeneric * data, int nelem) { qsort (data, nelem, sizeof (ShrinkGeneric), CmpShrink); } /* SortShrinkArray */ ShrinkGeneric * GetShrinkPtr (void) { return shrink_ptr; } /* * */ void DoShrink (int g_time) { if (g_time == shrink_ptr->time - SHRINK_WARN_OFFSET) { SND_Play (SND_WARN, SOUND_MIDDLE_POSITION); } // fprintf(stderr," time %i %s \n",g_time,GetShrinkName(shrinkType)); while ((g_time) == shrink_ptr->time) { // fprintf(stderr," %i %i \n",shrink_ptr->x, shrink_ptr->y); /* set block */ SetMazeBlock (shrink_ptr->x, shrink_ptr->y, shrink_ptr->block); if (playShrink) { if (soundFlipflop) { SND_Play (shrinkSound, (shrink_ptr->x * BLOCK_WIDTH) / (PIXW / MAX_SOUND_POSITION)); soundFlipflop = XBFalse; playShrink = XBFalse; } else { soundFlipflop = XBTrue; } } /* for solid blocks kill players and delete bombs */ if ((shrink_ptr->block == BTVoid) || (shrink_ptr->block == BTBlock) || (shrink_ptr->block == BTExtra)) { KillPlayerAtGhost (shrink_ptr->block, shrink_ptr->x, shrink_ptr->y); DeleteBombAt (shrink_ptr->x, shrink_ptr->y); } shrink_ptr++; } playShrink = XBTrue; } /* DoShrink */ void DoShrinkMapEdit (int g_time) { shrink_ptr = shrink_ptr1; if (g_time == shrink_ptr->time - SHRINK_WARN_OFFSET) { SND_Play (SND_WARN, SOUND_MIDDLE_POSITION); } while ((g_time) != shrink_ptr->time && shrink_ptr->time != 0 && shrink_ptr->time < g_time) { /* set block */ SetMazeBlock (shrink_ptr->x, shrink_ptr->y, shrink_ptr->block); shrink_ptr++; } playShrink = XBTrue; } /* DoShrink */ /* * Generic shrink function */ static void CreateGenericShrink (shri_data * data, shri_xoff_data * xoffdata, int startlevel, int endlevel, int inclevel, int starttime, int levelinctime, int offsetinctime, XBBool flags, shri_style * style) { int nelem; int i, st; ShrinkGeneric *dst; int acelm; int num_styles; int inclevel2; int st_offset; int st_level; int block; int offset; int xoff; int bigxoff; int reallevel; int dellevel; int levelstep; #ifdef DEBUG_SHRINK fprintf (stderr, "*GDS* Call\n"); fprintf (stderr, "startlevel: %3d endlevel: %3d inclevel: %3d starttime: %3d", startlevel, endlevel, inclevel, starttime); fprintf (stderr, "levelinctime: %3d offsetinctime: %3d flags: %1d\n", levelinctime, offsetinctime, flags); #endif /* Calculate the space required */ /* This is the maximum that could be used, without checking for levels etc. */ num_styles = style->num; for (nelem = 0; data[nelem].x != -1; nelem++) { /* per style */ } nelem *= num_styles; /* Total elements */ nelem++; /* Plus a terminator */ #ifdef DEBUG_SHRINK fprintf (stderr, "*GDS* Numstyles = %d nelem = %d\n", num_styles, nelem); #endif #ifdef DEBUG_SHRINK fprintf (stderr, "A total of %d blocks are needed\n", nelem); #endif /* alloc blocks memory */ assert (shrink_data == NULL); shrink_data = (ShrinkGeneric *) malloc (nelem * sizeof (ShrinkGeneric)); assert (shrink_data != NULL); dst = shrink_data; /* Pointer to current entry */ acelm = 0; /* To adjust xoff for start level */ if (flags) { bigxoff = xoffdata[startlevel]; } else { bigxoff = 0; } for (st = 0; st < num_styles; st++) { st_offset = style->styl[st].offset; st_level = style->styl[st].level; block = style->styl[st].block; for (i = 0; data[i].x != -1; i++) { offset = data[i].offset; reallevel = data[i].level - st_level; /* Check if in range */ if (((inclevel > 0) && (reallevel >= startlevel) && (reallevel <= endlevel)) || ((inclevel < 0) && (reallevel <= startlevel) && (reallevel >= endlevel))) { dellevel = reallevel - startlevel; inclevel2 = inclevel; if ((dellevel < 0) && (inclevel < 0)) { dellevel = -dellevel; inclevel2 = inclevel2; } if ((dellevel >= 0) && (inclevel >= 0) && !(dellevel % inclevel)) { levelstep = dellevel / inclevel; if (flags) { xoff = xoffdata[reallevel]; shrinkSound = SND_SPIRAL; } else { xoff = 0; shrinkSound = SND_COMPOUND; } dst->time = starttime + (levelstep * levelinctime) + ((offset + xoff - bigxoff) * offsetinctime) + st_offset; dst->x = data[i].x; dst->y = data[i].y; dst->block = block; #ifdef DEBUG_SHRINK fprintf (stderr, "*GDS* dst: %9d i: %3d st: %2d Time: %5d X: %3d Y: %3d Block: %2d\n", (int)dst, i, st, dst->time, dst->x, dst->y, dst->block); #endif dst++; /* Get ready for next one */ acelm++; } } } } dst->time = GAME_TIME * 2; dst->x = 0; dst->y = 0; dst->block = 0; acelm++; SortShrinkArray (shrink_data, acelm); shrink_ptr = shrink_data; shrink_ptr1 = shrink_ptr; } /* CreateShrinkGeneric */ /* * */ static void CreateSpiralShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (spiral_shri_data, spiral_xoff, startlevel, endlevel, 1, starttime, 0, speed, XBTrue, style); } /* CreateSpiralShrink */ /* * */ static void CreateQuadShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (quad_shri_data, quad_xoff, startlevel, endlevel, 1, starttime, 0, speed, XBTrue, style); } /* CreateQuadShrink */ /* * */ static void CreateWaveShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (quad_shri_data, quad_xoff, startlevel, endlevel, 1, starttime, speed, speed, XBFalse, style); } /* CreateWaveShrink */ static void CreateDiagShrink (int startlevel, int endlevel, int inc, int starttime, int speed, shri_style * style) { CreateGenericShrink (diag_shri_data, diag_xoff, startlevel, endlevel, inc, starttime, speed, 0, XBTrue, style); } /* CreateDiagShrink */ /* EPFL */ static void CreateHorizShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (horiz_shri_data, horiz_xoff, startlevel, endlevel, 1, starttime, 0, speed, XBTrue, style); } static void CreateCircleShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (circle_data, circle_xoff, startlevel, endlevel, 1, starttime, 0, speed, XBTrue, style); } static void CreateMoveShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (move_data, move_xoff, startlevel, endlevel, 1, starttime, 0, speed, XBTrue, style); } /* EPFL */ /* * */ static void CreateCompoundShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (spiral_shri_data, spiral_xoff, startlevel, endlevel, 1, starttime, speed, 0, XBFalse, style); } /* CreateCompoundShrink */ /* * */ static void CreateFancyCompoundShrink (int startlevel, int endlevel, int starttime, int speed, shri_style * style) { CreateGenericShrink (quad_shri_data, spiral_xoff, startlevel, endlevel, 1, starttime, speed, 2, XBFalse, style); } /* CreateFancyCompoundShrink */ /* * */ static void CreateVerticalShrink (int startlevel, int endlevel, int inc, int starttime, int speed, shri_style * style) { CreateGenericShrink (vertical_shri_data, vertical_xoff, startlevel, endlevel, inc, starttime, speed, 0, XBFalse, style); } /* CreateVerticalShrink */ static void CreateFancyVerticalShrink (int startlevel, int endlevel, int inc, int starttime, int speed, shri_style * style) { CreateGenericShrink (vertical_shri_data, vertical_xoff, startlevel, endlevel, inc, starttime, speed, 1, XBFalse, style); } /* CreateFancyVerticalShrink */ /* Now the actual shrink functions */ /* * parse shrink data in level data */ XBBool ParseLevelShrink (const DBSection * section, DBSection * warn) { /* check existence of section */ if (NULL == section) { Dbg_Out ("LEVEL: shrink section is missing!\n"); DB_CreateEntryString (warn, atomMissing, "true"); return XBFalse; } /* type has default */ switch (DB_ConvertEntryInt (section, atomType, (int *)&shrinkType, shrinkTable)) { case DCR_NoSuchEntry: Dbg_Level ("default for %s\n", DB_SectionEntryString (section, atomType)); shrinkType = ST_Void; break; case DCR_Failure: Dbg_Out ("LEVEL: warning %s\n", DB_SectionEntryString (section, atomType)); shrinkType = ST_Void; DB_CreateEntryString (warn, atomType, DB_IntToString (shrinkTable, shrinkType)); break; default: break; } return XBTrue; } /* ParseLevelShrink */ /* * configure selected shrink */ XBBool ConfigLevelShrink (const DBSection * section) { const char *s; assert (section != NULL); switch (shrinkType) { case ST_Void: shrink_ptr = shrink_data_none; break; case ST_Spiral: CreateSpiralShrink (1, 2, GAME_TIME / 2, 4, &style_rise_2); break; case ST_SpeedSpiral: CreateSpiralShrink (1, 2, GAME_TIME / 2, 2, &style_rise_2); break; case ST_SpiralPlus: CreateSpiralShrink (0, 2, GAME_TIME / 2, 4, &style_rise_2_plus); break; case ST_Spiral3: CreateSpiralShrink (1, 3, GAME_TIME / 2, 4, &style_rise_2); break; case ST_Spiral23: CreateSpiralShrink (2, 3, GAME_TIME / 2, 2, &style_rise_2_plus); break; case ST_SpiralLego: CreateSpiralShrink (3, 3, 3 * GAME_TIME / 4, 4, &style_rise_2_plus); break; case ST_EarlySpiral: CreateSpiralShrink (1, 2, 3 * GAME_TIME / 8, 4, &style_rise_2); break; case ST_Compound: CreateCompoundShrink (1, 5, GAME_TIME / 6, GAME_TIME / 6, &style_compound); break; case ST_CompoundF: CreateFancyCompoundShrink (1, 5, GAME_TIME / 6, GAME_TIME / 6, &style_compound); break; case ST_Compound2F: CreateFancyCompoundShrink (1, 2, GAME_TIME / 2, GAME_TIME / 6, &style_compound); break; case ST_LazyCompoundF: CreateFancyCompoundShrink (1, 3, GAME_TIME / 3, GAME_TIME / 3, &style_compound_solid); break; case ST_CompoundSolid: CreateCompoundShrink (1, 5, GAME_TIME / 6, GAME_TIME / 6, &style_compound_solid); break; case ST_SavageCompound: CreateCompoundShrink (2, 5, GAME_TIME / 6, GAME_TIME / 3, &style_savage_compound); break; case ST_CompoundExtra: CreateCompoundShrink (2, 5, GAME_TIME / 6, GAME_TIME / 6, &style_compound_extra); break; case ST_Down: CreateVerticalShrink (1, 11, 1, GAME_TIME / 11, GAME_TIME / 11, &style_compound); break; case ST_DownF: CreateFancyVerticalShrink (1, 11, 1, GAME_TIME / 11, GAME_TIME / 11, &style_compound); break; case ST_Quad: CreateQuadShrink (1, 3, GAME_TIME / 2, 16, &style_rise_2); break; case ST_ConstrictWave: CreateWaveShrink (1, 3, GAME_TIME / 2, 5, &style_rise_2_plus); break; case ST_OutwardSpiral: CreateGenericShrink (spiral_shri_data, spiral_xoff, 2, 5, 1, 3 * GAME_TIME / 8, -100, -3, XBFalse, &style_rise_2); break; /* EPFL */ case ST_Horiz: CreateHorizShrink (1, 5, GAME_TIME / 8, 20, &style_rise_2); break; case ST_Circle: CreateCircleShrink (0, 4, GAME_TIME / 8, 20, &style_rise_2); break; case ST_Move: CreateMoveShrink (0, 119, 1, 34, &style_move); break; case ST_IstySpiral3: CreateSpiralShrink (1, 3, GAME_TIME / 12, 5, &style_rise_2); break; case ST_IstyCompound2F: CreateFancyCompoundShrink (2, 5, GAME_TIME / 2, GAME_TIME / 4, &style_compound); break; case ST_Diag: CreateDiagShrink (1, 23, 1, GAME_TIME / 23, GAME_TIME / 23, &style_rise_2); break; case ST_OutwardExtra: CreateCompoundShrink (1, 3, GAME_TIME / 2, -GAME_TIME / 6, &style_outward_compound_extra); break; case ST_Spiral5: CreateSpiralShrink (1, 5, GAME_TIME / 4, 5, &style_rise_2); break; /* EPFL */ default: break; } /* make info entry */ if (NULL != (s = shrinkName[shrinkType])) { AddLevelInfo (s); } shrink_ptr1 = shrink_ptr; return XBTrue; } /* ConfigLevelShrink */ /* * cleaning up */ void FinishLevelShrink (void) { if (NULL != shrink_data) { free (shrink_data); shrink_data = NULL; } } /* FinishShrink */ /* * return the name of the shrink type */ const char * GetShrinkName (XBShrinkType type) { int i; if (type == ST_Void) return stVoidName; for (i = 0; i < NUM_ST; ++i) if (shrinkTable[i].value == type) return shrinkTable[i].key; return stVoidName; } /* * end of file shrink.c */ xblast-2.10.4/shrink.h0000644000175000017500000000375510373126067013676 0ustar rhondaalfie/* * file shrink.h - level shrink and scrambling blocks * * $Id: shrink.h,v 1.10 2006/02/10 15:07:35 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SHRINK_H #define _SHRINK_H /* * prototypes */ extern XBBool ConfigLevelShrink (const DBSection *); extern void FinishLevelShrink (void); extern void DoShrink (int g_time); extern void DoShrinkMapEdit (int g_time); extern XBBool ParseLevelShrink (const DBSection * section, DBSection *); /* generic shrink data */ typedef struct { int time; BMMapTile block; short x, y; } ShrinkGeneric; extern ShrinkGeneric *GetShrinkPtr (void); /* XBCC */ extern int getShrinkTimes (int p_time); /* * type definitions */ typedef enum { ST_Void, ST_Spiral, ST_SpeedSpiral, ST_SpiralPlus, ST_Spiral3, ST_Spiral23, ST_SpiralLego, ST_EarlySpiral, ST_Compound, ST_CompoundF, ST_Compound2F, ST_LazyCompoundF, ST_CompoundSolid, ST_SavageCompound, ST_CompoundExtra, ST_Down, ST_DownF, ST_Quad, ST_ConstrictWave, ST_OutwardSpiral, /* no new shrink after this line */ /* EPFL */ ST_Horiz, ST_Circle, ST_Move, ST_IstySpiral3, ST_IstyCompound2F, ST_Diag, ST_OutwardExtra, ST_Spiral5, /* EPFL */ NUM_ST } XBShrinkType; extern const char *GetShrinkName (XBShrinkType type); #endif /* * end of file shrink.h */ xblast-2.10.4/shrinkdat.h0000644000175000017500000014233410372705223014360 0ustar rhondaalfie/* * file shrinkdat.h - basic elements for shrink patterns * * $Id: shrinkdat.h,v 1.4 2006/02/09 18:31:47 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Revision 1.1 1999/06/20 19:54:03 xblast * Initial revision */ #ifndef _SHRINKDAT_H #define _SHRINKDAT_H /* Spiral and compound shrink data */ static shri_data spiral_shri_data[] = { /* Level 0 */ {0, 12, 0, 0}, {0, 11, 1, 0}, {0, 10, 2, 0}, {0, 9, 3, 0}, {0, 8, 4, 0}, {0, 7, 5, 0}, {0, 6, 6, 0}, {0, 5, 7, 0}, {0, 4, 8, 0}, {0, 3, 9, 0}, {0, 2, 10, 0}, {0, 1, 11, 0}, {0, 0, 12, 0}, {1, 0, 13, 0}, {2, 0, 14, 0}, {3, 0, 15, 0}, {4, 0, 16, 0}, {5, 0, 17, 0}, {6, 0, 18, 0}, {7, 0, 19, 0}, {8, 0, 20, 0}, {9, 0, 21, 0}, {10, 0, 22, 0}, {11, 0, 23, 0}, {12, 0, 24, 0}, {13, 0, 25, 0}, {14, 0, 26, 0}, {14, 1, 27, 0}, {14, 2, 28, 0}, {14, 3, 29, 0}, {14, 4, 30, 0}, {14, 5, 31, 0}, {14, 6, 32, 0}, {14, 7, 33, 0}, {14, 8, 34, 0}, {14, 9, 35, 0}, {14, 10, 36, 0}, {14, 11, 37, 0}, {14, 12, 38, 0}, {13, 12, 39, 0}, {12, 12, 40, 0}, {11, 12, 41, 0}, {10, 12, 42, 0}, {9, 12, 43, 0}, {8, 12, 44, 0}, {7, 12, 45, 0}, {6, 12, 46, 0}, {5, 12, 47, 0}, {4, 12, 48, 0}, {3, 12, 49, 0}, {2, 12, 50, 0}, {1, 12, 51, 0}, /* Level 1 */ {1, 11, 0, 1}, {1, 10, 1, 1}, {1, 9, 2, 1}, {1, 8, 3, 1}, {1, 7, 4, 1}, {1, 6, 5, 1}, {1, 5, 6, 1}, {1, 4, 7, 1}, {1, 3, 8, 1}, {1, 2, 9, 1}, {1, 1, 10, 1}, {2, 1, 11, 1}, {3, 1, 12, 1}, {4, 1, 13, 1}, {5, 1, 14, 1}, {6, 1, 15, 1}, {7, 1, 16, 1}, {8, 1, 17, 1}, {9, 1, 18, 1}, {10, 1, 19, 1}, {11, 1, 20, 1}, {12, 1, 21, 1}, {13, 1, 22, 1}, {13, 2, 23, 1}, {13, 3, 24, 1}, {13, 4, 25, 1}, {13, 5, 26, 1}, {13, 6, 27, 1}, {13, 7, 28, 1}, {13, 8, 29, 1}, {13, 9, 30, 1}, {13, 10, 31, 1}, {13, 11, 32, 1}, {12, 11, 33, 1}, {11, 11, 34, 1}, {10, 11, 35, 1}, {9, 11, 36, 1}, {8, 11, 37, 1}, {7, 11, 38, 1}, {6, 11, 39, 1}, {5, 11, 40, 1}, {4, 11, 41, 1}, {3, 11, 42, 1}, {2, 11, 43, 1}, /* Level 2 */ {2, 10, 0, 2}, {2, 9, 1, 2}, {2, 8, 2, 2}, {2, 7, 3, 2}, {2, 6, 4, 2}, {2, 5, 5, 2}, {2, 4, 6, 2}, {2, 3, 7, 2}, {2, 2, 8, 2}, {3, 2, 9, 2}, {4, 2, 10, 2}, {5, 2, 11, 2}, {6, 2, 12, 2}, {7, 2, 13, 2}, {8, 2, 14, 2}, {9, 2, 15, 2}, {10, 2, 16, 2}, {11, 2, 17, 2}, {12, 2, 18, 2}, {12, 3, 19, 2}, {12, 4, 20, 2}, {12, 5, 21, 2}, {12, 6, 22, 2}, {12, 7, 23, 2}, {12, 8, 24, 2}, {12, 9, 25, 2}, {12, 10, 26, 2}, {11, 10, 27, 2}, {10, 10, 28, 2}, {9, 10, 29, 2}, {8, 10, 30, 2}, {7, 10, 31, 2}, {6, 10, 32, 2}, {5, 10, 33, 2}, {4, 10, 34, 2}, {3, 10, 35, 2}, /* Level 3 */ {3, 9, 0, 3}, {3, 8, 1, 3}, {3, 7, 2, 3}, {3, 6, 3, 3}, {3, 5, 4, 3}, {3, 4, 5, 3}, {3, 3, 6, 3}, {4, 3, 7, 3}, {5, 3, 8, 3}, {6, 3, 9, 3}, {7, 3, 10, 3}, {8, 3, 11, 3}, {9, 3, 12, 3}, {10, 3, 13, 3}, {11, 3, 14, 3}, {11, 4, 15, 3}, {11, 5, 16, 3}, {11, 6, 17, 3}, {11, 7, 18, 3}, {11, 8, 19, 3}, {11, 9, 20, 3}, {10, 9, 21, 3}, {9, 9, 22, 3}, {8, 9, 23, 3}, {7, 9, 24, 3}, {6, 9, 25, 3}, {5, 9, 26, 3}, {4, 9, 27, 3}, /* Level 4 */ {4, 8, 0, 4}, {4, 7, 1, 4}, {4, 6, 2, 4}, {4, 5, 3, 4}, {4, 4, 4, 4}, {5, 4, 5, 4}, {6, 4, 6, 4}, {7, 4, 7, 4}, {8, 4, 8, 4}, {9, 4, 9, 4}, {10, 4, 10, 4}, {10, 5, 11, 4}, {10, 6, 12, 4}, {10, 7, 13, 4}, {10, 8, 14, 4}, {9, 8, 15, 4}, {8, 8, 16, 4}, {7, 8, 17, 4}, {6, 8, 18, 4}, {5, 8, 19, 4}, /* Level 5 */ {5, 7, 0, 5}, {5, 6, 1, 5}, {5, 5, 2, 5}, {6, 5, 3, 5}, {7, 5, 4, 5}, {8, 5, 5, 5}, {9, 5, 6, 5}, {9, 6, 7, 5}, {9, 7, 8, 5}, {8, 7, 9, 5}, {7, 7, 10, 5}, {6, 7, 11, 5}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data spiral_xoff[] = { 0, 52, 96, 132, 160, 180, -1 }; /* Upward and downward shrink data */ static shri_data vertical_shri_data[] = { /* Level 0 */ {0, 0, 7, 0}, {1, 0, 6, 0}, {2, 0, 5, 0}, {3, 0, 4, 0}, {4, 0, 3, 0}, {5, 0, 2, 0}, {6, 0, 1, 0}, {7, 0, 0, 0}, {8, 0, 1, 0}, {9, 0, 2, 0}, {10, 0, 3, 0}, {11, 0, 4, 0}, {12, 0, 5, 0}, {13, 0, 6, 0}, {14, 0, 7, 0}, /* Level 1 */ {0, 1, 7, 1}, {1, 1, 6, 1}, {2, 1, 5, 1}, {3, 1, 4, 1}, {4, 1, 3, 1}, {5, 1, 2, 1}, {6, 1, 1, 1}, {7, 1, 0, 1}, {8, 1, 1, 1}, {9, 1, 2, 1}, {10, 1, 3, 1}, {11, 1, 4, 1}, {12, 1, 5, 1}, {13, 1, 6, 1}, {14, 1, 7, 1}, /* Level 2 */ {0, 2, 7, 2}, {1, 2, 6, 2}, {2, 2, 5, 2}, {3, 2, 4, 2}, {4, 2, 3, 2}, {5, 2, 2, 2}, {6, 2, 1, 2}, {7, 2, 0, 2}, {8, 2, 1, 2}, {9, 2, 2, 2}, {10, 2, 3, 2}, {11, 2, 4, 2}, {12, 2, 5, 2}, {13, 2, 6, 2}, {14, 2, 7, 2}, /* Level 3 */ {0, 3, 7, 3}, {1, 3, 6, 3}, {2, 3, 5, 3}, {3, 3, 4, 3}, {4, 3, 3, 3}, {5, 3, 2, 3}, {6, 3, 1, 3}, {7, 3, 0, 3}, {8, 3, 1, 3}, {9, 3, 2, 3}, {10, 3, 3, 3}, {11, 3, 4, 3}, {12, 3, 5, 3}, {13, 3, 6, 3}, {14, 3, 7, 3}, /* Level 4 */ {0, 4, 7, 4}, {1, 4, 6, 4}, {2, 4, 5, 4}, {3, 4, 4, 4}, {4, 4, 3, 4}, {5, 4, 2, 4}, {6, 4, 1, 4}, {7, 4, 0, 4}, {8, 4, 1, 4}, {9, 4, 2, 4}, {10, 4, 3, 4}, {11, 4, 4, 4}, {12, 4, 5, 4}, {13, 4, 6, 4}, {14, 4, 7, 4}, /* Level 5 */ {0, 5, 7, 5}, {1, 5, 6, 5}, {2, 5, 5, 5}, {3, 5, 4, 5}, {4, 5, 3, 5}, {5, 5, 2, 5}, {6, 5, 1, 5}, {7, 5, 0, 5}, {8, 5, 1, 5}, {9, 5, 2, 5}, {10, 5, 3, 5}, {11, 5, 4, 5}, {12, 5, 5, 5}, {13, 5, 6, 5}, {14, 5, 7, 5}, /* Level 6 */ {0, 6, 7, 6}, {1, 6, 6, 6}, {2, 6, 5, 6}, {3, 6, 4, 6}, {4, 6, 3, 6}, {5, 6, 2, 6}, {6, 6, 1, 6}, {7, 6, 0, 6}, {8, 6, 1, 6}, {9, 6, 2, 6}, {10, 6, 3, 6}, {11, 6, 4, 6}, {12, 6, 5, 6}, {13, 6, 6, 6}, {14, 6, 7, 6}, /* Level 7 */ {0, 7, 7, 7}, {1, 7, 6, 7}, {2, 7, 5, 7}, {3, 7, 4, 7}, {4, 7, 3, 7}, {5, 7, 2, 7}, {6, 7, 1, 7}, {7, 7, 0, 7}, {8, 7, 1, 7}, {9, 7, 2, 7}, {10, 7, 3, 7}, {11, 7, 4, 7}, {12, 7, 5, 7}, {13, 7, 6, 7}, {14, 7, 7, 7}, /* Level 8 */ {0, 8, 7, 8}, {1, 8, 6, 8}, {2, 8, 5, 8}, {3, 8, 4, 8}, {4, 8, 3, 8}, {5, 8, 2, 8}, {6, 8, 1, 8}, {7, 8, 0, 8}, {8, 8, 1, 8}, {9, 8, 2, 8}, {10, 8, 3, 8}, {11, 8, 4, 8}, {12, 8, 5, 8}, {13, 8, 6, 8}, {14, 8, 7, 8}, /* Level 9 */ {0, 9, 7, 9}, {1, 9, 6, 9}, {2, 9, 5, 9}, {3, 9, 4, 9}, {4, 9, 3, 9}, {5, 9, 2, 9}, {6, 9, 1, 9}, {7, 9, 0, 9}, {8, 9, 1, 9}, {9, 9, 2, 9}, {10, 9, 3, 9}, {11, 9, 4, 9}, {12, 9, 5, 9}, {13, 9, 6, 9}, {14, 9, 7, 9}, /* Level 10 */ {0, 10, 7, 10}, {1, 10, 6, 10}, {2, 10, 5, 10}, {3, 10, 4, 10}, {4, 10, 3, 10}, {5, 10, 2, 10}, {6, 10, 1, 10}, {7, 10, 0, 10}, {8, 10, 1, 10}, {9, 10, 2, 10}, {10, 10, 3, 10}, {11, 10, 4, 10}, {12, 10, 5, 10}, {13, 10, 6, 10}, {14, 10, 7, 10}, /* Level 11 */ {0, 11, 7, 11}, {1, 11, 6, 11}, {2, 11, 5, 11}, {3, 11, 4, 11}, {4, 11, 3, 11}, {5, 11, 2, 11}, {6, 11, 1, 11}, {7, 11, 0, 11}, {8, 11, 1, 11}, {9, 11, 2, 11}, {10, 11, 3, 11}, {11, 11, 4, 11}, {12, 11, 5, 11}, {13, 11, 6, 11}, {14, 11, 7, 11}, /* Level 12 */ {0, 12, 7, 12}, {1, 12, 6, 12}, {2, 12, 5, 12}, {3, 12, 4, 12}, {4, 12, 3, 12}, {5, 12, 2, 12}, {6, 12, 1, 12}, {7, 12, 0, 12}, {8, 12, 1, 12}, {9, 12, 2, 12}, {10, 12, 3, 12}, {11, 12, 4, 12}, {12, 12, 5, 12}, {13, 12, 6, 12}, {14, 12, 7, 12}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data vertical_xoff[] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, -1 }; /* Quad shrink data */ static shri_data quad_shri_data[] = { /* Level 0 */ {0, 0, 6, 0}, {0, 1, 5, 0}, {0, 2, 4, 0}, {0, 3, 3, 0}, {0, 4, 2, 0}, {0, 5, 1, 0}, {0, 6, 0, 0}, {0, 7, 1, 0}, {0, 8, 2, 0}, {0, 9, 3, 0}, {0, 10, 4, 0}, {0, 11, 5, 0}, {0, 12, 6, 0}, {14, 0, 6, 0}, {14, 1, 5, 0}, {14, 2, 4, 0}, {14, 3, 3, 0}, {14, 4, 2, 0}, {14, 5, 1, 0}, {14, 6, 0, 0}, {14, 7, 1, 0}, {14, 8, 2, 0}, {14, 9, 3, 0}, {14, 10, 4, 0}, {14, 11, 5, 0}, {14, 12, 6, 0}, {1, 0, 6, 0}, {2, 0, 5, 0}, {3, 0, 4, 0}, {4, 0, 3, 0}, {5, 0, 2, 0}, {6, 0, 1, 0}, {7, 0, 0, 0}, {8, 0, 1, 0}, {9, 0, 2, 0}, {10, 0, 3, 0}, {11, 0, 4, 0}, {12, 0, 5, 0}, {13, 0, 6, 0}, {1, 12, 6, 0}, {2, 12, 5, 0}, {3, 12, 4, 0}, {4, 12, 3, 0}, {5, 12, 2, 0}, {6, 12, 1, 0}, {7, 12, 0, 0}, {8, 12, 1, 0}, {9, 12, 2, 0}, {10, 12, 3, 0}, {11, 12, 4, 0}, {12, 12, 5, 0}, {13, 12, 6, 0}, /* Level 1 */ {1, 1, 5, 1}, {1, 2, 4, 1}, {1, 3, 3, 1}, {1, 4, 2, 1}, {1, 5, 1, 1}, {1, 6, 0, 1}, {1, 7, 1, 1}, {1, 8, 2, 1}, {1, 9, 3, 1}, {1, 10, 4, 1}, {1, 11, 5, 1}, {13, 1, 5, 1}, {13, 2, 4, 1}, {13, 3, 3, 1}, {13, 4, 2, 1}, {13, 5, 1, 1}, {13, 6, 0, 1}, {13, 7, 1, 1}, {13, 8, 2, 1}, {13, 9, 3, 1}, {13, 10, 4, 1}, {13, 11, 5, 1}, {2, 1, 5, 1}, {3, 1, 4, 1}, {4, 1, 3, 1}, {5, 1, 2, 1}, {6, 1, 1, 1}, {7, 1, 0, 1}, {8, 1, 1, 1}, {9, 1, 2, 1}, {10, 1, 3, 1}, {11, 1, 4, 1}, {12, 1, 5, 1}, {2, 11, 5, 1}, {3, 11, 4, 1}, {4, 11, 3, 1}, {5, 11, 2, 1}, {6, 11, 1, 1}, {7, 11, 0, 1}, {8, 11, 1, 1}, {9, 11, 2, 1}, {10, 11, 3, 1}, {11, 11, 4, 1}, {12, 11, 5, 1}, /* Level 2 */ {2, 2, 4, 2}, {2, 3, 3, 2}, {2, 4, 2, 2}, {2, 5, 1, 2}, {2, 6, 0, 2}, {2, 7, 1, 2}, {2, 8, 2, 2}, {2, 9, 3, 2}, {2, 10, 4, 2}, {12, 2, 4, 2}, {12, 3, 3, 2}, {12, 4, 2, 2}, {12, 5, 1, 2}, {12, 6, 0, 2}, {12, 7, 1, 2}, {12, 8, 2, 2}, {12, 9, 3, 2}, {12, 10, 4, 2}, {3, 2, 4, 2}, {4, 2, 3, 2}, {5, 2, 2, 2}, {6, 2, 1, 2}, {7, 2, 0, 2}, {8, 2, 1, 2}, {9, 2, 2, 2}, {10, 2, 3, 2}, {11, 2, 4, 2}, {3, 10, 4, 2}, {4, 10, 3, 2}, {5, 10, 2, 2}, {6, 10, 1, 2}, {7, 10, 0, 2}, {8, 10, 1, 2}, {9, 10, 2, 2}, {10, 10, 3, 2}, {11, 10, 4, 2}, /* Level 3 */ {3, 3, 3, 3}, {3, 4, 2, 3}, {3, 5, 1, 3}, {3, 6, 0, 3}, {3, 7, 1, 3}, {3, 8, 2, 3}, {3, 9, 3, 3}, {11, 3, 3, 3}, {11, 4, 2, 3}, {11, 5, 1, 3}, {11, 6, 0, 3}, {11, 7, 1, 3}, {11, 8, 2, 3}, {11, 9, 3, 3}, {4, 3, 3, 3}, {5, 3, 2, 3}, {6, 3, 1, 3}, {7, 3, 0, 3}, {8, 3, 1, 3}, {9, 3, 2, 3}, {10, 3, 3, 3}, {4, 9, 3, 3}, {5, 9, 2, 3}, {6, 9, 1, 3}, {7, 9, 0, 3}, {8, 9, 1, 3}, {9, 9, 2, 3}, {10, 9, 3, 3}, /* Level 4 */ {4, 4, 2, 4}, {4, 5, 1, 4}, {4, 6, 0, 4}, {4, 7, 1, 4}, {4, 8, 2, 4}, {10, 4, 2, 4}, {10, 5, 1, 4}, {10, 6, 0, 4}, {10, 7, 1, 4}, {10, 8, 2, 4}, {5, 4, 2, 4}, {6, 4, 1, 4}, {7, 4, 0, 4}, {8, 4, 1, 4}, {9, 4, 2, 4}, {5, 8, 2, 4}, {6, 8, 1, 4}, {7, 8, 0, 4}, {8, 8, 1, 4}, {9, 8, 2, 4}, /* Level 5 */ {5, 5, 1, 5}, {5, 6, 0, 5}, {5, 7, 1, 5}, {9, 5, 1, 5}, {9, 6, 0, 5}, {9, 7, 1, 5}, {6, 5, 1, 5}, {7, 5, 0, 5}, {8, 5, 1, 5}, {6, 7, 1, 5}, {7, 7, 0, 5}, {8, 7, 1, 5}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data quad_xoff[] = { 0, 7, 13, 18, 22, 25, -1 }; /* Main diagonal shrink data *//* added by stn */ static shri_data diag_shri_data[] = { /* Level 0 */ {0, 0, 6, 0}, {0, 1, 5, 0}, {0, 2, 4, 0}, {0, 3, 3, 0}, {0, 4, 2, 0}, {0, 5, 1, 0}, {0, 6, 0, 0}, {0, 7, 1, 0}, {0, 8, 2, 0}, {0, 9, 3, 0}, {0, 10, 4, 0}, {0, 11, 5, 0}, {0, 12, 5, 0}, {14, 0, 6, 0}, {14, 1, 5, 0}, {14, 2, 4, 0}, {14, 3, 3, 0}, {14, 4, 2, 0}, {14, 5, 1, 0}, {14, 6, 0, 0}, {14, 7, 1, 0}, {14, 8, 2, 0}, {14, 9, 3, 0}, {14, 10, 4, 0}, {14, 11, 5, 0}, {14, 12, 5, 0}, /* Level 1 */ {1, 0, 6, 1}, {1, 1, 5, 1}, {1, 2, 4, 1}, {1, 3, 3, 1}, {1, 4, 2, 1}, {1, 5, 1, 1}, {1, 6, 0, 1}, {1, 7, 1, 1}, {1, 8, 2, 1}, {1, 9, 3, 1}, {1, 10, 4, 1}, {1, 11, 5, 1}, {1, 12, 5, 1}, {13, 0, 6, 1}, {13, 1, 5, 1}, {13, 2, 4, 1}, {13, 3, 3, 1}, {13, 4, 2, 1}, {13, 5, 1, 1}, {13, 6, 0, 1}, {13, 7, 1, 1}, {13, 8, 2, 1}, {13, 9, 3, 1}, {13, 10, 4, 1}, {13, 11, 5, 1}, {13, 12, 5, 1}, /* Level 2 */ {2, 0, 0, 2}, /* Level 3 */ {2, 1, 0, 3}, {3, 0, 0, 3}, /* Level 4 */ {2, 2, 0, 4}, {3, 1, 0, 4}, {4, 0, 0, 4}, /* Level 5 */ {2, 3, 1, 5}, {3, 2, 0, 5}, {4, 1, 1, 5}, {5, 0, 1, 5}, /* Level 6 */ {2, 4, 1, 6}, {3, 3, 0, 6}, {4, 2, 0, 6}, {5, 1, 1, 6}, {6, 0, 1, 6}, /* Level 7 */ {2, 5, 2, 7}, {3, 4, 1, 7}, {4, 3, 0, 7}, {5, 2, 1, 7}, {6, 1, 2, 7}, {7, 0, 2, 7}, /* Level 8 */ {2, 6, 2, 8}, {3, 5, 1, 8}, {4, 4, 0, 8}, {5, 3, 0, 8}, {6, 2, 1, 8}, {7, 1, 2, 8}, {8, 0, 2, 8}, /* Level 9 */ {2, 7, 3, 9}, {3, 6, 2, 9}, {4, 5, 1, 9}, {5, 4, 0, 9}, {6, 3, 1, 9}, {7, 2, 2, 9}, {8, 1, 3, 9}, {9, 0, 3, 9}, /* Level 10 */ {2, 8, 3, 10}, {3, 7, 2, 10}, {4, 6, 1, 10}, {5, 5, 0, 10}, {6, 4, 0, 10}, {7, 3, 1, 10}, {8, 2, 2, 10}, {9, 1, 3, 10}, {10, 0, 3, 10}, /* Level 11 */ {2, 9, 4, 11}, {3, 8, 3, 11}, {4, 7, 2, 11}, {5, 6, 1, 11}, {6, 5, 0, 11}, {7, 4, 1, 11}, {8, 3, 2, 11}, {9, 2, 3, 11}, {10, 1, 4, 11}, {11, 0, 4, 11}, /* Level 12 */ {2, 10, 4, 12}, {3, 9, 3, 12}, {4, 8, 2, 12}, {5, 7, 1, 12}, {6, 6, 0, 12}, {7, 5, 0, 12}, {8, 4, 1, 12}, {9, 3, 2, 12}, {10, 2, 3, 12}, {11, 1, 4, 12}, {12, 0, 4, 12}, /* Level 13 */ {2, 11, 5, 13}, {3, 10, 4, 13}, {4, 9, 3, 13}, {5, 8, 2, 13}, {6, 7, 1, 13}, {7, 6, 0, 13}, {8, 5, 1, 13}, {9, 4, 2, 13}, {10, 3, 3, 13}, {11, 2, 4, 13}, {12, 1, 5, 13}, /* Level 14 */ {2, 12, 4, 14}, {3, 11, 4, 14}, {4, 10, 3, 14}, {5, 9, 2, 14}, {6, 8, 1, 14}, {7, 7, 0, 14}, {8, 6, 0, 14}, {9, 5, 1, 14}, {10, 4, 2, 14}, {11, 3, 3, 14}, {12, 2, 4, 14}, /* Level 15 */ {3, 12, 4, 15}, {4, 11, 4, 15}, {5, 10, 3, 15}, {6, 9, 2, 15}, {7, 8, 1, 15}, {8, 7, 0, 15}, {9, 6, 1, 15}, {10, 5, 2, 15}, {11, 4, 3, 15}, {12, 3, 4, 15}, /* Level 16 */ {4, 12, 3, 16}, {5, 11, 3, 16}, {6, 10, 2, 16}, {7, 9, 1, 16}, {8, 8, 0, 16}, {9, 7, 0, 16}, {10, 6, 1, 16}, {11, 5, 2, 16}, {12, 4, 3, 16}, /* Level 17 */ {5, 12, 3, 17}, {6, 11, 3, 17}, {7, 10, 2, 17}, {8, 9, 1, 17}, {9, 8, 0, 17}, {10, 7, 1, 17}, {11, 6, 2, 17}, {12, 5, 3, 17}, /* Level 18 */ {6, 12, 2, 18}, {7, 11, 2, 18}, {8, 10, 1, 18}, {9, 9, 0, 18}, {10, 8, 0, 18}, {11, 7, 1, 18}, {12, 6, 2, 18}, /* Level 19 */ {7, 12, 2, 19}, {8, 11, 2, 19}, {9, 10, 1, 19}, {10, 9, 0, 19}, {11, 8, 1, 19}, {12, 7, 2, 19}, /* Level 20 */ {8, 12, 1, 20}, {9, 11, 1, 20}, {10, 10, 0, 20}, {11, 9, 0, 20}, {12, 8, 1, 20}, /* Level 21 */ {9, 12, 1, 21}, {10, 11, 1, 21}, {11, 10, 0, 21}, {12, 9, 1, 21}, /* Level 22 */ {10, 12, 0, 22}, {11, 11, 0, 22}, {12, 10, 0, 22}, /* Level 23 */ {11, 12, 0, 23}, {12, 11, 0, 23}, /* Level 24 */ {12, 12, 0, 24}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data diag_xoff[] = { 0, 7, 14, 15, 16, 17, 19, 21, 24, 27, 31, 35, 40, 45, 51, 56, 61, 65, 69, 72, 75, 77, 79, 80, 81, 82, -1 }; /* EPFL */ /* Enserb stuff starts here */ static shri_data circle_data[] = { /* level 0 */ {5, 1, 0, 0}, {6, 1, 0, 0}, {7, 1, 0, 0}, {8, 1, 0, 0}, {9, 1, 0, 0}, {4, 2, 0, 0}, {10, 2, 0, 0}, {3, 3, 0, 0}, {11, 3, 0, 0}, {2, 4, 0, 0}, {12, 4, 0, 0}, {2, 5, 0, 0}, {12, 5, 0, 0}, {2, 6, 0, 0}, {12, 6, 0, 0}, {2, 7, 0, 0}, {12, 7, 0, 0}, {12, 8, 0, 0}, {2, 8, 0, 0}, {3, 9, 0, 0}, {11, 9, 0, 0}, {4, 10, 0, 0}, {10, 10, 0, 0}, {5, 11, 0, 0}, {6, 11, 0, 0}, {7, 11, 0, 0}, {8, 11, 0, 0}, {9, 11, 0, 0}, /* Level 1 */ {5, 2, 0, 1}, {6, 2, 0, 1}, {7, 2, 0, 1}, {8, 2, 0, 1}, {9, 2, 0, 1}, {4, 3, 0, 1}, {5, 3, 0, 1}, {9, 3, 0, 1}, {10, 3, 0, 1}, {3, 4, 0, 1}, {4, 4, 0, 1}, {10, 4, 0, 1}, {11, 4, 0, 1}, {3, 5, 0, 1}, {3, 6, 0, 1}, {3, 7, 0, 1}, {3, 8, 0, 1}, {11, 5, 0, 1}, {11, 6, 0, 1}, {11, 7, 0, 1}, {11, 8, 0, 1}, {5, 10, 0, 1}, {6, 10, 0, 1}, {7, 10, 0, 1}, {8, 10, 0, 1}, {9, 10, 0, 1}, {4, 9, 0, 1}, {5, 9, 0, 1}, {9, 9, 0, 1}, {10, 9, 0, 1}, {4, 8, 0, 1}, {10, 8, 0, 1}, /* Level 2 */ {6, 3, 0, 2}, {7, 3, 0, 2}, {8, 3, 0, 2}, {5, 4, 0, 2}, {9, 4, 0, 2}, {4, 5, 0, 2}, {4, 6, 0, 2}, {4, 7, 0, 2}, {10, 5, 0, 2}, {10, 6, 0, 2}, {10, 7, 0, 2}, {5, 8, 0, 2}, {9, 8, 0, 2}, {6, 9, 0, 2}, {7, 9, 0, 2}, {8, 9, 0, 2}, /* Level 3 */ {6, 4, 0, 3}, {7, 4, 0, 3}, {8, 4, 0, 3}, {5, 5, 0, 3}, {5, 6, 0, 3}, {5, 7, 0, 3}, {9, 5, 0, 3}, {9, 6, 0, 3}, {9, 7, 0, 3}, {6, 8, 0, 3}, {7, 8, 0, 3}, {8, 8, 0, 3}, /* Level 4 */ {6, 5, 0, 4}, {7, 5, 0, 4}, {8, 5, 0, 4}, {6, 6, 0, 4}, {8, 6, 0, 4}, {6, 7, 0, 4}, {7, 7, 0, 4}, {8, 7, 0, 4}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data circle_xoff[] = { 0, 7, 13, 18, 22, -1 }; static shri_data horiz_shri_data[] = { /* Level 0 */ {0, 0, 0, 0}, {0, 1, 0, 0}, {0, 2, 0, 0}, {0, 3, 0, 0}, {0, 4, 0, 0}, {0, 5, 0, 0}, {0, 6, 0, 0}, {0, 7, 0, 0}, {0, 8, 0, 0}, {0, 9, 0, 0}, {0, 10, 0, 0}, {0, 11, 0, 0}, {0, 12, 0, 0}, {14, 0, 0, 0}, {14, 1, 0, 0}, {14, 2, 0, 0}, {14, 3, 0, 0}, {14, 4, 0, 0}, {14, 5, 0, 0}, {14, 6, 0, 0}, {14, 7, 0, 0}, {14, 8, 0, 0}, {14, 9, 0, 0}, {14, 10, 0, 0}, {14, 11, 0, 0}, {14, 12, 0, 0}, /* Level 1 */ {1, 0, 0, 1}, {1, 1, 0, 1}, {1, 2, 0, 1}, {1, 3, 0, 1}, {1, 4, 0, 1}, {1, 5, 0, 1}, {1, 6, 0, 1}, {1, 7, 0, 1}, {1, 8, 0, 1}, {1, 9, 0, 1}, {1, 10, 0, 1}, {1, 11, 0, 1}, {1, 12, 0, 1}, {13, 0, 0, 1}, {13, 1, 0, 1}, {13, 2, 0, 1}, {13, 3, 0, 1}, {13, 4, 0, 1}, {13, 5, 0, 1}, {13, 6, 0, 1}, {13, 7, 0, 1}, {13, 8, 0, 1}, {13, 9, 0, 1}, {13, 10, 0, 1}, {13, 11, 0, 1}, {13, 12, 0, 1}, /* Level 2 */ {2, 0, 0, 2}, {2, 1, 0, 2}, {2, 2, 0, 2}, {2, 3, 0, 2}, {2, 4, 0, 2}, {2, 5, 0, 2}, {2, 6, 0, 2}, {2, 7, 0, 2}, {2, 8, 0, 2}, {2, 9, 0, 2}, {2, 10, 0, 2}, {2, 11, 0, 2}, {2, 12, 0, 2}, {12, 0, 0, 2}, {12, 1, 0, 2}, {12, 2, 0, 2}, {12, 3, 0, 2}, {12, 4, 0, 2}, {12, 5, 0, 2}, {12, 6, 0, 2}, {12, 7, 0, 2}, {12, 8, 0, 2}, {12, 9, 0, 2}, {12, 10, 0, 2}, {12, 11, 0, 2}, {12, 12, 0, 2}, /* Level 3 */ {3, 0, 0, 3}, {3, 1, 0, 3}, {3, 2, 0, 3}, {3, 3, 0, 3}, {3, 4, 0, 3}, {3, 5, 0, 3}, {3, 6, 0, 3}, {3, 7, 0, 3}, {3, 8, 0, 3}, {3, 9, 0, 3}, {3, 10, 0, 3}, {3, 11, 0, 3}, {3, 12, 0, 3}, {11, 0, 0, 3}, {11, 1, 0, 3}, {11, 2, 0, 3}, {11, 3, 0, 3}, {11, 4, 0, 3}, {11, 5, 0, 3}, {11, 6, 0, 3}, {11, 7, 0, 3}, {11, 8, 0, 3}, {11, 9, 0, 3}, {11, 10, 0, 3}, {11, 11, 0, 3}, {11, 13, 0, 3}, /* Level 4 */ {4, 0, 0, 4}, {4, 1, 0, 4}, {4, 2, 0, 4}, {4, 3, 0, 4}, {4, 4, 0, 4}, {4, 5, 0, 4}, {4, 6, 0, 4}, {4, 7, 0, 4}, {4, 8, 0, 4}, {4, 9, 0, 4}, {4, 10, 0, 4}, {4, 11, 0, 4}, {4, 12, 0, 4}, {10, 0, 0, 4}, {10, 1, 0, 4}, {10, 2, 0, 4}, {10, 3, 0, 4}, {10, 4, 0, 4}, {10, 5, 0, 4}, {10, 6, 0, 4}, {10, 7, 0, 4}, {10, 8, 0, 4}, {10, 9, 0, 4}, {10, 10, 0, 4}, {10, 11, 0, 4}, {10, 14, 0, 4}, /* Level 5 */ {5, 0, 0, 5}, {5, 1, 0, 5}, {5, 2, 0, 5}, {5, 3, 0, 5}, {5, 4, 0, 5}, {5, 5, 0, 5}, {5, 6, 0, 5}, {5, 7, 0, 5}, {5, 8, 0, 5}, {5, 9, 0, 5}, {5, 10, 0, 5}, {5, 11, 0, 5}, {5, 12, 0, 5}, {9, 0, 0, 5}, {9, 1, 0, 5}, {9, 2, 0, 5}, {9, 3, 0, 5}, {9, 4, 0, 5}, {9, 5, 0, 5}, {9, 6, 0, 5}, {9, 7, 0, 5}, {9, 8, 0, 5}, {9, 9, 0, 5}, {9, 10, 0, 5}, {9, 11, 0, 5}, {9, 14, 0, 5}, /* Level 6 */ {6, 0, 0, 6}, {6, 1, 0, 6}, {6, 2, 0, 6}, {6, 3, 0, 6}, {6, 4, 0, 6}, {6, 5, 0, 6}, {6, 6, 0, 6}, {6, 7, 0, 6}, {6, 8, 0, 6}, {6, 9, 0, 6}, {6, 10, 0, 6}, {6, 11, 0, 6}, {6, 12, 0, 6}, {8, 0, 0, 6}, {8, 1, 0, 6}, {8, 2, 0, 6}, {8, 3, 0, 6}, {8, 4, 0, 6}, {8, 5, 0, 6}, {8, 6, 0, 6}, {8, 7, 0, 6}, {8, 8, 0, 6}, {8, 9, 0, 6}, {8, 10, 0, 6}, {8, 11, 0, 6}, {8, 14, 0, 6}, /* Terminator */ {-1, -1, -1, -1} }; static shri_xoff_data horiz_xoff[] = { 0, 7, 13, 18, 22, 25, 29, -1 }; /* 4 blocs move shrink */ static shri_data move_data[] = { /* level 0 */ {7, 11, 0, 0}, {7, 1, 0, 0}, {7, 10, 0, 0}, {7, 2, 0, 0}, {13, 6, 0, 0}, {1, 6, 0, 0}, {12, 6, 0, 0}, {2, 6, 0, 0}, {11, 6, 0, 0}, {3, 6, 0, 0}, /* level 1 */ {7, 10, 0, 1}, {7, 2, 0, 1}, {7, 9, 0, 1}, {7, 3, 0, 1}, {12, 6, 0, 1}, {2, 6, 0, 1}, {11, 6, 0, 1}, {3, 6, 0, 1}, {10, 6, 0, 1}, {4, 6, 0, 1}, /* level 2 */ {7, 9, 0, 2}, {7, 3, 0, 2}, {7, 8, 0, 2}, {7, 4, 0, 2}, {11, 6, 0, 2}, {3, 6, 0, 2}, {10, 6, 0, 2}, {4, 6, 0, 2}, {9, 6, 0, 2}, {5, 6, 0, 2}, /* level 3 */ {7, 8, 0, 3}, {7, 4, 0, 3}, {7, 7, 0, 3}, {7, 5, 0, 3}, {10, 6, 0, 3}, {4, 6, 0, 3}, {9, 6, 0, 3}, {5, 6, 0, 3}, {8, 6, 0, 3}, {6, 6, 0, 3}, /* level 4 */ {7, 9, 0, 4}, {7, 3, 0, 4}, {7, 8, 0, 4}, {7, 4, 0, 4}, {11, 6, 0, 4}, {3, 6, 0, 4}, {10, 6, 0, 4}, {4, 6, 0, 4}, {9, 6, 0, 4}, {5, 6, 0, 4}, /* level 5 */ {7, 10, 0, 5}, {7, 2, 0, 5}, {7, 9, 0, 5}, {7, 3, 0, 5}, {12, 6, 0, 5}, {2, 6, 0, 5}, {11, 6, 0, 5}, {3, 6, 0, 5}, {10, 6, 0, 5}, {4, 6, 0, 5}, /* level 6 */ {7, 11, 0, 6}, {7, 1, 0, 6}, {7, 10, 0, 6}, {7, 2, 0, 6}, {13, 6, 0, 6}, {1, 6, 0, 6}, {12, 6, 0, 6}, {2, 6, 0, 6}, {11, 6, 0, 6}, {3, 6, 0, 6}, /* level 7 */ {7, 10, 0, 7}, {7, 2, 0, 7}, {7, 9, 0, 7}, {7, 3, 0, 7}, {12, 6, 0, 7}, {2, 6, 0, 7}, {11, 6, 0, 7}, {3, 6, 0, 7}, {10, 6, 0, 7}, {4, 6, 0, 7}, /* level 8 */ {7, 9, 0, 8}, {7, 3, 0, 8}, {7, 8, 0, 8}, {7, 4, 0, 8}, {11, 6, 0, 8}, {3, 6, 0, 8}, {10, 6, 0, 8}, {4, 6, 0, 8}, {9, 6, 0, 8}, {5, 6, 0, 8}, /* level 9 */ {7, 8, 0, 9}, {7, 4, 0, 9}, {7, 7, 0, 9}, {7, 5, 0, 9}, {10, 6, 0, 9}, {4, 6, 0, 9}, {9, 6, 0, 9}, {5, 6, 0, 9}, {8, 6, 0, 9}, {6, 6, 0, 9}, /* level 10 */ {7, 9, 0, 10}, {7, 3, 0, 10}, {7, 8, 0, 10}, {7, 4, 0, 10}, {11, 6, 0, 10}, {3, 6, 0, 10}, {10, 6, 0, 10}, {4, 6, 0, 10}, {9, 6, 0, 10}, {5, 6, 0, 10}, /* level 11 */ {7, 10, 0, 11}, {7, 2, 0, 11}, {7, 9, 0, 11}, {7, 3, 0, 11}, {12, 6, 0, 11}, {2, 6, 0, 11}, {11, 6, 0, 11}, {3, 6, 0, 11}, {10, 6, 0, 11}, {4, 6, 0, 11}, /* level 12 */ {7, 11, 0, 12}, {7, 1, 0, 12}, {7, 10, 0, 12}, {7, 2, 0, 12}, {13, 6, 0, 12}, {1, 6, 0, 12}, {12, 6, 0, 12}, {2, 6, 0, 12}, {11, 6, 0, 12}, {3, 6, 0, 12}, /* level 13 */ {7, 10, 0, 13}, {7, 2, 0, 13}, {7, 9, 0, 13}, {7, 3, 0, 13}, {12, 6, 0, 13}, {2, 6, 0, 13}, {11, 6, 0, 13}, {3, 6, 0, 13}, {10, 6, 0, 13}, {4, 6, 0, 13}, /* level 14 */ {7, 9, 0, 14}, {7, 3, 0, 14}, {7, 8, 0, 14}, {7, 4, 0, 14}, {11, 6, 0, 14}, {3, 6, 0, 14}, {10, 6, 0, 14}, {4, 6, 0, 14}, {9, 6, 0, 14}, {5, 6, 0, 14}, /* level 15 */ {7, 8, 0, 15}, {7, 4, 0, 15}, {7, 7, 0, 15}, {7, 5, 0, 15}, {10, 6, 0, 15}, {4, 6, 0, 15}, {9, 6, 0, 15}, {5, 6, 0, 15}, {8, 6, 0, 15}, {6, 6, 0, 15}, /* level 16 */ {7, 9, 0, 16}, {7, 3, 0, 16}, {7, 8, 0, 16}, {7, 4, 0, 16}, {11, 6, 0, 16}, {3, 6, 0, 16}, {10, 6, 0, 16}, {4, 6, 0, 16}, {9, 6, 0, 16}, {5, 6, 0, 16}, /* level 17 */ {7, 10, 0, 17}, {7, 2, 0, 17}, {7, 9, 0, 17}, {7, 3, 0, 17}, {12, 6, 0, 17}, {2, 6, 0, 17}, {11, 6, 0, 17}, {3, 6, 0, 17}, {10, 6, 0, 17}, {4, 6, 0, 17}, /* level 18 */ {7, 11, 0, 18}, {7, 1, 0, 18}, {7, 10, 0, 18}, {7, 2, 0, 18}, {13, 6, 0, 18}, {1, 6, 0, 18}, {12, 6, 0, 18}, {2, 6, 0, 18}, {11, 6, 0, 18}, {3, 6, 0, 18}, /* level 19 */ {7, 10, 0, 19}, {7, 2, 0, 19}, {7, 9, 0, 19}, {7, 3, 0, 19}, {12, 6, 0, 19}, {2, 6, 0, 19}, {11, 6, 0, 19}, {3, 6, 0, 19}, {10, 6, 0, 19}, {4, 6, 0, 19}, /* level 20 */ {7, 9, 0, 20}, {7, 3, 0, 20}, {7, 8, 0, 20}, {7, 4, 0, 20}, {11, 6, 0, 20}, {3, 6, 0, 20}, {10, 6, 0, 20}, {4, 6, 0, 20}, {9, 6, 0, 20}, {5, 6, 0, 20}, /* level 21 */ {7, 8, 0, 21}, {7, 4, 0, 21}, {7, 7, 0, 21}, {7, 5, 0, 21}, {10, 6, 0, 21}, {4, 6, 0, 21}, {9, 6, 0, 21}, {5, 6, 0, 21}, {8, 6, 0, 21}, {6, 6, 0, 21}, /* level 22 */ {7, 9, 0, 22}, {7, 3, 0, 22}, {7, 8, 0, 22}, {7, 4, 0, 22}, {11, 6, 0, 22}, {3, 6, 0, 22}, {10, 6, 0, 22}, {4, 6, 0, 22}, {9, 6, 0, 22}, {5, 6, 0, 22}, /* level 23 */ {7, 10, 0, 23}, {7, 2, 0, 23}, {7, 9, 0, 23}, {7, 3, 0, 23}, {12, 6, 0, 23}, {2, 6, 0, 23}, {11, 6, 0, 23}, {3, 6, 0, 23}, {10, 6, 0, 23}, {4, 6, 0, 23}, /* level 24 */ {7, 11, 0, 24}, {7, 1, 0, 24}, {7, 10, 0, 24}, {7, 2, 0, 24}, {13, 6, 0, 24}, {1, 6, 0, 24}, {12, 6, 0, 24}, {2, 6, 0, 24}, {11, 6, 0, 24}, {3, 6, 0, 24}, /* level 25 */ {7, 10, 0, 25}, {7, 2, 0, 25}, {7, 9, 0, 25}, {7, 3, 0, 25}, {12, 6, 0, 25}, {2, 6, 0, 25}, {11, 6, 0, 25}, {3, 6, 0, 25}, {10, 6, 0, 25}, {4, 6, 0, 25}, /* level 26 */ {7, 9, 0, 26}, {7, 3, 0, 26}, {7, 8, 0, 26}, {7, 4, 0, 26}, {11, 6, 0, 26}, {3, 6, 0, 26}, {10, 6, 0, 26}, {4, 6, 0, 26}, {9, 6, 0, 26}, {5, 6, 0, 26}, /* level 27 */ {7, 8, 0, 27}, {7, 4, 0, 27}, {7, 7, 0, 27}, {7, 5, 0, 27}, {10, 6, 0, 27}, {4, 6, 0, 27}, {9, 6, 0, 27}, {5, 6, 0, 27}, {8, 6, 0, 27}, {6, 6, 0, 27}, /* level 28 */ {7, 9, 0, 28}, {7, 3, 0, 28}, {7, 8, 0, 28}, {7, 4, 0, 28}, {11, 6, 0, 28}, {3, 6, 0, 28}, {10, 6, 0, 28}, {4, 6, 0, 28}, {9, 6, 0, 28}, {5, 6, 0, 28}, /* level 29 */ {7, 10, 0, 29}, {7, 2, 0, 29}, {7, 9, 0, 29}, {7, 3, 0, 29}, {12, 6, 0, 29}, {2, 6, 0, 29}, {11, 6, 0, 29}, {3, 6, 0, 29}, {10, 6, 0, 29}, {4, 6, 0, 29}, /* level 30 */ {7, 11, 0, 30}, {7, 1, 0, 30}, {7, 10, 0, 30}, {7, 2, 0, 30}, {13, 6, 0, 30}, {1, 6, 0, 30}, {12, 6, 0, 30}, {2, 6, 0, 30}, {11, 6, 0, 30}, {3, 6, 0, 30}, /* level 31 */ {7, 10, 0, 31}, {7, 2, 0, 31}, {7, 9, 0, 31}, {7, 3, 0, 31}, {12, 6, 0, 31}, {2, 6, 0, 31}, {11, 6, 0, 31}, {3, 6, 0, 31}, {10, 6, 0, 31}, {4, 6, 0, 31}, /* level 32 */ {7, 9, 0, 32}, {7, 3, 0, 32}, {7, 8, 0, 32}, {7, 4, 0, 32}, {11, 6, 0, 32}, {3, 6, 0, 32}, {10, 6, 0, 32}, {4, 6, 0, 32}, {9, 6, 0, 32}, {5, 6, 0, 32}, /* level 33 */ {7, 8, 0, 33}, {7, 4, 0, 33}, {7, 7, 0, 33}, {7, 5, 0, 33}, {10, 6, 0, 33}, {4, 6, 0, 33}, {9, 6, 0, 33}, {5, 6, 0, 33}, {8, 6, 0, 33}, {6, 6, 0, 33}, /* level 34 */ {7, 9, 0, 34}, {7, 3, 0, 34}, {7, 8, 0, 34}, {7, 4, 0, 34}, {11, 6, 0, 34}, {3, 6, 0, 34}, {10, 6, 0, 34}, {4, 6, 0, 34}, {9, 6, 0, 34}, {5, 6, 0, 34}, /* level 35 */ {7, 10, 0, 35}, {7, 2, 0, 35}, {7, 9, 0, 35}, {7, 3, 0, 35}, {12, 6, 0, 35}, {2, 6, 0, 35}, {11, 6, 0, 35}, {3, 6, 0, 35}, {10, 6, 0, 35}, {4, 6, 0, 35}, /* level 36 */ {7, 11, 0, 36}, {7, 1, 0, 36}, {7, 10, 0, 36}, {7, 2, 0, 36}, {13, 6, 0, 36}, {1, 6, 0, 36}, {12, 6, 0, 36}, {2, 6, 0, 36}, {11, 6, 0, 36}, {3, 6, 0, 36}, /* level 37 */ {7, 10, 0, 37}, {7, 2, 0, 37}, {7, 9, 0, 37}, {7, 3, 0, 37}, {12, 6, 0, 37}, {2, 6, 0, 37}, {11, 6, 0, 37}, {3, 6, 0, 37}, {10, 6, 0, 37}, {4, 6, 0, 37}, /* level 38 */ {7, 9, 0, 38}, {7, 3, 0, 38}, {7, 8, 0, 38}, {7, 4, 0, 38}, {11, 6, 0, 38}, {3, 6, 0, 38}, {10, 6, 0, 38}, {4, 6, 0, 38}, {9, 6, 0, 38}, {5, 6, 0, 38}, /* level 39 */ {7, 8, 0, 39}, {7, 4, 0, 39}, {7, 7, 0, 39}, {7, 5, 0, 39}, {10, 6, 0, 39}, {4, 6, 0, 39}, {9, 6, 0, 39}, {5, 6, 0, 39}, {8, 6, 0, 39}, {6, 6, 0, 39}, /* level 40 */ {7, 9, 0, 40}, {7, 3, 0, 40}, {7, 8, 0, 40}, {7, 4, 0, 40}, {11, 6, 0, 40}, {3, 6, 0, 40}, {10, 6, 0, 40}, {4, 6, 0, 40}, {9, 6, 0, 40}, {5, 6, 0, 40}, /* level 41 */ {7, 10, 0, 41}, {7, 2, 0, 41}, {7, 9, 0, 41}, {7, 3, 0, 41}, {12, 6, 0, 41}, {2, 6, 0, 41}, {11, 6, 0, 41}, {3, 6, 0, 41}, {10, 6, 0, 41}, {4, 6, 0, 41}, /* level 42 */ {7, 11, 0, 42}, {7, 1, 0, 42}, {7, 10, 0, 42}, {7, 2, 0, 42}, {13, 6, 0, 42}, {1, 6, 0, 42}, {12, 6, 0, 42}, {2, 6, 0, 42}, {11, 6, 0, 42}, {3, 6, 0, 42}, /* level 43 */ {7, 10, 0, 43}, {7, 2, 0, 43}, {7, 9, 0, 43}, {7, 3, 0, 43}, {12, 6, 0, 43}, {2, 6, 0, 43}, {11, 6, 0, 43}, {3, 6, 0, 43}, {10, 6, 0, 43}, {4, 6, 0, 43}, /* level 44 */ {7, 9, 0, 44}, {7, 3, 0, 44}, {7, 8, 0, 44}, {7, 4, 0, 44}, {11, 6, 0, 44}, {3, 6, 0, 44}, {10, 6, 0, 44}, {4, 6, 0, 44}, {9, 6, 0, 44}, {5, 6, 0, 44}, /* level 45 */ {7, 8, 0, 45}, {7, 4, 0, 45}, {7, 7, 0, 45}, {7, 5, 0, 45}, {10, 6, 0, 45}, {4, 6, 0, 45}, {9, 6, 0, 45}, {5, 6, 0, 45}, {8, 6, 0, 45}, {6, 6, 0, 45}, /* level 46 */ {7, 9, 0, 46}, {7, 3, 0, 46}, {7, 8, 0, 46}, {7, 4, 0, 46}, {11, 6, 0, 46}, {3, 6, 0, 46}, {10, 6, 0, 46}, {4, 6, 0, 46}, {9, 6, 0, 46}, {5, 6, 0, 46}, /* level 47 */ {7, 10, 0, 47}, {7, 2, 0, 47}, {7, 9, 0, 47}, {7, 3, 0, 47}, {12, 6, 0, 47}, {2, 6, 0, 47}, {11, 6, 0, 47}, {3, 6, 0, 47}, {10, 6, 0, 47}, {4, 6, 0, 47}, /* level 48 */ {7, 11, 0, 48}, {7, 1, 0, 48}, {7, 10, 0, 48}, {7, 2, 0, 48}, {13, 6, 0, 48}, {1, 6, 0, 48}, {12, 6, 0, 48}, {2, 6, 0, 48}, {11, 6, 0, 48}, {3, 6, 0, 48}, /* level 49 */ {7, 10, 0, 49}, {7, 2, 0, 49}, {7, 9, 0, 49}, {7, 3, 0, 49}, {12, 6, 0, 49}, {2, 6, 0, 49}, {11, 6, 0, 49}, {3, 6, 0, 49}, {10, 6, 0, 49}, {4, 6, 0, 49}, /* level 50 */ {7, 9, 0, 50}, {7, 3, 0, 50}, {7, 8, 0, 50}, {7, 4, 0, 50}, {11, 6, 0, 50}, {3, 6, 0, 50}, {10, 6, 0, 50}, {4, 6, 0, 50}, {9, 6, 0, 50}, {5, 6, 0, 50}, /* level 51 */ {7, 8, 0, 51}, {7, 4, 0, 51}, {7, 7, 0, 51}, {7, 5, 0, 51}, {10, 6, 0, 51}, {4, 6, 0, 51}, {9, 6, 0, 51}, {5, 6, 0, 51}, {8, 6, 0, 51}, {6, 6, 0, 51}, /* level 52 */ {7, 9, 0, 52}, {7, 3, 0, 52}, {7, 8, 0, 52}, {7, 4, 0, 52}, {11, 6, 0, 52}, {3, 6, 0, 52}, {10, 6, 0, 52}, {4, 6, 0, 52}, {9, 6, 0, 52}, {5, 6, 0, 52}, /* level 53 */ {7, 10, 0, 53}, {7, 2, 0, 53}, {7, 9, 0, 53}, {7, 3, 0, 53}, {12, 6, 0, 53}, {2, 6, 0, 53}, {11, 6, 0, 53}, {3, 6, 0, 53}, {10, 6, 0, 53}, {4, 6, 0, 53}, /* level 54 */ {7, 11, 0, 54}, {7, 1, 0, 54}, {7, 10, 0, 54}, {7, 2, 0, 54}, {13, 6, 0, 54}, {1, 6, 0, 54}, {12, 6, 0, 54}, {2, 6, 0, 54}, {11, 6, 0, 54}, {3, 6, 0, 54}, /* level 55 */ {7, 10, 0, 55}, {7, 2, 0, 55}, {7, 9, 0, 55}, {7, 3, 0, 55}, {12, 6, 0, 55}, {2, 6, 0, 55}, {11, 6, 0, 55}, {3, 6, 0, 55}, {10, 6, 0, 55}, {4, 6, 0, 55}, /* level 56 */ {7, 9, 0, 56}, {7, 3, 0, 56}, {7, 8, 0, 56}, {7, 4, 0, 56}, {11, 6, 0, 56}, {3, 6, 0, 56}, {10, 6, 0, 56}, {4, 6, 0, 56}, {9, 6, 0, 56}, {5, 6, 0, 56}, /* level 57 */ {7, 8, 0, 57}, {7, 4, 0, 57}, {7, 7, 0, 57}, {7, 5, 0, 57}, {10, 6, 0, 57}, {4, 6, 0, 57}, {9, 6, 0, 57}, {5, 6, 0, 57}, {8, 6, 0, 57}, {6, 6, 0, 57}, /* level 58 */ {7, 9, 0, 58}, {7, 3, 0, 58}, {7, 8, 0, 58}, {7, 4, 0, 58}, {11, 6, 0, 58}, {3, 6, 0, 58}, {10, 6, 0, 58}, {4, 6, 0, 58}, {9, 6, 0, 58}, {5, 6, 0, 58}, /* level 59 */ {7, 10, 0, 59}, {7, 2, 0, 59}, {7, 9, 0, 59}, {7, 3, 0, 59}, {12, 6, 0, 59}, {2, 6, 0, 59}, {11, 6, 0, 59}, {3, 6, 0, 59}, {10, 6, 0, 59}, {4, 6, 0, 59}, /* level 60 */ {7, 11, 0, 60}, {7, 1, 0, 60}, {7, 10, 0, 60}, {7, 2, 0, 60}, {13, 6, 0, 60}, {1, 6, 0, 60}, {12, 6, 0, 60}, {2, 6, 0, 60}, {11, 6, 0, 60}, {3, 6, 0, 60}, /* level 61 */ {7, 10, 0, 61}, {7, 2, 0, 61}, {7, 9, 0, 61}, {7, 3, 0, 61}, {12, 6, 0, 61}, {2, 6, 0, 61}, {11, 6, 0, 61}, {3, 6, 0, 61}, {10, 6, 0, 61}, {4, 6, 0, 61}, /* level 62 */ {7, 9, 0, 62}, {7, 3, 0, 62}, {7, 8, 0, 62}, {7, 4, 0, 62}, {11, 6, 0, 62}, {3, 6, 0, 62}, {10, 6, 0, 62}, {4, 6, 0, 62}, {9, 6, 0, 62}, {5, 6, 0, 62}, /* level 63 */ {7, 8, 0, 63}, {7, 4, 0, 63}, {7, 7, 0, 63}, {7, 5, 0, 63}, {10, 6, 0, 63}, {4, 6, 0, 63}, {9, 6, 0, 63}, {5, 6, 0, 63}, {8, 6, 0, 63}, {6, 6, 0, 63}, /* level 64 */ {7, 9, 0, 64}, {7, 3, 0, 64}, {7, 8, 0, 64}, {7, 4, 0, 64}, {11, 6, 0, 64}, {3, 6, 0, 64}, {10, 6, 0, 64}, {4, 6, 0, 64}, {9, 6, 0, 64}, {5, 6, 0, 64}, /* level 65 */ {7, 10, 0, 65}, {7, 2, 0, 65}, {7, 9, 0, 65}, {7, 3, 0, 65}, {12, 6, 0, 65}, {2, 6, 0, 65}, {11, 6, 0, 65}, {3, 6, 0, 65}, {10, 6, 0, 65}, {4, 6, 0, 65}, /* level 66 */ {7, 11, 0, 66}, {7, 1, 0, 66}, {7, 10, 0, 66}, {7, 2, 0, 66}, {13, 6, 0, 66}, {1, 6, 0, 66}, {12, 6, 0, 66}, {2, 6, 0, 66}, {11, 6, 0, 66}, {3, 6, 0, 66}, /* level 67 */ {7, 10, 0, 67}, {7, 2, 0, 67}, {7, 9, 0, 67}, {7, 3, 0, 67}, {12, 6, 0, 67}, {2, 6, 0, 67}, {11, 6, 0, 67}, {3, 6, 0, 67}, {10, 6, 0, 67}, {4, 6, 0, 67}, /* level 68 */ {7, 9, 0, 68}, {7, 3, 0, 68}, {7, 8, 0, 68}, {7, 4, 0, 68}, {11, 6, 0, 68}, {3, 6, 0, 68}, {10, 6, 0, 68}, {4, 6, 0, 68}, {9, 6, 0, 68}, {5, 6, 0, 68}, /* level 69 */ {7, 8, 0, 69}, {7, 4, 0, 69}, {7, 7, 0, 69}, {7, 5, 0, 69}, {10, 6, 0, 69}, {4, 6, 0, 69}, {9, 6, 0, 69}, {5, 6, 0, 69}, {8, 6, 0, 69}, {6, 6, 0, 69}, /* level 70 */ {7, 9, 0, 70}, {7, 3, 0, 70}, {7, 8, 0, 70}, {7, 4, 0, 70}, {11, 6, 0, 70}, {3, 6, 0, 70}, {10, 6, 0, 70}, {4, 6, 0, 70}, {9, 6, 0, 70}, {5, 6, 0, 70}, /* level 71 */ {7, 10, 0, 71}, {7, 2, 0, 71}, {7, 9, 0, 71}, {7, 3, 0, 71}, {12, 6, 0, 71}, {2, 6, 0, 71}, {11, 6, 0, 71}, {3, 6, 0, 71}, {10, 6, 0, 71}, {4, 6, 0, 71}, /* level 72 */ {7, 11, 0, 72}, {7, 1, 0, 72}, {7, 10, 0, 72}, {7, 2, 0, 72}, {13, 6, 0, 72}, {1, 6, 0, 72}, {12, 6, 0, 72}, {2, 6, 0, 72}, {11, 6, 0, 72}, {3, 6, 0, 72}, /* level 73 */ {7, 10, 0, 73}, {7, 2, 0, 73}, {7, 9, 0, 73}, {7, 3, 0, 73}, {12, 6, 0, 73}, {2, 6, 0, 73}, {11, 6, 0, 73}, {3, 6, 0, 73}, {10, 6, 0, 73}, {4, 6, 0, 73}, /* level 74 */ {7, 9, 0, 74}, {7, 3, 0, 74}, {7, 8, 0, 74}, {7, 4, 0, 74}, {11, 6, 0, 74}, {3, 6, 0, 74}, {10, 6, 0, 74}, {4, 6, 0, 74}, {9, 6, 0, 74}, {5, 6, 0, 74}, /* level 75 */ {7, 8, 0, 75}, {7, 4, 0, 75}, {7, 7, 0, 75}, {7, 5, 0, 75}, {10, 6, 0, 75}, {4, 6, 0, 75}, {9, 6, 0, 75}, {5, 6, 0, 75}, {8, 6, 0, 75}, {6, 6, 0, 75}, /* level 76 */ {7, 9, 0, 76}, {7, 3, 0, 76}, {7, 8, 0, 76}, {7, 4, 0, 76}, {11, 6, 0, 76}, {3, 6, 0, 76}, {10, 6, 0, 76}, {4, 6, 0, 76}, {9, 6, 0, 76}, {5, 6, 0, 76}, /* level 77 */ {7, 10, 0, 77}, {7, 2, 0, 77}, {7, 9, 0, 77}, {7, 3, 0, 77}, {12, 6, 0, 77}, {2, 6, 0, 77}, {11, 6, 0, 77}, {3, 6, 0, 77}, {10, 6, 0, 77}, {4, 6, 0, 77}, /* level 78 */ {7, 11, 0, 78}, {7, 1, 0, 78}, {7, 10, 0, 78}, {7, 2, 0, 78}, {13, 6, 0, 78}, {1, 6, 0, 78}, {12, 6, 0, 78}, {2, 6, 0, 78}, {11, 6, 0, 78}, {3, 6, 0, 78}, /* level 79 */ {7, 10, 0, 79}, {7, 2, 0, 79}, {7, 9, 0, 79}, {7, 3, 0, 79}, {12, 6, 0, 79}, {2, 6, 0, 79}, {11, 6, 0, 79}, {3, 6, 0, 79}, {10, 6, 0, 79}, {4, 6, 0, 79}, /* level 80 */ {7, 9, 0, 80}, {7, 3, 0, 80}, {7, 8, 0, 80}, {7, 4, 0, 80}, {11, 6, 0, 80}, {3, 6, 0, 80}, {10, 6, 0, 80}, {4, 6, 0, 80}, {9, 6, 0, 80}, {5, 6, 0, 80}, /* level 81 */ {7, 8, 0, 81}, {7, 4, 0, 81}, {7, 7, 0, 81}, {7, 5, 0, 81}, {10, 6, 0, 81}, {4, 6, 0, 81}, {9, 6, 0, 81}, {5, 6, 0, 81}, {8, 6, 0, 81}, {6, 6, 0, 81}, /* level 82 */ {7, 9, 0, 82}, {7, 3, 0, 82}, {7, 8, 0, 82}, {7, 4, 0, 82}, {11, 6, 0, 82}, {3, 6, 0, 82}, {10, 6, 0, 82}, {4, 6, 0, 82}, {9, 6, 0, 82}, {5, 6, 0, 82}, /* level 83 */ {7, 10, 0, 83}, {7, 2, 0, 83}, {7, 9, 0, 83}, {7, 3, 0, 83}, {12, 6, 0, 83}, {2, 6, 0, 83}, {11, 6, 0, 83}, {3, 6, 0, 83}, {10, 6, 0, 83}, {4, 6, 0, 83}, /* level 84 */ {7, 11, 0, 84}, {7, 1, 0, 84}, {7, 10, 0, 84}, {7, 2, 0, 84}, {13, 6, 0, 84}, {1, 6, 0, 84}, {12, 6, 0, 84}, {2, 6, 0, 84}, {11, 6, 0, 84}, {3, 6, 0, 84}, /* level 85 */ {7, 10, 0, 85}, {7, 2, 0, 85}, {7, 9, 0, 85}, {7, 3, 0, 85}, {12, 6, 0, 85}, {2, 6, 0, 85}, {11, 6, 0, 85}, {3, 6, 0, 85}, {10, 6, 0, 85}, {4, 6, 0, 85}, /* level 86 */ {7, 9, 0, 86}, {7, 3, 0, 86}, {7, 8, 0, 86}, {7, 4, 0, 86}, {11, 6, 0, 86}, {3, 6, 0, 86}, {10, 6, 0, 86}, {4, 6, 0, 86}, {9, 6, 0, 86}, {5, 6, 0, 86}, /* level 87 */ {7, 8, 0, 87}, {7, 4, 0, 87}, {7, 7, 0, 87}, {7, 5, 0, 87}, {10, 6, 0, 87}, {4, 6, 0, 87}, {9, 6, 0, 87}, {5, 6, 0, 87}, {8, 6, 0, 87}, {6, 6, 0, 87}, /* level 88 */ {7, 9, 0, 88}, {7, 3, 0, 88}, {7, 8, 0, 88}, {7, 4, 0, 88}, {11, 6, 0, 88}, {3, 6, 0, 88}, {10, 6, 0, 88}, {4, 6, 0, 88}, {9, 6, 0, 88}, {5, 6, 0, 88}, /* level 89 */ {7, 10, 0, 89}, {7, 2, 0, 89}, {7, 9, 0, 89}, {7, 3, 0, 89}, {12, 6, 0, 89}, {2, 6, 0, 89}, {11, 6, 0, 89}, {3, 6, 0, 89}, {10, 6, 0, 89}, {4, 6, 0, 89}, /* level 90 */ {7, 11, 0, 90}, {7, 1, 0, 90}, {7, 10, 0, 90}, {7, 2, 0, 90}, {13, 6, 0, 90}, {1, 6, 0, 90}, {12, 6, 0, 90}, {2, 6, 0, 90}, {11, 6, 0, 90}, {3, 6, 0, 90}, /* level 91 */ {7, 10, 0, 91}, {7, 2, 0, 91}, {7, 9, 0, 91}, {7, 3, 0, 91}, {12, 6, 0, 91}, {2, 6, 0, 91}, {11, 6, 0, 91}, {3, 6, 0, 91}, {10, 6, 0, 91}, {4, 6, 0, 91}, /* level 92 */ {7, 9, 0, 92}, {7, 3, 0, 92}, {7, 8, 0, 92}, {7, 4, 0, 92}, {11, 6, 0, 92}, {3, 6, 0, 92}, {10, 6, 0, 92}, {4, 6, 0, 92}, {9, 6, 0, 92}, {5, 6, 0, 92}, /* level 93 */ {7, 8, 0, 93}, {7, 4, 0, 93}, {7, 7, 0, 93}, {7, 5, 0, 93}, {10, 6, 0, 93}, {4, 6, 0, 93}, {9, 6, 0, 93}, {5, 6, 0, 93}, {8, 6, 0, 93}, {6, 6, 0, 93}, /* level 94 */ {7, 9, 0, 94}, {7, 3, 0, 94}, {7, 8, 0, 94}, {7, 4, 0, 94}, {11, 6, 0, 94}, {3, 6, 0, 94}, {10, 6, 0, 94}, {4, 6, 0, 94}, {9, 6, 0, 94}, {5, 6, 0, 94}, /* level 95 */ {7, 10, 0, 95}, {7, 2, 0, 95}, {7, 9, 0, 95}, {7, 3, 0, 95}, {12, 6, 0, 95}, {2, 6, 0, 95}, {11, 6, 0, 95}, {3, 6, 0, 95}, {10, 6, 0, 95}, {4, 6, 0, 95}, /* level 96 */ {7, 11, 0, 96}, {7, 1, 0, 96}, {7, 10, 0, 96}, {7, 2, 0, 96}, {13, 6, 0, 96}, {1, 6, 0, 96}, {12, 6, 0, 96}, {2, 6, 0, 96}, {11, 6, 0, 96}, {3, 6, 0, 96}, /* level 97 */ {7, 10, 0, 97}, {7, 2, 0, 97}, {7, 9, 0, 97}, {7, 3, 0, 97}, {12, 6, 0, 97}, {2, 6, 0, 97}, {11, 6, 0, 97}, {3, 6, 0, 97}, {10, 6, 0, 97}, {4, 6, 0, 97}, /* level 98 */ {7, 9, 0, 98}, {7, 3, 0, 98}, {7, 8, 0, 98}, {7, 4, 0, 98}, {11, 6, 0, 98}, {3, 6, 0, 98}, {10, 6, 0, 98}, {4, 6, 0, 98}, {9, 6, 0, 98}, {5, 6, 0, 98}, /* level 99 */ {7, 8, 0, 99}, {7, 4, 0, 99}, {7, 7, 0, 99}, {7, 5, 0, 99}, {10, 6, 0, 99}, {4, 6, 0, 99}, {9, 6, 0, 99}, {5, 6, 0, 99}, {8, 6, 0, 99}, {6, 6, 0, 99}, /* level 100 */ {7, 9, 0, 100}, {7, 3, 0, 100}, {7, 8, 0, 100}, {7, 4, 0, 100}, {11, 6, 0, 100}, {3, 6, 0, 100}, {10, 6, 0, 100}, {4, 6, 0, 100}, {9, 6, 0, 100}, {5, 6, 0, 100}, /* level 101 */ {7, 10, 0, 101}, {7, 2, 0, 101}, {7, 9, 0, 101}, {7, 3, 0, 101}, {12, 6, 0, 101}, {2, 6, 0, 101}, {11, 6, 0, 101}, {3, 6, 0, 101}, {10, 6, 0, 101}, {4, 6, 0, 101}, /* level 102 */ {7, 11, 0, 102}, {7, 1, 0, 102}, {7, 10, 0, 102}, {7, 2, 0, 102}, {13, 6, 0, 102}, {1, 6, 0, 102}, {12, 6, 0, 102}, {2, 6, 0, 102}, {11, 6, 0, 102}, {3, 6, 0, 102}, /* level 103 */ {7, 10, 0, 103}, {7, 2, 0, 103}, {7, 9, 0, 103}, {7, 3, 0, 103}, {12, 6, 0, 103}, {2, 6, 0, 103}, {11, 6, 0, 103}, {3, 6, 0, 103}, {10, 6, 0, 103}, {4, 6, 0, 103}, /* level 104 */ {7, 9, 0, 104}, {7, 3, 0, 104}, {7, 8, 0, 104}, {7, 4, 0, 104}, {11, 6, 0, 104}, {3, 6, 0, 104}, {10, 6, 0, 104}, {4, 6, 0, 104}, {9, 6, 0, 104}, {5, 6, 0, 104}, /* level 105 */ {7, 8, 0, 105}, {7, 4, 0, 105}, {7, 7, 0, 105}, {7, 5, 0, 105}, {10, 6, 0, 105}, {4, 6, 0, 105}, {9, 6, 0, 105}, {5, 6, 0, 105}, {8, 6, 0, 105}, {6, 6, 0, 105}, /* level 106 */ {7, 9, 0, 106}, {7, 3, 0, 106}, {7, 8, 0, 106}, {7, 4, 0, 106}, {11, 6, 0, 106}, {3, 6, 0, 106}, {10, 6, 0, 106}, {4, 6, 0, 106}, {9, 6, 0, 106}, {5, 6, 0, 106}, /* level 107 */ {7, 10, 0, 107}, {7, 2, 0, 107}, {7, 9, 0, 107}, {7, 3, 0, 107}, {12, 6, 0, 107}, {2, 6, 0, 107}, {11, 6, 0, 107}, {3, 6, 0, 107}, {10, 6, 0, 107}, {4, 6, 0, 107}, /* level 108 */ {7, 11, 0, 108}, {7, 1, 0, 108}, {7, 10, 0, 108}, {7, 2, 0, 108}, {13, 6, 0, 108}, {1, 6, 0, 108}, {12, 6, 0, 108}, {2, 6, 0, 108}, {11, 6, 0, 108}, {3, 6, 0, 108}, /* level 109 */ {7, 10, 0, 109}, {7, 2, 0, 109}, {7, 9, 0, 109}, {7, 3, 0, 109}, {12, 6, 0, 109}, {2, 6, 0, 109}, {11, 6, 0, 109}, {3, 6, 0, 109}, {10, 6, 0, 109}, {4, 6, 0, 109}, /* level 110 */ {7, 9, 0, 110}, {7, 3, 0, 110}, {7, 8, 0, 110}, {7, 4, 0, 110}, {11, 6, 0, 110}, {3, 6, 0, 110}, {10, 6, 0, 110}, {4, 6, 0, 110}, {9, 6, 0, 110}, {5, 6, 0, 110}, /* level 111 */ {7, 8, 0, 111}, {7, 4, 0, 111}, {7, 7, 0, 111}, {7, 5, 0, 111}, {10, 6, 0, 111}, {4, 6, 0, 111}, {9, 6, 0, 111}, {5, 6, 0, 111}, {8, 6, 0, 111}, {6, 6, 0, 111}, /* level 112 */ {7, 9, 0, 112}, {7, 3, 0, 112}, {7, 8, 0, 112}, {7, 4, 0, 112}, {11, 6, 0, 112}, {3, 6, 0, 112}, {10, 6, 0, 112}, {4, 6, 0, 112}, {9, 6, 0, 112}, {5, 6, 0, 112}, /* level 113 */ {7, 10, 0, 113}, {7, 2, 0, 113}, {7, 9, 0, 113}, {7, 3, 0, 113}, {12, 6, 0, 113}, {2, 6, 0, 113}, {11, 6, 0, 113}, {3, 6, 0, 113}, {10, 6, 0, 113}, {4, 6, 0, 113}, /* level 114 */ {7, 11, 0, 114}, {7, 1, 0, 114}, {7, 10, 0, 114}, {7, 2, 0, 114}, {13, 6, 0, 114}, {1, 6, 0, 114}, {12, 6, 0, 114}, {2, 6, 0, 114}, {11, 6, 0, 114}, {3, 6, 0, 114}, /* level 115 */ {7, 10, 0, 115}, {7, 2, 0, 115}, {7, 9, 0, 115}, {7, 3, 0, 115}, {12, 6, 0, 115}, {2, 6, 0, 115}, {11, 6, 0, 115}, {3, 6, 0, 115}, {10, 6, 0, 115}, {4, 6, 0, 115}, /* level 116 */ {7, 9, 0, 116}, {7, 3, 0, 116}, {7, 8, 0, 116}, {7, 4, 0, 116}, {11, 6, 0, 116}, {3, 6, 0, 116}, {10, 6, 0, 116}, {4, 6, 0, 116}, {9, 6, 0, 116}, {5, 6, 0, 116}, /* level 117 */ {7, 8, 0, 117}, {7, 4, 0, 117}, {7, 7, 0, 117}, {7, 5, 0, 117}, {10, 6, 0, 117}, {4, 6, 0, 117}, {9, 6, 0, 117}, {5, 6, 0, 117}, {8, 6, 0, 117}, {6, 6, 0, 117}, /* level 118 */ {7, 9, 0, 118}, {7, 3, 0, 118}, {7, 8, 0, 118}, {7, 4, 0, 118}, {11, 6, 0, 118}, {3, 6, 0, 118}, {10, 6, 0, 118}, {4, 6, 0, 118}, {9, 6, 0, 118}, {5, 6, 0, 118}, /* level 119 */ {7, 10, 0, 119}, {7, 2, 0, 119}, {7, 9, 0, 119}, {7, 3, 0, 119}, {12, 6, 0, 119}, {2, 6, 0, 119}, {11, 6, 0, 119}, {3, 6, 0, 119}, {10, 6, 0, 119}, {4, 6, 0, 119}, {-1, -1, -1, -1} }; static shri_xoff_data move_xoff[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120 }; /* Enserb stuff stops here */ /* EPFL */ /* * Style data */ /* style_rise_2: Rises a block for 2 time frames */ static shri_style2 style_rise_2_xx[] = { {0, 0, BTBlockRise}, {2, 0, BTBlock} }; static shri_style style_rise_2 = { 2, style_rise_2_xx }; /* style_rise_2_plus: Rises a block for 2 time frames, deletes blocks on previous levels */ static shri_style2 style_rise_2_plus_xx[] = { {0, 0, BTBlockRise}, {2, 0, BTBlock}, {2, -1, BTVoid} }; static shri_style style_rise_2_plus = { 3, style_rise_2_plus_xx }; /* style_compound: Gives an 8 time frame warning on previous level before placing blocks on the current one */ static shri_style2 style_compound_xx[] = { {-8, -1, BTBlockRise}, {0, -1, BTVoid}, {0, 0, BTBlock} }; static shri_style style_compound = { 3, style_compound_xx }; /* style_compound_solid: Similar to above but rises the new blocks */ static shri_style2 style_compound_solid_xx[] = { {-16, -1, BTBlockRise}, {-12, -1, BTBlock}, {-6, 0, BTBlockRise}, {0, 0, BTBlock} }; static shri_style style_compound_solid = { 4, style_compound_solid_xx }; /* style_compound_extra: Compound style with extras */ static shri_style2 style_compound_extra_xx[] = { {-16, -2, BTBlockRise}, {-12, -2, BTVoid}, {-12, -1, BTBlock}, {-4, -1, BTBlockRise}, {0, -1, BTVoid}, {0, 0, BTBlock}, {4, 0, BTBlockRise}, {8, 0, BTExtra}, {8, -1, BTBlock} }; static shri_style style_compound_extra = { 9, style_compound_extra_xx }; /* 2 levels of compound */ static shri_style2 style_savage_compound_xx[] = { {-10, -2, BTBlockRise}, {-6, -2, BTVoid}, {-6, -1, BTBlock}, {-4, -1, BTBlockRise}, {0, -1, BTVoid}, {0, 0, BTBlock} }; static shri_style style_savage_compound = { 6, style_savage_compound_xx }; /* EPFL */ /* new fcn by XBLAS@T ; inserted by EPFL - x-bresse */ static shri_style2 style_outward_compound_extra_xx[] = { {-16, 1, BTBlockRise}, {-12, 1, BTBlock}, {-12, 0, -1}, /* 'V' block */ {-4, 1, BTBlockRise}, {0, 1, BTExtra}, {0, 0, BTBlock}, {4, 0, BTBlockRise}, {8, 0, BTExtra}, {8, -1, BTBlock} }; static shri_style style_outward_compound_extra = { 9, style_outward_compound_extra_xx }; /* Added by Enserb : test de mouvement */ static shri_style2 style_move_xx[] = { {0, 0, BTBlock}, {33, 0, BTFree} }; static shri_style style_move = { 2, style_move_xx }; /* End of Added by Enserb */ /* EPFL */ #endif /* * end of file shrinkdat.h */ xblast-2.10.4/snd.h0000644000175000017500000000442110443245274013153 0ustar rhondaalfie/* * file snd.h - sound library for xblast * * $Id: snd.h,v 1.10 2006/06/12 11:06:36 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SND_H #define XBLAST_SND_H /* * type definitions */ /* sound samples */ typedef enum { SND_BAD, SND_DROP, SND_NEWBOMB, SND_NEWKICK, SND_NEWPUMP, SND_NEWRC, SND_MOREFIRE, SND_DEAD, SND_EXPL, SND_KICK, SND_PUMP, SND_OUCH, SND_INTRO, SND_APPL, SND_APPL2, SND_BUTT, SND_SHOOT, SND_INVIS, SND_INVINC, SND_NEWTELE, SND_TELE, SND_INJ, SND_MINIBOMB, SND_WON, SND_HAUNT, SND_SPIRAL, SND_SPBOMB, SND_SLIDE, SND_FINALE, SND_WARN, SND_STUN, SND_WHIRL, SND_COMPOUND, SND_TELE1, SND_TELE2, SND_HOLY, SND_ENCLOAK, SND_DECLOAK, SND_FAST, SND_SLOW, SND_SLAY, SND_LIFE, SND_NEWCLOAK, SND_BOMBMORPH, SND_STEP1, SND_STEP2, SND_STEP3, SND_STEP4, SND_STEP5, SND_STEP6, SND_SNG1, SND_SNG2, SND_SNG3, SND_SNG4, SND_SNG5, SND_SNG6, /*---*/ SND_MAX } SND_Id; /* * Sound positions in the stereo panorama range from 0 (most left) to * 16 (most right) with 8 as middle position. */ #define MAX_SOUND_POSITION 15 #define SOUND_MIDDLE_POSITION 7 /* * Special id to stop all sounds */ #define STOP_ALL_SOUNDS 0 /* * function protoypes */ extern XBBool SND_Init (const CFGSoundSetup *); extern XBBool SND_Stop (SND_Id id); extern XBBool SND_Play (SND_Id id, int position); extern XBBool SND_Load (SND_Id id); extern XBBool SND_Unload (SND_Id id); extern void SND_Flush (void); extern void SND_Finish (void); extern void SND_Beep (void); #endif /* * end of file snd.h */ xblast-2.10.4/socket.h0000644000175000017500000000607010372731125013655 0ustar rhondaalfie/* * file socket.h - sockets abstraction for xblast * * $Id: socket.h,v 1.7 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SOCKET_H #define XBLAST_SOCKET_H /* * global const */ #define XB_SOCKET_END_OF_FILE 0 #define XB_SOCKET_WOULD_BLOCK (-1) #define XB_SOCKET_ERROR (-2) /* * type definitions */ typedef struct _xb_socket XBSocket; typedef struct _xb_socket_interface { char *name; char *addrDevice; char *addrBroadcast; } XBSocketInterface; /* * prototypes */ /* managing sockets */ extern XBBool Socket_Init (void); extern void Socket_Finish (void); /* data */ extern int Socket_Fd (const XBSocket *); extern int Socket_Family (const XBSocket *); extern const char *Socket_HostName (const XBSocket * pSocket, XBBool peer); extern unsigned Socket_HostPort (const XBSocket * pSocket, XBBool peer); /* construct */ extern XBSocket *Socket_Alloc (int family); extern void Socket_Free (XBSocket *); extern XBBool Socket_SetAddressInet (XBSocket * pSocket, XBBool peer, const char *hostName, unsigned short port); extern XBBool Socket_SetBroadcast (XBSocket * pSocket, XBBool enable); extern XBBool Socket_SetReuse (XBSocket * pSocket); extern void Socket_RegisterWrite (XBSocket *); extern void Socket_RegisterRead (XBSocket *); extern void Socket_UnregisterWrite (XBSocket *); extern void Socket_UnregisterRead (XBSocket *); /* bsd calls */ extern XBBool Socket_Open (XBSocket * pSocket, int type); extern XBBool Socket_Connect (XBSocket * pSocket); extern XBBool Socket_Bind (XBSocket * pSocket); extern XBBool Socket_Accept (XBSocket * pSocket, const XBSocket * pListen); extern XBBool Socket_Listen (XBSocket * pSocket); extern void Socket_Close (XBSocket *); extern void Socket_ShutdownWrite (XBSocket *); extern int Socket_Send (const XBSocket * pSocket, const void *buf, size_t len); extern int Socket_Receive (const XBSocket * pSocket, void *buf, size_t len); extern int Socket_SendTo (XBSocket * pSocket, const void *buf, size_t len, const char *host, unsigned short port); extern int Socket_ReceiveFrom (XBSocket * pSocket, void *buf, size_t len, const char **host, unsigned short *port); /* interfaces */ extern const XBSocketInterface *Socket_GetInterfaces (size_t *); extern const char *Socket_GetAutoInterface (XBSocket *, const char *); #endif /* * end of file socket.h */ xblast-2.10.4/sprite.c0000644000175000017500000002743610372731125013677 0ustar rhondaalfie/* * file sprite.c - handling sprites * * $Id: sprite.c,v 1.9 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local types */ /* function pointers for region and drawing */ /* * local variables */ AnySprite *spriteFirst = NULL; AnySprite *spriteLast = NULL; /* * mark sprite positon to redraw */ void MarkMazeSprite (const Sprite * spr) { const BMRectangle *r = (*spr->any.rect) (spr); assert (r != NULL); MarkMaze (r->x / BLOCK_WIDTH, r->y / BLOCK_HEIGHT, (r->x + r->w - 1) / BLOCK_WIDTH, (r->y + r->h - 1) / BLOCK_HEIGHT); } /* MarkMazeSprite */ /* * local function: create sprite */ static Sprite * CreateSprite (SpriteType type, DrawFunc draw, RectFunc rect, int x, int y, int ysort, int anime, int mode) { AnySprite *ptr; AnySprite *other; /* alloc memory */ if (NULL == (ptr = (AnySprite *) malloc (sizeof (Sprite)))) { return NULL; } /* init values */ ptr->type = type; ptr->dirty = XBTrue; ptr->draw = draw; ptr->rect = rect; ptr->x = x; ptr->y = y; ptr->ysort = ysort; ptr->anime = anime; ptr->mode = mode; ptr->next = NULL; ptr->prev = NULL; /* store sprite in list */ if (NULL == spriteFirst) { spriteFirst = spriteLast = ptr; } else { for (other = spriteFirst; other != NULL; other = other->next) { /* list is sorted by inccreasing (y+ysort) value */ if ((other->ysort + other->y) > (ptr->ysort + ptr->y)) { if (NULL == other->prev) { /* start of list */ spriteFirst = ptr; ptr->prev = NULL; } else { other->prev->next = ptr; ptr->prev = other->prev; } ptr->next = other; other->prev = ptr; goto Finish; } } spriteLast->next = ptr; ptr->prev = spriteLast; spriteLast = ptr; } Finish: return (Sprite *) ptr; } /* CreateSprite */ /* * rectangle function for player sprite */ static const BMRectangle * RectPlayerSprite (const Sprite * ptr) { static BMRectangle result; assert (ptr != NULL); result.x = imgRectSprite[ptr->any.anime].x + ptr->any.x; result.y = imgRectSprite[ptr->any.anime].y + ptr->any.y; result.w = imgRectSprite[ptr->any.anime].w; result.h = imgRectSprite[ptr->any.anime].h; return &result; } /* RectPlayerSprite */ /* * public function: CreatePlayerSprite */ Sprite * CreatePlayerSprite (int player, int x, int y, unsigned anime, int mode) { Sprite *ptr; ptr = CreateSprite (STPlayer, GUI_DrawPlayerSprite, RectPlayerSprite, x, y, BLOCK_HEIGHT, anime, mode); if (NULL == ptr) { return NULL; } ptr->player.player = player; /* mark maze to redrawn */ if (ptr->any.mode == SPM_MAPPED) { MarkMazeSprite ((Sprite *) ptr); } return ptr; } /* CreatePlayerSprite */ static const BMRectangle * RectBombSprite (const Sprite * ptr) { static BMRectangle result; assert (ptr != NULL); result.x = ptr->any.x; result.y = ptr->any.y; result.w = BLOCK_WIDTH; result.h = BLOCK_HEIGHT; return &result; } /* GUI_RectBombSprite */ /* * public function: CreateBombSprite */ Sprite * CreateBombSprite (int bomb, int x, int y, unsigned anime, int mode) { Sprite *ptr; ptr = CreateSprite (STBomb, GUI_DrawBombSprite, RectBombSprite, x, y, BASE_Y / 2, anime, mode); if (NULL == ptr) { return NULL; } ptr->bomb.bomb = bomb; /* mark maze to redrawn */ if (ptr->any.mode == SPM_MAPPED) { MarkMazeSprite ((Sprite *) ptr); } return ptr; } /* CreateBombSprite */ /* * */ static const BMRectangle * RectTextSprite (const Sprite * ptr) { static BMRectangle result; assert (ptr != NULL); result.x = ptr->any.x; result.y = ptr->any.y; result.w = ptr->text.w; result.h = ptr->text.h; return &result; } /* GUI_RectTextSprite */ /* * */ Sprite * CreateTextSprite (const char *text, int x, int y, int w, int h, unsigned anime, int mode) { Sprite *ptr; ptr = CreateSprite (STText, GUI_DrawTextSprite, RectTextSprite, x, y, 0, anime, mode); if (NULL == ptr) { return NULL; } ptr->any.anime = anime; ptr->text.text = text; ptr->text.w = w; ptr->text.h = h; /* mark maze to redrawn */ if (ptr->any.mode == SPM_MAPPED) { MarkMazeSprite ((Sprite *) ptr); } return ptr; } /* CreateTextSprite */ /* * */ static const BMRectangle * RectIconSprite (const Sprite * spr) { static BMRectangle result; assert (spr != NULL); assert (spr->any.anime < MAX_ICON_SPRITES); result.x = imgRectIcon[spr->any.anime].x + spr->any.x; result.y = imgRectIcon[spr->any.anime].y + spr->any.y; result.w = imgRectIcon[spr->any.anime].w; result.h = imgRectIcon[spr->any.anime].h; return &result; } /* RectColorSprite */ /* * */ Sprite * CreateIconSprite (int x, int y, unsigned anime, int mode) { Sprite *ptr; ptr = CreateSprite (STIcon, GUI_DrawIconSprite, RectIconSprite, x, y, 0, anime, mode); if (NULL == ptr) { return NULL; } /* mark maze to redrawn */ if (ptr->any.mode == SPM_MAPPED) { MarkMazeSprite ((Sprite *) ptr); } return ptr; } /* CreateIconSprite */ /* * public function delete_sprite */ void DeleteSprite (Sprite * spr) { /* check for non-dirty sprites to be redrawn */ if (NULL == spr->any.prev) { spriteFirst = spr->any.next; } else { spr->any.prev->next = spr->any.next; } if (NULL == spr->any.next) { spriteLast = spr->any.prev; } else { spr->any.next->prev = spr->any.prev; } if (spr->any.mode & SPM_MAPPED) { /* mark tiles on position */ MarkMazeSprite (spr); } free (spr); } /* DeleteSprite */ /* * local function swap_sprite_prev */ static void SwapSpritePrev (AnySprite * ptr) { AnySprite *prev; if (NULL == (prev = ptr->prev)) { return; } /* references from outside */ if (prev->prev != NULL) { prev->prev->next = ptr; } else { spriteFirst = ptr; } if (ptr->next != NULL) { ptr->next->prev = prev; } else { spriteLast = prev; } /* internal refs */ prev->next = ptr->next; ptr->prev = prev->prev; prev->prev = ptr; ptr->next = prev; } /* SwapSpritePrev */ /* * public function: move_sprite */ void MoveSprite (Sprite * sprite, int x, int y) { AnySprite *spr = (AnySprite *) sprite; AnySprite *ptr; if ((spr->y == y) && (spr->x == x)) { return; } if (spr->mode & SPM_MAPPED) { /* mark sprite as dirty */ spr->dirty = XBTrue; /* mark tiles on old position */ MarkMazeSprite ((Sprite *) spr); } spr->x = x; if (spr->y < y) { spr->y = y; /* sprite has move downwards */ for (ptr = spr->next; (ptr != NULL) && ((ptr->y + ptr->ysort) < (spr->y + spr->ysort)); ptr = spr->next) { SwapSpritePrev (ptr); } } else if (spr->y > y) { spr->y = y; /* sprite has moved upwards */ for (ptr = spr->prev; (ptr != NULL) && ((ptr->y + ptr->ysort) > (spr->y + spr->ysort)); ptr = spr->prev) { SwapSpritePrev (spr); } } /* mark tiles on new position */ if (spr->mode & SPM_MAPPED) { MarkMazeSprite ((Sprite *) spr); } } /* MoveSprite */ /* * public function: set_sprite_mode */ void SetSpriteMode (Sprite * sprite, int mode) { if (mode == sprite->any.mode) { return; } MarkMazeSprite ((Sprite *) sprite); sprite->any.mode = mode; sprite->any.dirty = XBTrue; } /* SetSpriteMode */ /* * */ void SetSpriteText (Sprite * sprite, const char *text) { assert (sprite != NULL); assert (sprite->type = STText); MarkMazeSprite ((Sprite *) sprite); sprite->text.text = text; sprite->any.dirty = XBTrue; } /* SetSpriteText */ /* * */ void SetSpriteAnime (Sprite * sprite, unsigned anime) { if (anime == sprite->any.anime) { return; } if (sprite->any.mode & SPM_MAPPED) { MarkMazeSprite ((Sprite *) sprite); sprite->any.dirty = XBTrue; } sprite->any.anime = anime; if (sprite->any.mode & SPM_MAPPED) { MarkMazeSprite ((Sprite *) sprite); } } /* SetSpriteAnime */ /* * set color for an icon/xolor sprite */ void SetSpriteColor (Sprite * sprite, XBColor color) { assert (sprite != NULL); assert (sprite->type == STIcon); GUI_LoadIconSprite (sprite->any.anime, color); MarkMazeSprite (sprite); } /* SetSpriteColor */ /* * local function: sprite_intersect */ static void SpriteIntersect (AnySprite * a, AnySprite * b) { BMRectangle rect_a, rect_b; int left, right, top, bottom; if ((a->mode & SPM_MAPPED) && (b->mode & SPM_MAPPED)) { rect_a = *(*a->rect) ((Sprite *) a); rect_b = *(*b->rect) ((Sprite *) b); left = MAX (rect_a.x, rect_b.x); right = MIN (rect_a.x + rect_a.w, rect_b.x + rect_b.w); if (left < right) { top = MAX (rect_a.y, rect_b.y); bottom = MIN (rect_a.y + rect_a.h, rect_b.y + rect_b.h); if (top < bottom) { a->dirty = XBTrue; b->dirty = XBTrue; MarkMazeRect (left, top, right - left, bottom - top); } } } } /* SpriteIntersect */ /* * */ void ShuffleAllSprites (void) { AnySprite *ptr; /* switch sprites on same (y+ysort) */ if (spriteFirst != NULL) { ptr = spriteFirst; while (ptr->next != NULL) { if ((ptr->y + ptr->ysort) == (ptr->next->y + ptr->next->ysort)) { if ((!ptr->dirty) && (!ptr->next->dirty)) { SpriteIntersect (ptr, ptr->next); } SwapSpritePrev (ptr->next); } else { ptr = ptr->next; } } } } /* ShuffleAllSprites */ void DeleteAllBombSprites (void) { AnySprite *ptr, *tmp; /* check for non-dirty sprites to be redrawn */ for (ptr = spriteFirst; ptr != NULL;) { if (ptr->draw == GUI_DrawBombSprite) { tmp = ptr->next; DeleteSprite ((Sprite *) ptr); ptr = tmp; } else { ptr = ptr->next; } } } /* * */ void MarkAllSprites (void) { AnySprite *ptr; /* check for non-dirty sprites to be redrawn */ for (ptr = spriteFirst; ptr != NULL; ptr = ptr->next) { if (!ptr->dirty) { ptr->dirty = SpriteMarked ((Sprite *) ptr); } } } /* MarkAllSprites */ /* * public function draw all sprites */ void DrawAllSprites (void) { AnySprite *ptr; for (ptr = spriteFirst; ptr != NULL; ptr = ptr->next) { if (ptr->type == STBomb) { } if ((ptr->mode & SPM_MAPPED) && (ptr->dirty)) { (*ptr->draw) ((Sprite *) ptr); } ptr->dirty = XBFalse; } } /* DrawAllSprites */ /* * get current region of sprite */ const BMRectangle * SpriteRectangle (const Sprite * sprite) { assert (sprite != NULL); assert (sprite->any.rect != NULL); return (*sprite->any.rect) (sprite); } /* SpriteRectangle */ /* * get sorite animation phase */ int SpriteAnime (const Sprite * sprite) { assert (sprite != NULL); return sprite->any.anime; } /* SpriteAnime */ /* * get bomb sprite bomb type (mini/normal) */ int SpriteBomb (const Sprite * sprite) { assert (sprite != NULL); assert (sprite->type == STBomb); return sprite->bomb.bomb; } /* SpriteBomb */ /* * get player sprite id */ int SpritePlayer (const Sprite * sprite) { assert (sprite != NULL); assert (sprite->type == STPlayer); return sprite->player.player; } /* SpritePlayer */ /* * get text sprite text to draw */ const char * SpriteText (const Sprite * sprite) { assert (sprite != NULL); assert (sprite->type == STText); return sprite->text.text; } /* SpriteText */ /* * check if sprite is masked */ XBBool SpriteIsMasked (const Sprite * sprite) { assert (sprite != NULL); return (sprite->any.mode & SPM_MASKED) ? XBTrue : XBFalse; } /* SpriteIsMasked */ /* * end of sprite.c */ xblast-2.10.4/sprite.h0000644000175000017500000000652310372731125013676 0ustar rhondaalfie/* * file sprite.h - handling all sprites * * $Id: sprite.h,v 1.6 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_SPRITE_H #define XBLAST_SPRITE_H /* * some flags */ #define SPM_UNMAPPED 0 #define SPM_MAPPED (1<<1) #define SPM_MASKED (1<<2) #define MAX_COLOR_SPRITES 6 typedef enum { ISA_Color1, ISA_Color2, ISA_Color3, ISA_Color4, ISA_Color5, ISA_Color6, ISA_LedOff, ISA_LedOn, ISA_Abort, ISA_Default, ISA_TeamNone, ISA_TeamRed, ISA_TeamGreen, ISA_TeamBlue, MAX_ICON_SPRITES } IconSpriteAnimation; typedef union _sprite Sprite; /* type of sprite */ typedef enum { STNone = 0, STPlayer, STBomb, STText, STIcon } SpriteType; typedef void (*DrawFunc) (const Sprite *); typedef const BMRectangle *(*RectFunc) (const Sprite *); typedef struct _any_sprite AnySprite; /* common basis */ struct _any_sprite { SpriteType type; XBBool dirty; AnySprite *prev; AnySprite *next; DrawFunc draw; RectFunc rect; int ysort; int x; int y; int mode; unsigned anime; }; /* players */ typedef struct { AnySprite any; int player; } PlayerSprite; /* bombs */ typedef struct { AnySprite any; int bomb; } BombSprite; /* text (for menus) */ typedef struct { AnySprite any; int w; int h; const char *text; } TextSprite; /* icons for menus */ typedef struct { AnySprite any; } IconSprite; union _sprite { int type; AnySprite any; PlayerSprite player; BombSprite bomb; TextSprite text; IconSprite icon; }; /* * prototypes */ extern Sprite *CreatePlayerSprite (int p, int x, int y, unsigned a, int m); extern Sprite *CreateBombSprite (int b, int x, int y, unsigned a, int m); extern Sprite *CreateTextSprite (const char *t, int x, int y, int w, int h, unsigned a, int m); extern Sprite *CreateIconSprite (int x, int y, unsigned a, int m); extern void DeleteSprite (Sprite * spr); extern void MoveSprite (Sprite * sprite, int x, int y); extern void SetSpriteMode (Sprite * sprite, int mode); extern void SetSpriteAnime (Sprite * sprite, unsigned anime); extern void SetSpriteText (Sprite * sprite, const char *text); extern void SetSpriteColor (Sprite * sprite, XBColor color); extern void ShuffleAllSprites (void); extern void MarkAllSprites (void); extern void DrawAllSprites (void); extern void DeleteAllBombSprites (void); extern const BMRectangle *SpriteRectangle (const Sprite *); extern int SpriteAnime (const Sprite *); extern int SpriteBomb (const Sprite *); extern int SpritePlayer (const Sprite *); extern const char *SpriteText (const Sprite *); extern XBBool SpriteIsMasked (const Sprite *); extern void MarkMazeSprite (const Sprite * spr); #endif /* * end fo file sprite.h */ xblast-2.10.4/status.c0000644000175000017500000005145310373126067013714 0ustar rhondaalfie/* * file status.c - displays status bar at window bottom * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "xblast.h" /* * local constants */ #define TEXT_ATTR_NORMAL (FF_Medium|FF_White|FF_Boxed) #define TEXT_ATTR_NUMBER (FF_Large|FF_White|FF_Boxed) #define TEXT_ATTR_SMALLNUMBER (FF_Medium|FF_White|FF_Boxed) // mab #define TEXT_ATTR_SMALLNUMBER1 (FF_Small |FF_White|FF_Boxed) /* Added by VVL (Chat) 12/11/99 */ #define FF_Scroll 0x40 #define MAX_MSG 8 #define MESSAGE_TIME TIME_STEP /* * local variables */ static int numPlayer; static int gameNext, timeLed; static int faceUsed[MAX_PLAYER]; static int numUsed[MAX_PLAYER]; #ifdef SMPF /* SMPF - create 2D arrays x and y pos, current values are all y = 0 new facePos y = 1, x = 0 2 4 6 8 10 12 14 16 18 and numPos facePos.x + 1 for this to work adjust SetScoreBlock (status.c) and GUI_DrawScoreBlock(x11c_tile.c), make sure the XFillRectangle call is correct!! */ static const int facePos[MAX_PLAYER] = { 0, 2, 4, 14, 16, 18, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 }; static const int numPos[MAX_PLAYER] = { 1, 3, 5, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39 }; #else static const int facePos[MAX_PLAYER] = { 0, 2, 4, 14, 16, 18, }; static const int numPos[MAX_PLAYER] = { 1, 3, 5, 15, 17, 19, }; #endif /* variables for message queue */ static const char *defaultMessage; static int msgRestore; /* Added by VVL (Chat) 12/11/99 */ static int chat_restore; /* Added by VVL (Chat) 12/11/99 */ static int num_chat = 0; /* Added by VVL (Chat) 12/11/99 */ static int first_chat; /* Added by VVL (Chat) 12/11/99 */ static char chat_queue[MAX_MSG][CHAT_LEN + 128]; /* Added by VVL (Chat) 12/11/99 : Begin */ static int chat_delay[MAX_MSG + 1] = { -1, 200, 80, 40, 20, 15, 10, 7, 7 }; /* Added by VVL (Chat) 12/11/99 : End */ static int numMsg = 0; static int firstMsg; static const char *msgQueue[MAX_MSG]; static const int msgDelay[MAX_MSG + 1] = { -1, 50, 40, 20, 12, 7, 7, 7, 7 }; /* status board text box */ static const int textLeft = 6; static const int textRight = 13; static BMRectangle statusBox = { 77 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 87 * STAT_WIDTH / 12, 2 * STAT_HEIGHT / 3, }; /* Added by VVL (Chat) 12/11/99 : Begin */ static BMRectangle get_box = { 2 * STAT_WIDTH / 12, #ifdef SMPF 93 * STAT_HEIGHT / 6, #else 87 * STAT_HEIGHT / 6, #endif 116 * STAT_WIDTH / 12, 2 * STAT_HEIGHT / 3, }; static BMRectangle chat_box = { 121 * STAT_WIDTH / 12, #ifdef SMPF 93 * STAT_HEIGHT / 6, #else 87 * STAT_HEIGHT / 6, #endif 116 * STAT_WIDTH / 12, 2 * STAT_HEIGHT / 3, }; /* Added by VVL (Chat) 12/11/99 : End */ /* status board number boxes */ #ifdef SMPF static BMRectangle statusNumberBox[STAT_W * 2] = { #else static BMRectangle statusNumberBox[STAT_W] = { #endif {1 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {13 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {25 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {37 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {49 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {61 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {73 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {85 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {97 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {109 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {121 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {133 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {145 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {157 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {169 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {181 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {193 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {205 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {217 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {229 * STAT_WIDTH / 12, 79 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, #ifdef SMPF {1 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {13 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {25 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {37 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {49 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {61 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {73 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {85 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {97 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {109 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {121 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {133 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {145 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {157 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {169 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {181 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {193 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {205 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {217 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, {229 * STAT_WIDTH / 12, 85 * STAT_HEIGHT / 6, 8 * STAT_WIDTH / 12 - 1, 4 * STAT_HEIGHT / 6}, #endif }; /* victory boxes, mab */ #ifdef SMPF static BMRectangle statusNumberBox2[STAT_W * 2] = { #else static BMRectangle statusNumberBox2[STAT_W] = { #endif {1 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {13 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {25 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {37 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {49 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {61 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {73 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {85 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {97 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {109 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {121 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {133 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {145 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {157 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {169 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {181 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {193 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {205 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {217 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {229 * STAT_WIDTH / 12 - 2, 79 * STAT_HEIGHT / 6 - 2, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, #ifdef SMPF {1 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {13 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {25 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {37 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {49 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {61 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {73 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {85 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {97 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {109 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {121 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {133 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {145 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {157 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {169 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {181 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {193 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {205 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {217 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, {229 * STAT_WIDTH / 12 - 2, 85 * STAT_HEIGHT / 6, 4 * STAT_WIDTH / 16 - 1, 2 * STAT_HEIGHT / 6}, #endif }; /* * */ void ClearStatusBar (int tile1, int tile2) { int x; for (x = 0; x < MAZE_W; x++) { GUI_DrawBlock (x, MAZE_H, tile1); GUI_DrawBlock (x, MAZE_H + 1, tile2); GUI_DrawBlock (x, MAZE_H + 2, tile2); #ifdef SMPF GUI_DrawBlock (x, MAZE_H + 3, tile2); #endif } MarkMazeRect (0, PIXH, PIXW, SCOREH); } /* ClearStatusBar */ /* * */ //#ifdef SMPF static void SetScoreBlock (int x, int y, int block) { GUI_DrawScoreBlock (x, y, block); MarkMazeTile (x, MAZE_H + y); } /* SetScoreBlock */ /*#else static void SetScoreBlock (int x, int block) { GUI_DrawScoreBlock (x, block); MarkMazeTile (x, MAZE_H); } *//* SetScoreBlock */ //#endif /* * */ static void SetStatusText (const char *msg) { GUI_DrawSimpleTextbox (msg, TEXT_ATTR_NORMAL, &statusBox); MarkMaze (textLeft, MAZE_H, textRight, MAZE_H); } /* SetStatusText */ /* Added by VVL (Chat) 12/11/99 : Begin */ /**/ /* local function set chat text */ static void SetChatText (char *msg) { GUI_DrawTextbox (msg, TEXT_ATTR_NORMAL | FF_Scroll, &chat_box); MarkMaze (10, MAZE_H + STAT_H - 1, 20, MAZE_H + STAT_H); } /* Added by VVL (Chat) 12/11/99 : End */ /* * */ static void #ifdef SMPF SetStatusNumber (int pos, int y, int value) #else SetStatusNumber (int pos, int value) #endif { char numString[2]; numString[0] = '0' + value; numString[1] = '\0'; GUI_DrawSimpleTextbox (numString, TEXT_ATTR_NUMBER, statusNumberBox + pos); #ifdef SMPF // fprintf(stderr," y1 %i pos %i pos 20 %i value %i\n",y,pos,pos%20,value); MarkMazeTile (pos % 20, MAZE_H + y); // SMPF - very carefull here!!!!! #else MarkMazeTile (pos, MAZE_H); #endif } /* SetStatusNumber */ /* * */ static void #ifdef SMPF SetStatusNumber2 (int pos, int y, int value) #else SetStatusNumber2 (int pos, int value) #endif { char numString[2]; numString[0] = '0' + value; numString[1] = '\0'; GUI_DrawSimpleTextbox (numString, TEXT_ATTR_SMALLNUMBER1, statusNumberBox2 + (pos)); #ifdef SMPF // fprintf(stderr," y2 %i pos %i pos 20 %i value %i\n",y,pos,pos%20,value); MarkMazeTile (pos % 20, MAZE_H + y); // SMPF - very carefull here!!!!! #else MarkMazeTile (pos, MAZE_H); #endif } /* SetStatusNumber2, mab */ /* * */ static void SetTimeLed (int x, int val) { GUI_DrawTimeLed (x, val); #ifdef SMPF MarkMazeTile (x / 3, MAZE_H + 2); #else MarkMazeTile (x / 3, MAZE_H + 1); #endif } /* SetTimeLed */ /* * */ void InitStatusBar (int numPlayers) { int p; /* set player and display number */ numPlayer = numPlayers; /* clear all */ for (p = 0; p < STAT_W; p++) { #ifdef SMPF SetScoreBlock (p, 0, SBVoid); // SMPF - 2D shit here see above.. SetScoreBlock (p, 1, SBVoid); // SMPF - 2D shit here see above.. SetScoreBlock (p, 2, SBVoid); // SMPF - 2D shit here see above.. SetScoreBlock (p, 3, SBVoid); // SMPF - 2D shit here see above.. #else SetScoreBlock (p, 0, SBVoid); SetScoreBlock (p, 1, SBVoid); SetScoreBlock (p, 2, SBVoid); #endif } /* player boxes */ for (p = 0; p < numPlayer; p++) { faceUsed[p] = SBPlayer + p; numUsed[p] = 0; #if 0 SetScoreBlock (facePos[p], p); #endif #ifdef SMPF SetScoreBlock (facePos[p], (p < 6 ? 0 : 1), faceUsed[p]); // SMPF - 2D shit here see above.. SetScoreBlock (facePos[p] + 1, (p < 6 ? 0 : 1), SBTextRight); SetStatusNumber (numPos[p], (p < 6 ? 0 : 1), numUsed[p]); #else SetScoreBlock (facePos[p], 0, faceUsed[p]); SetScoreBlock (numPos[p], 0, SBTextRight); SetStatusNumber (numPos[p], numUsed[p]); #endif } /* text box */ #ifdef SMPF SetScoreBlock (textLeft, 0, SBTextLeft); for (p = textLeft + 1; p < textRight; p++) { SetScoreBlock (p, 0, SBTextMid); } SetScoreBlock (textRight, 0, SBTextRight); #else SetScoreBlock (textLeft, 0, SBTextLeft); for (p = textLeft + 1; p < textRight; p++) { SetScoreBlock (p, 0, SBTextMid); } SetScoreBlock (textRight, 0, SBTextRight); #endif /* set queue to default message */ defaultMessage = ""; numMsg = 0; SetStatusText (defaultMessage); /* set leds */ for (p = 0; p < (4 * MAZE_W); p++) { SetTimeLed (p, 1); } /* set timers for leds */ gameNext = TIME_STEP; timeLed = MAZE_W * 4; } /* InitStatusBar */ /* * */ void ResetStatusBar (const BMPlayer * ps, const char *msg, XBBool flag) { int p, i, j; /* player boxes */ for (p = 0; p < numPlayer; p++) { faceUsed[p] = SBPlayer + p; numUsed[p] = flag ? ps[p].lives : ps[p].victories; #ifdef SMPF SetScoreBlock (facePos[p], (p < 6 ? 0 : 1), faceUsed[p]); SetStatusNumber (numPos[p], (p < 6 ? 0 : 1), numUsed[p]); SetStatusNumber2 (numPos[p], (p < 6 ? 0 : 1), ps[p].victories); #else SetScoreBlock (facePos[p], 0, faceUsed[p]); SetStatusNumber (numPos[p], numUsed[p]); SetStatusNumber2 (numPos[p], ps[p].victories); #endif } /* default message */ defaultMessage = msg; numMsg = 0; SetStatusText (msg); /* set leds */ for (p = 0; p < 4 * MAZE_W; p++) { SetTimeLed (p, 1); } if (flag) { // XBCC draw shrink in other color (for loosers with no memory) not on scorebord p = -1; while (p != 0) { p = getShrinkTimes (p); if (p != 0) { if ((p >= 0) && (p < GAME_TIME)) { i = 4 * MAZE_W - (p / TIME_STEP); // inverse SetTimeLed (i, 2); } } } p = -1; while (p != 0) { p = getScrambleTimes (p); if (p < 0) { j = 4; // DEL p = -p; } else { j = 3; // DRAW } if (p != 0) { if ((p >= 0) && (p < GAME_TIME)) { i = 4 * MAZE_W - (p / TIME_STEP); // inverse SetTimeLed (i, j); } } } } /* set timers for leds */ gameNext = TIME_STEP; timeLed = MAZE_W * 4; /* mark all filled to be redrawed */ #ifdef SMPF MarkMaze (0, MAZE_H, MAZE_W, MAZE_H + 2); // SMPF #else MarkMaze (0, MAZE_H, MAZE_W, MAZE_H + 1); #endif } /* ResetStatusBar */ /* * */ void UpdateStatusBar (const BMPlayer * ps, int game_time) { int p; int newFace; for (p = 0; p < numPlayer; p++) { /* determine current face for player */ if (ps[p].dying || ps[p].lives == 0) { newFace = SBDead + p; } else if (ps[p].illness != ps[p].health) { if (ps[p].abort) { newFace = SBSickAbort + p; } else { newFace = SBSick + p; } } else { if (ps[p].abort) { newFace = SBAbort + p; } else { newFace = SBPlayer + p; } } if (faceUsed[p] != newFace) { faceUsed[p] = newFace; #ifdef SMPF SetScoreBlock (facePos[p], (p < 6 ? 0 : 1), faceUsed[p]); #else SetScoreBlock (facePos[p], 0, faceUsed[p]); #endif } /* check player lives */ if (numUsed[p] != ps[p].lives) { numUsed[p] = ps[p].lives; #ifdef SMPF SetStatusNumber (numPos[p], (p < 6 ? 0 : 1), numUsed[p]); SetStatusNumber2 (numPos[p], (p < 6 ? 0 : 1), ps[p].victories); #else SetStatusNumber (numPos[p], numUsed[p]); SetStatusNumber2 (numPos[p], ps[p].victories); #endif } } /* check leds */ if (game_time > gameNext) { gameNext += TIME_STEP; timeLed--; SetTimeLed (timeLed, 0); } /* check message */ /* if any message is in the queue */ if (numMsg) { msgRestore++; /* check if message is outdated */ if (msgRestore >= msgDelay[numMsg]) { /* return to default message if last queued one */ if (--numMsg) { /* set next message */ firstMsg = (firstMsg + 1) % MAX_MSG; SetStatusText (msgQueue[firstMsg]); msgRestore = 0; } else { /* return to default message if last queued one */ SetStatusText (defaultMessage); } } } /* Added by VVL (Chat) 12/11/99 */ /* check chat */ /* if any chat message is in the queue */ if (num_chat) { chat_restore++; /* check if message is outdated */ if (chat_restore >= chat_delay[num_chat]) { /* return to default message if last queued one */ if (--num_chat) { /* set next message */ first_chat = (first_chat + 1) % MAX_MSG; SetChatText (chat_queue[first_chat]); chat_restore = 0; } else { /* return to default message if last queued one */ SetChatText (""); } } } /* Added by VVL (Chat) 12/11/99 : End */ } /* UpdateStatusBar */ /* * */ void SetMessage (const char *msg, XBBool perm) { int m; if (NULL != msg) { if (perm) { SetStatusText (msg); numMsg = 0; } else { /* if no other message exists set to start of queue */ if (0 == numMsg) { m = firstMsg = 0; msgRestore = 0; SetStatusText (msg); } else { m = (firstMsg + numMsg) % MAX_MSG; } msgQueue[m] = msg; numMsg++; /* check for queue overflow */ if (numMsg > MAX_MSG) { /* remove first message */ numMsg--; firstMsg = (firstMsg + 1) % MAX_MSG; } } } } /* SetMessage */ /* Added by VVL (Chat) 12/11/99 : Begin */ /**/ /* public function set_get */ void SetGet (const char *msg, int perm) { GUI_DrawTextbox (msg, TEXT_ATTR_NORMAL | FF_Scroll, &get_box); MarkMaze (0, MAZE_H + STAT_H - 1, 20, MAZE_H + STAT_H); } /* Added by VVL (Chat) 12/11/99 : End */ /* Added by VVL (Chat) 12/11/99 : Begin */ /**/ /* public function set_chat */ void SetChat (char *msg, int perm) { int m; if (NULL != msg) { if (perm) { SetChatText (msg); num_chat = 0; } else { /* if no other message exists set to start of queue */ if (0 == num_chat) { m = first_chat = 0; chat_restore = 0; SetChatText (msg); } else { m = (first_chat + num_chat) % MAX_MSG; } strncpy (chat_queue[m], msg, CHAT_LEN + 128); num_chat++; /* check for queue overflow */ if (num_chat > MAX_MSG) { /* remove first message */ num_chat--; first_chat = (first_chat + 1) % MAX_MSG; } } } } /* Added by VVL (Chat) 12/11/99 : End */ /* * */ void ResetMessage (void) { if (numMsg > 0) { SetStatusText (msgQueue[firstMsg]); } else { SetStatusText (defaultMessage); } } /* ResetMessage */ /* * end of file status.c */ xblast-2.10.4/status.h0000644000175000017500000000252110373126067013711 0ustar rhondaalfie/* * file status.h * * $Id: status.h,v 1.7 2006/02/10 15:07:35 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_STATUS_H #define XBLAST_STATUS_H extern void ClearStatusBar (int tile1, int tile2); extern void InitStatusBar (int numPlayer); extern void ResetStatusBar (const BMPlayer * ps, const char *msg, XBBool flag); extern void UpdateStatusBar (const BMPlayer * ps, int g_time); extern void SetMessage (const char *msg, XBBool perm); extern void ResetMessage (void); extern void SetGet (const char *msg, int perm); extern void SetChat (char *msg, int perm); #endif /* * end of file status.c */ xblast-2.10.4/str_util.c0000644000175000017500000000700610372731125014225 0ustar rhondaalfie/* * file str_util.c - some own string routines * * $Id: str_util.c,v 1.8 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* temporary string buffer */ static char *tmpstr = NULL; static unsigned int tmpsize = 0; /* * duplicate string (some systems do not have strdup) */ char * DupString (const char *ptr) { char *result; size_t length; assert (ptr != NULL); /* alloc data */ length = strlen (ptr); result = malloc (length + 1); assert (result != NULL); /* copy data */ memcpy (result, ptr, length + 1); /* --- */ return result; } /* DupString */ /* * duplicate string (some systems do not have strdup) */ char * DupStringNum (const char *ptr, size_t length) { char *result; assert (ptr != NULL); /* alloc data */ result = malloc (length + 1); assert (result != NULL); /* copy data */ memcpy (result, ptr, length); result[length] = 0; /* --- */ return result; } /* DupString */ /* * public function split_string */ char ** SplitString (const char *string, int *largc) { void *ptr; char *buf; char **argv; int i, length, size, argc; XBBool space; /* get number of words and total character count */ space = XBTrue; *largc = 0; size = 0; length = strlen (string); for (i = 0; i < length; i++) { if (isspace ((unsigned char)string[i])) { space = XBTrue; } else { if (space) { (*largc)++; space = XBFalse; } size++; } } /* alloc array */ ptr = malloc (((*largc) + 1) * sizeof (char *) + (size + (*largc)) * sizeof (char)); assert (ptr != NULL); /* now store strings */ buf = (char *)((char **)ptr + ((*largc) + 1)); argv = (char **)ptr; argc = 0; space = XBTrue; for (i = 0; i < length; i++) { if (isspace ((unsigned char)string[i])) { if (*largc <= argc) break; if (!space) { space = XBTrue; *buf = '\0'; buf++; } } else { if (space) { argv[argc] = buf; argc++; space = XBFalse; } *buf = string[i]; buf++; } } *buf = '\0'; argv[argc] = NULL; return argv; } /* SplitString */ /* * create a date string for XBlast */ const char * DateString (time_t t) { static char tmp[128]; strftime (tmp, sizeof (tmp), "%b %d %Y %H:%M", localtime (&t)); return tmp; } /* DateString */ /* * create temporary string */ const char * TempString (const char *fmt, ...) { int n; va_list argList; while (1) { va_start (argList, fmt); n = vsnprintf (tmpstr, tmpsize, fmt, argList); va_end (argList); if (n >= 0 && n <= tmpsize) { return tmpstr; } if (n >= 0) { tmpsize = n + 1; } else if (tmpsize == 0) { tmpsize = 100; } else { tmpsize *= 2; } if (tmpstr != NULL) { free (tmpstr); } tmpstr = malloc (tmpsize); assert (NULL != tmpstr); } } /* TempString */ /* * end of file str_util.c */ xblast-2.10.4/str_util.h0000644000175000017500000000233710372731125014234 0ustar rhondaalfie/* * file str_util.h - some own string routines * * $Id: str_util.h,v 1.6 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _STR_UTIL_H #define _STR_UTIL_H /* * prototypes */ extern char *DupString (const char *ptr); extern char *DupStringNum (const char *ptr, size_t length); extern char **SplitString (const char *string, int *largc); extern const char *DateString (time_t); extern const char *TempString (const char *fmt, ...); #endif /* * end of file str_util.h */ xblast-2.10.4/time.c0000644000175000017500000000236310372705223013317 0ustar rhondaalfie/* * timeval.h 1.0 01/12/19 * * Defines gettimeofday, timeval, etc. for Win32 * * By Wu Yongwei * */ #ifndef _TIMEVAL_H #define _TIMEVAL_H #ifdef W32 #define WIN32_LEAN_AND_MEAN #include #include #ifndef __GNUC__ #define EPOCHFILETIME (116444736000000000i64) #else #define EPOCHFILETIME (116444736000000000LL) #endif struct timeval { long tv_sec; /* seconds */ long tv_usec; /* microseconds */ }; struct timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ }; __inline int gettimeofday (struct timeval *tv, struct timezone *tz) { FILETIME ft; LARGE_INTEGER li; __int64 t; static int tzflag; if (tv) { GetSystemTimeAsFileTime (&ft); li.LowPart = ft.dwLowDateTime; li.HighPart = ft.dwHighDateTime; t = li.QuadPart; /* In 100-nanosecond intervals */ t -= EPOCHFILETIME; /* Offset to the Epoch time */ t /= 10; /* In microseconds */ tv->tv_sec = (long)(t / 1000000); tv->tv_usec = (long)(t % 1000000); } if (tz) { if (!tzflag) { _tzset (); tzflag++; } tz->tz_minuteswest = _timezone / 60; tz->tz_dsttime = _daylight; } return 0; } #else /* _WIN32 */ #include #endif /* _WIN32 */ #endif /* _TIMEVAL_H */ xblast-2.10.4/timeval.h0000644000175000017500000000331110372705223014021 0ustar rhondaalfie/* * timeval.h 1.0 01/12/19 x * * Defines gettimeofday, timeval, etc. for Win32 * * By Wu Yongwei * */ #ifndef _TIMEVAL_H #define _TIMEVAL_H #ifndef _WINSOCKAPI_ #ifndef _WINSOCK2API_ /* mingw32 libs (-mno-cygwin) */ /* gcc test */ #ifndef __GNUC__ #define EPOCHFILETIME (116444736000000000i64) #else #define EPOCHFILETIME (116444736000000000LL) #endif /* needed by cygwin,mingw wms */ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include #include /* mingw has timeval already defined */ #ifndef _TIMEVAL_DEFINED struct timeval { long tv_sec; /* seconds */ long tv_usec; /* microseconds */ }; #endif struct timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ }; /* WMS doesnt allow inline export (6.0) */ #ifdef WMS __inline int gettimeofday (struct timeval *tv, struct timezone *tz) { FILETIME ft; LARGE_INTEGER li; __int64 t; static int tzflag; if (tv) { GetSystemTimeAsFileTime (&ft); li.LowPart = ft.dwLowDateTime; li.HighPart = ft.dwHighDateTime; t = li.QuadPart; /* In 100-nanosecond intervals */ t -= EPOCHFILETIME; /* Offset to the Epoch time */ t /= 10; /* In microseconds */ tv->tv_sec = (long)(t / 1000000); tv->tv_usec = (long)(t % 1000000); } if (tz) { if (!tzflag) { _tzset (); tzflag++; } tz->tz_minuteswest = _timezone / 60; tz->tz_dsttime = _daylight; } return 0; } #else /* __MINGW32__ ,cygwin */ #include extern __inline int gettimeofday (struct timeval *tv, struct timezone *tz); #endif #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif /* _WIN32 */ #endif // winsock2 #endif // winsock #endif /* _TIMEVAL_H */ xblast-2.10.4/try.c0000644000175000017500000000134410372705223013175 0ustar rhondaalfie#include #include #include #define MAX_MSG 256 int main () { FILE *fp; char s[MAX_MSG]; char q[MAX_MSG]; int l[16], i, j; char *c, *d; if (NULL != (fp = fopen ("test", "r"))) { c = s; i = 0; l[i] = 0; while (1) { d = fgets (c, MAX_MSG, fp); if (d == NULL) break; i++; l[i] = strlen (s) - 1; c = s + strlen (s) - 1; } l[i + 1] = strlen (s); printf ("%s\n", s); for (j = 0; j < i; j++) { strncpy (q, (s + l[j]), (l[j + 1] - l[j])); q[l[j + 1] - l[j]] = 0; printf ("--%s--\n", q); } } sprintf (s, "%s", "dude"); printf ("--%s--\n", s); strcpy (q, s); printf ("--%s--\n", q); strcpy ((q + strlen (q)), "play"); printf ("--%s--\n", q); return 0; } xblast-2.10.4/user.c0000644000175000017500000001516010412220337013327 0ustar rhondaalfie/* * file user.c - communication interface for users * * $Id: user.c,v 1.14 2006/03/28 11:41:19 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define TIME_POLL_QUERY 5 #define PID_NONE -1001 #define PID_INVALID -3 /* * local variables */ static XBComm *comm = NULL; static int PID = PID_NONE; static int received = 0; /********************** * connect/disconnect * **********************/ /* * try to connect to server */ XBBool User_Connect (CFGCentralSetup * cfg) { int j; char tmp[16]; /* create communication */ assert (comm == NULL); comm = X2C_CreateComm (cfg); if (NULL == comm) { Dbg_User ("failed to establish tcp connection to central\n"); return XBFalse; } Dbg_User ("successfully established tcp to central\n"); /* init data */ PID = PID_NONE; received = 0; /* is that needed ? */ j = sprintf (tmp, "tmpPlayer"); tmp[j + 1] = 0; Network_SetPlayer (0, 0, GUI_StringToAtom (tmp)); return XBTrue; } /* User_Connect */ /* * disconnect from server by shutting down */ void User_Disconnect (void) { if (comm != NULL) { Dbg_User ("disconnecting from central\n"); CommDelete (comm); } else { Dbg_User ("already disconnected from central\n"); } } /* User_Disconnect */ /* * handle stream events */ XBBool User_EventToCentral (const XBEventToCentral ev) { switch (ev) { case XBE2C_IORead: Dbg_User ("read error to central, shutdown!\n"); Network_QueueEvent (XBNW_Error, CENTRAL_READ_ERR); return XBTrue; case XBE2C_IOWrite: Dbg_User ("write error to central, shutdown!\n"); Network_QueueEvent (XBNW_Error, CENTRAL_WRITE_ERR); return XBTrue; case XBE2C_InvalidCot: Dbg_User ("invalid telegram CoT from central, shutdown!\n"); Network_QueueEvent (XBNW_Error, CENTRAL_COT_INVALID); return XBTrue; case XBE2C_InvalidID: Dbg_User ("invalid telegram id central, ignoring!\n"); return XBTrue; case XBE2C_UnexpectedEOF: Dbg_User ("unexpected eof to central, shutdown!\n"); Network_QueueEvent (XBNW_Error, CENTRAL_DISCONNECT); return XBTrue; case XBE2C_StreamWaiting: Dbg_User ("all queued data sent to central\n"); return XBFalse; case XBE2C_StreamBusy: /* Dbg_User("data waits to be sent to central\n"); */ return XBFalse; case XBE2C_StreamClosed: Dbg_User ("connection to central has been removed\n"); comm = NULL; return XBFalse; default: Dbg_User ("unknown event on stream, ignoring\n"); return XBFalse; } } /* User_EventToCentral */ /**************** * receive data * ****************/ /* * receive player config from server */ void User_ReceivePlayerConfig (const char *data) { XBAtom atom, atomID; CFGPlayerEx tmpPlayer; int i; atom = Network_ReceivePlayerConfig (CT_Central, 0, 0, data); /* if atom is valid, data is complete */ if (ATOM_INVALID != atom) { Dbg_User ("Got player from central\n"); RetrievePlayerEx (CT_Central, atom, &tmpPlayer); i = tmpPlayer.id.PID; if (i >= 0) { /* store player under valid pid */ received++; atomID = GUI_IntToAtom (i); StorePlayerEx (CT_Central, atomID, &tmpPlayer); } /* remove the received database */ DeletePlayerConfig (CT_Central, atom); } } /* User_ReceivePlayerConfig */ /* * received last player */ void User_NoMorePlayers (void) { Dbg_User ("received %u players\n", received); User_SendDisconnect (); Network_QueueEvent (XBNW_Disconnected, CENTRAL_FINISHED); } /* User_NoMorePlayers */ /* * receive player pid from server */ void User_ReceivePlayerPID (const char *data) { if (!sscanf (data, "%i", &PID)) { PID = PID_INVALID; } } /* User_ReceivePlayerPID */ #ifdef unused /* * central has disconnected */ static void User_ReceiveDisconnect (unsigned id) { Network_QueueEvent (XBNW_Disconnected, CENTRAL_DISCONNECT); } /* User_ReceiveDisconnect */ #endif /****************** * get local data * ******************/ /* * return if connection is up */ XBBool User_Connected (void) { return (comm != NULL); } /* User_Connected */ /* * return PID */ int User_GetPID (void) { return PID; } /* User_GetPID */ /* * return number of players received */ int User_Received (void) { return received; } /* User_Received */ /************** * queue data * **************/ /* * send disconnect sequence, will shutdown after send */ void User_SendDisconnect (void) { if (comm != NULL) { Dbg_User ("queueing disconnect sequence to central\n"); X2C_SendDisconnect (comm); } else { Dbg_User ("already disconnected from central\n"); } } /* User_SendDisconnect */ /* * queue registration data */ void User_SendRegisterPlayer (XBAtom atom) { PID = PID_NONE; X2C_SendPlayerConfig (comm, atom); } /* Use_SendRegisterPlayer */ /* * unregister player */ void User_SendUnregisterPlayer (XBAtom atom) { } /* User_SendUnregisterPlayer */ /* * queue request for scores */ void User_RequestUpdate (void) { received = 0; RemoveAllPlayers (CT_Central); X2C_QueryPlayerConfig (comm); Dbg_User ("queueing update request, old rankings deleted\n"); } /* User_RequestUpdate */ /* * queue current score */ void User_SendGameStat (int numPlayers, BMPlayer * playerStat, int *pa) { int PID[MAX_PLAYER]; int Score[MAX_PLAYER]; BMPlayer *ps, *ps2; int i, j, t = 0, k; if (numPlayers > 0) { for (i = 0, j = 0, ps = playerStat; i < numPlayers; ps++, i++) { if (pa[i]) { PID[j] = ps->PID; Score[j] = 0; for (k = 0, ps2 = playerStat; k < numPlayers; ps2++, k++) { if ((ps->team == ps2->team) && (ps2->lives > 0)) { Score[j] = 1; } } t += Score[j]; j++; } } if (t == 0) { for (i = 0; i < j; i++) { Score[i] = 1; } } } else { j = -numPlayers; for (i = 0, ps = playerStat; i < j; ps++, i++) { PID[i] = ps->PID; Score[i] = ps->lives; } } X2C_SendGameStat (comm, j, PID, Score); } /* User_SendGameStat */ /* * end of file user.c */ xblast-2.10.4/user.h0000644000175000017500000000364210373126046013346 0ustar rhondaalfie/* * file user.h - communication interface for users * * $Id: user.h,v 1.10 2006/02/10 15:07:18 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * Added by Koen De Raedt for central support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_USER_H #define XBLAST_USER_H #define CENTRAL_FINISHED 0+(1<<10) #define CENTRAL_DISCONNECT 1+(1<<10) #define CENTRAL_READ_ERR 2+(1<<10) #define CENTRAL_WRITE_ERR 3+(1<<10) #define CENTRAL_COT_INVALID 4+(1<<10) /* * global prototypes */ /* connect/disconnect */ extern XBBool User_Connect (CFGCentralSetup *); extern void User_Disconnect (void); extern XBBool User_EventToCentral (const XBEventToCentral); /* get data */ extern XBBool User_Connected (void); extern int User_GetPID (void); extern int User_Received (void); extern void User_NoMorePlayers (void); /* receive data */ extern void User_ReceivePlayerPID (const char *data); extern void User_ReceivePlayerConfig (const char *data); /* queue data */ extern void User_SendDisconnect (void); extern void User_RequestUpdate (void); extern void User_SendRegisterPlayer (XBAtom); extern void User_SendUnregisterPlayer (XBAtom); extern void User_SendGameStat (int numPlayers, BMPlayer * playerStat, int *pa); #endif /* * end of file user.h */ xblast-2.10.4/util.c0000644000175000017500000004513210443244047013340 0ustar rhondaalfie/* * File util.c - file and directory i/o * * $Id: util.c,v 1.19 2006/06/12 10:55:35 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * local macros */ #define NUM_XBLAST_PATH 4 #ifndef XBLASTDIR #define XBLASTDIR NULL #endif /* * local variables */ static int initPath = 0; static char *pathList[NUM_XBLAST_PATH] = { NULL, NULL, ".", "/", }; /* shared buffer for complete filename */ static char zeile[1024]; /* * set paths for loading and saving */ static void InitPaths (void) { static char userPath[1024]; char tmp[1024]; char *home; /* set private xblast path */ home = getenv ("HOME"); if (NULL == home) { strcpy (userPath, "./user"); } else { sprintf (userPath, "%s/.xblast_tnt", home); } #if defined(__MINGW32__) || defined(WMS) mkdir (userPath); /* config subdirs */ sprintf (tmp, "%s/config", userPath); mkdir (tmp); sprintf (tmp, "%s/demo", userPath); mkdir (tmp); sprintf (tmp, "%s/central", userPath); mkdir (tmp); #else mkdir (userPath, 0755); /* config subdirs */ sprintf (tmp, "%s/config", userPath); mkdir (tmp, 0700); sprintf (tmp, "%s/demo", userPath); mkdir (tmp, 0700); sprintf (tmp, "%s/central", userPath); mkdir (tmp, 0700); #endif /* set user path as first path to load from */ pathList[0] = userPath; /* check environment for xblast search path */ pathList[1] = getenv ("XBLASTDIR"); /* --- */ initPath = 1; } /* InitPaths */ /* * find and open an xblast data file. */ FILE * FileOpen (const char *path, const char *name, const char *ext, const char *mode) { FILE *fp; int i; /* sanity check */ assert (NULL != path); assert (NULL != name); assert (NULL != ext); assert (NULL != mode); /* setup paths for loading */ if (!initPath) { InitPaths (); } /* try to open file, in directories given in path list */ for (i = 0; i < NUM_XBLAST_PATH; i++) { if (NULL != pathList[i]) { /* create full path to file */ sprintf (zeile, "%s/%s/%s.%s", pathList[i], path, name, ext); /* try to open it */ if (NULL != (fp = fopen (zeile, mode))) { /* file opened succesfully, use fclose to close it */ return fp; } } } /* sorry file opening failed */ fprintf (stderr, "failed to open file \"%s/%s.%s\".\n", path, name, ext); for (i = 0; i < NUM_XBLAST_PATH; i++) { if (NULL != pathList[i]) { fprintf(stderr,"%i : %s\n",i,pathList[i]); } } return NULL; } /* FileOpen */ /********************** * creating dir lists * **********************/ /* * add a file to list */ static void AddToFileList (XBDir ** pList, const char *name, size_t len, time_t mtime) { XBDir *ptr; XBDir *next; XBDir *prev = NULL; int cmp; char tmp[256]; assert (pList != NULL); assert (name != NULL); assert (len < 256 - 1); prev = NULL; strncpy (tmp, name, len); tmp[len] = 0; for (ptr = *pList; ptr != NULL; ptr = ptr->next) { cmp = strcmp (ptr->name, tmp); if (cmp == 0) { /* element already exists */ return; } else if (cmp > 0) { break; } prev = ptr; } /* create new element */ ptr = calloc (1, sizeof (XBDir)); assert (ptr != NULL); ptr->name = DupStringNum (name, len); ptr->mtime = mtime; /* insert element after prev */ if (prev == NULL) { next = *pList; *pList = ptr; } else { next = prev->next; prev->next = ptr; } ptr->next = next; } /* AddToFileList */ /* * create file list for dir and extension, recurse optional */ XBDir * CreateFileList (const char *path, const char *ext, XBBool rec) { int i; XBDir *list = NULL; XBDir *list1 = NULL; XBDir *ptr; #if defined(__MINGW32__) || defined(WMS) WIN32_FIND_DATA find_data; WIN32_FIND_DATA find_data1; HANDLE dp = NULL; HANDLE dp1 = NULL; size_t lenExt; size_t lenName; struct _stat buf; char *pFile; static char dirName[1024]; static char dirName1[1024]; static char fileName[1024]; static char fileName1[1024]; char dirToOpen[256]; XBBool testFile = XBTrue; #else DIR *dp; DIR *dp1; struct dirent *dirp; size_t lenExt; size_t lenName; struct stat buf; char *pFile; char dirName[1024]; char dirName1[1024]; char fileName[1024]; char fileName1[1024]; #endif /* sanity check */ assert (NULL != path); assert (NULL != ext); assert ('.' != ext[0]); /* set load paths if needed */ if (!initPath) { InitPaths (); } /* search all directories */ lenExt = strlen (ext); for (i = 0; i < NUM_XBLAST_PATH; i++) { if (NULL != pathList[i]) { Dbg_File ("trying path %s...\n", pathList[i]); /* create path to search */ strcpy (dirName, pathList[i]); strcat (dirName, "/"); strcat (dirName, path); /* prepare full path for file */ strcpy (fileName, dirName); strcat (fileName, "/"); pFile = fileName + strlen (fileName); /* open directory to read */ #if defined(__MINGW32__) || defined(WMS) /* windows specific */ strcpy (dirToOpen, dirName); strcat (dirToOpen, "/*"); /* try to open dir */ if (INVALID_HANDLE_VALUE == (dp = FindFirstFile (dirToOpen, &find_data))) { continue; } Dbg_File ("opening dir %s\n", dirName); while (testFile) { /* ignore hidden files */ if (find_data.cFileName[0] == '.') { testFile = FindNextFile (dp, &find_data); continue; } /* ignore files with wrong extension */ lenName = strlen (find_data.cFileName); if (lenName <= lenExt) { testFile = FindNextFile (dp, &find_data); continue; } /* check for directory */ if (0 != strcmp (find_data.cFileName + lenName - lenExt, ext)) { /* if recursive check if directory */ if (0 != rec && find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { sprintf (dirName1, "%s/%s/*", dirName, find_data.cFileName); /* try to open */ if (INVALID_HANDLE_VALUE != (dp1 = FindFirstFile (dirName1, &find_data1))) { /* cut the \/* */ dirName1[strlen (dirName1) - 2] = '\0'; /* create list */ list1 = CreateFileList (dirName1, ext, rec); if (list1 != NULL) { for (ptr = list1; NULL != ptr; ptr = ptr->next) { sprintf (fileName1, "%s/%s", find_data.cFileName, ptr->name); AddToFileList (&list, fileName1, strlen (fileName1), ptr->mtime); } DeleteFileList (list1); list1 = NULL; } testFile = FindNextFile (dp, &find_data); continue; } } testFile = FindNextFile (dp, &find_data); continue; } /* ignore files without modification time */ strcpy (pFile, find_data.cFileName); if (0 != _stat (fileName, &buf)) { testFile = FindNextFile (dp, &find_data); continue; } AddToFileList (&list, find_data.cFileName, lenName - lenExt - 1, buf.st_mtime); testFile = FindNextFile (dp, &find_data); } /* close directory */ FindClose (dp); #else /* try to open */ if (NULL == (dp = opendir (dirName))) { continue; } Dbg_File ("opening dir %s\n", dirName); /* read files */ while (NULL != (dirp = readdir (dp))) { /* ignroe hidden files */ if (dirp->d_name[0] == '.') { continue; } /* ignore files with wrong extension */ lenName = strlen (dirp->d_name); if (lenName <= lenExt) { continue; } /* check name for sanity */ if (0 != strcmp (dirp->d_name + lenName - lenExt, ext)) { /* if recursive check if directory */ if (0 != rec) { /* it might be a directory */ sprintf (dirName1, "%s/%s", dirName, dirp->d_name); if (NULL != (dp1 = opendir (dirName1))) { /* create a list of the dir / subdirs */ list1 = CreateFileList (dirName1, ext, rec); /* list not empty */ if (list1 != NULL) { /* save list in sub list */ for (ptr = list1; NULL != ptr; ptr = ptr->next) { /* list name is filename from the path GAME_DATADIR/level */ sprintf (fileName1, "%s/%s", dirp->d_name, ptr->name); /* add to main list */ AddToFileList (&list, fileName1, strlen (fileName1), ptr->mtime); } DeleteFileList (list1); list1 = NULL; } continue; } } continue; } /* ignore files without modification time */ strcpy (pFile, dirp->d_name); if (0 != stat (fileName, &buf)) { continue; } /* add the file */ AddToFileList (&list, dirp->d_name, lenName - lenExt - 1, buf.st_mtime); } /* close directory */ closedir (dp); #endif } } return list; } /* CreateFileList */ /* * delete a file list */ void DeleteFileList (XBDir * list) { XBDir *next; while (NULL != list) { next = list->next; /* delete data */ if (list->name != NULL) { free (list->name); } free (list); /* continue */ list = next; } } /* DeleteFileList */ /****************** * loading images * ******************/ /* * swaps bit order of pbm data to xbm format */ static void PbmSwapBits (unsigned char *pbm, int width, int height) { int nbytes; static XBBool convTableInit = XBFalse; static unsigned convTable[256]; if (!convTableInit) { unsigned i, j; unsigned *ptr; for (i = 0, ptr = convTable; i < 256; i++, ptr++) { *ptr = 0; for (j = 0; j < 8; j++) { if (i & (1 << j)) { *ptr |= (128 >> j); } } } convTableInit = XBTrue; } for (nbytes = (width * height + 7) / 8; nbytes > 0; nbytes--, pbm++) { *pbm = convTable[*pbm]; } } /* PbmSwapBits */ #ifdef MINI_XBLAST static void PbmShrink (unsigned char *pbm, int *width, int *height) { static XBBool mergeTableInit = XBFalse; static unsigned loMergeTable[256]; static unsigned hiMergeTable[256]; /* --- */ int x, y; int hHeight; int hWidth; unsigned char *dst; unsigned char *pFirst; unsigned char *pSecond; if (!mergeTableInit) { unsigned i, j; unsigned *hi; unsigned *lo; for (i = 0, hi = hiMergeTable, lo = loMergeTable; i < 256; i++, hi++, lo++) { *hi = 0; *lo = 0; for (j = 0; j < 8; j++) { if (i & (1 << j)) { *lo |= (1 << (j / 2)); } } *hi = *lo << 4; } mergeTableInit = XBTrue; } /* do the conversion */ assert (0 == *width % 8); hWidth = *width / 2; hHeight = *height / 2; dst = pbm; for (y = 0; y < hHeight; y++) { pFirst = pbm + 2 * y * (*width / 8); pSecond = pFirst + (*width / 8); for (x = 0; x < (hWidth / 8); x++) { dst[0] = (loMergeTable[pFirst[0]] | loMergeTable[pSecond[0]] | hiMergeTable[pFirst[1]] | hiMergeTable[pSecond[1]]); dst++; pFirst += 2; pSecond += 2; } if (0 != hWidth % 8) { dst[0] = (loMergeTable[pFirst[0]] | loMergeTable[pSecond[0]]); dst++; } } *height = hHeight; *width = hWidth; } /* PbmShrink */ #endif /* * public function read pbm file * load portable bitmap into memory */ unsigned char * ReadPbmFile (const char *path, const char *filename, int *width, int *height) { FILE *fp = NULL; unsigned char *pbm = NULL; size_t pbmSize; assert (width != NULL); assert (height != NULL); /* try to open file name */ if (NULL == (fp = FileOpen (path, filename, "pbm", "rb"))) { return NULL; } /* read header */ if (3 != fscanf (fp, "%s%d%d%*d%*c", zeile, width, height)) { fprintf (stderr, "Failed to read ppm header\n"); goto Error; } /* set size */ pbmSize = ((*width) * (*height) + 7) / 8; /* alloc data */ if (NULL == (pbm = malloc (pbmSize * sizeof (char)))) { goto Error; } /* read data */ if (pbmSize != fread (pbm, sizeof (char), pbmSize, fp)) { goto Error; } /* swap bit order */ PbmSwapBits (pbm, *width, *height); #ifdef MINI_XBLAST PbmShrink (pbm, width, height); #endif /* close file */ fclose (fp); return pbm; /* error handling */ Error: if (fp != NULL) { fclose (fp); } if (pbm != NULL) { free (pbm); } return NULL; } /* ReadPbmFile */ #ifdef MINI_XBLAST /* * shrink ppm data to half size */ static void ShrinkPpm (unsigned char *ppm, int *width, int *height) { int x, y; int hWidth; int hHeight; unsigned r, g, b; unsigned char *pFirst; unsigned char *pSecond; unsigned char *dst; assert (NULL != width); assert (NULL != height); hWidth = *width / 2; hHeight = *height / 2; dst = ppm; for (y = 0; y < hHeight; y++) { pFirst = ppm + 3 * 2 * y * (*width); pSecond = pFirst + 3 * (*width); for (x = 0; x < hWidth; x++) { /* read data */ r = 3u + (unsigned)pFirst[0] + (unsigned)pFirst[3] + (unsigned)pSecond[0] + (unsigned)pSecond[3]; g = 3u + (unsigned)pFirst[1] + (unsigned)pFirst[4] + (unsigned)pSecond[1] + (unsigned)pSecond[4]; b = 3u + (unsigned)pFirst[2] + (unsigned)pFirst[5] + (unsigned)pSecond[2] + (unsigned)pSecond[5]; /* store data */ dst[0] = (r >> 2); dst[1] = (g >> 2); dst[2] = (b >> 2); /* next step */ pFirst += 6; pSecond += 6; dst += 3; } } *width = hWidth; *height = hHeight; } /* ShrinkPpm */ #endif /* * public function read pbm file * load portable bitmap into memory */ unsigned char * ReadPpmFile (const char *path, const char *filename, int *width, int *height) { FILE *fp = NULL; unsigned char *ppm = NULL; size_t nPixel; assert (width != NULL); assert (height != NULL); /* try to open for reading */ if (NULL == (fp = FileOpen (path, filename, "ppm", "rb"))) { goto Error; } /* read header */ if (3 != fscanf (fp, "%s%d%d%*d%*c", zeile, width, height)) { fprintf (stderr, "Failed to read ppm header\n"); goto Error; } nPixel = 3 * (*width) * (*height); /* alloc data */ if (NULL == (ppm = malloc (nPixel * sizeof (char)))) { goto Error; } /* read data */ if (nPixel != fread (ppm, sizeof (char), nPixel, fp)) { goto Error; } /* close file */ fclose (fp); #ifdef MINI_XBLAST /* convert to half size if needed */ ShrinkPpm (ppm, width, height); #endif /* that's all */ return ppm; /* error handling */ Error: if (fp != NULL) { fclose (fp); } if (ppm != NULL) { free (ppm); } return NULL; } /* ReadPpmFile */ #ifdef MINI_XBLAST /* * shrink epm to half size */ static void ShrinkEpm (unsigned char *epm, int *width, int *height, int depth) { int x, y; int hWidth; int hHeight; unsigned v; unsigned char *pFirst; unsigned char *pSecond; unsigned char *dst; assert (NULL != width); assert (NULL != height); hWidth = *width / 2; hHeight = *height / 2; dst = epm; for (y = 0; y < depth * hHeight; y++) { pFirst = epm + 2 * y * (*width); pSecond = pFirst + (*width); for (x = 0; x < hWidth; x++) { /* read data */ v = 3u + (unsigned)pFirst[0] + (unsigned)pFirst[1] + (unsigned)pSecond[0] + (unsigned)pSecond[1]; /* store data */ dst[0] = (v >> 2); /* next step */ pFirst += 2; pSecond += 2; dst += 1; } } *width = hWidth; *height = hHeight; } /* ShrinkEpm */ #endif /* * load Extended Pixmap (.epm) into memory */ unsigned char * ReadEpmFile (const char *path, const char *filename, int *width, int *height, int *depth) { FILE *fp = NULL; unsigned char *epm = NULL; unsigned char *buf = NULL; size_t nPixel; assert (width != NULL); assert (height != NULL); assert (depth != NULL); /* try to open for reading */ if (NULL == (fp = FileOpen (path, filename, "epm", "rb"))) { fprintf (stderr, "failed to open file \"%s/%s.%s\".\n", path, filename, "epm"); return NULL; } /* read header */ if (4 != fscanf (fp, "%s%d%d%*d%d%*c", zeile, width, height, depth)) { fprintf (stderr, "Failed to read epm header\n"); goto Error; } /* calc number of pixels */ nPixel = (*depth) * (*width) * (*height); /* alloc data */ if (NULL == (epm = malloc (nPixel * sizeof (char)))) { goto Error; } /* check magic */ if (0 == strcmp (zeile, "PX")) { /* uncompressed data */ /* read data */ if (nPixel != fread (epm, sizeof (char), nPixel, fp)) { goto Error; } } else if (0 == strcmp (zeile, "PZ")) { /* compressed data */ int i, j, n_bytes, zero_count; /* alloc input buffer */ if (NULL == (buf = malloc (2 * nPixel * sizeof (char)))) { goto Error; } if (0 == (n_bytes = fread (buf, sizeof (char), 2 * nPixel, fp))) { goto Error; } for (i = 0, j = 0; i < n_bytes; i++) { if (buf[i]) { epm[j] = buf[i]; j++; } else { zero_count = 0; do { i++; zero_count += buf[i]; } while (buf[i] == 255); memset (epm + j, 0, zero_count); j += zero_count; } } free (buf); } else { /* wrong magic word */ fprintf (stderr, "Wrong magic word \"%s\".\n", zeile); goto Error; } #ifdef MINI_XBLAST ShrinkEpm (epm, width, height, *depth); #endif /* close file */ fclose (fp); return epm; /* Error handling */ Error: if (fp != NULL) { fclose (fp); } if (epm != NULL) { free (epm); } if (buf != NULL) { free (buf); } return NULL; } /* ReadEpmFile */ /* * load raw sound file into memory */ char * ReadRawFile (const char *path, const char *filename, size_t * len) { FILE *fp = NULL; char *buf = NULL; struct stat statBuf; size_t toRead; size_t lastRead; char *ptr; size_t i; /* sanity check */ assert (NULL != path); assert (NULL != filename); assert (NULL != len); /* open file for reading */ if (NULL == (fp = FileOpen (path, filename, "raw", "rb"))) { fprintf (stderr, "failed to open file \"%s/%s.%s\".\n", path, filename, "raw"); return NULL; } /* determine length */ if (-1 == fstat (fileno (fp), &statBuf)) { fprintf (stderr, "failed to get length of file \"%s/%s.%s\".\n", path, filename, "raw"); goto Error; } *len = statBuf.st_size; #ifdef DEBUG fprintf (stderr, "length of file \"%s/%s.%s\" is %lu\n", path, filename, "raw", (unsigned long)*len); #endif /* allocate buffer */ if (NULL == (buf = malloc (*len))) { fprintf (stderr, "failed to alloc buffer for file \"%s/%s.%s\".\n", path, filename, "raw"); goto Error; } /* read data */ toRead = *len; ptr = buf; while (toRead > 0) { if (0 >= (lastRead = fread (ptr, 1, toRead, fp))) { fprintf (stderr, "error while reading file \"%s/%s.%s\".\n", path, filename, "raw"); goto Error; } toRead -= lastRead; ptr += lastRead; } fclose (fp); /* convert data from 0..255 to -128..127 */ for (i = 0; i < *len; i++) { buf[i] += 0x80; } /* that's all */ return buf; Error: if (NULL != buf) { free (buf); } if (NULL != fp) { fclose (fp); } return NULL; } /* ReadRawFile */ /* * end of file util.h */ xblast-2.10.4/util.h0000644000175000017500000000343610372731125013345 0ustar rhondaalfie/* * file util.h - file and directory i/o * * $Id: util.h,v 1.8 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UTIL_H #define _UTIL_H /* * type definitions */ /* structure with directory entries */ typedef struct _xb_dir { char *name; time_t mtime; struct _xb_dir *next; } XBDir; /* * function prototypes */ /* loading config file */ extern FILE *FileOpen (const char *path, const char *name, const char *ext, const char *mode); /* create/destroy dir lists */ extern XBDir *CreateFileList (const char *path, const char *ext, XBBool rec); extern void DeleteFileList (XBDir * list); /* loading images */ extern unsigned char *ReadPbmFile (const char *path, const char *file, int *width, int *height); extern unsigned char *ReadPpmFile (const char *path, const char *file, int *width, int *height); extern unsigned char *ReadEpmFile (const char *path, const char *file, int *width, int *height, int *depth); extern char *ReadRawFile (const char *path, const char *filename, size_t * len); #endif /* * end of file util.h */ xblast-2.10.4/version.c0000755000175000017500000001264210373126045014052 0ustar rhondaalfie/* * file version.c - tools for version data * * $Id: version.c,v 1.13 2006/02/10 15:07:17 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* initial joint version */ static XBVersion jointVersion = { VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, }; /* constant versions */ const XBVersion Ver_Local = { VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH }; const XBVersion Ver_None = { 0, 0, 0 }; const XBVersion Ver_2_10_1 = { 2, 10, 1 }; const XBVersion Ver_2_10_2 = { 2, 10, 2 }; /* version table for hosts */ static XBVersion hostVersion[MAX_HOSTS]; /************************************* * general tools for version structs * *************************************/ /* * return temporary string for a version */ char * Version_ToString (const XBVersion * ver) { static char tmp[20]; sprintf (tmp, "V%i.%i.%i", ver->major, ver->minor, ver->patch); return tmp; } /* Version_ToString */ /* * clear a version struct */ void Version_Clear (XBVersion * ver) { assert (NULL != ver); memcpy (ver, &Ver_None, sizeof (XBVersion)); } /* Version_Clear */ /* * check if version is set */ XBBool Version_isDefined (const XBVersion * ver) { assert (NULL != ver); return (memcmp (ver, &Ver_None, sizeof (XBVersion)) != 0); } /* Version_isDefined */ /* * compare two versions, return sign of v1-v2 */ int Version_Compare (const XBVersion * v1, const XBVersion * v2) { assert (NULL != v1); assert (NULL != v2); if (v1->major > v2->major) { return (1); } else if (v1->major < v2->major) { return (-1); } if (v1->minor > v2->minor) { return (1); } else if (v1->minor < v2->minor) { return (-1); } if (v1->patch > v2->patch) { return (1); } else if (v1->patch < v2->patch) { return (-1); } return (0); } /* Version_Compare */ /****************************** * getting local data version * ******************************/ /* * return local version data as XBVersion */ void Version_Get (XBVerType type, XBVersion * ver) { assert (NULL != ver); switch (type) { case VERSION_JOINT: memcpy (ver, &jointVersion, sizeof (XBVersion)); return; default: assert (type < MAX_HOSTS); memcpy (ver, hostVersion + type, sizeof (XBVersion)); return; } } /* Version_Get */ /* * check if joint version is at least given version */ XBBool Version_AtLeast (XBVerType type, const XBVersion * ver) { assert (NULL != ver); switch (type) { case VERSION_JOINT: return (Version_Compare (&jointVersion, ver) >= 0); default: assert (type < MAX_HOSTS); return (Version_Compare (hostVersion + type, ver) >= 0); } } /* Version_AtLeast */ /*************************** * modifying host version * ***************************/ /* * reset host versions */ void Version_Reset (void) { unsigned char id; for (id = 0; id < MAX_HOSTS; id++) { Version_Clear (hostVersion + id); } Dbg_Version ("Resetting host version\n"); jointVersion = Ver_Local; } /* Version_Reset */ /* * set a host version and modify to joint version, return change */ XBBool Version_Join (unsigned char id, const XBVersion * ver) { assert (NULL != ver); assert (id < MAX_HOSTS); if (Version_isDefined (ver)) { Dbg_Version ("Current joint version %s\n", Version_ToString (&jointVersion)); Dbg_Version ("Joining version %s for host #%u\n", Version_ToString (ver), id); memcpy (hostVersion + id, ver, sizeof (XBVersion)); if (Version_Compare (ver, &jointVersion) < 0) { jointVersion = *ver; Dbg_Version ("Updating joint version\n"); return XBTrue; } } else { Dbg_Version ("Ignoring undefined version for host #%u\n", id); } return XBFalse; } /* Version_Join */ /* * remove a single host version, return change */ XBBool Version_Remove (unsigned char id) { unsigned char h; assert (id < MAX_HOSTS); if (Version_isDefined (hostVersion + id)) { Dbg_Version ("Current joint version %s\n", Version_ToString (&jointVersion)); /* first calculate joint version without the host version to be removed */ memcpy (&jointVersion, &Ver_Local, sizeof (XBVersion)); for (h = 0; h < MAX_HOSTS; h++) { if (h != id && Version_isDefined (hostVersion + h) && Version_Compare (hostVersion + h, &jointVersion) < 0) { memcpy (&jointVersion, hostVersion + h, sizeof (XBVersion)); } } /* now compare with version to be removed, then clear */ if (Version_Compare (&jointVersion, hostVersion + id) > 0) { Dbg_Version ("removing version for host #%u, joint version update to %s", id, Version_ToString (&jointVersion)); Version_Clear (hostVersion + id); return XBTrue; } else { Dbg_Version ("removing version for host #%u\n", id); Version_Clear (hostVersion + id); } } return XBFalse; } /* Version_Remove */ /* * end of file com.c */ xblast-2.10.4/version.h0000644000175000017500000000432710444626004014054 0ustar rhondaalfie/* * file version.h - tools for version data * * $Id: version.h,v 1.27 2006/06/16 22:09:08 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef XBLAST_VERSION_H #define XBLAST_VERSION_H /* * global macros */ #define VERSION_STRING "2.10.4 (Central,epfl,Sky)" #define VERSION_MAJOR 2 #define VERSION_MINOR 10 #define VERSION_PATCH 4 #define COPYRIGHT_YEAR "1993-2006" /* version struct */ typedef struct { int major; int minor; int patch; } XBVersion; /* version types */ typedef unsigned char XBVerType; #define VERSION_JOINT 0xFF /* constant version strings, please document incompatibility issues here */ extern const XBVersion Ver_None; extern const XBVersion Ver_Local; extern const XBVersion Ver_2_10_1; /* slowMotionBurst key in map section added */ extern const XBVersion Ver_2_10_2; /* XBTS_Out introduced, earlier versions can't handle it and assert */ /* bug fix for swapcolor, earlier versions might crash (SMPF) */ /* general tools */ extern char *Version_ToString (const XBVersion *); extern void Version_Clear (XBVersion *); extern XBBool Version_isDefined (const XBVersion *); extern int Version_Compare (const XBVersion * v1, const XBVersion * v2); /* getting local data */ extern void Version_Get (XBVerType, XBVersion *); extern XBBool Version_AtLeast (XBVerType, const XBVersion *); /* modifying host versions */ extern void Version_Reset (void); extern XBBool Version_Join (unsigned char, const XBVersion *); extern XBBool Version_Remove (unsigned char); #endif /* * end of file version.h */ xblast-2.10.4/w32_atom.c0000644000175000017500000000541010376071615014015 0ustar rhondaalfie/* * Datei w32_atom.c - atoms for database searches * * $Id: w32_atom.c,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "gui.h" #include "w32_common.h" /* * local constants */ #define ATOM_STRING_MAX 256 #define NUM_ATOMS 768 #define NUM_STATIC 8 /* * setup local atoms table */ XBBool GUI_InitAtoms (void) { InitAtomTable (NUM_ATOMS); return XBTrue; } /* InitAtoms */ /* * convert a string to an atom */ XBAtom GUI_FormatToAtom (const char *fmt, ...) { XBAtom atom; char string[ATOM_STRING_MAX]; va_list argList; #ifdef DEBUG_ATOM static unsigned atomCount = 0; #endif assert (fmt != NULL); /* format string */ va_start (argList, fmt); vsprintf (string, fmt, argList); va_end (argList); #ifdef DEBUG_ATOM if (0 == FindAtom (string)) { atomCount++; if ((atomCount & 0xF) == 0) { fprintf (stderr, "atomCount=%u\n", atomCount); } } #endif atom = AddAtom (string); return atom; } /* GUI_StringToAtom */ /* * convert a string to an atom */ XBAtom GUI_StringToAtom (const char *string) { #ifdef DEBUG_ATOM return GUI_FormatToAtom ("%s", string); #else XBAtom atom; assert (string != NULL); atom = AddAtom (string); return atom; #endif } /* GUI_StringToAtom */ /* * convert integer to atom */ XBAtom GUI_IntToAtom (int value) { return GUI_FormatToAtom ("%d", value); } /* GUI_IntToAtom */ /* * return string to an atom (transient) */ const char * GUI_AtomToString (XBAtom atom) { static int i = 0; static char string[NUM_STATIC][ATOM_STRING_MAX]; i++; if (i >= NUM_STATIC) { i = 0; } if (0 == GetAtomName ((unsigned short)atom, string[i], sizeof (string[i]))) { return NULL; } return string[i]; } /* GUI_AtomToString */ /* * convert atom int or -1 */ int GUI_AtomToInt (XBAtom atom) { const char *s; int value; if (NULL == (s = GUI_AtomToString (atom))) { return -1; } if (1 != sscanf (s, "%d", &value)) { return -1; } return value; } /* GUI_AtomToInt */ /* * end of file w32_atom.c */ xblast-2.10.4/w32_color.h0000644000175000017500000000217410051114303014162 0ustar rhondaalfie/* * w32_color.h - convert xblast colormto win32 color * * $Id: w32_color.h,v 1.2 2004/05/14 10:00:35 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_COLOR_H #define _W32_COLOR_H #include "w32_common.h" #include "color.h" /* * global macros */ #define COLOR_TO_COLORREF(c) (RGB (255*GET_RED(c)/31, 255*GET_GREEN(c)/31, 255*GET_BLUE(c)/31) ) #endif /* * end of file w32_color.h */ xblast-2.10.4/w32_common.c0000644000175000017500000000213310372705223014337 0ustar rhondaalfie/* * file w32_common.c - global variables for Win32 engine * * $Id: w32_common.c,v 1.3 2006/02/09 18:31:47 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "w32_common.h" /* * global variables */ HANDLE instance = NULL; HWND window = NULL; HBITMAP pix = NULL; HPALETTE palette = NULL; const char *xblastClass = "XBlast"; /* * end of file w32_common.c */ xblast-2.10.4/w32_common.h0000644000175000017500000000230510372705223014345 0ustar rhondaalfie/* * file w32_common.h - global variables for Win32 engine * * $Id: w32_common.h,v 1.3 2006/02/09 18:31:47 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_W32_COMMON_H #define XBLAST_W32_COMMON_H #include /* * global constants */ #define NUM_FONTS 3 /* * global variables */ extern HANDLE instance; extern HWND window; extern HBITMAP pix; extern HPALETTE palette; extern const char *xblastClass; #endif /* * end of file w32_common.h */ xblast-2.10.4/w32_config.c0000644000175000017500000000603210376071615014323 0ustar rhondaalfie/* * file w32_config.h - config data for win32 graphics engine * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * $Id: w32_config.c,v 1.5 2006/02/19 13:33:01 lodott Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_config.h" #include "gui.h" #include "atom.h" #include "geom.h" #include "ini_file.h" /* * local variables */ static DBRoot *dbGui = NULL; /* default geometry data */ static const RECT defaultGeometry = { 0, 0, PIXW, PIXH + SCOREH, }; /* * load config */ void GUI_LoadConfig (void) { /* create empty database for gui data */ dbGui = DB_Create (DT_Config, atomWin32); assert (dbGui != NULL); Dbg_Config ("loading w32 gui data\n"); if (DB_Load (dbGui)) { return; } Dbg_Config ("failed to load w32 gui data\n"); /* TODO: set default values */ /* and save it */ DB_Store (dbGui); } /* GUI_LoadConfig */ /* * save config if changed */ void GUI_SaveConfig (void) { assert (dbGui != NULL); if (DB_Changed (dbGui)) { Dbg_Config ("saving w32 gui data\n"); DB_Store (dbGui); } } /* GUI_SaveConfig */ /* * finish config */ void GUI_FinishConfig (void) { assert (dbGui != NULL); DB_Delete (dbGui); dbGui = NULL; Dbg_Config ("w32 gui data cleared\n"); } /* GUI_FinishConfig */ /* * get window position */ XBBool RetrieveWindowRect (RECT * rect) { const DBSection *section; assert (NULL != rect); assert (dbGui != NULL); /* set defaults */ *rect = defaultGeometry; /* find section */ if (NULL == (section = DB_GetSection (dbGui, atomGeometry))) { return XBFalse; } (void)DB_GetEntryInt (section, atomLeft, (int *)&rect->left); (void)DB_GetEntryInt (section, atomRight, (int *)&rect->right); (void)DB_GetEntryInt (section, atomTop, (int *)&rect->top); (void)DB_GetEntryInt (section, atomBottom, (int *)&rect->bottom); return XBTrue; } /* RetreiveWindowGeometry */ /* * store window position */ void StoreWindowRect (const RECT * rect) { DBSection *section; assert (NULL != rect); assert (dbGui != NULL); /* create section */ section = DB_CreateSection (dbGui, atomGeometry); assert (NULL != section); DB_CreateEntryInt (section, atomLeft, rect->left); DB_CreateEntryInt (section, atomRight, rect->right); DB_CreateEntryInt (section, atomTop, rect->top); DB_CreateEntryInt (section, atomBottom, rect->bottom); } /* StoreWindowRect */ /* * end of file w32_config.h */ xblast-2.10.4/w32_config.h0000644000175000017500000000216710372731125014330 0ustar rhondaalfie/* * file w32_config.h - config data for win32 graphics engine * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * $Id: w32_config.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_CONFIG_H #define _W32_CONFIG_H #include "w32_common.h" /* * global prototypes */ extern XBBool RetrieveWindowRect (RECT * rect); extern void StoreWindowRect (const RECT * cfg); #endif /* * end fo file w32_config.h */ xblast-2.10.4/w32_event.c0000644000175000017500000004312410377700543014202 0ustar rhondaalfie/* * file w32_event.c - event (message) handling for windows * * $Id: w32_event.c,v 1.29 2006/02/24 21:57:55 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_event.h" #include "gui.h" #include "SDL_vkeys.h" #include "w32_pixmap.h" #include "w32_keysym.h" #include "w32_joystick.h" #include "w32_socket.h" #include "geom.h" #include "cfg_control.h" #include "timeval.h" #include "chat.h" /* * local constants */ #define TIMER_POLL 1 /* * local types */ typedef struct { UINT key; XBEventCode code; int value; } GameKeyEvent; typedef struct _game_key_list { GameKeyEvent gke; struct _game_key_list *next; } GameKeyList; typedef struct _poll_func_list { XBPollFunction func; struct _poll_func_list *next; } PollFuncList; /* * local variables */ /* MM-Timer */ static UINT idTimer = 0; static TIMECAPS timeCaps; /* Polling */ static UINT pollTimer = 0; static PollFuncList *pollList = NULL; /* keyboard mode */ static XBKeyboardMode keyboardMode = KB_NONE; /* mouse mode */ static XBBool mouseEnable = XBTrue; /* keyboard lookup tables */ static int numKeyMenu = 0; static int numKeyPress = 0; static int numKeyRelease = 0; static int numKeyChat = 0; static GameKeyEvent *keyMenuTable = NULL; static GameKeyEvent *keyPressTable = NULL; static GameKeyEvent *keyReleaseTable = NULL; static GameKeyEvent *keyChatTable = NULL; /* clean exit */ static XBQuitFunction quitFunc = NULL; /* * compare two GameKeyCode, for sorting */ static int CompareKeyCode (const void *a, const void *b) { return (*(UINT *) a) - (*(UINT *) b); } /* CompareKeyCode */ /* * create keyboard lookup table from init table */ static GameKeyEvent * CreateGameKeyTable (const CFGKeyTable * init, int *nelem) { const CFGKeyTable *ptr; GameKeyList *list = NULL; GameKeyList *elem; GameKeyEvent *table = NULL; UINT virtualKey; int i; assert (nelem != NULL); *nelem = 0; /* create list with with all keymappings (part one) */ for (ptr = init; ptr->keysym != NULL; ptr++) { /* convert keysymbol name to keycode */ virtualKey = StringToVirtualKey (ptr->keysym); if (0 == virtualKey) { Dbg_Out ("unknown keysymbol %s.\n", ptr->keysym); continue; } /* create new list element */ elem = calloc (1, sizeof (GameKeyList)); assert (elem != NULL); elem->gke.key = virtualKey; elem->gke.code = ptr->eventCode; elem->gke.value = ptr->eventData; /* put it into list */ elem->next = list; list = elem; /* increment counter */ *nelem += 1; } /* create lookup table */ table = malloc (*nelem * sizeof (GameKeyEvent)); assert (table != NULL); /* store list in array and delete it */ i = 0; while (list != NULL) { /* store next one */ elem = list->next; /* copy data */ assert (i < *nelem); memcpy (table + i, &list->gke, sizeof (GameKeyEvent)); i++; /* next one */ free (list); list = elem; } /* now sort it with quicksort */ qsort (table, *nelem, sizeof (GameKeyEvent), CompareKeyCode); /* now check for double entries */ for (i = 1; i < *nelem; i++) { if (table[i - 1].key == table[i].key) { GUI_ErrorMessage ("Multiple bindings for key \"%s\".", GUI_AtomToString (VirtualKeyToAtom (table[i].key))); break; } } /* that's all */ return table; } /* CreateGameKeyTable */ /* * create keytables */ void GUI_UpdateKeyTables (void) { /* game key presses */ if (NULL != keyPressTable) { free (keyPressTable); } keyPressTable = CreateGameKeyTable (GetGameKeyPressTable (), &numKeyPress); assert (keyPressTable != NULL); /* game key releases */ if (NULL != keyReleaseTable) { free (keyReleaseTable); } keyReleaseTable = CreateGameKeyTable (GetGameKeyReleaseTable (), &numKeyRelease); assert (keyReleaseTable != NULL); /* menu keys */ if (NULL != keyMenuTable) { free (keyMenuTable); } keyMenuTable = CreateGameKeyTable (GetMenuKeyTable (), &numKeyMenu); assert (keyMenuTable != NULL); /* chat keys */ if (NULL != keyChatTable) { free (keyChatTable); } keyChatTable = CreateGameKeyTable (GetChatKeyTable (), &numKeyChat); assert (keyChatTable != NULL); } /* GUI_UpdateKeyTables */ /* * init timer */ static XBBool InitTimer (void) { if (0 != timeGetDevCaps (&timeCaps, sizeof (timeCaps))) { return XBFalse; } if (0 != timeBeginPeriod (15)) { return XBFalse; } Dbg_Out ("timer from %u to %u\n", timeCaps.wPeriodMin, timeCaps.wPeriodMax); return XBTrue; } /* InitTimer */ /* * callback */ static void PASCAL _export TimerProc (UINT idEvent, UINT dummy, DWORD userData, DWORD dummy1, DWORD dummy2) { PostMessage (window, userData, 0, 0); } /* TimerProc */ /* * finish timer */ static void FinishTimer () { timeEndPeriod (15); } /* FinishTimer */ /* * init event data: key tables and timer */ XBBool InitEvent (void) { /* initialize keyboard mapping */ GUI_UpdateKeyTables (); /* init timers */ (void)InitTimer (); /* that's all */ return XBTrue; } /* InitEvent */ /* * free all key tables in use */ void FinishEvent (void) { if (NULL != keyMenuTable) { free (keyMenuTable); keyMenuTable = NULL; numKeyMenu = 0; } if (NULL != keyPressTable) { free (keyPressTable); keyPressTable = NULL; numKeyPress = 0; } if (NULL != keyReleaseTable) { free (keyReleaseTable); keyReleaseTable = NULL; numKeyRelease = 0; } if (NULL != keyChatTable) { free (keyChatTable); keyChatTable = NULL; } FinishTimer (); } /* FinishEvent */ /* * add poll function to the gui event loop */ void GUI_AddPollFunction (XBPollFunction func) { PollFuncList *ptr; if (0 == pollTimer) { pollTimer = SetTimer (window, TIMER_POLL, 1000, NULL); assert (0 != pollTimer); } assert (func != NULL); ptr = calloc (1, sizeof (*ptr)); assert (ptr != NULL); ptr->func = func; ptr->next = pollList; pollList = ptr; } /* GUI_AddPollFunction */ /* * subtract poll function */ void GUI_SubtractPollFunction (XBPollFunction func) { assert (pollList != NULL); if (pollList->func == func) { PollFuncList *save = pollList; pollList = pollList->next; free (save); if (pollTimer && !pollList) { KillTimer (window, pollTimer); pollTimer = 0; } } else { PollFuncList *ptr; for (ptr = pollList; ptr->next != NULL; ptr = ptr->next) { if (ptr->next->func == func) { PollFuncList *save = ptr->next; ptr->next = save->next; free (save); } } } } /* GUI_SubtractPollFunction */ /* * set timer for event */ void GUI_SetTimer (long msec, XBBool periodic) { Dbg_Out ("Timer = %ld msec\n", msec); if (0 != idTimer) { timeKillEvent (idTimer); idTimer = 0; } if (0 < msec) { if (periodic) { idTimer = timeSetEvent (msec, msec / 2, TimerProc, MSG_XBLAST_TIMER, TIME_PERIODIC); } else { (void)timeSetEvent (msec, msec / 2, TimerProc, MSG_XBLAST_TIMER, TIME_ONESHOT); } } } /* GUI_SetTimer */ /* * set keyboard mode, determines which events are generated by keypresses */ void GUI_SetKeyboardMode (XBKeyboardMode _mode) { keyboardMode = _mode; } /* GUI_SetKeyboardMode */ /* * set Mouse mode, determines if mouse events are generated */ void GUI_SetMouseMode (XBBool _enable) { mouseEnable = _enable; } /* GUI_SetMouseMode */ /* * Show/Hide cursor */ void GUI_ShowCursor(XBBool enable) { /* TODO: show or hide the mouse cursor */ } /* * lookup a key table, return success and match */ static XBBool LookupKeyTable (WPARAM wParam, int numKey, const GameKeyEvent * keyTable, GameKeyEvent * key) { GameKeyEvent *tmp; assert (NULL != key); tmp = bsearch (&wParam, keyTable, numKey, sizeof (GameKeyEvent), CompareKeyCode); if (NULL != tmp) { memcpy (key, tmp, sizeof (GameKeyEvent)); return XBTrue; } return XBFalse; } /* LookupKeyTable */ /* * try to generate chat key event */ static XBBool HandleChatKey (UINT message, WPARAM wParam, LPARAM lParam) { GameKeyEvent key; /* only try to match if chat is active at all */ if (Chat_isListening ()) { if (LookupKeyTable (wParam, numKeyMenu, keyChatTable, &key)) { /* check input activity for escape key */ if ((key.value == XBCE_ESCAPE || key.value == XBCE_BACK || key.value == XBCE_ENTER) && Chat_GetCurrentCode () == XBE_NONE) { return XBFalse; } QueueEventValue (key.code, key.value + 1000); return XBTrue; } /* if chat input is active, expect character event */ if (Chat_GetCurrentCode () != XBE_NONE) { return XBTrue; } } return XBFalse; } /* HandleChatKey */ /* * try to generate menu key event, but first try chat key event */ static void HandleMenuKey (UINT message, WPARAM wParam, LPARAM lParam) { GameKeyEvent key; /* first try to match chat key */ if (!HandleChatKey (message, wParam, lParam)) { /* match menu key otherwise */ if (LookupKeyTable (wParam, numKeyMenu, keyMenuTable, &key)) { QueueEventValue (key.code, key.value); return; } } } /* HandleMenuKey */ /* * try to generate game key event; for keypresses, first try chat event */ static void HandleXBlastKey (UINT message, WPARAM wParam, LPARAM lParam) { GameKeyEvent key; GameKeyEvent *table = keyReleaseTable; int num = numKeyRelease; if (message == WM_KEYDOWN) { /* first try matching chat keys */ if (HandleChatKey (message, wParam, lParam)) { return; } table = keyPressTable; num = numKeyPress; } /* no chat key, match xblast key */ if (LookupKeyTable (wParam, num, table, &key)) { QueueEventValue (key.code, key.value); return; } } /* HandleXBlastKey */ /* * try to generate ascii key event */ static void HandleAsciiKey (UINT message, WPARAM wParam, LPARAM lParam) { char key = wParam; static int capslock = 0; /* generate only if requested or chat input is active */ if (keyboardMode != KB_ASCII && Chat_GetCurrentCode () == XBE_NONE) { return; } /* generate ascii event if printable */ if (isprint (key)) { QueueEventValue (XBE_ASCII, key); } else { /* generate control event */ switch (key) { /* not needed yet, for future features */ case VK_CAPITAL: capslock = !capslock; break; /* standard keys */ case VK_BACK: QueueEventValue (XBE_CTRL, XBCK_BACKSPACE); break; case VK_ESCAPE: QueueEventValue (XBE_CTRL, XBCK_ESCAPE); break; case VK_RETURN: QueueEventValue (XBE_CTRL, XBCK_RETURN); break; case VK_INSERT: if (lParam != 3473409) { QueueEventValue (XBE_CTRL, XBCK_INSERT); } else { QueueEventValue (XBE_ASCII, key); } break; case VK_END: if (lParam == 21954561) { QueueEventValue (XBE_CTRL, XBCK_END); } else { QueueEventValue (XBE_ASCII, key); } break; case VK_DELETE: if (lParam == 22216705) { QueueEventValue (XBE_CTRL, XBCK_DELETE); } else { QueueEventValue (XBE_ASCII, key); } break; default: break; } } } /* HandleAsciiKey */ /* * tyr to generate keysmbol event */ static XBBool HandleKeysymKey (UINT message, WPARAM wParam, LPARAM lParam) { if (VK_ESCAPE == wParam) { QueueEventAtom (XBE_KEYSYM, ATOM_INVALID); return XBTrue; } else { XBAtom atom = VirtualKeyToAtom (wParam); if (ATOM_INVALID != atom) { QueueEventAtom (XBE_KEYSYM, atom); return XBTrue; } } return XBFalse; } /* HandleKeysymKey */ /* * call poll functions */ static void HandlePoll (void) { PollFuncList *ptr; struct timeval tv; int i = 0; gettimeofday (&tv, NULL); for (i = 0, ptr = pollList; ptr != NULL && pollList != NULL; ptr = ptr->next, i++) { assert (NULL != ptr->func); (*ptr->func) (&tv); } } /* HandlePoll */ /* * handle query for new palette */ static BOOL HandleNewPalette (void) { BOOL result = FALSE; /* we need the device context */ HDC hdc = GetWindowDC (window); if (NULL == hdc) { return FALSE; } /* first call , we might need to create our own palette first */ if (NULL == palette) { if (RC_PALETTE & GetDeviceCaps (hdc, RASTERCAPS)) { Dbg_Out ("create palette\n"); palette = CreateHalftonePalette (hdc); } } if (NULL != palette) { HPALETTE oldPalette = SelectPalette (hdc, palette, FALSE); Dbg_Out ("realize palette\n"); if (RealizePalette (hdc) > 0) { result = TRUE; } (void)SelectPalette (hdc, oldPalette, FALSE); } ReleaseDC (window, hdc); if (result) { Dbg_Out ("update window\n"); InvalidateRect (window, NULL, FALSE); } return result; } /* HandleNewPalette */ /* * window event routine */ long PASCAL _export WindowProc (HWND window, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { /* redraw (part of) window */ case WM_PAINT: PaintPixmap (window); return 0; case WM_QUERYNEWPALETTE: return HandleNewPalette (); /* timer event */ case WM_TIMER: HandlePoll (); return 0; /* mm timer */ case MSG_XBLAST_TIMER: QueueEventVoid (XBE_TIMER); return 0; /* network event */ case MSG_XBLAST_SELECT: HandleSelect (wParam, lParam); return 0; break; /* handle keypress events */ case WM_SYSKEYDOWN: break; case WM_KEYDOWN: switch (keyboardMode) { case KB_CHAT: (void)HandleChatKey (message, wParam, lParam); break; case KB_MENU: HandleMenuKey (message, wParam, lParam); break; case KB_XBLAST: HandleXBlastKey (message, wParam, lParam); break; case KB_KEYSYM: HandleKeysymKey (message, wParam, lParam); break; default: break; } return 0; /* text input */ case WM_SYSCHAR: break; case WM_CHAR: HandleAsciiKey (message, wParam, lParam); break; /* handle keyrelease events */ case WM_SYSKEYUP: break; case WM_KEYUP: switch (keyboardMode) { case KB_XBLAST: HandleXBlastKey (message, wParam, lParam); break; default: break; } return 0; /* joystick */ case MM_JOY1BUTTONDOWN: case MM_JOY2BUTTONDOWN: case MM_JOY1MOVE: case MM_JOY2MOVE: switch (keyboardMode) { case KB_XBLAST: HandleXBlastJoy (message, wParam, lParam); break; case KB_MENU: HandleMenuJoy (message, wParam, lParam); break; default: break; } return 0; /* mouse */ case WM_LBUTTONDOWN: if (mouseEnable) { QueueEventPos (XBE_MOUSE_1, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_RBUTTONDOWN: if (mouseEnable) { QueueEventPos (XBE_MOUSE_2, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_MBUTTONDOWN: if (mouseEnable) { QueueEventPos (XBE_MOUSE_3, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_LBUTTONUP: if (mouseEnable) { QueueEventPos (XBE_RMOUSE_1, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_RBUTTONUP: if (mouseEnable) { QueueEventPos (XBE_RMOUSE_2, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_MBUTTONUP: if (mouseEnable) { QueueEventPos (XBE_RMOUSE_3, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; case WM_MOUSEMOVE: if (mouseEnable) { QueueEventPos (XBE_MOUSE_MOVE, LOWORD (lParam) / BASE_X, HIWORD (lParam) / BASE_Y); } return 0; /* xblast event */ case MSG_XBLAST_EVENT_VALUE: QueueEventValue ((XBEventCode) wParam, (int)lParam); return 0; case MSG_XBLAST_EVENT_POINTER: QueueEventPointer ((XBEventCode) wParam, (void *)lParam); return 0; /* end of game */ case WM_DESTROY: PostQuitMessage (0); return 0; default: break; } return DefWindowProc (window, message, wParam, lParam); } /* WindowProc */ /* * wait for next event in gui event queue */ XBEventCode GUI_WaitEvent (XBEventData * data) { XBEventCode ecode; MSG msg; /* only if there are no events in our xblast event queue */ while (XBE_NONE == (ecode = NextEvent (data))) { /* yes, now get windows events */ if (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } else { if (NULL != quitFunc) { (*quitFunc) (); } exit (msg.wParam); } } return ecode; } /* GUI_WaitEvent */ /* * peek at next event in queue */ XBEventCode GUI_PeekEvent (XBEventData * data) { XBEventCode ecode; MSG msg; /* only if there are no events in our xblast event queue */ while (XBE_NONE == (ecode = NextEvent (data))) { if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message != WM_QUIT) { TranslateMessage (&msg); DispatchMessage (&msg); } else { if (NULL != quitFunc) { (*quitFunc) (); } exit (msg.wParam); } } else { return XBE_NONE; } } return ecode; } /* GUI_PeekMessage */ /* * put an event with value in queue */ void GUI_SendEventValue (XBEventCode code, int value) { PostMessage (window, MSG_XBLAST_EVENT_VALUE, (WPARAM) code, (LPARAM) value); } /* GUI_SendEvent */ /* * put an event with pointer in queue */ void GUI_SendEventPointer (XBEventCode code, void *pointer) { PostMessage (window, MSG_XBLAST_EVENT_POINTER, (WPARAM) code, (LPARAM) pointer); } /* GUI_SendEvent */ /* * synchronize with display (not needed for win32) */ void GUI_Sync (void) { } /* GUI_Sync */ /* * beep */ void GUI_Bell (void) { MessageBeep (0xFFFFFFFF); } /* GUI_Bell */ /* * set function when window is destroyed */ void GUI_OnQuit (XBQuitFunction func) { quitFunc = func; } /* GUI_OnQuit */ /* * end of file w32_event.c */ xblast-2.10.4/w32_event.h0000644000175000017500000000257410372731125014206 0ustar rhondaalfie/* * file w32_event.h - event (message) handling for win32 * * $Id: w32_event.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_W32_EVENT_H #define XBLAST_W32_EVENT_H #include "w32_common.h" /* * global macros */ #define MSG_XBLAST_EVENT_VALUE WM_USER #define MSG_XBLAST_EVENT_POINTER (WM_USER+1) #define MSG_XBLAST_SELECT (WM_USER+2) #define MSG_XBLAST_TIMER (WM_USER+3) /* * global prototypes */ extern long PASCAL WindowProc (HWND window, UINT message, UINT w_param, LONG l_param); extern XBBool InitEvent (void); extern void FinishEvent (void); #endif /* * end of file w32_event.h */ xblast-2.10.4/w32_image.c0000644000175000017500000001760510376071615014150 0ustar rhondaalfie/* * file w32_image.c - image conversion (rgb to pixel) * * $Id: w32_image.c,v 1.5 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_image.h" #include "gui.h" #include "util.h" /* * local variables */ static unsigned char *bitConvTable = NULL; /* * library function: InitImages * description: initializes data structure neede for image conversion * parameters: none * return value: 0 on success, -1 on failure */ XBBool InitImages (void) { unsigned i, j; unsigned char tmp; /* create translation tables between pbm bits and windows mask */ bitConvTable = malloc (256); if (NULL == bitConvTable) { return XBFalse; } for (i = 0; i < 256; i++) { tmp = 0; for (j = 0; j < 8; j++) { if (i & (1 << j)) { tmp |= (1 << (7 - j)); } } bitConvTable[i] = ~tmp; } return XBTrue; } /* InitImages */ /* * */ void FinishImages (void) { if (NULL != bitConvTable) { free (bitConvTable); } } /* FinishImages */ /* * local function: BitmapFromRGBPixel * description: creates bitmap from pixel data in 24 bit RGB format * parameters: data - 24 bit pixel data (b,g,r!) * width - width of bitmap * height - height of bitmap * return value: handle of bitmap, or NULL on failure */ static HBITMAP BitmapFromRGBPixel (unsigned char *data, int width, int height) { BITMAPINFO info; HDC hdc; HBITMAP bitmap; HPALETTE oldPal = NULL; unsigned char swap; int i, len; /* turn r,g,b around */ len = 3 * width * height; for (i = 0; i < len; i += 3) { swap = data[i]; data[i] = data[i + 2]; data[i + 2] = swap; } /* set bitmap map info */ info.bmiHeader.biSize = sizeof (info.bmiHeader); info.bmiHeader.biWidth = width; info.bmiHeader.biHeight = -height; info.bmiHeader.biPlanes = 1; info.bmiHeader.biBitCount = 24; info.bmiHeader.biCompression = BI_RGB; info.bmiHeader.biSizeImage = 0; info.bmiHeader.biYPelsPerMeter = 2834; info.bmiHeader.biXPelsPerMeter = 2834; info.bmiHeader.biClrUsed = 0; info.bmiHeader.biClrImportant = 0; /* get dvice context of window */ hdc = GetDC (window); if (NULL == hdc) { return NULL; } /* select palette to use */ if (NULL != palette) { oldPal = SelectPalette (hdc, palette, FALSE); } /* create bitmap */ bitmap = CreateDIBitmap (hdc, &info.bmiHeader, CBM_INIT, data, &info, 0); ReleaseDC (window, hdc); if (NULL != palette) { SelectPalette (hdc, oldPal, FALSE); } /* that's all */ return bitmap; } /* BitmapFromRGBPixel */ /* * library function: ReadPbmBitmap * description: create a bitmap from a given pbm-file * parameters: path - relative path for image * filename - name of image file * return value: handle of bitmap, or NULL on failure */ HBITMAP ReadPbmBitmap (const char *path, const char *filename) { int width; int height; unsigned char *pbm; HBITMAP bitmap; int pbmLineLength; int w32LineLength; int i; int pbmSize; /* load pbm file */ if (NULL == (pbm = ReadPbmFile (path, filename, &width, &height))) { GUI_ErrorMessage ("Failed to load bitmap %s\n", filename); return NULL; } pbmLineLength = (width + 7) / 8; w32LineLength = 2 * ((width + 15) / 16); pbmSize = pbmLineLength * height; for (i = 0; i < pbmSize; i++) { pbm[i] = bitConvTable[pbm[i]]; } /* pbm data is byte aligned while bitmap data must be word aligned */ if (pbmLineLength != w32LineLength) { int y; unsigned char *tmp; /* --- */ tmp = calloc (height * w32LineLength, sizeof (unsigned char)); assert (tmp != NULL); for (y = 0; y < height; y++) { memcpy (tmp + y * w32LineLength, pbm + y * pbmLineLength, pbmLineLength); } /* --- */ free (pbm); pbm = tmp; } /* create monochrome bitmap */ bitmap = CreateBitmap (width, height, 1, 1, pbm); /* free data */ free (pbm); /* that's all */ return bitmap; } /* ReadPbmBitmap */ /* * library function: ReadRgbPixmap * description: create a bitmap from a ppm file (using rgb values) * parameters: path - relative path for image * filename - name of image file * return value: handle of bitmap, or NULL on failure */ HBITMAP ReadRgbPixmap (const char *path, const char *filename) { int width; int height; unsigned char *ppm; HBITMAP bitmap; /* load ppm file */ if (NULL == (ppm = ReadPpmFile (path, filename, &width, &height))) { GUI_ErrorMessage ("Failed to load pixmap %s\n", filename); return NULL; } /* now create bitmap */ bitmap = BitmapFromRGBPixel (ppm, width, height); /* free pixel data */ free (ppm); /* that's all */ return bitmap; } /* ReadRgbPixmap */ /* * library function: ReadCchPixmap * description: create a bitmap from a ppm file (using red as bg, green as add * and white as highlight) * parameters: path - relative path for image * filename - name of image file * fg - base color (black most of the time) * bg - first color (for red pixels) * add - seconed color (for green pixels) * return value: handle of bitmap, or NULL on failure */ HBITMAP ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add) { int width; int height; unsigned char *ppm; HBITMAP bitmap; /* load ppm file */ if (NULL == (ppm = ReadPpmFile (path, filename, &width, &height))) { GUI_ErrorMessage ("Failed to load pixmap %s\n", filename); return NULL; } /* convert color */ CchToPpm (ppm, width, height, fg, bg, add); /* now create bitmap */ bitmap = BitmapFromRGBPixel (ppm, width, height); /* free pixel data */ free (ppm); /* that's all */ return bitmap; } /* ReadCchPixmap */ /* * library function: ReadEpmPixmap * description: create a bitmap from a ppm file (using red as bg, green as add * and white as highlight) * parameters: path - relative path for image * filename - name of image file * n_colors - number of color layers * color - arrays with colors foreach layer * return value: handle of bitmap, or NULL on failure */ HBITMAP ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color) { int width; int height; int depth; unsigned char *epm; unsigned char *ppm; HBITMAP bitmap; assert (NULL != color); assert (NULL != path); assert (NULL != filename); /* load ppm file */ if (NULL == (epm = ReadEpmFile (path, filename, &width, &height, &depth))) { GUI_ErrorMessage ("Failed to load pixmap %s\n", filename); return NULL; } /* check depth */ if (depth < n_colors) { n_colors = depth; } /* create ppm array */ ppm = malloc (width * height * 3); assert (ppm != NULL); /* convert color */ EpmToPpm (epm, ppm, width, height, n_colors, color); /* now create bitmap */ bitmap = BitmapFromRGBPixel (ppm, width, height); /* free pixel data */ free (epm); free (ppm); /* that's all */ return bitmap; } /* ReadEpmPixmap */ /* * convert colorname to value (not supported for win32) */ XBColor GUI_ParseColor (const char *name) { return COLOR_INVALID; } /* GUI_ParseColor */ /* * end of file w32_image.c */ xblast-2.10.4/w32_image.h0000644000175000017500000000260610372731125014143 0ustar rhondaalfie/* * file w32_image.h - * * $Id: w32_image.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_IMAGE_H #define _W32_IMAGE_H #include "w32_common.h" #include "color.h" extern XBBool InitImages (void); extern void FinishImages (void); extern HBITMAP ReadPbmBitmap (const char *path, const char *filename); extern HBITMAP ReadRgbPixmap (const char *path, const char *filename); extern HBITMAP ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add); extern HBITMAP ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color); #endif /* * */ xblast-2.10.4/w32_init.c0000644000175000017500000001201310376071615014015 0ustar rhondaalfie/* * file w32_init.c - initialze Win32-graphics engine * * $Id: w32_init.c,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "gui.h" #include "w32_config.h" #include "w32_event.h" #include "w32_joystick.h" #include "w32_keysym.h" #include "w32_pixmap.h" #include "w32_sprite.h" #include "w32_text.h" #include "w32_image.h" #include "w32_tile.h" #include "version.h" #include "geom.h" /* * local function: InitWindow * description: create the xblast main window * parameters: title - title of window * return value: XBTrue on success, XBFalse on error */ static XBBool InitWindow (const char *title) { RECT cRect; RECT wRect; int x, y; int width, height; static WNDCLASS windowClass; /* register xblast class */ windowClass.style = 0; windowClass.lpfnWndProc = WindowProc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = instance; windowClass.hIcon = LoadIcon (instance, xblastClass); windowClass.hCursor = LoadCursor (NULL, IDC_ARROW); windowClass.hbrBackground = GetStockObject (BLACK_BRUSH); windowClass.lpszClassName = xblastClass; if (0 == RegisterClass (&windowClass)) { return XBFalse; } /* retrieve old geonetry */ RetrieveWindowRect (&wRect); /* now create the window */ window = CreateWindow (xblastClass, title, WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, wRect.right - wRect.left, wRect.bottom - wRect.top, NULL, NULL, instance, NULL); if (window == NULL) { return XBFalse; } /* now show it (may be moved elsewhere) */ ShowWindow (window, SW_SHOWDEFAULT); UpdateWindow (window); /* set window size correctly */ if (GetClientRect (window, &cRect)) { x = wRect.left; y = wRect.top; width = wRect.right - wRect.left; height = wRect.bottom - wRect.top; /* adjust width and height, if client region has wrong size */ if (PIXW != cRect.right - cRect.left) { width -= cRect.right - cRect.left - PIXW; } if (PIXH + SCOREH != cRect.bottom - cRect.top) { height -= cRect.bottom - cRect.top - PIXH - SCOREH; } Dbg_Out ("Window geom %dx%d+%d+%d\n", width, height, x, y); MoveWindow (window, x, y, width, height, TRUE); } /* that's all */ Dbg_Out ("InitWindow successful\n"); return XBTrue; } /* InitWindow */ /* * local function: FinishWindow * description: clean up window and its class */ static void FinishWindow (void) { RECT rect; /* store last position */ if (GetWindowRect (window, &rect)) { StoreWindowRect (&rect); } /* delete window */ DestroyWindow (window); /* unregister window class */ UnregisterClass (xblastClass, instance); } /* FinishWindow */ /* * global function: GUI_Init * description: initializes win32-display * parameters: title - window caption * icon_name - ignored * return value: 0 on success, -1 on failure */ XBBool GUI_Init (int argc, char *argv[]) { /* get program instance */ instance = GetModuleHandleA (0); /* create game window */ if (!InitWindow ("XBlast TNT " VERSION_STRING)) { return XBFalse; } /* init image loading */ if (!InitImages ()) { return XBFalse; } /* create bitmap for double buffering */ if (!InitPixmap ()) { return XBFalse; } /* setup text output and fonts */ if (!InitText ()) { return XBFalse; } /* setup tile output */ if (!InitTiles ()) { return XBFalse; } /* create sprites */ if (!InitSprites ()) { return XBFalse; } /* setup keysmbol table */ if (!InitKeysym ()) { return XBFalse; } /* Setup Event handler */ if (!InitEvent ()) { return XBFalse; } /* Setup Joystick Handler */ if (!InitJoystick ()) { return XBFalse; } return XBTrue; } /* GUI_Init */ /* * global function: GUI_Finish * description: shutdown win32 interface */ void GUI_Finish (void) { /* cleanup joystick */ FinishJoystick (); /* clean up event handling */ FinishEvent (); /* setup keysmbol table */ FinishKeysym (); /* remove all sprite bitmaps */ FinishSprites (); /* romve all tiles */ FinishTiles (); /* unload fonts etc */ FinishText (); /* clear image conversion data structures */ FinishImages (); /* remove double buffer */ FinishPixmap (); /* remove window */ FinishWindow (); } /* GUI_Finish */ /* * end of file w32_init.c */ xblast-2.10.4/w32_joystick.c0000644000175000017500000001537210376071615014724 0ustar rhondaalfie/* * file w32_joystick.c - joystick support * * $Id: w32_joystick.c,v 1.6 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_joystick.h" #include "gui.h" //#include "w32_mm.h" /* * local macros */ #define MAX_JOYSTICK 2 /* flags for joystick X and Y positions */ #define JOYDIR_NONE 0x00 #define JOYDIR_UP 0x01 #define JOYDIR_DOWN 0x02 #define JOYDIR_Y 0x03 #define JOYDIR_LEFT 0x04 #define JOYDIR_RIGHT 0x08 #define JOYDIR_X 0x0C /* * local types */ /* joystick data */ typedef struct { XBEventCode event; /* event code to send */ unsigned dir; /* current direction */ unsigned xLow; /* calibration data */ unsigned xHigh; /* calibration data */ unsigned yLow; /* calibration data */ unsigned yHigh; /* calibration data */ } XBJoystick; /* * local variables */ /* available joystick IDs */ static const UINT joyDevice[MAX_JOYSTICK] = { JOYSTICKID1, JOYSTICKID2, }; /* joystick parameters */ static XBJoystick joystick[MAX_JOYSTICK]; /* * how many joystick do we support */ int GUI_NumJoysticks (void) { int i, num; for (i = 0, num = 0; i < MAX_JOYSTICK; i++) { if (XBE_NONE != joystick[i].event) { num++; } } return num; } /* GUI_NumJoysticks */ /* * init joystick support */ XBBool InitJoystick (void) { int i, j; UINT joyThres; static JOYCAPS joyCaps; memset (joystick, 0, sizeof (joystick)); for (i = 0, j = 0; i < joyGetNumDevs () && i < MAX_JOYSTICK && j < MAX_JOYSTICK; i++) { /* get device */ if (JOYERR_NOERROR != joyGetDevCaps (joyDevice[i], &joyCaps, sizeof (joyCaps))) { continue; } /* set threshold */ joyThres = ABS ((int)joyCaps.wYmin - (int)joyCaps.wYmax) / 8; if (JOYERR_NOERROR != joySetThreshold (joyDevice[i], joyThres)) { continue; } if (JOYERR_NOERROR != joySetCapture (window, joyDevice[i], 0, TRUE)) { continue; } joystick[i].event = XBE_JOYST_1 + j; joystick[i].dir = JOYDIR_NONE; joystick[i].xLow = 3 * (joyCaps.wXmin / 4) + 1 * (joyCaps.wXmax / 4); joystick[i].xHigh = 1 * (joyCaps.wXmin / 4) + 3 * (joyCaps.wXmax / 4); joystick[i].yLow = 3 * (joyCaps.wYmin / 4) + 1 * (joyCaps.wYmax / 4); joystick[i].yHigh = 1 * (joyCaps.wYmin / 4) + 3 * (joyCaps.wYmax / 4); j++; Dbg_Out ("Joystick (%d) %s connected as XBE_JOYST_%d. x=(%u,%u) y=(%u,%u)\n", i + 1, joyCaps.szPname, j, joyCaps.wXmin, joyCaps.wXmax, joyCaps.wYmin, joyCaps.wYmax); } return XBTrue; } /* InitJoystick */ /* * finish joystick support */ void FinishJoystick (void) { size_t i; for (i = 0; i < MAX_JOYSTICK; i++) { if (XBE_NONE != joystick[i].event) { joyReleaseCapture (joyDevice[i]); } } } /* FinishJoystick */ /* * calculate new joystick position for window message */ static unsigned EvalJoystickMove (LONG lParam, const XBJoystick * pJoy) { UINT xPos, yPos; unsigned newDir = 0; /* sanity check */ assert (NULL != pJoy); /* get x-position */ xPos = LOWORD (lParam); if (pJoy->xHigh < pJoy->xLow) { if (xPos < pJoy->xHigh) { newDir |= JOYDIR_LEFT; } else if (xPos > pJoy->xLow) { newDir |= JOYDIR_RIGHT; } } else { if (xPos > pJoy->xHigh) { newDir |= JOYDIR_RIGHT; } else if (xPos < pJoy->xLow) { newDir |= JOYDIR_LEFT; } } /* get y-position */ yPos = HIWORD (lParam); if (pJoy->yHigh < pJoy->yLow) { if (yPos < pJoy->yHigh) { newDir |= JOYDIR_UP; } else if (yPos > pJoy->yLow) { newDir |= JOYDIR_DOWN; } } else { if (yPos > pJoy->yHigh) { newDir |= JOYDIR_DOWN; } else if (yPos < pJoy->yLow) { newDir |= JOYDIR_UP; } } return newDir; } /* EvalJoyMove */ /* * handle joysticks messages in menu mode */ void HandleMenuJoy (UINT message, UINT wParam, LONG lParam) { XBJoystick *pJoy; unsigned newDir; switch (message) { /* button presses */ case MM_JOY1BUTTONDOWN: case MM_JOY2BUTTONDOWN: QueueEventValue (XBE_MENU, XBMK_SELECT); break; /* joystick movement */ case MM_JOY1MOVE: case MM_JOY2MOVE: if (message == MM_JOY1MOVE) { pJoy = joystick + 0; } else { pJoy = joystick + 1; } newDir = EvalJoystickMove (lParam, pJoy); if (newDir != pJoy->dir) { /* test changes in y dir */ if ((newDir & JOYDIR_Y) != (pJoy->dir & JOYDIR_Y)) { switch (newDir & JOYDIR_Y) { case JOYDIR_UP: QueueEventValue (XBE_MENU, XBMK_UP); break; case JOYDIR_DOWN: QueueEventValue (XBE_MENU, XBMK_DOWN); break; } } if ((newDir & JOYDIR_X) != (pJoy->dir & JOYDIR_X)) { switch (newDir & JOYDIR_X) { case JOYDIR_LEFT: QueueEventValue (XBE_MENU, XBMK_LEFT); break; case JOYDIR_RIGHT: QueueEventValue (XBE_MENU, XBMK_RIGHT); break; } } pJoy->dir = newDir; } } } /* HandleMenuJoy */ /* * handle joysticks messages in game mode */ void HandleXBlastJoy (UINT message, UINT wParam, LONG lParam) { XBJoystick *pJoy; unsigned newDir; int value; switch (message) { /* button presses */ case MM_JOY1BUTTONDOWN: case MM_JOY2BUTTONDOWN: if (message == MM_JOY1BUTTONDOWN) { pJoy = joystick + 0; } else { pJoy = joystick + 1; } if (pJoy->event != XBE_NONE) { if (JOY_BUTTON1CHG & wParam) { QueueEventValue (pJoy->event, XBGK_BOMB); } if (JOY_BUTTON2CHG & wParam) { QueueEventValue (pJoy->event, XBGK_SPECIAL); } } break; /* moving */ case MM_JOY1MOVE: case MM_JOY2MOVE: if (message == MM_JOY1MOVE) { pJoy = joystick + 0; } else { pJoy = joystick + 1; } if (pJoy->event != XBE_NONE) { newDir = EvalJoystickMove (lParam, pJoy); switch (newDir) { case JOYDIR_UP: value = XBGK_GO_UP; break; case JOYDIR_DOWN: value = XBGK_GO_DOWN; break; case JOYDIR_LEFT: value = XBGK_GO_LEFT; break; case JOYDIR_RIGHT: value = XBGK_GO_RIGHT; break; case JOYDIR_NONE: value = XBGK_STOP_ALL; break; default: value = XBGK_NONE; break; } if (value != XBGK_NONE && newDir != pJoy->dir) { QueueEventValue (pJoy->event, value); pJoy->dir = newDir; } } break; } } /* HandleXBlastJoy */ /* * end fo file w32_joystick.c */ xblast-2.10.4/w32_joystick.h0000644000175000017500000000232610376071615014724 0ustar rhondaalfie/* * file w32_joystick.h - joystick support for Win32 * * $Id: w32_joystick.h,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_W32_JOYSTICK_H #define XBLAST_W32_JOYSTICK_H #include "w32_common.h" extern XBBool InitJoystick (void); extern void FinishJoystick (void); extern void HandleMenuJoy (UINT message, UINT wParam, LONG lParam); extern void HandleXBlastJoy (UINT message, UINT wParam, LONG lParam); #endif /* * end of file w32_joystick.h */ xblast-2.10.4/w32_keysym.c0000644000175000017500000001177110376071615014405 0ustar rhondaalfie/* * file w32_keysym.c - create X11 like keysmbol names for virtual keys * * $Id: w32_keysym.c,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_keysym.h" #include "gui.h" /* * local types */ typedef struct { UINT code; const char *name; } KeyNameTable; typedef struct { ATOM atom; UINT code; } AtomCodeTable; /* * local variables */ static int numKeys = 0; static AtomCodeTable *atomTable = NULL; static AtomCodeTable *codeTable = NULL; static KeyNameTable keyTable[] = { {VK_BACK, "BackSpace"}, {VK_TAB, "Tab"}, {VK_RETURN, "Return"}, {VK_SHIFT, "Shift"}, {VK_CONTROL, "Control"}, {VK_PAUSE, "Pause"}, {VK_CAPITAL, "Caps_Lock"}, {VK_ESCAPE, "Escape"}, {VK_SPACE, "space"}, {VK_PRIOR, "Prior"}, {VK_NEXT, "Next"}, {VK_END, "End"}, {VK_HOME, "Home"}, {VK_LEFT, "Left"}, {VK_UP, "Up"}, {VK_RIGHT, "Right"}, {VK_DOWN, "Down"}, {VK_PRINT, "Print"}, {VK_INSERT, "Insert"}, {VK_DELETE, "Delete"}, {'0', "0"}, {'1', "1"}, {'2', "2"}, {'3', "3"}, {'4', "4"}, {'5', "5"}, {'6', "6"}, {'7', "7"}, {'8', "8"}, {'9', "9"}, {'A', "A"}, {'B', "B"}, {'C', "C"}, {'D', "D"}, {'E', "E"}, {'F', "F"}, {'G', "G"}, {'H', "H"}, {'I', "I"}, {'J', "J"}, {'K', "K"}, {'L', "L"}, {'M', "M"}, {'N', "N"}, {'O', "O"}, {'P', "P"}, {'Q', "Q"}, {'R', "R"}, {'S', "S"}, {'T', "T"}, {'U', "U"}, {'V', "V"}, {'W', "W"}, {'X', "X"}, {'Y', "Y"}, {'Z', "Z"}, {VK_NUMPAD0, "KP_0"}, {VK_NUMPAD1, "KP_1"}, {VK_NUMPAD2, "KP_2"}, {VK_NUMPAD3, "KP_3"}, {VK_NUMPAD4, "KP_4"}, {VK_NUMPAD5, "KP_5"}, {VK_NUMPAD6, "KP_6"}, {VK_NUMPAD7, "KP_7"}, {VK_NUMPAD8, "KP_8"}, {VK_NUMPAD9, "KP_9"}, {VK_MULTIPLY, "KP_Multiply"}, {VK_ADD, "KP_Add"}, {VK_SUBTRACT, "KP_Subtract"}, {VK_DECIMAL, "KP_Decimal"}, {VK_DIVIDE, "KP_Divide"}, {VK_F1, "F1"}, {VK_F2, "F2"}, {VK_F3, "F3"}, {VK_F4, "F4"}, {VK_F5, "F5"}, {VK_F6, "F6"}, {VK_F7, "F7"}, {VK_F8, "F8"}, {VK_F9, "F9"}, {VK_F10, "F10"}, {VK_F11, "F11"}, {VK_F12, "F12"}, {VK_F13, "F13"}, {VK_F14, "F14"}, {VK_F15, "F15"}, {VK_F16, "F16"}, {VK_F17, "F17"}, {VK_F18, "F18"}, {VK_F19, "F19"}, {VK_F20, "F20"}, {VK_F21, "F21"}, {VK_F22, "F22"}, {VK_F23, "F23"}, {VK_F24, "F24"}, /* terminator */ {0, NULL}, }; /* * compare by code */ static int CompareByCode (const void *a, const void *b) { return ((AtomCodeTable *) a)->code - ((AtomCodeTable *) b)->code; } /* CompareByCode */ /* * compare by atom */ static int CompareByAtom (const void *a, const void *b) { return ((AtomCodeTable *) a)->atom - ((AtomCodeTable *) b)->atom; } /* CompareByAtom */ /* * init keysyms */ XBBool InitKeysym (void) { int i; /* count keys */ for (numKeys = 0; keyTable[numKeys].name != NULL; numKeys++) continue; /* alloc tables */ atomTable = calloc (numKeys, sizeof (AtomCodeTable)); assert (NULL != atomTable); codeTable = calloc (numKeys, sizeof (AtomCodeTable)); assert (NULL != codeTable); /* fill tables */ for (i = 0; i < numKeys; i++) { XBAtom atom = GUI_StringToAtom (keyTable[i].name); atomTable[i].code = codeTable[i].code = keyTable[i].code; atomTable[i].atom = codeTable[i].atom = atom; } /* sort tables */ qsort (atomTable, numKeys, sizeof (AtomCodeTable), CompareByAtom); qsort (codeTable, numKeys, sizeof (AtomCodeTable), CompareByCode); /* that's all */ return XBTrue; } /* InitKeysym */ /* * */ void FinishKeysym (void) { if (NULL != atomTable) { free (atomTable); atomTable = NULL; } if (NULL != codeTable) { free (codeTable); codeTable = NULL; } } /* FinishKeysym */ /* * convert string to keycode */ UINT StringToVirtualKey (const char *name) { AtomCodeTable key; AtomCodeTable *result; XBAtom atom; atom = GUI_StringToAtom (name); key.atom = atom; result = bsearch (&key, atomTable, numKeys, sizeof (AtomCodeTable), CompareByAtom); if (NULL == result) { return 0; } return result->code; } /* StringToVirtualKey */ /* * convert keycode to string */ XBAtom VirtualKeyToAtom (UINT code) { AtomCodeTable key; AtomCodeTable *result; XBAtom atom; key.code = code; result = bsearch (&key, codeTable, numKeys, sizeof (AtomCodeTable), CompareByCode); if (NULL == result) { return ATOM_INVALID; } atom = result->atom; return atom; } /* StringToVirtualKey */ /* * end of file w32_keysym.c */ xblast-2.10.4/w32_keysym.h0000644000175000017500000000213410372731125014376 0ustar rhondaalfie/* * file w32_keysym.h * * $Id: w32_keysym.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef W32_KEYSYM_H #define W32_KEYSYM_H #include "w32_common.h" #include "event.h" /* * global prototypes */ extern XBBool InitKeysym (void); extern void FinishKeysym (void); extern UINT StringToVirtualKey (const char *name); extern XBAtom VirtualKeyToAtom (UINT code); #endif /* * end of file w32_keysym.h */ xblast-2.10.4/w32_mm.h0000644000175000017500000001560510372705223013475 0ustar rhondaalfie/* * file w32_mm.h - prototypes for winmm library * * $Id: w32_mm.h,v 1.3 2006/02/09 18:31:47 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_MM_H #define _W32_MM_H #include #ifdef UNICODE #define joyGetDevCaps joyGetDevCapsW #else #define joyGetDevCaps joyGetDevCapsA #endif #define MAXPNAMELEN 32 /* * type definitions */ DECLARE_HANDLE (HWAVE); DECLARE_HANDLE (HWAVEOUT); typedef UINT MMRESULT; typedef struct { UINT wXpos; UINT wYpos; UINT wZpos; UINT wButtons; } PACKED JOYINFO, *LPJOYINFO; typedef struct tag_joycaps { UINT wMid; UINT wPid; char szPname[MAXPNAMELEN]; UINT wXmin; UINT wXmax; UINT wYmin; UINT wYmax; UINT wZmin; UINT wZmax; UINT wNumButtons; UINT wPeriodMin; UINT wPeriodMax; } PACKED JOYCAPS, *LPJOYCAPS; typedef struct tag_waveformat { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; } PACKED WAVEFORMAT, *LPWAVEFORMAT; typedef struct { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; } WAVEFORMATEX; typedef struct tag_pcmwaveformat { WAVEFORMAT wf; WORD wBitsPerSample; } PACKED PCMWAVEFORMAT, *LPPCMWAVEFORMAT; typedef struct tag_wavehdr { LPSTR lpData; DWORD dwBufferLength; DWORD dwBytesRecorded; DWORD dwUser; DWORD dwFlags; DWORD dwLoops; struct tag_wavehdr *lpNext; DWORD reserved; } PACKED WAVEHDR; /* * constants */ /* joystick ID */ #define JOYSTICKID1 0 #define JOYSTICKID2 1 /* error codes */ #define JOYERR_NOERROR 0 #define JOYERR_PARMS 165 #define JOYERR_NOCANDO 166 #define JOYERR_UNPLUGGED 167 /* messages */ #define MM_JOY1MOVE 0x3A0 #define MM_JOY2MOVE 0x3A1 #define MM_JOY1ZMOVE 0x3A2 #define MM_JOY2ZMOVE 0x3A3 #define MM_JOY1BUTTONDOWN 0x3B5 #define MM_JOY2BUTTONDOWN 0x3B6 #define MM_JOY1BUTTONUP 0x3B7 #define MM_JOY2BUTTONUP 0x3B8 /* joystick button flags */ #define JOY_BUTTON1CHG 0x0100 #define JOY_BUTTON2CHG 0x0200 #define JOY_BUTTON3CHG 0x0400 #define JOY_BUTTON4CHG 0x0800 /* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */ #define WAVE_FORMAT_QUERY 0x0001 #define WAVE_ALLOWSYNC 0x0002 #define CALLBACK_WINDOW 0x00010000l /* dwCallback is a HWND */ #define CALLBACK_FUNCTION 0x00030000l /* dwCallback is a FARPROC */ /* device ID for wave device mapper */ #define WAVE_MAPPER (-1) /* flags for wFormatTag field of WAVEFORMAT */ #define WAVE_FORMAT_PCM 1 /* messages */ #define MM_WOM_OPEN 0x3BB /* waveform output */ #define MM_WOM_CLOSE 0x3BC #define MM_WOM_DONE 0x3BD /* flags for dwFlags field of WAVEHDR */ #define WHDR_DONE 0x00000001 /* done bit */ #define WHDR_PREPARED 0x00000002 /* set if this header has been prepared */ #define WHDR_BEGINLOOP 0x00000004 /* loop start block */ #define WHDR_ENDLOOP 0x00000008 /* loop end block */ #define WHDR_INQUEUE 0x00000010 /* reserved for driver */ /* KOEN SHIT */ #define WINMMAPI #define TIMERR_NOERROR (0) /* no error */ #define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */ #define TIMERR_STRUCT (TIMERR_BASE+33) /* time struct size */ /* timer data types */ typedef void (CALLBACK TIMECALLBACK) (UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); typedef TIMECALLBACK FAR *LPTIMECALLBACK; /* MMTIME data structure */ typedef struct mmtime_tag { UINT wType; /* indicates the contents of the union */ union { DWORD ms; /* milliseconds */ DWORD sample; /* samples */ DWORD cb; /* byte count */ DWORD ticks; /* ticks in MIDI stream */ /* SMPTE */ struct { BYTE hour; /* hours */ BYTE min; /* minutes */ BYTE sec; /* seconds */ BYTE frame; /* frames */ BYTE fps; /* frames per second */ BYTE dummy; /* pad */ #ifdef _WIN32 BYTE pad[2]; #endif } smpte; /* MIDI */ struct { DWORD songptrpos; /* song pointer position */ } midi; } u; } MMTIME, *PMMTIME, *NPMMTIME, *LPMMTIME; /* flags for fuEvent parameter of timeSetEvent() function */ #define TIME_ONESHOT 0x0000 /* program timer for single event */ #define TIME_PERIODIC 0x0001 /* program for continuous periodic event */ #ifdef _WIN32 #define TIME_CALLBACK_FUNCTION 0x0000 /* callback is function */ #define TIME_CALLBACK_EVENT_SET 0x0010 /* callback is event - use SetEvent */ #define TIME_CALLBACK_EVENT_PULSE 0x0020 /* callback is event - use PulseEvent */ #endif /* timer device capabilities data structure */ typedef struct timecaps_tag { UINT wPeriodMin; /* minimum period supported */ UINT wPeriodMax; /* maximum period supported */ } TIMECAPS, *PTIMECAPS, *NPTIMECAPS, *LPTIMECAPS; /* timer function prototypes */ WINMMAPI MMRESULT WINAPI timeGetSystemTime (LPMMTIME pmmt, UINT cbmmt); WINMMAPI DWORD WINAPI timeGetTime (void); WINMMAPI MMRESULT WINAPI timeSetEvent (UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD dwUser, UINT fuEvent); WINMMAPI MMRESULT WINAPI timeKillEvent (UINT uTimerID); WINMMAPI MMRESULT WINAPI timeGetDevCaps (LPTIMECAPS ptc, UINT cbtc); WINMMAPI MMRESULT WINAPI timeBeginPeriod (UINT uPeriod); WINMMAPI MMRESULT WINAPI timeEndPeriod (UINT uPeriod); /* * function prototypes */ extern UINT STDCALL joyGetNumDevs (void); extern MMRESULT STDCALL joyGetDevCaps (UINT, LPJOYCAPS, UINT); extern MMRESULT STDCALL joyGetPos (UINT, LPJOYINFO); extern MMRESULT STDCALL joySetCapture (HWND, UINT, UINT, BOOL); extern MMRESULT STDCALL joySetThreshold (UINT, UINT); extern MMRESULT STDCALL joyReleaseCapture (UINT uJoyID); extern UINT STDCALL waveOutOpen (HWAVEOUT FAR * lphWaveOut, UINT uDeviceID, const WAVEFORMAT FAR * lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags); extern UINT STDCALL waveOutClose (HWAVEOUT hWaveOut); extern UINT STDCALL waveOutReset (HWAVEOUT hWaveOut); extern UINT STDCALL waveOutPrepareHeader (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, UINT uSize); extern UINT STDCALL waveOutUnprepareHeader (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, UINT uSize); extern UINT STDCALL waveOutWrite (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, UINT uSize); #endif /* * end of file w32_mm.h */ xblast-2.10.4/w32_msgbox.c0000644000175000017500000000236210376071615014357 0ustar rhondaalfie/* * file w32_msgbox.c - message boxes * * $Id: w32_msgbox.c,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "gui.h" #include "w32_common.h" static char msgText[1024]; /* * */ void GUI_ErrorMessage (const char *fmt, ...) { va_list argList; va_start (argList, fmt); vsprintf (msgText, fmt, argList); va_end (argList); MessageBox (window, msgText, "XBlast Error", MB_ICONSTOP | MB_OK); } /* GUI_ErrorMessage */ /* * end of file w32_msgbox.c */ xblast-2.10.4/w32_pixmap.c0000644000175000017500000002306110376071615014355 0ustar rhondaalfie/* * file w32_pixmap.c - double buffer for drawing * * $Id: w32_pixmap.c,v 1.11 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #include "w32_pixmap.h" #include "gui.h" #include "w32_image.h" #include "geom.h" #include "image.h" /* * local constants */ #define CLEAR_WIDTH (24*BASE_X) #define CLEAR_HEIGHT (24*BASE_Y) #define FADE_STEP 16 /* Changed by VVL (Chat) 12/11/99 */ /* Added by Fouf on 01/19/00 15:44:43 */ #define MAX_RECT (MAZE_W*(MAZE_H) + STAT_W*4) //#define MAX_RECT (MAZE_W*MAZE_H + 4*STAT_W) /* * local types */ typedef struct { RGNDATAHEADER rdh; RECT rect[MAX_RECT]; } RegionData; /* * local variables */ /* pixmap fro double buffering */ static HDC hdcPix = NULL; static HBITMAP clearPix = NULL; /* update rectangles for redraw */ static RegionData rgnData; /* maximum y coordinate */ static int fadeMax; /* step width between lines */ static int fadeStep; /* fade mode*/ static XBFadeMode fadeMode; /* * global function: GUI_ClearPixmap * description: clear pixmap buffer with standard pattern * parameters: none * return value: none */ void GUI_ClearPixmap (void) { HDC hdcSrc; HGDIOBJ oldPix; int x, y; /* get context for destination */ hdcSrc = CreateCompatibleDC (hdcPix); oldPix = SelectObject (hdcPix, pix); (void)SelectObject (hdcSrc, clearPix); /* draw */ for (x = 0; x < PIXW; x += CLEAR_WIDTH) { for (y = 0; y < PIXH + SCOREH; y += CLEAR_HEIGHT) { BitBlt (hdcPix, x, y, 192, 144, hdcSrc, 0, 0, SRCCOPY); } } /* get rid of the device contextes */ (void)SelectObject (hdcPix, oldPix); DeleteDC (hdcSrc); } /* GUI_ClearPixmap */ /* * library function: ClearRactnagles * description: clear given rectangles in pixmap * parameters: rect - point to array of rectangles * n_rect - number of rectangles in array * return value: none */ void ClearRectangles (HDC hdcDst, HDC hdcSrc, RECT * rect, int nRect) { HGDIOBJ oldSrc; int i; assert (rect != NULL); /* get context for destination */ oldSrc = SelectObject (hdcSrc, clearPix); /* draw */ for (i = 0; i < nRect; i++) { BitBlt (hdcDst, rect->left, rect->top, BLOCK_WIDTH, BLOCK_HEIGHT, hdcSrc, rect->left % CLEAR_WIDTH, rect->top % CLEAR_HEIGHT, SRCCOPY); rect++; } /* get rid of the device contextes */ (void)SelectObject (hdcSrc, oldSrc); } /* ClearRectangles */ /* * redraw window by painting parts of pixmap into it (for WM_PAINT) */ void PaintPixmap (HWND window) { HDC hdc; PAINTSTRUCT ps; HGDIOBJ oldPix; HPALETTE oldPal = NULL; unsigned i; HRGN hRgn = CreateRectRgn (0, 0, 0, 0); assert (hRgn != NULL); if (GetUpdateRgn (window, hRgn, FALSE)) { /* get graphics context for window */ hdc = BeginPaint (window, &ps); /* get region data */ if (0 == GetRegionData (hRgn, sizeof (rgnData), (RGNDATA *) & rgnData) || RDH_RECTANGLES != rgnData.rdh.iType) { /* update full window */ rgnData.rdh.nCount = 1; rgnData.rect->left = 0; rgnData.rect->top = 0; rgnData.rect->right = PIXW; rgnData.rect->bottom = PIXH + SCOREH; } /* draw it */ oldPix = SelectObject (hdcPix, pix); if (NULL != palette) { oldPal = SelectPalette (hdc, palette, FALSE); RealizePalette (hdc); } for (i = 0; i < rgnData.rdh.nCount; i++) { BitBlt (hdc, rgnData.rect[i].left, rgnData.rect[i].top, rgnData.rect[i].right - rgnData.rect[i].left, rgnData.rect[i].bottom - rgnData.rect[i].top, hdcPix, rgnData.rect[i].left, rgnData.rect[i].top, SRCCOPY); } if (NULL != palette) { (void)SelectPalette (hdc, oldPal, FALSE); } (void)SelectObject (hdcPix, oldPix); /* finish drawing */ EndPaint (window, &ps); } DeleteObject (hRgn); } /* UpdatePixmapRect */ /* * library function: GUI_FlushPixmap * description: copy pixmap to window * parameters: flag - XBTrue only changed parts, XBFalse all of it * return value: none */ void GUI_FlushPixmap (XBBool flag) { if (!flag) { InvalidateRect (window, NULL, FALSE); } UpdateWindow (window); } /* GUI_FlushPixmap */ /* * */ void GUI_FlushScoreBoard (void) { static const RECT rect = { 0, PIXH, PIXW, PIXH + SCOREH }; InvalidateRect (window, &rect, FALSE); UpdateWindow (window); } /* GUI_FlushScoreBoard */ /* * global function: GUI_AddMazeRectangle * description: add a map tile to list of rectangles, which are to be redrawn * parameters: x - column of tile * y - row of tile * return value: none */ void GUI_AddMazeRectangle (int x, int y) { RECT rect; rect.left = BLOCK_WIDTH * x; rect.top = BLOCK_HEIGHT * y; rect.right = BLOCK_WIDTH * (x + 1); rect.bottom = BLOCK_HEIGHT * (y + 1); InvalidateRect (window, &rect, FALSE); } /* GUI_AddMazeRectangle */ /* * global function: GUI_AddStatRectangle * description: add a statusbar tile to list of rectangles, which are to be redrawn * parameters: x - column of tile * y - row of tile * return value: none */ void GUI_AddStatRectangle (int x, int y) { RECT rect; rect.left = STAT_WIDTH * x; rect.right = STAT_WIDTH * (x + 1); rect.top = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT; if (++y < STAT_H) { rect.bottom = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT; } else { rect.bottom = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT + LED_HEIGHT; } //Dbg_Out("add rect %i %i %i %i max %i\n",rect.left ,rect.right ,rect.top ,rect.bottom,MAX_RECT ); InvalidateRect (window, &rect, FALSE); } /* GUI_AddStatRectangle */ /* Added by VVL (Chat) 12/11/99 : Begin */ void GUI_AddChatRectangle (int x, int y) { int i = 0, j = 1; RECT rect; rect.left = x * STAT_WIDTH; rect.right = STAT_WIDTH * (x + 1); #ifdef SMPF i = 0; j = 3; #else i = 0; #endif rect.top = (MAZE_H + j) * BLOCK_HEIGHT + i * STAT_HEIGHT + LED_HEIGHT + 8; rect.bottom = (MAZE_H + j) * BLOCK_HEIGHT + (i + 1) * STAT_HEIGHT + LED_HEIGHT + 8; // Dbg_Out("add rect1 %i %i %i %i\n",rect.left ,rect.right ,rect.top ,rect.bottom ); InvalidateRect (window, &rect, FALSE); } /* GUI_AddStatRectangle */ /* Added by VVL (Chat) 12/11/99 : Begin */ void GUI_AddTilesRectangle (int x, int y) { int i = 0, j = 0; RECT rect; rect.left = x * STAT_WIDTH; rect.right = STAT_WIDTH * (x + 1); #ifdef SMPF i = 0; j = 0; #else i = 0; #endif rect.top = (MAZE_H + j) * BLOCK_HEIGHT + i * STAT_HEIGHT + LED_HEIGHT + 8; rect.bottom = (MAZE_H + j) * BLOCK_HEIGHT + (i + 1) * STAT_HEIGHT + LED_HEIGHT + 8; // Dbg_Out("add rect1 %i %i %i %i\n",rect.left ,rect.right ,rect.top ,rect.bottom ); InvalidateRect (window, &rect, FALSE); } /* Added by VVL (Chat) 12/11/99 : End */ /* * library function: InitPixmap * description: creates bitmap for double buffering * parameters: none * return value: 0 on success, -1 on failure; */ XBBool InitPixmap (void) { HDC hdc; /* get device context of window */ hdc = GetDC (window); if (NULL == hdc) { return XBFalse; } /* create device context for drawing */ hdcPix = CreateCompatibleDC (hdc); if (NULL == hdcPix) { return XBFalse; } /* now create compatible bitmap */ pix = CreateCompatibleBitmap (hdc, PIXW, PIXH + SCOREH); if (NULL == pix) { return XBFalse; } /* Load Bitmap for clearing pixmap */ clearPix = ReadCchPixmap (imgPathMisc, imgFileTitle, COLOR_BLACK, COLOR_GRAY_75, COLOR_MIDNIGHT_BLUE); if (NULL == clearPix) { return XBFalse; } /* give back the window device context */ ReleaseDC (window, hdc); return XBTrue; } /* InitPixmap */ /* * */ void FinishPixmap (void) { if (NULL != hdcPix) { DeleteDC (hdcPix); } if (NULL != clearPix) { DeleteObject (clearPix); } if (NULL != pix) { DeleteObject (pix); } } /* FinishPixmap */ /* * */ void GUI_InitFade (XBFadeMode mode, int maxLines) { assert (maxLines <= PIXH + SCOREH); fadeMax = maxLines; fadeStep = FADE_STEP; fadeMode = mode; } /* GUI_InitFade */ /* * */ XBBool GUI_DoFade (void) { HDC hdc; int y, yStep; if (fadeStep <= 0) { return XBFalse; } /* setup lines to draw */ if (fadeStep == FADE_STEP) { y = 0; yStep = FADE_STEP; } else { y = fadeStep; yStep = 2 * fadeStep; } /* prepare drawing */ hdc = GetDC (window); /* draw ... */ if (fadeMode == XBFM_IN) { HGDIOBJ oldPix; oldPix = SelectObject (hdcPix, pix); for (; y < fadeMax; y += yStep) { BitBlt (hdc, 0, y, PIXW, 1, hdcPix, 0, y, SRCCOPY); } SelectObject (hdcPix, oldPix); } else { HGDIOBJ oldPen; HGDIOBJ newPen; if (fadeMode == XBFM_WHITE_OUT) { newPen = GetStockObject (WHITE_PEN); } else { newPen = GetStockObject (BLACK_PEN); } oldPen = SelectObject (hdc, GetStockObject (WHITE_PEN)); for (; y < fadeMax; y += yStep) { MoveToEx (hdc, 0, y, NULL); LineTo (hdc, PIXW - 1, y); } SelectObject (hdc, oldPen); DeleteObject (newPen); } ReleaseDC (window, hdc); /* prepare next step */ fadeStep /= 2; /* that´s all */ return XBTrue; } /* GUI_FadeOut */ /* * end of file w32_pixmap.c */ xblast-2.10.4/w32_pixmap.h0000644000175000017500000000224510372731125014356 0ustar rhondaalfie/* * file w32_pixmap.h - * * $Id: w32_pixmap.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_PIXMAP_H #define _W32_PIXMAP_H #include "w32_common.h" /* * global prototypes */ extern XBBool InitPixmap (void); extern void FinishPixmap (void); extern void ClearRectangles (HDC hdc_dst, HDC hdc_src, RECT * rect, int n_rect); extern void PaintPixmap (HWND); #endif /* * end of file w32_pixmap.h */ xblast-2.10.4/w32_sndsrv.c0000644000175000017500000003434010376071615014400 0ustar rhondaalfie/* * file w32_sndsrv.c - sound library for xblast * * $Id: w32_sndsrv.c,v 1.6 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_sndsrv.h" #include "snd.h" //#include "w32_mm.h" #include "util.h" /* * local macros */ #define WAVE_BUFFER_SIZE 2210 #define NUM_WAVE_HEADERS 4 /* * local types */ typedef struct { SND_Id id; /* the sound's id to refer to it */ const char *name; /* raw samples data file name */ char *samples; /* pointer to samples memory */ size_t length; /* length in samples of the sound */ XBBool repeat; /* repeat flag to play sound endlessly */ XBBool mono; /* mono flag indicating mono sounds */ } SoundInfo; typedef struct _sound_play { struct _sound_play *next; SND_Id id; /* reference to effect */ short left; /* left speaker volume */ short right; /* right speaker volume */ size_t pos; /* current data position */ } SoundItem; typedef struct { HGLOBAL hHdr; WAVEHDR *pHdr; HGLOBAL hBuf; char *pBuf; } HeaderInfo; /* * local variables */ static HWAVEOUT hWaveOut; static SoundItem *playList = NULL; static unsigned idThread; static XBBool finished = XBFalse; static HeaderInfo header[NUM_WAVE_HEADERS]; static short mixBuffer[WAVE_BUFFER_SIZE]; /* wave formats for stereo or mono */ static WAVEFORMATEX waveFormatMono = { WAVE_FORMAT_PCM, 1, 22050, 22050, 1, 8, 0 }; static WAVEFORMATEX waveFormatStereo = { WAVE_FORMAT_PCM, 2, 22050, 44100, 2, 8, 0 }; /* * sound sample table */ static SoundInfo soundInfo[SND_MAX] = { {SND_BAD, "xb_bad", NULL, 0, XBFalse, XBFalse}, /* got a skull */ {SND_DROP, "xb_drop", NULL, 0, XBFalse, XBTrue}, /* dropped a bomb */ {SND_NEWBOMB, "xbnbmb", NULL, 0, XBFalse, XBTrue}, /* got an extra bomb */ {SND_NEWKICK, "xbnkick", NULL, 0, XBFalse, XBTrue}, /* got kick extra */ {SND_NEWPUMP, "xbnpmp", NULL, 0, XBFalse, XBTrue}, /* got pump extra */ {SND_NEWRC, "xbnrc", NULL, 0, XBFalse, XBTrue}, /* got rem. control */ {SND_MOREFIRE, "xbfire", NULL, 0, XBFalse, XBTrue}, /* got more range */ {SND_DEAD, "xb_dead", NULL, 0, XBFalse, XBFalse}, /* player died */ {SND_EXPL, "xb_expl", NULL, 0, XBFalse, XBTrue}, /* normal explosion */ {SND_KICK, "xb_kick", NULL, 0, XBFalse, XBTrue}, /* kick a bomb */ {SND_PUMP, "xb_pump", NULL, 0, XBFalse, XBTrue}, /* pump a bomb */ {SND_OUCH, "xb_ouch", NULL, 0, XBFalse, XBFalse}, /* player lost life */ {SND_INTRO, "xb_intro", NULL, 0, XBFalse, XBFalse}, /* intro fanfare */ {SND_APPL, "xb_appl", NULL, 0, XBFalse, XBFalse}, /* applause */ {SND_APPL2, "xb_app2", NULL, 0, XBFalse, XBFalse}, /* applause */ {SND_BUTT, "xb_butt", NULL, 0, XBFalse, XBTrue}, /* triggered button */ {SND_SHOOT, "xb_shoot", NULL, 0, XBFalse, XBFalse}, /* using rem. ctrl. */ {SND_INVIS, "xb_nvis", NULL, 0, XBFalse, XBFalse}, /* player invisible */ {SND_INVINC, "xb_nvnc", NULL, 0, XBFalse, XBFalse}, /* player invincible */ {SND_NEWTELE, "xbntel", NULL, 0, XBFalse, XBTrue}, /* player got telep. */ {SND_TELE, "xbtele", NULL, 0, XBFalse, XBTrue}, /* player uses tele. */ {SND_INJ, "xbinj", NULL, 0, XBFalse, XBFalse}, /* player got junkie */ {SND_MINIBOMB, "xbmbmb", NULL, 0, XBFalse, XBTrue}, /* small bomb expl. */ {SND_WON, "xb_won", NULL, 0, XBFalse, XBFalse}, /* player won */ {SND_HAUNT, "xb_haunt", NULL, 0, XBFalse, XBFalse}, /* haunting bomb */ {SND_SPIRAL, "xb_spir", NULL, 0, XBFalse, XBTrue}, /* spiral shrinking */ {SND_SPBOMB, "xb_spbmb", NULL, 0, XBFalse, XBTrue}, /* got special bomb */ {SND_SLIDE, "xbslide", NULL, 0, XBFalse, XBTrue}, /* bomb slide sound */ {SND_FINALE, "xbfin", NULL, 0, XBFalse, XBFalse}, /* final fanfare */ {SND_WARN, "xb_warn", NULL, 0, XBFalse, XBFalse}, /* shrink warn sound */ {SND_STUN, "xb_stun", NULL, 0, XBFalse, XBFalse}, /* player stun sound */ {SND_WHIRL, "xb_whrl", NULL, 0, XBTrue, XBFalse}, /* intro whirl */ {SND_COMPOUND, "xb_cmpnd", NULL, 0, XBFalse, XBFalse}, /* compound shrink */ {SND_TELE1, "xbtele1", NULL, 0, XBFalse, XBTrue}, /* teleport start */ {SND_TELE2, "xbtele2", NULL, 0, XBFalse, XBTrue}, /* teleport end */ {SND_HOLY, "xbholy", NULL, 0, XBFalse, XBFalse}, /* holy grail extra */ {SND_ENCLOAK, "xbcloak", NULL, 0, XBFalse, XBTrue}, /* encloak sound */ {SND_DECLOAK, "xbdcloak", NULL, 0, XBFalse, XBTrue}, /* decloak sound */ {SND_FAST, "xbfast", NULL, 0, XBFalse, XBTrue}, /* speed up extra */ {SND_SLOW, "xbslow", NULL, 0, XBFalse, XBTrue}, /* slow down extra */ {SND_SLAY, "xbslay", NULL, 0, XBFalse, XBTrue}, /* slay extra */ {SND_LIFE, "xblife", NULL, 0, XBFalse, XBTrue}, /* extra life */ {SND_NEWCLOAK, "xbcloakx", NULL, 0, XBFalse, XBTrue}, /* new cloak extra */ {SND_BOMBMORPH, "xb_bombmorph", NULL, 0, XBFalse, XBTrue}, /* bomb morph */ {SND_STEP1, "xbstep1", NULL, 0, XBFalse, XBTrue}, /* steps #1 */ {SND_STEP2, "xbstep2", NULL, 0, XBFalse, XBTrue}, /* steps #2 */ {SND_STEP3, "xbstep3", NULL, 0, XBFalse, XBTrue}, /* steps #3 */ {SND_STEP4, "xbstep4", NULL, 0, XBFalse, XBTrue}, /* steps #4 */ {SND_STEP5, "xbstep5", NULL, 0, XBFalse, XBTrue}, /* steps #5 */ {SND_STEP6, "xbstep6", NULL, 0, XBFalse, XBTrue}, /* steps #6 */ {SND_SNG1, "xbsng1", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #1 */ {SND_SNG2, "xbsng2", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #2 */ {SND_SNG3, "xbsng3", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #3 */ {SND_SNG4, "xbsng4", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #4 */ {SND_SNG5, "xbsng5", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #5 */ {SND_SNG6, "xbsng6", NULL, 0, XBTrue, XBFalse}, /* Backgr. song #6 */ }; /* * check waveout capabilities */ XBBool SoundCheckWaveOut (XBBool stereo) { WAVEFORMATEX *pFormat = stereo ? &waveFormatStereo : &waveFormatMono; if (0 == waveOutOpen (NULL, WAVE_MAPPER, pFormat, 0, 0, WAVE_FORMAT_QUERY)) { return XBTrue; } else { return XBFalse; } } /* CheckWaveOut */ /* * Callback for audio device */ void PASCAL _export WaveProc (HWAVE hWave, UINT msg, unsigned inst, unsigned par1, unsigned par2) { /* assert (hWave == hWaveOut); */ switch (msg) { case MM_WOM_DONE: PostThreadMessage (idThread, MSG_XBLAST_SOUND_DONE, 0, par1); break; case MM_WOM_CLOSE: PostThreadMessage (idThread, MSG_XBLAST_SOUND_CLOSE, 0, 0); break; } } /* WaveProc */ /* * initialize waveform headers */ static XBBool InitHeader (HeaderInfo * header) { static XBBool first = XBTrue; assert (NULL != header); /* header */ header->hHdr = GlobalAlloc (GMEM_MOVEABLE, sizeof (WAVEHDR)); assert (header->hHdr != NULL); header->pHdr = GlobalLock (header->hHdr); assert (header->pHdr != NULL); memset (header->pHdr, 0, sizeof (WAVEHDR)); /* data */ header->hBuf = GlobalAlloc (GMEM_MOVEABLE, WAVE_BUFFER_SIZE); assert (header->hBuf != NULL); header->pBuf = GlobalLock (header->hBuf); assert (header->pBuf != NULL); memset (header->pBuf, 0x80, WAVE_BUFFER_SIZE); /* set header data */ header->pHdr->lpData = header->pBuf; header->pHdr->dwBufferLength = WAVE_BUFFER_SIZE; /* Prepare and Write header */ if (0 != waveOutPrepareHeader (hWaveOut, header->pHdr, sizeof (WAVEHDR))) { printf ("prepare header failed\n"); return XBFalse; } if (0 != waveOutWrite (hWaveOut, header->pHdr, sizeof (WAVEHDR))) { printf ("write failed\n"); return XBFalse; } first = !first; return XBTrue; } /* InitHeader */ /* * */ static void FinishHeader (HeaderInfo * header) { assert (header != NULL); if (NULL != header->hBuf) { GlobalUnlock (header->hBuf); GlobalFree (header->hBuf); header->hBuf = NULL; header->pBuf = NULL; } if (NULL != header->hHdr) { GlobalUnlock (header->hHdr); GlobalFree (header->hHdr); header->hHdr = NULL; header->pHdr = NULL; } } /* FinishHeader */ /* * Add single sound to buffer */ XBBool AddSound (short *buf, SoundItem * ptr) { size_t i; size_t nBytes; size_t totalBytes = 0; char *src; assert (NULL != buf); assert (NULL != ptr); assert (SND_MAX >= ptr->id); assert (NULL != soundInfo[ptr->id].samples); if (soundInfo[ptr->id].mono) { /* * 1 channel 8 bits source */ /* number of bytes to add */ if (soundInfo[ptr->id].length - ptr->pos > WAVE_BUFFER_SIZE / 2) { nBytes = WAVE_BUFFER_SIZE / 2; } else { nBytes = soundInfo[ptr->id].length - ptr->pos; } /* add on both channels */ src = soundInfo[ptr->id].samples + ptr->pos; for (i = 0; i < nBytes; i++) { buf[2 * i] += ptr->left * src[i]; buf[2 * i + 1] += ptr->right * src[i]; } ptr->pos += nBytes; } else { /* * 2 channel 8 bits source */ do { /* number of bytes to add */ if (soundInfo[ptr->id].length - ptr->pos > WAVE_BUFFER_SIZE - totalBytes) { nBytes = WAVE_BUFFER_SIZE - totalBytes; } else { nBytes = soundInfo[ptr->id].length - ptr->pos; } /* add on both channels */ src = soundInfo[ptr->id].samples + ptr->pos; for (i = 0; i < nBytes; i++) { buf[i + totalBytes] += ptr->left * src[i]; } ptr->pos += nBytes; if (soundInfo[ptr->id].repeat) { totalBytes += nBytes; if (ptr->pos == soundInfo[ptr->id].length) { ptr->pos = 0; } } else { totalBytes = WAVE_BUFFER_SIZE; } } while (totalBytes < WAVE_BUFFER_SIZE); } return (ptr->pos < soundInfo[ptr->id].length); } /* AddSound */ /* * one buffer is finished do it again */ static void SoundDone (const WAVEHDR * hdr) { int i, j; SoundItem *list = NULL; SoundItem *play, *next; char *dst; short *src; short val; /* find header */ for (i = 0; i < NUM_WAVE_HEADERS; i++) { if (header[i].pHdr == hdr) { break; } } if (i >= NUM_WAVE_HEADERS) { fprintf (stderr, "failed to identify header\n"); return; } /* clean up */ if (0 != waveOutUnprepareHeader (hWaveOut, header[i].pHdr, sizeof (WAVEHDR))) { return; } /* add sound effects */ if (NULL == playList) { memset (header[i].pBuf, 0x80, WAVE_BUFFER_SIZE); } else { memset (mixBuffer, 0x00, 2 * WAVE_BUFFER_SIZE); for (play = playList; play != NULL; play = next) { next = play->next; if (AddSound (mixBuffer, play)) { /* continue with this sound */ play->next = list; list = play; } else { /* no longer play this sound */ free (play); } } playList = list; /* copy to waveout buffer */ src = mixBuffer; dst = header[i].pBuf; for (j = 0; j < WAVE_BUFFER_SIZE; j++) { val = src[j] / 16 + 128; if (val < 0) { dst[j] = 0; } else if (val > 255) { dst[j] = (unsigned char)255; } else { dst[j] = (unsigned char)val; } } } /* write it again */ if (!finished) { if (0 != waveOutPrepareHeader (hWaveOut, header[i].pHdr, sizeof (WAVEHDR))) { printf ("prepare header failed\n"); return; } if (0 != waveOutWrite (hWaveOut, header[i].pHdr, sizeof (WAVEHDR))) { printf ("write failed\n"); return; } } } /* SoundDone */ /* * add this sound to play list */ static void SoundPlay (SND_Id id, short left, short right) { SoundItem *ptr; /* 1. search for same entry with offset 0 */ for (ptr = playList; ptr != NULL; ptr = ptr->next) { if (ptr->id == id && ptr->pos == 0) { break; } } /* 2. if no one was found create new one */ if (NULL == ptr) { ptr = calloc (1, sizeof (SoundItem)); assert (NULL != ptr); ptr->id = id; ptr->next = playList; playList = ptr; } /* 3. add own amplitudes */ ptr->left += left; ptr->right += right; } /* SoundPlay */ /* * remove this sound to play list */ static void SoundStop (SND_Id id) { SoundItem *list = NULL; SoundItem *ptr, *next; /* delete all sounds of given type */ for (ptr = playList; ptr != NULL; ptr = next) { next = ptr->next; if (ptr->id == id) { free (ptr); } else { ptr->next = list; list = ptr; } } playList = list; } /* SoundStop */ /* * unload sound */ static void SoundLoad (SND_Id id, char *samples) { assert (soundInfo[id].id == id); if (NULL != soundInfo[id].samples) { free (soundInfo[id].samples); } soundInfo[id].samples = samples; } /* SoundUnload */ /* * shutdown wave output */ static void SoundShutdown () { int i; finished = XBTrue; waveOutReset (hWaveOut); waveOutClose (hWaveOut); hWaveOut = NULL; for (i = 0; i < NUM_WAVE_HEADERS; i++) { FinishHeader (header + i); } } /* SoundShutdown */ /* * thread start function */ DWORD PASCAL _export SoundThreadStereo (void *par) { int i; MSG msg; /* get own id */ idThread = GetCurrentThreadId (); /* open device */ if (0 != waveOutOpen (&hWaveOut, WAVE_MAPPER, &waveFormatStereo, (DWORD) WaveProc, 0, CALLBACK_FUNCTION)) { fprintf (stderr, "failed to open waveout device\n"); return 0; } /* initialize two wave headers */ for (i = 0; i < NUM_WAVE_HEADERS; i++) { if (!InitHeader (header + i)) { fprintf (stderr, "failed to init waveout headers\n"); return 0; } } /* wait for messages */ while (GetMessage (&msg, NULL, MSG_XBLAST_SOUND_FIRST, MSG_XBLAST_SOUND_LAST)) { switch (msg.message) { case MSG_XBLAST_SOUND_DONE: SoundDone ((WAVEHDR *) msg.lParam); break; case MSG_XBLAST_SOUND_PLAY: SoundPlay ((SND_Id) msg.wParam, (short)LOWORD (msg.lParam), (short)HIWORD (msg.lParam)); break; case MSG_XBLAST_SOUND_STOP: SoundStop ((SND_Id) msg.wParam); break; case MSG_XBLAST_SOUND_LOAD: SoundLoad ((SND_Id) msg.wParam, (char *)msg.lParam); break; case MSG_XBLAST_SOUND_SHUTDOWN: SoundShutdown (); break; case MSG_XBLAST_SOUND_CLOSE: /* TODO clean up */ hWaveOut = NULL; return 1; } } return 1; } /* SoundThreadStereo */ /* * load a sound file from disk */ char * SoundLoadFile (SND_Id id) { assert (soundInfo[id].id == id); return ReadRawFile ("sounds", soundInfo[id].name, &soundInfo[id].length); } /* SoundLoad */ /* * end of file w32_sndsrv.c */ xblast-2.10.4/w32_sndsrv.h0000644000175000017500000000306010372731125014373 0ustar rhondaalfie/* * file w32_sndsrv.c - sound library for xblast * * $Id: w32_sndsrv.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_SNDSRV_H #define _W32_SNDSRV_H #include "w32_common.h" #include "snd.h" /* * global macros */ #define MSG_XBLAST_SOUND_DONE WM_USER #define MSG_XBLAST_SOUND_PLAY (WM_USER+1) #define MSG_XBLAST_SOUND_STOP (WM_USER+2) #define MSG_XBLAST_SOUND_LOAD (WM_USER+3) #define MSG_XBLAST_SOUND_SHUTDOWN (WM_USER+4) #define MSG_XBLAST_SOUND_CLOSE (WM_USER+5) #define MSG_XBLAST_SOUND_FIRST WM_USER #define MSG_XBLAST_SOUND_LAST (WM_USER+5) /* * global prototypes */ extern XBBool SoundCheckWaveOut (XBBool stereo); extern DWORD PASCAL _export SoundThreadStereo (void *); extern char *SoundLoadFile (SND_Id id); #endif /* * end of file w32_sndsrv.h */ xblast-2.10.4/w32_socket.c0000644000175000017500000006032010376071615014346 0ustar rhondaalfie/* * file w32_socket.c - true bsd sockets for xblast * * $Id: w32_socket.c,v 1.13 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #define __USE_W32_SOCKETS #include #include #include "socket.h" #include "w32_socket.h" #include "w32_event.h" #include "str_util.h" #include "com.h" #include "gui.h" /* * local constants */ #define LISTENQ 5 /* needed winsock version */ #define WINSOCK_VERSION (MAKEWORD (2, 0)) /* maximum number of sockets in map */ #define MAX_SOCKET 64 /* interface detection modes */ #define XBIF_MS 0x01 #define XBIF_MOD 0x02 /* * type definitions */ /* socket address */ typedef struct _xb_socket_address { int len; /* allocated length */ struct sockaddr *addr; /* protocol dependent data */ } XBSocketAddress; /* socket data */ struct _xb_socket { SOCKET fd; /* file descriptor */ XBSocketAddress sock; /* local address */ XBSocketAddress peer; /* remote address */ XBBool read; /* read flag */ XBBool write; /* write flag */ XBBool shutdown; /* shutdown flag */ }; /* list of all sockets */ typedef struct { size_t num; SOCKET fd[MAX_SOCKET]; const XBSocket *socket[MAX_SOCKET]; } XBSocketMap; /* modified sockaddr_gen, to deal with winsock bug */ typedef union sockaddr_genk { struct sockaddr address; struct sockaddr_in addressIn; struct sockaddr_in6 addressIn6; } sockaddr_genk; /* modified INTERFACE_INFO using the modified sockaddr_gen */ typedef struct _interface_info_mod { u_long iiFlags; /* Interface flags */ sockaddr_genk iiAddress; /* Interface address */ sockaddr_genk iiBroadcastAddress; /* Broadcast address */ sockaddr_genk iiNetmask; /* Network mask */ } INTERFACE_INFO_MOD; /* both INTERFACE_INFO versions */ typedef union { INTERFACE_INFO ms; INTERFACE_INFO_MOD mod; } XB_INTERFACE_INFO; /* * local variables */ static XBSocketMap socketMap; /* socket list */ static XBSocketInterface *inter = NULL; /* interface list */ static size_t numInter = 0; /* number of interfaces */ static short modeflags = 0; /* interface detection mode */ /*************** * local stuff * ***************/ /**/ static void AsyncSelect (const XBSocket * pSocket); /* * delete list with all interfaces */ static void DeleteInterfaces (void) { if (NULL != inter) { size_t i; for (i = 0; i < numInter; i++) { if (NULL != inter[i].name) { free (inter[i].name); } if (NULL != inter[i].addrDevice) { free (inter[i].addrDevice); } if (NULL != inter[i].addrBroadcast) { free (inter[i].addrBroadcast); } } free (inter); } inter = NULL; numInter = 0; } /* DeleteInterfaces */ /* * get inet address from string, host byte order */ static unsigned long GetAddressInet (const char *hostName) { long addr; struct hostent *serverEnt; assert (hostName != NULL); /* check if ip string */ if (-1L != (addr = inet_addr (hostName))) { return ntohl (addr); } /* lookup hostname if not an ip string */ if (NULL != (serverEnt = gethostbyname (hostName))) { return ntohl (*(long *)serverEnt->h_addr_list[0]); } /* lookup failed */ return 0L; } /* GetAddressInet */ /*************************** * general socket managing * ***************************/ /* * initialize winsock */ XBBool Socket_Init (void) { WSADATA wsaData; memset (&socketMap, 0, sizeof (XBSocketMap)); if (0 != WSAStartup (WINSOCK_VERSION, &wsaData)) { GUI_ErrorMessage ("winsock startup failed - unknown version\n"); return XBFalse; } if (wsaData.wVersion != WINSOCK_VERSION) { GUI_ErrorMessage ("winsock startup failed - wrong version (2.0 required)\n"); WSACleanup (); return XBFalse; } return XBTrue; } /* Socket_Init */ /* * add socket to list */ static void SocketMapAdd (XBSocketMap * map, const XBSocket * pSocket) { assert (NULL != socket); assert (NULL != map); assert (map->num < MAX_SOCKET); Dbg_Socket ("add fd=%u at map position #%u\n", pSocket->fd, map->num); map->fd[map->num] = pSocket->fd; map->socket[map->num] = pSocket; map->num++; } /* SocketMapAdd */ /* * subtract socket from set */ static void SocketMapSubtract (XBSocketMap * map, const XBSocket * pSocket) { size_t i; assert (NULL != socket); assert (NULL != map); assert (map->num > 0); for (i = 0; i < map->num; i++) { if (map->socket[i] == pSocket) { Dbg_Socket ("sub fd=%u from map pos #%u (total %u)\n", pSocket->fd, i, map->num); map->num--; if (i < map->num) { map->fd[i] = map->fd[map->num]; map->socket[i] = map->socket[map->num]; } } } } /* SocketMapSubtract */ /* * find socket to fd */ static const XBSocket * SocketMapFind (XBSocketMap * map, SOCKET fd) { size_t i; assert (NULL != socket); assert (NULL != map); for (i = 0; i < map->num; i++) { if (map->fd[i] == fd) { return map->socket[i]; } } return NULL; } /* SocketMapFind */ /* * shutdown winsock */ void Socket_Finish (void) { Dbg_Socket ("shutting down winsock\n"); DeleteInterfaces (); WSACleanup (); } /* Socket_Finish */ /*************** * socket data * ***************/ /* * return file descriptor for socket */ int Socket_Fd (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->fd; } /* Socket_Fd */ /* * return adress family for socket */ int Socket_Family (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->sock.addr->sa_family; } /* Socket_Family */ /* * get host name of client */ const char * Socket_HostName (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); /* determine address struct */ sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); /* reconstruct address */ inetAddr = (struct sockaddr_in *)sa->addr; return inet_ntoa (inetAddr->sin_addr); } /* Socket_HostName */ /* * get port of host */ unsigned Socket_HostPort (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); /* determine address struct */ sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); /* reconstruct port */ inetAddr = (struct sockaddr_in *)sa->addr; return ntohs (inetAddr->sin_port); } /* Socket_HostPort */ /******************* * socket creation * ******************* /* * create socket structure */ XBSocket * Socket_Alloc (int family) { int len; XBSocket *pSocket; /* require AF_INET family */ switch (family) { case AF_INET: len = sizeof (struct sockaddr_in); break; default: Dbg_Socket ("AF_INET family required, socket not created\n"); return NULL; } /* alloc socket data structure */ pSocket = calloc (1, sizeof (XBSocket)); assert (NULL != pSocket); pSocket->fd = -1; pSocket->read = XBFalse; pSocket->write = XBFalse; pSocket->shutdown = XBFalse; /* out address */ pSocket->sock.len = len; pSocket->sock.addr = calloc (1, len); assert (NULL != pSocket->sock.addr); pSocket->sock.addr->sa_family = family; /* other addresse */ pSocket->peer.len = len; pSocket->peer.addr = calloc (1, len); assert (NULL != pSocket->peer.addr); pSocket->peer.addr->sa_family = family; /* that's all */ return pSocket; } /* Socket_Alloc */ /* * free socket structure memory */ void Socket_Free (XBSocket * pSocket) { assert (NULL != pSocket); if (NULL != pSocket->sock.addr) { free (pSocket->sock.addr); } if (NULL != pSocket->peer.addr) { free (pSocket->peer.addr); } free (pSocket); } /* Socket_Free */ /* * set socket adress */ XBBool Socket_SetAddressInet (XBSocket * pSocket, XBBool peer, const char *hostName, unsigned short port) { XBSocketAddress *sa; unsigned long addr; struct sockaddr_in *serverAddr; assert (NULL != pSocket); /* determine address structure to set */ sa = peer ? &pSocket->peer : &pSocket->sock; /* get address in host byte order */ if (NULL != hostName) { if (0 == (addr = GetAddressInet (hostName))) { Dbg_Socket ("failed to set address %s:%u for fd=%u\n", hostName, port, pSocket->fd); return XBFalse; } } else { addr = INADDR_ANY; } /* now set the address */ assert (NULL != sa); memset (sa->addr, 0, sa->len); serverAddr = (struct sockaddr_in *)sa->addr; serverAddr->sin_family = AF_INET; serverAddr->sin_addr.s_addr = htonl (addr); serverAddr->sin_port = htons (port); Dbg_Socket ("set %s address %s:%u for fd=%u\n", peer ? "remote" : "local", hostName, port, pSocket->fd); return XBTrue; } /* Socket_SetAddressInet */ /* * set broadcast option for socket */ XBBool Socket_SetBroadcast (XBSocket * pSocket, XBBool enable) { BOOL flag = enable ? TRUE : FALSE; assert (NULL != pSocket); return (0 == setsockopt (pSocket->fd, SOL_SOCKET, SO_BROADCAST, (void *)&flag, sizeof (flag))); } /* Socket_SetBroadcast */ /* * set socket option reuse */ XBBool Socket_SetReuse (XBSocket * pSocket) { #if 0 /* TODO: implement for windows */ int so_reuseaddr = 1; if (-1 == setsockopt (pSocket->fd, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof (so_reuseaddr))) { return XBFalse; } /* that's all */ #endif return XBTrue; } /* Socket_SetReuse */ /* * register read socket for event handling */ void Socket_RegisterRead (XBSocket * pSocket) { assert (NULL != pSocket); if (!pSocket->read) { pSocket->read = XBTrue; AsyncSelect (pSocket); } } /* Socket_RegisterRead */ /* * register read socket for event handling */ void Socket_RegisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (!pSocket->write) { pSocket->write = XBTrue; AsyncSelect (pSocket); } } /* Socket_RegisterWrite */ /* * register read socket for event handling */ void Socket_UnregisterRead (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->read) { pSocket->read = XBFalse; AsyncSelect (pSocket); } } /* Socket_UnregisterRead */ /* * register read socket for event handling */ void Socket_UnregisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->write) { pSocket->write = XBFalse; AsyncSelect (pSocket); } } /* Socket_UnregisterWrite */ /************* * BSD calls * ************* /* * open socket */ XBBool Socket_Open (XBSocket * pSocket, int type) { assert (pSocket != NULL); /* request a socket from system */ if (-1 == (pSocket->fd = socket (pSocket->sock.addr->sa_family, type, 0))) { #ifndef WMS Dbg_Socket ("failed to open socket of type=%i, err=%u\n", type, WSAGetLastError ()); #endif pSocket->shutdown = XBTrue; return XBFalse; } SocketMapAdd (&socketMap, pSocket); Dbg_Socket ("open socket fd=%u (type=%i)\n", pSocket->fd, type); return XBTrue; } /* Socket_Open */ /* * close socket */ void Socket_Close (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd >= 0) { if (!pSocket->shutdown) { SocketMapSubtract (&socketMap, pSocket); pSocket->shutdown = XBTrue; } closesocket (pSocket->fd); Dbg_Socket ("socket fd=%u closed\n", pSocket->fd); } } /* Socket_Close */ /* * close write access */ void Socket_ShutdownWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd >= 0) { if (!pSocket->shutdown) { SocketMapSubtract (&socketMap, pSocket); pSocket->shutdown = XBTrue; } shutdown (pSocket->fd, SD_SEND); Dbg_Socket ("socket fd=%u shutdown write\n", pSocket->fd); } } /* Socket_ShutdownWrite */ /* * connect a socket */ XBBool Socket_Connect (XBSocket * pSocket) { assert (pSocket != NULL); /* connect */ if (-1 == connect (pSocket->fd, pSocket->peer.addr, pSocket->peer.len)) { #ifndef WMS Dbg_Socket ("failed to connect socket fd=%u to %s:%u, err=%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue), WSAGetLastError ()); #endif return XBFalse; } /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { #ifndef WMS Dbg_Socket ("failed to get local address of socket fd=%u after connecting, err=%u\n", pSocket->fd, WSAGetLastError ()); #endif return XBFalse; } Dbg_Socket ("socket fd=%u connected to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); return XBTrue; } /* Socket_Connect */ /* * bind a socket */ XBBool Socket_Bind (XBSocket * pSocket) { /* bind to port */ if (-1 == bind (pSocket->fd, pSocket->sock.addr, pSocket->sock.len)) { #ifndef WMS Dbg_Socket ("failed to bind socket fd=%u, err=%u\n", pSocket->fd, WSAGetLastError ()); #endif return XBFalse; } /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { #ifndef WMS Dbg_Socket ("failed to get local address of socket fd=%u after binding, err=%u\n", pSocket->fd, WSAGetLastError ()); #endif return XBFalse; } Dbg_Socket ("socket fd=%u bound to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); /* that's all */ return XBTrue; } /* Socket_Bind */ /* * accept a socket */ XBBool Socket_Accept (XBSocket * pSocket, const XBSocket * pListen) { assert (pSocket != NULL); assert (pListen != NULL); /* try to accept */ if (-1 == (pSocket->fd = accept (pListen->fd, pSocket->peer.addr, (void *)&pSocket->peer.len))) { #ifndef WMS Dbg_Socket ("failed to accept from socket fd=%u, err=%u\n", pListen->fd, WSAGetLastError ()); #endif return XBFalse; } /* now retrieve local adress */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { #ifndef WMS Dbg_Socket ("failed to get local address from accepted socket fd=%u, err=%u\n", pListen->fd, WSAGetLastError ()); #endif return XBFalse; } /* add the new socket */ SocketMapAdd (&socketMap, pSocket); Dbg_Out ("accepted socket %d from socket fd=%u\n", pSocket->fd, pListen->fd); /* that's all */ return XBTrue; } /* Socket_Accept */ /* * create listen socket */ XBBool Socket_Listen (XBSocket * pSocket) { assert (pSocket != NULL); /* now listen for client to connect */ if (0 != listen (pSocket->fd, LISTENQ)) { #ifndef WMS Dbg_Socket ("failed to listen on socket fd=%u (%s:%u), err=%u\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse), WSAGetLastError ()); #endif return XBFalse; } Dbg_Socket ("listening on socket fd=%u (%s:%u)\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBTrue; } /* Socket_Listen */ /* * write to socket, non blocking i/o assumed */ int Socket_Send (const XBSocket * pSocket, const void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to write */ result = send (pSocket->fd, buf, len, 0); if (result < 0) { int err = WSAGetLastError (); if (err == WSAEWOULDBLOCK) { Dbg_Socket ("send on fd=%d would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Out ("send error %d on fd=%u\n", err, pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Send */ /* * write to socket, given target, non blocking i/o assumed */ int Socket_SendTo (XBSocket * pSocket, const void *buf, size_t len, const char *host, unsigned short port) { int result; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* convert destination adress */ if (!Socket_SetAddressInet (pSocket, XBTrue, host, port)) { Dbg_Socket ("failed to send on fd=%u - failed to resolve %s:%u", pSocket->fd, host, port); return -1; } /* now try to write data */ result = sendto (pSocket->fd, buf, len, 0, pSocket->peer.addr, pSocket->peer.len); if (result < 0) { int err = WSAGetLastError (); if (err == WSAEWOULDBLOCK) { Dbg_Socket ("sendto on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Out ("sendto error on fd=%u\n", err); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u to %s:%u\n", result, pSocket->fd, host, port); return result; } /* Socket_SendTo */ /* * read from socket */ int Socket_Receive (const XBSocket * pSocket, void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to read */ result = recv (pSocket->fd, buf, len, 0); if (result < 0) { int err = WSAGetLastError (); if (err == WSAEWOULDBLOCK) { Dbg_Out ("receive on fd=%u would block\n", pSocket->fd); if (pSocket->read) { AsyncSelect (pSocket); } return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receive error %u on fd=%u\n", err, pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("received %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Receive */ /* * read from socket, get sender */ int Socket_ReceiveFrom (XBSocket * pSocket, void *buf, size_t len, const char **host, unsigned short *port) { long numRead; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* try to read */ numRead = recvfrom (pSocket->fd, buf, len, 0, pSocket->peer.addr, &pSocket->peer.len); if (numRead >= 0) { *host = Socket_HostName (pSocket, XBTrue); *port = Socket_HostPort (pSocket, XBTrue); } else { int err = WSAGetLastError (); *host = NULL; *port = 0; if (err == WSAEWOULDBLOCK) { Dbg_Socket ("socket receivefrom on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receivefrom error %u on fd=%u\n", err, pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("received %u bytes on fd=%u from %s:%u\n", numRead, pSocket->fd, *host, *port); return numRead; } /* Net_ReceiveFrom */ /***************** * socket events * *****************/ /* * handle selection events, needed in w32_event.c */ void HandleSelect (UINT wParam, LONG lParam) { SOCKET fd = wParam; UINT event = WSAGETSELECTEVENT (lParam); const XBSocket *pSocket; switch (event) { case FD_READ: case FD_ACCEPT: case FD_CLOSE: Dbg_Socket ("socket fd=%u readable\n", fd); CommReadable (fd); break; case FD_WRITE: Dbg_Socket ("socket fd=%u writeable\n", fd); CommWriteable (fd); if (NULL != (pSocket = SocketMapFind (&socketMap, fd)) && pSocket->write) { AsyncSelect (pSocket); } break; default: Dbg_Socket ("unknown select event %04x\n", event); break; } } /* HandleSelect */ /* * trigger async select */ static void AsyncSelect (const XBSocket * pSocket) { long event = 0; assert (NULL != pSocket); Dbg_Socket ("async select on fd=%u, flags=%c%c\n", pSocket->fd, pSocket->read ? 'R' : '-', pSocket->write ? 'W' : '-'); if (pSocket->read) { event |= (FD_READ | FD_ACCEPT | FD_CLOSE); } if (pSocket->write) { event |= FD_WRITE; } WSAAsyncSelect (pSocket->fd, window, MSG_XBLAST_SELECT, event); } /* AsyncSelect */ /************** * interfaces * **************/ /* * get all available interfaces */ const XBSocketInterface * Socket_GetInterfaces (size_t * num) { SOCKET fd = SOCKET_ERROR; DWORD nr, len; SOCKADDR_IN *pAddrInet = NULL; SOCKADDR_IN *pAddrNetmask = NULL; SOCKADDR_IN *pAddrBroadcast = NULL; u_long iFlags = 0; void *info = NULL; INTERFACE_INFO *ii = NULL; INTERFACE_INFO_MOD *iimod = NULL; DWORD iLen = 10; /* clean up */ DeleteInterfaces (); /* get test udp socket for interface detection */ if (SOCKET_ERROR == (fd = socket (AF_INET, SOCK_DGRAM, 0))) { Dbg_Socket ("failed to open udp socket for interface detection\n"); goto Error; } /* allocate space for iLen interfaces */ info = calloc (iLen, sizeof (XB_INTERFACE_INFO)); assert (NULL != info); /* start scanning */ Dbg_Socket ("guessing %u interfaces\n", iLen); while (SOCKET_ERROR == WSAIoctl (fd, SIO_GET_INTERFACE_LIST, NULL, 0, info, iLen * sizeof (XB_INTERFACE_INFO), &len, NULL, NULL)) { if (WSAEFAULT != WSAGetLastError ()) { Dbg_Socket ("ioctl failed, err=%u\n", WSAGetLastError ()); goto Error; } /* more space needed */ free (info); iLen += 10; info = calloc (iLen, sizeof (XB_INTERFACE_INFO)); assert (NULL != info); Dbg_Socket ("increasing guess to %u\n", iLen); } /* determine interface count */ modeflags |= XBIF_MS & (len % sizeof (INTERFACE_INFO) == 0); modeflags |= XBIF_MOD & (len % sizeof (INTERFACE_INFO_MOD) == 0); switch (modeflags) { case XBIF_MS: len /= sizeof (INTERFACE_INFO); Dbg_Socket ("using MS mode!\n"); break; case XBIF_MOD: len /= sizeof (INTERFACE_INFO_MOD); Dbg_Socket ("using modified MS mode!\n"); break; default: *num = 0; Dbg_Socket ("no matching mode, interface detection unreliable!\n"); goto Error; } Dbg_Socket ("interfaces detected = %u\n", len); /* allocate output buffer */ inter = calloc (len, sizeof (XBSocketInterface)); assert (NULL != inter); Dbg_Socket ("allocated %u interface descriptions\n", len); /* create interface list */ numInter = 0; for (nr = 0; nr < len; nr++) { Dbg_Out ("### interface %u ###\n", nr); /* get flags and addresses */ switch (modeflags) { case XBIF_MS: ii = (INTERFACE_INFO *) info; pAddrInet = (SOCKADDR_IN *) & ii[nr].iiAddress; pAddrNetmask = (SOCKADDR_IN *) & ii[nr].iiNetmask; pAddrBroadcast = (SOCKADDR_IN *) & ii[nr].iiBroadcastAddress; iFlags = ii[nr].iiFlags; break; case XBIF_MOD: iimod = (INTERFACE_INFO_MOD *) info; pAddrInet = (SOCKADDR_IN *) & iimod[nr].iiAddress; pAddrNetmask = (SOCKADDR_IN *) & iimod[nr].iiNetmask; pAddrBroadcast = (SOCKADDR_IN *) & iimod[nr].iiBroadcastAddress; iFlags = iimod[nr].iiFlags; break; default: break; } /* require INET family, up and broadcast */ if (pAddrInet->sin_family == AF_INET && pAddrInet->sin_addr.s_addr != INADDR_ANY && (iFlags & (IFF_UP | IFF_BROADCAST))) { struct in_addr bcAddr = pAddrInet->sin_addr; bcAddr.s_addr |= ~pAddrNetmask->sin_addr.s_addr; /* set interface data */ inter[numInter].name = DupString ("net"); inter[numInter].addrDevice = DupString (inet_ntoa (pAddrInet->sin_addr)); inter[numInter].addrBroadcast = DupString (inet_ntoa (bcAddr)); /* output data */ Dbg_Out ("IP = %s\n", inter[numInter].addrDevice); Dbg_Out ("NET= %s\n", inet_ntoa (pAddrNetmask->sin_addr)); Dbg_Out ("GBC= %s\n", inet_ntoa (pAddrBroadcast->sin_addr)); Dbg_Out ("BC = %s\n", inter[numInter].addrBroadcast); numInter++; } else { /* output interface data */ Dbg_Out ("IP = %s\n", inet_ntoa (pAddrInet->sin_addr)); Dbg_Out ("NET= %s\n", inet_ntoa (pAddrNetmask->sin_addr)); Dbg_Out ("GBC= %s\n", inet_ntoa (pAddrBroadcast->sin_addr)); Dbg_Out ("skipping interface\n"); } } /* clean up */ free (info); closesocket (fd); /* that's all */ *num = numInter; return inter; Error: if (NULL != info) { free (info); } if (SOCKET_ERROR != fd) { closesocket (fd); } return NULL; } /* Socket_GetInterfaces */ /* * return auto interface for given target and socket */ const char * Socket_GetAutoInterface (XBSocket * pSocket, const char *trg) { SOCKADDR_IN inaddr_trg; SOCKADDR_IN inaddr_if; DWORD ret = 0; const char *ifname; /* construct target address */ inaddr_trg.sin_family = AF_INET; inaddr_trg.sin_addr.s_addr = inet_addr (trg); /* ioctl to get interface address */ if (SOCKET_ERROR == WSAIoctl (pSocket->fd, SIO_ROUTING_INTERFACE_QUERY, &inaddr_trg, sizeof (SOCKADDR_IN), &inaddr_if, sizeof (SOCKADDR_IN), &ret, NULL, NULL)) { Dbg_Socket ("failed to find auto-interface, ioctl error %u\n", WSAGetLastError ()); ifname = NULL; } else { ifname = inet_ntoa (inaddr_if.sin_addr); } return ifname; } /* Socket_GetAutoInterface */ /* * end of file w32_socket.c */ xblast-2.10.4/w32_socket.h0000644000175000017500000000206610372731125014351 0ustar rhondaalfie/* * file w32_socket.h - true bsd sockets for xblast * * $Id: w32_socket.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_W32_SOCKET_H #define XBLAST_W32_SOCKET_H /* * global prototypes */ extern void HandleSelect (UINT wParam, LONG lPAram); #endif /* * end of file w32_socket.h */ xblast-2.10.4/w32_sound.c0000644000175000017500000000752610376071615014217 0ustar rhondaalfie/* * file w32_sound.c - Win32 sound interface for xblast * * $Id: w32_sound.c,v 1.5 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "snd.h" #include "w32_sndsrv.h" /* * local variables */ /* thread for sound playback */ static HANDLE hThread = NULL; static DWORD idThread = 0; /* volume tables for stereo sound */ static short leftVol[MAX_SOUND_POSITION] = { 16, 16, 16, 16, 16, 16, 16, 16, 14, 12, 10, 8, 6, 4, 2, }; static short rightVol[MAX_SOUND_POSITION] = { 2, 4, 6, 8, 10, 12, 14, 16, 16, 16, 16, 16, 16, 16, 16, }; static short beepMode = XBFalse; static short doBeep = XBFalse; /* * start thread for sound playback */ XBBool SND_Init (const CFGSoundSetup * setup) { LPTHREAD_START_ROUTINE threadFunc = NULL; assert (NULL != setup); /* determine mode to use */ switch (setup->mode) { case XBSM_Waveout: /* TODO: program mono support */ if (SoundCheckWaveOut (XBTrue)) { threadFunc = SoundThreadStereo; } beepMode = XBFalse; break; case XBSM_Beep: beepMode = XBTrue; break; case XBSM_None: beepMode = XBFalse; break; default: break; } if (NULL != threadFunc) { hThread = CreateThread (NULL, 0, threadFunc, NULL, 0, &idThread); if (NULL == hThread) { fprintf (stderr, "failed to start thread for sound\n"); return XBFalse; } if (!SetThreadPriority (hThread, THREAD_PRIORITY_TIME_CRITICAL)) { fprintf (stderr, "failed to set priority of thread\n"); } } return XBTrue; } /* SND_Init */ /* * stop to play given sound effect */ XBBool SND_Stop (SND_Id id) { if (0 != idThread) { PostThreadMessage (idThread, MSG_XBLAST_SOUND_STOP, id, 0); } return XBTrue; } /* SND_Stop */ /* * play a given sound */ XBBool SND_Play (SND_Id id, int pos) { if (0 != idThread) { assert (pos >= 0); assert (pos < MAX_SOUND_POSITION); PostThreadMessage (idThread, MSG_XBLAST_SOUND_PLAY, id, MAKELPARAM (leftVol[pos], rightVol[pos])); } else if (beepMode) { if (id == SND_EXPL || id == SND_MINIBOMB) { doBeep = XBTrue; } } return XBTrue; } /* SND_Play */ /* * unload given sound */ XBBool SND_Unload (SND_Id id) { if (0 != idThread) { PostThreadMessage (idThread, MSG_XBLAST_SOUND_LOAD, id, 0); } return XBTrue; } /* SND_Unload */ /* * flushing (not needed in win 32) */ void SND_Flush (void) { if (beepMode && doBeep) { doBeep = XBFalse; MessageBeep (0xFFFFFFFF); } } /* SND_Flush */ /* * close thread etc */ void SND_Finish (void) { if (0 != idThread) { /* send terminate message to thread */ PostThreadMessage (idThread, MSG_XBLAST_SOUND_SHUTDOWN, 0, 0); /* wait for its termination */ WaitForSingleObject (hThread, INFINITE); /* clean up */ CloseHandle (hThread); /* reset values */ idThread = 0; hThread = NULL; } } /* SND_Finish */ /* * */ XBBool SND_Load (SND_Id id) { if (0 != idThread) { PostThreadMessage (idThread, MSG_XBLAST_SOUND_LOAD, id, (DWORD) SoundLoadFile (id)); } return XBTrue; } /* SND_Load */ /* * beep once */ void SND_Beep (void) { MessageBeep (0xFFFFFFFF); } /* SND_Beep */ /* * end of file w32_sound.c */ xblast-2.10.4/w32_sprite.c0000644000175000017500000002720710376071615014373 0ustar rhondaalfie/* * file w32_sprite.c - drawing sprites * * $Id: w32_sprite.c,v 1.4 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_sprite.h" #include "gui.h" #include "w32_pixmap.h" #include "w32_image.h" #include "geom.h" #include "image.h" /* * local variables */ static HDC hdcPix = NULL; static HDC hdcSprite = NULL; static HBITMAP pixBombMask[MAX_BOMBS][MAX_BOMB_ANIME]; static HBITMAP pixBombBits[MAX_BOMBS][MAX_BOMB_ANIME]; static HBITMAP pixExplMask[MAX_EXPLOSION]; static HBITMAP pixExplBits[MAX_EXPLOSION]; static HBITMAP pixEpmSpriteBits[MAX_PLAYER][MAX_ANIME_EPM]; static HBITMAP pixEpmSpriteMask[MAX_PLAYER][MAX_ANIME_EPM]; static HBITMAP pixPpmSpriteBits[MAX_ANIME_PPM]; static HBITMAP pixPpmSpriteMask[MAX_ANIME_PPM]; static HBITMAP pixIconBits[MAX_ICON_SPRITES]; static HBITMAP pixIconMask[MAX_ICON_SPRITES]; /* * */ static void ClipSpriteBitmap (HBITMAP bits, HBITMAP mask, int width, int height) { HBITMAP clip; HGDIOBJ oldSprite; HGDIOBJ oldPix; /* create clipping bitmap */ clip = CreateBitmap (width, height, 1, 1, NULL); assert (clip != NULL); oldPix = SelectObject (hdcPix, clip); oldSprite = SelectObject (hdcSprite, mask); BitBlt (hdcPix, 0, 0, width, height, hdcSprite, 0, 0, NOTSRCCOPY); /* now clip bits */ SelectObject (hdcSprite, bits); BitBlt (hdcSprite, 0, 0, width, height, hdcPix, 0, 0, SRCAND); /* clean up */ SelectObject (hdcSprite, oldSprite); SelectObject (hdcPix, oldPix); DeleteObject (clip); } /* ClipSpriteBitmap */ /* * */ XBBool InitSprites (void) { int i, j; HDC hdc; /* create own device contextes */ hdc = GetDC (window); hdcPix = CreateCompatibleDC (hdc); hdcSprite = CreateCompatibleDC (hdc); ReleaseDC (window, hdc); /* zero all arrays */ memset (pixBombMask, 0, sizeof (pixBombMask)); memset (pixBombBits, 0, sizeof (pixBombBits)); memset (pixExplMask, 0, sizeof (pixExplMask)); memset (pixExplBits, 0, sizeof (pixExplBits)); memset (pixEpmSpriteMask, 0, sizeof (pixEpmSpriteMask)); memset (pixEpmSpriteBits, 0, sizeof (pixEpmSpriteBits)); memset (pixPpmSpriteMask, 0, sizeof (pixPpmSpriteMask)); memset (pixPpmSpriteBits, 0, sizeof (pixPpmSpriteBits)); memset (pixIconMask, 0, sizeof (pixIconMask)); memset (pixIconBits, 0, sizeof (pixIconBits)); /* bomb sprites */ for (i = 0; i < MAX_BOMBS; i++) { for (j = 0; j < MAX_BOMB_ANIME; j++) { pixBombMask[i][j] = ReadPbmBitmap (imgPathExpl, imgFileBomb[i][j]); pixBombBits[i][j] = ReadRgbPixmap (imgPathExpl, imgFileBomb[i][j]); if (NULL == pixBombMask[i][j] || NULL == pixBombBits[i][j]) { return XBFalse; } ClipSpriteBitmap (pixBombBits[i][j], pixBombMask[i][j], BLOCK_WIDTH, BLOCK_HEIGHT); } } /* create explosion sprites */ for (i = 0; i < MAX_EXPLOSION; i++) { pixExplMask[i] = ReadPbmBitmap (imgPathExpl, imgFileExpl[i]); pixExplBits[i] = ReadRgbPixmap (imgPathExpl, imgFileExpl[i]); if (NULL == pixExplMask[i] || NULL == pixExplBits[i]) { return XBFalse; } ClipSpriteBitmap (pixExplBits[i], pixExplMask[i], BLOCK_WIDTH, BLOCK_HEIGHT); } /* load icon sprites */ for (i = 0; i < MAX_ICON_SPRITES; i++) { pixIconMask[i] = ReadPbmBitmap (imgPathMisc, imgFileIcon[i]); pixIconBits[i] = ReadCchPixmap (imgPathMisc, imgFileIcon[i], COLOR_BLACK, (i != ISA_Abort) ? COLOR_SPRING_GREEN : COLOR_RED, COLOR_LIGHT_GOLDENROD); if (NULL == pixIconMask[i] || NULL == pixIconBits[i]) { return XBFalse; } ClipSpriteBitmap (pixIconBits[i], pixIconMask[i], imgRectIcon[i].w, imgRectIcon[i].h); } /* create shared players sprites */ for (j = 0; j < MAX_ANIME_PPM; j++) { pixPpmSpriteBits[j] = ReadRgbPixmap (imgPathSprite, imgFileSpritePpm[j]); pixPpmSpriteMask[j] = ReadPbmBitmap (imgPathSprite, imgFileSpritePpm[j]); if (NULL == pixPpmSpriteBits[j] || NULL == pixPpmSpriteMask[j]) { return XBFalse; } ClipSpriteBitmap (pixPpmSpriteBits[j], pixPpmSpriteMask[j], imgRectSprite[j + MAX_ANIME_EPM].w, imgRectSprite[j + MAX_ANIME_EPM].h); } /* everything is fine */ return XBTrue; } /* InitSprites */ /* * clan up the mess */ void FinishSprites (void) { int i, j; /* bomb sprites */ for (i = 0; i < MAX_BOMBS; i++) { for (j = 0; j < MAX_BOMB_ANIME; j++) { if (NULL != pixBombMask[i][j]) { DeleteObject (pixBombMask[i][j]); } if (NULL != pixBombBits[i][j]) { DeleteObject (pixBombBits[i][j]); } } } /* explosion sprites */ for (i = 0; i < MAX_EXPLOSION; i++) { if (NULL != pixExplMask[i]) { DeleteObject (pixExplMask[i]); } if (NULL != pixExplBits[i]) { DeleteObject (pixExplBits[i]); } } /* player sprites */ for (i = 0; i < MAX_PLAYER; i++) { for (j = 0; j < MAX_ANIME_EPM; j++) { if (NULL != pixEpmSpriteMask[i][j]) { DeleteObject (pixEpmSpriteMask[i][j]); } if (NULL != pixEpmSpriteBits[i][j]) { DeleteObject (pixEpmSpriteBits[i][j]); } } } for (i = 0; i < MAX_ANIME_PPM; i++) { if (NULL != pixPpmSpriteMask[i]) { DeleteObject (pixPpmSpriteMask[i]); } if (NULL != pixEpmSpriteBits[i][j]) { DeleteObject (pixPpmSpriteBits[i]); } } /* icons */ for (i = 0; i < MAX_ICON_SPRITES; i++) { if (NULL != pixIconBits[i]) { DeleteObject (pixIconBits[i]); } if (NULL != pixIconMask[i]) { DeleteObject (pixIconMask[i]); } } /* device contextes */ if (NULL != hdcPix) { DeleteDC (hdcPix); } if (NULL != hdcSprite) { DeleteDC (hdcSprite); } } /* FinishSprites */ /* * load sprites for given player */ XBBool GUI_LoadPlayerSprite (int player, int i, const CFGPlayerGraphics * config) { const char *epmName; assert (player < MAX_PLAYER); assert (i < MAX_ANIME_EPM); assert (config != NULL); /* delete old sprite */ if (NULL != pixEpmSpriteMask[player][i]) { DeleteObject (pixEpmSpriteMask[player][i]); pixEpmSpriteMask[player][i] = NULL; } if (NULL != pixEpmSpriteBits[player][i]) { DeleteObject (pixEpmSpriteBits[player][i]); pixEpmSpriteBits[player][i] = NULL; } /* load sprite */ if (ATOM_INVALID == config->shape) { pixEpmSpriteBits[player][i] = NULL; pixEpmSpriteMask[player][i] = NULL; } else { epmName = ImgFileSpriteEpm (config->shape, i); pixEpmSpriteBits[player][i] = ReadEpmPixmap (imgPathSprite, epmName, NUM_PLAYER_COLORS, &config->helmet); pixEpmSpriteMask[player][i] = ReadPbmBitmap (imgPathSprite, epmName); if (NULL == pixEpmSpriteBits[player][i] || NULL == pixEpmSpriteMask[player][i]) { /* error while loading */ return XBFalse; } ClipSpriteBitmap (pixEpmSpriteBits[player][i], pixEpmSpriteMask[player][i], imgRectSprite[i].w, imgRectSprite[i].h); } return XBTrue; } /* GUI_LoadPlayerSprite */ /* * load sprite for color selector */ void GUI_LoadIconSprite (int index, XBColor color) { assert (index >= 0); assert (index < MAX_COLOR_SPRITES); /* free bitmaps if necessary */ if (NULL != pixIconBits[index]) { DeleteObject (pixIconBits[index]); } if (NULL != pixIconMask[index]) { DeleteObject (pixIconMask[index]); } /* now load it */ pixIconBits[index] = ReadCchPixmap (imgPathMisc, imgFileIcon[index], COLOR_BLACK, color, COLOR_LIGHT_GOLDENROD); pixIconMask[index] = ReadPbmBitmap (imgPathMisc, imgFileIcon[index]); ClipSpriteBitmap (pixIconBits[index], pixIconMask[index], imgRectIcon[index].w, imgRectIcon[index].h); } /* GUI_LoadColorSprite */ /* * draw sprite into pixmap buffer */ static void DrawSprite (const BMRectangle * rect, HBITMAP bits, HBITMAP mask) { HGDIOBJ oldPix; HGDIOBJ oldSprite; assert (rect != NULL); assert (bits != NULL); assert (mask != NULL); oldPix = SelectObject (hdcPix, pix); /* draw mask */ oldSprite = SelectObject (hdcSprite, mask); BitBlt (hdcPix, rect->x, rect->y, rect->w, rect->h, hdcSprite, 0, 0, SRCAND); /* draw bits */ SelectObject (hdcSprite, bits); BitBlt (hdcPix, rect->x, rect->y, rect->w, rect->h, hdcSprite, 0, 0, SRCPAINT); /* finish drawing */ SelectObject (hdcPix, oldPix); SelectObject (hdcSprite, oldSprite); } /* DrawSprite */ /* * draw sprite mask into pixmap buffer */ static void DrawMask (const BMRectangle * rect, HBITMAP mask) { HGDIOBJ oldPix; HGDIOBJ oldSprite; assert (rect != NULL); assert (mask != NULL); oldPix = SelectObject (hdcPix, pix); /* draw mask */ oldSprite = SelectObject (hdcSprite, mask); BitBlt (hdcPix, rect->x, rect->y, rect->w, rect->h, hdcSprite, 0, 0, MERGEPAINT); /* finish drawing */ SelectObject (hdcPix, oldPix); SelectObject (hdcSprite, oldSprite); } /* DrawSprite */ /* * copy explosion sprite into a tile */ void CopyExplosion (HBITMAP pix_tile, int i) { HGDIOBJ oldPix; HGDIOBJ oldSprite; /* prepare drawing */ oldPix = SelectObject (hdcPix, pix_tile); /* draw mask */ oldSprite = SelectObject (hdcSprite, pixExplMask[i]); BitBlt (hdcPix, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT, hdcSprite, 0, 0, SRCAND); /* draw bits */ SelectObject (hdcSprite, pixExplBits[i]); BitBlt (hdcPix, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT, hdcSprite, 0, 0, SRCPAINT); /* finish drawing */ SelectObject (hdcSprite, oldSprite); SelectObject (hdcPix, oldPix); } /* CopyExplosion */ /* * draw explosion as sprite (fopr intro) */ void GUI_DrawExplosionSprite (int x, int y, int block) { BMRectangle rect; assert (block < MAX_EXPLOSION); /* set region */ rect.x = x * BLOCK_WIDTH; rect.y = y * BLOCK_HEIGHT; rect.w = BLOCK_WIDTH; rect.h = BLOCK_HEIGHT; /* draw sprite */ DrawSprite (&rect, pixExplBits[block], pixExplMask[block]); } /* GUI_DrawExplosionSprite */ /* * draw a bomb sprite */ void GUI_DrawBombSprite (const Sprite * ptr) { int bomb = SpriteBomb (ptr); int anime = SpriteAnime (ptr); assert (bomb < MAX_BOMBS); assert (anime < MAX_BOMB_ANIME); if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), pixBombMask[bomb][anime]); } else { DrawSprite (SpriteRectangle (ptr), pixBombBits[bomb][anime], pixBombMask[bomb][anime]); } } /* GUI_DrawBombSprite */ /* * draw a player sprite */ void GUI_DrawPlayerSprite (const Sprite * ptr) { HBITMAP bits; HBITMAP mask; int anime = SpriteAnime (ptr); int player = SpritePlayer (ptr); assert (anime < MAX_ANIME); assert (player < MAX_PLAYER); /* get mask an bitmap */ if (anime >= MAX_ANIME_EPM) { bits = pixPpmSpriteBits[anime - MAX_ANIME_EPM]; mask = pixPpmSpriteMask[anime - MAX_ANIME_EPM]; } else { bits = pixEpmSpriteBits[player][anime]; mask = pixEpmSpriteMask[player][anime]; } /* draw sprite */ if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), mask); } else { DrawSprite (SpriteRectangle (ptr), bits, mask); } } /* GUI_DrawPlayerSprite */ /* * draw color sprite */ void GUI_DrawIconSprite (const Sprite * ptr) { int anime = SpriteAnime (ptr); assert (anime < MAX_ICON_SPRITES); if (!SpriteIsMasked (ptr)) { DrawSprite (SpriteRectangle (ptr), pixIconBits[anime], pixIconMask[anime]); } } /* GUI_DrawColorSprite */ /* * draw textbox sprite */ void GUI_DrawTextSprite (const Sprite * ptr) { GUI_DrawTextbox (SpriteText (ptr), SpriteAnime (ptr), SpriteRectangle (ptr)); } /* GUI_DrawTextSprite */ /* * end of file w32_sprite.c */ xblast-2.10.4/w32_sprite.h0000644000175000017500000000211010372731125014355 0ustar rhondaalfie/* * file w32_sprite.h - * * $Id: w32_sprite.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_SPRITE_H #define _W32_SPRITE_H #include "w32_common.h" /* * global prototypes */ extern XBBool InitSprites (void); extern void FinishSprites (void); extern void CopyExplosion (HBITMAP pix_tile, int i); #endif xblast-2.10.4/w32_text.c0000644000175000017500000002543510376071615014052 0ustar rhondaalfie/* * file w32_text.c - drawing strings and boxes * * $Id: w32_text.c,v 1.5 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_text.h" #include "gui.h" #include "w32_color.h" #include "w32_image.h" #include "geom.h" /* * local macros */ #define COLOR_LIGHT (SET_COLOR(31,29,0)) #define COLOR_DARK (SET_COLOR( 0, 0,0)) /* * local types */ /* pen types */ enum { PEN_LightThick, PEN_LightThin, PEN_DarkThick, PEN_DarkThin, /*---*/ NUM_PEN }; /* brush types */ enum { BRUSH_Light, BRUSH_Dark, /*---*/ NUM_BRUSH }; /* pen init data */ typedef struct { int style; int width; XBColor color; } XBInitPen; /* * local variables */ static HDC hdcLight; static HDC hdcDark; static HPEN hPen[NUM_PEN]; static HBRUSH hBrush[NUM_BRUSH]; static HFONT hfont[NUM_FONTS]; #ifdef MINI_XBLAST static int fontSize[NUM_FONTS] = { 14, 12, 10 }; #else static int fontSize[NUM_FONTS] = { 32, 24, 18 }; #endif static int fontHeight[NUM_FONTS] = { 0, 0, 0 }; static XBInitPen initPen[NUM_PEN] = { {PS_SOLID, 3 * BASE_X / 8, COLOR_LIGHT,}, {PS_SOLID, 1, COLOR_LIGHT,}, {PS_SOLID, 3 * BASE_X / 8, COLOR_DARK,}, {PS_SOLID, 1, COLOR_DARK,}, }; static XBColor initBrush[NUM_BRUSH] = { COLOR_LIGHT, COLOR_DARK, }; /* * create dc for drwaing textbox */ static HDC CreateTextDC (HDC hdc, HPEN hPen, HBRUSH hBrush, XBColor textColor) { HDC hdcText; hdcText = CreateCompatibleDC (hdc); if (NULL == hdcText) { return NULL; } SelectObject (hdcText, hPen); SelectObject (hdcText, hBrush); SetTextColor (hdcText, COLOR_TO_COLORREF (textColor)); SetBkMode (hdcText, TRANSPARENT); SetTextAlign (hdcText, TA_CENTER | TA_TOP); SetPolyFillMode (hdcText, WINDING); /* that's all */ return hdcText; } /* CreateTextDC */ /* * library function: InitText * description: initizialize windows resources for drawingh text * parameters: none * return value: XBTrue on success, XBFalse on error */ XBBool InitText (void) { int i; HDC hdc; HGDIOBJ old; SIZE size; /* initialize fields */ hdcLight = hdcDark = NULL; memset (hPen, 0, sizeof (hPen)); memset (hBrush, 0, sizeof (hBrush)); memset (hfont, 0, sizeof (hfont)); /* create pens */ for (i = 0; i < NUM_PEN; i++) { hPen[i] = CreatePen (initPen[i].style, initPen[i].width, COLOR_TO_COLORREF (initPen[i].color)); } /* create brushes */ for (i = 0; i < NUM_BRUSH; i++) { hBrush[i] = CreateSolidBrush (COLOR_TO_COLORREF (initBrush[i])); } /* create logical fonts */ hdc = GetDC (window); for (i = 0; i < NUM_FONTS; i++) { hfont[i] = CreateFont (fontSize[i], 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, "MS SansSerif"); if (NULL == hfont[i]) { return XBFalse; } /* get default height */ old = SelectObject (hdc, hfont[i]); GetTextExtentPoint32 (hdc, "Xj", 2, &size); SelectObject (hdc, old); fontHeight[i] = size.cy; } /* create and config DC for light text */ hdcLight = CreateTextDC (hdc, hPen[PEN_LightThick], hBrush[BRUSH_Dark], COLOR_LIGHT); /* create and config DC for dark text */ hdcDark = CreateTextDC (hdc, hPen[PEN_DarkThick], hBrush[BRUSH_Light], COLOR_DARK); /* thats's all */ ReleaseDC (window, hdc); return XBTrue; } /* InitText */ /* * */ void FinishText (void) { int i; /* pens */ for (i = 0; i < NUM_PEN; i++) { if (NULL != hPen[i]) { DeleteObject (hPen[i]); } } /* brushes */ for (i = 0; i < NUM_BRUSH; i++) { if (NULL != hBrush[i]) { DeleteObject (hBrush[i]); } } /* fonts */ for (i = 0; i < NUM_FONTS; i++) { if (NULL != hfont[i]) { DeleteObject (hfont[i]); } } /* device contextes */ if (NULL != hdcLight) { DeleteDC (hdcLight); } if (NULL != hdcDark) { DeleteDC (hdcDark); } } /* FinishText */ /* * global function: GUI_DrawSimpleTextbox * description: draw a text string with optional box * parameters: text - 0 terminated string to draw * flags - draw mode flags see xblast.h FF_* rect - where to draw * return value: none */ void GUI_DrawSimpleTextbox (const char *text, unsigned flags, const BMRectangle * rect) { HGDIOBJ old; int len; int ypos; int xpos; HDC hdc; /* sanity checks */ assert (rect != NULL); /* get device context */ hdc = (flags & FM_Color) ? hdcLight : hdcDark; old = SelectObject (hdc, pix); /* draw boxes */ if (flags & FM_Boxed) { Rectangle (hdc, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h); } /* Draw text */ if (text != NULL) { len = strlen (text); ypos = rect->y + (rect->h - fontHeight[flags & FM_Size]) / 2; xpos = rect->x + rect->w / 2; /* x position */ SetTextAlign (hdcLight, TA_CENTER | TA_TOP); SetTextAlign (hdcDark, TA_CENTER | TA_TOP); SelectObject (hdc, hfont[flags & FM_Size]); ExtTextOut (hdc, xpos, ypos, ETO_OPAQUE, NULL, text, len, NULL); } /* clean up */ SelectObject (hdc, old); } /* GUI_DrawSimpleTextbox */ /* * */ static int DrawAlignedText (const char *text, int len, unsigned flags, int x, int y, int w, HDC hdc_fg, HDC hdc_bg, HGDIOBJ * pOld) { SIZE textSize; int xpos; int dx, dy; int step; int right; assert (text != NULL); assert (pOld != NULL); /* Set Font */ SelectObject (hdc_fg, hfont[flags & FM_Size]); /* determine length */ len++; do { len--; GetTextExtentPoint32 (hdc_fg, text, len, &textSize); } while (textSize.cx > w - 2 * BASE_X); /* set text alignment */ switch (flags & FM_Align) { case FF_Right: SetTextAlign (hdc_fg, TA_TOP | TA_RIGHT); SetTextAlign (hdc_bg, TA_TOP | TA_RIGHT); xpos = x + w - BASE_X; right = xpos; break; case FF_Left: SetTextAlign (hdc_fg, TA_TOP | TA_LEFT); SetTextAlign (hdc_bg, TA_TOP | TA_LEFT); xpos = x + BASE_X; right = xpos + textSize.cx; break; default: SetTextAlign (hdc_fg, TA_CENTER | TA_TOP); SetTextAlign (hdc_bg, TA_CENTER | TA_TOP); xpos = x + w / 2; right = xpos + textSize.cx / 2; break; } /* out lined output */ if (flags & FM_Outlined) { /* determine size of outlining */ if ((flags & FM_Size) == FF_Small) { step = 1; } else { step = BASE_X / 4; } SelectObject (hdc_fg, *pOld); *pOld = SelectObject (hdc_bg, pix); SelectObject (hdc_bg, hfont[flags & FM_Size]); for (dx = -step; dx <= step; dx += step) { for (dy = -step; dy <= step; dy += step) { if (dx || dy) { ExtTextOut (hdc_bg, xpos + dx, y + dy, ETO_OPAQUE, NULL, text, len, NULL); } } } SelectObject (hdc_bg, *pOld); *pOld = SelectObject (hdc_fg, pix); } /* text output */ ExtTextOut (hdc_fg, xpos, y, ETO_OPAQUE, NULL, text, len, NULL); /* that's all */ return right; } /* DrawAlignedText */ /* * global function: GUI_DrawTextbox * description: draw a text string with optional box and outlining * parameters: text - 0 terminated string to draw * flags - draw mode flags see xblast.h FF_* rect - where to draw * return value: none */ void GUI_DrawTextbox (const char *text, unsigned flags, const BMRectangle * rect) { HGDIOBJ old; int len; int ypos; HDC hdc; /* sanity checks */ assert (rect != NULL); /* get device context */ hdc = (flags & FM_Color) ? hdcLight : hdcDark; old = SelectObject (hdc, pix); /* draw boxes */ if (flags & FM_Boxed) { if (flags & FM_Transparent) { HGDIOBJ oldPen; if (flags & FM_Color) { oldPen = SelectObject (hdc, hPen[PEN_DarkThin]); } else { oldPen = SelectObject (hdc, hPen[PEN_LightThin]); } for (ypos = 0; ypos < rect->h; ypos += 2) { MoveToEx (hdc, rect->x, rect->y + ypos, NULL); LineTo (hdc, rect->x + rect->w - 1, rect->y + ypos); } SelectObject (hdc, oldPen); MoveToEx (hdc, rect->x, rect->y, NULL); LineTo (hdc, rect->x + rect->w - 1, rect->y); LineTo (hdc, rect->x + rect->w - 1, rect->y + rect->h - 1); LineTo (hdc, rect->x, rect->y + rect->h - 1); LineTo (hdc, rect->x, rect->y); } else { Rectangle (hdc, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h); } } /* Draw text */ if (text != NULL) { HDC hdcInv; int right; len = strlen (text); ypos = rect->y + (rect->h - fontHeight[flags & FM_Size]) / 2; hdcInv = (flags & FM_Color) ? hdcDark : hdcLight; if (flags & FF_Vertical) { /* vertcial text layout */ int i; for (i = 0; i < len; i++) { int h2 = fontHeight[flags & FM_Size]; int y2 = rect->y + ( /*height + */ rect->h) / 2 + (2 * i - len + 1) * (h2) / 2; right = DrawAlignedText (text + i, 1, flags, rect->x, y2, rect->w, hdc, hdcInv, &old); } } else { right = DrawAlignedText (text, len, flags, rect->x, ypos, rect->w, hdc, hdcInv, &old); /* draw cursor if needed */ if (flags & FF_Cursor) { MoveToEx (hdc, right + 2, rect->y + 4, NULL); LineTo (hdc, right + 2, rect->y + rect->h - 5); } } } /* clean up */ SelectObject (hdc, old); } /* GUI_DrawTextbox */ /* * global function: GUI_DrawPolygon * description: draw an outlined polygon * parameters: x - left side of draw region * y - top side of draw region * w - width of draw region * h - height of draw region * lw - width of outline * points - relative coordinates (0,0 to 1,1) * npoints - number of points * black_white - dark or light fill pattern * return value: none */ void GUI_DrawPolygon (int x, int y, int w, int h, int lw, const BMPoint * points, int npoints, XBBool blackWhite) { int i; POINT *wp; HDC hdc; HGDIOBJ old; assert (points != NULL); /* copy points to windows structure */ wp = calloc (sizeof (POINT), npoints + 1); assert (wp != NULL); for (i = 0; i < npoints; i++) { wp[i].x = (LONG) (x + w * points[i].x); wp[i].y = (LONG) (y + h * points[i].y); } wp[npoints] = wp[0]; /* get device context */ hdc = blackWhite ? hdcLight : hdcDark; old = SelectObject (hdc, pix); /* draw polygon */ Polygon (hdc, wp, npoints); /* clean up */ free (wp); SelectObject (hdc, old); } /* GUI_DrawPolygon */ /* * end of file w32_text.c */ xblast-2.10.4/w32_text.h0000644000175000017500000000176010376071615014052 0ustar rhondaalfie/* * file w32_text.h - * * $Id: w32_text.h,v 1.3 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_TEXT_H #define _W32_TEXT_H extern XBBool InitText (void); extern void FinishText (void); #endif /* * end of file w32_text.h */ xblast-2.10.4/w32_tile.c0000644000175000017500000002453110376071615014017 0ustar rhondaalfie/* * file w32_tile.c - loading and drawing maptiles * * $Id: w32_tile.c,v 1.8 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "w32_tile.h" #include "gui.h" #include "w32_image.h" #include "w32_sprite.h" #include "w32_pixmap.h" #include "geom.h" #include "image.h" /* * local variables */ #define MAX_LEDS 5 // 2+3 XBCC static HDC hdcDst = NULL; static HDC hdcSrc = NULL; static HBITMAP pixBlock[MAX_TILE]; static HBITMAP pixLeds[MAX_LEDS]; static HBITMAP pixScore[MAX_SCORE_TILES]; static HBITMAP pixExplBlock[MAX_EXPLOSION]; static RECT voidList[MAZE_W * (MAZE_H + 2)]; static RECT blockList[MAX_TILE][MAZE_W * (MAZE_H + 2)]; static RECT explList[MAX_EXPLOSION][MAZE_W * (MAZE_H + 2)]; static RECT *voidLast = voidList; static RECT *blockLast[MAX_TILE]; static RECT *explLast[MAX_EXPLOSION]; /* * */ XBBool InitTiles (void) { HDC hdc; int i; /* create device contextes for drawing block to pixmap */ hdc = GetDC (window); if (NULL == hdc) { return XBFalse; } hdcDst = CreateCompatibleDC (hdc); if (NULL == hdcDst) { return XBFalse; } hdcSrc = CreateCompatibleDC (hdc); if (NULL == hdcSrc) { return XBFalse; } /* init led tiles */ for (i = 0; i < 2; i++) { pixLeds[i] = ReadCchPixmap (imgPathScore, imgFileScoreLed[i], COLOR_BLACK, COLOR_LIGHT_GOLDENROD, COLOR_SPRING_GREEN); } // XBCC pixLeds[2] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, COLOR_LIGHT_GOLDENROD, COLOR_RED); // SHRINK Led pixLeds[3] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, COLOR_LIGHT_GOLDENROD, COLOR_ORANGE); // SCRAMBLE DRAW Led pixLeds[4] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, COLOR_LIGHT_GOLDENROD, COLOR_BLUE); // SCRAMBLE DEL Led // -XBCC /* init other score tiles */ for (i = 0; i < SBDead; i++) { pixScore[i] = ReadCchPixmap (imgPathScore, imgFileScoreTile[i], COLOR_BLACK, COLOR_LIGHT_GOLDENROD, COLOR_SADDLE_BROWN); } /* init drawing lists */ for (i = 0; i < MAX_TILE; i++) { blockLast[i] = blockList[i]; } for (i = 0; i < MAX_EXPLOSION; i++) { explLast[i] = explList[i]; } /* just clear this ones */ memset (pixBlock, 0, sizeof (pixBlock)); memset (pixExplBlock, 0, sizeof (pixExplBlock)); return XBTrue; } /* InitTiles */ /* * */ void FinishTiles (void) { int i; /* delete block tiles if loaded */ for (i = 0; i < MAX_TILE; i++) { if (NULL != pixBlock[i]) { DeleteObject (pixBlock[i]); } } /* score tiles */ for (i = 0; i < 2; i++) { if (NULL != pixLeds[i]) { DeleteObject (pixLeds[i]); } } for (i = 0; i < MAX_SCORE_TILES; i++) { if (NULL != pixScore[i]) { DeleteObject (pixScore[i]); } } /* explosion blocks */ for (i = 0; i < MAX_EXPLOSION; i++) { if (NULL != pixExplBlock[i]) { DeleteObject (pixExplBlock[i]); } } /* remove devicerc contexts */ if (NULL != hdcDst) { DeleteObject (hdcDst); } if (NULL != hdcSrc) { DeleteObject (hdcSrc); } } /* FinishTiles */ /* * */ void GUI_DrawBlock (int x, int y, int block) { assert (x >= 0); assert (x < MAZE_W); assert (y >= 0); #ifdef SMPF assert (y < MAZE_H + 4); #else assert (y < MAZE_H + 3); #endif assert (block >= -1); assert (block < MAX_TILE); if (block >= 0) { blockLast[block]->left = x * BLOCK_WIDTH; blockLast[block]->top = y * BLOCK_HEIGHT; blockLast[block]->right = (x + 1) * BLOCK_WIDTH; blockLast[block]->bottom = (y + 1) * BLOCK_HEIGHT; blockLast[block]++; } else { voidLast->left = x * BLOCK_WIDTH; voidLast->top = y * BLOCK_HEIGHT; voidLast->right = (x + 1) * BLOCK_WIDTH; voidLast->bottom = (y + 1) * BLOCK_HEIGHT; voidLast++; } } /* GUI_DrawBlock */ /* * */ void GUI_DrawExplosion (int x, int y, int block) { assert (block >= 0); assert (block < MAX_EXPLOSION); explLast[block]->left = x * BLOCK_WIDTH; explLast[block]->top = y * BLOCK_HEIGHT; explLast[block]->right = (x + 1) * BLOCK_WIDTH; explLast[block]->bottom = (y + 1) * BLOCK_HEIGHT; explLast[block]++; } /* GUI_DrawExplosion */ /* * */ void GUI_LoadBlockRgb (int id, const char *name) { assert (id >= 0); assert (id < MAX_TILE); assert (NULL == pixBlock[id]); if (NULL != pixBlock[id]) { DeleteObject (pixBlock[id]); } pixBlock[id] = ReadRgbPixmap (imgPathBlock, name); if (pixBlock[id] == NULL) { fprintf (stderr, " Faile to load rgb Block %s.ppm \n", name); pixBlock[id] = ReadRgbPixmap (imgPathBlock, "unknown-file"); } } /* GUI_LoadBlockPpm */ /* * */ void GUI_LoadBlockCch (int id, const char *name, XBColor fg, XBColor bg, XBColor add) { assert (id >= 0); assert (id < MAX_TILE); assert (NULL == pixBlock[id]); if (NULL != pixBlock[id]) { DeleteObject (pixBlock[id]); } pixBlock[id] = ReadCchPixmap (imgPathBlock, name, fg, bg, add); if (pixBlock[id] == NULL) { fprintf (stderr, " Faile to load rgb Block %s.ppm \n", name); pixBlock[id] = ReadRgbPixmap (imgPathBlock, "unknown-file"); } } /* GUI_LoadBlock */ /* * */ static void MultiBlt (HDC hdcDst, HDC hdcSrc, RECT * rect, int n_rect, DWORD rop) { int i; for (i = 0; i < n_rect; i++) { BitBlt (hdcDst, rect[i].left, rect[i].top, rect[i].right - rect[i].left, rect[i].bottom - rect[i].top, hdcSrc, 0, 0, rop); } } /* MultiBlt */ /* * */ void GUI_FlushBlocks (void) { int i; HGDIOBJ oldSrc; HGDIOBJ oldDst; oldDst = SelectObject (hdcDst, pix); /* normal blocks */ for (i = 0; i < MAX_TILE; i++) { if (pixBlock[i] != NULL && blockLast[i] != blockList[i]) { oldSrc = SelectObject (hdcSrc, pixBlock[i]); MultiBlt (hdcDst, hdcSrc, blockList[i], blockLast[i] - blockList[i], SRCCOPY); SelectObject (hdcSrc, oldSrc); } blockLast[i] = blockList[i]; } /* void blocks */ ClearRectangles (hdcDst, hdcSrc, voidList, voidLast - voidList); voidLast = voidList; /* explosion blocks */ for (i = 0; i < MAX_EXPLOSION; i++) { if (pixExplBlock[i] != NULL) { if (explLast[i] != explList[i]) { oldSrc = SelectObject (hdcSrc, pixExplBlock[i]); MultiBlt (hdcDst, hdcSrc, explList[i], explLast[i] - explList[i], SRCCOPY); SelectObject (hdcSrc, oldSrc); explLast[i] = explList[i]; } } } /* that's all */ (void)SelectObject (hdcDst, oldDst); } /* GUI_FlushBlocks */ void GUI_FreeBlock (int block) { assert (block >= 0); assert (block < MAX_TILE); /* delete bitmap */ if (NULL != pixBlock[block]) { DeleteObject (pixBlock[block]); pixBlock[block] = NULL; } } /* GUI_FreeBlock */ /* * */ void GUI_InitExplosionBlocks (void) { HGDIOBJ oldSrc; HGDIOBJ oldDst; int i; for (i = 0; i < MAX_EXPLOSION; i++) { oldSrc = SelectObject (hdcSrc, pixBlock[0]); pixExplBlock[i] = CreateCompatibleBitmap (hdcSrc, BLOCK_WIDTH, BLOCK_HEIGHT); assert (pixExplBlock[i] != NULL); oldDst = SelectObject (hdcDst, pixExplBlock[i]); /* draw floor tile into it */ BitBlt (hdcDst, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT, hdcSrc, 0, 0, SRCCOPY); SelectObject (hdcSrc, oldSrc); SelectObject (hdcDst, oldDst); /* now copy explosion into it */ CopyExplosion (pixExplBlock[i], i); } } /* GUI_InitExplosionBlocks */ /* * */ void GUI_FreeExplosionBlocks (void) { int i; for (i = 0; i < MAX_EXPLOSION; i++) { if (NULL != pixExplBlock[i]) { DeleteObject (pixExplBlock[i]); pixExplBlock[i] = NULL; } } } /* GUI_FreeExplosionBlocks */ /* * */ void GUI_LoadPlayerScoreTiles (int player, const CFGPlayerGraphics * config) { XBColor scoreColors[NUM_PLAYER_COLORS]; assert (player < MAX_PLAYER); assert (config != NULL); /* copy colors */ scoreColors[0] = config->helmet; scoreColors[1] = config->face; scoreColors[2] = config->handsFeet; scoreColors[3] = config->armsLegs; scoreColors[4] = COLOR_LIGHT_GOLDENROD; scoreColors[5] = COLOR_SADDLE_BROWN; scoreColors[6] = COLOR_WHITE; /* load pixmap */ pixScore[SBDead + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[0], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSick + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[1], NUM_PLAYER_COLORS, scoreColors); pixScore[SBPlayer + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[2], NUM_PLAYER_COLORS, scoreColors); pixScore[SBAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[3], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSickAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[4], NUM_PLAYER_COLORS, scoreColors); } /* GUI_LoadPlayerScoreTile */ /* * */ void //#ifdef SMPF GUI_DrawScoreBlock (int x, int y, int block) // SMPF /*#else GUI_DrawScoreBlock (int x, int block) #endif */ { HGDIOBJ oldSrc; HGDIOBJ oldDst; assert (block < MAX_SCORE_TILES); assert (pixScore[block] != NULL); oldSrc = SelectObject (hdcSrc, pixScore[block]); oldDst = SelectObject (hdcDst, pix); //#ifdef SMPF BitBlt (hdcDst, x * STAT_WIDTH, MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT, STAT_WIDTH, STAT_HEIGHT, hdcSrc, 0, 0, SRCCOPY); // SMPF /*#else BitBlt (hdcDst, x*STAT_WIDTH, MAZE_H*BLOCK_HEIGHT, STAT_WIDTH, STAT_HEIGHT, hdcSrc, 0, 0, SRCCOPY); #endif */ SelectObject (hdcDst, oldDst); SelectObject (hdcSrc, oldSrc); } /* GUI_DrawScoreBlock */ /* * */ void GUI_DrawTimeLed (int x, int block) { HGDIOBJ oldSrc; HGDIOBJ oldDst; assert (block < MAX_LEDS); assert (pixLeds[block] != NULL); oldSrc = SelectObject (hdcSrc, pixLeds[block]); oldDst = SelectObject (hdcDst, pix); #ifdef SMPF BitBlt (hdcDst, x * LED_WIDTH, MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT * 2, LED_WIDTH, LED_HEIGHT, hdcSrc, 0, 0, SRCCOPY); #else BitBlt (hdcDst, x * LED_WIDTH, MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT, LED_WIDTH, LED_HEIGHT, hdcSrc, 0, 0, SRCCOPY); #endif SelectObject (hdcDst, oldDst); SelectObject (hdcSrc, oldSrc); } /* GUI_DrawTimeLed */ /* * end of file w32_tile.c */ xblast-2.10.4/w32_tile.h0000644000175000017500000000176110376071615014024 0ustar rhondaalfie/* * file w32_tile.h * * $Id: w32_tile.h,v 1.3 2006/02/19 13:33:01 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _W32_TILE_H #define _W32_TILE_H extern XBBool InitTiles (void); extern void FinishTiles (void); #endif /* * end of file w32_tile.h */ xblast-2.10.4/warning.rtf0000644000175000017500000000043110225615652014374 0ustar rhondaalfie{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\fcharset0 Arial;}} \viewkind4\uc1\pard\f0\fs20 Please Read this before installing XBlast TNT!\par If you have a former installation of XBlast TNT deinstall it.\par Only then will be this install sucessfull.\par } xblast-2.10.4/x11_atom.c0000644000175000017500000000434310372731125014012 0ustar rhondaalfie/* * x11_atom.h - atoms (aka XrmQuark) for faster database handling * * $Id: x11_atom.c,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * Initialize Atoms */ XBBool GUI_InitAtoms (void) { XrmInitialize (); return XBTrue; } /* InitAtoms */ /* * conversion string to atom */ XBAtom GUI_StringToAtom (const char *string) { XBAtom atom; assert (NULL != string); atom = XrmStringToQuark (string); #ifdef DEBUG_ATOM fprintf (stderr, "atom = %lu\n", atom); #endif return atom; } /* GUI_StringToAtom */ /* * formatted string to atom */ XBAtom GUI_FormatToAtom (const char *fmt, ...) { XBAtom atom; char tmp[256]; va_list argList; assert (NULL != fmt); /* formatting */ va_start (argList, fmt); vsprintf (tmp, fmt, argList); va_end (argList); /* conversion */ atom = XrmStringToQuark (tmp); #ifdef DEBUG_ATOM fprintf (stderr, "atom = %lu\n", atom); #endif return atom; } /* GUI_FormatToAtom */ /* * convert int to atom */ XBAtom GUI_IntToAtom (int value) { return GUI_FormatToAtom ("%d", value); } /* GUI_IntToAtom */ /* * conversion atom to string */ const char * GUI_AtomToString (XBAtom atom) { return XrmQuarkToString (atom); } /* GUI_StringToAtom */ /* * convert atom int or -1 */ int GUI_AtomToInt (XBAtom atom) { int value; if (1 != sscanf (XrmQuarkToString (atom), "%d", &value)) { return -1; } return value; } /* GUI_AtomToInt */ /* * end of file x11_atom.c */ xblast-2.10.4/x11_common.c0000644000175000017500000000321310372731125014335 0ustar rhondaalfie/* * file x11_common.c - * * $Id: x11_common.c,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * global variables */ Display *dpy = NULL; /* connection to X11 display */ Window win; /* the xblast window */ Colormap cmap; /* colormap used */ Visual *defVisual; /* used visual */ int defDepth; /* color depth (in bits) */ int bitsPerPixel; /* pixel memroy size (in bits) */ int whitePixel; /* id for color white */ int blackPixel; /* id for color black */ int iconified; /* flag if window is iconfified */ char *xblastResName = "xblast"; char *xblastResClass = "XBlast"; GC gcFromPix; /* context to draw from pixmap into window */ GC gcWindow; /* context to clear window */ GC gcClearPix; /* context to clear pixmap */ Pixmap pix; /* pixmap for double buffering */ /* * end of x11_file common.c */ xblast-2.10.4/x11_common.h0000644000175000017500000000404710372731125014350 0ustar rhondaalfie/* * file x11_common.h - * * $Id: x11_common.h,v 1.6 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_X11_COMMON_H #define XBLAST_X11_COMMON_H #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_FCNTL_H #include #else #include #endif #include #include #include #include #include #if defined (sun) #include #endif #include "x11_event.h" #include "x11_config.h" #include "x11_joystick.h" #include "x11c_image.h" #include "x11c_pixmap.h" #include "x11_socket.h" #include "x11c_tile.h" #include "x11c_text.h" #include "x11_sound.h" #include "x11c_sprite.h" /* * global constants */ #define NUM_FONTS 3 /* * global variables; */ extern Display *dpy; extern int defDepth; extern int bitsPerPixel; extern Window win; extern Colormap cmap; extern Visual *defVisual; extern int whitePixel; extern int blackPixel; extern int iconified; extern char *xblastResName; extern char *xblastResClass; extern GC gcFromPix; extern GC gcWindow; extern GC gcClearPix; extern Pixmap pix; #endif /* * end of file common.h */ xblast-2.10.4/x11_config.c0000644000175000017500000001336410372731125014322 0ustar rhondaalfie/* * file x11_config.c - x11 specific configuration * * $Id: x11_config.c,v 1.7 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_config.h" /* * local variables */ static DBRoot *dbGui = NULL; /* default font config */ static CFGFont defaultFontConfig = { #ifdef MINI_XBLAST "-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-1", /* small */ "-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso8859-1", /* medium */ "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1", /* large */ // "-*-helvetica-medium-r-*-*-8-*-*-*-*-*-iso8859-*", /* small */ //"-*-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-*", /* medium */ // "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*", /* large */ #else "-*-helvetica-bold-r-*-*-14-*-*-*-*-*-iso8859-*", /* small */ "-*-helvetica-bold-r-*-*-18-*-*-*-*-*-iso8859-*", /* medium */ "-*-helvetica-bold-r-*-*-24-*-*-*-*-*-iso8859-*", /* large */ #endif }; /* default colors */ static CFGColor defaultColorConfig = { COLOR_GRAY_75, COLOR_MIDNIGHT_BLUE, COLOR_BLACK, COLOR_MIDNIGHT_BLUE, COLOR_GOLD, COLOR_YELLOW, COLOR_LIGHT_GOLDENROD, COLOR_SADDLE_BROWN, COLOR_SPRING_GREEN, }; /* * store font config */ static void StoreFontConfig (const CFGFont * cfgFont) { DBSection *section; /* sanity check */ assert (NULL != cfgFont); /* create new section */ #ifdef MINI_XBLAST section = DB_CreateSection (dbGui, atomFontMini); #else section = DB_CreateSection (dbGui, atomFont); #endif assert (section != NULL); /* set values */ DB_CreateEntryString (section, atomSmall, cfgFont->small); DB_CreateEntryString (section, atomMedium, cfgFont->medium); DB_CreateEntryString (section, atomLarge, cfgFont->large); } /* StoreFontConfig */ /* * retrieve font config */ const CFGFont * GetFontConfig (void) { const DBSection *section; static CFGFont cfgFont; memcpy (&cfgFont, &defaultFontConfig, sizeof (CFGFont)); /* get database entrry */ #ifdef MINI_XBLAST section = DB_GetSection (dbGui, atomFontMini); #else section = DB_GetSection (dbGui, atomFont); #endif if (NULL != section) { DB_GetEntryString (section, atomSmall, &cfgFont.small); DB_GetEntryString (section, atomMedium, &cfgFont.medium); DB_GetEntryString (section, atomLarge, &cfgFont.large); } return &cfgFont; } /* GetFontConfig */ /* * store color settings */ static void StoreColorConfig (const CFGColor * cfgColor) { DBSection *section; /* sanity check */ assert (NULL != cfgColor); /* create new section */ section = DB_CreateSection (dbGui, atomColor); assert (section != NULL); /* set values */ DB_CreateEntryColor (section, atomTitleFg, cfgColor->titleFg); DB_CreateEntryColor (section, atomTitleBg, cfgColor->titleBg); DB_CreateEntryColor (section, atomDarkText1, cfgColor->darkText1); DB_CreateEntryColor (section, atomDarkText2, cfgColor->darkText2); DB_CreateEntryColor (section, atomLightText1, cfgColor->lightText1); DB_CreateEntryColor (section, atomLightText2, cfgColor->lightText2); DB_CreateEntryColor (section, atomStatusFg, cfgColor->statusFg); DB_CreateEntryColor (section, atomStatusBg, cfgColor->statusBg); DB_CreateEntryColor (section, atomStatusLed, cfgColor->statusLed); } /* StoreColorConfig */ /* * get color settings */ const CFGColor * GetColorConfig (void) { const DBSection *section; static CFGColor cfgColor; memcpy (&cfgColor, &defaultColorConfig, sizeof (CFGColor)); /* get database entrry */ if (NULL != (section = DB_GetSection (dbGui, GUI_StringToAtom ("color")))) { DB_GetEntryColor (section, atomTitleFg, &cfgColor.titleFg); DB_GetEntryColor (section, atomTitleBg, &cfgColor.titleBg); DB_GetEntryColor (section, atomDarkText1, &cfgColor.darkText1); DB_GetEntryColor (section, atomDarkText2, &cfgColor.darkText2); DB_GetEntryColor (section, atomLightText1, &cfgColor.lightText1); DB_GetEntryColor (section, atomLightText2, &cfgColor.lightText2); DB_GetEntryColor (section, atomStatusFg, &cfgColor.statusFg); DB_GetEntryColor (section, atomStatusBg, &cfgColor.statusBg); DB_GetEntryColor (section, atomStatusLed, &cfgColor.statusLed); } return &cfgColor; } /* GetColorConfig */ /* * load gui database */ void GUI_LoadConfig (void) { /* create empty database for gui data */ dbGui = DB_Create (DT_Config, atomX11); assert (dbGui != NULL); /* load from file */ Dbg_Config ("loading x11 gui data\n"); if (DB_Load (dbGui)) { return; } Dbg_Config ("failed to load x11 gui data, setting defaults\n"); /* set default values */ StoreFontConfig (&defaultFontConfig); StoreColorConfig (&defaultColorConfig); /* and save it */ DB_Store (dbGui); } /* GUI_LoadConfig */ /* * store gui database */ void GUI_SaveConfig (void) { assert (dbGui != NULL); if (!DB_Changed (dbGui)) { Dbg_Config ("saving x11 gui data\n"); DB_Store (dbGui); } } /* GUI_SaveConfig */ /* * finish config */ void GUI_FinishConfig (void) { assert (dbGui != NULL); DB_Delete (dbGui); dbGui = NULL; Dbg_Config ("x11 gui data cleared\n"); } /* GUI_FinishConfig */ /* * end of file x11_config.c */ xblast-2.10.4/x11_config.h0000644000175000017500000000270110372705223014320 0ustar rhondaalfie/* * file x11_config.h - x11 specific configuration * * $Id: x11_config.h,v 1.4 2006/02/09 18:31:47 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_CONFIG_H #define _X11_CONFIG_H #include "color.h" /* * type defintions */ /* font configuration */ typedef struct { const char *small; const char *medium; const char *large; } CFGFont; /* colors */ typedef struct { XBColor titleFg; XBColor titleBg; XBColor darkText1; XBColor darkText2; XBColor lightText1; XBColor lightText2; XBColor statusFg; XBColor statusBg; XBColor statusLed; } CFGColor; /* * prototypes */ extern const CFGFont *GetFontConfig (void); extern const CFGColor *GetColorConfig (void); #endif /* * end of file x11_config.h */ xblast-2.10.4/x11_event.c0000644000175000017500000004207710377700543014206 0ustar rhondaalfie/* * file x11_event.c - event handling * * $Id: x11_event.c,v 1.22 2006/02/24 21:57:55 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local constants */ #define BELL_VOLUME 80 /* * local types */ typedef enum { TM_NONE, TM_ONCE, TM_PERIODIC } TimerMode; typedef struct { KeyCode key; XBEventCode code; int value; } GameKeyEvent; typedef struct _game_key_list { GameKeyEvent gke; struct _game_key_list *next; } GameKeyList; typedef struct _poll_func_list { XBPollFunction func; struct _poll_func_list *next; } PollFuncList; /* * local variables */ /* Timeout */ static TimerMode timerMode = TM_NONE; static struct timeval nextTimer; static struct timeval timerIncr; /* polling */ static PollFuncList *pollList = NULL; static struct timeval nextPoll; /* keyboard mode */ static XBKeyboardMode keyboardMode = KB_NONE; /* keyboard lookup tables */ static int numKeyMenu = 0; static int numKeyPress = 0; static int numKeyRelease = 0; static int numKeyChat = 0; static GameKeyEvent *keyMenuTable = NULL; static GameKeyEvent *keyPressTable = NULL; static GameKeyEvent *keyReleaseTable = NULL; static GameKeyEvent *keyChatTable = NULL; static void HandleAsciiKey (XKeyEvent * xkey); static XBBool HandleChatKey (XKeyEvent * xkey); /* * Set keyboard mode */ void GUI_SetKeyboardMode (XBKeyboardMode Mode) { keyboardMode = Mode; } /* GUI_SetKeyboardMode */ /* * Set mouse mode */ void GUI_SetMouseMode (XBBool enable) { XSetWindowAttributes xswa; if (enable) { xswa.event_mask = EVENT_MASK_MOUSE; } else { xswa.event_mask = EVENT_MASK_NORMAL; } XChangeWindowAttributes (dpy, win, CWEventMask, &xswa); } /* GUI_SetMouseMode */ /* * Show/Hide cursor */ void GUI_ShowCursor(XBBool enable) { /* TODO: show or hide the mouse cursor */ } /* * Comapre to GameKeyCode */ static int CompareKeyCode (const void *a, const void *b) { return (*(KeyCode *) a) - (*(KeyCode *) b); } /* CompareKeyCode */ /* * create keyboard lookup table from init table */ static GameKeyEvent * CreateGameKeyTable (const CFGKeyTable * init, int *nelem) { const CFGKeyTable *ptr; GameKeyList *list = NULL; GameKeyList *elem; GameKeyEvent *table = NULL; KeyCode keyCode; KeySym keySym; int i; assert (nelem != NULL); *nelem = 0; /* create list with with all keymappings (part one) */ for (ptr = init; ptr->keysym != NULL; ptr++) { /* convert keysymbol name to keycode */ keySym = XStringToKeysym (ptr->keysym); if (NoSymbol == keySym) { Dbg_Out ("unknown keysymbol %s.\n", ptr->keysym); continue; } keyCode = XKeysymToKeycode (dpy, keySym); if (0 == keyCode) { Dbg_Out ("unmapped keysymbol %s.\n", ptr->keysym); continue; } /* create new list element */ elem = calloc (1, sizeof (GameKeyList)); assert (elem != NULL); elem->gke.key = keyCode; elem->gke.code = ptr->eventCode; elem->gke.value = ptr->eventData; /* put it into list */ elem->next = list; list = elem; /* increment counter */ *nelem += 1; } /* create lookup table */ table = malloc (*nelem * sizeof (GameKeyEvent)); assert (table != NULL); /* store list in array and delete it */ i = 0; while (list != NULL) { /* store next one */ elem = list->next; /* copy data */ assert (i < *nelem); memcpy (table + i, &list->gke, sizeof (GameKeyEvent)); i++; /* next one */ free (list); list = elem; } /* now sort it with quciksort */ qsort (table, *nelem, sizeof (GameKeyEvent), CompareKeyCode); /* now check for double entries */ for (i = 1; i < *nelem; i++) { if (table[i - 1].key == table[i].key) { GUI_ErrorMessage ("Multiple bindings for key \"%s\".", XKeysymToString (XKeycodeToKeysym (dpy, table[i].key, 0))); break; } } /* that's all */ return table; } /* CreateGameKeyTable */ /* * reinitialize key tables */ void GUI_UpdateKeyTables (void) { /* game key presses */ if (NULL != keyPressTable) { free (keyPressTable); } keyPressTable = CreateGameKeyTable (GetGameKeyPressTable (), &numKeyPress); assert (keyPressTable != NULL); /* game key releases */ if (NULL != keyReleaseTable) { free (keyReleaseTable); } keyReleaseTable = CreateGameKeyTable (GetGameKeyReleaseTable (), &numKeyRelease); assert (keyReleaseTable != NULL); /* menu keys */ if (NULL != keyMenuTable) { free (keyMenuTable); } keyMenuTable = CreateGameKeyTable (GetMenuKeyTable (), &numKeyMenu); assert (keyMenuTable != NULL); /* chat keys */ if (NULL != keyChatTable) { free (keyChatTable); } keyChatTable = CreateGameKeyTable (GetChatKeyTable (), &numKeyChat); assert (keyChatTable != NULL); } /* GUI_UpdateKeyTables */ /* * Init Event routine */ XBBool InitEvent (void) { /* setup keyboard */ GUI_UpdateKeyTables (); /* register display for socket polling */ RegisterDisplay (ConnectionNumber (dpy)); /* that's all */ return XBTrue; } /* InitEvent */ /* * finish event handling */ void FinishEvent (void) { /* clean up key tables */ if (NULL != keyMenuTable) { free (keyMenuTable); keyMenuTable = NULL; } if (NULL != keyPressTable) { free (keyPressTable); keyPressTable = NULL; } if (NULL != keyReleaseTable) { free (keyReleaseTable); keyReleaseTable = NULL; } if (NULL != keyChatTable) { free (keyChatTable); keyChatTable = NULL; } } /* FinishEvent */ /* * Set timer for event */ void GUI_SetTimer (long msec, XBBool periodic) { if (0 == msec) { timerMode = TM_NONE; } else { /* get current time */ gettimeofday (&nextTimer, NULL); /* set next timeout */ timerIncr.tv_sec = msec / 1000; timerIncr.tv_usec = 1000 * (msec % 1000); /* --- */ nextTimer.tv_sec += timerIncr.tv_sec; nextTimer.tv_usec += timerIncr.tv_usec; if (nextTimer.tv_usec > 1000000L) { nextTimer.tv_usec -= 1000000L; nextTimer.tv_sec++; } /* periodic ? */ if (!periodic) { timerMode = TM_ONCE; } else { timerMode = TM_PERIODIC; } } } /* * */ static int CheckTimer (struct timeval *a, struct timeval *b) { if (a->tv_sec < b->tv_sec) { return TRUE; } if (a->tv_sec > b->tv_sec) { return FALSE; } return (a->tv_usec < b->tv_usec); } /* CheckTimer */ /* * Calc difference between timvals */ static void DeltaTimer (struct timeval *delta, struct timeval *a, struct timeval *b) { delta->tv_sec = a->tv_sec - b->tv_sec; delta->tv_usec = a->tv_usec - b->tv_usec; if (delta->tv_usec < 0) { delta->tv_usec += 1000000; delta->tv_sec--; } } /* DeltaTimer */ /* * insert poll function */ void GUI_AddPollFunction (XBPollFunction func) { PollFuncList *ptr; /* set timeout */ if (NULL == pollList) { gettimeofday (&nextPoll, NULL); nextPoll.tv_sec++; } /* create new element */ ptr = calloc (1, sizeof (*ptr)); assert (NULL != ptr); ptr->func = func; ptr->next = pollList; pollList = ptr; } /* GUI_AddPollFunction */ /* * subtract poll function */ void GUI_SubtractPollFunction (XBPollFunction func) { assert (pollList != NULL); if (pollList->func == func) { pollList = pollList->next; } else { PollFuncList *ptr; for (ptr = pollList; ptr->next != NULL; ptr = ptr->next) { if (ptr->next->func == func) { PollFuncList *save = ptr->next; ptr->next = save->next; free (save); } } } } /* GUI_SubtractPollFunction */ /* * Handle X11-KEyboard-Event by looking up Menu Event */ static void HandleMenuKey (XKeyEvent * xkey) { GameKeyEvent *key; KeyCode keyCode; /* search for key */ keyCode = xkey->keycode; if (!HandleChatKey (xkey)) { key = bsearch (&keyCode, keyMenuTable, numKeyMenu, sizeof (GameKeyEvent), CompareKeyCode); if (NULL != key) { QueueEventValue (key->code, key->value); } } } /* HandleMenuKey */ /* * Handle X11-KEyboard-Event by looking XBlast Event */ static void HandleXBlastKey (XKeyEvent * xkey) { GameKeyEvent *key_table; int num_key; GameKeyEvent *key; KeyCode keyCode; /* which table to loopkup */ if (xkey->type == KeyPress) { key_table = keyPressTable; num_key = numKeyPress; if (HandleChatKey (xkey)) { return; } } else { key_table = keyReleaseTable; num_key = numKeyRelease; } /* search for key */ keyCode = xkey->keycode; key = bsearch (&keyCode, key_table, num_key, sizeof (GameKeyEvent), CompareKeyCode); if (NULL != key) { QueueEventValue (key->code, key->value); } } /* HandleXBlastKey */ /* * handle chat key event */ static XBBool HandleChatKey (XKeyEvent * xkey) { GameKeyEvent *key; KeyCode keyCode; keyCode = xkey->keycode; key = bsearch (&keyCode, keyChatTable, numKeyChat, sizeof (GameKeyEvent), CompareKeyCode); if (key != NULL && Chat_isListening ()) { if ((key->value == XBCE_ESCAPE || key->value == XBCE_BACK || key->value == XBCE_ENTER) && Chat_GetCurrentCode () == XBE_NONE) { return XBFalse; } QueueEventValue (key->code, key->value + 1000); return XBTrue; } /* if chat input is active, expect character event */ if (Chat_GetCurrentCode () != XBE_NONE) { HandleAsciiKey (xkey); return XBTrue; } return XBFalse; } /* HandleChatKey */ /* * Handle X11-KEyboard-Event by looking up ascii value of key */ static void HandleAsciiKey (XKeyEvent * xkey) { char buf[8]; KeySym keySym; int len; len = XLookupString (xkey, buf, sizeof (buf), &keySym, NULL); if (len == 1) { if (isprint ((unsigned char)buf[0])) { /* printable character */ QueueEventValue (XBE_ASCII, buf[0]); } else if (iscntrl ((unsigned char)buf[0])) { /* control key */ switch (keySym) { case XK_BackSpace: QueueEventValue (XBE_CTRL, XBCK_BACKSPACE); break; case XK_Escape: QueueEventValue (XBE_CTRL, XBCK_ESCAPE); break; case XK_Return: QueueEventValue (XBE_CTRL, XBCK_RETURN); break; case XK_Delete: QueueEventValue (XBE_CTRL, XBCK_DELETE); break; /* case 71: QueueEventValue (XBE_CTRL, XBCK_INSERT); break; case 79: QueueEventValue (XBE_CTRL, XBCK_END); break; case 127: QueueEventValue (XBE_CTRL, XBCK_DELETE); break; case 129: QueueEventValue (XBE_CTRL, XBCK_HOME); break; */ default: break; } } } else { if (keySym == XK_End) { QueueEventValue (XBE_CTRL, XBCK_END); } if (keySym == XK_Home) { QueueEventValue (XBE_CTRL, XBCK_HOME); } if (keySym == XK_Insert) { QueueEventValue (XBE_CTRL, XBCK_INSERT); } if (keySym == XK_Delete) { QueueEventValue (XBE_CTRL, XBCK_DELETE); } } } /* HandleAsciiKey */ /* * Handle X11-KEyboard-Event by looking up keysymbol name */ static void HandleKeysymKey (XKeyEvent * xkey) { KeySym keySym; /* look up key smybol (lower case only) */ keySym = XLookupKeysym (xkey, 0); if (keySym == XK_Escape) { QueueEventAtom (XBE_KEYSYM, ATOM_INVALID); } else if (keySym != NoSymbol) { char *keyName = XKeysymToString (keySym); if (NULL != keyName) { QueueEventAtom (XBE_KEYSYM, GUI_StringToAtom (keyName)); } } } /* HandleKeysymKey */ /* * Handle X11 Events */ static void HandleX11Event (XEvent * xev) { switch (xev->type) { /* window is iconfied */ case UnmapNotify: iconified = TRUE; break; /* window is mapped again */ case MapNotify: iconified = FALSE; break; /* part of the window was exposed */ case Expose: GUI_FlushPixmap (FALSE); break; /* a key was pressed */ case KeyPress: switch (keyboardMode) { case KB_CHAT: (void)HandleChatKey (&xev->xkey); break; case KB_MENU: HandleMenuKey (&xev->xkey); break; case KB_XBLAST: HandleXBlastKey (&xev->xkey); break; case KB_ASCII: HandleAsciiKey (&xev->xkey); break; case KB_KEYSYM: HandleKeysymKey (&xev->xkey); break; default: break; } break; /* a key was released */ case KeyRelease: switch (keyboardMode) { case KB_XBLAST: HandleXBlastKey (&xev->xkey); break; default: break; } break; /* a mouse button has been pressed */ case ButtonPress: switch (xev->xbutton.button) { case Button1: QueueEventPos (XBE_MOUSE_1, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; case Button2: QueueEventPos (XBE_MOUSE_3, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; case Button3: QueueEventPos (XBE_MOUSE_2, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; default: break; } break; case ButtonRelease: switch (xev->xbutton.button) { case Button1: QueueEventPos (XBE_RMOUSE_1, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; case Button2: QueueEventPos (XBE_RMOUSE_3, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; case Button3: QueueEventPos (XBE_RMOUSE_2, xev->xbutton.x / BASE_X, xev->xbutton.y / BASE_Y); break; default: break; } break; /* the mouse pointer has been moved */ case MotionNotify: QueueEventPos (XBE_MOUSE_MOVE, xev->xmotion.x / BASE_X, xev->xmotion.y / BASE_Y); break; } } /* HandleX11Event */ /* * check application and poll timer */ struct timeval * HandleTimeout (XBBool peek) { struct timeval now; struct timeval *timeout; static struct timeval dTimer; static struct timeval dPoll; static struct timeval dPeek; /* application timer */ if (timerMode == TM_NONE) { timeout = NULL; } else { gettimeofday (&now, NULL); if (CheckTimer (&nextTimer, &now)) { /* timer has triggered */ if (timerMode == TM_ONCE) { /* this timer will only fire once */ timerMode = TM_NONE; } else { /* set new timer value */ nextTimer.tv_sec += timerIncr.tv_sec; nextTimer.tv_usec += timerIncr.tv_usec; if (nextTimer.tv_usec > 1000000L) { nextTimer.tv_usec -= 1000000L; nextTimer.tv_sec++; } } /* create new timer event */ QueueEventVoid (XBE_TIMER); dTimer.tv_sec = 0; dTimer.tv_usec = 0; timeout = &dTimer; } else { /* no timeout yet , calc time to timeout */ DeltaTimer (&dTimer, &nextTimer, &now); /* link to timeout */ timeout = &dTimer; } } /* polling (once per second) */ if (pollList != NULL) { gettimeofday (&now, NULL); if (CheckTimer (&nextPoll, &now)) { PollFuncList *poll; for (poll = pollList; poll != NULL; poll = poll->next) { (*poll->func) (&now); } nextPoll.tv_sec = now.tv_sec + 1; nextPoll.tv_usec = now.tv_usec; #ifdef DEBUG_EVENT Dbg_Out ("poll\n"); #endif } /* calc time for next polling */ DeltaTimer (&dPoll, &nextPoll, &now); if (NULL == timeout || CheckTimer (&dPoll, timeout)) { timeout = &dPoll; } } /* only peeking */ if (peek) { dPeek.tv_sec = 0; dPeek.tv_usec = 0; timeout = &dPeek; } return timeout; } /* CheckTimer */ /* * xblast main event routine */ XBEventCode GUI_WaitEvent (XBEventData * data) { XBEventCode ecode; int i, num_queued; XEvent xev; struct timeval *timeout; /* only if there are no events in our xblast event queue */ while (XBE_NONE == (ecode = NextEvent (data))) { /* wird sind schon Timeout */ timeout = HandleTimeout (XBFalse); /* are their any X11-Events in the Queue */ num_queued = XEventsQueued (dpy, QueuedAlready); for (i = 0; i < num_queued; i++) { XNextEvent (dpy, &xev); HandleX11Event (&xev); } if (SelectSockets (keyboardMode, timeout)) { int num_queued = XEventsQueued (dpy, QueuedAfterReading); for (i = 0; i < num_queued; i++) { XNextEvent (dpy, &xev); HandleX11Event (&xev); } } } /* we have an event, return it */ return ecode; } /* WaitEvent */ /* * xblast main event routine */ XBEventCode GUI_PeekEvent (XBEventData * data) { XBEventCode ecode; int i, num_queued; XEvent xev; struct timeval *timeout; /* only if there are no events in our xblast event queue */ if (XBE_NONE != (ecode = NextEvent (data))) { return ecode; } /* wird sind schon Timeout */ timeout = HandleTimeout (XBTrue); /* are their any X11-Events in the Queue */ num_queued = XEventsQueued (dpy, QueuedAlready); for (i = 0; i < num_queued; i++) { XNextEvent (dpy, &xev); HandleX11Event (&xev); } if (SelectSockets (keyboardMode, timeout)) { int num_queued = XEventsQueued (dpy, QueuedAfterReading); for (i = 0; i < num_queued; i++) { XNextEvent (dpy, &xev); HandleX11Event (&xev); } } /* we have check everything now return event if any */ return NextEvent (data); } /* WaitEvent */ /* * */ void GUI_Sync (void) { if (0 != XEventsQueued (dpy, QueuedAfterFlush)) { XSync (dpy, FALSE); } } /* GUI_Sync */ /* * */ void GUI_Bell (void) { XBell (dpy, BELL_VOLUME); } /* GUI_Bell */ /* * send event */ void GUI_SendEventValue (XBEventCode code, int value) { QueueEventValue (code, value); } /* GUI_SendEventValue */ /* * end of file x11_event.c */ xblast-2.10.4/x11_event.h0000644000175000017500000000232410372731125014175 0ustar rhondaalfie/* * file x11_event.h - * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * July 15, 1999 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: x11_event.h,v 1.5 2006/02/09 21:21:25 fzago Exp $ */ #ifndef _X11_EVENT_H #define _X11_EVENT_H /* * constants */ #define EVENT_MASK_NORMAL (ExposureMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask) #define EVENT_MASK_MOUSE (EVENT_MASK_NORMAL | ButtonPressMask |ButtonReleaseMask| PointerMotionMask) /* * prototypes */ extern XBBool InitEvent (void); extern void FinishEvent (void); #endif xblast-2.10.4/x11_joystick.c0000644000175000017500000001455710372731125014721 0ustar rhondaalfie/* * file x11_joystick.c - joystick support for linux * * $Id: x11_joystick.c,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if ! defined(linux) && ! defined(NO_JOYSTICK) #define NO_JOYSTICK #endif #include "xblast.h" #include "x11_common.h" #ifndef NO_JOYSTICK #include #include #include #endif #define JOYDIR_NONE 0x00 #define JOYDIR_UP 0x01 #define JOYDIR_DOWN 0x02 #define JOYDIR_Y 0x03 #define JOYDIR_LEFT 0x04 #define JOYDIR_RIGHT 0x08 #define JOYDIR_X 0x0C #define THRESHOLD 8192 /* * local types */ typedef struct { int fd; XBEventCode event; unsigned dir; } XBJoystick; /* * local variables */ #ifndef NO_JOYSTICK static const char *joyDevice[NUM_JOYSTICKS] = { "/dev/js0", "/dev/js1", "/dev/input/js0", "/dev/input/js1", "/dev/input/js2", "/dev/input/js3", }; static XBJoystick joystick[NUM_JOYSTICKS] = { {-1, XBE_NONE, 0}, {-1, XBE_NONE, 0}, {-1, XBE_NONE, 0}, {-1, XBE_NONE, 0}, {-1, XBE_NONE, 0}, {-1, XBE_NONE, 0}, }; #endif /* * global function: GUI_NumJoysticks * description: Query number of connected joysticks * return value: # joysticks */ int GUI_NumJoysticks (void) { #ifndef NO_JOYSTICK size_t i, count; for (i = 0, count = 0; i < NUM_JOYSTICKS; i++) { if (joystick[i].fd != -1) { count++; } } return count; #else return 0; #endif } /* GUI_NumJoysticks */ /* * Initialize */ XBBool InitJoystick (void) { #ifndef NO_JOYSTICK size_t i, j; for (i = 0, j = 0; i < NUM_JOYSTICKS; i++) { if (-1 != (joystick[i].fd = open (joyDevice[i], O_RDONLY))) { RegisterJoystick (joystick[i].fd); joystick[i].event = XBE_JOYST_1 + j; Dbg_Out ("joystick %s initialised\n", joyDevice[i]); j++; } else { Dbg_Out ("joystick %s not initialised\n", joyDevice[i]); } } #endif return XBTrue; } /* InitJoystick */ /* * shutdown */ void FinishJoystick (void) { #ifndef NO_JOYSTICK size_t i; for (i = 0; i < NUM_JOYSTICKS; i++) { if (joystick[i].fd != -1) { close (joystick[i].fd); } } #endif } /* FinishJoystick */ #ifndef NO_JOYSTICK /* * calculate new joystick direction from axis-event */ static unsigned EvalJoystickMove (unsigned dir, unsigned axis, int value) { unsigned newDir = dir; switch (axis) { /* x-Axis */ case 0: newDir &= ~JOYDIR_X; if (value > THRESHOLD) { newDir |= JOYDIR_RIGHT; } else if (value < -THRESHOLD) { newDir |= JOYDIR_LEFT; } break; /* y-axis */ case 1: newDir &= ~JOYDIR_Y; if (value > THRESHOLD) { newDir |= JOYDIR_DOWN; } else if (value < -THRESHOLD) { newDir |= JOYDIR_UP; } break; default: break; } #ifdef DEBUG_JOYSTICK Dbg_Out ("joy move: axis=%u value=%d => %02x\n", axis, value, newDir); #endif return newDir; } /* EvalJoystickMove */ #endif /* * handle new joystick event during game */ void HandleXBlastJoystick (int fd) { #ifndef NO_JOYSTICK size_t i; struct js_event jsEvent; unsigned newDir; int value; /* find joystick */ for (i = 0; i < NUM_JOYSTICKS; i++) { if (fd == joystick[i].fd) { break; } } if (i == NUM_JOYSTICKS) { return; } /* get event */ if (sizeof (jsEvent) != read (fd, &jsEvent, sizeof (jsEvent))) { return; } /* check type */ switch (jsEvent.type & ~JS_EVENT_INIT) { /* * handle button presses relases */ case JS_EVENT_BUTTON: if (jsEvent.value) { switch (jsEvent.number) { case 0: QueueEventValue (joystick[i].event, XBGK_BOMB); break; case 1: QueueEventValue (joystick[i].event, XBGK_SPECIAL); break; default: break; } } break; /* * handle direction changes */ case JS_EVENT_AXIS: newDir = EvalJoystickMove (joystick[i].dir, jsEvent.number, jsEvent.value); switch (newDir) { case JOYDIR_UP: value = XBGK_GO_UP; break; case JOYDIR_DOWN: value = XBGK_GO_DOWN; break; case JOYDIR_LEFT: value = XBGK_GO_LEFT; break; case JOYDIR_RIGHT: value = XBGK_GO_RIGHT; break; case JOYDIR_NONE: value = XBGK_STOP_ALL; break; default: value = XBGK_NONE; break; } if (value != XBGK_NONE && newDir != joystick[i].dir) { QueueEventValue (joystick[i].event, value); joystick[i].dir = newDir; } } #endif } /* HandleJoystick */ /* * handle new joystick event in menus */ void HandleMenuJoystick (int fd) { #ifndef NO_JOYSTICK size_t i; struct js_event jsEvent; unsigned newDir; /* find joystick */ for (i = 0; i < NUM_JOYSTICKS; i++) { if (fd == joystick[i].fd) { break; } } if (i == NUM_JOYSTICKS) { return; } /* get event */ if (sizeof (jsEvent) != read (fd, &jsEvent, sizeof (jsEvent))) { return; } /* check type */ switch (jsEvent.type & ~JS_EVENT_INIT) { /* * handle button presses relases */ case JS_EVENT_BUTTON: if (jsEvent.value) { QueueEventValue (XBE_MENU, XBMK_SELECT); } break; /* * handle direction changes */ case JS_EVENT_AXIS: newDir = EvalJoystickMove (joystick[i].dir, jsEvent.number, jsEvent.value); /* test changes in y dir */ if ((newDir & JOYDIR_Y) != (joystick[i].dir & JOYDIR_Y)) { switch (newDir & JOYDIR_Y) { case JOYDIR_UP: QueueEventValue (XBE_MENU, XBMK_UP); break; case JOYDIR_DOWN: QueueEventValue (XBE_MENU, XBMK_DOWN); break; default: break; } } /* test changes in x dir */ if ((newDir & JOYDIR_X) != (joystick[i].dir & JOYDIR_X)) { switch (newDir & JOYDIR_X) { case JOYDIR_LEFT: QueueEventValue (XBE_MENU, XBMK_LEFT); break; case JOYDIR_RIGHT: QueueEventValue (XBE_MENU, XBMK_RIGHT); break; default: break; } } joystick[i].dir = newDir; } #endif } /* HandleMenuJoystick */ /* * end of file x11_joystick.c */ xblast-2.10.4/x11_joystick.h0000644000175000017500000000231710372731125014715 0ustar rhondaalfie/* * file x11_joystick.h - joystick support for linux * * $Id: x11_joystick.h,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_X11_JOYSTICK_H #define XBLAST_X11_JOYSTICK_H /* * global macros */ #define NUM_JOYSTICKS 6 /* * global prototypes */ extern XBBool InitJoystick (void); extern void FinishJoystick (void); extern void HandleMenuJoystick (int); extern void HandleXBlastJoystick (int); #endif /* * end of file x11_joystick.h */ xblast-2.10.4/x11_msgbox.c0000644000175000017500000000231210372731125014343 0ustar rhondaalfie/* * file x11_msgbox.c - * * $Id: x11_msgbox.c,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "xblast.h" #include "x11_common.h" /* * not yet implemented */ void GUI_ErrorMessage (const char *fmt, ...) { va_list argList; GUI_Bell (); fputs ("*** ", stderr); va_start (argList, fmt); vfprintf (stderr, fmt, argList); va_end (argList); fputs (" ***\n", stderr); } /* GUI_ErrorMessage */ /* * end of file x11_msgbox.c */ xblast-2.10.4/x11_socket.c0000644000175000017500000005656510376102617014361 0ustar rhondaalfie/* * file x11_socket.c - true bsd sockets for xblast * * $Id: x11_socket.c,v 1.15 2006/02/19 14:49:51 lodott Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local constants */ #define CONNECT_TIMEOUT 60 #define ACCEPT_TIMEOUT 30 #define LISTENQ 5 #ifndef SHUT_WR #define SHUT_WR 1 #endif #ifndef MSG_DONTWAIT #define MSG_DONTWAIT 0 #endif /* * type definitions */ /* socket address */ typedef struct _xb_socket_address { socklen_t len; struct sockaddr *addr; } XBSocketAddress; /* fix for suns */ #ifdef sun typedef uint32_t u_int32_t; #endif /* socket data */ struct _xb_socket { int fd; /* file descriptor of socket */ XBSocketAddress sock; /* local address */ XBSocketAddress peer; /* remote address */ XBBool shutDown; /* shutdown flag, indicates if close has been called already */ }; /* * local variables */ static int socketMax = 0; /* current max */ static int socketX11 = -1; /* x11 socket */ static int socketSnd = -1; /* sound socket */ static fd_set socketReadSet; /* current read set */ static fd_set socketWriteSet; /* current write set */ static fd_set fdJoystickSet; /* current joystick set */ /* interface list */ static XBSocketInterface *inter = NULL; static size_t numInter = 0; /* * local stuff */ /* * delete list with all interfaces */ static void DeleteInterfaces (void) { if (NULL != inter) { size_t i; for (i = 0; i < numInter; i++) { if (NULL != inter[i].name) { free (inter[i].name); } if (NULL != inter[i].addrDevice) { free (inter[i].addrDevice); } if (NULL != inter[i].addrBroadcast) { free (inter[i].addrBroadcast); } } free (inter); } inter = NULL; numInter = 0; } /* DeleteInterfaces */ /* * get inet address */ static u_int32_t GetAddressInet (const char *hostName) { int32_t addr; struct hostent *serverEnt; assert (hostName != NULL); /* check if ip string */ if (-1L != (addr = inet_addr (hostName))) { return ntohl (addr); } /* lookup hostname if not an ip string */ if (NULL != (serverEnt = gethostbyname (hostName))) { return ntohl (*(int32_t *) serverEnt->h_addr_list[0]); } /* lookup failed */ return 0L; } /* GetAddressInet */ /* * handler for SIGCHLD */ static void HandleSigChld (int sig_num) { int stat; pid_t child; while (0 < (child = waitpid (-1, &stat, WNOHANG))) { Dbg_Out ("child %d terminated\n", child); } } /* HandleSigChld */ /************************** * local socket debugging * **************************/ #ifdef DEBUG_SOCKET /* * print out an fdset */ static void DebugFdSet (const char *header, fd_set * set) { int i; Dbg_Socket ("%s:", header); for (i = 0; i <= socketMax; i++) { if (FD_ISSET (i, set)) { fprintf (stderr, " %d", i); } } fprintf (stderr, "\n"); } /* DebugFdSet */ /* * print out interface config */ static void DebugInterfaceData (const struct ifconf *ifConf) { size_t i; Dbg_Socket ("Interface Config (%u bytes)", ifConf->ifc_len); for (i = 0; i < ifConf->ifc_len; i++) { if (i % 8 == 0) { fprintf (stderr, "\n"); } fprintf (stderr, "%02x ", (unsigned)(unsigned char)ifConf->ifc_buf[i]); } fprintf (stderr, "\n"); } /* DebugInterfaceData */ #endif /******************* * socket managing * *******************/ /* * initialisation routine */ XBBool Socket_Init (void) { static XBBool initDone = XBFalse; if (!initDone) { signal (SIGCHLD, HandleSigChld); signal (SIGPIPE, SIG_IGN); signal (SIGALRM, SIG_IGN); initDone = XBTrue; } /* clear fd_Set for sockets */ FD_ZERO (&socketReadSet); FD_ZERO (&socketWriteSet); FD_ZERO (&fdJoystickSet); Dbg_Socket ("initializing socket managing\n"); return XBTrue; } /* Socket_Init */ /* * cleaning up */ void Socket_Finish (void) { } /* Socket_Finish */ /*************** * socket data * ***************/ /* * return file descriptor for socket */ int Socket_Fd (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->fd; } /* Socket_Fd */ /* * return adress family for socket */ int Socket_Family (const XBSocket * pSocket) { assert (NULL != pSocket); return pSocket->sock.addr->sa_family; } /* Socket_Family */ /* * get host name of client */ const char * Socket_HostName (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); inetAddr = (struct sockaddr_in *)sa->addr; return inet_ntoa (inetAddr->sin_addr); } /* Socket_HostName */ /* * get port of host */ unsigned Socket_HostPort (const XBSocket * pSocket, XBBool peer) { const XBSocketAddress *sa; struct sockaddr_in *inetAddr; assert (NULL != pSocket); sa = peer ? &pSocket->peer : &pSocket->sock; assert (NULL != sa); assert (NULL != sa->addr); inetAddr = (struct sockaddr_in *)sa->addr; return ntohs (inetAddr->sin_port); } /* Socket_HostPort */ /******************* * socket creation * *******************/ /* * create socket structure */ XBSocket * Socket_Alloc (int family) { int len; XBSocket *pSocket; /* require AF_INET */ switch (family) { case AF_INET: len = sizeof (struct sockaddr_in); break; default: Dbg_Socket ("AF_INET family required, socket not created\n"); return NULL; } /* alloc socket data structure */ pSocket = calloc (1, sizeof (XBSocket)); assert (NULL != pSocket); pSocket->fd = -1; /* out address */ pSocket->sock.len = len; pSocket->sock.addr = calloc (1, len); assert (NULL != pSocket->sock.addr); pSocket->sock.addr->sa_family = family; /* other addresse */ pSocket->peer.len = len; pSocket->peer.addr = calloc (1, len); assert (NULL != pSocket->peer.addr); pSocket->peer.addr->sa_family = family; /* set shutdown flags to false */ pSocket->shutDown = XBFalse; /* that's all */ return pSocket; } /* Socket_Alloc */ /* * free socket structure memory */ void Socket_Free (XBSocket * pSocket) { assert (NULL != pSocket); if (NULL != pSocket->sock.addr) { free (pSocket->sock.addr); } if (NULL != pSocket->peer.addr) { free (pSocket->peer.addr); } free (pSocket); } /* Socket_Free */ /* * set socket adress */ XBBool Socket_SetAddressInet (XBSocket * pSocket, XBBool peer, const char *hostName, unsigned short port) { XBSocketAddress *sa; u_int32_t addr; struct sockaddr_in *serverAddr; assert (NULL != pSocket); /* determine address structure to set */ sa = peer ? &pSocket->peer : &pSocket->sock; /* get host name in host byte order */ if (NULL != hostName) { if (0 == (addr = GetAddressInet (hostName))) { Dbg_Socket ("failed to set address %s:%u for fd=%u\n", hostName, port, pSocket->fd); return XBFalse; } } else { addr = INADDR_ANY; } /* now set the address */ assert (NULL != sa); memset (sa->addr, 0, sa->len); serverAddr = (struct sockaddr_in *)sa->addr; serverAddr->sin_family = AF_INET; serverAddr->sin_addr.s_addr = htonl (addr); serverAddr->sin_port = htons (port); Dbg_Socket ("set %s address %s:%u for fd=%u\n", peer ? "remote" : "local", hostName, port, pSocket->fd); return XBTrue; } /* Socket_SetAddressInet */ /* * enable or disable broadcast */ XBBool Socket_SetBroadcast (XBSocket * pSocket, XBBool enable) { int flag = enable ? 1 : 0; if (0 == setsockopt (pSocket->fd, SOL_SOCKET, SO_BROADCAST, &flag, sizeof (flag))) { Dbg_Socket ("successfully %s broadcast flag on socket fd=%u\n", enable ? "set" : "cleared", pSocket->fd); return XBTrue; } else { perror ("Socket_SetBroadcast"); Dbg_Socket ("failed to %s broadcast flag on socket fd=%u\n", enable ? "set" : "cleared", pSocket->fd); return XBFalse; } } /* Socket_SetBroadcast */ /* * set socket option reuse */ XBBool Socket_SetReuse (XBSocket * pSocket) { int so_reuseaddr = 1; if (-1 == setsockopt (pSocket->fd, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof (so_reuseaddr))) { return XBFalse; } /* that's all */ return XBTrue; } /* Socket_SetReuse */ /* * register socket for reading */ void Socket_RegisterRead (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd > socketMax) { socketMax = pSocket->fd; } FD_SET (pSocket->fd, &socketReadSet); #ifdef DEBUG_SOCKET DebugFdSet ("read fd_set", &socketReadSet); #endif } /* Socket_RegisterRead */ /* * register socket for writing */ void Socket_RegisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd > socketMax) { socketMax = pSocket->fd; } FD_SET (pSocket->fd, &socketWriteSet); #ifdef DEBUG_SOCKET DebugFdSet ("write fd_set", &socketWriteSet); #endif } /* Socket_RegisterWrite */ /* * unregister socket for reading */ void Socket_UnregisterRead (XBSocket * pSocket) { assert (NULL != pSocket); FD_CLR (pSocket->fd, &socketReadSet); #ifdef DEBUG_SOCKET DebugFdSet ("read fd_set", &socketReadSet); #endif } /* socket_UnregisterRead */ /* * register socket for writing */ void Socket_UnregisterWrite (XBSocket * pSocket) { assert (NULL != pSocket); FD_CLR (pSocket->fd, &socketWriteSet); #ifdef DEBUG_SOCKET DebugFdSet ("write fd_set", &socketWriteSet); #endif } /* Socket_UnregisterWrite */ /************* * BSD calls * *************/ /* * open socket */ XBBool Socket_Open (XBSocket * pSocket, int type) { assert (pSocket != NULL); /* now create a stream socket */ if (-1 == (pSocket->fd = socket (pSocket->sock.addr->sa_family, type, 0))) { perror ("Socket_Open"); Dbg_Socket ("failed to open socket of type=%i", type); return XBFalse; } Dbg_Socket ("open socket fd=%u (type=%i)\n", pSocket->fd, type); return XBTrue; } /* Socket_Open */ /* * close socket */ void Socket_Close (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd < 0) { return; } if (0 != close (pSocket->fd)) { perror ("Socket_Close"); Dbg_Socket ("error while closing socket fd=%u\n", pSocket->fd); } else { pSocket->shutDown = XBTrue; Dbg_Socket ("socket fd=%u closed\n", pSocket->fd); } } /* Socket_Close */ /* * close write access */ void Socket_ShutdownWrite (XBSocket * pSocket) { assert (NULL != pSocket); if (pSocket->fd < 0 || pSocket->shutDown) { return; } if (0 != shutdown (pSocket->fd, SHUT_WR)) { perror ("Socket_ShutdownWrite"); Dbg_Socket ("error while shutting down socket fd=%u: ", pSocket->fd); } else { Dbg_Socket ("socket fd=%u shutdown write\n", pSocket->fd); } } /* Socket_ShutdownWrite */ /* * connect a socket */ XBBool Socket_Connect (XBSocket * pSocket) { assert (pSocket != NULL); /* try to connect, set timeout */ alarm (CONNECT_TIMEOUT); if (-1 == connect (pSocket->fd, pSocket->peer.addr, pSocket->peer.len)) { perror ("Socket_Connect"); alarm (0); Dbg_Socket ("failed to connect socket fd=%u to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); return XBFalse; } alarm (0); /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Connect(getsockname)"); Dbg_Socket ("failed to get local address of socket fd=%u after connecting\n", pSocket->fd); return XBFalse; } Dbg_Socket ("socket fd=%u connected to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBTrue), Socket_HostPort (pSocket, XBTrue)); return XBTrue; } /* Socket_Connect */ /* * bind a socket */ XBBool Socket_Bind (XBSocket * pSocket) { /* bind to port */ if (-1 == bind (pSocket->fd, pSocket->sock.addr, pSocket->sock.len)) { perror ("Socket_Bind"); Dbg_Socket ("failed to bind socket fd=%u\n", pSocket->fd); return XBFalse; } /* now get adress assigned by kernel. the cast to void* is needed since not all systems know socklen_t */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Bind(getsockname)"); Dbg_Socket ("failed to get local address of socket fd=%u after binding\n", pSocket->fd); return XBFalse; } /* that's all */ Dbg_Socket ("socket fd=%u bound to %s:%u\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBTrue; } /* Socket_Bind */ /* * accept a socket */ XBBool Socket_Accept (XBSocket * pSocket, const XBSocket * pListen) { assert (pSocket != NULL); assert (pListen != NULL); /* try to accept, set timeout */ alarm (ACCEPT_TIMEOUT); if (-1 == (pSocket->fd = accept (pListen->fd, pSocket->peer.addr, (void *)&pSocket->peer.len))) { perror ("Socket_Accept"); alarm (0); Dbg_Socket ("failed to accept from socket fd=%u\n", pListen->fd); return XBFalse; } alarm (0); /* now retrieve local adresse */ if (-1 == getsockname (pSocket->fd, pSocket->sock.addr, (void *)&pSocket->sock.len)) { perror ("Socket_Accept(getsockname)"); Dbg_Socket ("failed to get local address from accepted socket fd=%u\n", pListen->fd); return XBFalse; } /* that's all */ Dbg_Out ("accepted socket fd=%u from socket fd=%u\n", pSocket->fd, pListen->fd); return XBTrue; } /* Socket_Accept */ /* * listen on socket */ XBBool Socket_Listen (XBSocket * pSocket) { assert (pSocket != NULL); /* now listen for client to connect */ if (0 != listen (pSocket->fd, LISTENQ)) { perror ("Socket_Listen"); Dbg_Socket ("failed to listen on socket fd=%u (%s:%u)\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBFalse; } Dbg_Socket ("listening on socket fd=%u (%s:%u)\n", pSocket->fd, Socket_HostName (pSocket, XBFalse), Socket_HostPort (pSocket, XBFalse)); return XBTrue; } /* Socket_Listen */ /* * write to socket, non blocking i/o assumed */ int Socket_Send (const XBSocket * pSocket, const void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to write */ result = send (pSocket->fd, buf, len, MSG_DONTWAIT); if (result < 0) { perror ("Socket_Send"); if (EAGAIN == errno) { Dbg_Socket ("send on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("send error on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Send */ /* * write to socket, given target, non blocking i/o assumed */ int Socket_SendTo (XBSocket * pSocket, const void *buf, size_t len, const char *host, unsigned short port) { int result; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* convert destination adress */ if (!Socket_SetAddressInet (pSocket, XBTrue, host, port)) { Dbg_Socket ("failed to send on fd=%u - failed to resolve %s:%u", pSocket->fd, host, port); return -1; } /* now try to write data */ result = sendto (pSocket->fd, buf, len, MSG_DONTWAIT, pSocket->peer.addr, pSocket->peer.len); if (result < 0) { perror ("Socket_SendTo"); if (EAGAIN == errno) { Dbg_Socket ("sendto on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("sendto error on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("sent %u bytes on fd=%u to %s:%u\n", result, pSocket->fd, host, port); return result; } /* Socket_SendTo */ /* * read from socket */ int Socket_Receive (const XBSocket * pSocket, void *buf, size_t len) { int result; assert (NULL != pSocket); assert (NULL != buf); /* try to read */ result = recv (pSocket->fd, buf, len, 0); if (result < 0) { perror ("Socket_Receive"); if (EAGAIN == errno) { Dbg_Socket ("receive on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receive on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } Dbg_Socket ("received %u bytes on fd=%u\n", result, pSocket->fd); return result; } /* Socket_Receive */ /* * read from socket, get sender */ int Socket_ReceiveFrom (XBSocket * pSocket, void *buf, size_t len, const char **host, unsigned short *port) { ssize_t numRead; assert (NULL != pSocket); assert (NULL != buf); assert (NULL != host); /* try to read */ numRead = recvfrom (pSocket->fd, buf, len, 0, pSocket->peer.addr, (void *)&pSocket->peer.len); if (numRead > 0) { *host = Socket_HostName (pSocket, XBTrue); *port = Socket_HostPort (pSocket, XBTrue); } else { perror ("Socket_ReceiveFrom"); *host = NULL; *port = 0; if (numRead < 0) { if (EAGAIN == errno) { Dbg_Socket ("receivefrom on fd=%u would block\n", pSocket->fd); return XB_SOCKET_WOULD_BLOCK; } else { Dbg_Socket ("receivefrom on fd=%u\n", pSocket->fd); return XB_SOCKET_ERROR; } } } Dbg_Socket ("received %lu bytes on fd=%u from %s:%u\n", (unsigned long)numRead, pSocket->fd, *host, *port); return numRead; } /* Socket_ReceiveFrom */ /************** * interfaces * **************/ /* * get interface config data */ static const struct ifconf * GetInterfaceConfig (int fd) { size_t len, lastLen; char *buf = NULL; static struct ifconf ifConf; /* get list of all interfaces */ len = 100 * sizeof (struct ifreq); lastLen = 0; for (;;) { /* alloc buffer to receive data */ buf = calloc (1, len); assert (NULL != buf); /* prepare structure for query */ ifConf.ifc_len = len; ifConf.ifc_buf = buf; /* query list of interfaces */ if (-1 == ioctl (fd, SIOCGIFCONF, &ifConf)) { if (errno != EINVAL || lastLen != 0) { free (buf); return NULL; } } else if (ifConf.ifc_len == lastLen) { /* success */ return &ifConf; } else { /* net new length */ lastLen = ifConf.ifc_len; } /* next guess */ len += 10 * sizeof (struct ifreq); free (buf); } return XBFalse; } /* GetInterfaceConfig */ /* * check if single interface is acceptable */ static XBBool GetSingleInterface (int fd, XBSocketInterface * pInter, const struct ifreq *ifReq, size_t * len) { struct ifreq ifrFlags; struct ifreq ifrBroadcast; struct sockaddr_in *inetDevice; struct sockaddr_in *inetBroadcast; /* get address length of current entry */ switch (ifReq->ifr_addr.sa_family) { #ifdef IPV6 case AF_INET6: *len = IFNAMSIZ + sizeof (struct sockaddr_in6); break; #endif case AF_INET: default: *len = IFNAMSIZ + sizeof (struct sockaddr); break; } /* checks for protocol family */ if (ifReq->ifr_addr.sa_family != AF_INET) { Dbg_Out ("no INET interface, rejecting\n"); return XBFalse; } /* get flags */ ifrFlags = *ifReq; if (-1 == ioctl (fd, SIOCGIFFLAGS, &ifrFlags)) { Dbg_Out ("failed to get interface flags, rejecting\n"); return XBFalse; } /* device address is simple */ inetDevice = (struct sockaddr_in *)&ifReq->ifr_addr; /* try to get broadcast adress */ inetBroadcast = NULL; ifrBroadcast = *ifReq; if (IFF_BROADCAST & ifrFlags.ifr_flags) { if (-1 != (ioctl (fd, SIOCGIFBRDADDR, &ifrBroadcast))) { inetBroadcast = (struct sockaddr_in *)&ifrBroadcast.ifr_broadaddr; } } /* show data so far */ Dbg_Out ("IP = %s\n", inet_ntoa (inetDevice->sin_addr)); Dbg_Out ("BC = %s\n", inetBroadcast ? inet_ntoa (inetBroadcast->sin_addr) : "n/a"); /* check if interface is down */ if (!(IFF_UP & ifrFlags.ifr_flags)) { Dbg_Out ("interface is down, rejecting\n"); return XBFalse; } Dbg_Out ("interface is up\n"); /* store data */ pInter->name = DupString (ifReq->ifr_name); pInter->addrDevice = DupString (inet_ntoa (inetDevice->sin_addr)); pInter->addrBroadcast = inetBroadcast ? DupString (inet_ntoa (inetBroadcast->sin_addr)) : NULL; return XBTrue; } /* GetSingleInterface */ /* * list available interfaces */ const XBSocketInterface * Socket_GetInterfaces (size_t * pNum) { int fd; size_t maxInter; size_t cur; char *ptr; const struct ifconf *ifConf = NULL; size_t len; assert (pNum != NULL); /* clean up */ DeleteInterfaces (); /* open UDP socket for testing */ fd = socket (AF_INET, SOCK_DGRAM, 0); if (-1 == fd) { Dbg_Socket ("failed to get socket for interface detection\n"); goto Error; } /* get config */ if (NULL == (ifConf = GetInterfaceConfig (fd))) { Dbg_Socket ("failed to get interface data\n"); goto Error; } /* alloc result buffer */ numInter = 0; cur = 0; maxInter = ifConf->ifc_len / sizeof (struct ifreq); inter = calloc (maxInter, sizeof (XBSocketInterface)); assert (NULL != inter); /* now walk through buffer */ for (ptr = ifConf->ifc_buf; ptr < ifConf->ifc_buf + ifConf->ifc_len; ptr += len) { Dbg_Out ("### interface %u ###\n", cur); if (GetSingleInterface (fd, inter + numInter, (struct ifreq *)ptr, &len)) { numInter++; } cur++; } /* clean up */ free (ifConf->ifc_buf); close (fd); /* that's all */ *pNum = numInter; return inter; Error: if (NULL != ifConf && NULL != ifConf->ifc_buf) { free (ifConf->ifc_buf); } if (-1 != fd) { close (fd); } DeleteInterfaces (); *pNum = 0; return NULL; } /* Socket_GetInterfaces */ /******************* * special sockets * *******************/ /* * register a socket as x11 */ void RegisterDisplay (int fd) { if (fd > socketMax) { socketMax = fd; } FD_SET (fd, &socketReadSet); socketX11 = fd; Dbg_Socket ("x11 socket registered as fd=%u\n", fd); } /* RegisterDisplay */ /* * register a socket as joystick */ void RegisterJoystick (int fd) { if (fd > socketMax) { socketMax = fd; } FD_SET (fd, &socketReadSet); FD_SET (fd, &fdJoystickSet); Dbg_Socket ("joystick socket registered as fd=%u\n", fd); } /* RegisterJoystick */ /* * register a socket as sound */ void RegisterSound (int fd) { if (fd > socketMax) { socketMax = fd; } assert (-1 == socketSnd); FD_SET (fd, &socketReadSet); socketSnd = fd; Dbg_Socket ("sound socket registered as fd=%u\n", fd); } /* RegisterSound */ /* * unregister sound socket */ void UnregisterSound (int fd) { if (fd == socketSnd) { FD_CLR (fd, &socketReadSet); socketSnd = -1; } else { return; } } /* UnregisterSound */ /***************** * socket events * *****************/ /* * handle select */ XBBool SelectSockets (XBKeyboardMode kbMode, struct timeval * timeout) { XBBool xEvents = XBFalse; int fd; fd_set rdfs; fd_set wrfs; /* now poll X11 and other sockets */ memcpy (&rdfs, &socketReadSet, sizeof (fd_set)); memcpy (&wrfs, &socketWriteSet, sizeof (fd_set)); select (socketMax + 1, &rdfs, &wrfs, NULL, timeout); /* check each socket */ for (fd = 0; fd <= socketMax; fd++) { /* socket is readable */ if (FD_ISSET (fd, &rdfs)) { if (fd == socketX11) { xEvents = XBTrue; } else if (fd == socketSnd) { HandleSound (fd); } else if (FD_ISSET (fd, &fdJoystickSet)) { switch (kbMode) { case KB_XBLAST: HandleXBlastJoystick (fd); break; case KB_MENU: HandleMenuJoystick (fd); break; default: break; } } else { CommReadable (fd); } } if (FD_ISSET (fd, &wrfs)) { CommWriteable (fd); } } return xEvents; } /* * end of file x11_socket.c */ xblast-2.10.4/x11_socket.h0000644000175000017500000000234410372731125014346 0ustar rhondaalfie/* * file x11_socket.h - true bsd sockets for xblast * * $Id: x11_socket.h,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_X11_SOCKET_H #define XBLAST_X11_SOCKET_H /* * global prototypes */ extern void RegisterDisplay (int fd); extern XBBool SelectSockets (XBKeyboardMode kbMode, struct timeval *timeout); extern void RegisterJoystick (int fd); extern void RegisterSound (int fd); extern void UnregisterSound (int fd); #endif /* * end of file x11_socket.h */ xblast-2.10.4/x11_sound.c0000644000175000017500000001227310443245274014207 0ustar rhondaalfie/* * file x11_sound.c - sound via xbsndsrv or bell * * $Id: x11_sound.c,v 1.10 2006/06/12 11:06:36 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local constants */ #ifndef XBLAST_SOUND_SERVER #define XBLAST_SOUND_SERVER "xbsndsrv" #endif /* client/server commands */ #define SND_LOAD_SOUND 0 #define SND_PLAY_SOUND 1 #define SND_STOP_SOUND 2 #define SND_UNLOAD_SOUND 3 /* values to be used in acknowledge pipe */ #define SND_ACK_OK 0 #define SND_ACK_ERROR 1 /* * local variables */ static XBBool isActive = XBFalse; static XBBool boom = XBFalse; static XBBool soundInitialized = XBFalse; static int cmdPipe[2]; /* pipe i/o descriptors */ static int ackPipe[2]; static pid_t serverPid = -1; static char *monoArgs[] = { XBLAST_SOUND_SERVER, "-mono", NULL, }; static char *stereoArgs[] = { XBLAST_SOUND_SERVER, NULL, }; /* * */ XBBool SND_Init (const CFGSoundSetup * setup) { char **serverArgs = NULL; assert (NULL != setup); /* mode selection */ switch (setup->mode) { /* wave sound via xbsndsrv */ case XBSM_Waveout: serverArgs = setup->stereo ? stereoArgs : monoArgs; isActive = XBTrue; break; /* out via X11-bell */ case XBSM_Beep: isActive = XBTrue; return XBTrue; /* no sound at all */ case XBSM_None: isActive = XBFalse; return XBTrue; default: return XBFalse; } /* create pipes for communication */ if (pipe (cmdPipe) < 0) { fprintf (stderr, "could not create cmd pipe for sound communication\n"); return XBFalse; } if (pipe (ackPipe) < 0) { fprintf (stderr, "could not create ack pipe for sound communication\n"); close (cmdPipe[0]); close (cmdPipe[1]); return XBFalse; } if (0 == (serverPid = fork ())) { /* child process */ close (cmdPipe[1]); close (0); (void)dup (cmdPipe[0]); close (ackPipe[0]); close (1); (void)dup (ackPipe[1]); if (execvp (serverArgs[0], serverArgs) < 0) { int ack_val = SND_ACK_ERROR; fprintf (stderr, "Could not exec sound server\n"); fflush (stderr); write (1, &ack_val, sizeof (ack_val)); } exit (0); } else if (serverPid > 0) { /* parent (client) */ int ack_val; close (cmdPipe[0]); close (ackPipe[1]); read (ackPipe[0], &ack_val, sizeof (ack_val)); if (ack_val == SND_ACK_OK) { soundInitialized = XBTrue; /* Exit handler to kill sound server on exit */ RegisterSound (ackPipe[0]); atexit (SND_Finish); return XBTrue; } else { soundInitialized = XBFalse; return XBTrue; } } else { fprintf (stderr, "could not fork sound server\n"); close (cmdPipe[0]); close (cmdPipe[1]); soundInitialized = XBFalse; return XBFalse; } } /* SND_Init */ /* * */ XBBool SND_Stop (SND_Id id) { if (soundInitialized) { int cmd[2]; cmd[0] = SND_STOP_SOUND; cmd[1] = id; write (cmdPipe[1], cmd, sizeof (cmd)); /* read (ackPipe[0], cmd, 1); */ } return XBTrue; } /* SND_Stop */ /* * */ XBBool SND_Play (SND_Id id, int position) { if (soundInitialized) { /* Note: position argument is ignored for stereo sounds */ int cmd[2]; cmd[0] = SND_PLAY_SOUND; cmd[1] = id | (position << 16); write (cmdPipe[1], cmd, sizeof (cmd)); } else { /* beep at next frame */ if (SND_MINIBOMB == id || SND_EXPL == id) { boom = XBTrue; } } return XBTrue; } /* SND_Play */ /* * */ XBBool SND_Load (SND_Id id) { if (soundInitialized) { int cmd[2]; cmd[0] = SND_LOAD_SOUND; cmd[1] = id; write (cmdPipe[1], cmd, sizeof (cmd)); /* read (ackPipe[0], cmd, 1); */ } return XBTrue; } /* SND_Load */ /* * */ XBBool SND_Unload (SND_Id id) { if (soundInitialized) { int cmd[2]; cmd[0] = SND_UNLOAD_SOUND; cmd[1] = id; write (cmdPipe[1], cmd, sizeof (cmd)); /* read (ackPipe[0], cmd, 1); */ } return XBTrue; } /* SND_Unload */ /* * */ void SND_Flush (void) { if (isActive && boom) { boom = XBFalse; /* ring the bell */ XBell (dpy, 80); } } /* SND_Flush */ /* * */ void SND_Finish (void) { int wait_status; if (soundInitialized && serverPid != -1) { kill (serverPid, SIGINT); wait (&wait_status); UnregisterSound (ackPipe[0]); } soundInitialized = XBFalse; } /* SND_Finish */ /* * beep once */ void SND_Beep (void) { XBell (dpy, 80); } /* SND_Beep */ /* * */ void HandleSound (int fd) { if (fd == ackPipe[0]) { int cmd[2]; read (ackPipe[0], cmd, 1); /* TODO: ack auswerten */ // Dbg_Out ("sound ack\n"); } } /* HandleSound */ /* * end of file x11_sound.c */ xblast-2.10.4/x11_sound.h0000644000175000017500000000202510051114304014166 0ustar rhondaalfie/* * file x11_sound.h - sound support for linux * * $Id: x11_sound.h,v 1.3 2004/05/14 10:00:36 alfie Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBLAST_X11_SOUND_H #define XBLAST_X11_SOUND_H /* * global prototypes */ extern void HandleSound (int); #endif /* * end of file x11_sound.h */ xblast-2.10.4/x11c_image.c0000644000175000017500000002702310372731125014277 0ustar rhondaalfie/* * file x11c_image.c - convert images to window system * * $Id: x11c_image.c,v 1.6 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local variables */ static int rgb_color[6][6][6]; static unsigned long rmask, gmask, bmask; static int rbits, rshift; static int gbits, gshift; static int bbits, bshift; static int rbase, gbase, bbase; /* pointer to conversion functions (rgb to pixel) */ static void (*ppm_to_image) (unsigned char *ppm, int width, int height, XImage * image); /* * */ static void AnalyzeColorMask (unsigned long mask, int *bits, int *shift) { *shift = 0; *bits = 0; if (mask) { while (0 == (mask % 2)) { (*shift)++; mask >>= 1; } while (1 == (mask % 2)) { (*bits)++; mask >>= 1; } } } /* AnalyzeColorMask */ /* * */ static void PpmToImageRgb (unsigned char *ppm, int width, int height, XImage * image) { int x, y, i; int pixel; int base[3], scale[3], shift[3], mask[3]; base[0] = rbase; base[1] = gbase; base[2] = bbase; scale[0] = 65535 - base[0]; scale[1] = 65535 - base[1]; scale[2] = 65535 - base[2]; shift[0] = 16 - rshift - rbits; shift[1] = 16 - gshift - gbits; shift[2] = 16 - bshift - bbits; mask[0] = rmask; mask[1] = gmask; mask[2] = bmask; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { /* calculate renormalized rgb values */ pixel = 0; /* loop over rgb */ for (i = 0; i < 3; i++) { /* EPFL: shift[0] or shift[2] can be positive or negative, depending of the colordepth and hardware */ if (shift[i] > 0) { pixel |= (((scale[i] * (*ppm)) / 255 + base[i]) >> shift[i]) & mask[i]; } else { pixel |= (((scale[i] * (*ppm)) / 255 + base[i]) << -shift[i]) & mask[i]; } ppm++; } XPutPixel (image, x, y, pixel); } } } /* PpmToImageRgb */ /* * */ static void AllocRgbColor (int red, int green, int blue) { XColor colorUsed; #ifdef DEBUG static int num_rgb_colors = 0; fprintf (stderr, "Allocating RGB color %d\n", ++num_rgb_colors); #endif /* default pixel is white */ rgb_color[red][green][blue] = whitePixel; /* try to alloc a new color cell */ colorUsed.red = (65535 - rbase) * red / 5 + rbase; colorUsed.green = (65535 - gbase) * green / 5 + gbase; colorUsed.blue = (65535 - bbase) * blue / 5 + bbase; colorUsed.flags = DoRed | DoGreen | DoBlue; if (XAllocColor (dpy, cmap, &colorUsed)) { rgb_color[red][green][blue] = colorUsed.pixel; } else { /* if private colormap is in not in use,try agaian white */ if (cmap == DefaultColormap (dpy, DefaultScreen (dpy))) { /* create private color map */ cmap = XCopyColormapAndFree (dpy, cmap); XSetWindowColormap (dpy, win, cmap); /* alloc again */ colorUsed.red = 65535 * red / 5; colorUsed.green = 65535 * green / 5; colorUsed.blue = 65535 * blue / 5; colorUsed.flags = DoRed | DoGreen | DoBlue; if (XAllocColor (dpy, cmap, &colorUsed)) { rgb_color[red][green][blue] = colorUsed.pixel; } } } } /* AllocRgbColor */ /* * */ static void PpmToImage8Bit (unsigned char *ppm, int width, int height, XImage * image) { int x, y; unsigned char *ptr; int red, green, blue; /* upper left pixels */ ptr = ppm; for (y = 0; y < height; y += 2) { for (x = 0; x < width; x += 2) { /* calculate renormalized rgb values */ red = (20 * ptr[0] / 255) / 4; green = (20 * ptr[1] / 255) / 4; blue = (20 * ptr[2] / 255) / 4; if (rgb_color[red][green][blue] < 0) { AllocRgbColor (red, green, blue); } XPutPixel (image, x, y, rgb_color[red][green][blue]); ptr += 6; } ptr += 3 * width; } /* upper right pixels */ ptr = ppm + 3; for (y = 0; y < height; y += 2) { for (x = 1; x < width; x += 2) { /* calculate renormalized rgb values */ red = (20 * ptr[0] / 255 + 1) / 4; green = (20 * ptr[1] / 255 + 1) / 4; blue = (20 * ptr[2] / 255 + 1) / 4; if (rgb_color[red][green][blue] < 0) { AllocRgbColor (red, green, blue); } XPutPixel (image, x, y, rgb_color[red][green][blue]); ptr += 6; } ptr += 3 * width; } /* lower left pixels */ ptr = ppm + 3 * width; for (y = 1; y < height; y += 2) { for (x = 0; x < width; x += 2) { /* calculate renormalized rgb values */ red = (20 * ptr[0] / 255 + 2) / 4; green = (20 * ptr[1] / 255 + 2) / 4; blue = (20 * ptr[2] / 255 + 2) / 4; if (rgb_color[red][green][blue] < 0) { AllocRgbColor (red, green, blue); } XPutPixel (image, x, y, rgb_color[red][green][blue]); ptr += 6; } ptr += 3 * width; } /* lower right pixels */ ptr = ppm + 3 * width + 3; for (y = 1; y < height; y += 2) { for (x = 1; x < width; x += 2) { /* calculate renormalized rgb values */ red = (20 * ptr[0] / 255 + 3) / 4; green = (20 * ptr[1] / 255 + 3) / 4; blue = (20 * ptr[2] / 255 + 3) / 4; if (rgb_color[red][green][blue] < 0) { AllocRgbColor (red, green, blue); } XPutPixel (image, x, y, rgb_color[red][green][blue]); ptr += 6; } ptr += 3 * width; } } /* PpmToImage8Bit */ /* * */ XBBool InitImage (int visual_class) { XVisualInfo vinfo; XVisualInfo *result; int i, nitems; if (defDepth > 8) { /* get visual for true color display */ vinfo.class = visual_class; result = XGetVisualInfo (dpy, VisualClassMask, &vinfo, &nitems); for (i = 0; i < nitems; i++) { if (result[i].depth == defDepth) { break; } } if (i == nitems) { fprintf (stderr, "cannot find VisalInfo for current bpp. Expect color problems"); i = 0; } /* get pixel format */ rmask = result[i].red_mask; gmask = result[i].green_mask; bmask = result[i].blue_mask; AnalyzeColorMask (rmask, &rbits, &rshift); AnalyzeColorMask (gmask, &gbits, &gshift); AnalyzeColorMask (bmask, &bbits, &bshift); XFree (result); #ifdef DEBUG fprintf (stderr, "Red: mask=%08lx, bits=%d, shift=%d\n", rmask, rbits, rshift); fprintf (stderr, "Green: mask=%08lx, bits=%d, shift=%d\n", gmask, gbits, gshift); fprintf (stderr, "Blue: mask=%08lx, bits=%d, shift=%d\n", bmask, bbits, bshift); #endif ppm_to_image = PpmToImageRgb; } else { /* 8 bit display with color map */ int r, g, b; for (r = 0; r < 6; r++) { for (g = 0; g < 6; g++) { for (b = 0; b < 6; b++) { rgb_color[r][g][b] = -1; } } } ppm_to_image = PpmToImage8Bit; } /* set up offset for r,g,b values */ rbase = gbase = bbase = 0x1000; /* that's all */ return XBTrue; } /* InitImage */ /* * */ Pixmap ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add) { XImage *image; Pixmap tmp; int width, height; unsigned char *ppm; char *data; /* load ppm file */ if (NULL == (ppm = ReadPpmFile (path, filename, &width, &height))) { fprintf (stderr, "failed to load pixmap %s\n", filename); return None; } /* alloc ppm and image data */ if (NULL == (data = malloc (((bitsPerPixel + 7) / 8) * width * height))) { fprintf (stderr, "failed to alloc image data\n"); return None; } /* create image */ image = XCreateImage (dpy, defVisual, defDepth, ZPixmap, 0, data, width, height, 32, 0); if (image == NULL) { fprintf (stderr, "create image failed\n"); return None; } /* recolor ppm image */ CchToPpm (ppm, width, height, fg, bg, add); /* convert ppm to image */ (*ppm_to_image) (ppm, width, height, image); /* free ppm data */ free (ppm); /* create pixmap */ tmp = XCreatePixmap (dpy, win, width, height, defDepth); /* put image */ XPutImage (dpy, tmp, gcWindow, image, 0, 0, 0, 0, width, height); /* delete image */ #ifdef DEBUG_ALLOC Dbg_Vfree (__FILE__, __LINE__, data); #endif XDestroyImage (image); /* thats 'all */ return tmp; } /* ReadCchPixmap */ /* * */ Pixmap ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color) { XImage *image; Pixmap tmp; int width, height; unsigned char *epm, *ppm; char *data; int depth; /* load ppm file */ if (NULL == (epm = ReadEpmFile (path, filename, &width, &height, &depth))) { fprintf (stderr, "failed to load pixmap %s\n", filename); return None; } /* adjust number of colors */ if (n_colors > depth) { n_colors = depth; } /* alloc ppm and image data */ data = malloc (((bitsPerPixel + 7) / 8) * width * height); assert (data != NULL); ppm = malloc (depth * width * height); assert (ppm != NULL); /* create image */ image = XCreateImage (dpy, defVisual, defDepth, ZPixmap, 0, data, width, height, 32, 0); if (image == NULL) { fprintf (stderr, "create image failed\n"); return None; } /* recolor ppm image */ EpmToPpm (epm, ppm, width, height, n_colors, color); /* convert ppm to image */ (*ppm_to_image) (ppm, width, height, image); /* free ppm data */ free (epm); free (ppm); /* create pixmap */ tmp = XCreatePixmap (dpy, win, width, height, defDepth); /* put image */ XPutImage (dpy, tmp, gcWindow, image, 0, 0, 0, 0, width, height); /* delete image */ #ifdef DEBUG_ALLOC Dbg_Vfree (__FILE__, __LINE__, data); #endif XDestroyImage (image); /* thats 'all */ return tmp; } /* ReadEpmPixmap */ /* * */ Pixmap ReadRgbPixmap (const char *path, const char *filename) { XImage *image; Pixmap tmp; int width, height; char *data; unsigned char *ppm; /* load ppm file */ if (NULL == (ppm = ReadPpmFile (path, filename, &width, &height))) { fprintf (stderr, "Failed to load pixmap %s\n", filename); return None; } /* alloc ppm and image data */ if (NULL == (data = malloc (((bitsPerPixel + 7) / 8) * width * height))) { fprintf (stderr, "failed to alloc image data\n"); return None; } /* create image */ image = XCreateImage (dpy, defVisual, defDepth, ZPixmap, 0, data, width, height, 32, 0); if (image == NULL) { fprintf (stderr, "create image failed\n"); return None; } /* convert ppm to image */ (*ppm_to_image) (ppm, width, height, image); /* free ppm data */ free (ppm); /* create pixmap */ tmp = XCreatePixmap (dpy, win, width, height, defDepth); /* put image */ XPutImage (dpy, tmp, gcWindow, image, 0, 0, 0, 0, width, height); /* delete image */ #ifdef DEBUG_ALLOC Dbg_Vfree (__FILE__, __LINE__, data); #endif XDestroyImage (image); return tmp; } /* ReadRgbPixmap */ /* * */ Pixmap ReadPbmBitmap (const char *path, const char *filename) { int width, height; unsigned char *pbm; Pixmap tmp; /* load ppm file */ if (NULL == (pbm = ReadPbmFile (path, filename, &width, &height))) { fprintf (stderr, "Failed to load bitmap %s\n", filename); return None; } /* create bitmap data */ tmp = XCreateBitmapFromData (dpy, win, (char *)pbm, width, height); /* free ppm data */ free (pbm); return tmp; } /* ReadPbmBitmap */ /* * convert colorname to value */ XBColor GUI_ParseColor (const char *name) { XColor color; if (!XParseColor (dpy, DefaultColormap (dpy, DefaultScreen (dpy)), name, &color)) { return COLOR_INVALID; } return SET_COLOR (color.red >> 11, color.green >> 11, color.blue >> 11); } /* GUI_ParseColor */ /* * end of file x11c_image.c */ xblast-2.10.4/x11c_image.h0000644000175000017500000000257710372731125014313 0ustar rhondaalfie/* * file x11c_image.h - * * $Id: x11c_image.h,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_COLOR_IMAGE_H #define _X11_COLOR_IMAGE_H /* * global prototypes */ extern XBBool InitImage (int visual_class); extern Pixmap ReadPbmBitmap (const char *path, const char *filename); extern Pixmap ReadRgbPixmap (const char *path, const char *filename); extern Pixmap ReadCchPixmap (const char *path, const char *filename, XBColor fg, XBColor bg, XBColor add); extern Pixmap ReadEpmPixmap (const char *path, const char *filename, int n_colors, const XBColor * color); #endif /* * end of file x11c_image.h */ xblast-2.10.4/x11c_init.c0000644000175000017500000002165210372731125014162 0ustar rhondaalfie/* * file x11c_init.c - initialite x11 graphics engine * * $Id: x11c_init.c,v 1.8 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local variables */ static XBQuitFunction quitFunc = NULL; /* * local function: GetBitsPerPixel * description: get memory bits for color depth * return value: bits per pixel (in memroy) * parameters: depth - color depth bits bits */ static int GetBitsPerPixel (int depth) { XPixmapFormatValues *xpfv; int npfv, result; result = depth; if (NULL != (xpfv = XListPixmapFormats (dpy, &npfv))) { int i; for (i = 0; i < npfv; i++) { if (depth == xpfv[i].depth) { result = xpfv[i].bits_per_pixel; } } XFree (xpfv); } return result; } /* GetBitsPerPixel */ /* * local function: alloc color * description: allocate any given color by name (we need this to get black an white into our colormap * result: colormap index of allocated color * parameters: colorName - literal name of color * subst - colormap index to use if alloc fails */ static int AllocColor (char *colorName, int subst) { XColor colorUsed, colorExact; /* get color from name */ if ((NULL == colorName) || (!XParseColor (dpy, cmap, colorName, &colorExact))) { fprintf (stderr, "unknown color %s\n", colorName ? colorName : "(null)"); /* use substitute instead */ return subst; } /* try to alloc color cell */ colorUsed = colorExact; if (XAllocColor (dpy, cmap, &colorUsed)) { return colorUsed.pixel; } /* if private colormap is in use return white */ if (cmap != DefaultColormap (dpy, DefaultScreen (dpy))) { return subst; } /* create private color map */ cmap = XCopyColormapAndFree (dpy, cmap); XSetWindowColormap (dpy, win, cmap); /* alloc again */ colorUsed = colorExact; if (XAllocColor (dpy, cmap, &colorUsed)) { return colorUsed.pixel; } return subst; } /* AllocColor */ /* * local function: InitDisplay * description: Contac X11 displays and set some standard values * return value: XBTrue if successful * parameters: display - string with display name * visualClass - pointer to return visual class of display */ static XBBool InitDisplay (const char *display, int *visualClass) { XVisualInfo visual_info; #ifdef DEBUG fprintf (stderr, "Display is \"%s\"\n", XDisplayName (display)); #endif /* open display */ if (!(dpy = XOpenDisplay (display))) { fprintf (stderr, "could not open display %s\n", XDisplayName (display)); return XBFalse; } /* set some information of visual */ defDepth = DefaultDepth (dpy, DefaultScreen (dpy)); bitsPerPixel = GetBitsPerPixel (defDepth); /* set default visual */ defVisual = DefaultVisual (dpy, DefaultScreen (dpy)), /* set colormap to default */ cmap = DefaultColormap (dpy, DefaultScreen (dpy)); /* alloc black and white, so we still have them if we a use private colormap */ whitePixel = AllocColor ("White", WhitePixel (dpy, DefaultScreen (dpy))); blackPixel = AllocColor ("Black", BlackPixel (dpy, DefaultScreen (dpy))); /* get visual class */ assert (visualClass != NULL); *visualClass = DirectColor; while (!XMatchVisualInfo (dpy, DefaultScreen (dpy), defDepth, *visualClass, &visual_info)) { *visualClass -= 1; } if (*visualClass < TrueColor) { return XBFalse; } return XBTrue; } /* InitDisplay */ /* * local function: InitWindow * description: create xblast window and icon * return value: XBTrue on success * parameters: winTitle - window title for window manager * iconTile - icon title for window manager */ static int InitWindow (char *winTitle, char *iconTitle) { XWindowAttributes xwa; XSetWindowAttributes xswa; XSizeHints *xsh; XClassHint *xch; XEvent xev; XGCValues xgcv; /* Set Window Attributes */ xswa.event_mask = EVENT_MASK_NORMAL; xswa.background_pixel = blackPixel; xswa.border_pixel = blackPixel; xswa.override_redirect = False; xswa.colormap = cmap; /* Open the Window */ win = XCreateWindow (dpy, DefaultRootWindow (dpy), 0, 0, PIXW, PIXH + SCOREH, 0, defDepth, InputOutput, defVisual, CWEventMask | CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &xswa); /* Change Window and icon Title */ XChangeProperty (dpy, win, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)winTitle, strlen (winTitle)); XChangeProperty (dpy, win, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)iconTitle, strlen (iconTitle)); /* set window class */ if (NULL == (xch = XAllocClassHint ())) { fprintf (stderr, "alloc failed\n"); return XBFalse; } xch->res_name = xblastResName; xch->res_class = xblastResClass; XSetClassHint (dpy, win, xch); XFree (xch); /* set min and max geometry */ if (NULL == (xsh = XAllocSizeHints ())) { fprintf (stderr, "alloc failed\n"); return XBFalse; } xsh->flags = PPosition | PSize | PMinSize | PMaxSize; xsh->min_width = PIXW; xsh->max_width = PIXW; xsh->min_height = PIXH + SCOREH; xsh->max_height = PIXH + SCOREH; XSetWMSizeHints (dpy, win, xsh, XA_WM_NORMAL_HINTS); XFree (xsh); /* create graphics context for window */ xgcv.foreground = blackPixel; xgcv.background = whitePixel; gcWindow = XCreateGC (dpy, win, GCForeground | GCBackground, &xgcv); /* Set Cursor */ XDefineCursor (dpy, win, XCreateFontCursor (dpy, XC_trek)); /* Map the Window */ XMapRaised (dpy, win); /* wait for an expose event */ do { XNextEvent (dpy, &xev); } while (xev.type != Expose); /* get actual window size */ if (!XGetWindowAttributes (dpy, win, &xwa)) { fprintf (stderr, "could not get window size\n"); return XBFalse; } if ((xwa.width < PIXW) || (xwa.height < PIXH)) { fprintf (stderr, "display is to small for window\n"); return XBFalse; } return XBTrue; } /* InitWindow */ /* * local function: InitIcon * description: Setup icon for XBlast window * return value: none * parameters: none */ static void SetIcon (void) { XWMHints *wmh = XAllocWMHints (); assert (NULL != wmh); /* set icon pixmap and mask */ wmh->flags = IconPixmapHint | IconMaskHint; wmh->icon_pixmap = ReadRgbPixmap (imgPathExpl, "expl00"); wmh->icon_mask = ReadPbmBitmap (imgPathExpl, "expl00"); XSetWMHints (dpy, win, wmh); /* clean up */ XFree (wmh); } /* InitIcon */ /* * global function: GUI_Init * description: Initialize the X11 graphics engine * return value: XBTrue on success * parameters: argc - number commandline arguments * argv - array with commandline arguments */ XBBool GUI_Init (int argc, char *argv[]) { int visualClass; /* init x11 display */ if (!InitDisplay (NULL, &visualClass)) { return XBFalse; } /* now initialize the window */ if (!InitWindow ("XBlast TNT " VERSION_STRING, "XBlast TNT")) { return XBFalse; } /* now setup image loading */ if (!InitImage (visualClass)) { return XBFalse; } /* create our own icon */ SetIcon (); /* now create pixmap for double bufferung */ if (!InitPixmap ()) { return XBFalse; } /* initalisize fonst for text output */ if (!InitFonts ()) { return XBFalse; } /* initalisize tile drawing and scoreboard */ if (!InitTiles ()) { return XBFalse; } /* Initialsize Sprites */ if (!InitSprites ()) { return XBFalse; } /* Setup Event handler */ if (!InitEvent ()) { return XBFalse; } /* init joystick support */ if (!InitJoystick ()) { return XBFalse; } /* that's all */ return XBTrue; } /* init_display */ /* * global function: GUI_Finish * description: Shutdown x11 graphics engine * return value: none * parameters: none */ void GUI_Finish (void) { /* finish joystick support */ FinishJoystick (); /* some cleaning up */ FinishEvent (); /* shutdown connection to x-server */ if (dpy != NULL) { XCloseDisplay (dpy); } } /* GUI_Finish */ /* * */ static int IoErrorHandler (Display * _dpy) { assert (NULL != quitFunc); Dbg_Out ("connection to display %s lost.\n" "shutting down xblast.\n", DisplayString (_dpy)); (*quitFunc) (); return 0; } /* IoErrorHandler */ /* * */ void GUI_OnQuit (XBQuitFunction _quitFunc) { assert (NULL != _quitFunc); quitFunc = _quitFunc; XSetIOErrorHandler (IoErrorHandler); } /* GUI_OnQuit */ /* * end of file x11c_init.c */ xblast-2.10.4/x11c_pixmap.c0000644000175000017500000001320510372731125014510 0ustar rhondaalfie/* * file x11c_pixmap.c - double buffer for drawing * * $Id: x11c_pixmap.c,v 1.9 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #include "x11_common.h" /* * local constants */ #define FADE_STEP 16 /* * local variables */ //static XRectangle xrec[MAZE_W*MAZE_H + STAT_W*STAT_H]; /* Changed by VVL (Chat) 12/11/99 */ #ifdef SMPF static XRectangle xrec[MAZE_W * (MAZE_H + 2) + STAT_W * 4]; #else /* Added by Fouf on 01/19/00 15:44:43 */ static XRectangle xrec[MAZE_W * (MAZE_H + 1) + STAT_W * 4]; #endif static XRectangle *xrecMax = xrec; /* fading */ static int fadeMax; /* maximum y coordinate */ static int fadeStep; /* step width between lines */ /* GC to use*/ static GC fadeGC; /* * */ XBBool InitPixmap (void) { XGCValues xgcv; const CFGColor *cfgColor; cfgColor = GetColorConfig (); assert (cfgColor != NULL); /* where to draw pixmap */ pix = XCreatePixmap (dpy, win, PIXW, PIXH + SCOREH, defDepth); /* gc : copy pixmap to window */ xgcv.fill_style = FillTiled; xgcv.tile = pix; gcFromPix = XCreateGC (dpy, win, GCTile | GCFillStyle, &xgcv); /* gc : clear pixmap */ xgcv.fill_style = FillTiled; xgcv.tile = ReadCchPixmap (imgPathMisc, imgFileTitle, COLOR_BLACK, cfgColor->titleFg, cfgColor->titleBg); gcClearPix = XCreateGC (dpy, pix, GCFillStyle | GCTile, &xgcv); /* that's all */ return XBTrue; } /* InitPixmap */ /* * */ void GUI_ClearPixmap (void) { XFillRectangle (dpy, pix, gcClearPix, 0, 0, PIXW, PIXH + SCOREH); } /* GUI_ClearPixmap */ /* * */ void GUI_AddMazeRectangle (int x, int y) { xrecMax->x = BLOCK_WIDTH * x; xrecMax->y = BLOCK_HEIGHT * y; xrecMax->width = BLOCK_WIDTH; xrecMax->height = BLOCK_HEIGHT; if (xrecMax != xrec) { XRectangle *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->width)) { prev->width += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* GUI_AddMazeRectangle */ /* * */ void GUI_AddStatRectangle (int x, int y) { xrecMax->x = x * STAT_WIDTH; xrecMax->y = MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT; xrecMax->width = STAT_WIDTH; xrecMax->height = (y < STAT_H) ? STAT_HEIGHT : LED_HEIGHT; if (xrecMax != xrec) { XRectangle *prev = xrecMax - 1; /* try to join rectangles */ if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->width)) { prev->width += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* GUI_AddStatRectangle */ /* Added by VVL (Chat) 12/11/99 : Begin */ void GUI_AddChatRectangle (int x, int y) { #ifdef SMPF int i = 2; #else int i = 1; #endif xrecMax->height = i * STAT_HEIGHT + BLOCK_HEIGHT + 8; xrecMax->x = x * STAT_WIDTH; xrecMax->y = (MAZE_H + i) * BLOCK_HEIGHT; xrecMax->width = STAT_WIDTH; if (xrecMax != xrec) { XRectangle *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->width)) { prev->width += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* Added by VVL (Chat) 12/11/99 : End */ /* Added by VVL (Chat) 12/11/99 : Begin */ void GUI_AddTilesRectangle (int x, int y) { #ifdef SMPF int i = 0; #else int i = 0; #endif xrecMax->height = i * STAT_HEIGHT; xrecMax->x = x * STAT_WIDTH; xrecMax->y = (MAZE_H + i) * BLOCK_HEIGHT; xrecMax->width = STAT_WIDTH; if (xrecMax != xrec) { XRectangle *prev = xrecMax - 1; if ((prev->y == xrecMax->y) && ((xrecMax->x - prev->x) == prev->width)) { prev->width += BLOCK_WIDTH; xrecMax = prev; } } xrecMax++; } /* Added by VVL (Chat) 12/11/99 : End */ /* * */ void GUI_FlushPixmap (XBBool flag) { int i; if (!flag) { /* Copy Pixmap to Window */ for (i = 0; i < 4; i++) { XFillRectangle (dpy, win, gcFromPix, 0, (PIXH + SCOREH) / 4 * i, PIXW, (PIXH + SCOREH) / 4); } } else { if (!iconified) { XFillRectangles (dpy, win, gcFromPix, xrec, xrecMax - xrec); } xrecMax = xrec; } GUI_Sync (); } /* GUI_FlushPixmap */ /* * */ void GUI_FlushScoreBoard (void) { XFillRectangle (dpy, win, gcFromPix, 0, PIXH, PIXW, SCOREH); GUI_Sync (); } /* GUI_FlushScoreBoard */ /* * */ void GUI_InitFade (XBFadeMode mode, int maxLines) { assert (maxLines <= PIXH + SCOREH); fadeMax = maxLines; fadeStep = FADE_STEP; switch (mode) { case XBFM_IN: fadeGC = gcFromPix; break; case XBFM_BLACK_OUT: fadeGC = gcWindow; XSetForeground (dpy, gcWindow, blackPixel); break; case XBFM_WHITE_OUT: fadeGC = gcWindow; XSetForeground (dpy, gcWindow, whitePixel); break; } } /* GUI_InitFade */ /* * */ XBBool GUI_DoFade (void) { int y, yStep; if (fadeStep <= 0) { return XBFalse; } /* setup lines to draw */ if (fadeStep == FADE_STEP) { y = 0; yStep = FADE_STEP; } else { y = fadeStep; yStep = 2 * fadeStep; } for (y = fadeStep; y < fadeMax; y += yStep) { XFillRectangle (dpy, win, fadeGC, 0, y, PIXW, 1); } GUI_Sync (); /* prepare next step */ fadeStep /= 2; /* that´s all */ return XBTrue; } /* GUI_FadeOut */ /* * end of file x11c_pixmap.c */ xblast-2.10.4/x11c_pixmap.h0000644000175000017500000000175410372731125014523 0ustar rhondaalfie/* * file x11c_pixmap.h - * * $Id: x11c_pixmap.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_COLOR_PIXMAP_H #define _X11_COLOR_PIXMAP_H extern XBBool InitPixmap (void); #endif /* * ende of file x11c_pixmap.h */ xblast-2.10.4/x11c_sprite.c0000644000175000017500000002205110372731125014517 0ustar rhondaalfie/* * file x11c_sprite.c - drawing sprites under X11 * * $Id: x11c_sprite.c,v 1.5 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local variables */ static GC gcSpriteMask; static GC gcSpriteBits; static Pixmap pixBombMask[MAX_BOMBS][MAX_BOMB_ANIME]; static Pixmap pixBombBits[MAX_BOMBS][MAX_BOMB_ANIME]; static Pixmap pixExplMask[MAX_EXPLOSION]; static Pixmap pixExplBits[MAX_EXPLOSION]; static Pixmap pixEpmSpriteBits[MAX_PLAYER][MAX_ANIME_EPM]; static Pixmap pixEpmSpriteMask[MAX_PLAYER][MAX_ANIME_EPM]; static Pixmap pixPpmSpriteBits[MAX_ANIME_PPM]; static Pixmap pixPpmSpriteMask[MAX_ANIME_PPM]; static Pixmap pixIconBits[MAX_ICON_SPRITES]; static Pixmap pixIconMask[MAX_ICON_SPRITES]; static CFGPlayerGraphics gfxPlayer[MAX_PLAYER]; static const XBColor colorIcon[MAX_ICON_SPRITES] = { COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_SPRING_GREEN, COLOR_RED, COLOR_SPRING_GREEN, COLOR_GRAY_75, COLOR_RED, COLOR_GREEN, COLOR_BLUE, }; /* * local function init_sprites_color */ XBBool InitSprites (void) { XGCValues xgcv; int i, j; /* gc for drawing mask */ xgcv.foreground = whitePixel; xgcv.fill_style = FillStippled; gcSpriteMask = XCreateGC (dpy, pix, GCFillStyle | GCForeground, &xgcv); /* gc for drawing sprite bits */ xgcv.fill_style = FillTiled; gcSpriteBits = XCreateGC (dpy, pix, GCFillStyle, &xgcv); /* bomb sprites */ for (i = 0; i < MAX_BOMBS; i++) { for (j = 0; j < MAX_BOMB_ANIME; j++) { pixBombMask[i][j] = ReadPbmBitmap (imgPathExpl, imgFileBomb[i][j]); pixBombBits[i][j] = ReadRgbPixmap (imgPathExpl, imgFileBomb[i][j]); if ((None == pixBombBits[i][j]) || (None == pixBombMask[i][j])) { return XBFalse; } } } /* create explosion sprites */ for (i = 0; i < MAX_EXPLOSION; i++) { /* mask */ pixExplMask[i] = ReadPbmBitmap (imgPathExpl, imgFileExpl[i]); pixExplBits[i] = ReadRgbPixmap (imgPathExpl, imgFileExpl[i]); if ((None == pixExplBits[i]) || (None == pixExplMask[i])) { return XBFalse; } } /* set default value for player sprites */ for (i = 0; i < MAX_PLAYER; i++) { for (j = 0; j < MAX_ANIME_EPM; j++) { pixEpmSpriteBits[i][j] = pixEpmSpriteMask[i][j] = None; gfxPlayer[i].shape = ATOM_INVALID; gfxPlayer[i].helmet = COLOR_INVALID; gfxPlayer[i].face = COLOR_INVALID; gfxPlayer[i].body = COLOR_INVALID; gfxPlayer[i].handsFeet = COLOR_INVALID; gfxPlayer[i].armsLegs = COLOR_INVALID; gfxPlayer[i].white = COLOR_INVALID; } } /* create shared players sprites */ for (j = 0; j < MAX_ANIME_PPM; j++) { pixPpmSpriteBits[j] = ReadRgbPixmap (imgPathSprite, imgFileSpritePpm[j]); pixPpmSpriteMask[j] = ReadPbmBitmap (imgPathSprite, imgFileSpritePpm[j]); if ((None == pixPpmSpriteBits[j]) || (None == pixPpmSpriteMask[j])) { return XBFalse; } } /* load all icons soprites */ for (i = 0; i < MAX_ICON_SPRITES; i++) { pixIconBits[i] = ReadCchPixmap (imgPathMisc, imgFileIcon[i], COLOR_BLACK, colorIcon[i], COLOR_LIGHT_GOLDENROD); pixIconMask[i] = ReadPbmBitmap (imgPathMisc, imgFileIcon[i]); } /* that's all */ return XBTrue; } /* Init Sprites */ /* * load a single player sprite animation */ XBBool GUI_LoadPlayerSprite (int player, int anime, const CFGPlayerGraphics * config) { int i; const char *epmName; assert (player < MAX_PLAYER); assert (config != NULL); if (!ComparePlayerGraphics (config, gfxPlayer + player)) { /* graphics has changed => delete all loaded pixmaps */ for (i = 0; i < MAX_ANIME_EPM; i++) { if (None != pixEpmSpriteBits[player][i]) { XFreePixmap (dpy, pixEpmSpriteBits[player][i]); pixEpmSpriteBits[player][i] = None; } if (None != pixEpmSpriteMask[player][i]) { XFreePixmap (dpy, pixEpmSpriteMask[player][i]); pixEpmSpriteMask[player][i] = None; } } gfxPlayer[player] = *config; } /* check if loading of pixmap is needed */ if (ATOM_INVALID == config->shape) { pixEpmSpriteBits[player][anime] = None; pixEpmSpriteMask[player][anime] = None; } else { epmName = ImgFileSpriteEpm (config->shape, anime); if (None == pixEpmSpriteBits[player][anime]) { pixEpmSpriteBits[player][anime] = ReadEpmPixmap (imgPathSprite, epmName, NUM_PLAYER_COLORS, &config->helmet); if (None == pixEpmSpriteBits[player][anime]) { return XBFalse; } } if (None == pixEpmSpriteMask[player][anime]) { pixEpmSpriteMask[player][anime] = ReadPbmBitmap (imgPathSprite, epmName); if (None == pixEpmSpriteMask[player][anime]) { return XBFalse; } } } return XBTrue; } /* GUI_LoadPlayerSprite */ /* * */ void GUI_LoadIconSprite (int index, XBColor color) { assert (index >= 0); assert (index < MAX_COLOR_SPRITES); /* load sprite */ if (pixIconBits[index] != None) { XFreePixmap (dpy, pixIconBits[index]); } if (pixIconMask[index] != None) { XFreePixmap (dpy, pixIconMask[index]); } pixIconBits[index] = ReadCchPixmap (imgPathMisc, imgFileIcon[index], COLOR_BLACK, color, COLOR_LIGHT_GOLDENROD); pixIconMask[index] = ReadPbmBitmap (imgPathMisc, imgFileIcon[index]); } /* GUI_LoadColorSprite */ /* * draw a masked sprite */ static void DrawSprite (const BMRectangle * rect, Pixmap bits, Pixmap mask) { /* test values */ assert (rect != NULL); assert (mask != None); assert (bits != None); /* draw it */ XSetClipOrigin (dpy, gcSpriteBits, rect->x, rect->y); XSetTSOrigin (dpy, gcSpriteBits, rect->x, rect->y); XSetClipMask (dpy, gcSpriteBits, mask); XSetTile (dpy, gcSpriteBits, bits); XFillRectangle (dpy, pix, gcSpriteBits, rect->x, rect->y, rect->w, rect->h); } /* DrawSprite */ /* * draw mask of sprite */ static void DrawMask (const BMRectangle * rect, Pixmap mask) { /* test values */ assert (rect != NULL); assert (mask != None); /* draw it */ XSetTSOrigin (dpy, gcSpriteMask, rect->x, rect->y); XSetStipple (dpy, gcSpriteMask, mask); XFillRectangle (dpy, pix, gcSpriteMask, rect->x, rect->y, rect->w, rect->h); } /* DrawMask */ /* * */ void CopyExplosion (Pixmap pix_tile, int i) { static XGCValues xgcv; xgcv.clip_mask = pixExplMask[i]; xgcv.clip_y_origin = 0; xgcv.clip_x_origin = 0; xgcv.tile = pixExplBits[i]; xgcv.ts_y_origin = 0; xgcv.ts_x_origin = 0; XChangeGC (dpy, gcSpriteBits, GCClipMask | GCClipXOrigin | GCClipYOrigin | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &xgcv); XFillRectangle (dpy, pix_tile, gcSpriteBits, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT); } /* CopyExplosion */ /* * public function : draw_explosion */ void GUI_DrawExplosionSprite (int x, int y, int block) { BMRectangle rect; assert (block < MAX_EXPLOSION); rect.x = x * BLOCK_WIDTH; rect.y = y * BLOCK_HEIGHT; rect.w = BLOCK_WIDTH; rect.h = BLOCK_HEIGHT; DrawSprite (&rect, pixExplBits[block], pixExplMask[block]); } /* GUI_DrawExplosionSprite */ /* * draw bomb */ void GUI_DrawBombSprite (const Sprite * ptr) { int anime = SpriteAnime (ptr); int bomb = SpriteBomb (ptr); assert (anime < MAX_BOMB_ANIME); assert (bomb < MAX_BOMBS); if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), pixBombMask[bomb][anime]); } else { DrawSprite (SpriteRectangle (ptr), pixBombBits[bomb][anime], pixBombMask[bomb][anime]); } } /* GUI_DrawBombSprite */ /* * */ void GUI_DrawPlayerSprite (const Sprite * ptr) { Pixmap bits; Pixmap mask; int anime = SpriteAnime (ptr); int player = SpritePlayer (ptr); assert (anime < MAX_ANIME); assert (player < MAX_PLAYER); if (anime >= MAX_ANIME_EPM) { bits = pixPpmSpriteBits[anime - MAX_ANIME_EPM]; mask = pixPpmSpriteMask[anime - MAX_ANIME_EPM]; } else { bits = pixEpmSpriteBits[player][anime]; mask = pixEpmSpriteMask[player][anime]; } if (SpriteIsMasked (ptr)) { DrawMask (SpriteRectangle (ptr), mask); } else { DrawSprite (SpriteRectangle (ptr), bits, mask); } } /* GUI_DrawPlayerSprite */ /* * */ void GUI_DrawIconSprite (const Sprite * ptr) { int anime = SpriteAnime (ptr); assert (anime < MAX_ICON_SPRITES); if (!SpriteIsMasked (ptr)) { DrawSprite (SpriteRectangle (ptr), pixIconBits[anime], pixIconMask[anime]); } } /* GUI_DrawColorSprite */ /* * draw sprite routine for text sprites */ void GUI_DrawTextSprite (const Sprite * ptr) { GUI_DrawTextbox (SpriteText (ptr), SpriteAnime (ptr), SpriteRectangle (ptr)); } /* GUI_DrawTextSprite */ /* * end of x11c_sprite.h */ xblast-2.10.4/x11c_sprite.h0000644000175000017500000000212710372731125014526 0ustar rhondaalfie/* * file x11c_sprite.h - draw ing sprites under x11 * * $Id: x11c_sprite.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_COLOR_SPRITE_H #define _X11_COLOR_SPRITE_H /* * global prototypes */ extern XBBool InitSprites (void); extern void CopyExplosion (Pixmap pix_tile, int i); #endif /* * end of file x11c_sprite.h */ xblast-2.10.4/x11c_text.c0000644000175000017500000002074210426434470014205 0ustar rhondaalfie/* * file x11c_text.c - draw text strings * * $Id: x11c_text.c,v 1.8 2006/05/04 17:26:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "xblast.h" #include "x11_common.h" /* * local variables */ static GC gcTextBlack; static GC gcTextWhite; static XFontStruct *fontStruct[NUM_FONTS]; /* * load fonts struct by font name */ static XFontStruct * LoadFont (const char *fontName) { XFontStruct *fontStruct; if (NULL == (fontStruct = XLoadQueryFont (dpy, fontName))) { fprintf (stderr, "could not load font %s\n", fontName); /* otherwise get default font struct */ fontStruct = XQueryFont (dpy, XGContextFromGC (gcTextBlack)); } return fontStruct; } /* LoadFont */ /* * */ XBBool InitFonts (void) { XGCValues xgcv; const CFGFont *cfgFont; const CFGColor *cfgColor; /* get config */ cfgFont = GetFontConfig (); assert (cfgFont != NULL); cfgColor = GetColorConfig (); assert (cfgColor != NULL); /* gc black text */ xgcv.fill_style = FillTiled; xgcv.tile = ReadCchPixmap (imgPathMisc, imgFileTextBg, COLOR_BLACK, cfgColor->darkText1, cfgColor->darkText2); xgcv.line_width = BASE_X / 4; gcTextBlack = XCreateGC (dpy, pix, GCTile | GCFillStyle | GCLineWidth, &xgcv); /* gc white text */ xgcv.fill_style = FillTiled; xgcv.tile = ReadCchPixmap (imgPathMisc, imgFileTextFg, COLOR_BLACK, cfgColor->lightText1, cfgColor->lightText2); xgcv.line_width = BASE_X / 4; gcTextWhite = XCreateGC (dpy, pix, GCTile | GCFillStyle | GCLineWidth, &xgcv); /* try to load fonts */ fontStruct[FF_Large] = LoadFont (cfgFont->large); fontStruct[FF_Medium] = LoadFont (cfgFont->medium); fontStruct[FF_Small] = LoadFont (cfgFont->small); /* check load */ assert (NULL != fontStruct[FF_Large]); assert (NULL != fontStruct[FF_Medium]); assert (NULL != fontStruct[FF_Small]); /* that's all */ return XBTrue; } /* InitFonts */ /* * draw simple textbox (in game) */ void GUI_DrawSimpleTextbox (const char *text, unsigned flags, const BMRectangle * rect) { XFontStruct *font; int x, y; int width, height; GC gcFg, gcBg; XRectangle clip; /* first get used font */ font = fontStruct[FM_Size & flags]; /* set gc for foreground and background */ if (flags & FM_Color) { gcFg = gcTextWhite; gcBg = gcTextBlack; } else { gcFg = gcTextBlack; gcBg = gcTextWhite; } /* draw boxes if needed */ XSetTSOrigin (dpy, gcFg, 0, rect->y + (rect->h - BLOCK_HEIGHT) / 2); if (flags & FM_Boxed) { XSetTSOrigin (dpy, gcBg, 0, rect->y + (rect->h - BLOCK_HEIGHT) / 2); XFillRectangle (dpy, pix, gcBg, rect->x, rect->y, rect->w, rect->h); XDrawRectangle (dpy, pix, gcFg, rect->x, rect->y, rect->w, rect->h); } /* draw string */ if (NULL != text) { /* set clipping rectangles */ clip.x = rect->x; clip.y = rect->y; clip.width = rect->w; clip.height = rect->h; XSetClipRectangles (dpy, gcFg, 0, 0, &clip, 1, YXBanded); /* dimensions of text */ width = XTextWidth (font, text, strlen (text)); height = font->max_bounds.ascent - font->max_bounds.descent; /* x- location */ x = rect->x + (rect->w - width) / 2; /* y-location */ y = rect->y + (height + rect->h) / 2; /* draw it */ XSetFont (dpy, gcFg, font->fid); XDrawString (dpy, pix, gcFg, x, y, text, strlen (text)); /* reset clip mask */ XSetClipMask (dpy, gcFg, None); } } /* GUI_DrawSimpleTextbox */ /* * */ static int DrawAlignedText (const char *text, int len, unsigned flags, int x, int y, int w, GC gcFg, GC gcBg, XFontStruct * font) { int width; int dx, dy; int step; assert (text != NULL); assert (font != NULL); /* standard horizontal text */ len++; do { len--; width = XTextWidth (font, text, len); } while (width > w - 2 * BASE_X); /* x- location */ switch (flags & FM_Align) { case FF_Left: x += BASE_X; break; case FF_Right: x += w - width - BASE_X; break; default: x += (w - width) / 2; break; } /* y-location */ if (flags & FM_Outlined) { if (FF_Small == (flags & FM_Size)) { step = 1; } else { step = BASE_X / 4; } for (dx = -step; dx <= step; dx += step) { for (dy = -step; dy <= step; dy += step) { if (dx || dy) { XDrawString (dpy, pix, gcBg, x + dx, y + dy, text, len); } } } } XDrawString (dpy, pix, gcFg, x, y, text, len); /* return values */ return x + width - 1; } /* DrawAlignedText */ /* * */ void GUI_DrawTextbox (const char *text, unsigned flags, const BMRectangle * rect) { XFontStruct *font; int y, height; int right; int len; GC gcFg, gcBg; XRectangle clip; /* first get used font */ font = fontStruct[FM_Size & flags]; /* set gc for foreground and background */ if (flags & FM_Color) { gcFg = gcTextWhite; gcBg = gcTextBlack; } else { gcFg = gcTextBlack; gcBg = gcTextWhite; } /* draw boxes if needed */ XSetTSOrigin (dpy, gcFg, 0, rect->y + (rect->h - BLOCK_HEIGHT) / 2); if (flags & FM_Boxed) { if (!(flags & FM_Transparent)) { XSetTSOrigin (dpy, gcBg, 0, rect->y + (rect->h - BLOCK_HEIGHT) / 2); XFillRectangle (dpy, pix, gcBg, rect->x, rect->y, rect->w, rect->h); } else { XGCValues xgcv; xgcv.line_width = 1; XChangeGC (dpy, gcBg, GCLineWidth, &xgcv); for (y = 0; y < rect->h; y += 2) { XDrawLine (dpy, pix, gcBg, rect->x, rect->y + y, rect->x + rect->w - 1, rect->y + y); } xgcv.line_width = 3; XChangeGC (dpy, gcBg, GCLineWidth, &xgcv); } XDrawRectangle (dpy, pix, gcFg, rect->x, rect->y, rect->w, rect->h); } /* draw string */ if (NULL != text) { len = strlen (text); /* set clipping rectangles */ clip.x = rect->x; clip.y = rect->y; clip.width = rect->w; clip.height = rect->h; XSetClipRectangles (dpy, gcFg, 0, 0, &clip, 1, YXBanded); XSetClipRectangles (dpy, gcBg, 0, 0, &clip, 1, YXBanded); /* set font */ XSetFont (dpy, gcFg, font->fid); XSetFont (dpy, gcBg, font->fid); /* dimensions of text */ height = font->max_bounds.ascent - font->max_bounds.descent; y = rect->y + (height + rect->h) / 2; if (flags & FF_Vertical) { /* vertical text layout */ int i; for (i = 0; i < len; i++) { int h2 = font->max_bounds.ascent + font->max_bounds.descent; int y2 = rect->y + (height + rect->h) / 2 + (2 * i - len + 1) * (h2) / 2; (void)DrawAlignedText (text + i, 1, flags, rect->x, y2, rect->w, gcFg, gcBg, font); }} else { right = DrawAlignedText (text, len, flags, rect->x, y, rect->w, gcFg, gcBg, font); /* cursor for string editors */ if (flags & FF_Cursor) { XDrawLine (dpy, pix, gcFg, right + 2, rect->y + 2, right + 2, rect->y + rect->h - 3); } } /* reset clip mask */ XSetClipMask (dpy, gcFg, None); XSetClipMask (dpy, gcBg, None); } } /* GUI_DrawTextbox */ /* * draw a filled and outlinded polygon */ void GUI_DrawPolygon (int x, int y, int w, int h, int lw, const BMPoint * points, int npoints, XBBool black_white) { XPoint *xp; int i; XGCValues xgcv; /* convert and scale to xpoints */ xp = (XPoint *) calloc (sizeof (XPoint), npoints + 1); for (i = 0; i < npoints; i++) { xp[i].x = (int)(x + w * points[i].x); xp[i].y = (int)(y + h * points[i].y); } xp[npoints] = xp[0]; /* set line width */ xgcv.line_width = lw; /* now draw it */ if (black_white) { XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); XFillPolygon (dpy, pix, gcTextBlack, xp, npoints, Complex, CoordModeOrigin); XDrawLines (dpy, pix, gcTextWhite, xp, npoints + 1, CoordModeOrigin); xgcv.line_width = 2; XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); } else { XChangeGC (dpy, gcTextBlack, GCLineWidth, &xgcv); XFillPolygon (dpy, pix, gcTextWhite, xp, npoints, Complex, CoordModeOrigin); XDrawLines (dpy, pix, gcTextBlack, xp, npoints + 1, CoordModeOrigin); xgcv.line_width = 2; XChangeGC (dpy, gcTextWhite, GCLineWidth, &xgcv); } /* that's all */ free (xp); } /* GUI_DrawPolygon */ /* * end of file x11c_text.c */ xblast-2.10.4/x11c_text.h0000644000175000017500000000171010372731125014201 0ustar rhondaalfie/* * file x11c_text.h - * * $Id: x11c_text.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_COLOR_TEXT_H #define _X11_COLOR_TEXT_H extern XBBool InitFonts (void); #endif /* * */ xblast-2.10.4/x11c_tile.c0000644000175000017500000002141010372731125014144 0ustar rhondaalfie/* * file x11c_tile.c - draw map tiles * * $Id: x11c_tile.c,v 1.9 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" #include "x11_common.h" /* * local variables */ #define MAX_LEDS 5 // 2+3 XBCC static GC gcDrawBlock; static Pixmap pixBlock[MAX_TILE]; static Pixmap pixExplBlock[MAX_EXPLOSION]; static Pixmap pixLeds[MAX_LEDS]; static Pixmap pixScore[MAX_SCORE_TILES]; static XRectangle voidList[MAZE_W * (MAZE_H + 2)]; static XRectangle *voidLast = voidList; static XRectangle blockList[MAX_TILE][MAZE_W * (MAZE_H + 2)]; static XRectangle *blockLast[MAX_TILE]; static XRectangle explList[MAX_EXPLOSION][MAZE_W * (MAZE_H + 2)]; static XRectangle *explLast[MAX_EXPLOSION] = { explList[0], explList[1], explList[2], explList[3], explList[4], explList[5], explList[6], explList[7], explList[8], explList[9], explList[10], explList[11], explList[12], explList[13], explList[14], explList[15], }; /* * */ XBBool InitTiles (void) { const CFGColor *cfgColor; XGCValues xgcv; int i; /* load config */ cfgColor = GetColorConfig (); assert (cfgColor != NULL); /* init led tiles */ for (i = 0; i < 2; i++) { pixLeds[i] = ReadCchPixmap (imgPathScore, imgFileScoreLed[i], COLOR_BLACK, cfgColor->statusFg, cfgColor->statusLed); if (None == pixLeds[i]) { return XBFalse; } } // XBCC fuck colorconfig pixLeds[2] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_RED); pixLeds[3] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_ORANGE); pixLeds[4] = ReadCchPixmap (imgPathScore, imgFileScoreLed[1], COLOR_BLACK, cfgColor->statusFg, COLOR_BLUE); // -XBCC /* init other score tiles */ for (i = 0; i < SBDead; i++) { pixScore[i] = ReadCchPixmap (imgPathScore, imgFileScoreTile[i], COLOR_BLACK, cfgColor->statusFg, cfgColor->statusBg); if (None == pixScore[i]) { return XBFalse; } } /* gc : draw block */ xgcv.fill_style = FillTiled; gcDrawBlock = XCreateGC (dpy, pix, GCFillStyle, &xgcv); /* zero block and explosion tiles */ for (i = 0; i < MAX_TILE; i++) { pixBlock[i] = None; blockLast[i] = &blockList[i][0]; } for (i = 0; i < MAX_EXPLOSION; i++) { pixExplBlock[i] = None; explLast[i] = &explList[i][0]; } return XBTrue; } /* InitTiles */ /* * */ void GUI_DrawBlock (int x, int y, int block) { assert (x >= 0); assert (x < MAZE_W); assert (y >= 0); #ifdef SMPF assert (y < MAZE_H + 4); #else assert (y < MAZE_H + 3); #endif assert (block >= -1); assert (block < MAX_TILE); if (block >= 0) { blockLast[block]->x = x * BLOCK_WIDTH; blockLast[block]->y = y * BLOCK_HEIGHT; blockLast[block]->width = BLOCK_WIDTH; blockLast[block]->height = BLOCK_HEIGHT; blockLast[block]++; } else { voidLast->x = x * BLOCK_WIDTH; voidLast->y = y * BLOCK_HEIGHT; voidLast->width = BLOCK_WIDTH; voidLast->height = BLOCK_HEIGHT; voidLast++; } } /* GUI_DrawBlock */ /* * */ void GUI_DrawExplosion (int x, int y, int block) { assert (block >= 0); assert (block < MAX_EXPLOSION); explLast[block]->x = x * BLOCK_WIDTH; explLast[block]->y = y * BLOCK_HEIGHT; explLast[block]->width = BLOCK_WIDTH; explLast[block]->height = BLOCK_HEIGHT; explLast[block]++; } /* GUI_DrawExplosion */ /* * */ void GUI_FlushBlocks (void) { int i; /* void blocks */ if (voidLast != voidList) { XFillRectangles (dpy, pix, gcClearPix, voidList, voidLast - voidList); voidLast = voidList; } /* normal blocks */ for (i = 0; i < MAX_TILE; i++) { if (pixBlock[i] != None && blockLast[i] != blockList[i]) { XSetTile (dpy, gcDrawBlock, pixBlock[i]); XFillRectangles (dpy, pix, gcDrawBlock, blockList[i], blockLast[i] - blockList[i]); } blockLast[i] = blockList[i]; } /* explosion blocks */ for (i = 0; i < MAX_EXPLOSION; i++) { if (pixExplBlock[i] != None) { if (explLast[i] != explList[i]) { XSetTile (dpy, gcDrawBlock, pixExplBlock[i]); XFillRectangles (dpy, pix, gcDrawBlock, explList[i], explLast[i] - explList[i]); explLast[i] = explList[i]; } } } } /* GUI_FlushBlocks */ /* * */ void GUI_LoadBlockRgb (int id, const char *name) { assert (id >= 0); assert (id < MAX_TILE); assert (pixBlock[id] == None); pixBlock[id] = ReadRgbPixmap (imgPathBlock, name); if (pixBlock[id] == None) { fprintf (stderr, " Faile to load rgb Block %s.ppm \n", name); pixBlock[id] = ReadRgbPixmap (imgPathBlock, "unknown-file"); } } /* GUI_LoadBlock */ /* * */ void GUI_LoadBlockCch (int id, const char *name, XBColor fg, XBColor bg, XBColor add) { assert (id >= 0); assert (id < MAX_TILE); assert (pixBlock[id] == None); pixBlock[id] = ReadCchPixmap (imgPathBlock, name, fg, bg, add); if (pixBlock[id] == None) { fprintf (stderr, " Faile to load Block %s.ppm \n", name); pixBlock[id] = ReadCchPixmap (imgPathBlock, "unknown-file", fg, bg, add); } } /* GUI_LoadBlock */ /* * */ void GUI_InitExplosionBlocks (void) { int i; for (i = 0; i < MAX_EXPLOSION; i++) { pixExplBlock[i] = XCreatePixmap (dpy, pix, BLOCK_WIDTH, BLOCK_HEIGHT, defDepth); /* draw floor tile into it */ XSetTile (dpy, gcDrawBlock, pixBlock[0]); XFillRectangle (dpy, pixExplBlock[i], gcDrawBlock, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT); /* now copy explosion into it */ CopyExplosion (pixExplBlock[i], i); } } /* GUI_InitExplosionBlocks */ /* * */ void GUI_FreeBlock (int in_pix) { assert (in_pix >= 0); assert (in_pix < MAX_TILE); /* free pixmap */ if (None != pixBlock[in_pix]) { XFreePixmap (dpy, pixBlock[in_pix]); pixBlock[in_pix] = None; } } /* GUI_FreeBlock */ /* * */ void GUI_FreeExplosionBlocks (void) { int i; for (i = 0; i < MAX_EXPLOSION; i++) { XFreePixmap (dpy, pixExplBlock[i]); } } /* GUI_FreeExplosionBlocks */ /* * */ void GUI_LoadPlayerScoreTiles (int player, const CFGPlayerGraphics * config) { const CFGColor *cfgColor; XBColor scoreColors[NUM_PLAYER_COLORS]; assert (player < MAX_PLAYER); assert (config != NULL); /* get colors */ cfgColor = GetColorConfig (); assert (NULL != cfgColor); /* copy colors */ scoreColors[0] = config->helmet; scoreColors[1] = config->face; scoreColors[2] = config->handsFeet; scoreColors[3] = config->armsLegs; scoreColors[4] = cfgColor->statusFg; scoreColors[5] = cfgColor->statusBg; scoreColors[6] = COLOR_WHITE; /* load pixmap */ pixScore[SBDead + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[0], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSick + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[1], NUM_PLAYER_COLORS, scoreColors); pixScore[SBPlayer + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[2], NUM_PLAYER_COLORS, scoreColors); pixScore[SBAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[3], NUM_PLAYER_COLORS, scoreColors); pixScore[SBSickAbort + player] = ReadEpmPixmap (imgPathScore, imgFileScorePlayer[4], NUM_PLAYER_COLORS, scoreColors); } /* GUI_LoadPlayerScoreTile */ /* * */ //#ifdef SMPF void GUI_DrawScoreBlock (int x, int y, int block) // SMPF /*#else void GUI_DrawScoreBlock (int x, int block) #endif */ { assert (block < MAX_SCORE_TILES); assert (pixScore[block] != None); XSetTile (dpy, gcDrawBlock, pixScore[block]); //#ifdef SMPF XFillRectangle (dpy, pix, gcDrawBlock, x * STAT_WIDTH, MAZE_H * BLOCK_HEIGHT + y * STAT_HEIGHT, STAT_WIDTH, STAT_HEIGHT); /*#else XFillRectangle (dpy, pix, gcDrawBlock, x*STAT_WIDTH, MAZE_H*BLOCK_HEIGHT, STAT_WIDTH, STAT_HEIGHT); #endif */ } /* GUI_DrawScoreBlock */ /* * */ void GUI_DrawTimeLed (int x, int block) { // if(block > 1) { block = 1;} assert (block < MAX_LEDS); assert (pixLeds[block] != None); XSetTile (dpy, gcDrawBlock, pixLeds[block]); #ifdef SMPF XFillRectangle (dpy, pix, gcDrawBlock, x * LED_WIDTH, MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT * 2, LED_WIDTH, LED_HEIGHT); #else XFillRectangle (dpy, pix, gcDrawBlock, x * LED_WIDTH, MAZE_H * BLOCK_HEIGHT + STAT_HEIGHT, LED_WIDTH, LED_HEIGHT); #endif } /* GUI_DrawTimeLed */ /* * end of file x11c_tile.c */ xblast-2.10.4/x11c_tile.h0000644000175000017500000000171010372731125014152 0ustar rhondaalfie/* * file x11c_tile.h - * * $Id: x11c_tile.h,v 1.4 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X11_COLOR_TILE_H #define _X11_COLOR_TILE_H extern XBBool InitTiles (void); #endif /* * */ xblast-2.10.4/xbconfig.h0000644000175000017500000000271210372731125014163 0ustar rhondaalfie/* * file config.h - configuration types * * $Id: xbconfig.h,v 1.3 2006/02/09 21:21:25 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XBCONFIG_H #define XBCONFIG_H /* * constants */ #define NUM_PLAYER_COLORS 7 /* * type definitions */ /* player data shape, colors, strings etc */ typedef struct { char name[16]; char shape[16]; XBColor helmet; XBColor face; XBColor body; XBColor arms_legs; XBColor hands_feet; XBColor backpack; XBColor white; XBBool useStopKey; } XBPlayerConfig; /* game config (not complete now) */ typedef struct { int num_players; int num_lives; int num_wins; XBBool random_levels; XBBool random_players; XBBool *level_select; } XBGameConfig; #endif /* * end of file config.h */ xblast-2.10.4/xblast-alex.ico0000644000175000017500000000137610047640430015135 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ª ª¢ ª¢ ªª Ä Ä Ä Ä Ä Ä ÀÄ UUUUUUUUUPUUPUU ÄUUUP DÌÌ Ì@ ÌUUUUUP Ä ÀÝÐÕPÄ Ýwwww U ª Ðw0707pÕ ª ÐwpÕ ª ÐwpÕ ÐwpÕ Ðw0707pÕ Ýwwwp ÝÝÝ ÝÐ ÝÝÝÝÝÝ ÝÝÝÝÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast-norbert.ico0000644000175000017500000000137610047640430015657 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ™™‘ ™‘ ™™ Ä Ä Ä Ä Ä Ä ÀÄ DDDDDDDDD@DD@DD ÄDDD@ DÌÌ Ì@ Ì Ä ÀD@@ÄDwwww ™@w0707p@  ™@wp@ ™@wp@@wp@@w0707p@DwwwpDDDD@DDDDDDDDDDÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast-olaf.ico0000644000175000017500000000137610047640430015125 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ™™‘ ™‘ ™™€€€€€€€€ˆˆˆˆˆˆˆˆˆ€ˆˆ€ˆˆ€ˆˆˆ€ˆˆˆˆ€€ˆ€€€ˆwwww ™€w0707p€  ™€wp€ ™€wp€€wp€€w0707p€ˆwwwpˆˆˆˆ€ˆˆˆˆˆˆˆˆˆˆÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast-olli.ico0000644000175000017500000000137610047640430015143 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿw€wxwxww€€€€€€€€ˆˆÿÿÿ€ÿÿÿˆÿ€ÿÿø€ÿÿø€ÿÿˆ€ÿÿÿøˆˆˆˆfffff`€€îàæ`€îwwwwfwàw0707pæ€wàwpæwàwpæàwpæàw0707pæîwwwpîîîîàîîîîîîîîîîÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast-rodi.ico0000644000175000017500000000137610047640430015141 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ"" " ""™™™™™™™™™‘™™‘ ™™  ™™™‘™‘ ™wwww " w0707p‘" wp‘" wp‘ wp‘ w0707p‘ ™wwwp ™™™ ™ ™™™™™™ ™™™™ÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast-ted.ico0000644000175000017500000000137610047640430014760 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ™™‘ ™‘ ™™øøøøøøðø""ªªª ªªª"ª ªª¢* ªª¢*  ªª" ø ªªª¢ˆÿÿÿ€ÿ333330øð»°³0ø »wwww 3 ™ °w0707p³  ™ °wp³ ™ °wp³ °wp³ °w0707p³ »wwwp »»» »° »»»»»» »»»»ÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿxblast-2.10.4/xblast.c0000644000175000017500000000704510374725610013664 0ustar rhondaalfie/* * file xblast.c - main routine * * $Id: xblast.c,v 1.19 2006/02/15 22:30:32 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "xblast.h" /* * going down gracefully */ static void Finish (void) { Dbg_Out ("Finish\n"); /* shutdown sound */ #if defined(XBLAST_SOUND) SND_Finish (); #endif /* shutdown network */ Socket_Finish (); /* clean up some modules */ ClearShapeList (); ClearInfo (); /* save and delete current configuration */ SaveConfig (); FinishConfig (); /* finish all remaining databases */ DB_Finish (); /* finish level selection, if necessary */ FinishLevelSelection (); #ifdef DEBUG_ALLOC Dbg_FinishAlloc (); #endif } /* Finish */ /* * main routine */ #ifdef WMS int WINAPI WinMain (HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // pointer to command line int nCmdShow // show state of window ) #else int main (int argc, char *argv[]) #endif { #if defined(XBLAST_SOUND) CFGSoundSetup soundSetup; #endif #ifndef WMS int i; #endif XBPlayerHost hostType; XBBool autoCentral; XBBool nsound; XBBool check; #ifdef ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); #endif autoCentral = XBFalse; nsound = XBFalse; check = XBFalse; #ifndef WMS if (argc > 1) { i = 1; while (i < argc) { if (0 == strcmp ("-central", argv[i])) { autoCentral = XBTrue; i++; continue; } else if (0 == strcmp ("-ns", argv[i])) { nsound = XBTrue; i++; continue; } else if (0 == strcmp ("-check", argv[i])) { check = XBTrue; i++; continue; } else { break; } } } #endif /* init new configuration */ InitConfig (); /* initialize network */ if (!Socket_Init ()) { return -1; } /* Init Sound support */ #if defined(XBLAST_SOUND) RetrieveSoundSetup (&soundSetup); if (!nsound) { SND_Init (&soundSetup); } #endif /* Initialize graphics engine */ #ifdef WMS if (!GUI_Init (0, NULL)) { #else if (!GUI_Init (argc, argv)) { #endif Finish (); return -1; } GUI_OnQuit (Finish); if (check && !CheckConfig ()) { GUI_Finish (); Finish (); return -2; } /* init random number generator */ SeedRandom (time (NULL)); /* Call intro */ DoIntro (); /* main loop until quit */ while (XBPH_None != (hostType = DoMenu (autoCentral))) { /* save current configurations */ SaveConfig (); SetHostType (hostType); /* run selected game */ switch (hostType) { case XBPH_Local: RunLocalGame (); break; case XBPH_Demo: RunDemoGame (); break; case XBPH_Server: RunServerGame (); break; default: RunClientGame (hostType); break; } } /* close Display */ GUI_Finish (); /* shutdown the rest */ Finish (); /* that's all */ return 0; } /* main */ /* * end of file xblast.c */ xblast-2.10.4/xblast.coff0000644000175000017500000001267610107051712014352 0ustar rhondaalfieL¨.rsrcô<0 @ÀIA €ð€IA`€x€€¨€À€Ø€IA LIA \IA lIA |IA ŒIA œIAÀ€0€Î€H€æ€`€€x€€€4€¨€IA ¬IA ¼IA ÌIA ÜIA ìIA üXBLAST XBLAST_ALEXXBLAST_NORBERT XBLAST_OLLI XBLAST_RODI XBLAST_TED èôèÜèÄ è¬è”è|¤¸Ìà( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿˆˆ€ˆ€€€€€€€€€€€€€ˆˆ€€€€ˆˆˆw€€ˆwxˆ€pp€÷ˆ‡ÿxw€ˆ€€‡ÿxxx€wxpˆ38™€ˆ€€»‘€ˆ3 ™ˆˆ€™¹™›‘››™‘››‘ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿ€ÿÿÿÿÿÿ€ÿÿ€ÿÿÿþÿþÿüüüüüþÿþÿÿÏÿ€‡ÿÀÿàÿø<ÿÿüÿÿøÿÿøÿÿüÿÿþ¿ÿÿÿÿÿÿÿÿ( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿw€wxwxww€€€€€€€€ˆˆÿÿÿ€ÿÿÿˆÿ€ÿÿø€ÿÿø€ÿÿˆ€ÿÿÿøˆˆˆˆfffff`€€îàæ`€îwwwwfwàw0707pæ€wàwpæwàwpæàwpæàw0707pæîwwwpîîîîàîîîîîîîîîîÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿ( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ™™‘ ™‘ ™™ Ä Ä Ä Ä Ä Ä ÀÄ DDDDDDDDD@DD@DD ÄDDD@ DÌÌ Ì@ Ì Ä ÀD@@ÄDwwww ™@w0707p@  ™@wp@ ™@wp@@wp@@w0707p@DwwwpDDDD@DDDDDDDDDDÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿ( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ"" " ""™™™™™™™™™‘™™‘ ™™  ™™™‘™‘ ™wwww " w0707p‘" wp‘" wp‘ wp‘ w0707p‘ ™wwwp ™™™ ™ ™™™™™™ ™™™™ÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿ( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ™™‘ ™‘ ™™øøøøøøðø""ªªª ªªª"ª ªª¢* ªª¢*  ªª" ø ªªª¢ˆÿÿÿ€ÿ333330øð»°³0ø »wwww 3 ™ °w0707p³  ™ °wp³ ™ °wp³ °wp³ °w0707p³ »wwwp »»» »° »»»»»» »»»»ÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿ( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ ª ª¢ ª¢ ªª Ä Ä Ä Ä Ä Ä ÀÄ UUUUUUUUUPUUPUU ÄUUUP DÌÌ Ì@ ÌUUUUUP Ä ÀÝÐÕPÄ Ýwwww U ª Ðw0707pÕ ª ÐwpÕ ª ÐwpÕ ÐwpÕ Ðw0707pÕ Ýwwwp ÝÝÝ ÝÐ ÝÝÝÝÝÝ ÝÝÝÝÿ‡ÃÿÿÿÿÿÿÿÿÁÿÿÁÿÿÁÿÿÀÿÿÀÿÿÀÿÿÀÿÿ€ÿÿ€ÿÿ€ÿÿ€ÿþÿüø?ððàÀÀàüüüþÿÿÿÿ€ÿÿàÿÿüÿ è è è è è èL\l|Œœ¬¼ÌÜìü.rsrcxblast-2.10.4/xblast.h0000644000175000017500000001654510412222330013656 0ustar rhondaalfie/* * file xblast.h - common macros, constants ansd types * * $Id: xblast.h,v 1.16 2006/03/28 11:58:16 fzago Exp $ * * Program XBLAST * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will be entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifdef XBLAST_XBLAST_H #error #endif #define XBLAST_XBLAST_H /* include config header first */ #ifdef HAVE_CONFIG_H /* autoconf generated */ #include "config.h" #else /* non-autoconf generated, include target specific header */ #ifdef __MINGW32__ #include "config-mingw.h" #endif #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_TIME_H #include #endif #ifdef WIN32 #include #endif #ifdef W32 #ifndef WMS #include #include #endif #endif #if defined(__MINGW32__) || defined(WMS) #include #include #endif #ifndef __USE_W32_SOCKETS #ifndef W32 #include #endif #endif #ifdef WIN32 #else #include #endif /*--------------------------------------------------------------------------*/ /* * macros */ #ifdef MAX #undef MAX #endif #define MAX(a,b) ( (a)>=(b) ? (a) : (b) ) #ifdef MIN #undef MIN #endif #define MIN(a,b) ( (a)<=(b) ? (a) : (b) ) #ifdef ABS #undef ABS #endif #define ABS(a) ( (a)>=0 ? (a) : (-(a)) ) /* how may player are maximum */ #ifdef SMPF #define MAX_PLAYER 16 #else #define MAX_PLAYER 6 #endif /* maximum mask bytes allowed, affects player maximum in network game */ #define MAX_MASK_BYTES 4 /* how many local players */ #define NUM_LOCAL_PLAYER 6 /* how many client can connect */ #define MAX_HOSTS MAX_PLAYER /* maximum allowed number of victories to win */ #define MAX_VICTORIES 9 /* dimension of of maze */ #define MAZE_W 15 #define MAZE_H 13 #define STAT_W 20 #ifdef SMPF #define STAT_H 3 #else #define STAT_H 2 #endif /* number block tiles */ #define MAX_BLOCK 11 #define MENU_MAX_TILE 21 #define MAX_TILE MAX(MAX_BLOCK,MENU_MAX_TILE) /* number of bombs and their animations */ #define MAX_BOMBS 2 #define MAX_BOMB_ANIME 17 /* size of big letters */ #define CHARW 3 #define CHARH 5 #define MAX_EXPLOSION 16 #define TIME_STEP 48 #define DEAD_TIME 8 #define GAME_TIME (60*TIME_STEP + DEAD_TIME) /* Added by Fouf on 09/14/99 23:55:18 *//* Written by Amilhastre */ #define BOMB_SEARCH_X (2.5*BLOCK_WIDTH) #define BOMB_SEARCH_Y (2.5*BLOCK_HEIGHT) /* length of a frame in ms */ #define FRAME_TIME 50 /* * fundamental types */ typedef enum { XBFalse = 0, XBTrue } XBBool; typedef struct { double x, y; } BMPoint; typedef struct { int x, y; int w, h; } BMRectangle; /* * position vector */ typedef struct { short y, x; } BMPosition; /* * PFV Pointer to void/int functions */ typedef void (*PFV) (void); typedef int (*PFI) (void); typedef BMRectangle *(*PFR) (void); /* * player sprite animations phase */ typedef enum { SpriteStopDown = 0, SpriteWalkDown0, SpriteWalkDown1, SpriteWalkDown2, SpriteWalkDown3, SpriteStopUp, SpriteWalkUp0, SpriteWalkUp1, SpriteWalkUp2, SpriteWalkUp3, SpriteStopRight, SpriteWalkRight0, SpriteWalkRight1, SpriteWalkRight2, SpriteWalkRight3, SpriteStopLeft, SpriteWalkLeft0, SpriteWalkLeft1, SpriteWalkLeft2, SpriteWalkLeft3, SpriteDamagedDown, SpriteDamagedLeft, SpriteDamagedUp, SpriteDamagedRight, SpriteLooser, SpriteLooser1, SpriteLooser2, SpriteWinner, SpriteWinner2, SpriteWinner3, SpriteBigWinner, SpriteDeadDown, SpriteDeadLeft, SpriteDeadUp, SpriteDeadRight, SpriteMorphed, SpriteZombie, MAX_ANIME } BMSpriteAnimation; #define MAX_ANIME_EPM ((int) SpriteDeadDown) #define MAX_ANIME_PPM ((int) (MAX_ANIME - MAX_ANIME_EPM)) /* * player directions */ typedef enum { GoStop = 0, GoUp, GoLeft, GoDown, GoRight, GoDefault, GoAll, MAX_DIR } BMDirection; /* * ??? */ typedef enum { SBVoid = 0, SBTextLeft, SBTextMid, SBTextRight, SBDead = 4, SBSick = 4 + MAX_PLAYER, SBPlayer = 4 + 2 * MAX_PLAYER, SBAbort = 4 + 3 * MAX_PLAYER, SBSickAbort = 4 + 4 * MAX_PLAYER, MAX_SCORE_TILES = 4 + 5 * MAX_PLAYER } BMScoreTile; /*--------------------------------------------------------------------------*/ #ifdef WMS #define GAME_DATADIR "." #endif /*--------------------------------------------------------------------------*/ #include "debug.h" #include "socket.h" #include "util.h" #include "str_util.h" #include "event.h" #include "random.h" #include "version.h" #include "color.h" #include "sprite.h" #include "image.h" #include "cfg_xblast.h" #include "snd.h" #include "dat_rating.h" #include "net_tele.h" #include "action.h" #include "ini_file.h" #include "cfg_main.h" #include "cfg_game.h" #include "cfg_player.h" #include "cfg_stat.h" #include "cfg_demo.h" #include "cfg_level.h" #include "cfg_control.h" #include "gui.h" #include "browse.h" #include "chat.h" #include "atom.h" #include "net_dgram.h" #include "net_socket.h" #include "network.h" #include "com.h" #include "com_central.h" #include "com_base.h" #include "com_central.h" #include "com_dgram.h" #include "com_from_central.h" #include "com_newgame.h" #include "com_reply.h" #include "com_to_central.h" #include "com_to_server.h" #include "com_browse.h" #include "com_dg_client.h" #include "com_dg_server.h" #include "com_listen.h" #include "com_query.h" #include "com_stream.h" #include "com_to_client.h" #include "player.h" #include "client.h" #include "server.h" #include "central.h" #include "user.h" #include "mi_tool.h" #include "mi_base.h" #include "mi_button.h" #include "mi_color.h" #include "mi_cyclic.h" #include "mi_int.h" #include "mi_label.h" #include "mi_player.h" #include "mi_string.h" #include "mi_toggle.h" #include "mi_combo.h" #include "mi_host.h" #include "mi_keysym.h" #include "mi_map.h" #include "mi_stat.h" #include "mi_tag.h" #include "menu.h" #include "menu_level.h" #include "menu_game.h" #include "menu_layout.h" #include "menu_extras.h" #include "menu_player.h" #include "menu_control.h" #include "menu_network.h" #include "menu_level.h" #include "menu_edit.h" #include "game_local.h" #include "game_demo.h" #include "game_server.h" #include "game_client.h" #include "map.h" #include "level.h" #include "geom.h" #include "bomb.h" #include "shrink.h" #include "scramble.h" #include "func.h" #include "bot.h" #include "demo.h" #include "game.h" #include "status.h" #include "intro.h" #include "introdat.h" #include "info.h" #include "timeval.h" /* i18n */ #ifdef ENABLE_NLS #include #include #define _(String) gettext (String) #define gettext_noop(String) String #define N_(String) gettext_noop (String) #else #define _(String) String #define N_(String) String #define gettext(String) String #endif xblast-2.10.4/xblast.ico0000644000175000017500000000137610047640430014206 0ustar rhondaalfie è( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿˆˆ€ˆ€€€€€€€€€€€€€ˆˆ€€€€ˆˆˆw€€ˆwxˆ€pp€÷ˆ‡ÿxw€ˆ€€‡ÿxxx€wxpˆ38™€ˆ€€»‘€ˆ3 ™ˆˆ€™¹™›‘››™‘››‘ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿÿ€ÿÿÿÿÿÿ€ÿÿ€ÿÿÿþÿþÿüüüüüþÿþÿÿÏÿ€‡ÿÀÿàÿø<ÿÿüÿÿøÿÿøÿÿüÿÿþ¿ÿÿÿÿÿÿÿÿxblast-2.10.4/xblast.man0000644000175000017500000002671110234124132014201 0ustar rhondaalfie.TH xblast 6x "Release 2.10.0 (Februar 27th 2005)" .SH NAME XBlast (TNT) \- Multi-player "Blast the Others" game .PP .SH SYNOPSIS .B xblast \fI [options] .PP .SH DESCRIPTION .PP XBlast is a multi-player arcade game for X11R5/R6. The game can be played with at least two players and up to six players. It was inspired by the video/computer game Bomberman/Dynablaster which was to my knowledge first programmed for NEC's PC Engine/Turbo Grafx. Other (commercial) versions of the original game exist for IBM-PC, Atari ST, Amiga, NES, GameBoy and Super NES. .PP .SH Actualized information you can obtain on the web page: http://xblast.sourceforge.net/ Follow the link Player-Tutorials .SH LAUNCHING XBLAST Just type xblast in an xconsole. .PP .SH SOUND OPTIONS This option is only valid when \fIXBlast\fP was compiled with the optional sound support. Freebsd, Linux and Sun should be supported. .TP .B -ns This disables the sound support. .PP .SH OTHER OPTIONS The program \fIXBlast\fP supports the following command-line options: .TP .B -central This option starts the program as central server. .TP .B -check This option verifies if all levels are loadable. .PP .SH PLAYING XBLAST The idea of the game is quite simple: "There can be only one ...". So the aim is to blast away all the other players. Use your bombs to blast away the other players and certain blocks (e.g. the ?-Blocks in the 1st level). Below some of these blocks there are extras. .PP The program \fIXBlast\fP can be played locally or in network. After you started \fIXBlast\fP it will display an intro. The next step will show you the "Main Menu". In the "Main Menu" you can decide if you want to start a local game, join a network game or host a network game. For detailed information please go to the web site. .SH CONTROLS .PP The following will explain the default bindings. These keys control the first (right) player at your display: .TP .IR KP_8 , \ KP_Up Player starts walking up. .TP .IR KP_2 , \ KP_Down Player starts walking down. .TP .IR KP_4 , \ KP_Left Player starts walking to the left. .TP .IR KP_6 , \ KP_Right Player starts walking to the right. .TP .IR KP_5 Player stops (in the center of the next block). .TP .IR KP_0 , \ KP_Insert Player drops a bomb (in the center of the current block). .TP .IR Return , \ KP_Add Player uses special function (e.g. remote control, special bombs). .TP .IR KP_Subtract Pause of level in Local Game. .TP .IR KP_Multiply Request to abort the level. .TP .IR KP_Divide Cancel abort request. .PP The following keys control the second (left) player at your display: .TP .IR T Player starts walking up. .TP .IR V , \ B Player starts walking down. .TP .IR F Player starts walking to the left. .TP .IR H Player starts walking to the right. .TP .IR G Player stops (in the center of the next block). .TP .IR Space Player drops a bomb (in the center of the current block). .TP .IR Tab Player uses special function (e.g. remote control, special bombs). .TP .IR P Pause of level in Local Game. .TP .IR A Request to abort of level. .TP .IR Z cancel abort request. .PP A single player can use both key sets for playing. Furthermore the following keys effect all players: .TP .IR P pause game, resume game after pause. .TP .IR Escape Go to previous menu. .PP Please note that since \fIXBlast 2.7.x\fP the keybindings can be customised via Options Menu Controls (see also \fxhttp://blast.sf.net/ \fP). .PP .SH EXTRA SYMBOLS There are many extras to be found in xblast. Most of the time they can be found under blastable blocks, sometimes they are just lying around. The following extras can be found in nearly any level. You will keep these extras until you have lost all your lives or the level ends. See the web site for actualized information. .TP .B Bomb \fP(red frame) This extra increases the number of bombs you can drop by one. .TP .B Flame \fP(yellow flame) This extra increases the range of your bombs by one field. .PP Furthermore in several levels the following symbol can be found: .TP .B Skull \fP(cyan frame) This is not really an extra, but you will be infected with an random illness when picking it up. You will be healed automatically after a certain time, or if you loose one life. Additionally you can infect other players while being ill by running past them. .PP In many levels there is also a special extra. There will always be only one type of special extra per level and you will loose it if you loose a life. The following special extras can be found: .TP .B Kick extra \fP(moving bomb in blue frame) This extra enables you to kick bombs by running into them. .TP .B Invincibility \fP(star in golden frame) This extra makes you invincible for some time. You are not killed by explosions, stunned by moving bombs, nor infected by skulls. .TP .B Global Detonator \fP(button in deep pink frame) Picking up this extra ignites all bombs on the map. Use with care. .TP .B Construction Bombs \fP(bricks and bombs in firebrick frame) This extra gives you construction bombs as special bombs. These bombs create a blastable block when exploding. Use the special key to drop them. .TP .B Remote Control \fP(button box in spring green frame) This extra enables you to ignite all your bombs by pressing the special key. .TP .B Teleport Extra \fP(beaming player in orchid frame) This extra enables you to beam away to a random location. You must be in the center of a block to activate it. Use the special key to teleport. .TP .B Airpump \fP(clouds in sky blue frame) This extra enables you to blow away (not to blast away) bombs within a range of 2 fields. It also works when your are trapped between two bombs. Use the special key to activate it. .TP .B Napalm Bombs \fP(burning bombs in orange red frame) This extra allows you to drop a high powered napalm bomb using the special key. This bomb has a much larger explosion than normal, and is bigger if you have more Flames. If the bomb is struck with an explosion, it will explode as a normal bomb. For the large explosion to occur, it must explode on its own. .TP .B Firecrackers \fP(firecrackers in orange frame) This extra allows you to drop firecracker bombs with the special key. Firecracker bombs set off a series of explosions that can clear away a small area. One in ten firecracker bombs is high powered and clears away a much larger area. There is no way to tell if a firecracker is high powered or not until it explodes. Unlike napalm bombs there is no way to stop the firecracker explosion, although it is blocked by walls and other solid objects. .TP .B Pyro bombs \fP(firecrackers in orange frame) This extra allows you to drop pyro bombs with the special key. Pyro bombs explode with a series of small explosions that dance around the level. These explosions are blocked by walls and other bombs but are able to travel through corridors with ease. They explode randomly and cannot be controlled. Pyro bombs have the same range irrespective of how many flame extras you have. Even if the bomb is struck with an explosion it will still explode as pyro bomb. .TP .B Junkie Virus \fP(syringe in yellow green frame) This extra infects you with the junkie virus. Whilst you have the junkie virus you are randomly infected with illnesses (as if you were picking up skulls). You MUST touch other players to pass on the illness within a certain time limit or you will lose a life. Any touched players are given the junkie virus as well. There is currently no way to get rid of the junkie virus (but look for a rehabilitation centre in the next release). :) .TP .B Poison \fP(black skull in steel blue frame)\fI This extra?! cost you one of your lives. So avoid to step on it. At least if you are not currenlty invincible. .TP .B Spinner \fP(looks like normal floor)\fI When picking up this extra you will be stunned for some time. Your opponents might want to blast you while you are spinning. .TP .B Speed \fP(moving head in light blue frame)\fI This extra enables you too run twice as fast as normal. Try to overtake other players and catch them between bombs. .TP .B Mayhem \fP(moving head and bomb in blue frame)\fI This extra gives you speed and kicking. Make the best of it. .TP .B Holy Grail \fP(a grail with blue light in white frame)\fI This extras transfers life energy to you from your opponents. Be sure you are the one to get there first. .TP .B Life \fP(head and first aid kit in red frame) This extra increases your number of lifes by one. Comes in handy while in "hot" environments. .TP .B Random \fP(question mark in light blue frame)\fI Picking up this extra will give you one of the following extras: .IR Speed , \ Poison , \ Invincibility , \ Spinner , \ Air\ Pump \ or\ Life . Avoid it if you have only one life left. .TP .B Cloak \fP(vanishing player in violet frame)\fI This extras allows you to cloak yourself using the special key. You become invisible for all other players. The extras wears out after a certain time of use. .TP .B Morph \fP(bomb with eyes in green frame)\fI Get this extra to morph into a bomb with the special key. You still move as a bomb although you cannot alter course while on the run. You cannot be harmed by explosions while you are a bomb. Beware not to be kicked in the wall while the level shrinks. .PP .SH GAME RESOURCES These resources define the rest of the game setup of xblast. They will be taken from the following sources (in the given order): .TP .B 1. internal defaults .TP .B 2. the directory "~/.xblast_tnt" .PP .SH DISPLAY RESOURCES These resources are read separately for each display used in xblast. They are read only from the following sources (in the given order): .TP .B 1. internal defaults .TP .B 2. the directory "~/.xblast_tnt" .TP .B 3. the server resources of the default display (can be set using \fIxrdb\fP). .PP .SH BUGS .PP If you found one go to the web site and tell us. .SH COPYRIGHT Copyright (C) 1993-2005, Oliver Vogel. .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public Licences as published by the Free Software Foundation; either version 2; or (at your option) any later version .PP This program is distributed in the hope that it will be entertaining, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .PP .SH AUTHORS .TP Oliver Vogel \fI(Main Author) vogel@ikp.uni-koeln.de .TP Garth Denley \fI(Coauthor) g0denley@teaching.cs.adelaide.edu.au .TP Norbert Nicolay \fI(Linux Sound Support, optional) nicolay@ikp.uni-koeln.de .TP Koen (central, SMPF, teammode on TNT, bugcatcher) .TP EPFL .TP Belgium Guys .TP Skywalker (epfl port, laola, some game functions, user friendliness, Shapes) .TP Kruno Sever (Major network review, Chat, bugcatcher) .PP .SH CONTRIBUTORS .PP Xavier Caron \- x-caron@es2.fr .br Chris Doherty \- cpdohert@teaching.cs.adelaide.edu.au .br Patrick Durish \- dri@eup.siemens-albis.ch .br Keith Gillow \- ...@... .br Rob Hite \- hite@tellabs.com .br Christophe Kalt \- kalt@hugo.int-evry.fr .br Joachim Kaltz \- kaltz@essi.fr .br Laurent Marsan \- mbaye@univ-mlv.fr .br Pierre Ramet \- ramet@labri.u-bordeaux.fr .br Mike Schneider \- schneid@tellabs.com .br Mark Shepherd \- ...@... .br Rob, Simon and Tristan \- ...@... .br Xbresse .br Gerfried Fuchs .br Rado .br Ifi .br Bombenfutter .br Galatius .br Garth Denley .br Stephan Natschlaeger .br Amilhastre .br Fouf .br ALu .br Larsl .br Stefan Stiasny .br .PP xblast-2.10.4/xblast.rc0000644000175000017500000000037310047640431014035 0ustar rhondaalfie/* * resource file for xblast */ xblast ICON xblast.ico xblast_olli ICON xblast-olli.ico xblast_norbert ICON xblast-norbert.ico xblast_rodi ICON xblast-rodi.ico xblast_ted ICON xblast-ted.ico xblast_alex ICON xblast-alex.ico xblast-2.10.4/xblast.wxs0000644000175000017500000125045710177361022014265 0ustar rhondaalfie DlgFont8 1 1 1 1 Select the way you want features to be installed. Click on the icons in the tree below to change the way features will be installed. [DlgTitleFont]Custom Setup Multiline description of the currently selected item. The size of the currently selected item. <The selection's path> 1 1 1 1 1 1 Browse to the destination folder [DlgTitleFont]Change current destination folder 1 1 The [Wizard] is ready to begin the installation Click Install to begin the installation. [DlgTitleFont]Ready to Install 1 1 Are you sure you want to cancel [ProductName] installation? 1 Please wait while the [Wizard] [Progress2] [ProductName]. This may take several minutes. [DlgTitleFont][Progress1] [ProductName] 1 (NOT Installed) AND (LAUNCHPRODUCT = 1) Click the Finish button to exit the [Wizard]. Launch [ProductName] {\VerdanaBold13}Completing the [ProductName] [Wizard] bytes GB KB MB Entire feature will be unavailable Feature will be installed when required Entire feature will be installed to run from CD Entire feature will be installed on local hard drive Entire feature will be installed to run from network Will be installed to run from CD Will be installed on local hard drive Will be installed to run from network Gathering required information... This feature will remain uninstalled This feature will be set to be installed when required This feature will be installed to run from CD This feature will be installed on the local hard drive This feature will be installed to run from the network This feature will become unavailable Will be installed when required This feature will be available to run from CD This feature will be installed on your local hard drive This feature will be available to run from the network This feature will be uninstalled completely, you won't be able to run it from CD This feature will change from run from CD state to set to be installed when required This feature will remain to be run from CD This feature will change from run from CD state to be installed on the local hard drive This feature frees up [1] on your hard drive. This feature requires [1] on your hard drive. Compiling cost for this feature... This feature will be completely removed This feature will be removed from your local hard drive, but will be set to be installed when required This feature will be removed from your local hard drive, but will be still available to run from CD This feature will remain on you local hard drive This feature will be removed from your local hard drive, but will be still available to run from the network This feature will be uninstalled completely, you won't be able to run it from the network This feature will change from run from network state to set to be installed when required This feature will change from run from network state to be installed on the local hard drive This feature will remain to be run from the network This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive. This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive. This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive. This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive. Time remaining: {[1] minutes }{[2] seconds} Available Difference Required Disk Size Volume Computing space requirements Computing space requirements Computing space requirements Validating install Copying new files Copying network install files Creating shortcuts Publishing Qualified Components Publishing Product Features Publishing product information Registering Class servers Registering extension servers Registering MIME info Registering program identifiers Allocating registry space Searching for installed applications Binding executables Searching for qualifying products Creating folders Deleting services Creating duplicate files Searching for related applications Installing ODBC components Installing new services Evaluating launch conditions Migrating feature states from related applications Moving files Patching files Updating component registration Registering COM+ Applications and Components Registering fonts Registering product Registering type libraries Registering user Removing duplicated files Updating environment strings Removing applications Removing files Removing folders Removing INI files entries Removing ODBC components Removing system registry values Removing shortcuts Searching for qualifying products Registering modules Unregistering modules Initializing ODBC directories Starting services Stopping services Unpublishing Qualified Components Unpublishing Product Features Unregister Class servers Unregistering COM+ Applications and Components Unregistering extension servers Unregistering fonts Unregistering MIME info Unregistering program identifiers Unregistering type libraries Updating environment strings Writing INI files values Writing system registry values Advertising application Generating script operations for action: Installing system catalog Publishing assembly information Unpublishing assembly information Rolling back action: Removing backup files Removing moved files Unpublishing product information {{Fatal error: }} {{Error [1]. }} Warning [1]. Info [1]. The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is [1]. {{The arguments are: [2], [3], [4]}} {{Disk full: }} Action [Time]: [1]. [2] [ProductName] {[2]}{, [3]}{, [4]} Message type: [1], Argument: [2] === Logging started: [Date] [Time] === === Logging stopped: [Date] [Time] === Action start [Time]: [1]. Action ended [Time]: [1]. Return value [2]. Time remaining: {[1] minutes }{[2] seconds} Out of memory. Shut down other applications before retrying. Installer is no longer responding. Installer stopped prematurely. Please wait while Windows configures [ProductName] Gathering required information... Removing older versions of this application... Preparing to remove older versions of this application... {[ProductName] }Setup completed successfully. {[ProductName] }Setup failed. Error reading from file: [2]. {{ System error [3].}} Verify that the file exists and that you can access it. Cannot create the file '[2]'. A directory with this name already exists. Cancel the install and try installing to a different location. Please insert the disk: [2] The installer has insufficient privileges to access this directory: [2]. The installation cannot continue. Log on as administrator or contact your system administrator. Error writing to file: [2]. Verify that you have access to that directory. Error reading from file [2]. {{ System error [3].}} Verify that the file exists and that you can access it. Another application has exclusive access to the file '[2]'. Please shut down all other applications, then click Retry. There is not enough disk space to install this file: [2]. Free some disk space and click Retry, or click Cancel to exit. Source file not found: [2]. Verify that the file exists and that you can access it. Error reading from file: [3]. {{ System error [2].}} Verify that the file exists and that you can access it. Error writing to file: [3]. {{ System error [2].}} Verify that you have access to that directory. Source file not found{{(cabinet)}}: [2]. Verify that the file exists and that you can access it. Cannot create the directory '[2]'. A file with this name already exists. Please rename or remove the file and click retry, or click Cancel to exit. The volume [2] is currently unavailable. Please select another. The specified path '[2]' is unavailable. Unable to write to the specified folder: [2]. A network error occurred while attempting to read from the file: [2] An error occurred while attempting to create the directory: [2] A network error occurred while attempting to create the directory: [2] A network error occurred while attempting to open the source file cabinet: [2] The specified path is too long: [2] The Installer has insufficient privileges to modify this file: [2]. A portion of the folder path '[2]' is invalid. It is either empty or exceeds the length allowed by the system. The folder path '[2]' contains words that are not valid in folder paths. The folder path '[2]' contains an invalid character. '[2]' is not a valid short file name. Error getting file security: [3] GetLastError: [2] Invalid Drive: [2] Error applying patch to file [2]. It has probably been updated by other means, and can no longer be modified by this patch. For more information contact your patch vendor. {{System Error: [3]}} A file that is required cannot be installed because the cabinet file [2] is not digitally signed. This may indicate that the cabinet file is corrupt. A file that is required cannot be installed because the cabinet file [2] has an invalid digital signature. This may indicate that the cabinet file is corrupt.{{ Error [3] was returned by WinVerifyTrust.}} Failed to correctly copy [2] file: CRC error. Failed to correctly move [2] file: CRC error. Failed to correctly patch [2] file: CRC error. The file '[2]' cannot be installed because the file cannot be found in cabinet file '[3]'. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package. The cabinet file '[2]' required for this installation is corrupt and cannot be used. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package. There was an error creating a temporary file that is needed to complete this installation.{{ Folder: [3]. System error code: [2]}} Could not create key: [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not open key: [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not delete value [2] from key [3]. {{ System error [4].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not delete key [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not read value [2] from key [3]. {{ System error [4].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not write value [2] to key [3]. {{ System error [4].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not get value names for key [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not get sub key names for key [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not read security information for key [2]. {{ System error [3].}} Verify that you have sufficient access to that key, or contact your support personnel. Could not increase the available registry space. [2] KB of free registry space is required for the installation of this application. Another installation is in progress. You must complete that installation before continuing this one. Error accessing secured data. Please make sure the Windows Installer is configured properly and try the install again. User '[2]' has previously initiated an install for product '[3]'. That user will need to run that install again before they can use that product. Your current install will now continue. User '[2]' has previously initiated an install for product '[3]'. That user will need to run that install again before they can use that product. Out of disk space -- Volume: '[2]'; required space: [3] KB; available space: [4] KB. Free some disk space and retry. Are you sure you want to cancel? The file [2][3] is being held in use{ by the following process: Name: [4], Id: [5], Window Title: '[6]'}. Close that application and retry. The product '[2]' is already installed, preventing the installation of this product. The two products are incompatible. There is not enough disk space on the volume '[2]' to continue the install with recovery enabled. [3] KB are required, but only [4] KB are available. Click Ignore to continue the install without saving recovery information, click Retry to check for available space again, or click Cancel to quit the installation. Could not access network location [2]. The following applications should be closed before continuing the install: Could not find any previously installed compliant products on the machine for installing this product. An error occurred while applying security settings. [2] is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. {{Unable to locate the user's SID, system error [3]}} The key [2] is not valid. Verify that you entered the correct key. The installer must restart your system before configuration of [2] can continue. Click Yes to restart now or No if you plan to manually restart later. You must restart your system for the configuration changes made to [2] to take effect. Click Yes to restart now or No if you plan to manually restart later. An installation for [2] is currently suspended. You must undo the changes made by that installation to continue. Do you want to undo those changes? A previous installation for this product is in progress. You must undo the changes made by that installation to continue. Do you want to undo those changes? An installation package for the product [2] cannot be found. Try the installation again using a valid copy of the installation package '[3]'. Installation completed successfully. Installation failed. Product: [2] -- [3] You may either restore your computer to its previous state or continue the install later. Would you like to restore? An error occurred while writing installation information to disk. Check to make sure enough disk space is available, and click Retry, or Cancel to end the install. One or more of the files required to restore your computer to its previous state could not be found. Restoration will not be possible. [2] cannot install one of its required products. Contact your technical support group. {{System Error: [3].}} The older version of [2] cannot be removed. Contact your technical support group. {{System Error [3].}} Installed [2] Configured [2] Removed [2] File [2] was rejected by digital signature policy. The Windows Installer Service could not be accessed. This can occur if you are running Windows in safe mode, or if the Windows Installer is not correctly installed. Contact your support personnel for assistance. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. {{Custom action [2] script error [3], [4]: [5] Line [6], Column [7], [8] }} There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. {{Action: [2], location: [3], command: [4] }} There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. {{Action [2], location: [3], command: [4] }} There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. {{Action [2], entry: [3], library: [4] }} Removal completed successfully. Removal failed. Advertisement completed successfully. Advertisement failed. Configuration completed successfully. Configuration failed. You must be an Administrator to remove this application. To remove this application, you can log on as an Administrator, or contact your technical support group for assistance. The path [2] is not valid. Please specify a valid path. Out of memory. Shut down other applications before retrying. There is no disk in drive [2]. Please insert one and click Retry, or click Cancel to go back to the previously selected volume. There is no disk in drive [2]. Please insert one and click Retry, or click Cancel to return to the browse dialog and select a different volume. The folder [2] does not exist. Please enter a path to an existing folder. You have insufficient privileges to read this folder. A valid destination folder for the install could not be determined. Error attempting to read from the source install database: [2]. Scheduling reboot operation: Renaming file [2] to [3]. Must reboot to complete operation. Scheduling reboot operation: Deleting file [2]. Must reboot to complete operation. Module [2] failed to register. HRESULT [3]. Contact your support personnel. Module [2] failed to unregister. HRESULT [3]. Contact your support personnel. Failed to cache package [2]. Error: [3]. Contact your support personnel. Could not register font [2]. Verify that you have sufficient permissions to install fonts, and that the system supports this font. Could not unregister font [2]. Verify that you that you have sufficient permissions to remove fonts. Could not create Shortcut [2]. Verify that the destination folder exists and that you can access it. Could not remove Shortcut [2]. Verify that the shortcut file exists and that you can access it. Could not register type library for file [2]. Contact your support personnel. Could not unregister type library for file [2]. Contact your support personnel. Could not update the ini file [2][3]. Verify that the file exists and that you can access it. Could not schedule file [2] to replace file [3] on reboot. Verify that you have write permissions to file [3]. Error removing ODBC driver manager, ODBC error [2]: [3]. Contact your support personnel. Error installing ODBC driver manager, ODBC error [2]: [3]. Contact your support personnel. Error removing ODBC driver: [4], ODBC error [2]: [3]. Verify that you have sufficient privileges to remove ODBC drivers. Error installing ODBC driver: [4], ODBC error [2]: [3]. Verify that the file [4] exists and that you can access it. Error configuring ODBC data source: [4], ODBC error [2]: [3]. Verify that the file [4] exists and that you can access it. Service '[2]' ([3]) failed to start. Verify that you have sufficient privileges to start system services. Service '[2]' ([3]) could not be stopped. Verify that you have sufficient privileges to stop system services. Service '[2]' ([3]) could not be deleted. Verify that you have sufficient privileges to remove system services. Service '[2]' ([3]) could not be installed. Verify that you have sufficient privileges to install system services. Could not update environment variable '[2]'. Verify that you have sufficient privileges to modify environment variables. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation. Could not set file security for file '[3]'. Error: [2]. Verify that you have sufficient privileges to modify the security permissions for this file. Component Services (COM+ 1.0) are not installed on this computer. This installation requires Component Services in order to complete successfully. Component Services are available on Windows 2000. Error registering COM+ Application. Contact your support personnel for more information. Error unregistering COM+ Application. Contact your support personnel for more information. The description for service '[2]' ([3]) could not be changed. The Windows Installer service cannot update the system file [2] because the file is protected by Windows. You may need to update your operating system for this program to work correctly. {{Package version: [3], OS Protected version: [4]}} The Windows Installer service cannot update the protected Windows file [2]. {{Package version: [3], OS Protected version: [4], SFP Error: [5]}} The Windows Installer service cannot update one or more protected Windows files. {{SFP Error: [2]. List of protected files:\r\n[3]}} User installations are disabled via policy on the machine. An error occured during the installation of assembly component [2]. HRESULT: [3]. {{assembly interface: [4], function: [5], assembly name: [6]}} NOT Installed 2 &No &Install Setup Br&owse custicon &Next > < &Back Typical installs No Setup Wizard removico exclamic 1 none &Reset &Remove completi &Yes &Exit &Return dlgbmp {&DlgFontBold8} &Ignore repairic &Resume insticon &Finish P @@@@@]]> Installing Cancel 3 info &Repair &Retry bannrbmp OK 1 xblast-2.10.4/xblastc.dsp0000644000175000017500000005531410172252727014375 0ustar rhondaalfie# Microsoft Developer Studio Project File - Name="xblastc" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=xblastc - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "xblastc.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "xblastc.mak" CFG="xblastc - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "xblastc - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "xblastc - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "xblastc - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "xblastc - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /w /W0 /Gm /GX /ZI /Od /D "WIN32" /D "_MBCS" /D "WMS" /D "W32" /D "WINMS32" /D "DEBUG_NAT" /D "_WINDOWS" /FR /YX /FD /D /D /GZ /c # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib Ws2_32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "xblastc - Win32 Release" # Name "xblastc - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=D:\games\xbtntexp\xblast\action.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\atom.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\bomb.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\bot.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\browse.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\central.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_control.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_demo.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_game.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_level.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_main.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_player.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_stat.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_xblast.c # End Source File # Begin Source File SOURCE=.\chat.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\client.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\color.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_base.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_browse.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_central.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dg_client.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dg_server.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dgram.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_from_central.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_listen.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_newgame.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_query.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_reply.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_stream.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_central.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_client.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_server.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\dat_rating.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\debug.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\demo.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\event.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\func.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_client.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_demo.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_local.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_server.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\image.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\info.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\ini_file.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\intro.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\introdat.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\level.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\map.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_control.c # End Source File # Begin Source File SOURCE=.\menu_edit.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_extras.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_game.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_level.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_network.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_player.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_base.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_button.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_color.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_combo.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_cyclic.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_host.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_int.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_keysym.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_label.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_map.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_player.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_stat.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_string.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_tag.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_toggle.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_tool.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_dgram.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_socket.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_tele.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\network.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\player.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\random.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\scramble.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\server.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\shrink.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\sprite.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\status.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\str_util.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\user.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\util.c # End Source File # Begin Source File SOURCE=.\version.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_atom.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_common.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_config.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_event.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_image.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_init.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_joystick.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_keysym.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_msgbox.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_pixmap.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_sndsrv.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_socket.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_sound.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_sprite.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_text.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_tile.c # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\xblast.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=D:\games\xbtntexp\xblast\action.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\atom.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\bomb.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\bot.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\browse.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\central.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_control.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_demo.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_game.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_level.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_main.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_player.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_stat.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\cfg_xblast.h # End Source File # Begin Source File SOURCE=.\chat.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\client.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\color.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_base.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_browse.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_central.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dg_client.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dg_server.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_dgram.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_from_central.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_listen.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_newgame.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_query.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_reply.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_stream.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_central.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_client.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\com_to_server.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\common.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\config.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\dat_rating.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\debug.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\demo.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\event.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\func.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_client.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_demo.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_local.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\game_server.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\geom.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\gui.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\image.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\info.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\ini_file.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\intro.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\introdat.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\level.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\map.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_control.h # End Source File # Begin Source File SOURCE=.\menu_edit.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_extras.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_game.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_layout.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_level.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_network.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\menu_player.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_base.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_button.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_color.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_combo.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_cyclic.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_host.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_int.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_keysym.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_label.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_map.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_player.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_stat.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_string.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_tag.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_toggle.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\mi_tool.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_dgram.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_socket.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\net_tele.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\network.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\player.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\random.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\randomlib.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\rating.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\scramble.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\server.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\shrink.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\shrinkdat.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\snd.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\socket.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\sprite.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\status.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\str_util.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\timeval.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\user.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\util.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\version.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_color.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_common.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_config.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_event.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_image.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_joystick.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_keysym.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_mm.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_pixmap.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_sndsrv.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_socket.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_sprite.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_text.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\w32_tile.h # End Source File # Begin Source File SOURCE=D:\games\xbtntexp\xblast\xblast.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project xblast-2.10.4/xblastc.dsw0000644000175000017500000000103310067166212014365 0ustar rhondaalfieMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "xblastc"=".\xblastc.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### xblast-2.10.4/xbsndsrv.c0000644000175000017500000006116210443245274014240 0ustar rhondaalfie/* * Program XBLAST V2.5.15 or higher * (C) by Oliver Vogel (e-mail: vogel@ikp.uni-koeln.de) * March 21nd, 1997 * started August 1993 * * File: xbsndsrv.c * sound server and sound processing * * Author: Norbert Nicolay, e-mail: nicolay@ikp.uni-koeln.de * July 30th 1996 * * $Id: xbsndsrv.c,v 1.23 2006/06/12 11:06:36 fzago Exp $ * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public Licences as published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Publis License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "config.h" #if defined(XBLAST_SOUND) #define _SOUND_C_ #include #include #include #include #include #include #include #include #include #include #ifdef __sun__ /* format for pids on sun */ #define PID_FORMAT "%lu" /* needed for bzero(), open()*/ #include #include /* sun-specific audio includes */ #ifdef HAVE_SYS_AUDIO_H #include #else #include #include #endif #else /* format for pids, non-sun */ #define PID_FORMAT "%u" /* non-sun audio includes */ #ifdef HAVE_SYS_SOUNDCARD_H #include #endif #ifdef HAVE_MACHINE_SOUNDCARD_H #include #endif #ifdef HAVE_LINUX_SOUNDCARD_H #include #endif #endif #include #include "xblast.h" #if !defined(TRUE) #define TRUE 1 #endif #if !defined(FALSE) #define FALSE 0 #endif /* * play at least 5 sounds simultaneously regardless of machine power */ #define DEFAULT_MAX_SIM_SOUNDS 10 #define ABS_MAX_SIM_SOUNDS 250 #define MAX_CPU_LOAD_ADJUST 10 /* client/server commands */ #define SND_LOAD_SOUND 0 #define SND_PLAY_SOUND 1 #define SND_STOP_SOUND 2 #define SND_UNLOAD_SOUND 3 /* values to be used in acknowledge pipe */ #define SND_ACK_OK 0 #define SND_ACK_ERROR 1 static const char rcs_id[] = "$Id: xbsndsrv.c,v 1.23 2006/06/12 11:06:36 fzago Exp $"; typedef unsigned char u8; typedef short s16; typedef struct _xbsound { int id; int repeat; int mono; int position; u8 *samples; int length; struct _xbsound *next; } XBSOUND; static int max_sim_sounds = DEFAULT_MAX_SIM_SOUNDS; static int next_free_sound = 0; static int sounds_playing = 0; static XBSOUND *sound_table; static volatile int calibration_ready; /* * sound sample table */ static struct _sound_name { int sound_id; /* the sound's id to refer to it */ const char *name; /* raw samples data file name */ u8 *samples; /* pointer to samples memory */ int length; /* length in samples of the sound */ int repeat; /* repeat flag to play sound endlessly */ int mono; /* mono flag indicating mono sounds */ } sound_name[] = { { SND_BAD, "xb_bad.raw", NULL, 0, FALSE, FALSE}, /* got a skull */ { SND_DROP, "xb_drop.raw", NULL, 0, FALSE, TRUE}, /* dropped a bomb */ { SND_NEWBOMB, "xbnbmb.raw", NULL, 0, FALSE, TRUE}, /* got an extra bomb */ { SND_NEWKICK, "xbnkick.raw", NULL, 0, FALSE, TRUE}, /* got kick extra */ { SND_NEWPUMP, "xbnpmp.raw", NULL, 0, FALSE, TRUE}, /* got pump extra */ { SND_NEWRC, "xbnrc.raw", NULL, 0, FALSE, TRUE}, /* got rem. control */ { SND_MOREFIRE, "xbfire.raw", NULL, 0, FALSE, TRUE}, /* got more range */ { SND_DEAD, "xb_dead.raw", NULL, 0, FALSE, FALSE}, /* player died */ { SND_EXPL, "xb_expl.raw", NULL, 0, FALSE, TRUE}, /* normal explosion */ { SND_KICK, "xb_kick.raw", NULL, 0, FALSE, TRUE}, /* kick a bomb */ { SND_PUMP, "xb_pump.raw", NULL, 0, FALSE, TRUE}, /* pump a bomb */ { SND_OUCH, "xb_ouch.raw", NULL, 0, FALSE, FALSE}, /* player lost life */ { SND_INTRO, "xb_intro.raw", NULL, 0, FALSE, FALSE}, /* intro fanfare */ { SND_APPL, "xb_appl.raw", NULL, 0, FALSE, FALSE}, /* applause */ { SND_APPL2, "xb_app2.raw", NULL, 0, FALSE, FALSE}, /* applause */ { SND_BUTT, "xb_butt.raw", NULL, 0, FALSE, TRUE}, /* triggered button */ { SND_SHOOT, "xb_shoot.raw", NULL, 0, FALSE, FALSE}, /* using rem. ctrl. */ { SND_INVIS, "xb_nvis.raw", NULL, 0, FALSE, FALSE}, /* player invisible */ { SND_INVINC, "xb_nvnc.raw", NULL, 0, FALSE, FALSE}, /* player invincible */ { SND_NEWTELE, "xbntel.raw", NULL, 0, FALSE, TRUE}, /* player got telep. */ { SND_TELE, "xbtele.raw", NULL, 0, FALSE, TRUE}, /* player uses tele. */ { SND_INJ, "xbinj.raw", NULL, 0, FALSE, FALSE}, /* player got junkie */ { SND_MINIBOMB, "xbmbmb.raw", NULL, 0, FALSE, TRUE}, /* small bomb expl. */ { SND_WON, "xb_won.raw", NULL, 0, FALSE, FALSE}, /* player won */ { SND_HAUNT, "xb_haunt.raw", NULL, 0, FALSE, FALSE}, /* haunting bomb */ { SND_SPIRAL, "xb_spir.raw", NULL, 0, FALSE, TRUE}, /* spiral shrinking */ { SND_SPBOMB, "xb_spbmb.raw", NULL, 0, FALSE, TRUE}, /* got special bomb */ { SND_SLIDE, "xbslide.raw", NULL, 0, FALSE, TRUE}, /* bomb slide sound */ { SND_FINALE, "xbfin.raw", NULL, 0, FALSE, FALSE}, /* final fanfare */ { SND_WARN, "xb_warn.raw", NULL, 0, FALSE, FALSE}, /* shrink warn sound */ { SND_STUN, "xb_stun.raw", NULL, 0, FALSE, FALSE}, /* player stun sound */ { SND_WHIRL, "xb_whrl.raw", NULL, 0, TRUE, FALSE}, /* intro whirl */ { SND_COMPOUND, "xb_cmpnd.raw", NULL, 0, FALSE, FALSE}, /* compound shrink */ { SND_TELE1, "xbtele1.raw", NULL, 0, FALSE, TRUE}, /* teleport start */ { SND_TELE2, "xbtele2.raw", NULL, 0, FALSE, TRUE}, /* teleport end */ { SND_HOLY, "xbholy.raw", NULL, 0, FALSE, FALSE}, /* holy grail extra */ { SND_ENCLOAK, "xbcloak.raw", NULL, 0, FALSE, TRUE}, /* encloak sound */ { SND_DECLOAK, "xbdcloak.raw", NULL, 0, FALSE, TRUE}, /* decloak sound */ { SND_FAST, "xbfast.raw", NULL, 0, FALSE, TRUE}, /* speed up extra */ { SND_SLOW, "xbslow.raw", NULL, 0, FALSE, TRUE}, /* slow down extra */ { SND_SLAY, "xbslay.raw", NULL, 0, FALSE, TRUE}, /* slay extra */ { SND_LIFE, "xblife.raw", NULL, 0, FALSE, TRUE}, /* extra life */ { SND_NEWCLOAK, "xbcloakx.raw", NULL, 0, FALSE, TRUE}, /* new cloak extra */ { SND_BOMBMORPH, "xb_bombmorph.raw", NULL, 0, FALSE, TRUE}, /* bomb morph */ { SND_STEP1, "xbstep1.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #1 */ { SND_STEP2, "xbstep2.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #2 */ { SND_STEP3, "xbstep3.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #3 */ { SND_STEP4, "xbstep4.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #4 */ { SND_STEP5, "xbstep5.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #5 */ { SND_STEP6, "xbstep6.raw", NULL, 0, FALSE, TRUE}, /* Backgr. song #6 */ { SND_SNG1, "xbsng1.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #1 */ { SND_SNG2, "xbsng2.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #2 */ { SND_SNG3, "xbsng3.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #3 */ { SND_SNG4, "xbsng4.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #4 */ { SND_SNG5, "xbsng5.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #5 */ { SND_SNG6, "xbsng6.raw", NULL, 0, TRUE, FALSE}, /* Backgr. song #6 */ { SND_MAX, NULL, NULL, 0} }; #ifdef __sun__ #define SOUND_DEVICE "/dev/audio" #define SAMPLE_CHANNELS 2 #define SAMPLE_SIZE 16 #define SUN_AUDIO_REF 0 #else #define SOUND_DEVICE "/dev/dsp" #define SAMPLE_CHANNELS 1 #define SAMPLE_SIZE 8 #endif #define SAMPLE_RATE 22050 #define SUBSIZE 2048 #define FRAGSIZE 0x0004000a static s16 sumbuff[SUBSIZE]; static u8 playbuff[SUBSIZE]; static int mono_mode = FALSE; static int fragsize = FRAGSIZE; static int sample_rate = SAMPLE_RATE; static int sample_channels = SAMPLE_CHANNELS; static int sample_size = SAMPLE_SIZE; /* * outcomment the following line to suppress server statistics */ #define SERVER_STATISTICS #if defined(SERVER_STATISTICS) static double total_samples = 0.0; static int total_played = 0; static int total_skipped = 0; static int total_loaded = 0; static int total_unloaded = 0; #endif /* * Abort signal handler */ static void server_abort (int signnum) { #if defined(SERVER_STATISTICS) fprintf (stderr, "XBlast sound server statistics:\n"); fprintf (stderr, "\tloaded %d sounds,\n", total_loaded); fprintf (stderr, "\tfreed %d sounds,\n", total_unloaded); fprintf (stderr, "\tplayed %d sounds,\n", total_played); fprintf (stderr, "\tskipped %d sounds,\n", total_skipped); fprintf (stderr, "\tprocessed %10.3f Mega samples on sound device.\n", total_samples / 1000000.0); #endif fprintf (stderr, "XBlast sound server terminated.\n"); fflush (stderr); exit (0); } /* * alarm signal handler for sound server calibration */ static void calibration_stop (int signum) { calibration_ready = TRUE; } /* * initialize sound device */ #if defined(__STDC__) static void init_dsp (int dsp) #else static void init_dsp (dsp) int dsp; #endif { #ifdef __sun__ struct audio_info au; bzero (&au, sizeof (struct audio_prinfo)); fprintf (stderr, "Solaris audio device initialisation beginning.\n"); if (ioctl (dsp, AUDIO_GETINFO, &au) < 0) { fprintf (stderr, "XBlast sound server: " "could not read audio device settings\n"); } au.play.sample_rate = sample_rate; au.play.precision = sample_size; au.play.channels = sample_channels; if (sample_channels == 0) au.play.channels = 1; au.play.buffer_size = fragsize; au.play.encoding = AUDIO_ENCODING_LINEAR; /* ULAW, ALAW, LINEAR */ au.play.balance = AUDIO_MID_BALANCE; au.play.pause = 0; au.record.pause = 1; au.output_muted = 0; if (ioctl (dsp, AUDIO_SETINFO, &au) < 0) { fprintf (stderr, "XBlast sound server: " "could not read audio device settings\n"); } if (ioctl (dsp, AUDIO_GETINFO, &au) < 0) { fprintf (stderr, "XBlast sound server: " "could not read audio device settings\n"); } fprintf (stderr, "Audio device initialised: %d channels, %d bits, %dHz.\n", au.play.channels, au.play.precision, au.play.sample_rate); fprintf (stderr, " (wanted %d channels, %d bits, %dHz)\n", sample_channels, sample_size, sample_rate); #else if (ioctl (dsp, SNDCTL_DSP_SETFRAGMENT, &fragsize) < 0) { fprintf (stderr, "XBlast sound server: could not set fragment size %8x on sound device\n", fragsize); } if (ioctl (dsp, SNDCTL_DSP_STEREO, &sample_channels) < 0) { fprintf (stderr, "XBlast sound server: could not set %d sample channels on sound device\n", sample_channels); } if (ioctl (dsp, SNDCTL_DSP_SPEED, &sample_rate) < 0) { fprintf (stderr, "XBlast sound server: could not set sample rate %d on sound device\n", sample_rate); } if (ioctl (dsp, SNDCTL_DSP_SETFMT, &sample_size) < 0) { fprintf (stderr, "XBlast sound server: could not set sample size %d on sound device\n", sample_size); } if (ioctl (dsp, SNDCTL_DSP_GETBLKSIZE, &fragsize) < 0) { fprintf (stderr, "XBlast sound server: could not get block size of sound device\n"); } #endif } /* * resync sound device */ #if defined(__STDC__) static void resync (int dsp) #else static void resync (dsp) int dsp; #endif { /* clear sample sum buffer */ register int i; register u8 *s = playbuff; for (i = 0; i < SUBSIZE; i++) { *s++ = 128; } #ifdef __sun__ ioctl (dsp, I_FLUSH, NULL); fprintf (stderr, "\nsync\n"); #else /* resync sound device to correct any channel flipping */ write (dsp, playbuff, SUBSIZE); write (dsp, playbuff, SUBSIZE); write (dsp, playbuff, SUBSIZE); (void)ioctl (dsp, SNDCTL_DSP_SYNC, NULL); #endif } /* * load sound samples into server memory */ #if defined(__STDC__) static int server_load_sound (int number) #else static int server_load_sound (number) int number; #endif { char fname[1000]; int i, f; static char *path_list[3] = { NULL, GAME_DATADIR "/", ".", }; /* check environment for xblast search path */ path_list[0] = getenv ("XBLASTDIR"); for (i = 0; i < 3; i++) { if (path_list[i] != NULL) { sprintf (fname, "%s/%s/%s", path_list[i], "sounds", sound_name[number].name); // fprintf(stderr," opening %s \n",fname); if ((f = open (fname, O_RDONLY)) >= 0) { int sound_size; u8 *sb; struct stat snd_stat; #ifdef DEBUG fprintf (stderr, "Opened file \"%s\".\n", fname); #endif (void)fstat (f, &snd_stat); sound_size = snd_stat.st_size / sizeof (u8); if (sound_name[number].samples != NULL) { free (sound_name[number].samples); sound_name[number].samples = NULL; sound_name[number].length = 0; } if ((sb = (u8 *) malloc (sound_size * sizeof (u8))) == NULL) { close (f); return (-1); } else { read (f, sb, sound_size * sizeof (u8)); sound_name[number].samples = sb; sound_name[number].length = sound_size; close (f); #if defined(SERVER_STATISTICS) total_loaded++; #endif /* * convert stereo samples to mono if running in mono mode */ if (mono_mode == TRUE && sound_name[number].mono == FALSE) { int i; u8 *m, *s; s16 sum; m = s = sound_name[number].samples; sound_name[number].length >>= 1; for (i = 0; i < sound_name[number].length; i++) { sum = *s + *(s + 1); *m++ = sum >> 1; s += 2; } } return (0); } } } } fprintf (stderr, "could not open sound data file %s\n", sound_name[number].name); return (-1); } /* * free sample memory of a given sound */ #if defined(__STDC__) static void server_unload_sound (int id) #else static void server_unload_sound (id) int id; #endif { if (sound_name[id].samples != NULL) { free (sound_name[id].samples); sound_name[id].samples = NULL; sound_name[id].length = 0; #if defined(SERVER_STATISTICS) total_unloaded++; #endif } } static int RunningInstances (void) { FILE *ptr; static char userPath[1024]; char tmp[1024]; unsigned int pid; char *home; /* set private xblast path */ home = getenv ("HOME"); if (NULL == home) { strcpy (userPath, "./user/xbsndsrv.pid"); } else { sprintf (userPath, "%s/.xblast_tnt/xbsndsrv.pid", home); } ptr = fopen (userPath, "r+"); if (ptr == NULL) { ptr = fopen (userPath, "w+"); sprintf (tmp, PID_FORMAT, getpid ()); fwrite (tmp, 1, strlen (tmp), ptr); fclose (ptr); return 0; } fscanf (ptr, PID_FORMAT, &pid); fprintf (stderr, " " PID_FORMAT " \n", pid); if (kill (pid, 0) == -1 || pid <= 0) { fseek (ptr, 0, SEEK_SET); sprintf (tmp, PID_FORMAT, getpid ()); fwrite (tmp, 1, strlen (tmp), ptr); fclose (ptr); return 0; } else { return 1; } } /* * main function */ #if defined(__STDC__) int main (int argc, char **argv) #else int main (argc, argv) int argc; char **argv; #endif { int dsp; int do_sync = TRUE; int did_sync = FALSE; int ack_val; #ifdef __sun__ int samples_to_play = 0; int samples_played = 0; #endif if (RunningInstances ()) { fprintf (stderr, "xbsndsrv already running\n"); return 1; } /* * open and prepare sound device */ if ((dsp = open (SOUND_DEVICE, O_WRONLY)) < 0) { fprintf (stderr, "XBlast sound server: could not open sound device %s\n", SOUND_DEVICE); ack_val = SND_ACK_ERROR; write (1, &ack_val, sizeof (ack_val)); exit (-1); } ack_val = SND_ACK_OK; write (1, &ack_val, sizeof (ack_val)); while (--argc > 0) { ++argv; if (!strcmp ("-mono", *argv)) { mono_mode = TRUE; } else { fprintf (stderr, "XBlast sound server: unknown option %s ignored\n", *argv); } } if (mono_mode == TRUE) { #ifdef __sun__ sample_channels = 1; #else sample_channels = 0; #endif } init_dsp (dsp); /* * install server abort signal handler */ signal (SIGINT, server_abort); fprintf (stderr, "XBlast sound server $Revision: 1.23 $ running in %s mode.\n", (mono_mode == TRUE) ? "mono" : "stereo"); /* * calibrate sound server to CPU power */ signal (SIGALRM, calibration_stop); { unsigned long l = 0; int d1, d2, d3, d4, d5; calibration_ready = FALSE; alarm (1); while (calibration_ready == FALSE) { l++; /* do something similar to the "place a sample" loop */ #ifdef __sun__ d5 = d2++ - SUN_AUDIO_REF; #else d5 = d2++ - 128; #endif d1 = (d2 * (d3 + 1)) >> 4; d4 = (d2 * (d3 - MAX_SOUND_POSITION + 1)) >> 4; d2 += d1; d3 += d4; } max_sim_sounds = l / (SAMPLE_RATE * MAX_CPU_LOAD_ADJUST); l = d4 + d5; /* hope to fake C optimizer */ /* calc. max playable sounds to something reasonable... */ if (max_sim_sounds > ABS_MAX_SIM_SOUNDS) { max_sim_sounds = ABS_MAX_SIM_SOUNDS; } else if (max_sim_sounds < DEFAULT_MAX_SIM_SOUNDS) { max_sim_sounds = DEFAULT_MAX_SIM_SOUNDS; } } /* * allocate memory for playing sounds table */ fprintf (stderr, "Xblast Sound Server: playing at most %d sounds simultaneously\n", max_sim_sounds); fflush (stderr); if ((sound_table = (XBSOUND *) malloc (max_sim_sounds * sizeof (XBSOUND))) == NULL) { fprintf (stderr, "XBlast Sound Server: not enough memory to allocate sound table\n"); exit (-1); } else { /* initialze sound table */ XBSOUND *s = sound_table; int i; for (i = 0; i < max_sim_sounds; i++, s++) { s->length = 0; } } /* * loop forever (or SIGINT) */ while (1) { /* clear sample sum buffer */ { register int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE; i++) { *s++ = 128; } } if (sounds_playing <= 0) { /* no sound to play, may sync */ do_sync = TRUE; } else { do_sync = FALSE; did_sync = FALSE; } /* sum samples in sumup buffer */ if (mono_mode == TRUE) { /* * process sounds in mono mode */ XBSOUND *xs = sound_table; int as; for (as = 0; as < max_sim_sounds; as++) { if (xs->length > 0) { int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE && xs->length > 0; i++, xs->length--) { #ifdef __sun__ *s++ += ((s16) * xs->samples++) - SUN_AUDIO_REF; #else *s++ += ((s16) * xs->samples++) - 128; #endif } #if defined(SERVER_STATISTICS) total_samples += (double)i; #endif /* repeat a sound if this is required */ if (xs->length <= 0) { if (xs->repeat == TRUE) { int id = xs->id; xs->length = sound_name[id].length; xs->samples = sound_name[id].samples; } else { next_free_sound = as; sounds_playing--; } } } xs++; } /* correct clipping */ { register int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE; i++) { if (*s > 255) { *s = 255; } else if (*s < 0) { *s = 0; } s++; } } /* copy sum buffer to playback buffer and play it */ { register u8 *d = playbuff; register s16 *s = sumbuff; register int i; for (i = 0; i < SUBSIZE; i++) { *d++ = (u8) * s++; } /* play buffer */ write (dsp, playbuff, SUBSIZE); } } else { /* * process sounds in stereo mode */ XBSOUND *xs = sound_table; int as; for (as = 0; as < max_sim_sounds; as++) { if (xs->length > 0) { int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE && xs->length > 0; i++, xs->length--) { if (xs->mono == TRUE) { /* calc. position of mono sounds and add to sumup buffer */ int pos = xs->position; #ifdef __sun__ s16 sample = ((s16) * xs->samples++) - SUN_AUDIO_REF; #else s16 sample = ((s16) * xs->samples++) - 128; #endif s16 sr, sl; sr = (sample * (pos + 1)) >> 4; sl = (sample * (pos - MAX_SOUND_POSITION + 1)) >> 4; *s++ += sl; *s++ += sr; i++; } else { #ifdef __sun__ *s++ += ((s16) * xs->samples++) - SUN_AUDIO_REF; #else *s++ += ((s16) * xs->samples++) - 128; #endif } } #if defined(SERVER_STATISTICS) total_samples += (double)i; #endif /* repeat a sound if this is required */ #ifdef __sun__ samples_to_play = i; #endif if (xs->length <= 0) { if (xs->repeat == TRUE) { int id = xs->id; xs->length = sound_name[id].length; xs->samples = sound_name[id].samples; } else { sounds_playing--; next_free_sound = as; } } } xs++; } /* correct clipping */ switch (sample_size) { case 8: { register int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE; i++) { if (*s > 255) { *s = 255; } else if (*s < 0) { *s = 0; } s++; } } break; case 16: { register int i; register s16 *s = sumbuff; for (i = 0; i < SUBSIZE; i++) { if (*s > 8191) { *s = 8191; } (*s) = (*s) << 5; if (*s < -8191) { *s = -8191; } s++; } } } /* copy sum buffer to playback buffer and play it */ { register u8 *d = playbuff; register s16 *s = sumbuff; register int i; for (i = 0; i < SUBSIZE; i++) { *d++ = (u8) * s++; } /* play buffer */ #ifdef __sun__ switch (sample_size) { case 8: write (dsp, playbuff, samples_to_play); samples_played += samples_to_play; break; case 16: write (dsp, sumbuff, samples_to_play * 2); samples_played += samples_to_play >> 1; break; } /* Wait for output to mostly finish playing */ { struct audio_info au; /* ioctl(dsp,AUDIO_GETINFO,&au); au.play.pause=0; au.play.error=0; ioctl(dsp,AUDIO_SETINFO,&au); */ ioctl (dsp, AUDIO_GETINFO, &au); /* fprintf(stderr, "\rsamples_played = %10d, played = %10d, error=%d", samples_played,au.play.samples,au.play.error); fflush(stdout); */ while ((samples_played - au.play.samples) > (SAMPLE_RATE >> 4)) { if (ioctl (dsp, AUDIO_GETINFO, &au) < 0) { fprintf (stderr, "XBlast sound server: " "could not read audio device settings\n"); } /* if (au.play.error) break; */ } } #else switch (sample_size) { case 8: write (dsp, playbuff, SUBSIZE); break; case 16: write (dsp, sumbuff, SUBSIZE * 2); break; } #endif } } #if 1 /* resync sound device to correct any channel flipping */ if (do_sync == TRUE && did_sync == FALSE) { #ifdef __sun__ /* ioctl(dsp,AUDIO_DRAIN,NULL); */ ioctl (dsp, I_FLUSH, NULL); fprintf (stderr, "\nsync\n"); #else (void)ioctl (dsp, SNDCTL_DSP_SYNC, NULL); #endif did_sync = TRUE; } #endif /* check for new commands in input pipe */ { int command_buff[1024]; int *cmd; int n; struct timeval tv; fd_set rs; while (1) { tv.tv_sec = tv.tv_usec = 0; FD_ZERO (&rs); FD_SET (0, &rs); if (select (1, &rs, NULL, NULL, &tv) > 0 && FD_ISSET (0, &rs)) { n = read (0, command_buff, 8); if ((n == 0) || (n < 0 && errno != EINTR && errno != EAGAIN)) { fprintf (stderr, "Parent was killed, bailing out ...\n"); exit (0); } cmd = command_buff; /* there are commands in the pipe */ while (n > 0) { if (*cmd == SND_PLAY_SOUND) { int id = *++cmd; if (sounds_playing < max_sim_sounds) { XBSOUND *xs = sound_table + next_free_sound; /* append new sound to play to play list */ #if defined(SERVER_STATISTICS) total_played++; #endif while (xs->length > 0) { next_free_sound++; if (next_free_sound >= max_sim_sounds) { next_free_sound = 0; } xs = sound_table + next_free_sound; } xs->id = id & 0xffff; xs->position = (id >> 16) & 0xffff; id &= 0xffff; xs->repeat = sound_name[id].repeat; xs->mono = sound_name[id].mono; xs->samples = sound_name[id].samples; xs->length = sound_name[id].length; xs->next = NULL; sounds_playing++; } else { total_skipped++; } } else if (*cmd == SND_STOP_SOUND) { int stop_id = *++cmd; if (stop_id == 0 || stop_id == STOP_ALL_SOUNDS) { XBSOUND *s = sound_table; int i; for (i = 0; i < max_sim_sounds; i++, s++) { s->length = 0; s->repeat = 0; } sounds_playing = 0; resync (dsp); } else { XBSOUND *s = sound_table; int i; for (i = 0; i < max_sim_sounds; i++, s++) { if (s->id == stop_id) { s->length = 0; s->repeat = 0; sounds_playing--; } } } write (1, cmd, 1); } else if (*cmd == SND_LOAD_SOUND) { server_load_sound (*++cmd); write (1, cmd, 1); } else if (*cmd == SND_UNLOAD_SOUND) { server_unload_sound (*++cmd); write (1, cmd, 1); } n -= 2 * sizeof (int); cmd++; } } else { break; } } } } } #endif
%s
%s%s:%d%d%d%dV%u.%u.%u%s
%u registered games at %s