[Tux4kids-commits] r4 - in tuxmath/trunk: . data data/images data/images/backgrounds data/images/cities data/images/comets data/images/status data/images/status/.xvpics data/images/tux data/sounds docs src

sam at alioth.debian.org sam at alioth.debian.org
Thu Mar 8 20:55:31 CET 2007


Author: sam
Date: 2006-01-26 20:51:19 +0000 (Thu, 26 Jan 2006)
New Revision: 4

Added:
   tuxmath/trunk/Makefile
   tuxmath/trunk/data/
   tuxmath/trunk/data/images/
   tuxmath/trunk/data/images/backgrounds/
   tuxmath/trunk/data/images/backgrounds/0.jpg
   tuxmath/trunk/data/images/backgrounds/1.jpg
   tuxmath/trunk/data/images/backgrounds/2.jpg
   tuxmath/trunk/data/images/backgrounds/3.jpg
   tuxmath/trunk/data/images/backgrounds/4.jpg
   tuxmath/trunk/data/images/cities/
   tuxmath/trunk/data/images/cities/cdead-blue.png
   tuxmath/trunk/data/images/cities/cdead-green.png
   tuxmath/trunk/data/images/cities/cdead-orange.png
   tuxmath/trunk/data/images/cities/cdead-red.png
   tuxmath/trunk/data/images/cities/city-blue.png
   tuxmath/trunk/data/images/cities/city-green.png
   tuxmath/trunk/data/images/cities/city-orange.png
   tuxmath/trunk/data/images/cities/city-red.png
   tuxmath/trunk/data/images/cities/csplode-blue-1.png
   tuxmath/trunk/data/images/cities/csplode-blue-2.png
   tuxmath/trunk/data/images/cities/csplode-blue-3.png
   tuxmath/trunk/data/images/cities/csplode-blue-4.png
   tuxmath/trunk/data/images/cities/csplode-blue-5.png
   tuxmath/trunk/data/images/cities/csplode-green-1.png
   tuxmath/trunk/data/images/cities/csplode-green-2.png
   tuxmath/trunk/data/images/cities/csplode-green-3.png
   tuxmath/trunk/data/images/cities/csplode-green-4.png
   tuxmath/trunk/data/images/cities/csplode-green-5.png
   tuxmath/trunk/data/images/cities/csplode-orange-1.png
   tuxmath/trunk/data/images/cities/csplode-orange-2.png
   tuxmath/trunk/data/images/cities/csplode-orange-3.png
   tuxmath/trunk/data/images/cities/csplode-orange-4.png
   tuxmath/trunk/data/images/cities/csplode-orange-5.png
   tuxmath/trunk/data/images/cities/csplode-red-1.png
   tuxmath/trunk/data/images/cities/csplode-red-2.png
   tuxmath/trunk/data/images/cities/csplode-red-3.png
   tuxmath/trunk/data/images/cities/csplode-red-4.png
   tuxmath/trunk/data/images/cities/csplode-red-5.png
   tuxmath/trunk/data/images/cities/shields.png
   tuxmath/trunk/data/images/comets/
   tuxmath/trunk/data/images/comets/comet1.png
   tuxmath/trunk/data/images/comets/comet2.png
   tuxmath/trunk/data/images/comets/comet3.png
   tuxmath/trunk/data/images/comets/cometex1.png
   tuxmath/trunk/data/images/comets/cometex1a.png
   tuxmath/trunk/data/images/comets/cometex2.png
   tuxmath/trunk/data/images/comets/cometex3.png
   tuxmath/trunk/data/images/icon.png
   tuxmath/trunk/data/images/status/
   tuxmath/trunk/data/images/status/.xvpics/
   tuxmath/trunk/data/images/status/.xvpics/cmd_credits.png
   tuxmath/trunk/data/images/status/.xvpics/cmd_options.png
   tuxmath/trunk/data/images/status/.xvpics/cmd_play.png
   tuxmath/trunk/data/images/status/.xvpics/cmd_quit.png
   tuxmath/trunk/data/images/status/.xvpics/title.png
   tuxmath/trunk/data/images/status/.xvpics/tux4kids.png
   tuxmath/trunk/data/images/status/.xvpics/tux_helmet1.png
   tuxmath/trunk/data/images/status/.xvpics/tux_helmet2.png
   tuxmath/trunk/data/images/status/.xvpics/tux_helmet3.png
   tuxmath/trunk/data/images/status/cmd_credits.png
   tuxmath/trunk/data/images/status/cmd_options.png
   tuxmath/trunk/data/images/status/cmd_play.png
   tuxmath/trunk/data/images/status/cmd_quit.png
   tuxmath/trunk/data/images/status/demo-small.png
   tuxmath/trunk/data/images/status/demo.png
   tuxmath/trunk/data/images/status/gameover.png
   tuxmath/trunk/data/images/status/keypad.png
   tuxmath/trunk/data/images/status/lednums.png
   tuxmath/trunk/data/images/status/loading.png
   tuxmath/trunk/data/images/status/nbs.png
   tuxmath/trunk/data/images/status/numbers.png
   tuxmath/trunk/data/images/status/nums.png
   tuxmath/trunk/data/images/status/opt_addition.png
   tuxmath/trunk/data/images/status/opt_check.png
   tuxmath/trunk/data/images/status/opt_check_on.png
   tuxmath/trunk/data/images/status/opt_division.png
   tuxmath/trunk/data/images/status/opt_max_answer.png
   tuxmath/trunk/data/images/status/opt_multiplication.png
   tuxmath/trunk/data/images/status/opt_q_range.png
   tuxmath/trunk/data/images/status/opt_rng_13_20.png
   tuxmath/trunk/data/images/status/opt_rng_13_20_on.png
   tuxmath/trunk/data/images/status/opt_rng_1_5.png
   tuxmath/trunk/data/images/status/opt_rng_1_5_on.png
   tuxmath/trunk/data/images/status/opt_rng_6_12.png
   tuxmath/trunk/data/images/status/opt_rng_6_12_on.png
   tuxmath/trunk/data/images/status/opt_subtraction.png
   tuxmath/trunk/data/images/status/options.png
   tuxmath/trunk/data/images/status/paused.png
   tuxmath/trunk/data/images/status/score.png
   tuxmath/trunk/data/images/status/standby.png
   tuxmath/trunk/data/images/status/title.png
   tuxmath/trunk/data/images/status/tux4kids.png
   tuxmath/trunk/data/images/status/tux_helmet1.png
   tuxmath/trunk/data/images/status/tux_helmet2.png
   tuxmath/trunk/data/images/status/tux_helmet3.png
   tuxmath/trunk/data/images/status/wave.png
   tuxmath/trunk/data/images/tux/
   tuxmath/trunk/data/images/tux/console.png
   tuxmath/trunk/data/images/tux/tux-console1.png
   tuxmath/trunk/data/images/tux/tux-console2.png
   tuxmath/trunk/data/images/tux/tux-console3.png
   tuxmath/trunk/data/images/tux/tux-console4.png
   tuxmath/trunk/data/images/tux/tux-drat.png
   tuxmath/trunk/data/images/tux/tux-egypt1.png
   tuxmath/trunk/data/images/tux/tux-egypt2.png
   tuxmath/trunk/data/images/tux/tux-fist1.png
   tuxmath/trunk/data/images/tux/tux-fist2.png
   tuxmath/trunk/data/images/tux/tux-kiss1.png
   tuxmath/trunk/data/images/tux/tux-kiss2.png
   tuxmath/trunk/data/images/tux/tux-relax1.png
   tuxmath/trunk/data/images/tux/tux-relax2.png
   tuxmath/trunk/data/images/tux/tux-sit.png
   tuxmath/trunk/data/images/tux/tux-yay1.png
   tuxmath/trunk/data/images/tux/tux-yay2.png
   tuxmath/trunk/data/images/tux/tux-yes1.png
   tuxmath/trunk/data/images/tux/tux-yes2.png
   tuxmath/trunk/data/images/tux/tux-yipe.png
   tuxmath/trunk/data/sounds/
   tuxmath/trunk/data/sounds/SIZZLING.WAV
   tuxmath/trunk/data/sounds/alarm.wav
   tuxmath/trunk/data/sounds/buzz.wav
   tuxmath/trunk/data/sounds/click.wav
   tuxmath/trunk/data/sounds/explosion.wav
   tuxmath/trunk/data/sounds/game.mod
   tuxmath/trunk/data/sounds/game2.mod
   tuxmath/trunk/data/sounds/game3.mod
   tuxmath/trunk/data/sounds/laser.wav
   tuxmath/trunk/data/sounds/pop.wav
   tuxmath/trunk/data/sounds/shieldsdown.wav
   tuxmath/trunk/docs/
   tuxmath/trunk/docs/CHANGES.txt
   tuxmath/trunk/docs/COPYING.txt
   tuxmath/trunk/docs/INSTALL.txt
   tuxmath/trunk/docs/README.txt
   tuxmath/trunk/docs/TODO.txt
   tuxmath/trunk/src/
   tuxmath/trunk/src/credits.c
   tuxmath/trunk/src/credits.h
   tuxmath/trunk/src/game.c
   tuxmath/trunk/src/game.h
   tuxmath/trunk/src/images.h
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/options.h
   tuxmath/trunk/src/playsound.c
   tuxmath/trunk/src/playsound.h
   tuxmath/trunk/src/setup.c
   tuxmath/trunk/src/setup.h
   tuxmath/trunk/src/sounds.h
   tuxmath/trunk/src/title.c
   tuxmath/trunk/src/title.h
   tuxmath/trunk/src/tuxmath.c
Log:
Move tuxmath from sf.net


