[Tux4kids-commits] r186 - in tuxtype/trunk: . tuxtype tuxtype/data/fonts tuxtype/data/themes/bokmal tuxtype/data/themes/bokmal/images tuxtype/data/themes/bokmal/words tuxtype/data/themes/brazilian-portuguese tuxtype/data/themes/brazilian-portuguese/images tuxtype/data/themes/brazilian-portuguese/words
dbruce-guest at alioth.debian.org
dbruce-guest at alioth.debian.org
Fri Jun 15 09:55:25 UTC 2007
Author: dbruce-guest
Date: 2007-06-15 09:55:25 +0000 (Fri, 15 Jun 2007)
New Revision: 186
Modified:
tuxtype/trunk/ChangeLog
tuxtype/trunk/Makefile
tuxtype/trunk/README-CROSSBUILD.txt
tuxtype/trunk/config.log
tuxtype/trunk/config.status
tuxtype/trunk/configure
tuxtype/trunk/configure.ac
tuxtype/trunk/tuxtype/alphabet.c
tuxtype/trunk/tuxtype/data/fonts/Makefile
tuxtype/trunk/tuxtype/data/themes/bokmal/Makefile
tuxtype/trunk/tuxtype/data/themes/bokmal/images/Makefile
tuxtype/trunk/tuxtype/data/themes/bokmal/words/Makefile
tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/Makefile
tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/images/Makefile
tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/words/Makefile
tuxtype/trunk/tuxtype/funcs.h
tuxtype/trunk/tuxtype/laser.c
tuxtype/trunk/tuxtype/laser.h
tuxtype/trunk/tuxtype/loaders.c
tuxtype/trunk/tuxtype/playgame.c
tuxtype/trunk/tuxtype/practice.c
tuxtype/trunk/tuxtype/snow.c
Log:
fix for Comet Zap gameplay
Modified: tuxtype/trunk/ChangeLog
===================================================================
--- tuxtype/trunk/ChangeLog 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/ChangeLog 2007-06-15 09:55:25 UTC (rev 186)
@@ -1,3 +1,10 @@
+15 Jun 2007
+[ David Bruce]
+ - Comet Zap fixed to require player to type letters in proper
+ order - "shootable" flag added to comet type.
+ - More code cleanup - mostly adding checks to prevent dereferencing
+ of null or invalid pointers.
+
07 Jun 2007
[ David Bruce]
- Code cleanup - funcs.h revised, unneeded "extern" keywords for
Modified: tuxtype/trunk/Makefile
===================================================================
--- tuxtype/trunk/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -101,7 +101,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/README-CROSSBUILD.txt
===================================================================
--- tuxtype/trunk/README-CROSSBUILD.txt 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/README-CROSSBUILD.txt 2007-06-15 09:55:25 UTC (rev 186)
@@ -31,13 +31,17 @@
1. Install mingw32 (apt-get install mingw32) and makensis (apt-get install nsis)
+ NOTE: the versions of the mingw32 packages in Etch work fine, but the newer
+ ones currently in Sid (specifically mingw32-binutils 2.17.50) fail, at least
+ on my amd-64 host.
+
2. Create directory structure:
- mkdir /usr/local/cross-tools
- mkdir /usr/local/cross-tools/i586-mingw32msvc
- mkdir /usr/local/cross-tools/i586-mingw32msvc/lib
- mkdir /usr/local/cross-tools/i586-mingw32msvc/include
- 3. Install precompiled win32 dev files (lib and includes) for SDL, SDL-image
+ 3. Install precompiled win32�dev files (lib and includes) for SDL, SDL-image
and SDL-mixer in the lib and include directories you just created.
You can get all of these from www.libsdl.org. I had some trouble with
this step as the SDL libs have varieties intended for both mingw32 and MSVC -
@@ -60,18 +64,16 @@
5. You need to have a directory containing all of the dlls that will need to be
packaged into the installer. The Makefile expects them to be in NSI_DLL_DIR,
- which is set to ~/tuxtype_dll. The directory also needs to contain the
- Gentium font file. On my machine, I have:
+ which is set to ~/tuxtype_dll. On my machine, I have:
dbruce at debian:~/tuxtype_dll$ ls
- GenAI102.ttf SDL.dll jpeg.dll smpeg.dll
- GenAR102.ttf SDL_image.dll libpng12.dll vorbis.dll
- GenI102.ttf SDL_mixer.dll libtiff.dll vorbisfile.dll
- GenR102.ttf SDL_ttf.dll ogg.dll zlib1.dll
+ jpeg.dll ogg.dll SDL_mixer.dll vorbis.dll
+ libpng12.dll SDL.dll SDL_ttf.dll vorbisfile.dll
+ libtiff.dll SDL_image.dll smpeg.dll zlib1.dll
- (Note - this has mostly the same files as the cross-tools lib directory - it is most
- likely possible to eliminate this redundancy in some way.).
+ (Note - this has mostly the same files as the cross-tools lib directory - it is most
+ likely possible to eliminate this redundancy in some way.).
6. If you have done a native (Linux) build in the same source tree, run "make clean"
and "make distclean" to get rid of the autogenerated files.
@@ -82,6 +84,6 @@
./cross-make.sh
./cross-make.sh nsis
- You should now have the installer (something like "tuxtype-1.5.6-win32-installer.exe")
+ You should now have the installer (something like "tuxtype-1.5.9-win32-installer.exe")
in the trunk directory. Execute the installer on the target Windows machine to install
the program.
\ No newline at end of file
Modified: tuxtype/trunk/config.log
===================================================================
--- tuxtype/trunk/config.log 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/config.log 2007-06-15 09:55:25 UTC (rev 186)
@@ -125,16 +125,16 @@
configure:3681: result: /usr/bin/sdl-config
configure:3690: checking for SDL - version >= 1.2.5
configure:3817: result: yes
-configure:3913: checking for IMG_Load in -lSDL_image
-configure:3948: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_image >&5
+configure:3913: checking for Mix_PlayMusic in -lSDL_mixer
+configure:3948: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_mixer >&5
configure:3954: $? = 0
configure:3972: result: yes
-configure:3988: checking for Mix_PlayMusic in -lSDL_mixer
-configure:4023: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_mixer -lSDL_image >&5
+configure:3988: checking for TTF_Init in -lSDL_ttf
+configure:4023: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_ttf -lSDL_mixer >&5
configure:4029: $? = 0
configure:4047: result: yes
-configure:4063: checking for TTF_Init in -lSDL_ttf
-configure:4098: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_ttf -lSDL_mixer -lSDL_image >&5
+configure:4063: checking for IMG_Load in -lSDL_image
+configure:4098: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/local/cross-tools/i586-mingw32msvc/include -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lSDL_image -lSDL_ttf -lSDL_mixer >&5
configure:4104: $? = 0
configure:4122: result: yes
configure:4146: checking for native Win32
@@ -157,9 +157,9 @@
| #define PACKAGE_BUGREPORT "tuxmath-devel at lists.sourceforge.net"
| #define PACKAGE "tuxtype"
| #define VERSION "1.5.9"
-| #define HAVE_LIBSDL_IMAGE 1
| #define HAVE_LIBSDL_MIXER 1
| #define HAVE_LIBSDL_TTF 1
+| #define HAVE_LIBSDL_IMAGE 1
| #define BUILD_MINGW32 1
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
@@ -178,9 +178,9 @@
| #define PACKAGE_BUGREPORT "tuxmath-devel at lists.sourceforge.net"
| #define PACKAGE "tuxtype"
| #define VERSION "1.5.9"
-| #define HAVE_LIBSDL_IMAGE 1
| #define HAVE_LIBSDL_MIXER 1
| #define HAVE_LIBSDL_TTF 1
+| #define HAVE_LIBSDL_IMAGE 1
| #define BUILD_MINGW32 1
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
@@ -241,26 +241,26 @@
configure:5145: $? = 0
configure:5163: result: inline
configure:5192: checking for atexit
-configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
+configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
configure:5254: $? = 0
configure:5272: result: yes
configure:5192: checking for memset
-configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
+configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
conftest.c:50: warning: conflicting types for built-in function 'memset'
configure:5254: $? = 0
configure:5272: result: yes
configure:5192: checking for strchr
-configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
+configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
conftest.c:51: warning: conflicting types for built-in function 'strchr'
configure:5254: $? = 0
configure:5272: result: yes
configure:5192: checking for strstr
-configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
+configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
conftest.c:52: warning: conflicting types for built-in function 'strstr'
configure:5254: $? = 0
configure:5272: result: yes
configure:5192: checking for malloc
-configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
+configure:5248: i586-mingw32msvc-gcc -o conftest.exe -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D__GW32__ -I/usr/local/cross-tools/i586-mingw32msvc/include -idirafter /usr/local/cross-tools/i586-mingw32msvc/include/glibc -L/usr/local/cross-tools/i586-mingw32msvc/lib conftest.c -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows >&5
conftest.c:53: warning: conflicting types for built-in function 'malloc'
configure:5254: $? = 0
configure:5272: result: yes
@@ -458,7 +458,7 @@
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS='-L/usr/local/cross-tools/i586-mingw32msvc/lib'
LIBOBJS=''
-LIBS='-lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows'
+LIBS='-lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows'
LN_S='ln -s'
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo'
@@ -543,9 +543,9 @@
#define PACKAGE_BUGREPORT "tuxmath-devel at lists.sourceforge.net"
#define PACKAGE "tuxtype"
#define VERSION "1.5.9"
-#define HAVE_LIBSDL_IMAGE 1
#define HAVE_LIBSDL_MIXER 1
#define HAVE_LIBSDL_TTF 1
+#define HAVE_LIBSDL_IMAGE 1
#define BUILD_MINGW32 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
Modified: tuxtype/trunk/config.status
===================================================================
--- tuxtype/trunk/config.status 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/config.status 2007-06-15 09:55:25 UTC (rev 186)
@@ -598,7 +598,7 @@
s, at ECHO_C@,|#_!!_#|,g
s, at ECHO_N@,|#_!!_#|-n,g
s, at ECHO_T@,|#_!!_#|,g
-s, at LIBS@,|#_!!_#|-lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows,g
+s, at LIBS@,|#_!!_#|-lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows,g
s, at build_alias@,|#_!!_#|i386-linux,g
s, at host_alias@,|#_!!_#|i586-mingw32msvc,g
s, at target_alias@,|#_!!_#|i586-mingw32msvc,g
@@ -936,9 +936,9 @@
s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_BUGREPORT\)[ (].*,\1define\2 "tuxmath-devel at lists.sourceforge.net" ,
s,^\([ #]*\)[^ ]*\([ ]*PACKAGE\)[ (].*,\1define\2 "tuxtype" ,
s,^\([ #]*\)[^ ]*\([ ]*VERSION\)[ (].*,\1define\2 "1.5.9" ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIBSDL_IMAGE\)[ (].*,\1define\2 1 ,
s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIBSDL_MIXER\)[ (].*,\1define\2 1 ,
s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIBSDL_TTF\)[ (].*,\1define\2 1 ,
+s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIBSDL_IMAGE\)[ (].*,\1define\2 1 ,
s,^\([ #]*\)[^ ]*\([ ]*BUILD_MINGW32\)[ (].*,\1define\2 1 ,
s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 ,
s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 ,
Modified: tuxtype/trunk/configure
===================================================================
--- tuxtype/trunk/configure 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/configure 2007-06-15 09:55:25 UTC (rev 186)
@@ -3910,13 +3910,13 @@
-{ echo "$as_me:$LINENO: checking for IMG_Load in -lSDL_image" >&5
-echo $ECHO_N "checking for IMG_Load in -lSDL_image... $ECHO_C" >&6; }
-if test "${ac_cv_lib_SDL_image_IMG_Load+set}" = set; then
+{ echo "$as_me:$LINENO: checking for Mix_PlayMusic in -lSDL_mixer" >&5
+echo $ECHO_N "checking for Mix_PlayMusic in -lSDL_mixer... $ECHO_C" >&6; }
+if test "${ac_cv_lib_SDL_mixer_Mix_PlayMusic+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSDL_image $LIBS"
+LIBS="-lSDL_mixer $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -3930,11 +3930,11 @@
#ifdef __cplusplus
extern "C"
#endif
-char IMG_Load ();
+char Mix_PlayMusic ();
int
main ()
{
-return IMG_Load ();
+return Mix_PlayMusic ();
;
return 0;
}
@@ -3957,41 +3957,41 @@
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_SDL_image_IMG_Load=yes
+ ac_cv_lib_SDL_mixer_Mix_PlayMusic=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_SDL_image_IMG_Load=no
+ ac_cv_lib_SDL_mixer_Mix_PlayMusic=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_image_IMG_Load" >&5
-echo "${ECHO_T}$ac_cv_lib_SDL_image_IMG_Load" >&6; }
-if test $ac_cv_lib_SDL_image_IMG_Load = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_mixer_Mix_PlayMusic" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_mixer_Mix_PlayMusic" >&6; }
+if test $ac_cv_lib_SDL_mixer_Mix_PlayMusic = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSDL_IMAGE 1
+#define HAVE_LIBSDL_MIXER 1
_ACEOF
- LIBS="-lSDL_image $LIBS"
+ LIBS="-lSDL_mixer $LIBS"
else
- { { echo "$as_me:$LINENO: error: SDL_image not found http://www.libsdl.org/projects/SDL_image" >&5
-echo "$as_me: error: SDL_image not found http://www.libsdl.org/projects/SDL_image" >&2;}
+ { { echo "$as_me:$LINENO: error: SDL_mixer not found http://www.libsdl.org/projects/SDL_mixer" >&5
+echo "$as_me: error: SDL_mixer not found http://www.libsdl.org/projects/SDL_mixer" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: checking for Mix_PlayMusic in -lSDL_mixer" >&5
-echo $ECHO_N "checking for Mix_PlayMusic in -lSDL_mixer... $ECHO_C" >&6; }
-if test "${ac_cv_lib_SDL_mixer_Mix_PlayMusic+set}" = set; then
+{ echo "$as_me:$LINENO: checking for TTF_Init in -lSDL_ttf" >&5
+echo $ECHO_N "checking for TTF_Init in -lSDL_ttf... $ECHO_C" >&6; }
+if test "${ac_cv_lib_SDL_ttf_TTF_Init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSDL_mixer $LIBS"
+LIBS="-lSDL_ttf $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4005,11 +4005,11 @@
#ifdef __cplusplus
extern "C"
#endif
-char Mix_PlayMusic ();
+char TTF_Init ();
int
main ()
{
-return Mix_PlayMusic ();
+return TTF_Init ();
;
return 0;
}
@@ -4032,41 +4032,41 @@
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_SDL_mixer_Mix_PlayMusic=yes
+ ac_cv_lib_SDL_ttf_TTF_Init=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_SDL_mixer_Mix_PlayMusic=no
+ ac_cv_lib_SDL_ttf_TTF_Init=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_mixer_Mix_PlayMusic" >&5
-echo "${ECHO_T}$ac_cv_lib_SDL_mixer_Mix_PlayMusic" >&6; }
-if test $ac_cv_lib_SDL_mixer_Mix_PlayMusic = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_ttf_TTF_Init" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_ttf_TTF_Init" >&6; }
+if test $ac_cv_lib_SDL_ttf_TTF_Init = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSDL_MIXER 1
+#define HAVE_LIBSDL_TTF 1
_ACEOF
- LIBS="-lSDL_mixer $LIBS"
+ LIBS="-lSDL_ttf $LIBS"
else
- { { echo "$as_me:$LINENO: error: SDL_mixer not found http://www.libsdl.org/projects/SDL_mixer" >&5
-echo "$as_me: error: SDL_mixer not found http://www.libsdl.org/projects/SDL_mixer" >&2;}
+ { { echo "$as_me:$LINENO: error: SDL_ttf not found http://www.libsdl.org/projects/SDL_ttf" >&5
+echo "$as_me: error: SDL_ttf not found http://www.libsdl.org/projects/SDL_ttf" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: checking for TTF_Init in -lSDL_ttf" >&5
-echo $ECHO_N "checking for TTF_Init in -lSDL_ttf... $ECHO_C" >&6; }
-if test "${ac_cv_lib_SDL_ttf_TTF_Init+set}" = set; then
+{ echo "$as_me:$LINENO: checking for IMG_Load in -lSDL_image" >&5
+echo $ECHO_N "checking for IMG_Load in -lSDL_image... $ECHO_C" >&6; }
+if test "${ac_cv_lib_SDL_image_IMG_Load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSDL_ttf $LIBS"
+LIBS="-lSDL_image $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4080,11 +4080,11 @@
#ifdef __cplusplus
extern "C"
#endif
-char TTF_Init ();
+char IMG_Load ();
int
main ()
{
-return TTF_Init ();
+return IMG_Load ();
;
return 0;
}
@@ -4107,30 +4107,30 @@
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_SDL_ttf_TTF_Init=yes
+ ac_cv_lib_SDL_image_IMG_Load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_SDL_ttf_TTF_Init=no
+ ac_cv_lib_SDL_image_IMG_Load=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_ttf_TTF_Init" >&5
-echo "${ECHO_T}$ac_cv_lib_SDL_ttf_TTF_Init" >&6; }
-if test $ac_cv_lib_SDL_ttf_TTF_Init = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_image_IMG_Load" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_image_IMG_Load" >&6; }
+if test $ac_cv_lib_SDL_image_IMG_Load = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSDL_TTF 1
+#define HAVE_LIBSDL_IMAGE 1
_ACEOF
- LIBS="-lSDL_ttf $LIBS"
+ LIBS="-lSDL_image $LIBS"
else
- { { echo "$as_me:$LINENO: error: SDL_ttf not found http://www.libsdl.org/projects/SDL_ttf" >&5
-echo "$as_me: error: SDL_ttf not found http://www.libsdl.org/projects/SDL_ttf" >&2;}
+ { { echo "$as_me:$LINENO: error: SDL_image not found http://www.libsdl.org/projects/SDL_image" >&5
+echo "$as_me: error: SDL_image not found http://www.libsdl.org/projects/SDL_image" >&2;}
{ (exit 1); exit 1; }; }
fi
Modified: tuxtype/trunk/configure.ac
===================================================================
--- tuxtype/trunk/configure.ac 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/configure.ac 2007-06-15 09:55:25 UTC (rev 186)
@@ -33,9 +33,9 @@
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
-AC_CHECK_LIB([SDL_image], [IMG_Load], ,[AC_MSG_ERROR(SDL_image not found http://www.libsdl.org/projects/SDL_image, )])
AC_CHECK_LIB([SDL_mixer], [Mix_PlayMusic], ,[AC_MSG_ERROR(SDL_mixer not found http://www.libsdl.org/projects/SDL_mixer, )])
AC_CHECK_LIB([SDL_ttf], [TTF_Init], ,[AC_MSG_ERROR(SDL_ttf not found http://www.libsdl.org/projects/SDL_ttf, )])
+AC_CHECK_LIB([SDL_image], [IMG_Load], ,[AC_MSG_ERROR(SDL_image not found http://www.libsdl.org/projects/SDL_image, )])
#
SDL_CFLAGS=`sdl-config --cflags`
Modified: tuxtype/trunk/tuxtype/alphabet.c
===================================================================
--- tuxtype/trunk/tuxtype/alphabet.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/alphabet.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -29,7 +29,7 @@
SDL_Color yellow;
/* Used for word list functions (see below): */
-static int WORD_qty;
+static int num_words;
wchar_t word_list[MAX_NUM_WORDS][MAX_WORD_SIZE + 1];
wchar_t char_list[MAX_UNICODES]; // List of distinct letters in list
static int num_chars_used = 0; // Number of different letters in word list
@@ -318,11 +318,11 @@
void ClearWordList(void)
{
int i;
- for (i = 0; i < WORD_qty; i++)
+ for (i = 0; i < num_words; i++)
{
word_list[i][0] = '\0';
}
- WORD_qty = 0;
+ num_words = 0;
}
/* UseAlphabet(): setups the word_list so that it really
@@ -334,25 +334,25 @@
LOG("Entering UseAlphabet()\n");
- WORD_qty = 0;
+ num_words = 0;
/* This totally mucks up i18n abilities :( */
for (i=65; i<90; i++)
{
if (ALPHABET[i]) {
- word_list[WORD_qty][0] = (unsigned char)i;
- word_list[WORD_qty][1] = '\0';
- WORD_qty++;
+ word_list[num_words][0] = (unsigned char)i;
+ word_list[num_words][1] = '\0';
+ num_words++;
DEBUGCODE { fprintf(stderr, "Adding %c\n", (unsigned char)i); }
}
}
/* Make sure list is terminated with null character */
- word_list[WORD_qty][0] = '\0';
+ word_list[num_words][0] = '\0';
/* Make list of all unicode characters used in word list: */
gen_char_list();
- DOUT(WORD_qty);
+ DOUT(num_words);
LOG("Leaving UseAlphabet()\n");
}
@@ -365,39 +365,39 @@
int choice;
LOG("Entering GetWord()\n");
- DEBUGCODE { fprintf(stderr, "WORD_qty is: %d\n", WORD_qty); }
+ DEBUGCODE { fprintf(stderr, "num_words is: %d\n", num_words); }
- /* Now count list to make sure WORD_qty is correct: */
+ /* Now count list to make sure num_words is correct: */
- WORD_qty = 0;
- while (word_list[WORD_qty][0] != '\0')
+ num_words = 0;
+ while (word_list[num_words][0] != '\0')
{
- WORD_qty++;
+ num_words++;
}
- DEBUGCODE { fprintf(stderr, "After count, WORD_qty is: %d\n", WORD_qty); }
+ DEBUGCODE { fprintf(stderr, "After count, num_words is: %d\n", num_words); }
- if (0 == WORD_qty)
+ if (0 == num_words)
{
LOG("No words in list\n");
return NULL;
}
- if (WORD_qty > MAX_NUM_WORDS)
+ if (num_words > MAX_NUM_WORDS)
{
- LOG("Error: WORD_qty greater than array size\n");
+ LOG("Error: num_words greater than array size\n");
return NULL;
}
- if (WORD_qty < 0)
+ if (num_words < 0)
{
- LOG("Error: WORD_qty negative\n");
+ LOG("Error: num_words negative\n");
return NULL;
}
do {
- choice = (rand() % WORD_qty);
- } while ((choice == last_choice) || (WORD_qty < 2));
+ choice = (rand() % num_words);
+ } while ((choice == last_choice) || (num_words < 2));
last_choice = choice;
@@ -418,13 +418,14 @@
{
int j;
unsigned char temp_word[FNLEN];
+ wchar_t temp_wide_word[FNLEN];
size_t length;
FILE* wordFile=NULL;
DEBUGCODE { fprintf(stderr, "Entering GenerateWordList() for file: %s\n", wordFn); }
- WORD_qty = 0;
+ num_words = 0;
/* --- open the file --- */
@@ -446,7 +447,7 @@
/* ignore the title (i.e. first line) */
fscanf( wordFile, "%[^\n]\n", temp_word);
- while (!feof(wordFile) && (WORD_qty < MAX_NUM_WORDS))
+ while (!feof(wordFile) && (num_words < MAX_NUM_WORDS))
{
fscanf( wordFile, "%[^\n]\n", temp_word);
@@ -456,39 +457,57 @@
temp_word[j] = '\0';
}
- /* Make sure word is usable: */
- /* NOTE we need to use mbstowcs() rather than just strlen() */
- /* now that we use UTF-8 to get correct length - DSB */
- length = mbstowcs(NULL, temp_word, 0);
+ /* Convert from UTF-8 to wcs and make sure word is usable: */
+ /* NOTE need to add one to length arg so terminating '\0' gets added: */
+ length = mbstowcs(temp_wide_word, temp_word, strlen(temp_word) + 1);
DOUT(length);
- if (length == -1) /* Means invalid UTF-8 sequence */
+ if (length == -1) /* Means invalid UTF-8 sequence or conversion failed */
{
fprintf(stderr, "Word '%s' not added - invalid UTF-8 sequence!\n", temp_word);
continue;
}
- if (length == 0)
+ if (length == 0)
+ {
+ fprintf(stderr, "Word '%s' not added - length is zero\n", temp_word);
continue;
+ }
+
if (length > MAX_WORD_SIZE)
+ {
+ fprintf(stderr, "Word '%s' not added - exceeds %d characters\n",
+ temp_word, MAX_WORD_SIZE);
continue;
- if (WORD_qty >= MAX_NUM_WORDS)
+ }
+;
+ if (num_words >= MAX_NUM_WORDS)
+ {
+ fprintf(stderr, "Word '%s' not added - list has reached max of %d characters\n",
+ temp_word, MAX_NUM_WORDS);
continue;
+ }
/* If we make it to here, OK to add word: */
- /* NOTE we have to add one to the length argument to get */
- /* mbstowcs() to reliably include the terminating null. */
- mbstowcs(word_list[WORD_qty], temp_word, strlen(temp_word) + 1);
- WORD_qty++;
+ /* NOTE we have to add one to the length argument */
+ /* to include the terminating null. */
+ //mbstowcs(word_list[num_words], temp_word, strlen(temp_word) + 1);
+ DEBUGCODE
+ {
+ fprintf(stderr, "Adding word: %ls\n", temp_wide_word);
+ }
+
+ wcsncpy(word_list[num_words], temp_wide_word, strlen(temp_word) + 1);
+ num_words++;
}
/* Make sure list is terminated with null character */
- word_list[WORD_qty][0] = '\0';
+ word_list[num_words][0] = '\0';
- DOUT(WORD_qty);
+ DOUT(num_words);
- if (WORD_qty == 0)
+ if (num_words == 0)
UseAlphabet( );
fclose(wordFile);
Modified: tuxtype/trunk/tuxtype/data/fonts/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/fonts/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/fonts/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -72,7 +72,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
@@ -149,7 +149,7 @@
target_vendor = pc
top_builddir = ../../..
top_srcdir = ../../..
-EXTRA_DIST = AndikaDesRevA.ttf
+EXTRA_DIST = AndikaDesRevG.ttf
all: all-am
.SUFFIXES:
@@ -313,10 +313,10 @@
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/fonts
- $(INSTALL_DATA) $(srcdir)/AndikaDesRevA.ttf $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/fonts
+ $(INSTALL_DATA) $(srcdir)/AndikaDesRevG.ttf $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/fonts
uninstall-local:
- rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/fonts/AndikaDesRevA.ttf
+ rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/fonts/AndikaDesRevG.ttf
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
Modified: tuxtype/trunk/tuxtype/data/themes/bokmal/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/bokmal/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/bokmal/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -84,7 +84,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/data/themes/bokmal/images/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/bokmal/images/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/bokmal/images/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -84,7 +84,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/data/themes/bokmal/words/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/bokmal/words/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/bokmal/words/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -72,7 +72,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -84,7 +84,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/images/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/images/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/images/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -72,7 +72,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/words/Makefile
===================================================================
--- tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/words/Makefile 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/data/themes/brazilian-portuguese/words/Makefile 2007-06-15 09:55:25 UTC (rev 186)
@@ -72,7 +72,7 @@
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS = -L/usr/local/cross-tools/i586-mingw32msvc/lib
LIBOBJS =
-LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_ttf -lSDL_mixer -lSDL_image -lgw32c -luuid -lole32 -lwsock32 -mwindows
+LIBS = -lmingw32 -lSDLmain -L/usr/lib -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lgw32c -luuid -lole32 -lwsock32 -mwindows
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/dbruce/tux4kids/tuxtype/trunk/missing --run makeinfo
Modified: tuxtype/trunk/tuxtype/funcs.h
===================================================================
--- tuxtype/trunk/tuxtype/funcs.h 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/funcs.h 2007-06-15 09:55:25 UTC (rev 186)
@@ -74,11 +74,10 @@
/* In playgame.c: */
int PlayCascade(int level);
void InitEngine(void);
-void TransWipe(SDL_Surface* newbkg, int type, int var1, int var2);
+int TransWipe(SDL_Surface* newbkg, int type, int var1, int var2);
/* In practice.c: */
-int Practice( void );
int Phrases(char* practice_phrase);
Modified: tuxtype/trunk/tuxtype/laser.c
===================================================================
--- tuxtype/trunk/tuxtype/laser.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/laser.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -226,14 +226,18 @@
for (;ans_num>0;ans_num--) {
- /* Pick the lowest comet which has the right answer: */
+ /* Pick the lowest shootable comet which has the right answer: */
lowest_y = 0;
lowest = -1;
for (i = 0; i < MAX_COMETS; i++)
- if (comets[i].alive && comets[i].expl == 0 &&
- KEYMAP[comets[i].ch] == ans[ans_num-1] && comets[i].y > lowest_y) {
+ if (comets[i].alive
+ && comets[i].shootable
+ && comets[i].expl == 0
+ && KEYMAP[comets[i].ch] == ans[ans_num -1 ]
+ && comets[i].y > lowest_y)
+ {
lowest = i;
lowest_y = comets[i].y;
}
@@ -246,9 +250,12 @@
/* Destroy comet: */
comets[lowest].expl = COMET_EXPL_START;
-
+ /* Make next letter in word shootable: */
+ comets[lowest].shootable = 0;
+ if (comets[lowest].next)
+ comets[lowest].next->shootable = 1;
+
/* Fire laser: */
-
laser.alive = LASER_START;
/* this is a hack so drawing to the center of the screen works */
@@ -814,6 +821,10 @@
/* Pick a letter */
comets[location].ch = GetLetter();
+ /* single letters always shootable: */
+ comets[location].shootable = 1;
+ comets[location].next = NULL;
+
add--;
}
DEBUGCODE {if (location == MAX_COMETS)
@@ -824,7 +835,8 @@
{
LOG("NUM_CITIES is odd\n");
wchar_t* word = GetWord();
- int i=0;
+ int i = 0;
+ comet_type* prev_comet = NULL;
DEBUGCODE {fprintf(stderr, "word is: %s\n", word);}
do
@@ -840,11 +852,25 @@
if (location < MAX_COMETS)
{
+ /* First comet in word is shootable: */
+ if (0 == i)
+ comets[location].shootable = 1;
+ else
+ comets[location].shootable = 0;
+
comets[location].alive = 1;
comets[location].city = target + i;
comets[location].x = cities[target + i].x;
comets[location].y = 0;
comets[location].ch = word[i];
+ comets[location].next = NULL;
+
+ /* Take care of link from previous letter's comet: */
+ if (prev_comet)
+ prev_comet->next = &comets[location];
+ /* Save pointer for next time through: */
+ prev_comet = &comets[location];
+
DEBUGCODE {fprintf(stderr, "Assigning letter to comet: %c\n", word[i]);}
}
}
Modified: tuxtype/trunk/tuxtype/laser.h
===================================================================
--- tuxtype/trunk/tuxtype/laser.h 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/laser.h 2007-06-15 09:55:25 UTC (rev 186)
@@ -13,6 +13,8 @@
int expl;
int city;
int x, y;
+ int shootable;
+ struct comet_type* next;
wchar_t ch;
} comet_type;
Modified: tuxtype/trunk/tuxtype/loaders.c
===================================================================
--- tuxtype/trunk/tuxtype/loaders.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/loaders.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -240,7 +240,7 @@
/***********************
LoadImage : Load an image and set transparent if requested
************************/
-SDL_Surface* LoadImage(const char* datafile, int mode )
+SDL_Surface* LoadImage(const char* datafile, int mode)
{
int i;
int oldDebug; //so we can turn off debug output for this func only
@@ -275,8 +275,11 @@
}
if (tmp_pic == NULL) {
- if (mode & IMG_NOT_REQUIRED)
+ if (mode & IMG_NOT_REQUIRED)
+ {
+ debugOn = oldDebug;
return NULL;
+ }
fprintf(stderr, "ERROR could not load required graphics file %s\n", datafile);
exit(1);
Modified: tuxtype/trunk/tuxtype/playgame.c
===================================================================
--- tuxtype/trunk/tuxtype/playgame.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/playgame.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -29,18 +29,18 @@
int o_lives; // something cal is working on
int sound_vol;
-SDL_Surface *background;
+SDL_Surface* background;
-SDL_Surface *level[NUM_LEVELS];
-SDL_Surface *number[NUM_NUMS];
-SDL_Surface *curlev;
-SDL_Surface *lives;
-SDL_Surface *fish;
-SDL_Surface *congrats[CONGRATS_FRAMES];
-SDL_Surface *ohno[OH_NO_FRAMES];
+SDL_Surface* level[NUM_LEVELS];
+SDL_Surface* number[NUM_NUMS];
+SDL_Surface* curlev;
+SDL_Surface* lives;
+SDL_Surface* fish;
+SDL_Surface* congrats[CONGRATS_FRAMES];
+SDL_Surface* ohno[OH_NO_FRAMES];
-sprite *fishy;
-sprite *splat;
+sprite* fishy;
+sprite* splat;
/* --- Data Structure for Dirty Blitting --- */
SDL_Rect srcupdate[MAX_UPDATES];
@@ -48,31 +48,31 @@
int numupdates = 0; // tracks how many blits to be done
struct blit {
- SDL_Surface *src;
- SDL_Rect *srcrect;
- SDL_Rect *dstrect;
+ SDL_Surface* src;
+ SDL_Rect* srcrect;
+ SDL_Rect* dstrect;
unsigned char type;
} blits[MAX_UPDATES];
/* Local function prototypes: */
-static void AddRect(SDL_Rect * src, SDL_Rect * dst);
-static void AddSplat(int *splats, struct fishypoo *f, int *curlives, int *frame);
-static void CheckCollision(int fishies, int *fish_left, int frame );
-static void CheckFishies(int *fishies, int *splats);
+static int AddRect(SDL_Rect* src, SDL_Rect* dst);
+static void AddSplat(int* splats, struct fishypoo* f, int* curlives, int* frame);
+static void CheckCollision(int fishies, int* fish_left, int frame );
+static void CheckFishies(int* fishies, int* splats);
static int check_word(int f);
-static void display_msg(const unsigned char *msg, int x, int y);
+static void display_msg(const unsigned char* msg, int x, int y);
static void DrawBackground(void);
static void draw_bar(int curlevel, int diflevel, int curlives,
int oldlives, int fish_left, int oldfish_left);
static void DrawFish(int which);
static void DrawNumbers(int num, int x, int y, int places);
-static void DrawObject(SDL_Surface* sprite, int x, int y);
-static void DrawSprite(sprite *gfx, int x, int y);
+static int DrawObject(SDL_Surface* sprite, int x, int y);
+static int DrawSprite(sprite* gfx, int x, int y);
static void EraseNumbers(int num, int x, int y, int places);
-static void EraseObject(SDL_Surface* sprite, int x, int y);
-static void EraseSprite(sprite *img, int x, int y);
+static int EraseObject(SDL_Surface* sprite, int x, int y);
+static int EraseSprite(sprite* img, int x, int y);
static float float_restrict(float a, float x, float b);
static void FreeGame(void);
static int int_restrict(int a, int x, int b);
@@ -461,7 +461,7 @@
* that wipe requires, will perform a wipe from
* the current screen image to a new one.
*/
-void TransWipe(SDL_Surface * newbkg, int type, int var1, int var2)
+int TransWipe(SDL_Surface* newbkg, int type, int var1, int var2)
{
int i, j, x1, x2, y1, y2;
int step1, step2, step3, step4;
@@ -471,6 +471,12 @@
LOG("->TransWipe(): START\n");
+ if (!newbkg)
+ {
+ fprintf(stderr, "TransWipe() - 'newbkg' arg invalid!\n");
+ return 0;
+ }
+
numupdates = 0;
frame = 0;
@@ -610,6 +616,7 @@
break;
}
}
+ return 1;
}
@@ -686,49 +693,79 @@
LOG( "OBJECTS RESET\n" );
}
-static void DrawSprite(sprite *gfx, int x, int y) {
- if (!gfx) return;
+static int DrawSprite(sprite* gfx, int x, int y)
+{
+ struct blit* update;
- struct blit *update;
- update = &blits[numupdates++];
- update->src = gfx->frame[gfx->cur];
- update->srcrect->x = 0;
- update->srcrect->y = 0;
- update->srcrect->w = gfx->frame[gfx->cur]->w;
- update->srcrect->h = gfx->frame[gfx->cur]->h;
- update->dstrect->x = x;
- update->dstrect->y = y;
- update->dstrect->w = gfx->frame[gfx->cur]->w;
- update->dstrect->h = gfx->frame[gfx->cur]->h;
- update->type = 'D';
+ if (!gfx)
+ {
+ fprintf(stderr, "DrawSprite() - 'gfx' arg invalid!\n");
+ return 0;
+ }
+
+ update = &blits[numupdates++];
+
+ if(!update || !update->srcrect || !update->dstrect)
+ {
+ fprintf(stderr, "DrawSprite() - 'update' ptr invalid!\n");
+ return 0;
+ }
+
+ update->src = gfx->frame[gfx->cur];
+ update->srcrect->x = 0;
+ update->srcrect->y = 0;
+ update->srcrect->w = gfx->frame[gfx->cur]->w;
+ update->srcrect->h = gfx->frame[gfx->cur]->h;
+ update->dstrect->x = x;
+ update->dstrect->y = y;
+ update->dstrect->w = gfx->frame[gfx->cur]->w;
+ update->dstrect->h = gfx->frame[gfx->cur]->h;
+ update->type = 'D';
+
+ return 1;
}
/**********************
DrawObject : Draw an object at the specified
location. No respect to clipping!
*************************/
-static void DrawObject(SDL_Surface* sprite, int x, int y)
+static int DrawObject(SDL_Surface* surf, int x, int y)
{
- if (!sprite) return;
+ struct blit *update;
- struct blit *update;
- update = &blits[numupdates++];
- update->src = sprite;
- update->srcrect->x = 0;
- update->srcrect->y = 0;
- update->srcrect->w = sprite->w;
- update->srcrect->h = sprite->h;
- update->dstrect->x = x;
- update->dstrect->y = y;
- update->dstrect->w = sprite->w;
- update->dstrect->h = sprite->h;
- update->type = 'D';
+ if (!surf)
+ {
+ fprintf(stderr, "DrawObject() - invalid 'surf' arg!\n");
+ return 0;
+ }
+
+ update = &blits[numupdates++];
+
+ if(!update || !update->srcrect || !update->dstrect)
+ {
+ fprintf(stderr, "DrawObject() - 'update' ptr invalid!\n");
+ return 0;
+ }
+
+ update->src = surf;
+ update->srcrect->x = 0;
+ update->srcrect->y = 0;
+ update->srcrect->w = surf->w;
+ update->srcrect->h = surf->h;
+ update->dstrect->x = x;
+ update->dstrect->y = y;
+ update->dstrect->w = surf->w;
+ update->dstrect->h = surf->h;
+ update->type = 'D';
+
+ return 1;
}
/************************
UpdateScreen : Update the screen and increment the frame num
***************************/
-static void UpdateScreen(int *frame) {
+static void UpdateScreen(int* frame)
+{
int i;
/* -- First erase everything we need to -- */
@@ -753,83 +790,139 @@
*frame = *frame + 1;
}
-static void EraseSprite(sprite *img, int x, int y) {
- struct blit *update;
+static int EraseSprite(sprite* img, int x, int y)
+{
+ struct blit* update;
- update = &blits[numupdates++];
- update->src = background;
- update->srcrect->x = x;
- update->srcrect->y = y;
- update->srcrect->w = img->frame[img->cur]->w;
- update->srcrect->h = img->frame[img->cur]->h;
+ if(!img)
+ {
+ fprintf(stderr, "EraseSprite() - invalid 'img' arg!\n");
+ return 0;
+ }
- /* check to see if we are trying blit data that doesn't exist!!! */
+ update = &blits[numupdates++];
- if (update->srcrect->x + update->srcrect->w > background->w)
- update->srcrect->w = background->w - update->srcrect->x;
- if (update->srcrect->y + update->srcrect->h > background->h)
- update->srcrect->h = background->h - update->srcrect->y;
+ if(!update || !update->srcrect || !update->dstrect)
+ {
+ fprintf(stderr, "EraseSprite() - 'update' ptr invalid!\n");
+ return 0;
+ }
- update->dstrect->x = x;
- update->dstrect->y = y;
- update->dstrect->w = update->srcrect->w;
- update->dstrect->h = update->srcrect->h;
- update->type = 'E';
+ update->src = background;
+ update->srcrect->x = x;
+ update->srcrect->y = y;
+ update->srcrect->w = img->frame[img->cur]->w;
+ update->srcrect->h = img->frame[img->cur]->h;
+
+ /* check to see if we are trying blit data that doesn't exist!!! */
+
+ if (update->srcrect->x + update->srcrect->w > background->w)
+ update->srcrect->w = background->w - update->srcrect->x;
+ if (update->srcrect->y + update->srcrect->h > background->h)
+ update->srcrect->h = background->h - update->srcrect->y;
+
+ update->dstrect->x = x;
+ update->dstrect->y = y;
+ update->dstrect->w = update->srcrect->w;
+ update->dstrect->h = update->srcrect->h;
+ update->type = 'E';
+
+ return 1;
}
/*************************
EraseObject : Erase an object from the screen
**************************/
-static void EraseObject(SDL_Surface * sprite, int x, int y) {
- struct blit *update;
+static int EraseObject(SDL_Surface* surf, int x, int y)
+{
+ struct blit *update;
- update = &blits[numupdates++];
- update->src = background;
- update->srcrect->x = x;
- update->srcrect->y = y;
- update->srcrect->w = sprite->w;
- update->srcrect->h = sprite->h;
+ if(!surf)
+ {
+ fprintf(stderr, "EraseObject() - invalid 'surf' arg!\n");
+ return 0;
+ }
- /* check to see if we are trying blit data that doesn't exist!!! */
+ update = &blits[numupdates++];
- if (update->srcrect->x + update->srcrect->w > background->w)
- update->srcrect->w = background->w - update->srcrect->x;
- if (update->srcrect->y + update->srcrect->h > background->h)
- update->srcrect->h = background->h - update->srcrect->y;
+ if(!update || !update->srcrect || !update->dstrect)
+ {
+ fprintf(stderr, "EraseObject() - 'update' ptr invalid!\n");
+ return 0;
+ }
- update->dstrect->x = x;
- update->dstrect->y = y;
- update->dstrect->w = update->srcrect->w;
- update->dstrect->h = update->srcrect->h;
- update->type = 'E';
+ update->src = background;
+ update->srcrect->x = x;
+ update->srcrect->y = y;
+ update->srcrect->w = surf->w;
+ update->srcrect->h = surf->h;
+
+ /* check to see if we are trying blit data that doesn't exist!!! */
+
+ if (update->srcrect->x + update->srcrect->w > background->w)
+ update->srcrect->w = background->w - update->srcrect->x;
+ if (update->srcrect->y + update->srcrect->h > background->h)
+ update->srcrect->h = background->h - update->srcrect->y;
+
+ update->dstrect->x = x;
+ update->dstrect->y = y;
+ update->dstrect->w = update->srcrect->w;
+ update->dstrect->h = update->srcrect->h;
+ update->type = 'E';
+
+ return 1;
}
+
/******************************
AddRect : Dont actually blit a surface,
but add a rect to be updated next
update
*******************************/
-static void AddRect(SDL_Rect * src, SDL_Rect * dst) {
- /*borrowed from SL's alien (and modified)*/
- struct blit *update;
+static int AddRect(SDL_Rect* src, SDL_Rect* dst)
+{
- update = &blits[numupdates++];
+ /*borrowed from SL's alien (and modified)*/
+ struct blit* update;
- update->srcrect->x = src->x;
- update->srcrect->y = src->y;
- update->srcrect->w = src->w;
- update->srcrect->h = src->h;
- update->dstrect->x = dst->x;
- update->dstrect->y = dst->y;
- update->dstrect->w = dst->w;
- update->dstrect->h = dst->h;
- update->type = 'I';
+ if(!src)
+ {
+ fprintf(stderr, "AddRect() - invalid 'src' arg!\n");
+ return 0;
+ }
+
+ if(!dst)
+ {
+ fprintf(stderr, "AddRect() - invalid 'dst' arg!\n");
+ return 0;
+ }
+
+ update = &blits[numupdates++];
+
+ if(!update || !update->srcrect || !update->dstrect)
+ {
+ fprintf(stderr, "AddRect() - 'update' ptr invalid!\n");
+ return 0;
+ }
+
+ update->srcrect->x = src->x;
+ update->srcrect->y = src->y;
+ update->srcrect->w = src->w;
+ update->srcrect->h = src->h;
+ update->dstrect->x = dst->x;
+ update->dstrect->y = dst->y;
+ update->dstrect->w = dst->w;
+ update->dstrect->h = dst->h;
+ update->type = 'I';
+
+ return 1;
}
/*********************
LoadOthers : Load all other graphics
**********************/
-static void LoadOthers( void ) {
+static void LoadOthers(void)
+{
int i;
unsigned char filename[FNLEN];
@@ -895,7 +988,7 @@
LOG( "=LoadOthers() END\n" );
}
-static void display_msg(const unsigned char *msg, int x, int y)
+static void display_msg(const unsigned char* msg, int x, int y)
{
SDL_Surface* m;
m = TTF_RenderUTF8_Shaded(font, msg, white, white);
@@ -907,7 +1000,8 @@
/***************************
LoadFishies : Load the fish animations and graphics
*****************************/
-static void LoadFishies( void ) {
+static void LoadFishies(void)
+{
int i;
LOG( "=LoadFishies()\n" );
@@ -927,7 +1021,8 @@
/******************************
LoadTuxAnims : Load the Tux graphics and animations
*******************************/
-static void LoadTuxAnims( void ) {
+static void LoadTuxAnims(void)
+{
int i;
int height = 0; //temp width/height varis to determine max's
@@ -949,7 +1044,8 @@
a certain x,y. See "usage"
below
*******************************/
-static void DrawNumbers(int num, int x, int y, int places) {
+static void DrawNumbers(int num, int x, int y, int places)
+{
//usage:
// num = number to draw onscreen
// x, y = coords to place number (starting upper left)
@@ -1021,7 +1117,8 @@
FreeGame : Free all
the game elements
***********************/
-static void FreeGame( void ) {
+static void FreeGame(void)
+{
int i;
FreeLetters();
@@ -1083,7 +1180,7 @@
{
struct blit *update;
- LOG( "-DrawBackground(): Updating entire background\n" );
+ LOG("-DrawBackground(): Updating entire background\n");
numupdates=0; // drawing entire background writes over all other stuff, so don't draw them
@@ -1102,7 +1199,8 @@
SpawnFishies: Spawn the fishes
in the key cascade game
*****************************/
-static void SpawnFishies(int diflevel, int *fishies, int *frame ) {
+static void SpawnFishies(int diflevel, int* fishies, int* frame)
+{
int i, spacing;
wchar_t* new_word;
@@ -1172,7 +1270,7 @@
CheckFishies : Check all the fishies and splats.
sort the splats and fishies
****************************/
-static void CheckFishies(int *fishies, int *splats)
+static void CheckFishies(int* fishies, int* splats)
{
int forward, backward;
struct fishypoo fish_temp;
@@ -1249,7 +1347,7 @@
/***************************
AddSplat: A fish has died, add a splat where he used to be
****************************/
-static void AddSplat(int *splats, struct fishypoo *f, int *curlives, int *frame) {
+static void AddSplat(int* splats, struct fishypoo* f, int* curlives, int* frame) {
int i;
for ( i = 0; i < f->len; i++ ) {
@@ -1272,7 +1370,7 @@
-static void DrawFish( int which )
+static void DrawFish(int which)
{
/* LOG ("Entering DrawFish()\n");*/
int j = 0;
Modified: tuxtype/trunk/tuxtype/practice.c
===================================================================
--- tuxtype/trunk/tuxtype/practice.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/practice.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -28,11 +28,164 @@
Mix_Chunk *wrong;
/*local function prototypes: */
-void print_at( char *pphrase, int wrap, int x, int y );
+static int get_phrase(const char* phr);
+static void practice_load_media(void);
+static void practice_unload_media(void);
+static void print_at(const char *pphrase, int wrap, int x, int y);
+static void show(unsigned char t);
+/************************************************************************/
+/* */
+/* "Public" functions (callable throughout program) */
+/* */
+/************************************************************************/
+
+
+
+int Phrases(char* pphrase ) {
+
+ /* TODO
+ *
+ *
+ *
+ */
+
+ Uint32 start=0,a=0;
+ int quit=0,
+ i=0,
+ c=0,
+ wp=0,
+ z=0,
+ total=0,
+ state=0;
+ int key[100];
+ SDL_Rect dst, dst2, dst3, dst4,dst5;
+ char keytime[FNLEN],
+ totaltime[FNLEN];
+
+ practice_load_media();
+ SDL_BlitSurface(bkg, NULL, screen, NULL);
+ SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+ SDL_Flip(screen);
+
+ wp = get_phrase(pphrase);
+ if (!strncmp(phrase[0], "", 1))
+ strncpy(pphrase, phrase[0], 80);
+
+ dst.x = 320 - (letters[65]->w/2); dst.y = 100; dst.w = letters[65]->w; dst.h = letters[65]->h;
+ dst2.x = 50; dst2.y = 400; dst2.w = letters[65]->w; dst2.h = letters[65]->h;
+ dst3.x = 50; dst3.y = 400; dst3.w = 160; dst3.h = 50;
+ dst4.x = 480; dst4.y = 400; dst4.w = 240; dst4.h = 50;
+ dst5.x = 480; dst5.y = 400; dst5.w = 240; dst5.h = 50;
+ dst.x = 40;
+
+ start = SDL_GetTicks();
+
+ do {
+ switch (state) {
+ case 0:
+ start = SDL_GetTicks();
+ SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+ state = 1;
+ break;
+ case 1:
+ if (SDL_GetTicks() - start > 500) {
+ for (i=0; i<10; i++)
+ if (FINGER[(int)pphrase[c]][i]){
+ SDL_BlitSurface(hand[i], NULL, screen, &hand_loc);
+ }
+ state = 2;
+ }
+ break;
+ case 2:
+ if (state == 2 && SDL_GetTicks() - start > 750) {
+ state = 3;
+ }
+ break;
+ case 3:
+ SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+ state = 12;
+ break;
+ case 4:
+ for (i=0; i<10; i++)
+ if (FINGER[(int)pphrase[c]][i])
+ SDL_BlitSurface(hand[i], NULL, screen, &hand_loc);
+ state = 11;
+ break;
+ default:
+ state -= 2; // this is to make the flashing slower
+ }
+
+ while (SDL_PollEvent(&event)) {
+ if (event.type == SDL_KEYDOWN) {
+ a=SDL_GetTicks();
+ key[c]=a-start;
+ total += key[c];
+ sprintf(keytime, "%.2f", (float) key[c] / 1000);
+ sprintf(totaltime, "%.2f", (float) total / 1000);
+ start = a;
+ if (event.key.keysym.sym == SDLK_ESCAPE)
+ quit=1;
+ if (event.key.keysym.sym == SDLK_DOWN) {
+ //practice next phase in list
+ //a=a;
+ } else {
+ if (ALPHABET[KEYMAP[event.key.keysym.unicode]] && pphrase[c]==(char)event.key.keysym.unicode){
+ state=0;
+ dst2.x=40;
+ dst4.x=480;
+ SDL_BlitSurface(bkg, &dst3, screen, &dst2);
+ SDL_BlitSurface(bkg, &dst5, screen, &dst4);
+ SDL_Flip(screen);
+ SDL_BlitSurface(letters[KEYMAP[event.key.keysym.unicode]], NULL, screen, &dst);
+ for (z=0;z<strlen(keytime);z++){
+ SDL_BlitSurface(letters[(int)keytime[z]], NULL, screen, &dst2);
+ dst2.x = dst2.x + letters[(int)keytime[z]]->w-2;
+ }
+ for (z=0;z<strlen(totaltime);z++){
+ SDL_BlitSurface(letters[(int)totaltime[z]], NULL, screen, &dst4);
+ dst4.x = dst4.x + letters[(int)totaltime[z]]->w-2;
+ }
+ dst.x = (dst.x + letters[KEYMAP[event.key.keysym.unicode]]->w) - 5;
+ if (c==(strlen(pphrase)-1)){
+ print_at("Great!",6 ,275 ,200);
+ SDL_Flip(screen);
+ SDL_Delay(2500);
+ quit=1;
+ }
+ if (c==wp){
+ c++;
+ dst.x=40;
+ dst.y=142;
+ }
+ c++;
+ } else {
+ if ( event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT )
+ PlaySound(wrong);
+ }
+ }
+ }
+ }
+ SDL_Flip(screen);
+ SDL_Delay(30);
+ }while (!quit);
+ practice_unload_media();
+ return 1;
+}
+
+
+
+/************************************************************************/
+/* */
+/* "Private" functions (local to practice.c) */
+/* */
+/************************************************************************/
+
+
/* FIXME use RenderLetters(), etc */
-void practice_load_media(void) {
+static void practice_load_media(void)
+{
int i;
unsigned char fn[FNLEN];
unsigned char let[5];
@@ -67,7 +220,10 @@
}
-void practice_unload_media(void) {
+
+
+static void practice_unload_media(void)
+{
int i;
SDL_FreeSurface(bkg);
SDL_FreeSurface(hands);
@@ -82,7 +238,10 @@
Mix_FreeChunk(wrong);
}
-void show(unsigned char t) {
+
+
+static void show(unsigned char t)
+{
SDL_Rect dst;
dst.x = 320 - (letters[(int)t]->w/2);
dst.y = 100;
@@ -91,7 +250,10 @@
SDL_BlitSurface(letters[(int)t], NULL, screen, &dst);
}
-int get_phrase(char *phr){
+
+
+static int get_phrase(const char* phr)
+{
int pc=0,
pw[256] = { 0 },
wp=0,
@@ -169,7 +331,10 @@
return(wp);
}
-void print_at( char *pphrase, int wrap, int x, int y ) {
+
+
+static void print_at(const char *pphrase, int wrap, int x, int y)
+{
int z=0;
letter_loc.x = x;
letter_loc.y = y;
@@ -195,135 +360,3 @@
}
}
-
-int Phrases( char *pphrase ) {
-
- /* TODO
- *
- *
- *
- */
-
- Uint32 start=0,a=0;
- int quit=0,
- i=0,
- c=0,
- wp=0,
- z=0,
- total=0,
- state=0;
- int key[100];
- SDL_Rect dst, dst2, dst3, dst4,dst5;
- char keytime[FNLEN],
- totaltime[FNLEN];
-
- practice_load_media();
- SDL_BlitSurface(bkg, NULL, screen, NULL);
- SDL_BlitSurface(hands, NULL, screen, &hand_loc);
- SDL_Flip(screen);
-
- wp = get_phrase(pphrase);
- if (!strncmp(phrase[0], "", 1))
- strncpy(pphrase, phrase[0], 80);
-
- dst.x = 320 - (letters[65]->w/2); dst.y = 100; dst.w = letters[65]->w; dst.h = letters[65]->h;
- dst2.x = 50; dst2.y = 400; dst2.w = letters[65]->w; dst2.h = letters[65]->h;
- dst3.x = 50; dst3.y = 400; dst3.w = 160; dst3.h = 50;
- dst4.x = 480; dst4.y = 400; dst4.w = 240; dst4.h = 50;
- dst5.x = 480; dst5.y = 400; dst5.w = 240; dst5.h = 50;
- dst.x = 40;
-
- start = SDL_GetTicks();
-
- do {
- switch (state) {
- case 0:
- start = SDL_GetTicks();
- SDL_BlitSurface(hands, NULL, screen, &hand_loc);
- state = 1;
- break;
- case 1:
- if (SDL_GetTicks() - start > 500) {
- for (i=0; i<10; i++)
- if (FINGER[(int)pphrase[c]][i]){
- SDL_BlitSurface(hand[i], NULL, screen, &hand_loc);
- }
- state = 2;
- }
- break;
- case 2:
- if (state == 2 && SDL_GetTicks() - start > 750) {
- state = 3;
- }
- break;
- case 3:
- SDL_BlitSurface(hands, NULL, screen, &hand_loc);
- state = 12;
- break;
- case 4:
- for (i=0; i<10; i++)
- if (FINGER[(int)pphrase[c]][i])
- SDL_BlitSurface(hand[i], NULL, screen, &hand_loc);
- state = 11;
- break;
- default:
- state -= 2; // this is to make the flashing slower
- }
-
- while (SDL_PollEvent(&event)) {
- if (event.type == SDL_KEYDOWN) {
- a=SDL_GetTicks();
- key[c]=a-start;
- total += key[c];
- sprintf(keytime, "%.2f", (float) key[c] / 1000);
- sprintf(totaltime, "%.2f", (float) total / 1000);
- start = a;
- if (event.key.keysym.sym == SDLK_ESCAPE)
- quit=1;
- if (event.key.keysym.sym == SDLK_DOWN) {
- //practice next phase in list
- //a=a;
- } else {
- if (ALPHABET[KEYMAP[event.key.keysym.unicode]] && pphrase[c]==(char)event.key.keysym.unicode){
- state=0;
- dst2.x=40;
- dst4.x=480;
- SDL_BlitSurface(bkg, &dst3, screen, &dst2);
- SDL_BlitSurface(bkg, &dst5, screen, &dst4);
- SDL_Flip(screen);
- SDL_BlitSurface(letters[KEYMAP[event.key.keysym.unicode]], NULL, screen, &dst);
- for (z=0;z<strlen(keytime);z++){
- SDL_BlitSurface(letters[(int)keytime[z]], NULL, screen, &dst2);
- dst2.x = dst2.x + letters[(int)keytime[z]]->w-2;
- }
- for (z=0;z<strlen(totaltime);z++){
- SDL_BlitSurface(letters[(int)totaltime[z]], NULL, screen, &dst4);
- dst4.x = dst4.x + letters[(int)totaltime[z]]->w-2;
- }
- dst.x = (dst.x + letters[KEYMAP[event.key.keysym.unicode]]->w) - 5;
- if (c==(strlen(pphrase)-1)){
- print_at("Great!",6 ,275 ,200);
- SDL_Flip(screen);
- SDL_Delay(2500);
- quit=1;
- }
- if (c==wp){
- c++;
- dst.x=40;
- dst.y=142;
- }
- c++;
- } else {
- if ( event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT )
- PlaySound(wrong);
- }
- }
- }
- }
- SDL_Flip(screen);
- SDL_Delay(30);
- }while (!quit);
- practice_unload_media();
- return 1;
-}
-
Modified: tuxtype/trunk/tuxtype/snow.c
===================================================================
--- tuxtype/trunk/tuxtype/snow.c 2007-06-07 18:54:49 UTC (rev 185)
+++ tuxtype/trunk/tuxtype/snow.c 2007-06-15 09:55:25 UTC (rev 186)
@@ -21,8 +21,8 @@
/* while it looks like you can just
* change the number of planes, flakes,
- * etc and it will work alright, it is not
- * true. Do not fidle with number unless you
+ * etc and it will work all right, it is not
+ * true. Do not fiddle with number unless you
* change the rest of the code to be the same!
*/
@@ -33,7 +33,7 @@
Uint16 snow_color;
-int wind=0;
+int wind = 0;
int SNOW_on = 0;
int NUM_FLAKES = 300;
More information about the Tux4kids-commits
mailing list