From: jsancho Date: Fri, 27 Jan 2012 19:24:02 +0000 (+0000) Subject: Making collisions support X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=c136e8116d3f8a40aa0ec2e5506774aead91e958;p=gacela.git Making collisions support --- diff --git a/Makefile b/Makefile index 84eb1c5..d7950bc 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - +MAKE=make pkgdatadir = $(datadir)/gacela @@ -38,13 +38,9 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \ - config.guess config.rpath config.sub depcomp install-sh \ - ltmain.sh missing + config.guess config.sub depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -137,7 +133,7 @@ AUTOHEADER = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run autohea AUTOMAKE = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run automake-1.11 AWK = mawk CC = gcc -CCDEPMODE = depmode=gcc3 +CCDEPMODE = depmode=none CFLAGS = -g -O2 CPP = gcc -E CPPFLAGS = @@ -153,8 +149,6 @@ ECHO_T = EGREP = /bin/grep -E EXEEXT = FGREP = /bin/grep -F -FTGL_LIBS = -lftgl -GL_LIBS = -lGL -lGLU GREP = /bin/grep GUILE = /usr/bin/guile GUILE_CFLAGS = -pthread -I/usr/include/guile/2.0 @@ -194,9 +188,8 @@ PACKAGE_URL = PACKAGE_VERSION = 0.5 PATH_SEPARATOR = : RANLIB = ranlib -SDL_LIBS = -lSDL -lSDL_image -lSDL_gfx -lSDL_mixer SED = /bin/sed -SET_MAKE = +SET_MAKE = MAKE=make SHELL = /bin/bash STRIP = strip VERSION = 0.5 @@ -207,7 +200,7 @@ abs_top_srcdir = /home/jsancho/proyectos/gacela/trunk ac_ct_AR = ar ac_ct_CC = gcc ac_ct_DUMPBIN = -am__include = include +am__include = # am__leading_dot = . am__quote = am__tar = ${AMTAR} chof - "$$tardir" @@ -254,7 +247,6 @@ top_builddir = . top_srcdir = . SUBDIRS = src dist_doc_DATA = README -ACLOCAL_AMFLAGS = -I m4 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/configure b/configure index 4d0e906..80babfe 100755 --- a/configure +++ b/configure @@ -619,10 +619,10 @@ LIBOBJS FTGL_LIBS GL_LIBS SDL_LIBS -GUILE_LDFLAGS -GUILE_CFLAGS GUILE_LTLIBS GUILE_LIBS +GUILE_LDFLAGS +GUILE_CFLAGS GUILE_TOOLS GUILE_CONFIG GUILE @@ -744,7 +744,6 @@ enable_dependency_tracking with_gnu_ld with_sysroot enable_libtool_lock -enable_rpath ' ac_precious_vars='build_alias host_alias @@ -1382,7 +1381,6 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-libtool-lock avoid locking (might break parallel builds) - --disable-rpath do not hardcode runtime library paths Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1392,7 +1390,6 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). - --with-gnu-ld assume the C compiler uses GNU ld default=no Some influential environment variables: CC C compiler command @@ -11979,216 +11976,6 @@ fi -# 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. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 -$as_echo_n "checking for ld used by GCC... " >&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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${acl_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${acl_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$acl_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 -$as_echo_n "checking for shared library run path origin... " >&6; } -if ${acl_cv_rpath+:} false; then : - $as_echo_n "(cached) " >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 -$as_echo "$acl_cv_rpath" >&6; } - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_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 - - - - - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 -$as_echo_n "checking for 64-bit host... " >&6; } -if ${gl_cv_solaris_64bit+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef _LP64 -sixtyfour bits -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sixtyfour bits" >/dev/null 2>&1; then : - gl_cv_solaris_64bit=yes -else - gl_cv_solaris_64bit=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; } - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking libguile compile flags" >&5 $as_echo_n "checking libguile compile flags... " >&6; } GUILE_CFLAGS="`$GUILE_CONFIG compile`" @@ -12201,127 +11988,9 @@ $as_echo_n "checking libguile link flags... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE_LDFLAGS" >&5 $as_echo "$GUILE_LDFLAGS" >&6; } - - - - GUILE_LIBS= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - rpathdirs= - next= - for opt in $GUILE_LDFLAGS; do - if test -n "$next"; then - dir="$next" - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n """"; then - for dir in $rpathdirs; do - GUILE_LIBS="${GUILE_LIBS}${GUILE_LIBS:+ }-R$dir" - done - else - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - GUILE_LIBS="$flag" - else - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - GUILE_LIBS="${GUILE_LIBS}${GUILE_LIBS:+ }$flag" - done - fi - fi - fi - fi - fi - - + AC_LIB_LINKFLAGS_FROM_LIBS(GUILE_LIBS, $GUILE_LDFLAGS, ) GUILE_LIBS="$GUILE_LDFLAGS $GUILE_LIBS" - - - - GUILE_LTLIBS= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - rpathdirs= - next= - for opt in $GUILE_LDFLAGS; do - if test -n "$next"; then - dir="$next" - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""yes""; then - for dir in $rpathdirs; do - GUILE_LTLIBS="${GUILE_LTLIBS}${GUILE_LTLIBS:+ }-R$dir" - done - else - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - GUILE_LTLIBS="$flag" - else - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - GUILE_LTLIBS="${GUILE_LTLIBS}${GUILE_LTLIBS:+ }$flag" - done - fi - fi - fi - fi - fi - - + AC_LIB_LINKFLAGS_FROM_LIBS(GUILE_LTLIBS, $GUILE_LDFLAGS, yes) GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS" diff --git a/src/gacela.scm b/src/gacela.scm index c0451f6..6c109da 100644 --- a/src/gacela.scm +++ b/src/gacela.scm @@ -38,14 +38,17 @@ show-mob-hash hide-mob-hash hide-all-mobs - get-mob-function-name) + get-current-mob-id + get-mob-function-name + map-mobs) #:export-syntax (game show-mob hide-mob the-mob define-mob-function define-mob - lambda-mob) + lambda-mob + define-checking-mobs) #:re-export (get-current-color set-current-color with-color @@ -223,11 +226,18 @@ (else `(hide-mob-hash (,mob 'get-mob-id))))) +(define current-mob-id #f) + +(define (get-current-mob-id) + current-mob-id) + (define* (run-mobs #:optional (mobs (get-active-mobs))) (for-each (lambda (m) + (set! current-mob-id (m 'get-mob-id)) (glmatrix-block (m))) - mobs)) + mobs) + (set! current-mob-id #f)) ;;; Making mobs @@ -304,8 +314,15 @@ (the-mob 'undefined '() ,fun-name)))) -;;; Collisions +;;; Functions for checking mobs (collisions and more) + +(define (map-mobs fun) + (let ((mobs (filter (lambda (m) (not (eq? (m 'get-mob-id) (get-current-mob-id)))) (get-active-mobs)))) + (map fun mobs))) +(define-macro (define-checking-mobs head mob-attr . body) + `(define ,head + ;; (define-macro (lambda-mob-data attr . body) ;; `(lambda ,attr ,@body))