Added: tuxmath/trunk/Makefile
===================================================================
--- tuxmath/trunk/Makefile	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/Makefile	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,113 @@
+# Makefile for "tuxmath"
+# (Hand-coded)
+
+# Bill Kendrick
+# bill at newbreedsoftware.com
+# http://www.newbreedsoftware.com/tuxmath/
+
+# 2001.Aug.26 - 2005.Jan.03
+
+
+CFLAGS=-Wall -g $(SDL_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" -DDEBUG \
+	-DVERSION=\"$(VERSION)\" -D$(SOUND)SOUND
+
+SDL_CFLAGS=$(shell sdl-config --cflags)
+SDL_LIBS=$(shell sdl-config --libs)
+
+LIBS=$(SDL_LIBS) $(MIXERLIB) -lSDL_image
+MIXERLIB=-lSDL_mixer
+
+ifndef PREFIX
+PREFIX=/usr/local
+endif
+DATA_PREFIX=$(DESTDIR)$(PREFIX)/share/tuxmath/
+BIN_PREFIX=$(DESTDIR)$(PREFIX)/bin
+
+# There isn't always a root group on every unix
+OWNER=$(shell if `groups root | grep root > /dev/null` ; then echo root:root ; else echo root:wheel ; fi)
+
+
+VERSION=2005.01.03
+
+all:	tuxmath
+
+nosound:
+	make tuxmath SOUND=NO MIXERLIB=
+
+install:
+	@echo "COPYING BINARY TO $(BIN_PREFIX)"
+	mkdir -p $(BIN_PREFIX)
+	mkdir -p $(DATA_PREFIX)
+	strip tuxmath
+	cp tuxmath $(BIN_PREFIX)
+	chown $(OWNER) $(BIN_PREFIX)/tuxmath
+	chmod 0755 $(BIN_PREFIX)/tuxmath
+	@echo "COPYING DATA FILES TO $(DATA_PREFIX)"
+	mkdir -p $(DATA_PREFIX)
+	cp -r data/* $(DATA_PREFIX)
+	chown -R $(OWNER) $(DATA_PREFIX)
+	chmod a+Xr $(DATA_PREFIX)
+	chmod a-w $(DATA_PREFIX)
+
+uninstall:
+	@echo "REMOVING TUX MATH"
+	-rm $(BIN_PREFIX)/tuxmath
+	-rm -r $(DATA_PREFIX)
+
+clean:
+	-rm tuxmath
+	-rm obj/*.o
+	-rmdir obj
+
+
+tuxmath:	obj/tuxmath.o obj/setup.o obj/title.o obj/game.o \
+		obj/options.o obj/credits.o obj/playsound.o
+	@echo "LINKING!"
+	$(CC) $(CFLAGS) $^ -o tuxmath $(LIBS)
+
+
+obj:
+	mkdir -p obj
+
+obj/tuxmath.o:	src/tuxmath.c src/images.h src/sounds.h src/setup.h \
+		src/title.h src/game.h src/options.h src/credits.h \
+		src/playsound.h
+	@echo "BUILDING tuxmath.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/tuxmath.c -c -o obj/tuxmath.o
+
+obj/setup.o:	src/setup.c src/setup.h src/sounds.h src/images.h src/game.h
+	@echo "BUILDING setup.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/setup.c -c -o obj/setup.o
+
+obj/title.o:	src/title.c src/title.h src/setup.h src/sounds.h src/images.h \
+		src/playsound.h
+	@echo "BUILDING title.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/title.c -c -o obj/title.o
+
+obj/game.o:	src/game.c src/game.h src/setup.h src/sounds.h src/images.h \
+		src/playsound.h
+	@echo "BUILDING game.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/game.c -c -o obj/game.o
+
+obj/options.o:	src/options.c src/options.h src/images.h src/setup.h \
+		src/sounds.h src/playsound.h
+	@echo "BUILDING options.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/options.c -c -o obj/options.o
+
+obj/credits.o:	src/credits.c src/credits.h src/setup.h src/sounds.h \
+		src/images.h
+	@echo "BUILDING credits.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/credits.c -c -o obj/credits.o
+
+obj/playsound.o:	src/playsound.c src/playsound.h src/setup.h \
+		src/sounds.h
+	@echo "BUILDING playsound.o"
+	-mkdir -p obj
+	$(CC) $(CFLAGS) src/playsound.c -c -o obj/playsound.o
+

Added: tuxmath/trunk/data/images/backgrounds/0.jpg
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/backgrounds/0.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/backgrounds/1.jpg
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/backgrounds/1.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/backgrounds/2.jpg
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/backgrounds/2.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/backgrounds/3.jpg
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/backgrounds/3.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/backgrounds/4.jpg
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/backgrounds/4.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/cdead-blue.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/cdead-blue.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/cdead-green.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/cdead-green.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/cdead-orange.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/cdead-orange.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/cdead-red.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/cdead-red.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/city-blue.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/city-blue.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/city-green.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/city-green.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/city-orange.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/city-orange.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/city-red.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/city-red.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-blue-1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-blue-1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-blue-2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-blue-2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-blue-3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-blue-3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-blue-4.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-blue-4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-blue-5.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-blue-5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-green-1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-green-1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-green-2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-green-2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-green-3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-green-3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-green-4.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-green-4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-green-5.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-green-5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-orange-1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-orange-1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-orange-2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-orange-2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-orange-3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-orange-3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-orange-4.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-orange-4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-orange-5.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-orange-5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-red-1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-red-1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-red-2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-red-2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-red-3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-red-3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-red-4.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-red-4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/csplode-red-5.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/csplode-red-5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/cities/shields.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/cities/shields.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/comet1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/comet1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/comet2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/comet2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/comet3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/comet3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/cometex1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/cometex1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/cometex1a.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/cometex1a.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/cometex2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/cometex2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/comets/cometex3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/comets/cometex3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/icon.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/icon.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/cmd_credits.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/cmd_credits.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/cmd_options.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/cmd_options.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/cmd_play.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/cmd_play.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/cmd_quit.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/cmd_quit.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/title.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/title.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/tux4kids.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/tux4kids.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/tux_helmet1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/tux_helmet1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/tux_helmet2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/tux_helmet2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/.xvpics/tux_helmet3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/.xvpics/tux_helmet3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/cmd_credits.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/cmd_credits.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/cmd_options.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/cmd_options.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/cmd_play.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/cmd_play.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/cmd_quit.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/cmd_quit.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/demo-small.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/demo-small.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/demo.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/demo.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/gameover.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/gameover.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/keypad.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/keypad.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/lednums.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/lednums.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/loading.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/loading.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/nbs.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/nbs.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/numbers.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/numbers.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/nums.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/nums.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_addition.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_addition.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_check.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_check.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_check_on.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_check_on.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_division.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_division.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_max_answer.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_max_answer.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_multiplication.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_multiplication.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_q_range.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_q_range.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_13_20.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_13_20.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_13_20_on.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_13_20_on.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_1_5.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_1_5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_1_5_on.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_1_5_on.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_6_12.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_6_12.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_rng_6_12_on.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_rng_6_12_on.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/opt_subtraction.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_subtraction.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/options.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/options.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/paused.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/paused.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/score.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/score.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/standby.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/standby.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/title.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/title.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/tux4kids.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/tux4kids.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/tux_helmet1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/tux_helmet1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/tux_helmet2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/tux_helmet2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/tux_helmet3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/tux_helmet3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/status/wave.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/wave.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/console.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/console.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-console1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-console1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-console2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-console2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-console3.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-console3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-console4.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-console4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-drat.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-drat.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-egypt1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-egypt1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-egypt2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-egypt2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-fist1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-fist1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-fist2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-fist2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-kiss1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-kiss1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-kiss2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-kiss2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-relax1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-relax1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-relax2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-relax2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-sit.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-sit.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-yay1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-yay1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-yay2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-yay2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-yes1.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-yes1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-yes2.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-yes2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/images/tux/tux-yipe.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/tux/tux-yipe.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/SIZZLING.WAV
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/SIZZLING.WAV
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/alarm.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/alarm.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/buzz.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/buzz.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/click.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/click.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/explosion.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/explosion.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/game.mod
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/game.mod
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/game2.mod
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/game2.mod
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/game3.mod
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/game3.mod
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/laser.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/laser.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/pop.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/pop.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/sounds/shieldsdown.wav
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/sounds/shieldsdown.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/docs/CHANGES.txt
===================================================================
--- tuxmath/trunk/docs/CHANGES.txt	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/docs/CHANGES.txt	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,212 @@
+CHANGES.txt for "tuxmath"
+
+March 7, 2005
+
+2005.Mar.7
+  Interface:
+    * Added sound effects to Options screen.
+    
+    * Comets 'sizzle' when you shoot them.
+      Glen Ditchfield <gjditchfield at acm.org>
+
+    * Correct answer is displayed when a comet hits a city.
+      Glen Ditchfield <gjditchfield at acm.org>
+
+  Game:
+    * Kept first value in division questions from being huge.
+    
+    * Spread out comets in 'slow' mode.
+      Glen Ditchfield <gjditchfield at acm.org>
+
+  Options:
+    * Added basic "Maximum Answer" option.
+
+  Documentation:
+    * Updated Credits screen some.
+
+  Build:
+    * Makefile modifications ($OWNER).
+      Donny Viszneki <smirk at thebuicksix.com>
+
+    * Compile options ("-g" for debugging, then strip)
+      Glen Ditchfield <gjditchfield at acm.org>
+
+    * Tidier linkage (fewer multiply-included #define's)
+      Glen Ditchfield <gjditchfield at acm.org>
+
+    * Created "uninstall" Makefile target.
+
+2004.Feb.18
+  Game:
+    * Speed now depends on a speed setting, multiplied by the current wave #.
+      Michael Behrisch <behrisch at users.sourceforge.net>
+      
+  Options:
+    * Added "--speed" option to set initial game speed.
+      Michael Behrisch <behrisch at users.sourceforge.net>
+
+2003.Apr.5
+  Interface:
+    * Removed "Alpha Version" stamp from title screen.
+
+  Options:
+    * Replaced info. screen with actual option-setting interface.
+
+    * Alternative command-line options available for operators.
+      ("addition", along with "add",
+       "subtraction", along with "subtract",
+       "multiplication", along with "multiply", and
+       "division" along with "divide")
+
+  Sound:
+    * Increased audio buffer, so it's less choppy-sounding.
+
+  Documentation:
+    * Updated Credits screen.
+
+
+2001.Sep.14:
+  Documentation:
+    * Added more testers, and a "." character, to the credits display.
+
+
+2001.Sep.7:
+  Code:
+    * On-screen keypad control was enabled even if keypad wasn't.  Fixed.
+
+  Game:
+    * Slightly tweaked current equation-generation code to be more interesting.
+      (Will eventually be based on options)
+
+
+2001.Sep.6:
+  Code:
+    * Pause also pauses music
+    * More attention is paid to "NOSOUND" compile-time define
+      (you should now be able to build without SDL_mixer)
+
+  Interface:
+    * In lieu of an option screen, a message asking for help in that
+      aspect of the game design has been added.
+    * Added "SCORE" and "WAVE" displays
+
+  Game:
+    * Waves progress
+    * Score accumulates
+    * Game over at end of wave if all cities destroyed
+
+  Documentation:
+    * INSTALL.txt fleshed out quite a bit.
+
+  Installation:
+    * "install" target added to "makefile"
+
+
+2001.Sep.4:
+  Documentation:
+    * Added copyright info. to the program ("--copyright")
+    * Moved documentation into "docs/" subdirectory
+
+
+2001.Sep.3:
+  Code:
+    * "#ifdef 0" in "src/game.c" replaced.
+
+
+2001.Sep.2:
+  Graphics:
+    * Icon image ("icon.png") changed.
+
+  Documentation:
+    * More added to "README.txt"
+
+
+2001.Aug.31
+  Interface:
+    * Operators used in the game can be overridden ("--operator")
+    * Mouse controls added to title screen
+    * Added keyclick sound effect
+    * Added an on-screen keyboard (eg, for touchscreens?)  ("--keypad")
+
+  Graphics:
+    * Replaced spire with Tux at a console.
+    * Added surface (land) to remaining background photos.
+    * PNGs processed with "pngcrush" to make them smaller.
+    * Comet explosion animation works right.  Also, numbers disappear.
+    * Equations drawn after all comets drawn (to avoid covering them up)
+    * LED digits spread apart
+    * No-background mode draws faux-skyline (instead of black)
+    * "DEMO" on title screen reduced
+
+  Code:
+    * Keyboard event handling and demo mode stuff split up
+    * Demo mode plays more like a regular player
+    * FPS slowed down to max 15fps
+
+
+2001.Aug.30
+  Interface:
+    * Details added to "--help" display.
+
+  Graphics:
+    * Accidentally displayed "DEMO" on title screen even in normal mode. Fixed
+
+
+2001.Aug.29  (Live, from LinuxWorld Expo!)
+  Interface:
+    * Added demo mode ("--demo" option)
+
+
+2001.Aug.28
+  Interface:
+    * Command-line options added ("--help", "--version",
+       "--nosound", "--fullscreen", "--usage", and "--nobackground")
+    * Random backgrounds loaded (optional; use "--nobackground" to disable)
+    * Replaced UFOs with comets
+    * "Paused" text added to screen when game is paused
+    * Laser shot added
+    * Shields added to city
+
+  Graphics:
+    * Converted background PNGs to JPEGs
+    * "Alpha Version" added to title screen
+    * Title screen menu items redone to look nicer
+    * Equations don't disappear off edges of screen
+
+  Code:
+    * References to "aliens" in source replaced with "comets"
+    * Initial sound code added.
+    * Initial music code added.
+    * Sometimes cities would explode at level start. Fixed.
+
+
+2001.Aug.27
+  Interface:
+    * Initial pause code added
+    * KEYPAD numbers accepted in the game
+    * Credits in nifty rainbow colors
+    * Commands on title screen shrunk to fit and centered
+    * Cities explode when crashed-into.
+    * Spire added to game screen.
+    * Extra padding removed from digits image ("nums.png")
+    * Sound support now optional.
+    * Added New Breed Software logo
+
+  Gameplay:
+    * Game loop slowed to max(20fps)
+    * Aliens pick cities to crash into.
+    * Changed equation-creation algorithm
+
+  Code:
+    * More comments added to "game.c"
+    * Makefile fixed (was rebuilding objects due to "obj" _dir_ being newer)
+
+  Documentation:
+    * CHANGES.txt list categorized
+    * TODO.txt list categorized
+    * README.txt expanded some
+
+
+2001.Aug.26
+  * Initial build
+

Added: tuxmath/trunk/docs/COPYING.txt
===================================================================
--- tuxmath/trunk/docs/COPYING.txt	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/docs/COPYING.txt	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: tuxmath/trunk/docs/INSTALL.txt
===================================================================
--- tuxmath/trunk/docs/INSTALL.txt	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/docs/INSTALL.txt	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,198 @@
+INSTALL.txt for "tuxmath"
+
+September 6, 2001
+
+
+[ NOTE: When (and if) TuxMath changes from a simple Makefile system to
+  an autoconf/automake system, parts of this document will need to change! ]
+
+
+Requirements
+------------
+  Operating System
+  ----------------
+    "Tux, of Math Command" ("TuxMath" for short) requires a computer and
+    operating system supported by libSDL.  At the time this document was
+    written, this included:
+
+      Windows 32-bit
+      MacOS
+      Linux
+      Solaris
+      IRIX
+      FreeBSD
+      BeOS
+
+
+  CPU
+  ---
+    [ Minimum requirements should be P90, but not sure yet... ]
+    [ Architectures including i386, Alpha, PPC, Sparc64, 68000<?> ]
+
+
+  Video Display
+  -------------
+    TuxMath displays the game screen in a 640x480 window.
+
+    If supported by your system, the game can also display in full-screen
+    mode (see "README.txt" or the program's "--usage" display).
+
+    When attempting to run in fullscreen mode on systems where true 640x480
+    resolution isn't available for some reason, the next-lowest resolution
+    available will be used, and the game area will be centered within a
+    black screen.
+
+    TuxMath prefers 16bpp (bits per pixel) color depth, but can run in
+    8bpp (256 colors) if that's all that is available.
+
+
+  Sound Card
+  ----------
+    TuxMath attempts to play stereo 16-bit sound and music at
+    44.1Khz, if possible.
+
+    Sound, however, is optional, and can be disabled at compile-time
+    (see below) or run-time (see "README.txt" or the program's "--usage"
+    display).
+
+
+  Input Methods
+  -------------
+    The game is typically played using a keyboard.  The numeric keypad
+    portion of standard PC keyboards is supported (so if there are any
+    stand-alone numeric keyboards with no other keys, they SHOULD work, too).
+
+    Menus and options can be controlled with either the pointer or the
+    keyboard's arrow keys.
+
+    The game can also be played with a large, on-screen numeric keypad
+    which can be accessed using the pointer (ie, a mouse, trackball,
+    touch-screen monitor, touchpad, etc.).  (See "README.txt" or the
+    game's "--usage" display).
+
+
+  Required Libraries
+  ------------------
+    "Tux, of Math Command" uses the Simple DirectMedia Layer library (libSDL)
+    to display graphics, receive keyboard and mouse input, and play sounds.
+    (It was designed around libSDL version 1.2, but later versions should
+    work.)
+
+    It uses the SDL helper library "SDL_image" to load the game's graphics
+    data, as they are in PNG (Portable Network Graphic) format.
+
+    Also, by default, it uses "SDL_mixer" to load and play the game's
+    sound and music.  This library is optional, but without it, the program
+    will be completely silent.
+
+    Note: libSDL, SDL_image and SDL_mixer are all free, Open Source libraries,
+    released under the GNU Library General Public License (LGPL).
+
+    Getting SDL
+    -----------
+      You can download "libSDL," "SDL_image," and "SDL_mixer" from the
+      SDL website:
+
+      http://www.libsdl.org/
+
+
+      Specifically, the download pages for each are here:
+
+        libSDL:     http://www.libsdl.org/download-1.2.html
+        SDL_image:  http://www.libsdl.org/projects/SDL_image/
+        SDL_mixer:  http://www.libsdl.org/projects/SDL_mixer/
+
+      Using SDL Packages
+      ------------------
+        When building "TuxMath" from source, if you decide to install the
+        SDL libraries using packages (RedHat RPMs or DEBs), you'll
+        need to install not only each library's 'binary' package, but ALSO
+        each library's 'development' package.
+
+        These contain the text "-devel" in the package name.
+
+        Also note: Make sure you download the packages for the appropriate
+        operating system and architecture (eg, an RPM for Linux/i386 for
+        RedHat Linux on Intel-compatible computers).
+
+
+
+Compiling and Installing TuxMath
+--------------------------------
+  Linux/Unix
+  ----------
+    Compiling the Program
+    ---------------------
+      To compile the "tuxmath" binary, simply issue the following command:
+
+        make
+
+      This will compile the source files and, unless any errors occur,
+      create a "tuxmath" executable program in the TuxMath directory.
+
+
+      If you wish to build the program without sound support (in this
+      case, the "SDL_mixer" does NOT need to be installed), run this
+      command instead:
+
+        make nosound
+
+
+      NOTE: See below to change the installation directory for TuxMath.
+
+
+    Installing
+    ----------
+      Once compiled, you can have the program and graphics/sound data
+      files copied to a shared location on your system.
+
+      First, change to the superuser (root), by running the "su"
+      command and entering root's password.  Then, run this command:
+
+        make install
+
+      By default, the program will be copied into "/usr/local/bin/"
+      and the data will be copied into a new directory,
+      "/usr/local/share/tuxmath/".
+
+
+    Changing Installation Directory
+    -------------------------------
+      If you wish to override the default installation directories
+      for TuxMath, you can specify them when you run "make"
+      (or "make nosound").  Do this BEFORE running "make install".
+
+        make PREFIX=/home/username/
+
+
+      For example, if you do not have superuser access on the computer
+      you're installing in, and wish to simply run TuxMath from within
+      your home directory, you can run:
+
+        make PREFIX=/home/usernmame/
+
+      And when you go to install, run "make install" with the same:
+
+        make install PREFIX=/home/username
+
+      The data files will be copied into "tuxmath-data" in your home
+      directory, and the program will be copied into the "bin" directory.
+
+      Packages will also find the DESTDIR option useful, you can build as normal,
+      then install to a "dummy" root directory so that it is easy to determine what 
+      files are part of the package
+
+        make install DESTDIR=/tmp/tuxmath
+
+
+    Cleaning Up
+    -----------
+      If you need to re-make from scratch for some reason (for example,
+      you wish to change the "DATA_PREFIX" value when you run "make"),
+      you can have all of the compiled files (the program, and all of the
+      object files in the "obj/" directory) deleted by running:
+
+        make clean
+
+
+[ UNDER CONSTRUCTION ]

Added: tuxmath/trunk/docs/README.txt
===================================================================
--- tuxmath/trunk/docs/README.txt	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/docs/README.txt	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,245 @@
+"Tux, of Math Command"
+An educational math tutorial game starring Tux, the Linux Penguin
+-----------------------------------------------------------------
+
+February 21, 2003
+
+
+Objective
+---------
+  In "Tux, of Math Command," you play the part of Commander Tux, as he
+  defends his cities from an attack of math equations.
+
+  Comets are crashing towards your cities, and you must destroy
+  them by solving their equations.
+
+
+
+Installation
+------------
+  For instructions on installing the game on your system,
+  please read the "INSTALL.txt" file.
+
+
+
+Running The Program
+-------------------
+  Linux/Unix
+  ----------
+    Simply type the command "tuxmath" at a command prompt (eg, in an xterm).
+
+    Depending on your graphical interface or window manager, you can
+    probably also create a clickable icon which will launch the game.
+    See your interface's documentation or help screens for details.
+
+  Windows
+  -------
+    [ UNDER CONSTRUCTION ]  Just double-click the "tuxmath.exe" icon. ???
+    To be prompted for command line options (see below), invoke the game
+    from the "Run" dialog, which you can get by selecting the "Run Program"
+    item from Windows' "Start" menu. [ IS THIS CORRECT? ]
+
+  MacOS
+  -----
+    [ UNDER CONSTRUCTION ]  Just double-click the "tuxmath" icon. ???
+    To be prompted for command line options (see below), hold the [OPTION] key
+    as you double-click the icon.
+
+
+  Command Line Options
+  --------------------
+    The following command-line options can be sent to the program.
+
+      --fullscreen    -  Run the game in full screen, instead of in a window,
+      -f                 if possible.
+
+      --nosound       -  Do not play any sounds or music.
+      -s
+      --quiet
+      -q
+
+      --nobackground  -  Do not display photographic backgrounds in game.
+      -b                 (Useful on slower systems.)
+
+      --keypad        -  Display an on-screen numeric keypad.  (Useful
+      -k                 for touch screens or in place of a physical keyboard.)
+
+      --operator OP   -  Add an operator to the game (will cause the program
+      -o OP              to ignore saved option screen settings).  You can
+                         use this switch multiple times to run the game
+                         with multiple operators.
+
+                         Valid values for "OP" are:
+
+                           add
+                           subtract
+                           multiply
+                           divide
+
+      --demo          -  Demo mode.  The game will cycle back and forth
+      -d                 between the title and the game, and it will
+                         auto-play the game.  The only user interaction
+                         can be for quitting or pausing.
+
+
+    These command-line options display useful information, but the program
+    does not attempt to start up in interactive mode.
+
+      --help          -  Display a short help message, explaining how to
+      -h                 play the game.
+
+      --usage         -  Display the available command-line options.
+      -u
+
+      --version       -  Display the version of "tuxmath" you're running.
+      -v
+
+      --copyright     -  Display copyright information
+      -c
+
+
+
+Program Navigation
+------------------
+  Title Screen
+  ------------
+    On this screen, you can choose to play the game, change the gameplay
+    options, view the credits, or quit.
+
+    Use the [UP] and [DOWN] arrow keys to select what you wish to do,
+    and then press [ENTER / RETURN].  Or, use the mouse to click the
+    menu item.
+
+    Pressing [ESCAPE] will quit the program.
+
+
+  Options Screen
+  --------------
+    [ UNDER CONSTRUCTION ]
+
+
+  Credits Screen
+  --------------
+    This screen displays the credits.  You can press [ESCAPE] to return
+    to the title screen.
+
+
+
+How To Play
+-----------
+  Destroying Comets
+  -----------------
+    As the comets fall towards your cities, you must solve their equations.
+
+    To destroy it:
+    --------------
+      First, figure out the answer to the equation.
+      For example, "3 x 4" would be "12"
+
+      Second, type in the answer.  As you type numbers on the keyboard, they
+      will appear in the "LED"-style display at the top center of the screen.
+
+      Finally, press [ENTER / RETURN].
+
+
+    The comet that has the number you entered as its answer will
+    be shot down by Tux the penguin.
+
+    Note: Sometimes more than one comet will have the same answer.
+          In this case, the comet closest to your cities will be
+          destroyed first.  [Perhaps all should be destroyed?]
+
+    Note: After typing [ENTER / RETURN], the "LED"-style display will
+          automatically reset to "000" for you, so you can answer the
+          next equation!
+
+
+  Correcting Your Answer
+  ----------------------
+    If you made a mistake as you typed in your answer, you can press
+    [BACKSPACE / DELETE] and the "LED"-style display at the top center
+    of the screen will reset to "000".
+
+
+  Using the On-Screen Keypad
+  --------------------------
+    If you launched the program with the "--keypad" (or "-k") option,
+    the game screen will also have an 11-key numeric keypad on the
+    center of the screen.  (It has a similar layout to most keyboard
+    number pads and calculators.)
+
+    Using the mouse pointer to click on the on-screen buttons acts
+    just like typing numbers on the keyboard.
+
+    This feature could be useful for computers with touchscreens,
+    or for players who cannot use a keyboard.
+
+
+  Losing A City
+  -------------
+    If a comet crashes into one of your cities before you had the
+    chance to answer its equation, the city's shields will be
+    destroyed.  If the city is hit by another comet, it will be
+    completely destroyed.
+
+    Once you lose all of your cities, the game will end.
+
+
+  Regaining Cities
+  ----------------
+    [ Rules will go here ]
+
+
+  Advancing Waves
+  ---------------
+
+
+
+Setting Game Options
+--------------------
+  [ UNDER CONSTRUCTION ]
+
+
+
+Setting Administrative Options
+------------------------------
+  "Tux, of Math Command" allows parents/teachers to adjust which parts
+  of the game options can be changed by the player.
+
+  For example, if you wish to, you can completely lock out all
+  "Division" questions.  The students/children will still be able to enable
+  and disable "Addition," "Subtraction," and "Multiplication" as they
+  wish.
+
+  On the other hand, you may wish to lock-in the other three kinds
+  of equations, so that the players cannot disable any of them.
+  All games will always have addition, subtraction and multiplication
+  problems, but will never had division problems.
+
+  [ UNDER CONSTRUCTION ]
+
+
+
+License
+-------
+  "Tux, of Math Command" is Free Software, distributable under the
+  GNU General Public License (GPL).  Please read COPYING.txt for more info.
+
+
+
+Credits
+-------
+  Designed by Sam "Criswell" Hart  <criswell at geekcomix.com>
+  Software by Bill Kendrick  <bill at newbreedsoftware.com>
+
+  Please see the game's "Credits" screen for a complete list of contributors.
+
+
+
+Software Used
+-------------
+  GNU C Compiler
+    http://www.gnu.org/
+
+  The GIMP
+    http://www.gimp.org/

Added: tuxmath/trunk/docs/TODO.txt
===================================================================
--- tuxmath/trunk/docs/TODO.txt	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/docs/TODO.txt	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,36 @@
+TODO.txt for "tuxmath"
+
+January 3, 2005
+
+
+Graphics:
+  * Change city graphics to something less violent.
+
+Interface:
+  * Add more sound effects
+  * Speech mode
+  * Add option for number-keys to control main menu and possible options
+    (for mouseless scenarios where arrow keys might not be the available...
+    is there such a thing as numeric-only keyboards for PCs???)
+  * High-score table?
+  * Disable controls if game is over
+
+Game Play:
+  * End-of-level calculations, bonuses and animations
+  * Finish tweaking equation-generation algorithm
+
+Documentation:
+  * Finish README.txt
+  * Finish INSTALL.txt
+
+Options:
+  * Require that at least one operator be selected, or display numbers 
+    instead of formulas if no operators are selected: "typing tutor" mode.
+  * Save options.
+  * Admin options screen / files
+  * Command-line options based on grade-level (?)
+
+Code:
+  * Optimize graphics blitting!!!
+  * Abstract SDL_BlitSurface() calls
+

Added: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/credits.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,541 @@
+/*
+  credits.c
+ 
+  For TuxMath
+  Contains the text of the credits display, as well
+  as the function which displays the credits in the game window.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+  
+  August 26, 2001 - March 7, 2005
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <SDL.h>
+#include "options.h"
+#include "images.h"
+#include "setup.h"
+#include "sounds.h"
+
+
+char * credit_text[] = {
+  "-TUX, OF MATH COMMAND",  /* '-' at beginning makes highlighted: */
+  "COPYRIGHT 2001-2005",
+  "",
+  "PART OF THE 'TUX4KIDS' PROJECT",
+  "",
+  "-DESIGNED BY",
+  "SAM 'CRISWELL' HART",
+  "",
+  "-LEAD PROGRAMMER",
+  "BILL KENDRICK",
+  "NEW BREED SOFTWARE",
+  "",
+  "-ADDITIONAL CODE",
+  "GLEN DITCHFIELD",
+  "MICHAEL BEHRISCH",
+  "DONNY VISZNEKI",
+  "",
+  "-LEAD ARTIST",
+  "SAM HART",
+  "",
+  "-ADDITIONAL ART",
+  "BILL KENDRICK",
+  "",
+  "-SOUND EFFECTS",
+  "TBA",
+  "",
+  "-MUSIC",
+  "BEYOND THE HORIZON",
+  "BY MYSTRA OF STONE ARTS, 1994",
+  "",
+  "CCCP MAIN",
+  "BY GROO OF CNCD, 1994",
+  "",
+  "SOFT BRILLIANCE",
+  "TJOPPBASS, 1994",
+  "",
+  "-PACKAGERS",
+  "JESSE ANDREWS",
+  "",
+  "-'TUX' THE PENGUIN CREATED BY",
+  "LARRY EWING",
+  "",
+  "-TESTERS",
+  "PETE SALZMAN",
+  "ST. CATHERINE ELEM., CINCINNATI, OH",
+  "WESTWOOD ELEMENTARY, CINCINNATI, OH",
+  "",
+  "",
+  "-WEBSITE",
+  "TUX4KIDS.COM",
+  "", /* The following blanks cause the screen to scroll to complete blank: */
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  "",
+  NULL
+};
+
+
+/* Some simple pixel-based characters we can blit quickly: */
+
+char chars[39][5][5] = {
+  {".###.",
+   "#..##",
+   "#.#.#",
+   "##..#",
+   ".###."},
+
+  {"..#..",
+   ".##..",
+   "..#..",
+   "..#..",
+   ".###."},
+
+  {".###.",
+   "....#",
+   "..##.",
+   ".#...",
+   "#####"},
+
+  {".###.",
+   "....#",
+   "..##.",
+   "....#",
+   ".###."},
+
+  {"...#.",
+   "..##.",
+   ".#.#.",
+   "#####",
+   "...#."},
+
+  {"#####",
+   "#....",
+   "####.",
+   "....#",
+   "####."},
+
+  {".###.",
+   "#....",
+   "####.",
+   "#...#",
+   ".###."},
+
+  {"#####",
+   "....#",
+   "...#.",
+   "..#..",
+   ".#..."},
+
+  {".###.",
+   "#...#",
+   ".###.",
+   "#...#",
+   ".###."},
+
+  {".###.",
+   "#...#",
+   ".####",
+   "....#",
+   ".###."},
+
+  {".###.",
+   "#...#",
+   "#####",
+   "#...#",
+   "#...#"},
+
+  {"####.",
+   "#...#",
+   "####.",
+   "#...#",
+   "####."},
+  
+  {".###.",
+   "#....",
+   "#....",
+   "#....",
+   ".###."},
+  
+  {"####.",
+   "#...#",
+   "#...#",
+   "#...#",
+   "####."},
+  
+  {"#####",
+   "#....",
+   "###..",
+   "#....",
+   "#####"},
+  
+  {"#####",
+   "#....",
+   "###..",
+   "#....",
+   "#...."},
+  
+  {".###.",
+   "#....",
+   "#.###",
+   "#...#",
+   ".###."},
+  
+  {"#...#",
+   "#...#",
+   "#####",
+   "#...#",
+   "#...#"},
+  
+  {".###.",
+   "..#..",
+   "..#..",
+   "..#..",
+   ".###."},
+  
+  {"....#",
+   "....#",
+   "....#",
+   "#...#",
+   ".###."},
+  
+  {"#..#.",
+   "#.#..",
+   "##...",
+   "#.#..",
+   "#..#."},
+  
+  {"#....",
+   "#....",
+   "#....",
+   "#....",
+   "#####"},
+  
+  {"#...#",
+   "##.##",
+   "#.#.#",
+   "#...#",
+   "#...#"},
+  
+  {"#...#",
+   "##..#",
+   "#.#.#",
+   "#..##",
+   "#...#"},
+  
+  {".###.",
+   "#...#",
+   "#...#",
+   "#...#",
+   ".###."},
+  
+  {"####.",
+   "#...#",
+   "####.",
+   "#....",
+   "#...."},
+  
+  {".###.",
+   "#...#",
+   "#.#.#",
+   "#..#.",
+   ".##.#"},
+  
+  {"####.",
+   "#...#",
+   "####.",
+   "#...#",
+   "#...#"},
+  
+  {".###.",
+   "#....",
+   ".###.",
+   "....#",
+   ".###."},
+  
+  {"#####",
+   "..#..",
+   "..#..",
+   "..#..",
+   "..#.."},
+  
+  {"#...#",
+   "#...#",
+   "#...#",
+   "#...#",
+   ".###."},
+  
+  {"#...#",
+   "#...#",
+   ".#.#.",
+   ".#.#.",
+   "..#.."},
+  
+  {"#...#",
+   "#...#",
+   "#.#.#",
+   "##.##",
+   "#...#"},
+  
+  {"#...#",
+   ".#.#.",
+   "..#..",
+   ".#.#.",
+   "#...#"},
+
+  {"#...#",
+   ".#.#.",
+   "..#..",
+   "..#..",
+   "..#.."},
+  
+  {"#####",
+   "...#.",
+   "..#..",
+   ".#...",
+   "#####"},
+  
+  {".....",
+   ".....",
+   ".....",
+   "..#..",
+   ".#..."},
+
+  {".....",
+   ".....",
+   ".....",
+   "..#..",
+   "..#.."},
+  
+  {"..#..",
+   "..#..",
+   ".....",
+   ".....",
+   "....."}
+};
+
+
+void draw_text(char * str, int offset);
+
+
+int line;
+
+
+int credits(void)
+{
+  int done, quit, scroll;
+  SDL_Rect src, dest;
+  SDL_Event event;
+  Uint32 last_time, now_time;
+  SDLKey key;
+  
+  
+  /* Clear window: */
+  
+  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+  
+  
+  /* Draw title: */
+  
+  dest.x = (screen->w - images[IMG_TITLE]->w) / 2;
+  dest.y = 0;
+  dest.w = images[IMG_TITLE]->w;
+  dest.h = images[IMG_TITLE]->h;
+  
+  SDL_BlitSurface(images[IMG_TITLE], NULL, screen, &dest);
+  
+  
+  /* --- MAIN OPTIONS SCREEN LOOP: --- */
+  
+  done = 0;
+  quit = 0;
+  scroll = 0;
+  line = 0;
+  
+  do
+    {
+      last_time = SDL_GetTicks();
+      
+      
+      /* Handle any incoming events: */
+      
+      while (SDL_PollEvent(&event) > 0)
+	{
+	  if (event.type == SDL_QUIT)
+	    {
+	      /* Window close event - quit! */
+	      
+	      quit = 1;
+	      done = 1;
+	    }
+	  else if (event.type == SDL_KEYDOWN)
+	    {
+	      key = event.key.keysym.sym;
+	      
+	      if (key == SDLK_ESCAPE)
+		{
+		  /* Escape key - quit! */
+		  
+		  done = 1;
+		}
+	    }
+	}
+
+      
+      /* Scroll: */
+
+      src.x = 0;
+      src.y = (images[IMG_TITLE]->h) + 2;
+      src.w = screen->w;
+      src.h = screen->h - (images[IMG_TITLE]->h);
+      
+      dest.x = 0;
+      dest.y = (images[IMG_TITLE]->h);
+      dest.w = src.w;
+      dest.h = src.h;
+      
+      SDL_BlitSurface(screen, &src, screen, &dest);
+
+      dest.x = 0;
+      dest.y = (screen->h) - 2;
+      dest.w = screen->w;
+      dest.h = 2;
+
+      SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0));
+      
+      
+      scroll++;
+      
+      draw_text(credit_text[line], scroll);
+      
+
+      if (scroll >= 9)
+	{
+	  scroll = 0;
+	  line++;
+	  
+	  if (credit_text[line] == NULL)
+	    done = 1;
+	}
+      
+      
+      SDL_Flip(screen);
+      
+      
+      /* Pause (keep frame-rate event) */
+      
+      now_time = SDL_GetTicks();
+      if (now_time < last_time + (1000 / 20))
+	{
+	  SDL_Delay(last_time + (1000 / 20) - now_time);
+	}
+    }
+  while (!done);
+  
+  
+  /* Return the chosen command: */
+  
+  return quit;
+}
+
+
+void draw_text(char * str, int offset)
+{
+  int i, c, x, y, cur_x, start, hilite;
+  SDL_Rect dest;
+  Uint8 r, g, b;
+
+
+  if (str[0] == '-')
+  {
+    start = 1;
+    hilite = 1;
+  }
+  else
+  {
+    start = 0;
+    hilite = 0;
+  }
+  
+  
+  cur_x = (screen->w - ((strlen(str) - start) * 18)) / 2;
+  
+  for (i = start; i < strlen(str); i++)
+    {
+      c = -1;
+      
+      if (str[i] >= '0' && str[i] <= '9')
+	c = str[i] - '0';
+      else if (str[i] >= 'A' && str[i] <= 'Z')
+	c = str[i] - 'A' + 10;
+      else if (str[i] == ',')
+	c = 36;
+      else if (str[i] == '.')
+	c = 37;
+      else if (str[i] == '\'')
+	c = 38;
+      
+      
+      if (c != -1)
+	{
+	  for (y = 0; y < 5; y++)
+	    {
+	      if (hilite == 0)
+	      {
+	        r = 255 - ((line * y) % 256);
+	        g = 255 / (y + 2);
+	        b = (line * line * 2) % 256;
+	      }
+	      else
+	      {
+		r = 128;
+		g = 192;
+		b = 255 - (y * 40);
+	      }
+	      
+	      for (x = 0; x < 5; x++)
+		{
+		  if (chars[c][y][x] == '#')
+		    {
+		      dest.x = cur_x + (x * 3);
+		      dest.y = ((screen->h - (5 * 3)) + (y * 3) +
+				(18 - offset * 2));
+		      dest.w = 3;
+		      dest.h = 3;
+		      
+		      SDL_FillRect(screen, &dest,
+				   SDL_MapRGB(screen->format, r, g, b));
+		    }
+		}
+	    }
+	}
+      
+      
+      /* Move virtual cursor: */
+      
+      cur_x = cur_x + 18;
+    }
+}

