initial
This commit is contained in:
1
.deps/CVS/Entries
Normal file
1
.deps/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D
|
||||
1
.deps/CVS/Repository
Normal file
1
.deps/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/.deps
|
||||
1
.deps/CVS/Root
Normal file
1
.deps/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
1
.xvpics/CVS/Entries
Normal file
1
.xvpics/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D
|
||||
1
.xvpics/CVS/Repository
Normal file
1
.xvpics/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/.xvpics
|
||||
1
.xvpics/CVS/Root
Normal file
1
.xvpics/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
22
CVS/Entries
Normal file
22
CVS/Entries
Normal file
@@ -0,0 +1,22 @@
|
||||
/Makefile.am/1.6/Mon May 10 01:07:02 2004//
|
||||
/Makefile.cvs/1.2/Wed Nov 19 19:31:47 2003//
|
||||
/conf.c/1.1/Mon May 10 01:07:02 2004//
|
||||
/conf.h/1.1/Mon May 10 01:10:15 2004//
|
||||
/configure.in/1.5/Mon May 10 01:07:02 2004//
|
||||
/game.c/1.1/Fri May 7 05:50:18 2004//
|
||||
/game.h/1.1/Fri May 7 05:50:18 2004//
|
||||
/gamedefs.h/1.1/Fri May 7 05:47:38 2004//
|
||||
/gameinput.c/1.2/Mon May 10 01:07:02 2004//
|
||||
/gameinput.h/1.1/Fri May 7 05:47:39 2004//
|
||||
/main.c/1.15/Mon May 10 01:07:02 2004//
|
||||
/main.h/1.4/Mon May 10 01:08:34 2004//
|
||||
/mines.conf/1.1.1.1/Thu Oct 31 02:06:40 2002//
|
||||
/structs.h/1.2/Sun May 9 22:58:13 2004//
|
||||
/video.c/1.1/Mon May 10 01:07:02 2004//
|
||||
/video.h/1.1/Mon May 10 01:10:15 2004//
|
||||
D/.deps////
|
||||
D/.xvpics////
|
||||
D/admin////
|
||||
D/docs////
|
||||
D/images////
|
||||
D/templates////
|
||||
1
CVS/Repository
Normal file
1
CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine
|
||||
11
Makefile.am
Normal file
11
Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
# don't warn about missing AUTHORS, NEWS, ChangeLog .. files
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
#SUBDIRS = docs
|
||||
EXTRA_DIST = admin images main.c mines.conf templates
|
||||
|
||||
bin_PROGRAMS = openmine
|
||||
openmine_SOURCES = main.c game.c gameinput.c video.c conf.c
|
||||
openmine_CFLAGS = @CFLAGS@
|
||||
openmine_LDFLAGS = @LDFLAGS@
|
||||
15
Makefile.cvs
Normal file
15
Makefile.cvs
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
all:
|
||||
@echo "This Makefile is only for the CVS repository"
|
||||
@echo "This will be deleted before making the distribution"
|
||||
@echo ""
|
||||
@if test ! -d admin; then \
|
||||
echo "Please recheckout this module!" ;\
|
||||
echo "for cvs: use checkout once and after that update again" ;\
|
||||
exit 1 ;\
|
||||
fi
|
||||
$(MAKE) -f admin/Makefile.common cvs
|
||||
|
||||
clean:
|
||||
$(MAKE) -f admin/Makefile.common cvs-clean
|
||||
.SILENT:
|
||||
11
admin/CVS/Entries
Normal file
11
admin/CVS/Entries
Normal file
@@ -0,0 +1,11 @@
|
||||
/Makefile.common/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/acinclude.m4/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/compile/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/config.guess/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/config.sub/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/depcomp/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/install-sh/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/ltmain.sh/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/missing/1.1/Wed Nov 19 17:23:57 2003//
|
||||
/mkinstalldirs/1.1/Wed Nov 19 17:23:57 2003//
|
||||
D
|
||||
1
admin/CVS/Repository
Normal file
1
admin/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/admin
|
||||
1
admin/CVS/Root
Normal file
1
admin/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
49
admin/Makefile.common
Normal file
49
admin/Makefile.common
Normal file
@@ -0,0 +1,49 @@
|
||||
cvs:
|
||||
#@echo "*** Concatenating configure tests into acinclude.m4"
|
||||
#@-rm -f acinclude.m4
|
||||
#@$(MAKE) -f Makefile.am top_srcdir=. acinclude.m4
|
||||
@echo "*** Retrieving configure tests needed by configure.in"
|
||||
@aclocal -I . -I admin
|
||||
@echo "*** Scanning for include statements"
|
||||
@autoheader
|
||||
@echo "*** Building Makefile templates (step one)"
|
||||
@automake
|
||||
@echo "*** Building Makefile templates (step two)"
|
||||
@autoconf
|
||||
@if grep "ac_kw foo" configure &>/dev/null; then perl -p -i -e "s/ac_kw foo/ac_kw int foo/" configure; fi
|
||||
@perl -pi -e 'if (/\[\/\$$\]\*. INSTALL=/) { print $$_ ; $$_ = "\"\") ;;\n"; }' configure
|
||||
@-rm -f config.cache config.h
|
||||
@echo "*** Create date/time stamp"
|
||||
@touch stamp-h.in
|
||||
@echo "*** Finished"
|
||||
@echo " Don't forget to run ./configure"
|
||||
@echo " If you haven't done so in a while, run ./configure --help"
|
||||
|
||||
cvs-clean:
|
||||
@if test ! -d CVS; then \
|
||||
echo "you don't have a toplevel CVS directory."; \
|
||||
echo "You most certainly didn't use cvs to get these sources."; \
|
||||
echo "But this function depends on cvs's informations."; \
|
||||
exit 1 ;\
|
||||
fi;\
|
||||
pwd=`pwd` ;\
|
||||
dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\
|
||||
for i in $$dirs; do \
|
||||
if test ! -d $$pwd/$$i/CVS; then \
|
||||
echo "D $$i" ;\
|
||||
rm -rf $$pwd/$$i; \
|
||||
continue; \
|
||||
fi ;\
|
||||
cd $$pwd/$$i ;\
|
||||
for f in * .*; do \
|
||||
if test ! -d $$f; then \
|
||||
if grep "^/$$f/" CVS/Entries > /dev/null; then \
|
||||
a="b"; \
|
||||
else \
|
||||
echo "F $$i/$$f"; \
|
||||
rm -f $$pwd/$$i/$$f; \
|
||||
fi; \
|
||||
fi ; \
|
||||
done; \
|
||||
done
|
||||
|
||||
168
admin/acinclude.m4
Normal file
168
admin/acinclude.m4
Normal file
@@ -0,0 +1,168 @@
|
||||
# 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_PATH_PROG(SDL_CONFIG, sdl-config, no)
|
||||
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_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
], [ 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"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
||||
99
admin/compile
Executable file
99
admin/compile
Executable file
@@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
|
||||
|
||||
# Usage:
|
||||
# compile PROGRAM [ARGS]...
|
||||
# `-o FOO.o' is removed from the args passed to the actual compile.
|
||||
|
||||
prog=$1
|
||||
shift
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
args=
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we do something ugly here.
|
||||
ofile=$2
|
||||
shift
|
||||
case "$ofile" in
|
||||
*.o | *.obj)
|
||||
;;
|
||||
*)
|
||||
args="$args -o $ofile"
|
||||
ofile=
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
args="$args $1"
|
||||
;;
|
||||
*)
|
||||
args="$args $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$prog" $args
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir $lockdir > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir $lockdir; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$prog" $args
|
||||
status=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir $lockdir
|
||||
exit $status
|
||||
1363
admin/config.guess
vendored
Executable file
1363
admin/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1470
admin/config.sub
vendored
Executable file
1470
admin/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
423
admin/depcomp
Executable file
423
admin/depcomp
Executable file
@@ -0,0 +1,423 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, 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 <oliva@dcc.unicamp.br>.
|
||||
|
||||
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
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
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. 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.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
# 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"
|
||||
;;
|
||||
|
||||
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
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab 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 proprocessed 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'. We will use -o /dev/null later,
|
||||
# however we can't do the remplacement now because
|
||||
# `-o $object' might simply not be used
|
||||
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
|
||||
"$@" -o /dev/null $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 $?
|
||||
# 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 ;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
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 proprocessed 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 '/^# [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 proprocessed 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
|
||||
251
admin/install-sh
Executable file
251
admin/install-sh
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# 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}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# 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 $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
4984
admin/ltmain.sh
Normal file
4984
admin/ltmain.sh
Normal file
File diff suppressed because it is too large
Load Diff
336
admin/missing
Executable file
336
admin/missing
Executable file
@@ -0,0 +1,336 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, 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
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-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]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.4 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1Help2man' 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' is missing on your system. 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 missing on your system. 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)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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 you do not seem to have it handy on your
|
||||
system. 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 prerequirements 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
|
||||
99
admin/mkinstalldirs
Executable file
99
admin/mkinstalldirs
Executable file
@@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case "${1}" in
|
||||
-h | --help | --h* ) # -h for help
|
||||
echo "${usage}" 1>&2; exit 0 ;;
|
||||
-m ) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||
dirmode="${1}"
|
||||
shift ;;
|
||||
-- ) shift; break ;; # stop option processing
|
||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||
* ) break ;; # first non-opt arg
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi ;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
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: 3
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
250
conf.c
Normal file
250
conf.c
Normal file
@@ -0,0 +1,250 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#else
|
||||
#define PACKAGE_VERSION "0.2b"
|
||||
#define PACKAGE_NAME "openmine"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gamedefs.h"
|
||||
#include "structs.h"
|
||||
#include "conf.h"
|
||||
|
||||
extern char *progname;
|
||||
|
||||
static int
|
||||
getuint (const char *s, unsigned *myuint)
|
||||
{
|
||||
long int l;
|
||||
char *error;
|
||||
|
||||
if (s == NULL)
|
||||
return -1;
|
||||
|
||||
l = strtol (s, &error, 0);
|
||||
if (error && *error)
|
||||
return -1;
|
||||
|
||||
if (l < 0 || l > UINT_MAX)
|
||||
return -1;
|
||||
|
||||
if (myuint)
|
||||
*myuint = l;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
help (void)
|
||||
{
|
||||
printf (PACKAGE_NAME " v" PACKAGE_VERSION "\n"
|
||||
"\n"
|
||||
"[OPCIONES]:\n"
|
||||
"\t-h, --help\t\tMostrar este mensaje.\n"
|
||||
"\t-f, --fullscreen\tCargar el juego a pantalla completa.\n"
|
||||
"\t-l[num] [cant]\t\tEspecificar [cant] de cubos en el lado [num]\n"
|
||||
"\t\t\t\t(de 1 a 3).\n"
|
||||
"\t-c [cant]\t\tTodos los lados tendrán la misma [cant]\n"
|
||||
"\t\t\t\tde cubos.\n"
|
||||
"\t-m [cant]\t\tEspecificar [cant] de minas.\n"
|
||||
"\t-t [tema]\t\tCargar el juego con el [tema] especificado\n"
|
||||
"\t\t\t\t(el tema debe existir).\n" "\t-s [xxx]\t\t????\n");
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static int
|
||||
processFile (struct config *c, const char *rc)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen (rc, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: unable to open rc file `%s'\n", progname, rc);
|
||||
fprintf (stderr, "%s: %s\n", progname, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: make this smarter.
|
||||
* TODO: at least flush on error
|
||||
*/
|
||||
fscanf (fp, "theme=%s\n", c->theme);
|
||||
fscanf (fp, "lado1=%u\n", c->side + 0);
|
||||
c->side[0] += 2;
|
||||
fscanf (fp, "lado2=%u\n", c->side + 1);
|
||||
c->side[1] += 2;
|
||||
fscanf (fp, "lado3=%u\n", c->side + 2);
|
||||
c->side[2] += 2;
|
||||
fscanf (fp, "cantidad=%u", &(c->n));
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Search Path:
|
||||
* options
|
||||
* ./mine.conf
|
||||
* ~/.mine.conf (UNIX)
|
||||
* default options
|
||||
*/
|
||||
int
|
||||
getOptions (struct config *c, int argc, char **argv)
|
||||
{
|
||||
if (c == NULL || argv == NULL || argc < 1)
|
||||
return 1;
|
||||
|
||||
memset (c, 0, sizeof (*c));
|
||||
|
||||
/* default */
|
||||
c->flags = SDL_OPENGL;
|
||||
strcpy (c->theme, RC_THEME "/");
|
||||
|
||||
c->side[0] = c->side[1] = c->side[2] = 7;
|
||||
c->n = 15;
|
||||
c->cube = 0.25f;
|
||||
|
||||
c->side[0] += 2;
|
||||
c->side[1] += 2;
|
||||
c->side[2] += 2;
|
||||
|
||||
|
||||
processFile (c, RC_FILE);
|
||||
if (processCmdLine (c, argc, argv))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
processCmdLine (struct config *c, int argc, char **argv)
|
||||
{
|
||||
int nRet;
|
||||
int fail = 0;
|
||||
/* TODO: getopt or something similar?
|
||||
*/
|
||||
progname = argv[0];
|
||||
while (!fail && --argc)
|
||||
{
|
||||
argv++;
|
||||
if (!strcmp (*argv, "-t"))
|
||||
{
|
||||
argc--;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
printf ("%s: argument missing\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen (argv[1]) >= sizeof (c->theme) - 2)
|
||||
{
|
||||
printf ("%s: theme name is too long\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (c->theme, *(++argv));
|
||||
strcat (c->theme, "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp (*argv, "-l1") ||
|
||||
!strcmp (*argv, "-l2") || !strcmp (*argv, "-l3"))
|
||||
{
|
||||
unsigned d = (*argv)[2] - '1';
|
||||
|
||||
argc--;
|
||||
if (argc == 0)
|
||||
{
|
||||
printf ("%s: argument missing\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRet = getuint (*(++argv), c->side + d);
|
||||
if (nRet == -1)
|
||||
{
|
||||
printf ("%s: `%s' is not an int\n", progname, *(argv - 1));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
c->side[d] += 2;
|
||||
|
||||
}
|
||||
else if (!strcmp (*argv, "-c"))
|
||||
{
|
||||
argc--;
|
||||
if (argc == 0)
|
||||
{
|
||||
printf ("%s: argument missing\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRet = getuint (*(++argv), c->side + 0);
|
||||
if (nRet == -1)
|
||||
{
|
||||
printf ("%s: `%s' is not an int\n", progname, *(argv - 1));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
c->side[1] = c->side[2] = c->side[0] += 2;
|
||||
}
|
||||
else if (!strcmp (*argv, "-s"))
|
||||
{
|
||||
unsigned p;
|
||||
|
||||
argc--;
|
||||
if (argc == 0)
|
||||
{
|
||||
printf ("%s: argument missing\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRet = getuint (*(++argv), &p);
|
||||
if (nRet == -1)
|
||||
{
|
||||
printf ("%s: `%s' is not an int\n", progname, *(argv - 1));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
c->cube = 1.0f / (2.0f + p);
|
||||
}
|
||||
else if (!strcmp (*argv, "-m"))
|
||||
{
|
||||
if (argc == 0)
|
||||
{
|
||||
printf ("%s: argument missing\n", progname);
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRet = getuint (*(++argv), &(c->n));
|
||||
if (nRet == -1)
|
||||
{
|
||||
printf ("%s: `%s' is not an int\n", progname, *(argv - 1));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
argc--;
|
||||
}
|
||||
else if (!strcmp (*argv, "--fullscreen") || !strcmp (*argv, "-f"))
|
||||
c->flags |= SDL_FULLSCREEN;
|
||||
else if (!strcmp (*argv, "--help") || !strcmp (*argv, "-h"))
|
||||
help ();
|
||||
}
|
||||
|
||||
return fail;
|
||||
}
|
||||
3
conf.h
Normal file
3
conf.h
Normal file
@@ -0,0 +1,3 @@
|
||||
int getOptions (struct config *c, int argc, char **argv);
|
||||
static int processCmdLine (struct config *c, int argc, char **argv);
|
||||
|
||||
114
configure.in
Normal file
114
configure.in
Normal file
@@ -0,0 +1,114 @@
|
||||
|
||||
AC_PREREQ(2.53)
|
||||
|
||||
PROJ_NAME=Openmine
|
||||
PROJ_VERSION=0.2.0
|
||||
|
||||
AC_INIT(Openmine)
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
AC_CONFIG_SRCDIR(main.c, game.c)
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE($PROJ_NAME,$PROJ_VERSION)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
CFLAGS="-Wall -ansi -pedantic "
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug creates debugging code],
|
||||
[ openmine_use_debug="$enableval"],[openmine_use_debug="no"])
|
||||
|
||||
CFLAGS=`echo $CFLAGS | sed s/-g//`
|
||||
if test "$openmine_use_debug" = "yes"; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
|
||||
# Build time sanity check...
|
||||
AM_SANITY_CHECK
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
#AC_MINGW32
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_RANLIB
|
||||
AC_ISC_POSIX
|
||||
# AC_PROG_LIBTOOL
|
||||
AC_ISC_POSIX
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
|
||||
|
||||
# Checks for X
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
|
||||
CFLAGS="$X_CFLAGS $CFLAGS"
|
||||
LDFLAGS="$X_LDFLAGS $X_LIBS $LDFLAGS"
|
||||
X_EXTRA_LIBS="$X_EXTRA_LIBS -lX11 -lm"
|
||||
|
||||
# Check for SDL
|
||||
SDL_VERSION=1.2.0
|
||||
AM_PATH_SDL($SDL_VERSION, :,
|
||||
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
|
||||
# Check for OpenGL
|
||||
AC_MSG_CHECKING(for OpenGL support)
|
||||
HAVE_OPENGL=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <GL/gl.h>
|
||||
|
||||
void
|
||||
foo( void )
|
||||
{
|
||||
glSelectBuffer(1,(void *)0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
],[
|
||||
],[
|
||||
HAVE_OPENGL=yes
|
||||
])
|
||||
if test x$HAVE_OPENGL = xyes; then
|
||||
CFLAGS="$CFLAGS"
|
||||
GL_LIBS="$SYS_GL_LIBS"
|
||||
LDFLAGS="$LDFLAGS -lGL -lGLU"
|
||||
echo "yes"
|
||||
else
|
||||
AC_MSG_ERROR([*** OpenGL not found ! ***])
|
||||
fi
|
||||
AC_SUBST(GL_LIBS)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
|
||||
# GLUT
|
||||
AC_CHECK_LIB([glut], [glutStrokeCharacter])
|
||||
|
||||
# X libs
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, X_LIBS="-lX11", X_LIBS=no, $X_EXTRA_LIBS)
|
||||
AC_CHECK_LIB(Xext, XShmAttach, X_LIBS="-lXext $X_LIBS", X_EXT=no,$X_EXTRA_LIBS)
|
||||
|
||||
|
||||
# At last, the end
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
||||
echo "
|
||||
$PACKAGE_NAME $PACKAGE_VERSION:
|
||||
Compiler: ${CC}
|
||||
Install prefix: $prefix
|
||||
SDL version: `sdl-config --version`
|
||||
CFLAGS: ${CFLAGS}
|
||||
LDFLAGS: ${LDFLAGS}
|
||||
debug: ${openmine_use_debug}"
|
||||
echo '
|
||||
Now type "gmake" to build ' $PACKAGE_NAME
|
||||
|
||||
|
||||
1
docs/CVS/Entries
Normal file
1
docs/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D/en////
|
||||
1
docs/CVS/Repository
Normal file
1
docs/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/docs
|
||||
1
docs/CVS/Root
Normal file
1
docs/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
9
docs/en/CVS/Entries
Normal file
9
docs/en/CVS/Entries
Normal file
@@ -0,0 +1,9 @@
|
||||
/index-1.html/1.1.1.1/Thu Oct 31 02:06:50 2002//
|
||||
/index-2.html/1.1.1.1/Thu Oct 31 02:07:01 2002//
|
||||
/index-3.html/1.1.1.1/Thu Oct 31 02:07:01 2002//
|
||||
/index-4.html/1.1.1.1/Thu Oct 31 02:07:01 2002//
|
||||
/index-5.html/1.1.1.1/Thu Oct 31 02:07:01 2002//
|
||||
/index-6.html/1.1.1.1/Thu Oct 31 02:07:01 2002//
|
||||
/index.html/1.1.1.1/Thu Oct 31 02:06:50 2002//
|
||||
/index.sgml/1.1.1.1/Thu Oct 31 02:06:50 2002//
|
||||
D
|
||||
1
docs/en/CVS/Repository
Normal file
1
docs/en/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/docs/en
|
||||
1
docs/en/CVS/Root
Normal file
1
docs/en/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
28
docs/en/index-1.html
Normal file
28
docs/en/index-1.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Introduction</TITLE>
|
||||
<LINK HREF="index-2.html" REL=next>
|
||||
|
||||
<LINK HREF="index.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="index.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="ss1.1">1.1 Changes</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="index-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="index.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
58
docs/en/index-2.html
Normal file
58
docs/en/index-2.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Installation</TITLE>
|
||||
<LINK HREF="index-3.html" REL=next>
|
||||
<LINK HREF="index-1.html" REL=previous>
|
||||
<LINK HREF="index.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-3.html">Next</A>
|
||||
<A HREF="index-1.html">Previous</A>
|
||||
<A HREF="index.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Installation</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="ss2.1">2.1 How to obtain Buscaminas3d </A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Compilation and installation</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>In order to compile and install Buscaminas3d on your system, type the following in
|
||||
the base directory of the Buscaminas3d distribution:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
% ./configure
|
||||
% make
|
||||
% make install
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>
|
||||
<P>Since Buscaminas3d uses
|
||||
<PRE>
|
||||
autoconf
|
||||
</PRE>
|
||||
you should have not trouble
|
||||
compiling it.
|
||||
Should you run into problems please report them to the the author at
|
||||
<A HREF="mailto:root@localhost.localdomain">root</A><P>
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="index-3.html">Next</A>
|
||||
<A HREF="index-1.html">Previous</A>
|
||||
<A HREF="index.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
27
docs/en/index-3.html
Normal file
27
docs/en/index-3.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Usage </TITLE>
|
||||
<LINK HREF="index-4.html" REL=next>
|
||||
<LINK HREF="index-2.html" REL=previous>
|
||||
<LINK HREF="index.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-4.html">Next</A>
|
||||
<A HREF="index-2.html">Previous</A>
|
||||
<A HREF="index.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Usage </A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="ss3.1">3.1 General Usage</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="index-4.html">Next</A>
|
||||
<A HREF="index-2.html">Previous</A>
|
||||
<A HREF="index.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
24
docs/en/index-4.html
Normal file
24
docs/en/index-4.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Another Section</TITLE>
|
||||
<LINK HREF="index-5.html" REL=next>
|
||||
<LINK HREF="index-3.html" REL=previous>
|
||||
<LINK HREF="index.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-5.html">Next</A>
|
||||
<A HREF="index-3.html">Previous</A>
|
||||
<A HREF="index.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4. Another Section</A></H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="index-5.html">Next</A>
|
||||
<A HREF="index-3.html">Previous</A>
|
||||
<A HREF="index.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
24
docs/en/index-5.html
Normal file
24
docs/en/index-5.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Questions and Answers</TITLE>
|
||||
<LINK HREF="index-6.html" REL=next>
|
||||
<LINK HREF="index-4.html" REL=previous>
|
||||
<LINK HREF="index.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-6.html">Next</A>
|
||||
<A HREF="index-4.html">Previous</A>
|
||||
<A HREF="index.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5. Questions and Answers</A></H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="index-6.html">Next</A>
|
||||
<A HREF="index-4.html">Previous</A>
|
||||
<A HREF="index.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
37
docs/en/index-6.html
Normal file
37
docs/en/index-6.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook: Copyright</TITLE>
|
||||
<LINK HREF="index-5.html" REL=previous>
|
||||
<LINK HREF="index.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="index-5.html">Previous</A>
|
||||
<A HREF="index.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s6">6. Copyright</A></H2>
|
||||
|
||||
<P>
|
||||
<P>Buscaminas3d Copyright 2002 root , root@localhost.localdomain
|
||||
<P>
|
||||
<P>This program is free software; you can redistribute 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.
|
||||
<P>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.
|
||||
<P>You 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.
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="index-5.html">Previous</A>
|
||||
<A HREF="index.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
docs/en/index.html
Normal file
55
docs/en/index.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>The Buscaminas3d Handbook</TITLE>
|
||||
<LINK HREF="index-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="index-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>The Buscaminas3d Handbook</H1>
|
||||
|
||||
<H2>root <CODE>root@localhost.localdomain</CODE></H2>Version 0.1 , dom oct 6 20:22:13 ART 2002
|
||||
<P><HR>
|
||||
<EM>This Handbook describes Buscaminas3d Version 0.1</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="index-1.html">Introduction</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="index-1.html#ss1.1">1.1 Changes</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="index-2.html">Installation</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="index-2.html#ss2.1">2.1 How to obtain Buscaminas3d </A>
|
||||
<LI><A HREF="index-2.html#ss2.2">2.2 Requirements</A>
|
||||
<LI><A HREF="index-2.html#ss2.3">2.3 Compilation and installation</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="index-3.html">Usage </A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="index-3.html#ss3.1">3.1 General Usage</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="index-4.html">Another Section</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="index-5.html">Questions and Answers</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="index-6.html">Copyright</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="index-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
||||
74
docs/en/index.sgml
Normal file
74
docs/en/index.sgml
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
<!doctype linuxdoc system>
|
||||
<article>
|
||||
<title>The Buscaminas3d Handbook
|
||||
<author>root <tt>root@localhost.localdomain</tt>
|
||||
<date>Version 0.1 , dom oct 6 20:22:13 ART 2002
|
||||
<abstract>
|
||||
This Handbook describes Buscaminas3d Version 0.1
|
||||
</abstract>
|
||||
|
||||
<toc>
|
||||
|
||||
<sect>Introduction
|
||||
<p>
|
||||
<sect1>Changes
|
||||
<p>
|
||||
|
||||
<sect>Installation
|
||||
<p>
|
||||
<sect1>How to obtain Buscaminas3d
|
||||
<p>
|
||||
|
||||
<sect1>Requirements
|
||||
<p>
|
||||
|
||||
<sect1>Compilation and installation
|
||||
<p>
|
||||
|
||||
In order to compile and install Buscaminas3d on your system, type the following in
|
||||
the base directory of the Buscaminas3d distribution:
|
||||
|
||||
<tscreen><verb>
|
||||
% ./configure
|
||||
% make
|
||||
% make install
|
||||
</verb></tscreen>
|
||||
|
||||
<p>
|
||||
Since Buscaminas3d uses <verb>autoconf</verb> you should have not trouble
|
||||
compiling it.
|
||||
Should you run into problems please report them to the the author at
|
||||
<htmlurl url="mailto:root@localhost.localdomain" name = "root">
|
||||
|
||||
|
||||
<p>
|
||||
<sect> Usage <p>
|
||||
<sect1> General Usage
|
||||
<p>
|
||||
<sect> Another Section
|
||||
<p>
|
||||
|
||||
<sect>Questions and Answers<p>
|
||||
|
||||
<sect>Copyright<p>
|
||||
|
||||
Buscaminas3d Copyright 2002 root , root@localhost.localdomain
|
||||
|
||||
|
||||
This program is free software; you can redistribute 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
<p>
|
||||
</article>
|
||||
82
game.c
Normal file
82
game.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "structs.h"
|
||||
#include "gamedefs.h"
|
||||
#include "game.h"
|
||||
|
||||
void
|
||||
nuevojuego (struct game *g)
|
||||
{
|
||||
int x, y, z, cantidad;
|
||||
|
||||
g->status=PLAYING;
|
||||
g->display->up = 0.0f;
|
||||
g->display->zoom = 0.0f;
|
||||
g->display->tilt_y = 0.0f;
|
||||
g->display->side = 0.0f;
|
||||
g->descubiertas = 0;
|
||||
g->start_time = time (NULL);
|
||||
|
||||
cantidad = g->config->n;
|
||||
for (x = 1; x < g->config->side[0] - 1; x++)
|
||||
for (y = 1; y < g->config->side[1] - 1; y++)
|
||||
for (z = 1; z < g->config->side[2] - 1; z++)
|
||||
g->campoV[x][y][z] = NUEVO;
|
||||
for (x = 1; x < g->config->side[0] - 1; x++)
|
||||
for (y = 1; y < g->config->side[1] - 1; y++)
|
||||
for (z = 1; z < g->config->side[2] - 1; z++)
|
||||
g->campo[x][y][z] = 0;
|
||||
|
||||
srand (time (NULL));
|
||||
while (cantidad > 0)
|
||||
{
|
||||
x = 1 + (int) (rand () / ((float) RAND_MAX) * (g->config->side[0] - 2));
|
||||
y = 1 + (int) (rand () / ((float) RAND_MAX) * (g->config->side[1] - 2));
|
||||
z = 1 + (int) (rand () / ((float) RAND_MAX) * (g->config->side[2] - 2));
|
||||
if (g->campo[x][y][z] == 0)
|
||||
{
|
||||
g->campo[x][y][z] = BOMBA;
|
||||
cantidad--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
descubrir (struct game *g, int x, int y, int z)
|
||||
{
|
||||
int i, j, k, num = 0;
|
||||
int lado1 = g->config->side[0], lado2 = g->config->side[1], lado3 =
|
||||
g->config->side[2];
|
||||
|
||||
if (g->campoV[x][y][z] == NUEVO)
|
||||
{
|
||||
if (g->campo[x][y][z] != BOMBA)
|
||||
{
|
||||
for (i = -1; i <= 1; i++)
|
||||
for (j = -1; j <= 1; j++)
|
||||
for (k = -1; k <= 1; k++)
|
||||
if (g->campo[x + i][y + j][z + k] == BOMBA)
|
||||
num++;
|
||||
g->campoV[x][y][z] = num;
|
||||
g->descubiertas++;
|
||||
if (g->descubiertas ==
|
||||
(lado1 - 2) * (lado2 - 2) * (lado3 - 2) - g->config->n)
|
||||
g->status = WON;
|
||||
if (num == 0)
|
||||
{
|
||||
g->campoV[x][y][z] = 0;
|
||||
for (i = -1; i <= 1; i++)
|
||||
for (j = -1; j <= 1; j++)
|
||||
for (k = -1; k <= 1; k++)
|
||||
if (!(i == 0 && j == 0 && k == 0)
|
||||
&& g->campoV[x + i][y + j][z + k] != BOMBA)
|
||||
descubrir (g, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g->status = LOST;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
game.h
Normal file
3
game.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
void descubrir (struct game *g, int x, int y, int z);
|
||||
void nuevojuego (struct game *g);
|
||||
18
gamedefs.h
Normal file
18
gamedefs.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#define RC_FILE "mines.conf"
|
||||
#define RC_THEME "classic"
|
||||
|
||||
#define THEME_RC "theme.conf"
|
||||
#define THEME_IMAGE "./images"
|
||||
#define THEME_LEN 40 /* max length of an image name */
|
||||
#define THEME_N 29 /* how many surfaces ? */
|
||||
|
||||
#define SCREEN_W 640
|
||||
#define SCREEN_H 480
|
||||
#define TEXTURAS GL_LINEAR
|
||||
#define BUFFER_LENGTH 64
|
||||
|
||||
/* Simbolos */
|
||||
#define BOMBA 27
|
||||
#define MARCA 28
|
||||
#define NUEVO '·'
|
||||
#define BLANCO ' '
|
||||
146
gameinput.c
Normal file
146
gameinput.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#include <SDL/SDL.h>
|
||||
#include "gamedefs.h"
|
||||
#include "structs.h"
|
||||
|
||||
void
|
||||
ingame_input (struct game *g)
|
||||
{
|
||||
Uint8 *keys;
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent (&event))
|
||||
{
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN)
|
||||
{
|
||||
/* Mouse button 1 ---> check for mine */
|
||||
if (event.button.button == 1)
|
||||
ProcessClick (g, event.button.x,
|
||||
SCREEN_H - event.button.y, 0);
|
||||
/* Mouse button 3 ---> toggle flag on selected cube */
|
||||
if (event.button.button == 3)
|
||||
ProcessClick (g, event.button.x,
|
||||
SCREEN_H - event.button.y, 1);
|
||||
/* Mouse wheel (Don't know if it works on M$ Win ) ---> zoom in */
|
||||
if (event.button.button == 4)
|
||||
g->display->zoom += 2;
|
||||
/* zoom out */
|
||||
if (event.button.button == 5)
|
||||
g->display->zoom -= 2;
|
||||
}
|
||||
if (event.type == SDL_QUIT)
|
||||
{
|
||||
g->status = QUIT;
|
||||
}
|
||||
if (event.type == SDL_KEYDOWN)
|
||||
{
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_ESCAPE:
|
||||
g->status = QUIT;
|
||||
break;
|
||||
case SDLK_n:
|
||||
g->status = NEWGAME;
|
||||
break;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
g->display->mod_status = CTRL;
|
||||
SDL_ShowCursor (SDL_DISABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_ON);
|
||||
break;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
g->display->mod_status = SHIFT;
|
||||
SDL_ShowCursor (SDL_DISABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_ON);
|
||||
break;
|
||||
case SDLK_RALT:
|
||||
case SDLK_LALT:
|
||||
g->display->mod_status = ALT;
|
||||
SDL_ShowCursor (SDL_DISABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_ON);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
if (event.type == SDL_KEYUP)
|
||||
{
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
g->display->mod_status = NONE;
|
||||
SDL_ShowCursor (SDL_ENABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_OFF);
|
||||
break;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
g->display->mod_status = NONE;
|
||||
SDL_ShowCursor (SDL_ENABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_OFF);
|
||||
break;
|
||||
case SDLK_RALT:
|
||||
case SDLK_LALT:
|
||||
g->display->mod_status = NONE;
|
||||
SDL_ShowCursor (SDL_ENABLE);
|
||||
SDL_WM_GrabInput (SDL_GRAB_OFF);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
if (event.type == SDL_MOUSEMOTION)
|
||||
{
|
||||
switch (g->display->mod_status)
|
||||
{
|
||||
case CTRL:
|
||||
g->display->tilt_y += (float) event.motion.xrel / 2.0f;
|
||||
g->display->up += (float) event.motion.yrel / 2.0f;
|
||||
break;
|
||||
case SHIFT:
|
||||
g->display->zoom -= (float) event.motion.yrel / 2.0f;
|
||||
break;
|
||||
case ALT:
|
||||
g->display->side -= (float) event.motion.xrel / 10.0f;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
keys = SDL_GetKeyState (NULL);
|
||||
if (keys[SDLK_a] == SDL_PRESSED)
|
||||
{
|
||||
g->display->tilt_y += 0.5f;
|
||||
if (g->display->tilt_y >= 360.0f)
|
||||
g->display->tilt_y = 0.5f;
|
||||
}
|
||||
if (keys[SDLK_d] == SDL_PRESSED)
|
||||
g->display->tilt_y += -0.5f;
|
||||
if (keys[SDLK_z] == SDL_PRESSED)
|
||||
if (g->display->zoom <= 40.0)
|
||||
g->display->zoom += 0.25f;
|
||||
if (keys[SDLK_x] == SDL_PRESSED)
|
||||
if (g->display->zoom >= -20.0)
|
||||
g->display->zoom += -0.25f;
|
||||
if (keys[SDLK_w] == SDL_PRESSED)
|
||||
if (g->display->up >= -45.0)
|
||||
g->display->up += -0.25f;
|
||||
if (keys[SDLK_s] == SDL_PRESSED)
|
||||
if (g->display->up <= 45.0)
|
||||
g->display->up += 0.25f;
|
||||
if (keys[SDLK_q] == SDL_PRESSED)
|
||||
if (g->display->side <= 10.0)
|
||||
g->display->side += 0.025;
|
||||
if (keys[SDLK_e] == SDL_PRESSED)
|
||||
if (g->display->side >= -10.0)
|
||||
g->display->side -= 0.025;
|
||||
}
|
||||
/* if (event.type == SDL_KEYDOWN)
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_y:
|
||||
case SDLK_ESCAPE:
|
||||
a = 1;
|
||||
default:
|
||||
jugando = 0;
|
||||
*/
|
||||
2
gameinput.h
Normal file
2
gameinput.h
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
void ingame_input(struct game *);
|
||||
2
images/CVS/Entries
Normal file
2
images/CVS/Entries
Normal file
@@ -0,0 +1,2 @@
|
||||
D/caco////
|
||||
D/classic////
|
||||
1
images/CVS/Repository
Normal file
1
images/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/images
|
||||
1
images/CVS/Root
Normal file
1
images/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
1
images/caco/CVS/Entries
Normal file
1
images/caco/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D
|
||||
1
images/caco/CVS/Repository
Normal file
1
images/caco/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/images/caco
|
||||
1
images/caco/CVS/Root
Normal file
1
images/caco/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
1
images/classic/CVS/Entries
Normal file
1
images/classic/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D
|
||||
1
images/classic/CVS/Repository
Normal file
1
images/classic/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/images/classic
|
||||
1
images/classic/CVS/Root
Normal file
1
images/classic/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
347
main.c
Normal file
347
main.c
Normal file
@@ -0,0 +1,347 @@
|
||||
/***************************************************************************
|
||||
main.c - Buscaminas 3D
|
||||
-------------------
|
||||
begin : dom oct 6 20:22:13 ART 2002
|
||||
copyright : (C) 2002 by Feuerfrei
|
||||
email : feuerfrei@interlap.com.ar
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute 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. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#else
|
||||
#define PACKAGE_VERSION "0.2b"
|
||||
#define PACKAGE_NAME "openmine"
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "structs.h"
|
||||
#include "gamedefs.h"
|
||||
#include "game.h"
|
||||
#include "gameinput.h"
|
||||
#include "video.h"
|
||||
#include "conf.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct game g;
|
||||
struct config c;
|
||||
struct display disp;
|
||||
|
||||
|
||||
g.display = &disp;
|
||||
g.config = &c;
|
||||
progname = argv[0];
|
||||
|
||||
g.status=NEWGAME;
|
||||
|
||||
if (getOptions (&c, argc, argv) < 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
SDL_Init (SDL_INIT_VIDEO);
|
||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_SetVideoMode (SCREEN_W, SCREEN_H, 0, c.flags);
|
||||
SDL_WM_SetCaption ("Openmine", NULL);
|
||||
strcat (c.theme, "/");
|
||||
if (init (&g) < 0)
|
||||
return EXIT_FAILURE;
|
||||
do
|
||||
{
|
||||
if (g.status==NEWGAME)
|
||||
nuevojuego (&g);
|
||||
jugar(&g);
|
||||
}
|
||||
while (g.status!=QUIT);
|
||||
SDL_Quit ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
jugar (struct game *g)
|
||||
{
|
||||
display (g);
|
||||
ingame_input(g);
|
||||
}
|
||||
|
||||
int
|
||||
ProcessClick (struct game *g, int xPos, int yPos, int flag)
|
||||
{
|
||||
int x, y, z, i, done = 0;
|
||||
GLuint *ptr, *cercano, minZ, selectBuff[BUFFER_LENGTH];
|
||||
GLint hits, viewport[4];
|
||||
|
||||
glSelectBuffer (BUFFER_LENGTH, selectBuff);
|
||||
glGetIntegerv (GL_VIEWPORT, viewport);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix ();
|
||||
glRenderMode (GL_SELECT);
|
||||
|
||||
glLoadIdentity ();
|
||||
gluPickMatrix (xPos, yPos, 1, 1, viewport);
|
||||
gluPerspective (45.0f, (float) SCREEN_W / SCREEN_H, 0.1f, 100.0f);
|
||||
|
||||
display (g);
|
||||
hits = glRenderMode (GL_RENDER);
|
||||
|
||||
ptr = selectBuff;
|
||||
minZ = 0xffffffff;
|
||||
for (i = 0; i < hits; i++)
|
||||
{
|
||||
ptr++;
|
||||
if (*ptr < minZ)
|
||||
{
|
||||
minZ = *ptr;
|
||||
cercano = ptr + 2;
|
||||
}
|
||||
ptr += 3;
|
||||
}
|
||||
if (hits != 0)
|
||||
{
|
||||
z = (*cercano) % (g->config->side[2]);
|
||||
*cercano /= (g->config->side[2]);
|
||||
y = (*cercano) % (g->config->side[1]);
|
||||
*cercano /= (g->config->side[1]);
|
||||
x = (*cercano) % (g->config->side[0]);
|
||||
if (!flag)
|
||||
descubrir (g, x, y, z);
|
||||
else if (g->campoV[x][y][z] == NUEVO)
|
||||
g->campoV[x][y][z] = BOMBA;
|
||||
else if (g->campoV[x][y][z] == BOMBA)
|
||||
g->campoV[x][y][z] = MARCA;
|
||||
else if (g->campoV[x][y][z] == MARCA)
|
||||
g->campoV[x][y][z] = NUEVO;
|
||||
}
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPopMatrix ();
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
return done;
|
||||
}
|
||||
|
||||
int
|
||||
init (struct game *g)
|
||||
{
|
||||
int x, y, i;
|
||||
|
||||
g->campo = (char ***) calloc (g->config->side[0], sizeof (char **));
|
||||
for (x = 0; x < g->config->side[0]; x++)
|
||||
{
|
||||
g->campo[x] = (char **) calloc (g->config->side[1], sizeof (char *));
|
||||
for (y = 0; y < g->config->side[1]; y++)
|
||||
g->campo[x][y] = (char *) calloc (g->config->side[2], sizeof (char));
|
||||
}
|
||||
g->campoV = (char ***) calloc (g->config->side[0], sizeof (char **));
|
||||
for (x = 0; x < g->config->side[0]; x++)
|
||||
{
|
||||
g->campoV[x] = (char **) calloc (g->config->side[1], sizeof (char *));
|
||||
for (y = 0; y < g->config->side[1]; y++)
|
||||
g->campoV[x][y] = (char *) calloc (g->config->side[2], sizeof (char));
|
||||
}
|
||||
|
||||
SDL_ShowCursor (SDL_ENABLE);
|
||||
glViewport (0, 0, SCREEN_W, SCREEN_H);
|
||||
glClearColor (1.0f, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
if (LoadGLTextures (g, g->config->theme) < 0)
|
||||
{
|
||||
SDL_Quit ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glClearColor (1.0f, 1.0f, 1.0f, 0.0f);
|
||||
glClearDepth (1.0);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glShadeModel (GL_SMOOTH);
|
||||
glLoadIdentity ();
|
||||
|
||||
glGenLists (THEME_N);
|
||||
for (i = 0; i < THEME_N; i++)
|
||||
{
|
||||
glNewList (i + 1, GL_COMPILE);
|
||||
drawcube (g, i, g->config->cube);
|
||||
glEndList ();
|
||||
}
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
|
||||
gluPerspective (45.0f, (float) SCREEN_W / SCREEN_H, 0.1f, 1000.0f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
display (struct game *g)
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glEnable (GL_CULL_FACE);
|
||||
glInitNames ();
|
||||
glPushName (0);
|
||||
|
||||
glLoadIdentity ();
|
||||
glTranslatef (g->display->side, 0, g->display->zoom - 25.0);
|
||||
glRotatef (g->display->up, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef (g->display->tilt_y, 0.0f, 1.0f, 0.0f);
|
||||
for (x = 1; x < g->config->side[0] - 1; x++)
|
||||
for (y = 1; y < g->config->side[1] - 1; y++)
|
||||
for (z = 1; z < g->config->side[2] - 1; z++)
|
||||
{
|
||||
if (g->campoV[x][y][z] != 0)
|
||||
{
|
||||
glPushMatrix ();
|
||||
glTranslatef (x - (g->config->side[0] - 1) / 2.0f,
|
||||
y - (g->config->side[1] - 1) / 2.0f,
|
||||
z - (g->config->side[2] - 1) / 2.0f);
|
||||
glLoadName (x * g->config->side[1] * g->config->side[2] +
|
||||
y * g->config->side[2] + z);
|
||||
glCallList (g->campoV[x][y][z] !=
|
||||
NUEVO ? g->campoV[x][y][z] + 1 : 1);
|
||||
glPopMatrix ();
|
||||
}
|
||||
}
|
||||
if(g->status==WON)
|
||||
{
|
||||
drawString(-13.0, 9.0, -25.0, 0.01, "You Win!");
|
||||
drawString(-13.0, -10.0, -25.0, 0.01, "Press n to start a new game");
|
||||
}
|
||||
else if(g->status==LOST)
|
||||
{
|
||||
drawString(-13.0, 9.0, -25.0, 0.01, "You Lose!");
|
||||
drawString(-13.0, -10.0, -25.0, 0.01, "Press n to start a new game");
|
||||
}
|
||||
SDL_GL_SwapBuffers ();
|
||||
}
|
||||
|
||||
int
|
||||
LoadGLTextures (struct game *g, const char *tema)
|
||||
{
|
||||
FILE *fp;
|
||||
SDL_Surface *img;
|
||||
char *dir, *s;
|
||||
unsigned i, n;
|
||||
int fail = 0;
|
||||
|
||||
glGenTextures (THEME_N, g->config->texture);
|
||||
|
||||
dir = malloc (strlen (THEME_IMAGE) + strlen (tema) + THEME_LEN + 2 + 1);
|
||||
sprintf (dir, "%s/%s", THEME_IMAGE, tema);
|
||||
s = dir + strlen (dir);
|
||||
strcpy (s, THEME_RC);
|
||||
|
||||
fp = fopen (dir, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: unable to open `%s'\n"
|
||||
"%s: %s \n", progname, dir, progname, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; !fail && i < THEME_N && fgets (s, THEME_LEN, fp); i++)
|
||||
{
|
||||
n = strlen (s);
|
||||
if (n == THEME_LEN - 1 && s[n - 1] != '\0')
|
||||
{ /* TODO: line overflown */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
s[n - 1] = '\0';
|
||||
if (n - 2 == '\r')
|
||||
s[n - 2] = '\0';
|
||||
}
|
||||
|
||||
img = LoadBMP (dir);
|
||||
if (!img)
|
||||
fail = 1;
|
||||
else
|
||||
{
|
||||
glBindTexture (GL_TEXTURE_2D, g->config->texture[i]);
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TEXTURAS);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TEXTURAS);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, 3, img->w, img->h, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, img->pixels);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: free resources when LoadBMP fail */
|
||||
|
||||
free (dir);
|
||||
|
||||
return -fail;
|
||||
}
|
||||
|
||||
SDL_Surface *
|
||||
LoadBMP (const char *filename)
|
||||
{
|
||||
Uint8 *rowhi, *rowlo;
|
||||
Uint8 *tmpbuf, tmpch;
|
||||
SDL_Surface *image;
|
||||
int i, j;
|
||||
|
||||
image = SDL_LoadBMP (filename);
|
||||
if (image == NULL)
|
||||
{
|
||||
fprintf (stderr, "Unable to load %s: %s\n", filename, SDL_GetError ());
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
tmpbuf = (Uint8 *) malloc (image->pitch);
|
||||
if (tmpbuf == NULL)
|
||||
{
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
rowhi = (Uint8 *) image->pixels;
|
||||
rowlo = rowhi + (image->h * image->pitch) - image->pitch;
|
||||
for (i = 0; i < image->h / 2; ++i)
|
||||
{
|
||||
for (j = 0; j < image->w; ++j)
|
||||
{
|
||||
tmpch = rowhi[j * 3];
|
||||
rowhi[j * 3] = rowhi[j * 3 + 2];
|
||||
rowhi[j * 3 + 2] = tmpch;
|
||||
tmpch = rowlo[j * 3];
|
||||
rowlo[j * 3] = rowlo[j * 3 + 2];
|
||||
rowlo[j * 3 + 2] = tmpch;
|
||||
}
|
||||
memcpy (tmpbuf, rowhi, image->pitch);
|
||||
memcpy (rowhi, rowlo, image->pitch);
|
||||
memcpy (rowlo, tmpbuf, image->pitch);
|
||||
rowhi += image->pitch;
|
||||
rowlo -= image->pitch;
|
||||
}
|
||||
free (tmpbuf);
|
||||
return (image);
|
||||
}
|
||||
|
||||
12
main.h
Normal file
12
main.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <SDL/SDL.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
char *progname;
|
||||
|
||||
int init (struct game *g);
|
||||
void display (struct game *g);
|
||||
void resize (int, int);
|
||||
int LoadGLTextures (struct game *g, const char *tema);
|
||||
int ProcessClick (struct game *g, int x, int y, int flag);
|
||||
SDL_Surface *LoadBMP (const char *filename);
|
||||
void jugar(struct game *g);
|
||||
5
mines.conf
Normal file
5
mines.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
theme=caco
|
||||
lado1=6
|
||||
lado2=6
|
||||
lado3=6
|
||||
cantidad=18
|
||||
33
structs.h
Normal file
33
structs.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <SDL/SDL.h>
|
||||
#include <GL/gl.h>
|
||||
#include "gamedefs.h"
|
||||
|
||||
struct config
|
||||
{
|
||||
char theme[256];
|
||||
unsigned side[3];
|
||||
unsigned n;
|
||||
float cube;
|
||||
int flags;
|
||||
GLuint texture[THEME_N];
|
||||
};
|
||||
|
||||
struct game
|
||||
{
|
||||
struct config *config;
|
||||
struct display *display;
|
||||
enum status_t {PLAYING, WON, LOST, QUIT, NEWGAME} status;
|
||||
int descubiertas;
|
||||
int start_time;
|
||||
char ***campo;
|
||||
char ***campoV;
|
||||
};
|
||||
|
||||
struct display
|
||||
{
|
||||
enum mod_status_t { CTRL, SHIFT, ALT, NONE} mod_status;
|
||||
float tilt_y;
|
||||
float zoom;
|
||||
float up;
|
||||
float side;
|
||||
};
|
||||
1
templates/CVS/Entries
Normal file
1
templates/CVS/Entries
Normal file
@@ -0,0 +1 @@
|
||||
D
|
||||
1
templates/CVS/Repository
Normal file
1
templates/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
openmine/templates
|
||||
1
templates/CVS/Root
Normal file
1
templates/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
/Users/stephenschuresko/src/openmine
|
||||
83
video.c
Normal file
83
video.c
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "gamedefs.h"
|
||||
#include "structs.h"
|
||||
#include "video.h"
|
||||
|
||||
void
|
||||
drawString(float x, float y, float z, float scale, char *string)
|
||||
{
|
||||
int i;
|
||||
glLoadIdentity();
|
||||
glTranslatef(x, y, z);
|
||||
glScalef(scale,scale,scale);
|
||||
for(i=0;i<strlen(string);i++)
|
||||
glutStrokeCharacter(GLUT_STROKE_ROMAN,*(string+i));
|
||||
}
|
||||
|
||||
void
|
||||
drawcube (struct game *g, int color, float lado)
|
||||
{
|
||||
glFrontFace (GL_CCW);
|
||||
glBindTexture (GL_TEXTURE_2D, g->config->texture[color]);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (-lado, -lado, lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (lado, lado, lado);
|
||||
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (lado, lado, -lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, -lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (-lado, -lado, -lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, -lado);
|
||||
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (lado, lado, lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, -lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (lado, lado, -lado);
|
||||
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, -lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (-lado, -lado, -lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (-lado, -lado, lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, lado);
|
||||
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (lado, lado, lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (lado, lado, -lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (-lado, lado, -lado);
|
||||
|
||||
glTexCoord2f (0.0f, 1.0f);
|
||||
glVertex3f (-lado, -lado, -lado);
|
||||
glTexCoord2f (0.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, -lado);
|
||||
glTexCoord2f (1.0f, 0.0f);
|
||||
glVertex3f (lado, -lado, lado);
|
||||
glTexCoord2f (1.0f, 1.0f);
|
||||
glVertex3f (-lado, -lado, lado);
|
||||
glEnd ();
|
||||
}
|
||||
Reference in New Issue
Block a user