Added: tuxmath/trunk/src/credits.h
===================================================================
--- tuxmath/trunk/src/credits.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/credits.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,25 @@
+/*
+  credits.h
+
+  For TuxMath
+  Contains the text of the credits display, as well
+  as the function which displays the credits in the game window.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - August 28, 2001
+*/
+
+
+#ifndef CREDITS_H
+#define CREDITS_H
+
+int credits(void);
+
+#endif

Added: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/game.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,1542 @@
+/*
+  game.c
+
+  For TuxMath
+  The main game loop!
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 18, 2004
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <SDL.h>
+#ifndef NOSOUND
+#include <SDL_mixer.h>
+#endif
+#include <SDL_image.h>
+#include "game.h"
+#include "images.h"
+#include "setup.h"
+#include "sounds.h"
+#include "playsound.h"
+
+
+#define FPS (1000 / 15)   /* 15 fps max */
+
+#define CITY_EXPL_START 3 * 5  /* Must be mult. of 5 (number of expl frames) */
+#define ANIM_FRAME_START 4 * 2 /* Must be mult. of 2 (number of tux frames) */
+#define GAMEOVER_COUNTER_START 75
+#define LEVEL_START_WAIT_START 20
+#define LASER_START 5
+
+char operchars[NUM_OPERS] = {
+  "+-*/"
+};
+
+char * oper_opts[NUM_OPERS] = {
+  "add", "subtract", "multiply", "divide"
+};
+
+char * oper_alt_opts[NUM_OPERS] = {
+  "addition", "subtraction", "multiplication", "division"
+};
+
+typedef struct range_type {
+  int min;
+  int max;
+} range_type;
+
+static range_type ranges[NUM_Q_RANGES] = {
+  {0, 5},
+  {6, 12},
+  {13, 20}
+};
+
+#define ANSWER_LEN 5
+#define FORMULA_LEN 8
+typedef struct comet_type {
+  int alive;
+  int expl;
+  int city;
+  float x, y;
+  int eq1, oper, eq2;
+  char formula[FORMULA_LEN];
+  int answer;
+  char answer_str[ANSWER_LEN];
+} comet_type;
+
+/* Local (to game.c) 'globals': */
+
+static int wave, score, pre_wave_score, num_attackers;
+static int digits[3];
+static comet_type comets[MAX_COMETS];
+static city_type cities[NUM_CITIES];
+static laser_type laser;
+static SDL_Surface * bkgd;
+static int last_bkgd;
+
+
+
+/* Local function prototypes: */
+
+static void reset_level(void);
+static void add_comet(void);
+static void draw_numbers(char * str, int x);
+static int pause_game(void);
+static void draw_line(int x1, int y1, int x2, int y2, int r, int g, int b);
+static void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
+static void draw_console_image(int i);
+static void add_score(int inc);
+static int pick_operand(int min);
+static int in_range(int n);
+
+
+
+/* --- MAIN GAME FUNCTION!!! --- */
+
+int game(void)
+{
+  int i, j, num, img, done, quit, frame, lowest, lowest_y, kx, ky,
+    tux_img, old_tux_img, tux_pressing, tux_anim, tux_anim_frame,
+    tux_same_counter, level_start_wait, num_cities_alive, doing_answer,
+    num_comets_alive, paused, demo_countdown, picked_comet, answer_digit,
+    gameover;
+  SDL_Event event;
+  Uint32 last_time, now_time;
+  SDLKey key;
+  SDL_Rect src, dest;
+  char str[64];
+  char* comet_str;
+
+
+  /* Clear window: */
+  
+  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+  SDL_Flip(screen);
+  
+  
+  /* --- MAIN GAME LOOP: --- */
+
+  done = 0;
+  quit = 0;
+  
+  
+  /* Prepare to start the game: */
+  
+  wave = 1;
+  score = 0;
+  gameover = 0;
+  demo_countdown = 1000;
+  level_start_wait = LEVEL_START_WAIT_START;
+
+  
+  /* (Create and position cities) */
+  
+  for (i = 0; i < NUM_CITIES; i++)
+    {
+      cities[i].alive = 1;
+      cities[i].expl = 0;
+      cities[i].shields = 1;
+     
+
+      /* Left vs. Right - makes room for Tux and the console */
+
+      if (i < NUM_CITIES / 2)
+	{
+	  cities[i].x = (((screen->w / (NUM_CITIES + 1)) * i) +
+			 ((images[IMG_CITY_BLUE] -> w) / 2));
+	}
+      else
+	{
+	  cities[i].x = (screen->w -
+			 ((((screen->w / (NUM_CITIES + 1)) *
+			    (i - (NUM_CITIES / 2)) +
+			    ((images[IMG_CITY_BLUE] -> w) / 2)))));
+	}
+    }
+
+  num_cities_alive = NUM_CITIES;
+  num_comets_alive = 0;
+
+
+  /* (Clear laser) */
+
+  laser.alive = 0;
+
+  
+  /* Reset remaining stuff: */
+ 
+  bkgd = NULL;
+  last_bkgd = -1;
+  reset_level();
+  
+  
+  /* --- MAIN GAME LOOP!!! --- */
+  
+  frame = 0;
+  paused = 0;
+  picked_comet = -1;
+  answer_digit = 0;
+  doing_answer = 0;
+  tux_img = IMG_TUX_RELAX1;
+  tux_anim = -1;
+  tux_anim_frame = 0;
+  tux_same_counter = 0;
+
+  
+  do
+    {
+      frame++;
+      last_time = SDL_GetTicks();
+
+
+      /* Handle any incoming events: */
+     
+      old_tux_img = tux_img;
+      tux_pressing = 0;
+
+      while (SDL_PollEvent(&event) > 0)
+	{
+	  if (event.type == SDL_QUIT)
+	    {
+	      /* Window close event - quit! */
+	      
+	      quit = 1;
+	      done = 1;
+	    }
+	  else if (event.type == SDL_KEYDOWN)
+	    {
+	      key = event.key.keysym.sym;
+	      
+	      
+	      if (key == SDLK_ESCAPE)
+		{
+		  /* Escape key - quit! */
+		  
+		  done = 1;
+		}
+	      else if (key == SDLK_TAB ||
+		       key == SDLK_p)
+		{
+		  /* [TAB] or [P]: Pause! */
+		  
+		  paused = 1;
+		}
+	      
+	      
+	      if (level_start_wait > 0 || demo_mode)
+		{
+		  /* Eat other keys until level start wait has passed,
+		     or if game is in demo mode: */
+		  
+		  key = SDLK_UNKNOWN;
+		}
+	      
+	      
+	      if (key >= SDLK_0 && key <= SDLK_9)
+		{
+		  /* [0]-[9]: Add a new digit: */
+		  
+		  digits[0] = digits[1];
+		  digits[1] = digits[2];
+		  digits[2] = key - SDLK_0;
+		  
+		  tux_pressing = 1;
+		}
+	      else if (key >= SDLK_KP0 && key <= SDLK_KP9)
+		{
+		  /* Keypad [0]-[9]: Add a new digit: */
+		  
+		  digits[0] = digits[1];
+		  digits[1] = digits[2];
+		  digits[2] = key - SDLK_KP0;
+		  
+		  tux_pressing = 1;
+		}
+	      else if (key == SDLK_BACKSPACE ||
+		       key == SDLK_CLEAR ||
+		       key == SDLK_DELETE)
+		{
+		  /* [BKSP]: Clear digits! */
+		  
+		  digits[0] = 0;
+		  digits[1] = 0;
+		  digits[2] = 0;
+		  
+		  tux_pressing = 1;
+		}
+	      else if (key == SDLK_RETURN ||
+		       key == SDLK_KP_ENTER ||
+		       key == SDLK_SPACE)
+		{
+		  /* [ENTER]: Accept digits! */
+		 
+		  doing_answer = 1;
+		}
+	    }
+	  else if (event.type == SDL_MOUSEBUTTONDOWN)
+	    {
+              if (level_start_wait == 0 && !demo_mode && use_keypad)
+	      {
+	        if (event.button.x >=
+	            (screen->w / 2) - (images[IMG_KEYPAD]->w / 2) &&
+                    event.button.x <=
+		    (screen->w / 2) + (images[IMG_KEYPAD]->w / 2) &&
+		    event.button.y >= 
+		    (screen->h / 2) - (images[IMG_KEYPAD]->h / 2) &&
+		    event.button.y <=
+		    (screen->h / 2) + (images[IMG_KEYPAD]->h / 2))
+	        {
+		  kx = (event.button.x -
+		        ((screen->w / 2) - (images[IMG_KEYPAD]->w / 2)));
+		  ky = (event.button.y -
+		        ((screen->h / 2) - (images[IMG_KEYPAD]->h / 2)));
+
+		  tux_pressing = 1;
+
+
+		  if (ky >= (images[IMG_KEYPAD]->h / 4) * 3)
+		  {
+	            /* Bottom row is special (has Enter key) */
+			  
+	            if (kx >= (images[IMG_KEYPAD]->w / 3))
+		    {
+		      /* "Enter" key */
+
+		      doing_answer = 1;
+
+		      tux_pressing = 0;
+		    }
+                    else
+		    {
+		      /* "0" key */
+			    
+		      digits[0] = digits[1];
+		      digits[1] = digits[2];
+		      digits[2] = 0;
+		    }
+		  }
+		  else
+		  {
+	            digits[0] = digits[1];
+		    digits[1] = digits[2];
+		    digits[2] = (((kx / (images[IMG_KEYPAD]->w / 3)) + 1) +
+				 6 - ((ky / (images[IMG_KEYPAD]->h / 4) * 3)));
+		  }
+	        }
+	      }
+	    }
+	}
+
+
+
+      if (demo_mode)
+      {
+        /* Demo mdoe! */
+
+        if (picked_comet == -1 && (rand() % 10) < 3)
+        {
+	  /* Demo mode!  Randomly pick a comet to destroy: */
+	
+	  picked_comet = (rand() % MAX_COMETS);
+	
+	  if (!comets[picked_comet].alive || comets[picked_comet].y < 80)
+            picked_comet = -1;
+	  else
+	  {
+	    if (comets[picked_comet].answer >= 100)
+	      answer_digit = 0;
+	    else if (comets[picked_comet].answer >= 10)
+	      answer_digit = 1;
+	    else
+              answer_digit = 2;
+	  }
+        }
+      
+
+        /* Add a digit: */
+
+	if (picked_comet != -1 && (frame % 5) == 0 && (rand() % 10) < 8)
+	{
+          tux_pressing = 1;
+	  
+          if (answer_digit < 3)
+	  {
+	    digits[0] = digits[1];
+	    digits[1] = digits[2];
+
+	    if (answer_digit == 0)
+	    {
+	      digits[2] = comets[picked_comet].answer / 100;
+	    }
+	    else if (answer_digit == 1)
+	    {
+	      digits[2] = (comets[picked_comet].answer % 100) / 10;
+	    }
+	    else if (answer_digit == 2)
+	    {
+	      digits[2] = (comets[picked_comet].answer % 10);
+	    }
+	    
+            answer_digit++;
+	  }
+	  else
+	  {
+            /* "Press Return" */
+
+	    doing_answer = 1;
+	    picked_comet = -1;
+	  }
+	}
+
+
+        /* Count down counter: */
+	
+	demo_countdown--;
+	
+	if (demo_countdown <= 0 || num_cities_alive == 0)
+          done = 1;
+      }
+      
+      
+      /* Handle answer: */
+      
+      if (doing_answer)
+      {
+	doing_answer = 0;
+
+	num = (digits[0] * 100 +
+	       digits[1] * 10 +
+	       digits[2]);
+	
+	
+	/*  Pick the lowest 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 < COMET_EXPL_END && 
+	        comets[i].answer == num &&
+	        comets[i].y > lowest_y)
+	      {
+	        lowest = i;
+	        lowest_y = comets[i].y;
+	      }
+	  }
+	
+	
+	/* If there was an comet with this answer, destroy it! */
+	
+	if (lowest != -1)
+	  {
+            /* Destroy comet: */
+		  
+	    comets[lowest].expl = COMET_EXPL_START;
+	    
+
+	    /* Fire laser: */
+	    
+	    laser.alive = LASER_START;
+	    
+	    laser.x1 = screen->w / 2;
+	    laser.y1 = screen->h;
+	    
+	    laser.x2 = comets[lowest].x;
+	    laser.y2 = comets[lowest].y;
+	    
+	    playsound(SND_LASER);
+	    playsound(SND_SIZZLE);
+	    
+	    /* 50% of the time.. */
+	    
+	    if ((rand() % 10) < 5)
+	      {
+	        /* ... pick an animation to play: */
+	        
+	        if ((rand() % 10) < 5)
+	          tux_anim = IMG_TUX_YES1;
+	        else
+	          tux_anim = IMG_TUX_YAY1;
+	        
+	        tux_anim_frame = ANIM_FRAME_START;
+	      }
+
+
+	    /* Increment score: */
+
+	    /* [ add = 25, sub = 50, mul = 75, div = 100 ] */
+	    /* [ the higher the better ] */
+
+	    add_score(((25 * (comets[lowest].oper + 1)) *
+		        (screen->h - comets[lowest].y + 1)) /
+		      screen->h);
+	  }
+	else
+	  {
+	    /* Didn't hit anything! */
+	    
+	    laser.alive = LASER_START;
+	    
+	    laser.x1 = screen->w / 2;
+	    laser.y1 = screen->h;
+	    
+	    laser.x2 = laser.x1;
+	    laser.y2 = 0;
+	    
+	    playsound(SND_LASER);
+	    playsound(SND_BUZZ);
+	    
+	    if ((rand() % 10) < 5)
+	      tux_img = IMG_TUX_DRAT;
+	    else
+	      tux_img = IMG_TUX_YIPE;
+	  }
+	
+	
+	/* Clear digits: */
+	
+	digits[0] = 0;
+	digits[1] = 0;
+	digits[2] = 0;
+      }
+
+      
+      /* Handle start-wait countdown: */
+      
+      if (level_start_wait > 0)
+	{
+	  level_start_wait--;
+	  
+	  if (level_start_wait > LEVEL_START_WAIT_START / 4)
+	    tux_img = IMG_TUX_RELAX1;
+	  else if (level_start_wait > 0)
+	    tux_img = IMG_TUX_RELAX2;
+	  else
+	    tux_img = IMG_TUX_SIT;
+	  
+	  if (level_start_wait == LEVEL_START_WAIT_START / 4)
+	    {
+	      playsound(SND_ALARM);
+	    }
+	}
+
+      
+      /* If Tux pressed a button, pick a new (different!) stance: */
+	  
+      if (tux_pressing)
+      {
+        do
+	{
+	  tux_img = IMG_TUX_CONSOLE1 + (rand() % 4);
+	}
+        while (tux_img == old_tux_img);
+
+	playsound(SND_CLICK);
+      }
+      
+      
+      /* If Tux is being animated, show the animation: */
+
+      if (tux_anim != -1)
+      {
+	tux_anim_frame--;
+
+	if (tux_anim_frame < 0)
+          tux_anim = -1;
+	else
+	  tux_img = tux_anim + 1 - (tux_anim_frame / (ANIM_FRAME_START / 2));
+      }
+
+
+      /* Reset Tux to sitting if he's been doing nothing for a while: */
+
+      if (old_tux_img == tux_img)
+      {
+	tux_same_counter++;
+
+	if (tux_same_counter >= 20)
+	{
+          tux_img = IMG_TUX_SIT;
+	}
+      }
+      else
+	tux_same_counter = 0;
+
+
+      /* Handle comets: */
+     
+      num_comets_alive = 0;
+      
+      for (i = 0; i < MAX_COMETS; i++)
+	{
+	  if (comets[i].alive)
+	    {
+	      num_comets_alive++;
+
+	      comets[i].x = comets[i].x + 0;
+	      comets[i].y = comets[i].y + (speed * wave);
+	      
+	      if (comets[i].y >= (screen->h - images[IMG_CITY_BLUE]->h) &&
+	          comets[i].expl < COMET_EXPL_END)
+	      {
+		/* Disable shields or destroy city: */
+		      
+		if (cities[comets[i].city].shields)
+		{
+	          cities[comets[i].city].shields = 0;
+		  playsound(SND_SHIELDSDOWN);
+		}
+		else
+		{
+		  cities[comets[i].city].expl = CITY_EXPL_START;
+		  playsound(SND_EXPLOSION);
+		}
+
+		tux_anim = IMG_TUX_FIST1;
+		tux_anim_frame = ANIM_FRAME_START;
+
+
+		/* Destroy comet: */
+
+		comets[i].expl = COMET_EXPL_START;
+	      }
+
+
+	      /* Handle comet explosion animation: */
+
+	      if (comets[i].expl >= COMET_EXPL_END)
+	      {
+		comets[i].expl--;
+
+		if (comets[i].expl < COMET_EXPL_END)
+	          comets[i].alive = 0;
+	      }
+	    }
+	}
+
+
+      /* Handle laser: */
+
+      if (laser.alive > 0)
+	laser.alive--;
+      
+     
+      /* Comet time! */
+
+      if (level_start_wait == 0 && (frame % 20) == 0 &&
+	  gameover == 0)
+      {
+	if (num_attackers > 0)
+	{
+          /* More comets to add during this wave! */
+		
+	  if ((rand() % 2) == 0 || num_comets_alive == 0)
+	  {
+            add_comet();
+	    num_attackers--;
+	  }
+	}
+	else
+	{
+          if (num_comets_alive == 0)
+	  {
+            /* Time for the next wave! */
+
+	    /* FIXME: End of level stuff goes here */
+
+	    if (num_cities_alive > 0)
+	    {
+              /* Go on to the next wave: */
+		  
+              wave++;
+	      reset_level();
+	    }
+	    else
+	    {
+              /* No more cities!  Game over! */
+
+	      gameover = GAMEOVER_COUNTER_START;
+	    }
+	  }
+	}
+      }
+
+
+      /* Handle cities: */
+     
+      num_cities_alive = 0;
+
+      for (i = 0; i < NUM_CITIES; i++)
+	{
+	  if (cities[i].alive)
+	    {
+	      num_cities_alive++;
+
+
+	      /* Handle animated explosion: */
+
+	      if (cities[i].expl)
+		{
+		  cities[i].expl--;
+		  
+		  if (cities[i].expl == 0)
+		    cities[i].alive = 0;
+		}
+	    }
+	}
+
+
+      /* Handle game-over: */
+
+      if (gameover > 0)
+      {
+	gameover--;
+
+	if (gameover <= 0)
+          done = 1;
+      }
+      
+      
+      /* Clear screen: */
+     
+      if (bkgd == NULL)
+      {
+        dest.x = 0;
+        dest.y = 0;
+        dest.w = screen->w;
+        dest.h = ((screen->h) / 4) * 3;
+
+        SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format,
+		     64,
+		     64 + ((wave * 32) % 192),
+		     128 - ((wave * 16) % 128)));
+
+
+        dest.x = 0;
+        dest.y = ((screen->h) / 4) * 3;
+        dest.w = screen->w;
+        dest.h = (screen->h) / 4;
+
+        SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 64, 96, 64));
+      }
+      else
+        SDL_BlitSurface(bkgd, NULL, screen, NULL);
+
+
+      /* Draw "Demo" */
+
+      if (demo_mode)
+      {
+	dest.x = (screen->w - images[IMG_DEMO]->w) / 2;
+	dest.y = (screen->h - images[IMG_DEMO]->h) / 2;
+	dest.w = images[IMG_DEMO]->w;
+	dest.h = images[IMG_DEMO]->h;
+
+	SDL_BlitSurface(images[IMG_DEMO], NULL, screen, &dest);
+      }
+
+
+      /* Draw wave: */
+
+      dest.x = 0;
+      dest.y = 0;
+      dest.w = images[IMG_WAVE]->w;
+      dest.h = images[IMG_WAVE]->h;
+
+      SDL_BlitSurface(images[IMG_WAVE], NULL, screen, &dest);
+
+      sprintf(str, "%d", wave);
+      draw_numbers(str, images[IMG_WAVE]->w + (images[IMG_NUMBERS]->w / 10));
+
+
+      /* Draw score: */
+
+      dest.x = (screen->w - ((images[IMG_NUMBERS]->w / 10) * 7) -
+	        images[IMG_SCORE]->w);
+      dest.y = 0;
+      dest.w = images[IMG_SCORE]->w;
+      dest.h = images[IMG_SCORE]->h;
+
+      SDL_BlitSurface(images[IMG_SCORE], NULL, screen, &dest);
+      
+      sprintf(str, "%.6d", score);
+      draw_numbers(str, screen->w - ((images[IMG_NUMBERS]->w / 10) * 6));
+      
+      
+      /* Draw cities: */
+      
+      for (i = 0; i < NUM_CITIES; i++)
+	{
+	  /* Decide which image to display: */
+	 
+	  if (cities[i].alive)
+	    {
+	      if (cities[i].expl == 0)
+		img = IMG_CITY_BLUE;
+	      else
+		img = (IMG_CITY_BLUE_EXPL5 -
+	               (cities[i].expl / (CITY_EXPL_START / 5)));
+	    }
+	  else
+	    img = IMG_CITY_BLUE_DEAD;
+	  
+	  
+	  /* Change image to appropriate color: */
+	  
+	  img = img + ((wave % MAX_CITY_COLORS) *
+		       (IMG_CITY_GREEN - IMG_CITY_BLUE));
+	  /* img = img + ((i % MAX_CITY_COLORS) *
+	               (IMG_CITY_GREEN - IMG_CITY_BLUE)); */
+	  
+	  
+	  /* Draw it! */
+	  
+	  dest.x = cities[i].x - (images[img]->w / 2);
+	  dest.y = (screen->h) - (images[img]->h);
+	  dest.w = (images[img]->w);
+	  dest.h = (images[img]->h);
+	  
+	  SDL_BlitSurface(images[img], NULL,
+			  screen, &dest);
+
+
+	  /* Draw sheilds: */
+
+	  if (cities[i].shields)
+	  {
+            for (j = (frame % 3); j < images[IMG_SHIELDS]->h; j = j + 3)
+	    {
+	      src.x = 0;
+	      src.y = j;
+	      src.w = images[IMG_SHIELDS]->w;
+	      src.h = 1;
+
+	      dest.x = cities[i].x - (images[IMG_SHIELDS]->w / 2);
+	      dest.y = (screen->h) - (images[IMG_SHIELDS]->h) + j;
+	      dest.w = src.w;
+	      dest.h = src.h;
+
+	      SDL_BlitSurface(images[IMG_SHIELDS], &src, screen, &dest);
+	    }
+	  }
+	}
+
+
+      /* Draw comets: */
+      
+      for (i = 0; i < MAX_COMETS; i++)
+	{
+	  if (comets[i].alive)
+	    { 
+	      if (comets[i].expl < COMET_EXPL_END)
+	      {
+	        /* Decide which image to display: */
+	        img = IMG_COMET1 + ((frame + i) % 3);
+
+		/* Display the formula (flashing, in the bottom half
+		   of the screen) */
+		if (comets[i].y < screen->h / 2 || frame % 8 < 6)
+		  comet_str = comets[i].formula;
+		else comet_str = NULL;
+	      }
+	      else
+	      {
+		img = comets[i].expl;
+		comet_str = comets[i].answer_str;
+	      }
+	      
+	      /* Draw it! */
+	      dest.x = comets[i].x - (images[img]->w / 2);
+	      dest.y = comets[i].y - images[img]->h;
+	      dest.w = images[img]->w;
+	      dest.h = images[img]->h;
+	      
+	      SDL_BlitSurface(images[img], NULL, screen, &dest);
+	      if (comet_str != NULL)
+		draw_nums(comet_str, comets[i].x, comets[i].y);
+	    }
+	}
+
+
+      /* Draw laser: */
+
+      if (laser.alive)
+      {
+	draw_line(laser.x1, laser.y1, laser.x2, laser.y2,
+		  255 / (LASER_START - laser.alive),
+		  192 / (LASER_START - laser.alive),
+		  64);
+      }
+
+
+      /* Draw numeric keypad: */
+
+      if (use_keypad)
+      {
+        dest.x = (screen->w - images[IMG_KEYPAD]->w) / 2;
+        dest.y = (screen->h - images[IMG_KEYPAD]->h) / 2;
+        dest.w = images[IMG_KEYPAD]->w;
+        dest.h = images[IMG_KEYPAD]->h;
+
+        SDL_BlitSurface(images[IMG_KEYPAD], NULL, screen, &dest);
+      }
+
+
+      /* Draw console & tux: */
+
+      draw_console_image(IMG_CONSOLE);
+
+      if (gameover > 0)
+      {
+	tux_img = IMG_TUX_FIST1 + ((frame / 2) % 2);
+      }
+
+      draw_console_image(tux_img);
+
+
+      /* Draw LED digits at the top of the screen: */
+      
+      for (i = 0; i < 3; i++)
+	{
+	  src.x = digits[i] * ((images[IMG_LEDNUMS]->w) / 10);
+	  src.y = 0;
+	  src.w = (images[IMG_LEDNUMS]->w) / 10;
+	  src.h = images[IMG_LEDNUMS]->h;
+	  
+	  dest.x = (((screen->w - (((images[IMG_LEDNUMS]->w) / 10) * 3)) / 2) +
+		    (i * (images[IMG_LEDNUMS]->w) / 10));
+	  dest.y = 4;
+	  dest.w = src.w;
+	  dest.h = src.h;
+	  
+	  SDL_BlitSurface(images[IMG_LEDNUMS], &src, screen, &dest);
+	}
+
+
+      /* Draw "Game Over" */
+
+      if (gameover > 0)
+      {
+	dest.x = (screen->w - images[IMG_GAMEOVER]->w) / 2;
+	dest.y = (screen->h - images[IMG_GAMEOVER]->h) / 2;
+	dest.w = images[IMG_GAMEOVER]->w;
+	dest.h = images[IMG_GAMEOVER]->h;
+	
+        SDL_BlitSurface(images[IMG_GAMEOVER], NULL, screen, &dest);
+      }
+      
+      
+      /* Swap buffers: */
+      
+      SDL_Flip(screen);
+
+
+      /* If we're in "PAUSE" mode, pause! */
+
+      if (paused)
+        {
+	  quit = pause_game();
+	  paused = 0;
+        }
+
+      
+      /* Keep playing music: */
+      
+#ifndef NOSOUND
+      if (use_sound)
+	{
+	  if (!Mix_PlayingMusic())
+	    Mix_PlayMusic(musics[MUS_GAME + (rand() % 3)], 0);
+	}
+#endif
+      
+      
+      /* Pause (keep frame-rate event) */
+      
+      now_time = SDL_GetTicks();
+      if (now_time < last_time + FPS)
+	SDL_Delay(last_time + FPS - now_time);
+    }
+  while (!done && !quit);
+
+  
+  /* Free background: */
+
+  if (bkgd != NULL)
+    SDL_FreeSurface(bkgd);
+
+
+
+  /* Stop music: */
+#ifndef NOSOUND
+  if (use_sound)
+  {
+    if (Mix_PlayingMusic())
+    {
+      Mix_HaltMusic();
+    }
+  }
+#endif
+  
+  
+  /* Return the chosen command: */
+  
+  return quit;
+}
+
+
+/* Reset stuff for the next level! */
+
+void reset_level(void)
+{
+  char fname[1024];
+  int i;
+  
+  
+  /* Clear all comets: */
+  
+  for (i = 0; i < MAX_COMETS; i++)
+    comets[i].alive = 0;
+  
+  
+  /* Clear LED digits: */
+  
+  digits[0] = 0;
+  digits[1] = 0;
+  digits[2] = 0;
+
+
+  /* Load random background image: */
+
+  do
+  {
+    /* Don't pick the same one as last time... */
+
+    i = rand() % NUM_BKGDS;
+  }
+  while (i == last_bkgd);
+
+  last_bkgd = i;
+
+  sprintf(fname, "%s/images/backgrounds/%d.jpg", DATA_PREFIX, i);
+
+  if (bkgd != NULL)
+    SDL_FreeSurface(bkgd);
+
+  
+  if (use_bkgd == 1)
+  {
+    bkgd = IMG_Load(fname);
+    if (bkgd == NULL)
+    {
+      fprintf(stderr,
+	      "\nWarning: Could not load background image:\n"
+	      "%s\n"
+	      "The Simple DirectMedia error that ocurred was: %s\n",
+	      fname, SDL_GetError());
+      use_bkgd = 0;
+    }
+  }
+
+
+  /* Record score before this wave: */
+
+  pre_wave_score = score;
+
+
+  /* Set number of attackers for this wave: */
+
+  num_attackers = 2 * wave;  /* FIXME: Is this good? */
+}
+
+
+/* Add an comet to the game (if there's room): */
+
+void add_comet(void)
+{
+  static int prev_city = -1;
+  int i, found;
+  
+
+  /* Look for a free comet slot: */
+  
+  found = -1;
+  
+  for (i = 0; i < MAX_COMETS && found == -1; i++)
+    {
+      if (comets[i].alive == 0)
+	{
+	  found = i;
+	}
+    }
+  
+  
+  if (found != -1)
+    {
+      comets[found].alive = 1;
+
+
+      /* Pick a city to attack that was not attacked last time */
+      /* (so formulas are less likely to overlap). */
+      do 
+	i = rand() % NUM_CITIES;
+      while (i == prev_city);
+      prev_city = i;
+     
+
+      /* Set in to attack that city: */
+      
+      comets[found].city = i; 
+
+
+      /* Start at the top, above the city in question: */
+      
+      comets[found].x = cities[i].x;
+      comets[found].y = 0;
+
+
+      /* Pick an operation (+, -, *, /): */
+     
+      do
+      { 
+        comets[found].oper = (rand() % NUM_OPERS);
+      }
+      while (opers[comets[found].oper] == 0);
+     
+      
+      if (comets[found].oper == OPER_ADD)
+	{
+	  /* Simple addition: */
+
+	  do
+	  {
+	    comets[found].eq1 = pick_operand(0);
+	    comets[found].eq2 = pick_operand(0);
+	    comets[found].answer = comets[found].eq1 + comets[found].eq2;
+	  }
+	  while (comets[found].answer > max_answer);
+	}
+      else if (comets[found].oper == OPER_SUB)
+	{
+	  /* Subtraction: */
+
+	  do
+	  {
+	    comets[found].eq1 = pick_operand(0);
+
+
+	    /* (No negative answers) */
+	    /* [ WILL PROBABLY ALLOW FOR NEG. ANS. ] */
+	  
+	    do
+	    {
+	      comets[found].eq2 = pick_operand(0);
+	    }
+	    while (comets[found].eq2 > comets[found].eq1);
+
+	    comets[found].answer = comets[found].eq1 - comets[found].eq2;
+	  }
+	  while (comets[found].answer > max_answer);
+	}
+      else if (comets[found].oper == OPER_MULT)
+	{
+	  /* Multiplication: */
+	
+          comets[found].eq1 = pick_operand(1);
+	  comets[found].eq2 = pick_operand(0);
+	  comets[found].answer = comets[found].eq1 * comets[found].eq2;
+	}
+      else if (comets[found].oper == OPER_DIV)
+	{
+	  /* Division: */
+
+	  do
+	  {
+	    /* (Don't divide by zero) */
+		
+	    comets[found].eq2 = pick_operand(1);
+
+
+	    /* (Make sure answer will be a whole (int) number) */
+	  
+	    comets[found].eq1 = pick_operand(0) * comets[found].eq2;
+
+	  
+	    comets[found].answer = comets[found].eq1 / comets[found].eq2;
+	  }
+	  while (comets[found].answer > max_answer ||
+		 !in_range(comets[found].eq1 / 2));
+	}
+      snprintf(comets[found].formula, FORMULA_LEN,"%d%c%d",
+	       comets[found].eq1,
+	       operchars[comets[found].oper],
+	       comets[found].eq2);
+      snprintf(comets[found].answer_str, ANSWER_LEN, "%d",
+	       comets[found].answer);
+    }
+}
+
+
+/* Draw numbers/symbols over the attacker: */
+
+void draw_nums(char * str, int x, int y)
+{
+  int i, j, cur_x, c;
+  SDL_Rect src, dest;
+
+
+  /* Center around the shape */
+  
+  cur_x = x - ((strlen(str) * (images[IMG_NUMS]->w / (10 + NUM_OPERS)))) / 2;
+
+  if (cur_x < 0)
+    cur_x = 0;
+
+  if (cur_x + (strlen(str) * (images[IMG_NUMS]->w / (10 + NUM_OPERS))) >=
+      screen->w)
+    cur_x = ((screen->w) -
+             (strlen(str) * (images[IMG_NUMS]->w / (10 + NUM_OPERS))));
+
+
+  /* Draw each character: */
+  
+  for (i = 0; i < strlen(str); i++)
+    {
+      c = -1;
+
+
+      /* Determine which character to display: */
+      
+      if (str[i] >= '0' && str[i] <= '9')
+	c = str[i] - '0';
+      else
+	{
+	  /* [ THIS COULD CAUSE SLOWNESS... ] */
+		
+	  for (j = 0; j < NUM_OPERS; j++)
+	    {
+	      if (str[i] == operchars[j])
+		{
+		  c = 10 + j;
+		}
+	    }
+	}
+      
+
+      /* Display this character! */
+      
+      if (c != -1)
+	{
+	  src.x = c * (images[IMG_NUMS]->w / (10 + NUM_OPERS));
+	  src.y = 0;
+	  src.w = (images[IMG_NUMS]->w / (10 + NUM_OPERS));
+	  src.h = images[IMG_NUMS]->h;
+	  
+	  dest.x = cur_x;
+	  dest.y = y - images[IMG_NUMS]->h;
+	  dest.w = src.w;
+	  dest.h = src.h;
+	  
+	  SDL_BlitSurface(images[IMG_NUMS], &src,
+			  screen, &dest);
+
+
+          /* Move the 'cursor' one character width: */
+
+	  cur_x = cur_x + (images[IMG_NUMS]->w / (10 + NUM_OPERS));
+	}
+    }
+}
+
+
+/* Draw status numbers: */
+
+void draw_numbers(char * str, int x)
+{
+  int i, cur_x, c;
+  SDL_Rect src, dest;
+
+
+  cur_x = x;
+
+
+  /* Draw each character: */
+  
+  for (i = 0; i < strlen(str); i++)
+    {
+      c = -1;
+
+
+      /* Determine which character to display: */
+      
+      if (str[i] >= '0' && str[i] <= '9')
+	c = str[i] - '0';
+      
+
+      /* Display this character! */
+      
+      if (c != -1)
+	{
+	  src.x = c * (images[IMG_NUMBERS]->w / 10);
+	  src.y = 0;
+	  src.w = (images[IMG_NUMBERS]->w / 10);
+	  src.h = images[IMG_NUMBERS]->h;
+	  
+	  dest.x = cur_x;
+	  dest.y = 0;
+	  dest.w = src.w;
+	  dest.h = src.h;
+	  
+	  SDL_BlitSurface(images[IMG_NUMBERS], &src,
+			  screen, &dest);
+
+
+          /* Move the 'cursor' one character width: */
+
+	  cur_x = cur_x + (images[IMG_NUMBERS]->w / 10);
+	}
+    }
+}
+
+
+/* Pause loop: */
+
+int pause_game(void)
+{
+  int done, quit;
+  SDL_Event event;
+  SDL_Rect dest;
+ 
+  done = 0;
+  quit = 0;
+
+  dest.x = (screen->w - images[IMG_PAUSED]->w) / 2;
+  dest.y = (screen->h - images[IMG_PAUSED]->h) / 2;
+  dest.w = images[IMG_PAUSED]->w;
+  dest.h = images[IMG_PAUSED]->h;
+    
+  SDL_BlitSurface(images[IMG_PAUSED], NULL, screen, &dest);
+  SDL_Flip(screen);
+
+
+#ifndef NOSOUND
+  if (use_sound)
+    Mix_PauseMusic();
+#endif
+  
+  
+  do
+  {
+    while (SDL_PollEvent(&event))
+    {
+      if (event.type == SDL_KEYDOWN)
+	done = 1;
+      else if (event.type == SDL_QUIT)
+	quit = 1;
+    }
+
+    SDL_Delay(100);
+  }
+  while (!done && !quit);
+
+
+#ifndef NOSOUND
+  if (use_sound)
+    Mix_ResumeMusic();
+#endif
+
+  return (quit);
+}  
+
+
+
+/* Draw a line: */
+
+void draw_line(int x1, int y1, int x2, int y2, int red, int grn, int blu)
+{
+  int dx, dy, tmp;
+  float m, b;
+  Uint32 pixel;
+  SDL_Rect dest;
+ 
+  pixel = SDL_MapRGB(screen->format, red, grn, blu);
+
+  dx = x2 - x1;
+  dy = y2 - y1;
+
+  putpixel(screen, x1, y1, pixel);
+  
+  if (dx != 0)
+  {
+    m = ((float) dy) / ((float) dx);
+    b = y1 - m * x1;
+
+    if (x2 > x1)
+      dx = 1;
+    else
+      dx = -1;
+
+    while (x1 != x2)
+    {
+      x1 = x1 + dx;
+      y1 = m * x1 + b;
+      
+      putpixel(screen, x1, y1, pixel);
+    }
+  }
+  else
+  {
+    if (y1 > y2)
+    {
+      tmp = y1;
+      y1 = y2;
+      y2 = tmp;
+    }
+    
+    dest.x = x1;
+    dest.y = y1;
+    dest.w = 3;
+    dest.h = y2 - y1;
+
+    SDL_FillRect(screen, &dest, pixel);
+  }
+}
+
+
+/* Draw a single pixel into the surface: */
+
+void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
+{
+#ifdef PUTPIXEL_RAW
+  int bpp;
+  Uint8 * p;
+  
+  /* Determine bytes-per-pixel for the surface in question: */
+  
+  bpp = surface->format->BytesPerPixel;
+  
+  
+  /* Set a pointer to the exact location in memory of the pixel
+     in question: */
+  
+  p = (Uint8 *) (surface->pixels +       /* Start at beginning of RAM */
+                 (y * surface->pitch) +  /* Go down Y lines */
+                 (x * bpp));             /* Go in X pixels */
+  
+  
+  /* Assuming the X/Y values are within the bounds of this surface... */
+  
+  if (x >= 0 && y >= 0 && x < surface -> w && y < surface -> h)
+    {
+      /* Set the (correctly-sized) piece of data in the surface's RAM
+         to the pixel value sent in: */
+      
+      if (bpp == 1)
+        *p = pixel;
+      else if (bpp == 2)
+        *(Uint16 *)p = pixel;
+      else if (bpp == 3)
+        {
+          if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+            {
+              p[0] = (pixel >> 16) & 0xff;
+              p[1] = (pixel >> 8) & 0xff;
+              p[2] = pixel & 0xff;
+            }
+          else
+            {
+              p[0] = pixel & 0xff;
+              p[1] = (pixel >> 8) & 0xff;
+              p[2] = (pixel >> 16) & 0xff;
+            }
+        }
+      else if (bpp == 4)
+        {
+          *(Uint32 *)p = pixel;
+        }
+    }
+#else
+  SDL_Rect dest;
+
+  dest.x = x;
+  dest.y = y;
+  dest.w = 3;
+  dest.h = 4;
+
+  SDL_FillRect(surface, &dest, pixel);
+#endif
+}
+
+
+/* Draw image at lower center of screen: */
+
+void draw_console_image(int i)
+{
+  SDL_Rect dest;
+
+  dest.x = (screen->w - images[i]->w) / 2;
+  dest.y = (screen->h - images[i]->h);
+  dest.w = images[i]->w;
+  dest.h = images[i]->h;
+
+  SDL_BlitSurface(images[i], NULL, screen, &dest);
+}
+
+
+/* Increment score: */
+
+void add_score(int inc)
+{
+  score += inc;
+}
+
+
+/* Pick a suitable operand: */
+
+int pick_operand(int min)
+{
+  int i;
+
+  do
+  {
+    i = (rand() % 50) + min;
+  }
+  while (!in_range(i));
+
+  return i;
+}
+
+
+/* Is the value with available operand ranges? */
+
+int in_range(int n)
+{
+  int ok, i;
+  
+  ok = 0;
+  
+  for (i = 0; i < NUM_Q_RANGES && ok == 0; i++)
+  {
+    if (range_enabled[i])
+    {
+      if (n >= ranges[i].min && n <= ranges[i].max)
+	ok = 1;
+    }
+  }
+  
+  return ok;
+}
+

Added: tuxmath/trunk/src/game.h
===================================================================
--- tuxmath/trunk/src/game.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/game.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,65 @@
+/*
+  game.h
+
+  For TuxMath
+  The main game loop!
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 18, 2004
+*/
+
+
+#ifndef GAME_H
+#define GAME_H
+
+#define MAX_COMETS 10
+#define NUM_CITIES 4   /* MUST BE AN EVEN NUMBER! */
+
+#define NUM_BKGDS 5
+
+#define MAX_CITY_COLORS 4
+
+typedef struct city_type {
+  int alive, expl, shields;
+  int x;
+} city_type;
+
+typedef struct laser_type {
+  int alive;
+  int x1, y1;
+  int x2, y2;
+} laser_type;
+
+enum {
+  OPER_ADD,
+  OPER_SUB,
+  OPER_MULT,
+  OPER_DIV,
+  NUM_OPERS
+};
+
+extern char operchars[NUM_OPERS];
+
+extern char * oper_opts[NUM_OPERS];
+
+extern char * oper_alt_opts[NUM_OPERS];
+
+enum {
+  Q_RANGE_1_5,
+  Q_RANGE_6_12,
+  Q_RANGE_13_20,
+  NUM_Q_RANGES
+};
+
+int game(void);
+
+void draw_nums(char* str, int x, int y);
+
+#endif

Added: tuxmath/trunk/src/images.h
===================================================================
--- tuxmath/trunk/src/images.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/images.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,118 @@
+/*
+  images.h
+
+  For TuxMath
+  Contains an enumerated list of constant values to be used to refer to
+  images, as well as a list of filenames for each image (used by the
+  loader in "setup" module)
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 21, 2003
+*/
+
+enum {
+  IMG_STANDBY,
+  IMG_LOADING,
+  IMG_TITLE,
+  IMG_OPTIONS,
+  IMG_TUX4KIDS,
+  IMG_NBS,
+  IMG_TUX_HELMET1,
+  IMG_TUX_HELMET2,
+  IMG_TUX_HELMET3,
+  IMG_CMD_PLAY,
+  IMG_CMD_OPTIONS,
+  IMG_CMD_CREDITS,
+  IMG_CMD_QUIT,
+  IMG_OPT_ADDITION,
+  IMG_OPT_SUBTRACTION,
+  IMG_OPT_MULTIPLICATION,
+  IMG_OPT_DIVISION,
+  IMG_OPT_MAX_ANSWER,
+  IMG_OPT_Q_RANGE,
+  IMG_OPT_RNG_1_5,
+  IMG_OPT_RNG_1_5_ON,
+  IMG_OPT_RNG_6_12,
+  IMG_OPT_RNG_6_12_ON,
+  IMG_OPT_RNG_13_20,
+  IMG_OPT_RNG_13_20_ON,
+  IMG_OPT_CHECK,
+  IMG_OPT_CHECK_ON,
+  IMG_CITY_BLUE,
+  IMG_CITY_BLUE_EXPL1,
+  IMG_CITY_BLUE_EXPL2,
+  IMG_CITY_BLUE_EXPL3,
+  IMG_CITY_BLUE_EXPL4,
+  IMG_CITY_BLUE_EXPL5,
+  IMG_CITY_BLUE_DEAD,
+  IMG_CITY_GREEN,
+  IMG_CITY_GREEN_EXPL1,
+  IMG_CITY_GREEN_EXPL2,
+  IMG_CITY_GREEN_EXPL3,
+  IMG_CITY_GREEN_EXPL4,
+  IMG_CITY_GREEN_EXPL5,
+  IMG_CITY_GREEN_DEAD,
+  IMG_CITY_ORANGE,
+  IMG_CITY_ORANGE_EXPL1,
+  IMG_CITY_ORANGE_EXPL2,
+  IMG_CITY_ORANGE_EXPL3,
+  IMG_CITY_ORANGE_EXPL4,
+  IMG_CITY_ORANGE_EXPL5,
+  IMG_CITY_ORANGE_DEAD,
+  IMG_CITY_RED,
+  IMG_CITY_RED_EXPL1,
+  IMG_CITY_RED_EXPL2,
+  IMG_CITY_RED_EXPL3,
+  IMG_CITY_RED_EXPL4,
+  IMG_CITY_RED_EXPL5,
+  IMG_CITY_RED_DEAD,
+  IMG_SHIELDS,
+  IMG_COMET1,
+  IMG_COMET2,
+  IMG_COMET3,
+  IMG_COMETEX8,
+  COMET_EXPL_END = IMG_COMETEX8,
+  IMG_COMETEX7,
+  IMG_COMETEX6,
+  IMG_COMETEX5,
+  IMG_COMETEX4,
+  IMG_COMETEX3,
+  IMG_COMETEX2,
+  IMG_COMETEX1,
+  COMET_EXPL_START = IMG_COMETEX1,
+  IMG_NUMS,
+  IMG_LEDNUMS,
+  IMG_PAUSED,
+  IMG_DEMO,
+  IMG_DEMO_SMALL,
+  IMG_KEYPAD,
+  IMG_CONSOLE,
+  IMG_TUX_CONSOLE1,
+  IMG_TUX_CONSOLE2,
+  IMG_TUX_CONSOLE3,
+  IMG_TUX_CONSOLE4,
+  IMG_TUX_RELAX1,
+  IMG_TUX_RELAX2,
+  IMG_TUX_DRAT,
+  IMG_TUX_YIPE,
+  IMG_TUX_YAY1,
+  IMG_TUX_YAY2,
+  IMG_TUX_YES1,
+  IMG_TUX_YES2,
+  IMG_TUX_SIT,
+  IMG_TUX_FIST1,
+  IMG_TUX_FIST2,
+  IMG_WAVE,
+  IMG_SCORE,
+  IMG_NUMBERS,
+  IMG_GAMEOVER,
+  NUM_IMAGES
+};
+

Added: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/options.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,314 @@
+/*
+  options.c
+
+  For TuxMath
+  The options screen loop.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - January 3, 2005
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <SDL.h>
+#include "options.h"
+#include "images.h"
+#include "setup.h"
+#include "sounds.h"
+#include "playsound.h"
+#include "game.h"
+
+int options(void)
+{
+  int opt, old_opt, done, quit, img, blinking, i, j, x, y;
+  unsigned char range_bits;
+  char tmp_str[10];
+  SDL_Rect dest;
+  SDL_Event event;
+  Uint32 last_time, now_time;
+  SDLKey key;
+  
+  
+  /* Clear window: */
+  
+  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+
+  dest.x = (screen->w - images[IMG_OPTIONS]->w) / 2;
+  dest.y = 0;
+  SDL_BlitSurface(images[IMG_OPTIONS], NULL, screen, &dest);
+
+
+  /* Draw options: */
+
+  for (i = 0; i < NUM_OPTS; i++)
+  {
+    y = (images[IMG_OPTIONS]->h + 8 + (i * images[IMG_TUX_HELMET1]->h));
+    
+    dest.x = 32 + images[IMG_TUX_HELMET1]->w + 4;
+    dest.y = y;
+    
+    SDL_BlitSurface(images[IMG_OPT_ADDITION + i], NULL, screen, &dest);
+
+
+    /* Checkmarks for operators: */
+
+    if (i >= OPT_OP_ADD && i < OPT_OP_ADD + NUM_OPERS)
+    {
+      dest.x = screen->w - images[IMG_OPT_CHECK]->w - 16;
+      dest.y = y;
+      
+      SDL_BlitSurface(images[IMG_OPT_CHECK + opers[i]], NULL, screen, &dest);
+    }
+    else if (i == OPT_A_MAX)
+    {
+      /* Maximum answer: */
+
+      snprintf(tmp_str, sizeof(tmp_str), "%04d", max_answer);
+      draw_nums(tmp_str,
+		screen->w - ((images[IMG_NUMS]->w / 14) * 2) - 16,
+		y + images[IMG_OPT_MAX_ANSWER]->h);
+
+      /* Using "* 2" instead of "* 4" (even though string is 4 digits long)
+         because "draw_nums()" actually centers around x; not left-justifies */
+    }
+    else if (i == OPT_Q_RANGE)
+    {
+      x = 32 + images[IMG_TUX_HELMET1]->w + 4 + 64;
+      y = y + images[IMG_TUX_HELMET1]->h;
+
+      for (j = 0; j < NUM_Q_RANGES; j++)
+      {
+	dest.x = x;
+	dest.y = y;
+
+	SDL_BlitSurface(images[IMG_OPT_RNG_1_5 + j * 2 + range_enabled[j]],
+			NULL,
+			screen, &dest);
+
+	x = x + images[IMG_OPT_RNG_1_5 + j * 2 + range_enabled[j]]->w + 16;
+      }
+    }
+  }
+
+
+  /* Get bits of what ranges are available: */
+
+  range_bits = 0;
+  for (j = 0; j < NUM_Q_RANGES; j++)
+  {
+    range_bits = range_bits << 1;
+    if (range_enabled[j])
+      range_bits = range_bits | 1;
+  }
+
+  
+  /* --- MAIN OPTIONS SCREEN LOOP: --- */
+
+  blinking = 0;
+  opt = 0;
+  done = 0;
+  quit = 0;
+  
+  do
+    {
+      last_time = SDL_GetTicks();
+      old_opt = opt;
+      
+      
+      /* Handle any incoming events: */
+      
+      while (SDL_PollEvent(&event) > 0)
+	{
+	  if (event.type == SDL_QUIT)
+	    {
+	      /* Window close event - quit! */
+	      
+	      quit = 1;
+	      done = 1;
+	    }
+	  else if (event.type == SDL_KEYDOWN)
+	    {
+	      key = event.key.keysym.sym;
+	      
+	      if (key == SDLK_ESCAPE)
+		{
+		  /* Escape key - quit! */
+		  
+		  done = 1;
+		}
+	      else if (key == SDLK_DOWN)
+		{
+		  if (opt < NUM_OPTS - 1)
+		  {
+		    opt++;
+
+		    playsound(SND_POP);
+		  }
+		}
+	      else if (key == SDLK_UP)
+		{
+		  if (opt > 0)
+		  {
+		    opt--;
+		    playsound(SND_POP);
+		  }
+		}
+	      else if (key == SDLK_RETURN)
+		{
+		  if (opt >= OPT_OP_ADD && opt < OPT_OP_ADD + NUM_OPERS)
+		  {
+		    opers[opt - OPT_OP_ADD] = !opers[opt - OPT_OP_ADD];
+		    
+	            dest.x = screen->w - images[IMG_OPT_CHECK]->w - 16;
+                    dest.y = (images[IMG_OPTIONS]->h + 8 +
+			      ((opt - OPT_OP_ADD) *
+			      images[IMG_TUX_HELMET1]->h));
+      
+	            SDL_BlitSurface(images[IMG_OPT_CHECK +
+				           opers[opt - OPT_OP_ADD]], NULL,
+				    screen, &dest);
+		    
+		    playsound(SND_LASER);
+		  }
+		  else if (opt == OPT_A_MAX)
+		  {
+		    max_answer = (max_answer * 2) / 3;
+
+		    if (max_answer < 12)
+		      max_answer = 144;
+
+		    dest.x = screen->w - ((images[IMG_NUMS]->w / 14) * 4) - 16;
+		    dest.y = (images[IMG_OPTIONS]->h + 8 +
+			      ((opt - OPT_OP_ADD) *
+			       images[IMG_TUX_HELMET1]->h));
+
+		    dest.w = ((images[IMG_NUMS]->w / 14) * 4);
+		    dest.h = images[IMG_OPT_MAX_ANSWER]->h;
+
+		    SDL_FillRect(screen, &dest,
+				 SDL_MapRGB(screen->format, 0, 0, 0));
+
+		    snprintf(tmp_str, sizeof(tmp_str), "%04d", max_answer);
+		    draw_nums(tmp_str,
+			screen->w - ((images[IMG_NUMS]->w / 14) * 2) - 16,
+			(images[IMG_OPTIONS]->h + 8 +
+			 ((opt - OPT_OP_ADD) *
+			 images[IMG_TUX_HELMET1]->h)) +
+			images[IMG_OPT_MAX_ANSWER]->h);
+		  }
+		  else if (opt == OPT_Q_RANGE)
+		  {
+		    /* Change which ranges are available: */
+		
+		    range_bits = range_bits + 1;
+		    if (range_bits >= (1 << NUM_Q_RANGES))
+		      range_bits = 1;
+
+		    for (j = 0; j < NUM_Q_RANGES; j++)
+		    {
+		      if ((range_bits & (1 << j)) != 0)
+			range_enabled[j] = 1;
+		      else
+			range_enabled[j] = 0;
+		    }
+		    
+
+		    /* Redraw ranges: */
+			  
+      		    x = 32 + images[IMG_TUX_HELMET1]->w + 4 + 64;
+                    y = (images[IMG_OPTIONS]->h + 8 +
+			 (opt * images[IMG_TUX_HELMET1]->h)) +
+			 images[IMG_TUX_HELMET1]->h;
+
+	            for (j = 0; j < NUM_Q_RANGES; j++)
+	            {
+		      dest.x = x;
+		      dest.y = y;
+
+		      SDL_BlitSurface(images[IMG_OPT_RNG_1_5 + j * 2 +
+				      range_enabled[j]],
+				      NULL,
+				      screen, &dest);
+
+		      x = x + images[IMG_OPT_RNG_1_5 + j * 2 +
+			             range_enabled[j]]->w + 16;
+		    }
+		    
+		    playsound(SND_LASER);
+		  }
+		}
+	    }
+	}
+      
+      
+      /* Erase Tux (cursor) */
+      
+      if (opt != old_opt)
+	{
+	  blinking = 0;
+	  
+	  dest.x = 32;
+	  dest.y = (images[IMG_OPTIONS]->h + 8 + 
+		    (old_opt * images[IMG_TUX_HELMET1]->h));
+	  dest.w = images[IMG_TUX_HELMET1]->w;
+	  dest.h = images[IMG_TUX_HELMET1]->h;
+	  
+	  SDL_FillRect(screen, &dest,
+		       SDL_MapRGB(screen->format, 0, 0, 0));
+	}
+      
+      
+      /* Handling Tux (cursor) blinking: */
+      
+      if ((rand() % 50) == 0 && blinking == 0)
+	{
+	  blinking = 6;
+	}
+      
+      if (blinking > 0)
+	blinking--;
+      
+      
+      /* Draw Tux (cursor) */
+      
+      dest.x = 32;
+      dest.y = images[IMG_OPTIONS]->h + 8 + (opt * images[IMG_TUX_HELMET1]->h);
+      dest.w = images[IMG_TUX_HELMET1]->w;
+      dest.h = images[IMG_TUX_HELMET1]->h;
+      
+      img = IMG_TUX_HELMET1;
+      
+      if (blinking >= 4 || (blinking >= 1 && blinking < 2))
+	img = IMG_TUX_HELMET2;
+      else if (blinking >= 2 && blinking < 4)
+	img = IMG_TUX_HELMET3;
+     
+      SDL_BlitSurface(images[img], NULL, screen, &dest);
+      
+      SDL_Flip(screen);
+
+      
+      /* Pause (keep frame-rate event) */
+      
+      now_time = SDL_GetTicks();
+      if (now_time < last_time + (1000 / 20))
+	{
+	  SDL_Delay(last_time + (1000 / 20) - now_time);
+	}
+    }
+  while (!done);
+
+
+  /* Return the chosen command: */
+  
+  return quit;
+}

Added: tuxmath/trunk/src/options.h
===================================================================
--- tuxmath/trunk/src/options.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/options.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,34 @@
+/*
+  options.h
+
+  For TuxMath
+  The options screen loop.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 21, 2003
+*/
+
+
+#ifndef OPTIONS_H
+#define OPTIONS_H
+
+enum {
+  OPT_OP_ADD,
+  OPT_OP_SUB,
+  OPT_OP_MUL,
+  OPT_OP_DIV,
+  OPT_A_MAX,
+  OPT_Q_RANGE,
+  NUM_OPTS
+};
+
+int options(void);
+
+#endif

Added: tuxmath/trunk/src/playsound.c
===================================================================
--- tuxmath/trunk/src/playsound.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/playsound.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,33 @@
+/*
+  playsound.c
+
+  For TuxMath
+  Plays a sound (if sound support is enabled)
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+  
+  August 28, 2001 - September 6, 2001
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <SDL.h>
+#ifndef NOSOUND
+#include <SDL_mixer.h>
+#endif
+#include "setup.h"
+
+
+void playsound(int snd)
+{
+#ifndef NOSOUND
+  if (use_sound)
+    Mix_PlayChannel(-1, sounds[snd], 0);
+#endif
+}

Added: tuxmath/trunk/src/playsound.h
===================================================================
--- tuxmath/trunk/src/playsound.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/playsound.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,23 @@
+/*
+  playsound.h
+
+  For TuxMath
+  Plays a sound (if sound support is enabled)
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+  
+  August 28, 2001 - August 28, 2001
+*/
+
+
+#ifndef PLAYSOUND_H
+#define PLAYSOUND_H
+
+void playsound(int snd);
+
+#endif

Added: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/setup.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,656 @@
+/*
+  setup.c
+
+  For TuxMath
+  Contains some globals (screen surface, images, some option flags, etc.)
+  as well as the function to load data files (images, sounds, music)
+  and display a "Loading..." screen.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+   
+  August 26, 2001 - January 3, 2005
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <SDL.h>
+#ifndef NOSOUND
+#include <SDL_mixer.h>
+#endif
+#include <SDL_image.h>
+#include "setup.h"
+#include "images.h"
+#include "sounds.h"
+#include "game.h"
+
+
+static char * image_filenames[NUM_IMAGES] = {
+  DATA_PREFIX "/images/status/standby.png",
+  DATA_PREFIX "/images/status/loading.png",
+  DATA_PREFIX "/images/status/title.png",
+  DATA_PREFIX "/images/status/options.png",
+  DATA_PREFIX "/images/status/tux4kids.png",
+  DATA_PREFIX "/images/status/nbs.png",
+  DATA_PREFIX "/images/status/tux_helmet1.png",
+  DATA_PREFIX "/images/status/tux_helmet2.png",
+  DATA_PREFIX "/images/status/tux_helmet3.png", 
+  DATA_PREFIX "/images/status/cmd_play.png",
+  DATA_PREFIX "/images/status/cmd_options.png",
+  DATA_PREFIX "/images/status/cmd_credits.png",
+  DATA_PREFIX "/images/status/cmd_quit.png",
+  DATA_PREFIX "/images/status/opt_addition.png",
+  DATA_PREFIX "/images/status/opt_subtraction.png",
+  DATA_PREFIX "/images/status/opt_multiplication.png",
+  DATA_PREFIX "/images/status/opt_division.png",
+  DATA_PREFIX "/images/status/opt_max_answer.png",
+  DATA_PREFIX "/images/status/opt_q_range.png",
+  DATA_PREFIX "/images/status/opt_rng_1_5.png",
+  DATA_PREFIX "/images/status/opt_rng_1_5_on.png",
+  DATA_PREFIX "/images/status/opt_rng_6_12.png",
+  DATA_PREFIX "/images/status/opt_rng_6_12_on.png",
+  DATA_PREFIX "/images/status/opt_rng_13_20.png",
+  DATA_PREFIX "/images/status/opt_rng_13_20_on.png",
+  DATA_PREFIX "/images/status/opt_check.png",
+  DATA_PREFIX "/images/status/opt_check_on.png",
+  DATA_PREFIX "/images/cities/city-blue.png",
+  DATA_PREFIX "/images/cities/csplode-blue-1.png",
+  DATA_PREFIX "/images/cities/csplode-blue-2.png",
+  DATA_PREFIX "/images/cities/csplode-blue-3.png",
+  DATA_PREFIX "/images/cities/csplode-blue-4.png",
+  DATA_PREFIX "/images/cities/csplode-blue-5.png",
+  DATA_PREFIX "/images/cities/cdead-blue.png",
+  DATA_PREFIX "/images/cities/city-green.png",
+  DATA_PREFIX "/images/cities/csplode-green-1.png",
+  DATA_PREFIX "/images/cities/csplode-green-2.png",
+  DATA_PREFIX "/images/cities/csplode-green-3.png",
+  DATA_PREFIX "/images/cities/csplode-green-4.png",
+  DATA_PREFIX "/images/cities/csplode-green-5.png",
+  DATA_PREFIX "/images/cities/cdead-green.png",
+  DATA_PREFIX "/images/cities/city-orange.png",
+  DATA_PREFIX "/images/cities/csplode-orange-1.png",
+  DATA_PREFIX "/images/cities/csplode-orange-2.png",
+  DATA_PREFIX "/images/cities/csplode-orange-3.png",
+  DATA_PREFIX "/images/cities/csplode-orange-4.png",
+  DATA_PREFIX "/images/cities/csplode-orange-5.png",
+  DATA_PREFIX "/images/cities/cdead-orange.png",
+  DATA_PREFIX "/images/cities/city-red.png",
+  DATA_PREFIX "/images/cities/csplode-red-1.png",
+  DATA_PREFIX "/images/cities/csplode-red-2.png",
+  DATA_PREFIX "/images/cities/csplode-red-3.png",
+  DATA_PREFIX "/images/cities/csplode-red-4.png",
+  DATA_PREFIX "/images/cities/csplode-red-5.png",
+  DATA_PREFIX "/images/cities/cdead-red.png",
+  DATA_PREFIX "/images/cities/shields.png",
+  DATA_PREFIX "/images/comets/comet1.png",
+  DATA_PREFIX "/images/comets/comet2.png",
+  DATA_PREFIX "/images/comets/comet3.png",
+  DATA_PREFIX "/images/comets/cometex3.png",
+  DATA_PREFIX "/images/comets/cometex3.png",
+  DATA_PREFIX "/images/comets/cometex2.png",
+  DATA_PREFIX "/images/comets/cometex2.png",
+  DATA_PREFIX "/images/comets/cometex1a.png",
+  DATA_PREFIX "/images/comets/cometex1a.png",
+  DATA_PREFIX "/images/comets/cometex1.png",
+  DATA_PREFIX "/images/comets/cometex1.png",
+  DATA_PREFIX "/images/status/nums.png",
+  DATA_PREFIX "/images/status/lednums.png",
+  DATA_PREFIX "/images/status/paused.png",
+  DATA_PREFIX "/images/status/demo.png",
+  DATA_PREFIX "/images/status/demo-small.png",
+  DATA_PREFIX "/images/status/keypad.png",
+  DATA_PREFIX "/images/tux/console.png",
+  DATA_PREFIX "/images/tux/tux-console1.png",
+  DATA_PREFIX "/images/tux/tux-console2.png",
+  DATA_PREFIX "/images/tux/tux-console3.png",
+  DATA_PREFIX "/images/tux/tux-console4.png",
+  DATA_PREFIX "/images/tux/tux-relax1.png",
+  DATA_PREFIX "/images/tux/tux-relax2.png",
+  DATA_PREFIX "/images/tux/tux-drat.png",
+  DATA_PREFIX "/images/tux/tux-yipe.png",
+  DATA_PREFIX "/images/tux/tux-yay1.png",
+  DATA_PREFIX "/images/tux/tux-yay2.png",
+  DATA_PREFIX "/images/tux/tux-yes1.png",
+  DATA_PREFIX "/images/tux/tux-yes2.png",
+  DATA_PREFIX "/images/tux/tux-sit.png",
+  DATA_PREFIX "/images/tux/tux-fist1.png",
+  DATA_PREFIX "/images/tux/tux-fist2.png",
+  DATA_PREFIX "/images/status/wave.png",
+  DATA_PREFIX "/images/status/score.png",
+  DATA_PREFIX "/images/status/numbers.png",
+  DATA_PREFIX "/images/status/gameover.png"
+};
+
+
+static char * sound_filenames[NUM_SOUNDS] = {
+  DATA_PREFIX "/sounds/pop.wav",
+  DATA_PREFIX "/sounds/laser.wav",
+  DATA_PREFIX "/sounds/buzz.wav",
+  DATA_PREFIX "/sounds/alarm.wav",
+  DATA_PREFIX "/sounds/shieldsdown.wav",
+  DATA_PREFIX "/sounds/explosion.wav",
+  DATA_PREFIX "/sounds/click.wav",
+  DATA_PREFIX "/sounds/SIZZLING.WAV"
+};
+
+static char * music_filenames[NUM_MUSICS] = {
+  DATA_PREFIX "/sounds/game.mod",
+  DATA_PREFIX "/sounds/game2.mod",
+  DATA_PREFIX "/sounds/game3.mod"
+};
+
+/* (These need to be 'extern'd in "setup.h") */
+
+SDL_Surface * screen;
+SDL_Surface * images[NUM_IMAGES];
+#ifndef NOSOUND
+Mix_Chunk * sounds[NUM_SOUNDS];
+Mix_Music * musics[NUM_MUSICS];
+#endif
+int use_sound, fullscreen, use_bkgd, demo_mode, oper_override, use_keypad;
+float speed;
+int opers[NUM_OPERS], range_enabled[NUM_Q_RANGES];
+int max_answer;
+
+
+/* Local function prototypes: */
+
+void seticon(void);
+void usage(int err, char * cmd);
+
+
+/* --- Set-up function! --- */
+
+void setup(int argc, char * argv[])
+{
+  int i, j, found, total_files;
+  SDL_Rect dest;
+
+
+  /* Set default options: */
+
+  use_sound = 1;
+  fullscreen = 0;
+  use_bkgd = 1;
+  demo_mode = 0;
+  use_keypad = 0;
+  speed = 1.0;
+  oper_override = 0;
+  max_answer = 144;
+
+  for (i = 0; i < NUM_OPERS; i++)
+  {
+    opers[i] = 1;
+  }
+
+  for (i = 0; i < NUM_Q_RANGES; i++)
+  {
+    range_enabled[i] = 1;
+  }
+
+
+  /* FIXME: Program should load options from disk */
+
+
+  /* See if operator settings are being overridden by command-line: */
+
+  for (i = 1; i < argc; i++)
+  {
+    if (strcmp(argv[i], "--operator") == 0 ||
+        strcmp(argv[i], "-o") == 0)
+    {
+      oper_override = 1;
+    }
+  }
+
+
+  /* If operator settings are being overridden, clear them first: */
+
+  if (oper_override)
+  {
+    for (i = 0; i < NUM_OPERS; i++)
+    {
+      opers[i] = 0;
+    }
+  }
+
+
+  /* Get options from the command line: */
+
+  for (i = 1; i < argc; i++)
+  {
+    if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
+    {
+      /* Display help message: */
+
+      printf("\nTux, of Math Command\n\n"
+        "Use the number keys on the keyboard to answer math equations.\n"
+        "If you don't answer a comet's math equation before it hits\n"
+        "one of your cities, the city's shields will be destroyed.\n"
+        "If that city is hit by another comet, it is destroyed completely.\n"
+	"When you lose all of your cities, the game ends.\n\n");
+
+      printf("Run the game with:\n"
+        "--nosound      - to disable sound/music\n"
+	"--nobackground - to disable background photos (for slower systems)\n"
+	"--fullscreen   - to run in fullscreen, if possible (vs. windowed)\n"
+        "--keypad       - to enable the on-sceen numeric keypad\n"
+	"--demo         - to run the program as a cycling demonstration\n"
+	"--speed S      - set initial speed of the game\n"
+	"                 (S may be fractional, default is 1.0)\n"
+	"--operator OP  - to automatically play with particular operators\n"
+	"                 OP may be one of:\n");
+
+      for (j = 0; j < NUM_OPERS; j++)
+        printf("                   \"%s\"\n", oper_opts[j]);
+
+      printf("            or:\n");
+      
+      for (j = 0; j < NUM_OPERS; j++)
+        printf("                   \"%s\"\n", oper_alt_opts[j]);
+
+      printf("\n");
+      
+
+      exit(0);
+    }
+    else if (strcmp(argv[i], "--copyright") == 0 ||
+	     strcmp(argv[i], "-c") == 0)
+    {
+      printf(
+	"\n\"Tux, of Math Command\" version " VERSION ", Copyright (C) 2001 Bill Kendrick\n"
+        "This program is free software; you can redistribute it and/or\n"
+        "modify it under the terms of the GNU General Public License\n"
+        "as published by the Free Software Foundation.  See COPYING.txt\n"
+	"\n"
+	"This program is distributed in the hope that it will be useful,\n"
+	"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+	"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
+	"\n");
+
+      exit(0);
+    }
+    else if (strcmp(argv[i], "--usage") == 0 ||
+	     strcmp(argv[i], "-u") == 0)
+    {
+      /* Display (happy) usage: */
+	    
+      usage(0, argv[0]);
+    }
+    else if (strcmp(argv[i], "--fullscreen") == 0 ||
+	     strcmp(argv[i], "-f") == 0)
+    {
+      fullscreen = 1;
+    }
+    else if (strcmp(argv[i], "--nosound") == 0 ||
+	     strcmp(argv[i], "-s") == 0 ||
+	     strcmp(argv[i], "--quiet") == 0 ||
+	     strcmp(argv[i], "-q") == 0)
+    {
+      use_sound = 0;
+    }
+    else if (strcmp(argv[i], "--version") == 0 ||
+	     strcmp(argv[i], "-v") == 0)
+    {
+      printf("Tux, of Math Command (\"tuxmath\")\n"
+	     "Version " VERSION "\n");
+      exit(0);
+    }
+    else if (strcmp(argv[i], "--nobackground") == 0 ||
+             strcmp(argv[i], "-b") == 0)
+    {
+      use_bkgd = 0;
+    }
+    else if (strcmp(argv[i], "--demo") == 0 ||
+	     strcmp(argv[i], "-d") == 0)
+    {
+      demo_mode = 1;
+    }
+    else if (strcmp(argv[i], "--keypad") == 0 ||
+             strcmp(argv[i], "-k") == 0)
+    {
+      use_keypad = 1;
+    }
+    else if (strcmp(argv[i], "--speed") == 0 ||
+	     strcmp(argv[i], "-s") == 0)
+    {
+      if (i >= argc - 1)
+      {
+	fprintf(stderr, "%s option requires an argument\n", argv[i]);
+	usage(1, argv[0]);
+      }
+
+      speed = strtod(argv[i + 1], (char **) NULL);
+
+      if (speed <= 0)
+      {
+	fprintf(stderr, "Invalided argument to %s: %s\n",
+		argv[i], argv[i + 1]);
+	usage(1, argv[0]);
+      }
+
+      i++;
+    }
+    else if (strcmp(argv[i], "--operator") == 0 ||
+	     strcmp(argv[i], "-o") == 0)
+    {
+      if (i >= argc - 1)
+      {
+	fprintf(stderr, "%s option requires an argument\n", argv[i]);
+	usage(1, argv[0]);
+      }
+     
+      found = 0; 
+      for (j = 0; j < NUM_OPERS; j++)
+      {
+	if (strcmp(argv[i + 1], oper_opts[j]) == 0 ||
+	    strcmp(argv[i + 1], oper_alt_opts[j]) == 0)
+	{
+          found = 1;
+          opers[j] = 1;
+	}
+      }
+
+      if (found == 0)
+      {
+	fprintf(stderr, "Unrecognized operator %s\n", argv[i + 1]);
+	usage(1, argv[0]);
+      }
+
+      i++;
+    }
+    else
+    {
+      /* Display 'made' usage: */
+
+      fprintf(stderr, "Unknown option: %s\n", argv[i]);
+      usage(1, argv[0]);
+    }
+  }
+
+
+  if (demo_mode && use_keypad)
+  {
+    fprintf(stderr, "No use for keypad in demo mode!\n");
+    use_keypad = 0;
+  }
+
+  
+  /* Init SDL Video: */
+  
+  if (SDL_Init(SDL_INIT_VIDEO) < 0)
+    {
+      fprintf(stderr,
+	      "\nError: I could not initialize video!\n"
+	      "The Simple DirectMedia error that occured was:\n"
+	      "%s\n\n", SDL_GetError());
+      exit(1);
+    }
+  
+  
+  /* Init SDL Audio: */
+
+#ifndef NOSOUND
+  if (use_sound)
+    { 
+      if (SDL_Init(SDL_INIT_AUDIO) < 0)
+        {
+          fprintf(stderr,
+  	          "\nWarning: I could not initialize audio!\n"
+	          "The Simple DirectMedia error that occured was:\n"
+	          "%s\n\n", SDL_GetError());
+	  use_sound = 0;
+        }
+    }
+  
+  if (use_sound)
+    {
+      if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
+        {
+          fprintf(stderr,
+	          "\nWarning: I could not set up audio for 44100 Hz "
+	          "16-bit stereo.\n"
+	          "The Simple DirectMedia error that occured was:\n"
+	          "%s\n\n", SDL_GetError());
+          use_sound = 0;
+        }
+    }
+#endif
+  
+ 
+  if (fullscreen)
+  {
+    screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN | SDL_HWSURFACE);
+
+    if (screen == NULL)
+    {
+      fprintf(stderr,
+              "\nWarning: I could not open the display in fullscreen mode.\n"
+	      "The Simple DirectMedia error that occured was:\n"
+	      "%s\n\n", SDL_GetError());
+      fullscreen = 0;
+    }
+  }
+
+  if (!fullscreen)
+    screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE);
+
+  if (screen == NULL)
+  {
+    fprintf(stderr,
+            "\nError: I could not open the display.\n"
+	    "The Simple DirectMedia error that occured was:\n"
+	    "%s\n\n", SDL_GetError());
+    exit(1);
+  }
+  
+  seticon();
+  SDL_WM_SetCaption("Tux, of Math Command", "TuxMath");
+
+
+  if (use_sound)
+    total_files = NUM_IMAGES + NUM_SOUNDS + NUM_MUSICS;
+  else
+    total_files = NUM_IMAGES;
+  
+
+  /* Load images: */
+
+  for (i = 0; i < NUM_IMAGES; i++)
+  {
+    images[i] = IMG_Load(image_filenames[i]);
+    if (images[i] == NULL)
+      {
+	fprintf(stderr,
+		"\nError: I couldn't load a graphics file:\n"
+		"%s\n"
+		"The Simple DirectMedia error that occured was:\n"
+		"%s\n\n", image_filenames[i], SDL_GetError());
+	exit(1);
+      }
+
+    
+    if (i == IMG_STANDBY)
+      {
+	dest.x = (screen->w - images[IMG_STANDBY]->w) / 2;
+	dest.y = screen->h - images[IMG_STANDBY]->h - 10;
+	dest.w = images[IMG_STANDBY]->w;
+	dest.h = images[IMG_STANDBY]->h;
+	
+	SDL_BlitSurface(images[IMG_STANDBY], NULL, screen, &dest);
+	SDL_Flip(screen);
+      }
+    else if (i == IMG_LOADING)
+      {
+	dest.x = (screen->w - images[IMG_LOADING]->w) / 2;
+	dest.y = 0;
+	dest.w = images[IMG_LOADING]->w;
+	dest.h = images[IMG_LOADING]->h;
+	
+	SDL_BlitSurface(images[IMG_LOADING], NULL, screen, &dest);
+	SDL_Flip(screen);
+      }
+    else if (i == IMG_TITLE)
+      {
+	dest.x = (screen->w - images[IMG_TITLE]->w) / 2;
+	dest.y = images[IMG_LOADING]->h;
+	dest.w = images[IMG_TITLE]->w;
+	dest.h = images[IMG_TITLE]->h;
+	
+	SDL_BlitSurface(images[IMG_TITLE], NULL, screen, &dest);
+	SDL_Flip(screen);
+      }
+    
+    
+    dest.x = 0;
+    dest.y = (screen->h) - 10;
+    dest.w = ((screen->w) * (i + 1)) / total_files;
+    dest.h = 10;
+    
+    SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 255, 0));
+    SDL_Flip(screen);
+  }
+
+
+#ifndef NOSOUND
+  if (use_sound)
+  {
+    for (i = 0; i < NUM_SOUNDS; i++)
+    {
+      sounds[i] = Mix_LoadWAV(sound_filenames[i]);
+
+      if (sounds[i] == NULL)
+      {
+        fprintf(stderr,
+	        "\nError: I couldn't load a sound file:\n"
+                "%s\n"
+                "The Simple DirectMedia error that occured was:\n"
+                "%s\n\n", sound_filenames[i], SDL_GetError());
+        exit(1);
+      }
+      
+      dest.x = 0;
+      dest.y = (screen->h) - 10;
+      dest.w = ((screen->w) * (i + 1 + NUM_IMAGES)) / total_files;
+      dest.h = 10;
+
+      SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 255, 0));
+      SDL_Flip(screen);
+    }
+
+
+    for (i = 0; i < NUM_MUSICS; i++)
+    {
+      musics[i] = Mix_LoadMUS(music_filenames[i]);
+
+      if (musics[i] == NULL)
+      {
+        fprintf(stderr,
+	        "\nError: I couldn't load a music file:\n"
+                "%s\n"
+                "The Simple DirectMedia error that occured was:\n"
+                "%s\n\n", music_filenames[i], SDL_GetError());
+        exit(1);
+      }
+      
+      dest.x = 0;
+      dest.y = (screen->h) - 10;
+      dest.w = ((screen->w) * (i + 1 + NUM_IMAGES + NUM_SOUNDS)) / total_files;
+      dest.h = 10;
+
+      SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 255, 0));
+      SDL_Flip(screen);
+    }
+  }
+#endif
+  
+
+  for (i = images[IMG_LOADING]->h; i >= 0; i = i - 10)
+    {
+      SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+
+      dest.x = (screen->w - images[IMG_TITLE]->w) / 2;
+      dest.y = i;
+      dest.w = images[IMG_TITLE]->w;
+      dest.h = images[IMG_TITLE]->h;
+      
+      SDL_BlitSurface(images[IMG_TITLE], NULL, screen, &dest);
+      SDL_Flip(screen);
+      SDL_Delay(10);
+    }
+}
+
+
+/* Set the application's icon: */
+
+void seticon(void)
+{
+  int masklen;
+  Uint8 * mask;
+  SDL_Surface * icon;
+  
+  
+  /* Load icon into a surface: */
+  
+  icon = IMG_Load(DATA_PREFIX "/images/icon.png");
+  if (icon == NULL)
+    {
+      fprintf(stderr,
+              "\nWarning: I could not load the icon image: %s\n"
+              "The Simple DirectMedia error that occured was:\n"
+              "%s\n\n", DATA_PREFIX "images/icon.png", SDL_GetError());
+      return;
+    }
+  
+  
+  /* Create mask: */
+  
+  masklen = (((icon -> w) + 7) / 8) * (icon -> h);
+  mask = malloc(masklen * sizeof(Uint8));
+  memset(mask, 0xFF, masklen);
+  
+  
+  /* Set icon: */
+  
+  SDL_WM_SetIcon(icon, mask);
+  
+  
+  /* Free icon surface & mask: */
+  
+  free(mask);
+  SDL_FreeSurface(icon);
+  
+  
+  /* Seed random-number generator: */
+  
+  srand(SDL_GetTicks());
+}
+
+
+void usage(int err, char * cmd)
+{
+  FILE * f;
+
+  if (err == 0)
+    f = stdout;
+  else
+    f = stderr;
+
+
+  fprintf(f,
+   "\nUsage: %s {--help | --usage | --copyright}\n"
+   "       %s [--fullscreen] [--nosound] [--nobackground] [--demo] [--keypad]\n"
+   "          [--operator {add | subtract | multiply | divide} ...]\n"
+   "          [--speed <val>]\n"
+    "\n", cmd, cmd);
+
+  exit (err);
+}

Added: tuxmath/trunk/src/setup.h
===================================================================
--- tuxmath/trunk/src/setup.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/setup.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,44 @@
+/*
+  setup.h
+
+  For TuxMath
+  Contains some globals (screen surface, images, some option flags, etc.)
+  as well as the function to load data files (images, sounds, music)
+  and display a "Loading..." screen.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 18, 2004
+*/
+
+
+#ifndef SETUP_H
+#define SETUP_H
+
+#include <SDL.h>
+#ifndef NOSOUND
+#include <SDL_mixer.h>
+#endif
+#include "game.h"
+
+extern SDL_Surface * screen;
+extern SDL_Surface * images[];
+#ifndef NOSOUND
+extern Mix_Chunk * sounds[];
+extern Mix_Music * musics[];
+#endif
+extern int use_sound, fullscreen, use_bkgd, demo_mode, oper_override,
+  use_keypad;
+extern float speed;
+extern int opers[NUM_OPERS], range_enabled[NUM_Q_RANGES];
+extern int max_answer;
+
+void setup(int argc, char * argv[]);
+
+#endif

Added: tuxmath/trunk/src/sounds.h
===================================================================
--- tuxmath/trunk/src/sounds.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/sounds.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,40 @@
+/*
+  sounds.h
+
+  For tuxmath
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - August 31, 2001
+*/
+
+
+#ifndef SOUNDS_H
+#define SOUNDS_H
+
+enum {
+  SND_POP,
+  SND_LASER,
+  SND_BUZZ,
+  SND_ALARM,
+  SND_SHIELDSDOWN,
+  SND_EXPLOSION,
+  SND_CLICK,
+  SND_SIZZLE,
+  NUM_SOUNDS
+};
+
+enum {
+  MUS_GAME,
+  MUS_GAME2,
+  MUS_GAME3,
+  NUM_MUSICS
+};
+
+#endif

Added: tuxmath/trunk/src/title.c
===================================================================
--- tuxmath/trunk/src/title.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/title.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,296 @@
+/*
+  title.c
+
+  For TuxMath
+  The title screen function.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - February 21, 2003
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <SDL.h>
+#include "title.h"
+#include "images.h"
+#include "setup.h"
+#include "sounds.h"
+#include "playsound.h"
+
+
+#define START_DEMO_COUNTDOWN 150  /* Some time unit.. not sure yet :) */
+
+
+int title(void)
+{
+  int i, cmd, old_cmd, done, img, blinking, widest, left, width, demo_countdown;
+  SDL_Rect dest;
+  SDL_Event event;
+  Uint32 last_time, now_time;
+  SDLKey key;
+  
+
+  /* Determine widest option image size: */
+
+  widest = 0;
+  for (i = 0; i < NUM_CMDS; i++)
+    {
+      if (images[IMG_CMD_PLAY + i]->w > widest)
+        widest = images[IMG_CMD_PLAY + i]->w;
+    }
+
+  width = widest + 4 + 4 + images[IMG_TUX_HELMET1] -> w;
+  left = (screen->w - width) / 2;
+  
+  
+  /* Clear window: */
+  
+  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+  
+  
+  /* Draw title: */
+  
+  dest.x = (screen->w - images[IMG_TITLE]->w) / 2;
+  dest.y = 0;
+  dest.w = images[IMG_TITLE]->w;
+  dest.h = images[IMG_TITLE]->h;
+  
+  SDL_BlitSurface(images[IMG_TITLE], NULL, screen, &dest);
+  
+  
+  /* Draw options: */
+  
+  for (i = 4; i >= 0; i--)
+    {
+      // dest.x = (32 - 2) - i;
+      dest.x = left + 4 - i;
+      dest.y = (images[IMG_TITLE]->h + 2) + (4 - i);
+      // dest.w = (screen->w) - ((32 - 2) * 2) + (i * 2);
+      dest.w = width + (i * 2);
+      dest.h = (NUM_CMDS * images[IMG_TUX_HELMET1]->h + 2) + (i * 2);
+      
+      SDL_FillRect(screen, &dest,
+		   SDL_MapRGB(screen->format,
+			      200 - (i * 32),
+			      232 - (i * 32),
+			      255 - (i * 32)));
+    }
+  
+  
+  for (i = 0; i < NUM_CMDS; i++)
+    {
+      // dest.x = 32 + (images[IMG_TUX_HELMET1]->w + 4);
+      dest.x = left + (images[IMG_TUX_HELMET1]->w) + 4;
+      dest.y = (images[IMG_TITLE]->h + 8 + 
+		(i * images[IMG_TUX_HELMET1]->h));
+      dest.w = images[IMG_TUX_HELMET1]->w;
+      dest.h = images[IMG_TUX_HELMET1]->h;
+      
+      SDL_BlitSurface(images[IMG_CMD_PLAY + i], NULL, screen, &dest);
+    }
+  
+  
+  /* Draw "Tux4Kids" logo: */
+  
+  dest.x = (screen->w - images[IMG_TUX4KIDS]->w);
+  dest.y = (screen->h - images[IMG_TUX4KIDS]->h);
+  dest.w = images[IMG_TUX4KIDS]->w;
+  dest.h = images[IMG_TUX4KIDS]->h;
+  
+  SDL_BlitSurface(images[IMG_TUX4KIDS], NULL, screen, &dest);
+
+
+  /* Draw "New Breed Software" logo: */
+
+  dest.x = 0;
+  dest.y = (screen->h - images[IMG_NBS]->h);
+  dest.w = images[IMG_NBS]->w;
+  dest.h = images[IMG_NBS]->h;
+
+  SDL_BlitSurface(images[IMG_NBS], NULL, screen, &dest);
+
+
+  if (demo_mode)
+  {
+    dest.x = (screen->w - images[IMG_DEMO_SMALL]->w) / 2;
+    dest.y = (screen->h - images[IMG_DEMO_SMALL]->h);
+    dest.w = images[IMG_DEMO_SMALL]->w;
+    dest.h = images[IMG_DEMO_SMALL]->h;
+
+    SDL_BlitSurface(images[IMG_DEMO_SMALL], NULL, screen, &dest);
+  }
+
+  
+  /* Flip the screen: */
+  
+  SDL_Flip(screen);
+  
+  
+  
+  /* --- MAIN TITLE SCREEN LOOP: --- */
+
+  blinking = 0;
+  cmd = 0;
+  done = 0;
+  demo_countdown = START_DEMO_COUNTDOWN;
+  
+  do
+    {
+      last_time = SDL_GetTicks();
+      old_cmd = cmd;
+      
+      
+      /* Handle any incoming events: */
+      
+      while (SDL_PollEvent(&event) > 0)
+	{
+	  if (event.type == SDL_QUIT)
+	    {
+	      /* Window close event - quit! */
+	      
+	      cmd = CMD_QUIT;
+	      done = 1;
+	    }
+	  else if (event.type == SDL_KEYDOWN)
+	    {
+	      key = event.key.keysym.sym;
+	      
+	      if (key == SDLK_ESCAPE)
+		{
+		  /* Escape key - quit! */
+		  
+		  cmd = CMD_QUIT;
+		  done = 1;
+		}
+	      else if (key == SDLK_DOWN)
+		{
+		  demo_countdown = START_DEMO_COUNTDOWN;
+		  
+		  cmd++;
+		  
+		  if (cmd >= NUM_CMDS)
+		    cmd = NUM_CMDS - 1;
+		}
+	      else if (key == SDLK_UP)
+		{
+		  demo_countdown = START_DEMO_COUNTDOWN;
+
+		  cmd--;
+		  
+		  if (cmd < 0)
+		    cmd = 0;
+		}
+	      else if (key == SDLK_RETURN)
+		{
+		  done = 1;
+		}
+	    }
+	  else if (event.type == SDL_MOUSEBUTTONDOWN)
+	  {
+            /* Mouse click: */
+	
+	    if (event.button.x >= left &&
+	        event.button.x <= left + width &&
+		event.button.y >= images[IMG_TITLE]->h + 8 &&
+		event.button.y <= (images[IMG_TITLE]->h + 8 +
+		                   NUM_CMDS * images[IMG_TUX_HELMET1]->h))
+	    {
+	      cmd = ((event.button.y - (images[IMG_TITLE]->h + 8)) /
+	             images[IMG_TUX_HELMET1]->h);
+
+	      done = 1;
+	    }
+	  }
+	}
+      
+      
+      /* Erase Tux (cursor) */
+      
+      if (cmd != old_cmd)
+	{
+	  blinking = 0;
+	  
+	  
+	  dest.x = left + 4;
+	  // dest.x = 32;
+	  dest.y = (images[IMG_TITLE]->h + 8 + 
+		    (old_cmd * images[IMG_TUX_HELMET1]->h));
+	  dest.w = images[IMG_TUX_HELMET1]->w;
+	  dest.h = images[IMG_TUX_HELMET1]->h;
+	  
+	  SDL_FillRect(screen, &dest,
+		       SDL_MapRGB(screen->format, 200, 232, 255));
+
+	  playsound(SND_POP);
+	}
+      
+      
+      /* Handling Tux (cursor) blinking: */
+      
+      if ((rand() % 50) == 0 && blinking == 0)
+	{
+	  blinking = 6;
+	}
+      
+      if (blinking > 0)
+	blinking--;
+      
+      
+      /* Draw Tux (cursor) */
+      
+      // dest.x = 32;
+      dest.x = left + 4;
+      dest.y = images[IMG_TITLE]->h + 8 + (cmd * images[IMG_TUX_HELMET1]->h);
+      dest.w = images[IMG_TUX_HELMET1]->w;
+      dest.h = images[IMG_TUX_HELMET1]->h;
+      
+      img = IMG_TUX_HELMET1;
+      
+      if (blinking >= 4 || (blinking >= 1 && blinking < 2))
+	img = IMG_TUX_HELMET2;
+      else if (blinking >= 2 && blinking < 4)
+	img = IMG_TUX_HELMET3;
+      
+      SDL_BlitSurface(images[img], NULL, screen, &dest);
+
+      SDL_Flip(screen);
+
+
+      /* Handle demo countdown: */
+
+      if (demo_mode)
+      {
+	demo_countdown--;
+
+	if (demo_countdown == 0)
+	{
+	  cmd = CMD_GAME;
+	  done = 1;
+	}
+      }
+
+      
+      /* Pause (keep frame-rate event) */
+      
+      now_time = SDL_GetTicks();
+      if (now_time < last_time + (1000 / 20))
+	{
+	  SDL_Delay(last_time + (1000 / 20) - now_time);
+	}
+    }
+  while (!done);
+  
+  
+  /* Return the chosen command: */
+  
+  return cmd;
+}

Added: tuxmath/trunk/src/title.h
===================================================================
--- tuxmath/trunk/src/title.h	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/title.h	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,32 @@
+/*
+  title.h
+
+  For TuxMath
+  The title screen function.
+
+  by Bill Kendrick
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+      
+  August 26, 2001 - August 28, 2001
+*/
+
+
+#ifndef TITLE_H
+#define TITLE_H
+
+enum {
+  CMD_GAME,
+  CMD_OPTIONS,
+  CMD_CREDITS,
+  CMD_QUIT,
+  NUM_CMDS
+};
+
+int title(void);
+
+#endif

Added: tuxmath/trunk/src/tuxmath.c
===================================================================
--- tuxmath/trunk/src/tuxmath.c	2006-01-26 20:48:08 UTC (rev 3)
+++ tuxmath/trunk/src/tuxmath.c	2006-01-26 20:51:19 UTC (rev 4)
@@ -0,0 +1,56 @@
+/*
+  tuxmath.c
+
+  Main function for TuxMath
+  Calls functions in other modules (eg, "setup", "title", "game", etc.)
+  as needed.
+
+  Source code by Bill Kendrick, New Breed Software
+  bill at newbreedsoftware.com
+  http://www.newbreedsoftware.com/
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.org/
+  
+  August 26, 2001 - August 28, 2001
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "setup.h"
+#include "title.h"
+#include "game.h"
+#include "options.h"
+#include "credits.h"
+
+
+int main(int argc, char * argv[])
+{
+  int cmd, done;
+
+
+  setup(argc, argv);
+  
+  done = 0;
+  
+  do
+  {
+    cmd = title();
+
+    if (cmd == CMD_GAME)
+      done = game();
+    else if (cmd == CMD_OPTIONS)
+      done = options();
+    else if (cmd == CMD_CREDITS)
+      done = credits();
+    else if (cmd == CMD_QUIT)
+      done = 1;
+  }
+  while (!done);
+  
+  SDL_Quit();
+
+  return 0;
+}
+




More information about the Tux4kids-commits mailing list